Saturday, 13 December 2014
Wednesday, 20 August 2014
Synopsis of Articles Read Throughout Time
I often find myself drawn to reading articles of varied topics, but sometimes at a loss to recall the content of most. Here is a living collection of links, ideas, and thoughts of the articles and interests of my life. I hope to bring some organization to the chaos that is my reading habit.
Aug 20, 2014:
Aug 21, 2014:
Aug 20, 2014:
- $2.5 billion dollar shoe box of LSD, and the value of various objects: http://what-if.xkcd.com/108/
- De Beers fixed the prices of diamonds for over 60 years to gain a ridiculous monopoly. People fought back and won: https://en.wikipedia.org/wiki/De_Beers_Diamonds_Antitrust_Litigation
- Metabolites are injected to see their effect of pain/fatigue on muscles - turns out 'going lactic' during intense workouts is more complicated than just lactic acid: http://www.runnersworld.com/general-interest/what-causes-muscle-pain-during-hard-exercise
- SalesForce is a highly innovative company with a kickass CEO named Mark Benioff. He's a visionary leader who doesn't refer to their product as a CRM, but as a Utility, like water or electricity. This article outlines Salesforce's innovation techniques: http://www.forbes.com/sites/alexkonrad/2014/08/20/marc-benioffs-innovation-secret/
- The fastest man-hole cover ever was the result of an underground nuclear explosion. It was ejected from earth at 66km/s, which is awesome and hilarious at the same time. http://qr.ae/5HeEY
- Elon Musk is my hero, and a huge inspiration to me. This outlines his dark times and bright future in a 13 minute chunk of a 60 minute interview: https://www.youtube.com/watch?v=dvz1kWLMGm4
Aug 21, 2014:
- Was the iPhone 5C the biggest flop in Apple history? I found this title intriguing given that I didn't know the 5C was even considered a flop. Here's the Quora answer to this question: http://www.quora.com/Was-making-the-iPhone-5C-one-of-Apples-biggest-flop-product-ideas
Here's a statistics blog highlighting the number of units sold of each type: http://www.statisticbrain.com/iphone-5-sales-statistics/ It's not a flop (I'd be proud of selling 2.6million anything), but it's not the raging success it was hoped to be. - The previous post opened me up to the cool site http://www.statisticbrain.com/ Great place for random stats and interesting facts.
- Alan Watts can be heard quoted in many Youtube videos (even the occasional electronic song), but to hear his stream of thoughts in his Conversations with Myself series is quite something: https://www.youtube.com/watch?v=8aufuwMiKmE This came up after telling a coworker about Richard Feynman.
September 5, 2014
- http://www.huffingtonpost.ca/diane-francis/chinese-money-laundering_b_5664319.html?utm_hp_ref=canada-business - billions of dollars leave China undetected though corrupt officials and shady businessmen, happening since 2002.
Thursday, 19 June 2014
Handler Service for dynamic Javascript
We're creating a great app for photographers to easily sell their works online, with orders fulfilled by the PNI network - how awesome would it be to 'purchase' a print from my dad, and pick it up from Costco? Pretty rad. Especially if all he has to do is drop one line of javascript on his page.
To accomplish it this succinctly I had to build a dynamic javascript page which would allow the intake of an api-key from the users site. Now, I am aware that the big guys at Stack Overflow accomplish this with a JSON object and using
If you have IIS6.0 (I did not, but that took a bit of fiddling to find out):
If you have IIS7.0 You'll notice that the parent node is
If you want to know more about what
I found that if I removed the '.js' file extension, I would get an error page saying "JavascriptHandler not found in this assembly" but it -had- to happen that way... So I queued the music, and got to work.
I eventually found a blog post on exactly what I needed: "Extension-less Routing" This resource and explanation is so well put and apparent (after the fact) that I will leave it up to you to read and enjoy. Spoiler alert: It's a bug in IIS of the mappings of "*." Kind of takes the edge of spending the morning on this.
tl;dr - To get a url like www.example.com/FooHandler/ to run a Handler, go here and apply the hotfix.
Till next time - Find me on Twitter to say hello and ask a question about my ongoing developments
To accomplish it this succinctly I had to build a dynamic javascript page which would allow the intake of an api-key from the users site. Now, I am aware that the big guys at Stack Overflow accomplish this with a JSON object and using
StackOverflow.init({JSON_MADNESS}) kind of tag - but I need this to be fool proof and "pretty" so that someone like my dad wouldn't be afraid of it's length. I think this would go a long way to improving uptake. Also, Shane told me I couldn't do it that way. Lousy EA's.
So I needed to build a script that would output the required javascript to the users page, why the heck not? Here's the (naive) flow of how I tried to accomplish this:- Append a '?' string of variables to the javascript tag. Immediately dismissed as silly after trying to think of how to get the variables from the js file (uh... location? script name? parsing?). If it could be done, I didn't want to waste time coding it into submission.
- Pretty please can I use a JSON object? No? Fine.
- A C# Handler whose call would look like
"ourapi.url.com/JavascriptHandler/MrHudsonsAPIKEY"Beautiful; I'd even used an implemented code with our Google Glass app so I'd have a reference application
- Make sure your project solution has the App_Code folder. If not, simply right-click your project name and find the Add > Add New ASP.Net Folder > App_Code
- Right-click the App_Code folder and select Add > Generic ASP.NET Handler to create a new file. Call it what you feel appropriate; for my project I called it JavascriptHandler
- In the created method stubs, know that
ProcessRequest(HttpContext context)is the called method when the user hits the appropriate URL, so this is where your Handler 'starts.'
If you have IIS6.0 (I did not, but that took a bit of fiddling to find out):
<system.web> <httpHandlers> <add verb="*" path="foo.js" type="JavascriptHandler"/> </httpHandlers></system.web>
If you have IIS7.0 You'll notice that the parent node is
system.webServer this time:<system.webServer>
<handlers>
<add verb="*" path="foo.js"
name="JavascriptHandler"
type="JavascriptHandler"
allowPathInfo="true"/>
</handlers>
</system.webServer>
If you want to know more about what
verb, path, type all mean, read the Microsoft documentation (sorry, can't find the exact link at the moment).I found that if I removed the '.js' file extension, I would get an error page saying "JavascriptHandler not found in this assembly" but it -had- to happen that way... So I queued the music, and got to work.
I eventually found a blog post on exactly what I needed: "Extension-less Routing" This resource and explanation is so well put and apparent (after the fact) that I will leave it up to you to read and enjoy. Spoiler alert: It's a bug in IIS of the mappings of "*." Kind of takes the edge of spending the morning on this.
tl;dr - To get a url like www.example.com/FooHandler/ to run a Handler, go here and apply the hotfix.
Till next time - Find me on Twitter to say hello and ask a question about my ongoing developments
Thursday, 5 June 2014
Entity Framework EF6 and Debugging Errors
I'm building a geo-location Google Glass app today. I want to compare the Glass's location to a set of lat/lon coordinates from an Entity Framework (EF) database - I'm using C# on MSVisStud2013.
Debugging Errors
A good programmer must have a process to debug errors that do not (at first) make any sense. A skeleton concept I created today after watching a co-worker debug an error is as follows:
Check errors in
Permissions
Files Existence
Structure (and link/reference errors - especially when moving from local to staging environments)
Packages that need to be included (for eg Know where EntityFramework.dll should exist)
Sidebar, the more acronyms and shortened names someone uses, the cooler they are (eg: Banana Republic -> B-Rep. Thanks Paul Thompkins)Entity Framework First things first, I'm using Code-first approach as opposed to Design-First, and most of the config stuff applies to EF6 onwards so make sure you check your version. Here's some musings/learnings/thoughts from this app: Web.config: If you use EF6 you have the option to do Code-Based Configuration, but what I'm wanting to focus on here is the Web.config or app.config file that specifies the DB. Also of note is that your .config file will override any settings you provide in code. With EF6 (and simple LocalDB or SQL Express setups) your configuration is auto-generated, so when you look online to find help, don't pay attention to the suggestions to add <connectionStrings> tags to connect your db! This is taken care of in the generated <entityFramework> settings.
Debugging Errors
A good programmer must have a process to debug errors that do not (at first) make any sense. A skeleton concept I created today after watching a co-worker debug an error is as follows:
Check errors in
Permissions
Files Existence
Structure (and link/reference errors - especially when moving from local to staging environments)
Packages that need to be included (for eg Know where EntityFramework.dll should exist)
Subscribe to:
Comments (Atom)