RSS  |  Archive    


3:07 pm, by shenie,




Quick script to decompile all the class files.

find . -name "*.class" -not -name "*\$*" | while read class
do
  dir=`dirname $class`
  file=`basename $class .class`
  pushd $dir >/dev/null
  jad -p ${file}.class > ${file}.java
  popd >/dev/null
done

9:30 pm, by shenie,




WOW! scary but pretty.

WOW! scary but pretty.

 
tagged: interesting,
3:39 pm, by shenie,




I think new version of ruby is meant to be installed with the following prefix, using 1.8.7 as an example.

/System/Library/Frameworks/Ruby.framework/Versions/1.8.7/usr

That way you can just /System/Library/Frameworks/Ruby.framework/Versions/Current to the version you want.

tagged: ruby,os x,
11:15 pm, by shenie,




As I mentioned before, I upgraded to ruby 1.8.7 and decided to use —prefix=/usr, i.e. overwriting existing ruby 1.8.6. Big mistake. After some issues I decided to roll back completely.

This is what I did (luckily I can copy the required files from my wife’s Macbook).

OS X ruby framework overview

The framework is /System/Library/Frameworks/Ruby.framework

  • /usr/lib/ruby is a softlink to osx ruby framework
  • osx ruby framework’s site_ruby is a softlinke to /Library/Ruby/Site

To fix

  • /usr/bin
  • osx ruby framework
  • /Library/Ruby/Site

Actions

Rename the following directories then copy the same directories from another OS X

  • /System/Library/Frameworks/Ruby.framework
  • /Library/Ruby/Site

Make sure the following files are links to os x ruby framework’s /usr/bin

  • /usr/bin/erb
  • /usr/bin/irb
  • /usr/bin/rdoc
  • /usr/bin/ri
  • /usr/bin/ruby
  • /usr/bin/testrb

Cleanup

Remove these backup directories afterwards (once everything is ok)

  • os x ruby framework .bak
  • /Library/Ruby/Site.bak
  • /usr/lib/ruby/site_ruby.bak
  • /usr/lib/ruby/user-gems.bak

Now

  • link /usr/lib/ruby/site_ruby to /Library/Ruby/Site
  • link /usr/lib/ruby/user-gems to /Library/Ruby/Gems

tagged: ruby,osx,
11:10 pm, by shenie,




tagged: interesting,
3:52 pm, by shenie,




tagged: interesting,
3:51 pm, by shenie,




That’s one expensive apartment!!

3:24 pm, by shenie,




Oh Oh I want one!!

tagged: git,
10:03 pm, by shenie,




I was in a update mood so I updated my system to use GWT 1.5.0 and ruby 1.8.7.

After updated ruby I tried to figure out how to keep the old gems. My solution was to set the following env variables (similar result could be achieved with .gemrc).

  • export GEM_HOME=/Library/Ruby/Gems/1.8
  • export GEM_PATH=/usr/lib/ruby/gems/1.8

But in the end I decided to revert back to ruby 1.8.6…. because I realised a problem that I worked around earlier is bigger than I thought. The problem was that hpricot 0.6 didn’t load properly under 1.8.7. I was too focused on understanding how OS X setup ruby framework and replicating it in 1.8.7.

All was not lost, someone has found the problem and fixed it. So once a new hpricot released then I should be able to re-apply what I learnt.

11:56 pm, by shenie,




I use iPhoto Library Manager to manage the size of my iPhoto libraries.

When I need to split libraries there isn’t a easy way to delete photos that match your criteria (I use date) from the library.

If there are less than 50% of the photos that I want to keep in a library then I can just create a smart album that contain those photos and simply drag and drop the album to a new library. But when there are more than 50% then it is faster to delete the unwanted photo from the existing library.

That is the problem, there isn’t an easy way to delete a bunch of photos from library that belongs to a certain album (i.e. match certain criteria).

My solution is this, iPhoto has a Bulk Update (cmd+shift+B) function. So I select all the photos in the album that I want to delete and use Bulk Update to set the description to be ‘deleteme’ then I go to the photos and do a find (cmd+F) with the same string. Voila now I can select the photos and delete them out of the library. Just remember to empty the iPhoto Trash so you recover the disk space from the library.

tagged: iphoto,tip,
9:19 am, by shenie,




1:06 pm, by shenie,




I like stikipad, but I am glad when I was deciding which wiki to use I didn’t go with stikipad.

They are currently down and, according to its users has been down for 2 weeks already. On top of the the owners and support is not there.

I am current playing with porting my wiki pages to Google Site. My experience so far is that the UI is nice, displaying code is a bit of pain until I figure out a better way. Lastly it doesn’t seem to be indexed by Google.

tagged: wiki,google,sites,
4:51 pm, by shenie,




One of the reason I like Ruby community is the friendliness.

But a few comments on this post is not a demonstration of that friendliness. I am sure Dan totally gets the concepts and he wrote a followup post about it. I am just interested to see if the idiotic comments come back.

tagged: rails,locking,
5:45 am, by shenie,




By default Git uses less as a pager. That is very cool because to look at logs you no longer have to pipe the output to less yourself. But something didn’t work very well for me until I finally couldn’t take it anymore. The problem was that for some reason my Git output in less is displaying weird chars that looks like ESC at beginning of lines. I found the culprit to be one of my env variable LESS=-i, which makes search in less case-insensitive. It’s all good after it’s taken out :)

tagged: git,
4:42 am, by shenie,