Feb 1, 2006

Sparklines, internship ends, MS Office XML documents

In all the furore over my new and continually-evolving design I've been neglectful of my Sparklines code. Well, the good news is I've been working on it so intensively that the current version of sparklines.doc is so much more functional than the code I've posted here that I've seriously been thinking about deleting the code from the last two sparklines entries. But hell, it's amusing to look at.

The bad news is I've been working on even more exciting stuff for the last few days -- like my blog and conversion of the bank's daily reports into parseable XML form -- that the work I'm doing on sparklines.doc has slowed to a crawl. BUT to be fair, it meets my needs fully.

I'll take a brief interlude here and talk about some of the stuff I tried to do during my internship at ONE Bank, Dhanmondi branch. It'll lead up directly to why I'm so hyped-up about MS Office's new XML file format -- and this is weird, because just a few days ago I'd have told you OpenOffice.org's XML file format is better than Microsoft's. Now I'm strongly inclined to say otherwise.

At the bank, as I (think I) mentioned in Sparklines: can't resist, they have a lot of computer-generated output put in their hard drives daily. I guess their database-querying and -reporting software is tasked to process the day's transactions and output reports on the states of the various accounts, clients and such, every night. Now these reports are in plain-text format and currently the people in my branch, whenever they need to look up some information, just open up the report files in Wordpad and do a search for it.

This simple searching of plain-text files is well and good for small-scale information needs like looking up the account number of an account holder who can't recall the number, finding the interest rates offered on different types of deposits and loans, and sometimes also finding out historical interest rates. But it quickly starts sucking up your time if you have to keep doing things like:

  • prepare a monthly report on deposit mobilisation -- that is, a tally of the people who opened and closed deposit accounts, along with their account balances, and total amount of money deposited and withdrawn thus;

  • prepare reports with tallies of amounts grouped by type (deposit/loan), interest rate, and then economic sector code, as required by Bangladesh Bank;

  • prepare credit risk grading reports;

  • create mass-mailings to send out to account-holders and prospective clients;

  • email daily lists of transactions to the companies with which the bank has bill-collection arrangements;

  • and many more types of documents that the employees of each branch routinely have to prepare.


The common theme running through all of these different tasks is: the user has to process information output from the central database(s) in different ways and create documents showing these data in a nicely formatted way. And this has to be done month after month, with a lot of the document staying basically the same -- the changing data being the newly-processed information.

To me, the processes above are screaming to be automated. And this is where Office's new XML file formats come in. From what I've read about Office's (2003 and above) capabilities in Brian Jones' blog, Word lets you define arbitrary arrangements for your data and then lets you tell it how to format and display the data. This is done through the magic of XML schemas and stylesheets. For details, check out the article. But in short, suppose you start out with some raw data you're working on, information about about some accounts:









Account IDHolder NameBalanceDebit/Credit
1234567890Mr X100000Cr
2345678901Ms Y96000Cr
3456789012Dr Z45009.87Dr

You have this data in XML format, obviously ideal because of its parseability to both humans and computers. Say, this is your XML:

<?xml version="1.0"?>
<?mso-application progid="Word.Document"?>
<al:accountlist xmlns:al="http://yawar.blogspot.com">
<al:account>
<al:accid>1234567890</al:accid>
<al:holdername>Mr X</al:holdername>
<al:balance>100000</al:balance>
<al:drcr>Cr</al:drcr>
</al:account>
<al:account>
<al:accid>2345678901</al:accid>
<al:holdername>Ms Y</al:holdername>
<al:balance>96000</al:balance>
<al:drcr>Cr</al:drcr>
</al:account>
<al:account>
<al:accid>3456789012</al:accid>
<al:holdername>Dr Z</al:holdername>
<al:balance>45009.87</al:balance>
<al:drcr>Dr</al:drcr>
</al:account>
</al:accountlist>

Now, you need a way to tell Word (or any other XML-processing program) what kind of values to expect in each field so that it doesn't goof up on bad data: the account ID should be a sequence of ten digits; the name should be a string; the balance a real number (greater than zero), and the Debit/Credit field should be either `Dr' or `Cr', and nothing else. In fact, we could really just use `d' and `c', but Dr and Cr are time-honoured abbreviations of the words. Turns out the way to do is is through another XML file, a schema definition file.

More about schemas at MSDN's Advanced XML Support in Word and the W3C's XML Schema Primer.


Schema generator at XSD Inference Demo.

More tools, including one that validates your XML file against its schema, at XML Tools.


The schema definition for our account listing should be something like:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://yawar.blogspot.com"
xmlns:al="http://yawar.blogspot.com"
elementFormDefault="qualified">
<xsd:element name="accountlist" />
<xsd:complexType>
<xsd:sequence>
<xsd:element name="account" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
<xsd:all>
<xsd:element name="accid">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="[0-9]{10}" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="holdername" type="xsd:string" />
<xsd:element name="balance">
<xsd:simpleType>
<xsd:restriction base="xsd:decimal">
<xsd:minInclusive value="0" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="drcr">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="[DC]r" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

Yes, it looks rather daunting, but it's not that hard; I whipped this schema up myself browsing through W3Schools' Schema tutorials.

The last piece of the puzzle is, how do we tell Word how to format and display our nice XML file? The answer is the standardised XML Stylesheet Language, XSL. Yet another piece of XML coding, this file instructs Word on how to create a Word XML document on-the-fly from the XML data file that you have (the accounts listing file). Let me try a whimsical explanation here. Imagine the stylesheet file is talking to Word, giving running instructions as the input file is being processed.

`Started reading the document? OK, write the heading, ``ACCOUNT LISTING''. Format it with the ``Heading 1'' style. Now leave a blank line and start a four-column table, with column headers ``Account ID'', ``Holder Name'', ``Balance'' and ``Debit/Credit''.

`Now for each <account>, create a new table row, and: put the contents of the <accid> in the first column; the contents of the <holdername> in the second column; <balance> in the third; and <drcr> in the fourth. Oh, and sort the table rows by account holder name.'

And remember, this is a Word document that is being created -- not an HTML file. Yeah, you can do all that with XSL inside Word!

As an aside, for someone like me, who cut his teeth on LaTeX and then a little bit of DocBook (SGML and XML) with PassiveTeX, Jade, Apache FOP, you name it, Word's new XML capabilities just blow me away. It looks like Word has become the powerful XML processing and transformation engine that documentation writers have always dreamed of.


Soon, I'll post the stylesheet file I've created to do the transformation, and hopefully graphical comparisons of the different views of the same XML document.

Jan 26, 2006

The Wheel of Time -- The Eye of the World

Wheeling Round and Round

Finished Robert Jordan's The Eye of the World and it was a whopper. The story itself is 782 pages. Not the longest I've read, but remarkable because the whole book is nothing more than a setup, even a leaflet, for the rest of the series. And wheels within wheels: almost the whole of the book is a setup for the last couple of chapters, where it really gets exciting.

The book as a whole is a long journey, a long series of hair-breadth escapes, interspersed with threatening dreams, drawn out but at the same time picking up more and more pace, until the explosive ending. The ending makes you want to go out and get the next book pretty much immediately.

