Sunday, June 3, 2012

Countries of Southeast Asia - Part 1

Coming from Europe, via Florida, I knew very little about the countries of Southeast Asia. I knew a bit about Vietnam - because of the wars, and because there is a Vietnamese community in Poland. In the U.S. I worked with a Vietnamese, and a Filipino, but still my knowledge of Southeast Asia was pitiful.

This has been changing since I moved to Australia. Countries of Southeast Asia (SEA) are Australia's neighbours to the north, and north-west. From the Australian viewpoint to the west there is the Indian Ocean and then far far away Africa, to the south - Antartica, to the east: New Zealand, New Caledonia, Fiji, and lots of smaller islands, and then far away South America. SEA countries are Australia's closest big neighbours. They are a varied and interesting bunch. Let's start with the four biggest by population size:

Indonesia.  Population: 237 million.
Area: 1,900,000 km2 on over 17,000 islands, the biggest of which are: Java, Sumatra, Borneo, New Guinea.
Capital: Jakarta.
Official language: Indonesian (form of Malay). Over 700 local languages.
Religion: 86% Muslim, 9% Christian.

GDP per capita in purchasing power parity (PPP): 4700 USD.
Currency: rupiah.
Democratic? Yes, since very recently.
Indonesian island of Bali, where 88 Australians died in 2002 bombings, is a popular holiday destination. The almost 4 mln inhabitants of Bali are very different from the rest of Indonesia in terms of religion: 92% are Hindu.


Philippines. Population: 92 million.
Area: 300,000 km2 over 7000 islands. Capital: Manila.
Official languages: Filipino (Tagalog) and English. 170 local languages.
Religion: 90% Christian, 5% Muslim.

GDP per capita in PPP: 4000 USD.
Currency: piso/peso.
Democratic? Yes.
Philippines is famous for exporting nurses, doctors, and even priests, mainly to the U.S.


Vietnam. Population: 91 million.
Area: 330,000 km2.
Capital: Hanoi.
Official language: Vietnamese.
GDP per capita in PPP: 3400 USD.
Currency: dong.
Religion: officially 81% atheist, but traditionally Buddhist with 6% Christian minority. See Religion of the Vietnamese.

Democratic? No.
Communist Vietnam is famous for fighting first the French and then the Americans for a total period of 31 years after end of WW II.



Thailand. Population: 67 million.
Area: 513,000 km2.
Capital: Bangkok.
Official language: Thai.
Religion: 95% Buddhist, 5% Muslim.
GDP per capita PPP: 9400 USD.
Currency: baht.
Democratic? Yes.
What is Thailand famous for? The only thing that comes to my mind are Thai ladyboys.

Friday, May 4, 2012

Polish Proverbs - Part Two

Part two of the proverbs and sayings that I heard while growing up in Poland, and which I still remember. A much longer list, in Polish only, can be found on wikiquote.org.

1. Nie ma róży bez kolców. There is no rose without thorns. Even the best outcomes have some undesired effects.

2. Gdzie dwóch się bije, tam trzeci korzysta. Where two fight, the third benefits. I remember that as a call not to fight.

3. Gdzie drwa rąbią, tam wióry lecą. Where wood is chopped, the chips fly. I think this means that if something big is going on, than it has known properties that may hurt you. It is an obvious, normal thing. Stay away from trouble.

4. Człowiek uczy się na błędach. A man learns by his mistakes.

5. Mierz siły na zamiary. Measure strengths for plans. Analyse the situation, and plan properly.

6. Nie porywaj się z motyką na słońce. Don't attack the sun with a hoe. Don't attempt the impossible.

7. Jak trwoga to do Boga. When in fear then to God. Used perhaps with contempt to describe a situation when people turn to religion only when they are afraid.

8. Nie ma tego złego, co by na dobre nie wyszło. Every bad outcome turns out to be good in some way. Can you think of something good that came out from the calamity you experienced? At minimum you learn something, gain experience.

