Saturday, October 16, 2010

Melville's First Incompleteness Theorem

I promise nothing complete; because any human thing supposed to be complete, must for that very reason infallibly be faulty.

These are Ishmael's words from Herman Melville's Moby-Dick (Chapter 32). This reminds me of Gödel's First Incompleteness Theorem, though broader in its implications. I'm going to call this Herman Melville's First Incompleteness Theorem!

Tuesday, October 12, 2010

The Most Disturbing Novel I've Ever Read

The last two days weren't fun. I spend all of my commute time listening to audio books, and the book I've been listening to in the last two days was Digital Fortress, by Dan Brown. Disturbing book, that one is. I've read all of Brown's other books. Da Vinci Code, The Lost Symbol, and Angels & Demons I loved. Deception Point was fine, though its many scientific inaccuracies somehow marred the experience. Digital Fortress, Brown's debut novel, was completely another matter. Inaccuracies are so wild it causes physical pain to those who understand the subject matter, namely computers and cryptography. Here's a list of only some of the problems and inaccuracies of the novel:

  • When reading The Da Vinci Code, I got the impression that Dan Brown doesn't know what public-key encryption is. The name was used merely in passing however, and I thought that maybe it was only a mistake.

    Oh, I was so wrong. Here, Dan Brown actually "explains" (or rather fails to explain) public-key encryption. What he describes is just plain old symmetric encryption. The brilliance of public-key encryption is using two keys each of which can decrypt what is encrypted by the other one. One of the keys is (widely) distributed and is called, wait for it, the public key! The other is not distributed at all. If I want to send someone a secret message, I simply encrypt it with their public key, knowing that it can only be decrypted by the intended party. This way, there is no need for communicating a "pass-key" at all.
  • "Simple syntactical errors--such as a programmer mistakenly inserting a comma instead of a period--could bring entire systems to their knees."

  • Plain wrong. Programs with syntactical errors don't compile and run at all.

  • "Numataka could embed the algorithm in tamper-proof, spray-sealed VSLI chips..."

    Come on! At least get the name right. It's VLSI (Very Large Scale Integration). Is it so hard?

  • '"When the denominator's zero," Midge explained, "the quotient goes to infinity. Computers hate infinity, so they type all nines."'

    Not so. Dividing by zero usually causes an error, and even in systems in which infinity is represented by the maximum integer, you get all ones (in binary) not all nines.

    Also, computers don't type, people do.

  • Firewalls are not like brick walls. Breaking a firewall, means to find a weak point in it and use it to open a way in or out. The final chapters of the book in which the firewalls of the NSA are gradually breaking down are simply ridiculous.

  • The novel is mainly built around the idea of an unbreakable code. Unbreakable codes do exist, though they are rarely used in practice, but unlike the novel says, an unbreakable code is a code which absolutely cannot be broken unless you have the key. You can use brute-force even with unbreakable codes.

  • As far as I know, the Nagasaki bomb was a Plutonium bomb. The book claims this is a widely accepted misconception. I looked up different sources and they all corroborate the fact that the Nagasaki bomb was indeed a Plutonium bomb.
Apart from inaccuracies, there are other things I didn't like about the book.

  • Misrepresenting the EFF. Disgusting.

  • Characters with an IQ of 170 who, when the cheesy story-line demands, can show the IQ of the average chicken. Or killers who always get their target but fail to do so, repeatedly, by making rookie mistakes when it comes to killing a protagonist.

  • There are real-world stories about NSA putting back doors in encryption mechanisms (especially in Windows encryption code). No matter these are true or false I was horrified to see that Brown (well, his protagonists) actually defend the idea.
Both the lists can go on and on. Maybe the reason I enjoyed Da Vinci Code, The Lost Symbol and Angels & Demons was, after all, the fact that I know very little about symbology and art history. Maybe there are art historians who tremble when reading those novels.

The moral of the story: If you are not William Gibson, you cannot write wildly inaccurate novels and expect people to like them!

Saturday, September 18, 2010

Why We Love Harry Potter

I just finished reading Ursula K. Le Guin's A Wizard of Eearthsea. The story is beautiful, and the prose nothing less than masterful, yet I felt something unappealing about it. Now, I try to read books critically, since I have always dreamed of once becoming a good writer myself (or at least a normal one!), so I'm trying to figure out what it is that makes me love Harry Potter stories so much, while this one is only interesting to me. This is what I came up with.

