Saturday, 28 November 2009

Webfaction + ssh key

Step by step instruction:
Local:
cd ~/.ssh/
ssh-keygen -t dsa
name_of_your_new_key
[enter]
[enter]
vim config
Add:

  • Host webfaction
  • Port 22
  • User your_login
  • IdentityFile path_to_your_key_file eg. /home/username/.ssh/key_name
sudo vim /etc/hosts
Add:
  • server_ip webfaction
scp key_name your_login@your_login.webfactional.com/home/your_login/ [type_password]
On server:
mkdir .ssh
cat key_name >> .ssh/authorized_keys
chmod 701 ~/
chmod 700 ~/.ssh
chmod 600 .ssh/authorized_keys
and voila, now you can login to webfaction with: ssh webfaction
I hope it will help someone

Saturday, 23 May 2009

Eclipse IDE for Python and Ruby

To write code I'm using Eclipse 3.4.2 with following plugins:

  • PyDev - code completion, syntax highlighting,... for Python
    Installation: Help->Software Updates->Available Software->Add Site...
    Location: http://pydev.sourceforge.net/updates/
    Select PyDev and Install
  • Dynamic Languages Toolkit - Ruby Developer - code completion for Ruby
    Installation: Help->Software Updates->Available Software
    Select Ganymede Update Site->Programming Languages->Dynamic Languages Toolkit - Ruby Developer and Install
  • Eclipse Git Feature - git plugin for eclipse
    Installation: Help->Software Updates->Available Software->Add Site...
    Location: http://www.jgit.org/update-site
    Select Eclipse Git Plugin - Stable build and Install
  • Remote System Explorer End-User Runtime - great tool if you work with remote servers
    Installation: Help->Software Updates->Available Software
    Select Ganymede Update Site->Remote Access and Device Development->Remote System Explorer End-User Runtime and Install
If you know interesting plugins, please write comment.

Thursday, 21 May 2009

missing_method in Ruby

missing_method is one of cool features of Ruby.
Code:

class A
 def method_missing(name, *args)
   puts "Oops! \"#{name}\" method is missing"   
 end 
end

a = A.new
a.howdy
Output:
Oops! "howdy" method is missing
Rails ActiveRecord uses it for dynamic finders: here