randys.org

Wasting your precious bandwidth since 1999

Posts Tagged ‘rails’

Personal goal: Learn Ruby (on Rails)

The time has come. I need to discipline myself to learn Ruby (on rails). It’s been around for quite a while now and I just have dig in. So I’m making a new personal goal: learn Ruby or bust.

The problem is that breaking the PHP habit will be dificult. Although, I’ve become more OOP aware and always try to create objects instead of random functions. I suppose I could stick with PHP and use Cake or Zend’s Framework to build MVC style applications, but, that sounds increasingly boring these days. I need something new to obsess over.

So, I’m off to learn. I can’t really learn by book; it just doesn’t work for me. I have to get my hands dirty. What better way to do that than to build something. I’m not talking about building a blog in 15 minutes (especially since there several other blogging type applications written in RoR already). It will have to be something somewhat unique that will keep me interested enough in the language and challenging enough to keep me busy. I’m open to suggestions and always open to collaboration (if anyone is interested).

• • •

Long time, no post

I know it’s been a while. I’m sorry. I went through a phase where I just didn’t feel like contributing very much (hence the Tumblr episode). Don’t worry, the vast void of meaninglessness is still available and I’ll still be posting uninteresting tid-bits I find on the intertubes there.

So, last night I took it upon myself to give this site another chance. This time, with the help of Mephisto (another RoR blogging app). The install went smoothly. The conversion was a little bit of a pain, but I managed to make it work with a little help. So far, I like Mephisto. Better than Typo. It has less ‘bells and whistles’ but manages to have the essentials. And, it feels faster on my poor little 256MB VPS. It’s been running over night (granted with minimal to no traffic) and it’s currently sitting at ~40MB of memory (compared to the 60 - 80MB that Typo would suck on regularly).

Don’t get me wrong, Typo is a wonderful product. However, because I’m limited on RAM, I became frustrated with Rails thinking it was a complete memory hog. But that’s not the case really since I’m running Mephisto wich uses the same framework and the memory consumption is almost half of what Typo was using. If I had twice the memory, I’d probably still be using Typo… but I don’t and I can’t afford to throw more money into a site that doesn’t reciprocate.

I’m hoping to really dig into Ruby now. My crappy side gig with .e is winding down and I’m pretty much fed up with my day job so I’d like to move completely away from the Java/.NET environment I’m forced to work in everyday. Nothing would make me happier than be able to work on my Mac (or any Mac for that fact) doing PHP or better still, Ruby/Rails work. Call me snoby, I don’t care. It is what it is.

• • •

Changing Permalinks In Typo

When I switched from Wordpress to Typo, I faced the issue of keeping my Wordpress permalinks in Typo. Unfortunately, there’s no simple way of doing this. I noticed the ‘redirects’ table in the database, but I could never get it to realy do anything. So, I had to dig in and find the bit of code that controlled the permalinks in Typo.

Typo uses ‘articles’ as it’s base for all posts so I looked in config/routes.rb and found what I needed to change. As you can see from the url of this post, I use ‘content’ as the base of my permalink. So, I changed all the references of ‘articles’ to ‘content’ and all seems to be right in the world.

I changed

1
2
map.connect 'articles',
    :controller => 'articles', :action => 'index'

to

1
2
map.connect 'content',
    :controller => 'articles', :action => 'index'

and then changed

1
2
3
map.connect 'articles/:year/:month/:day',
    :controller => 'articles', :action => 'find_by_date',
    :year => /\d{4}/, :month => /\d{1,2}/, :day => /\d{1,2}/

to

1
2
3
map.connect 'content/:year/:month/:day',
    :controller => 'articles', :action => 'find_by_date',
    :year => /\d{4}/, :month => /\d{1,2}/, :day => /\d{1,2}/

and so on.

The only thing I haven’t gotten to work is to map the pages. I can change the ‘pages’ map, but it doesn’t act as desired. I only had 3 pages in Wordpress, so I might as well either alias them or premanent redirect in the Apache configuration.

If anybody has some insight, I’d love to here it. Also, still haven’t figured out why mod_rewrite is working like it should.

• • •

Typo, Apache & Mongrel, Oh My!

Wow. I’ve been testing the possibility of running Typo on my VPS with the pre-notion that it just wouldn’t work very well. I think I may be wrong. It’s been running for about a week while I tweak some shit and so far, my memory performance has been stable. Of course, thing would probably be different if I threw some real traffic at it… but, then again, I don’t get a lot of that.

The Setup

Initially, I was going to use lighty + fastcgi to serve up the Rails application. So, I had setup lighty to serve up my PHP/MySQl sites and that worked just fine. Then I started reading up on Mongrel and wanted to see what all the hubub was about. But then I got to reading the Mongrel site (more specifically the part where he says don’t use lighty and mod_proxy).

Crap.

Aight, so back to Apache and their proxy setup. no biggie. I racked my brain for several hours one night trying to figure out why the hell I kept getting these 403 Forbidden errors in Apache. Hours. After the millionth Google search, I finally found the issue: The mod_proxy configuration in Ubuntu is turned off by default (well, not really turned off… it just denies traffic to the proxy server).

 8     <Proxy *>
 9         Order deny,allow
10         #Deny from all
11         Allow from .randys.org
12     </Proxy>

Line 8 was initially not commented out. I had to comment that out and add the Allow from .randys.org bit.

Once I got that changed and reloaded Apache, everything is working nicely together.. even PHP.

The Tweaks

So far, the only tweaks I’ve managed to make is to the flickr Sidebar plugin. It now uses Lightbox V2. That was a bit tricky, considering I don’t really know Ruby but, it all worked out in the end.

As I figure out more stuff to do, I’ll post more.

• • •

Ubuntu + Rails + Typo

So, I’ve decided to give Typo another shot. This time, using Apache 2.0 and Mongrel running on Ubuntu. So far, it seems kind of sluggish. I could just be the VPS node that I’m on. I’m well within my memory limits (currently at ~63% capacity), but VPSLink has been experiencing a rather high level of disk I/O issues that’s causing a slow down in overall performance of my VPS.

Anyway, Typo is definitely more pleasing to look at (from an administration standpoint) and it will force me to learn the ins and outs of Ruby on Rails.

• • •

All content Copyright © Randy Sesser | Hosted by WebFaction
Entries (RSS) | Comments (RSS)