Archive for September, 2009

29 Sep 2009

Eric Wroolie: Gym Man

7 Comments Army Days, Bumblings, Growing Up

I’ve always hated going to the gym.  It’s not that I don’t like working out—I just prefer something like running.  Running is easy.  It’s solitary.  You can listen to music and not have to worry about being watched or criticized or anything.

Most of my experience with gyms goes back to my time in the Army.  Every post I was stationed at had a gym that soldiers could freely use in addition to our mandatory physical training.  I would occasionally go for periods of up to a week of regularly gym usage.

Arnold Schwarzenegger Color S-Africa
Creative Commons License photo credit: d_vdm

My memories of the gym are of bulky guys having lengthy conversations about their pecks, their lats, their gloots, whatever.  We shared the gym with soldiers from the infantry divisions.  As a linguist, it was a little unnerving (“Sure, they can kill a guy in a few seconds, but let’s see how quickly they can translate the People’s Daily.”). Just by standing in a gym, you were in danger of one these bulky, self-obsessed, guys tapping you on the should and saying “Spot me?”  So, not wanting to look like I didn’t know what I was doing, I would just grunt “Yeah, okay” and pray that the guys could actually bench press the amounts they were trying to lift.

I can remember working in one of the small controlled machines in the corner of the gym and listening to one guy spotting another on the bench press in the centre of the room—“Yeah Man!  You can do it!  Come on! Come On!  Yeah!  Yeah!”  My sarcasm made me want to mock them, but I wouldn’t dare.  However, if he had said “Eye of the Tiger, man!”, I would not have been able to control myself.

I pretty much stayed away from the gym after that.  I’ve run several 10ks, half-marathons, and marathons—but have stayed out of the gym.

As I get older, though, running is not enough to keep me fit.  I fear myself losing out to the obesity epidemic.  Either I have to exercise more or change my diet.  So, last week I joined the gym.

Joining the gym at 37 is not as easy as I thought it would be.  I wish I could have filled out an online form and just showed up at a time I thought it was empty.  Instead, I had to apply in person.  My big fear was that when I approached the reception desk at the local leisure centre and told them I wanted to join the gym, they would start laughing and say “I should think so!”  But, it was easy.

Once I filled in the paperwork, I had to book a meeting with a trainer to discuss my goals and set up a training plan.  I was nervous about this meeting.  I tried to think of a good answer to the question “So, what do you want to achieve by working out?”  I feel uncomfortable answering this question.  I don’t like bringing attention to areas of my body I’m unhappy with—especially to fit guy in his early twenties.  So my rehearsed answer was “You know, I want to do a little toning and work a little bit on upper body strength.”  But I really wanted to say “I want six-pack abs and I want people to gasp for the right reasons when I take my shirt off at the beach.” The answer I gave seemed to work and I am now set-up with a training plan.

The gym at the leisure centre is nothing like the gyms I used on Army bases.  So far, I’ve been going in the middle of the day and there seem to be mostly older people (older than myself) and no body builders.  I am now set-up with a direct-debit scheme that should keep me motivated to keep using it.  So far, so good.

Eye of the Tiger, man.  Eye of the Tiger!

25 Sep 2009

Overpass site re-designed.

2 Comments Software Dev & Productivity

Site ComparisonI’ve been working on redesigning the Overpass website for the past few weeks and have finally put the site live.  I didn’t mind the old site, but it was starting to look old and very 2004.  Website trends change over time and it is easy to tell if a site is not maintained very well.

In the Web 2.0 world, there are certain design principals that are definitely in vogue at the moment.  Sites look cleaner, use few images, adhere more to CSS standards, and have to look good in a mobile device.  A lot more attention is spent these day on where visitors first set their attention when they arrive at your site and how you should optimise it for them.

There is an excellent tutorial on Web 2.0 design created by a company called "Web Design from Scratch” which I found very useful.  That tutorial can be found here.

With the Overpass site, there were some changes I made overall structure to clean it up. 

