Thursday, May 21, 2009
Hi, my name is Felix...
One day when I came home from work, I heard a cat crying miserably. It sound to be very near when I went on the balcony, but the cat's location was not detectable. So we started searching on the attic, in the garden, we even replaced tiles from the roof as we thought the cat is maybe stucked under the roof. Finally we found him - stucked in the drainpipe of the cullis! Most probably he went over the cullis and fell into the hole where the drainpipe starts towards the ground and as the pipe is quite thin the cat pinned inside the pipe. So we dismantled the drainpipe in order to rescue the undercooled, wet, afraid cat. I suggest he was only 4 weeks old and no mother or brothers/sisters were in sight, so we decided to keep him :-) Say hello to my new lodger:
Tuesday, April 28, 2009
Modifying the S100
Hey out there,
I just bought a T-Online Vision S100. That's a media settop box for streaming movies over the internet directly to the TV. As the service was discontinued here in Germany, many of them are sold @ ebay for around 40€. Here are two pictures:

As you can see, it's quite stylish and gives enough possibilities to 'pimp' it. Some technical facts: Intel Celeron 733Mhz, 128MB Ram, Intel 830M for Graphics, USB, LAN, WLAN, Audio Analog/Digital, SVideo, Scart and also an infrared remote control. As there is no fan, it's runs completely silent.
So it's a perfect target to modify it to a personal mediabox, for watching movies, listen to music, surfing in the net or playing old games, all via TV. There are many fansites and tutorials about modding the S100, just use google.
The first thing I did is to tinker a custom cable for enabling the VGA output on the motherboard, similar to this one (picture is from here):

