Showing posts from June, 2007

More Rails Progress

I've been playing with Rails over the past few days and want to quickly express my experience so far. Creating joins, lookup tables, tuning, grouping, sorting, and setting limits are all easy. You can do something like: Actor.sum(:appearances, :joins => "INNER JOIN appearances_show_lookup asl ON asl.appearances_id = appearances.appearances_id", :group=>'asl.appearances_id', :order=>'sum(appearances) DESC', :limit=>10) which translates into SELECT m.appearances_id, sum(appearances) FROM appearances m INNER JOIN appearances_show_lookup md ON md.appearances_id=m.appearances_id GROUP BY m.appearances_id ORDER BY sum(appearances) DESC LIMIT 10; or... Actor.find(:all,include=>:appearances_type, :conditions=>"'guest'", :limit=>10) to SELECT * FROM appearances LEFT OUTER JOIN appearances_type ON appearances_type.appearances_type_id = appearances.appearances_type_id WHERE

Rails Progress

I picked up a copy of Rails for Java Developers by Stuart Halloway and Justin Gehtland and am playing around more with Rails. The book is really good, but I really need a migration guide from Hibernate to Rails (or an existing web application to Rails). I'm looking for more information on creating Rails models that can be accessed through a complex set of filters and associations. The things I need to know are: How to create something like a 8 table Rails join? How best to represent lookup tables? What options are available to tune the queries? Can I capture the Rails query before it's sent to the DB for debugging (outside the MySQL log)? How do I specify things like limit, paging, group by, sum, distinct, etc? I'm going to reread the ActiveRecord chapter of this book again. I also have a copy of Agile Web Development with Rails on the way. Many articles I'm finding on the Internet draw the same conclusions - if your schema and object dependencies ar


The database cleanup is finally complete! Now I need to rewrite our web app's data access code. When we first created the database layer, we used the Hibernate framework. Since then Hibernate3 has been released and an upgrade is scheduled as part of this work. We did have some pain points with Hibernate, however. For instance, when I started evaluating our DB code, I noticed some DB queries that we don't explicitly create. Whether these were the result of a poor object-relational model, lazy instantiation, or some other Hibernate functionality is unknown at this time. I've found Hibernate (or at least how we're using Hibernate) complicated to debug. I'm going to take some time and look at Ruby and Rails as an alternative. I've mentioned before that I've wanted to learn Ruby for a while and this seems like a good excuse. There is a Ruby library for Java called JRuby . The plan is to learn the JRuby Rails extensions and find out the effort to incor


I just listened to an interview with Tim Berners-Lee , inventor of the World Wide Web. While most of the interview focused the Semantec Web , what I found most interesting, were his thoughts on Rich Internet Applications. Of course he thinks this is an exciting development, but with various technologies (Flash, JavaFX, Silverlight) competing in this space, he feels that standardization would help speed its adoption. He points to how standardizing HTML in an open and royalty-free way helped to speed the adoption of the Web. Standardizing this technology would be a great step. Right now, these technologies run as a plugin on the browser. Once standardized, browsers could build this functionality right in, making adoption seamless. Open-sourcing the technology is not enough. The biggest problem with standardization is that it takes so long. It's a good thought, hopefully it will gain some traction. ****** More news on the DB front. The more I delve into the database schema and

It's All About Software (and Passion)

Just to touch on Apple and Microsoft again... I've watched the conversation between Steve Jobs and Bill Gates from this year's D5 conference a number of times. The thing that keeps amazing me is that these guys, earlier than almost anyone else, got that it's all about the software. They realized that we had this great, new technology... but it was way too hard for the average person to use. Gates referred to a speech that Jobs gave years ago where he said, "We build the products that we want to use ourselves." I always hear successful people say that the key to success is being passionate about what you're doing and what you're producing. Microsoft and Apple are two examples where this approach has obviously worked. I'm convinced these giants are more similar than different. It would be foolish not to apply these ideals into our own software projects. To have a successful project we need to become our target users. Think like they think. Le

Masking the Problem

From my past posts, you may have guessed that I'm in the middle of optimizing a web application that accesses a database. Our studies have shown that a combination of missing indexes, unnormalized data, and inefficient queries are the root cause for this application's poor performance. The optimal solution involves reorganizing the database schema and rewriting our database access layer. Side Note: The books SQL Tuning by Dan Tow , Pro MySQL by Michael Kruckenberg and Jay Pipes , and Hibernate in Action by Christian Bauer and Gavin King have been instrumental in helping to identify solutions to these problems. During a meeting to discuss these changes, another suggestion was made to help performance. There are certain instances where we could save few trips to the database (per request) by reusing session information that is unlikely to change (whether this data should actually be in the session or not is a subject for another post). This enhancement requires


One Laptop Per Child ( OLPC ) is a movement to create inexpensive, full featured laptops to be used by children for education. The design of this machine is geared at promoting creativity and collaboration. Each system features wireless capabilities for students to connect and communicate with teachers and other students. The user interface centers on activities that children participate in to learn. This differs from a traditional UI which focuses on tasks and applications. The laptop is enclosed in a durable case with a kid friendly handle. It also includes many power saving features, including the ability to charge the battery using human power (like turning a crank or pulling a string). This is an important consideration for areas with little or no access to power. The price of the hardware is very low (around $100). In addition, much of the software for this system is being developed in an cost friendly, open source model. I'm excited about the possibilities this

Gearing Up

I've previously written about Rich Internet Applications and how they bring desktop-like functionality to web applications. The knock on this technology has always been "how do I work if I don't have an Internet connection?" Last week, Google announced Google Gears , a framework designed to address this problem. Google Gears provides 3 modules developers can used to make their web applications available offline. LocalServer allows web applications the ability to store, then serve, web content locally when a user does not have an Internet connection. These resources can be updated when the user is reconnected to the Net. Database provides persistent storage to the application when working offline. WorkerPool allows long running operations to be "chunked", and run in the background without blocking the browser. It's likely Google developed this technology to widen the appeal and availability of it's Google Docs & Spreadsheats offeri

Performance Testing

I just upgraded my Eclipse IDE and installed the latest Test and Performance Tools Platform (TPTP) release. The only tricky part of the installation was installing the Agent Controller (available from from the TPTP download site ). This is a separate install from the TPTP plugin and must be placed on your PATH. TPTP application profiling is easy. Simply start your application in profiling mode, then start the profiler before you access application functionality you want to benchmark. I'm currently using the tool to identify memory and execution time bottlenecks. The TPTP utility makes it easy to sort on key statistics (like the memory footprint for an object class, or the total time spent executing various methods). I find the method invocation information especially useful. Not only does the tool provide information on which calls are taking the longest, but it also provides details for who called the method and what supporting methods are called (along with the time sp

New Age Appliances

I'm pretty excited about the latest consumer tech products I've seen from Apple and Microsoft. Although they seem to target slightly different segments, both have new offerings which push user interface and interaction to a new level. iPhone Early this year, I watched the Macworld video where Steve Jobs introduced the iPhone. I was blown away. It was easy to see the new possibilities offered by this device. I mean, the phone I have now offers many advanced features that are clumsy and frustrating to use (web access, email, text messaging, etc) . The iPhone makes these tasks intuitive (and it looks fun). As the average user gets a hold of this, I'm guessing we'll see a spike in web traffic as mobile computing goes mainstream (sort of like what the iPod did for digital music). It will forever change the way people interact with the Internet and our products. Microsoft Surface Computing Yesterday I watched a video demoing Microsoft Surface Computing. I don&