Aug
31
2010
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:
- Download and install the latest version of MacPorts if not already installed
- 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
1 comment | tags: Gem, OS X, Ruby on Rails, Snow Leopard | posted in Software Tools
Mar
24
2010
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?
no comments | tags: 5 Years, AJAX, Canvas, Framework, Future, HTML5, JavaScript, WebGL | posted in Mobile, Software Development, Software Tools, Web
Oct
11
2009
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.

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.

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.

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.
1 comment | tags: Firebug, Firefox Extension, JavaScript | posted in Software Tools
Sep
6
2009
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:
- Download and install the MySQL package.
- Install XCode that’s bundled with Snow Leopard
- 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
3 comments | tags: Gem, OS X, Ruby on Rails, Snow Leopard | posted in Software Tools
Sep
4
2009
To install git on the latest version of OS X (10.6), use the git-1.6.4.2-intel-leopard.dmg (or later) package from git-osx-installer. So far it works fine for me on Snow Leopard.
I like how OS X comes with a large number of open source packages such as PHP, Apache, Vim, Subversion and Ruby on Rails; however, I’d really like to see Apple add Git to the list.
2 comments | tags: Git, OS X, Snow Leopard | posted in Software Tools