Attaching a monitor enables you to enter the Bios and disable booting Windows CE from the flash memory. You can either boot from usb or embed a harddisk (preferably a 2,5" notebook harddisk as they are more silent and require less power). I am going to choose the second option but therefore I have to modify the power supply and braze additional connectors. After that, an OS and some cool tools are installed, an LED for harddisk usage will be inserted and maybe the LED frontpanel will be removed, but let's see...
Here is picture of my home activity area:
I just bought a T-Online Vision S100. That's a media settop box for streaming movies over the internet directly to the TV. As the service was discontinued here in Germany, many of them are sold @ ebay for around 40€. Here are two pictures:

As you can see, it's quite stylish and gives enough possibilities to 'pimp' it. Some technical facts: Intel Celeron 733Mhz, 128MB Ram, Intel 830M for Graphics, USB, LAN, WLAN, Audio Analog/Digital, SVideo, Scart and also an infrared remote control. As there is no fan, it's runs completely silent.So it's a perfect target to modify it to a personal mediabox, for watching movies, listen to music, surfing in the net or playing old games, all via TV. There are many fansites and tutorials about modding the S100, just use google.
The first thing I did is to tinker a custom cable for enabling the VGA output on the motherboard, similar to this one (picture is from here):

Attaching a monitor enables you to enter the Bios and disable booting Windows CE from the flash memory. You can either boot from usb or embed a harddisk (preferably a 2,5" notebook harddisk as they are more silent and require less power). I am going to choose the second option but therefore I have to modify the power supply and braze additional connectors. After that, an OS and some cool tools are installed, an LED for harddisk usage will be inserted and maybe the LED frontpanel will be removed, but let's see...
Here is picture of my home activity area:
Sunday, April 19, 2009
What's currently going on..
So folks,
I had last week off as my company has closed for four days due to the financial/economical situation. I used this 'forced spare time' to go on holiday - I went with my girlfriend to Vienna, Austria for some days. This was really nice - it's a really cool city with many, many places worth to visit, so we were the whole day on the move. Additionally we had awesome weather - look at this:
What else I have done in my spare time? Well, I must admit I began to play a video game which I came across in the net. It's a quite old one (dos game) which I own for about ten years but never fetched again from my rack because of lack of time and motivation. Then I saw the screenshots on the net and read that is has been drastically improved by hobby programmers which reversed the whole game and made it open source. Moreover it's now running under Windows (also under linux and mac, just for information!), I tried it again and nearly became addicted again. I'm talking about Transport Tycoon, more precisely Open Transport Tycoon - go and check it out (but you need the game data files from the original game). Here a screenshot:
What's about coding, reversing and your homepage you ask? Damn, a good question. Of course, it's not dead. I have just only little time... But I read about many topics I am interested in and some really cool ideas for projects in my head but everything is taking much time so new coding activities just progress slowly.
But I do my best :-) Let's see...
I had last week off as my company has closed for four days due to the financial/economical situation. I used this 'forced spare time' to go on holiday - I went with my girlfriend to Vienna, Austria for some days. This was really nice - it's a really cool city with many, many places worth to visit, so we were the whole day on the move. Additionally we had awesome weather - look at this:
What else I have done in my spare time? Well, I must admit I began to play a video game which I came across in the net. It's a quite old one (dos game) which I own for about ten years but never fetched again from my rack because of lack of time and motivation. Then I saw the screenshots on the net and read that is has been drastically improved by hobby programmers which reversed the whole game and made it open source. Moreover it's now running under Windows (also under linux and mac, just for information!), I tried it again and nearly became addicted again. I'm talking about Transport Tycoon, more precisely Open Transport Tycoon - go and check it out (but you need the game data files from the original game). Here a screenshot:
What's about coding, reversing and your homepage you ask? Damn, a good question. Of course, it's not dead. I have just only little time... But I read about many topics I am interested in and some really cool ideas for projects in my head but everything is taking much time so new coding activities just progress slowly.But I do my best :-) Let's see...
Thursday, February 26, 2009
Some personal news
So folks,
finally a new post :-) Just to tell that I'm still there and some things have changed in my life...
I have successfully completed my study at University of Karlsruhe and received my diploma in computer science. My diploma thesis about H.264 video coding finished very well and I'm quite proud of it, likewise my mentor and professor so I expect a very good grade :-)
After this, I moved away from Karlsruhe and now live together with my girlfriend in our own flat. That's why I had no internet access for more than one month and was not able to update my blog. Since beginning of February, I am working as a software engineer at Robert Bosch Gmbh in the sector of automotive control units, more precisely called DCU (Domain Control Unit). Everything is quite new so I am excited how things will go on - hopefully fine and successfully.
But yeah, only less time is available for spare time compared to be a student, so I have nearly no time for my personal coding and my website ;-( But no fear, this will change and I will somewhen resume to please the world with my code snippets ;-)
So then, stay tuned!
finally a new post :-) Just to tell that I'm still there and some things have changed in my life...
I have successfully completed my study at University of Karlsruhe and received my diploma in computer science. My diploma thesis about H.264 video coding finished very well and I'm quite proud of it, likewise my mentor and professor so I expect a very good grade :-)
After this, I moved away from Karlsruhe and now live together with my girlfriend in our own flat. That's why I had no internet access for more than one month and was not able to update my blog. Since beginning of February, I am working as a software engineer at Robert Bosch Gmbh in the sector of automotive control units, more precisely called DCU (Domain Control Unit). Everything is quite new so I am excited how things will go on - hopefully fine and successfully.
But yeah, only less time is available for spare time compared to be a student, so I have nearly no time for my personal coding and my website ;-( But no fear, this will change and I will somewhen resume to please the world with my code snippets ;-)
So then, stay tuned!
Thursday, October 30, 2008
Accessing Webcam & pre-process frame
One evening I asked myself how to access my laptop webcam (a noname 1.3MP cam integrated into my HP Pavillon dv6XXX) by code. As I faced a little problem with this, I want to share my experience with you.
A look at msdn/internet revealed the Windows Capture Functions, all starting with the prefix cap. Creating the capture window, connecting to the driver, scaling, enabling preview - all very easy as these are just simple function calls. Cause I wanted to preprocess the frame (in order to implement some algorithms to make nice effects - which is not done yet and will take some more time...) I engaged a frame callback function without problem.
But then a little obstacle occured: how is the frame data stored? Using capGetVideoFormat, I accessed the bitmapinfoheader structure and checked the biBitCount member - 16 Bits. Ok - nice - and started coding immediuately which turned out to be a mistake!
The color members were not stored as specified in the msdn library: least significant five bits blue, followed by five bits each for green and red and the most significant bit is unused.
At first I thought I introduced a bug on my bit operations to extract these bits - but no, works perfectly.
Ok, no big deal - as I wished the data to be 24bit RGB, I wanted to use capSetVideoFormat to change the captued video data to this format. But of course this solution would have been too easy - this function always returned FALSE meaning my webcam driver does not like another format :-(
So what was the problem?
While tracing the program I saw the bitmapheader structure values in the debugging window inside visual studio and the biCompression member caught my eyes: 844715353. Hm such a value is not predefined as e.g. BI_RGB etc. I converted this number to hex = 0x32595559 and searched the internet to find out that this is the fourcc of YUY2! Another search brought my to the great website FourCC.org where this format (and many others) is explained:
a simple 4:2:2 YUV format with byte order Y1 U Y2 V. With this info it's of course easy to preprocess each frame of my webcam as I want.
Of course a better BitmapInfoHeader Page at msdn would have saved me a lot of time... Although interestingly a few days later I found this page at msdn where I found exactly my required information - but just too late.
I hope this will help someone facing the same problem while accessing a webcam!
A look at msdn/internet revealed the Windows Capture Functions, all starting with the prefix cap. Creating the capture window, connecting to the driver, scaling, enabling preview - all very easy as these are just simple function calls. Cause I wanted to preprocess the frame (in order to implement some algorithms to make nice effects - which is not done yet and will take some more time...) I engaged a frame callback function without problem.
But then a little obstacle occured: how is the frame data stored? Using capGetVideoFormat, I accessed the bitmapinfoheader structure and checked the biBitCount member - 16 Bits. Ok - nice - and started coding immediuately which turned out to be a mistake!
The color members were not stored as specified in the msdn library: least significant five bits blue, followed by five bits each for green and red and the most significant bit is unused.
At first I thought I introduced a bug on my bit operations to extract these bits - but no, works perfectly.
Ok, no big deal - as I wished the data to be 24bit RGB, I wanted to use capSetVideoFormat to change the captued video data to this format. But of course this solution would have been too easy - this function always returned FALSE meaning my webcam driver does not like another format :-(
So what was the problem?
While tracing the program I saw the bitmapheader structure values in the debugging window inside visual studio and the biCompression member caught my eyes: 844715353. Hm such a value is not predefined as e.g. BI_RGB etc. I converted this number to hex = 0x32595559 and searched the internet to find out that this is the fourcc of YUY2! Another search brought my to the great website FourCC.org where this format (and many others) is explained:
a simple 4:2:2 YUV format with byte order Y1 U Y2 V. With this info it's of course easy to preprocess each frame of my webcam as I want.
Of course a better BitmapInfoHeader Page at msdn would have saved me a lot of time... Although interestingly a few days later I found this page at msdn where I found exactly my required information - but just too late.
I hope this will help someone facing the same problem while accessing a webcam!
Wednesday, September 17, 2008
A bug hard to find...
During the last evenings, I have been coding a little tool to convert Avi files to 4:2:0 Yuv files. I just wanted it to have more videos to test with my H.264 encoder I work with in my diploma thesis. Well, it was no big deal programming it, just diving into the Video for Windows Api on MSDN to get familar with its interface so it didn't take long till I finished it. It's a console application and I always tested inside Visual Studio, passing the commandline parameters in the project settings. So everything worked fine till I tested it inside a cmd window outside Visual Studio. The converting loop was successful but it freezed after printing "Done!". Looking at the code I was surprised cause that printf("Done!\n") is the very last command!
That's the pseudocode:
for all frames
pData = (BYTE*)AVIStreamGetFrame(pFrame, i-1);
CreateYuvfromFrame(pData);
CloseAviFunctions();
printf("Done\n");
return;
Inside Visual Studio, I found at first no hint what was wrong, even tracing it showed no problem. Than I noticed that it does not freeze when the for-loop is not entered. Again reading in msdn, more specific AviStreamGetFrame, I read following:
Remarks:
The returned frame is valid only until the next call to this function or the AVIStreamGetFrameClose function.
Then I suddenly noticed, I called every necessary Avi-release and Avi-close function except the AviStreamGetFrameClose one. Inserting it just before my program ends and the bug was gone... and I was happy!
So what we learn from this: when using the Video for Windows Api, make sure to call the corresponding close-function for every Avifunction you use, although MSDN does not explicitly state that you have to before your program finishes!
But the open question remains: how to find this bug in a structured straightforward way? Normal debugging did not help and I was not willing the spend all my time to debug internal system calls within Ollydbg.
So if you know a way or you have just a suggestion, feel free to tell it me!
That's the pseudocode:
for all frames
pData = (BYTE*)AVIStreamGetFrame(pFrame, i-1);
CreateYuvfromFrame(pData);
CloseAviFunctions();
printf("Done\n");
return;
Inside Visual Studio, I found at first no hint what was wrong, even tracing it showed no problem. Than I noticed that it does not freeze when the for-loop is not entered. Again reading in msdn, more specific AviStreamGetFrame, I read following:
Remarks:
The returned frame is valid only until the next call to this function or the AVIStreamGetFrameClose function.
Then I suddenly noticed, I called every necessary Avi-release and Avi-close function except the AviStreamGetFrameClose one. Inserting it just before my program ends and the bug was gone... and I was happy!
So what we learn from this: when using the Video for Windows Api, make sure to call the corresponding close-function for every Avifunction you use, although MSDN does not explicitly state that you have to before your program finishes!
But the open question remains: how to find this bug in a structured straightforward way? Normal debugging did not help and I was not willing the spend all my time to debug internal system calls within Ollydbg.
So if you know a way or you have just a suggestion, feel free to tell it me!
Friday, September 05, 2008
Still there
Hi,
currently I'm very busy with my diploma thesis - I just finished a big part concerning mode decision inside the encoder, now I have to implement some algortihms in VHDL and after that I will start with the actual Rate Controller. Things are getting more complicated and I also have to read some papers and books to build a mathematical theoretical background for my model. Well, nearly half of the time is already gone, so only 3 months left = stress.
That's why there is also no real update on my website. Ok I improved my layout as you can see which took already some time - did I ever mentioned that I'm no friend of html/css/all other web scripting languages - they just look ugly compared to a real programming language!
But I have already two cool tools coded concerning planar 4:2:0 yuv-files which just need some commenting and bugfixing before going to be available on my site - so stay tuned.
(Caution: Advertisment) I came across two cool free downloads - maybe you are also interested:
First of all, google published their own browser chrome for free download. My first impression is pretty positive - it's fast, small and easy to use - most of the screen is used for the displayed website, there is no over-blown gui with thousands of menus and statusbars. I like it but I stick to my lovely firefox - I am used to it and the bookmark bar is better and more comfortable to use in my opinion. But you should give chrome a try!
Second, after releasing Command & Conquer 1 as freeware, C&C - Red Alert is now also freely available as download. It's even better than part 1, in fact it is my all-time favourite realtime strategy game ever. I loved it. So go and download the iso images and start playing. For playing it under Windows XP/Vista, choose compatibility mode 'Windows 95' for both, the setup exe file and game exe file, and install also the provided patch - then you have no trouble.
currently I'm very busy with my diploma thesis - I just finished a big part concerning mode decision inside the encoder, now I have to implement some algortihms in VHDL and after that I will start with the actual Rate Controller. Things are getting more complicated and I also have to read some papers and books to build a mathematical theoretical background for my model. Well, nearly half of the time is already gone, so only 3 months left = stress.
That's why there is also no real update on my website. Ok I improved my layout as you can see which took already some time - did I ever mentioned that I'm no friend of html/css/all other web scripting languages - they just look ugly compared to a real programming language!
But I have already two cool tools coded concerning planar 4:2:0 yuv-files which just need some commenting and bugfixing before going to be available on my site - so stay tuned.
(Caution: Advertisment) I came across two cool free downloads - maybe you are also interested:
First of all, google published their own browser chrome for free download. My first impression is pretty positive - it's fast, small and easy to use - most of the screen is used for the displayed website, there is no over-blown gui with thousands of menus and statusbars. I like it but I stick to my lovely firefox - I am used to it and the bookmark bar is better and more comfortable to use in my opinion. But you should give chrome a try!
Second, after releasing Command & Conquer 1 as freeware, C&C - Red Alert is now also freely available as download. It's even better than part 1, in fact it is my all-time favourite realtime strategy game ever. I loved it. So go and download the iso images and start playing. For playing it under Windows XP/Vista, choose compatibility mode 'Windows 95' for both, the setup exe file and game exe file, and install also the provided patch - then you have no trouble.
Thursday, July 03, 2008
Online Calculator and Autocompletion
Finally my online calculator is published here: Online Calculator.
I was tired of using Windows Calculator for evaluating terms when I forget my hand calculator at home. And using other numeric bases like hexadecimal were not possible but I needed this functionality quite often. So I decided to code my own expression evaluator as a java applet and to put it on my homepage. Not bad, isn't it? Perhaps you find it also useful ;-)
It took quite some time at the beginning to get a working little parser engine. At first I wanted to do it the 'right way' -to build a complete parser tree in memory but very soon I noticed that this is too much for this little applet and also too time-consuming/complex to code. So I came up with a really simple but good working recursive parser. Then most of the work was already finished - just my ownerdraw resultlist took me some research on the internet to paint the listitems myself.
Originally I wanted also to implement an 'intellisense-like' autocompletion functionality for the textfield where you enter the term. But it turned out to be more difficult that I expect so I delayed it cause my online calculator has till now less than 15 commands so it's more fun than really necessary. But today I continued the fight and got it working - my main idea was not to extend a frame but just a JPopupMenu with some nice 'keylistener-action'. Till now it's not ownerdrawn and I don't know if I should really insert it into my online calculator. Let's see... but first here a little animation that it really works :-)
I was tired of using Windows Calculator for evaluating terms when I forget my hand calculator at home. And using other numeric bases like hexadecimal were not possible but I needed this functionality quite often. So I decided to code my own expression evaluator as a java applet and to put it on my homepage. Not bad, isn't it? Perhaps you find it also useful ;-)
It took quite some time at the beginning to get a working little parser engine. At first I wanted to do it the 'right way' -to build a complete parser tree in memory but very soon I noticed that this is too much for this little applet and also too time-consuming/complex to code. So I came up with a really simple but good working recursive parser. Then most of the work was already finished - just my ownerdraw resultlist took me some research on the internet to paint the listitems myself.
Originally I wanted also to implement an 'intellisense-like' autocompletion functionality for the textfield where you enter the term. But it turned out to be more difficult that I expect so I delayed it cause my online calculator has till now less than 15 commands so it's more fun than really necessary. But today I continued the fight and got it working - my main idea was not to extend a frame but just a JPopupMenu with some nice 'keylistener-action'. Till now it's not ownerdrawn and I don't know if I should really insert it into my online calculator. Let's see... but first here a little animation that it really works :-)
Thursday, June 26, 2008
Command & Conquer 1 for free!
Hi folks,
in a phase of nostalgia I viewed some videos on youtube of old pc-games I played when I was younger - and the first Command & Conquer part Tiberian Dawn was one of my favourite. Of course the dos version with just 320x200 pixels ;-) But it was the perfect real-time strategy game in those days. But I think everybody knows it so why talking much about it - you can play it now for free. In 2006 it was re-released in the 'The first decade' compilation pack - even the SVGA windows version including a patch to work under XP/Vista. Then in September 2007, EA released these iso images for free downloading on their servers. So what are you waiting for - go and get it!
in a phase of nostalgia I viewed some videos on youtube of old pc-games I played when I was younger - and the first Command & Conquer part Tiberian Dawn was one of my favourite. Of course the dos version with just 320x200 pixels ;-) But it was the perfect real-time strategy game in those days. But I think everybody knows it so why talking much about it - you can play it now for free. In 2006 it was re-released in the 'The first decade' compilation pack - even the SVGA windows version including a patch to work under XP/Vista. Then in September 2007, EA released these iso images for free downloading on their servers. So what are you waiting for - go and get it!
Wednesday, June 18, 2008
Firefox 3 is out!
The final reason of Firefox 3 is out and waiting to be downloaded. I have just installed it and I'm fully happy with it. Looks better, seems to be even more stable than version 2 and alone the new "AwesomeBar" makes it worth to get it. Since Firefox 0.8 it's the only browser I use and I'm really a fan of this (in my opinion) best existing browser. It has also broken a world record by being downloaded more than 7 million times in the first 24 hours!
Download Firefox
Firefox Worldrecord
Download Firefox
Firefox Worldrecord
Wednesday, June 11, 2008
Diploma Thesis
That's just a quick post to tell what I'm doing now. I found finally an interesting diploma thesis at which I have been working for the last two weeks already. It's official title is "Development of a Power-Aware Rate Controller for H.264 Video Encoder" and it's located at the Chair for Embedded Systems at University Karlsruhe. My mentor seems to be really nice and to be motivated to help me completing my work successfully. I have 6 months to finish it and hopefully this length of time is enough. I was surprised how complex this H.264 Encoding Standard is and how many complicated steps needs to be accomplished to encode a video with good quality and less need for memory. I have read two complete books and several papers during the last weeks and also dived in the C Code of the standard implementation of this encoder but understanding the rate controller process/steps seems to be really hard. I think this will last but let's see...
The good thing is that when I come home I can watch football the whole evening :-) Or I go to a place with public viewing when the German football team plays. The European Soccer Championship is really exciting and I'm curious what will happen... :-)
The good thing is that when I come home I can watch football the whole evening :-) Or I go to a place with public viewing when the German football team plays. The European Soccer Championship is really exciting and I'm curious what will happen... :-)
Saturday, April 26, 2008
Last oral exam done!
Hi everybody,
after 8 weeks of learning and diving into the secrets of nets, pointclouds, bezier and bspline curves, triangulations, many graphical algorithms and much more, I had yesterday my last oral exam - in computer graphics. It went perfectly :-) Fortunately I was very well prepared. My study thesis is also finished so I'm looking currently for an interesting diploma thesis. But now I make holidays for two weeks - very nice cause the summer slowly begins now here in Germany and the weather is great!
So perhaps I'll find some time for coding - have already two things in mind that I'm wanna code, but let's see.
Well, over the last years my interest in computer games constantly decreased. But when I played something (very seldom) then it was of course Trackmania Nations. I did already mentioned it on my site when this game was released two years ago - completely for free! It an really nice, good looking, challanging racing game which you can also play over the net against others. And now, finally, the next part was released - Trackmania Nations Forever - again for free! So if you like racing games, be sure to check it out! Best thing is to check out following very good site - there you find everything you need:
http://tmnforever.tm-exchange.com/
So have fun!
Sunshine
after 8 weeks of learning and diving into the secrets of nets, pointclouds, bezier and bspline curves, triangulations, many graphical algorithms and much more, I had yesterday my last oral exam - in computer graphics. It went perfectly :-) Fortunately I was very well prepared. My study thesis is also finished so I'm looking currently for an interesting diploma thesis. But now I make holidays for two weeks - very nice cause the summer slowly begins now here in Germany and the weather is great!
So perhaps I'll find some time for coding - have already two things in mind that I'm wanna code, but let's see.
Well, over the last years my interest in computer games constantly decreased. But when I played something (very seldom) then it was of course Trackmania Nations. I did already mentioned it on my site when this game was released two years ago - completely for free! It an really nice, good looking, challanging racing game which you can also play over the net against others. And now, finally, the next part was released - Trackmania Nations Forever - again for free! So if you like racing games, be sure to check it out! Best thing is to check out following very good site - there you find everything you need:
http://tmnforever.tm-exchange.com/
So have fun!
Sunshine
Thursday, March 06, 2008
Maximum subvector problem
So folks,
again a life sign from me. Again I'm busy... Currently I'm writing the paper of my study thesis. This needs more time than I thought but fortunately my monitoring unit works on the fpga. On the side I started to learn for my last oral exam - in computer graphics. That means hard-core diving into bézier and b-spline curves, also in point clouds. That's gonna be difficult and time-consuming.
Nevertheless while surfing, I came across a paper about the so-called maximum subvector problem. I even think that I really had this problem some years ago while coding. Although it's quite simple it's somehow cool to think about solving it. So what it is about?
given : an array[1...n] of (positive and negativ) numeric values
goal: to determine the maximum subvector a[i..j], 1 <= i <= j <= n whose sum of elements is maximum over all subvectors. Well, not that big thing at first - just calculate all possible subvectors and save the maximum one. The straightforward approach could be look like this: MaxSoFar := 0.0
for L := 1 to N do
  for U := L to N do
    Sum := 0.0
    for I := L to U do
      Sum : = Sum + X[I]
      /* Sum now contains the sum of X[L..U] */
      MaxSoFar := max(MaxSoFar, Sum)
