Upgrade to Git

Remember when Subversion was the new tool that all the cool kids were flocking to? Well, Subversion is now the old and busted, and it’s time to move to Git.

It’s time to upgrade your Subversion repo (if your still using it) to Git because of the benefits you will gain from moving to a more flexible tool.

  1. Distributed: When you checkout (or clone in the git world) a repository, you are checking out all the files in the repository, which means you can work independently of others. You can commit and make changes on master, or another branch without imposing your incomplete changes on the rest of the team.
  2. Simple Merging: Compared to Subversion, merging is fun. Because its so easy, as a developer you are more inclined to make additional branches and use them as they should be used. This adds a lot of flexibility in where and when the changes are pushed to master.
  3. Speed: A subversion commit doesn’t end until all the files have been transferred to the remote server, with git, commits are completed instantly because you are committing to the local repository, not the remote one. Therefore, you don’t have to wait for actions to complete as they are almost instantaneous.

I could go on, but those are the big ones for me. Note: I’m not against other DVCS systems like Mercurial, Bazaar, but I chose Git because of it’s popularity and ability to handle the Linux kernel.

Download GIT now.

MySQL Gem on Snow Leopard

Snow Leopard does not have the mysql gem installed, and my last solution for installing it only work in OS X prior to 10.6.4; therefore, when you see the following error:

Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.


/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install mysql
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

Install the mysql gem with these steps:

  1. Download and install the latest version of MacPorts if not already installed
  2. Run the following commands to install mysql5 and the associated ruby gem

# sudo port install mysql5-server
# sudo env ARCHFLAGS="-arch x86_64" gem install mysql

What Will Web Development Look Like in 5 Years

Developing applications for the web has changed significantly over the last 5 years. Since 2005 the term AJAX has been coined, Ruby on Rails is now an open source web application framework, jQuery was created and has subsequently revolutionized JavaScript development, and now HTML5 is the top buzzword of the day. I believe the next 5 years will hold just as many improvements for web developers.

I foresee a new framework will be created to make developing fully interactive AJAX applications as easy as it is to write current MVC applications. Current frameworks like Ruby on Rails and Symfony provide everything you need to develop a modern application without having to build plumbing infrastructure; however, they do not provide nice components for interactive applications. In addition to a robust server core, this new framework will have a client side JavaScript component that simplifies the process of building interactive web 2.0 applications. Some critical components would be:

  • Form Validation. Libraries do exist to validate forms in JavaScript, but they don’t integrate with the server side form validation. In this new framework you won’t have to write form validation code twice.
  • Paginated Lists. Almost all web applications have at least one page where data needs to be searched and listed with pagination. We need to have this same functionality in JavaScript to skip a full page reload and provide local caching of the results.
  • Animation Library. While script.aculo.us and jQuery have made simple animations and visual effects much easier to do, I believe we can go even farther. Web applications also need to gain that fluidity and soft animations that desktop applications such as Exposé have had for a couple of years.

I also see huge resources being directed towards mobile development because ALL current generation smart phones are built for an incredible web browsing experience. As home users have switched from desktop computers to laptop computers in the last few years, people will slowly start switching to hand-held devices for their primary communication and Internet needs. Most likely this will have one primary effect: web frameworks will have a mobile optimized version of the site done automatically. Little to none developer intervention will be required as only resolution, text sizes, and layouts will be modified for the mobile version.

Lastly I see tools and libraries around 2D and 3D drawing elements. Most likely these libraries would be rendering to a Canvas or a WebGL element but something better could be created. Both of these are young standards right now that show a lot of promise on delivering the ability to draw pixels directly in a native HTML web page. While they will be used first in simple computer games, I am very interested to see what libraries are created to facilitate these elements being used appropriately inside next generation web applications.

What do you think the next 5 years will bring?

Firebug: The JavaScript Debugger

JavaScript is a core language of many web developers and a necessary component for any modern web application; therefore having an excellent JavaScript debugger and knowing how to use it effectively is key to fixing bugs faster. Fixing bugs faster also makes you a happier software developer!

I recommend Firebug, which is a JavaScript debugger, a real-time HTML, CSS, DOM, and JavaScript editor, and a network monitor.

Logging

One of the most useful features are the logging functions through console.log which can simply be used to output a string or object:

console.log('Testing log output: ', myObject);

This will output your message and the full object available for inspection in the Firebug console tab. In addition to console.log, there is also console.warn, console.error, and more. See the Firebug documentation for more info.

Be careful to remove the statements from your code before deploying it, because your users won’t have Firebug installed, and JavaScript will then fail when it tries to output to the console object. Also, you certainly don’t want users to see your debug output.

firebug logger
console.log in action

Breakpoints

Pausing scripts to investigate the system at a current point in time can be very valuable in solving bugs. To use the breakpoint feature click just to the left of a JavaScript line. This will set a breakpoint and make a red dot appear.

You can also add a conditional breakpoint by right clicking on a line number. Now the program will only pause under your specified condition.

firebug breakpoint
Setting a breakpoint

JavaScript Errors

Firebug will print out JavaScript errors with the corresponding file and line number. An absolute must for any JavaScript development.

firebug javascript error
A JavaScript Error

Those are the key feature I use most often, but there are many more JavaScript features in Firebug, including stack traces, watching expressions, profiling and viewing events.

Download Firebug now.

Fixing MySQL Gem on Snow Leopard

NOTE: See my latest post for a solution for OS X 10.6.4 and later

A fresh Snow Leopard (OS X 10.6) install does not have the mysql gem installed, and installing it fails because of missing header files:

Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.


/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install mysql
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

To correctly install the mysql gem:

  1. Download and install the MySQL package.
  2. Install XCode that’s bundled with Snow Leopard
  3. Install the gem for your architecture (use -arch i386 if you have an Intel Core Solo or Intel Core Duo processor):

# sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql-5.1.38-osx10.5-x86_64/bin/mysql_config