Archive for January, 2009

Git for dummies

January 31st, 2009

Only just started to finally get stuck into learning git. It certainly seems to be revolutionising the way we do version control. I’m pretty hooked on subversion and I have to admit, I thought that was as good as it gets! But the hype around git to much to ignore.

Here’s some resources I’ve found really useful to get (git) going:

Resources

  • GitCasts by Scott Chacon. Screencasts are for me one of the best ways to learn things, these casts, although very quick, give you that good leg up.
  • Git from the bottom up by John Wiegley. There is a link from his blog entry to a paper he has put together on his understanding of Git. Always good to read some theory!
  • Git – SVN crash course from the offical git site. A great place to start if like me, you’re already familiar with svn.
  • Github’s Git Cheat Sheet is a good resource too!

Getting Ruby to talk to Oracle with Cygwin

January 7th, 2009

I need to be able to use Ruby to talk to Oracle databases to help us easily build scripts for maintenance and support. So, I started doing some googling and found ruby-oci8. Excellent!

I’m also mainly PC bound so I needed to get this working on my cygwin installation. My entire Ruby environment is running through cygwin.

So I started through the installation instructions on the ruby-oci8 site but started to find it pretty confusing to follow for the cygwin-specific installation. Finally, after a bit of trial and error, here are the steps I followed to get this baby humming:

  1. Download and unzip the Oracle Instant Client Basic and SDK packages. I successfully did this with version 11.1.0.7.0. The path I chose was:
    C:\oracle\instantclient_11_1
  2. Add the instant client to the front of your system path (through Control Panel –> System)
  3. Launch cygwin
  4. Install the gem
    $ gem install ruby-oci8
    Building native extensions.  This could take a while...
    Successfully installed ruby-oci8-1.0.3
    1 gem installed
    Installing ri documentation for ruby-oci8-1.0.3...
    Installing RDoc documentation for ruby-oci8-1.0.3...

That’s it! You’re now all installed! You’ll notice that the gem compiles some native extensions, this is why you need the instant client to be available in your path.

Now to give it a test run, open up and irb session and give it a go:

irb(main):001:0> require 'oci8'
=> true
irb(main):002:0> conn = OCI8.new('username', 'password', '//server:port/sid')
=> #<OCI8:0x7fdb3d44 @privilege=nil, @prefetch_rows=nil, @ctx=[0, #<Mutex:0x7fdb3cf4>, nil, 65535], @svc=#<ocisvcctx:0x7fdb3ce0>>

We have a connection!

Accessing github from behind a proxy

January 2nd, 2009

If you’re behind a proxy which restricts outbound ports (i.e. only port 80 and 443), then you’ll be pleased to know that you can still access Github.

Rather than using the git:// protocol (defaulting to port 9418), you can use the HTTP protocol to do the same thing! Article on Github about it here.

git clone http://github.com/justinfrench/formtastic.git

It also works for Rails plugins!

script/plugin install http://github.com/justinfrench/formtastic.git

Don’t forgot you need to set environment variable http_proxy to tell Git to use the proxy or or can set it in git-config. The example below sets it at the global level:

git config --global --add http.proxy http://myproxy:8080