AngularJS Is For Real

Using web technologies is a roller coaster experience. New things roll out every week. That can be very exciting and fun, actually. Always learning. Reinventing. However, I can’t totally keep up with it all so I have to choose my focus from time to time. Right now I choose AngularJS. I don’t know that AngularJS is totally the future, but the direction AngularJS it is taking with HTML data binding totally is. I think.

AngularJS_logoI’m currently working on a small AngularJS project — a product order form, with API’s to PayPal, etc. So far I am loving Angular and I think it has a big future. Here is why:

  • Reason 1: It can be simple. It’s like when I first learned HTML. It was attractive because you could do something simple right away, knowing just a little about it. AngularJS is like that — and it is integrated right into HTML. However, it’s not totally simple. If you want to go very far with AngularJS, you’ll need to be JavaScript savvy, and yet the JavaScript is more like glue than the actual app, so code redundancy is reduced because Angular does so much — invisibly!
  • Reason 2: It is comprehensive. Unlike HTML alone, AngularJS really can do everything without additional tools. AngularJS scales well and supports a robust MVC design paradigm. It just depends on how far you need to go with it.
  • Reason 3: It is well supported and extremely well documented. Even the best tool can fail to gather broad support if there is a lack of resources behind it. AngularJS is supported by Google so that should be no issue. Google has created a winner.

iPad 4 Review

I purchased a 64 GB WiFi only iPad 4 about a month ago to replace my “old” iPad 1. Both of my iPads are black and at first glance one would hardly see the difference. There is a positive difference in functionality though and I’ll just mention my impressions and not get into much technical detail.

First of all, the “Retina” display on the iPad 4 is AMAZING – just as good as magazine printed text and sometimes better.

Also now I can now keep more apps in memory (without restart) because the iPad 4 has 4 GB of RAM whereas the iPad 1 had only 256 MB. Then of course there es the processor speed: faster on the iPad 4 and definitely noticeable, however I am not sure how much the extra zippyness is due to the A6X processor and how much to the additional RAM (does it matter?). Both iPads are powerful enough to run video with no problem so the primary speed advantage to me is in browsing the web with the Chrome browser.

Then there is the weight – the iPad 4 feels (and is) lighter. I find now that I use the iPad 4 even more than before (which was considerable) and am starting to even do some actual work on the iPad whereas before I treated it strictly as a consumer device.

Finally, there are the camera’s (front and back). The iPad 1 didn’t have this and I really like having it.

I think the Apple supplied “cover” is both cheesy and over priced. Below is the case I purchased from Amazon.com for about $16.

Accessorise Ultra Slim and Lightweight Leather Case Folio (Black) with
Automatic Wake-up Closure and 3-in-1 built-in Stand for Apple iPad 4 / iPad

iPad Stylii Review

About 5 months ago I came to the conclusion that my fingers are not ideal for the iPad. There are three reasons:

  1. Fingers are too fat. Precision pointing is often required for speed and accuracy.
  2. Fingers are too greasy. Who wants a smeared up, greasy screen?
  3. Fingers are too slow. A pencil or pen provides quicker directional changes.

After reading stylus reviews I narrowed down my choice and picked the Wacom Bamboo Stylus for $25 from Amazon.com. Nicely crafted with aluminum and brass, it has good heft and balance and is quality made — but it is a horrible stylus for the iPad. Oops.

So I tried again. This time I choose the “Universal Touch Screen Stylus”, also from Amazon.com at $2.50 for a 3-pack. Much better and here’s why:

  1. Price: No comparison. The current price for the Universal is $1.05 for a 3-pack.
  2. Weight: Turns out weight is not your friend. The Universal is much much lighter, faster, and less tiresome over time.
  3. Size: Smaller is better for “poking” the screen, which is what you mostly do with an iPad. The Universal is just right. The Wacom too big.
  4. Rubber tip: Firmer is better. The Wacom has a “flat tire” feel to it. I want to be able to jab the screen without hitting the rims!
  5. Rubber tip:  Slipperier is better. The Wacom has more “grip” and thus is the inferior choice for handwriting and art apps. The stylus needs to slide like a pencil, not stick and grab. The Universal is better at this, but not perfect
  6. Capacitance: Stylii work with a small electrical charge. It’s is easier for current to flow through a little metal rather than a lot of metal. The thin shelled Universal wins again. It is more reliable in registering screen taps
  7. Peace of mind: stylii are like pencils – easy to misplace or lose. With three super inexpensive Universals, I can spread them around and don’t have to worry about it. The $25 Wacom is always a worry.

