Tuesday, July 7, 2009

Prof. Indiresan's Speech

Prof. Indiresan's Speech

PROF INDIRESAN WAS FORMER DIRECTOR OF IIT MADRAS
Response of Professor Indiresan To Felicitation by IIT Delhi On
The Conferment of Hon. Membership By The Institute of Electrical and
Electronic Engineers (April 6, 1998)

Some people are born with honours; some acquire honours and some
others have honours thrust on them. I belong to the third
category!
I have been lucky, lucky to have the kind of students I have had,and
particularly lucky with the kind of colleagues I had the privilege to work
with. Many of you would have heard of the Big Temple in Tanjore. That temple
is an engineering marvel. As its name implies,it s big, very big indeed. It
is also aesthetically fascinating. But it is not a holy temple. It is not
described as Thiru Tanjore the way holy temples are described in that part of
the country. That is so because the Big Temple never had an ardent poet who
sang in praise of its deity. Evidently, it is not how great you are but how
great your disciples are that determines what honours you get. So, I thank my
stars that my students and colleagues are as great as they are!

Today, I plan to explore the reasons why India is, and has always been
a weak force in international technology. Once we understand why we have been
backward, and why we still are backward, we should be on the way to success.
Let there be no misunderstanding. I yield to no one in my pride in what India
has achieved in recent years.In many areas of space technology, defence
systems, nuclear engineering,telecommunications and the like, we are
admittedly at the cutting edge of technology. We do not want to boast about
it, we do not even talk about it but the work that we have done here at IIT
Delhi on phased array radars would be deemed commendable in any part of the
world.
At the same time, it is proper for us to enquire why we built temple
halls with a thousand pillars a millennium after others had mastered
the design of the arch. Or, consider why we built the great sundial in
Jantar Mantar long after telescopes had become commonplace, and why even
today we remain the only manufacturers of vintage cars. When Alexander bore
down on us with his swift horses, we stood stuck in the mire with elephants.
We learnt no lessons from our defeat at his hands. 1700 years later, we lost
again to Babar because, in all those intervening centuries, we had remained
loyal to elephants and further had nothing better than muskets to counter
Babar's canons. Even in 1962, the Chinese humiliated us because they had
modern arms and we had none. Why do we stick to obsolete technology all the
time?

Let me illustrate the issue with a couple of stories. The first concerns a
dhabha where, as is to be expected, the food was delightful. A guest after
enjoying the meal, washed his hands and asked for a towel to dry them. The
towel that was proffered was so filthy that he was driven to protest. The
dhabha owner was perplexed. He replied ``Saab! Hazaron log use kiye hain;
abhi tak koi complaint kiye nai!'' (Sir! A thousand people have used that
towel and nobody has complained!) The second concerns a seller of gud
in a mandi in Rajasthan. Noticing that the whole mound of gud was covered
with flies, a young police officer asked the shopkeeper to do something about
it. The shopkeeper was unperturbed. He said: ``Wo kitna kha sakta hai,
saab!'' (How much can they eat, sir!) These anecdotes tell us a great deal
about our culture. One, as in the case of the dirty towel, we are content
with the barest minimum utility and have no concern for quality. Two, as in
the case of flies, we measure what is irrelevant. We are backward in
technology not because we do not have the materials, not because we do not
have the talent, not because we do not have the money, not even because we
cannot get the technology. We are backward because, as Mancur Olson has
postulated,our culture makes us think poor.
Technology innovation is like a baby. As you know, a baby is defined as an
alimentary canal with a loud voice at one end and no responsibility at the
other! Likewise, technology innovation is a conduit for digesting natural
resources - with environmental disturbance at one end and science at the
other.
Let me turn to Thomas Kuhn to explain the science part of it. Kuhn has
developed a theory to explain why Western science has dominated the world for
centuries. For that purpose, he broadly divides science into two categories:
the normal and the revolutionary. Normal science involves:

1. Acceptance of a paradigm composed of mutually consistent hypotheses.
2. Setting solvable puzzles based on the paradigm.
3. Checking theoretical solutions by experiment.
4. Looking for anomalies.

