Friday, March 18, 2011

Automatic Upgrade from .NET 2 to .NET 3.5

Our core application suite is currently based on .NET 2, C# 2, VS2005, with a few dependencies on libraries from 3.0 and 3.5. I decided to perform a trial upgrade of the solution into VS2010, as I am using it for all new work and hate to revert back to 2005.

To start, I simply created a branch of the source, and then loaded the solution into VS2010. I waited for some time, and then eventually the import wizard completed – the result was a set of fully loaded .NET 2.0 projects within VS2010 – That seemed too easy! Of course, getting everything to compile was a different story. As stated above, several of the projects had taken some dependencies on 3.0 libraries – specifically WCF and WPF, and these projects longer compiled. Unfortunately they represented some core libraries within our project suit so this meant the solution was broken.

Instead of spending too much time finding out why, I converted these projects to the 3.5 framework via the project properties dialog and proceeded to compile – it soon became apparent however that I would be better off upgrading all projects in the same way, yet I didn’t have the time to upgrade 120 projects within the solution via the properties window..

Of course I knew that there had to be a better way, and having read about other attempts to do the same, II decided to write a macro to do the upgrade. Avner Kashtan provided a method here to process the projects within the solution like this:

For Each proj As Project In DTE.Solution.Projects

   Try

       proj.Properties.Item("TargetFramework").Value = 196613

       Debug.Print("Upgraded {0} to 3.5", proj.Name)

   Catch ex As Exception

       Debug.Print("Failed to upgrade {0} to 3.5", proj.Name)

   End Try

Next proj



I tried this but it didn’t do much – it turns out that Solution.Projects returns only the child nodes of the solution, which from my solution was simply 7 solution folders – so this didn’t work. Of course, I realised that I could rewrite this macro to be recursive so that I could traverse the hierarchy and process it that way.

This is what I came up with:

Sub Upgrade()
    For Each project As EnvDTE.Project In DTE.Solution.Projects
        UpgradeProject(project)
    Next
End Sub
 
Sub UpgradeProject(ByVal Project)
    For Each projectItem As EnvDTE.ProjectItem In Project.ProjectItems
        Dim childProject = TryCast(projectItem.Object, EnvDTE.Project)
        If childProject IsNot Nothing Then
            UpgradeProject(childProject)
        End If
    Next
 
    If Project.Kind = PrjKind.prjKindCSharpProject Then
        Project.Properties.Item("TargetFramework").Value = 196613
    End If
End Sub


This macro ran reasonably quickly and did the upgrade with the visible effect of changing all the project files to refer to the new framework version.

I then recompiled everything successfully.

Nice!

Monday, October 25, 2010

Windows Phone 7 First Impressions


I'm not a usual candidate to be the first kid on the block with the new toys - I usually like to let things settle down first - but this time I took a punt.. Not 100% sure why, but I've been telling myself that this time I could write some code to run on the phone, so that would make it worth the trouble. Since Windows Phone 7 is silverlight based, and developed in C#, I couldn't resist.

I've been developing in .NET and C# so it was a natural fit - my first thoughts though have nothing to do with the developer experience however, since I soon discovered that even 'sideloading' and app on to the phone from my local Visual Studio wouldn't be possible without purchasing a developer unlock for $100. Although something I'll consider if/when I get an app worth depolying, I was still a little surprised. I had expected to deploy locally for free - naively I realise now, in retrospect, given that MS has decided to control deployment ostensibly to maintain standards via the marketplace..

As for the phone itself, I was an early buyer - early on the 22nd of October. Telstra, the most prominent Australian telco shipped the phone the day before and I received a text late that afternoon telling me to hurry to avoid disappointment. As it turns out, I have heard that others did get disappointed with limited stock, but at least from the Rundle Mall Testra Store, there was at least a few left when I arrive 9am Friday morning (so much for going to work!)

Price

At the end of the day, I care about the price, it's not purely about function, it has to meet the features/dollar ratio in my mind - and in this case, I actually thought Telstra had this one totally sorted in my favour. $49 cap, with $400 worth of calls and 500MB data on the NextG network? Rediculous. I was expecting to pay $79 for this at least, and thought I would thus need some convincing. My old Nokia plan was the same price and was on Vodafone, slow data and old (N95) handset.. In the end tt was a simple swap actually, for no real outlay.. Awesome! now you know why I was an early adopter!

Physical Appearance

I bought the HTC Mozart and my initial response was very good - I like the weight, size, shape and overall appearance - granted it's not quite as single chassis iPhone style, but it feels well built and comfortable to hold - it fits well in my pocket without feeling either bulky or heavy. The screen repsonsive to touch too. The soft buttons do have to be avoided though, but this was sorted out after a few hours of use.

UI

The interface is different, and overall I don't mind it. The tile concept is well put together especially the live data within each tile - even the simple colour scheme is ok to me, I'm not really sure why so many iFreaks are hating on in, I'm yet to see why a standard icon is that much more effective.., and I don't mind the hubs concept either.

The graphics looks great - smooth hardware based transitions looks slick, the way you move around the page feels very natural. The metaphor of panorama or pivot style pages works well. I didn't see too many apps that got thi
s too wrong.. a few did, but that's not surprising!

As for the secondary app list, I don't know.. Can't say I'm convinced. I will wait to see how many apps I settle on before passing judgement. Although I'm not a huge fan of the iPhone app array as a great UI metaphor (kind or reminds me of Windows Explorer View Lists), on the other the idea has some merit, since it doesn't take long for the app list of WP7 to get a bit long. I wouldn't mind if this is swappable with a 3rd party but at this stage I haven't seen anything like this - I suspect this will change in a latter OS upgrade (at least, I *hope* it will!) though, as the volume of apps goes up.

Apps

I was pleasant'y surprised at the number of apps in the market place on day 2 - There was something in every problem space I enquired about. Not bad for such early days. Obviously the quality varies, but I only had to download an try a few apps for various things to get a good 'base' collection. I did have to remove the Yellow Pages app after a while when I realised it was based on old data, and wasn't Australian enough to be useful. It is listed as a beta product though, so I hope to try it again later once the issues are ironed out. I actually bought a few apps too, a few games and some baby pleasers too - my toddler loves to press the screen, so why not touch the animal to hear some noises. Just a little fun at a $1.30!!

Facebook, Twitter, YouTube are all there and provide some decent 'basic' coverage of those sites capabilities. Not bad for free.

