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.



Sources:

http://en.wikipedia.org/wiki/Cell_%28microprocessor%29

http://en.wikipedia.org/wiki/Octopiler

http://news.cnet.com/Octopiler-seeks-to-arm-Cell-programmers/2100-1007_3-6042132.html

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.

http://www.linuxtopia.org/HowToGuides/runlevel.html

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.

http://atutility.com/content/pentaho-kettle-database-cache

http://ramathoughts.blogspot.com/2010/08/dealing-with-kettle-dbcache.html

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.

http://www.unix.com/solaris/34987-cronjob-dies-when-user-password-expires.html

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.

http://www.thegeekstuff.com/2009/04/chage-linux-password-expiration-and-aging/

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:

http://www.rahul.net/raithel/MyBackPages/crontab.html

 

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));

[/sourcecode]

http://www.tek-tips.com/viewthread.cfm?qid=1493070

Thursday, October 6, 2011

Postgresql table locks

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

http://heatware.net/databases/how-view-see-table-row-locks-postgres/

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;

http://wiki.postgresql.org/wiki/Lock_Monitoring
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.

http://www.commandprompt.com/ppbook/r27479

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"]

SELECT

a.attname as "Column",

pg_catalog.format_type(a.atttypid, a.atttypmod) as "Datatype"
FROM
pg_catalog.pg_attribute a
WHERE
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)
)
;
[/sourcecode]
Taken from here:


dblink

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).

http://www.devdaily.com/blog/post/linux-unix/use-unix-linux-tee-command-send-output-two-or-more-directions-a

Java String.format

Is the java equivalent to the sprintf function in c

http://www.devdaily.com/blog/post/java/use-string-format-java-string-output