Es gibt ja klassische Beispiele für Branchen, die meinen, gegen die Geschichte im negativen Sinne aufstehen zu können. Angenommen, bei der Einführung des Autos hätten die Postkutscher sich gegen eben jenes zur Wehr gesetzt, es wäre vergleichbar mit dem peinlichen Aufstand, den die Musikindustrie derzeitig gegen Downloader wagt. Einem ähnlichen Aufstand frönen die Freunde des »sauberen« Radsports, die ach so furchtbar finden, dass immer mehr Doping-Fälle bekannt werden. Dabei sind die Leistungen, die diese Sportler vollbringen, längst nicht mehr ohne Drogen zu schaffen. Man sollte also schnellstens darüber nachdenken, den Gebrauch von Amphetaminen, Steroiden usw. zur Gänze zu legalisieren. Ähnlich den Reifenherstellern in der Formel 1, in der die Fahrer längst nur noch vernachlässigbares Teilchen des »Gesamtsetups«, wie es so euphemistisch heißt, sind, könnten dann endlich die Pharmakonzerne munter gegeneinander antreten und hätten einen wunderbaren Werbeeffekt: »Bayer: Dopingpartner der Gewinner der Tour de France 2007, 2008 und 2009« – ein Untertitel der durchaus etwas hermacht.
Filed under Doping, Drogen, Floyd Landis, Radsport, Tour de France & 15 comments & no trackbacks
Why does nobody develop Gstreamer-bindings for PHP?
Filed under Code, Gstreamer, PHP, Technology, www & seven comments & no trackbacks
»The neighborhood bully been driven out of every land,
He’s wandered the earth an exiled man.
Seen his family scattered, his people hounded and torn,
He’s always on trial for just being born.
He’s the neighborhood bully.Well, he knocked out a lynch mob, he was criticized,
Old women condemned him, said he should apologize.
Then he destroyed a bomb factory, nobody was glad.
The bombs were meant for him.
He was supposed to feel bad.
He’s the neighborhood bully.«
Bob Dylan, Neighbourhood Bully
Filed under Israel, Libanon, Politik & seven comments & no trackbacks
Hopefully on Wednesday Blogmonitor, a new project of Interdings will be open for the public. In the last days and hours I was working on the API-components. An XML/RPC-interface, an REST-service and as a nice goodie a multithreaded TCP-server where you can watch all the incoming pings when they occur. The concept is the following: when an incoming ping occurs, the encapsulated class Blogmonitor::Pingservice::Ping sends a notification to the TCP-component, which waits for incoming connections on a custom port and serves the snippet to all of the connected clients. This is invented as really simple interface and has nothing to do with more standartized technologies like »Publish & Subscribe«, also the logic would be similiar.
Ruby ships an example of a multihreaded server implementation which is called GServer. It provides the possibility to create a child-class of it, overload the serve()-method and be happy. That’s really a good beginning and the concept of having patterns seems to succeed again: don’t code things twice.
<ol><li>require 'gserver'</li><li>class MyServer < GServer</li><li> def serve( io )</li><li> io.puts( "Hello world" )</li><li> end</li><li>end</li><li></li><li>s = MyServer.new 1234</li><li>s.start</li><li>s.join</li></ol>
The code should be more or less self-explaining: load the pattern, extend the class GServer and overload the method server(), which provides an IO-object. The method puts() of the IO-object writes »Hello world« to connected client.
Just create an instance, start() the server, join().
Connect with telnet to localhost and port 1234:
telnet localhost 1234 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. <strong>Hello World</strong> Connection closed by foreign host.
Now you have a simple TCP-Server. But we miss a few things: on the one-hand the backend notification is not implemented and the connection is not persistent. If a client connects, it should not be disconnected just to receive a stream of incoming weblogs. First of all: implement the streaming thingy. Have a look at the lines 3-5 of example I: the serve()-method is executed on a new connection and disconnects the client when it method is called. But we want to have it persistant. A dirty solution would be to write the io-code in an endless loop, which works pretty fine.
<ol><li>require 'gserver'</li><li>class MyServer < GServer</li><li> def serve( io )</li><li> loop do</li><li> io.puts( "Hello World" )</li><li> end</li><li> end</li><li>end</li><li></li><li>s = MyServer.new 1234</li><li>s.start</li><li>s.join</li></ol>
Let’s implement the backend thingy. During my implementation I ran into a number of problems: I had a working example on my Linux-box there and after putting it on our development-system, which is a Solaris-driven T1000 from Sun I saw that from strange reason the implementation of sockets in Ruby seems not to work on Solaris, which is pretty annoying but in the end I’m happy it did not work with sockets. The next idea was to use just TCP with non-blocking connections to send packages from the ping-interface to the Live-monitor-component, but sadly Ruby on Solaris does sadly also not support non-blocking connections. The thing I’d stuck with was UDP. Good old UDP but I think it is pretty ok for this uncritical task. To send some message, you also have a pattern called UDPSocket which can be utilized to do this task.
<ol><li>require 'socket'</li><li>u = UDPSocket.new</li><li>u.bind( "127.0.0.1", 1357 )</li><li>message = u.recvfrom( 512 )[0]</li><li>puts message</li></ol>
<ol><li>require 'socket'</li><li>s = UDPSocket.new</li><li>s.connect( "localhost", 1357 )</li><li>s.send( "Hello world", 0 )</li><li>s.close</li></ol>
The next problem is to make sure all listening TCP-clients get notified. So we need to have something like an IO-heap, where we store all the existing IO-objects and iterate through them to notify everyone. So we modify the serve()-method as it follows:
- def serve( io )
io_heap << io</li><li> loop do; end</li><li>end</li></ol></pre> <p>But who sends the snippet to all the objects? We also overload the constructor of ourio_heap = []MyServerclass to start a notification thread which does the following tasks:<ul><li>Start the UDP-server</li> <li>Iterate to our heap of IO-objects to notify them all</li></ul></p> <h3>Example V, the complete component</h3> <pre><ol><li>require 'gserver'</li><li></li><li>class MyServer < GServer</li><li> def initialize( port, *args )</li><li>udp = Thread.fork do</li><li>udp_socket = UDPSocket.newudp_socket.bind( "localhost", 1357 )</li><li> loop do</li><li> payload =udp_socket.recvfrom( 512 )[0]- unless payload.empty?
io_heap.each do |io|</li><li> begin</li><li> io.puts payload</li><li> rescue Errno::EPIPE => error</li><li>io_heap.delete io- end
- end
- end
- end
- end
- super(port, *args)
- end
- def serve( io )
- @io_heap << io
- loop do; end
- end
- end
- server = MyServer.new( 1234, host=“localhost” )
- server.start
- server.join
Isn’t it really, really short?
Filed under Blogmonitor, Code, GServer, Ruby, TCP, Technology, UDP & no comments & no trackbacks
Für Interessierte: meine Artikel in der Philtrat kann man nun auch online nachlesen und nicht nur in Druckform.
[ Disclaimer: they forced me to use the Binnen-I ]
Filed under Me, Philtrat & two comments & no trackbacks
Wieso macht die Stereoanlage bei dEUS merkwürdige Probleme, bei Soundgarden nicht und wieso geht es in »Schön von hinten« von Stereo Total nur ums Verlassenwerden und nicht um Analsex. Fände zweiteres lustiger. Das ist sowieso eine Frage, die ich mir in letzter Zeit häufiger stelle. Also ich hätte bei Brecht, Adorno, Focault, Marx und den ganzen Spacken immer wieder Korrekturen. Wenn die mich mal gefragt hätten, wäre Marx vielleicht nicht so ein lausiger Schriftsteller geblieben. Fühle mich vom Weltgeist vernachlässigt. Deswegen auch mein Problem mit Stereo Total. Auch erschreckend, dass ich heute schon zum zweiten Mal festgestellt habe, dass das Foxi-Geschreibsel mich amüsiert. Dabei finde ich Blogger ja eigentlich komplett doof. Aber wo die Welt nicht ins Bild passt da … jaja, Luschen passen dann das Weltbild an. Ich nicht.
Filed under Me & nine comments & no trackbacks
Wer sich nicht dafür interessiert, was der erweiterte Freundeskreis Palästinas – also praktisch die gesammte deutsche Politik – derzeitig so alles »verurteilt«, »schlimm findet«, »anmahnt«, »kritisiert«, »deutlich sagt«, »zu Bedenken gibt«, etc. pp., der lese Letters from Rungholt (Archiv).
Filed under Israel, Politik & no comments & no trackbacks
Es gibt Dinge, die sind nur als »Ausflüsse« zu bezeichnen. Durchaus im körperlichen Sinne. Ebenso wie es Leute gibt, denen man anmerkt, dass sie ihre kompletten geistigen Möglichkeiten darauf verwenden, nicht zu sabbern, gibt es noch jene, die genau dieses Sabbern noch nicht einmal kontrollieren können, geschweige denn wollen.
Besondere Ausflüsse produzieren Deutsche meist dann, wenn es um Israel geht. Nur als tief sitzende Neurose zu deuten, ist dieser Antisemitismus des Moralisten in seinem Gestus ganz besonders ekelhaft. Beseelt von dem Wunsch, das »endlich einmal Schluss sei«. Zur Verdeutlichung einige Zitate:
Filed under Antisemitismus, Deutschland, Israel, Politik, Zentralrat der Juden & one comment & no trackbacks
During my daily work I often heard discussions about how to handle charset properly. What a server must provide to handle charsets correctly, which configuration for Apache is needed, what options must be set in php.ini to make PHP correctly working, which functions should be avoided when using PHP, which locales must be used and so on. So I want to give a short overview how to sail around common problems in a LAMP-setup.
CONFIG_NLS_UTF8 is set to y.
.UTF-8-suffix. For german feel free to choose de_DE.UTF-8. Make sure your glibc is provides this locales. To convert current names of files you can just use convmv. For a desktop you must also adjust the font and set a correct TTY-font but this could be ignored for a server which is just administrated via remote shell.
Content-Type-header. Take a look at the output of wget -S http://usrportage.de, my weblog, which is hosted on Schokokeks.org, a properly configured server (sure!):wget -S usrportage.de
—21:00:33— http://usrportage.de/ => `index.html’
Resolving usrportage.de… 87.106.4.7
Connecting to usrportage.de|87.106.4.7|:80… connected.
HTTP request sent, awaiting response… HTTP/1.1 200 OK Date: Thu, 13 Jul 2006 19:00:27 GMT Server: Apache X-Powered-By: PHP/5.1.4-pl0-gentoo with Hardening-Patch X-Blog: Serendipity Set-Cookie: PHPSESSID=9da2ded6522851ef8ddc3ebe7590b354; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache X-Serendipity-InterfaceLang: de X-FreeTag-Count: Array Connection: close Content-Type: text/html; charset=UTF-8
Length: unspecified [text/html] [ <=> ] 65,557 250.71K/s21:00:33 (250.19 KB/s) – `index.html’ saved [65557]
Content-Type: text/html; charset=UTF-8. (You can also the a bug in S9Y, which poorly casts an array, but anyway.) So your browser is notified, that it should send UTF-8 encoded data. That’s the whole secret. To configure Apache properly, make sure the directive AddDefaultCharset is set to UTF-8.$string = utf8_encode( $_POST[‘key’] );
SET NAMES utf8;By the way: have I ever mentioned you should ever use
mysql_real_escape_string() instead of mysql_escape_string()?
default_charset to UTF-8 and – anyway – don’t use functions from the ereg-family also they have an mb_-Prefix. They aren’t binary-safe, that’s all you need to know.iconv to correct those who are not.
htmlentities(), html_entity_decode() and htmlspecialchars() does not reflect PHPs default_charset-directive but assumes iso-8859-15 as the default charset, which is pretty annoying and should be considered as a bug, from my point of view. So you need to pass UTF-8 as the third parameter to the function to make sure it will work properly with Unicode.
Filed under Apache, Charset, Kernel, Linux, MySQL, PHP, Technology, www & no comments & no trackbacks
Ich wollte nur mal darauf hinweisen, dass der Deutschnationalist Manfred Rouhs nun einen publizistischen Gegenspieler bekommen hat. Ob Biedermanni beleidigt ist, wenn man ihn fragt, ob sein Nachname wirklich französisch ist?
Filed under Manfred Rouhs, Politik & no comments & no trackbacks
Filed under Fußball-Weltmeisterschaft, Ghana, John Pantsil. Israel flag, Zidane & eight comments & no trackbacks
Ab und an ist selbst in Bonn was los.
Filed under Bonn, Grand Hotel van Cleef, Kettcar, Me, Tomte & no comments & no trackbacks
Filed under Deutschland, Diskurs, Fußball, Kritische Theorie, Nationalismus, Politik, Popkultur, Progrom, Subjekt, Weltmeisterschaft & no comments & no trackbacks
»We really have nothing to talk about other than our conviction, that religion sucks.«
Brannon Braga
Source: Stefan Horning
Filed under Atheism, Politik, Religion & no comments & no trackbacks
Um dem sich anbahnenden Chaos in der Kontaktliste des Lieblingsclients wieder etwas Herr zu werden habe ich nach Gutdünken Leute entfernt, mit denen ich seit längerer Zeit nichts mehr zu tun hatte oder bei denen ich mich nicht mehr an die Ursache ihrer Existenz in meiner Kontaktliste erinnern konnte. Wenn Sie meinen sollten, Sie seien fälschlicherweise gelöscht worden, dann täuschen Sie sich mit sehr hoher Wahrscheinlichkeit. Falls doch, einfach nochmal hinzufügen. Wer bisher nicht drin stand aber schon immer in den Genuss des Kontakts zu mir kommen wollte, dem sei dies auch gestattet (Kontaktdaten).
Filed under Buddylist, Gajim, Jabber, Me & two comments & no trackbacks