Tuesday, October 27, 2009

10 steps to get start with MySpace Ruby SDK

by sandipransing 0 comments
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/
Read More…

Hello

by sandipransing 0 comments
Hello from Fun On Rails www.funonrails.com
Read More…

Monday, October 26, 2009

Find processor (cpu) information on linux

by sandipransing 0 comments
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:

Read More…

How to find OS X version on linux machine

by sandipransing 0 comments
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"
Read More…

Wednesday, October 21, 2009

How to map irregular database tables with rails models

by sandipransing 2 comments
Rails specifies conventions while creating models, controllers, migrations ( database tables ).

Conventions for creating database tables
1. Table name should be plural
2. id field should be primary_key for table.
3. foreign_key should be like _id i.e. post_id, site_id

Conventions for creating models & Controllers
1. Model name should be singular
2. controller name should be plural.
Although rails has standard defined, In some cases it becomes quite necessary to map irregular

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
Read More…

Wednesday, October 14, 2009

Getting wireless working on ubuntu machine

by sandipransing 1 comments
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 :)
Here are the steps
Read More…

Monday, October 12, 2009

Feedzirra installtion on ubuntu interpid

by sandipransing 0 comments
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-dev


sudo gem install pauldix-feedzirra

Read More…

Wednesday, October 7, 2009

Converting dos(windows) files to unix files

by sandipransing 0 comments

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

Read More…

Thursday, October 1, 2009

How to submit sitemap to search engines

by sandipransing 6 comments

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 submit
    http://www.google.com/webmasters/tools/ping?sitemap=XML_SITEMAP_PATH

b. Yahoo Submit
    http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=XML_SITEMAP_PATH

c. Ask Submit
    http://submissions.ask.com/ping?sitemap=XML_SITEMAP_PATH

d. Webmaster submit
    http://webmaster.live.com/ping.aspx?siteMap=XML_SITEMAP_PATH

5. Best practices in rails to submit sitemap is scheduled task (cron job).
    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 :)
Read More…

About The Author

Sandip is a ruby on rails developer based in pune and also a blogger at funonrails. Opensource contributor and working with Josh software Private Limited. for more info read Follow Sandip on Twitter for updates.

Connect With Me...

Github Projects

@sandipransing Twitter