Friday, January 16, 2015

.NET Core and friends

With all the hullabaloo around .NET Core, I thought I'd dig in, try it out and see what all the fuss is.

It's taken a bit of effort to cut through the hype and get to the meat of what it is, and what it is expected to be.  Here's the no-nonsense version, based on a few hours of experimentation:

What .NET Core is today:

* A modularized .NET framework whose libraries are acquired through NuGet
* The newest way to do your ASP.NET apps
* A gateway to using .NET Native, for machine-compiled code instead of JIT
* An adoption by MS of many Mono sources and open source in general for .NET

What .NET Core is also today, 

but might/should be categorized under a different name depending where you read:

* A new project file structure focusing on "kproj" and Project.json
* Aforementioned new structure facilitates targeting any combination of multiple .NET frameworks within one project file (yes!)
* A way to do very nifty console apps which demonstrate the power of above multitargeting, with zero relation to ASP.NET or .NET Native

What .NET Core isn't, today:

* A fully functional replacement for current mature .NET Frameworks.  .NET Core is missing many support libraries, such as System.Transaction
* A Client-friendly entity.  No WPF for .NET Core yet, based on what I read.

What .NET Core promises to be in the future:

* The foundation for all upcoming .NET Frameworks
* A unifying force bringing together things like .NET CF, Silverlight, Windows 8 API, etc.
* Cross platform to Linux, Mac OS as well as Windows

What .NET Core promises to be today, but I can't figure the @#$! out:

* A way to build "regular" .NET projects as well, but referencing "regular" .NET Framework libs (like System.Transaction... or any of the others) is darned mysterious
* Can utilize PCL and SHPROJ projects.  Can't find a way to make SHPROJ works

Thoughts

I'm damned excited.  Multitargeting within the confines of csproj files is a disaster area, and SHPROJ helps a lot, but it's still just awful with the way packages.config and repositories.config all collide with each other.  The .NET Core revamped project structure promises to solve all that




Saturday, December 21, 2013

Nexus 5 GPS repair howto & pictures

Some people are experiencing inaccurate GPS on their Nexus 5.  I and my friend were two such people.

