Archive for the 'Web Development' Category

The World’s Oyster

Thursday, August 20th, 2009

Its been a long year and I’ve had very little time to keep things updated around this site but here’s a preview of something we’ve been working on with a client. Its a self updating address book so you never lose track of your contacts when their information changes. Signup, try it out, and let us know if you have any ideas for improving it.

The World’s Oyster

Hiring full time Rails developers

Thursday, February 19th, 2009

My company Onomojo, http://onomojo.com , is searching for a few quality Rails developers to bring onto our team. You need to have some experience under your belt and have urls to show for yourself. You must develop on a Mac or Linux. Windows users need not apply. This is a telecommute position but ideally you’d be located either in Hawaii or North Carolina. If you’re interested, please send your desired salary, date you can start, and your resume to hr at onomojo dot com

Rojo – An open source Ruby on Rails CMS

Saturday, February 7th, 2009

I’ve been planning out a content management system in Ruby on Rails for a while now and will be releasing a beta version in the next few weeks. I’m calling the project Rojo. There are quite a few CMSs out there for PHP already and they’re quite mature at this point but the ones I’ve seen for Rails are pretty pathetic to say the least. They’re all really limited in functionality and lack modularity so they’re not always the easiest to extend.

My company, Onomojo, does a decent amount of Ruby on Rails development and have been working on building a solid CMS that’s modular, easily extended, and easily customized. The project itself is coming along nicely. I’ve taken concepts that I like from different content management systems that I’ve used over the past decade and combined them in a way that helps minimize the effort involved in developing Rails sites for our clients. I’m pretty excited about it and I’ll be releasing the core code and the plugin code to the public after we get a few pieces developed so stay tuned for more on Rojo.

Rails HTML Sanitize gem

Saturday, January 17th, 2009

I was recently working on improving the search engine rankings of a site with lots of user generated content and noticed that users were creating 404s through bad links. The users were able to add links to other sites in their comments and such but sometimes the links were bad. Sometimes they were even local links so the search engines were effectively seeing a bunch of internal 404s from the user generated content. This was essentially defeating any seo being done elsewhere on the site and needed to be fixed quickly. My original idea was to use hpricot to scrub all the anchor tags and append a rel=”nofollow” tag to them all. I was mulling over how to write the hpricot parsing code when I found the Sanitize gem. It does exactly what I needed and saved me the hassle of writing the hpricot parsing code. The gist of it is:

[source:ruby]
Sanitize.clean(html, Sanitize::Config::BASIC)
[/source]

As an added bonus, it also can scrub out unwanted script tags and more. Now, the site won’t be nicked for having internal 404s from the user generated content since they’ll all have rel=”nofollow” on them.

Webster’s Classroom redesign

Saturday, January 10th, 2009

It’s been a long time coming but we’ve finally published our redesign of the Webster’s Classroom site. Webster’s Classroom helps teachers make classroom websites. We’ve also incorporated a new school site feature which will allow schools to take advantage of the features offered with Webster’s Classroom and get their entire school online. Its a service site offering school website design through my web development company, Onomojo. Check it out and tell your teacher friends about this great free tool.

Webster’s Classroom redesign

Ditching Mongrel for mod_rails

Sunday, May 25th, 2008

I build a lot of Rails apps on a regular basis and each one I add to my server takes another bite out of my limited resources. The way I’ve traditionally setup a new Rails app was using a Mongrel cluster. I found it to be a lot more reliable and faster than the fcgi approach people use to use (and some still do). The downside to setting up a few dozen Rails apps on your server with each running a Mongrel cluster is that it eats up all your memory. One of my sites is starting to get a lot more traffic than it has been in the past and its putting additional strain on the server. As a result I decided to find an alternative to Mongrel. I’ve tried searching for alternatives in the past but everything sent me back to Mongrel. Until today of course when I came across Jamie Flournoy’s blog about mod_rails.

