Older blog entries for rkrishnan (starting at number 239)

cell phone battery charger

I misplaced my cell phone charger about 2 months ago and ever since, had been charging my cell phone with the micro USB cable connected to the laptop. So far, I have managed to charge the phone before it completely exhausted the power. Until yesterday. I thought it is just a matter of plugging in, the cable into the phone and connect the other end of the cable to the computer. The phone did start charging. But at some point, it got enough power to bootup and decided to automatically bootup. Once booted up, it shows up as a USB Mass Storage device. But before it enumerates, the phone powers off again. The issue is that, before enumeration, the host controller gives out only 100 mA of current. It can give out 500 mA, only after enumeration. The current was just not enough to keep it going and it kept on booting up and powering down again and again.

Finally I found a way to break the dead lock by rebooting the computer and stop the boot at GRUB prompt. Turned out that the BIOS configured the USB Host Controller to give out 500 mA and it quickly charged up, enough to enumerate, so that I could turn on the computer again.

Syndicated 2009-11-11 08:00:00 from Ramakrishnan Muthukrishnan

debian and other off-work projects

I met another debian package maintainer today for gpg key signing and general chat. I understood how horribly outdated I am, with the happenings in the debian world though I still manage to read some of the debian emails. It provided enough motivation for me to work on some of my packages.But that would mean taking time off from my Lisp study.

I have not been able to keep up with SICP videos though I managed to see (multiple times) up to 4b. I need to catch up with the book though. Currently I am working through Seibel’s Programming Common Lisp. I have also set my eyes on Clojure and had been going through its features. I also worked some small programs with it and found it to be incredibly powerful. It has immutable data structures which is better suited for creating pure functional programs, unlike CL where data is mutable.

I have zero Java knowledge though and often find myself struggling to use java classes from clojure.

Syndicated 2009-11-08 08:00:00 from Ramakrishnan Muthukrishnan

coders at work

Peter Seibel

The book is a collection of conversations with some very well known figures in the computing world. These people have done significant contributions to the body of knowledge and are “inventors/practitioners” of Unix/C, Lisp, Java, Erlang, TeX etc.

Peter has done a great contribution to the computing world by bring out this book (not to mention his other great book “Practical Common Lisp”). The subjects seem to have been very carefully chosen and are experts in their respective fields. But did I miss anyone? Yes, Richard Stallman. He has done some really great deal of programming, all by himself. Nevertheless, this book is a great contribution into the field of Computing folklore and biographies and is very very inspirational. Hats off to Peter for painstakingly undertaking this massive activity of researching the backgrounds and also for researching various topics. It is not easy to talk to these great people in the same language.

The questions are spontaneous and encourages the people to open up the story gradually. Mix of context specific ones and generic ones. Peter also seem to have been careful about not getting into a duel on various usual flamewars. For instance, Peter never asked the question “Vi or Emacs?”.

These are some of the questions, Peter seem to have asked everyone.

  • When did you start to program? (A great deal discussion follows on details about the machine and methods used.)
  • What are your usual ways of debugging? Do you use print statements or use a debugger ?
  • Do you consider yourself as a programmer or an engineer or a craftsmen or an artist?
  • What are the differences between programming and prose writing?
  • What is different in the programming between then and now? This is usually followed by really good discussions of the difficulties of modern day coding with layers on top of layers. Even though source code is available, the sheer amount of knowledge on various libraries and abstractions built by modern day computing systems make it very difficult for a newbie to understand what is going on under the hood. It also make the system inefficient because the computing hardware has become better and cheaper and so no one cares for these things.
  • What are your favourite programming books? Needless to say, "The art of computer programming" is in the list. Some said, they read all volumes cover to cover.
  • What is beautiful code? Importance of reading good code.
  • How do you read code?
It is amazing, how early some of the people touched their first computers. Remember these are 60s and 70s and not even 80s. Contrasting this with my own experiences, I think I am one of the many  nfortunates who had no idea what computers are until I went to the college for undergraduate degree.