Well there you have it. My opinion. Sometimes the less expensive product is better!!

Wacom Bamboo
Wacom Bamboo
Stylus

Universal Touch
Screen Stylus

GUI For PICK Solved

Years ago, even before I graduated from BYU in Computer Science, my first computer related job involved the PICK operating system. Very fortuitous, as it turned out, for it lead to a long term position at ADP Inc, now an 8 billion dollar company in annual sales. The PICK system is a marvel and that is why it is still very much alive and active in the world of business computing. Today it is called a MultiValue NoSQL type database system. There are multiple flavors, all based on the “Microdata REALITY” original: Reality, CoRA, NorthGate, jBase, and Universe are some varieties that I have used.

Originally, MultiValue systems used character based terminals and, later, PC based terminal emulators for the user interface (UI). With the advent of Macs, PC’s, and then the web, it became a little embarrassing from a marketing perspective for companies with MV systems to continue on with character based (green screen) interfaces. Most MV systems are extremely robust and efficient so they end up running a lot of intricate business processes on the back end. Over the years MV legacy systems grow to such complexity that it is cost prohibitive and almost impossible to replace them with “modern” relational databases and GUI systems, which, when compared to legacy MV systems tend to be “all hat and no cattle.”

ADP tried to replace their MV systems (CoRA) several times by re-writing it into a 3-tiered GUI system — and failed. Eventually, they punted and developed “Web Suite” which simply overlayed a graphical screen directly on top of existing character based screens. This allowed them to continue with all the old underlying software and architecture and introduce a somewhat graphical look and feel. Ingenious really, but not as capable as a modern GUI should be. Lipstick on a pig really, but good enough.

