May 03 2008

Windows Presentation Foundation and Model View Controller

Published by under Computers - General

A while back, Josh Smith wrote an article on Unit Testing and Model View Controller. The article features a small application that lets the user view some sample images. The WPF application uses and discusses the Model View Controller. While my kids were at swimming today, I analyzed the source code, to try to understand what's going on. There is not really that much source code there, but understanding what's going on requires that you understand WPF fairly well [try to figure out how the text items get into the list box, for instance]. I have tried to diagram my understanding of what's happening.

050308 1328 wpfandmvc12 Windows Presentation Foundation and Model View Controller

 

All this leads me to think about Unit Testing and WPF, and the question: Is unit testing worthwhile for UI? And at what point in time (or complexity) does it make sense to use the MVC or Model View-View-Model-Model pattern?

What do you think? – leave a comment.

No responses yet

May 03 2008

Vincent Van Gogh

Published by under Art

Vincent Willem van Gogh (30 March 1853 – 29 July 1890) was a Dutch Post-Impressionist artist. His paintings and drawings include some of the world's best known, most popular and most expensive pieces.

This is a very well known self-portrait of Vincent, the artist placed against a blue, swirly background. The intense eyes and rather stern expression foreshawdow some of the mental illness that was to appear later in his life. There's something I like about the picture, but I can't quite put my finger on what it exactly is. Perhaps this is what makes this painting so good.

050308 1339 vincentvang1 Vincent Van Gogh

2 responses so far

May 02 2008

Using the Tortoise SVN Create Patch and Apply Patch feature

Published by under Computers - General

The Create Patch and Apply patch Tortoise SVN commands are a developer's friend. Here's why. Let's say you worked on a piece of functionality and you need it code-reviewed by someone not on site. Since you don't want to commit, how do you get the software to the reviewer? Or what if you want to take some uncommitted work from one of the workstations in the common area transfer it to your laptop?

Creating the Patch

  1. Do a SVN Update to get the latest bits from the trunk.
  2. Go to the top-level folder in your project tree in Windows Explorer, right click and choose Create patch.

    050208 1225 usingthetor13 Using the Tortoise SVN Create Patch and Apply Patch feature

  3. The Create Patch dialog comes up – up, listing (a) items you have made changes are checked, (b) items you have on your local system, but that are not in the repository are unchecked.

    050208 1225 usingthetor23 Using the Tortoise SVN Create Patch and Apply Patch feature

  4. Any files with the checkmark will go into the patch (actually only the diffs go into the patch file). Click OK, and you are prompted to save.
    050208 1225 usingthetor33 Using the Tortoise SVN Create Patch and Apply Patch feature
  5. Congratulations, you have created your patch!

     

Applying the patch

  1. Go to the machine you wish to apply the patch to, and do a SVN update. Also do a SVN Revert, to minimize chances of conflicts later on. Now your machine's sandbox should match the repository.
  2. Copy the patch file from removable media or from the network to your local machine.
  3. Choose SVN Apply patch.
    050208 1225 usingthetor43 Using the Tortoise SVN Create Patch and Apply Patch feature
  4. Locate and open your .patch or .diff file:
    050208 1225 usingthetor53 Using the Tortoise SVN Create Patch and Apply Patch feature
  5. Tortoise will launch its merge program (you can configure what program to launch under tortoise options, unified diff viewer), and the file patch window. Right click anywhere in the "File Patches" window, but not on any specific file, and choose patch all.
    050208 1225 usingthetor63 Using the Tortoise SVN Create Patch and Apply Patch feature
  6. As soon as you choose this command, Tortoise will silently patch your files, and you're done. To verify its work, you can attempt to do a commit and see what the changes are.

     

Happy patching!

One response so far

May 01 2008

René Magritte

Published by under Art,Computers - General

René François Ghislain Magritte (November 21, 1898 – August 15, 1967) was a Belgian surrealist artist. He became well known for a number of witty and amusing images.

I use the following image as the desktop background when I log in. I like the blue sky tones suggesting freedom, but when you open the window, there is darkness. Sometimes things are deceptive…

050108 1219 renmagritte14 René Magritte

