E-com DevBlog

Web. Development.

April 17, 2013
by Phil
0 comments

The Death of 1140px CSS Grid

 

1140 CSS Grid - 12 columns fluid to mobile

The 1140 CSS Grid sign from http://cssgrid.net

Death, no, not really. I’m being slightly over-dramatic, the grid system was merely put into retirement… This post is my tribute to the framework and the work that went into it.

Odd things happen when you have meetings in open cubicle spaces. Things like shoulder-surfing someone at another cube who is looking at responsive frameworks and different grid systems. I currently use base as a responsive starting point (yes, it has a bug or three, and is extremely basic out of the box), but my designer friends are starting to strike out on their own learning what will work and what will not for our new and upcoming projects.  As she was surfing I couldn’t help but notice the giant words on her screen stating “1140px CSS Grid Retired”.

A moment of reminiscence took me back to Google I/O ’11, where as a sandbox developer on the 2nd floor of Moscone West I received an emergency phone call telling me that I needed to get a press release site put together in a couple of hours… and it had to work on whatever device the user was using to view the release. I grabbed my laptop and sat on the floor coding trying to get done before Jane’s Addiction rocked the house for the after-hours party. I had heard of the 1140px CSS Grid and so I decided to give it a whirl. I grabbed it and hastily put together the site (including a sidebar with a gallery and press kit download section that would collapse under the press release when viewed on a phone). The system was terrific, and worked perfectly for what I needed.

After that experience I always carried the 1140px CSS Grid system in my web-toolbox for some quick grid-like-fixery where a fluid site would be needed. In fact I’ve mentioned the 1140px CSS Grid before in posts, and I think it even snuck into one of my books.

So why was the 1140px CSS Grid retired? Well, as Andy Taylor explains on the 1140px CSS Grid blog post, it was always an experiment, RWD has come a long way since the inception of the project, and it was desktop-down utility. I agree with what Andy has done in retiring the project, and I would like to express my thanks for the experience it gave me.

November 24, 2012
by Phil
0 comments

Where did all the updates go?

Hey guys, it’s been a while and I found a few minutes to give you an update on where I’ve been and what I’ve been up to:

  • I have two books out now (one I wrote myself, and one I co-authored), and I’ve been spending time hanging out with the Boston PHP group (for Season 2 of jQuery jAM).
  • I also have a video training series set to drop at the end of next month (fingers-crossed).
  • I’ve also been working on several side projects and spending some make-up time with the family (since they saw so little of me while working on the books).

Those of you who read the sidebar on the site may have noticed that I have been maintaining a list of mini-posts about things I find that are interesting or cool over on my tumblr blog. While I try to decide if it is worth porting over as full posts to this site (rather than just sidebar material), be sure to go there to look at what I am looking at, considering, or even what random things I believe need to be posted.

October 30, 2012
by Doo
0 comments

I was reading java code geeks this morning and read an interesting article on java standards. I read through this article and holy crapped on almost every point. I couldn’t believe the code standards would be so backward of best practice. Then I checked the date on the standards linked to. 1999 for the HTML, 1997 for the PDF. That is long before java 1.5, it was different world then (it wasn’t even Oracle). I want to know why the standards have not evolved. They need to release a new best practices document. Makes me feel good that the changes the author of the post recommends are already reflected in our code standards.

July 28, 2012
by Phil
1 Comment

jsPerf and selector performance

Those who have been using jQuery since the initial release know that it is a serious boon to any developer working with JavaScript and multiple browsers.  What you may not know is that while jQuery is incredibly awesome, browsers have gone well past the sluggish speed of the IE6 and 7 days. This may not mean much to you as your code still works like a champ and behaves well in cross browser situations, but by using jsPerf you can see just how much your “lazy” selectors are costing you.

Standard Disclaimer: The following are massive tests and while they demonstrate the repetitive nature of selectors they may not actually help your web application (especially if it is a small application with only one or two selector calls). As always, do your own benchmarking with the same hardware your customer or client is using. Always remember to remove the jank.

jsPerf image

jsPerf.com (not the official logo, but you get the idea)

