Friday, December 17, 2004

There must be some way out of here," said the joker to the thief,

"There's too much confusion, I can't get no relief.

Businessmen, they drink my wine, plowmen dig my earth,

None of them along the line know what any of it is worth."

 

"No reason to get excited," the thief, he kindly spoke,

"There are many here among us who feel that life is but a joke.

But you and I, we've been through that, and this is not our fate,

So let us not talk falsely now, the hour is getting late."

 

All along the watchtower, princes kept the watch

While all the women came and went, barefoot servants, too.

 

Outside in the distance a wildcat did growl,

Two riders were approaching, the wind began to howl.

 

            All Along the Watchtower, Bob Dylan 1967.

  

And I am thinking that songs like this are not written or authorized by committees. Committees are about filtering out the insanity of individuals into the sanity of the collective. The whole is greater than the sum of the parts. Or so they said.

 

How does it feel

How does it feel

To be on your own

With no direction home

Like a complete unknown

Like a rolling stone?

           

            Like a Rolling Stone, Bob Dylan 1965

 

 

THE MYTH OF DAEDALUS & ICARUS

 

Daedalus was a highly respected and talented Athenian artisan descendent from the royal family of Cecrops, the mythical first king of Athens. He was known for his skill as an architect, sculpture, and inventor, and he produced many famous works. Despite his self-confidence, Daedalus once committed a crime of envy against Talus, his nephew and apprentice. Talus, who seemed destined to become as great an artisan as his uncle Daedalus, was inspired one day to invent the saw after having seen the way a snake used its jaws. Daedalus, momentarily stricken with jealousy, threw Talus off of the Acropolis. For this crime, Daedalus was exiled to Crete and placed in the service of King Minos, where he eventually had a son, Icarus, with the beautiful Naucrate, a mistress-slave of the King.

Minos called on Daedalus to build the famous Labyrinth in order to imprison the dreaded Minotaur. The Minotaur was a monster with the head of a bull and the body of a man. He was the son of Pasiphae, the wife of Minos, and a bull that Poseidon had sent to Minos as a gift. Minos was shamed by the birth of this horrible creature and resolved to imprison the Minotaur in the Labyrinth where it fed on humans, which were taken as "tribute" by Minos and sacrificed to the Minotaur in memory of his fallen son Androgenos.

 

Theseus, the heroic King of Athens, volunteered himself to be sent to the Minotaur in the hopes of killing the beast and ending the "human tribute" that his city was forced to pay Minos. When Theseus arrived to Crete, Ariadne, Minos's daughter, fell in love with him and wished to help him survive the Minotaur. Daedalus revealed the mystery of the Labyrinth to Ariadne who in turn advised Theseus, thus enabling him to slay the Minotaur and escape from the Labyrinth. When Minos found out what Daedalus had done he was so enraged that he imprisoned Daedalus & Icarus in the Labyrinth themselves.

 

Daedalus conceived to escape from the Labyrinth with Icarus from Crete by constructing wings and then flying to safety. He built the wings from feathers and wax, and before the two set off he warned Icarus not to fly too low lest his wings touch the waves and get wet, and not too high lest the sun melt the wax. But the young Icarus, overwhelmed by the thrill of flying, did not heed his father's warning, and flew too close to the sun whereupon the wax in his wings melted and he fell into the sea. Daedalus escaped to Sicily and Icarus' body was carried ashore by the current to an island then without a name. Heracles came across the body and recognized it, giving it burial where today there still stands a small rock promontory jutting out into the Aegean Sea, and naming the island and the sea around it after the fallen Icarus.

 

 

Icarus by frank wright

 

The labyrinth from which Theseus escaped by means of the clew of Ariadne was built by Daedalus, most skillful artificer. It was an edifice with numberless winding passages and turnings opening into one another, and seeming to have neither beginning nor end, like the river Maeander, which returns on itself, and flows now onward, now backward, in its course to the sea. Daedalus built the labyrinth for King Minos, but afterward lost the favor of the king, and was shut up in a tower. He contrived to make his escape from his prison, but could not leave the island by sea, as the king kept strict watch on all the vessels and permitted none to sail without being carefully searched. "Minos may control the land and sea," said Daedalus, "but not the regions of the air. I will try that way."

