Entries Tagged 'Ruby' ↓
October 15th, 2009 — Linux, PHP, Ruby, development, python
For php I use Zend Studio for Linux. We have a license at work for it and it is in my opinion the best editor for php. It's relatively fast and you can use it to quickfix php over an ftp connection.
For Ruby I use netbeans. I would also like to use it for php but it doesn't allow to quicly open a file via ftp/scp or whatever. And it can sometimes be sloooooowwww. I've seen netbeans used on a Windows platform and there it is much faster.
When I right-click on a project in netbeans for the first time, it takes 5 seconds (not lying!) to render the popup-menu. Come onm take forever!
And because I was now developing with Python I decided to try a new editor. Something more hardcore and lighter. Something nerdy
So ofcourse I only have two decent options: Vim & Emacs.
I already had try them with Ruby. But I found good Ruby (& Rails) support rather lacking by both of them. I believe that the python comminity is more hardcore and therefore are using more arcane editors
And maybe because they aren't afraid to hack away in another language than their own (lisp, vimscript).
I think I have been comparing the two editors for nearly two weeks now. I have spent hours and hours comparing, trying and browsing for blog posts about the two. At the end, I really didn't know which one to choose. I really suck at deciding something
So I made a little list of what I find to be strong points of each editor:
VIM:
- Better syntax highlighting/theming supprt (wombat ftw!!)
- Faster/smaller
- No weird handling of new buffers like with emacsclient
- No daemon like: emacs --daemon
- Better python integration
- Easier to make extensions
- Preview of docstrings when using omni completion
EMACS:
- Better python-mode
- No commandmode/normalmode
- Directory browser/editor
- Debugger (better integration with external tools)
- easier to begin
- Everyting is a buffer™
And now I have chosen to be the editor with which I am going to work is...... (drum roll please) .......:
Gedit!
No, it's (g)Vim
And while writing this article I was looking for a WordPress/blog plugin for Vim and Emacs. At a glance it looked like the wordpress plugin for Emacs was a little bit better. So already I was doubting my decision... So it could be that I switch editor in the next few months
But I'm first going to really use gvim to see if it fits with my workflow and is really useable for me.
As cherry on the pie, a nice screenshot of my gvim in action:

[update]
I've installed Netneans 6.8m2 and it feels a lot faster than 6.7 but python completion is as bad as in 6.7.
[/update]
[update2]
Found out about Vim's netrw. So Emacs no longer got "Directory browser/editor" as a strong point.
[/update2]
September 24th, 2009 — Ruby, development, python
I've ditched Ruby for my mpd project and started using Python. Not that I like python that much more but the Gstreamer library for python is much more complete. I really wanted gapless playback and the Ruby Gstreamer libray just doesn't support that. If it does by the time you read this: please let me know
The new Pmpd project (looking for a better name) can be found on github. The hardest part so far is having to restructure the sources. Python is not a difficult language to master at all but I'm very picky on how everything fits together. My ruby project felt right on that part. But the python equivelant has some things I just don't like enough up to now.
November 12th, 2008 — Ruby, development
I'm now developing a flexible car database for a couple of hours per week. Our first customer, a Beemer dealer, has a lot of fancy requests. Well, the hired-in Flash developer has these requests actually.
One of them is that they want to save a field in the database that contains a unique identification number for the secondhand cars they sell. But this number is set-up in a way that is unique to BMW's. So actually, I didn't want to add this column to the database, 'cause that will mess up my clean database tables.
But then I came up with the idea to add functionality to the website where users (dealers in this case) can add custom columns to their cars / profiles.
Instead of creating this functionality from scratch, I first wanted to know if there are any plugins that have this functionality already. I found these three:
- acts_as_free_form
- has-magic-columns
- acts_as_customizable
I haven't decided (yet) which is best.
And if you want to roll your own, here's a nice article about choosing the best structure for dynamic fields.
I realize that the story above is written in truly horrible English. But I really didn't have the energy to make something nice of it...
November 5th, 2008 — Linux, Ruby, development

Very easy to do:
CODE:
-
sudo aptitude install ant openjdk-6-jdk
-
cd ~/src
-
svn co http://svn.codehaus.org/jruby/trunk/jruby/
-
cd jruby
-
ant
-
bin/jruby --version
October 28th, 2008 — Linux, PHP, Ruby

