Git up, Git on up

by aaron

Well what do ya know… Pandora, Twitter, Lost, and GitHub have something in common after all! Yeah, so I sort of avoided jumping on the bandwagon for a while, but each time I keep caving under pressure :) … although I’m still reluctant to admit that I’ve ever watched an episode of Lost.

So that’s big news for this project. I’ve spent the last few weeks tidying up some of the plugins and making the transition from Subversion to GitHub and Trac to Lighthouse. I’m really hoping that this change will help encourage more contributions to this project and give it a better spotlight to shine in.

Check out the goodies

Github: http://github.com/pluginaweek
Lighthouse: http://pluginaweek.lighthouseapp.com

If you need to access the old Subversion repository, I still have it up at svn.pluginaweek.org and it’ll remain there for a while, albeit deprecated, until most people have moved over to GitHub.

I really hope you’re as excited about these changes as I am :) And I look forward to a more social interaction with other developers such as yourself!

Comments Off 

Rails 2.1 Certified

by aaron

Toot toot! Rails 2.1 is almost out and the gravy train has set sail, full speed ahead! Are you excited? I know the girl to the left here is. She’s totally psyched about the upcoming release. Screw barbie dolls, you’ve got some upgrading to do!

You’ll be happy to know that all the plugins here are Rails 2.1 ready. That’s been my testbed for a while now.

I’m sorry, son. You must be 2.1 or over to enter.

The downside of being Rails 2.1 ready is, well… Rails 2.1 certified means NOT < Rails 2.1 certified. I don’t like code strictly meant for backwards compatibility. This project is maintained against the latest version of Rails and is meant to be implemented with the latest and greatest in mind.

Hopefully, for most people, that decision won’t have much of an effect on your project. If you’re lagging a bit behind and want to update a plugin, you should feel free to just make the appropriate patches needed. Sure, it’s a little extra work, but I think you’ll be happier with code that’s not just a bowl of spaghetti.

You wanted a bowl of ice cream anyway. Screw spaghetti.

Let me know if you run into any issues with the 2.1 release. I’ll be happy to take a look!

Go green with 5 lines of Ruby

by aaron

I decided to go “green” last weekend and spend a little time reducing the energy consumption of my computer. See, I’ve always left my desktop computer on at home while I’ve been at work or asleep. I’m sort of lazy and suspend never really worked that well in Ubuntu.

After upgrading to 8.04 and finding suspend working, I decided to overcome the “lazy” excuse and write a script that automagically suspends my computer after I’ve left and turns it back on before I come back. Now I never have to think about it (if I’m in a rush) and I can still significantly reduce energy consumption.

Here’s the meat:

#!/usr/bin/ruby
require 'time'
wake_time = Time.parse(ARGV[0])
wake_time += 24 * 60 * 60 if wake_time < Time.now
File.open('/proc/acpi/alarm', 'w') {|f| f << wake_time.utc.strftime('%Y-%m-%d %H:%M:%S')}
system('/etc/acpi/sleep.sh force')

This just takes a single argument representing the next time the computer should start up, sets up the ACPI to wake up at that time, and then suspends the computer.

I have 2 cron jobs set up to use this script:

45 09 * * 1,2,3,4,5 /home/aaron/Projects/Personal/green/sleep.rb 19:00:00
00 02 * * * /home/aaron/Projects/Personal/green/sleep.rb 07:45:00

This means the computer will always be off between 9:45am and 7:00pm on weekdays and between 2:00am and 7:45am every day. Now, sometimes I work late, so if you’re on Ubuntu and use Gnome, here’s a little extension of the script that will display a dialog and give you a chance to cancel the automatic shutdown:

#!/usr/bin/ruby
require 'time'
require 'timeout'
require 'gtk2'
 
begin
  # Wait a few minutes before going on in case we're working late
  Timeout::timeout(5 * 60) do
    dialog = Gtk::Dialog.new('Still awake?', nil, nil, [Gtk::Stock::OK, Gtk::Dialog::RESPONSE_NONE])
    dialog.signal_connect('response') do
      # User is still around
      dialog.destroy
      Gtk.main_quit
    end
    dialog.resize(200, 51)
    dialog.show_all
    Gtk.main
  end
rescue Timeout::Error
  # Time to go to sleep
 
  # Write the time that we're going to wake up next
  wake_time = Time.parse(ARGV[0])
  wake_time += 24 * 60 * 60 if wake_time < Time.now
  File.open('/proc/acpi/alarm', 'w') {|f| f << wake_time.utc.strftime('%Y-%m-%d %H:%M:%S')}
 
  # Suspend the computer
  system('/etc/acpi/sleep.sh force')
end

Every little bit counts ;)

P.S. The dialog extension needs a windowing environment, so I set up KAlarm to replace the cron jobs.

P.P.S. Disclaimer, be careful, blah blah .. you know the story.

A fresh perspective

by aaron

Looking back on past code oftentimes gives us all a case of the “What was I thinking?”. You could just ignore svn blame and pretend you didn’t write it, but you did. You sucked. And that’s okay. It’s hard (read: impossible) to write perfect code the first time; there are too many things you haven’t learned/thought/worried about yet.

