June 26th, 2011 -- by Jan-Philip Gehrcke Currently, I am playing around with WebSockets. This is due to an application idea I have in my mind which requires a bidirectional connection between browser and server with low latency. The communication will happen in a stream-like fashion at low bandwidth. Real network sockets using TCP/UDP are often the desired optimum for things like that, but within a browser they can only be provided by Java or Flash plugins. The future belongs to WebSockets. Implemented directly in the browser they are providing a much lower level network connection between the browser and the server than HTTP — without any plugin. WebSockets still work on a layer above TCP, but low latency and efficient data transport in both directions is warranted in a TCP-like fashion. Therefore, real-time application developers are very keen to use WebSockets. As this still is a young development, there is only few browser support and a lot of non-mature client/server libraries. Most importantly, there is a huge lack of documentation how to use these. In this blog post, I present a very simple “echo application” where the user sends a message from his browser to the server — which in turn sends this message back to the client. Simple so far, but the main focus while realizing this is on selecting the right tools for the task, as there is already a lot of stuff out there — some very good, undocumented and hidden things, some totally overloaded things, and some bad things. I tried to fulfill the following conditions: - Make use of a “Flashbridge” to realize a fallback when WebSockets are not available in a browser (which is true for Firefox at the moment)
- use Python on the server side
- use the best / most solid tools available
- at the same time, use the simplest tools available that do not bring along loads of stuff that you do not need for simple applications or if you want to desing your own communication protocol anyway.
»» Continue reading »» June 18th, 2011 -- by Jan-Philip Gehrcke Currently, I am looking into gevent — a nicely performing networking library for Python, based on the brilliant idea of greenlets. I try to use this for WebSocket communication with browsers. As of today, WebSockets are still not available or disabled in some browsers. That’s why there are Javascript implementations like web-socket-js providing a transparent “Flashbridge” as a fallback for the WebSocket communication. But the Flash plugin in the client’s browser does not simply communicate with any server on any port in the world. As a first step, it always tries to receive a so-called socket policy file from the same server the SWF file was received from; on port 843. This policy file tells the client from whom he is allowed to receive data. Today, I present a simple server based on gevent providing this policy file for connecting Flash clients. »» Continue reading »» February 6th, 2011 -- by Jan-Philip Gehrcke Assume, you’ve measured values over time and now you want to average your data. This means you have to a) average your measured values — which is a trivial task — and b) average your points in time. Here, I present a solution how to average arbitrary date strings in Python. »» Continue reading »» November 17th, 2010 -- by Jan-Philip Gehrcke Let me share a shell script to perform a backup of a MySQL database. It is intended to run regularly (e.g. as cronjob). I created it carefully. Finally, it may distinguish itself from similar scripts by the following points: »» Continue reading »» February 13th, 2010 -- by Jan-Philip Gehrcke While writing my master thesis with LaTeX, I often change source code files, graphics etc. It is important for me to keep track of the major changes as well as I have to prevent losing the whole work due to some data loss issue. To solve these two problems, I wrote a convenient Python backup script. »» Continue reading »» January 26th, 2010 -- by Jan-Philip Gehrcke 0110100001110100011101000111000000111010001011110010111101111000011010110110001101100100001011100110001101101111011011010010111100110101001100010011100000101111
Seriously, you really want to know what’s behind this! »» Continue reading »» October 29th, 2009 -- by Jan-Philip Gehrcke I just needed to convert several PDF graphics to PNG raster graphics. The cleanest way to do this is via Ghostscript (example: gs -sDEVICE=png16m -sOutputFile=tiger.png tiger.pdf). For convenience I made a Python script that converts all PDF files in the working directory to PNG files via Ghostscript. I use it under Windows, but this works for “all” operating systems. Let me share it with you. »» Continue reading »» August 24th, 2009 -- by Jan-Philip Gehrcke The Google Summer of Code 2009 final evaluation deadline is today; 19 UTC. I don’t have time to summarize my summer here now, but there are two things I want to say to the world. First, I want to thank many people for enriching my summer. Second, I would like to announce the Clobi project on Google Code. »» Continue reading »» August 18th, 2009 -- by Jan-Philip Gehrcke Hello you out there! I just started running the first serious test of the system I’ve developed during this year’s Google Summer of Code. If I wanted to put it in sensational words, the test could be called “Distribution of Particle Physics High Performance Computing Jobs among Multiple Computing Clouds”; just to get some readers . During the test, there will be some time I just sit around and watch my monitor, so I decided to share my experience about the new system with you and keep record of the test progress within this blog post. »» Continue reading »» August 1st, 2009 -- by Jan-Philip Gehrcke These days I built up an inter-thread communication via os.pipe(). While one thread is only writing to the “write end” of the pipe, the other thread is only reading from the “read end”. »» Continue reading »» | |