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


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;

compiled and executed it:

$ ./ctest
aantal argc: 1
argv0: ./ctest
argv1: (null)
h: 16383.000000
h: 0.006104

Well that’s very exiting.

ref cursor column names

 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;
 l_cur := dbms_sql.open_cursor;
 open l_ref for l_sql;
 dbms_sql.parse(l_cur, l_sql, dbms_sql.native);
 for i in 1..l_cnt
 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); 
 -- dbms_output.put_line('|- precision : '||l_tab(i).col_precision); 
 -- dbms_output.put_line('|- scale : '||l_tab(i).col_scale);
 -- dbms_output.put_line('|- > : '||'['|| case l_tab(i).col_type when 1 then 'varchar2('||l_tab(i).col_max_len||')' when 2 then 'number('||l_tab(i).col_precision||','||l_tab(i).col_scale||')' when 12 then 'date' end ||']');
 case l_tab(i).col_type 
 when 2 then dbms_sql.define_column(l_cur, i, l_num);
 when 12 then dbms_sql.define_column(l_cur, i, l_dat);
 else dbms_sql.define_column(l_cur, i, l_tab(i).col_name,l_tab(i).col_max_len);
 end case;

 end loop;
 l_exe := dbms_sql.execute(l_cur);
 if dbms_sql.fetch_rows(l_cur) = 0 then
 end if; 

 for j in 1..l_cnt loop
 case l_tab(j).col_type
 when 2 then 
 dbms_sql.column_value(l_cur, j, l_num); 
 l_val := l_num;
 when 12 then 
 dbms_sql.column_value(l_cur, j, l_dat);
 l_val := to_char(l_dat,'dd-mm-yyyy hh24:mi:ss');
 dbms_sql.column_value(l_cur, j, l_val);
 end case; 
 end loop;
 end loop;

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 . -iname ‘*.avi’ | cut -d ‘/’ -f2 | sort | uniq | xargs -I {} mv -i {} /mnt/usb1/dlna/

(run this command again for mkv’s and mp4’s and move the folders where a video_ts exists into non_dlna).

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

c_x sys_refcursor;
l_xml_ xmltype;


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;



<?xml version="1.0"?>
  <B>Some text</B>
  <B>Some other text</B>

And now for something completely different….


Why didn’t I think off that before.

$johannes@ubuntu:~$ sudo apt-get install postgresql

$johannes@ubuntu:~$ sudo apt-get install postgresql-doc


sudo -u postgres psql postgres

change password:

\password postgres

create database johannes;

create user johannes;

ctrl D

~$ psql


create table test (a varchar(10));
insert into test (a) values(‘b’);

CTRL D …..


Some Oracle session information

select s.process,s.status
,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:


chrooted sftp

chrooted sftp:

$ sudo adduser –shell /bin/false pietjepuk


$ /home $ sudo chown root:pietjepuk /home/pietjepuk/
$ sudo chmod 755 /home/pietjepuk/

$ sudo vi /etc/ssh/sshd_config

comment de regel waar sftp server wordt bepaald:
#Subsystem sftp /usr/lib/openssh/sftp-server

En voeg het volgende onderaan toe:
Subsystem sftp internal-sftp
Match User pietjepuk
ChrootDirectory %h
ForceCommand internal-sftp
X11Forwarding no
AllowTCPForwarding no

$ sudo service ssh restart

json kladblok

$.getJSON( “ajax/test.json”, function( data ) {
var items = [];
$.each( data, function( key, val ) {
items.push( “

  • ” + val + “
  • ” );

    $( “

      “, {
      “class”: “my-new-list”,
      html: items.join( “” )
      }).appendTo( “body” );


      ‘, {
      id: ‘foo’,
      href: ‘’,
      title: ‘Become a Googler’,
      rel: ‘external’,
      text: ‘Go to Google!’