Sunday, April 06, 2008

I was speaking with a friend the other day and we were talking about the interaction of effects and how to explain them.

One informal way to explain some additions to languages are that they are scale down localized structured versions of features that were largely available for the whole program. Let me explain: Did you start programming with an imperative language with global variables? (There is one called C that affected the minds of many people.) When you switch to an object oriented language, someone might have explained to you that there is no longer any need for real global variables. You may make these wannabe globals members of a class. You can turn methods that need the globals into members of that class as well. So they are global as far as the methods in question go, but they are not truly global.

In much the same way, we can explain yield. Programming languages have always had input and output operators - scanf-printf, gets-puts etc. However these operators are global with respect to your program. When you execute a printf, it is the output of the whole program, not of any one part of it. Yield on the other hand can be thought of as a localized input output operator. You can yield values from one part of the program to another part of the program. You get input from one part of the program. A method that yields is a packaged up opaque entity, a little sub-program, that communicates using yield with its consuming-context, the rest of the program.

We can explain exceptions in this way as well. In the absence of exceptions when there was a fault, the whole program would come down. It would core dump, modulo global error handlers. The whole machine does not come down, just the program that faults does. The environment that hosts the program may realize that there is a fault and do something about it. Its much the same with exceptions, but with the difference that only a part of the program "core dumps". Its a localized failure of the program that the environment (the rest of the program) can handle (or not handle, thereby making it a global failure).

So can you play this game or any other global program features, turning them into powerful localized structured operators?

Sunday, April 06, 2008 9:55:25 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 
 Saturday, March 22, 2008

image

Never underestimate the stupidity of people. Over many years, I believed my bar had fallen sufficiently low enough that not very much surprised me. Then along comes something like this!

ps. Sid, if you are reading, this is your doing: After that link from your blog about PZ Myers, I ended up wasting a major part of my evening browsing around looking at the foolishness. Thanks!

pps. What does the blog title mean? Its the from the banner of the "Landover Baptist Church".

Saturday, March 22, 2008 9:07:27 PM (Eastern Standard Time, UTC-05:00)  #    Comments [4]  | 
 Wednesday, March 19, 2008

fund0232[1]

After talking to Pooja, I felt it necessary to mention the great mathematician G. H. Hardy on my blog. Hardy is most famous outside of mathematics for his "A Mathematician's Apology". The book, written in later in life by Hardy, talks among aother things about how mathematics is young man's game. He is also somewhat know for his association with Ramanujan and for being the person responsible for bringing him to Cambridge where his greatest mathematics unfolded.

Quoting one of the mathematicians, C Snow, that Hardy worked with:
http://www-groups.dcs.st-and.ac.uk/~history/Biographies/Hardy.html

A mathematicians apology is, if read with the textual attention it deserves, a book of haunting sadness. Yes, it is witty and sharp with intellectual high spirits: yes, the crystalline clarity and candour are still there: yes, it is the testament of a creative artist. But it is also, in an understated stoical fashion, a passionate lament for creative powers that used to be and that will never come again. I know nothing like it in the language: partly because most people with the literary gift to express such a lament don't come to feel it: it is very rare for a writer to realise, with the finality of truth, that he is absolutely finished.

Hardy was a sort of purist mathematician, one who did his mathematics not for the sake of its applicability to anything, but for the sake of doing great mathematics. Hardy, along with Littlewood and Ramanujan,  is also mention in Apostolos Doxiadis' "Uncle Petros and the Goldbach Conjecture". The link above gives a short summary on his life.

Some quotes:

Asked if he believes in one God, a mathematician answered: "Yes, up to isomorphism".

http://en.wikipedia.org/wiki/G._H._Hardy:

It is never worth a first class man's time to express a majority opinion. By definition, there are plenty of others to do that.

A mathematician, like a painter or a poet, is a maker of patterns. If his patterns are more permanent than theirs, it is because they are made with ideas.

Wednesday, March 19, 2008 12:50:42 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 
 Monday, March 17, 2008

IMG_2834

Aaargh.... Its shaped like a card but its not to be carried in you wallet. Otherwise the top layer just comes off! And guess what, that's the layer with your name and number and photo on it. Seriously, would it have killed them to make these cards of a slightly better quality? What did they save by creating the cheapest possible kind of card?