This works of course but for even quite small array sizes (e.g. 1000 elements) this lasts quite long. The execution time is proportional to O(n^3)!
This just be motivation enough to search for some better algorithm. Well, after some thinking you might find a O(n^2) algorithm. There is even a divide-and-conquer approach which is in O(nlogn), but it's not that easy to code :-( Ok, nice, they are often hard to implement...
But in fact there is a simple algorithm that works in linear time! Yes, in O(n)! I must admit I had never expected it nor searched for it. And it is so simple!!!
Curious? Ok here it is:
MaxSoFar := 0.0
MaxEndingHere := 0.0
for I := 1 to N do
  MaxEndingHere := max(MaxEndingHere+X[I], 0.0)
  MaxSoFar := max(MaxSoFar, MaxEndingHere)
So if you found this blog entry interesting, then be sure to check out following article, it contains everything I've written here:
Bye
again a life sign from me. Again I'm busy... Currently I'm writing the paper of my study thesis. This needs more time than I thought but fortunately my monitoring unit works on the fpga. On the side I started to learn for my last oral exam - in computer graphics. That means hard-core diving into bézier and b-spline curves, also in point clouds. That's gonna be difficult and time-consuming.
Nevertheless while surfing, I came across a paper about the so-called maximum subvector problem. I even think that I really had this problem some years ago while coding. Although it's quite simple it's somehow cool to think about solving it. So what it is about?
given : an array[1...n] of (positive and negativ) numeric values
goal: to determine the maximum subvector a[i..j], 1 <= i <= j <= n whose sum of elements is maximum over all subvectors. Well, not that big thing at first - just calculate all possible subvectors and save the maximum one. The straightforward approach could be look like this: MaxSoFar := 0.0
for L := 1 to N do
  for U := L to N do
    Sum := 0.0
    for I := L to U do
      Sum : = Sum + X[I]
      /* Sum now contains the sum of X[L..U] */
      MaxSoFar := max(MaxSoFar, Sum)
