Saturday, December 6, 2008

Watchmen


I finally completed a reading of "Watchmen", a well acclaimed DC comic written back in 1987. I never knew it existed till I saw the trailer for it's upcoming movie adaptation for March 2009. I must say it is one of the two best comics I ever read with the other being Kingdom Come. Here's the Watchmen trailer that got me interested. The movie adaptation is directed by Zack Snyder that previously did 300. I'm definitely catching this one.



Thursday, December 4, 2008

Hidden multiple argument BAT file execution with VBS


I have been writing a program that calls external programs using batch files in windows. Every time the call is made, the ugly command line box appears. After searching the net it seems that a simple way would be to use Visual Basic Script (VBS) to call the batch file in a special shell. Since the VBS interpreter is available on WinXP and above systems, I decided to try this vbs script that I found somewhere off the net.

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & WScript.Arguments(0) & Chr(34), 0
Set WshShell = Nothing


Put the above code in a file called "invi.vbs" and then call the following from command line:

$>wscript.exe "invi.vbs" "mybatchfile.bat"


The batch file runs without a window! Thinking that this was great, I tried to run a batch file with arguments. Now that fails somehow because the interpreter seems to think that the entire WScript.Arguments(0) is a program name, i.e. "mybatchfile.bat arg1" will be treated as a program name instead of a batch file with a single argument.

Having not written VB since eons ago, I used my limited knowledge to concatenate the WScript.Arguments into a string. Somehow it just worked after replacing "invi.vbs" with my edits below.

Set WshShell = CreateObject("WScript.Shell")
dim toexec
For Each x in WScript.Arguments
   toexec = toexec & x & " "
Next
WshShell.Run toexec, 0, 1
Set WshShell = Nothing


Then, running it without quotes for the batch file, i.e.:

$>wscript.exe "invi.vbs" mybatchfile.bat arg1 arg2

Monday, December 1, 2008

MinGW to MSVC -- the case of rint()


I have recently been working on shifting a project over from compiling with the MinGW implementation of the GNU C++ compiler to the Microsoft Visual C++ (MSVC) compiler. The most glaring difference is the lack of the rint() function in MSVC. rint(x) takes a double, x, and returns the double value of the closest integer to x. Being a lazy bum I opened the math.h file for MinGW to copy the rint() function to a global win32 compatibility header. Unfortunately, it is written using an assembly instruction and a bunch of macros. Not wanting to copy the macros over, I did the next lazy thing and used Google.

More unfortunately for me, I copied a version of rint() that was not compatible with the implementation in MinGW. I had:

double rint(double x)
{
     return floor(x < 0.0 ? x - 0.5 : x + 0.5);
}

It turns out, that this is wrong as -1.5 should be rounded to -1.0 and not -2.0. After wasting a few hours debugging, I finally realised it should be the much simpler:

double rint(double x)
{
     return floor(x + 0.5);
}

So much for being a lazy bum...

Wednesday, November 26, 2008

Google Maps Europe Street View


I was just browsing my Google Maps today when I realised something interesting. Street View over Europe! So I zoomed into Rome and checked out the Colosseum.


hohoho...

If you are observant, you will realise that car plate numbers and human faces have been blurred out like this.


Pan over to the left (<--) where the road is filled with cars. Zoom in to see their license plates blurred out.