It is also amazing to see that these folks are still tinkering with the machine and programming, pretty much every day. In contrast, my job is trying to keep me away fron hands on programming. I am instead trying to work with what others have done and bending it to work with other things and in the process, not writing much code at all.

The discussions are very casual and not formal. It will be very interesting to hear the audio recordings of these conversations, which will obviously have much more interesting anecdotes and stories which Peter couldn’t have been able to incorporate into the book. Most subjects are older programmers. There are few younger ones.

  • Fitzpatrick: Importance of statistics.
  • Peter seem to have researched his subjects very well and have digged most of the information about them off the web. For example, he talks about Fitzpatrick's student day Livejournal entries, one of which said, he was stressed out and hated computers.
  • Most people used print statements instead of symbolic debuggers.
  • C++ hate seem to be a common thread.
  • code reviews as a pre-commit step.
  • bottom-up approach to coding. One exception was Joshua Bloch who said, he does the APIs first and then the implementation, which felt like a top-down method to me.
Some quotes from the book.
  • "C is a portable assembler"
  • "You can reason from effects back to causes. Which is the whole game in debugging"
  • "I tend not to buy into religions, any religions, whole hog. Whether it is object oriented programming or functional programming or Christianity or Judaism, I mine them for good ideas but I don't practice them in toto." : Joshua Bloch
  • " Oh, it's not worth the time, it's just the name of a variable, just don't get it. You're not going to produce a maintainable program with that attitude." Joshua Bloch
  • brilliant quote by Tony Hoare in his Turing Award speech about how there are two ways to design a system: "One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies."
  • "Bloch: I believe that code ownership can't be denied. In a way, it's  like motherhood - you give birth to the code that you write, and especially  if it is large, complex or original, it is yours."
  • Joe’s Law of Debugging, which is that all errors will be plus/minus three statements of the place you last changed the program
  • “Just start something, no matter how humble.” John Washbrook, a senior academic told Simon Peyton Jones. How true this is, as one begins a new programming project with a blank editor in front.
  • "programming languages are the user interfaces of programming": Simon Peyton Jones.
  • "Every five pages of my book is somebody's career" : Donald Knuth.
  • "The first rule of writing is to understand your audience—the better you know your reader the better you can write, of course. The second rule, for technical writing, is say everything twice in complementary ways so that the person who’s reading it has a chance to put the ideas into his or her brain in ways that reinforce each other." : Donald Knuth
  • "The problem is that coding isn’t fun if all you can do is call things out of a library, if you can’t write the library yourself. If the job of coding is just to be finding the right combination of parameters, that does fairly obvious things, then who’d want to go into that as a career?" : Knuth
Guy Steele and Peter Norvig interviews turned out to be great. I then read Simon Peyton Jones and that was great. Every interview turned out to be better than the previous one, whichever order you read it! I just wished there were more. May be dead tree books are a bad choice for such things.

Ken Thomson’s interview had quite a lot of surprises. I just loved this interview. Ken just opens up his mind on various very interesting things.

Peter, though an author of a successful Lisp book, never gets into an argument with Ken Thomson, when he kind of, thrash the Lisp machine concept and the mentality of MIT hackers at that time to compete with the Unix. I was also surprised when Ken said he had not heard of the “Worse is better” paper of Richard Gabriel which compares the Boston style vs New Jersey Style of computing. I also couldn’t justify the vague answer Ken gave regarding Buffer overflowscaused by slppy coding of C/C++ programs. Also Ken said, at Google he has no check-in rights. He also said he despise C++ (like many others in the book and elsewhere) developed by his ex co-worker. C++ has too many features and everyone use a subset of it. Ken clearly says that it is a badly designed language.