I reduced the number of pages by about 75%.  It didn’t need to be a book—no one would read it.  By watching the stats on the site for the past few years, I could see that most people didn’t stay very long and did not click on many links.  They might visit one or two pages and stay on the site for about 2 or 3 minutes.  I’m happy with 2 or 3 minutes—but that means I need to condense what is said.

I removed the hierarchical menus in favour of tabs.  I loved the hierarchical drop-down menus when I first started using them.  I’ve been using them in apps for years.  I love that you can add as many new pages as you want without cluttering the interface.  For a financial system, this is fine—but not on a brochure site.  The fewer the pages, the easier it looks for a visitor to swallow with little commitment.

I removed most of the images that added no value.  On the old site, most of them added no value—I just added images to pages that looked too plain.  On the old site landing page, I had an image of a giant key going into a globe on the front page.  Not only was this image very heavy, it took up a lot of real-estate and added no value to the page.  I still have a globe on the new page, but it is more subtle and blends in better with the page.

I’ve made better use of CSS.  I took great pains to make sure the last site was CSS3 compliant, but I tried to use positioning better in this site.  Tables are only used for data, while span and div tags are used for positioning.

I tried to give the site a softer, simpler, feeling.  There are a few things I still am not sure about on the site, but I could tinker with it forever before getting it live if I allowed myself.  I will probably change it more in the future.  This is the third major iteration of this site in the past 6 years, so I’ll try the new design out and see how I like it in a few months.

22 Sep 2009

Expression Superpreview and IE6 transparent PNG images

No Comments Software Dev & Productivity

Up until a few months ago, the best way to ruin a developer pc was to install IE7. 

As much as developers and web designers want the world to move away from IE6, there are still lots of machines that still run it.  These computers are typically in enterprise environments, where staff are prohibited from upgrading their browser and some in-house applications would stop working if they did.  I recently worked in an environment like this.

In the old days (back when all you could see was farmland for miles around), it was easy to load several versions of Netscape and run them concurrently.  I used to be able to code a web page and tell you how it looked in Netscape 3, Netscape 4, Firefox, and . . . whatever version of IE I had installed. 

Because there was no way to install multiple IE versions, you pretty much had to stick with the lowest common denominator—otherwise, there was no way to tell what your site would look like to the luddites.

It was possible to run different browser version in different virtual machines, but this was really tough on a slow pc.  image

Some developers don’t bother checking their code in other browsers at all—especially in a corporate environment, but I encourage it anyway.

A few months ago, Microsoft released the Expressions Superpreview application which renders your pages in  IE6 and IE7 in a side-by-side comparison.  This really makes life a lot easier.  While working on some changes for the Overpass site, I was able to view my site in Firefox, Safari, and IE8 on my workstation—and in IE6 and IE7 with Superpreview.  I found that my transparent PNG files were not transparent in IE6 and was able to correct this.

Superpreview is one of those tools that would have come in handy so many times in the past.  If you do cross-browser design, you should have a look at it.

The Superpreview application can be downloaded here.

And about the transparent png problem I had (in case you found this post while Googling the issue) . . .

I spent most of the morning and part of yesterday trying to get my transparent png files working.  They worked on the local PC, but not from the server.  I spent ages Googling problems with PNG and Ubuntu, PNG and Apache, etc, but couldn’t find the problem.  In the end, I found that the problem I first had was due to the fact that I was uploading the images as ASCII instead of binary. 

To fix the problem with png transparency rendering in IE6, I used a fantastic script written by Drew Diller called DD_belatedPNG which renders PNG files as VML.  That script can be found here.  What a huge help it was.

18 Sep 2009

Automate Skype Status with PowerShell

14 Comments PowerShell, Software Dev & Productivity

One of the big problems I have with Skype is its lack of a scheduling feature.  I have a Skype dual phone which will ring when someone calls me on Skype, but I don’t want the phone ringing in the middle of the night because someone from another time zone sees my status as “Online” decides to call.  I use Skype frequently for work with virtual teams, so I can’t just turn it off because I don’t want to forget to turn it back on.  My status should show as “Away” when I haven’t used my PC for a while, but this isn’t always consistent and it doesn’t cater for insomnia-induced tinkering on the pc.