It was a troublesome day today. All did not go as planned.
I had to install fcgid + suexec on one of our servers, I had delayed it too long. So I used my how-to and it still worked flawless. But I noticed I hadn't mentioned what the right were of the suexec binary. So here it goes:
CODE:
-
chown root:www-data suexec
-
chmod 4754 suexec
After the install I restarted Apache and looked at one of the sites. And it worked! I was baffled. That's the first time I installed fcgid without hours long of searching where the flaw was.
But then I looked at our support system (Redmine) and it didn't work too well
All controllers were being executed 'n stuff. But the stylesheets, images and javascripts were not loaded. When requesting an image in the browser I got Rails 404-error page. Huh? Apache should have handled that request. At first I thought it was because of some changes I made to the virtualserver configuration of an other Rails site. But after some trial and error I couldn't find anything that was wrong.
Then I removed the .htaccess from the public directory of Redmine. That once worked for one of my rails sites. But no cigar. Then I noticed that there were a lot of dispatch*example.rb's in the public directory. And: after removing them, the stuff worked. So it seems like Rails or Phusion Passenger uses some kind of fuzzy matching when searching for a dispatch.rb. And it first just worked because fcgid was not installed. So I don't know who's to blame. But the problem is solved. Phew!
September 24th, 2008 — Ruby, development
This will be a short post: I like merb/datamapper better. It's cleaner and faster.
But, I have to finish a project this week and merb/datamapper is not just stable yet, has less documentation, less plugins, less helpers and less features.
For example, the "has and belongs to many" association in datamapper isn't fully implemented (look a the tests). There are some nice backend generators for Rails. And if you have to finish a project in too little time, it's a quick decision.
I know, I could also make/fix this stuff for merb and datamapper myself and I would love to. But there just isn't enough time! Aaarghhh...

September 15th, 2008 — Ruby
I have this public/images/cars directory but it gets overwritten everytime I use "cap deploy". So in order to have my images/cars directory saved every time, I used this addon for capistrano:

RUBY:
-
set :assets, ['images/cars']
-
-
namespace :deploy do
-
task :after_deploy do
-
copy_assets
-
end
-
end
-
-
namespace :deploy do
-
desc "Link in the production database.yml"
-
task :copy_assets do
-
self.assets ||= []
-
assets.each do |asset|
-
run "cp -r #{previous_release}/public/#{asset} #{release_path}/public/#{asset}"
-
end
-
end
-
end
Worked like a charm for me!
September 10th, 2008 — Ruby, development
First of all I did a:
And used this deploy.rb
Then to setup the current, releases, etc. directories:
Then, when I tried to login via ssh with shared key: nothing!
After some searching I found out that capistrano messed up the permissions on the .ssh directory
To fix it:
CODE:
-
chmod 755 $HOME
-
chmod 755 $HOME/.ssh
-
chmod 644 $HOME/.ssh/authorized_keys
September 8th, 2008 — Linux, Ruby

I've created a little merb app for a customer. The reason I chose merb because I really like the :provides-api. The app had to generate a lot of xml, so using Merb was really nice.
But the installation on the server was a little troublesome. I had to install some gems (which I of course forgot to do) and I had to figure out how the file permissions had to be.
First step: installing software
aptitude install build-essential ruby1.8-dev libxml2-dev libmysql++-dev
gem install merb datamapper do_mysql merb_datamapper --include-dependencies --no-ri --no-rdoc
gem update --include-dependencies
passenger-install-apache2-module
Step two: project's dependency packages
aptitude install libmagick9-dev libtidy-0.99-0
gem install orderedhash shared-mime-info rmagick tidy
But the big problem here was libtidy! All the packages keep segfaulting. So I had to use the Gutsy or Feisty package (don't remember which one exactly. One of the two
).
Step three: config.ru
Because I wanted to run Merb on apache2 with Phusion passenger I had to create a config.ru file. The contents of the file can be found on the merbivore wiki.
Last step: Adjusting permissions
I was ready to start merb, but when I tried to start it, it kept complaining about permission errors. So after a little fiddling I chmod'ed the whole shebang to 750. I think it will be solved if I install suexec on the server.
July 21st, 2008 — Linux, Ruby
Just some quick links!
This links describes how to manage multiple databases with Capistrano. That's not why I picked it though. I liked it because it shows the "<<: *" syntax of yaml.
And a repository of Ubuntu Hardy Heron debs for mod_rails/Phusion passenger. At this time I installed mod_rails via rubygems. But if the guys at brighbox make the package so it builds/installs the Apache module automatically (without human intervention and pressing Y two times) I will install that one. Much, much nicer to use with Puppet.