Rails 3 on debian with Sqlite 3

October 13, 2010

Decided to move to Rails 3 recently and get up to speed on the new framework version.

I list here the process I followed to install it on Debian (Lenny).

*Note, some of these commands need root / administrator privileges. Notably the apt and install commands. Use sudo, su or a root shell.

Install dependancies

# optional VCS, we use Mercurial Locally and Git for deployments to Heroku (hosting)

apt-get install git-core mercurial

# libmysqlclient15off libreadline5-dev
apt-get install build-essential libreadline5-dev libssl-dev zlib1g zlib1g-dev

#optional Database, I have detail for getting Sqlite3 later
#apt-get install mysql-common mysql-server

Install Ruby

wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p0.tar.gz
tar xzf ruby-1.9.2-p0.tar.gz
cd ruby-1.9.2-p0
./configure
make
make install

Install sqlite 3

wget http://www.sqlite.org/sqlite-amalgamation-3.7.2.tar.gz
tar xzf sqlite-amalgamation-3.7.2.tar.gz
cd sqlite-3.7.2/

./configure
make
make install

gem install rails sqlite3-ruby

Create your rails app

rails new Items
rails g scaffold Item name:string detail:text
rake db:migrate
rm public/index.html
vim config/routes.rb

add this line:

root :to => "items#index"

then start the server:

rails s

Open your browser and go to http://localhost:3000/

And that’s it!


Deploying your Rails 3 app to Heroku from Debian GNU/Linux

October 11, 2010

Deploying apps to Heroku is as simple as

git push heroku master

But you need a little bit of setup first.

If you haven’t got git, install it with

apt-get install git-core

You will also need the Heroku gem

gem install heroku

Then set up your app, adding the files to the git repository

cd myapp
git init
git add *
git commit -m 'first commit, using git for pushes to heroku which hosts rails apps free and uses git'

Create a key for secure authentication to Heroku

ssh-keygen -t rsa -C "me@mycompany.com"
heroku keys:add

Create your heroku app

heroku create

And push your new rails app to it

git push heroku master

Now browse to the url you were given in previous steps as feedback from heroku, and you should see your app, now live !


Favicon/URL/Bookmark icon for you website

October 7, 2010

You can easily create a bookmark icon / URL icon / Domain Icon / favicon.ico for your website.

This is usually called favicon.ico, and usually exists in your web root folder (htdocs, public_html, etc).

Why would you do this?

  1. Your Brand is present in the users Browser URL/URI field in browsers and/or on the browser window or tab title
  2. Your Brand is present in the users browser bookmarks
  3. You user can easily find Your Brand in their bookmarks list – from my perspective, this is a big win.
    1. I have a couple of options bookmarked for the types of online service I use most, and in the cases where one of the sites has no favicon and another does, I inevitably end up using the site that has the favicon, simply because their favicon stands out immediatly in my list of bookmarks.

Your favicon can be a .ico, .gif or .png file.

I use .png more and more. I use a 32×32 pixel file but you can use 16×16 also.

http://en.wikipedia.org/wiki/Favicon

Generally, for the simple/default case, you just name the icon as “favicon.ico” and upload it to the root directory of your website. The broswers will check for it there (http://www.yourdomain.tld/favicon.ico).

You can also use this markup, per page, to have a favicon per page.

<link rel=”shortcut icon” href=”/img/favicon.ico”/>

 


Reset Administrator Password on a Mac / Apple Mac

October 7, 2010

Have tried this on a Tiger OS X

  • Reboot
  • Hold down Apple+S when you hear the chime
  • When you see the Aplle on screen, hit the power button once

You should see the text prompt now

Type:

  • mount -uw /
  • passwd
  • reboot

That’s it.
You should be able to log into the administrator user account with the new password you set now.

You keychain will probably be useless no unless you remember the password for that. I had connectivity issues, the airport would not connect to my wireless networks.

Once I deleted the login keychain, the network issues went away.

To delete the login keychain:

  • Open Applications/Utilities/Keychain Access
  • Click the Login keychain
  • Choose Edit -> Delete

Follow

Get every new post delivered to your Inbox.