Thursday, September 07, 2006

A Review of Puppy Linux

I have an interesting problem. I want to run linux at work, but don't want to lose the space on my laptop. The solution? Use a live-cd linux distro. At the same time, I'm not looking for too much and so a full blown live-cd distro like knoppix would be overkill.

So, it was going to be a small distro. What's also nice about small distros are that they are extremely easy to use. They aren't bloated (Hey! how much can you fit into 50 MB) and they still seem to have the necessary bits plugged in. I found a few and had shortlisted it down to DSL and Puppy Linux. I gave DSL a try before switching over to Puppy Linux. Don't get me wrong, I liked DSL quite a bit but I found some of the features on Puppy Linux quite a bit better.

Some of the things I really liked about Puppy Linux was its support for the 2.6 Kernel and thereby pretty decent support for hardware. Since I have a laptop, WLAN connectivity is a must and that's what I wanted from Puppy Linux. I gave a good RTFM before actually trying it out and expected Wifi to work out of the box. It didn't. It took me a *lot* of time and effort before I realized that I need to download and install an additional package which patches the Wifi connectivity for my laptop. This wasn't as bad as it seems because of a really cool feature that the distro has - multi session live CD. Basically, this feature allows for software to be installed on top of the same cd and not just that, it allows file modifications to be saved as well. This really is a superb solution, because it gives the illusion of a read/write filesystem on what is actually a read only media. Naturally, this doesn't come for free and the more you save, the longer it takes to boot.

There are a lot more features than just this. Puppy Linux runs off a ramdisk, and so you can remove the Live-CD once it boots. This frees up the CD ROM drive. Plus, this distro makes replication really really easy. All you need to do, is pop in a different CD, and save and it gives a new CD with all the software. This is still a bit unstable though, and I had some problems when I used it, but I does work.

On the whole, I really liked Puppy Linux. Its easy to use and some of its features are seriously cool. No doubt I would be spending more time on it trying to customize it to my liking and yet try to keep things as simple as possible.

Tuesday, June 27, 2006

Some free ebooks from oreilly

Its not a comprehensive list, but oreilly has decided to open out some of their books. link.

Perhaps a book was outdated enough to be put out of print, yet some
people still needed the information it covered. Or the author or
subject of a book felt strongly that it should be published under a
particular open copyright. Maybe the book was written collectively by a
particular community, as in the case of our Community Press books.

On the whole I think this is a good idea. There are books I definitely want to read
1. Linux Device Drivers (both 2nd and 3rd editions)
2. Unix Text Processing
and to a lesser extent
3. Version Control using Subversion

Monday, June 26, 2006

Setting up a blog using Sharepoint

Sharepoint is great. It makes collaboration within and across teams really easy. I use it all the time at work. It takes a bit of effort to create a personal page on sharepoint though. Here's what I did.
1. Created a new site with my name
2. Modified the main page with only announcements and a contacts widget.
3. I added only myself to the contacts in the site and changed the display to Newspaper type.
4. The announcements widget automatically act like a blog!!!

Friday, June 16, 2006

Now that BillG ....

.... is leaving out come the ancedotes. Joel has a great one where he talks about his experience as a Program Manager of Excel. Apparently he was responsible for Visual Basic integration with Excel and had to go through a review with Bill Gates. link.

Thursday, June 15, 2006

Webdav and box.net

Systems Boy has an excellent post on publishing ical calendars on the net using box.net. link.

Going further, I tried to find some tools that use webdav. One option is to use tcl vfs. However, this is pretty useless if one is behind a corporate firewall. Next I found a tool called cadaver. Again this doesn't have proxy support.

In the end hunting around, I found that IE itself supports webdav. The only thing is that they don't call it webdav. Instead they call it webfolders! Believe it or not this info comes from mozilla.

So here is what to do if you want to have a 1 GB of storage space on the net.
1. signup with box.net
2. start IE and do file->open "http://www.box.net/dav". Check the option for webfolders
3. Voila!! Now you can store/retrieve files from box.net!!

Wednesday, May 31, 2006

Slashdot redesign winner announced

The winning entry can be seen here. This is far better than the original slashdot but far from revolutionary. There were other far more interesting layouts, but I guess this was the one that kept CmdrTaco happy and was backward compatible as well. Sigh.

Update: The Slashdot story is here.

Tuesday, May 30, 2006

Simple Library to create BMP Files

EasyBMP is a small library that can be embedded inside any application to create BMP files. The project homepage is here.

Tutorial on pointers

Gamedev has an excellent article introducing pointers in C. Building on that article, I think an introduction to volatile and const pointers. While const is more C++ than C, it is still useful. MSDN introduces both here.

Expanding Scope

I'm changing the scope of my blog here. Instead of the narrow focus on Scheme, I'm now going to blog on anything related to software or hardware or techie. Now this should get the blog moving.

Monday, March 27, 2006

Scheme Interpreter in 48 Hours using Haskell

This link contains pointers to creating a scheme interpreter written in Haskell. Still looking for a easy to build and use version written in 'C' though.

