Archive

Posts Tagged ‘ruby’

RVM problem – ‘rvm-prompt’ returns ‘rvm’

April 18th, 2011 No comments

The amazing RVM was throwing a bit of a tantrum and rvm-prompt was simply returning

rvm

in new shells.

I tried re-installing but no dice.

So after bothering the nice people on IRC as well as on the rvm mailing list, the solution was in the rvm help. When in doubt and seeing odd behavour run

rvm reset

and lo and behold, ‘rvm-prompt’ now works again.

Categories: Development, Technical Tags: ,

IDE for Ruby development

April 14th, 2011 No comments

If you’re on the lookout for a new IDE for Rails in particular (or simply Ruby development in general) then have a look at RubyMine from JetBrains. It knocks the socks off NetBeans.

Categories: Development Tags: , , , ,

RVM & GEM_PATH – things to check if RVM doesn’t play ball

December 23rd, 2010 No comments

After having discovered RVM (Ruby enVironment Manager) and realizing how much easier it makes your life (application specific gemsets are pure genuis), I couldn’t get it to work on the desktop while it was fine on the laptop.

gem kept looking in /var/lib/gems/1.8 and it turns out there is quite a few places where GEM_PATH and GEM_HOME are being (or can be) set on your Linux box:

  1. /etc/environment
  2. /etc/security/pam_env.conf
  3. $HOME/.gemrc
  4. $HOME/.bashrc and $HOME/.profile

In my case it was the first 3 and after removing GEM_(PATH|HOME) assignments from those files, RVM started working.

Categories: Development, Technical Tags: ,

PDF::Writer and Ruby on Rails

January 15th, 2009 1 comment

Was struggling with an unbelievably annoying error, where PDF::Writer (or pdf-writer as it’s also called) simply refused to show special accented characters incl the Euro sign, but presented garbage instead. Turns out that as of pdf-writer 1.1.8, the following is the case:

a) No, it doesn’t accept utf-16, despite what it claims
b) Feeding it utf-8, will look fine for what can be mapped to 7bit ASCII
c) Feeding it Win-1252 seems to do the trick, although some people claim it’s also hit and miss.

In your class doing the PDF generation, add a method like this:

def to_pw(text = '')
  return Iconv.conv('win-1252', 'utf-8', text)
end

And then call that to output all the text.

YMMV, but it worked for me.

Categories: Development, Technical Tags: , ,