Composite UI Application Block

We have just finished watching the Composite UI Application Block webcast from the August MSDN Webcast DVD (which could be a CD with its 180MB of data on it). I have to give big kudos to the patterns & practices team, it’s a really cool piece of work.

I’ve been struggling with idea of how to refactor the application we have here at work, with the compartmentalized MVC system, and support for plug-ins and how these would all tie together. Oh the joy of spending my home time dreaming up methods to improve my work efforts, or how I’d do it if I had to start again. Now I can stop trying to solve the problem, and wait to use the CAB when it’s released, and we move to .Net 2.0

The Collapse of Barings

I finished reading this book last weekend, I really enjoyed the story. It makes me want to learn more about the derivative markets, how options are priced and the modelling used to evaluate the effects of change.

TopCoder - Open Qualification Round

Well I’m not going to get into the Elimination Rounds.
I was assigned VideoEncode and GridGame.

I spent ~30 minutes of my 60 solving a problem that was really just a bit of algebra. I solved it using binary search, when I just need to rearrange the variables to get a single line piece of code. I had the feeling this was the case, but the stress of the situation I was not trusting myself to solve the algebra faster than getting the binary search working. Net time I’ll have a better indicator. The binary search was required in the AutoLoan problem due to the value been search for had a compounding affect on the result. Whereas here there was no complex relationship.

The second problem was a simple min/max tree problem. Given a 4x4 board how many of the available moves will “win” if I only play perfectly. I had missed the guarantee you win and assuming you play perfectly bits. Not that I know how to solve this. But I went down the path of how many of the moves could I win.

So now I’ll stop trying the path of logic I had been working on after the event, and workout how to solve the problem correctly.

[Some time later]

Oh my, it really was quite simple once I stopped and thought about that at each turn the two players are trying to achieve different things. For our turn we just need to find one move that we win. For the opposition move they win if they find a path we don’t win. So simple now I understand what I was trying to achieve. Other the feeling silly for not know how to program this I now feel relax I worked out how to-do it.

I’ll be ready for next time.

[Just before publishing]

Well the results are in. I came 300th out of 374 in my problem set. Most those people came 317th equal for no score. This hammered my ranking, and I’m now down to 1050. Oh well, I surely can’t get much worse than this.

Transition from geek to luser

I’ve been becoming more aware of the fact that I spend more time fixing my home computer than doing productive stuff on it. This in days gone by was not an issue, but I’m really getting sick of Windows doing the funniest of things. I’ll admit that I have not been inspired to cough up the money to upgrade from 2000 to XP, but I probably should (If only for Media Player version 10). Maybe I’ll wait for Vista and get a new computer to run it at the same time. The latest round of really odd behaviour is that each time I log out, my user profile was deleted, and upon next login I’d be presented with a clean user profile, very annoying. Also at times the Administrator could not delete/move files that were created by my user account, which just violates the principle of logging in as Admin.

I suspect this came about because ~2 months ago I re-installed the machine to sort out the difference between my user account and the Admin account. For about 4 years (on NT also) I had been using the Administrator account as my everyday account. Made setting up software easy, but I knew it was wrong. On the original 2000 install about 6 months ago I created a Simeon users account and started using it. Not all my apps were happy to now run as Simeon. So I moved all my important files/data onto my second HDD and reformatted/installed 2000 on the first. Both disk were NTFS, but only one was reformatted, and I changed the system name, so the second disk had files owned by some “person” that is did not know. So I ended up fighting the volume quite a bit, taking ownership etc. For a few weeks this seems to all work, but things that didn’t work were Microsoft Update and other apps still were not always happy. So last night I got sick of losing my profile and reinstalled the system.

This time I backed up every thing to the first disk. Formatted the second disk to Fat32, copied all the backup data onto the second disk. Reinstalled on the first then merged/sorted the data/files. Other than been up till 4am (take that Mayo) I’ve almost completed the install. I’ve had no user profile issues, Windows Update works a treat.

