Older blog entries for shlomif (starting at number 17)

Linux Saves the Day

Dudu, Eran's friend, recently bought a new computer which came with Windows XP installed. Another friend of both Eran and Dudu installed Mandrake Linux 8.1 there, which I helped configure a bit after it was installed. A couple of days ago, Dudu called me by phone and informed me his Windows won't load (and he blamed it on the Linux). I told him I'll get to him and try to do whatever I can do to help.

After a long bus ride to the lower city of Haifa, I came to Dudu and checked the computer. The LILO was perfectly fine and indeed booted XP. XP even started to load some files, but then it yelled that something was wrong there. I had no idea how to fix it and Dudu did not have the CD, so I could not re-install it. What I did was mount the XP partition (an NTFS) one on the Linux and back up the important files on a different partition.

The next day Dudu re-installed Windows XP, which naturally run over the boot loader, which made it impossible to boot Linux. While using the phone, I instructed Dudu to insert the first Mandrake CD into the CD-ROM drive, set it as bootable. Then press F1 and quickly type "rescue" at the prompt and press enter. This brings the rescue image. It turned out that it automatically loaded the Linux partition on /mnt. Realizing that, I told Dudu to invoke the following command:

# chroot /mnt /sbin/lilo -c

Which is a trick I saw someone do in a Linux Insta-Party. This restored the LILO and Dudu told me he was then able to boot both Linux and WinXP again.

Note that I'm not entirely sure it's the Linux fault that XP got corrupt. Before I configured it, the Linux did not even mount the NTFS partition much less write to it. And XP is at the moment full of bugs. I advised Dudu to upgrade to Service Pack 1 as soon as it is available.

Safe X-Windows Locking in Run-Level 3

Runlevel 5 (when X runs automatically) considered harmful, because X-Windows can respond very delicately to hardware changes. However, when using X-Windows on runlevel 3 after it was started using "startx", there is a security breach involved in just locking it. The problem is that a malicious person who has physical access to the computer can press Ctrl+Alt+F1, press Ctrl+C or Ctrl+Z and have access to a shell prompt in which X runs.

I found a way to resolve it by logging into another console and typing "vlock -a", which locks the console and does not allow moving to a different one. This, however, has the unfortunate effect of making the computer unusable, except for remote login. I came up with a better solution, though: run "startx" inside a "screen" session and detach the session. That way, the computer is still perfectly usable.

Or maybe Runlevel 5 does make sense sometimes... :-)

Haifux' Meeting

The meeting of the Haifa Linux Club took place this Monday as usual. This time we had an English speaker who did not know Hebrew well, so the lecture was given in English. That's the first time I remember that was the case.

mulix and Guy Keren gave a fascinating lecture about syscalltracker. You can find the lecture's slides on-line here.

I thought it was funny that they kept a workaround for a compiler's bug in the code, instead of telling people to upgrade to a new compiler. I personally would never do such a thing.

In any case, I finally was able to get acquainated with the famous (or perhaps notorious) Nadav Har'El. Adir Abraham suggested we wage the "Technion - good or bad" war in real-life there, but I decided to skip it.

Implementation of the log function

One side-effect of the lecture was the Muli and Guy said they would like to test their code on an SMP machine. This reminded me that I'd also like to make sure IP-Noise is SMP-safe, so the day afterwards I e-mailed Orr Dunkelman, Muli and Guy that I'd like to share the session with them. This sparced a small discussion which I will not detail here, but everybody agreed that I could do that.

In parallel, I tried to find an SMP machine in the Computer Networks Lab. All I could find was an old Dual-Processor SPARC station. There is no problem installing Linux on it, but the IP-Noise code uses an i386-assembler coded implementation of log(x), so I had to adapt it to the SPARC. I tried to look at glibc (from which I took the i386 routine), but could not make heads or tails of it. So I made a post to Linux-IL which sparced (pardon the pun) a very big discussion. It turns out the SPARC's floating-point unit does not have an internal implementation of the log function and one has to code iteratively.

With some help and input from the Linux-IL'ers, I coded a log() implementation in Perl and then converted it to C. You can find it here. It is not very optimized but it is fast enough for our needs.

I think it would be a good idea to have a central repository of kernel-compatible C and C++ source code, that kernel developers can use in their modules. That way, the wheel would not need to be coded times and again.

GNOME

In order to help keep balance in the force I decided to switch to using GNOME for a while after a long time when I used KDE 2.x. Nautilus is not so bad, for selecting mp3s for playback after I turned off the automatic previewing of files. What did cause me some problems were the Netscape fonts.

