Monday, January 24, 2005
Ruby on Rails
This article is going to compile information I've found in a few places just to let people know about this great application framework. Personally, I've just started with this thing, but it did take some searching to figure out how to get it installed. From what I hear, installing it is the hardest part of using it, and now after this, so many things are a breeze.

First, I'd like to point out the Slashdot posting on it. My biggest concern in this discussion is that it seems like many people think that in order to use Ruby their web host needs to have it preinstalled for them. Well, I am here to say that I got it done with my webhost, nicewebhost.biz (Disclaimer: I sell hosting here under a reseller account, therefore I don't have root access. I wish I did because I would make Ruby available to all my users. This is the next best thing I can do.) This will be exactly how I got it working at
nicewebhost.biz, but will also show you some of the challenges you might have at your own webhosts when setting up Ruby and Rails.

I have to thank the information here on figuring out the primary step in installing Ruby without root access. Here is what I did then on nicewebhost. I had to pay $14 extra for the year to get SSH access. But even that added in, I think the total amount that my clients and I pay for hosting is still inexpensive. Login to you SSH account.

mkdir -p ~/www/usr/src/ruby
cd ~/www/usr/src/ruby
wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.2.tar.gz
tar xvfz ruby-1.8.2.tar.gz
cd ~
HOMEDIR=`pwd`
cd ~/www/usr/src/ruby/ruby-1.8.2
./configure --prefix=$HOMEDIR/usr
make
make install
PATH=$PATH:~/www/usr/bin

Ok now the Ruby part is over. Its time to install Rails. Gem is a cool tool to manage third party software for Ruby (I am starting to tear I thinking about how much time I spend with classpaths and Java jar files all day).

cd ~/www/usr/src
wget http://rubyforge.org/frs/download.php/2412/rubygems-0.8.4.tgz
tar xvfz rubygems-0.8.4.tgz
cd rubygems-0.8.4
ruby setup.rb

That was it, now to install rails.

gem install rails

Answer Y to installing activerecord and actionpack.

Ok, now I am going to go through some of the instructions at the Rails wiki site. Lets create an application directory.

rails /home/www/firstapp

Your rails application is now seeded with all sorts of files, with the correct permissions . We have to change the default path to Ruby in those files.

cd firstapp/public
ruby -i -pe 'gsub!("#!/usr/local/bin/ruby", "#!/home/www/usr/bin")' public/dispatch.* script/*

Rails uses an Apache .htaccess file in the firstapp/public directory to route web requests. With nicewebhost.biz you need to use the Control Panel and password protect the public directory to get the .htaccess file working.
Open up your Control Panel and go to the "Site Manager" section and click on "Password Protected Areas". Password protect the /home/www/firstapp/public directory for a single user. Don't worry, the .htaccess file will override the protection you are setting here, but nicewebhost requires the directory to have some default password protection in place first. So password protect the new rails application directory (for example: /www/firstapp/public) with a user of your choice. We are almost done. The .htaccess file needs one tweak to make it good at nicewebhost. They don't allow Options in the .htaccess file, since the necessary one are already configured by default. So run

cd
/www//firstapp/public
ruby -i -pe 'gsub!("Options +FollowSymLinks +ExecCGI", "")' .htaccess

Now open a web browser and go to your site (http://www.
your domainname.com/firstapp/public). And you should get your Congratulations screen! Now there is just one more step to allow for the default .htaccess to work out for you. You should access your new rails application from a sub domain. I am sure people can figure out some other things with the .htaccess file, but I am new to this, and I found that using a subdomain pointing to the public directory worked great.

Go to the Control Panel again.
Go to "Site Manager" -> "Subdomain Manager"
Add your subdomain and have the path point to /www/firstapp/public

Now if you continue on and follow the instructions in some of the tutorials (I will assume that most of you here can figure out the MySQL stuff with phpMyAdmin that is also in the Control Panel. If not just let me know.) everything should work out perfectly. Just access your application at your new sub domain:

http://subdomain.yourdomainname.com

Have fun with Rails. It looks like a fun ride. I made certain assumptions about everyone's comfortablity with MySQL and other things. If you have any further questions about this article or nicewebhost.biz please don't hesitate to send me an email at nate@inventric.com.

Monday, January 10, 2005
Do affiliate programs really work?
I keep asking this question. As some of you may know, I have been dabbling in affiliate programs lately. It started with a program from work (Digital River) that gave me the chance to make this: www.safelykept.com. So far I haven't sold much here and have spent more on advertising. A few people in the program have become profitable and are selling $1000s per week in software. I don't know how profitable. This opportunity though has really gotten me to learn a ton more about marketing and affiliate programs in general.

My favorite find is some stuff at this site www.dangrossman.info. This guy is 20 years old and still in school at Drexel U. He puts a lot of good, helpful, honest stuff in his blog and his forum communications. From what it looks like, this guy is having a lot of success as his profit from this year has paid his last 2 years of school tuition and living expenses. Is that like 50Gs!? For a 20 year old kid doing this part time while in school! Ok, now that has to be motivation.

He has a lot of advice on his site, but the one thing that is standing out the most to me, is that he has had much more success selling other people's services than products. So the reselling of hosting, advertising, etc. does much better than his attempt to sell cooking supplies from Amazon. With that in mind, I think I am going to venture further down this road of affiliate marketing of services.
Monday, January 03, 2005
Zip codes
I have been doing application development for years. Often I see applications that take user registration information. One of the largest issues with the user registration scenario is attempting to receive accurate data from users. Having a complete database of zip codes, cities, states, etc. is one sure way of programatically verifying a registration. Here is a nice collection of this type of information that you can include in your application:




Subscribe in NewsGator Online

Copyright 2005-2006 © Inventric LLC. All rights reserved.