Install node on linux
1) Install g++ c++ libraries as follows
Setting up redmine 1.2 on heroku with redmine_s3 plugin
Tested system cnfg: Ubunut Lucid 10.04.3 LTS
Libraries Requirements: Essential libraries and rvm installed ( Refer the post with title “setting up a naked bare m/c and then view this post…Don’t start doing something else 😛 )
0) rvm rubygems 1.4.2
1) rvm install ruby-1.8.7-p334
2) rvm use ruby-1.8.7-p334 ( Still thinking about the photo! Few more commands dude, c’mon not now 🙂 )
3) rvm gemset create rails-2-3-11
4) rvm gemset use rails-2-3-11
5) sudo gem install rails -v=2.3.11 / sudo gem install rails -v=2.3.11 –no-ri –no-rdoc ( For all the Indians who bought cheap systems and don’t have hard disk space a.k.a BPL )
6) sudo gem install rake -v=0.8.7
7) sudo gem install bundle
8) svn co http://redmine.rubyforge.org/svn/branches/1.2-stable redmine-1.2
9) find ./ -regex ‘.*svn’ -exec sudo rm -r {} \; ( Dont panic if it show a long list of ‘not found’ )
10) Create a file with name ‘Gemfile’ in your application directory with follwing contents (if you have followed this post correctly so far the directory name would be “redmine-1.2” and you are already into it if you didn’t get any error.)
==============================================================
source :gemcutter gem "pg" gem "rake", "0.8.7" gem "rails", "2.3.11" gem "rack", "1.1.1" gem "i18n", "0.4.2" ============================================================= Note: Dont copy the "======" :)11) bundle install 12) cp config/database.yml.example config/database.yml 13) Edit your config/database.yml to look like following: ===================================================================== # MySQL (default setup). production: adapter: postgresql database: redmine_heroku host: localhost username: postgres password: postgres # adapter: mysql # database: redmine # host: localhost # username: root # password: # encoding: utf8 development: adapter: postgresql database: redmine_heroku host: localhost username: postgres password: postgres # adapter: mysql # database: redmine_development # host: localhost # username: root # password: # encoding: utf8 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: mysql database: redmine_test host: localhost username: root password: encoding: utf8 test_pgsql: adapter: postgresql database: redmine_test host: localhost username: postgres password: "postgres" test_sqlite3: adapter: sqlite3 database: db/test.sqlite3 =============================================================== 14) rake generate_session_store 15) Add following line in your config/environment.rb before last line i.e before "end" =============================================================== ****Here key is the key from "config/initializers/session_store.rb" Here secret is the secret from "config/initializers/session_store.rb" Example: **** config.action_controller.session = { :key => "_redmine_session", :secret => "56acb9c4c9e6165ad25a8f747e014b54eb219a6e7db2a549a0178ddc4bc73e68b16314c4054c7595" } 16a) RAILS_ENV=production rake db:migrate 16b) RAILS_ENV=production rake redmine:load_default_data 17) gem install heroku / sudo gem install heroku 18) heroku create redmine-manoj --stack bamboo-ree-1.8.7 --remote redmine-manoj 19) find ./ -regex '.*~' -exec sudo rm {} \; 20) git init 21) git add . 22) git commit -m "your commit message" 23) git remote add redmine git@heroku.com:redmine-manoj.git 24) git push redmine master 25a) sudo gem install taps 25b) heroku db:push ( When promted to enter your repository name on heroku, enter the correct name from step 18, in this example it will be redmine-manoj )) 26) git clone https://github.com/tigrish/redmine_s3 vendor/plugins/redmine_s3 27) cp vendor/plugins/redmine_s3/config/s3.yml.example config/s3.yml 28) Enter your S3 credentials in config/s3.yml created in step 27 29) git add config/s3.yml vendor/plugins/redmine_s3/ 30) git commit -m "Add s3 support" 31) git push redmine master 32) Test by creating a project and uploading files. If you face any issues the author is very willing to help, If you think this post can be improved further go on and give feedback. Thank you for your time :)
Facebook etiquettes
Yesterday, my not-so-tech-savvy friend asked me if he can block some people on facebook chat similar to the block feature in gmail chat and I suggested him the following method to do that:
1) Create a list called “Blocked people” or choose your own name.
2) Add the people you want to block to the list created in step1
3) Click on facebook chat window and on the top of it(Blue Bar), click on the gear like setting icon.
4) Click on limit availability. A box that will appear in the centre of the window
5) Select the list created in step1.
Yeah, thats it and you are done!
WEBRICK NIGHTMARES
Please use the following tip while using webrick server for rails:
1) Make sure that you do not have any “tilde backup” files in app/views/(controller), or else WEBrick will not show the expected output.
Save Time Save Money!
Setting up a naked machine
Setting up a bare debian-squeeze m/c for redmine
1a) cat /etc/apt/sources.list
deb http://ftp.debian.org/debian squeeze main contrib non-free
deb http://security.debian.org squeeze/updates main contrib non-free
deb http://volatile.debian.org/debian-volatile squeeze/volatile main contrib non-free
Update it if it doesn’t look like this because we will be installing a lot of libraries after this steps which will give you errors if you don’t do it. Please note the arguments carefully because it might look like the above but you will end up frustrating yourself which will defeat the sole purpose of this blog.
1b) sudo apt-get update
2a) sudo apt-get install build-essential libxslt1.1 libxslt1-dev libxml2 ruby-full mysql-server libmysqlclient-dev libmysql-ruby libssl-dev libopenssl-ruby libcurl4-openssl-dev imagemagick libmagickwand-dev git-core redis-server libffi-dev libffi-ruby rubygems libsqlite3-dev libpq-dev
2b) sudo apt-get install build-essential zlib1g zlib1g-dev libreadline5 libreadline5-dev libssl-dev
2c) sudo apt-get install imagemagick libmagick9-dev
3) wget https://rvm.beginrescueend.com/install/rvm
Why this? because we might want to manage a lot of rails applications which uses different ruby versions on the same m/c in a simple and efficient manner.
4) chmod 777 rvm
5) rvm install ruby-1.8.7-p352
6) rvm use ruby-1.8.7
7) gem install rails -v=2.3.11
After this you can ride on ROR 🙂
Cron not working
Today i stuck into running cron on my local m/c
I found that I needed to specify the following environment variables to run my commands
PATH=path to your binaries
SHELL=/bin/sh or whatever
cron job statements TIP: Make sure when you specify flags you do not include spaces like this -f=<space>somthing OW you may spend hours trying to figure out what is going wrong.
Thank you reading this post.
Migrating from mysql to postgres tips
Postgres pain
insert into (col1,col2) values (“val1″,”val2”);
gives error
Tip1: Columns are identified either by enclosing them with double inverted commas or by enclosing them with any special char so don’t enclose your values by double inverted commas, like here “val1” so “val1” is treated as column. USE single inverted commas like ‘val1’
Tip2: You have to specify columns before VALUES keyword.
I will be posting the internal code once i get a chance to look into it.
Small utilities: Playing with grep as needed
1)grep -nri “helo” “your file name” | grep -v “lala”
This will return all the file names which has “helo” string in the file and whose file_name doesn’t have “lala”. For eg
I wanted to search only for files which doesn’t have “.svn” in their name and contains the string “grep” in my folder and bingo i did it using the above command.
2) find ./ -regex .*~ -exec rm -r {} \;
This will remove all the files ending with ~ which are created by the editor for backups but which corrupt your git repo if you are maintaining one ofcourse its not limited to your repo only.
I will be posting more utilites as and when i need to use them.
Postgres error: psql: FATAL: Ident authentication failed for user “postgres”
I am in a hurry so i will just post the solution this time.
CAREFUL Ctrl+c and Ctrl+v users: Remove the angle brackets in names
———————————————————————————
***Restart the postgres server after finishing the changes***
user@desktop: /etc/init.d/postgresql-8.4 restart
———————————————————————————–
user@desktop: psql -Upostgres
FATAL: Ident authentication failed for user “postgres”
user@desktop: emacs /etc/postgresql/8.4/main/pg_hba.conf
user@desktop: Replace the phrase Ident with trust
Additional details:
If it complains FATAL: password authentication failed for user “<user>”
su root
su postgres
ALTER USER <user>WITH PASSWORD ‘<your_passwrd>’;
Drop in your qs and i will edit the post a/c.
rails: no such file to load —
Yesterday my colleague ran into a problem when he was integrating the infamous gem oauth with his mighty application and ran into the following error
no such file to load –twitter
As evident since he was doing it the first time he couldn’t find the cause and contacted me 🙂
The following statement made by me casually, then a careful thought (thats why i am spending 10 mins of my time @ the average rate of 20 wpm :)) helped him solve his error
“You have a require statement somewhere in your gem file which may be some gem you need to install for oauth”
And Bazzinga!! ( yeah I am a big bang theory big fan ) he executed the following command and solved his problem
gem install twitter
Thank you for reading this post.
I just wanted to make it more interesting so the references here and there. Don’t bother to thank me 😛