Archive for February, 2008

Mój plan na semestr letni

Saturday, February 23rd, 2008

Przy okazji pobawiłem się Google Spreadsheet. ;)

http://spreadsheets.google.com/pub?key=pGWzSN9qMru5kSDOS6VN_Sg

pyhttpd - a tiny HTTP deamon written in Python

Monday, February 11th, 2008

It’s for my Python Course. It provides only very basic HTTP, but yet can be used for simple WWW hosting. Link.

Features:

  • GET and POST methods
  • New thread for new connection
  • Directory listing
  • Error pages
  • Document index
  • Deafult type and charset
  • Python scripts ;)
  • Configuration file
  • … and my own modules to handle these

TODOs:

  • Logging
  • Much more stability (exceptions handling, etc.)
  • Sending gzipped or chunked data (if accepted)
  • Range headers
  • … and many, many other

To run just edit pyhttpd.conf and change Port and Document root. Then type “python pyhttpd.py” and it should be now listening for connections.

How to run a python script and its output send to client? Pyhttpd checks if the requesting file is a python one. If so then it opens a python interpreter by a pipe, sends _GET and _POST dictionaries and file contents. And finally, sends interpreter outputs to client.

_GET and_POST are just dictionaries with variable names as keys. So if there is a foobar.py?i=500 request then _GET will be { ‘i’ : ‘500′ } (note that this is always a string value).

It’s GPL if someone asked.

Open source? A po cholerę mi kod źródłowy?

Thursday, February 7th, 2008

Ostatnio często czytam stwierdzenia, że dostęp do kodu źródłowy nie jest przydatny zwykłym użytkownikom, którzy nie mają zielonego pojęcia o programowaniu. Krew mnie powoli zalewa, gdy o tym słyszę, więc powiem tak: otwarty kod źródłowy wolnego oprogramowania umożliwia innym programistom (niezależnym od autorów oprogramowania) analizować dany program, wykrywać i naprawiać jego błędy oraz tworzyć rozszerzenia i inne dodatki, dzięki czemu wszyscy użytkownicy (cała społeczność) ZYSKUJĄ (uff… długie zdanie).

Załóżmy,  że jakiegoś programu używa 200000 osób, jedna na tysiąc programuje, więc daje nam 200 programistów, zdolnych przejrzeć i poprawić nasz program. Korzystają wszyscy, nie tylko informatycy. Na tym to polega. Jasne? Mam nadzieję, że cześć osób zrozumie.