Though both stories are told by third person narrators, Harry Potter's narrator is much closer to the main characters. The narrator shows us the story as the life of Harry and his friends progresses, telling us about all the interesting things that happen around them in detail. The narrator of A Wizard of Earthsea on the other hand, is more distant from the protagonist. I simply can't fully feel for Ged. Of course, in many parts of the story I really, really hate Harry and the other protagonists, but the simple fact that I do have a feeling (although it is hate) means that Rowling has been successful in engaging me with her story.

Another point, and this is the more crucial one I believe, is that Rowling uses much less exposition in her books, than Le Guin does in hers. Though Le Guin's prose is much better than Rowling's, still someone is telling me (albeit in a wonderful prose) what is going on all the way through the story. In Harry Potter, I simply see events as they unfold. Following the old "Show, don't tell" advice here makes Rowling the clear winner.

This is more of a reminder to myself. When I write a story, I want to be able to enjoy reading it like I do when reading Harry Potter. Indeed, aside from Stanislaw Lem's The Invincible, there is no other book I have read over and over again more than Harry Potter books.

So dear Homayoon, if you want people like your stories, read Harry Potter even more, and learn showing your readers what is going on. Avoid exposition at all costs!

Monday, July 05, 2010

Crazy Iranian Copyright

Like everything in Iran, our copyright law has always irrational and haphazard. Up until now, the copyright law for books was retained for the heirs of the author for thirty years after his death. Also, a work is not automatically copyrighted like in most other countries. It has to be registered (typical Iranian bureaucracy), and that means a book cannot be copyrighted unless it is approved by the authorities. Lately however, the crazy law has changed again into something even more insane.

The Iranian legislators changed the copyright law by removing its time limit entirely. From now on, any copyrighted work will be the property of the creator and his/her inheritors indefinitely. And if at any given point of time, there are no more inheritors, the copyrighted work will be passed on to the supreme leader! So we should forget about a Project Gutenberg equivalent for Iranian works. The ISNA report rationalizes the passing on of the work to the supreme leader as "for public use," that is the work will be owned to the leader so that he can use it "for the public benefit" as he sees fit. Again here's a typical behavior of the Islamic regime. Instead of passing something directly to the people (as in other countries in which the work goes to the public domain after a certain amount of time), it is handed to the authorities, because they see themselves the only ones who know the good of people.

UPDATE: A friend told me that the law has been vetoed by the Guardian Council, though I can't find any sources to corroborate the story.

Sunday, July 04, 2010

Gods and Atheists

[T]he gods had a habit of going round to atheists' houses and smashing their windows.

--The Colour of Magic, by Terry Pratchett


If only gods did that in our world too (or kept on doing that for the last millennia or so), a lot of doubts concerning their existence would vanish.

Note to terrorists and extremists: No. You doing that in their place, even if it's by the will of God/gods, doesn't prove anything.

Friday, June 18, 2010

Hijab Ticket

