October 7th, 2011 -- by Jan-Philip Gehrcke I am following the emerging WebSocket standard with a lot of interest. Today, I would like to update my recommendation of tools presented in the article “The best and simplest tools to create a basic WebSocket application with Flash fallback and Python on the server side”. ws4py (WebSocket for Python) by Sylvain Hellegouarch is worth spreading the word. »» Continue reading »» August 16th, 2011 -- by Jan-Philip Gehrcke I could not remember the command to “jump” to the bottom of a page in LaTeX. »» Continue reading »» 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 25th, 2011 -- by Jan-Philip Gehrcke Because of this POV-Ray issue, I wanted to figure out what is the most secure and stable way to read a file line by line in C++ using a std::ifstream in combination with std::getline(). Furthermore, it was the aim to provide as precise error messages as possible. It turned out that dealing with the error bits eofbit, failbit, and badbit is already challenging, as discussed for e.g. here, here, and here, and finally at cplusplus.com. Even in the latter case you are not provided with all details and the optimal solution. Regarding error messages, it is getting more complicated. Evaluating errno, respectively perror(), at the same time as the error bits is not trivial as can already be inferred from discussions like this and this. But after some testing and carrying together all available information it turns out that there are good recipes to follow. Update (July, 7th, 2011): I revised the whole article due to an important insight provided by Alexandre Duret-Lutz (confer comments). »» Continue reading »» June 20th, 2011 -- by Jan-Philip Gehrcke It took me much too long to find a proper solution while searching for “pymol remove hydrogens” and “pymol remove water“. It’s pretty easy… »» 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 »» June 9th, 2011 -- by Jan-Philip Gehrcke If you build (xm)grace without the presence of libpdf, you won’t be able to save figures as PDF files. I compiled both — libpdf and grace — as non-privileged user: »» Continue reading »» June 7th, 2011 -- by Jan-Philip Gehrcke Long time ago since my last blog post… maybe I should just write the small things down. For my PhD, I’m currently working with PyMOL and was wondering how to rename an object there. So I googled searched for “pymol rename object” and did not find the proper solution on the first page. But there is one. Maybe this post will show up for the next one searching for “pymol rename object”. »» 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 22nd, 2010 -- by Jan-Philip Gehrcke The appearance of this website just changed, as you perhaps have noticed. »» Continue reading »» | |