I just dist-upgraded to aptosid, sidux is gone.
As I am sure you are all aware, there have been interesting times for sidux recently. The bad news is that the sidux project is dead. The good news is that aptosid has been aptly born like a phoenix from the ashes and will provide a smooth upgrade for sidux systems. In many ways nothing has changed but our name.
Now, the official announce is released, I upgraded my system to aptosid.
First of all I created a
aptosid.list in my
After wards calling
aptitude update to reread the package listings. It notifies me that the new servers couldn’t be verified, I had to install the new keyring:
It’s time to upgrade:
That fails at the first time:
As you see,
/usr/sbin/update-grub wasn’t found. It is in
grub-pc , but I have no idea why there isn’t a dependency so that
grub-pc is installed by default!? Not fine but doesn’t matter, just install it:
If this is done, just reboot and join the new kernel version 2.6.35 (slh is the greatest!!).
Nothing new, I don’t like the twitter web interface. Neither to read, nor to write messages. So I developed some scripts to tweet from command line. These tools are still working, but not that comfortable as preferred.
Today I had a great thought. At Gajim I’m online at least 24/7, talking with people, getting news etc. So the comparison with twitter is obvious.
After some research how to connect to twitter and jabber I decided to implement the bot in Perl. I still worked a little bit with Net::Twitter, so one side of the connection is almost done. For the other side I used the module Net::Jabber::Bot to implement a bot listening for messages or commands and sending twitter news via IM to my jabber account. The call for the jabber bot looks like:
Most of it should be clear, the function
messageCheck is called when a new message arrives the bot’s jabber account. There I parse the text whether it starts with
! (then it’s a command) otherwise the bot schould take the message to update the twitter status.
updateCheck is the background function, it’s called when the bot idles. Here is time to check for news at twitter. It is called
The rest is merely a matter of form. News from twitter are jabber’ed, IM’s from the authorized user are twitter’ed. Cool, isn’t it!?
Just download the tool, create a new jabber account for the bot (you’ll get one for example from jabber.ccc.de) and update the
jmt.conf file with your credentials.
Of course you need the additional Perl modules, if you also experience various problems with Net::Jabber::Bot try to use the latest code from git://github.com/toddr/perl-net-jabber-bot.git.
The bot could simply be launched by running the Perl script. Send
!help to the bot to get some information about known commands.
Just start it at any server/PC that has a network connection.
What comes next? If anyone would provide a server I would like to implement a multiuser tool, maybe with database connectivity!?
I’m actually learning some stuff related to algorithms on sequences. The naive search for a pattern in a long string is of course very slow and comes with a lot of unintelligent compares. The Z-Algorithm improves the searching by preprocessing the pattern.
A simple search algorithm written in java may look like
This code reliably finds any existence of needle in haystack in , with length of needle and length of haystack. That screams for improvements ;)
The first algorithm that I want to present in this series is called Z-Algorithm. First of all we need some definitions.
Definition 1: In the following we denote as the substring of beginning at position and ending at position . We can also leave one of the limits clear, so that is the substring and means .
Definition 2: So is the length of the longest prefix of the suffix that is also prefix of itself. To abbreviate is further on mentioned as .
Definition 3: The set for a is called Z-Box at position .
Definition 4: is the set of limits of all Z-Box’es that start at the left-handed side of . Consider .
Definition 5: If and , defines the rightest Z-Box that starts before respectively at position . Consider .
In the following will denote the actual position we are looking for, and describe the current respectively last found of a Z-Box. First of all we set the values and to zero because we haven’t found any Z-Box yet. of our text is according to Definition 2 the length of the longest prefix of that is also prefix of itself. If we found a first Z-Box and update the limits to and .
Now we have to run through the word , so with defines the length of .
Case 1: Let’s assume position is outside of the last found Z-Box or we didn’t find any Z-Box yet (). We find by comparing the prefixes of and . If we’ve found a new Z-Box and need to update the limits to and .
Case 2: If the current position is inside of a current Z-Box () we try to find the equivalent position at the beginning of . The position we are searching for is steps off the beginning of (we are steps behind and has the same prefix as ). Case 2a: If we don’t break out of the current Z-Box by creating another Z-Box with the length of the box at position (, so position is not behind position ), we can simply apply this Z-Box to the current position and . Case 2b: Otherwise, if we would leave the actual Z-Box () we have to recheck the prefix conditions of and . We know that equals , so we only have to find the length of the longest prefix of that equals the prefix of . Now we can apply the new Z-Box such that and of course we update the Z-Box limits to and .
If we reached the end of all Z-Boxes are found in .
Let me demonstrate the algorithm with a small example. Let’s take the word . First we start with and at position 2. is the length of the shared prefix of () and (). Easy to see the prefix is with a length of 1. So , and . At the beginning of our for-loop the program’s status is:
At the first round in the loop , so because . So we meet case 1 and have to find the length of the prefix of () and (). Of course it’s zero, nothing to do.
Next round, we’re at position 4 and again (case 1). So we have to compare and . The longest prefix of both words is with a length of 2. So we start a new Z-Box at 4 with a size of 2, so and .
With and we reach case 2 for the first time. so our similar position at the beginning of is position 2. and so we are in case 2b and have to find the shared prefix of () and (). It’s , so and . and .
Next round brings us , therefor we’re in case 2. Equivalent position is again , but now and we’re in case 2a and can just set .
The last round we have to process is , case 2. Equivalent position is and , so case 2a and .
That’s it. The Z-Box’es we’ve found are visualized in the image.
To search for a pattern in a text just calculate the Z-Boxes of with . These calculations are done in . For any : If means is prefix of , so is found at position in .
Of course I’m providing an implementation, see attachment.
Such as telnet the SSH protocol also has a control character, it’s the tilde (~).
If you for example want to kill a hanging SSH session just type
~. . With
~^Z you can suspend a running session and get back to your local machine. To reactivate it just type
fg (yes, the SSH session is also just a job).
All supported escape sequences will be listed with
All sequences are of course only understood after a newline ;)
Although I have too much to do it’s in the nick of time to try some stuff with HTML5.
You should all have heard about HTML5, next generation of web ;) I still saw a lot of new features, some are still not supported in many browsers but all in all I’m looking forward.
Here I played a little bit with the canvas stuff and created a binary clock:
Wasn’t that difficult, just created an HTML element of type
canvas with enough space in it to draw the clock:
After wards just called
init (); , that calls
clock(); once a second to draw the clock. Please tell me whether it works in your browser ;)
I hope this new age of web will delete all the flash trash out there!