If you would like to have this picture as your background on Windows XP when you log in [it only changes the background while the login dialog is present!], please follow the following steps: [Note: I'm pretty sure this only works if you get a login dialog, not the login screen where you click icons to log in]. If you wish to modify such an icon-based (Fast User Switching) login screen, it is possible to use another tool such as Logon Studio. If you get a logon dialog, the following instructions apply:

  1. Download the Magritte.bmp file from here. [You may need to right click on the link and save, see step 2]
  2. Save the file in your Windows directory (usually c:\windows), you must have administrative privileges to do this.
  3. Download installwallpaper.reg to your desktop (save it there) and double click it. The system will ask if you want to merge the contents to the registry. Click 'yes' to accept. [Verify the contents with a text editor, if you are paranoid, before clicking 'yes']. This will add the image to your background of the login screen, and change the background colour from blue to black. Delete the .reg file from your desktop.
  4. To see the image, log off.

No responses yet

Apr 30 2008

Beware of false teachings

Published by under Christian

About noon the following day as they were on their journey and approaching the city, Peter went up on the roof to pray. He became hungry and wanted something to eat, and while the meal was being prepared, he fell into a trance. He saw heaven opened and something like a large sheet being let down to earth by its four corners. It contained all kinds of four-footed animals, as well as reptiles of the earth and birds of the air. Then a voice told him, "Get up, Peter. Kill and eat." "Surely not, Lord!" Peter replied. "I have never eaten anything impure or unclean." The voice spoke to him a second time, "Do not call anything impure that God has made clean." Acts 10, 9-15

There is an unfortunate tendency in many mainline Churches to preach a new theology, which (paraphrased by me) states that everything is OK, that you only need to believe in Christ, and that everything else is taken care of. Be happy, rejoice, and wait for heaven. Proponents of this would likely want point at the above scripture, at Peter's vision. In the vision, Peter is being asked to do something ritually unclean, to eat something which was prohibited by the laws of the old Covenant. The voice of the angel tells Peter not to call anything impure that God has made clean. Does this mean that that no matter what I do, God has already made me clean, and I have nothing to worry about?

Earlier in the Acts, there is a story about Simon the Sorcerer, who tries to persuade Peter to sell him the power to give the gift of the Holy Spirit to people.

Peter answered: "May your money perish with you, because you thought you could buy the gift of God with money! You have no part or share in this ministry, because your heart is not right before God. Repent
of this wickedness and pray to the Lord. Perhaps he will forgive you for having such a thought in your heart. For I see that you are full of bitterness and captive to sin."
Acts 8, 20-23

Simon is encouraged to repent of his ways, to turn around and walk a different way, and I believe that we need to look at ourselves, turn around, and try to do things in our lives that are pleasing to God.

While faith in Christ is the key requirement for forgiveness of sins, true disciples will want to try to turn away from sin. As a Christian, it is not OK to do anything bad that comes to mind.

"Why do you ask me about what is good?" Jesus replied. "There is only One who is good. If you want to enter life, obey the commandments." Matthew 19, 17

One response so far

Apr 30 2008

Edward Hopper

Published by under Art

Edward Hopper (July 22, 1882 – May 15, 1967) was an American painter and printmaker. While most popularly known for his oil paintings, he was equally proficient as a watercolorist and printmaker in etching.

I came across this painting, which I appreciate for the mood that it exudes. I found it while looking at information about straight razors, a more environmentally friendly way to shave.

043008 1153 edwardhoppe14 Edward Hopper

No responses yet

Apr 27 2008

Spring Music at St. George’s Church

Published by under Music

I am a member of a little German Choir, at St. George's Lutheran Church in Toronto, which normally has just one concert a year at Christmas (even though we attend First Lutheran Church). This year Burkhard Moeller, the pastor's husband, asked if I could participate in the spring concert. I initially said no, because a lot of things were happening on the weekends with the kids and that joining the practices would be difficult. Burkhard then called me, asking me to join anyways because there was a shortage of basses – a problem if your choir only as 12 people. So I agreed to come to the practices that I could attend. Manya, my dear wife nearly had a fit – heart attack – or nervous breakdown, mentioning that other things were happening at nearly all the practices, and that the kids' soccer collided with the concert, which we performed today.

Despite the problems, I was able to attend 4 of the practices and the concert – I also played the soprano recorder. Here the choir part of the material we sang:

     
 

Alta trinita Beata

From Italy, 15th century

Die gueldene Sonne

Johann Georg Ebeling

Zuvor, so last uns gruessen

Werner Gneist

Kommt herzu und lasst uns Froehlich sein

Heinrich Schuetz

Singet dem Herrn ein neues Lied

Heinrich Schuetz

Wir lieben sehr im Herzen

Daniel Friderici

Jauchze, frohlocke, du himmlischer Chor

Anonymous

Hinunter ist der Sonnenschein


Melchior Vulpius,
text: Nikolaus Herman, 1480-1561

 I really liked the last piece, both from the melody and text wise. The text goes as follows:

Hinunter ist der Sonnen Schein,
die Finstre Nacht bricht stark herein.
Leucht uns, Herr Christ du wahres Licht,
lass uns im finstern tappen nicht.

The sun's last beam of light is gone,
The shades of night come swiftly on;
O Christ, our Light, upon us shine
Lest we to sin's dark ways incline.

Dir sei Dank dass du uns den Tag
vor Schaden G'fahr und mancher Plag
durch deine Engel hast behuet
aus Gnad und vaeterlicher Guet.

The sun's last beam of light is gone,
The shades of night come swiftly on;
O Christ, our Light, upon us shine
Lest we to sin's dark ways incline.

Durch deinen Engel die Wach bestell,
das suns der boese Feind nicht faell;
vor Schrecken, Angst und Feuersnot
behuet uns heut, o lieber Gott.

Let angels guard our sleeping hours
And drive away all evil powers;
Our soul and body, while we sleep,
In safety, gracious Father, keep.


The concert was a good one, even though relatively few people attended. For me, the goal is not to impress people, but to sing joyfully onto the Lord, and to be with people who enjoy making music in an unpretentious setting. A recording of all of the music is available here if you are interested.

    

No responses yet

Apr 27 2008

It’s like hot, running water…

Published by under Music

Been listening to DJ Shog's Hot Running Water on Sirius 33 (would you expect me to listen to trance?) The lyrics are interesting, an go like this... (I think they are still incomplete, because there is a reference in to depression in the song as well. Irma Esselien Florence is the one performing the vocals in this tune.

-----------

It's like hot, running water,
When you're tired of the pressure
And there's no room for mistake

It's like hot, (like hot) running water, (running water)
As it runs through your fingers,
Living in burning pain

Love's like hot (like hot), running water (running water),
Once it runs through your fingers,
Painful in every way

How it hurts to lose a partner,
How it hurts to lose a friend.

There is no wound, but still there is agonizing pain

When you're tired of the pressure,
There is no room for mistakes,
And the words don't seem to make it right,
No matter what you say

It's like hot, (like hot) running water, (running water)
As it runs to your fingers,
Living in burning pain

Love's like hot, (like hot) running water (running water...)
Once it runs through your fingers,
Painful in every way

How it hurts to lose a partner,
How it hurts to lose a friend.

There is no wound, but still there is agonizing pain

When you're tired of the pressure,
There is no room for mistakes,
And the words don't seem to make it right,
No matter what you say
 

Jesus answered her, "If you knew the gift of God and who it is that asks you for a drink, you would have asked him and he would have given you living water."

No responses yet

Apr 27 2008

Butting the line…

Published by under Computers - General

Its sign up time again for the City of Toronto classes, which include swimming, dancing, sports and various camps.  I remember standing in line at 4:00am in the morning at the Franklin community centre with dozens of other parents a few years back - it was first come, first serve.  People had brought in chairs, blankets etc...; it gets cold waiting in line.

Then the city moved to Telephone registration.  You got a family number, and child number, course number and you did everything by phone, provided you could get past the busy tone.

Then came the internet, and signing up for courses became much easier.  Go to your computer at 7:00am, pick the courses and voila. 

But that's not fair - people without internet access can't sign up as easily and are treated as second class citizens.  Thats why the city of Toronto came up with a Maximum number of Sessions for their website.  A means to throttle the users into more manageable chunks while being more fair.  You go to the site http://efun.toronto.ca/torontofun and, if you are exceeding the number, you get a polite message about how the number of sessions was exceeded, and the reason thereof.

On the other hand, we have a busy life, and need to get our kids to school, finishing up with the registration.  So I quickly (<5min) wrote the script below using ruby  ruby182-15.exe (object oriented scripting language) and Watir watir-1.4.1.exe (a framework for testing web applications using ruby). Once those two things are installed, load the following into your favourite editor...

require 'watir'
test_site = 'http://efun.toronto.ca/torontofun'
ie = Watir::IE.new
ie.goto(test_site)
while ie.contains_text("Maximum Sessions")
    ie.refresh()
end

Even if you're not a programmer, this is pretty clean and easy to understand. Saved it as efun.rb, and double clicked.  Internet explorer went to the site, and did the equivalent of hitting the refresh button at the rate of 3 to 5 refresh cycles per second, flooding the server with requests.  In less than 5 minutes, we had the normal start screen showing. The script had done its job.  The little hacker in me rejoiced and I'm actually proud of this little script.

Now is this ethical and fair?  I'm not sure. We could have been clicking refresh 2x per second manually to try to get in; I just automated the whole thing.  In any case I posted this if you were curious...

Therefore, as God's chosen people, holy and dearly loved, clothe yourselves with compassion, kindness, humility, gentleness and patience. Col 3,12

No responses yet

Apr 27 2008

Account of a Kidney stone episode…

Published by under Health

The following is an account of an episode of Kidney Stones, which I had during the second week of June. Friday, June 8,2007. It is around 9:00pm. I feel tired and decide to go to bed before the kids; there is some dull pressure on my left lower back – I am not really concerned because I know I have some kidney stones in there. Three of them to be precise, last time I went to the urologist I was told they were all below 4 mm in size, too small to be smashed by ultrasound electrolithotrypsy. Saturday, June 9. I wake at 3:30am and immediately realize that the pain on the left side has gotten worse, much worse. I decide that the pain is bad enough to warrant a trip to the hospital; as an experienced kidney stone patient I know what to do. I take two tablets of Percocet, a pretty strong pain killer, and take one suppository of Endomethacine, and anti-inflammatory agent that works very well long term when faced with Kidney stone pain. Manya is still asleep – I decide that it is better to let her sleep; there is nothing she can do anyways. I write a quick note saying that I will be at the TEGH (Toronto East General Hospital) and that she won't be able to reach me on my cell phone. I only take my Health and hospital cards and leave on foot to the Hospital. My typical symptoms are there: pain on the left flank, nausea and unsettledness. While walking, the pain crystallizes in my left flank, radiating like light in the outside areas. Finally, I reach the hospital. It has been about 20 minutes since I have taken the Percocet pain medicine. With my metabolism, it takes about 40 minutes for the tablets to be effective. Its 4:10am as I enter the emergency. A security guard asks me to put on a mask, just in case I have SARS. There's one person ahead of me in the lineup of the triage nurse. A glance at the waiting room astounds me: the waiting room is completely empty! It's my turn now. I explain that I'm having a renal colic – the nurse understands, writes down my symptoms, takes a quick temperature and blood pressure and tells me to line up at the admitting. This also goes quickly – I have to show my health and hospital cards and get two ID bands, one that says I'm allergic to Quinine sulfate and the other one that has my name and other information. I'm given a chart and told to go to the station. There, I'm assigned a room with a bed, and have to wait. Fortunately, the pain medicine now has kicked in, and the pain is now quite manageable. What should I do if they offer me morphine? Thirty minutes later, an emergency physician, Dr. S. Sirna examines me. I'm careful to explain the symptoms that I have, and list them, stating that these correspond to what I have previously experienced as a renal colic. Some doctors really hate it if you go into their office with a diagnosis already made up. But in this case, I was pretty sure. He examines my abdomen, and listens to my breathing. He asks how many previous episodes of stones I have had. I answer that it is about fifteen or so, since 1992. He asks if I need pain medication, but I decline, since the pain has become manageable. A nurse comes to take some blood for an analysis and leaves; they wait for the shift change. At 6:00am, the shift changes, the doctors transfer the knowledge of what has happened with what patient and the nursing staff also changes. There is usually more buzz in the department. Around 7:00 a new physician comes to greet me. We agree that it is best to do a normal KUB, and abdominal X ray to see what is going on, after finding out that all of my previous stones were calcium based. Calcium based stones do show up in an X-ray, some of the other types do not. Around 8:00am, I go to the imaging department, where a nice young lady takes two pictures of my abdomen. I tell her to expect more than one stone in the X-ray. After the imaging is complete and developed, she tells me there are three stones. Want to see, she asks? I glance at the computer monitor, where she points out three lumps of gray, one going down the urethra, the other two still located inside the kidney. From the picture they look big. The technician makes some comment about there being some likely problems passing the stones and wishes me good luck. It's close to 10:00am, it takes time for the doctors to make the rounds of the emergency. The doctor tells me that the stones are there, and that I urgently need to see my urologist, Dr. Kell. He prescribes more Percocet and endocet suppositories and lets me go. I finally go home. The pain is almost completely gone. I now have to fill my prescriptions, as I know that I am sitting on a time bomb. By 1:30pm I am all done, and wind up talking to my sister all afternoon – her server's hard disk crashed and she needed some support. Saturday, June 9th, 9:30pm. The kids are finally in bed. My kidney pain comes back, all of a sudden with a vengeance. I feel sick to the stomach, but not enough to actually throw up. I take two more Percocet tablets, and another suppository. Around 10:00pm, I decide that the pain is such that I can't control it with Percocet anymore. I remind myself that Percocet has 500mg of Tylenol and that the maximum daily dosage of Acetaminophen is around 2000mg – after that you can poison yourself. I take another Percocet before leaving - thinking that it may take some time until I'm seen. The emergency physisican had told me: "If you can't control the pain with the Percocet, come back. Just tell them that they have confirmed that you have stones and they will take you in, and we will give your morphine". I then leave for the Hospital, one more one foot. I could have taken a cab, but it would not have been much faster. Around 10:25pm, I get to the emergency department of TEGH, and the waiting room is full. I am greeted by a elderly stern, thin nurse with a British accent. I tell her my story and that I'm in pain. Same routine, admission, bracelets are due. I'm told I will have to wait at least 1 hour as there are no beds. As my pain is getting worse I'm almost going crazy. Why can't they have morphine drips in the waiting room? I pace up and down the corridor, restless and miserable. At 11:45pm, I can't bear it anymore – I go to a pay phone and call Manya. I had made the critical mistake of not brining extra Percocet tablets with me. I told her to send the medicine per cab courier to the Hospital. Around midnight, I picked up the package with pills and a water bottle in front of the Hospital emergency. I immediately took two Percocet tablets – at this point I did not care anymore – I just wanted the pain to go away. Around 1:00am, I finally got my bed, and a morphine drip. The nurse in the ER was a bit careless however, the IV somehow was blocked and not dripping – I had to call her back two times to get the medicine to flow. This "not checking" if the IV was really working happened a few times at the hospital and as a patient shows to me a severe lack of professionalism. The rest of the evening was spent in the arms of Morpheus, the god of dreams in Greek mythology. Even with the morphine, the pain was still present, just dulled and made more bearable. Sunday, June 10, 8:00am. The emergency doctor comes in, and we agree that it is probably a good idea to do a CAT scan. He asks about previous CAT scans as he is concerned about the levels of radiation. Around 9:00am, the CAT scan happens; a friendly young blond woman is the technician. After the CAT scan, I'm moved to the CDU (Critical Decisions Unit), a small room with 6 beds. Here all the poor slobs that need procedures are gathered, and decisions regarding possible surgical interventions are made. Morphine keeps flowing, I just have to ask for it – I get a bag of 5mg every 2 hours or so. The morphine is diluted in 50 ml of 5% dextrose; they add gravol, and then drip it in slowly over a 10 min period. This prevents getting a rush or high – a good thing – because morphine is extremely addictive. I have been given morphine directly before, and the instant you're injected with it you feel like you have to throw up, and then you get a warm itchy relatively pain-free feeling. The drip is the better solution, for sure. They are careful – nurses always measure your blood pressure; if it is below 100, you cannot get pain killers, opiates including morphine depress the Central Nervous system. I am still under the care of Dr. Sam, the current emergency physician. Around 2:00pm, a Doctor comes in. He introduces himself as Dr. John Morell, the on-call Urologist. He has already spoken to my Urologist, Dr Kell and now we discuss the options. He offers to go in with a scope and to blast the two reachable stones with a laser, and then to put in a stent, a small flexible plastic tube into my urethra, the tube connecting the kidney and bladder. I have had stents before, and a similar procedure done by Dr. Kell about one and a half years ago. My questions were: have you ever done this before? And would Dr. Kell be OK with this? He assured me that this type of procedure is a "Bread and Butter type of urological procedure that all urologists can perform. I sign the consent form. Dr. Morell says he will try to schedule sometime in the Operating Room tonight, but that it may get bumped if a higher priority case comes in. Around 6:00pm, Manya comes with Anna. Just around then, I get sick to the stomach, and throw up right into a plastic container. I am a bit surprised, since I have not eaten anything in the last 24 hrs. Around 7:00pm, I am moved to the 5th floor to the surgical and Urological unit. It's a nice 2 person room, with another man in the bed next to the Window. The bed is considerably nicer than what they had before. I am anxious to know when the procedure will happen, and keep ordering morphine drips every two hours. At 9:30pm, I am informed that the procedure will not likely happen today (Sunday). At this point I have limited mobility; the IV's are hanging from a stand with wheels; I can get up, drag the stand into the washroom. Nurses are much nicer (more caring) than in the ER. The night is a disastrous one, not knowing how much longer I will have to suffer. Hours go by slowly, after each bag of morphine, I sleep for a bit, and then wake again. Sunday, June 11th. I have to wait the entire day until 6:30pm, when a familiar looking guy with a colourful OR cap comes to pick me up. They bring me to the sixth floor, to the operating room. I am greeted by a nurse who asks a number of questions – concerning if I have dentures etc.. Dr. Morell is also there, and tells me not to worry. I request to speak to the anastetheologist, who has not yet arrived. Finally, I enter the tech-filled OR room. I notice to huge plasma monitors arranged in portrait mode next to each other, with a keyboard suspended in mid air by a jig. Cool. They have lots of portable X-Ray equipment stored in the room, but everything is clean and tidy. The OR bed is very uncomfortable, and the nurse comes and brings a heated blanket which feels really wonderful as the OR is frigid. I speak to the anstetheologist and tell him that on previous occasions, I had problems getting back to normal breathing after the operation. I also ask him to consider the previous morphine that I got, but he's way ahead of me on that one. I'm starting the medication now is the last thing I remember. I wake up in a daze and listen to Dr. Morell telling me that he got two stones and that everything went OK. Next thing I know is that a nurse is telling me to breathe deeply – she is almost screaming. I don't know who she is, and I don't seem to care too much… I don't remember being wheeled back to my room. Monday Jun 12th. It is early in the morning. The pain is GONE! The OR staff have put in a catheter that drains my bladder, probably a good idea since I'm not in any condition to go anywhere. At the same time I feel trapped in the bed, I cannot go anywhere. It is about 3:00am. Slowly, the morning comes. Around 6:00am, the nurse comes and removes the catheter, and brings me something to drink. I notice a strange tingling in my left thumb, index and middle fingers, and the whole hand feels as though it was "asleep" and is just awakening. But the usual movement of muscles does nothing. The nurses and Dr. tell me not to worry, that this will go away by itself in a day or so. After doing some research on the Internet, I found that the cause was positioning on the Operating Room table, somehow my median nerve was compressed. The takeaway message is, be careful when you position yourself on the OR table. In fact, the compression was not very severe, now, after a few days everything is back to normal. I am informed that they will let me go some time in the morning, but that I have to pee a good quantity first before I go. I have to request breakfast, but finally get it. They bring some eggs that look like balls of ice cream with a weird texture, toast and some cereal with milk. The food is horrible, so I only eat the cereal with milk. Around 9:30 am, Manya arrives to pick me up. I am still shaky, but OK. We walk out of the hospital with discharge instructions and prescriptions for more meds as well as a follow up date with the Urologist to take out the stent in 2 weeks time. We take a cab home.

3 responses so far

« Newer Entries

Bad Behavior has blocked 14 access attempts in the last 7 days.