Friday, January 27, 2006

Wednesday, January 18, 2006

Lists and Maps

Lists and Maps

The simplest way to define a list is

(define a-list '(1 2 3 4 5 6 7 8))

If we want a function that works on each member of this list, then we will have to make use of the map inbuilt function.
Here is a function that adds 1 to each member of a list and then returns that list

(define (add-one n)
(+ n 1))

(map add-one a-list)

We can play around a bit more with map
Let us define a function that adds a fixed number to a-list

(define (list-plus n)
(map (lambda (x)
(+ x n))
a-list))


We can refine this further to take any list and add a function that does a minus as well

(define (list-plus-n n some-list)
(map (lambda (x)
(+ x n))
some-list))

(define (list-minus-n n some-list)
(map (lambda (x)
(- x n))
some-list))


Then we can call the functions as

(list-plus-n 10 a-list)
(list-minus-n 10 a-list)


We can even make list-plus-n and list-minus-n to be wrappers for a more generic function

(define (list-plus-n n some-list)
(list-map + n some-list))

(define (list-minus-n n some-list)
(list-map - n some-list))

(define (list-map operation n some-list)
(map (lambda (x)
(operation x n))
some-list))

Saturday, January 07, 2006

Celsius to Fahrenheit in Scheme

Converting from C to F is trival - just multiple the temperature in C with 9/5 and then add 32.
So, a scheme version of this would look something like this
(define (celsius-fahrentheit c)
(+ (* c (/ 9 5)) 32))

However, this gives results out as fractions. So, (celsius-fahrenheit 32) gives the result as
448/5

Therefore, the correct implementation would be
(define (celsius-fahrentheit c)
(+ (* c (/ 9.0 5.0)) 32.0))

This gives the result as
89.6.
We can also define a new function that prints a table of celsius and fahrenheit values.
Ideally, this function would be using recursion instead a loop to go through all the
functions.
(define (celsius-fahrenheit-table min-value max-value)
(let ((c min-value))
(if (<= c max-value) (begin (display c) (display "<->")
(display (celsius-fahrenheit c))
(newline))
(celsius-fahrenheit-table (+ min-value 1) max-value))
0)))

However, the display bit can also be moved out to a separate function
(define (display-items x y)
(display y)
(display "<->")
(display (x y))
(newline))

Then, our function will look like this
(define (celsius-fahrenheit-table min-value max-value)
(let ((c min-value))
(if (<= c max-value)
(begin
(display-items celsius-fahrenheit c)
(celsius-fahrenheit-table (+ min-value 1) max-value)) 0)))

But the biggest change for a C program is the fact that functions are first class objects. What this means, is that we can use functions in interesting ways. We can define separate functions for celsius to fahrenheit conversion and vice versa, and pass them around. That means, we have a generic function that prints a table.

(define (tabulate convertor min-value max-value)
(define (display-items x y)
(display y) (display "<->")
(display (x y))
(newline))

(let ((x min-value))
(if (<= x max-value)
(begin
(display-items convertor x)
(tabulate convertor (+ x 1) max-value))
0)))

(define (celsius-fahrenheit-table min-value max-value)
(tabulate celsius-fahrenheit min-value max-value))

(define (fahrenheit-celsius-table min-value max-value)
(tabulate fahrenheit-celsius min-value max-value))

If you are interested in learning more about scheme then schemers.org is a great starting point. I also have a page maintaining some of my posts on scheme. 

Sunday, January 01, 2006

Hello World

The first thing to do is to install a scheme implementation and run a "hello world" program. So, I downloaded MIT/GNU Scheme and installed it on my Laptop. MIT/GNU Scheme can be downloaded from here.

I ran the following code
(display "Hello World")
This ran fine, but gave an error
;Unspecified return value
This required some additional searching on the net. A quick search on google gave me two different links. The first is from a website that has "Hello World" Programs in a zillion languages and the other is from GNU on how people from different age groups and jobs write a "Hello World" Program.

Both versions print hello world, and in fact the first version is a recursive loop that continuously prints hello world. More importantly, both versions did not give the above error.

Why should I learn Scheme?

As a software engineer, I'm not unique for not having never learnt Scheme or Common Lisp. I had my Professional Education in Electronics and Communication Engineering, where the focus had been on learning stuff far removed from my day to day work - which is Software Engineering.

As a result, not knowing some of the basics of computer science has left me with a poorer understanding of software. To make up for this gap, one of my new year's resolution is to learn Scheme. Learning Scheme by itself will not make up for my lack of education, but will help in understanding some of the fundamentals that I sorely lack.

This blog is about Scheme and related topics. I'm going to look at Scheme through a Newbie's eyes. In my day to day job, I work exclusively on Embedded Software, which requires good understanding of Operating Systems, C, Hardware/Software Interfaces, Device Drivers. At this point in time, I don't see any connection between Scheme and my day to day work, but I hope to learn it nevertheless. Its been almost 8 years since I first learnt C, and over 10 years since I learnt Fortran. But I learnt my first language, Basic almost 14 years ago. Its about time I learnt Scheme.