Wednesday, August 30, 2006

FAR Manager

I really like WinRAR. And the same people make another program I like very much as well: FAR Manager. It is a file manager, but it is so much more than that...

First of all, it takes all the guesswork out of drag and dropping files, of finding the right files in windows explorer, of copying or moving files quickly... and then, it supercharges them beyond your wildest imagination. For example, copying files between two locations becomes:

  • Choose the destination folder in one panel.
  • Choose the source folder in the other panel.
  • Select the files you want to copy, either by wildcard matching or by cherry picking with the Insert key.
  • Press F5, then Enter.
Done. There is no dealing with holding shift, ctrl, or accidentally making a copy of a zillion files in the same folder. None of that. Everything is perfectly clear, and in an equally spaced font that makes it easy to read.

But the killer part is that people write plugins for this thing. So for example someone wrote an extended file copier for FAR. It uses read ahead and write back buffers, it can read and write in parallel, and it even preallocates space on the hard drive to avoid fragmentation. Result? Copying the VW goodies folder from one hard drive to another used to take me 25 seconds to do. With this plugin, 10 seconds. Apply this kind of savings every time you copy or move files, and it adds up to real money real fast.

But it doesn't end there. Now imagine that all the things you do with files are supercharged in the same way. Moving, renaming, deleting, editing, searching through files, browsing FTP servers, diffing folders, mass renaming files according to some rule... everything supercharged to the max, and much more efficient than what Windows and a plethora of annex utilities will give you, all in a single program.

Oh, by the way, and should the standard package not be enough for your needs, there are over 700 plugins available for FAR to choose from.

And to top it off, the keyboard centric interface is way faster than Windows' idea of how you should deal with files. Once you get used to it, the idea of messing with file icons using a mouse will become a synonym for inefficiency.

Stop wasting time and energy with one of the most basic and pervasive activities you perform every day. Get rid of those performance taxes that are so obvious they are invisible.

But there is more. It is so easy to see the inside of files with FAR, you just press F3 on a file. Once you do that with enough files, you will know how files look. To me, this has tremendous advantages.

For example, you can start recognizing things like compressed files, down to the program that was used to make them. This is regardless of whether the file has been modified by simple things like renaming, or more complicated things like prefixing it with other stuff. Windows gives you no ability to do this.

What's more, once you know how to recognize how different files look, you become able to ask interesting questions. For example, I can't find the help switch for this program, can I see the help text inside it? Why would a Word document have compressed stuff that does not have common JPEG / GIF / PNG headers? Why would that executable file look just like the others except that compressed block at the end, just where the overlays would be? What compression scheme was used in this installer program, if any? How, exactly, is this archive file broken as reported by the compression utility (this can be very important for recovery efforts)? If I need to fix a damaged file that programs won't help me with, can I attempt a manual recovery myself?

I even have actual examples of this that relate directly to Smalltalk. For example, does this VM have debugging information in it? Is it already compressed with an executable cruncher, or could it be worthwhile to use UPX on it? Can I find a snippet of code in the changes file quickly?

But my favorite Smalltalk example is this: why does the image contain byte encoded strings that you cannot find by sending allInstances to String and all its subclasses?

Seriously. Become truly productive now.

Wednesday, August 23, 2006

New sensation

Somebody recently asked me to sign my chapter included in one of the Squeak books. It was the first time anybody asked me for anything like an autograph. And what a surprise it was. I didn't expect it at all --- it was amazing to see something I wrote 7 years ago come back like this.

I feel a bit humbled about it. People actually read what I wrote back then! I have to be even more careful with what I write now, it is such a big responsibility!

At the same time, I always hoped that what I did would meet with its intended fate and that it would be put to good use. The request makes me think it has happened, and it makes me feel very very happy.

Thank you so much for reading, known and unknown readers! With a bit of luck, next year's book will be worth reading too :).

Monday, August 21, 2006

Post #200 --- fun at the airport

