Tag Archives: Rails

10 Places left for the rails rumble

The rails rumble team inform us (on their blog) that they manage to open more Rails Rumble seat.

There are now 10 seat left. Hurry up.

NBGit, a Git plugin for Netbeans


Use Git and GitHub on Netbeans (image source : http://www.flickr.com/photos/boboroshi/2591305062/ )

For three months now I’ve managed to migrate my project on the Git version control system.

Just found, yesterday night, a Git plug in for Netbeans. It’s the first version, not all the commands are implemented, but, you will have the commit one, the diff one and the update. For the branches and the tag, you will need to wait a little.

Why use a version control :

A version control is a must have for every kind of project development.

A version control will help you to :

  • Save your code
  • Keep a trace on what you are doing
  • Keep a history of the changes
  • View the difference between the old version of the file(s) and the local one
  • Keep your modification and your code safe when you work in a team
  • Tag and branche your code for a better organization

And more and more and more …

The most commonly used in companies are : CVS or his fork Subversion (svn), Mercurial, Git.

You can find a good review about seven different version control systems on Smashing Magazine.

What is Git :

Git is a distributed version control system. It means that every developer of the team own a copy of the repository on their disk.

This is the one chosen by the Ruby on Rails core team development and now a lot of rails plugins (Before it was SVN).

Pro :

  • Distributed version
  • Quick (very quick)
  • Easy to manage
  • GitHub
  • Open Source

Cons :

  • ? I do not see any for the moment

You can find a Git cheat sheet here and the official website is here.

What’s GitHub :

GitHub is an ‘easy to open’ and cheap Git server repository provider.

Instead of managing a repository server (and the data backup/security/cost … who come with) you can open an account with GitHub and manage free public repositories.

If you need to have some private projects, you can sign up for a pay monthly account from 7$ a month.

It’s really easy to use, and if you’ve already used another version control system the ‘learning curve’ will be very short.

Your repository will be on safe hands, and will be backup on two others servers, and pushing code is only allowed if you give them your SSH keys.

So, and this Netbeans Git plugins :

Netbeans 6.5 comes with some source control plugins, but there ISN’T ANY for Git.

This issue is corrected with the NBGit plugin, purposed by Jonas.

You can find the plugin here and the git repository here. The official website is on http://nbgit.org.

For the moment there are only the basic operations like Commit/Update and Diff, but I hope branches and tags will come quickly.

I tried it yesterday night, it worked fine for me. Perhaps this plugins will help me to decide definitively between my Gedit a la Textmate and Netbeans.

NetBeans 6.5 beta is out

To develop on Ruby on Rails on my Linux platform, I use to code with NetBeans 6.1.

This editor is absolutely fantastic and powerful. Today the 6.5 is out, it’s just installed on my computer.

All my projects were imported, my config files also (if you have the textmate color plugin, you’ll have color problems ..).

There are some improvement also on the PHP side and the JavaScript side, so lets give a look.

Clik here to see the official announcement and the download page

Edit :

  1. I’ve used it all day since yesterday, and it really rocks. No problems for me, more faster than 6.1 and the PHP/Js support work very well. It’ll replace my aptana for the PHP/(X)HTML/Js/CSS.
  2. I’ve told you there were a problem with netbeans 6.5 and the textmate color plugin. In fact it works well, you just have to reinstall the plugin. You can find this plugin here Huikau texmate plugin color netbeans 6.x.

Rails 2.1 where to begin …

This is a fact, Ruby on Rails 2.1 rocks …

But there has been a lot of evolutions since the 1.x versions, and the problem is that a lot of Rails tutorials available on the Internet are for the 1.x.

So here is a quick collection on how-to begin with Rails 2.x, and what documents you should have a look at:

  1. A free pdf book, the first version was the Brazilian one (original version) and here is the English version (English version of the What’s new in Rails 2.1). This book is highly recommended to anyone who wants to see more Ruby on Rails before starting to code.
  2. After this e-book, you can buy the PeepCode Rails 2.1 Pdf (link to the page) for only 9$!. I really like Peepcode screencast and Peepcode pdf, they are a really good source of information. This e-book will teach you, in a very good presentation all the new things in Rails 2.1. In fact, the content is the same than as in above pdf, but I really much prefer the Peepcode presentation.
  3. Once you’ve read this e-book, you’ll clearly see the benefits of Rails and Rails 2.x. So, if you want to begin writing some code, just take the Pragmatic programmers e-book,Agile Web Development with Rails, Third Edition. This book IS WRITEN by 2 Ruby on Rails master. This book is not available, for the moment in Paper version, but the PDF version is really amazing and covers the 2.x branch. (I had the first of this book, and this is a bible for every rails developer).
  4. In the same time, if you’re new in Ruby on Rails, coming from PHP (like me) you should take some time to read some Ruby documentation. For that, go here Ruby-doc.org and here, Ruby-lang.
    Yes, you really need to read some Ruby documentation before starting Rails. Would you start in Django or in Symfony Php without any knowledge in Python or Php ?
  5. Well, if you’ve read all this, you should now be really comfortable with Rails. But you can (trust me, you really can) have a PDF copy of the Advanced Rails Recipes ebook. Again it’s available at the Pragmatic Programmers shop. This book is simply an awesome help on every day Rails problems.

You can now see what my Rails bibliography looks like. I also have other pdf titles and pdf tutorials that I’ll share with you later.

Rails 2.1 is really good, but if you want to be aware of its power, you need to spend some time on reading books … don’t be blind by the scaffold :D.

How to search on a MediaWiki (Wikipedia) with Ruby On Rails

I have been looking for 3 days how to search on Wikipedia with Ruby.

After having found the solution, this is really simple :

1. I found MediaCloth

MediaCloth is a MediaWiky syntax parser. You feed it with a media wiki syntax and it’s supposed to return a correct html.
It works, it’s not perfect but it works.

There is a gem so : gem install mediacloth will do the job.

MediaCloth on rubyforge

MediaCloth help ?

2. MediaCloth were working, so let’s code an ugly solution

def ugly

feed_url = 'http://en.wikipedia.org/w/api.php?action=opensearch&search=avignon'
output = "Avignon"
open(feed_url) do |http|
response = http.read
output += response
end

@result =  MediaCloth::wiki_to_html(output)

end

It was working, nearly, but it was very ugly.

3. The Wikipedia Client

After that I found the Wikipedia Client (google source code website).

Install it like every plugin : ruby script/plugin install http://wikipedia-client.googlecode.com/svn/trunk/wikipedia

If you try to run the example now, it will crash, you need to install the json gem : gem install json

Then try


def pretty

page = Wikipedia.find('peanut')
@title =  MediaCloth::wiki_to_html(page.title)
@content = MediaCloth::wiki_to_html(page.content)
end

And now, everything is working like a charm.

Just be careful that the MediaWiki api solution is in beta for the moment. So don’t use it in production ;)