Quibbles

I had some initial difficulty getting some games to load in the app store (err. marketplace), but in the end I discovered that the games were installing, but don't appear in the app list itself - *only* in the game hub.. obviously it makes sense but since I didn't read the manual (dude RTFM..) I had to discover it myself.

There have been a few other quibbles too - It's hard to apportion blame at this stage so I'll just detail what I discovered. Hopefully others have more insight.

  • Outlook Integration - fails when the company certificate is self signed. Usually apps just ask for you to accept it anyway - but there is no setting for this that I could see. Obviously the company needs to get there exchange server act together, but I am told iPhone and Android phones within the office all accept the certificate as is.
  • Google Calendar Sync - my wife and I run our whole 'eLife' via google apps, and have a calendar for each of us as well as our daughter. 90% of my app events exist on my wife's calendar, so having them all sync into the phone is critical, but alas, no. Not only does my calendar not sync correctly (it does allow me to write from phone to gCal, ) my 'other' shared calendars don't appear at all. I read somewhere that others have claimed the same problem, and that WP7 only syncs to gCal when there is only one calendar and this is a known issue. Wish I had read that one earlier!
  • IE7 - not the most polished app I've ever used. sometimes the zoom rendering is a little laggy catching up with the resizing. overall though, I expected it to be much worse. Didn't try using a site with some modern CSS or HTML though so no doubt things go a bit funky on that end - I hope this changes soon though.. Perhaps an IE9 Mobile version is pending?
  • Predicitive texting - is actually awesome, but is a quibble because not all text entry uses it. Don't know why not.. surely this is a device level function?? strange, such an excellent feature, wish it was everywhere.
  • Copy/Paste - I know I know, you know and I know it's coming. I don't really need it much anyway (so far) but I would have thought it wasn't too hard to include up front
Overall

I don't think I want to speculate about the success of WP7 too much, but suffice to say I like it, and will definitely consider writing an app for this OS soon. I think once the quibbles are ironed out it will be a good platform. I only hope that the anti-MS types don't get too much mindshare.. I really don't see a problem with more competition in the mobile space, and hope that MS can push the envelop and then the entire industry (including general software development) will benefit.

Lastly, I was showing the phone of to my father-n-law yesterday, and I learnt he bought the same one on the same plan this morning.. Nice!

Wednesday, July 21, 2010

Powershell Scripting Book - first thoughts


As part of my endeavour to learn a new language this year (and hopefully every year), I decided to improve my .NET and general Windows development workflow with Powershell. It's not only a great scripting tool, but a complete language, and actually quite handy as a REPL too, when working with .NET types.

In order to maximize my learning time, I turned to Manning and bought the 'early access program' book for Windows Powershell In Action. I am a huge fan of the early access program, and have bought more than 10 books now.. Again I wasn't disappointed, as it is a good entry level book to the syntax and idioms that make Powershell so, well.. powerful.

Once I had mastered the syntax, using the canned examples within the book, I decided to take the plunge and write a few 'real world' scripts. It didn't take me too long until I had started incorporating Powershell into my everyday development cycle.

My 'new work' script looks something like this:

param
(
[string]$name = $(throw "a branch name is required")
)

. .\Scripts\Utilities.ps1

Stop-
Servers

Invoke-Expression .\Create-Branch.ps1 "BUG_$name"
Invoke-Expression .\Setup-Config.ps1
Invoke-Expression .\Build-Source.ps1
Invoke-Expression .\Build-Database.ps1

Start-Servers

The whole process automates a lot of the drudgery of creating a branch, switching to it, patching the many config files (via XPath), doing a full build, rebuilding the database, etc. Fantastic!

What is more surprising is that these processes were done each and every time by each developer manually until I suggested we script them.. What's more, each had their own special way to achieve the end result, which made things difficult when we integrate branches and get a consistent working environment.

I am still trialling these scripts, and the many others that I have written to manage random files and processes on the fly, however I am having lots of fun and have even managed to remove some drudgery from a home-centric file operation ritual I do all the time.. This will have to wait for another post however..

HINT: I'm downloading and transferring podcasts to my phone.. (I use RSS via google reader and DownThemAll currently - it's very manual..)

Thursday, March 25, 2010

Media Center Goes Win 7 - Finally

It's hard to believe that I first built my media center back in 2007. When I initially set it up, my plan was to use Windows XP and run Media Portal. After a few abortive attempts and getting everything running with my hardware, I gave up and moved to Media Center 2005 (XP). After further configuration woes (due to dodgy hardware and/or drivers), it has worked basically flawlessly since.

I was happy with this configuration, and it remained unchanged, until I bought Windows Vista.. MY tuner cards didn't work any more, and the interface ran too slow for my wife to accept. Needless to say, that copy of Vista still sits in a box somewhere, never to see the light of day again.

With the recent release of Windows 7, I knew the time was right to try again - I knew there were lots of good features for MC, and I was keen - only problem was that my hardward (tuner cards) *still* didn't work. This time though, I was feeling a bit more keen on spending some money, so I discarded my tuner card (actually I gave it to my brother-n-law, who has made it work in Win 7!), and I bought two dual-tuner cards and a 1TB hard drive for TV only.

These cards are Hauppauge 2200 and they 'just worked'. Now the only problem was that the interface was a bit sluggish on a busy screen (e.g. Recorded TV - we have a lot of recorded shows).

I looked at everything obvious (or so I thought), and eventually I realised, much to my own embarrassment, that the HTPC only had 1GB of ram! I don't really recall way back there in 2007, but 1GB was probably not too bad.. As my wife pointed out, even her netbook has more ram. Too true.

A quick trip to MSY (great prices, worst web site ever) and 4 GB, for a lousy $105 and now the Win7 Media Center is looking awesome.

One last thing - having visited my place several times and viewed the beast that is my HTPC, my stepfather has decided he wanted one too - despite my encouragement to get a TiVo. I beg you.. But no.. He bought one anyway, and a big screen TV, and a nice new stereo. It will be a good setup, when he gets it working.. :-)

Given that he's not technical, I've committed a few hours to the cause so far, but as of last night, we are not quite there yet.. I think we're close though, with only the channels tuning to be done. Somewhat poorly, I think, the supplier (in a different city), left the channels configured when he shipped it - thus, when we booted it, it listed all the 'correct' channels, but no guide listings, and no reception. It took me a while to realise that these were for Melbourne (or perhaps Brisbane?), but the bub had had enough so we went home with the problem unresolved..