But that's not the first thing that struck me, by far, while I was reading it. That would be the similarities to Tolkien's Lord of the Rings. Here are a basic few:
  • Two Rivers = The Shire
  • Tam al'Thor = Frodo, brings back `ring' (either Rand or the sword, or both, depending on how you look at it) from his adventures abroad
  • Fellowship sets out on quest
  • Mischievious Mat Cauthon = Mischevious Pippin Took
  • Moiraine = Gandalf
  • Lan = Aragorn
  • Sauron = Ba'alzamon
  • Fades hunting our `hobbits' = Ringwraiths
  • Trollocs = orcs
  • Padan Fain = Gollum
  • Journey to Blight = Trip to Mordor. Pack light, heroes! :-)
  • Children of the Light capture Perrin & Egwene = Faramir's gang captures Frodo, Sam & Gollum. OK, this is stretching it a bit
  • Green Man = Tom Bombadil, only sadder
  • Green Man = Ent
  • Egwene sounds like Éowyn
Um, am I forgetting anything?

Anyway, I do appreciate that there are definitely big differences. Jordan writes in more modern prose, with more short, sharp sentences for dramatic effect. Short. Dramatic. And he avoids, for the most part, Tolkien's rambling descriptions of this valley here, that nook and cranny there, that seem to go on for days. Oh, and a blessed avoidance of accented characters in names. But they're more than made up for with a liberal dose of apostrophes. Check out the names of some of the main Trolloc tribes (and I've thrown in their roots in monster names): Ahf'frait (afreet), Al'ghol (ghoul), Bhan'sheen (banshee), Dha'vol (devil), Dhai'mon (guess this one), Dhjin'nen (djinn), Ghar'ghael (gargoyle), Ghob'hlin (again, guess), Gho'hlem (golem), Ghraem'lan (gremlin).

But I digress. There is the One Power, a mystical force which comes from the True Source of the universe, drives the eternal Wheel of Time, and empowers a few chosen individuals with great power but at the risk of death and/or madness. But then again, it's like Tolkien's One Ring where it gives you power against the bad guy but the price is high. The real revelation is the turning of the Wheel of Time, where apparently the ages come and go and come again; nothing new ever happens. Civilisations rise and fall, and fall some more, in the eternal battle (you know the one, Good v Evil). Mankind continues to lose science and technology because it just can't get a firm foothold on the Earth before it's all toppled away again. Bleak outlook, really. But then I've heard there are thirteen books in this series, each one presumably as fat as the first. With that kind of length, what else could Jordan be doing but telling the story of the liberation of humanity from the yoke of the Wheel? Guess I'll have to find out. But it's what I would do.

Jan 22, 2006

New style, cont.

After a lot of high-flying coding trying to get cookies to work (to
remember which user has seen which posts and/or comments) and at the
same be compatible with Internet Explorer, I've decided to BAD (Bypass
All Difficulties) and just show the posts and comments by default,
letting users hide them if they want. Code is so much simpler, and at
the same time IE users get to at least read the posts, even if they
don't get the cool clicking and hiding/showing effects.

Jan 19, 2006

New style

After what seems like an eternity with the old ready-made style, have finally gotten down and dirty with Blogger's internals. The inspiration was Gmail's message display interface, which also led me to suggest such an interface for the next version of Thunderbird in the website maintained by the developers, here. Also led me to thinking about how to implement something like it with HTML. Plucked up some courage reading up on JavaScript, the DOM, and CSS, then gave it a try; rather aborted results can be seen here.

Then realised that Blogger's template system provides pseudo-HTML tags which automatically pull blog posts and comments out of the Blogger database -- so basically we have this big database of items which we can pull out and display, rather as if they were emails. Of course, they're a little more complicated than emails (because each post can have one or more comments), which leads to some code complexity; but on the whole it was surprisingly easy. Guess I have XML/CSS/JavaScript and their amazing expressiveness to thank for that.

One thing to note though is that the site doesn't work very well at all on Internet Explorer, even the version 6 that I have running on this XP Service Pack 2 machine. Tried a perfunctory hack to solve the problem, but hasn't worked. Oh well, will tackle it later, I guess. Meanwhile, I recommend all my beloved viewers (anybody out there? :-) use Firefox or Opera, the two best browsers available today.

Jan 12, 2006

Thunderbird rocks

Set up Thunderbird to handle my Gmail account as well as the ISP-provided POP3 account. Works great and, what's more, allows me to sign and/or encrypt outgoing messages with Thunderbird's Enigmail extension which gives Thunderbird OpenPGP support.

Also set up the BDComics RSS feed (Tools > Account Settings..., then Add Account...), making it a hell of a lot easier to navigate all the great comics links put up there.

Dec 30, 2005

Sparklines: satisfaction and disappointment

Could go into a whole diatribe about the paradoxical human condition of conflicting feelings but will keep it simple. Have achieved what I set out to do: and -- sparkline the bank's account opening activity during a given period. Well, have achieved it roughly, anyway. But generating sparklines is a big hassle: code for Office 2000 or XP and above? (2000 doesn't have a feature which makes the user's life a hell of a lot easier.) When generating multiple sparklines at the same time, scale them all to the same scale or different (as they are above)? Currently I'm coding for MSO2000, though there's no guarantee the code will actually work; and scaling to different scales even when generating in the same batch. Will have to change both these settings because the alternatives are so much more helpful.

On the plus side, wrote a clever little toolbar that manages generated sparklines -- i.e. selecting and deleting them -- almost well enough to be called a sparkline manager.

Here are the macros that pull in and parse the plain-text reports generated daily by the bank's software:

Sub inputData(fname, aDoc)
Set fso = CreateObject("Scripting.FileSystemObject")
Set fin = fso.OpenTextFile(fname, 1)
branchNamesStore = ""
openingCountsStore = ""
printingCounts = False
weHaveTabs = False

Do While fin.AtEndOfStream <> True
aLine = fin.ReadLine

Dim branchNamePoses(5)
branchNamePoses(0) = InStr(1, aLine, " BRANCH ")
branchNamePoses(1) = InStr(1, aLine, " BRANCH" + vbTab)
branchNamePoses(2) = InStr(1, aLine, " BRAN ")
branchNamePoses(3) = InStr(1, aLine, " BRAN" + vbTab)
branchNamePoses(4) = InStr(1, aLine, " BRANC ")
branchNamePoses(5) = InStr(1, aLine, " BRANC" + vbTab)

numAcctsPos = InStr(1, aLine, "OPENED :")
lineHasComma = InStr(1, aLine, ",")
branchName = ""
branchNameTemp = ""
numAcctsStr = ""

For posCounter = 0 To UBound(branchNamePoses)
If branchNamePoses(posCounter) <> 0 And lineHasComma = 0 Then
If posCounter Mod 2 = 0 Then ' No tabs in this file
i = branchNamePoses(posCounter) - 1
Do While Mid(aLine, i, 1) <> " "
branchName = branchName & Mid(aLine, i, 1)
i = i - 1
Loop
branchNameTemp = branchName
branchName = StrReverse(branchNameTemp)
branchNamesStore = branchNamesStore & " " & branchName
Else ' Tabs in the file
weHaveTabs = True
i = branchNamePoses(posCounter) - 1
Do While Mid(aLine, i, 1) <> vbTab
branchName = branchName & Mid(aLine, i, 1)
i = i - 1
Loop
branchNameTemp = branchName
branchName = StrReverse(branchNameTemp)
branchNamesStore = branchNamesStore & " " & branchName
End If
ElseIf InStr(1, aLine, "HEAD OFFICE") And lineHasComma = 0 And Not InStr(1, branchNamesStore, "HEADOFFICE") Then
branchNamesStore = branchNamesStore & " HEADOFFICE"
Exit For
End If
Next posCounter

If numAcctsPos <> 0 Then
i = numAcctsPos + 9
Do While i < Len(aLine) + 1
curChar = Mid(aLine, i, 1)
If weHaveTabs Then
If curChar <> vbTab Then numAcctsStr = numAcctsStr & curChar
Else
If curChar <> " " Then
numAcctsStr = numAcctsStr & curChar
Else
If Len(numAcctsStr) >= 2 Then Exit Do
End If
End If
i = i + 1
Loop
openingCountsStore = openingCountsStore & " " & numAcctsStr
End If
Loop
fin.Close

branchNames = Strings.Split(Trim(branchNamesStore))
openingCounts = Strings.Split(Trim(openingCountsStore))
Debug.Assert UBound(branchNames) = UBound(openingCounts)

For Each par In aDoc.Paragraphs
docLine = Mid(par.Range.Text, 1, Len(par.Range.Text) - 1)
If docLine = "\begin{acc_opening_counts}" Then
printingCounts = True
GoTo nextItem
ElseIf docLine = "\end{acc_opening_counts}" Then
printingCounts = False
GoTo nextItem
End If

typedNumber = False
If printingCounts Then
curBranch = Trim(par.Range.Words.First)
par.Range.Select
Selection.EndKey Unit:=wdLine
For i = 0 To UBound(branchNames)
If branchNames(i) = curBranch Then
typedNumber = True
Selection.TypeText Text:=" " & openingCounts(i)
GoTo nextItem
End If
Next i
If typedNumber = False Then Selection.TypeText Text:=" 0"
End If
nextItem:
Next
End Sub

Sub importStats()
Dim theDoc As Document
Set theDoc = ActiveDocument

Set fso = CreateObject("Scripting.FileSystemObject")
monthFolder = "\\accounts\MB_REPORT 2004\YEAR2004\DECEMBER2004\"

For i = 1 To 31
If i < 10 Then
fname = monthFolder + "Dhanmondi Branch 2004-12-0" & Str(i) & "\AC_OPEN_ALL"
fname = Strings.Replace(fname, "0 ", "0")
If fso.FileExists(fname) Then
inputData fname, theDoc
Else
Debug.Print fname, "does not exist"
End If
Else
fname = monthFolder + "Dhanmondi Branch 2004-12-" & i & "\AC_OPEN_ALL"
If fso.FileExists(fname) Then
inputData fname, theDoc
Else
Debug.Print fname, "does not exist"
End If
End If
Next i
End Sub


May not look like much but was a bitch to write thanks to the lack of regular expressions in vanilla Office VBA. This was the first half. The second half was even harder because even more ill-defined -- almost no one's ever done it before.

The sparkline generator:
Microsoft Word Object ThisDocument

Private Sub Document_Close()
myDocumentClose
End Sub

Private Sub Document_Open()
myDocumentOpen
End Sub

Module NewMacros


Function sizeof(arr)
sizeof = UBound(arr) - LBound(arr)
End Function

Function sort(arr As Variant, Optional SortAscending As Boolean = True)
' Chris Rae's VBA Code Archive - http://chrisrae.com/vba
' By Chris Rae, 19/5/99. My thanks to
' Will Rickards and Roemer Lievaart
' for some fixes.
ToSort = arr
Dim AnyChanges As Boolean
Dim BubbleSort As Long
Dim SwapFH As Variant
Do
AnyChanges = False
For BubbleSort = LBound(ToSort) To UBound(ToSort) - 1
If (ToSort(BubbleSort) > ToSort(BubbleSort + 1) And SortAscending) _
Or (ToSort(BubbleSort) < ToSort(BubbleSort + 1) And Not SortAscending) Then
' These two need to be swapped
SwapFH = ToSort(BubbleSort)
ToSort(BubbleSort) = ToSort(BubbleSort + 1)
ToSort(BubbleSort + 1) = SwapFH
AnyChanges = True
End If
Next BubbleSort
Loop Until Not AnyChanges
sort = ToSort
End Function

Function arrayMin(theArr)
Dim arr()
ReDim arr(UBound(theArr))

For i = LBound(theArr) To UBound(theArr)
arr(i) = Val(theArr(i))
Next i

If sizeof(arr) = 1 Then
arrayMin = arr(LBound(arr))
ElseIf sizeof(arr) = 2 Then
If arr(LBound(arr)) < arr(UBound(arr)) Then
smaller = arr(LBound(arr))
ElseIf arr(UBound(arr)) < arr(LBound(arr)) Then
smaller = arr(UBound(arr))
End If
arrayMin = smaller
Else
sortedArr = sort(arr)
arrayMin = sortedArr(LBound(sortedArr))
End If
End Function

Function arrayMax(theArr)
Dim arr()
ReDim arr(UBound(theArr))

For i = LBound(theArr) To UBound(theArr)
arr(i) = Val(theArr(i))
Next i

If sizeof(arr) = 1 Then
arrayMax = arr(LBound(arr))
ElseIf sizeof(arr) = 2 Then
If arr(LBound(arr)) < arr(UBound(arr)) Then
bigger = arr(UBound(arr))
ElseIf arr(UBound(arr)) < arr(LBound(arr)) Then
bigger = arr(LBound(arr))
End If
arrayMax = bigger
Else
sortedArr = sort(arr)
arrayMax = sortedArr(UBound(sortedArr))
End If
End Function

Function scaleHeight(num, max, theHeight) As Double
If max = 0 Then
scaleHeight = 0
Else
scaleHeight = theHeight - (num / max) * theHeight
End If
End Function

Function lineChart(aLine, theHeight, widthMul, showAvg, vertPos As Single, ByRef header, Optional ByVal scaleSame As Boolean, Optional scaleMax, Optional scaleMin)
If Right(aLine, 1) = vbCr Then
theLine = Left(aLine, Len(aLine) - 1)
Else
theLine = aLine
End If
theSeries = Split(theLine) ' Contains the header label
Dim numSeries() ' Does not hold the label

numNils = 0
For counter = 1 To UBound(theSeries)
If theSeries(counter) = "nil" Then numNils = numNils + 1
Next counter

ReDim numSeries(UBound(theSeries) - numNils - 1)
For i = numNils + 1 To UBound(theSeries)
numSeries(i - numNils - 1) = Val(theSeries(i))
Next i

If scaleSame Then
min = scaleMin
tempMax = scaleMax
Else
min = arrayMin(numSeries)
tempMax = arrayMax(numSeries)
End If
max = tempMax - min

For i = 0 To UBound(numSeries)
tempNum = numSeries(i) - min
numSeries(i) = tempNum
Next

If showAvg Then
sum = 0
For Each elem In numSeries
sum = sum + elem
Next
avg = sum / UBound(numSeries)
avgHeight = scaleHeight(avg, max, theHeight)
End If

With ActiveDocument.shapes.BuildFreeform(msoEditingAuto, (numNils * widthMul) + 100, scaleHeight(numSeries(0), max, theHeight) + vertPos)
For i = 1 To UBound(numSeries)
.AddNodes msoSegmentLine, msoEditingAuto, ((numNils + i) * widthMul) + 100, scaleHeight(numSeries(i), max, theHeight) + vertPos
Next i
freeformName = .ConvertToShape.Name
End With

With ActiveDocument.shapes.AddShape(msoShapeOval, (numNils + i - 1) * widthMul - 2 + 100, scaleHeight(numSeries(i - 1), max, theHeight) + vertPos - 2, 4, 4)
.Fill.Visible = msoTrue
.Fill.Solid
.Fill.ForeColor.RGB = RGB(51, 102, 255)
.Line.ForeColor.RGB = RGB(51, 102, 255)
dotName = .Name
End With

With ActiveDocument.shapes.AddTextbox(msoTextOrientationHorizontal, (numNils + i - 1) * widthMul + 5 + 100, scaleHeight(numSeries(i - 1), max, theHeight) + vertPos - 7.5, 50, 15)
.TextFrame.TextRange.Text = strings.Trim(Str(numSeries(i - 1) + min))
.TextFrame.TextRange.Font.Size = 8
.TextFrame.TextRange.Font.Color = RGB(51, 102, 255)
.Fill.ForeColor.RGB = RGB(255, 255, 255)
.Line.Visible = False
.Fill.Transparency = 1#
textBoxName = .Name
End With

If showAvg Then
With ActiveDocument.shapes.AddLine(numNils * widthMul + 100, avgHeight + vertPos, (numNils + i - 1) * widthMul + 100, avgHeight + vertPos)
.Line.ForeColor.RGB = RGB(153, 51, 0)
.Line.DashStyle = msoLineRoundDot
avgLineName = .Name
End With
End If

header = theSeries(0)
If showAvg Then
retval = Array(freeformName, dotName, textBoxName, avgLineName)
Else
retval = Array(freeformName, dotName, textBoxName)
End If

For Each elem In retval
Debug.Print elem
Next
lineChart = retval
End Function

Sub selectChart()
Dim ctl As CommandBarComboBox
Set ctl = CommandBars("Sparklines").Controls(2)
If ctl.ListCount < 1 Then Exit Sub

lineArr = Split(ctl.List(ctl.ListIndex), ":")

theNames = Split(Trim(lineArr(1)), ",")
Dim shapeNames() As Variant
ReDim shapeNames(UBound(theNames))
For i = 0 To UBound(shapeNames)
shapeNames(i) = theNames(i)
Next i

ActiveDocument.shapes.Range(shapeNames).Select
End Sub

Sub deleteChart()
Dim ctl As CommandBarComboBox
Set ctl = CommandBars("Sparklines").Controls(2)
If ctl.ListCount < 1 Then Exit Sub

selectChart
Selection.Delete
ctl.RemoveItem ctl.ListIndex
End Sub

Sub moveChartRight()
Dim ctl As CommandBarComboBox
Set ctl = CommandBars("Sparklines").Controls(2)
If ctl.ListCount < 1 Then Exit Sub

selectChart
Selection.MoveRight
End Sub

Sub moveChartLeft()
Dim ctl As CommandBarComboBox
Set ctl = CommandBars("Sparklines").Controls(2)
If ctl.ListCount < 1 Then Exit Sub

selectChart
Selection.MoveLeft
End Sub

Sub refresh()
myDocumentClose
myDocumentOpen
End Sub

Sub myDocumentOpen()
CommandBars.Add(Name:="Sparklines", Temporary:=False).Visible = True

With CommandBars("Sparklines")
With .Controls.Add(Type:=msoControlButton, Temporary:=False)
.Caption = "Line Chart..."
.Style = msoButtonCaption
.OnAction = "lineChartGui"
End With
.Controls.Add Type:=msoControlDropdown
With .Controls.Add(Type:=msoControlButton, Temporary:=False)
.Caption = "Select"
.Style = msoButtonCaption
.OnAction = "selectChart"
.Enabled = True
End With
With .Controls.Add(Type:=msoControlButton, Temporary:=False)
.Caption = "Delete"
.Style = msoButtonCaption
.OnAction = "deleteChart"
.Enabled = True
End With
With .Controls.Add(Type:=msoControlButton, Temporary:=False)
.Caption = "Refresh"
.Style = msoButtonCaption
.OnAction = "refresh"
.TooltipText = "Clears names of all charts from the list, whether charts are still in document or not"
.Enabled = True
End With
End With
End Sub

Sub myDocumentClose()
Dim sl As CommandBar

On Error Resume Next
Set sl = CommandBars("Sparklines")
If sl Then sl.Delete
End Sub

Sub lineCharts(theHeight, widthMul, showAvg)
noTb = False
Dim sl As CommandBar
On Error GoTo makeToolbar
Set sl = CommandBars("Sparklines")

continueWithTb:
howMany = Selection.Range.Paragraphs.Count
If howMany < 1 Then End

lines = Split(Selection.Range.Text, vbCr)
theHeader = ""
For i = 0 To howMany - 1
theShapes = lineChart(lines(i), theHeight, widthMul, showAvg, 100 + i * (theHeight + 15), theHeader)
shapesStrTemp = ""
For Each elem In theShapes
shapesStrTemp = shapesStrTemp & "," & elem
Next
shapesStr = Right(shapesStrTemp, Len(shapesStrTemp) - 1)
sl.Controls(2).AddItem theHeader & ":" & shapesStr
Next i

Exit Sub
makeToolbar:
myDocumentOpen
GoTo continueWithTb
End Sub

Sub lineChartGui()
frmLineChart.Show
End Sub


Yup, very complicated. Hopefully will become simpler and simpler in future iterations. Sometimes wonder why I don't just switch to automating Excel charts.

Dec 26, 2005

Sparklines: can't resist


When I started looking at ways to automate the graphing of the bank's accounts opening data, I originally started out with a 3-D line chart powered by a PivotTable. But have since realised that this is a perfect area of application for sparklines, Edward Tufte's `intense, simple, word-sized graphics'. For example, see above.