Wireless Skype Phone
Creative Commons License photo credit: iBjorn

Ideally, Skype would have a feature to set “Opening Hours” on your account—I only want to show up as available between 8am and 8pm.  I bought the Pamela extra which does some scheduling, but you can set only one event per day—ie. I can set it to go offline at 8pm, but not to turn back on at 8am.

Since Skype offers a client API component, it is possible to create a scheduler to set your online status at different times using Windows Scheduler and a scripting tool.  I wrote this before in VBScript, but this being the dawn of Windows 7 with pre-installed PowerShell, I rewrote it as a PowerShell script.

If you are on XP or Vista and haven’t installed PowerShell, you will need to do this before you can run these scripts.  Installation instructions for PowerShell are here.  You will also need to set the execution policy.  You can find instructions for this here.  I am running XP.

I hope this helps . . .

Step 1: Install the Skype4Com component

Skype still uses a COM component called Skype4Com which needs to be downloaded and registered on your local PC.  The component can be found at https://developer.skype.com/Download.  I’m using version 1.0.32, but you can probably use a later version.

Download the component, extract it to a directory (ie. “c:skype”) and type the following into the Run window:

regsvr32  c:skypeSkype4COM-1.0.32Skype4COM.dll

Make sure the directory point to the actual dll file to you downloaded.  You should get a response that it was registered successfully:

image

Step 2: Write the PowerShell script

Now, write the PowerShell script to use the component.  I’ve created two scripts—one sets my status to “Online”, the other sets it to “Offline”.  You can probably create a single script with a parameter passed in if you wish (but I couldn’t be bothered to figure out how to do this).

In the script, you have to create the Skype object, identify the current user, and change the status.

In my first script, I use the following code:

   1: #Create Skype Object

   2: $skype = New-Object -COM "Skype4COM.Skype"

   3:

   4: #Get the logged in user

   5: $currentUser = $skype.CurrentUserProfile

   6:

   7: #Get the Status vars

   8: $onlineStatus = $skype.Convert.TextToUserStatus("ONLINE")

   9:

  10: #Now Change your status

  11: $skype.ChangeUserStatus($onlineStatus)

The main Skype call here is the “ChangeUserStatus” method.  I named the first script “SetSkypeStatus_on.ps1”.

The second script is almost identical, but it sets the status to “Offline”:

   1: #Create Skype Object

   2: $skype = New-Object -COM "Skype4COM.Skype"

   3:

   4: #Get the logged in user

   5: $currentUser = $skype.CurrentUserProfile

   6:

   7: #Get the Status vars

   8: $offlineStatus = $skype.Convert.TextToUserStatus("OFFLINE")

   9:

  10: #Now Change your status

  11: $skype.ChangeUserStatus($offlineStatus)

I named the second script “SetSkypeStatus_off.ps1”.

There are several other parameters you can pass into the “ChangeUserStatus” method.  Here are the values I know about:

Status Code Sample
OFFLINE $skype.Convert.TextToUserStatus(“OFFLINE”)
ONLINE $skype.Convert.TextToUserStatus(“ONLINE”)
RINGING $skype.Convert.TextToUserStatus(“RINGING”)
INPROGRESS $skype.Convert.TextToUserStatus(“INPROGRESS”)
BUSY $skype.Convert.TextToUserStatus(“BUSY”)

Of course, you can automate most actions on the Skype client using the component (not just setting your online status).  You can schedule calls, send text messages, etc.  But I’m only concerned with my online status.

Step 3: Set up Windows Scheduled Tasks

Now you have two scripts to go Offline and Online.  You just need to have something trigger them.  I use Windows Scheduled Tasks.  In Control Panel, go to the Scheduled Tasks window.  You’ll see a list of scheduled tasks for your pc.  Right client and select “Add”—>”Scheduled Task” (Don’t go through the “Add Scheduled Task” wizard).  Name your task “SkypeStatusOn”.  Right-click the task and choose “Properties”.

Now, in the “Run:” box, type the following command:

powershell -command “& ‘c:tempSetSkypeStatus_on.ps1′ “

Make sure the path is pointed to you PowerShell script you’ve created.