9. W zdrowym ciele, zdrowy duch. In a healthy body, a healthy spirit.

10. Strzeżonego, Pan Bóg strzeże. What is protected, is protected by God. A call to protect your things, guard your affairs, be prepared for worst.

11. Najlepszą obroną jest atak. The best defence is to attack.

12. Co dwie głowy, to nie jedna. Two heads are better than one. When you have a problem to solve, ask for advice.

13. Co komu pisane, to go nie minie. You will get, what is written for you. God has a plan for you.

14. Gdzie dwóch Polaków, tam trzy opinie. Where you have two Poles, there you have three opinions. National stereotype: not agreeing with one another.

15. Co ma piernik do wiatraka? What is the connection between ginger bread and the wind mill? The Polish version is very short, easy to utter quickly, and it was asked when speaker was talking about something not obviously connected to the previous subject. Something that required explanation.

16. Było, minęło. It was, it passed. No need to bring back the past, good or bad.

17. Co się stało, to się nie odstanie. What happened, cannot be undone.

18. Co kraj, to obyczaj. Different country, different customs.

19. Co za dużo, to nie zdrowo. Too much is not healthy. Mainly about keeping moderation in eating - don't overeat, but also in anything else. When kids are misbehaving, and the parent finally has had enough, he or she may say that. My grandma loved this one. She kept the good food locked away at all times, so wouldn't gobble it up at once. :-)

20. Co się źle zaczyna, to się dobrze kończy. What starts badly, ends well. A strange one, but often true. The point is that even if you start a relationship on a wrong foot, you can mend it. Your enemy can become your best friend.

See also: Polish Proverbs - Part OnePolish Proverbs - Part Three


Tuesday, April 24, 2012

Displaying special characters the hard way