They're usually supposed to be surrounded by more context, but basically that is their size and general appearance.

Sparklines have so much potential in charting huge amounts of data; couldn't resist spending a lot of thought and time trying to figure out what would be the best way to implement them. First decided on plain HTML and CSS generated by Python, and spent a lot of time on it before decided it was too tedious because I had to get Python to generate each and every dot making up the lines. Python is very good, but after a while I realised I should use an environment which already provided vector-based drawing tools which could be automated.

The obvious choice turned out to be Microsoft Word, because of how common it is, especially here in Bangladesh. After some hacking, came up with the following code:

Const theHeight = 50
Const widthMul = 1

Function scaleHeight(num, max) As Double
num = Val(num)

scaleHeight = theHeight - (num / max) * theHeight
End Function

Sub genSl()
Dim c As Shape ' Holds the canvases one by one
min = 0
max = 0

Dim theArray()
howMany = Selection.Range.Paragraphs.Count
ReDim theArray(howMany - 1)
Dim canvasNames()
ReDim canvasNames(howMany - 1)

For i = 0 To howMany - 1
theArray(i) = Strings.Split(Selection.Range.Paragraphs(i + 1).Range.Text)
For j = 1 To UBound(theArray(i))
If Val(theArray(i)(j)) < min =" theArray(i)(j)"> max Then max = theArray(i)(j)
Next j
Next i
max = max - min

For i = 0 To howMany - 1
' For each paragraph in the selection a sparkline is drawn
Set c = ActiveDocument.Shapes.AddCanvas(100, i * (theHeight + 20) + 200, widthMul * (UBound(theArray(i)) + 1) + 55, theHeight + 15)
canvasNames(i) = c.Name

With c.CanvasItems.BuildFreeform(msoEditingAuto, 0, scaleHeight(theArray(i)(1), max) + 7.5)
For j = 2 To UBound(theArray(i))
' j starts from 1 because the first point was plotted in the BuildFreeform function
.AddNodes msoSegmentLine, msoEditingAuto, j * widthMul, scaleHeight(theArray(i)(j), max) + 7.5
Next j
.ConvertToShape
End With

j = j - 1
With c.CanvasItems.AddShape(msoShapeOval, j * widthMul - 2, scaleHeight(theArray(i)(j), max) + 7.5 - 2, 4, 4)
.Fill.Visible = msoTrue
.Fill.Solid
.Fill.ForeColor.RGB = RGB(51, 102, 255)
.Line.ForeColor.RGB = RGB(51, 102, 255)
End With

With c.CanvasItems.AddTextbox(msoTextOrientationHorizontal, j * widthMul + 5, scaleHeight(theArray(i)(j), max) + 7.5 - 7.5, 50, 15)
.TextFrame.TextRange.Text = Strings.Trim(Str(theArray(i)(j)))
.TextFrame.TextRange.Font.Size = 8
.TextFrame.TextRange.Font.Color = RGB(51, 102, 255)
.Fill.ForeColor.RGB = RGB(255, 255, 255)
.Line.Visible = False
End With
Next i

ActiveDocument.Shapes.Range(canvasNames).Select
End Sub

