Wednesday, 29 February 2012

Lower casing variables in DOS

Occasionally, I will need to use MS-DOS in my role at work. MS-DOS is one of the scripting languages to use while using Microsoft Windows operating system.

One of the problems with MS-DOS is that it is case-insensitive. MS-DOS does not distinguish the difference between upper case or lower case when using it. While this may not cause problems most circumstances while using Windows, it may potentially cause problems when interacting with other systems or programs.

I have used the following snippet of code to convert the %computername% variable, which was set as upper case to lower case. The result will be stored as %mycomputername%

dir /b/l %computername%>lower.tmp
set /p mycomputername=<lower.tmp
del lower.tmp
del %computername%

This snippet works by creating an empty file based on the variable that is in upper case. Then a directory listing is made, with the appropriate flags to list the output in lower case, and the output of this is stored in a file called lower.tmp. Then the contents of that file is read into the new variable. Finally the two temporary files are deleted.

I would have thought it would have been easier than that.

Monday, 13 February 2012

Teams are winning - including me (sometimes)

For the first time in a few months, both the teams I am following are winning!

The Boston Celtics recently beat the Chicago Bulls, and the Melbourne Victory beat the Central Coast Mariners. The former teams play in the NBA, and the later teams play in the A-League. What makes both teams interesting to watch at the moment is they are both quality teams on paper, but are not really producing winning results (until recently). And while the Celtics are currently above a 50% win-loss ratio, the Victory are struggling to have wins on the board, having more matches end in draws than anything else.


Other than that, I have been playing in the Magic: The Gathering (MTG) prerelease tournament for Dark Ascension and in the MTG League at Games Laboratory. While I am not ruling the game, I am starting to win a few matches here and there. It feel better than just loosing every single game, but then again, I do not put as much effort into this game as I would like.

With the introduction of the new set for Dark Ascension, I have already seen some new ideas for my to add to my infinite copies of tokens deck which is powered by the Splinter Twin / Kiki-Jiki, Mirror Breaker combo. While it does not affect the main deck very much, the new mechanics from the latest set will definitely change what I believe should go into my sideboard. Cards that I believe will need to be considered in my sideboard are:
The exact quantities of the ones mentioned here is something I need to work on, as well as possibly including some duplicate of the spells in my main deck into my sideboard - up to the maximum of 4 of any card.

This leads me to the psychology of how people feel things based on how much control we have over the aspects in front of us. When it comes to cheering about a sporting team, no matter how much I cheer or oppose a team, it does not affect their final outcome. It comes down to those sports people and how they play, as to what results are achieved. It also comes down to their opponents and how well their opponents play as well. In summary to this situation, I am not too upset when a team I support looses, just somewhat annoyed.

When it comes down to a card game that I have some (perceived) "control" over, it does get a little bit beyond annoying if I had a possible win, and did not make the correct decisions, or choose the right elements at hand to bring forth a winning result. If I play against a deck that my opponent has tuned, play tested a lot, and I loose to it - I do not feel very bad. I noticed in the MTG League that most of my opponents have at least one, if not two, mythic rare cards. While some of those cards are awful to use, some (in the correct circumstances) are game changers. Loosing to those decks do not upset me. Winning to those decks is always a pleasant surprise, as I do not have any mythic rare cards in any of my MTG League decks. The only time I am upset is if through a mistake of my own, I loose to a deck that is underpowered or is on the same level as mine. Luckily, it has not happened much.

Friday, 10 February 2012

Upper and lower case in vim

I use vim for most of my text editing, especially with it comes to configuration and text files on UNIX / Linux machines, and there are times where I need to convert the entire file to uppercase or to lowercase. I find these two commands useful (when in command mode of vim):


converts all uppercase characters to lowercase,


converts all lowercase characters to uppercase.

You could always toggle case characters using "~" as well.