I was at an airport not long ago, and something disturbing happened. I had just crossed the security checkpoint on the way out, and then...

... FREEEEZE!!!

The police style scream had just gone off, no question about that. I looked back, and I saw a bunch of security types running towards one of the metal detectors. Some of the people around me started running away.

But... hold on here... why are the the security types smiling? And now they are congratulating themselves, too. Oh. Nice joke. And oh by the way, this was after the water bottle fiasco at Heathrow.

Some people, man...

Sunday, August 20, 2006

A lot of fun coming up at NYC's SUG

Well, well... the time has come. I will be giving a presentation at New York's Smalltalk User Group on September 13th. The topic is the Smalltalk Solutions 2006 Coding Contest. I hope you will enjoy it as much as I will :). See you there --- don't miss it!

Details coming up at Charles Monteiro's blog.

Regarding Mr. Carr's post

Via James' blog, I read this blog entry in Mr. Carr's blog about blog readership. I am tempted to say I wrote a shorter version of the same, with juicy comments too. But I would like to comment on Mr. Carr's post now.

Yes. It is easy to think that whatever one has to say all of a sudden has more value because it appears in a blog. A blog is typically a much prettier place than a mailing list. It is so convenient to make it attractive, and to use its visual qualities to throw an aura of greatness on oneself.

But when, despite the best efforts, one's blog does not have the readership of mass media... not even an average of comments per post significantly greater than zero... then it sinks in. Our efforts to be well-known are in vain. So if one was blogging with the idea of being popular, hey, people know that appearances can be deceiving.

But there's more to this. Regarding innocent fraud, as commented on by Carr, I'd say it is described quite eloquently in the tiny book called On Bullshit. Amazon's review, written by Mary Park and quoted below for convenience, offers the following:

"One of the most salient features of our culture is that there is so much bullshit," Harry G. Frankfurt writes [...]. "Everyone knows this. Each of us contributes his share. But we tend to take the situation for granted." [...] Bullshitting, as he notes, is not exactly lying, and bullshit remains bullshit whether it's true or false. The difference lies in the bullshitter's complete disregard for whether what he's saying corresponds to facts in the physical world: he "does not reject the authority of the truth, as the liar does, and oppose himself to it. He pays no attention to it at all. By virtue of this, bullshit is a greater enemy of the truth than lies are." [... H]e points to one source of bullshit's unprecedented expansion in recent years, the postmodern skepticism of objective truth in favor of sincerity, or as he defines it, staying true to subjective experience. But what makes us think that anything in our nature is more stable or inherent than what lies outside it? Thus, Frankfurt concludes, with an observation as tiny and perfect as the rest of this exquisite book, "sincerity itself is bullshit." [...]

I would add that being "sincere" might qualify as being arrogant.

But back to the story. On one hand, we find it so easy to look at another blog and question it on bullshitting grounds, ignore it, post no comments, or rebuke it in our blog, etc. But on the other hand, the majority of us find it very hard to stop accepting things like mass media at face value.

So how do we achieve this dual behavior without experiencing a mental meltdown? And here I would like to offer my 2 cents: it is because we, in general, have learned to suspect our fellows, and only trust arbitrary sources of authoritative opinion[*1].

In other words, we rarely communicate with each other. We live mostly alone, in a world where as long as our opinion matches that of the source of authoritative truth, nobody will question us. From the moment we learn to do things such as to pass multiple choice tests, our individuality is squished because we are taught that we only need to pick the correct answer from the ones we will be conveniently provided in a silver tray. And we do not even need to understand the book to recognize the direct quote from it.

Besides, questions are scary. What if we had not memorized the answer yet? We would not be able to answer immediately, and we would not look cool[*2]. We might even have to say "I do not know"! So why do we need the hassle of thinking for ourselves, with the possibility of making a mistake, needing time to consider things, or just look stupid when compared to someone who answers on the spot? We'd do better if we did not need to come up with an answer by using whatever gray matter we may have.

