My odyssey in vTiger CRM

The problem: replace a popup with an Ajax autocomplete. In vTiger a Contact belongs to an organisation (called an Account), so the typical UI for a Contact shows both the Contact’s data (name, email, phone number) and the Account data (ship address, bill address and so on). If you happen to switch the organisation this Contact belongs to (maybe because you entered the wrong one) you have to click an icon, which opens a new browser window and lets you choose the new Account. When you pick one, the popup is closed and the data are sent back to window.opener.form. A more user-friendly UI, of course, is the autocompleter.

[More...]

Apache mod_authz_host: what do Order, Deny and Allow mean?

This is really silly – I admin, but I never had to mess with Order, Deny and Allow inside <Directory> contexts in Apache configuration files and .htaccess. But Today I got an error: “403 Forbidden: You are not allowed to access / on this server”. This turned out to be a missing +Indexes in my virtual host configuration, neverthless it was an opportunity to revise the Apache documentation. [More...]

Java HTTP client and POST requests

Apache HttpClient’s site is poorly designed, so the documentation is difficult to find and it also assumes you have some confidence with HTTP. So, first things first, this is the link to the project, and here is the official tutorial. (BTW, you’ll often see GA which stands for General Availability – ie a public release) [More...]

Multiple substitutions with sed

$echo 'hello world!' | sed "s/hello/good/g;s/world/bye/g"
good bye!

Rotate a shape about an arbitrary point

I wrote this to answer a question on StackOverflow. It’s a piece of Javascript code to rotate an object around an arbitrary point. I underestimated the complexity of this problem and found no available solution online. To be honest, the objective is quite simple to achieve, but neverthless it made me review trigonometry and linear algebra and exercise the canvas API. Here is the original JSFiddle. Here is the result

[More...]

Join multidimensional array elements with a Ruby oneliner

Just the code

matrix = Array[
[1, 2, 3],
[4, 5, 6],
[0, 0, 0]
]
puts matrix[0..1].transpose.map {|col| col.join(', ')}.join(', ')
>>> 1, 4, 2, 5, 3, 6

I thought of this because of canvas.setTransform()

Install RVM

The following downloads and executes the RVM installer

$ bash -s stable < \
   <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

[More...]

Reverse proxy on development machine to get rid of ports in URLs

As a web developer I deal with several HTTP servers: Apache, Tomcat6, Tomcat7, Play!, WEBrick. In order to run all of them on the same machine (possibly at the same time) each needs to be bound on a port different than well known 80, so that you need to specify the port as part of the URL (for example in the browser). [More...]