So he set to work to fabricate wings for himself and his young son Icarus. He wrought feathers together, beginning with the smallest and adding larger, so as to form an increasing surface. The larger ones he secured with thread and the smaller ones with wax, and gave the whole a gentle curvature like the wings of a bird. Icarus, the boy, stood and looked on, sometimes running to gather up the feathers which the wind had blown away, and then handling the wax and working it over with his fingers, by his play impeding his father in his labors. When at last the work was done, the artist, waving his wings, found himself buoyed upward and hung suspended, poising himself on the beaten air. He next equipped his son in the same manner and taught him how to fly, as a bird tempts her young ones from the lofty nest into the air. When all was prepared for flight he said, "Icarus, my son, I charge you to keep at a moderate height, for if you fly too low the damp will clog your wings, and if too high the heat will melt them. Keep near me and you will be safe."

 

While he gave him these instructions and fitted the wings to his shoulders, the face of the father was wet with tears, and his hands trembled. He kissed the boy, not knowing it was for the last time. Then rising on his wings he flew off, and looked back from his own flight to see how his son managed his wings. As they flew the plowman stopped his work to gaze, and the shepherd leaned on his staff and watched them, astonished at the sight, and thinking they were gods who could thus cleave the air.

 

They passed Samos and Delos on the left and Lebynthos on the right, when the boy, exulting in his career, began to leave the guidance of his companion and soar upward as if to reach heaven. The nearness of the blazing sun softened the wax which held the feathers together, and they came off. He fluttered with his arms, but no feathers remained to hold the air. While his mouth uttered cries to his father it was submerged in the blue waters of the sea, which was thenceforth called by his name. His father cried, "Icarus, Icarus, where are you?" At last he saw the feathers floating on the water, and bitterly lamenting his own arts, he buried the body and called the land Icaria in memory of his child. Daedalus arrived safe in Sicily, where he built a temple to Apollo and hung up his wings, an offering to the god.

 

Friday, December 17, 2004 9:41:02 AM (Eastern Standard Time, UTC-05:00)  #    Comments [5]  | 
 Monday, December 13, 2004

Frodo: What are we holding on to Sam?
Sam: That there's some good in this world, Mr. Frodo... and it's worth fighting for.

My blog just crossed 10 thousand unique visitors. Yippie!

Monday, December 13, 2004 3:30:52 PM (Eastern Standard Time, UTC-05:00)  #    Comments [20]  | 
 Monday, December 06, 2004

With unknown consciousness, I possessed in my grip

A magnificent mantelpiece, though its heart being chipped,

Noticing not that I'd already slipped

To a sin of love's false security.

 

From silhouetted anger to manufactured peace,

Answers of emptiness, voice vacancies,

Till the tombstones of damage read me no questions but, "Please,

What's wrong and what's exactly the matter?"

 

And so it did happen like it could have been foreseen,

The timeless explosion of fantasy's dream.

At the peak of the night, the king and the queen

Tumbled all down into pieces.

 

Listening to Dylan again

 

Ah, my friends from the prison, they ask unto me,

"How good, how good does it feel to be free?"

And I answer them most mysteriously,

"Are birds free from the chains of the skyway?"

 

                        Bob Dylan, Ballad in Plain D, 1964

Monday, December 06, 2004 1:17:42 AM (Eastern Standard Time, UTC-05:00)  #    Comments [7]  | 
 Friday, December 03, 2004

Common Larceny

Common Larceny is a Scheme runtime implementation on the Common Language Runtime.  One more chip in the usage of dynamic languages on the CLR. More details of the project here -

http://www.ccs.neu.edu/home/will/Larceny/

 

Robotics4.Net

