Note: I did a major catch-up in readings this week. This are just the highlights.
Extra:
Let's suppose you've a simple task in JavaScript; a form field has a date in the format YYYY-MM-DD and you want to convert it to a Date object.
Your first guess is to read about native Date support and found about Date.parse, but guess what? Let's take a look at the ECMAScript Language Specification:
15.9.4.2 Date.parse (string)
The parse function applies the ToString operator to its argument and interprets the resulting String as a date and time; it returns a Number, the UTC time value corresponding to the date and time. The String may be interpreted as a local time, a UTC time, or a time in some other time zone, depending on the contents of the String. The function first attempts to parse the format of the String according to the rules called out in Date Time String Format (15.9.1.15). If the String does not conform to that format the function may fall back to any implementation-specific heuristics or implementation-specific date formats. Unrecognizable Strings or dates containing illegal element values in the format String shall cause Date.parse to return NaN.
So, we end up with this vague definition of the behaviour that causes browsers to disagree on what to do.
Ubuntu 12.04 is the current LTS version of the distribution and is what I'm using on most of the servers I get to manage.
I always try to work with the packages provided by the distribution. In this case Ubuntu bundled PostgresSQL 9.1 as the most up-to-date version of the database software in the distribution (you can always use an update PPA to get the shiny new things).
In the middle of a small migration between versions of our software I needed to populate a database with information from other database. By design you can't do queries between databases in PostgreSQL because it loads database-specific system catalogs and it is uncertain how a cross-database query should even behave.
For this problem you can use dblink, it basically acts like a function that contains a query in it and returns the result of the query. dblink comes as part of the contrib package in PostgreSQL, and it's present in the postgresql-9.1-contrib package in Ubuntu.
So, supposing you already have PostgreSQL 9.1 running you can install the contrib package with:
sudo apt-get install postgresql-contrib-9.1
And to load the dblink modules in PostgreSQL you've to:
sudo su postgres -c "psql -c "CREATE EXTENSION dblink" postgres"
Supposing that "postgres" is the database where you want to use dblink. That's it, to try it:
postgres=# select username, app from dblink('dbname=booki', 'select usename, application_name from pg_stat_activity') as t(username text, app text); username | app ----------+------ postgres | psql postgres | (2 rows)
Magic!