Author Archives: elciok

Restarting PostgreSQL server on Mac OS X

sudo SystemStarter start PostgreSQL

Posted in Uncategorized | Leave a comment

RAILS: link_to current page

Using Rails 3. I wanted to generate a link to the current page being viewed, with some extra parameters, but couldn’t find an easy way just by browsing the docs. It turns out this is quite easy: link_to “My Link”, … Continue reading

Posted in programming | Tagged , | Leave a comment

RAILS: configuring authlogic authentication gem on Rails 3

Using Rails 3. This is the most straightforward article on configuring authlogic on Rails 3: http://www.dixis.com/?p=352 There’s only one minor change I had to do, changing this (in ApplicationController): def store_location session[:return_to] = request.request_uri end To this: def store_location session[:return_to] … Continue reading

Posted in configuration, programming | Tagged , , | Leave a comment

PHP and Yii FRAMEWORK: use browser locale to set application locale

Using PHP 5.2.10 and Yii Framework 1.1.4 (http://www.yiiframework.com) I wanted my web application to use messages in a language depending on the locale used by the web browser. According to the HTTP specification, browsers can send headers, in a request, … Continue reading

Posted in programming | Tagged , | 1 Comment

GOOGLE CHROME: onUnload event when closing popup

I’m building a Google Chrome extension and I needed to run some code when the popup that opens when the user clicks the browser action is closed. Unfortunately, the “onunload” event is never trigered in this case. Well, according to … Continue reading

Posted in programming | Tagged | Leave a comment

JAVASCRIPT: be notified when location hash changes

I have code that should be fired when the URL at the location bar on the browser changes, most specifically, when the “hash” part of the URL changes. This happens when the user clicks a “a” anchor link to the … Continue reading

Posted in programming | Tagged , , | Leave a comment

JAVA: Using Java 6 instead of Java 5 in Mac OS X

Using Mac OS X 10.5.8 I was getting some UnsupportedClassVersionError when I tried running my application in Mac OS X. This error means I’m trying to use code compiled in a Java version not supported by my JVM. To check … Continue reading

Posted in configuration | Tagged , , | Leave a comment

XUL: Allowing DIV text select inside XUL controls in Firefox

Needed to use a DIV tag to show some text in a Firefox extension. The problem was that Firefox extensions usually use XUL, not HTML, but we can use HTML controls and tags inside XUL. But the DIV was not … Continue reading

Posted in programming | Tagged , , | Leave a comment

EJABBERD: registering new account using an admin connection

Symptom: Using ejabberd 2.1.x built from source code from Git repository. I’m connecting to an ejabberd server using Smack XMPP client library. I am able to create new accounts on the XMPP server when the connection is not logged, just … Continue reading

Posted in configuration | Tagged , | 1 Comment

GRAILS: Transaction injection doesn’t work if you declare your methods as closures

Symptoms: Using Grails 1.2.2. I created a Service and declared some methods like this: def signUp = { arg1, arg2 -> //method body } This is a valid way to declare a method, where you simply assign a closure to … Continue reading

Posted in programming | Tagged , , | Leave a comment