Somebody posted this today on Facebook (http://www.facebook.com/photo.php?pid=31103525&id=1083203360):


It's a ticket in the amount of 22500 tomans (around US$22) for failing to observe the Islamic modesty code. If you want to know what kind of looks can get you in trouble in Iran, here's what it reads.

The table at the left lists the possible charges:
  1. Eye-glasses over the head: 18000 tomans (US$18)
  2. Short manteu: 25000 tomans (US$25)
  3. Bright-colored manteu (especially green or red): 25000 tomans (US$25)
  4. Nail polish: 5000 tomans (US$5) per finger
  5. Tanned skin: 25000 tomans (US$25)
  6. Light-colored hair (depends on the color): from 50000 to 150000 tomans (US$50 to US$150)
The right sections contains information about the offender and the person/group who issued the ticket.

It's sick; that's all I can say.

Friday, May 14, 2010

An Old Generation

I take up space,
therefore I am.
A celebration,
for the birth of a volume,
for the birth of a lined mind,
for the birth of a striped imagination.
Is this a 27th birthday, or a 1000th birthday?
I feel old.
A ship takes me to the end of the world;
and I fall into a fish tank.
The stupid fish swallows me,
and in its belly, I blow out 27 lit candles.
And again there's darkness.
In the darkness,
I blow out
the blown out candles,
the dead moments,
and the youth gone.
I'm still blowing. I become empty, and emptier.
like a wandering balloon.
Translated from wall photos of a friend of a friend on Facebook. I like it, because like many twenty-somethings in Iran, I already feel old.

Sunday, May 09, 2010

Explosion Engineering

In a time when many people around the world think that Iranians train suicide bombers in other countries (and they're probably right), how do you think I feel when I walk into the university and find white flags everywhere saying "Explosion Engineering?" (the red large text in the photo)


Okay, granted. Apparently this is a valid engineering discipline, and I think the right non-literal translation would be "explosives engineering" but still it feels weird.

Thursday, April 15, 2010

Information Junky

So yesterday I arrived at work and found out that we don't have an Internet connection. A colleague of mine and I tried to fix the problem but after checking everything we decided that the problem was from outside our network. We just had to wait till somebody else arrived who could fix the problem. I sat at my desk and since there was nothing I could do without an Internet connection I just started killing time doing whatever I could do with a computer without Internet.

Ten minutes later I found out I was just looking through openSUSE software catalog, reading descriptions and finding about software packages I didn't know about. I stopped for a moment to think about what I was doing. It appeared that I could do nothing else besides going through some sort of information. Had I become an addict to information? It certainly appears so. I've noticed that if I'm not reading something on the Internet, I feel numb and anxious. I have tried it. I've tried getting out of my chair, trying to practice Piano, read a newspaper, call a friend or do anything besides killing time on Wikipedia, and I immediately feel I want to get back at my computer and forget about everything else.

This can be at least part of the reason why my grades have fallen lately. I don't study, so what can I expect? My advisor and my instructors are not happy with me. I seem to need to refocus.

Alcoholics and drug addicts have support groups to help them quit. I haven't heard of a support groups for informaholics. Maybe I can find something online. :) You see even now that I feel I have a problem I'm blogging about it! There's something seriously wrong with me. I need another big dose of information to calm down!

Saturday, April 10, 2010

Teabags and Cigarettes: The Legend of a Cafeteria

I spent six years of my life to get my bachelor's degree at IUST (Iran University of Science and Technology, or Elm-o-San'at). If you ask me what is the most vital part of IUST life, I will answer "the cafeteria;" there is no doubt about that. Others seem to agree with me. In just a few days the IUST cafeteria page on Facebook has more than 550 fans, and counting. (This is also a testimony to the fact that the government censorship of the Internet has practically no effect. Facebook is blocked, but everyone is on Facebook.)

We're talking about the boys' cafeteria of course. In Iran there are separate cafeterias for the boys and the girls. The girls sometimes came to our cafeteria though, but I never saw the girls' cafeteria during all those years. A female classmate of mine once told me that their cafeteria more like a dungeon. The girls never seemed to find their cafeteria very important. As to the the boys', the complete opposite was true. The cafeteria had sort of a religious importance to us. We used to joke that it's a "vajeb" (Islamic mandatory) to show up at the cafeteria everyday.

The quality of the food served at the legendary cafeteria was poor, so what was so interesting about it? I have two words for you, teabags and cigarettes. Of course, cigarettes weren't sold in there, we had to buy it from outside the campus. But then, we would come to the cafeteria, get teabags and hot water in paper cups, sit with our friends (and there were always a few people we knew in there) and kill endless time talking about trivial things.

That's all I miss now from my IUST days: a cup of tea, a bag of cigarettes and a few friends to kill time with forgetting everything else in our life.

Sunday, March 14, 2010

A Crazy 50000-Word Month

A month ago I started this crazy idea to write a 50000-word novel in one month (the same idea as the one behind the National Novel Writing Month). I'm proud to announce that I succeeded. It's not a great or even okay novel, that was never the point of this practice. The only point was to write a 50000 novel (or at least a 50000 word text of fiction) and I did it.

The story didn't go exactly as I had planned it in my mind. Most of the characters just emerged as I was writing. In the whole, I think it was a worthy practice. As I said in my previous post, I didn't use Persian, my native language, but English which is my second language. I am very confident with my command of English, but I found out that I know only so much. There were several occasions that I had trouble putting what I had in my mind into words. Sometimes I had even trouble wording what I wanted to say in Persian. I didn't do this very frequently though, as I believe that during every translation parts of the meaning are lost and so if I'm writing in English I think in English. The trouble is, I have a very visual imagination. I make pictures of what I'm thinking in my mind, I see them clearly but I have trouble putting them into words, describing them as I see them clearly. If there's one thing I learned from this exercise, it was that I need a lot of more practice describing events, things and especially people. This last one has always been troublesome for me. If someone asks me how someone else looks like, I'll be totally at a loss as to how to describe them. I see the other person clearly in my mind, but I just don't know how to describe the image.

I'm not going to despair though. Many great writers wrote their first great novels in their fifties or sixties. I still have time. Who knows I might be one of them one day.

And as I promised to myself, I am not going to let anyone see what I've written. It's just embarrassing. It can wait. Maybe I'll be later able to rewrite the story in a better shape, or recycle it in another work.

One of my major reasons to undertake this crazy adventure was to quantize my knowledge of English vocabulary. I used this simple Python program to count the words.
import sys

filename = sys.argv[1]
text = unicode("")

with open(filename, "r") as f:
text = f.read().lower()

new = ""
for ch in text:
if ch in "abcdefghijklmnopqrstuvwxyz ":
new += ch
elif ch == '\n' or ch == '\x0c':
new += ' '

text = new

words = text.split()
u = set(words)
print sorted(u)
print len(u)
When I give my novel as input to this program, I get 4082 words. So how does that compare? Let's see how many words are there in some other works of fiction. To be fair, I take the first 268458 characters of these novels (that's the length of my own novel):

