Blog Movement
November 9, 2009 at 5:46 pm | In 1 | Leave a CommentHello All
I pleased to announce that this blog is moved to domain http://www.funonrails.com
Sandip
10 steps to get start with MySpace Ruby SDK
October 27, 2009 at 4:03 pm | In ruby, rubyonrails | Leave a CommentTags: myspace api, myspace sdk, ruby
Follow 10 simple steps in order to use myspace sdk api
1. Remove all your previous gems installed
+ gem uninstall myspace
2. Checkout sample source code
svn checkout http://myspaceid-ruby-sdk.googlecode.com/svn/trunk/ myspacesdk
3. cd myspacesdk/samples/rails/sample
4. Modify config/database.yml accordingly
development:
adapter: mysql
database: sample_development
password: abcd
pool: 5
timeout: 5000
5. Download http://myspaceid-ruby-sdk.googlecode.com/files/myspaceid-sdk-0.1.11.gem
6. gem install –local ~/Desktop/myspaceid-sdk-0.1.11.gem i.e.PATH_TO_GEM
7. Above command supposed to give you following error otherwise skip to step 10
ERROR: Error installing /home/sandip/Desktop/myspaceid-sdk-0.1.11.gem:
myspaceid-sdk requires ruby-openid (>= 0, runtime)
8. gem install ruby-openid go to step 6
9. ruby script/server
10. Browse http://localhost:3000/
Find processor (cpu) information on linux
October 26, 2009 at 6:19 pm | In linux, ubuntu | Leave a CommentTags: cpu, linux, processor
Here is the command
cat /proc/cpuinfo
Example use on my ubuntu machine, It shows me.
cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Pentium(R) Dual CPU T2330 @ 1.60GHz
stepping : 13
cpu MHz : 800.000
cache size : 1024 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts pni monitor ds_cpl est tm2 ssse3 cx16 xtpr lahf_lm
bogomips : 3191.95
clflush size : 64
power management:processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Pentium(R) Dual CPU T2330 @ 1.60GHz
stepping : 13
cpu MHz : 800.000
cache size : 1024 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts pni monitor ds_cpl est tm2 ssse3 cx16 xtpr lahf_lm
bogomips : 3192.03
clflush size : 64
power management:
How to find OS X version on linux machine
October 26, 2009 at 6:05 pm | In funday, ubuntu | Leave a CommentTags: linux, os x, version
Here is the command which will give you OS name with version along with other detail information.
cat /etc/*release*
Example: On my ubutnu machine, It shows me.
cat /etc/*release*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.10
DISTRIB_CODENAME=intrepid
DISTRIB_DESCRIPTION="Ubuntu 8.10"
How to map irregular database tables with rails models
October 21, 2009 at 6:23 pm | In rubyonrails | 2 CommentsTags: active record, database table mapping, migrations, model, rails, ruby on rails
Rails specifies standard conventions while creating models, controllers, migrations ( database tables ).
Conventions for creating database tables
1. Table name should be plural
2. id field must be primary_key for table.
3. foreign_key must be like <model_name>_id i.e. post_id, site_id
Conventions for creating models & Controllers
1. Model name must be singular and controller name should be plural.
Although rails have some standard defined, sometimes it becomes quite necessary to map rails models with non- standard database tables.
1. Table mapping
class Review < ActiveRecord::Base
# Here comments is name of database table
set_table_name :comments
end
2. Set primary key ( other than rails standar ‘id’ primary_key )
class Review < ActiveRecord::Base
# It assumes "reviews" as table in database
# Below line indicates reviews table contains column_name "reviewId" which is a primary_key
set_primary_key :reviewId
end
3. Foreign key association
class Review < ActiveRecord::Base
# Below line indicates reviews table contains column_name 'RatingId' which is foreign_key to primary_key
# of 'ratings' table.
# It can be applied to any associan type [ has_one, has_many, belongs_to, has_many_through ]
belongs_to :rating, :class_name => "SiteUser", :foreign_key => "RatingId"
end
4. Model association ( non-standard model name )
class Review < ActiveRecord::Base
# Below line indicates reviews table contains column_name 'UserId' which is foreign_key to primary_key
# of model with class_name 'SiteUser'
belongs_to :user, :class_name => 'SiteUser', :foreign_key: => 'UserId'
end
Getting wireless working on ubuntu machine
October 14, 2009 at 4:23 pm | In ubuntu | Leave a CommentTags: ubuntu, atheros, wireless
Please follow following steps blindly to get wireless working on ubuntu machine.
Here are the steps…
On a fresh clean Ubuntu machine:
1. Disable the “Support for Atheros 802.11 wireless LAN cards” on Hardware Drivers, and reboot your box.
2. In a terminal:
2.1 Updates all package lists
# sudo apt-get update
2.2 Update driver.
# sudo apt-get install linux-backports-modules-intrepid-generic
3. Reboot.
Thanks to Gautam, directing me correct way
Feedzirra installtion on ubuntu interpid
October 12, 2009 at 3:06 pm | In 1 | Leave a CommentTags: feedzirra, ubuntu
Feedzirra is a feed library that is designed to get and update many feeds as quickly as possible. This includes using libcurl-multi through the taf2-curb gem for faster http gets, and libxml through nokogiri and sax-machine for faster parsing.
sudo apt-get install libcurl3 libxml2 libxml2-dev libxslt1-devsudo gem install pauldix-feedzirra
Converting dos(windows) files to unix files
October 7, 2009 at 12:57 pm | In ubuntu | Leave a CommentTags: dos2unix, ubuntu, ubuntu interpid
While using windows we get ^M characters in files that will get displayed when you open files on unix machines.
To remove such ^M characters,
Install dos2unix package using
sudo apt-get install sysutils
Convert individual file
dos2unix file_path
Run following command to convert recursively all the files inside directory.
find . -type f -exec dos2unix {} \;
sudo apt-get install sysutils
How to submit sitemap to search engines
October 1, 2009 at 5:27 pm | In ruby, rubyonrails, seo | 1 CommentTags: rails, rails seo sitemap, search eng, search engine, search engine optimization, sitemap
There are many ways that can be used to submit sitemap to search engines. Lets discuss approaches 1. Put sitemap.xml in public folder and you are done. Crawlers will find it through url http://yourdomain.com/sitemap.xml 2. There are many online sites which generates sitemaps for you. like http://www.xml-sitemaps.com/3. Open following urls in browser Be sure to add xml sitemap path for your site. a. Google submithttp://www.google.com/webmasters/tools/ping?sitemap=XML_SITEMAP_PATH
b. Yahoo Submit
http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=XML_SITEMAP_PATHc. Ask Submithttp://submissions.ask.com/ping?sitemap=XML_SITEMAP_PATH
d. Webmaster submit
http://webmaster.live.com/ping.aspx?siteMap=XML_SITEMAP_PATH5. Best practices in rails to submit sitemap is scheduled task (cron job)a. Write a rake task that will generate sitemap in rails public folder and
will submit sitemap.xml file to search engines. ( as mentioned above.)
Got easy![]()
–no-ri –no-rdoc for ruby gem installation
September 30, 2009 at 5:57 pm | In funday, ruby, rubyonrails | 1 CommentTags: --no-ri --no-rdoc, gem, gem configuration, gemrc, ruby, ruby on rails
One can install gem without rdoc using
gem install GEM_NAME –no-ri –no-rdoc
Skip ri rdoc for all gem installation as i haven’t seen anyone using it.
Edit gemrc file
Add following line to it
vi ~/.gemrc
:gem: --no-ri --no-rdoc
Here is my ~/.vimrc file
---
:verbose: true
gem: --no-ri --no-rdoc
:update_sources: true
:sources:
- http://gems.rubyforge.org
- http://gems.github.com
:backtrace: false
:bulk_threshold: 1000
:benchmark: false
That’s it !
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.