Notice how parts of the lamppost are also blurred out. They must be using some sort of image segmentation (dividing an image into logical segments -- clusters of pixels) and machine learning (ah that's a face, etc) to automatically identify parts of the scene to blur. Looks like the lamppost is a false positive.


Vatican City

Friday, November 21, 2008

Smashing the Moon


Somehow this ramming of the Moon Impact Probe at 1.69 km/s reminds me of H. G. Well's Time Machine in which humans split the moon causing disaster on Earth.

Thursday, November 20, 2008

Yummy Caesar Salad


Went to Coffee Club a few weeks back and noticed everyone was eating something new on the menu. It's a Caesar Salad with smoked salmon! Being a fan of Caesar Salad, I decided to order it.

It comes in a basket made of ---- Cheese!

Tastes really good for some 14 odd dollars

Thursday, November 6, 2008

Romance of the Three Kingdoms XI

I haven't been posting for a long while. Well there're two main reasons. First of all, I have been busy (who isn't?). But, more importantly some two years after the Japanese and Chinese versions, the English PC version of KOEI's Romance of the Three Kingdoms XI was released. Heading down to the shop where I get my games from, I got it for $52. Here's the opening video.



The last time I played a RTK game was version 4 as it was the last English translated version. In those days the game was rather easy. Using a nifty combination of wind direction and fire, a much smaller force could wipe out a large force in tactical combat. This made picking a small force like Liu Bei's in the common ``Dong Zhuo seizes Loyang" scenario a breeze with his super generals Guan Yu and Zhang Fei. For those of you that do not know what I am talking about, RTK is a game whereby one tries to unify China and Liu Bei starts out with a puny city, his two brothers, and some handyman. He is sandwiched between much larger forces.

Unfortunately for me, now in RTK XI there's no tactical combat map, everything takes place on the same map that looks like this.



That means that while I'm out fighting, nobody will be home to develop my city. Furthermore, there's no wind! So much for superior tactics and generals. After wave after wave of Yuan Shao's (a big bully in the north with lots of generals) army being owned by me, the effects of economic neglect starts to show when the enemy returns in full numbers while my army steadily erodes. Super generals give good advantages but not god-like advantages anymore. Take a look at this duel mini-game video.



Now multiple generals may participate in a duel allowing two or three weaker generals to take out a stronger general.

And so, for the first time in RTK history for me, I had to make a tactical withdrawal across the Yellow River to Bei Hai where the 20th descendant of Confucius, Kong Rong, is about to be destroyed by a sneak attack by Guan Yu. Here's a map for perspective. The green square is Ping Yuan where Liu Bei starts and the red arrow charts the ``great escape".



Interestingly, while evacuating Liu Bei from Ping Yuan, Yuan Shao's army captured the port and Guan Yu had to come back to capture it so that his master could flee to Bei Hai. Even after withdrawing to Bei Hai, Yuan Shao pressed on, but Guan Yu being smart in naval warfare routed most of his inferior sailors in the Yellow river.

Now, Gongsun Zan (in orange on the map) was good friends with Liu Bei, and seizing the opportunity of Yuan Shao's weakness (I devastated most of his army remember?), launched an invasion from the rear. Apart from the fact I had to actually withdraw, the next thing that amazed me is that Yuan Shao got his ass handed to him by Gongsun Zan. Something remarkably different from the old RTK 2 to 4 games whereby he was normally the first to be wiped out. Before long the entire north eastern bank of the Yellow River belonged to the Gongsun clan. Thankfully, he's a good friend.

To cut the long story short, for the next part I was pretty much worming my ruler around, being a cheapskate and letting my ally Cao Cao do all the hard work while I capture the cities he sieged from behind. Before long, Liu Bei's realm was formidable and I liberated the Han Emperor. Eventually the Emperor abdicated in his favor. Finishing off all rivals, he became the Emperor of the next dynasty. Right, and that took me like 5 full days of playing the game when I can finish one Civilization 4 game in 2 days.

Some nice aspects of the game included female generals that you can marry of and a system that allows you to create new sworn brothers giving them bonuses. On top of that there is also the Debate mini game that is sort of like an intellectual duel. Here's a screen shot of Zhuge Liang telling Lu Xun to "Shut the f*** up!".



Unfortunately, the diplomacy system is lacking, allies can only be requested to attack but not to defend, also there was no proper way to betray an alliance -- features that were present since RTK 2 on DOS. Oh well, time to best the game with my own created gang of female generals next.

Thursday, October 16, 2008

Behold the Fat Funnel



All rights reserved

Saturday, September 13, 2008

Central Japan Day 6 & 7 - Tokyo Disney Resort & Home


View the first post in this series here.
View the previous post in this series here.

05 June 2008

Without any onsen for a morning dip, I was able to sleep longer than usual today. After breakfast at the top of Washington Hotel, we will be headed to Tokyo Disney Resort. Having been to the original Disneyland in the US I had some mixed feelings -- was Mickey going to say "Konnichiwa"? Nevertheless, there is a good reason why Disney Resort is one of the most successful theme parks in the world. It was a weekday and the place was teeming with students right after school.


Breakfast, yummy lemon tea


A large hotel right opposite Tokyo Disney Resort


Now at ¥4500 it is really quite cheap. I think it was only about ¥3600 for students.

Tokyo Disneyland 25th Anniversary
Happy 25 Years Anniversary!


Right through the first gate is the shopping area. It's morning and the crowd has not arrived

Disney Castle
The famous castle that's present in every Disney theme park, unfortunately it was a rather gloomy day


Our first ride of the day, the ``Pirates of the Caribbean", was actually the best ride I have taken. It comes complete with cannons and guns shooting compressed air overhead (yes your hair will fly). Being a boat ride the ``cannonballs" whizz past and create splashes in the water. Great effects.


There, spotted Captain Jack Sparrow!


These themes just remind me of Roller Coaster Tycoon


We'll be taking a ride here later


That's some amazonian atmosphere down there


Ah the shooting gallery, a piece of cake. I had 9/10. Little did I know that I could get a prize with a perfect score. Darn, I knew I should not have risked it with the dashing/hopping mouse.


The first mini-parade of the day. Being Disney Resort's 25th Anniversary, there will be special events all year round and parades every day.


Da Big Thunder Mountain!


It's one of the sleepy looking bears. I'm not sure what they are called though


Lunchtime! Everyone just has to have a smoked turkey leg!


Unfortunately Pool's Honey Hunt was closed. I was looking forward to taking this ride without physical guidance -- the ride uses a Local Positioning System to guide the carriages, unlike using rails as per normal.


``It's a small world after all" ride. ``We MUST take this", says my friend.


It's a boat ride with lots of animated dolls dressed up in costumes from different cultures


The Haunted Mansion, some cool effects such as projected 3D spooks inside


Wow, pram parking, everything here is exceptionally orderly, the cleaners sweep and clean the floors every few minutes

Disney Space Mountain
Another high trill ride, the Space Mountain


Technically we'll be boarding this space craft


Everything here is in the shape of King Mickey


The beginning of the main float parade, thankfully the rain stopped


The princes and princesses


Winnie the Pooh and friends


The Lion King


Some elaborate costumes here


Peter Pan and Captain Hook!


Lilo & Stitch



It's amazing how they can dance in these costumes


Pinocchio!


Monster INC


Cranky hairdo


Now this made me realise something, each float was moving by itself! There were no visible drivers and everything seemed to move autonomously.


This costume wins the most bombastic award

Disney Classic Float Parade
To wrap up, the classic Disney characters make an appearance


After the parade we decided to go try out the rally


Here's my ride. It's a real petrol fueled vehicle


Then it was time to nibble on some Mickey nuggets


Catch a tram to Toon Town where all the toons live


Mickey's house, an audience will require almost 2 hours in queue


Minnie's house. See the ears on those students? Everyone has one. I mean everyone of these students in Disneyland has these ears in different shapes and sizes. It is as if they head for the ear shop right after stepping in.


Chip and Dale's tree house


Ho it's one of the pigs


Back to the castle on the reverse side, the castle is in the middle of the entire theme park


Mosaic decorations on the inside of the castle. The castle also houses the most expensive shops, such as those selling crystals.



Back to the shops, everyone here seems crazy about shopping and the shops were packed with people. Look at this biscuit tin, I'll probably keep the biscuits till they rot. Then, it was time to leave.


At dinner, here's some Kobe beef, it's good because the fat is intertwined with the meat. So for the fat lovers it's great.


We had shabu shabu dinner, lots of sliced beef with golden mushrooms and some Kirin beer to wash them down. There is actually no soup base, the pot contains just plain hot water. Some special peanut sauce is provided to dip the meat in. Well the peanut sauce was interesting but I still preferred dipping the meat in soryu. We were then brought to Narita to spend the night before our flight home the next morning. Exhausted from a day of fun, we quickly fell asleep in our comfortable beds.

06 Jun 2008

Morning came soon enough, we had our last breakfast in Japan and sadly departed for the airport.


Now I haven't had pancakes in awhile


Continental Breakfast


Soba


We stayed at the garden hotel


On board our ANA flight, everyone drinks Suntory, it's a good beer


Lunch


Some saffron rice, and yes more champagne


To top it all off they gave us Häagen-Dazs ice-cream. ANA's a winner


Back home reflecting what I bought from the airport. Here's three erm... barrels of sake


And some shiroi koibito biscuits from Hokkiado, melts in your mouth

All in all our trip to Japan together was fantastic. However I will definitely not take a tour if I'm going back again as most tours still cater to the shopping crowd. Being extremely well connected by rail, there's probably no point in taking a tour except for saving the hassle of organization.

Now that took awhile, thanks to my extremely busy schedule I finally completed my Japan trip posts some 3 months after I returned. Having about 9 GBs of photos didn't help one bit. Now I wonder where to next...

Go back to the first post in this series here.

Return to the trip index here.