In normal science, researchers operate with a paradigm by accepting certain
hypotheses to be absolutely true. Based on those axioms,they set for
themselves puzzles, solvable puzzles. After solving them theoretically, they
verify the same by experiment. Every time experiments confirm the theoretical
prediction, the paradigm gets strengthened. However, sooner or later,
anomalies crop up. When they do, the initial attempt is to question the
experiment, not the paradigm. After some time, so many anomalies accumulate
that the paradigm becomes indefensible. At that stage comes a new genius
who postulates a new theory to trigger a revolution that produces a new
paradigm which explains the anomalies and explains the earlier results
too. What Einstein did to Newtonian mechanics is one such example. Once the
new paradigm is accepted, the process continues with a new set of puzzles
until yet another paradigm becomes necessary.
At times, the old theory is subsumed; at times it becomes irrelevant. In
the latter event, textbook writers give obsolete concepts an unceremonious
burial by deleting them altogether. For instance,which textbook today talks
of phlogiston or even about electronic tubes?
Science textbooks do not argue the past, they merely ignore it!
Compare that with philosophers who never forget and will not forgive either!
That is why we have ideological wars but no wars between followers of Newton
and Einstein, not even between devotees of Newton and Huygens.

Kuhn's paradigm may be described as a tetrahedron. Puzzle solving, anomaly
detection, experimentation and textbook writing are its four vertices. A
tetrahedron is admittedly the most stable structure imaginable. In this case,
the situation is different. The Kuhn tetrahedron is normally as stable as you
wish. But once in a while,it explodes. That combination of normal stability
and occasional revolution is the hallmark of the culture of Western science.
What about our culture? The Mundaka Upanishad says:

Dve vidye veditavye . . . tatra apara rigvedo yajurvedah, samavedo
atharva vedah; shiksha, kalpo, vyakaranam, niruktam, chando jyotishmati.
atah para, adrishyam, agrahyam, agothram, avarnam.
(There are two kinds of knowledge; the lower one consists of the Rig
Veda, the Yajur Veda, the Saama Veda, the Atharva Veda as also diction,
rituals, grammar, etymology, prosody and astrology. The higher one is
unseeable, unreachable, origin-less and undescribable.)
These thoughts are prehistoric, were enunciated thousands of years ago. They
still control our attitudes. We still feel in our bones that the highest
knowledge cannot be measured, cannot be deduced logically, may only be
realised intuitively and hence, cannot be taught in the conventional sense.
There is also no space for experiment.
Further,in the Indian tradition of caste, imparting knowledge to the
undeserved is prohibited. So, textbooks are not written with the fear they
may fall into wrong hands. (That we have jumped to the other extreme with
our affirmative policies is a different story.) At any rate, however much
Feynman and Samuelson could have become famous, we look down on the writing
of textbooks. So, if current Western science philosophy is like a solid
tetrahedron, our tradition, lacking as it does both experimental spirit and
interest in writing textbooks, is formless.
At the same time, some aspects of our philosophy are unbelievably fantastic.
In which culture will the holiest of holy texts (in our case the Vedas) be
described as inferior knowledge? Thus, we are warned not to accept even holy
texts as immutable. That is great; that should have made us prolific
inventors. Unfortunately, we were also taught that innovation requires
intuition that comes out of a form of Immaculate Conception. That needs a
miracle. Unfortunately, in the strict sense, technology permits no miracles.
Instead, as Kuhn points out, revolution is actually the culmination of
continuous evolution - it is always one last straw that breaks the camel's
back. In our culture, in theory, we may question but as we do not experiment,
we have no logical way of doing so. That is why we still manufacture cars
exactly the way they were designed nearly half a century ago.
In this respect, Indian intellectual culture is similar to that of ancient
Greeks. They too felt that the best way to develop new ideas is to sit under
a tree and think and think and think until realisation comes like a bolt of
lightening. There is the story of Aristotle decreeing that women had less
number of teeth than men. Such was Aristotle's reputation in the Western
world that, for centuries, people did indeed believe that women had fewer
teeth. They could have easily verified whether that was true or false by
asking their wives to open their mouth. They did not because in those they
too did not believe in experiments. Eventually, they started experimentation,
and progressed. We do not do so as yet. So, we remain stuck. Not many people
are aware that the first rockets ever used in war were of Indian origin.
Almost exactly two hundred years ago, Tipu Sultan stuck terror among British
troops with his rockets. Unfortunately, his rockets were so primitive and so
uncontrollable that they devastated Tipu's own troops as often as they hurt
the enemy. So, Tipu Sultan abandoned his rockets instead of trying to improve
them. (As a matter of curiosity, the only sample of Tipu's missiles is not in
India,but in the British War Museum.) The moral of the story is, generating
ideas is not the same as converting ideas into usable products.
The latter needs patience, time, determination and above all empathy.
That is where Indian technology policy is found wanting. These days, we are
looking for new models of economic development. Many of us have been
ascinated by the extraordinary progress of East Asian countries. There is a
talk of instituting a new ministry on the lines of Japan's MITI. As Lawrence
Summers has explained, the East Asian success is attributable less to
technology innovation and more to higher application of capital. East Asian
countries operate with technologies that are available for sale,not with
innovations of their own. However, a large country like India cannot become
rich by selling TV sets and notebook computers based on somebody else's
design. Then, what can we, who missed the bus of post-war expansion, do? The
story of drug industry indicates the way out. Drug prices often fall to less
than a tenth the moment their patents expire. That is an indication of the
power of technology innovation. Monopolies are always profitable. However, in
that respect no commercial monopoly can hold a candle to technology monopoly.
That is, what India needs most is technology of her own. India can
become rich not by exploiting labour, not by borrowing capital but only
through technical innovation.