At the same time I’ve decided to stop using The Bat! as my email client and try Thunderbird. It would seem the sensible thing to-do as I refuse to go near Outlook Express.

There is still another evenings work checking apps are happy and reinstalling things like Office, Media Player, Messenger, RSS Bandit.

Sometimes it would be nice if it just worked. And it’s at this point in my though process that I realised I’ve become someone who just want to get stuff done, and I don’t really care for the sake of caring any more.

AJAX Blogversation

Tim from the New Zealand .Net User Group has put up a blogversation about uses of AJAX to enhance his shopping cart software. So I’ve never done any AJAX development let alone ASP.Net development. Any how, while not shopping carts a place I think that could really get some again from AJAX is real estate sites. They are painful.

The first area I think that would get the best again is searching. Avoiding the complete screen re-draws on country selection and again when you enter your region. But that’s the obvious place. The next improvement is dynamic search result size. Normal the search page lets you select the suburb/s, room count, price min/max. Now if as I adjust each one I see how many matches/entries this will be I can adjust my search. This would allow you to gage the price hotspot for a suburb/area. Heck you could even start streaming the textual details after a small delay, and also stream the pictures as a lower priority stream.

Bandwidth management is also something I could imagine could be managed in an AJAX style managed way (user driven or just dynamic). The client side code could evaluate the download time, (even have a UI widget for pipe size) then change how data is sent. I say this one because I have dial-up at home, and waiting for high resolution pictures to load (watch the sky load) to get to the middle of the picture and decide I dislike the view, verses have a low resolution picture, and wanting to see better detail. Even a low resolution b/w picture would give to a good idea. Sort of how Google Earth works (even though that is a client side app)

So not really sure if that relates to a shop, I would love to find a real estate site that was not brain dead. While a real-estate magazine has bad search and low number of pictures, the scan rate is really nice and fast, so I’m not sure how you can allow the quality random access on a web site. I’ll have to think some more on this…

The Price of Printing Digital Photos

Michaela and I had stockpiled a years worth of digital photos that we wanted to print. After spending an evening reviewing the 2 gigs of pictures (~1000 pictures). We then reviewed how to get them printed.

We have used FrogPrint in the past, and have no issues with there service. Having a dial-up connection I was not interested in uploading 280Mb to their site. You can send them a CD but I wasn’t interesting in paying to send the CD and then paying to get the photos back. More of a point is their price is $0.60 (100+ run) per picture.

The local Warehouse I only have to pay $0.3729 on a 24 exposure film. Their digital printing can be done the infinitely crappy Kodak picture maker, or on the same machine that is used for normal film. I could not find online there digital print price, but last time I was there it was also around the $0.60 mark. I’ve used this service for one off print enlargements, paying ~$2.00 for a 10 x 8 picture was wonderful as it took longer to chose the frame than get the print done. But still the price difference doesn’t seemed justified when it’s the same machine used to print the photo’s, and yes a technician might have to do a little more, but they are managing the machine anyway, so I’m not really sure there is a justifiable cost increase.

The winner on the day however was digitalmax with their $0.38 per print price (via the $20 prepay card). The best part was we could take our CD of pictures to the local pharmacy, and get the pictures back the next day with no shipping cost incurred, and we only need to pay for the number of picture we had printed at the $0.38 price.

One point to note is that we had 70 of our photo’s take at 5M pixel (6inch x 4.5inch) and the rest at the 3:2 (6inch x 4inch) format. So the 70 larger pictures where printed onto smaller paper (13 x 10cm or 5.3 x 4inch) so that the images were not cropped. This happened due to the instructions been “one of each”. When talking to the print company (not sure who they actually were) the guy said to use “all at 6x4” and then the pictures will be auto-cropped. This would have looked better in our photo album. To give the print guy credit he did say they could reprint them, for free was not explicitly mentioned, but I’ll assume it otherwise the comment was pointless. We didn’t take them up on this, but we will more precise next time.