All companies with MV systems have struggled in a similar fashion because MV systems do not have a built in communications layer that works seamlessly with internet based communications. My current company, Columbia Ultimate, has also searched for a good solution to this problem. Finally, after all these years, the problem has been solved. A company called Bluefinity International has created a product called MV.Net that lets MV/Pick communicate on the network in the native way: using the telnet protocol. The end result is a browser running a Silverlight (C#) based GUI that talks directly to the MV back end. It works beautifully and, yes, MV programming is required to separate the obsolete UI code from the business logic code — not a minor task, depending on how many functions are moved over — yet it’s doable and at the same time tends to simplify MV systems significantly.

The problem in the MV/Pick world that has existed since Windows 95 has finally been solved in a quality way.

New Macbook Air

To support Mac OS X development, I purchased the 64 bit MacBook Air 13″ last week. I have not been disappointed as it is just plain faster than any computer I have ever used or seen. Blistering fast. I would have chosen the MacBook Pro if I had a spare $1000 to throw at it but I am happy with the Air. The smaller form factor has it’s advantages and it’s actually newer generation hardware than the Pro right now. I told one person the Air was so thin I could cut cake with it. He laughed and suggested maybe I could chop wood. I don’t think I’ll try that.

However, I had some interesting little glitches early on, so I just thought I would share since others might have the same… Since I need both Windows and Mac OS, I decided to install Windows via Boot Camp. I considered Parallels or VMWare VM (Virtual Machine) but decided that, as a developer, I won’t be switching that often. I’ll spend long periods in each OS and I like the idea of running natively. Besides, Mac OS X boots up in only 8 seconds or so. I can handle that!! Also 4GB of memory is fine for one OS but a bit tight for two. The Air’s memory is not upgradeable because it is soldered in to achieve the ultra thin styling.

I purchased an OEM version of Windows Home Premium as the price is right and I don’t need anything offered by the Pro version for my development or support tasks. Not having a ready external optical drive for installing Windows I decided to create an ISO image on an external notebook drive connected via USB. Didn’t work. I created the ISO image OK but the drive just wouldn’t boot successfully into the Windows start-up via Boot Camp. After some frustration (and vain googling) I gave up on that and just hooked up an internal DVD drive borrowed from a desktop computer. I used an inexpensive USB cable with power supply and it worked like a charm. BTW, I consider a USB to hard drive cable like this one to be simply indispensable to owning a computer. Five dollars. Don’t leave home without it.

The Air has a solid state hard drive and it’s “only” 128 GB and I wanted to leave plenty of room for Mac OS X. When setting up the Windows partition via Boot Camp, it defaults to 20 GB. I thought that should be fine since I don’t need that much and since I’ve read people claim they can run Win7 in 8GB. WRONG. The Windows install itself chewed up 15 GB plus, then after installing Visual Studio C# I had less than 3GB remaining. After a few more installs of essentials, I got down to 1.7 GB left and then — BOOM. Windows would not reboot successfully. It could not be repaired or restored from a restore point either. Dead.

The wild thing is that it damaged the Mac OS X partition also! — and this was just after I got everything set up over there. After going through the Command-R (restore utilities) process without success, I placed a call to Apple and got immediate and friendly help but after some consultation, they confirmed what I already pretty much knew. I was toast.

So, after re-partitioning the drive with the Mac OS repair utility (Command-R at boot-up). I got a chance to try Apples new internet based “no DVD needed” approach to system restores. Worked great, although some patience was required to download the entire OS.

The second time around I partitioned Windows for 50GB, installed Windows 7, and it’s worked great ever since. I consider my MacBook Air to be worth every dime I paid for it and then some. And it’s nice to be leading edge, at least for as long as it lasts…

Simile Bug Resolved!

Simile is a browser app with a great presentation for displaying timelines. See the Simile timeline examples. I first tried Simile at version 1.0 but got frustrated with the many defects it still contained. It’s now at version 2.3 so I thought I would try again but was still stopped by a major defect – it can’t handle BC dates correctly!!

I looked into it and found the issue. Here is an example of what fails:

var objDate = new Date(“Mar 10, 600 BC 01:00:00”);

That’s a major flaw for a timeline app!! The built-in JavaScript date creation fails on BC and negative year dates for Firefox & Chrome but not Internet Explorer (at least IE versions 8 and 9 are OK).

The fix is to first create the desired date object as a non-BC date, then extract the year, make it negative, and finally set the date object to the negative year. I wrote a new function “getDatesBC” to it this way.

Simile coders put in a terrible hack that only allowed BC dates if provided in whole years in the format “yyyy BC”. My fix allows any valid format, including optional month, day, and time and should work for any browser since the exception code is only executed if the date creation fails (therefore IE works just as it did before). The fix is made to the simile-ajax-bundle.js file and is shown below. The parseGregorianDateTime function is re-written and the getDatesBC function is new.

FINAL NOTE: To use BC dates with this fix, specify all dates (including Timeline.createBandInfo dates) in the format MMM DD YYYY BC. Example: Apr 06 0600 BC  or  Apr 6 600 BC. If you leave out the month and day it may still fail.

The compressed code is the original and the non-compressed indented code is the new code for the fix.

SimileAjax.DateTime.parseIso8601DateTime=function(A){try{return SimileAjax.DateTime.setIso8601(new Date(0),A);
}catch(B){return null;
}};
// start of patch
function getDatesBC(myDate) {
  var orig = myDate;
  var isGood;
  try {
    isGood = !isNaN(myDate.getUTCFullYear()); // BC dates may return NaN on getUTC, if non-IE browser.
  } catch (BBB) {
    isGood = false; // BC dates may fail totally on getUTC, if non-IE browser.
  }
  if (isGood) {
    return myDate; // BC date succeeded. Probably IE browser.
  } else {
    var isBC = false;
    orig = orig.replace("B.C.","BC");
    if (orig.indexOf(" BC") != -1) {
      isBC = true;
      orig = orig.replace(" BC","");
    }
    if (orig.indexOf(" -") != -1) {
      isBC = true;
      orig = orig.replace(" -","");
    }
    if (isBC) {
      // BC date failure so special handling here
      if (orig.indexOf(":") == -1) {
        orig = orig + " 00:00:00";
      }
      myDate = new Date(orig);  // Create the date as non-BC date. Should always work.
      BCyear = myDate.getUTCFullYear();
      BCYear = (1 - parseInt(BCyear)); // set the year to negative
      myDate.setUTCFullYear(BCYear); // assign the neg year to the already created date object (this works)
      return myDate; // return the valid BC date object
    } else {
      return myDate; // Date failed for non BC reason so just returned failed date
    }
  }
};
SimileAjax.DateTime.parseGregorianDateTime=function(F){
  if (F==null) {
    return null;
  } else {
    if (F instanceof Date) {
      return F;
    } else {
      F = getDatesBC(F);
      return F;
    }
  }
};
// end of patch
SimileAjax.DateTime.roundDownToInterval=function(E,B,I,K,A){var F=I*SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR];
var J=new Date(E.getTime()+F);
var C=function(L){L.setUTCMilliseconds(0);
L.setUTCSeconds(0);
L.setUTCMinutes(0);
L.setUTCHours(0);
};

Apple and iPad 2

Apple is revolutionizing the computer industry. In many ways it’s the PC revolution all over again and Apple is very well poised to win it all this time around. Their iPad is amazing in many multiple small ways that add up. The one-click purchasing of app, songs, movies, and books is marvelous. I really like reading books and watching movies (with earphones) on the iPad. At the end of the day, it’s really the quality and quantity of apps that leave other other tablets in the dust right now and provide Apple’s total supremacy. And it’s only one simple tap to purchase/install/update and you only have to put in your password once up front. Compare this to PC apps: download it (step 1), where did it go? (step 2), click on the installer (step 3 what’s an installer? says grandma), review a bunch of incomprehensible questions and click next, next (step 4 and 5) and then run the app (step 6, but again, where did it go?). Purchasing a program online is another 6 steps or so (add it the shopping cart, enter your name, enter you CC number, enter the CCID, etc etc). Apple has got this mess solved. For usability, the iPad is a great device for grandma and grandpa on so many levels — they really can’t get themselves into any serious trouble with it. The iPad is also great with 2-3 year old kids. I know this from personal experience and a youtube search is convincing. The iPad apps are typically of great quality and so-o-o cheap, and they come with no chance of malware. My workplace requires anti-virus software on all network devices – except iOS — because malware doesn’t exist with iPads and iPhones and that’s a very very important revolution. Of course, there is no iPad malware because each and every app is pre-approved by Apple before it is made available on an Apple device. Techie’s hate this closed approach but for the general public now-days it’s really a gift — as the average PC Joe is sitting on a boatload of malware. I am writing this on  a dual core Win7 laptop PC. I run a lot of apps and get annoyed at the wait cursor which can sometimes come up for no good reason. No wait cursor on the iPad. In fact, no waiting — at least not perceptually — and no apps ever freeze (i.e. “not responding”) for any reason whatever. Finally, developers are making real money off the iPad through the app store. Just try selling your PC app! Some of the best stuff for the PC has to just be given away and very little money is made unless you are a big corporation that has cornered some part of a vertical market. Not so with the iPad — at least not yet. Computers are leaving the desktop and going mobile. The world is changing.

One another note: The iPad 2 is out in the US and being released internationally in 3 days. It appears to be a worthy successor. The look of the unit is very impressive and much of what I asked for in my last iPad post is now available. Here’s my take on it …

  1. Screen: I was looking forward to a higher res OLED screen. Maybe iPad 3. Meanwhile the display is still very, very good.
  2. Battery: Maintaining the same 10 hours is not an improvement, but still noteworthy considering the lighter, thinner design and additional hardware features (2 video cameras and an HDMI port). Ten hours is passable for now. Again, maybe iPad 3.
  3. Weight: Thinner and lighter is great for book reading. Look forward to trying it.
  4. OS: iOS has been upgraded twice since I got my iPad. Getting  better and better. Great!
  5. Camera: I was expecting iPad 2 with one camera but it comes with two!! Plus both cameras do video. Cool. They’re not high spec cameras by any means, however I am sure they’ll be fine for Facebook social media. Apple hit the target market and kept the overall price the same as iPad 1. Smart move actually.
  6. Memory: Ram memory doubled to 512k for iPad2. However, with the solid state drive on iPad1, plus a very modern OS, I’ve never actually encountered a real “memory problem” on iPad 1 in the traditional PC sense — and I use my iPad with many multiple apps a LOT.
  7. Micro-card reader: They didn’t provide it on iPad 2. I would still like this.
  8. Other: iPad 2 has a gyroscope and a plug and play HDMI video port that works with all apps. Very important features that I overlooked in my last post. I hope to get an iPad 2 ASAP but won’t be a super-early adopter. Nevertheless, I look forward to it!!

Me and My iPad

Yes, I have an iPad and love the thing. It’s a great addition but not a replacement to my regular computer. Still, I use it every day even when I am not on the go. I originally pre-ordered an iPad in March 2010 and was one of the first to receive one. Unfortunately my original iPad had a hardware problem with freezing video but Apple honored their 90 day warranty gracefully and replaced it. That was a confidence builder!

Technology is marching so fast, I already see a host of improvements Apple can make for version 2 of the iPad. Here’s my list:

  1. The iPad screen is a marvelous 160 dpi IPS beauty but it could be better. What I really want is the 360 dpi “retina display” that recently came out on the iPhone. Oh, and I want it to be OLED of course.
  2. 10 hours battery life is much better than I get with my laptop but still not quite good enough, especially since I don’t really get quite 10 hours in actual use. An OLED screen would help here. Also, it’s rumored that there are new battery saving technologies that Apple is considering. This includes capturing energy from Wi-Fi signals and solar energy capture. Great! I want it.
  3. I find the iPad to be a good book reader in many regards except for one thing. It’s too heavy. At 1.5 pounds it’s still too heavy for real convenience. Most of that weight is in the battery size, so that needs to be reduced. 12 ounces would be perfect. To do that Apple will have to lose the big battery and probably some of the aluminum.
  4. The iOS needs a upgrade to add a few convenience features. iOS 4.0 is coming out in November 2010. Great! This means multi-tasking support and ability to actually arrange/categorize desktop icons.
  5. The next iPad needs a camera. The same or better than the current iPhone 4 camera would be great! What’s really nice about the idea of an iPad camera is the size of the photo preview screen. iPhone 4 camera specs:
    • 5.0 Mpixels (2592 x 1936)
    • 1/3.2″ back-illuminated CMOS sensor
    • 4:3 aspect ratio
    • 35 mm film camera crop factor: 7.64
    • Low ISO 80 (or better)
    • 3.85 mm lens focal length
    • f/2.8 lens aperture
    • Autofocus: tap to focus
  6. The iPad also needs more memory. 256K just won’t cut it for long. Fortunately at present, the memory limitations do not slow it down, largely thanks to the solid state hard drive I imagine.
  7. Finally, the iPad needs a micro-card reader. Right now it’s just too difficult to get data in and and out over wi-fi networks. It’s not Apples fault but there is just too much security and inconvenience to worry about so everyone needs a quick and easy way to exchange and backup data.

Well, that’s all I want. I am not asking too much am I? I would like all this on the anniversary of the first iPad – April 1.

😉

Ripples

Ripples is what I call the brownish graphics pattern seen at the head of this blog. The Ripples graphic is based on the formula for a circle (z = y2 + x2). The actual formula is:

IntegerResult = (OffSetY + (Y * Param1)2) + (OffSetX + (X * Param1)2)

where X and Y are pixel coordinates. Param1 has a value of 1 so that we get a circular (not an oval) pattern. OffSetY and OffSetX are the number of pixels to shift the pattern (not the whole picture) horizontally and vertically. OffSetY and OffSetX are both zero in this case. Each pixel is calculated one at a time, left to right, top to bottom.  Given the default values for OffSetX, OffSetY, and Param1, we can rewrite the formula as:

IntegerResult = Y2 + X2

So the only purpose of the formula is to determine if a given X,Y pixel gets a color and, if so, what that color it will be. The modulo value of IntegerResult determines the color of the pixel at coordinates X,Y like this: Each pixel color is assigned for prime numbers 2, 3, 5 etc, whichever is first evenly divisible into the IntegerResult. In this case, if IntegerResult is divisible by 2 then the current X,Y pixel is assigned the color black. If the IntegerResult is divisible by 3 (but not 2)  then the current X,Y pixel is assigned the color brown. If the IntegerResult is divisible by 5 (but not 2 or 3) then the current X,Y pixel is assigned the color dark green. If the IntegerResult is not evenly divisible by 2, 3, or 5 then the X,Y pixel is assigned the background color, which in this case is a brick red.