Paul - The Programmer

simple & stupid

Always debug seriously

When something unexpected happens:

  • Read the code carefully.
  • In patient.
  • Never assume anything.
  • Follow the code step by step.
  • Watch the variates change.
  • Run code in debug enviorement.  Print function is far to sufficient.

Help yourself first!

Proxy server with multiplexing socket by select function

Performance is not so good as forking server. Remote address connecting is a time consuming action and blocks the main operating loop. The good of select function is to avoid spawning a bunch of child processes. Did not try the non-block model socket with select function. Since the non-block model socket seems not be well supported by ActivePerl on Win32. Maybe the performance will be better. At least, the conneting action won't block main loop. But still brings a little complication.

merge code with vimdiff

#update difference

:diffupdate

# merge difference from another buffer to current buffer

:diffget                

do

#merge difference from current buffer to another buffer

:diffput

dp

my first Perl proxy server

It's ungly but it's working!!!

So, the lesson learnt.

  • Model developing with a script language is a happy work.
  • Perl fork works on Win32, but it seems a little buggy. Awalys end up with resource tmporary unavailable error : ( May be my bad, but I am quite sure every child process and file handle has been release properly.
  • Have no idea to  Perl multi-thread.  Even the Perl declares it's a multi-thread version.
  • Perl fcntl does not work with Active Perl but is supported by cygwin porting Perl. Great work!
  • Share out-going connections may be a good idea, but how to seperate the responses for each client connection.
  • Pre-fork model seems a good idea to have a try. : )
  • HTTP connect method is to create a tunnel. Still working on this.

Get oracle table primary key info

    SELECT cols.table_name, cols.column_name, cols.position, cons.status, cons.owner
    FROM all_constraints cons, all_cons_columns cols
    WHERE cols.table_name = 'TABLE_NAME'
    AND cons.constraint_type = 'P'
    AND cons.constraint_name = cols.constraint_name
    AND cons.owner = cols.owner
    ORDER BY cols.table_name, cols.position;

-- What a terrible statement. 

-- Reference link: http://www.techonthenet.com/oracle/questions/find_pkeys.php