jsPerf is a JavaScript Performance benchmarking site. You can go there to write your own series of benchmarks and watch them perform in different browsers.  The site also leverages the use of Browserscope showing you how other browsers have performed using your test.  It is important to remember that you cannot snap judge your tests, you really should be running them with as many browsers as possible. This is important because it will affect how your JavaScript runs on every browser. Not all browsers use the V8 engine that Chrome does ;) .

For an example, lets fire up http://jsperf.com/getelementbyid-vs-jquery-id/13. When you load this page you can see that the test is set up to use jQuery 1.7 and is going to run several tests (using a jQuery selector, using the vanilla getElementById, creating a custom function for selection, etc). Click the “Run Tests” button to begin the test sequence.  When finished you will be shown the fastest test and the slowest.  Each test will also show the relation in speed to the fastest running test.

As an example I ran this test using Chrome 22.0.1215.3 on Windows 7, below is a screen shot of my results:

jsPerf test score

From the image above you can see that using the plain JavaScript “document.getElementById(‘foo’);” was the fastest method for selecting the element with an id of foo. By faster I don’t mean just a ‘meh’ amount of fast, I mean it was blazingly fast, look at the speed difference for the jQuery selector “$(‘#foo’);”. Now back to the disclaimer, take a look at the following chart:

jsPerf results chart

This chart shows plenty of Chrome love, but also highlights the speed differences and improvements in the internal JavaScript engine. Not all browsers are created equal, but luckily seem to be improving all the time.

You can see that other browsers (including previous versions of Chrome) do not run this test with the same performance. In fact, some browsers are even up to 50% slower running the same tests. Always test your code, and then test it again.  After that, have someone else test your code and compare the results.

Now, go out there and start tearing up your old code and getting performance back to where it should be ;) .

July 24, 2012
by Phil
4 Comments

Sams Teach Yourself jQuery Mobile in 24 Hours

I’m happy to announce that Sams Teach Yourself jQuery Mobile in 24 Hours is now available at most book retailers including Barnes and Noble, Amazon, Safari Book, Pearson Higher Ed, and informIT.

The book writing process was a fantastic one that was full of late nights, last minute changes, and lots of testing. While I’ve already thanked quite a few people in the book, I’d like to extend that thanks to everyone who had a suggestion, comment, correction or otherwise.

Those wanting to pick up the book right now can use the following link to purchase the book from Amazon (in both the paperback and/or kindle variety).

Sams Teach Yourself jQuery Mobile in 24 Hours (Sams Teach Yourself — Hours)

As always, please let me know what errors you find (I’ve already found a couple – including a floating “n” in the first ‘about the author’ section), and I’ll have them noted so that future printings of the book don’t have these errors.

Those that are in marketing or are just curious about creating and using QR and Microsoft Tag codes can forgo the morning beverage and instead pick up the mini-book “Creating QR and Tag Codes” for their kindle with the link below:

Creating QR and Tag Codes

In another bout of good news, I’m also happy to announce that my second book has just left round one of editing and is moving into production! “jQuery, jQuery UI, and jQuery Mobile: Recipes and Examples” is slated to be released on November 10th.  This is an amazing book of recipes that you can use to get the gist of a particular jQuery function, or an actual snippet of code that you can use in your current projects.

Here is the link to the pre-order page on amazon:

jQuery, jQuery UI, and jQuery Mobile: Recipes and Examples (Developer’s Library)

June 25, 2012
by Phil
0 comments

Google I/O 2012

Today is June 25th, and for all you tech-heavy developers, that can only mean one thing.  Tomorrow is when you are probably migrating to San Francisco for Google I/O 2012!

This year promises to reach out and give more developers a chance to learn a little something extra as there are a few new tracks including cloud storage options (Drive), Google+and many sessions on Android, YouTube,  Chrome, and more!

For those who cannot attend, use the widget below to watch the live stream!

The widget above should be hooked into my Google+ account, so anything I blog there should be visible here :) . And of course I’ll be throwing thoughts up on Twitter and Instagram as well.

 

April 16, 2012
by Phil
0 comments

jQuery Mobile 1.1 Final Released

For those of you using the RC1 or RC2 candidates of jQuery Mobile, the wait is over.  jQuery Mobile 1.1 Final was released last Friday (13th).  For those of you wailing on a bout superstition, know that yes, this will break the themes you generated with ThemeRoller.  Now for the good news, you can import your old theme into the updated ThemeRoller and convert it to work with jQM 1.1.

