Ruby’s attr_accessor method is much cleaner and easier to write than other get/set methods, such as those in C#.
I’m currently working on an application to take donations using Mephisto, ActiveMerchant and a custom Mephisto plugin. We’re not storing any of the credit card data in the database so I needed to extend the model to virtually include the credit card number, expiration date and card type.
In C# I would add getter and setter methods as such:
public int ccnumber
_ccnumber = value;
Ruby makes this much easier and really is elegant.
Beautiful isn’t it? When part of an ActiveRecord model you have full validation capabilities as well.
FYI – If you want to write plugins for Mephisto, you’ll need Rails 1.2.x+ and the edge version of Mephisto from the repository. 7.3 doesn’t have plugin capability.
The combination of Apache, Lighttpd and FastCGI has been the best option for hosting rails applications over the last few years. While Mongrel arrived on the scene to replace the Lighttpd/FastCGI portion, the performance gains weren’t that great. That was until a few people stumbled upon Nginx, and blazingly fast proxy server that was built for speed and scalability at a Russian hosting company.
While I had never been happy with the performance of Apache, Lighttpd and FastCGI for hosting Rails, it was in fact a more pressing need that caused me to find something faster. See, there is this little known fact that FastCGI caches ranges for model validations in Rails.
But caching is good isn’t it?
Well, not in this case.
I’m shifting my focus to talk about what I love. Building scalable web sites using the right technology for the job.
I’ve decided to change my blog’s focus today. Rather I’m going to have one.
I’ve been abusing myself this week with a jet ski on beautiful Burt Lake in Indian River, MI. Between racing around bouys and reading Seth Godin’s latest book, The Dip, I decided to concentrate on what I do best: Building websites that work. Period.
This includes choosing the proper language for the job, structure, reuse, optimization and scaling when you need it.
Coming soon I’ll document my foray into hosting Ruby on Rails sites using nginx and mongrel cluster compared to Apache 2 and fastcgi. Let’s just say one of them is better than the 2nd. Alot better.
A few months ago I expanded my podcast listening beyond TWiT and Windows Weekly to include MacBreak Weekly. Out of that show has emerged another solid podcast that should be great once the iPhone launches. The Apple Phone Show is put on by Scott Bourne and features guests like Chris Breen and Andy Ihnatko talking up the iPhone and its possibilities.
I can’t wait to see what they turn up once the iPhone is finally here! Come on 6/30!
I’ve been wanting to use OpenID for a while, but I was having problems getting it to work on Windows. I think it was a hashing issue, but I could never narrow it down. Since then, I’ve gone away from Moveable Type on Windows Server 2003, on to Mephisto on CentOS and finally to WordPress on CentOS. Guess what? It works on linux.
The OpenID server implementation I am using is phpMyID. It very easy to implement and works great.
I looked around before hand, but I couldn’t find a WordPress plugin to implement OpenID server. That’s why I went back to phpMyID. You unpack the zip file to a subdirectory (phpMyID), hash “username:realm:password” using openssl md5 and then add the values to the config file. The last step is to add two lines to your home page template so site know how to auth against your domain:
Like I said, it’s easy.
Now that I’m motivated, I may just have to create a WordPress plugin…
I just couldn’t deal with Mephisto anymore. It isn’t ready for prime time and really needs some work before it will be. I was hoping it would be a good rails app so I could tinker, but I don’t have that much time.
Both from a blog and site standpoint, WordPress runs circles around Mephisto. Themes, plugins, etc. So much better…
I was up in minutes. I actually think it took longer to ssh into the server than it did to install wp!
I finally picked up a copy of Wilco’s Yankee Hotel Foxtrot today. Over the weekend I caught the tail end of a special on them that was filmed during the making of the album. What I heard and saw were oddly interesting.
My old boss Peter McCormick, one of the co-owners of ExactTarget, was a huge Wilco fan when this dropped and raved about it on several occasions. At the time I didn’t bother to take a listen and understand why he loved it so much. I thought it was a crazy Minneapolis thing.
Frankly, I’m not sure I would have understood it. I just wasn’t ready.
Brilliant. Layered. Inspirational. 4th spin in a row. I’m hooked.
Update: I’ve since gone back and purchased A Ghost is Born and the oustanding live album Kicking Television – Live in Chicago. I can’t waiting for Sky Blue Sky to drop next week!
Here’s a great little read from Freelance Switch on the different types of clients out there. I often think about the types of clients TGFI has and the balance that we keep among them. It’s good to have a bit of everything to keep you honest to the world. Trust me, we do.