Getting back to MITI, even in Japan, MITI is not much admired. MITI is a
bureaucrat's paradise. It assumes that bureaucrats can out-guess
entrepreneurs. We know that is not true. It is merciless competition
(with unsentimental bloody exit) that ensures prosperity for worthwhile ideas
and the elimination of useless ones. So, if have to at all try a MITI like
experiment, it is best to introduce MITI-like divisions in every economic
ministry and let all of them compete against one another. That might possibly
work. On the other hand, one single MITI will end up like our Planing
Commission, excellent in promise but poor in performance. What we need is not
more management but better innovation. That is exactly what a bureaucratic
set up like MITI cannot provide.
Richard Feynman has some very interesting things to say about innovators,
rather about uncreative people. According to him.(Uncreative people's) main
characteristic is a desire for exactness and precision, and for
definiteness-a desire for formal rules that will be guaranteed to work and to
yield results. I have to be very specific here. The main characteristic is
really that they want someone to give them that exactness and precision,
those definitions and those formal rules. But of course what distinguishes a
creative scientist is a desire to create (italic original) an exactness or
a definition or a way of stating a problem. Or to create a system of rules
that will guarantee that the other fools get the right answer.''Then, who
deals with rules? Bureaucrats! So, let us leave them alone. Instead, let us
ask what we ourselves do here in the IIT.
Do we train our students to be creative, or do we let them assume that the
engineering world is a precisely regulated place with exact answers to
every problem? IITs are so much examination oriented with so much emphasis on
accuracy that it is possible we induce our students to concentrate on
common-sense and prevent them from exploring uncommon sense. Feynman is
contemptuous of uncreative students who 'worship the Baconian idea of
science'' and ``delight in trying to define as precisely as possible.'' He
regards them as ``the bottom of the barrel''. As he says, the Baconian method
is like Darwin's, to record everything and hope to find a pattern there in.
Instead, Feynman extols the ability to pick and choose what to record and
what not to record, that is, the ability to approximate. Let me modify his
thesis to point out that the more precise your measurement becomes,the more
probabilistic the result will be. I shall not repeat Feynman's own earthy
description but paraphrase it in more polite terms.
'`Your weight is essentially a constant from one day to the next if the
accuracy chosen is plus or minus a Kg. However, what with your daily imports
and exports, your weight becomes a random variable if it is measured accurate
to a gram.''
Do we teach our students to appreciate that the fun is not in measuring
precisely the average value but in studying the variations around the mean?
While we teach them Boolean logic do we also tell them about Bertrand
Russel's paradox? If the village barber is defined as one who shaves every
person who does not shave himself, does the barber shave himself or not? In
other words, can it be that we in the IITs train students to solve problems
but not to think!
If that is happening even in the IITs, where else can India go to get
thinkers and innovators of tomorrow?
Let me now shift the thread of the argument. I believe philosophers are those
who have the sixth sense. Then, let us say they can solve sixth order
equations. By the same token, artists can solve fifth order equations - they
can handle all five senses. Scientists are often described as mad. That is
possibly because they have no taste. So, they can solve only fourth order
equations. Engineers, the common garden variety at any rate - come yet
another peg lower; they are often accused of having neither taste nor sense
of smell.
Ask any environmentalist! So, they can handle only third order equations.
Politicians are worse, they have no taste, they stink and further, they have
no vision. However, they have their years to the ground and a fine sense of
touch, I mean they know how to make a touch on your purse. So, we may take it
they can solve second order problems. Still lower are bureaucrats who do not
care to hear.
They know only how to make a touch. So, they can tackle nothing better than
first order equations. Is there a still lower breed? Who can that be?
Let me make a guess. How about IIT graduates who go on to study in he
institutes of management and manage Indian industry!
Let me explain. The problem with those who make it their profession to
provide precise management answers is, they often end up with precisely wrong
answers. As it has been said, it is better to be approximately right than to
be precisely wrong. Let me give one example. It is said that Howard Hughes
the self-made billionaire of yester years approached a banker for a loan to
build an aeroplane. According to the story, the banker refused to lend him
the precisely- calculated amount the gawky youngster wanted. He insisted on
lending him a lot more because a new venture is always uncertain, and there
will always be unexpected demands. Compare that banker's wisdom with the way
our bankers and grant giving agencies operate.
Our administrators pare down financial support to the barest minimum in the
expectation the returns will then become maximum. As we know,more often than
not, our bankers and our government lose everything. In contrast, Hughes's
banker not only saved all his investment, he made millions for himself and
for Hughes too. Once again, precise answers are wrong, approximate ones are
right! Our country will march forward in technology only when our managers
stop insisting on assured returns, and prepare to gamble to lose all -- or
win the jackpot!
Then, there is the even more startling case of the Xerox corporation
offering to sell to IBM the patents of the Xerox copier. In turn, IBM
turned to Arthur D. Little, the famed management consultants, for advice.
Those management experts calculated that even if the Xerox copier took away
100 percent of the existing market for carbon paper and for dittographs, it
will not be financially viable. So, IBM turned down the offer. Against such
advice, Xerox persisted. The rest is history. The flaw in the management
approach of Arthur D. Little was, there is no way of conducting market
research on a product that does not exist, a flaw nobody in India
appreciates. As Schumpeter pointed > out over eighty years ago,
``innovations do not as a rule take place in such a way that first new wants
arise spontaneously in consumers . . . It is the producer who as a rule
initiates economic change, and consumers . . .are taught as it were to want
new things.''
When we look at our managers, I am reminded of an itinerant vendor who sold a
customer a bottle, which, he assured, will kill mosquitoes. When the customer
wanted to know what he should do with the bottle, the vendor explained:
``catch the mosquito and put it inside the bottle. Then it will die.'' When
the customer protested that he could as well have squashed the mosquito, the
vendor assuaged the customer saying ``That may as well be the easier way of
killing mosquitoes, but this has always been my way of doing it!'' It would
be nice if our managers, whether in the government or in industry, ask of
themselves every day, and day after day, ``Am I using this technology because
it is good, or is it because I am used to it?'' As Robert Frost has written:

Two roads diverged in a wood, and I took the one less traveled by,And that
made all the difference.
Do we train our students to take the less traveled road? Let me conclude with
another thought. We bemoan that our lot is bad, that teachers are not given
their due. Having been a member of the Pay Commission of IIT and other
institutions, I know those complaints very well. The situation indeed is bad.
As Donald Christiansen, long time editor of IEEE Spectrum has said:

``A country that trains its engineers and technologists well, then rewards
them with both real and psychic income, should have little trouble
competing in a world economy that thrives on trading high quality, high
tech products over international boundaries.''

I could not agree more. Consider Christiansen's phrase ``psychic income''.
That comes from respect offered and respect received. Do we, the teachers of
IIT respect our colleagues? We know our colleagues too well, we know what
their failings are. That blinds us to their virtues. We want the government
to single out IIT teachers for special benefits but we do not want to give
the same teachers anything ourselves. In one of the most evocative passages
in our Upanishads we are given the advice:

Shraddhaya deyam, ashraddhaya adeyam.
Hriya deyam, bhiya deyam, sriya deyam, samvida deyam.
(Give with reverence; do not give disrespectfully. Give with humility,
give with a sense of awe, give generously, give affectionately.)

We are not good at giving. That is why we ourselves get so little. I must
admit, however, that you have made an exception in my case.You have given me
a lot. I am getting so much from you at this old age long years after I
retired. I have come to believe the only reason why I have been so lucky is
because when I could, I gave what I could. I did not give away what was mine
but only let others have what was actually theirs. Authority is exercised
both when you say ``Yes!'' and when you say ``No!'' I can assure you, it is
more joyful to exercise authority by saying ``Yes!''than by saying ``No!''.
Then, if you have to say ``yes'' ultimately, why not say so immediately? As
you observe from my case, it is rewarding too!

Dutta Roy told you today about what I have done for IIT. He forgot to
mention that the best thing I did for IIT is to induce a number of
outstanding persons like him to give up lucrative careers elsewhere to join
in the struggle for life here in IIT. That is my pride: I persuaded a number
of minds greater than mine to join the IIT. It can only be on their behalf
that I can accept the honour you have done me today.

Mancur Olson Jr., Big bills on the sidewalk: Why some countries are rich and
others are poor, The Journal of Economic Perspectives,1995.

Thomas S. Kuhn, The Structure of Scientific Revolutions, Chicago University
Press, 1970.

David and Judith Goodstein, The Uncreative Scientist: Feynman's Other Lost
Lecture, Caltech News, Vol. 31, No. 4, PP. 12-17,1997.

Michael Hammer and James Champy, Reegineering The Corporation: A Manifesto
For Business Revolution, Nicholas Braily, London, p. 86.

J.A. Schumpeter, The Theory of Economic Development, Oxford University Press,
1961

Christiansen, Donald, Engineering Excellence: Cultural and Organisational
Factors, New York, 1987, IEEE Press.

Wednesday, July 1, 2009

Frequently Asked Questions

click to expand How to Add Simple Dock Menu (FishEye Menu) For Blogs


A fisheye-menu/dock menu is a menu with pictorial menu items which zoom on mouse-hover, and are linked to different web pages. Please read my tutorial here!

Sunday, June 28, 2009

Be always prepared to be wrong

If being right is your goal,
you will find error in the world,
and seek to correct it.
But do not expect peace of mind.

If peace of mind is your goal,
look for the errors in your beliefs and expectations.
Seek to change them, not the world.
And be always prepared to be wrong.

Saturday, March 22, 2008

The Maha Mrityunjaya Mantra

The Maha Mrityunjaya Mantra


Om Tryamlakam Yajamahe
Sugandhim Pusti - vardhanam |
Urva - rukamiva Bandhanan
Mrtyor - muksheeya Ma - amritat ||

Meaning:
Om. We worship The Three-Eyed Lord Shiva who is fragrant and who increasingly nourishes the devotees. Worshipping him may we be liberated from death for the sake of immortality just as the ripe cucumber easily separates itself from the binding stalk.

Explanation:
The mantra is a prayer to Lord Shiva who is addressed as Sankara and Trayambaka. Sankara is sana (blessings) and Kara (the Giver). Trayambaka is the three eyed one (where the third eye signifies the giver of knowledge, which destroys ignorance and releases us from the cycle of death and rebirth).

Best Time to Chant
Chanting the Maha Mrityunjaya Mantra with sincerity, faith and devotion in Bramha Muhurata is very beneficial. But one can also do Maha Mrityunjaya japa anytime in a pure environment with great benefit and discover the happiness that's already within.

Wednesday, January 23, 2008

break

Sub PasswordBreaker()
'Author unknown
'Breaks worksheet password protection.
Dim counter As Long, startTimer As Long
startTimer = Timer
counter = 0
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
counter = counter + 1
If ActiveSheet.ProtectContents = False Then
MsgBox "One usable password is " & Chr(i) & Chr(j) & _
Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) & _
vbCrLf & "Found in " & counter & " tries," & _
vbCrLf & "taking " & (Timer - startTimer) & " sec."
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub


Sub PasswordBreaker()
'Author unknown
'Breaks worksheet password protection.
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
If ActiveSheet.ProtectContents = False Then
MsgBox "One usable password is " & Chr(i) & Chr(j) & _
Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub

Sunday, December 9, 2007

spellnumber

'Main Function
Function SpellNumber(ByVal MyNumber)
Dim Rupees, Paise, Temp
Dim DecimalPlace, Count
ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Million "
Place(4) = " Billion "
Place(5) = " Trillion "
' String representation of amount.
MyNumber = Trim(Str(MyNumber))
' Position of decimal place 0 if none.
DecimalPlace = InStr(MyNumber, ".")
' Convert paise and set MyNumber to dollar amount.
If DecimalPlace > 0 Then
Paise = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
"00", 2))
MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
End If
Count = 1
Do While MyNumber <> ""
Temp = GetHundreds(Right(MyNumber, 3))
If Temp <> "" Then Rupees = Temp & Place(Count) & Rupees
If Len(MyNumber) > 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 3)
Else
MyNumber = ""
End If
Count = Count + 1
Loop
Select Case Rupees
Case ""
Rupees = "No Rupees"
Case "One"
Rupees = "One Rupee"
Case Else
Rupees = Rupees & " Rupees"
End Select
Select Case Paise
Case ""
Paise = " Only "
Case "One"
Paise = " and One Paise only"
Case Else
Paise = " and " & Paise & " Paise only"
End Select
SpellNumber = Rupees & Paise
End Function