Apparently the GPS antenna has a weak physical connection point within the phone.  After watching some youtube videos (http://www.youtube.com/watch?v=K1-uCIb-t8I) and (http://www.youtube.com/watch?v=QBpNtWvY454), I tried it repairing this myself.

While extremely helpful (thank you guys!) the videos left out some important factors and image quality could be better.  The photos here aren't exemplary, but the quality is high enough to remove ambiguity.

Items you will need:

- strong, thin plastic wedge.  I used a guitar pick
- card stock.  check your junkmail
- electrical tape
- very sharp knife or jeweler's flathead screwdriver

DISCLAIMER: I am not an authorized repair technician, and am not liable if your phone turns into an internet meme, supermodel, ball of flame, or other unintended result.  Proceed at your own risk!

On to the repair:

#1 Removing the back

Removing the back there are two things to know:

a.  Don't use a knife.  You want something plastic otherwise you'll damage your back case.  I used a heavy-weight guitar pick, worked like a charm.

Bottom adhesive
b.  Some devices have adhesive near the bottom, requiring extra force to pull out.  Mine took an uncomfortable amount of force which resulted in a slight permanent bend in the back.  Ultimately I "cut" the adhesive slowly with the guitar pick, had I done this earlier the bend would not have happened.  Use your own judgement here, it will be obvious if it's bending too much.

c. There's another issue with the adhesive, but we'll get to that later

#2 Lifting the contact

The offending contact is glued down and delicate, so be gentle.

a.  Use a very tiny flathead screwdriver from a jeweler's set, or a very sharp knife (not a butter knife) to carefully lift the antenna contact from the back.

b.  You don't need to lift it so much that it flaps like in the video, just enough to slip 1mm of cardboard underneath.

#3 Prep and place the cardstock

The cardstock provides a shim in which to push the contacts more forcefully from the phone into the GPS antenna.

This is the focal point of the repair.

Any thinnish cardstock will do.  We're only looking to raise the contacts about 1 mm.  I cut up some junkmail, worked like a charm.  You only need a tiny piece, well under 1 cm square, so put down that honkin' refrigerator box.


The pictures make it appear that the cardstock is folded in two, but it is not.  It is one small, flat piece.

Yeah, my tape is janky.  It works, dammit
#4 Taping it down

The cardstock has a bit of free play in there, so we need to secure it with some tape.  Not much is needed, just enough to keep it from moving about.
Don't use too much cardboard or tape, because the bulk will lift the rear and cause other contacts to lose connection, namely the wireless charging contact.

#5 Putting it back together

If your device had no adhesive, then you're good to go, snap it all back together - it's easy

If your device has adhesive at the bottom, you may want to remove it.  It can bunch up and cause a minor lift of the rear case, nullifying your work and also causing problems for other contacts.  My wireless charger stopped working until I scraped it off.  I suggest leaving it on and trying things out, and only remove it if you have to.

Scraped off adhesive



wireless charger contact








Conclusion

Afterwards, GPS appears to be improved slightly.  Locks seem to happen a bit faster and to more satellites.

Accuracy seems to be improved by about 5-10 ft.  Too soon to tell, but it seems like there's less drift and no more "compass freakout"

I'll need more time with the unit to say whether it made a sizable difference or not, but initial results are positive.






Saturday, September 1, 2012

Tapp and NFC payments for the masses

If you own an NFC equipped Android phone but have been left out of the Google Wallet fun, check out Tapp . Finally, almost a year after buying my i777 today I was able to buy something with NFC!

Saturday, August 18, 2012

Android, AOSP, Cyanogenmod and life

So I own an AT&T Galaxy SII i777 I can't say enough good things about this device. Nearly a year and a half old, it still kicks the ass of most devices people have in their pocket. It's fabulous

After hemming, hawing and complaining about the carrier's lack of interest in keeping old (but very capable) phones updated with the newest version of android, I took matters into my own hands.

I've been a longtime fan of CyanogenMod and its close relative AOKP. I happily ran AOKP ICS for a while (task650 variant), cheerfully bragging to my oblivious iOS pals about how behind they were.

Well with Google's Jellybean release, the AOKP front has been silent. And the Cyanogenmod (v10) activity is present, but just beginning. But I said to myself, "I'm a developer, I don't have to wait!". So I've been compiling my own CM10 builds. You can find it here.

Yet more opinions..

But my point wasn't to brag so much about that really nifty XDA thread I posted. That's just a happy accident. The real focus was to go on record and say how awesome android development is. I've tried my hand at Windows Mobile, iOS even a tiny bit of Palm OS back in the day. There's no comparison. Android blows them all away. And I don't say this lightly. I am a self-admitted Microsoft lackey, with a deep and passionate love affair with the .NET framework.

When it's good, it's good. And developing on Android is great.

I'm not loving the AOSP build process, but I see the necessity to its complexity. But as far as the OS and apps are laid out, it follows my #1 most important rule of development: predictability. Things are where you expect them to be. And if they aren't, once you learn a bit, you say - AH, that's a good place for them.

Upping the ante

So now that I've been running my own builds for a while, I've learned a few things. Enough to start tweaking some of the inbuilt CyanogenMod apps. Namely, I've had my eye on DSPManager for a long long time. It's not a major thing, but I've always been annoyed that you couldn't switch your EQ curve/audio profiles easily.

So, I've started a github repository and am once again taking matters into my own hands. My ultimate goal is to get it into the official build, but I have a lot of learning to do between now and then.

Friday, May 11, 2012

More jQuery validation shenanigans

Here's my latest custom rule for doing regex within jQuery validation. Lifted & modified from stack overflow.  Not doing a whole lot, but super useful:


/*
* Malachi Burke.  
* (c) 2012 Apprentice Lib
*/
// http://stackoverflow.com/questions/280759/jquery-validate-how-to-add-a-rule-for-regular-expression-validation
$.validator.addMethod(
        "regex",
        function (value, element, regexp) {
            var options = "";
            if (typeof (regexp) != "string") {
                options = regexp.options;
                regexp = regexp.match;
            }
            var re = new RegExp(regexp, options);
            return this.optional(element) || re.test(value);
        },
        "Please check your input."
);
Using it is like:
fieldName: { required: true, regex: { match: "your regex string" } }

Saturday, April 21, 2012

jQuery validation plugin per-field AJAX

UPDATE: sigh. after looking for solutions, not finding any, making this one... I stumble across:

http://stackoverflow.com/questions/4687492/ajax-validation-using-jquery
http://docs.jquery.com/Plugins/Validation/Methods/remote#options

Now I'm gonna read up on those..
----

Well after tinkering around a bunch with jQuery validation plugin, I managed success doing AJAX validation per field, vs. over the whole form.  There's lots of buggy example code out there, they suck.  This one works - albeit ugly:

 $(function() {   
     var response;  
     var retrigger = 0;  
   $.validator.addMethod("uniqueUserName", function(value, element) {  
     if(retrigger == 1)  
       return true;  
     $.ajax({  
       type: "POST",  
       url: "/TestHandler.ajax.axd",  
       data: "ajaxPost="+element.ID + "&value="+value,  
       dataType:"html",  
       success: function(msg)  
       {  
         response = (msg == 'True') ? true : false;  
         retrigger = 1;  
         $("#contact-form").validate().element("#Middle");  
         retrigger = 0;  
       }  
     })  
     return true;  
   }, "Username is Already Taken");  
   $.validator.addMethod("uniqueUserName2", function(value, element) {  
     return response;  
   }, "Username is ALready Taken2");  
   var test2 = $("#Middle");   
   //var test2 = $("#contact-form#Email");   
   test2.rules("add", {  
     uniqueUserName: true,  
     uniqueUserName2: true  
   });  
 });  

So the basic concept is to allow jQuery validator plugin to manage all the focus/keyup etc. events and call us when we're really interested in validating something.  Most code examples out there do the "uniqueUserName" but not the "uniqueUserName2".  Long story short, AJAX is a 2-step process - the callback comes much later, so "uniqueUserName2" is our placeholder for that.

Flow goes as follows:


  • You type something
  • uniqueUserName validator runs and kicks off AJAX request.  It always succeeds in validation, so it's kind of a dummy just to kick off the request
  • at some point, the AJAX success function runs.  We set our retrigger to 1 and brute force validation again on the same field.  
  • uniqueUserName validation runs again but this time we abort out before making the AJAX call - still returning success.  Without this retrigger check, you'll keep sending AJAX requests forever.
  • finally, uniqueUserName2 is evaluated and it is patiently waiting around with the results of our last AJAX response.  
There are some good jQuery validation frameworks out there, this one in particular actually appears to be the least 'developed' featurewise, but its extensibility is hard to beat.  Some other good ones I found are:

and

Validation Engine looks really powerful, but I felt constrained by how to present the errors - although his error reporting is perfectly adequate.

Valid8 also looks powerful, but I wasn't confident it was being maintained 

Worth mentioning are both of these actually tout AJAX support, where jQuery validation plugin does not.  But as you can see it's a little clunky but not too difficult to get it working.  

Oh Javascript.  It's like writing untyped C code all over again.... and not in a good way.

Tuesday, April 17, 2012

Apprentice Open Source Edition now available!

After much deliberation, I've decided to piecemeal Apprentice out into the open source community. Certain elements will remain top secret and/or closed - but some juicy goodies are now free and available.  Starting small, but I will be revealing more features on a fairly consistent basis.

Check it out here: https://github.com/malachib/Apprentice

Included presently are:
  • IoC Cache Facade
  • Logger & Logger facade
  • Initializer 
Coming soon:
  • IoC Cache Facade implementations for ASP.NET, Memcached and MSEL