Robotics for .Net is run by a bunch of geeks who have robots and API that run on .Net. I had been out of touch with Antonio Cisternino for while after our discussions on implementation of closures in C# and further… It looks like Antonio has been making brilliant use of his time since then. Among other goodies on the site you would find Antonio’s Annotated C# language and something that said that its VC++ API for controlling Robosapien that runs on a WinCE box.

http://robotics4.net/default.aspx

 

Spamming the Spammer

This actually sounded nice. Worth a look - discusses a screen saver from Lycos that discourages spammers by spamming their servers using unused bandwidth.

http://news.bbc.co.uk/1/hi/technology/4051553.stm

Friday, December 03, 2004 5:11:54 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 
 Thursday, December 02, 2004

Here is another command line tool. Strangely, a couple of quick web searches could not come up with a command line tool for resizing images – so I wrote my own. If you have photographs from a digital camera that you want to mail out and the images are too large for email then most of the time it involves taking each image to some sort of image editing software and resizing them and such.

 

Image Manipulation Utility v0.1

(c) Roshan James, Dec 1 2004

 Img v0.1 is built on the .Net 2.0 GDI+ API and supports only creation

 of JPG image files. Exif/Iptc metadata are lost during convertions.

 

Syntax:

     imgmanip [/S] < filepattern> [additional patterns] < image size>

         /S               - recurse subdirs

         < filepattern>    - any wildcard combination

         < image size>     - format < Width>x< Height>, Ex: 800x600

 

(Don’t tell me it looks cheesy – I know it does – but it solves the problem)

A part of this source I found on the web, so appropriate mention is given to the original article.

 

Here are a few usage examples

 

> img *.jpg 800x600

File1.800x600.jpg

File2.800x600.jpg

This basically converts all jpf files to images of 800 * 600 resolution.

 

To recursively change

> img /S *.jpg 800x600

File1.800x600.jpg

File2.800x600.jpg

Simple?

 

If the original images have any metadata information then they are not retained in the new ones. What is this? Well most cameras insert information about the camera into the image file. You can also add your custom information like a title or description or comments to the image. To see this information (on a WinXP) simple right click the image file and take a look at the properties -> summary tab. Also if you tinker around with the column settings of explorer in detail view you can display some of this info directly in explorer.

 

I can think of a bunch of simple useful things to add – format conversions, cropping, borders, grayscale etc. Lets see…

 

The code is simple usage of .Net GDI+ API. The download exe is compiled to .Net 2.0 – but you can recompile from source to the version you want. For compilation run the following from a .Net SDK 2.0 command line –

>csc img.cs

 

Download

 

Speaking of image metadata, if you are a Ruby programmer, take a look at the exif library available. EXIF is a metadata tagging standard for image files.

http://raa.ruby-lang.org/list.rhtml?name=rexif

Thursday, December 02, 2004 1:14:33 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 
 Wednesday, December 01, 2004

Digressing from the past couple of posts - I just wrote this little utility for myself that will do file encryption/decryption from the command line. I figured that some of you might also find this useful so I am sharing it out here.

 

File Encryption/Decryption utility v0.1

(c) Roshan James, Dec 1st 2004 
 Enc v0.1 uses 256 bit Rijndael encryption to give a relatively strong

 encryption for data. The utility is built over the .Net 2.0 Crypto API.

 

Syntax:

     enc +< password> < filename>

         to encrypt a file

     enc -< password> < filename>

         to decrypt a file

     enc ?< password> < filename>

         to view fileinfo

 

This is no rocket science – simple usage of the API - but gives you reasonably good locking and a handy tool. The 256 bit Rijndael encryption implies that you can provide a password that is upto 16 chars in length. The encryption algorithm is a symmetric one – which means that you use the same password to decrypt the file.

 

This is also very rudimentary – no error checks and blah done: just enough code to get the job done.

 

Usage:

 

This is how you encrypt a file

> enc +password foobar.txt

Creating:2004-12-01--1206711.enc (foobar.txt)

 