In the beginning, there was function.

A fully-functioning piece of code is sort of your 1.0 milestone. That was the PluginAWeek milestone. There was all this code and, somehow, it all pretty much worked (at least, for a time it did). There wasn’t too much thought other than, “Hey! Let’s see what kind of fancy, shmancy stuff we can do with this!” Once you get on that gravy train, it’s hard to look back.

A lot of us get stuck in that 1.0 state. When I started on the re-building of this project several weeks ago, I did so with a different set of goals in mind.

And Ruby said, “Let there be elegance”. And there was elegance.

Functional plugins are awesome. But, hell, Apple doesn’t sell laptops just because they’re functional. If that were the case, no one would raise their hands when I ask “Who here is developing Ruby on a Macbook Pro?” (p.s. I am not in that group). There’s a lot more to it. And that’s the part that counts.

  1. Make it elegant. We develop in Ruby. We’re in love with simple, elegant code. Some of us get turned on by it. Make us love your code.
  2. Make it easy. Plugins are supposed to be drop-in code. I learned that the hard way. The more things I have to do to get your plugin working, the less of a chance there is that I’m going to use it.
  3. Write good code. Don’t hack it in. And don’t write hacks. Follow Merb‘s strategy: Distribute simple, elegant code. If someone wants to start using hacks, let them do it, not you.
  4. Extend, don’t overwrite. When I see a plugin copying framework code so some custom code can be injected, I’m immediately turned off. That’s hard to maintain and more likely to fail during upgrades.
  5. Write good documentation/tests. A lot of you hate it, I know. But do you know how many headaches we’ve had because of the lack of documentation for Pound? So many that we stopped using it.

Sequels are underrated. Honestly, who isn’t psyched for Indiana Jones 4?

Failure is just an opportunity to get it right the second time around. So don’t screw it up the second time around! ‘Cuz two failures are an opportunity for me to point and laugh at you and no one wants that, trust me.

POPSignal in Boston

by aaron

Tonight I’ll be at POPSignal in Boston, a party graciously organized in part by Brian Balfour, the founder of our company (Viximo). Hope to share a beer with you there.

A prelude

by aaron

What good would a comeback be if there wasn’t some Rocky story about how I found myself at the end of the road, the bottom of the bottle, the back of the bus, only to be miraculously motivated to push myself to the limits to get back in shape and fight for glory? That actually would be pretty awesome, but this ain’t Hollywood, Dorothy, and I ain’t Chris Gardner.

So I could just start talking about the actual plugins, but where’s the fun in that? I mean, c’mon, I have to tease you for a little while. Everyone likes a tease, don’t lie ;-) Before I start talking about the meat of this project, I want to give a background for newcomers and an explanation for oldcomers newcomebackers everyone else. I promise, this will be one of the few long posts here and it’s worth it.

Mommy, where do babies come from?

The PluginAWeek project started back in September 2006 and, like lots of people, I was really excited to contribute back to a community I had joined 6 months earlier. The goal was simple (or so it seemed): release at least 1 new plugin each week and add the occasional post on plugin development. A lot of cool things came out of that project and I met a lot of great people. Unfortunately, I couldn’t keep up.

The school bully is winning

In early 2007, school reared its ugly head and the PluginAWeek project went dry with no blog posts. I graduated in May, moved to Boston, and tried my hand at starting a company. When the company went nowhere, I spent time on covert operation PluginAWeek: Reloaded (yes, I’m a Matrix fan, don’t make fun). By October 2007, there were almost 70 plugins which had been developed and released into the public repository, but never announced in any fashion.

In November 2007, I joined a startup called Viximo, and put PluginAWeek in hibernation mode as I focused on other things.

If he were any cooler, he’d still be frozen, baby!

Last week I publicly announced the reopening of the project. For over a month, I’ve been spending my free time cleaning old plugins out of the repository and re-building, from scratch, every single plugin based on the experience I’ve gained working with this stuff for 2 1/2 years. And I’m really excited about the results.

There are now currently 32 plugins in the project. If you’ve tried your hand at one of them before, I’d ask you to take a look at it again. I assure you things have changed for the better.

RubyMan could totally take on IronMan!

So you’ve made it this far. That’s a good sign. It either means you’re legitimately interested in the project or you’re a sneaky recruiter trying to get me to give you some leads. What should you look forward to over the next few months? A lot.

I’ll soon start talking about the various plugins available in this project, but I implore you to go ahead and take a look yourself. I hope that they’ll help you out in one way or another!

I love me some preludes.

Comments Off 

Hello, World

by aaron

It’s been almost a year since we last talked. How have you been? How are the kids?

A lot has happened in the last year as I disappeared and found people playing “Where in the world is Aaron Pfeifer?” looking for information about PluginAWeek. Well, I have good news. It’s back.

Things are still coming together as I migrate the wiki, bug tracker, api, etc. so if you find a link that leads to the end of the Internet, don’t be scared. The Internet is round.

In the meantime, check out the source.

Comments Off 

« go back