Sunday, February 16, 2014

Localstorage using AngularJS

I found a really nice demo app (and associated .js file as a service) at

Unfortunately when I went to update my app recently, I noticed that my localstorage was getting clobered for some reason.

I after bringing up the debugger and stepping through, I found out that when the $watch was being called on the demo values, it was passing value as a null value. Now as to why this was happening I don't know, however to fix it I reverted from $watch to ng-change, so here's how.

(if you're literally using his page identically, then do a view page source and we'll move from there):
Here is the before:

And here is the after:
I added an ng-change attribute to the input field. Then in the controller, I added a call to update the variables we want to use, and added a function called change, inside that function I attempt to store the data (as before) and update the variable we are using for our text (as before).

If you've been having problems getting localStorage to work hopefully this will get you moving along.

Monday, February 10, 2014

5 ways to think more like an Engineer

1. Read Technical Documentation.
If you write software, read about new languages, or techniques. If you design buildings, learn about new techniques, materials.

2. Read Context Documentation.
Understand your customer, when you see the pain points of customers, you can understand better how to solve the problems they are experiencing.

3. Think Wider.
If you are trying to solve a problem, try to solve it in more than one way. Aim to meet the same end result with each option. Look at how each can work for and against your end goal.

4. Be social, share
Talk to other engineers, particularly others that are always furthering their knowledge, sometimes you'll find that they understood a subject differently than you, which is good, this gives you another view. Also if you share stuff you build, you might find others are interested in helping out, and show you new ways to solve your current problems.

5. Test your assumptions.
Create a hypothesis about everything you do, and then prove your hypothesis is correct. Do this one day a week. Whether its writing code, simulating the tensile strength of a set of materials you're considering using. Find ways to prove that your understanding of the system is right, even if you are 'certain' you're right. See if you can 'break' what you thought was a certainty.

Good luck, do you have any other ideas of How to think more like an engineer? Share them in the comments.