Shame is Pride's cloak.
William Blake, The Marriage of Heaven and Hell (1790-93). Proverbs of Hell
Latest Comments 
Choosing is existence: to the extend you don't choose, you don't exist.
Dr. Dockey tells Horner
Nasty Java catch
by gmosx, at 17 Mar 2011BigDecimal value = new BigDecimal("0.31");BigDecimal oldValue = new BigDecimal("0.34");BigDecimal ratio = value.divide(oldValue);java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.BigDecimal ratio = value.divide(oldValue, BigDecimal.ROUND_HALF_EVEN);Ultra geeky holiday e-Card
by gmosx, at 04 Feb 2011This came to my attention and I had to share it:
Cool innovative mini apartment
by gmosx, at 10 Dec 2010Overpopulation is one of the haunting problems of our age (and things can only get worse down the road). As always, to crack difficult problems, you need innovative thinking. Have a look at the following video:
Random GAE/J deployment problems
by gmosx, at 19 Nov 2010I had a very annoying problem lately. The deployment of my app to GAE was failing randomly with mysterious errors like this:
com.google.apphosting.utils.config.AbstractConfigXmlReader
getTopLevelNode
SEVERE: Received IOException parsing the input stream for /home/.../war/WEB-INF/web.xml
java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
...
SEVERE: Received exception processing /home/.../war/WEB-INF/web.xml
com.google.apphosting.utils.config.AppEngineConfigException: Received
IOException parsing the input stream for /home/.../war/WEB-INF/web.xml
at
com.google.apphosting.utils.config.AbstractConfigXmlReader.getTopLevelNode( AbstractConfigXmlReader.java:
210)
After an extended googling session I unearthed a solution from this helpful discussion thread. Just replace the doctype declaration in your web.xml file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
with the following updated version:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
That's all, one click deployment is working reliably again!
Explorer blocking your Facebook app cookies?
by gmosx, at 17 Nov 2010You worked hard. Your application works like a charm, the concept rocks, the graphics are great, the client is happy. Still, you know there is one more thing to do: test with the dreaded Internet Explorer.
In your case, the app is a standard Facebook iframe application. You went to great lengths to make sure it stays compatible with IE (that means modern CSS/HTML techniques are off limits). Tough luck, you have to try harder my friend. You see, the application does not work at all! With no error message whatsoever.
Oh, wait a minute, there is a stupid eye icon in the status bar. Once you click it you realize that IE is actually blocking Facebook's authentication cookie! In the default security setting, no less. You are royally screwed.
To make a long story short, here is a 'voodoo' solution, offered by a mastermind friend:
response.setHeader("P3P","CP='IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT'");
For the hairy details, get educated by the pros. Groovy!
Center a div horizontally and vertically using CSS
by gmosx, at 18 Oct 2010A few days ago, I needed to center a mini site horizontally *and* vertically (don't you just love client requests?). It 's easy to tackle the horizontal axis using CSS:
<style>
.hcenter {
margin: auto;
width: 320px;
height: 240px;
}
</style>
<div class="hcenter">Horizontally centered text</div>
On the contrary, I thought that CSS can't handle vertical centering (at least in a cross-browser compatible way) and a quick Google session ended fruitless as well. Instead, I wrote a small script to programmatically center the div inside the window. It took a couple of revisions to support resizing, eliminate flickering, ensure cross-browser compatibility, etc. but eventually I got it right.
Today though, I rediscovered an old trick:
<style>
.center {
position: absolute;
width: 320px;
height: 240px;
top: 50%;
left: 50%;
margin-top: -120px;
margin-left: -160px;
}
</style>
<div class="center">Horizontal and vertical centered text is possible.</div>
Duh!
A few days ago, Joyent unveiled the public beta of their NodeJS-based platform-as-a-service contender. Well, this service rocks! From the great no.de domain name to the RESTful procurement/management API and the git-powered deployment, everything radiates coolness.
Even though I posted my hearts to the API end-point (/♥ !!), I haven't received any coupons in return. So there is no review for you. However, the elegant simplicity of the API (combined with the clean-slate design of the underlying NodeJS infrastructure) lights my geeky heart (pun intended).
I am not a NodeJS fan-boy. These days I am evaluating Java/GWT (so far I am positively surprised but I 'll reserve my final judgement for a future post). So, you understand, like everyone who feels overwhelmed by the complexity of the Java ecosystem, I can appreciate a refreshingly simple alternative.
We are what we repeatedly do
by gmosx, at 28 Aug 2010We are what we repeatedly do.
Excellence, then, is not an act, but a habit.
Aristotle, 384-322 BC
Subscribe to this blog


on RingoJS vs NodeJS