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!

13 Dec 2008, Starbucks

The coffee lesson last weekend at Starbucks. Really a good time. 8-)

All the photos in this post belong to the author and all rights reserved.
To be used in other places without permission from the owner is not acceptable.

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


# merge difference from another buffer to current buffer



#merge difference from current buffer to another buffer



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.