So my real point is: why does it cost 57% extra to print from a digital media source to the same photo paper as does when processing a film. Processing the film cannot be free, so the price difference is even more. I just feel like I’m getting milked, and I don’t like it. Sure there is cost in having a web front, and the cost a normal shop has will be absorbed/shared across all product sales, but it still seems a high premium to be paying.

digitalmax have a service with a price point that I’d expect, and a willingness to be helpful. So I know where I’ll be going in the future.

Programming Challenges Problems

Here’s the list the 21 problems I’ve solved on the Programming Challenges site.
If any ATR people have solved more I’ll have to start solving them again…

110101 The 3n+1 problem
110102 Minesweeper
110103 The Trip
110106 Interpreter
110107 Check The Check
110108 Australian Voting
110201 Jolly Jumpers
110202 Poker Hands
110203 Hartals
110207 Contest Scoreboard
110301 WERTYU
110306 File Fragmentation
110308 Fmt
110404 Longest Nap
110405 Shoemaker’s Problem
110406 CDVII
110504 Ones
110805 Tug of War
110903 The Tourist Guide
111302 Rope Crisis in Ropeland !
111308 How Big Is It?

The problems I can’t/haven’t solved and would love to hear of solutions for are

110104 LC-Display (edit 2008: now solved)
110206 Erdos Numbers (edit 2010: now solved)
110208 Yahtzee (edit 2010: now solved)
110307 Doublets
110801 Little Bishops
110804 Servicing Stations
111002 The Necklace

[Edit 2010] I have a newer, complete list here

Competition Programming

The art of know all the required tricks, and just “getting” the problem, and writing the solution. I have so much to learn.

I entered TopCoder SRM 258, and end with a zero score for the second time. But this time at least I submitted a problem that I thought worked. My score is was not too affect this time and I’m still in Division I. I plan to turn the slope of this graph around.

The first problem was calculating the interest rate given the start price, monthly payment and number of months. I’ve done a lot of self discovery in the finance area driving by our (Michaela and me) desire to purchasing a house. The problem reminded me of my book of formula’s so much I couldn’t get over it and just write a program to solve this problem. So after the event was over last night I worked on it. I almost had it solved correctly, but the way I was generating the correct interest rate was ugly (it just required a binary search due to the limit of 0% to 100% stated in the problem) and the exit conditions. The latter was a bigger issue. The problem stated 1e-9 precision, so I comparing the money owning at the end of the term to 1e-9 not the interest rate. So using the binary search also solves that problem.

The second problem was a compression problem. The problem that got my code rejected was a challenge of “ASD”. Although the problem stated the input was from 1 to 50, I had thought that the two compression keys needed to be unique, thus my inner loop would not use the same key as the outer loop. There was also a problem where my inner loop was from 0 to n-1 not n as it should have been. But looking at other peoples solutions I worked out that one correct way was to use Dynamic Programming, which I had been reading about that morning. So failing to spot the change to use it make me feel a little silly, but boy, from now on, DP is going to be on my check list.

The third problem was a really hard DP problem. Work out the probability of each play (1-4) winning a game of snakes and ladders (though they used a different name). That just messed with my head. But the people that did get it had very compressed but elegant solutions. Another learning opportunity.

Anyway the first two problems were opened, read, coded, tested in 5 minutes by the best people, so I’m just thinking they really grok there comp sci algorithm courses.

TopCoder - Single Round Match 257

Well, I just completed the TopCoder SRM 257, and I didn’t even get one problem solved.

The first problem was find the minimum error ( difference ) for a weighted average.
You used 5 weights, with a sum 1.0, that last bit (sum of 1.0) I forgot, so spent the whole time trying to workout why my result was different from the example. Also the run time was too long for the bigger dataset. Not till coding phase was over and I started reading other people solutions did I see my error. GRRRR. So I’m not sure how badly it will affect my ranking, but I’m think its going to hurt. Maybe I’ll get put into the second division, which will be easier, but not as much fun as playing with the big boys in Div I.

So tonight instead of doing game development, I’m going to solve the other two problems that I didn’t even start.