I tried to set the Fantasy and Cursive fonts (whatever they are) to something nicer than Courier New, but it turns out Netscape 6.2 gives a long list of fonts, with a very slow scrolling mechanism. I tried Galeon instead - it has the Gtk+ font selection dialog (yey!) but crashed after I tried to set the fonts. It's version 0.12.1 so maybe I should upgrade.

End of story: I'm writing this entry on Konqueror running on top of a GNOME desktop as I speak. Konqi usually brings up half of KDE with it, so thanks God I have 320 MB of RAM.

Aside from that, GMC and Nautilus put together seem to clatter my desktop with icons, but since I don't use the desktop icons much, it's not a major concern.

IP-Noise Project

I discovered that there is a readers/writers lock mechanism that can be used inside the Linux kernel. Check:

http://www.lisoleg.net/doc/Kernel-Hacking-HOWTO/kernel-hacking-HOWTO-5.html

This is good news because so far we defaulted on a mutex, which could have been inefficient in an SMP machine.

Otherwise, I made some minor improvements to the code and documentation - mostly adding comments and the such. I think Roy and I should hand the document to Lavy as it is, so he can review it and hopefully we will get the final report over with. Or the worst case is that we will have to write a very detailed (and IMO useless) architecture document.

The EE-Lab 2 Experiments

In "Electrical Engineering Lab 2", Technion students need to choose 3 experiments from a list of about 20, perform them (with the help of an instructor), and hand reports on them. Usually there are two meetings so sometimes we have a preliminary report for the first meeting, a summary report for the first meeting, a preparation report for the second meeting, and a final report that should be handed after the second meeting. %-)

Two of Eran's and mine experiments: Image Compression and Wavelets went very well. (in the second Wavelets meeting, the instructor was not present, but Eran and I managed to finish the experiment after just two hours anyway.) The "Real Time Digital Signal Processing" one however was not the case. Eran and I set a Technion precendent by leaving the first meeting in the middle and declaring that we wish to give up on the experiment. It turned out to be impossible, so we were scheduled a different meeting.

The second meeting took place last Wednesday and the second take of the first one a week earlier. We finished what we had to do (with a lot of help from the instructor) , but otherwise it did not went too well. Eran wants to get the final report over with ASAP, so he forced me to get to the Technion early today (from Tel Aviv) and work on it in the morning. Good thing that I wook up at 5:15 AM today.

Eran said, that if anyone proposed to give him 55 in that experiment, he would take it. (and I second that) He also said that he also does not mind giving up the experiment and even this entire take of "Lab 2". I said that we should at least give our best shot at "Real-Time DSP" before we give up.

Freecell Solver

I released version 2.0.0 of it. There are two very big things which I'd like to do with it now: add support for multiple threads to operate on the same states' collection, and port to Java. I'll do the former first, so I'll have a good code-base to translate into Java.

Otherwise than that, I'm also thinking of finding a way to abstract prunes without messing the code too much. But since Freecell Solver is fast enough as it is, it's in a rather low priority.

First-Come First-Served Readers/Writers Lock

I coded such a beast for POSIX threads and you can find it here. I did it mainly for fun and to see if the model I thought about for implementing it would work. It seems that it does.

I received some feedback about it from various people. Now I have an idea for improving it, so there will be a smaller number of condition variables that are allocated. But I'll release the current implementation as 0.2 before I do that.

Unfortunately, I'm not going to use such a mechanism for Freecell Solver's multi-threading capabilities. The reason is that the atomic operation of managing the states collection is of checking if a state exists and if not adding it. (and returning whether it was the case). That way, a mutex is enough.

Humanity

I added an incomplete scene called "The Street". It has a lot to do with Computer Science, so I recommend hackers to read it.

The Technion

After having to do 5 exercises in "Structure and Interpretation of Computer Programs", I won't be surprised if I'll start dreaming in parenthesis. During the last lecture, I managed to correct the lecturer on one occasion. Read about it in this post I made to Hackers-IL.

In case, I did not mention it here earlier, I'm writing the answers in English and using LaTeX. It's very convenient and causes much less trouble and frustration than Word. I discovered that one should write {\tt My text} instead of \tt{My text}. LaTeX is not without its idiosyncrecies, but at least one becomes familiar with them eventually, which is not the case with MS-Word.

Other than that, I stopped studying "Digital Communications". The lecturer and the T.A. were great and the material was very interesting, but the homework took too much time. And after I worked in the summer on the project, I'd like to have a light semester.