Ken also says about the well known story of his wife and kid who went away for a month when Ken was happily programming pieces of Unix at a fast pace. Ken says that when your wife and kid are away, you no longer have to sync with the Sun’s cycle of 24 hours and that he never experienced any stress during that time. Ken also feels (like his friend Rob Pike) that nothing new is happening in the computing world. According to him, the last significant change was the Internet. Ken also shares the same thought, which many others also expressed, that the modern day programming is all about layers on top of layers on top of layers and that a program depends on 40 different libraries which in turn depends on more libraries and at some point, one just can’t keep all that in one’s head. On top of it, things are now distributed with messages being passes from one place to another. Modern day free software projects like GNOME and Mono and gtk are good examples of this phenomenon. Personally, I find it extremely hard and intimidating to even figure out where to start looking if I see a problem and the very thought of it scares me away from such an undertaking. One instance is that on my laptop, the speaker volume control always resets to mute every time I bootup, no matter what the volume level was during the previous bootup. I had been trying to track the problem down for quite a while and finally the layers scared me away and I gave up.

There are some good discussions and contrasting opinions on Unit Testing and how and when to do it. Some of these have hit the headlines recently.

Overall, it is a very inspirational book for programmers and everyone interested in the craft or art or religion or whatever you call it, should read it.

Syndicated 2009-10-04 07:00:00 from Ramakrishnan Muthukrishnan

groklaw's PJ on RMS

This post ought to be read by the so called "open source" pragmatists.

Syndicated 2009-09-30 07:00:00 from Ramakrishnan Muthukrishnan

Paul Graham's On Lisp

I got myself, a spiral bound printout of Paul Graham’s ”On Lisp”. The missing diagrams are explained in this c.l.l post.

Syndicated 2009-09-29 07:00:00 from Ramakrishnan Muthukrishnan

C Programming Language

Just thinking aloud. I used to think that C is a “general purpose” programming language and languages like lisp are “application specific” high level languages. Obviously, this was because of my ignorance and lack of thinking.

I now feel the exact opposite. C being a glorified assembly language with poor support for higher level data structures, is a language intended for low level programming and languages like Lisp with its rich support for data structures and extensibility with macros is the real general purpose language. For proof, see the kind of things Common Lisp allows you to do with the ”numbers” for instance. The C library itself does not seem to have all those facilities, though it has some of those facilities. One can argue that C allows one to implement all those features, but that is not the point.

Syndicated 2009-09-28 07:00:00 from Ramakrishnan Muthukrishnan

SICP and wishful thinking

One of the most powerful ideas conveyed by SICP is the idea of designing programs by “wishful thinking”. It is a simple but powerful concept. The idea is that if you want to design a large program, then we think in terms of some building blocks and use them in our program as if they are primitives. We assume that it is someone else’s problem to write those and give it to us, for a moment. We then write our program in the clearest terms using the newly given building blocks. Once that’s done, we worry about how to implement those building blocks. The idea itself is a recursive one.

For a while I thought that this is a sort of top-down approach of programming. But I now feel that, it is not so. It is instead, bottom-up programming strategy. It is as if we grow the language to create the primitives we need and solve the problem at hand. The order in which we implement them is not important and that’s what we often confuse with the top-down vs bottom-up approach. Atleast that’s how I thought.

Syndicated 2009-09-23 07:00:00 from Ramakrishnan Muthukrishnan

Common Lisp and SICP

I have made a bit of progress with my Common Lisp studies, though I still find it a very hard to think in Lisp. I guess it takes time and practice to achieve it. I also could view some of the SICP video lectures though I haven’t followed up on the relevant text sections. I just don’t have time at the moment.

Programming Common Lisp turned out to be a great first book. On the other hand, I feel that it should have a set of exercises for every chapter. I have covered about 8 chapters now, even with my super slow pace. I had been trying out some small programs. But since my day job is orthogonally different from these things, it takes a lot of time for me to context switch. I have to atempt some bigger problems as time progress. My plan is to atleast keep in touch with lisp on a daily basis so as to not lose touch. I am not in a hurry. This time I am more determined not to lose focus and drift into other interests. So far it has worked well. Let us see.

