Thursday, October 6, 2011

No More Steve

I started out as a PC user with DOS 2.16 or some really early version like that running on a 386 back in high school, and used the old 5.25" floppy disks for storage. As a sophomore in college my roommate had an Apple II that we used to write papers on. I used to take money (or beer) to type up papers for other students, because typing was the only thing I knew how to do on a computer, and that was before we had the internet publicly available. Senior year we finally started learning how to get online so I switched over to the PC. After college I went back to school to learn how to write code and fix pc's

That was the only time I ever used an Apple product. Still with Steve Job's passing away yesterday nobody can deny the influence he has given over technology as a whole. His vision will be missed by us all in the future.

Back in the mid-2000's when I had the business I did my fair share of Mac support and repair work, got to know the IOS pretty well. I could do all of your basic setup and admin work on mac's, getting them network connectivity. I remember when the first (maybe second) generation iMacs came out with intel processors and my business partner and I were some of the first people to roll out dual boot options with Windows 2000 and the Mac OS 9.

Now as developers we build web sites for use with mobile browsing, size and graphic constraints thanks to Steve Jobs influence. Designers alone are making everything with rounded corners now creating the same feel to products that Steve gave the Apple product lines.

I'm sure with a few more years we would have gotten more from him. He'll be greatly missed. But like I tell my kids today, you get what you get and you don't get upset. Thanks for everything Steve.

Monday, September 26, 2011

Slick Javascript Trim

I found a great Trim function for Javascript that I wanted to share. Got it from and it has the cleanest explanation of space removal I've seen in a while.

My task has some form validation for incomplete fields, and it was reported back to me that users were entering a space and it was passing the validation. Now this is also why you should use both server side and client side validation so that extra space crud doesn't go into your database. But that's another post.

My javascript (inherited - I found it but didn't write it) was doing a

if (document.formname.elementname.value == "") ....

so if you enter a space, that's not equal to empty string. Validation passed, right? That syntax alone is enough reason for me to switch to JQuery. But that's out of my control

Javascript by default will use regular expressions for string comparison. If we change the if statement to read:

if (document.formname.elementname.value.replace(/^\s+|\s+$/g, '') == "")

then it will remove all spaces in the form element text no matter what. The regular expression breaks down like this:

/ start the regex
^ from the beginning
\s look for spaces
+ not just as the first character
| or (really more like also)
\s+$ look for spaces until the end of the form text
/ end regex
g = make it global

And since this is in an IF statement, it's just going to check and see what happens if you strip out all of the spaces. If you type two words separated by a space it will still go into the database as two words. and the conditional statement will still return false.

This is the cleanest and "most right" trim statement I've seen yet. Very cool!

Tuesday, September 20, 2011

Binary Fun

Today's XKCD is worth a quick read. Too funny!

Sunday, May 1, 2011


Why is Microsoft pushing MVC so hard? All I hear about the new certification exams is that they are very heavy on MVC and JQuery. We've been using plenty of JQuery at work lately, I feel really comfortable in there.

But WHY all the MVC? I'm sure I can pick it up. But I'm going into it a bit begrudgingly. I know eventually I'm going to have to tell somebody who's currently in elementary school how "we used to do some really cool stuff in But MVC is such a different framework I'm not looking forward to the change.