Sub showMarkers(n As Integer)
pWidth = ActiveDocument.PageSetup.PageWidth
pHeight = ActiveDocument.PageSetup.PageHeight

Dim l As Shape
For i = 1 To Int(pWidth / n)
Set l = ActiveDocument.Shapes.AddLine(i * n, 0, i * n, 10)
Set l = ActiveDocument.Shapes.AddLine(i * n, pHeight, i * n, pHeight - 10)
Next i
For i = 1 To Int(pHeight / n)
Set l = ActiveDocument.Shapes.AddLine(0, i * n, 10, i * n)
Set l = ActiveDocument.Shapes.AddLine(pWidth, i * n, pWidth - 10, i * n)
Next i
End Sub

Sub doShowMarkers()
Call showMarkers(10)
End Sub

If you're interested in using them, put them in some module in one of your documents templates (if in the Normal template, it will be available to all documents). Then put some data and numbers in the document itself, arranged in a certain way. The above sparklines were generated from the following data:

DSE 2 3 4 7 3 7 4 119 3
DSEGeneralIndex 749.11 768.03 795.05 763.7 752.91 792.56 874.57 870.46 874.22 842.36 845.07 848.41 807.6 806.92 750.84 787.94 791.7
DSE20Index 942.46 958.2 1004.56 963.88 920.73 973.88 1134.34 1094.45 1085.97 1052.47 1051.48 1054.89 1004.61 1021.5 948.27 964.13 964.32
RandomIndex 642.2 221.5 2

That is, each series is on its own paragraph (paragraphs not separated by blank lines), each item in the series separated from the other by a single space. To chart the data, select it all. If the selection contains a single data series, then a single sparkline will be drawn, and so on.

Need to work more on the code and especially on the GUI front-end. But for now it works OK.
Will upload it to a public server after working on it some more.

Dec 22, 2005

New ideas

As usual, haven't posted in a long time. Never found much to talk about, but nowadays I find myself looking at problems and inconveniences in my life, and others', and thinking of ways to solve them.

Example. With the abolishing of rickshaws from the main road near leading up to New Market and Nilkhet, the road in front of New Market has become more jammed than ever with parked cars and stationary rickshaws. Right now it is a two-way street, with two lanes on each side and a lane for parking cars on. A simple way to solve the jam would be to allow only cars on the side further away from NM, and only rickshaws on the side closer to it. Sure, cars would have to exit through the other, further side on their way out, but then, that's what they're there for.

Work

Started at One Bank in the beginning of December. Worked, or observed, my way through a lot of stuff but I've finally seen what to me is the most interesting part of it all: the raw data generated by the computer system of the bank's daily activities. These data are in the form of plain text files arranged into folders, essentially by date. They are just crying to be pulled in and processed programmatically by Excel or some such program. For example, there are daily data files about fixed deposits which mature on the day; and new accounts (including loans) which were opened on the previous day.

