Sunday, June 28, 2009

Starcraft 2 - Battle Reports Collection

For those of you out there who are avid fans of Blizzard Entertainment and their game franchise (Warcraft, Diablo, Starcraft), their latest RTS (Starcraft 2) is nearing release and from what I've been following through press release / forum / fan sites, the beta is going to be going live most likely sometime this quarter. I eagerly opted in for the beta testing process and have my fingers crossed. If you haven't already done so, you'd better hurry if it's not already too late. Just head over to battle.net.

Below is a collection of all of the battle reports released by Blizzard. These are some amazing matches and the game has a lot of potential!

Battle Report 1



Battle Report 2



Battle Report 3

Monday, April 27, 2009

Building your own Digital TV Antenna - Why pay for cable?

Some of my readers may have seen stuff like this before, but there's plenty who haven't. I came across a video about a month back over at makezine.tv that showed how to build this crazy looking tv antenna. Me being the dissatisfied owner of an overpriced store-bought version, I decided to embark on the journey of duplicating this miraculous antenna to see if it held up to the hype.

After watching the video I then turned to the PDF plans that they provided that correspond to the video which can be found here.

My original antenna looked like the following, a sleek flat ribbon-like antenna that had dreams of proving itself to its owner, only to fall short.



With the above antenna, after a fresh programming of my HDTV set, I could pick up 12 digital stations and 9 analog stations. The mere fact that I could "pick them up" does not mean that they were stable and watchable all the time. More often than not, many of the digital stations would constantly go from beautiful perfect quality to flat out darkness (one of the nice attributes of the digital era). This proved to be quite annoying and would eventually force me back toward its analog counterpart. Obviously in the near future (if they stop changing the freakin' date!) this will no longer be an option so I figured it was time to do something about this reception issue.

Now here's a couple shots of my finished product for the new antenna.




I didn't stray too far from the original PDF plans, although some minor liberties were taken, based on parts availability at the local hardware stores. I actually ended up buying a spool of 16 guage fencing wire from Lowes since all of our coat hangers in the house are made out of plastic. The spool was pretty cheap (< $5 for about 100ft. of it I think) so I figured it was worth picking it up rather than hanger hunting! The only other part where I marginally strayed was with some of the screw sizes / washer sizes, and of course, the plywood base which is more or less left up to the do-it-yourselfer.

Anyhow, onto the results. With the new antenna I merrily went about my way, pushing that magical reprogram button again on the tv, after confirming that the antenna was facing the optimal direction for my house (this can be done by visiting this site and typing in your address - they offer a map that will show you where to point the antenna from your exact house!). The results were amazing, with 24 digital stations and 12 analog stations, all picked up for free over the air. The 24 digital stations are very stable and rarely ever flicker off. I didn't care so much about the analog versions anymore and have saved off my favorites as to avoid them since they look horrible to begin with and will be phased out soon enough.

It's worth noting that folks who subscribe to cable television do not actually receive true HDTV quality television, as your cable provider actually compresses the quality of the broadcast through their lines as it makes its way to your house. Catching over-the-air broadcast actually catches the full HD quality. Kind of ironic that most people pay money for lesser quality. Now obviously if you want to watch stations that aren't available via antenna, well I can't help you there.

I hope you have all enjoyed the article and are inspired to make one of these antennas on your own, as it doesn't take too much cash nor time to get it up and running. Best of luck! Please let me know in the comments how your creations go.

Cheers,
Chris

Thursday, January 29, 2009

GPG (PGP) Public/Private Key Encryption/Decryption/Signing using the Command Line

I've had a couple emails asking about public/private key security and how you can perform this task without the need for GUI-based applications. Below you will see an example command line session of mine showing the complete process from plain text to cipher and back to plain text.
Macintosh:Desktop chris$ cat test.txt
This is a test secret message.
Macintosh:Desktop chris$ gpg -sea -r 'Christopher M. Ball' test.txt 

You need a passphrase to unlock the secret key for
user: "Christopher M. Ball <chris.m.ball@gmail.com>"
1024-bit DSA key, ID 0B9FD4CE, created 2007-11-01

Macintosh:Desktop chris$ cat test.txt.asc 
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.8 (Darwin)

hQIOA5PL0Y5P2m2zEAf/b+o5ISTGorJnloGYyAnmt4hw17r98MZ57IFOB/AAJ4hG
Sp/Ru72+0qhEW/IbsX+i4bLO7bAyoPY47yw549yALP621O6s+mqrisrC0nJ33N8v
smyJ8sROn+Pzf53Xkf41wmTgssgSZAd3B60wrmf+AW0csHfjWAd6n8h9lw53HwfR
uzvG3CIkElo6eTG447qGXW07e7AbjlFRAOuuzn9YgvDLHHbpYM38o/snufOOkejD
lyeUQTVwOOxNa4nAQJYSO6Xwd9YP7+MsntbR598DsA5xLRlXxZsEplkoE3c0hRDh
3PCcIeBDUaXC7ZLDc/on7CrL5S7NJUEKGeAx7GMgOgf/QClLSBkMYrO31wbGd4ga
27YLUJNNdGRXIGHsJy/03OGYPh1tKS7xXYJd6q2oK1t9qlyWKTmBLLndIa3UvslF
MVsz7tLqKwr873lBWwdpNBS9YQiBNjqVwNyh4S3XVzzb8RsAa9WSRO2WGqOGaktf
VsfwDdVFmrNwu57f24U2TYzAUWaij/W/e3ANwor6FpvNva8AT9yO0d5xz+PYRXrw
n9UkPQR12TAZ94bcDWq0VWp/yJp+9zMT0MY/kilq4eQxaX6Ha3MtRz+GX7OizK9a
VdSly/AC4RHFVqbK1qhhq8U2Uu7ce0DUs9NYc0DxcoGzz28KFv2RGekh1Pbo+Lx/
j9KxAeL0+F+sdeojxktqmtG1Lp+z1TKrQ69VhQlSOT+kjMH/UfUqjMmCsA9v8t7Q
xRA+AK00K6FWV/x8AcG5ypTeq3DeWLrHLfdB6Ct8iA3yUF8qIGH60jRyXpY/jIL+
pJ7mxNcBQS33RNuoI2eOok5+aAZZERM1DRJKEzJN+PQf8YKG/ZesCRzGO1Di6sgB
J3o/JKnvrGyuXDZ8cmLHvajXk8hKAvQdvKmRl5rMnLiuP2/B
=i0iO
-----END PGP MESSAGE-----
Macintosh:Desktop chris$ rm test.txt
Macintosh:Desktop chris$ gpg test.txt.asc 

You need a passphrase to unlock the secret key for
user: "Christopher M. Ball <chris.m.ball@gmail.com>"
2048-bit ELG-E key, ID 4FDA6DB3, created 2007-11-01 (main key ID 0B9FD4CE)

gpg: encrypted with 2048-bit ELG-E key, ID 4FDA6DB3, created 2007-11-01
      "Christopher M. Ball <chris.m.ball@gmail.com>"
gpg: Signature made Thu Jan 29 08:41:07 2009 PST using DSA key ID 0B9FD4CE
gpg: Good signature from "Christopher M. Ball <chris.m.ball@gmail.com>"
Macintosh:Desktop chris$ cat test.txt
This is a test secret message.

We typically do not send messages to ourselves, but this example shows the basic practice. In a future posting I will put together a similar simple example of how to generate your private/public key pairs using the command line, so stay tuned.

Cheers,
Chris

Monday, January 26, 2009

Internet Security 101: Monster.com data stolen (again?)

Time and time again I see businesses reporting that their sensitive data has been stolen or hacked into. This latest report from PCWorld suggests that Monster.com still has yet to learn some of the basics of security, as this is the second time I recall seeing an article of this nature on Monster.

While it doesn't make sense to hash ALL of the data for a customer, some pieces of data can often times be stored in a completely hashed format or at least partially hashed format. Some examples might include your password or social security number.

What is a hash you ask?
A hash is nothing more than an algorithm that accepts an input (usually in the form of a file or string) and provides an output result in the form of a series of numbers and letters. One of the more popular hashing algorithms available is called MD5.

How does one hash a password?
Depending on whether you're doing hashing within a piece of software or just manually at home, you might make use of the encryption libraries from Microsoft's Enterprise Libraries, or you might just open up the terminal (for you Mac users out there) and type the following:
Macintosh:~ chris$ md5 -s "MyPassword"
MD5 ("MyPassword") = 48503dfd58720bd5ff35c102065a52d7
Can't a thief simply figure out the password from the hash?
Nope! That's the beauty of hashes. Think of them as one way trains. Once you get on the train and reach your destination. There's no way to return home. Now if you somehow manage to make your way back to your point of origination, you can certainly hop on the same train and you'll reach the exact same destination again guaranteed. This is the basis for how authentication works for your average commercial website.

During the enrollment / registration period when you usually pick your username and password, if the website was properly designed and security was not ignored, the moment you push "register", the site will check to make sure the username doesn't already exist. Once this pass is confirmed, your plain text password will be passed off to something like an MD5 hash function which will then spit out the resulting hash. It is this resulting hash that is then stored in the database table alongside your username. Each and every future time you log in again, your password gets passed through the same hashing function and is then compared to the hash stored in the database. Assuming the hashes match, voila, you're allowed to enter!

How is it then that I can tell a site that I forgot my password and they will email it to me?
That is your first sign that the site you are signed up with stores passwords insecurely. If the password is hashed, the company storing your data can't figure out your password. This is where the password reset page comes into play, often accompanied by multi factor authentication (MFA) questions, such as "What was the name of your first pet dog?".

It boggles the mind that so many large corporations have failed and still continue to fail implementing some of the most basic features of data security. Should you ever be in a position to help enforce data security practices, please please please remember to ask whether sensitive data that doesn't need to be retrieved is being stored in its hashed state.

Cheers,
Chris

Tuesday, December 30, 2008

C++ and SDL Video Game Creation: Breakout a.k.a. Arkanoid

Over the last several weeks, I've been focusing on a passion I've had ever since I first laid my hands on the Atari and Nintendo consoles back in the 80s; video game development.

I remember having a blast playing the game Breakout but wasn't sure whether I could muster up the skills necessary to develop it straight out the gate since my professional forte is C#.NET development for business applications rather than game development using C++.

Based on some of the more popular game development sites out there, the general recommendation was to start with very basic games first, such as Tic-Tac-Toe, Blackjack or Connect Four. Get use to these types of event-driven games that take advantage of the basic game loop structure without the necessity for motion, collision detection, sound, state machines, you name it.

So I took to the adventure of creating a GUI-based Tic-Tac-Toe with intelligent AI that holds its own fairly well. This rather mundane game was actually a very valuable experience and pushed me toward my original intent: Breakout. Let me start by saying, do not skip the easy games if you're thinking about going down the road of game development. It is completely unbelievable how much you learn if you truly take the time to do things right with an object-oriented approach in mind.

While this game is still in development, I've put in a lot of hours on it over the holidays and it is coming together amazingly well. There's still a ton of stuff I want to do with this one, but I've integrated numerous concepts into the game thus far, including physics motion, collision detection, sprite animation, sound effects, time-based frames per second (FPS) cap control, hotkeys, in-game screenshots, event handling, etc...There's a few bugs I'm still working out as I go, but all in all, a very smooth and responsive game so far!

I still have numerous "weapons" left to design and integrate into the playing field, along with a fully functional state machine so that I can present menu systems prior to the game starting, but I wanted to share what I had, as I'm very pleased with the results.







You'll notice in the above screenshots that there is a funny little cluster of red balls. They are actually animated as they fall. That is my "multi-ball" weapon. If you manage to catch it with the paddle before it falls into oblivion, you get a nice spray of 6 balls that shoot out of the paddle. I currently have only this weapon but more will be coming soon. As of now, the weapon is assigned randomly to approximately 5% of the bricks for a given level. I'm still playing with figures.

Speaking of levels, another one of the most impressive features of the game is the light-weight level editor concept. You can create your own levels with a simple array of numbers in notepad. It currently supports 5 different colored bricks, each of which has a different internal strength (i.e. number of hits that it can sustain before going poof).

Since I'm sure some of my readers will ask that I provide more specifics on the development tools I use at home, here's the list: Mac OS X Leopard 10.5.5, XCode 3.1.2, SVN 1.4.4, C++, SDL 1.2. The cool thing is that C++ & SDL are cross-platform so there's not too much effort involved in creating a Windows or Linux port of my games down the road.

For those of you out there thinking about developing some of your own games, feel free to leave a comment if you have any basic questions that I might be able to help with.

Cheers,
Chris

Monday, December 29, 2008

Setting up XCode 3.1.2 to work with Subversion 1.4.4

I've been doing a lot of development in XCode lately and had to brute force my way through the learning process of how to start running my own Subversion repository at home. It seems so easy at work...you just point Tortoise to this magical repository that already exists and voila, source control! At home it can be a bit more tricky. Fear not. I took copious notes on the process and have decided to be kind and save others from similar grief. Plus, this post will also serve as a nice memory jogger for me if I ever have to set this all up again.

Step 1

Open up Terminal.app and type "svnadmin create /Users/chris/SVN" at the prompt.

Needless to say, choose your own directory of course, in the likely event you don't share my name. If you were to navigate to this directory after executing the command above, you'll notice that svnadmin has essentially setup an entire folder structure that SVN will use to maintain your repositories.

Step 2

Head to the following "XCode.app -> SCM -> Configure Repositories"

Name: Home
URL: file:///Users/chris/SVN
Scheme: file
Host: [blank]
Path: /Users/chris/SVN
Port: [blank]
User: [blank]
Password: [blank]

Step 3

Using finder, go to the project folder that you want to import into your SVN repository. Delete the "build" directory if it is within the project folder, as we do not want to keep track of this folder within SVN. If we fail to do this, we will get all sorts of lovely errors within XCode when we try to do anything with our repository and local code.

Step 4

Return to your "SCM -> Repositories" window. Select "import" and select your project folder. Once this is done, delete the original folder from your finder window and perform a "checkout" from the repository window. This effectively grabs the code you just imported plus it sets up the .svn hidden folders that SVN needs.

Step 5

Open up your project within XCode. Head to the "SCM -> Configure SCM for this project" menu.

Project Format: XCode 3.1 compatible
Base SDK: Current Mac OS
SCM Repository: Home (Subversion) - Recommended

At this point, you should be all set! Any changes that you make will have an "M" appear next to the file within XCode. When you've finished making changes to a file, simply go to the "SCM -> Commit entire project" menu and provide a comment.

If at any point you want to make a file backup of your project to an external hard drive (if for example you're using your own local machine as I am for your SVN repository), then you can use the "export" feature within the "Xcode.app -> SCM -> Repositories" menu and dump your code to wherever you choose. You'll notice that the export feature does not include the ".svn" folders which is exactly what you want, just the raw source code with no SVN-related goodies!

Cheers,
Chris

Saturday, November 1, 2008

Been busy with my other blog lately...

For those of you wondering where my posts have fizzled off to lately, I've been distracted with my typical musings and have been working on my other blog over at http://chartingwithchris.blogspot.com. I've been writing a lot of code in thinkscript for the Thinkorswim trading platform, but felt that it was best placed within a targeted blog so that my readers of that blog didn't have to pilfer through my incoherent ramblings over here. On a side note, are any of my readers members of chess.com? If so, I'd be glad to accept some challenge matches. Even my chess has taken a back seat lately and we can't have that now... 'Chris