Lucky (my brilliant novel!): 4082

Harry Potter and the Sorcerer's Stone (J. K. Rowling): 4980
Poison Study (Maria V. Snyder): 5857
Magic Study (Maria V. Snyder): 5304
Fire Study (Maria V. Snyder): 5278
Twilight (Stephenie Meyer): 5433
New Moon (Stephenie Meyer): 5421
The Door into Summer (Robert A. Heinlein): 6011

So I know about as much as 82 percent of J. K. Rowling's vocabulary, 74 percent of Maria V. Snyders's, 75 percent of Stephenie Meyer's and 68 percent of Heinlein's. Impressive! (All right, I know that's probably a very weak measure, but it's a measure anyway, and I like numbers.)

Monday, February 15, 2010

Words, Vocabulary, and the One Month Novel

I'm into languages. No doubt about that. And I am an engineer, so I have a love of numbers, too. It's been for some time that I've been wondering about words and vocabulary. How many words are there in a work of fiction for example. I mean how many unique words. Is there any difference between different languages. I've been wondering if there are more words used in English than in Persian. I'm not talking about how many words each language has, or how many words can be made, but how many are actually used.

And then, there is the more difficult question of the difference between speaking and writing. In Persian, the written language is quite different with the spoken one. It is another question I've been wondering about. Aren't there more Persian words spoken than written. It seems so to me, but being an engineer, I need proof. I need numbers and graphs.

The third question I have is my own vocabulary. How many words do I use? How many words can I use? Is my vocabulary as vast as I like to think it is?

The second question is rather difficult, and I don't have a solution for it. The first and the third are easier to approach. Of course, there are still difficulties. What is a word? Are plan and plans two words or one? What is English? What is Persian? The boundaries of languages is not very easy to define either. Still, since I want to make comparisons the exact definitions and the exact numbers are not important. I can consider plan and plans two separate words, or the same word, using the same approach for different inputs and the results remain fairly comparable.

I'm going to plan a few experiments which I might write about later, but I am going to start a related project for now which I can later use as an input to my other experiments. My current project is writing a one month novel. The same idea behind NaNoWriMo. If you are not familiar with NaNoWriMo, it is an annual competition to write a 50000 word novel in one month. It takes place every November, and since I'm not going to wait until next November, I'm doing it now on my own. I started on February 12, and I'm going to finish it by March 14. NaNoWriMo winners are all those who have finished their work. There is no emphasis on quality, just quantity, so that's what I'm going to do, too. I've written 8750 words by now. It's not a great story, but if I can finish it, at least I have a rough draft of my very first novel.

If you're wondering how the hell someone is supposed to write 50000 words in one month, you might want to read Chris Baty's No Plot? No Problem! I'm sure you'll enjoy it even if you don't want to write a novel ever.

If you're curious about my story, it's called Lucky (working title) and it's about a boy who finds out he is luckier than the average person. I intend it to be a fantasy novel (since I am a HUGE fan of fantasy) but it can go anywhere from where it is. Here's a few paragraphs from the first chapter titled The Monster.

