Rails Refactor, a small command line tool to make rails refactoring more fun, is now available as a gem. To use:
gem install rails_refactor
More info available on github.
Rails Refactor, a small command line tool to make rails refactoring more fun, is now available as a gem. To use:
gem install rails_refactor
More info available on github.
Outstanding news! As part of the rails refactor talk at RORO (Sydney Rails Group) tonight (great evening by the way!), I asked for a show of hands on people’s favoured editors. I was amazed to discover the vim has edged out TextMate with just over half of the people at the group using it as their editor of choice! As an aside, Netbeans had one supporter, RubyMine and Emacs had zero. The groundswell of support for vim (and the cheering) was impressive!
PS – this is a very nerdy post, but as a long time vim fan, I had to report on it 🙂
I’ll be giving a short talk with Ryan Bigg on Rails Refactor at the next Sydney Rails Group (RORO) meet (Tuesday, Feb 8 from 7pm) . We’ll be talking about Rails Refactor’s birth at a hack night last year, what it can do for you right now, and its bright future as your refactoring tool of choice. Hope to see you there.
I’ll be giving a short talk on Starting Android Development on Tuesday at the Sydney ALT.NET group.
We’ll be covering:
Richard Banks (@rbanks54) will also be giving a talk on .NET bdd tools.
More info and RSVP on the ALT.NET blog.
See you there!
Palm and its Demise
I’ve been using Palm organisers and smart phones since the year 2000. I enjoyed developing for them, writing several medical applications, and using them extensively for calendaring, contacts and memos (PIM). The Treo smart phones were visionary at the time, providing integrated phone and PIM functionality, plus push email and basic web browsing.
I was at the lavish developer conference in Sydney, when Palm was the market leader, and announced they were splitting into two separate businesses – software and hardware, and developing a new OS (Cobalt), which never saw the light of day. After that, Palm slowly lost its lead. I would have been interested to try out Palm’s last throw – the Pre and WebOS – but it never made it to Australia. Now Palm has been purchased by HP, and it is abundantly clear that Palm has had its day, and it’s time to move on. Goodbye Treo 650 and Palm OS Garnet!
Where to next?
Well, major contenders for smart phones at this point are iOS and Android (sorry Windows Phone 7, maybe next release :)). The iPhone is a nicely crafted piece of consumer electronics, and it’s the obvious choice for many people. Personally, I like the polish, but find the limitations of the OS and clumsy notification system, vendor lock in and tightly controlled environment does not appeal. Android, especially with 2.2, is pretty smooth. It requires a lot more tweaking than an iPhone to get it to a good state, but once set up, it’s a really nice experience and lets you do quite a lot of stuff you can’t do on an iPhone. I chose a HTC Desire HD and Android 2.2.
Android Migration
What I particularly want to share is how I migrated my data across from Palm OS to Google services and Android 2.2, and what applications I chose to replace the beautifully crafted Palm PIM system. There’s still some Palm users out there hanging on, and I’d encourage you to take the leap and move over to Android.
Aims
Apps & Architecture
After quite a bit of research and trial, I decided to go with:
Data Migration
Conclusion
In conclusion, I now have my data and quite workable PIM functionality on my Android phone. Business Calendar has a great multi-day view that my old palm didn’t, but it is a bit slower to add new events. The HTC Contacts app gets pictures from Facebook which is pretty cool, and syncs with my gmail so I don’t have to maintain email addresses in two places. It is a bit more clunky to edit and add contacts though. On the memo/note front, B-folders encrypts notes which is cool… but a bit irritating to need to enter your password every time you launch the program. Also it is more clunky to edit notes and does not save your last open note, and position in the note between launches. The rest of the phone functionality is great though and a huge step forward from the Palm. It’s really for a separate post to talk about these, but good web browser, GPS with maps, train timetables, movie times near you, twitter client, etc make it an amazing device and well worth the upgrade.
On the ultra-geeky front, I watched the original TRON last night, kindly leant to me by my buddy Doctor Dray. Having never seen it before, but heard a lot about it, I was keen to watch it at last. The core idea of computer programs personified is pretty cool, and the 80s rendering is interesting to watch (looks like stuff we did in computer graphics class at uni!). The plot does stretch belief a bit too thin at times though. To get an idea how far movie tech has come between the 80s and today, check out the original 80s trailer and the new Tron Legacy trailer.
Also, at high school, I and my fellow geeks spent quite a bit of time writing games in C like the TRON light cycle game, cunningly avoiding copyright violation by calling them NORT. After writing the 2 player version, we moved on to writing simple AIs so that you could play against the computer. Recently going through an old computer’s hard disk, I found the code for these. Thanks to the backward comparability features of Windows they still run, although they were written in Borland C/C++ for DOS! Amazing blast from the past.. here’s a picture of AI NORT in action:
nRake is now the subject of a Microsoft case study. Check it out here:
UPDATE: Now on the Microsoft Case Study site.
During the RORO hack night last Wednesday, Ryan Bigg (@ryanbigg) and I worked on a Rails Refactor, something I’ve been meaning to get going for a long time.
How often have you wasted time doing renames in rails? Sure it’s hard to automate everything without understanding the code, but there sure are a lot of mechanical steps that you can easily automate. Ryan and I took on controller renames and got a fair way in the few hours we spent on the night.
To rename a controller:
$ rails_refactor.rb rename OldController NewController
To rename a controller action:
$ rails_refactor.rb rename DummyController.old_action new_action
Looking to extend it with model renames, and then more complex refactoring.
If you like it, please fork and contribute 🙂
While comparing Dates and Times in Rails (both 2.3 and 3), I came across an odd behaviour:
>> Time.parse("Mon, 26 Jul 2010 9:59") == Date.new(2010, 7, 26)
=> false
>> Time.parse("Mon, 26 Jul 2010 10:00") == Date.new(2010, 7, 26)
=> true
>> Time.parse("Mon, 26 Jul 2010 10:01") == Date.new(2010, 7, 26)
=> false
Also
>> Date.new(2010, 7, 26) == Time.parse("Mon, 26 Jul 2010 10:00")
=> false (Rails 2.3)
=> nil (Rails 3)
>> Date.new(2010, 7, 26) == Time.parse("Mon, 26 Jul 2010 0:00")
=> false (Rails 2.3)
=> nil (Rails 3)
Tonight, we’ll be having the RORO hack night in the ThoughtWorks Sydney office, with a focus on open source projects (your own or contributing). A patch for this date/time behaviour might be an interesting area to pursue.
Quick ruby quiz.. after these two lines execute, what is the value of number?
>> number = 5
>> (1..10).each {|number| print number}
Well, number will be 10, thanks to the block being run and re-assigning the value of number. This can cause you some pretty subtle bugs if you happen to have the same name for a local/function argument, and as a variable name in a block.
In C#, the compiler is kind enough to tell you that this would be a very bad idea and give you an error.
And thanks to Sudhinda for commenting – this has been fixed in Ruby 1.9. In 1.9, the variable used as the argument in the block does not affect the variable outside the block.
Powered by WordPress & Theme by Anders Norén