Latest Posts

Some advice for junior developers new on the job by Henrik on November 15th, 2017First of all, the below applies to a quite high stakes setting in a financially related company, a place were we don't move fast and break things if we want to continue being in business.

Setting up Ansible for MySQL by Henrik on September 14th, 2016In this how to we're going to manage in total 16 different LXC nodes on two different host machines.

A Function Browser for Emacs by Henrik on April 9th, 2016In my emacs init file for 2015 post I state:
However it would be kind of nice to be able to run a command to open a new buffer with links to line numbers for all definitions in the current file, shouldn’t be too hard to implement either, we’ll see if I manage in 2015.

Hacking Wordpress The Ugly And Quick Way by Henrik on August 4th, 2015Recently I've started a little project to see how I can do with IDN affiliate sites where there is a lot less competition than in English.

Functional HTML Rendering with PHP by Henrik on August 4th, 2015When you're working with a programming language that doesn't have templating per default and you're not in the mood - or don't see the need - for templating your first course of actions is to write something to obviate having to print and concatenate everything.

Update: Paceville.com is now online, where the effect described in this tutorial can be seen.

Take a look at the image to the right, a classic example, due to space restrictions we have a login form – that has the information we would normally put in labels – as values instead.

The first requirement is that as soon as a field gets focus its contents should be nulled, the second is that the password field should of course be a password field when getting focus, and the third is that everything should be tabbable.

So I implemented #1 and #2, but for some reason the form would not tab properly in for instance Chrome and Safari, it worked just fine in Firefox 3.x.

Note the use of jQuery instead of $, we’re working with Joomla here which is using Mootools so we don’t want any conflicts, that’s why.

Let’s discuss the password field first (#mod_login_password). On focus we replace it with the argument string. I couldn’t figure out how to change just the attribute here, doing attr(“type”, “password”) didn’t work for me, that’s why I ended up with this less than ideal solution.

Anyway when the username field gets the focus we zero out its contents and then listen for all key presses, if we have a vertical or horizontal tab (I’ve got no idea if both cases are needed but just in case since I don’t know the difference or the history behind there being two types) we trigger a focus event on the password field.