Friday 30 November 2012

Oracle sqldeveloper, openjdk, .xsession-errors and no disk space

The file ~/.xsession-errors is eating all of the file system!
I had this problem happen to me before when I was using Ubuntu, at the time I didn't figure out what the problem was, but I solved it with ln -s /dev/null .xsessions-errors and called it quits. Today however, it happened to me on my Fedora system. However this time I figured it out.
Earlier today I had installed Oracle's sqldeveloper, I tried to lunch it a couple times from the GUI, when that failed I went to the console and typed "sqldeveloper", I was graced with the following message:


Error: /bin/java not found
Type the full pathname of a J2SE installation (or Ctrl-C to quit), the path will be stored in ~/.sqldeveloper/jdk
So I gave it my JAVA_HOME, set some config file so it would ignore the fact that I was using open-jdk and voilá.

Seven hours later I'm getting no disk space errors, wtf? 
Scan tells me that my music folder is the biggest file system hog.... sure I can understand that, but it's not like it's growing right now...
Open up the console, ll -ash and bam! .xsession-erros is 11G! 
I tail the file and the oracle's lovely error message and input request is being written on that file at monitor-flickering speed. 
The command ps -aux reveled to me that I had 3 instances of sqldeveloper open since morning, killed those and the file stopped being written on. 
Now just removed it and all is well.

TL;DR: Bad Oracle! BAD!

Wednesday 7 November 2012

Complete Guide to install Ruby 1.9.3 on CentOS

UPDATE: These instructions also work on Fedora 16 ( and possibly bellow; on 17+ you should have Ruby 1.9.3 on yum repos).
There are some nice guides out there, like this one, explaining how to do this, but they don't tell the complete story, especially if you're on a clean CentOS install - which is the only explanation I can come up with for the fact that other guides didn't have the same problems I had.


EDIT 11/12/2013: The version listed on the instructions bellow is a bit dated, since this post is now 13 months old, check https://www.ruby-lang.org/en/downloads/ for the latest ruby 1.9.3 patch and replace the patch number (p194) with the latest one on step 9 (wget [...] ruby-19.3-p194.tar.gz).

Steps I ended up following:

#preparing packages
$ sudo yum groupinstall 'Development Tools'
$ sudo yum install -y httpd-devel openssl-devel zlib-devel gcc gcc-c++ curl-devel expat-devel gettext-devel patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel make bzip2 zlib1g mysql-server

#compaling libyaml
$ wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
$ tar xzvf yaml-0.1.4.tar.gz
$ cd yaml-0.1.4
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
#compiling ruby 1.9.3
$ wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
$ tar xvzf ruby-1.9.3-p194.tar.gz
$ cd ruby-1.9.3-p194
$ ./configure
$ make
$ sudo make install
#rubygems
$ wget http://rubyforge.org/frs/download.php/76073/rubygems-1.8.24.tgz
$ tar xvzf rubygems-1.8.24.tgz
$ cd rubygems-1.8.24
$ sudo /usr/local/bin/ruby setup.rb


During the preparation stages a few packages may say they already installed, don't worry.
I'm not sure still if it will work with everything (like rails if that's your thing) but at least 
(Update I've installed both Rails and Sinatra without any problems on top of this setup)
I have been able to install some gems now which by other guides I followed fell short of.

Monday 5 November 2012

Time Helper 2.0.0 released

Funny how time-helper is older than this blog yet not a single post or page about it here.

I've considered this a new major version because there's no guarantee of compatibility with previous versions, in a couple features.

About version 2.0.0

I've changed the =~, the old way was just stupid (no one else to blame but me here), the new version just compares two Time objects and see if they are within an acceptable distance from each other in seconds, defaults to 300 (5 minutes).
So where you'd have a symbol as first argument you now have a Fixnum. Also added a sanity check for the second argument.

Completely removed the #parse integration in #strtotime, this means that if you were using #strtotime as both it won't work, as such, it reduces the memory footprint of this gem (by not requiring stdlib time)  for those who don't want .parse - which is most of the people that I've made this gem for (including myself).

And yes, this gem still doesn't care about American date format (mm/dd/yyyy), because it's silly.

I've already found a couple issues that need to be fixed:
  • Documentation for =~ doesn't completely reflex the changes.
  • Time.valid_datetime? returns true for more than intended inputs.

How to make TM, C and R symbols on Keyboard - Linux ™,©, ®

Silly short post, I was playing with the keyboard and finally figured this out, quite useful, so I'm making a post for:
a) I can refer to later.
b) Other people may find later.

I only tested this with Ubuntu, so there

These 3 symbols work in combinations of Alt Gr + Shift + [KEY], I'll list the key:

  • ™ - 8
  • © - c
  • ® - r