Software

Caching with Ruby on Rails

It just needed to happen. The Hardcore Racing eStore seemed slower every day. It started off as just an attempt to cache the make/model dropdown since we now wanted to put it in the search box in the left sidebar, which is visible on every page. It was simply an unrealistic number of queries to build that dropdown—with all the other queries I expected to make for a page’s request.

Read on to learn how I made my site FAST!

› Continue reading

Thursday, December 15th, 2005 Software 3 Comments

Rails 1.0!

Ruby on Rails 1.0 was just announced, accompanied by a new website. I was active in #rubyonrails when it was announced:

14:51 ( onpo) can anyone access rubyonrails.org?
14:51 ( onpo) YES YOU CAN!
14:51 ( onpo) ITS OUT!
14:51 ( onpo) 1.0 is OUT!
14:51 ( onpo) WOoooooooooooooooooooooooooooooooooooooooooooooo
14:51 ( Qerub) the website has been 37signalized.
14:51 ( zraii) whoa
14:51 ( Ave) well hot diggity, toss the confetti
14:51 ( zraii) that just went up
14:51 ( danfg) OMG IMMA HAVE A HEART ATTACK
14:52 ( thread) ho damn
14:52 -+- bitsweat changed the topic of #rubyonrails to: 1.0 Release | Beta
          gems: gem update --source http://gems.rubyonrails.com  |  Paste:
          rafb.net/paste  |  Logs: loglibrary.com/channels/preview/62