With time, we even learn what are the things we should associate with authoritative truth. Ceremony. Rounds of applause. A particular cadence in speech. Reverence to particular names. Standing ovations. Buildings, structures or other artifacts with particular looks. Low frequency voices. And so on. Therefore, we do not even need to think about what is a source of authoritative truth --- as in a multiple choice exam, we just choose what we are taught to bark and wag our tails for.

And thus, trained to think that this must be so, we live in a world of seemingly easy dog biscuits --- one of sameness, blandness, atrophied minds, and bullshit... lots and lots of bullshit.

And then we wonder why would anybody waste time reading our blogs! Even if we used them to let others know about things we research, or about the results of spending considerable time using our gray matter, we do not have what we need to be recognized as a source of authoritative truth. Immediately, our readership goes to zero, comparatively speaking.

I wish we ever dared to live with the scientific method as our golden standard, and let go of all this bullshit, even just a bit. And I do not wish that so that more people would read what I write. It is because then we would be more aware of our limitations, and with that knowledge we might even decide to try to become better. But someone else has already expressed this quite well:

"We make our world significant by the courage of our questions and by the depth of our answers." --- Carl Sagan

*1: CNN proudly proclaims it is the most "trusted" source of information, for example. Trust, yes. Resistant to reasonable inquiry, no.

*2: The "blink" phenomenon, and the idea that experts are right because of gut feeling, is a prime example of telling the masses what they need to consider as "cool". The Holy Inquisition, witch hunting and many other horrors we inflicted on each other were direct consequences of gut feeling.

Saturday, August 19, 2006

LaTeX, MiKTeX, and OOPSLA

Ah my friend, preparing papers for OOPSLA can be quite interesting. In particular, how about this? You get the OOPSLA-sanctioned style file and template, you fill in all your content, you generate the required .ps and .pdf files without touching anything, and you think you are done.

Emphasize think. Because you are not. You get back a notice telling you "hey, you gave us files formatted for A4 paper, and we need letter size". Ah yes, there are differences in size, and thus margins will get broken.

But how did this happen, you think? You didn't touch anything. Didn't the style file set the paper size to letter? Scratching your head a bit, you go over OOPSLA's FAQ and find that the european TeX distributions, while very good, default their configuration to A4 paper. MiKTeX, in particular, comes configured for A4 paper instead of letter. You use MiKTeX, there's the problem.

Ok, so how to fix it? The .ps file is easily fixed by adding "-t letter" to dvips.exe's command line. But pdflatex.exe knows nothing about the -t switch, so your .pdf file is still in A4. What to do now?

Fortunately, you notice one of those rarely-used programs is called dvipdfm.exe. From .dvi to .pdf, sounds good! So you try "-t letter" with dvipdfm.exe thinking it should work, but instead you get an error and a screenful of help text. Examining this, you find that with dvipdfm you have to use "-p letter" instead of "-t letter". Hmmm.

And thus, finally the files are produced.

Monday, August 14, 2006

Another Smalltalk blog

Please welcome Zephyr to Planet Smalltalk!

Sunday, August 13, 2006

Writing Truly Efficient Smalltalk

I just finished the paper for OOPSLA. I think it looks good --- hopefully others will think so too!

Now, back to writing the book.

Friday, August 11, 2006

Today's random taxi cab driver

Today's taxi driver had a russian accent, so I asked him if he was from Russia. When he said yes, I told him that when I was a kid, I read books published by Mir, in particular some by Yakov Isidorovich Perelman. He knew Perelman as well, and in his bookshelves back in Russia, among perhaps 1500 books, he had 3 books by Perelman.

What a nice conversation followed! He told me about Russia, and how the Jewish community established there, coming from Spain, France, Germany, Poland, and finally to this town which sounded like Hazaria, where they flourished because they traded things like silk from China, back in the year 700 or so.

