More servicesWindows Live
HomeHotmailSpacesOneCare
 
MSN
Sign in
 
 
Spaces home  John Stewien's Road To S...ProfileFriendsFilesBlog Tools Explore the Spaces community

Blog

8/27/2008

John escapes from Perth in.....

I've put up a countdown for when I leave Perth here:

John escapes from Perth in

8/22/2008

Violet making Crazy Frog sounds

Hey does this remind anyone of the Crazy Frog?

 

Nearly Walking

By the time I get back to Taiwan Violet will be walking I think:

DSC03154

8/12/2008

Different ways of showing a C# dialog from Managed C++ or C++/CLI

Here are 3 different behaviours for showing a C# dialog from a C++ application:

  • Modal
  • Non-modal clipped by parent
  • Non-model not clipped by parent

Code examples are below to show how to use each. Note that for the non-modal non-clipped call to SetWindowLongPtr the flag GWLP_HWNDPARENT doesn’t appear in the documentation for SetWindowLongPtr. That’s because the owner for a window can’t be changed after it is created, however  GWLP_HWNDPARENT is the offset flag for reading the owner as seen in the GetWindowLongPtr documentation, so it can be written to before the window is shown and be used to set the owner.

 

// Wrapper for a HWND
public
__gc class WindowWrapper : public IWin32Window { // Managed C++ (VS2003)
public ref class WindowWrapper : public IWin32Window { // C++/CLI (VS2005+)
private:
      IntPtr _hwnd;
public:
      WindowWrapper(IntPtr handle){
            _hwnd = handle;
      }
 
      IntPtr get_Handle(){
            return _hwnd;
      }
};

void OpenDialog(HWND hwnd){ // hwnd is the main window
      // use one of the following depending on which version of .NET you are using
      TestDialog __gc* dialog = new TestDialog(); // Managed C++ (VS2003)
      TestDialog^ dialog = gcnew TestDialog(); // C++/CLI (VS2005+)

      // Note that the following code snippets are mutually exclusive, only use 1
     
// Show modal
      dialog->ShowDialog(new  WindowWrapper(hwnd));

 
      // Show non-modal with parent clipping child
      SetParent((HWND)dialog->get_Handle().ToPointer(),hwnd);
      dialog->Show();

 
      // Show non-modal without parent clipping child
      SetWindowLongPtr((HWND)overlay->get_Handle().ToPointer(), GWLP_HWNDPARENT, (LONG_PTR)hwnd);
      dialog->Show();
}

 

 

8/11/2008

Visual Studio Command Prompt Explorer Context Menu

I keep on reinventing the wheel every time I'm at a new place of work and want a Visual Studio Command Prompt Explorer Context Menu, so I'm going to put the contents of a reg file here so that I can find it easily in the future when I need it. Here's the entry for a Visual Studio 2003 command prompt, but something similar would also apply for Visual Studio 2005 and 2008:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shell\VS2003 Command Prompt\command]
@="cmd.exe /k pushd %1&\"C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Common7\\Tools\\vsvars32.bat\""

8/10/2008

I now know sour, which allows me to appreciate the sweet

The title is a modified quote from the movie Vanilla Sky which has these lines:

"And I know sour, which allows me to appreciate the sweet"

and

"Just remember, the sweet is never as sweet without the sour, and I know the sour"

and

"There are no guarantees, but remember: Even in the future, the sweet is never as sweet without the sour"

It's a recurring theme.

I suspect that this turn of phrase will be something going through my head when I return to my family in Taiwan, where my home life is quite pleasant, and I will appreciate it more for having recently been living in a less pleasant environment. I've been working in Perth since May, and my experience while living here has highlighted to me how good I have had it over the years in other places. One thing I've noticed about people in Perth is that they like to complain a lot. People like to waste energy and time focusing on little things. Living with this daily is life force draining, but has allowed me to appreciate my father's personality:

My father is a true Engineer, when he looks out on the world he doesn't see problems, he just sees solutions. If a problem doesn't have a solution, or if the solution isn't worth the effort, then he doesn't see the problem, he just doesn't waste time and emotional effort on it. He enjoys his life and doesn't drive himself to misery over problems, as to him they don't exist. Probably why he's so far made it to 76 and still seems reasonably intact. Here's a small example of this:

When I was around 13 my mother had to go to hospital for a long enough period that my father had to take over the household duties. My family is the traditional woman is the home maker man is the bread winner type family, so household duties were a bit foreign to my father. Anyway on Thursday night my father came home a little early and we took the car to go Thursday night grocery shopping which is an Australian tradition. After filling a shopping trolley my father let me push it to the car. He had warned me to be careful, but in my normal fashion I pushed the trolley too fast and it flipped over. Our shopping went all over the car park.

I was shocked at what I had done, I just didn't see that coming. I looked at my father and he had a calm expression on his face, and he said "well lets pick up the groceries and put them back in the trolley". It's like there was no problem. Even during stressful times he didn't waver from his no-problems-just-solutions attitude. In my future years as a father, this is the mantra I want to live by. Optimally Jasmine and I will create a happy home life for my daughter with such consistency that she won't appreciate how sweet it is; but I'll know.

Violet won a crawling race in Taoyuan

 

 

And here's her gold medal:

DSC03115

8/9/2008

The Square Root of 3

I fear that I will always be
A lonely number like root three

A three is all that’s good and right,
Why must my three keep out of sight

Beneath a vicious square root sign,
I wish instead I were a nine

For nine could thwart this evil trick,
with just some quick arithmetic

I know I’ll never see the sun, as 1-point-7-3-2-1
Such is my reality, a sad irrationality

When harken What is this I see,
Another square root of a three

Has quietly come waltzing by,
Together now we multiply

To form a number we prefer,
Rejoicing as an integer

We break free from our mortal bonds
and with the wave of magic wands

Our square root signs become unglued
Your love for me has been renewed

- by David Feinberg (read by Kumar Patel in "Harold an Kumar Escape From Guantanamo Bay")

8/4/2008

Violet crawling across the floor

Here's a video of Violet racing across the floor, up onto the bed and the onward

 

8/2/2008

General Lee Drifting

Found this nice drifting video on youtube:

 

7/15/2008

C# Formatting XmlSerializer Output

 

So today I’m writing an app that loads and writes data to and from XML files, Excel Files, and Oracle Databases. An integration application you might say. Naturally I picked C# for the job as the thought of debugging a big hairy Perl script didn’t fill me with joy. Unfortunately my work PC only has Visual Studio 2003 on it, but what can you do?

One of the things I wanted to do was load an XML file, modify some parts of it, and then write it out again with just the parts changed that I wanted changed. Fortunately I had an XSD for the XML file so I used the VS2003 xsd.exe utility to convert it to a C# .cs file. Unfortunately it did a terrible job and created C# class hierarchies that were a bit messy. So I went through and hand modified the C# code until I ended up with something I liked.

Right, I deserialized the XML file, modified the data, and wrote it out again just using the simple XmlSerializer class in C#.

What I wanted was this header:

<?xml version="1.0" encoding="UTF-8" ?>
<ReferenceData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="T:\ ReferenceData.xsd">

What I got was this:

<?xml version="1.0"?>
<ReferenceData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

And to top it off the output file had double space as the indentation instead of tabs. To fix all this first of all I modified the serializable class to generate the noNamespaceSchemaLocation attribute:

[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public classReferenceData {
     [XmlAttribute(AttributeName="noNamespaceSchemaLocation",
             Namespace="http://www.w3.org/2001/XMLSchema-instance")]
     public stringnoNamespaceSchemaLocation = @"T:\ReferenceData.xsd";

Then I changed the serialization to encode in UTF-8, indent using single tab spaces, and set the namespace the way I wanted it set:

XmlSerializer serializer = newXmlSerializer(typeof(Xml.ReferenceData));
XmlTextWriter stream = newXmlTextWriter(saveFileDialog1.FileName, System.Text.Encoding.UTF8);
using(Stream baseStream = stream.BaseStream){
    stream.Formatting = Formatting.Indented;
    stream.IndentChar = '\x09';
    stream.Indentation = 1;

    //Create our own namespaces for the output
  
XmlSerializerNamespaces ns = newXmlSerializerNamespaces();
    ns.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance");
    serializer.Serialize(stream, referenceData, ns);
}

Then I got the output I wanted.

7/6/2008

Office Design

We've been thinking about office design for the new company. There's a few things that come to mind:

People have engaged discussions when doing something else, for example when playing golf business executives will often have very productive discussions. In light of this I'm thinking that the meeting room should have a pool table (8-ball, 9-ball, billiards, snooker, etc), so that people can play a game while having productive discussions.

Work stress can lead to making mistakes, people need to feel relaxed so that they can concentrate on the job, therefore I think the office should have hot tubs (spas, artificial hot springs), for people to work in, this would also be good for meetings, however we will need to find some floating waterproof laptops.

We also needs plants, heating, cooling, a location that is near a Starbucks, near the underground train, etc

7/4/2008

More Pictures From Adelaide

Here are my parents waiting for me at the airport. Jasmine arrived with Violet from Taiwan, and I arrived from Perth.

DSC02789

 

Here's Jasmine at lunch with a friend, who is also my best friend's fiancee:

DSC02796

 

Here I am with Violet and my best friend Ian:

DSC02797

 

Here are Violet and I feeding the swans:

DSC02801

 

Here's Jasmine, Violet and I at the Torrens River, Adelaide:

DSC02808

 

Here I am pushing Violet along in North Adelaide:

DSC02821

 

What the?

DSC02836

 

Here's my best friend with his fiancee from Taiwan:

DSC02843

 

Here's Violet waiting for lunch:

DSC02855

 

After lunch here's Violet with her great grandmother:

DSC02866

7/3/2008

Baby Stunt

Violet climbing the couch. Violet was not harmed as a result of this stunt. The minor harm that occurred later was due to something else and was not stunt related.

 

Trip to Adelaide

Went on a trip to Adelaide to fix up some things, and to catch up with family and friends. Unfortunately I didn't have time to catch up with all my friends. Jasmine, Violet and I are now all on the same medicare card though. For some reason it seems like a nice feeling to pull out my medicare card and see the names of my family all on there.

 

Here's all my immediate family including my sister's family unit:

IMG_0278

 

Violet got to meet her cousins for the first time:

IMG_0069

 

She's a big baby, but hopefully she won't get as big as her grandfather:

IMG_0219

 

Here's a picture of my beautiful wife and daughter together:

 IMG_0234_enhanced

 

While in Adelaide we travelled about by bus and train:

IMG_0087

IMG_0270

 

Lunch times can be tricky:

IMG_0091

 

A high chair is recommended:

IMG_0176

 

Got to watch out at the pub for baby grabbing things:

IMG_0226

 

At the end of the day a bath is good:

IMG_0080

 

Then maybe watch some tv:

IMG_0215

 

We had some fun times:

IMG_0209

 

Note the teeth:

IMG_0181

 

But at the end of the day a rest is good:

IMG_0262

6/13/2008

We need a Taiwan Java Developer

Yes my new company needs a Java developer to lead our Java team in Taiwan. If you have 5+ years experience in lots of enterprise web stuff in Java then join us now and soon we will be paying you lots of money and giving you flexible workings hours. What's not to like. If you just returned from Silicon Valley to Taiwan we definitely want to talk. E-mail us at jobs@jelical.com with your resume. Hope that doesn't attract too much spam. I'm a C# person with not enough web development experience which doesn't fit in with the work coming in.

We have an ad up at 104:

http://www.104.com.tw/jobbank/cust_job/job.cfm?jobnum=4244168&invoice=88494346000&intro=1&jobsource=checkc&page=1

Here's the English bits:

We want a person with:
* 5+ years Java programming in web-based business applications
* experience with short development/test/deployment cycles (1-4 weeks)
* experience in justifying and guiding others in code-level technical architecture
* a working understanding of J2EE patterns
* experience in estimating development from requirements
* regular experience in leading 5+ developers
* recent production experience in one of these (or similar):
- Spring Framework
- EJB 3
- JBoss Seam
- Apache Open For Business
- JZeno
* recent production experience with any of the major MVC implementations


Other highly desirable experience:
* test-driven development (junit, httpunit, selenium ..)
* working in an extreme programming environment
* working in some other agile development environment
* automated build and deployment (ant/maven ..)
* continuous integration (cruise control ..)
* ajax implementation using a popular toolkit

We Offer:
* flexible working hours
* good salary growth
* an environment where people are treated as a peers rather than low level workers
* an environment where everyone's opinion counts
* work on a rapidly changing product line
* an opportunity to become a leading figure in the Taiwan software industry

6/11/2008

More Baby Stuff. Other news coming soon.

I'm starting a company so I've been very busy of late. At some point I'll put some news about that here on my blog.

 

On Saturday I get to see my wife and daughter again. They are coming to Adelaide, Australia. I'm currently in Perth, Australia, but I will be flying to Adelaide to stay with them there for 2 weeks. Then they'll fly back to Taiwan, I'll keep working in Perth for 3 more months, and then I'll be returning to Taiwan, hopefully with my new company in full swing.

 

In the mean time I'm still surviving on photos and videos of my baby 7 month old Daughter. Here's some cute photos:

DSC02721

 

DSC02725

DSC02728

DSC02750

And here's a video of her following her mother Jasmine around in her walker:

 

6/4/2008

Violet Whistling

Violet's grandfather has been teaching Violet to whistle, however it's a bit hard for a 6 month year old to whistle. Here's what she can manage so far:

 

5/27/2008

Here comes trouble

At nearly 7 months Violet has started moving around, she can stand up straight hanging on to things:

DSC02599

5/25/2008

Funny Quote

The police who arrived late for the beginning of my experiment, but in time for the grand finale, were unappreciative - Werner von Braun