Now before you ask me why I cant use the license as an Indian government issued id, let me tell you - that's because its cracked too. It cracked within the first month of my getting it. And no, all the other cards in my wallet are just fine. The govt issued ones are just cheap manufacturing quality.

Monday, March 17, 2008 10:42:57 AM (Eastern Standard Time, UTC-05:00)  #    Comments [10]  | 
 Sunday, March 16, 2008
IMG_2822

Its fun to play with light. Light has so much color and "texture". I bought this strange looking glass bowl at an antique shop. They were selling it as an ashtray. I figured I could use it to hold candles. 

Sunday, March 16, 2008 10:45:42 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 
 Friday, March 14, 2008

This Tuesday I finally got my driving license in the US. Well, I technically don't have the license itself yet - it will be mailed to me eventually. Since I had a rental car at my disposal, Kyle and I decided to take a little photography trip. We drove to Lake Lemon, a few miles from Bloomington.

image

We reached the lake a little before sunrise. It had been years since I saw a sunrise, and the quality of the light was just fascinating. Its true what professional photographers say - there is quite nothing like the morning light. Also, wild geese make lovely subjects.

IMG_2457

I usually don't shoot in black and white. Kyle almost always does. Here is my attempt to look vaguely Ansel Adams-ish. The picture below looks a lot better in full resolution. So the hi-res version of the picture is uploaded, you just need to click on it.

 

IMG_2537

Finally, to add a bit of color, here is Lake Lemon a few minutes before sunrise. This too is better hi-res, but in the interest of server space I am uploading only the little version here.

IMG_2283

Friday, March 14, 2008 1:27:34 PM (Eastern Standard Time, UTC-05:00)  #    Comments [7]  | 
 Sunday, March 09, 2008

Graffiti-2   Graffiti-6  Graffiti-1-3

  Graffiti-1-2

Graffiti-7 Graffiti-5

Sunday, March 09, 2008 7:19:43 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 

Most photographers I talk to, who are hobbyists like me, act a little strange when the topic of post processing comes up. A manner that is rather reminiscent of a stupid friend letting slip something in front of your parents. They look a little squeamish and then they start to feign innocence. "I never post process my pictures", "Oh! that's how it came out of the camera", "I want my photos to be *real*", "Only minimally, just yadda yadda yadda..." etc.

What?

What are you all uptight about? What's the big deal? Do you realize that when you take a digital photograph there is a lot of software in the camera making choices for you already? I haven't done much (if any at all) post processing so far, not because I have anything against it, but because of (1) I don't have the tools and (2) It takes too much time. I do have Picasa on my machine and every now and then I have tried boosting saturation on a picture or cropping out an annoying detail and have felt good about it.

The problem with Picasa is that it doesn't allow much control over things and I still end up wasting a lot of time if I ever start playing with it. Many many years back I had access to a copy of Photoshop and that program simply made me feel stupid - I couldn't get it to do anything. I remember Abdul Rafeeq who was in my undergrad engineering class and was a wiz with Photoshop. Rafeeq used to design all our posters and such, so I had first hand evidence of the fact that the tool was powerful in the right hands. (The only image manipulating program I felt good about was Gimp - the fact that I never installed it and that I never really used used it, made me feel really good about myself. Once in a while I'd find some poor soul struggling with it and feel a deep satisfaction that it wasn't me.)

Enter Adobe Lightroom. Lightroom is a post processing tool designed primarily with the interests of photographers in mind. The tool is designed to let you select and organize pictures, do a decent set of color corrections, tone fixing etc type operations that most photographers are interested in.

I downloaded a copy a few days back on the 30 day trial period and I like it. Its a bit slow, not as responsive as Picasa, but is otherwise rather nice. After playing around with it a bit, I must say I like the added power to fix the color settings of my pictures. Being able to boost color in your pictures (or de-saturate them) is an added dimension of power. Of course, it cant make a bad picture good, but it does compensate for the color of the light, the white balance settings, the nuances of your cameras sensor etc. As a matter of fact, once I get comfortable with this I suspect I will be able to get the look I want without much trouble as well.

image  image

Comparing the detail of someone's forehead. Which one do you think came out of the camera and which one is the post processed version? The odd looking reddish hue, the one on the right, is the version that came out the camera.

The downside? The several hundred dollar price tag. Its cheaper than Photoshop but its a bit too much for what the PhD program pays me.

Sunday, March 09, 2008 1:44:40 AM (Eastern Standard Time, UTC-05:00)  #    Comments [4]  |