Other improvements on this release are “true” fixed-toolbars.  This is a wonderful addition as instead of having them disappear and then reappear (in jumpy fashion on Android), they will stick now.  Page transitions also have gone through a bit of a lift.  In RC1.1 the default slide transition was replaced with a fade transition.  It was cool, it worked, and then when I used it in a PhoneGap application, it was way to laggy to be useful.  I wasn’t the only one who ran into  issues similar to this one, and the jQM team put in some serious overtime working on the issue.  I’ll let you read about all of the new changes over at the official blog post.

For those of you who want to jump in and get started here are the CDN links:

<link rel=”stylesheet” href=”http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css” /> <script src=”http://code.jquery.com/jquery-1.6.4.min.js”></script> <script src=”http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js”></script>

For those who prefer a local copy to work with, here is a link to the download page.

February 9, 2012
by Phil
0 comments

Easiest URLEncoding Method Ever

Easy%20URLEncode

Why leave your browser?

I’ve been doing some ridiculously complicated parameter passing between a server script and a javascript plugin that ahs finally required me to encode the values into a URLEncoded fashion.  To do this I would normally crack open my Adobe Air app that I use for encoding and decoding form data, but I just realized that there was a little voice in my head telling that what I was doing it wasn’t necessarily wrong, but just over-complicated.

Don’t get me wrong, the Air App I have is great, and yes, I could build a utility in PHP-and-friends that would accomplish the same thing.  But stay with me, this is about the easiest, most readily available method ever, not the most involved.

Please note that the following instructions contain a bit of humor aimed at Internet Explorer users.  We are all aware of the limitations of the browser, and the fact that it is slowly getting better. So remember, it’s all in good fun :) .  Here we go.

Chrome/Safari users:

  1. Open Web Inspector (ctrl-shift-i/option-command-i)
  2. Open the console
  3. Type: escape(“The values you want escaped go here, seriously”);
  4. Press Enter
  5. Copy your URLEncoded data out of the console

Firefox/Aurora users:

  1. Get Firebug
  2. Open Firebug (F12)
  3. Open the Console tab
  4. Type: escape(“The values you want escaped go here, throw in some extra characters, like I’m awesome searching http://www.google.com/”);
  5. Press Enter
  6. Copy your URLEncoded data out of the console

Internet Explorer Users:

  1. Download Chrome or Firefox
  2. Follow the steps above for the browser you downloaded.
  3. Remember that IT blocked you from using or downloading a modern browser, so give up and open IE anyway
  4. Press F12 and pray that you have the less-than-stellar-copy of Firebug/Web Inspector available
  5. Rejoice because it is installed, Click on the Console tab
  6. Type: escape(“Wow, this totally works in IE, and I’m pleasantly surprised by that fact”);
  7. Press Enter
  8. Copy the URLEncoded data out of the console

Unescaping or URLDecoding

Isn’t that awesome?  Now that you can encode the data, you probably want to decode it right?  Follow the same method as above, only use the following function:

unescape("URLEncoded%20data%20goes%20here");

That’s it, easy, built-in URLEncoding and URLDecoding from the browser that you are already working in and developing with.  Now go out there and save the world from too many slashes and quotes getting in the way!

February 1, 2012
by Phil
3 Comments

LESS is more

LESS logo

LESS - The dynamic Stylesheet lanugage

I’ve seen it, I’ve ignored it, and now it’s time to embrace and post about it.  If you haven’t already given it the time of day, it’s time to crawl out from under the rock and start learning LESS.

LESS bills itself as “The Dynamic Stylesheet language”, and even for a self-billing, it is dead-on.  LESS allows the use of variables, mixins, a nested rule system, and the use of functions within your CSS.  All of this is processed through some black JavaScript magic, so you don’t need to worry about possible performance kills in your vanilla stylesheet.

LESS isn’t just for client-side operations either, it can be integrated with both Node.js and Rhino.

Who is using LESS? Fair enough question, many sites are using LESS right now but perhaps you should check out the Twitter Bootstrap that is built using LESS.

I could give you quite a few examples here to really get you salivating, but I find that when someone has already done the work, I may as well have you go there. So to get your hands dirty and start using LESS, just hit up the official site.