So Proud of Myself

Wednesday 9. April, 2008

Today I finally managed to repair my A-Link RR24AP(c) adsl-modem. The problem was that the wireless side didn’t function at all because the boot environment of the modem was corrupted. The corruption was my fault as I accidentaly used a wrong power source which wasn’t powerful enough, all I could see was the lan-connection light flickering.

Few weeks ago I contacted A-link’s tech support and they told me to send the modem to their technicians, but I didn’t bother to that as the warranty period had ended quite some time ago.

The modem accepts ssh-connections for controlling it and a linux shell/toolset, busybox. Boot environment configuration can be accessed through /proc/ticfg/env -file. A quick look into it and some knowledge from RouterTech’s forums and the modem’s system log revealed that WLAN_EEPROM-values were missing. I don’t know exactly what these values are but I do know that without them the wireless doesn’t work.

I found a recovery software through the same forums but the program didn’t start. I crashed immediately. I was very disappointed as it was my only hope. As I knew that I needed those WLAN_EEPROM-settings so it came to my mind to take a look on that program with a hex editor (Notepad++ with hex editing plugin, in case you want to know…) and indeed there they were! Apparently it was a template of the eeprom-settings, but still I got my hopes up again!

I didn’t expect this template to work directly which was then confirmed when I tried it. Again the answer was found in RouterTech’s forums. Some other guy had the same problem of missing/corrupted WLAN_EEPROMs and some other guy told him that WLAN_EEPROM8-line contains a hardware specific id in REVERSE order (12 34 56 would become 56 34 12). Modifying that line did the trick! The WLAN-led lit up! I had restored the right WLAN_EEPROMs (WLAN_EEPROM0-WLAN_EEPROM14) and I had a working wireless access point. One problem, though, the modem though that the BSSID was 00:00:00:00:00:00 THAT IS NOT RIGHT! (and only my laptop’s Intel 3945 detected it, my buffalo usb-wlan stick didn’t see anything).

And to the Google we went… it turned out that WLAN_HWADDR0 should be set and contain the MAC-address of the wlan-system.

Now the modem is under testing and seems to run just fine.

(I don’t publish the WLAN_EEPROM-values here because I don’t know if  that would be legal)

Incomplete standards

Saturday 5. April, 2008

My friend does some C programming and many times he has im’ed me about his progress in his projects or other interesting results. This time he complained that his code doesn’t work the same way in Linux as it does in Windows. I’ll demonstrate the problem with the same code he demonstrated the problem to me:

#include <stdio.h>