Back in 1991 a programming language called Clipper (version Summer'87) was a popular choice for making simple business applications for IBM PC computers. Clipper was a specialised language designed to easily create business forms of 25 rows by 80 columns of characters. It was also very simple to read and write data using dBase IV format dbf files.

It had one tiny problem back then - it did not handle special Polish characters: ĄĆĘŁŃÓŚŹŻ, which at that time were encoded typically in the Mazovia code page.

Luckily, Clipper was extensible through the assembly language, so somebody wrote this little 8086 library to write and read characters using processor interrupts. I don't know who wrote it, because there was no author in the file, and every Clipper programmer had the source, so I assume it was, and is, in the public domain. The version presented here has been slightly updated by me, mainly by adding comments.

Please note: this program is very fragile and dangerous: inputs are not validated, which makes buffer overrun a possibility.

Clipper commands:
SCREENSTR read characters from SCREEN to Clipper STRing.
STRSCREEN write characters from Clipper STRing to SCREEN.

Assembly functions:
__RETNI, __PARNI, _RETC, __PARC allow passing of data to/from Clipper.
__PARNI, for example, allows passing of a Clipper numeric value to the assembly language, see Nantucket's Guide to Clipper here.
__PARC places the address of a Clipper character string in DX:AX.

16 bit registers like DX can can be accessed as DH and DL - higher and lower byte. Read the guide to 8086 registers, by Thomas Scarff, and the guide to Input and Output (I/O) in 8086 by Joe Carthy for more information.

And here is the assembly code:


PUBLIC   SCREENSTR
PUBLIC   STRSCREEN

EXTRN    __RETNI:FAR
EXTRN    __PARNI:FAR
EXTRN    __RETC :FAR
EXTRN    __PARC :FAR

DGROUP   GROUP   DATASG

DATASG   SEGMENT 'DATA'
; string to return to Clipper
         RETSTR DW 80 DUP (0)  
DATASG   ENDS

_PROG    SEGMENT 'CODE'
; cs -> code, ds -> data
         ASSUME cs:_PROG,ds:DGROUP 

SCREENSTR PROC   FAR


; save registers
          push bp         
          mov bp,sp
          push ds
          push es
          push si
          push di


; get param. #1: row into dh
          mov ax,1        
          push ax
          call __PARNI
          add sp,2
          mov dh, al
          push dx


; get param. #2: col into dl
          mov ax,2        
          push ax
          call __PARNI
          add sp,2
          pop dx
          mov dl, al      


; get video page in bh
          mov ah,0fh
          int 10h         


; set cursor
          mov ah,02h
          int 10h         


; get param. #3: count into cl
          mov ax,3        
          push ax
          call __PARNI
          add sp,2
          mov cl, al
          mov ch, 0        


; di is an index for RETSTR
          mov di, 0        
          push di


; start loop1
; bh: video page, read char
loop1:    mov ah,08h        
          int 10h           


; write to RETSTR
          pop di
          mov RETSTR[di],ax 


inc. offset  
          inc di             
          inc di
          push di


; inc column
          inc dl           


; set cursor
          mov ah,02h       
          int 10h         
; loop: dec cx 
          loop  loop1      


; restore registers
          pop di           
          pop di
          pop si
          pop es
          pop ds
          pop bp


; return string
          mov dx, seg RETSTR       
          mov ax, offset RETSTR
          push dx
          push ax
          call __RETC
          add sp,4

          ret

SCREENSTR ENDP

STRSCREEN PROC   FAR

          push bp
          mov bp,sp
          push ds
          push es
          push si
          push di


; get param. #2: row
          mov ax,2         
          push ax
          call __PARNI
          add sp,2
          mov dh, al
          push dx


; get param. #3: col
          mov ax,3         
          push ax
          call __PARNI
          add sp,2
          pop dx
          mov dl, al
          push dx


; get param. #4: count
          mov ax,4         
          push ax
          call __PARNI
          add sp,2
          mov ch,0
          mov cl, al
          push cx


; get param. #1: string
          mov ax,1         
          push ax
          call __PARC  
          add sp,2
          mov es,dx
          mov bp,ax


; get video page (in bh)         
          mov ah,0Fh
          int 10h          
          mov bl,0


; write to screen
          mov ah,13h
          mov al,2
          pop cx
          pop dx
          int 10h          

          pop di
          pop si
          pop es
          pop ds
          pop bp

          ret

STRSCREEN ENDP

_prog    ENDS
         END



Friday, April 13, 2012

Silence before the Storm


I'm scared. As a civilisation, we are moving very quickly towards our total destruction.

No, I am not talking about global warming. We can deal with that. Even if we do nothing to control the amounts of greenhouse gases in the atmosphere, and it becomes unbearably hot in some places, and sea levels rise 80 meters making countries like the Netherlands and Bangladesh disappear under water, we will survive. We will relocate to higher, cooler places. We will ban combustion engines, or more likely we will get CO2 out of the air and store it underground. Climate change will be disruptive, it will be unpleasant, but we will adjust. Countries will help each other, or will fight each other, or mayhem will rein, but our civilisation will survive. We may even be better off: we may develop technologies that allow us to control the climate globally whatever the cause, and we may embark on ambitious projects like making deserts habitable by changing local climate. All good stuff.

I am talking about something much more sinister, namely: robots and AI. We blindly keep developing technologies that are a mortal danger to us. Our latest "achievement" is Boston Dynamics' newest robot: PETMAN, or as it should be called, the Terminator, because it is ghastly similar to the original killing robot.

PETMAN's development started at least a year ago under a ruse of testing soldier uniforms. It is however the first serious example of a dangerous new weapon category: a humanoid robot. These robots will be able to use anything that was designed to be used by humans, anything that has a human interface. They will walk the stairs, open doors, move things, turn on and off switches, valves, operate heavy machinery, drive tanks, fly planes. They won't need machine guns for arms. They will be able to pick up any gun and use it. This is what makes them a new weapon category. There was no such thing in the past. We were making specialised military robots: flying drones, scouting, guarding, and combat vehicles, and now we created a robot that can control them.

Can we control it? Can we control the person who will send millions of these robots on a mission? As a civilisation we have a poor track record of stopping those in power from committing crimes against humanity. We actually have laws in place that give those in power immunity and the right to secrecy.

Combined with the latest advancements in sensory input processing and AI, examples of which are Google's self-driving cars, IBM's Watson supercomputer, and Apple's Siri, we are making a weapon much more dangerous than nuclear, chemical, or biological weapons. Those weapons were dumb. We would use them once or twice, see how terrible they were, and put them away. It may not be possible to put away a million highly intelligent PETMANs that can build, repair, and recharge themselves, know exactly were they are, access any map, and all human knowledge in milliseconds. Once let out, they may not come back.

Behind many of these technologies is DARPA, and their newest robotic challenge is probably one step too far. We could ban robotic and AI development on international level before singularity happens, but will we do it?

Post scriptum: PETMAN climbing stairs...

Friday, March 30, 2012

Neither Here nor There


In Neither Here nor There: Travels in Europe Bill Bryson retraces his earlier travels in Europe when he was a young American student and liked Europe so much that he decided to stay.

Now, in 1990, he starts in Norway travelling by bus to the northermost point to see Aurora Borealis. Then he visits France, Belgium, Germany, Netherlands, Denmark, Sweden, Italy, Switzerland, Liechtenstein, Austria, Yugoslavia, Bulgaria, and finishes in Turkey. Going by plane, bus, train or on foot, he constantly wonders about the beauty and ugliness of European cities, strange customs, and laws. He meets people of all nationalities and often makes fun of them. Bill generalizes and makes fun of whole countries too. Sometimes he uses black humor, sometimes he swears. Be warned: you may be offended. He describes shopping windows in the red lights district in Amsterdam  and in other cities. He gets drunk, he goes to museums, sleeps in expensive hotels,  and in shabby ones. He gets robbed, and experiences bureaucracy at its worst. He falls in love with some places, and is disgusted by others. In the end, tired, he's ready to go back to his wife and children in England.

Reading "Neither Here nor There" felt like travelling with Bill. You will enjoy this book if you are a man, are not easily offended, and you like to travel on the rough side. And please remember: people change, places change, and whole countries change too. The Europe from Bill's travel no longer exists, and spending a few days or even weeks in a country gives you a very shallow and perhaps skewed knowledge of its people and customs.

Friday, March 2, 2012

Membricks Update

The coding of Membricks has stalled for the last month or two, but I will get back to it soon. Currently, in my limited free time I am working on a Research Proposal for a Master by Research degree, which I would like to attempt and complete at QUT in Brisbane. I'd like to research how an application like Membricks can improve effectiveness of vocabulary learning in a real-life environment. 

Here is a screenshot of the current version of Membricks running in an iOS Simulator with English/French deck:

Friday, February 17, 2012

Polish Proverbs - Part One

Proverbs and sayings are like psychology, sociology, history, and economics books condensed to one sentence statements that make it easy for us to remember the essence of the story. Proverbs often contain old knowledge, something that was observed to be generally true for hundreds of years, across villages and towns. It may no longer be true in our curent world, or it may have never been true in another culture or in another place, but sometimes it's eerily adequate today.

Here is a collection of proverbs and sayings that I remember from my youth. I grew up in a small town in the Mazovia region of Poland and I heard these mainly from my grandparents throughout the 1980s.

1. Kto pod kim dołki kopie ten sam w nie wpada. He who digs holes under another, falls into them himself. He who plots against somebody, falls himself the victim of that plotting.

2. Kto mieczem wojuje, od miecza ginie. He who fights with a sword, dies from a sword. This one was supposed to make you think before you use "the sword". Is it worth attacking? You may meet with retribution in kind.

3. Do odważnych świat należy. The world belongs to the brave. You must take action, or risk, to achieve something.

4. Nie święci garnki lepią. It is not the saints who glue (form or make) pots. Making pots from clay was probably seen at one time as a very complicated process, maybe almost magical. The proverb is encouraging us to believe that we - the regular folks - can do it too. It is not "the saints" (people who can make miracles) who make pots, it is people like us.

5. Lepiej z mądrym stracić niż z głupim znaleźć. It is better to lose something while in a company of a wise man, than to find something while in a company of a fool. Stay away from fools.

6. Z kim przestajesz taki się stajesz. You become like those you hang around with. Pick your friends, collegues, and in the broad sense everything around you carefully, because it will affect you. You will adjust, regardless of if you want it or not, and become like the ones you spend most time with.

7. Nie rób drugiemu co tobie nie miłe. Don't do to the other, what you don't like done to you.

8. Jak Kuba Bogu, tak Bóg Kubie. As Coby (Jacob) to God, so God to Coby.

9. Nie chciała góra przyjść do Mahometa, to musiał Mahomet pójść do góry. The mountain didn't want to come to Mahomet, so Mahomet had to go to the mountain. Sometimes you have to make the first move.

10. Upiec dwie pieczenie przy jednym ogniu. Make two roasts with one fire. A much gentler version of the English equivalent: Kill two birds with one stone. Use one event, or thing in a clever manner to achieve two goals.

11. Lepszy wróbel w garści, niż gołąb na dachu. Better a sparrow in the hand, than the pigeon on the roof. Settle for less. Having something now, even small, is better than trying to get something bigger, which is visible, but not achievable.

12. Do wesela się zagoi. It is going to heal before wedding. Usually told to a small child when he or she is crying after suffering a small injury. The said wedding is probably at least 15 years into the future, so yes, it's probably going to heal.

13. Czas leczy rany. Time heals wounds.

14. Gość w dom, Bóg w dom. A guest enters the house, the God enters the house. Treat the guest as if it was Jesus Christ himself. The source of this one is probably in the teachings of the Catholic Church. Jesus is supposed to test us by showing up as a beggar, or some other needy person, and we pass the test if we help him, not recognising him for being God.

15. Pies ogrodnika: sam nie zje i drugiemu nie da. Gardener's dog: it will not eat something, and it will not let another to eat that. Meaning: a person, who doesn't share despite that he or she has no use for the thing in question.

16. Odpłacić pięknym za nadobne. Pay back with beautiful, for the pretty. This one has a strange, ironic meaning. It is used when you do something bad to a person who did something bad to you earlier. You are paying back with an "ugly" deed, for an "ugly" deed.

17. Prawdziwych przyjaciół poznaje się w biedzie. You learn who your true friends are when you are poor (in need).

18. Z rodziną najlepiej wychodzi się na obrazku. This one is difficult to translate literally. It means something like: you look best with your family in a family picture. It is used when the family hurts you or in some other way disappoints you. You all look fine in the photo, but in reality, you aren't.

19. Z głupim się nie dyskutuje. You don't argue with a fool. It is a waste of time to argue with a fool, he won't understand you anyway.

20. Baba z wozu, koniom lżej. Old woman off the cart, the horses have it easier. Used ironically or with anger to come to terms with the fact that we lost something or someone, or that someone abandoned us.

21. Gdzie kucharek sześć, tam nie ma co jeść. Where you have six cooks (female form), there is nothing to eat. You need one boss, not six, to get things done.

22. Dla chcącego, nic trudnego. For someone who really wants, nothing is difficult.

23. Bez pracy, nie ma kołaczy. Without work, there is no sweet bread.

24. Jak sobie pościelesz, tak się wyśpisz. You will sleep well if you make your bed well. If you don't prepare, don't expect a good result.

25. Diabeł tkwi w szczegółach. The devil is in the details. Used when something looks easy at first glance, but isn't.

26. Łatwiej powiedzieć, niż zrobić. Easier said than done.

27. Ten kto daje i odbiera, ten się w piekle poniewiera. He who gives and then takes away, roams in hell. Never take away what you have given.

28. Dwa razy daje, kto szybko daje. He who gives promptly, gives twice. If you give something without hesitation, it can do more good.

29. Zastaw się, a postaw się. Take a loan, but meet put food on the table. You may need to go into debt to do what is expected from you. The thing in question that you need money for, may not be really important, it may be a matter of hosting your guest lavishly.

30. Jak się nie ma co się lubi, to się lubi co się ma. When you don't have what you like, you like what you have. Try to like what you have.

31. Zamienił stryjek siekierkę na kijek. A cousin exchanged an axe for a stick. Used when you do something stupid, especially exchange one thing for another that is cheaper.

32. Gdy się człowiek spieszy, to się diabeł cieszy. When a man makes haste, the devil is happy. Rushing things will cause something to go wrong.

33. Spiesz się powoli. Rush slowly. Don't make haste.

34. Gdyby kózka nie skakała, to by nóżki nie złamała. If the little goat had not been jumping, it would not have broken her leg. Told to a little child, when it hurts itself jumping or climbing.

35. Kochajmy się jak bracia, liczmy się jak Żydzi. Let's love each other like brothers, let's count ourselves (keep our finances) like Jews. Let's be friends, but when it comes to money let's keep it business-like, let's keep it fair, so we can stay friends. The purpose of this proverb is to remind people not to take any financial advantage of their friends.  Note: like all generalisations, negative or positive stereotyping by nationality, religion, gender, profession, etc. allows us to turn on the autopilot... and drive right into the ditch.

36. Niedaleko pada jabłko od jabłoni. Not far from the apple tree, an apple falls. Children are similar to parents. Used when the child in question does something bad, and the parent is known to be a bad person.

37. Czego Jaś się nie nauczy, tego Jan nie będzie umiał. What little Johnny doesn't learn, the big John will not know.

38. Zgoda buduje, niezgoda rujnuje. An accord builds, a discord ruins. Cooperation, compromise builds. Disagreements, quarrelling destroys, ruins. Family or neighbourly feuds had a long history in Poland. This proverb reminds that making mends and living in harmony is better than fighting.

39. Na pochyłe drzewo, każda koza skacze. Any goat can jump on a leaning tree. When something is easy, anybody can do it.

40. Nie ma dymu bez ognia. There is no smoke without a fire. When there is an effect, there must be a cause.

41. Darowanemu koniowi nie zagląda się w zęby. Don't look at teeth of a horse that you received as a gift. Be glad for any gift you receive, regardless of its value. Apparently, when buying a horse you can tell its age and health by checking the state of its teeth.

42. Jedna jaskółka nie czyni wiosny. One swallow doesn't make Spring. To be sure, sometimes you need to wait for multiple confirmations.

43. Nie od razu Kraków zbudowano. Kraków wasn't build at once. English version: Rome wasn't build in a day. Things take time, be patient.

44. Kuj żelazo póki gorące. Forge iron while it is hot. Continue promising endeavours promptly.

45. Co się odwlecze to nie uciecze. What is delayed, is not gone. Some things are inevitable. I think this one would be said by someone who was late in doing something, but wanted to assure another person that the thing in question would be done.

46. Ciasne, ale własne. Tight (small), but your own. It is better to own your house or apartment, however small it is, than to rent or share.

47. Szlachcic na zagrodzie równy wojewodzie. A noble man on his farm is equal to a statesman. Every member of mobility, and that was a relatively large class in Poland, was equal regardless of personal wealth or position. For a few centuries Poland had kings elected by nobles.

Follow-up: Polish Proverbs - Part TwoPolish Proverbs - Part Three