I also plan to get more books like Paul Graham’s ANSI Common Lisp and also print “On Lisp” from the pdf. According the webpage, 9 figures are missing, but I found only 7 are missing. May be I missed the other 2. These are the missing figures: 5.7, 20.2, 22.11, 23.2, 23.6, 24.1 and 25.2. If someone who own this book make these figures available, then the whole book can be easily recreated. I wonder why Graham himself didn’t do that when he made the pdf available.

Syndicated 2009-09-17 07:00:00 from Ramakrishnan Muthukrishnan

Lisp, again

Since Neuros OSD2 hacking has been abandoned and also because my ham radio interests are currently in hibernation and also since my family is away for a while, I decided to take up some self learning. I have decided to re-start my lisp studies. The goal is to reach a stage where I can write non-trivial programs with lisp. To achieve this purpose, I have choosen the following path:

  • Grok Practical Common Lisp, arguably the best introductory Lisp book available today. Unfortunately there are no exercises, but there a few quite good "Practicals".
  • Watch the SICP lecture videos. I don't like watching them on my PC as my attention span has reduced considerably, thanks to Internet. I use the versions available for viewing on IPod and watch them on my (loaned) Apple IPod. It had been quite effective. The 320x240 resolution is more than enough. I don't have to sit in front of my computer, instead I sit with a pen and notebook, just like in a classroom.I can also listen to them while travelling in trains. These days, I am a regular on weekend trains between cochin and bangalore.
  • Read SICP and work out the exercise. I have a dead-tree version of SICP for some years now. Every time, I read parts of the book but never completed even half of it.
I am making good progress with Practical Common Lisp. Though there is an online version, I decided to buy a dead-tree version. I am finding that Common Lisp is one of the best language for a C programmer like me to learn, instead of Scheme. Scheme syntax and CL syntax has got some subtle differences.

It would take me many months to continue this process. But I have decided not to get distracted with other things during this study. I also have afew projects in mind which I can use Common Lisp for. I am not sure, whether I can go anywhere near the effort that this guy undertook. But even if it is a bit of what he did, it is going to be very beneficial.

Also, if anyone would like to take this undertaking and would like to form a study group (in Bangalore), let me know, we can chart out a plan to meetup regularly and spend time on the lisp study.

Syndicated 2009-09-02 07:00:00 from Ramakrishnan Muthukrishnan

Kernel and OSD2

David Rowe

Past weeks, I had been hacking with the Neuros OSD2 which is based on TI DM6446 processor. I could get the basic kernel up and running. I could also get the framebuffer working. I thought of getting a simple application running. Then started the nightmare. Compiling any simple application which uses the DSP on the processor needs tons of TI written software which goes by strange acronyms like dsplink, cmem, codecengine, dmai, xdc etc etc. Some of them are provided with source but without makefiles, so that they are not buildable. Some of them have very strange directory structures, on one of the software archive, there are two directories at the same level, one is called “package” another called “packages”. Isn’t that funny and wierd ? One of the software (xdc?) has hardcoded names of Montavista toolchain built in, they needed to be changed and recompiled. The git version of the kernel has many features missing, making it just a name-sake port and not very useful. Who wants to just get the command prompt over serial working and type afew sell commands over shell? Such pleasures last for afew minutes and then one realises the reality that some real applications should be running in there.

Even after all these nerve wracking stuff, the application could not be used or compiled with full features. They used non-standard kernel include files, older kernel interfaces specific to TI capture/display device drivers etc. Finally I decided to give up. Many many hours of personal time was wasted, not to mention the money wasted in buying tools like debugger, a USB tv tuner card etc.

I have this Neuros OSD2, a Beagleboard, an XDS100 debugger, a Hauppage WinTV HVR-900 with composite input cable etc for sale. I will probably buy some good books with the proceeds. Do email me, if anyone wants those hardware.

Syndicated 2009-08-27 07:00:00 from Ramakrishnan Muthukrishnan

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