My friends used to think that I cheat. Even I sometimes thought that I cheat. What else could it be? Luck? That was one theory, but not a very likely one. Lucky people, apart from me, are only stuff of legends. You hear people saying, my cousin Farsheed, is such a lucky man. Anything he touches becomes gold. He buys a house, and tomorrow real estate prices skyrocket. He sells his house, next thing you know we are in economic depression. But these are legends. If you get to know the said cousin, you will find him a man with great economic sense. He buys and sells not randomly, but calculatingly. Not me. For me, it happened like this. A friend would invite us to play Mensch. We would start by rolling the die, and I was usually the one who got the six first. As the game continued, my friends used to find that I'm likely to get a four, if one their pieces is four fields ahead of mine, and a five if its five fields ahead. Mensch is supposed to be a game of pure chance. No thinking is required. Nothing serious. Just play and enjoy. But when I am involved, everything changes.


That was why I got less and less invitations to play with my friends. They didn't like to play a cheater. At first I tried to explain, that I can't explain why it is happening. “Freak accidents happen,” I used to say. I didn't add that they tend to happen around me a lot more often, and they're usually to my advantage.


They didn't buy it. “You're cheating.” They used to say, “You're not supposed to get a six right at the beginning of the game.” Not that they knew anything about probabilities. They were believers of the Murphy's Law, though they didn't like it when they were always the ones to be the victim of the Law.


But games of chance were not the only reason I got separated from my friends and classmates. At school, teachers only tended to pick me when I was prepared for the topic. It rarely happened that I was not ready and teacher would ask me a question. On the rare occasions that it did happen, I saw triumphant looks in my classmates' eyes.


So, school wasn't at all fun for me. When I started college, it was with a relief to start a new life, with new people that didn't know anything about my freakishness. Probability classes were the worse things in this new life. It was like the lecturer was deliberately taunting me. Dice and coins were always a touchy subject with me. Colored balls were soon added to the list. “There are eight red balls, five green balls, and twelve white balls in a bowl. Blindfolded, you take three balls from the bowl, one at a time and without replacing them. How probable is it that the third one is green?”


When I would see such questions, I was tempted to answer, “It depends on who is taking the balls.”


It was after one particularly nasty Probability class that I decided to quantify me freakishness. I guess that proves that I am a real freak. I took a coin and started to count how many tails I get and how many heads. I flipped the coin two hundred times. 109 heads, 98 tails. Damn it. So how is it supposed to happen? Then I notices two people coming. I couldn't hide what I was doing fast enough. Mohsen was coming towards me, with a huge smile on his face. I had tried to ignore him as much as I could, because he was a betting person. The ideal candidate to blow my new cover as a normal fifty-fifty person. But this time I decided the hell with it. Who cares what these idiots think about me. “I do,” said a small voice in my head, but I ignored it. Apparently he'd been watching me for some time and decided that I really was crazy. Not that it mattered to him. After all, he was crazy too. Beside him, was his annoyingly ever present girlfriend, Sima. I couldn't read the emotion on her face. Was it consent, curiosity, or something else? I couldn't tell.


So who won? You or you?” said Mohsen, “Doing some lab after class? Deciding if your coin is fair or not?”


I know. It's not very good, but remember I'm after quantity for now, not quality. If it goes well, I'm gonna find out how many English words I can use in a fairly large written work. And I'm announcing what I'm doing here, so I can't back away later. Or at least I hope I won't. Wish me luck.

Friday, February 05, 2010

Westernized

I never paid much attention to the government's "westernization" (or rather, anti-westernization) propaganda and I don't make my choices based on what is Iranian and what is not. But my current situation is beyond that. English has become an indispensable part of my process of thinking. I write my notes half in English, half in Persian. I think intermittently in English and in Persian. I even frequently dream in English! Now that is a bit too much, but not quite unexpected. I'm suspecting that I'm actually using English more than my native Persian despite the fact that I'm living in a Persian-speaking country.

I took a moment to think about my daily routine. when I'm at home, I'm usually either reading (almost always in English), or listening to audio books or music (both in English) or watching movies (again in English) or study (not very much, and in English naturally). When I'm out, and I don't go out unless it is necessary, I use Persian for communicating with others, which I keep
to a minimum. I rarely talk and I almost never listen (preferring to listen to audio books or occasionally music).

I never thought such thing could be possible. I used to think that even when people live in societies with languages other than their native tongues, their going to continue to use their first language for thinking. Now I see, it is even possible to stay in the society you've been born into, and change your thinking language. Interesting.

I think I am now officially westernized!