His rudimentary English only made it more interesting. He had been a military guy for 30 years. He was a radio set engineer, and built nearly 500,000 radio sets. He was proud because his radio sets had been in Vietnam, Cambodia, Cuba, even Che Guevara had used them. He also built radio sets to control missiles (and he clarified that while the plane went bum with the missile, his radio set was safe on the ground).

He also related how if you had Jewish family then your military possibilities were capped because at that time the KGB would only allow Russians. Even though he was a Russian orthodox, his wife and other family members were Jewish. This brought him many problems. He told me one day the KGB person came over and told him that his top rank would be Major because his family was not 100% Russian.

He said he didn't like communists, fascists, or any of those guys. And that while there were communists in power, even though they were bad, at least they imposed a Russian point of view on things. Once they were gone, then all sorts of nasty stuff appeared: fascists, nationalists, and people with an exaggerated pride in their country --- even with skinheads wearing swastikas, of all things.

He told me how one Russian lady was stopped in a country road with signs of "Jewish => Go to Israel" by these crazy people, and that she was killed with bombs, even though she was Russian. He had an opportunity to speak to people like this, and recalled the conversation. Apparently he was in his home town, where most people are Russian and there is only a small Jewish minority. He asked these guys why would them, Russian people, tell Jewish people to go to Israel. Their answer was that they had killed Christ. But, he complained, Christ was Jewish! Their answer? No, Christ was Russian. "We have idiots in Russia, too".

He added that he had studied English when he was younger, but that he had forgotten most of it because at the time he was told America was bad and that it was full of bad people. He used to think that he, a military person, would go to the Moon before going to America. So, when he came here, he studied very hard for a few months and that then at least he was able to talk with others in English.

He mentioned that, despite all the bias to the contrary, America was a good place and was full of good people. Then he compared things a bit. He said that indeed, people here were good, and that would helpfully tell him where to turn and where to go if he didn't know the exact directions (he apologized for his lack of experience, as he started driving 3 months and 3 weeks ago). But that while in Russia people would like to read a lot, here people would be nice but uninterested. In his own words: "No study, no read. Many people talk Irak, Afghanistan, they cannot know where. They don't know difference, Austria and Australia". Alas, the convenient newspaper poll would most likely prove him true. And with that, we arrived at the destination.

Simply fantastic. I wish I had had my video camera to tape the interview.

Saturday, August 05, 2006

Minesweeper, success at last!

I had this project, that I started in 2002, to write a program that plays Minesweeper like I do. My goal was to reproduce, as far as I could, the actual thought processes that went on my mind, rather than to reach for linear algebra, minimax algorithm, or some other ad-hoc hacked together algorithm*.

I made some SUnit tests, with beautiful messages such as thereAre: anIntegerMines in: aCollectionOfSquares, so that I could create stress tests for each solver prototype, and off I went to write them. But I would get stuck --- either the solver would completely fail to see dependencies that were there, or it would end up resorting to brute force.

But when people play, they do not need the age of the universe to solve a particular game --- in fact, they seem able to realize that there are multiple solutions without much effort. How do they do it, then, if they couldn't possibly use brute force?

So last night, something told me that I had to play Minesweeper but this time paying attention to how I thought about it, instead of trying to reproduce the thought process after the fact. So I played with attention... and I realized that my previous mistake had been not to separate two phases of solving. One is the "mark/unmark everything that is obvious" phase. The other one is capable of "marking/unmarking" when nothing is obvious. And because I had combined them in my earlier attempts, the code ended up reflecting my confusion.

In an inspiration attack, I did better in a couple hours than I did in all the previous months of work, and for the first time a beautifully written solver passed all the stress tests.

It was a great experience, and for more than one reason. This project lives in a Stable Squeak image. It's about 2mb, and has all the refactorings I had done for Morphic. One that I frequently remember is that I replaced all the event mechanisms with when:send:to:, without needing to restart Morphic. Such nice memories!

* Incidentally, Google knows about many hacked together algorithms that play Minesweeper, but none that I know is written rigorously :(.