Posts

Showing posts from November, 2009

Git Pack Error

I believe this error occurred when a pack operation was interupted during a push operation:


Counting objects: 338, done.
warning: suboptimal pack - out of memory
fatal: Out of memory, malloc failed
error: pack-objects died with strange error
error: failed to push some refs to 'ssh://build@192.168.0.17/~build/dev/git-public/platform/billing/billing'


The solution that worked for me:

git repack -adf --window-memory=100M

Hibernate Exception in Grails when dealing with exceptions

HibernateException: Found shared references to a collection

Like me, you may have have caused this error by having something like the following

sale2.discounts = sale1.discounts
sale2.save()


The solution in my case was to do the following:

sale1.discounts.each { d->
sale2.discounts << d
}

Quick Solution to Godaddy Certs not working in Java

If your experiencing problems with godaddy certs (generally an SSLHandshakes error) when using Java (perhaps with HttpClient), the following may solve your problem quickly.

Note: this was done on Ubuntu, so you may need to adjust it to your OS.

wget 'http://blogs.sun.com/andreas/resource/InstallCert.java'

javac InstallCert.java

java InstallCert $mydomainname
#respond to prompt with return

sudo cp jssecacerts $JAVA_HOME/jre/lib/security

grails remotefunction limitation

I stumbled apon a limitation of the grails remote function today. I have two drop down lists Products and Prices, with the Prices dependent on the particular Product selected, and also the customer in question. In order to achieve this, I needed to pass two params to the remote method.

There are two ways of using the params attribute of the remotefunction.

Option 1:

You can pass a string


<select onchange="${remoteFunction(action:'getRightPriceForProduct',update:'price', params:'\'productId=\' + this.value\'' )}">
product1
product2
</select>


Option 2:

you can pass a map


<select onchange="${remoteFunction(action:'getRightPriceForProduct',update:'price', params:[customerId:customer.id])}">
product1
product2
</select>


Option 1 allows me to use 'this' in javascript to send the product selected, and option 2 allows me to pass the customer's id at the page rendering time, but neither option allow…