Freecell Solver

The refactoring of the code was eventually declared successful. Since then I've added a few more changes. One of them was to make sure that the fc-solve executable made use of the freecell_solver_user library. This is programmatically correct due to the "eating your dog food" concept. Afterwards I spent some time implementing a randomized Depth-First Search scan. The so-called random-DFS scan sometimes yields very good results which vary with the different seeds one gives it.

Lastly, I coded a test_multi_parallel.c program that runs several scans on one board simultaenously. From a benchmarking I made it seems that it solves a range of boards, much faster than a single-scan run. The next step in this direction would be to allow for several simultaneous scans to share the same states' collection. I'll probably work on it for the next release of Freecell Solver unless I find something more pressing to implement. But I have higher priorities, like the studies that have just been re-initiated (see below).

Michal Reading Ayn Rand's Books

My sister Michal finished to read the book "The Fountainhead" by Ayn Rand. She said she enjoyed it very much. Now she's reading "Atlas Shrugged" and for the time finds it less intersting. We had a small discussion about these books the other day. I told here that Atlas Shrugged is purposely made more irritating as one goes on reading it. But that's a good thing<tm>.

The Technion

Well, studies so far have been incomplete due to the lecturers' strike. But now the strike is over and hopefully everything will be back on track.

There were some rumours about nasty things the lecturers are going to do to compensate for the missing lectures. I sure hope those rumours are not true.

SICP Amusements

For those who do not know, SICP stands for "Structure and Interpretation of Computer Programs" and is the name of a book and a course in the Technion and in other universities. I had some fun solving Problem Set No. 3. Basically, we had to draw figures on the screen using one drawing primitive (that draws a single point) and a lot of abstractions above it. I'm considering playing with it some more and building transformations for generating such shapes as the cycloid, the hyper-cycloid, an Escher-like condensing pattern, etc.

The IP-Noise Project

Not much to report here. Roy said he sent me a draft of the final report, but I did not recieve it. There's a flow-chart I want to prepare for it in Visio. Otherwise, everything is set and ready for prime-time.

The Image Processing Course's Test Appeal

I failed on my Moed Beith test and to make a long story short, I agreed with the lecturer that I'll hand him another appeal. I decided to print the whole test, and I used LaTeX for this purpose. It did not came out half as bad (much better than my hand-writing that's for sure). And it went much faster than Word despite the fact that I had to check out how to do a lot of things in LaTeX when I needed them. God bless Google and the Haifux mailing list.

Freecell Solver

I got an idea for a re-facoring of the Freecell Solver code. It's documented in this message I sent to the discussion mailing list. Last time I checked there were 18 registered members there. Not bad, I'd say. Of course, I still make most of the posts.

I found out that Beleaguered Castle was actually a variation of Freecell without any freecells. I was able to add support for it and for two related games in Freecell Solver, just by adding three presets.

Another thing I'd like to do for the next release of Freecell Solver is to make the fc-solve program use the freecell_solver_user library instead of calling the more internal functions directly. This has several modularity and usability reasons for it, but it is also a derivative of the "eating your own dog food concept". If I accept third parties to use freecell_solver_user, I should also use it myself, so I know people have everything they can posssibly need.

The IP-Noise Project

Going pretty well. I spent part of the weekend writing a Perl/Gtk+ applet to load the arbitrator and display the configuration file and a description of it, for the final demonstration. Lavy said that the final report composes of 20% of the grade, and should have a similar amount of investment. We have a relatively large part of it written, but we need to document the code in more detail.

I discovered that the module works well with the older Linux 2.4 VM, but not with the newer VM by Andrea Archanagely. I haven't tested it with kernel 2.4.14 yet, so it might be fixed by now.

The Technion

The lecturers are still on strike. I met my former boss from Harmonic, Moshe Nazarthi, at the Digital Communications class and it turns out he is a lecturer in the parallel group. I encountered him before this semester, but I was not sure that was indeed him.

LaTeX

I decided to write the first Digital Communications assignment in Heb-LaTeX so Yesterday and today I spent quite a lot of time working on it. Even though it is better than Word, it seems to take much too long to be worth the effort. I can understand why people would use it for articles or books, but I think homework assignments can be left alone to be hand-written. But who is John Galt?

One of the things that interrupted me was that I had to lookup various commands and conventions using the LaTeX reference on the web. It usually did not take too long, but it accomulated to a large overhead.

Installing Linux

