Ian Bicking (a python developer I have a great deal of respect for) has a good comparison of Python and Ruby, focusing on the things that are unique to dynamic languages.
It’s interesting that both frameworks were extracted from large development projects in roughly the same time period, although Rails has been publicly available for longer, and has more mindshare at the moment.
I’m happy with Rails, but I wonder whether I would have bothered with it if Django had been available when I started looking at Rails. The thing that kept me away from Rails for a long time was that I didn’t know Ruby. I was (and still am) well-versed in Python. I still prefer the cleaner syntax of Python over Ruby, although the latter does have some features that I find compelling.
I wonder about the impact of one aspect of Django though: the fact that the model generates your databas schema, instead of the developer generating the model from the schema (which is the Rails model). I suspect most DBA’s would go into convulsions at the very thought of this. I can certainly see how it would ease moving from database to database.
Someone wrote a programming language consisting entirely of whitespace (you knew it would happen eventually). Now maybe people will stop making fun of Python.
Kathy Sierra, who runs the excellent Creating Passionate Users blog, is doing a series of “passion reviews”. She’s started with http://www.37signals.com Signals. Interesting article, but I suspect if the Signals get any more positive PR, they’re heads may explode.
via Ted Leung
Martin Fowler has a great introduction to Rake. If you’re not familiar, Rake is similar to Ant, but instead of build files written in XML, they’re written in Ruby. If you’ve ever written a complicated Ant script, you know how verbose and complicated they can be. Rake is the answer to your prayers.
Novell has put OpenSUSE 10 into beta.
Adaptive Path has an interview with Flickr’s Eric Costello. Good read.
A collection of links from the last week or so:
Seth Godin has a brilliant piece on the advantages of small companies. It seems to me that the greatest innovation in technology (particularly software) is being done by micro-companies. These are companies like 37 Signals(5 people), Robot Co-Op(7 people), and Delicious Monster(7 people).
I think that larger companies tend to be very good at stifling creativity. There are notable exceptions (Google comes to mind), but by and large this rule seems to hold. Small companies are more able (and willing) to take risks, whereas risk-taking is seen as a bad thing in many companies.
Are there are any other examples of micro-companies anyone can think of?
I’m a big fan of GTD. A lot of people ramble on about “so-and-so changed my life”, but in this case it’s true. I had never been organized a day in my life until I discovered David Allen and his system. I’m not saying I’m some sort of uber-organized person, but I’m 1000% better than I was.
There is a big community that has built up around GTD that spends a lot of time swapping tips on how best to implement the system. One of the problems with this is that it is incredibly easy to get caught up in tweaking your system, rather than Getting Things Done. I have caught myself doing this more than once, downloading software and templates, in an effort to add that one thing that’s going to make it even better. What this really is, is a very deceiving form of procrastination. You seem really busy, but aren’t actually accomplishing anything.
I’m learning to recognize when I’m starting to fall into this trap, but it isn’t easy.
File this under “Useful things to remember”.
The following bit of command line magic will export the schema of your
mysqldump –no-data –tables -u
YOUR_USER_NAME -p DATABASE_YOU_WANT_SCRIPTED >> FILENAME.sql
An example looks like this:
mysqldump –no-data –tables -u larry -p contacts >> contacts.sql
If you want the data as well, omit the “–no-data” portion.
Update 11/23/2005: Months later, this is still apparently a popular topic, as it’s one of the most viewed posts here. Time has passed though, and there’s a better option: RadRails. It’s built on Eclipse, but includes Rails-specific tooling, which the configuration discussed below does not. It’s well worth your time to check out.
In this short tutorial, I'm going to walk you through setting up a code editing environment for Ruby on Rails using the Eclipse IDE.
Eclipse isn't really an IDE in and of itself. It's more like a platform to build IDE's on. It was developed by IBM and then released as an open source project. The code is now owned by the Eclipse Foundation. IBM uses Eclipse as the foundation for all of their development tools, such as Rational Application Developer, their J2EE development tool. There are a variety of other companies and open source projects developing plugins as well as full-blown IDE's using Eclipse. See the Eclipse website for further information.
Note: Eclipse is a pig when it comes to memory and processor (mostly memory). If you don't have a 1.5ghz+ machine with 1gb of ram, you may find using it a little frustrating. I am using it on a machine with a 1.1ghz P4 and 512mb of ram, and it does OK, but it's not what I would call quick.
What we're going to do
What we are going to do here is install Eclipse (if you don't already have it), and then add two plugins to it. The first plugin will add support for editing Ruby code. The second will add support for HTML editing. Then we'll make some configuration changes to make everything work nicely, and that will be it.
NOTE:This is not a tutorial on Eclipse. I'm not planning on covering the ins and outs of Eclipse here, there are plenty of other sites that offer that kind of information. If you're interested in seeing a more in-depth tutorial on using Eclipse to edit Ruby/Rails code, drop me a line at \[larry AT approachingnormal.com\], and I'll consider developing one.
The first thing you need to do is install Eclipse, if you don't have it already. Head over to http://www.eclipse.org, then download and install the latest version for your platform. Make sure to pick a stable release and not one of the milestone releases. Once you have it installed, start up Eclipse and go on to the next step.
Adding some plugins
Once you are in Eclipse go to Help ~~> Software Updates~~> Find and Install. This brings up a wizard-style dialog. On the first screen, make sure that "Search for new features to install" is selected, and click Next. The next screen let's you add/edit update sites where eclipse will look for additional functionality. We're going to add two sites here. First, click on the "New Remote Site" button. When the New Update Site dialog pops up, enter "Ruby" into the Name field, and http://rubyeclipse.sf.net/updatesite in the URL field. Then click OK. You will now see your Ruby entry in the list of update sites. Click on the checkmark to the left of the entry to include it in the list of sites to search.
Now, click on the "New Remote Site" button again. Fill in the values as before, this time using "Web" as the Name, and http://pipestonegroup.com/eclipse/updates as the URL. Click OK as before, and make sure you check the checkbox to the left of the Web entry. When you're all done, click Next.
The next screen takes you to the Search Results screen. This will give you a list of features you can install. We're interested in two here. Select the checkboxes for the latest version of "Ruby Development Tools" (currently 0.5), and "net.sourceforge.phpeclipse" (currently 1.1.4). Click Next. On the next screen you'll accept the licenses, and click Next again. On the final page, you'll choose the location to store the plugins. Select the default unless you have a reason to do otherwise. I had to add a new site to store mine in my home directory on Linux due to not having permissions to the default location. On a Windows machine you should be fine with the default. Now click Finish and confirm the dialogs that pop up. The download process may take a little time depending on your internet connection.
We need to let Eclipse know what to do with rhtml files. By default, Eclipse will treat it as a text file, which isn't what we want. In Eclipse, go to Window ~~> Preferences. In the tree on the left, navigate to Workbench~~> File Associations. Now click the Add button at the top of the dialog, next to the File Types list. Enter \*.rhtml in the dialog that appears and click OK. Now select our new type in the File Types list and then click the Add button at the bottom of the screen next to the "Associated Editors" list. Choose "HTML Editor" from the list that appears, and click OK. Now close the Preferences screen.
Now that we have everything installed, let's try it out. In Eclipse, select File ~~> New~~> Ruby Project. Enter a name into the dialog that appears and click OK. You should now see your project in the Navigator window on the left hand side of the screen. Now right click on that project name and choose "Import". I'm going to import a copy of Typo, the excellent blog software that runs this site. I happen to have this on my drive, if you don't have a rails project, either create one real quick or download something like Typo. When the Import dialog comes up, choose "File System" and click Next. Choose the directory your source code is sitting in. and then select it in the checkbox on the left like this: <img src="http://approachingnormal.com/images/share/import.png" align="Middle" width="500" height="500" alt="Import screen" / >
Now click Finish. Once the source is imported, you should see be able to navigate through the project tree in the Navigator window. If you click on ruby and rhtml files, you will see that they are opened in their proper editors.
\ Editing an ERB File
Editing Ruby code
So what's missing from this? Well, a couple of things:
- Eclipse doesn't really understand ERB files. It would be great if the Ruby plugin understood them, as it would make the syntax highlighting much better. It would also allow for code completion, etc.
- No documentation. A real IDE needs to have the Rails documentation embedded and searchable
- WEBRick integration. It would be nice to be able to stop/start WEBRick from within the IDE.
If you have questions or comments, I'd love to hear them. Leave me a comment, or email me at \[larry AT approachingnormal.com\]