This works of course but for even quite small array sizes (e.g. 1000 elements) this lasts quite long. The execution time is proportional to O(n^3)!
This just be motivation enough to search for some better algorithm. Well, after some thinking you might find a O(n^2) algorithm. There is even a divide-and-conquer approach which is in O(nlogn), but it's not that easy to code :-( Ok, nice, they are often hard to implement...
But in fact there is a simple algorithm that works in linear time! Yes, in O(n)! I must admit I had never expected it nor searched for it. And it is so simple!!!
Curious? Ok here it is:
MaxSoFar := 0.0
MaxEndingHere := 0.0
for I := 1 to N do
  MaxEndingHere := max(MaxEndingHere+X[I], 0.0)
  MaxSoFar := max(MaxSoFar, MaxEndingHere)
So if you found this blog entry interesting, then be sure to check out following article, it contains everything I've written here:
Bye
Tuesday, January 29, 2008
Hope dies last
So, January is nearly over and that's just my first post.
As always, much work to do :-( My study thesis does progress quite slowly unfortunately. The problems are pretty resistent against my tries to solve them ;-)
I managed it that my log entries can be sent from the htx-board to main memory. Therefore I use a linux device driver to allocate a buffer in main memory and send its physical (not virtual, that's why a driver is needed) address to the board. So when my associative memory on the board is full, they are written to this buffer and I can read them with my user-level test application. Of course, some little bugs are still there (not surprisingly, isn't it). Write requests are not correctly logged in contrast to read requests and I f***ing don't find the reason. But I still hope that I can finish it in near future.
I'm slightly sad that I have so little time for my website and coding. I had begun to code my own burrows-wheeler-transformation in the last week of december, but just one day wasn't enough to get it working. The reverse transformation is quite difficult to implement it efficiently - the way I learned to do it by hand is not a good way to implement it. Perhaps when this term is over, I have some spare time and enough motivation to complete it.
Till then, keep cool,
greetz Sunshine
As always, much work to do :-( My study thesis does progress quite slowly unfortunately. The problems are pretty resistent against my tries to solve them ;-)
I managed it that my log entries can be sent from the htx-board to main memory. Therefore I use a linux device driver to allocate a buffer in main memory and send its physical (not virtual, that's why a driver is needed) address to the board. So when my associative memory on the board is full, they are written to this buffer and I can read them with my user-level test application. Of course, some little bugs are still there (not surprisingly, isn't it). Write requests are not correctly logged in contrast to read requests and I f***ing don't find the reason. But I still hope that I can finish it in near future.
I'm slightly sad that I have so little time for my website and coding. I had begun to code my own burrows-wheeler-transformation in the last week of december, but just one day wasn't enough to get it working. The reverse transformation is quite difficult to implement it efficiently - the way I learned to do it by hand is not a good way to implement it. Perhaps when this term is over, I have some spare time and enough motivation to complete it.
Till then, keep cool,
greetz Sunshine
Thursday, December 20, 2007
No time for anything....
So folks,
pretty long no update, I know. But this term is quite stressful - my Informatics I Tutorial needs some time for correcting the exercise sheets, for preparation the material and holding the tutorial and the computer execercise lessons. Then I attend some lectures, all of them about computer graphics. Some of them are quite difficult to follow cause of the complicated mathematics involved. And last but not least the most time-consuming thing in the last time: my study thesis. I did not even managed it to update the study page on my homepage with information about it.
Well I'm working with a Xilinx Fpga Board Virtex4 Fx-100 where a Hypertransport Core is running on (I got it working). My task is to extend the core with a monitoring feature - till now I managed it to log the write and read accesses in an associative memory. But now I have to write these information to the main memory using DMA - and this does not work (damn!). Either the linux kernel panics or the computer just hangs up. I really don't know how to achieve the right behaviour, this drives my crazy. I have no simulator, there is no possibility to 'debug' it and synthesizing my design with ISE and upload it to the board takes every time more than 45min. This is definitely no fun! As soon as I get it working, I will post more detailed information about my study thesis.
Anyhow, I got round to code and publish a nice applet demonstrating the Cohen-Sutherland-Algorithm last week. And guess what? The implementation of the Sutherland-Hodgman-Algorithm is nearly finished and waits to be uploaded on my page :-)
But for now, Christmas is coming soon, I still have to organize some presents and I'm looking forward to some relaxing days. So I wish you all a merry christmas and a happy new year!!!
Greetz Sunshine
pretty long no update, I know. But this term is quite stressful - my Informatics I Tutorial needs some time for correcting the exercise sheets, for preparation the material and holding the tutorial and the computer execercise lessons. Then I attend some lectures, all of them about computer graphics. Some of them are quite difficult to follow cause of the complicated mathematics involved. And last but not least the most time-consuming thing in the last time: my study thesis. I did not even managed it to update the study page on my homepage with information about it.
Well I'm working with a Xilinx Fpga Board Virtex4 Fx-100 where a Hypertransport Core is running on (I got it working). My task is to extend the core with a monitoring feature - till now I managed it to log the write and read accesses in an associative memory. But now I have to write these information to the main memory using DMA - and this does not work (damn!). Either the linux kernel panics or the computer just hangs up. I really don't know how to achieve the right behaviour, this drives my crazy. I have no simulator, there is no possibility to 'debug' it and synthesizing my design with ISE and upload it to the board takes every time more than 45min. This is definitely no fun! As soon as I get it working, I will post more detailed information about my study thesis.
Anyhow, I got round to code and publish a nice applet demonstrating the Cohen-Sutherland-Algorithm last week. And guess what? The implementation of the Sutherland-Hodgman-Algorithm is nearly finished and waits to be uploaded on my page :-)
But for now, Christmas is coming soon, I still have to organize some presents and I'm looking forward to some relaxing days. So I wish you all a merry christmas and a happy new year!!!
Greetz Sunshine
Friday, October 26, 2007
My hook doesn't work :-(
A few days ago I rummaged through my old code snippets and sources on my harddisk. I noticed that I coded quite many PE tools, especially with Delphi, but something I have never created - an Api hook!
I read pretty much about it (there are many code snippets in the net about this), but most of them are complicated and badly commented so that it's difficult to undertstand what's going on. So I tried myself and began coding the most simple and clean api hook possible (in c cause it's better to read than asm): a little Messagebox hook which should alter the caption of all messageboxes.
Ok I thought, the most simple approach is to code a loader which starts a target process and loads my selfcoded 'hook dll file' into the address space with the well-known CreateRemoteThread trick. Inside the dll file is all the work: as soon as injected and attached, it travels through the import table of the process, searches for MessageBoxA API from user32.dll and replaces the RVA (called Thunk) with the RVA of my own function I declared in my dll file. Hm... sounds not bad although I know that this works just with exes with a straightforward import table - even loading the MessageBox API with GetProcAddress would bypass my approach. But that's not bad - if it would work.... Damn!
With some targets it works, but in others it corrups the stack!? That's a bit strange to me - either it should work always or never. Of course, I took special care about the arguments and the stack. And debugging with olly is quite boring and not that easy... I think I give up and I put up with the fact that I'm never gonna code a nice Api hook :-(
Moreover, studies suck also -> 'thank god it's friday' and I will relax the whole weekend!
I read pretty much about it (there are many code snippets in the net about this), but most of them are complicated and badly commented so that it's difficult to undertstand what's going on. So I tried myself and began coding the most simple and clean api hook possible (in c cause it's better to read than asm): a little Messagebox hook which should alter the caption of all messageboxes.
Ok I thought, the most simple approach is to code a loader which starts a target process and loads my selfcoded 'hook dll file' into the address space with the well-known CreateRemoteThread trick. Inside the dll file is all the work: as soon as injected and attached, it travels through the import table of the process, searches for MessageBoxA API from user32.dll and replaces the RVA (called Thunk) with the RVA of my own function I declared in my dll file. Hm... sounds not bad although I know that this works just with exes with a straightforward import table - even loading the MessageBox API with GetProcAddress would bypass my approach. But that's not bad - if it would work.... Damn!
With some targets it works, but in others it corrups the stack!? That's a bit strange to me - either it should work always or never. Of course, I took special care about the arguments and the stack. And debugging with olly is quite boring and not that easy... I think I give up and I put up with the fact that I'm never gonna code a nice Api hook :-(
Moreover, studies suck also -> 'thank god it's friday' and I will relax the whole weekend!
Friday, October 05, 2007
Skyscraper Solver
So folks,
I removed the last bugs and cleaned up the code faster than I thought - so my Skyscraper solver waits to be downloaded from my site :-)
But unfortunately it is pretty timeconsuming to check if a solution is valid so it's quite slower than I thought! For example to go through all possibilities in a 6x6 quest with my backtracking algorithm can take several minutes in the worst case - even on my new laptop! That's bad - but I don't see many places for optimization which would really speed it up.
Of course this makes me thinking about another approach: it is possible and worth the time to solve it with Dancing Links like a Sudoku quest? Well, in fact I don't know and I didn't (and won't) try it. That's not an exercise which could be easily solved in a few hours in my opinion! But if anybody will do it and succeed, mail me please! I would be very interested in it.
So far so good. It's Friday afternoon, I have already done everything I had to do - it's time to relax and waiting for the weekend to begin :-)
Greetz, Sunshine
I removed the last bugs and cleaned up the code faster than I thought - so my Skyscraper solver waits to be downloaded from my site :-)
But unfortunately it is pretty timeconsuming to check if a solution is valid so it's quite slower than I thought! For example to go through all possibilities in a 6x6 quest with my backtracking algorithm can take several minutes in the worst case - even on my new laptop! That's bad - but I don't see many places for optimization which would really speed it up.
Of course this makes me thinking about another approach: it is possible and worth the time to solve it with Dancing Links like a Sudoku quest? Well, in fact I don't know and I didn't (and won't) try it. That's not an exercise which could be easily solved in a few hours in my opinion! But if anybody will do it and succeed, mail me please! I would be very interested in it.
So far so good. It's Friday afternoon, I have already done everything I had to do - it's time to relax and waiting for the weekend to begin :-)
Greetz, Sunshine
Monday, October 01, 2007
Again I'm coding...
Hey folks,
well at the moment I have some free time. No exams, the lectures are going to start not until middle of October and there are some problems with my study thesis. I cannot begin cause the HTX-Board (a special board to study the hypertransport bus) is not working properly, so this week seems to be idle too.
But not that bad. I came across a little game similar to sudoku and I decided to code a nice applet to play it. And of course even more: also a solver which gives all solutions to a quest (which is even finished and fully working) and a generator to create new games which has only one valid solution. This in fact is pretty more difficult to code - till now it takes in some cases nearly one minute to generate a quest which is sometimes not even solvable! Ok this tool I hacked in really short time without thinking about a clever algorithm so this is something I have to recode I think. The applet coding comes slowly to an end, here a screenshot from its current state:
As you see, I coded also some kind of lame visualization of the currently game. Well, that's not important for the game. It's more my first try of coding a simple wireframe 3D software rendering engine! Not that easy to code - you find only little information about camera and screen projection, but I succeeded :-) Let's see if I will also implement solid filled polygons...
So keep cool, I'm going to proceed with coding!
Cya
well at the moment I have some free time. No exams, the lectures are going to start not until middle of October and there are some problems with my study thesis. I cannot begin cause the HTX-Board (a special board to study the hypertransport bus) is not working properly, so this week seems to be idle too.
But not that bad. I came across a little game similar to sudoku and I decided to code a nice applet to play it. And of course even more: also a solver which gives all solutions to a quest (which is even finished and fully working) and a generator to create new games which has only one valid solution. This in fact is pretty more difficult to code - till now it takes in some cases nearly one minute to generate a quest which is sometimes not even solvable! Ok this tool I hacked in really short time without thinking about a clever algorithm so this is something I have to recode I think. The applet coding comes slowly to an end, here a screenshot from its current state:
So keep cool, I'm going to proceed with coding!
Cya
Tuesday, September 18, 2007
Disabling HP Quickplay buttons
As I wrote some weeks ago, I got a new laptop - a HP Pavillon dv6XXX. Well, everything works and I have no problems so I'm quite satisfied... but one thing really nerves me . There are some so-called quickplay buttons above the normal keyboard, look here:

The problem is that I often accidentally push it. Well, push it is too much, let's say smoothly touch it. This often occurs while coding and I push F5, F8 etc. to compile, build or test something. Then every time it the dvd programm slowly starts and I have to close it down. If this happens a few times, it really pisses me off so I tried to disable them.
Looking at the taskmanager, I noticed some HP programms running. Interesting sounded QPService.exe ("HP QuickPlay Resident Program") and Qlbctrl.exe ("HP Quick Launch Buttons"). But killing these two processes didn't helped.
The only way to solve our problem is to avoid even loading them, so we have to delete the registry keys in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.
Be sure to make an backup of these keys to be able to re-enable it later! Here you have my 2 reg files: the first one disables QuickPlay by deleting the regkeys while the other one enables it by adding the regkeys.
I think that will be useful for some other nerved HP laptop users :-)
Use at your own risk! If they don't work and damage your system, don't blame me.
The problem is that I often accidentally push it. Well, push it is too much, let's say smoothly touch it. This often occurs while coding and I push F5, F8 etc. to compile, build or test something. Then every time it the dvd programm slowly starts and I have to close it down. If this happens a few times, it really pisses me off so I tried to disable them.
Looking at the taskmanager, I noticed some HP programms running. Interesting sounded QPService.exe ("HP QuickPlay Resident Program") and Qlbctrl.exe ("HP Quick Launch Buttons"). But killing these two processes didn't helped.
The only way to solve our problem is to avoid even loading them, so we have to delete the registry keys in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.
Be sure to make an backup of these keys to be able to re-enable it later! Here you have my 2 reg files: the first one disables QuickPlay by deleting the regkeys while the other one enables it by adding the regkeys.
I think that will be useful for some other nerved HP laptop users :-)
Use at your own risk! If they don't work and damage your system, don't blame me.
--- Download Reg Files ---
Update: It seems that I can't re-enable these buttons! So be careful - I don't take any responsibility.
Greetz, Sunshine
Wednesday, September 12, 2007
Holidays are over :-(
Hm, what a nice time I had in August - 4 weeks free! Three weeks relaxing at home, meeting with friends, shopping, going to parties, relaxing and sleeping... But everything has an end and real life comes back. Next week my last oral exam in my minor subject, then I am going to begin with my study thesis - it will be about examining/monitoring the hypertransport bus system. Let's see how it will be - I hope easy :-)
I noticed that I haven't done anything in reversing for a long time but somehow I currently don't feel motivated to do something concerning this topic. But I dived into bezier curves and coded some nice applets (look in the java section of my site). An applet about b-splines is already finished - some little bugs have to be killed. In a few days I'll release two short articles about polygons with a nice applet so stay tuned and keep coding!
I noticed that I haven't done anything in reversing for a long time but somehow I currently don't feel motivated to do something concerning this topic. But I dived into bezier curves and coded some nice applets (look in the java section of my site). An applet about b-splines is already finished - some little bugs have to be killed. In a few days I'll release two short articles about polygons with a nice applet so stay tuned and keep coding!
Subscribe to:
Posts (Atom)