In the new accounts example, the information in each file (each day's report) includes a grouping of accounts by branch, count of new accounts in each branch, and detailed information on each account (one account per line). The way it is arranged makes it possible to parse it and pull out the most useful data -- for example, the count of new accounts opened in each branch. If one does this every day to keep current, one can graph the daily account opening activity for each branch, and what's more, put these graphs together into a combined `3-D' graph for ease of comparison. This gives, over time, a nice high-level view of account activity throughout the bank.

This is exactly what am now trying to do with Excel and a well-crafted macro at the bank. Have made some progress, and think the parsing bit is taken care of thanks to Excel's, well, excellent plain text file importing/parsing capabilities. But a lot of it is still left, including programmatically generating pivot tables and charts for new months. Should be quite a challenge. If they let me do this, even intermittently, it should make it very interesting at work. Don't know who it will really help, though, to be realistic. At this point it's just a shiny toy, a very high-level view which branch employees may not find ultimately useful and thus may lose interest in rapidly.

But still look forward to exploring more of the daily reports and perhaps even getting something useful out of them.

Nov 9, 2005

Evolution v intelligent design, notes from Slashdot

Kansas' education board has decided that its students should be taught about intelligent design, an alternative `theory' to evolution. Here's a posting from Slashdot (http://science.slashdot.org/science/05/11/08/2338233.shtml?tid=123&tid=14) which describes exactly how I feel about this:



Re:You are only hurting yourself you know.... (Score:4, Insightful)

by Decaff (42676) on Tuesday November 08, @10:15PM (#13985193)

Interesting comment--considering that they are teaching Intelligent Design alongside Evolutionary Theory. Your comment seems to indicate that, by teaching ONLY Evolution, that's how we develop Independent Thinking? Tell one side of a story? Somehow, that seems more like indoctrination to me.

You are missing the point. These classes are supposed to be science lessons, not philosophy or religion. There are plenty of alternatives ideas to evolution that can be discussed in biology classes, such as the ideas that fossils aren't old and the Earth was created recently. These areas are testable, and examining the data that suggests they are false can be highly educational - students learn about rock strata and radioactive dating.

Intelligent design is not testable. It is nothing more than a series of statements of incredulity - that because we don't yet understand everything about the evolution of life then there must have been intervention by a `designer'. This isn't science. Intelligent design might be science if there was some sort of valid consistent test for the existence of a designer, but there isn't. Also, because it is likely there there will always be some area of evolution or of biology that is not fully understood, there will always be some room for someone to say `that must be designed'. This means that Intelligent Design is never refutable; again, making it meaningless in the context of science.

Science teaching should include the idea that we are simply currently ignorant about some things. Coming up with untestable, irrefutable explanations to cover that ignorance is dishonest and should not be part of the process.

Imagine this sort of approach being used in other areas of science (e.g. `We don't yet fully understand the origin of comets, so aliens or gods must have made them') and the results are silly in the extreme.


Here's another that echoes it:



Re:You are only hurting yourself you know....(Score:4, Insightful)

by Flower (31351) on Tuesday November 08, @10:25PM (#13985290)


What independent thinking? ID certainly doesn't promote it. It provides the ultimate out in the search for truth. It's too hard right now to explain *this* so the obvious answer is God did it! (And don't even try to claim it is some ambiguous creator that spontaneously created the eye. The second some pagan asserts that it was the Goddess who made it happen you'll see every ID proponent in Kansas heading out to smite that heretic down.)

ID's greatest sin is that it closes doors to scientific research. If God miraciously intervened and created the eye then there is no reason to try to find an explanation. God did it so leave it alone and don't question it. Obviously if a million believers can't figure it out what could a scientist accomplish? And if this can be done in evolution then why can't it be done in other sciences? The creation of the universe is too complex to really comprehend so all this fluff about researching gravity really doesn't have to be done because we can just attribute the really interesting mysteries to God.

ID isn't science. It's the same old shit that pioneers in science had to fight against and be abused by centuries ago.


You have to love Slashdot: they put into words exactly how I feel about this stuff. I don't even have to raise a finger and type the stuff out, it's so perfect. Best of all, their sense of humour:



Hey Kansas! (Score:5, Funny)

by Anonymous Coward on Tuesday November 08, @09:30PM (#13984798)

We're becoming a laughingstock of not only the nation, but of the world, and I hate that

HAHAHAHAHAHAHAHAAHAHA!!!!!!!

-- The World


And also:



Re:Misleading headline (Score:4, Funny)

by c0d3h4x0r (604141) on Tuesday November 08, @10:17PM (#13985212)


2)It redefined the meaning of science. According to the new definition, science is no longer is limited to searching for natural explanations for natural phenomena.

Excellent! So now student `science' fair projects can be about... well, pretty much anything!


Richard Feynman must be turning in his grave.

Oct 6, 2005

Cleaned my room

I cleaned my room tonight. And I mean really cleaned, with mop and cleaning liquid. This is the first time I've ever done that, I kid you not. Room looks and feels cleaner than ever, but I know it won't last :-(

I'm managing to post now, after all this time, because only now have I gotten some time (well, stolen some time) to do it. It's been amazingly hectic for the last few weeks. The assignments have come and gone one after the other, and the way I am -- very bad at managing my time -- they pile up till the weekend before they're due, and then I start; of course by then it's guaranteed that I'll be brain-fried in a couple of days. But just enough, and just in time, to hand the damn thing in, then sink into lethargy.

Well, not actually lethargy. I've been snatching time to read Azarello's 100 Bullets whenever I can. I have upto issue 52, and it's amazing. For me it started off with a whimper, but it's gotten stronger and stronger. The big deal is that they keep the story intelligent, with plot surprises for me. And the characters just suck you in. I hate that. But I like and appreciate it very much. Plus Risso's art is a treat. I would be very surprised if he hasn't already drawn one of the Batman books.

Speaking of which, did I mention how much I love Lucifer? Mike Carey's Lucifer, I mean. It's so easy for me to identify with him. Damn. I have a problem with authority but will make my own rules as I go along. And yes, I hate hypocrisy ... but there's a line between playing by your own rules and being a hypocrite. Even if it's not there all the time. But that's what makes life so fun ... the back and forth between the law and lawlessness.

Anyway, back to the story. How did I end up cleaning my room? I have a reputation (at least among ... myself) for avoiding that kind of drudgery. Although I do like to think of myself as a glutton for punishment. Anyway. I was supposed to go watch a movie at 9 (pm), but my ISN meeting ... spilled over ... into that time, so I decided to skip it. Was hungry and didn't want to dine on popcorn watching the movie anyway. So. I came back home after dinner at Pink, the restaurant right outside the campus, and just decided to get it over with. The cleaning, I mean. I figured I wouldn't get the chance again soon.

Anyway, gotta go now. I should probably take my bath. At 1:30 in the morning, that makes me a very odd person. But then I've always been a night owl. Aren't all university students?

Jul 29, 2005

Harry Potter and the Half-Blood Prince

I bought the book the day it came out on Dhaka, July 16th (from what I remember, Rowling wanted to release it on the day of the summer solstice, but also at midnight. So that ended up being July 16th in Dhaka). It was a hartal, so believe it or not, there was practically no one else at the bookstore compared to the crowd I'd been expecting. It cost Tk. 1,475 in anyone was wondering.

I started reading it immediately after getting home. I had to stop to do stuff like packing and meeting family, because it was the last day of my holiday in Dhaka, and I was flying the next morning. But I read whenever I could, and into the night. Around 2 am, I finished. It was well worth it.

When I started reading it, something felt wrong near the beginning. But I couldn't put a finger on it. Yesterday I realised that it was that in the second chapter, Rowling tells the story located somewhere far away from Harry -- and we the readers see something that Harry doesn't, something she's never done before. Think about it. Every device that Rowling has ever introduced to show something that happens far away from Harry or far before Harry's time -- Harry's connection to Voldemort's mind, the `memory dishes', the Dementors' awakening of long-dormant memories in Harry's mind, the journal of Tom Riddle, among others -- let Harry see and hear what's going on, as well as us.

So for the first time ever, the story shifts away from Harry and onto Snape. What does this mean? I have no idea.

Then, throughout the book, Harry has this growing paranoia and obsession with Malfoy. They've always been enemies, but before this book, Harry never attached such an urgency to finding out what Malfoy was doing. And his intuition proved right in the end. But the irony is that Dumbledore was willing to put his own life on the line to turn Malfoy from his father's and Voldemort's side, and wouldn't lift a finger to stop him.

Reading the book, you get the feeling that Rowling has got the whole of these characters wrapped around her brain, so easily do their interactions come together. But also, Harry getting together with Ginny felt pretty forced to me. They had some little interaction before, nothing that came before had hinted at the `little monster' of jealous love in Harry for Ginny. With Ron and Hermione, for example, you knew it was coming from book 4 -- the Krum stuff. That was extended here into the kind of interaction I'd always imagined they'd have before they got together.

The climax of the book -- between Harry, Draco, Dumbledore and Snape -- also felt like the most natural possible buildup to the big finish. I couldn't have asked for anything better.

Snape's escape, and Harry's failure to prevent him, showed just how much Harry trails the older wizards in actual power levels, and just how lucky he's been upto now fighting the Death Eaters. I could feel Harry's frustration as Snape turned aside every single spell Harry threw at him, but left Harry unharmed, a prize the Dark Lord would claim for himself.

And the situation that the last chapter sets up -- it's beyond anything that has ever happened in Harry's world. Suddenly it's become a much bigger and scarier place, and no more shielding, no more Dumbledore, Sirius or even Snape to take some of the heat off Harry. The only protector-figure left for Harry now is Hagrid, which is kind of fitting -- there's a connection between them. But you have to wonder if Hagrid's days are numbered too.

But I digress. Everything is torn away from Harry -- Hogwarts forgotten, training to be an Auror put on the backburner, and friends, except for perhaps only Ron and Hermione, left behind. He finally has a quest, but it's a huge one -- a whopper which I'm not sure how Rowling is going to fit it into a single book 7, unless much of the work has already been done for Harry. We can only hope.

But whether or not that's true, it's been driven like a nail into Harry's head that he has to, to the exclusion of everything else, kill Voldemort. Nice and chilling.

Jul 14, 2005

Holidays end

I go back to Malaysia on the 17th, after a nice and relaxing vacation in which I've done everything the way I wanted to, but haven't done everything I've wanted to. Oh well, maybe next time.

But now, it's almost over, and that sucks. I've been watching movies, reading comics, downloading music and videos, and everything else without any regard to the time or how much sleep I get in the day. The only thing that I've seemed to lack is time -- it just flew by. I've stayed awake for 24 hours straight or more trying to do everything I wanted to do and still I was forced to go to bed, unsatisfied, at dawn. Only to wake up in the afternoon tired and bleary-eyed.

I have made sacrifices, e.g. my eyes. They're teary and bleary and a little bit red all the time, and oh so itchy. So itchy that I can get an almost orgasmic satisfaction by just rubbing them with the backs of my hands. Instead I force myself to pull at the skin around them a bit to satisfy the itch -- for a little while. If I rub my eyes my hands come away wet with a foul-smelling fluid that presumably comes from the backs of my eyeballs.

Today my semester results came out and I've done tolerably in all four of my core units -- haven't failed anything like I feared at times. Was a little surprised to see that I did best in the management unit -- a Distinction -- but then I guess it must be because of the second assignment; I worked hard on that one. The worst grade, a Pass, was in microeconomics. Guess I shouldn't be surprised, because no matter how much I like economics, I've always sucked at it.

Jun 27, 2005

Microsoft Office

Following my success at installing Internet Explorer and MSN Messenger on my Linux laptop, I realised I might as well install Microsoft Office and make a clean job of fizzling out my open source utopia. So I did it, yesterday. I installed Office 2000, the latest version that was known, as far as I knew, to work with Wine.

The installation did error out at first, but a quick check of a couple of Wine websites told me the answer to that problem. So I managed to complete the install -- Word, Excel and PowerPoint, possibly the three most used desktop applications in the Monash computer labs. Well, Visual Studio/Visual C++ is up there, but still.

Anyway, after I installed everything and made sure it worked -- and it does, more or less -- I started wondering how far Wine has come at running Office XP. So I did some Googling and wouldn't you know it, Office XP now works with Wine -- again, more or less. Damn. Still, at least Office 2K has all the features I really need in Word and Excel -- tables within tables, and PivotCharts.

Using Word and Excel, even stripped of all their Windows XP eye-candy freshness, I quickly appreciate just how good the user interface is. How well everything has been put together and just gets out of your way, compared to something like OpenOffice.org. Take, for example, the pull-down menus of their word processors. Word's menus are of a reasonable size; they don't stretch down almost to the bottom of the screen. In OpenOffice.org Writer, they do.

Note: I'm not dissing OpenOffice.org here. I really, really like some of its features, and if I could help it, I'd use it over MS Office any day. Features like the true integration -- it's really one program that changes its menus, toolbars, etc. depending on what type of document you're viewing; Stylist and Navigator panes which quickly let you manipulate and apply all kinds of styles, and move around documents quickly; the built-in PDF export; the Python programmability (I've written a very useful little word count tool for Writer in Python -- remind me to talk about it some other time); and of course, the fact that it's free and open source, works pretty much flawlessly with MS Office documents, and runs on the Big Three operating systems of today -- Windows, Unix and Mac OS X.

But where does that leave me with MS Office? The truth is I need Excel to conveniently do data analysis in my statistics units, and Word as a last resort to open files I might come across.

May 16, 2005

Updating a page in a browser

Say you know that a web page has recently been changed, but no matter how many times you click Refresh/Reload, the new version just refuses to come up. What do you do? Hold down Shift, then click. This will force the browser to go out and download the page again, instead of lazily telling you it has the latest version.

May 13, 2005

Quick update on Internet Explorer and Wine

Well, turns out I didn’t need Internet Explorer 5 at all. The reason the IE6 installer I downloaded from Microsoft was not working with Wine was that I had the latest Wine version installed, and it had a bug which prevented IE6’s installer from working. I downloaded and installed a slightly older version of Wine (20041019), and voila, Internet Explorer 6 SP1 was installed (I’m running it now).

I then managed to go to the MSN Messenger website and let IE install Messenger 7 for (which I’m also running now). So now, instead of having to use the E-Messenger website all the time, I can sign in with the Real Deal(TM). Yessss.

Details? Feeling lazy now, maybe I’ll post them later.

May 12, 2005

Various

The Darth Side

Ever wonder what thoughts swirled around in the evil Darth Vader’s head during the events of Star Wars 4–6? Well, here’s your chance to find out – this blog is the personal narrative of the Dark Lord himself! ‘The Darth Side: Memoirs of a Monster’, http://darthside.blogspot.com/. The classic post to read: ‘Does It Hurt When I Go Like This?’

Bruce Schneier

Check out ‘Schneier on Security’, http://www.schneier.com/blog/. He writes about an always-interesting topic, security, which inevitably leads to many diverse and interesting discussions with his readers on his blog – nowadays probably more about politics than about anything else. But it’s always an interesting take on the topic.

Internet Explorer on Linux

It’s ironic that I, a Firefox freak, am searching for a download of Internet Explorer 5. But it’s true. I am trying to install IE5, as insane as that sounds. And what’s more, I’m not trying to do it on my Windows machine, because I have none. I’m trying to do it on my Linux box, to get MSN Messenger to work on Linux.

For those of you not familiar with Linux, this is quite a trick, because it requires a lot of special tinkering before you can run common Windows programs like Internet Explorer and MSN Messenger. Things are going at snail’s pace now because I can’t find a download of IE5 anywhere on the ’net. Guess I’ll just have to keep searching.

Uni

University life never lets up. First there was the Monash Cultural Night, and that was so hectic it made us, the organisers, not so eager to see each other again for a while. Ironic.

Then there are all these damned assignments that have you on a choke-hold. They keep coming, one after the other. You keep putting them off, claiming to do ‘research’ and ‘I’ll start them real soon.’ But then a couple of days before the due date, you start doing the research and writing, and voila! Instant assignment. Meanwhile your brain and eyes are stir-fried.

On the up side, though, the assignments’ marks make up the total marks for each unit, so all the pressure is not put on the exam results.

Star Wars
Movie and ...

I am so looking forward to the 19th. Episode 3 comes out, and all assignments for the semester are finally done and over with. Ah, the closure. Of course, that just means the exams are coming up in an all-too-few number of days, but that also means so is my summer vac. Ah, the mixed emotions.

Apr 5, 2005

Another (ir)religion post

Yesterday night I had the usual `discussion' with another guy about religion. He's a Muslim, and a pretty dogmatic one at that. `Discussing' the basic concepts of religion with someone like that gets very old, very fast. For example, yesterday, he was of the opinion that I'm something really bad is going to happen to me, and I'm on the `wrong path' because I don't have any religion. Here's a basic idea of the exchange that followed:

--

Him: Man, I'm telling you, you should start believing, because see, if you keep on going this way, sooner or later something really bad is going to happen to you.

Me: Maybe. But if does, then don't you think that's unfair? If someone came up to you and told you, `If you don't do what this book here says, you're going to be punished....', wouldn't that make you angry?

Him: You can't question these things....

.
.
.

Me: But why am I on the wrong path?

Him: Because you don't follow the Holy Book.

Me: But why is following the Holy Book the right path? You've been told that it is, by other people. But how do you know that's it so?

Him: You shouldn't question these things.

Me: OK man, if I can't question your beliefs, then let's make it fair and say that you can't question mine.

Him: That's fine with me, even though you're on the wrong path and will burn in hell forever....

Me: I think we had a deal...?

Him: Yeah, I'm just saying, because you really are going to get hurt really badly some time if you don't start believing.

.
.
.

Him: Man, if you don't believe, you're going to burn in hell forever, even if you never do anything bad in your life. Even [somebody] who has drunk and committed murder and adultery and everything will get into heaven if they ask for forgiveness right before they die. (Slightly hysterically) You'll burn in hell forever!

Me: But what if I live my life as an atheist ask for forgiveness right before I die?

Him: ...

--

And then there was another thing that we touched upon: the Quran. Obviously Muslims believe that it comes straight from God, and yesterday I was trying, very subtly, to show this guy, and a friend of his, how maybe Muhammad and the Arabs of that time could have written it.

--

Them: The Quran had to come from God, because how else could it contain all the stories of the prophets like Musa (Moses), Isa (Jesus), Ibrahim (Abraham) ... in such great detail?

Me: Maybe the Arabs of that time knew of those stories from the old books, like the old and new Testaments, the Torah, etc....

Them: But the Arabs of that time couldn't read!

Me: But they could have heard the stories from someone or the other. You have to agree that at that time Makkah was a big trading city, and all kinds of people -- Christians, Jews -- traded there?

Them: Yeah....

Me: Then they could have brought the Bible and the Torah along with them, and told the Makkans and other Arabs the old stories.

--

But that did get me thinking. Suppose that there is a God, and He wants to test us while we live on earth. Suppose He has given us free will and wants us to use it to make our condition better, to live on earth with dignity and respect for one another. Maybe the real test is to see whether we can discipline ourselves even without the carrot and stick of eternal reward/punishment.

To make things more interesting, and harder for us, He has given us lots of holy books with lots of instructions and admonitions, thereby killing two birds with one stone. A beautiful masterstroke: the books contain the moral codes and authority to set mankind on a moral path, but also enough threats and contradictions to confuse and scare us. A test to see if we can overcome the confusion and the fear of being by ourselves to get to the next level, whatever that is.

Look that the history of religion in our world through this theory: everything is perfectly balanced. The feeling of fellowship and happiness from following a higher moral power, together; and the bloodshed and strife caused by conflicting beliefs. The holy books and beliefs give us just the right amount of guidance, while at the same time literally putting the fear of God in us, and the seeds of our own confusion and misery.

Feb 24, 2005

`Jonathan Strange & Mr Norrell'

Just a few days before flying to Malaysia I bought and read, in three days, Susanna Clarke’s 800-page debut novel, Jonathan Strange & Mr Norrell (see Amazon.com). Where to begin? Well, let me start with the back cover blurb. Basically it talks about the two magicians who appear in England to revive English magic. It talks about Mr Norrell as a reclusive scholar-type with an aversion to hazardous forms of magic. And of Jonathan Strange as a wild magician almost on the brink, one who is ready to try anything to gain fame and power.

It couldn’t be more wrong.

WARNING: SPOILER

‘Two magicians will appear in England. One will fear me. The other will long to behold me.’ – prophecy by the Raven King, from back cover

Only someone who has read the book can understand how much the characters have been misinterpreted by the marketers. In the book, Mr Norrell has an aversion to any type of publicity and a dislike for any magic he didn’t personally sanction. Clarke writes of him destroying would-be magicians by forbidding them from performing magic, and censoring any writings on magic – even going as far as to magically vanish books of magic right out of people’s homes to keep the public from reading them.

Strange on the other hand is presented as a very likeable character, a gentleman to the bone. Here’s something I roughly remember from the book:

‘Wellington asked Strange, “Could a magician kill people with magic?”

‘Strange frowned. “I suppose a magician could. But a gentleman never would.” ’

Strange is blessed with an unparalleled talent for magic. He discovers magic as a profession quite by accident (seemingly). Unbelieving, he goes with the flow and discovers that things happen at his command that have not happened for hundreds of years. He comes into contact with, and works with, Norrell. Yet the world he enters is unexplored and disquieting, unlike Norrell’s world of ‘safe English magic’. Strange has premonitions of things going on that are just beyond his level of awareness.

Things continue. Both magicians grow in power and renown, Strange more so than Norrell, because of his willingness to aid his country’s war machine abroad. He practices magic on very large scales – rearranging the Spanish countryside.

After the war his wife dies in very mysterious and troubling circumstances. He is a broken man, although he tries not to show it very much. All he has left is magic. And the magic is growing stronger within him every day, as he immerses himself within it. He picks up more strange vibes, premonitions, insights. He goes to Venice and finds it, too, steeped in magic. In Venice Clarke describes one of the most memorable scenes I’ve ever read in a book. It involves trees, lots of trees. Read the book!

Strange discovers that his wife is not dead, but has been enchanted away by a suave, fun-loving and cruel fairy. After this, he throws all caution to the wind and distills all the knowledge he has gained in his years as a magician into a way to access the fairy country, Faerie. He uses madness, his own madness, as a tool to contact ‘the gentleman’, as the fairy is called. So desperate, and yet hanging on by a thread, he manages to save his wife, and at the same time, with Norrell’s help, revive English magic – as part of a spell worked long ago by the Raven King himself.

In the end, the eye of the beholder beholds the eye of the beheld. But you have to read the book to understand this!

He doesn’t emerge unscathed – the conflict leaves him literally in eternal night, which he and Norrell carry with them wherever they go. Clarke ends the book on an open note, as if indicating more adventures (and hopefully more books) to come.

One recurring theme I noticed in the book was the English’s unwillingness to accept magical causes for something, even though they know that magic is possible and even likely with Strange and Norrell having opened the doors to it. Strange himself is guilty of this before his wife dies. I think her death teaches him a lesson – if anything that could be explained at all by magic, it probably is magic. Cruel way to learn, and cruel lesson, but this is not an innocent book.

Feb 9, 2005

University, and some books

AFTER a long time of hither and thither, I've finally bought the ticket. I am definitely going to Malaysia to study in Monash University. The student pass they have sent me will see me through Dhaka's airport and on to Kuala Lumpur, where I will be given a visa.

I've finished, within the last few days, Jean P. Sasson's Princess and Daughters of Arabia. The former was excellent. I found the book, of all places, in my grandfather's bookshelf. I've known of it for a long time, but for some reason or the other always passed over it, looking for interesting books. But....

I really like learning about things which have always been shrouded in mystery, and the book felt like a frank confession of Saudi royal life behind the veil. `Sultana' and Sasson's voices both felt sincere, and I identified with the princess. I have very strong and conflicting ideas about freedom and laissez-faire and non-violence and the fair treatment of minorities -- among other things. I love to see them echoed in other people.

Daughters was not as original -- and understandably so. Still highly readable, though. I'll never tire of Sultana's opinions and thoughts, partly because they're so much my own. I'm waiting for my brother to buy the next in the series, Desert Royal. (I'm currently broke -- in Bangladesh taka, anyway.) Then again, I'll probably be in Malaysia by the time he gets around to it.

I'm currently reading The Da Vinci Code. Another excellent book. Symbology; hidden meanings in famous artworks; secret societies; radical theories about Christianity -- it's all there and it's exactly my kind of brainy thriller. I can't wait to finish it, but am loath to at the same time -- because a book like this is hard to find.

Reading the book, I couldn't help comparing it to another radical book I've read recently -- Anne Rice's Memnoch the Devil. That book was about the vampire Lestat's quest for redemption, but also about the struggle between God and the Devil, apparently called Memnoch by himself and Satan (among other names) by everyone else. In it, Memnoch explained to Lestat an alternate, and shocking, view of creation and mankind and Christianity's history.The parts all fit cleverly, and the wheel turns. It left me genuinely frightened (not from the religious repercussions -- I'm secular -- but from the general atmosphere created in the book. Yes, it was that good).

Another thing which I've been exploring is a certain similarity of themes between the Princess books and The Da Vinci Code. In the former, Sultana has the feeling that many problems in the world are caused by male domination over women, which is unnatural. In the latter, much is made of the natural duality and equality of man and woman, and the subversion of that natural order in the modern world, and the resulting pain and misery. Almost uncanny.

Jan 1, 2005

For those who died: we came from the ocean, and we will go back to it

`'Tis double death to drown in sight of shore.'
--
Shakespeare

THE mind boggles at the amount of death and suffering. The sheer scale of the disaster is unthinkable. The damage will take decades to repair. The blow will lay low the economies of the region and send it into an interrugnum of darkness and despair.

This is what floats through my mind right now, watching and reading about ten thousand new deaths with every new day and the rising difficulties facing the relief workers. Suddenly the Iraq insurgency, terrorist threats and Middle Eastern oil cartels seem like such distant concerns. Something has hit us here in Asia, and this something that could destroy this region and turn it into a hellpit of misery.

I look at satellite imagery of Indonesia before and after the tsunami and try to imagine what would happen if something like that hit here in Bangladesh. I can't; it's too hard.

I once read a Jungle Book story where Mowgli has the elephants of the jungle destroy his native village, which cast him out as a demon child and would have burnt his parents as witches. He said, `Let in the jungle, Hathi!' In the satellite pictures it looks like someone cried `Let in the sea!' and it was so. In the Jungle Books, there was nothing older or more powerful than the Law of the Jungle. Now it seems to me there is something older and more powerful: the Law of the Ocean.

And yet in the news they're always talking about what the UN is saying, what countries are forming coalitions, sending each other aid; the rich giving to the poor, and the poor sharing amongst themselves. Volunteers helping stranded tourists find their lost ones. All countries coming together in symphony and no jarring notes, no dissension. It's so amazing, so incredible to see this -- the countries acting as if they are part of one big nation, one nation-planet, governed by the common Law of Humanity.

Which is the stronger law? No doubt about it, the Law of the Ocean. We came from the ocean, and back to it we will go in the end.

Dec 29, 2004

Earthquakes, tsunamis and life

I was chatting with a Sri Lankan friend about an hour ago and I mentioned to him my surprise that the Bam, Iran earthquake of last year is not mentioned by the BBC (at bbc.co.uk) as one of the major earthquakes of this century. Instead, after mentioning the Indonesia earthquake of a couple of days ago, the list jumps to 1964, I think. He said something to the effect that that's because the international community was not affected by Bam. With the Indonesia earthquake, the dead came from many countries around the world.

I suppose this view is cynical, but at least to me it's not such a surprise. I know that most people are more or less self-interested -- I know I am. So it's hardly immoral to give something more importance that affects you directly. Still, considering that 30,000 lives were lost in Bam, I think it deserved a mention.

And now, we're hearing that the Asian death toll is 44,000 (my God!) because of Indonesia's losses of maybe 25,000 and Sri Lanka's (almost) 19,000. I'm seeing stories of people from all over the world, famous and obscure, being caught up together in this disaster. This is brutal and amazing, that all are levelled to the same ground in the maelstrom, from supermodels to football stars, to the German chancellor himself.

And to add salt to the considerable wounds, Asia will almost certainly have to implement, at the cost of perhaps millions of dollars, tsunami and earthquake early warning systems or the tourist industry will never recover. Paradise on Earth will forever be on the lookout for death from the sea.

Dec 15, 2004

For science

A few weeks ago I caught a little household spider in a transparent plastic floppy disk case. I showed it to Yaman, who recoiled in disgust (he's mortally afraid of all insects and most animals). Still, he overcame his fear enough to take the case from me and give it a good shaking. I shouted at him and snatched the case back. Then I put it on a table to observe.

In about a minute, maybe, the spider turned itself to `stand' on the ceiling of the case, upside-down. I then turned the case upside-down, to put the spider right-side up again. It went crazy! It started running about inside the case for about ten or twenty seconds, then slowed down and hung itself upside-down again.

I put it upright again. And again, it went crazy, skittering about madly, and then finally putting itself upside-down again. I did this several times, and each time it responded in exactly the same way.

After a while, I have to admit, I got bored (I'm not Richard Feynman :-). So I let it go on the balcony outside my bedroom. Immediately Yaman squashed it under his sandal. I shouted at him some more, then gave it up. He's totally determined to wipe out all of insectkind, it seems. (Yes, I know a spider is not an insect, but an arachnid. Yaman doesn't care.)

Dec 12, 2004

Mistakes I can make

Yes, I too make mistakes. I did a very foolish thing today. I was walking home when a man wearing a shirt and lungi greeted me as if he knew me. He said he'd used to work for this video store that had closed down and that I had used to go there frequently (which was true, but that was a _long_ time ago, and he shouldn't have been able to have recognised me from from then). Although I didn't recognise him I shook his hand and he clasped my hand for a long time while he spoke of himself and asked me where I'd been recently. I answered him (Chittagong, Dhaka), wondering what he wanted (idiot me).

Then he started describing all the troubles he'd been having in Dhaka after losing the video store job -- looking for a job, supporting the family, and so on. And still I stood there like an idiot letting him talk on. I don't know what spell came over me -- was I uncertain as to whether he had really recognised me? Was it because he spoke some English as he told me about trying to get a job at a club in Gulshan? Was he going to ask me for a job?

Then I got a call from my mother, and I decided to get going. So I told him I had to go, implying that my mother had told me something I needed to do in a hurry. He kept on talking, finally getting to the point -- would I lend him some money, he would never ask me normally but he'd been having trouble recently and also suffering ill health -- he showed me his left arm, which had discoloured patches on it. That was when I started kicking myself (figuratively speaking) for staying to listen so long.

He was saying, maybe I could lend him a hundred taka? Maybe even fifty? I told him I didn't have anything, I would have given him something if I did have it, but I didn't. I lied, I did have some money on me, two hundred taka, but I would never give away money to anyone I met on the street.

He seemed very reluctant to let me go. I left him behind, feeling like a total idiot.

Nov 18, 2004

I love new software

I don't know about you but, I'm a sucker for new (and improved) programs on my computer. This is what keeps me downloading and trying out most anything I can lay my hands on, from alternative office suites to mail servers.

Lately on Linux, I've been trying out the Xfce desktop environment, and I have to say, on my RAM-deprived PC (128 MB), it totally kicks ass. It's fast, clean, minimal, but it looks incredible, especially with the GTK+ Smokey-Blue theme.

I've also been setting up a mail system in Linux that uses MrPostman to download all my Hotmail messages from the Hotmail site, classify it into different categories using POPFile, and deliver it to my electronic mailbox. It's working pretty well so far, and POPFile is getting more and more accurate in its classification. My only problem is the lack of mail to download and test the setup! But what the heck.

Finally I've got a mail system that comes about as close as I've ever gotten to my own POP account with an ISP.

Nov 3, 2004

(Bangalis) debating the election

This might be one of the more exciting events of modern times. The American people choose a new president and the rest of the world is riveted. Everyone I know has an opinion and wants to debate. Everyone here is rooting for Kerry, but the funny thing is people supporting the same guy find a way to debate with each other.


What I mean is, people start talking about Bush and Saddam and Osama and Iraq. The old story. Then someone goes, `Oh, I'm behind Kerry 100%.' And the other guy is `Absolutely, me too.' And they're both (moderately) happy. But then guy no. 1 says something like, `And you know, Bush did such-and-such and you could obviously see that it was wrong.'


Now this is a very innocuous statement because these guys are definitely on the same side, right? Wrong! Guy no. 2 gets all riled up at this point: `It's ridiculous! Can't you see that such-and-such! And this-and-that!!! And on top of everything else, ...'


Then guy no. 1 gets worked up as well: `But that was absolutely wrong! Bush should've gone to the United Nations and blah-blah-blah!'


Guy no. 2: `But don't you see, he says he did go! And that they gave him permission to blah-blah-blah!'


Guy no. 1: `What the hell are you talking about! Are you a Bush supporter!'


Guy no. 2: `I thought you said you supported Bush! Otherwise why were you arguing about him!!!'

Oct 23, 2004

Using GnuPG

I've started using GnuPG, the GNU Privacy Guard. I've uploaded my public key to the MIT PGP key server, pgp.mit.edu. My key ID is:


D8643D69


and fingerprint is:


B57F D9D9 FFA1 A18F 9876 7512 5999 7722 D864 3D69


If this post has caused you a headache so far, sorry! I just like the idea of playing around with digital signing and encryption.

Oct 9, 2004

`The Apprentice'

After watching four episodes, I've finally decided it's one of my all-time favourite shows. Two teams, minimal team loyalty, and almost constant bickering among the women are the defining factors, and it's great to watch.

My favourite episode so far has been the one where Sam got fired. He was labeled the `wild man' of the men's team, and he had openly admitted to Mr Trump that he had not earned the others' respect -- but he seemed to think that was their fault. After he was fired, he stared murderously at Trump. Hadn't anyone told him when he signed up there was a possibility he would get fired? Trump probably increased his security detail after that!

Yesterday night's episode was interesting because Nick folded when he didn't approve of a business tactic the others were using to get the customers in. They had set up Kwame at a desk giving out autographs -- `Get your autograph of Kwame Jackson, Wall Street [grunt]', as if he was a celebrity. In retrospect, it seems like what Sam tried to do in the first episode selling lemonade to a guy for a thousand dollars -- `I guarantee that if you buy this lemonade, you will have an experience that you will remember.' Kinda bending the rules of the show, but not quite. The implication was that after the show aired, all the contenders would become well-known to the public.

Anyway, Nick said he didn't approve of the tactic and wasn't going to be a part of it. But he didn't really do anything much at all. He just hung around outside and chanted something like `Coupons, coupons'. Carolyn was right when she pointed out he had looked like he was dying. Nick should have stuck up for the team and the team leader no matter what he thought of the tactics. And in any case he certainly didn't come up with anything better.

As for the women ... they focused on liquor and won. Heidi was very impressive selling the drinks. She capitalised on the male `macho' complex, urging them to down the shots. It was excellent. I don't know if you could say whether they went too far when the started drinking as well. Maybe that was a mistake, but they beat the men, which was the goal, so....

As for the whole `Shooters Girls' thing, small T-shirts and all, I think Trump and Carolyn were wrong to caution them about using sexuality. It should be obvious that their goal, and all their incentives, pointed at beating the men any way necessary. It was just business. If Trump wanted to see what they would do if they couldn't use sexuality as a tactic, he should have put them in a task which neutralised it -- e.g., negotiating with a woman, or in a highly scrutinised corporate environment. I don't know.

On a side note, I have to admit that for the most part I'm very erratic with my blogging. It's just that I just don't say anything if there's nothing interesting going on.

Sep 7, 2004

Haircuts as a kid

When I was younger, from nine years to about eleven years old, we used to live in Dubai, in a part of town called Deira. I was pretty happy there, for the most part. At that time I really liked going for my haircuts. My father and I would go for a walk to the barbershop, which was moderately close. Maybe sometimes we'd take the car.

So I would sit in the barbershop, which was spotlessly clean, and cool and dry, and have the accoutrements of the haircut put on me. First came the universal inner towel and white cloak. Then, unique (as far as I could tell) to this barbershop, one of the Filipino barbers, they were young chaps, would roll out some length of plasticky cloth, cut it off at the end, and wind it around my neck, holding up the white cloak. This was probably to make sure no hair fell in through the cracks.

Then would commence the snip, snip, snippety-snip. And voila, we were done. I think once or twice after a cut, we would go to a nearby public library, which to my great regret I didn't spend more time in.

Later, we moved to Sharjah [Sharjah and Dubai are cities in the United Arab Emirates]. So I actually became a teenager growing up in Sharjah. But anyway, when I was still a pre-teen, by that time I was trying to throw off the tyrannical yoke of my mother and her enforced mushroom cut. She thought it was cute, but by that time I had developed enough sentience to realise it was ghastly. OK, it was really more suited to the Western or Filipino kids, but by then I couldn't really pass for either, so I decided the best cut for me would be a fully natural cut -- in other words, just let it grow however it will, and trim it if it starts getting uncomfortable. And to this day I've kept to that style.

So anyway, back then, I was this kid in Sharjah, trying to outgrow, literally, my mushroom cut. And there were a couple of barbershops pretty close to my place. In fact, probably there was one in the next building. Finally, shortly before I turned twelve, I managed to get there alone and gave strict instructions to have it cut evenly. I was quite pleased with the result, but my mother was noncommittal at best.

Still later, we had moved to another house in Sharjah, on another street. And there was another barbershop on this street, and I used to get my haircuts there from then on. This one had nice black leather chairs -- rather like I car's, I thought. Once, on my way to the place, I popped open and started drinking a bottle of Pepsi. Then when I got there, I had to wait while the barber was finishing with another customer. In an accident, I clumsily tipped the bottle of Pepsi and it spilled. Now what I should have done was let it all spill onto my lap, because I was sitting in a leather chair. And I knew that. But in a reflex action, I had opened my lap, and most of the Pepsi went on the leather.

The barber was mad. He went nuclear, really. He was a youngish (well, late thirties) Iranian guy, and he had a temper. He started yelling at me. Luckily my father showed up and it was exit, stage left. And no haircut that night. And I didn't go back there for some time, for good measure.

Actually the one thing I appreciate about those haircuts is I got into the habit of getting a standard `medium-length' cut which just about any barber can do, so it doesn't take me long to describe what I want when I have to go to a new barbershop. And that's great because I hate describing how I want my hair cut.

Sep 2, 2004

On My Faith

I am not a religious person. In fact, I consider myself an atheist. I never was very religious but as I grew up I saw no point in pretending to be a Muslim if I didn't think of myself as such. I distinguish between religion and morality and am content with that. I try to be tolerant of all religions. That may not always have been the case, but I think now it's more important in most cases to empathise with people rather than emphasise your difference from them.

When you say you're an atheist, you come to the problem of what you think will happen after death. Most people obviously think their souls will go on `living', thus preserving their consciousness and their memories and experiences. And I automatically put myself against this when I say I'm an atheist. But I do accept that when I die, that will be it, the end of the universe as far as I'm concerned -- no soul, no afterlife, nothing but the void. And I accept that. It doesn't depress me terribly because, and I know this isn't the secret of eternal bliss, I'm not terribly obsessive about such things.

I do like to think of myself as a philosopher, but not really a seeker of spiritual truth. What I'm more interested in is a sort of sociological perspective of human civilisation for the past ten thousand years. Somewhere in all of human history there must be the clue that helps us to deal with the advances our civilisation is making as we move to the next level. Or perhaps it is present at the macro level as the patterns fall into place.

All I know is there are some things that are terribly wrong with our civilisation as it is, and we are all too stuck in the human mindset, the one we've had for the past ten thousand years, to put our fingers on it. We need to get out of this rut to make the advances we need to live up to our potential.

I think of myself as a liberal, having been influenced by Isaac Asimov, Harper Lee, Philip Pullman (His Dark Materials), Anne Rice, Carl Sagan, Khushwant Singh, Voltaire, and many others I can't think of right now. I am more or less totally liberal in attitude. And I think the basis of that is a kind of fierce tolerance of others, their behaviour, their attitudes, meanners, customs, whatever. For the most part, people don't want to get in my way, tell me what to do, and so on. And I love that and I act exactly the same way. Let everyone live their lives as they will, as long as they don't tell me what to do.

Finally, on a personal level, I have this attitude which I have decided to adopt of complete imperturbability. It's a kind of attitude where you're polite and somewhat kind and maybe even generous but you don't let anybody push you around, and you never get angry -- and even if you do feel anger, or pain, or whatever, you don't let them see it -- because you don't let yourself get hurt by anything anyone says. If one becomes totally insensitive to negative criticism (but not constructive criticism), derision, you know, all kinds of negative attitudes, I think one can find the world a much easier place to live in.

What I mean to say is, I have a very simple measure of whether somebody is trying to hurt me. Are they making fun of me, spreading lies about me, etc. etc.? Then they're not hurting me. Are they coming after me with a knife? Then they're going to hurt me. It's that simple. OK, maybe it's not, but for the most part I can deal with people by simply refusing to let anyone hurt me with words. The way I look at it is, all that's coming out of their mouths is shit at 60 wpm [words per minute]. But even then, try to understand where they're coming from, never let them feel that you're disturbed by them, but rather that you understand how they feel, but you don't feel the same way, and you simply don't care what they think. And the best part of it is, this will drive them nuts!

This is my favourite maxim: `Don't suffer fools gladly, but gladly make them suffer.'

Aug 27, 2004

Gmail, Islam, Understanding

A couple of days ago, a red link showed up in my Gmail inbox page below the mailbox list. It said `Invite a Friend' [to use Gmail], and I was like OK, this may be my only chance to invite someone for I dunno, six months or a year or something, so I better make it good. And the only person I could think of who might appreciate a Gmail account was Faisal (and yes, Marvin, but he recently got himself a 1 GB Walla account so I thought a Gmail invitation would just confuse the poor guy). And Yaman would certainly not even understand the big deal about Gmail. So it's 1 GB, so what? He doesn't even use his 2 MB Hotmail account much. When Hotmail upgrades him to 250 MB, as they've promised to do soon, he probably won't even notice the difference.

So I called up Faisal and indirectly asked him what he thought of a Gmail account. He was interested but for the life of him couldn't figure out why I was asking these silly questions. But then he's probably used to that from me by now. As an aside, if I were called up and asked what I thought of Gmail, I'd probably make the connection immediately and expect an invite, but what the hey.... :-)

So, having assured myself that he would appreciate the benefits of having a Gmail account, I sent out the invite and congratulated myself on my wise decision.

Today, I signed in to Gmail and what should I see but 6 -- not one, but six -- invitations that I can give out to friends. Yikes. Sue me, but I think I'm running out of friends to invite. Nevertheless, I think I'll try. Alia could probably use the storage space, given her volume of correspondence, and Marvin, now that I come to think of it, could probably be persuaded to part with Walla for Gmail. Actually, I think I'll just email them, so there.

--

Now, I've finally finished Karen Armstrong's `History of Islam' -- not that it was huge or anything, but rather because I took a rather long hiatus to read other stuff. Dadiamma could never figure out why Dada leaves a book unfinished to start another one, and then finishes the first after the second, but I think that like me, he gets bored with one book after a while, no matter how interesting it is.

Anyway, Armstrong said something about why Muslim women might want to veil themselves from head to toe -- even though that is not required by the Quran -- that reminded me of my own affinity for my beard even when it was criticised roundly by both friends and family. Part of my rationale for the beard was, I don't care how I look to the rest of the world as long as I can have my way. Or, screw the rest of the world, I don't give a damn what they think. Or even, screw the rest of the world, I'll keep the beard just to irritate them!

So my being like that, I can certainly appreciate why some women might subscribe to the veil. It might irritate people, but I can appreciate the black irony of that and congratulate myself (!) for it.

--

This might sound shallow after the last paragraph, but I've come to realise that the most important thing I can ever learn is how to put myself in another person's shoes. In another word, empathy. The master's disciple may have concentrated on anger management[1], but I think if you understand the motivations behind people's actions, you'll find it a lot easier to control your temper. Now if only I could drill this into my head with a chainsaw. But no, it will probably take many years to fully absorb this idea.

[1] The story goes like this. A master once left his disciples to go on a trip. When he returned, he asked each of them what they had learned in his absence. They each enumerated the things they had learned, and the master was well pleased. However, when he came to the last pupil, and asked him what he had learnt, the pupil said he had learned only one thing. Hearing this, the master became very angry and struck the pupil. Then he asked him what he had learned. Calmy, the pupil replied, `I have learned never to lose my temper.'

Aug 20, 2004

Stuff

Well, my beard is gone. And for some people, good riddance. Damn, I miss it. After I had it shaved off, I felt like I looked completely different. Like another person. Mummy was ecstatic. Yaman was smirky as usual. Daddy didn't react -- I guess he's a stoic.

Meanwhile, this may come as a shock to me (!), but other people aren't as interested in my beard (or lack of one) as I might be.

I called up the Malaysian High Commission to ask about their student visa procedure and it turns out they have none. Monash U. will actually be doing all the work on my behalf, arranging my student pass. Then they will send it to me and wait for me at the airport. That's pretty much it. The lady at the High Commission explained it to me in excruciating detail. I was afraid I would grow old and die listening to her rambling on about the process.

In other news, I've come across some videos of Richard Feynman's QED (quantum electrodynamics, oh how I love those two words) lectures -- the same famous lectures that were compiled into the book Dada bought. I'm going through the videos one by one now. Feynman is an incredibly rich and interesting character. Witty, smart, and sophisticated, he's like the Indiana Jones of theoretical physics. I'd like to see a movie about him. Russell Crowe's A Beautiful Mind proved that thoughtful movies could be made of scientists. And Feynman is such an interesting character even if you leave aside his scientific achievements -- his days as a barfly, artist, raconteur, immersion tank experimenter, marching band player in Copacabana (Brazil) would make incredible fodder for a movie.

If they did make a movie on him, Matthew Perry would be perfectly placed to play him in about ten years' time, I think, if he (Perry) takes care of himself. I think they have the same facial structure and Perry's sense of humour would only help him. The only problem that might come up is Perry's voice. At the least he'll have to go through some practice to make it sound deeper. Might even try catching a cold :-)








Perry
Feynman

Aug 15, 2004

My beard

Perhaps the time has finally come to let go of it. If I do go to the concert tomorrow, everyone (probably including me) will surely have a better time if I don't have it there. In any case, maybe the time has also come to explain why I have a beard in the first place.

I decided to grow a beard a few weeks after the A levels ended because I didn't really have much else to do and I was getting tired of shaving every other day. So through the past month I haven't touched my face with a razor, letting it all just run wild on my face. I've discovered some very interesting things about the way it grows, including the places where it doesn't (beside my lips, if anyone is interested).

I knew it could get itchy, having kept various forms of facial hair before; but then it also got sticky and dry, seemingly sucking all the moisture out of my skin. Then I got into this phase where I kept stroking the moustache and/or the beard continuously. Actually, I'm not sure I've recovered from that yet. I discovered that I don't have to worry about little bits of food getting stuck to it, but that now whenever I drink water some of it always ends up in the hair somehow.

I've also realised that all this hair makes me look more indigenous, more Bangladeshi really. In the past people have been confused as to where I'm from, and I guess this brings my appearance into a familiar level for most people.

Of course, most people I know have been vehemently against the beard (big surprise :-). Mummy and Nano have been against, Daddy, Yaman and Nana have reserved their judgement, and friends -- for the most part -- have been against. I tell them I just want to look a little different for a while, and I'll get rid of it sooner or later.

And finally, today looks like the perfect day to do it. The hartal before the concert. If the barber shop is open, that is.