It creates a new file called ‘2004-12-01--1206711.enc’ using the current date-time. This file is always a few bytes larger than the original. To extract the foobar.txt again you would say –

 

>enc -password 2004-12-01--1206711.enc

 

If you did not wish to extract the contents of an enc file, but you just what to see what file it contains, you say –

 

>enc ?password 2004-12-01--1206711.enc

2004-12-01--1206711.enc ==> foobar.txt

 

The exe here is a .Net 2.0 executable. The source is also there, so you can compile under your pet version of the runtime.  To compile

> csc enc.cs

 

And of course, it can encrypt any kind of file.

 

Download

 

Let me know if you want some simple switches/features added.

Wednesday, December 01, 2004 7:31:45 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 
 Monday, November 22, 2004

Over the months I had slowly lost touch with Scheme, with so much happening in life. Today I saw some scheme code again and somehow just looking at it made me happy. Some kind of inherent simplicity in seeing those brackets and that indentation style – something vague familiarity of old friendship. It was weird.

 

No no, I am not cracking up and I am still a good old pure imperative languages programmer at heart and yes (Small talk guys please stand to the corner), I believe that C++ is a OO language and I still like .Net and C#. But all said and done, I think I like scheme – need to get back to some old scheming as soon as time allows.

 

Digressing - been musing about dynamic languages a bit more. The real reason I have not been writing too much about it is because of the feeling that I am going to sound stupid because I don’t know enough. I think I am going to let go of that and take the risk of looking foolish for a bit and start writing down things as I go ahead.

 

Here is a bunch of things that could/would fall under the general umbrella of the lose term – dynamic languages –

1)       closures

2)       iterators

3)       coroutines

4)       continuations

5)       mutable types

6)       typeless variables

7)       dynamic method dispatch

8)       eval

 

I don’t want to get into method dispatch and sub-classing mechanisms here, but I think the above is a general list. Any biggies I have missed? Lets see if there are any appropriate mappings we can find in the CLR and such.

 

The iterators and closures are solved problems – or atleast are largely solved problems in C# 2.0 (yes I know we can’t do ref variables – I think that’s ok for now – I will be happy if you have an answer)

 

There are solutions to most of the others lying around in one way or the other in Jim’s IronPython and the lesser loved Jscript.Net compiler that ships in source form with Rotor.

 

Does anyone know where I can find a readable description of how a scheme compiler (not interpreter) would work?

Monday, November 22, 2004 8:51:44 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 

Dynamic Languages on the CLR – Part 1

 

Today I came across a paper written in 1996 at MIT that spoke of Dynamic Languages implementation on the JVM. The paper is an interesting read and pleasant because it isn’t dotted with arcane notational jing-bang and actually talks about real implementation issues.

 

The paper is written by Olin Shivers of MIT, interesting person – ha ha, actually this is the real link.

 

The first section address the issues of optimization of small scalar data types like integers which cannot actually afford to have dynamic lookup. The solution he proposes entails an assumption to be imposed on pointer types – so that small values can be held immediately rather than via indirection. For this purpose he recommends the addition of a type called an ImmediateDescriptor. I could not help smiling because this seems so much like a solved problem in the CLR of today – value types.

 

The second big issue that the paper brings is one of custom operations that a particular language may require that the runtime may not support. I don’t really have an answer for this. The paper goes onto compare this as being the inherent contradiction between RISC and CISC systems and adds the angle of safety of the end programming construct. This is by far a brilliant piece of thinking and these are the two suggestions primarily

1)       Build it up in API

2)       Enable the VM to have an extendable instruction set – similar to micrcodes in a processor

a.       Enable compilability of such new instructions by compiling to a lower level more RISC instruction set than the high level instruction set of the runtime…

 

I am hoping to offset this second part by not affording extensibility in the runtime and instead believing in some magical set of primitives. I don’t know about work that is actually being planned by the CLR team in this regard, I wonder what they are planning.

Monday, November 22, 2004 3:45:54 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |