Older blog entries for shlomif (starting at number 25)

28 Feb 2002 (updated 28 Feb 2002 at 20:40 UTC) »

SICP

After the test I had a while ago, I received the news that my final grade is 88%. IMVHO, I deserve more, but perhaps I should have stayed a while in the testing room and gone over the test, instead of handing it right away, like I did.

Not staying to go over the test, seems to be a theme of mine lately in the Technion. I just don't have the nerve to spend more time in the testing room and ahttp://groups.yahoo.com/group/fc-solve-discuss/message/283m anxious to get out ASAP. I'd like to break this habit for the Game Theory test though.

Next semester I am taking the course "SICP 2", which from what I understood is being taken by very few students. Dudu, Eran's friend, is taking it too, so I'll have a partner in case the course gives way to them. The course covers the other part of the book, with the interpreters and the compiler as well as some external material.

When I read the book I found it strange that it is a register machine where every register can hold an entire S-expression. I.e: '(hello (6 (9 0) jkl (uo) op) kl). Now put this in the EAX register of a Pentium...

But thinking about it, Abelson and Sussman got along with very few registers, so I don't think consing several values into one register, could give any advantage. And Parrot has registers which are strings of unlimited length or those "Parrot Magic Cookies", so it's probably a relatively common idiom in designing high-level virtual machines.

Nevertheless, I don't think the book gives the readers enough knowledge to implement a Compiler from Scheme to a Real-Life Assembler. But that's what the Dragon Book is for probably. I did not read the Dragon Book as of yet, but I'd like to, sometime.

Freecell Solver

Being home after the SICP test gave me some time to work on Freecell Solver vis-a-vis with studying for Game Theory. After fine-tuning the FCS 2.2.x autotools parameters, I started working on implementing the so called "Soft Threads".

By "Soft Threads" I mean a way for several parallel scans to operate on the same state collection. I remember that last time I tried it (in what should have been FCS 1.8.x), it took me a very long time to get everything working and even then it was not flawless. This time, howver, working on gvim with a lot of substitutions and an internal framework that was adapted to it a-priori, I managed to get it done very quickly. God bless Linux.

The code is very stable now, and the soft threads work beautifully. Refer to the following URL for more details.

There is still a minor glitch I encountered, which I'll have to deal with. And then there is a mis-feature in the range solver, which I'll have to adapt to the new architecture.

Incidentally, Tom Holroyd released PatSolve 3.0 recently. He claims that he managed to code a very speed-wise optimized mode using a genetic algorithm. I was not able to compile it (probably due to a python version mismatch) and Tom is out of town until next Wednesday, so I'll just have to wait.

"Rindolf" - a New Language is Born

I decided to start my own dialect of Perl, which I call Rindolf. It will be based mostly on Perl 5, with some ideas from other languages I'm familiar with and with some ideas for cleanups I have in mind.

The idea came to me after I heard mulix say that he reads the Apocalypses and Exegesis, but doesn't understand them. It made me realize that I also felt that most of the suggestions were either incomprehensible, or useless for me.

I plan to simply formulate a complete SPEC of the way in which Rindolf deviates from Perl 5. That way, my recommendation can be integrated into Perl 5, Perl 6 or stand on their own.

For more information Refer to:

My original post to Hackers-IL with the idea (I call it Perl 5 TNG there).
The Rindolf Mailing List I set up
A Rindolf Feature in "Use Perl" (It was not comprehensive enough, I believe)

Fixing the IP-Noise Final Report

The Final Report of the IP-Noise Project which Roy and I wrote was based on an old version of the Mid-Term Report before Lavy fixed a lot of things. Thus, Lavy was not very happy with it, and asked us to correct things before he'll take another look. He said the user's guide which we wrote was very good, OTOH.

Today, my father and I went over the final report and corrected a lot of things. Office XP was installed so it can read the report in the first place, but it still causes some minor glitches. But so far, the document is better than it was before.

The worst case scenario is that we will lose some points due to the brevity of the report.

Vim Macro

Due to the fact that I could not find any decent editor outside KDE that behaves just like I wanted, I decided to try and make gvim into an xmms front-end. Which naturally meant adding two macros (one for playing a file and the other for enqueuing it) into my .vimrc file.

I knew Vim macros were basically a recording of all the commands needed to execute them. So, after consulting the vim help pages a bit I came up with a generic macro that did just that. This macro had a problem in which it was not resistant to shell's special characters.

I worked on two other revisions of the macro. In the third revision everything was fixed except for filenames that contain newlines (which are pretty rare as it is).

What I did was copy the line containing the filename into a register, duplicate it below, substitute all the single quotes with the sequence '\'', copy it into the register again. Then, I entered the command line :!xmms '$reg' on the shell, and afterwards deleted the extra line.

Guy Keren once said to me that one did not do real programming until he programs with Vi macros. So, perhaps this was a baby step in the direction of becoming a "real" programmer.

This macro looks like line noise, doesn't it? ;-)

So many things happened since my last diary entry and I have so many things to write. Well - better start somewhere - here goes:

"The Great Kernel CVS Mutiny"

That was the name of a post I made to the Linux-IL mailing-list, which started quite a flamewar. Basically, I made two suggestions for improvements to the way the Linux kernel was managed:

  1. That a source control mechanism be used by Linus and the other kernel developers (hence the name)
  2. That Linus will not necessarily OK all the patches that will go into the main kernel tree, but rather rely on the good judgement of the subsystem maintainers, the module maintainers, etc.

Suggestion #1 seems to have been resolved (with or without my influence - IANA prominent kernel developer) by Linus' switch to BitKeeper. Suggestion #2 seems to have been raised in the "Patch Penguin" post. I did not thoroughly read either the original post or Torvalds' reply to it, so I cannot say right now whether or not it has been resolved the way I think it should.

An interesting theme to my posts was an analogy I made to the story of Moses and Jethero in the Exodus. Read the posts and be amused.

A New Bike

I finally have a new bike which is a blue Raleigh A4 (yes, like the paper size). I rode it several times the past weekend and this one, and it feels pretty good. Some things in it are a bit of an over-kill, if you ask me, but all in all I'm happy.

I'm supposed to take it to the shop were I bought it after a month or so, for some maintainance.

User's Guide for the IP-Noise Project

Roy is finally through with his Milu'im. We decided that we can add more meat to our final report by writing a User's Guide. We decided to write it in HTML, after ruling out POD (which is very limited) , LaTeX (which is harder for MS-Word to import) and DocBook (which I still have to learn). POD is still great for writing man pages, and Roy agreed with me that the nroff syntax is much more horrid.

We will explain setting up and using the front-end in detail. I believe I have GraphViz around, which should prove useful for including diagrams that explain about the Markov chains.

Exercising

My bike broke again last Friday, which made it impossible for me to ride them in the further part of the weekend. This has finally convinced my father to buy me a new bicycle.

My father and I went on a hiking trip on Saturday. We walked in a narrow water-less channel, which did not have too many flowers or interesting trees. The road up to it looked nicer than the road inside, IMO, but it was good to have a trip back again.

It's been constanly raining here since the weekend, so I could not jog even assuming I would want to do that. Maybe, I'll go to the gym today, or tomorrow...

Technion Courses

Things are not going very well with Game Theory and with "Intro to Thermodynamics and Statistical Physics". In Game Theory I missed a few lectures due to these wretched Real-Time DSP experiments and was not very successful in solving the home exercises on my own. In Thermo, I missed a few lectures and T.A. sessions and also have a learning gap.

I called a tutor for Thermo and he said he was busy this week and that I should phone him on Thursday. There are no tutors for Game Theory unfortunately, but I'm going to consult with the lecturer today about the situation.

FCFS RWLock

I hacked on it a bit in the past few days. Right now there is a working man page with many aliases for every function it contains. Took me some Autotools games to put the man page on a separate directory.

I also combined release_write() and release_read() into one function.

Misc Stuff

vipe.technion.ac.il has been inaccesible for some time but is now. I wonder why does the dorms network causes me so much trouble.

I forgot my cell-phone at home. At times, I feel the urge to call people using it. Maybe I'm becoming too technocratic...

SICP

I spent a lot of time in the weekend working on the Structure and Interpretation of Computer Programs course's homework. I forgot the LaTeX files that contained the cover page I prepared on my Com-Net Lab workstation, so I re-created a cover page from scratch. It was not too hard.

It maybe my impression but it seems that Scheme programs are more prone to bugs than Perl programs. And those bugs are harder to trace. MIT Scheme is rather strange in the sense that the identifiers there are case-insensitive. I checked it on Guile and A and a are completely different variables.

Bicycle Ride

I rode my bicycle twice on Friday and once on Saturday. Now I'm going to bike again. Last weekend one of the brakes cords of my bicycle broke, and I had to return with them to home walking. This thursday, I walked with them to the bicycle repair man and he fixed them.

I'm getting tired of my bicycle breaking down, so I asked my mother to buy me a new bicycle for my birthday instead of an electrical organ which was our original plan.

Refactoring the Law

There's a small article I have been intending to write for a long time about re-factoring the Law. To sum up, I believe that adding new laws is like making ugly changes to the code that attempt to add more functionality but mess it up completely.

The equivalent of refactoring a code is taking out redundant or harmful laws out of the Law Canon.

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.

16 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!