' Converts a number from 100-999 into text
Function GetHundreds(ByVal MyNumber)
Dim Result As String
If Val(MyNumber) = 0 Then Exit Function
MyNumber = Right("000" & MyNumber, 3)
' Convert the hundreds place.
If Mid(MyNumber, 1, 1) <> "0" Then
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
End If
' Convert the tens and ones place.
If Mid(MyNumber, 2, 1) <> "0" Then
Result = Result & GetTens(Mid(MyNumber, 2))
Else
Result = Result & GetDigit(Mid(MyNumber, 3))
End If
GetHundreds = Result
End Function

' Converts a number from 10 to 99 into text.
Function GetTens(TensText)
Dim Result As String
Result = "" ' Null out the temporary function value.
If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19...
Select Case Val(TensText)
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"
Case 14: Result = "Fourteen"
Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen"
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else
End Select
Else ' If value between 20-99...
Select Case Val(Left(TensText, 1))
Case 2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "
Case 8: Result = "Eighty "
Case 9: Result = "Ninety "
Case Else
End Select
Result = Result & GetDigit _
(Right(TensText, 1)) ' Retrieve ones place.
End If
GetTens = Result
End Function

' Converts a number from 1 to 9 into text.
Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"
Case 7: GetDigit = "Seven"
Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
End Function

Thursday, November 1, 2007

First Folio