Excited for an alternative to raising a pack of resource hungry mongrels on my server I installed the gem and tried it out. It was exactly what I was looking for as far as ease of use straight away. All I needed to do was stop a mongrel cluster and simplify its virtual host directive in Apache to leave out the mod_proxy_rewrite and the other wonky rewrite rules. The first app I tested went smoothly but suddenly the server started misbehaving. Resources were being eaten and it wasn’t clear what was doing it because the app I was testing with is behind an Apache password and I’m the only user. I ended up having to turn off the mod_rails to get my system back in control. The problem turned out to be that by default mod_rails tries to test if your virtual host directory is a rails app or not. I have a few apps that I tossed in an instance of WordPress into a blog directory inside my rails app directory. I found it convenient to toss them all into the same directory since its all the same website. As a result mod_rails was doing a ../ check to see if the blog directory was a rails app which it decided it was. That’s where the craziness came in because its a php application. Anyway, the quick solution was to move the blog directory out of the Rails app directory.

Other than that my memory usage is way down. I’ve migrated all my low traffic sites to mod_rails and I’m happy with how they’re performing. There is a little delay on the initial load of the app but subsequent calls are quick because its already loaded. I can wait an extra 2-5 seconds for my low traffic apps to load in exchange for hundreds of extra megs of free memory.

I haven’t moved over my higher traffic money making sites yet and I’m not entirely sure I will until I’ve tested mod_rails a bit more. I’m extremely happy with the results thus far though.

Reducing Rails model callbacks

Tuesday, April 22nd, 2008

I’ve been working with a client to optimize parts of their Rails application. The problem is that a method in the app does some simple updating of a few model objects but because the model has so many relations it goes through a ton of unnecessary callbacks. There are issues related to data concurrency which means you have to do the callbacks but in this particular situation there won’t be any concurrent updates to the data so the callbacks can be omitted. The solution to the problem was trivial when using the save_without_callbacks Rails plugin. Just adding a simple:

[source:ruby]
some_object.skip_callbacks = true
[/source]

before the update_attribute reduced the number of SQL UPDATE queries from 90 to 8. Lesson learned. If you need to skip model relation callbacks on save this plugin is for you. Be careful about data concurrency issues though.

Obama, Hillary, and McCain website languages

Monday, April 21st, 2008

This isn’t really the proper forum to be blogging about political preference, however, I stumbled upon a key difference in the three presidential candidates Obama, Hillary, and McCain with regards to the language they chose to program their campaign websites with. A quick browse through the links on the McCain site shows that they use ASP as you can see from this link:

http://www.johnmccain.com/ActionCenter/registertovote/information.aspx

A similar search through Hillary’s site confirms the same. They use ASP and you can see from this url:

http://www.hillaryclinton.com/video/158.aspx

Now, saving the best for last, Obama has a smarter approach to technology and uses PHP instead as you can see here:

http://www.barackobama.com/index.php

Based solely on programming language choice for their web development which candidate would you choose? Given that I’m a Rails and PHP developer (albeit I once programmed in ASP for a paycheck) I think I’m going to have to go with the better language choice. It says something about where your head is.

New Onomojo design services

Thursday, April 17th, 2008

Its been a long time coming but we’ve finally got our new site design finished for Onomojo. We’ve also expanded our services to include graphics design, logo design, web design, and a whole slew of other graphics related services. That’s in addition to the services we already provided which were primarily programming, seo, and marketing related. Here’s a screenshot of the new design.

Onomojo screenshot

Googlebot and redirect_to :back

Thursday, February 28th, 2008

The other day I noticed a pretty significant SEO related problem with using a built in Rails construct. I noticed a problem when I started getting application errors that were letting me know that the user agent was none other than our friendly Googlebot. A closer look at the app shed light on a problem you may not have even expected. When using

[source:ruby]
redirect_to :back
[/source]

it will take a look at the HTTP_REFERRER and redirect the user to that url. The problem, however, is that Googlebot doesn’t send a referrer and neither do a whole bunch of other search engine spiders. The result is that when they visit your site they get a nice 502 server error because Rails raises an exception. It doesn’t know what url to redirect to so it send a 502 error. Googlebot then sees your site as a bunch of 502 errors in the situations where you’re using redirect_to :back. Take a look at the Rails API and you’ll see the last line clearly mentions this.

The solution is to catch the RedirectBackError the redirect_to raises when there’s no referrer. Its a simple fix but one you need to be on the lookout for or else you might end up with a few 502 errors giving you bad mojo with the Google gods.