JSEDLAK » 2008 » October

Archive for October, 2008

Well That Didn’t Last Long…

Seems as though I am going through a new theme every couple of days. I really liked the last one, but it would have taken a tad too much work to get it to work well with putting code in posts. This one seems a little better suited for that.

My Introduction to PowerShell

Wow! I can’t believe I have been missing this for so long. It is the answer to all my command line woes in Windows. I have only touched the surface but love it already. Today I created my profile to change the prompt and add a command for copying my FGF binaries to my current working directories:

?View Code CSHARP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Profile PowerShell Script
# Author: John Sedlak
# Site: http://focusedgames.com
 
$a = (Get-Host).UI.RawUI
$a.ForegroundColor = "White"
$a.WindowTitle = "WPS - Focused Games"
 
# This function changes the prompt.
function prompt{
	$path = get-location
	$b = Get-Date -format "HH:mm"
	return "$b $path ?> "
}
 
# This function copies a bunch of FGF libraries to current working directories.
function fgfCopy{
	# These are the platforms that need to be copied
	$platforms = "x86","Zune","Xbox 360"
 
	# An array of the destinations for copying
	$destinations = "E:\Users\John Sedlak\Code\Games\GW3\trunk\Libraries\"
 
	# The source directory and the suffix.
	$source = "E:\Users\John Sedlak\Code\FGF\trunk\Bin\"
	$sourceSuffix = "\Release"
 
	# Loop through all the destinations and all the platforms
	# For each platform, copy some files.
	foreach($destination in $destinations){
		write-host "Starting copy to"$destination
		foreach($platform in $platforms){
			# Build up the source and destination paths
			$tempSource = $source + $platform + $sourceSuffix
			$tempDestination = $destination + $platform
 
			# Get a list of all DLL files that contain the word Thrust
			$files = get-childItem $tempSource -force | ? {$_.extension -eq ".dll"}|where {$_.name -match "Thrust"}
 
			# For each file, copy it!
			foreach($dll in $files){
				copy-item $tempSource\$dll $tempDestination
				write-host "Copied"$platform\$dll
			}
		}
	}
}
PowerShell - fgfCopy Command

Screw you road surface…

Well, my favorite time trial loop got decimated because the town decided to lay down tar and then pile on a bunch of loose gravel. This forces me to ride at a much slow pace because it is (a) bumpy and (b) hard to spot the big potholes.

If I continue straight where that road starts I am forced to climb a fairly steep hill (5% maybe?) which, although doable, will wreck any meaningful capture of a flat 16 mile time trial workout. Looks like I need to find a new route that gives me a flat 20 mile (or less) country road. Not that easy in Jersey where ridges are plentiful and have steep albeit short drop offs.

But there is good news in all of this… my 80 mile workout last Thursday really killed my knees but also tormented my leg muscles. I am finding that high resistance riding is getting a lot easier, including steep climbs and big gear churning. On the major flat part of my 16 mile TT route I am able to hold 23-24mph with greater ease.

Plus, climbing is just so much fun. Gotta love dancing on the pedals and making others jealous that you, a 200+ lb rider can beat them up the climb. :D

P.S. Scale has me down ~10 pounds! Onward and downward I go.

Provider Model is Win

The provider model’s goal is to allow for the abstraction of implementation to the nth degree by allowing for the choice between separate implementations of the same functionality. This design pattern is incredibly common in Microsoft’s ASP.NET, especially in the realm of security. Developers can choose between different providers for membership, roles and authentication for a single site. The point is that the core functionality of the site does not change, only the implementation. Below is a quick snapshot of how such a model is used in Vodka.

The driving force behind the provider model is the abstraction of the implementation. This is done via an interface.

?View Code CSHARP
1
2
3
public interface IAuthenticationProvider{
	bool Authenticate(string username, string password);
}

What gives the provider model its meat and bones is the different implementations of the above interface. The two implementations below represent two authentication backends: an ActiveDirectory installation and an Sql database. Although the meat has been stripped from these two classes, it is clear that their implementations would differ enough to have the two separate classes. Read the rest of this entry »

New Theme!

I hope my reader[s] (?) like it! The other one was a little too simple and boring as well as dark. Who knows how long this one will last…

Mono 2.0 is out!

Looks like Mono 2.0 is out. Dot NET development just got a little better (on Linux)!

Off topic, but anyone notice that in the second episode of the first season of West Wing a character by the name of Mandy runs her BMW E36 M3 right over a curb? Poor BMW… :( It was a convertible too!

You may eat about 6,598 additional calories today.

Basically I failed today. But I am still proud of the effort I put in!

I wanted to do my first century so badly. Boy did I pick the wrong day to try it! It was so windy and so cloudy and just at the temperature where warmers would overheat me and not wearing them meant I was a bit chilly.

I also picked a very tough route. The first 50 miles was 4000 ft of climbing and 4000 ft of descending. It was a very exciting new route though and I am definately getting better at climbing.

The second 50 would be a little more flat but with some steep but short ascents.

I stopped at mile 44 for a quick sandwich and to refill.

At mile 60 my knees started hurting.

Mile 65 my right calf was about to charlie horse which meant I had to stay in the saddle during every climb. I hate that, much more comfy out of the saddle.

By mile 78 I was coming back in to town to start another loop and decided to call it quits. I had been out for 5 hours and I was barely keeping 15 mph.

Hit 80.xx by the time I made it home. Put all my data into TheDailyPlate and my log and now TDP is saying I can eat roughly 6.5k calories because I burned ~4000 on the ride. hahahahah. not going to happen.

Advanced State System: Queues and Removal

During the last part of this little article series I mentioned how I used a queue in each state object to allow for continuous transitioning to occur. The reason for this is to allow for complex transitioning to occur. One example for this is a logo screen where it needs to fade in, stay on screen and then fade out again. Rather than relying on managing the states manually, we can add states on to a queue so they occur automatically.

Read the rest of this entry »

Advanced State System: Concept and Base

There comes a time when simple state management just will not cut it anymore. I found this out while building up the code base for Thrust’s GUI library. As the objects on the screen became more complex, so did their states. This article covers a new way of thinking about an object’s state, a design that has been proven in Thrust (v1.x). The goals of this state system include the following:

Read the rest of this entry »

Next Up, 3bit LCD!

Check out this video of a South Korean LCD Crowd at what looks like a football game. Awesome work crowd, you outdid your own cheerleaders.