14:52 ( thread) BAD FRICKIN ASS
14:52 ( thread) TY RAILS PPL
14:52 (@noradio)  ____       _ _       _   ___  _
14:52 (@noradio) |  _ \ __ _(_) |___  / | / _ \| |
14:52 (@noradio) | |_) / _` | | / __| | || | | | |
14:52 (@noradio) |  _ < (_| | | \__ \ | || |_| |_|
14:52 (@noradio) |_| \_\__,_|_|_|___/ |_(_)___/(_)
14:52 (@noradio)
14:53 ( argv[0]) haha
14:53 ( danfg) WOOHOO!

etc… :)

Tuesday, December 13th, 2005 Software No Comments

My Favorite Firefox Extensions

I decided I’d better list some of the extensions that I really enjoy having around the most in firefox. Right now, I have 13 extensions installed, but the really good ones are as follows:

  • All-in-One Gestures lets me use mouse gestures for a few things (still using hotkeys for a lot of stuff). UL/UR for switching tabs left/right and RLR to close a tab are really the only ones I really use.
  • Sage reads RSS feeds in a handy sidebar. Who knew it could be so easy to check a bunch of sites for updates?
  • FlashGot lets you use an external download manager and also queue up a bunch of links on a single page for download at once.
  • Adblock preserves my www sanity.
  • Forecastfox puts 3 days of weather in my status bar. Oh boy do I like this one.
  • Web Developer is an a must-have tool for any web developer. It gives you a giant toolbar for doing all sorts of stuff.
  • SessionSaver should have been (and may be in the future from what I’ve heard) bundled with Firefox. It makes firefox start with the same tabs and windows open as there were before. (even in the unlikely event of a crash!) Opera has done this for some time, and ff kinda annoyed me by not doing it.
  • ColorZilla is a nice extension that will let you pick colors out of a web page among other things… although somewhere along the way, it decided something about my system wasn’t compatible with it’s ColorPicker feature… so it doesn’t exactly work for me right now.
  • All-in-One Sidebar (original author’s site this time) puts a whole lot of really useful goodies in your sidebar! I actually only just discovered this one while link-hunting for this article, and I am very impressed!

Comment with your favorites please!

Monday, December 5th, 2005 Software No Comments

Firefox 1.5 is the New Standard

My Firefox

Firefox 1.5 came out yesterday, and although I tried a beta some time ago and was impressed with the speed increase, I’ve held out upgrading for day-to-day use until the final release. This isn’t even so much because for the sake of a final release but also so the extensions I want would become available.

So, since I hear it might be some time before we see Firefox 1.5 backported to Ubuntu Breezy (let alone 64-bit packages!), I decided to just build it myself from source. Well, I had a tiny gotcha that I was able to solve, but now I’m lovin’ the Firefox!

It’s really cool:

  1. It’s 20-30% faster than the old 1.0.x versions in most cases making it rival even Opera’s speed.
  2. It caches pages so that when you go back/forward, the new page loads instantaneously. This is especially pleasing when I can use my mouse’s side thumby buttons to zip around in my history!
  3. You can drag/drop tabs around to reorder them—even between windows!
  4. It has lots of really nice extensions
  5. There are friendlier error messages.
  6. UI enhancements, particularly in the preferences.
  7. Loads of other stuff.

Firefox has been a really great browser for quite some time now. Version 1.5 seems to be very well refined product that is fast, easy to use, and very flexible.

Wednesday, November 30th, 2005 Reviews, Software 2 Comments

The Simplicity of AJAX in Rails

I thought I would take a moment and show you all just how easy these fancy AJAX interface tricks are with Ruby on Rails and some javascript libraries. With all my years of web development experience, I never really learned learned javascript properly. (I just borrow code from the online examples.) But RoR makes this stuff a breeze!

The real benefit to using this method is that when the user makes their selection, I don’t need to send them an entirely new web page. Instead, the “smart” (read: javascript equipped) web page actually makes an HTTP request to the server in the background. The server then responds with an HTML fragment that is then dropped inside a DIV element (replacing its prior contents, if any). As the programmer, I usually only need to make calls to the Rails “helper” methods which in turn spit out (still) very simple calls to the included javascript libraries. Why is this so cool? Because I can make a snappy-quick interface without sending down the entire catalog, and with an absolute minimum of work!

› Continue reading

Thursday, November 17th, 2005 Software No Comments

Breezy the Impressive

I’m not crazy about their names or color schemes, but Ubuntu linux seriously has the whole linux usability thing figured out. I upgraded my Hoary laptop to Breezy last Wednesday, and just yesterday switched my desktop that has been running Gentoo for 5-6 years now over to Breezy. Why did I do that, you ask? Well even if you didn’t, it’s because qt failed to compile, and rather than figure it out like I always have to, I said to hell with it. Gentoo is awesome, but things often take more time and research than they should.

The new Gnome 2.12 is so frickin smooth. Nautilus doesn’t crash like it did in 2.10, and there are new usability features that really make it a comfy environment. Hooray for linux on the desktop! \o/

I’ve ordered a pile of Breezy discs from shipit.ubuntu.com. So I’ll be passing those out to anyone who’s interested.

Monday, October 3rd, 2005 Reviews, Software No Comments

Why I Love Ruby on Rails

That first post I made about Ruby on Rails was more of a brain fart of excitement than a proper explanation of why it’s so cool. I really wanted to explain in my own words why I’ve decided I’d rather be working with RoR than any other framework, or at least the one I’m used to—PHP.

First of all, RoR is more than just a language; it’s a framework. This means that developers are encouraged to write applications in a roughly standard way, and all rails apps have a very similar flow. For instance, when you first begin a new rails application, you use the “rails” command line tool:

$ rails myapp

And rails generates all your starting directory structure for you—where to hold the application files, test code, external libraries, and so forth. And the fun doesn’t stop there! Say I have to write the same CRUD code I’ve down a thousand times in PHP to let an admin manage, say, users.

$ ruby script/generate scaffold User

Blamo! I get a model class that represents a user in the database, and a controller class complete with generated templates that handle all the flow for a simple CRUD. I need only to extend from this.

Rails uses what they call the Model-View-Controller (MVC) model. An instance of a model represents a single record in the database. It knows all about itself: how to validate its attributes, what its relationships to the other models are (which gives you lots of really sweet functionality for FREE!), and whatever else you want to program in. The view is nothing more than an erb (embedded ruby) template that spits out values calculated in the controller, which in turn is the class that dispatches and handles actions (incoming requests). Find yourself putting too much code into the view? Move the code into the helper (every controller has one) and call your new helper method from the view.

Here’s just a short example of how you might fetch some information about a product and display it to the user:

The controller, app/controllers/store_controller.rb:

class StoreController < ApplicationController
  def product
    @product = Product.find(params[:id])
  end
end

The view, app/views/store/product.rhtml

<% @product.attributes.each do |field, value| %>
  <%= field %>: <%= value %><br />
<% end %>

No lingering sql or extra code of any kind. Couldn’t you get used to that?

Yeah, you can do all the same stuff in PHP, but your code will probably turn out pretty ugly. I’m just loving how elegantly Ruby on Rails solves these web development issues. Just the other day, I started experimenting with AJAX and script.aculo.us js libraries to achieve some quite impressive effects and interactivity with very little effort.

The Rails people like to call it a “disruptive technology.” I’m not sure to what extent Rails is a disruptive technology, but I’m pretty sure there is a place for it in the future as we continue to see its user base grow like wild!

And there are lots of good tutorials and references at documentation.rubyonrails.com.

Saturday, September 10th, 2005 Software No Comments

Ruby on Rails

I’ve gotten behind! Hooray for rapid-fire postings!

I’ve known about it for a while now, but I only got my copy of Agile Web Development with Rails by Dave Thomas and David Heinemeier Hansson a couple of weeks ago now. I’ve since dived right into RoR, and I must say… the more I learn about it, the more impressed I become. It seems like the most elegant and simple way to write web applications I’ve ever encountered. This all stems from the DRY principle (Don’t Repeat Yourself). DRY says that every bit of application logic should be expressed only once in your code. Models form database objects that are very smart (they know their associations with other objects, they can validate themselves, etc).

I could go on and on about RoR, but instead I’ll just drop you a few links:

Wednesday, August 31st, 2005 Software No Comments

Mixxx Tutorial

In this post, I will attempt to give you an idea how I use Mixxx. This isn’t a detailed manual of all usage cases, but a howto or tutorial explaining how I use the program. Please post comments!

› Continue reading

Thursday, August 11th, 2005 Software 11 Comments

Skype as voIP Solution

I’ve tried Ventrilo (only for windows) and TeamSpeak (the advanced interface and actually having to connect to a particular server make it a bit tricky for newbies.) They’re both nice, but Skype seems even nicer.

Skype is a company that provides their client software for free, and without any malware even! This will allow you to connect with other users who have the Skype client software on their computer for free! The added bonus of this system is, if you want to drop some scrilla, you can call out to PSTN lines ($0.017 /min in US and a few other places), get your own phone number and take incoming phone calls (from PSTN), and/or use a voicemail service.

Anyway, the client application is very clean and easy to use. I would recommend it to anyone who needs the voIP services, or just wants to experiment with some cool things to do with your new fast wireless T1 connection you’ve got even though you live out in the middle of nowhere. Oh wait, that’s me. Nevermind…

Skype Me! I’m threadphone.

Saturday, June 25th, 2005 Computers, Software No Comments

@djthread

My Flickr Photostream

A photo on Flickr
A photo on Flickr
A photo on Flickr
A photo on Flickr
A photo on Flickr
A photo on Flickr
 

Categories

My History