June 2011
2 posts
Grails, spring-ws, SOAP & HTTP request's content...
If you ever have to use Grails to process a fucked up SOAP request with a content type of application/x-www-form-urlencoded then this post is for you. p.s. eventually we will stop processing that kind of requests but for now we need it to work so client has time to fix their shit up Problem with application/x-www-form-urlencoded requests & spring-ws’ message factory is that it does...
How to use Groovy categories in gsp's
You use Groovy categories in a canonical way in gsp’s. i.e. by surrounding all your gsp code inside a call to <% use(YourCategoryClass) { %> <% } %> But it gets troublesome quite soon, especially if the main gsp renders other partial templates. Luckily there is a way to hook into the view rendering workflow. The trick is to provide your own implementation of View that invoke...
November 2010
1 post
Convert GPathResult to String without tag0
In Groovy, you can use groovy.xml.XmlUtil.serialize(GPathResult node) to convert node to XML String. But sometimes the XML you end up with contains tag0 namespace all over the elements. It happens because the doc contains default namespace with empty prefix, so groovy uses a default prefix which is “tag0”. The XML is still correct but it would be nice to not have to see that crap. To...
July 2010
1 post
Overwrite Inploy app servers' restart command
Inploy (http://github.com/dcrec1/inploy) is a rails deployment solution. It comes with integration to restart 4 app servers: * mongrel * passenger * thin * unicorn I needed a way to change how Inploy restarts passenger since our passenger’s restart file is at a different location. I could’ve changed the command inside Inploy’s passenger.rb but I wanted to avoid that as...
December 2009
1 post
My shortcut to open any gem in TextMate with 1...
Using the implementation from @peepcode’s blog on shell method missing as a base.I’ve added another action (code snippet below) to open a gem library in TextMate by typing in the name of the gem followed by “.mate”.when /^[A-Za-z0-9_-\/]+.mate$/ # Open the gem in textmate # @example # haml.mate gem_to_open = command.first.gsub(/.mate$/, ”) run...
November 2009
2 posts
Download sources jar from maven
We use Maven, when Maven downloads dependencies it doesn’t download sources, which I rely on when learn and debug programs…. I was expecting, for what seem a simple thing to me, a flag that I can add in maven’s settings files or an option to pass to mvn command…. but I couldn’t find the solution (or anything close to it). Don’t get me wrong, there are solutions...
ImageMagick and JPEG on OSX
I am not a fan of port or fink so I always install ImageMagick from source.
Recently I came across a problem where ImageMagick fails to identify JPEG’s.
The error looks something like this
identify: no decode delegate for this image format
After some digging around it appears I need to install libjpeg and reinstall ImageMagick for JPEG support.
So I downloaded jpegsrc.v7.tar.gz and...
October 2008
2 posts
3 tags
Script Editor
This is a reminder for myself more than anything.
To learn what you can do with an application using osascript, you can run Script Editor and click “Open the Application’s Dictionary” to see properties &/methods that are available.
Apple did the right thing →
NDA dropped for released software
September 2008
3 posts
iPhone NDA →
Wonder when is Android powered phones will come to OZ. It’d be fun to write app to run on my own phone :)
1 tag
Fun with proc →
Curry is going to be a double edged sword.
2 tags
git survey
Some of the commands in the survey looks interesting, must find time to learn them.
git add -i / -p
git add -u / -A
git am
git am -i
git apply
git apply --whitespace=fix
git archive
git bisect
git bisect run
git annotate
git gui blame
git blame
git blame -L , etc.
git bundle
git cherry
git cherry-pick
git cherry-pick -n
git citool
git clean
git add + git commit
git commit -a
git commit ...
git...
July 2008
2 posts
6 tags
Jar decompiler
A while ago I posted some shell scripts to decompile java classes.
I decided to re-implement it in ruby so I can use it between my work (Windows) and home (OS X) machines.
This version does not require you to extract the class files first. You simply pass the jar file to the script and it’ll decompress and decompile it into a directory with the same name as the jar file without .jar.
Twitter's auto follow script in ruby →
As requested by Josh
June 2008
11 posts
3 tags
How to map a network drive
net use x: \\{server}\d$ /USER:{server}\{username} {password}
Basically says you want to map d: drive on {server} to your x: drive as the {username}, which is a login locally on {server}
4 tags
Apple & Google's open web efforts →
4 tags
How to decompile everything
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
1 tag
2 tags
OS X's ruby framework
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.
2 tags
How to revert back to os x ruby framework
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...
1 tag
I give this 2 thumbs up :p →
1 tag
Very interesting read about scentists →
F*%#$in hell →
That’s one expensive apartment!!
1 tag
Git shirt →
Oh Oh I want one!!
May 2008
13 posts
6 tags
Ruby 1.8.7
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...
2 tags
How to batch delete photos from iPhoto library
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....
4 tags
How to stop windows from treating zip files like a... →
3 tags
stikipad
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...
2 tags
Rudeness
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.
1 tag
Git pager
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...
:cry: JSR-308
I am already not a fan of annotations and now this!?!? Fortunately (and also unfortunate) enterprise (man I hate that word) companies are slow to take up new things. The client I work for at the moment is still on Java 1.4…..
5 tags
RoR @ LinkedIn
umm… LinkedIn is looking for Rails developer~~~~
LinkedIn is keeping both its Rails & Java development as Matt suggested.
2 tags
To Flex or not
I am not saying I am going to convert to develop Flex application.
But it might be worth keeping an eye on the technology. It might just be an interesting platform to play with. It is certainly getting attention from the JavaFX guys.
3 tags
Platform, language & future →
If you liked Steve’s post then read Cedric’s comeback
4 tags
Sure way to dump DB schema into ruby using jdbc :)
You need:
jruby
rails (or just active record) gem
activerecord-jdbc-adapter
If you are using the base jdbc adapter then you need to put jdbc jar in jruby’s classpath. I just copied the jar into $JRUBY_HOME/lib
Then
establish AR connection
use schema dumper
e.g.
require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => "jdbc",
...
4 tags
Exciting stuff
Checkout Nick’s JavaOne presso and play with Warbler. I just did and it is very cool. It will create a lot of combination of possibilities on something I plan to present to the company I work for.
1 tag
The power of logo
My baby daughter now recognizes McDonald’s logo, every time she sees the logo she yells out ‘chips’ :)
yes, we should take her there less often.
3 tags
Romey mashup
I was reading Tim’s post which reminded me that I had implemented similar things with Romey. Basically because I was running Romey on a Mac Mini at home and didn’t want to make it accessible over the internet I created another way to create transactions in Romey. It was done with a POP account at my ISP, ruby script running by cron on the Mac Mini. I stopped running the cron job since...
April 2008
7 posts
3 tags
Merb wiki gitified me
I am interested in wiki. So when I saw the new Merb wiki I naturally wanted to check it out. One problem, it’s on github and I don’t have git yet….
So I finally got off my lazy butt and installed git. The process was painless. Now I am all gitified to version 1.5.5. Yeeeha gitty up~~
5 tags
Gem which
I recently installed rb-appscript gem, which is way cool and I wanted to have a look at its implementation.
So I used my ‘pushdgem’ shortcut which basically does a gem which and extract the path of the gem. But to my surprise it said ‘Can’t find rb-appscript’
I knew for a fact that the gem was installed, because TextMate’s RubyAMP (how this all started)...
1 tag
RubyForge and TPG
A while ago, I was unable to login to RubyForge due to proxy issues. Thanks to Tom, he fixed it so I could start publishing romey releases again :)
1 tag
335i coupe
I’ve had a chance of thrashing one at Eastern Creek. Let me just say when I floored it on the main straight…. WOA~~~~ the acceleration sent me firmly to the seat.
Very very nice car indeed.
1 tag
I’ve discovered something interesting… on average each grocery item we get costs about $4.
2 tags
Git
I actually looked to get started git a while ago. Even got myself a github repos but I couldn’t be bothered to install git back then.
Fast forward to now, it is still not as easy as I would like but I can deal with it.
The main reason I want to get git is to make it easier to stay on edge rails.
I haven’t felt that I really need distributed SCM. With no experiences with using...
I think it's time for me to learn
git
a functional language, probably Haskell. Pity uni taught Miranda for my year and switched to Haskell the next year
March 2008
14 posts
3 tags
romey nows run on edge rails.
It started with me trying the scope_out plugin as suggested by Ryan Bate’s awesome railscasts, episode 76. Then I read about named_scope from Ryan Daigle. named_scope is previously known as the has_finder gem so I decided to give the gem a go. After I started using it I decided to pistonise romey with edge rails to save myself the trouble of migrating from...
Nice tumblr features
The archive view. Also we can starting tagging and I saw them mentioned comments. Though tagging is not yet searchable or browsable but things are looking good.
3 tags
Here’s a little 1 liner that let you find all the svn directories in the current folder.
find . -mindepth 2 -maxdepth 2 -name .svn -type d | sed -e's/\.svn//'
Sweet~~~ →
Didn’t know I got mentioned in that blog :)
Firefox 3 (I installed beta 4) seems faster than Firefox 2 but still slower than Safari.
Found a website that doesn’t work very well in Safari though… my modem admin page LOL.