Cleaning up, found some bits of code…

#include <stdio.h> #include <math.h> int main(int argc, char **argv) { float h; printf( “aantal argc: %d\n” ,argc); printf( “argv0: %s\n”, argv[0]); printf( “argv1: %s\n”, argv[1]); h=0x3fff; /* 16 * 16^0 16 * 16^1 16 * 16^2 3 * 16^3 = 16656 */ printf( “h: %f\n”, h); h=(100.0 / h); printf( “h: %f\n”, h); return 0; […]

ref cursor column names

declare l_ref sys_refcursor; l_cur integer; l_exe integer; l_sql varchar2(100) := ‘select * from <>’; l_tab dbms_sql.desc_tab; l_cnt integer; l_val varchar2(4000); l_num number; l_dat date; begin l_cur := dbms_sql.open_cursor; open l_ref for l_sql; dbms_sql.parse(l_cur, l_sql, dbms_sql.native); dbms_sql.describe_columns(l_cur,l_cnt,l_tab); for i in 1..l_cnt loop dbms_output.put_line(i||’ ‘||l_tab(i).col_name||’ ‘||l_val); — dbms_output.put_line(‘|- type : ‘||l_tab(i).col_type); — dbms_output.put_line(‘|- max_len : ‘||l_tab(i).col_max_len); — […]

move directories

I wanted to differentiate my movies into ones playable on dlna aware devices and others. ie my avi’s and mkv’s and mp4’s are ok. but files with reside into folders named video_ts need to be excluded. So how to mv all dir’s (in from current dir) where an avi exists into the dlna folder: find […]

plug my alcatel 3g modem in an usb3 port….

Cut ‘n Paste from some forum: In the last ‘upstream’ version of usb_modeswitch, there is an additional global option SetStorageDelay in the config file “/etc/usb_modeswitch.conf”. You can set this to “3” or anything else, and usb_modeswitch will check if this is the minimum value and set it accordingly via the respective sysfs attribute.

oracle xml quicky

declare c_x sys_refcursor; l_xml_ xmltype; begin open c_x for select t.a,t.b,t.c from zzz_test t; select t.xml_ into l_xml_ from xmltable(‘/’ passing xmltype(c_x) columns xml_ xmltype path ‘.’) t; dbms_output.put_line(l_xml_.getclobval()); end; <?xml version=”1.0″?> <ROWSET> <ROW> <A>1</A> <B>Some text</B> <C>6</C> </ROW> <ROW> <A>7</A> <B>Some other text</B> <C>5</C> </ROW> <ROW> <A>8</A> <C>4</C> </ROW> </ROWSET>

And now for something completely different….

POSTGRESQL Why didn’t I think off that before. $johannes@ubuntu:~$ sudo apt-get install postgresql $johannes@ubuntu:~$ sudo apt-get install postgresql-doc login: sudo -u postgres psql postgres change password: \password postgres create database johannes; create user johannes; ctrl D ~$ psql johannes=> create table test (a varchar(10)); insert into test (a) values(‘b’); commit; \password CTRL D …..  

Some Oracle session information

select s.process,s.status ,s.username,s.schemaname ,s.sid,s.serial# ,to_char(s.logon_time,’dd-mm-yyyy hh24:mi’) logon_time ,substr(sq.sql_text,1,25) sql_txt from v$session s left outer join v$sql sq on s.sql_id = sq.sql_id order by 5; And kill some session: ALTER SYSTEM KILL SESSION ‘sid,serial#’;