Malachi
Monday, November 7, 2016
.NET Core Authentication: a taste of what's to come
The latest endeavor has been to get OpenID Connect to work in 2 directions with ASP.NET Core:
1. Web API server authenticates via JWT thru a Xamarin Android app
2. Regular browseable web pages authenticate via OAuth2/OpenID Connect cookie (I don't fully understand it either but it works!)
Scenario 1 is important because mobile and maybe desktop apps can use this standardized JWT format for API calls in lieu of the likely-proprietary cookie format
Scenario 2 is important because for your web users they want SSO like behavior, which cookies plus OpenID connect provide (i.e. the "sign in with google" button we're all accustomed to seeing)
Importantly, both scenarios are working with Google Sign In. Thus, in theory, no new account registration required anywhere to be authenticated - presuming you have a Google login of course ;)
I plan to provide example code of how to do all this & understand most of it. It took a lot of digging around to make it all work!
Tuesday, May 17, 2016
Debian + ASP.NET Core 1.0 RC2 + AngularJS 2
Since he (she? they?) has gone into excellent depth, I'll only cover what I did differently to get it to work in a non-Windows environment (spoiler alert: not much!)
ASP.NET Core 1.0 RC2
Yeoman
To create ASP.NET boilerplate code, we use Yeoman (installed via npm). Type:yo aspnet
Then Choose "Web Application" because conveniently enough, MVC now is Web API with ASP.NET Core!
Check this page for installation tips: https://docs.asp.net/en/latest/client-side/yeoman.html#install-node-js-npm-and-yeoman
Visual Studio Code
- C# syntax error highlighting
- assist with "using" statements
- Integrated debugging - although I lucked out and didn't need it, it does work very well and having that on tap has a value which cannot be overstated
Building Visual Studio Code ... from code
Most folks will install direct from a download, but if you're like me and want to build vscode from source, be advised - I found no "install" mechanism when building Visual Studio code.For convenience, after building Visual Studio Code I made a $PATH discoverable symlink called "vscode" to easily start it anywhere. I suggest you do the same
.vscode folder & tasks.json
- launch.json - among other things, this feeds the debugger for what configurations you'd like to launch & debug
- tasks.json - when using vscode's integrated build feature (ctrl-shift-B on non Macs) it reaches out to this file to determine what to do.
gulpfile.js
Don't forget, Visual Studio isn't here to help you with gulp tasks, so you'll have to run them manually (you'll want to run gulp copy-deps and gulp min) after you've done a proper npm install. Remember, a proper npm install won't work until your package.json is sorted out.
package.json
Results
Friday, January 16, 2015
.NET Core and friends
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
Saturday, December 21, 2013
Nexus 5 GPS repair howto & pictures
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:
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 |
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 |
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
Saturday, August 18, 2012
Android, AOSP, Cyanogenmod and life
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
/* * 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" } }