Sunday, October 30, 2011

cell microprocessor - Intro

I'll be doing a little bit of research on this processor as I'm likely to program or implement some high intensive computation solutions on top of it.


Saturday, October 29, 2011

inittab file - init command

It's funny how late I came to know this configuration file. It turns out to be the one that determines de default run level at startup. As far as I'm concern, every server should be set to use run level 3 by default. Another thing worth mentioning is that was JA who pointed to me the posibility to reboot your system using a particular run level with the command init # (where # is the appropriate run level)  if you want to change the run level after the startup.

Friday, October 28, 2011

Kettle cleaning the database cache

Sometimes when you're doing extreme bi (or bi on the fly, not in a production environment of course), but just for the sake of it , you realize that is necessary to make changes to your data warehouse schema. The issue when working with Kettle is that if you previously told the tool to fetch field data from a table, it won't update to the latest changes automatically, so you'll need to clean the database cache of the database you made the changes to in order to update  its meta-data.

Thursday, October 27, 2011

cron jobs - aged passwords

I've never happened to use a linux account with a periodical password change policy before.  I logged in, I was asked to change my password, and realized  one cron job didn't  execute at the scheduled time. First thing that came to mind, was that password expiration issue, and it makes absolute sense to prevent automatic actions from an "invalid" user from taking place.

So, as I intent to forget about that cron job once the performance monitoring stage is over, the easiest way is to edit the crontable of the root user , rather than dropping the policy that was set there for a reason.

Though knowing how to do it should the necessity arise, won't kill anybody.

Whether I agree with the password expiration policy is not an issue, I'm not happy scheduling the job as root either but I least I won't be invalidating a policy that was adopted for security reasons, provided the person entitled with the system admin role knows what is doing.

Grasping more insights into the cron environment:


Monday, October 24, 2011

Insert where not exists

I learned about this neat sql construction (it works in postgresql, I couldn't tell whether in others too):

[sourcecode language="sql"]

insert into dim_pais (pais_key,country_id,nombre) (select 0 as pais_key, 0 as country_id, 'SIN PAIS' as nombre where
not exists (select 1 from dim_pais where pais_key= 0));


Thursday, October 6, 2011

Postgresql table locks

Another interesting link regarding postgresql is this one about glancing at active table locks:

select t.relname,l.locktype,page,virtualtransaction,pid,mode,granted from pg_locks l, pg_stat_all_tables t where l.relation=t.relid order by relation asc;
Thanks to this I could figure out that there were a bunch of locks on a table one of my etl jobs uses.

Then I realized I needed a refresher for the lock concepts.

I can see now, my job's generating a deadlock, goddamn it!

Postgresql get column names of a table / dblink

Postgresql get column names of a table

I'm saving this query for future reference, It might come in handy someday:

[sourcecode language="sql"]


a.attname as "Column",

pg_catalog.format_type(a.atttypid, a.atttypmod) as "Datatype"
pg_catalog.pg_attribute a
a.attnum > 0
AND NOT a.attisdropped
AND a.attrelid = (
SELECT c.oid
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relname ~ '^(foo)$'
AND pg_catalog.pg_table_is_visible(c.oid)
Taken from here:


I've been looking forward to try dblink, but I haven't had the time. I found a very useful overview.

Monday, October 3, 2011

tee command | Java String.format

tee command

I had never used it before. It splits the output of an operation so you can send it to multiple targets (i.e to the standard output and to a file at the same time).

Java String.format

Is the java equivalent to the sprintf function in c