Ahh.. Why didn't he just buy TiVo?

EDIT: After a little tweaking (faulty tuner, wrong city config) it is all working a treat, and the supplier was good about replacing the faulty tuner too

Wednesday, February 17, 2010

Open Source RTS Engine


I had a brief window of opportunity to play a game a few weeks ago - the first I've played on my computer for a few years. I used to be a hard-core real time strategy (RTS) player, but with work, house, wife and child, their is never enough time!

The game itself is called Spring, and is an open source RTS engine. The implementation is inspired from Total Annihilation (1997) and more recently, from it's modern equivalent Supreme Commander (2007). The basic idea is a classic RTS paradigm, with base building, resource collecting and domination being the primary methods of success.

The feature which I enjoy the most is the use of metal as salvageable resource from the remnants of the battle field. A favourite strategy is to allow the enemy near to your base to allow easy access when picking over the carcasses of the dead (it's only robots, no blood!!).

Also, I really appreciated (in the original TA), that the command system is entirely queued. Simply hold down shift, and initiate a sequence of commands. It is essentially fire-n-forget. Back in 97, this concept was revolutionary.. It is still awesome today.

What I particularly like - besides being open source - is that the game play is very similar to my recollections of TA, but with better graphics and sound.

The game is separated into the engine, modifications (mods), and maps, such that there are various mods available, some ostensibly require a licence to the original TA (it uses its units model and rule data), and others are complete fabrications of new rules, units, AIs, and scenarios. There are both open source and paid mods, such as a futuristic (Sci-Fi), WW2, and Star Wars themed mods.

I have been playing the Balanced Annihilation (BA) mod only at this stage, since it has the familiar units and rules of the original Total Annihilation game.

After approx. 20 hours of gaming, I can now give a fair review of the engine, the AIs, the mod, and the lobby:

The lobby is the weakest link in this suite, although it does work, I have found it crashes, has a lot of 'nag' dialogs when failing to connect to a server (even when playing single player), and in general is a bit dull (it appears to be a standard windows form application, nothing special..). It is functional, and provides some good mechanisms for downloading content as required.

The engine is very good, but requires a better graphics card than I have to fully appreciate the feature set it offers. I found the game is responsive with medium unit volumes, but since I prefer high response times to great graphics, I generally played with these settings on low.

Since I needed a lot of practice before I could commit to the multi-player game, I spent all my time with the bundled AIs. Some are definitely better than others, E323AI and RAI I beleive the ones I competed against. One is easy ot beat, as soon as the game's mechanics are mastered, but the other one (I think it was E323AI), is a difficult one to handle, especially early game! I suspect that these AI processes are reducing the performance of the game overall, but still performed admirably.

The BA mod is a faithful recreation of the game I remember, and has been so good that I am yet to entertain the thought of loading up any other mods at this time! I will do this at some time though - Time permitting, of course!

For some screenshots, see here.

Well done to the guys over at Spring RTS, this is a worthwhile project, and I hope to get some time in the future to peruse the source for my self.

Wednesday, October 21, 2009

SQL Formatter Released!

Although, not finished by any stretch, I have released my first draft of the Laan.Sql.Formatter to 'production'.

I have provided 3 deliverables - each providing access to SQL Formatting for different purposes:
  • Sql Server Management Studio 2008 (SSMS) Plugin
  • Ad-hoc Sql Formatter Web Page
  • Sql Formatter Log4Net Appender (for use with NHibernate)
Further, the SSMS plugin provides a second feature - code template expansions. I've 'borrowed' the idea shamelessly from DevExpress' CodeRush (awesome tool), but without all the trappings. In my version, you can only expand a template that you know and remember (no visual clues - sorry, this *may* come some day), Also, the template list can't be edited/added/removed (yet).

For more information, and to obtain an installer for the plugin, go to the project site, or directly to the download page. There is also a download for the NHibernate Appender, with some simple documentation on it's use still to come. To play with the formatter, you can go to my web site as per my last blog entry.

If you find an issue, or have a feature request, you can add it here - but don't bother to log an issue regarding missing formatting options - I know I need to add some, eventually, but my plan is to get the core functionality done first.

Also, I would appreciate it if someone could provide a code review of my work so far. There is no doubt some of it needs more work, especially within the formatter assembly.. All code is available via svn hosted on google code, so it's easy to get access to a read only file set, or on the download page on the above link. If you are interested, let me know, or just send me an email of your review or blog it.

I hope you find these tools useful, I know I have..



Thursday, May 28, 2009

Laan SQL Formatter (alpha) is online!

Finally, after much wailing and nashing of teeth, I've delivered my first draft (alpha) of my SQL code formatter. There's not much too it, simply enter (or copy) your SQL into the top, hit convert, and the bottom will (should!) supply the formatted result!

code.laanfamily.com


Also, I will soon be releasing an NHibernate Appender which raps this functionality into a FormattedSqlFileAppender, once I get the appender subclassing working correctly.

Currently, the formatter (and even the parser, behind the scenes) is quite limited. It only supports SELECT statements, without UNION and SELECT..INTO modifiers. I believe there is full expression syntax parsing, but some aspects of expressions are still not formatted - e.g., bracketed sub expressions.

I will keep modifying it over time, as time permits (baby is now 6 weeks away!), but hopefully I can quickly implement INSERT, UPDATE and DELETE, CREATE TABLE and CREATE VIEW statements fairly rapidly. Then I'll work towards doing batched SQL instead of single statements, which will open the door for stored procedures.


Stay tuned!

P.S. Interested in the code? check it: http://code.google.com/p/sqlformat/

Wednesday, September 03, 2008

NHibernate SQL Logger

As a traditional SQL 'backend' developer, I've always relied on SQL Profiler to let me know what is happening in the back end at any given point, but now that I'm using NHibernate for our persistence layer, I've found that the SQL that is generated is not very readable. If you've used NHibernate you'll know what I mean!

Besides the aliased fields, I don't like the fact that the entire statement is packed onto one line, and is using the sp_exec statement for parameter passing - Not very readable.

In order to remedy this, I configured an appender within log4net that allows the SQL to be pushed to its own file, with the following config:

    <logger name="NHibernate.SQL">
      <appender-ref ref="nh"/>
      <level value="ALL" />
    </logger>


where "nh" is just a standard Log4Net file appender. This works, but still means I have to dissect the SQL and reformat it as I go.

Of course, this is not ideal, so I have decided to write a small log4net appender that formats this output. The only problem is that I will need to write an SQL formatter! Not trivial.





In the interim, I have written a rough 'formatter' which simply uses find and replace to get the SQL slightly readable.  It places each field on its own line, and creates distinct blocks for each join.



SELECT
    FieldA,
    FieldB,
    FieldC
FROM dbo.Table1 AS T1
JOIN dbo.Table2 AS T2
  ON T1.Field1 = T2.Field1
  
JOIN dbo.Table3 AS T3
  ON T2.Field2 = T3.Field2
  
WHERE T3.Field4 = 1
  AND T2.FieldA <> 0


It’s not perfect, and will place new lines in regardless of whether they are necessary, but it does substitute parameters so generally it does the job!



If you happen to read this and think this sounds like something you *must* have, let me know.. It’s quite easy to use, simply reference the assembly, and place this into the log4net config:



    <appender name="sqlFormatter" type="NHibernate.Appender.NHibernateAppender,NHibernate.Appender">
      <param name="FileName" value="C:\Logs\MatrixSQL.log"/>
    </appender>


and then reference it accordingly within the NHibernate.SQL logging level:



    <logger name="NHibernate.SQL">
      <appender-ref ref="sqlFormatter"/>
      <level value="ALL" />
    </logger>


The next step will be to build a reasonable SQL parser, so that I can create a syntax tree of the statements in order to present them neatly. 



To get this happening I will need a tokeniser (lexer), a grammar parser, and a formatter.  Sounds like an interesting project. I’ll make this project available on GoogleCode at some point, assuming that I’m making progress.

Sunday, April 29, 2007

Chào ban! - Greetings from North Vietnam

We lost our luggage in Hanoi. 3 trips to the airport (50 mins away from Hanoi) and 24 hours later, we're ready to start out Vietnam holiday!...

Vietnam is so under-developed and filthy but fantastically cultural!! Life here is like nothing of what we're used to. Communication is really bad here - no one speaks English!! There are people hawking their wares of all sorts all over the streets... our money means so much to them. Amazingly, there are no beggars to be seen! Stray cats and dogs everywhere. No fast food chains. People eat on road side stalls and squat on little stools on the footpaths. Ladies in traditional Ao Dai (Vietnamese get ups) walking the streets with rice paddy cone shaped hats and carrying poles on their shoulders with baskets hanging off them storing fruit or snacks to sell, or balancing baskets of goods on top of their heads in the middle of the city. And the traffic!! Sheez -We have never seen so many motorbikes in all our life!! It's just like on telly! Hardly any traffic lights, no one obeys road rules, everyone drives on the wrong side of the road, playing chicken is standard play and the adrenelin pumps each time you attempt to cross the road! You'll definitely find the famous 25c bowls of noodles here, but they are Lin size, not Ben size! Meals at regular restaurants and cafes are about $1-2, beers are ridiculously cheap between 50c and $1. The only place in the world where cans of iced tea or coke are more expensive than beer. Alcohol in general is dirt cheap. Ben's drink of the trip is Long Island Iced Tea. At $5 a pop, you can just imagine...

Hanoi has such a French influence. The architecture is pretty and lots of French words everywhere. It was FREEZING!! No one told us we had to bring jackets!! It averaged 15-18 degrees during our stay! We had to buy parkas and beanies from the locals just to keep warm! I was chuffed at my $5 purchase that certainly did it's job at keeping me cozy! Ben's parka purchase was not so easy - try looking for a jacket to fit a 6'3" anglo built male in a country where the average male is my height and half Ben's build! Nevertheless, we managed to find a Nike rip-off for $25 (+pants) which was almost too warm for Ben's liking!

Hoi An is a gorgeous town stuck in old school. Roads in the old town are not bitumen and the shops are all like you see in an old Chinese movie - lots of wood and lanterns. We got lots of cool stuff tailored for really cheap - I got a long woolly duffle coat, and some beautiful traditional chinese silk brocade cheongsams and outfits made - The whole lot for under $100! I also took some dresses for them to copy and they did a fantastic job! Ben got 18 shirts, 3 pants and 3 pairs of shoes made (mind you, there ain't no way we were going to find size 13 shoes off the shelf for Mr Big Foot over here). We are very impressed by the workmanship of the tailors - much better than our Thai experience!! Only problem now with our limited wardrobe space, is that we're not sure where we're going to keep the clothes at home! Looks like we're going to have to buy a bigger house! Tomorrow we're off to My Son to check our the remains of the old Champa Kingdom

Everyone keeps asking us if we're married or here on our honeymoon! If I had a dollar for every time I was asked if I am Vietnamese, I'd be rich!! Apparently I look Vietnamese to the locals?? - or they're just trying to get me to buy something...

Saturday, April 28, 2007

Return to Malaysia

As we step off the plane, all bleary-eyed and sheepish after our 7 hour flight, the hit of humidity welcomes us back to KL once again. En-route to Vietnam and Cambodia, I’m here with bf; sister and her new white boy husband and; brother and my best friend, for 4 days and 5 nights of eating, shopping and sibling bonding. My sister has just been married this weekend and we’re all gate-crashing the first leg of her honeymoon.

KL is just as we had remembered it from when we were last here 18 months ago – hot, humid, polluted and oh so chaotic. Staying at the KL Hilton, it was disappointing that we only once got time out from our hectic schedule to swim in the gorgeous lagoon style pool. Apart from the fact that we had no time, the weather wasn’t the greatest in KL during our stay – it was overcast, windy and rainy most of the time.

Breakfast at the KL Hilton is the best you could ever image. Of course, the staple western fare was always on offer, but in gourmet varieties – 2 separate egg stations to make your eggs any way you like – poached was the favourite on our table! There was not only regular pork bacon, but there was a newie for us – beef bacon! The boys weren’t fans, but I quite preferred it! There was a huge patisserie section (jam donuts were to become bf’s essential for every day of our trip); every cereal under the sun; fresh fruit platters with papaya, dragon fruit, guava and the sweetest pineapple in the world; a “dessert” station serving fresh waffles, pancakes and French toast with divine condiments to boot – brother couldn’t decide, so he divided his waffles into 4 sections with differing combos! The highlight for us was the international fare – roti canai, roti murtabak, pandan chicken, nasi lemak, just to name but a few. Also in contending top position was the fresh juice station where an attendant was waiting to juice up your favourite fresh juice concoction. We loved green apple and guava! And to help prevent and combat against potentially pooey bellies, a daily shot of yakult was on hand – even dairy nazi bf got in on the game! The only problem about the KL Hilton having such a great spread, was that we spent the rest of our holiday comparing every breakfast to the Hilton's! Truely the best breaky ever!


Day 1 was spent shopping at KLCC where the girls went one way and the boys another – a smart idea indeed! After our intro to shopping in KL, we ventured up to the Twin Tower's bridge, where we took in a bird's eye view of the city. Back to the hotel late afternoon for a quick dip in the pool and outrageously expensive pool-side beverages before making the train journey to Klang to meet up with the rellies for sister’s wedding celebration dinner. We were met by Uncle Peter and Alvin who took us to the restaurant where Uncle Sunny's family and Sophia's family were there to greet us. After a fantastic meal, including whole baby suckling pig (best friend was a little grossed out!), we went to EE's shop to visit Boy Boy and Su Chen and congratulate them on the birth of their new baby son.

Day 2 – Road trip to Taiping. After breaky, we were met by our driver to be chauffeured in a comfy van for the 3 ½ hour journey north. All siblings were knocked out within the first ½ hour – we all get incredible motion sickness, so after a round of avomine, we were gone for all money. The mandatory stop an hour out of Taiping at the roadside eatery and jumbu stalls was quite an experience… As we piled into the car after a quick loo visit and snack grab, our driver was approached by about half a dozen suspect Malay and Indian rather gruff looking males. A mild argument ensued which started to make best friend rather uncomfortable and we all began to feel a bit nervous – perhaps we watch too much tv, but when you’re out in the middle of nowhere, and your driver is being harassed by local thugs, is not a pleasant sight nor situation to be in. After what seemed like an eternity, the driver jumped back in the car and we took off like the clappers. Seems the story goes that the thugs were repo men who troll the roads with a list of in arrears vehicles to look out for and attempt to sort out! Slight mix up with our vehicle as the repo men had mistook the registration number of our vehicle for another – Phew! - we didn’t at all fancy the long walk home! Finally we arrived in Taiping and it was good to see Mama - and she loved seeing the 3 of us and our partners together. Mama had seen bf and I only 18 months ago, brother and best friend 4 years ago, had never seen sister’s husband and it was at least 10 years since she’d seen sister! We took Mama out to lunch at a local Chinese restaurant; for a drive around Taiping Gardens to visit the monkeys; to Burmese Pools and; to also pay our respects at Kong Kong’s resting place.

On day 3 in KL we started the day off with a shopping expedition at Bukit Bintang. 4 hours in Sungei Wang Plaza was enough to send everyone balmy! The centre was just one big plethora of shops intertwined like a big spider web! Lots of jewellery, cheap clothes, shoes (and would you believe, I didn’t make a single shoe purchase!!) and gadgetery or all sorts. The boys later made a split to Imbi and Low Yat Plaza to check out electronics and IT goods. They had a shopping list: laptop, camera, handy cam, media player and hard drives. It was best they went at it alone whilst us chicks explored Lot 10 and the rest of the precinct. PM saw us face a bitter disappointment – Genting. Our cousin Alvin ferried us up the mountain to Genting via an incredibly windy and hold-on-for-dear-life road. Bf doesn’t normally get car sick, but was feeling quite green on arrival. For those who believe that SKYCITY casino in Adelaide is low brow, they need to go to Genting! No flashy lights, no promos, no hype - just dull smokey gaming with emotionless faces lining the rooms. If we hadn’t known better, we’d have thought everyone was in mourning! After white boy’s AUD24 round of drinks (jug of beer and a soft drink!), a rather pathetic exploration of the Genting Shops and no less than 10 minutes in the casino, we were off down the hill again heading back to KL! Once back in KL, Alvin toured us around the red light districts looking for lady boys, tucked safely inside our locked SUV. The close of the evening saw us hoeing into some BBQ stingray at the local mamak - street side food stalls with the tastiest cuisine to be had!


Day 4 – our last day in KL. We kicked off the day with some last minute shopping. Brother spent most of the day finalising his camera and best friend’s laptop purchase but not without bank dramas – HSBC “The world’s local bank”, gave no end of stress when they locked their account after multiple ATM transactions from attempting to withdrawal a bucket load of cash to pay for their purchases. HSBC can be applauded for their security measures, but boy did it put them through grief trying to unfreeze their account from overseas! The rest of us coupled off, spending the day shopping at Mid Valley. Bf was less than impressed, as shopping is most definitely not his favorite past time! We met with our cousin Julian for lunch - it had probably been 20 years since we'd seen him last! Laden with purchases, burning feet and aching bodies, we made our way back to the Hilton for our last supper in KL together – dinner at the Hilton’s Senses Restaurant where world renowned Chef Cheong Liew ran the pot (he also has the Grange Restaurant in the Hilton Adelaide). Our 5 course degustation menu was immensely enjoyed by all, with the most immpecable service you could ever imagine. Seriously, if I could grab all the service staff with me and fly them home, I would. Eloquently sufficed, we ended the night in our room swapping photos between us before we turned down for the night.

Morning brought on a weird and somber mood for all. We met early at breakfast with the harsh reality that our holiday together had finally come to an end, but more horribly, it was goodbye - brother and best friend were returning to London. Lucky for all, our goodbyes were short and sweet. We arrived at the airport all 6 of us, running behind schedule of course! Brother and best friend were the first to fly out, so they had to make their dash quickly. After tight hugs and kisses all round, they disappeared quickly, bolting through the terminal to catch their plane. My tears flooded like the River Nile and I sobbed all the way to our terminal. I’m not sure why – I’ll be seeing them in less than a year when they return for their wedding! I’m such a sook. What made me feel better was the comfort in bf’s arms, and knowing we were about to embark on an amazing journey – 3 weeks in Vietnam and Cambodia!



Thursday, February 01, 2007

DIY - Home Theatre PC (HTPC)

Introduction


I recently built, configured and installed a PC into the lounge, to function as my entertainment hub. So many people have asked me what is involved in doing it themselves so I thought I'd write down what I learnt.


Hopefully this article will not be too technical, but it may be a difficult goal given the subject matter.

What is a HTPC?

If you've seen mine, then you already know - if not, the HTPC is a PC designed for the lounge, acting as the media hub of the house. It can record scheduled TV (Free-To-Air) whilst playing movies (or other recordings), listening to music or even while you're out. All interaction is via a remote control, much like using a DVD player. Other features include photo album viewing, checking the weather and watching downloaded movies (eg Torrents)

Get Your Facts Right

There is so much information on the web about the HTPC that you can't possibly start without reading as much as you possibly can about what to expect. Even with my 10 years within the IT industry (as a programmer, so not a techie) I still read article after article for 3 months in order to fully understand what would be required - and I still missed some things!

It was important for me to find good reliable reading material from an Australian perspective, so my first stop was to join (and remain) a member of xpmediacenter which has been extremely beneficial in every way. Before buying anything, get online, read and ask what others have used for various hardware concerns. Not doing this early enough cost me quite a bit!

Define Your Requirements

The most import requirement is budget. This will define the entire project and will ensure you are satisfied with the outcome. The other important requirements have to do with functionality, capacity, and aesthetics.

Personally, my requirement was to limit myself to AU$2500, able to display HD video and playback HD audio to provide total 'front end' capability to the 42" HD plasma TV and 5.1/DTS Sound System, and with the capacity to record and play TV concurrently.

If I'd known then what I know now, I'd say it's extremely important to consider heat (i.e. noise and ventilation) as well as the above 'features'. The sound of an overworked CPU fan will ruin the quiet scenes in any movie!

Be Prepared for Problems

You may never encounter any, but it is possible - If you are building the box, or even just configuring the software, you will inevitably have issues - mostly they will be simple, such as installing a driver or a codec, or they might be more complex and require some experimentation or even outside help. The best thing you can do is ensure that everything has been configured, and tested, prior to demonstrating to family and friends! I actually had mine in the study for over a month as I ironed out all the problems (it turned out that the original DVICo TV card was a dud!)

What You Will Need

The core hardware components that your HTPC will need are:
  • TV Tuner card (Analog or Digital) - more likely you will want at least 2 - so you can record and watch two stations concurrently - the current version of MCE only allows 2 cards to be installed without resorting to registry hacks

  • Quality Audio card (on board will do) - If you intent to play music, or watch DVDs via your AV Receiver system, you will want a coax / spdif capable sound card

  • Graphics card with digital (or HD digital) output, or analogue output, depending on your TV - personally, I wouldn't touch analogue, since it is being phased out within the next few years. Also, 3D Gaming features are not required, and will probably cause problems due to heat so these types of cards should be avoided if possible. If you wish to route the video to yuor TV via the receiver, you will need to ensure that the AV catoers for the cable type that the TV supports - for this reason, I have implemented my solution using Component Video, even though the TV does support HDMI.

  • Hard drive - get the largest, fastest, quietest one you can afford (get two!). This will be used a lot so don't skimp here. Recording HD TV will 'cost' 4Gb/hr, so you will need plenty if you plan on keeping all your favourite shows on the machine. I bought a 320Gb drive and have almost filled it up, only 3 months into operation.. If you have a lot of music, a second drive for music and AVIs might be a good idea, since MCE only allows one HDD to be indicated for storing TV recordings.

  • Internet via Network card / Wireless card - Although not essential, not having the Internet on hand will severely handicap your system.. (Dial up is probably not going to cut it). If you wish to stream HD over wireless then you must get the latest 802.11g or 802.11n standard which supports high data transfer rates.
And, optional features include:
  • AV Receiver style case - with LCD or VFD display (VFD is what Receivers generally use, as it is brighter but uses less power), and front USB, Firewire, etc ports for convenient access

  • Remote Control device - the MS one comes with a keyboard as well..

  • Wireless keyboard / mouse - you probably won't use them that much, but can be handy for surfing the net, or searching for a stored track or video! (You will need to consider where they will reside - mine is on the bottom shelf of the coffee table

  • Silent / Quiet operation - generally, this will require either silent pipe technology, or passive cooling - this approach can be a bit risky if the air flow within and around the case is hampered, but you will thank yourself when this is all working right.

Putting the Bits in the Box

Although I have considerable experience with building PCs, I chose to use a hardware supplier to build and deliver the final product - I didn't have the time, nor did I want the issues that often arise due to hardware installation problems - still, this can be a rewarding part of the project, so it's a matter of choice.

Depending on who you use, they might even setup and configure Media Center for you.

Its Nothing Without Software

Although MS has just released Vista, I implemented my solution of Windows Media Center Edition (MCE), which is a hybrid of XP Home and Pro, with the Media Center functionality bundled in. The best feature of MCE is that all hardware you buy will be designed to 'Just Work' with it. It should be a breeze to get MCE to find and configure all the necessary bits and pieces. This was the case for me and others I've spoken to so far..

There are several alternatives to using Windows and MCE, which might be considered. You could choose a Windows based commercial package, or use the open source Media Portal, or you could go MS-free completely by choosing a Linux implemenation, such as MythTV. Although these solutions have lots going for them, I chose MS MCE since it is the most well known, and as such, most if not all hardware simply 'Just Works' with it.

There are a few things that you will need manual configure after MCE is installed:
  • Electronic Program Guide - Although in the US this 'Just Works', in Australia, it's a different story. Apparently, due to legal problems with the TV stations here, the guide is not published.. You will need to install Blade Runnner Pro (BRP) and every week will need to run it (from MCE) and manually import the listings into MCE (from the TV Settings menu) - slightly annoying, but not the end of the world. BRP requires an account with a homebrew TV listings website called OzTivo (maintained by users!) to work, but this is easily configured.. You can even add to it if you like

  • AnyDVD - Necessary to overcome the region restrictions technology that Media Center enforces. Not free, but I'm sure you can afford it!

  • Codecs - every media format requires one, and unfortunately they don't all come with Windows, or MCE. Codecs are required for both encoding (burning, converting) and decoding (viewing) so they are essential. Different codecs provide different quality and performance, and so in general, shop around!

    There are a few collections of decent codecs called K-Lite, or ffdshow (don't know about much about this one) to name a few that include most of the usual decoders you will require. In theory, if a file you wish to watch or listen to doesn't work, try it in Media Player (MP) since MCE uses this as it's display engine (if it works in MP, it should work in MCE). MP will notify you what the missing codec is or perhaps, if it's well known, it may even download it for you.

    Video codecs for decoding the stream coming from the TV tuner will require a decoder that will probably come with your new DVD player (if not, you'll have to buy it) such as CyberDVD or PowerDVD or one supplied with your graphics card (ie from NVidia).

  • Some DVD Burning software - not sure which one is best.. This is still on my to do list. Such a feature should have come 'out of the box' with MCE, such that you can burn recorded TV to a DVD.. It appears that you require an MPEG-2 encoder such as one from Sonic (publisher: Roxio?) to do this.

Outstanding Issues

  • Noise - I still need to replace my fan that makes too much noise. It is not the constant whirling noise that one would expect however, I could probably get used to that - Instead, it is a constantly changing high (not piercing though) pitch that sounds like the fan is off-balanced. I am looking at a cooling tower (like the Noctua NH-U12F CPU Heatsink with 120mm fan)

  • TV Recording archival - Burning to DVD and converting to MPEG4 (DivX, Xvid). I'm sure that it is quite possible to convert the TV recordings, however these features are not a part of the basic MCE install. I have looked at several alternatives, however at this stage nothing has stood out as being the perfect solution. A solution I will explore when time permits is MyTV ToGo, however I don't have any good information on it at this stage

  • Scheduled recordings from Standby - I have nto yet worked out how to reliably start MCE from standby automatically (ie when a show that I want to see is on) without doing it myself. This solution would involve reliably starting and returning to standby in time to record any shows I would like.. I have found a free tool called MCE Standby Tool which might do the trick though.

    From what I've read, it appears that MCE will start from standby correctly to start recording from the schedule, however in my case, it appears that either Windows or some drivers don't like restarting MCE after standby - I generally have to reboot after doing it as I have find that I have no valid TV tuner cards afterwards. Apparently MCE will fix this but I don't know yet..

  • Finding out more about the Registry Hacks required in order to have more tuner cards. 2 more should do the trick!

  • Vista - There are several early adopters of Vista (Premium and Ultimate include MCE) however I am yet to attempt it myself - when time permits I will create a new partition and have a play..

Some Further Reading
I wish I knew about these ones before I built!
Products I recommend and use
Good Luck!

If you're still reading this, you can see now that building and running a HTPC is not a casual affair - like most things to do with computers, and in particular with cutting edge technology, there is a lot to consider, and a lot to learn. Luckily there are a lot of knowledgeable people at the various forums who are willing and able to help out.

As you can see, I still have an outstanding list myself, but these features are not essential for my needs at this point. Hopefully I will solve these issue soon and will provide an update.

If you are still willing to undertake this project then I think you will be very happy with the final result. I know I am, and even my once-sceptical girlfriend is now a convert.

All the best.

Wednesday, December 14, 2005

Life: "Spikers" win the Monday Social 'A' Summer V-Ball Competition

Last Monday saw the "Drink Spikers", after only dropping 1 game in the minor rounds, make their way into the Semi Final of the Monday night Beach Volleyball Social "A"s competiton. After easily dispatching "The Force" (46-31) who seemed to be somewhat depleted from their best form, the Spikers had a tough and torrid battle with the ever challenging "Wongas".

Highlights of the game included being down throughout the whole game, but hanging on just enough to stay in touch, and finally getting back to even at around 30 a piece. After trading advantage point several times each (in OT), finally the Spikers were able to win the Grand Final with a deft touch by yours truly - A comfortable set by Big Al gave me the opportunity to get a good jump, and an easy purchase on a solid spike was on offer, but instead (somewhat cheekily) I placed the ball in the dead zone (centre court) with a casual flick of the wrist. The look on the opposition's faces said it all. Dirty.

Granted, it's not normally how you'd want to win a game, but, with pride and $100 drinks voucher at the local pub (The Winston, Pirie St) on offer, winning came first.

Congratulations to all the boys in team Drink Spikers (Paul, Tim, Al, and myself) - it was a good team effort, can't wait to crack the $100!!

P.S. Thanks also to our cheer squad (Lin and Donna) who watched the entire game - especially to Lin who dolled out the medallions (with complimentary kisses) to the lads and Tim for buying the beer!

Friday, November 25, 2005

Politics: Peak Oil makes it to Australian TV

Australia's national broadcaster ABC has produced a 15 minute segment on the show Catalyst about Peak Oil. Finally there is the beginnings of a discussion on this very important issue.

Although they covered the topic in some detail, it was only a 15 minute segment on a channel that is rarely watched by the mainstream public. If only this type of journalism was being done on the big channels. Instead, 60 minutes is covering the latest human interest stories (Not that I mind, it just seems the world has more pressing stories to tell!).

The most compelling fact of this story was the hands-up poll conducted by an Australian Oil man at an Industry conference, who asked the assembly, how many think we've already reached the 'peak'.. 50% or so said yes.. Scary. You'd think those people would have an inside look..

Friday, September 30, 2005

Life: Malaysia calls

My first overseas trip for several years started in KL, Malaysia. Lin and I set off early Sunday after the AFL grand final, which meant no big night.. Not really a bad thing!

Kuala Lumpur is quite a city. Huge, smelly, and full of smog. Great food, great fun, great adventure. I only wish I had more time to explore it all.. I intend to return one day soon.


Highlights - The food..!!!! Well, I love Indian and Chinese, so Malay is a natural fit. I ate all the time, and due to Lin's family being locals, it was all free, all the time! Against our constant urging, the Ng family would not let us buy a single meal.. Luckily, when Collin (Lin's cousin) wasn't looking, I rushed off to pay our final bill!!! So many options - from stuffed tofu to curried fish or beef, chicken rice, steamed boat a plenty... Mmm.. mmm..

Also, we visited a shopping complex devoted entirely to IT hardware and software. I'm talking about a place larger than any shopping centre in Adelaide - 6 levels of laptops, CDS, flash drives and the like.. I was naturally in heaven!!! The price for a notebook is amazing. Compare: a $AU2500 lappy there to an equivalent machine back in Adelaide would be around 4000.. I think I would have to think twice about a local purchase..

KL is a shoppers paradise, no doubt about it. Not that I wanted to go to market after market, but we could have - the exchange rate was very generous as well.

Unfortunately, all that buzz comes at a significant price. the skyline is 'hazed' 24-7, and the air is smelly. Not to mention the traffic, which was, to put it midly, a nightmare! I don't think I ever saw Sydney so bad!!

Overall, I think we will definitely return sooner than later..

Tuesday, August 30, 2005

Life: Lin's Birthday

Happy Birthday Lin!

I hope you are having a great day. I won't mention how *old* you are.. I know you'd kill me if I did!

I bought some flowers for her, they look like this:

Thursday, August 11, 2005

Programming: Coding Is Like Poetry

I've always enjoyed poetry, and as a programmer, I've often noted the similarities between them. Today I noticed an interesting chat on the CodeProject forum about this very thing.

The mental process behind writing poetry and code is the same.
You have to be able to abstract reality into a simple model and be able to transfer that abstraction into concrete code - ie. your natural language or a programming language.

That sums it up nicely. Thanks goes to
Rui Sousa for that one.

Normally, I have this discussion when I've had a few pints at the local, so I've wondered if it was just the brew that has me thinking like that. It's good to see some others thinking the same way.

Similarly,

Good code is like good Haiku.
It is concise, descriptive, and elegant.

Good Haiku, like good code is never contrived. It is also minimialsist without compromising its descriptive qualities

using (Haiku)
{
Writing code, like Haiku:
Elegant within confines
That limit and free.
}


Followed up with a nice Haiku from BluePineNeedles!!

I'll have to keep these points in mind for that next time when I'm challenged to a debate!

Friday, August 05, 2005

Tamagotchi Pokies

It seems that South Australia's anti-gambling king has found a new target of his angst. According to this article he has discovered that those kids toys called Tamagotchi have a gambling element within them.

I don't see how playing the pokies at 6 years old is good for a child's development. I for one don't see how it's good for anyone, but then, I don't play and I've never won 'big'..

The cynic in me can't help but wonder who funded this inclusion? Gambling cartels preparing for their future income streams..?

Wednesday, July 06, 2005

Politics: Birds and Wind Energy

Once again partisan politics rears it's ugly head in Australia. We have a perculiar position right now of a Liberal fedaral government with all (I think) states being Labor. The current issue stems from the Victorian government's desire for a wind farm in Bald Hill, South Gippsland.

Wind farms appear to be the next battleground between the Bracks Government and Canberra, after the federal Environment Minister promised to use his power to stand up for aggrieved rural communities and protect birds from turbines.


It seems the local community are up in arms about it's location and have resorted to the claim of "what about the birds?" to see that it is not built in their back yard.

The reality of bird deaths may be real, but the extent of these deaths, compared to the benefits to the community at large, is negligible. Birds? even the (British) Royal Society for the Protection of Birds have stated that wind farms are a good idea, and that the deaths of birds (which they acknowledge does happen on occasion) is negligible compared to the deaths of birds from other sources.

Millions of birds are eaten by domestic cats each, year, more fly in to houses (windows) or cars to their deaths. Surely a slowly spinning turbine (these things aren't exactly propellers) can easily be avoided by a bird on route.

I think that the federal government should be doing everything it can to reduce our Coal burning requirements, and should forget about politics for the sake of the country. Is it that difficult?

After all, what is more important? Birds in the sky, or clean air in which to breath (for all of us, including the birds!)

Read the article here

Monday, July 04, 2005

Politics: Bogus War On Terror..

If you've spent any time talking politics with me over the last few years, then most of this article, by Michael Meacher will not be 'news' to you. It does however hold some small hope to see it splashed so brazenly over the Guardian's pages, even if it is only 'commentary'.

Meacher pulls no punches, by naming the PNAC, it's geopolitical imperatives, and the fallout resulting from 9/11, a clear and worrying picture emerges.

In fact, 9/11 offered an extremely convenient pretext to put the PNAC plan into action. The evidence again is quite clear that plans for military action against Afghanistan and Iraq were in hand well before 9/11. A report prepared for the US government from the Baker Institute of Public Policy stated in April 2001 that "the US remains a prisoner of its energy dilemma. Iraq remains a destabilising influence to... the flow of oil to international markets from the Middle East". Submitted to Vice-President Cheney's energy task group, the report recommended that because this was an unacceptable risk to the US, "military intervention" was necessary (Sunday Herald, October 6 2002).

That's quite a claim, isn't it? And to think the author is no less than a former British MP.. His summary is no less impacting..


The conclusion of all this analysis must surely be that the "global war on terrorism" has the hallmarks of a political myth propagated to pave the way for a wholly different agenda - the US goal of world hegemony, built around securing by force command over the oil supplies required to drive the whole project.

Read the full article here.

Programming: Riskier (Part 4)

Finally I have a working program. After many prototypes, tests and experiments, I have finally built a shell of a server in C#.

Currently, it is listening to one client generate message (MoveUnit) via .NET remoting. The world object is being updated correctly. Now, my next step is to have the fact update propagated to all interested parties. That should be interesting. The plan is to simply register each player object with the server, such that when a unit or region fact update is allowed to be known to a client, it is sent a message – this will be a simple .NET delegate (event). Ultimately, I intend to build a message packet which will accumulate updates, but that optimisation will come later, if required.

Next, I intent to start exploring the idea of using Reflection to automate the FactUpdate event. I thought it would be really cool to simply tag a property with an attribute that would indicate to the server that an update to the various clients is required – great plan, but yet to be confirmed. The fall back position will be to manually code the event call for each property for each entity. Not hard, but certainly not as elegant. It will no doubt be more efficient though, so all would not be lost.

Of course, a functioning server will demand a new and improved client. My intent is to build a primitive command based ‘terminal’ which will simply be a basic object viewer, in the spirit of mail-based BBS games of 10 years ago (no doubt these games still exist, and are well participated in!).

An interesting point from all this is that I have found it has been much harder to build this program than I had expected. Don’t get me wrong, I never though this would be easy, but I really have struggled to make the progress I had wanted. I have however learned several important skills, so all is not lost. I have in the process learnt many things about C#, the .NET Framework, and Object-Oriented design. At least my secondary goal was obtained!

As a vehicle for learning new technologies, it has been worthwhile. I can only hope that I am now in a good position to commence the ‘guts’ of the program. Writing the actual ‘business’ logic is where the process should become interesting and start yielding some visible results.

Firstly though, I need to beef up the client!