image

You can now use the “Schedule” tab to schedule when you want the script to run.  Click “OK”.

Now do the same for the other script.  You can test these scripts by right-clicking the task and selecting “Run”.  You should be able to watch your Skype status go from offline to online.

By the way, the first time you run this, Skype will ask if you want PowerShell to have access to Skype.  Click “Allow”.

If everything works successfully, your pc should set your online status and give you the “Opening Hours” that Skype forgot.

I hope you find this useful.

18 Sep 2009

Line Breaks in Webby

2 Comments Software Dev & Productivity

For the past few weeks, I’ve been using a tool called Webby for static html pages.  Webby is a Ruby-based tool which produces static html pages based on templates you create.  Think of it as using master pages in ASP.Net, except that the final product is files with a .html extension instead of .aspx (and you don’t get the asp.net processor kicking in each time this static page is called).

It’s a great tool, because most of my sites need to have a consistent look and feel.  I don’t want to copy html from one file to another and I can use a master page-like concept.  And it gives me the chance to toy around with Ruby a little bit (but not much).

In Webby, you create a layout page and the other pages as .txt files with html.  Run the command “webby autobuild” in a command window and each time you make a change to any of the files, it will create a folder called output with all of your processed html pages.

A problem I did have with the tool is that it was adding <br /> tags into my html where the line breaks where in my files.  I absolutely hate it when something tries to inject html into my code.  This is why I didn’t use Frontpage and won’t use tools like Dreamweaver.  I know html is a lost art but . . .

So, in my files, I would type

<p>I would type a paragraph that might be
lengthy, so I use multiple lines in the code
but don't expect the browser to interpret these.
I just want it to look for the tags.</p>

What I got back in return was

<p>I would type a paragraph that might be <br />
lengthy, so I use multiple lines in the code<br />
but don't expect the browser to interpret these.<br />
I just want it to look for the tags.</p><br />

It took me a few hours to figure out why this was happening (I couldn’t find anything on Google with a “BR tags in Webby” search).

The problem is not with Webby, but with a tool called RedCloth, which Webby uses.  Redcloth does the html processing with something called Textile.  This is not a problem, but a feature in Redcloth from very 4 onwards.

After searching for hours (and contemplating whether to just transfer everything to aspx pages), I found that Webby was automatically adding a “- textile” filter to all of the pages:

---
title:      <%= title %>
created_at: <%= Time.now.to_y %>
filter:
  - erb
  - textile
---

The simple solution, was the remove the textfile flag from all pages.  Remove the flag from the “templates/page.erb” file in the project and you should remove it from all pages in the project.  Then you are master of all your html, my son.

I hope this

07 Sep 2009

Slip and fall down carefully

4 Comments China

20090828_8

One of the things I’ve heard about China before arriving was that the English translations I would see on signs and literature might not be the best use of English.  While in Beijing, we saw lots of examples of signs that were just funny.  In the pool area of our hotel is a sign that says “Slip and fall down carefully”.