int main(int argc, char *argv[]) {
int temp = 0;
printf(“%d %d “, temp++, temp++);
printf(“%d\n”, temp);
return 0;

What do you expect this little program to do? Does it print something? You’re right but what exactly does it print? well, that depends on what compiler it was compiled on…

WIth University’s Sparc-Solaris gcc-3.0.4 it print 0 1 2, with Ubuntu Feisty’s gcc-4.1.2 and lcc-win32 it will print 1 0 2 and actually lcc-win32 printed the same as did Cygwin’s gcc-4.4.3.

Googling for explanation ended up telling that this case is not defined in standard C so results may vary on every compiler.

I wonder why that hasn’t been defined… For a programmer it should be quite clear that this code should print 0 1 2 but I do understand that this might get bit controversial as you could expect it to print anything from 0 0 1, 0 0 2, and so on to 0 1 2.

(Ha! You might have expected me to write about my lack of morality and standards instead of this…)

After midnight, part 4: LaTeX

Tuesday 11. December, 2007

What has happened since the last blog entry? Well, I’m not sick anymore and I live on my own now (okay, it’s relative “on my own”).

Unlike the previous After midnight -posts, this isn’t actually about a programming language.

Do you know “Structured text processing” (Rakenteellinen tekstinkäsittely, in Finnish)? It was the fancier name for our university’s LaTeX-typesetting course. It’s like text processing, but not at all like it. Today everybody uses these “What You See, Is What You Get” software (M$ Word, OpenOffice.Org Writer), but no one has ever hear that you could type those documents with a TeX-system. Usage of LaTeX is quite a bit different from those wysiwyg-programs as you don’t see what you get until you have compiled the tex file into something more readable such as DVI- or PostScript-file.

Personally I’m impressed by the looks of the documents I have made so far.

If you want to try it out, you need a LaTeX-environment, see MikTex. Then you need the Ghostscript-software. You probably want GSView too. You can write tex-files with Notepad or any text editor, as those files are more or less pure ascii-text. If you really start using LaTeX, I suggest you to download TexMaker. It’s free (open source) LaTeX editor and available for Linux systems too or if you are using Linux, you can also try out Kile editor and if you are using Ubuntu, you can install all you need with “apt-get install kile”. Besides the editor, this should pull all required packages including LaTeX-system.

I suppose our text processing environment is now installed and working (well, you probably don’t know if it is working yet)

Open up you editor, so we can start writing our first LaTeX-document. It all begins with lines

Hello this is our very first \LaTeX-document.

Save it and if you are using Texmaker, there should be a button with text “LATEX”, push it. If your specified paths are correct (you can check them in settings), the latex-system now compiles our document into a dvi-file. The animal button next to LATEX-button opens up a dvi-file viewer and you should see your document there.

The commands given above first define the type of our document, which is “report” with font size 12pt. All options in [] are optional, where {} are required. Without required parameters the compilation will fail. You probably have noticed that all Latex commands begins with \. The \begin{document} defines a document environment and \end{document} will end it. Everything you write and want it to be seen in the final document must be written inside the document environment.

For more information on LaTeX resides in the “doc”-folder inside your miktex installation (if documentation was installed). There’s also a folder named ‘guide’ or ‘guides’ in which resides a tutorial to LaTeX-system. You can also find a lot of information on latex with the help of Google.

(I can’t write a complete tutorial here as this is only a blog posting nor could I do it anyway as I’m not very familiar with LaTeX by myself. If you find these instructions too complicated to understand, leave a comment and I’ll try to help)

Hello? Are you still standing there?

Sunday 25. November, 2007


Who can guess where that line is taken from? Here’s a hint: It’s a computer game and it’s name starts with P.

Apparently I have got a new obsession related to that game. I hope it’s nothing serious, though. I still want a big blue tower.

On the other news, it seems there’s something wrong somewhere as my laptop’s hard drive seem to be under massive use in both Fedora and Ubuntu. I have no idea what’s going on there, the system just uses hard drive. I suppose it’s somehow related to swapping, but it didn’t do that in previous versions of Ubuntu. Also, when ever it’s updating/installing/removing packages (aka using the hd) the whole system goes nearly unusable state. It’s not nice at all.  I already downloaded a Vector Linux installation cd image as they say it’s a lightweight distribution, but if the problem lies some where in the hardware changing distro won’t help.

I don’t remember having this sort of problem in my personally built Prospekt Linux. In case I get tired of Vector too Prospekt is the next installation. Hmm… I should write some sort of installation program for it…

I had to do a practice work (in Java) to the programming course I mentioned in an earlier post. So far I have a working implementation of “program that calculates the age of a person in months and years. Current date is taken from the system.” I still have to do some testing, write API documentation using Javadoc and a small report containing the testing material, short instructions and stuff. (How much instructions users need for a program that asks their birthday?)

Last Friday the teacher did a small review on the current state of our projects. He told my program was great (I’m not really sure how to translate the adjective he used) and needed only testing. I was quite sure that wrong input format wouldn’t crash it, but he still managed to do it. Apparently I never tested what would happen if there’s some extra spaces before the actual birthday. It was quite easy to fix, though, and I’m somewhat proud of it. Now it “cleans” all extra space from the input string by utilizing Java’s StringTokenizer-class.

Yet another news: I’m sick. My throat hurts and I’ve got fever. Usually I’ve been sick around December 6th, but it came early this year, it seems. A quick check to my calendar shows that the 6th day is Thursday and we’ll have final test in Calculus III on Friday, so I guess my immune-system predicted the test and decided I must get sick this weekend instead so I can attend to the test. It also knew that getting sick next weekend would have compromised the final test in Fotonics or my possible moving to Joensuu.

After midnight, part 3: Java

Friday 5. October, 2007

As I took the Programming course at the University, I was faced with this beast. The course is about programming and how to program in Java. Even though I have never before even seen actual Java code, I’ve always been hating it. Some Java programs just seem to be so goddamn slow even if they don’t appear doing anything special (well, Azureus might have been the app in question, not sure about it).

Anyhow, here’s the Hello World in Java:

public class HelloThere {

public static void main(String args[]) {

System.out.println("Hello there!");



Save in a file with exactly the same name as the class + “.java” in this case “”. As you have installed Java Development Kit, or the SDK, (Java runtime is NOT enough), compile the java file with


This will create a corresponding class-file which is the bytecode version of the source code, and as far as I know, the closest form of a binary you can get with javac. And run it with

java HelloThere

Note: If you are using Linux environment you might not need Sun’s Java environments at all. Gnu Compiler Collection (GCC) contains a Java compiler (gcj), that can produce even native binary code. Be warned though, the gcj is compatible with 1.4-series, which means that newer features won’t be available such as the java.util.Scanner -class for reading user input in console applications.

Search the net and you should be able to find Java tutorials easily and among them a lot of posts on various forums telling you you shouldn’t use Java in the first place.