Yesterday's evening I installed Linux for Dudu, who is Eran's friend, this morning I installed it for Eran, and today I upgraded the IP-Noise computer to Mandrake 8.1. I think it's the first time I performed three installations in a 24-hours period, not counting insta-parties.

Which reminds me that tomorrow there is a lecture about Basic Linux Admin by Etzion.

Epilogue

I thought about hacking on Freecell Solver a little now, but it's a bit late, so maybe I'll turn into bed.

Well, the big news is that I set up the homepage for the "Humanity - the Movie" project. This project aims to be the Bazaar way of writing a movie. More info at the homepage.

Otherwise than that I had some homework and project work to do so I stayed in Haifa for the weekend. :-(. Roy and I worked on the project yesterday and today I am working on the image processing experiment preparation questions.

Had I known what life in the Technion would be like in advance, I would not have joined it in the first place.

I'll finish with a joke from "Humanity":

The Tour Guide: The wall is just there. The wall exists.

Tourist: Excuse me, does the wall exists in the same way that Existence exists?

The Tour Guide: No, the wall exists therefore existence exists.

Think about it!

New Signature

Well, today I came up with a new signature, which I think is funnier than the previous one. It goes like this:

"If A is A and A is not not-A, does it imply that B is B and B is not not-B ?"

Flame away! My problem is that I insist that all of my signatures be original. It's not that I don't like many quotes by other people, it's just that I am an individualist. And I also want all my quotes to be funny. And I refuse to use a randomizer. And I want to change it once in a while.

s/problem/problems/ :-)

Noise Over IP Project

That's what I decided should be the new name of the IP-Noise project. Just kidding. In any case, we have a fully working IP-Queue/Kernel Mode Arbitrator. It's only show-stopping bug is a division by zero problem, which I'll solve as soon as I meet with Roy again.

Roy and I prepared a list of notes for the final report, and a wish-list (which we are toying with the idea of out-sourcing a subset of it into a next project). Get this: we have to give a final presentation, a final demonstration and hand out a lengthy final report.

The report would probably be in Word. I asked Roy to learn LaTeX, so we can use it in the next project. It's not that I hate Word... It's just that I can't stand using this excuse for a Word-Processor. WordPerfect 5.1/6.0 was very nice IMO, but LaTeX seems nice too. LaTeX has its quirks, but it is by far better than Word.

Oh well, who is John Galt?

Freecell Solver

I released Freecell Solver 1.10.0 onto the world. Freecell Solver 1.11.0, which is also available, also includes support for Yukon. Yukon has a much bigger number of possible moves so the scan takes longer on average, but it was able to solve all the games I had solved on PySol. There are some cases, where I think it can potentially lose, but I have to pinpoint such one. Which means I'll be playing a lot of Yukon now.

Yukon also tends to generate very long stacks, which only only makes the Indirect Stack States<tm> make sense.

I see it's been more than two weeks since I wrote the last entry. Oh well.

I had some time off my University project (due to the fact that I got a little sick and because of the Jewish holidays), and I invested it in Freecell Solver. Now it is solves Simple Simon games par excellance, and you can expect the release of 1.10.x anytime now. Simple Simon tests are more complex than Freecell ones due to the unique nature of Simple Simon, so it had been quite an experience.

If you can't wait, the development releases are available on the site by now.

The presentation went pretty well. Roy brough snacks and Ecclaires which his wife prepared, so it made a good impression on the Lab staff who jokingly said that it set a new standard for lab presentations.

The coming week will feature Rosh-Hashana in Monday, Tuesday and Wednesday, which does not leave much point in going to the Technion. Nevertheless, Roy and I decided that I will keep converting the arbitrator to C, and he will work on the Mid-Term report.

Thus, yesterday I finished converting the compiler's interface to C and it works pretty well. I started working on the switcher today, but did not finish yet. In any case, I have an entire week for this. I also made a diagram of the packet handler in Dia, but I have to fix it a bit because it came out too large.

I have a test the Sunday after the next in Image Processing and Analysis, so I am preparing for it too.

I downloaded a couple of fortunes yesterday, namely the ones from the Jargon File and some collections I found in a site I spotted on Freshmeat (from the Simpsons, Disc-World, Forrest Gump, the Hitchhiker's Guide to the Galaxy, and Star Wars).

In the R2L front, I am still quite stuck with the KDE applet. I'll try to dedicate some time this week to work on it. I have yet to write a SPEC of the MAYBE simulator internals, too. And I plan to add support for Simple Simon to Freecell Solver. So, I still have some things in my task list.

8 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!