While at the Beijing Amusement Park, most of the rides included Alcoholism as one of the symptoms you might have to prevent you from going on a ride (“You must not ride this if you suffer from Heart problems, pregnancy, or alcoholism.”  I kept imagining recovering alcoholics staying off these rides in case they caused a relapse.

Most of the Westerners we saw in Beijing were not English speakers (or at least not as a first language).  We heard people speaking Russian, French, and Swedish . . . but all the signs that were translated, were shown in Chinese and English.  My son pointed out to me, when he saw a sign that said to turn off you cell phone instead of mobile phone, that they were specifically translated into American English.

Beijing 239Some of the signs were okay, but so many were either vague (a sign along a river bank says “Please away from the water”) or complicated (the instructions for how to pay for food in the Food Republic food court at the APM shopping centre on Wanfujing street is impossible to read).  Some are intentionally cute and funny, like a sign in the Olympic village that says “The Grass is smiling at you”.

This is often referred to as Chinglish.  The BBC ran story while we were still over there with several other photos of strange Chinglish signs.  The story is here.

Outside the Forbidden City (on the East Gate) is a set of posh toilets.  (The only reason I call them posh is because it costs 1 yuan –about 10p– to use them.  The sign above the doors in Chinese says that it’s the room for men to urinate in.  But, here greeting you as you enter one of China’s most revered treasures, is my favourite sign of all:

Beijing 405 Beijing 404

The kids love saying it, now.

03 Sep 2009

Scaffolding in Tiananmen Square

8 Comments China

Of all the pictures I was going to take in Beijing, I was most looking forward to the one of me standing in front of the Mao portrait at Tiananmen Square. Everyone gets that picture.  I’ve seen it in books so often—with it’s bold Chinese characters on the read wall behind.  This picture was going to be even better than one standing on the Great Wall.Beijing 149

Well, wouldn’t you know it?  The entire time we were in Beijing (two whole weeks!), several of the monuments in Tiananmen were covered in scaffolding.  In this picture on the right, you can’t even see the “Peoples Republic of China” characters because they are behind green scaffolding.

I kind of felt like Chevy Chase in National Lampoon’s Vacation when he drives cross country to Wally’s World to find out that it’s closed.  I wonder what tourists to New York thought in the eighties when the Statue of Liberty was in scaffolding for months while they refurbished it for the 1986 anniversary. Beijing 109

The 60th Anniversary of the PRC is taking place next month, so they must be getting ready for that.  Even the Monument to the People’s Heroes in the square was covered in scaffolding.

It wasn’t too bad at night, you could still see the characters when they were illuminated.

Despite all the maintenance, the square was packed every day we went (we found ourselves back at the square about 4 times in total).

I mentioned in the earlier post that I was surprised by the number of Chinese tourists.  For some reason, I expected all the tourists to be from the west.  But most of the tourists were from around China making a once in a lifetime trip to see their capital.  It’s no different than the tourists in the States who make the cross-country trip to Washington DC.  I’ve been living in England so long I forgot what is was like being in a big country.  In fact, the Chinese tourists had more reason to be visiting than I did, I guess.  They weren’t put off by the maintenance work at all.Beijing 370

Another site that was closed was the Science and Technology Museum.  We took a taxi across town the visit the museum, but when we arrived (and our taxi left), we found that it was closed for a month for renovations.  There were several ‘unofficial’ taxi drivers swarming around like vultures in the front of the museum trying to get us to take their taxis to another site like the Beijing Aquarium.  We stood there, not sure what to do—but I was sure I didn’t want to watch fish at an aquarium.  I noticed a man with a young boy who seemed to have made the same mistake we did and was trying to decide where to go next.  He was being hounded by the drivers just like us.  I walked over to the man and asked him where he was going next.  He seemed surprised that I was trying to talk to him in Chinese—but I was obviously not a driver and not trying to sell him anything.  He told me that they were going to find the underground train and go to the Military Museum.  I asked if we could follow them.  We had only been taking taxis until then, so it sounded fun.  The drivers were annoyed, but we all walked off.

We walked with this man’s family (himself, his wife, and their son) and another family they were friends with for about a mile and a half to the underground station.  They were visiting from Inner Mongolia.  We talked about school out there and they were very interested in our 3 children.  They didn’t speak any English—but they told me their son was learning English in school (he didn’t want to show me what he knew).

There were two boys in their group.  I asked if they were brothers.  One boy’s mother told me that they couldn’t be brothers because China has too many people.  They could only have one child.  I knew this, of course, so I felt a little stupid.  Then I asked if they were cousins.  No, she told me, they are not cousins but only friends.  The one child rule came in in 1979.  I realised that China would not have siblings, but I never considered that this would one day mean no cousins, no uncles, no aunts . .

It took us ages getting to the subway station—the other Dad, being a tourist too, really had no idea where the station was but shared my keen sense of direction.  We stopped and asked a lot of passers-by for directions.

The subway train we rode was very crowded.  The Beijing subway at 2pm was like the Central Line at 5pm.  It took a couple of hours, but when we finally arrived at the Military Museum . . . it was closed.  It was Monday, and the museum is always closed on Monday.  But I didn’t mind.  This was the only real time we were able to have a lengthy conversation with a Chinese family.  If the Science Museum had been open, we wouldn’t have been able meet them at all.

It was a great experience.

02 Sep 2009

Back from my Beijing Holiday

8 Comments China

I returned from 2 weeks holiday in Beijing just a few days ago.  I’m still suffering from some food poisoning I picked up over there, so I’m not entirely at 100%.Me at the Great Hall of the People

There’s so much to talk about Beijing.  It’s difficult to know where to start.  I’ll probably have more than one post on this trip, so I hope it doesn’t bore anyone.

I spent most of the time speaking Mandarin.  I’ve been studying it for so long that it often felt odd listening to so many people speak it too.  A lot of people out there speak a tiny amount of English but a surprising amount spoke none.  When I spoke Mandarin, people seemed to really appreciate it and enjoyed having conversations on various subjects.

For this trip to China, we went as a family.  It was good for the kids to see another country and experience what another culture is like.

I have three sons- aged 4 to 11.  This turned a lot of heads.  Everywhere we went, people would comment on our children or we would hear them commenting to each other (“三个儿子”) about how many kids we have.  Many Chinese people would stop and tell me how strong my family is.  Some told me about the one-child policy and we did feel very guilty for bringing three.  Some asked me how many we were allowed to have in England.

When I imagined going to Beijing, I imagined going to Epcot Centre.  I figured that since the Olympics last year, the place would be entirely Westernised.  If I wanted to see “Real China”, Beijing might not be the place to do it.  I expected to see mostly Westerners and everything would cater to us.  But I was wrong.  We saw very few Westerners at all.  The ones we did see were Russians.  I saw no Western kids at all.  Most of the people we spoke with were tourists from around China—making a trip to their nation’s capital.  So, we, a family of 5, were the object of much interest.

In our first day in Beijing, while walking along the Wangfujing shopping street, we were frequently stopped by Chinese people asking to take their pictures with us.  I noticed a lot of other people took out pictures without asking at all—like you would take pictures of animals in the zoo.  Once a few people posed for pictures with us, people started to swarm and everyone wanted to add us to their photo albums. Some people wanted pictures with only the kids.  Some young ladies wanted their pictures taken with me alone (the extra weight doesn’t matter in China, I guess).  For a while, I thought they might have mistaken us for someone famous (like that guy last year shouting “I’m not Michael Phelps” while everyone crowded around him).  It was a lot of fun, actually.  We felt like we were famous.  It was cool—on the first day!

Everywhere we went, we would be stopped at least once for a photo opportunity with someone.  We posed with everyone—kids, parents, teenagers, and a family even made their old grandmother sit down next to us on a curb in Tiananmen Square to take a picture.  After a week, whenever someone would walk up to us carrying a camera, we would start to pose.

After a few days, my younger boys started to protest and make faces when people took their pictures.  We tried to explain how this is not polite and that they should smile, but it really did become overwhelming after a while.  The standard pose for pictures in China seems to be the two-finger peace symbol—so that’s how we posed.

Once, while riding a hired boat in the lake at Beihai Park, a family followed around the lake in their boat for about 20 minutes until we stopped and let them circle around us to take a picture.  We sat in our boat—everyone making a peace symbol and smiling.

All over China, people are returning from their holiday to Beijing and showing their friends pictures of us.  Weird.

Even when we weren’t being photographed, we were being watched.  We had many meal where at least one person from the next table was turned around in their chair watching us continuously.  I would look at them, just to acknowledge that I knew they were staring and said Ni Hao but they would continue to watch us like we were a show for them.  After a few days, I got used to this.  But, if you have kids—especially more than one—you know that you sometimes need to raise your voice (“Don’t pick that up off the floor!”, “Just don’t touch him, okay?”, “Whoever is kicking had better stop!”) and it was difficult to do this when you have several eyes on you.

We spent two weeks there.  We saw Tiananmen Square, the Great Wall, the Forbidden City, the Olympic Village and several other sites.  I’ll write some more on what it was like in future posts.

I plan on returning to China (to Dalian) in a few months to meet with some software companies.  But for now, It’s nice to be home.