30 April 2007

Code Monkey

I've been keeping up with Korby Parnell's blog recently.  I'm trying to keep abreast of this whole "Social Software" thing.  I think it might take off like that whole "Internet" thing did a few years ago and I want to be "hip" with it (unlike last time). 

His current offering is short and concise and, well, a bit addictive.  Here's the whole post (minus the video):

"Are you a code monkey?
Do you
dress like a code monkey?
Do you dance like a code monkey?"

- Korby Parnell

So I looked at the embedded video and checked out the Wikipedia link, by the way I have to say that Wikipedia if freakin' awesome!  I have been called a fountain of useless knoweldge, but this just puts me to shame!!  I know have a resource for EVERYTHING esoteric....oh the humanity!  Um, getting back to the story... So I found the "Code Monkey" song and some other links.

What a fantastic and funny tune.  It's a real toe-tapper and had me in tears, both for the comic humor, the irony and remembering my own personal "Robs".  As such I hereby declare that I will waste some of my precious time pulling together all of the "Code Monkey" stuff and posting it onthis blog entry.  You can just file this one under "Fun".

- Steve

 P.S.  After spending a couple of hours tracking down "Code Monkey" stuff, I hereby declare that many many people have wayyyy too much time on their hands...enjoy!

 

 

All the Code Monkey stuff that's fit to link

The original Code Monkey song: http://www.jonathancoulton.com/2006/04/14/thing-a-week-29-code-monkey/

The Code Monkey Remix Contest winners: http://www.quickstopentertainment.com/?p=2784

Code Monkey entry on Wikipedia: http://en.wikipedia.org/wiki/Code_monkey

Jonathan Coulton Code Monkey T-Shirts: http://www.cafepress.com/jonathancoulton

More Code Monkey T-Shirts: http://www.thinkgeek.com/tshirts/coder/3817/

Code Monkey Song on DIGG: http://www.digg.com/programming/Code_Monkey_Song_2

CodeMonkey.com Domain name is still For Sale: http://codemonkey.com/

"Everything int he known Universe tagged 'Code Monkey'" - Technorati: http://technorati.com/tag/Code+Monkey  http://technorati.com/tag/code-monkey

World of Warcraft - Code Monkey Video:

 

 Jonathan Coulton performing Code Monkey in LA

 

 Code Monkey dance video

 

 Code Monkey ukelele remix - Live

 

 And another Code Monkey video

 

 Speed Monkey (Son of Code Monkey) Remix Video

 

 Naruto the Code Monkey (audio recorded live on SecondLife)

 

Matrix Code Monkey

 

 The SIMS Code Monkey Video

 

 Derek the Bandit vs. Jonathan Coulton Code Monkey Remix

22 April 2007

MSBuild: DependsOnTargets and Conditions

I was presenting my Introduction to MSBuild session last Thursday night at the Visual Studio Team System Public User Group (VSTSPUG).  We were discussing the application of Conditions to Targets that were in a DepensdsOnTargets list.  One of the attendees asked me:

"You have Target A that is a dependent of Target B.  Target A also has a condition on it.  When Target B fires, it invokes Target A first and Target A is skipped because its Condition evaluates to False.  Does Target B continue running or is it stopped because Target A's Conditon was False?"

I replied that Target B would run because the DependsOnTargets tells MSBuild to "Attempt to run" the dependent targets.  If Target A is skipped, it is considered to have completed successfully for Target B's dependency purposes.

In a follow-up question I was asked:

"... if Target A doesn't get run when Target B calls it because its Condition is False, then what happens if it is a dependent of another target, say Target C, and when Target C is run the Condition evaluates to True?"

In this case, Target A would be run because its Condition is True and it was skipped the last time.  A Target will only be run once per build, so this is Target A's "run" since it was skipped earlier.

Here is an example project that shows this.  In it you have 4 targets, Test, Test2, WillRun and WontRun.  There is also a property, RunDependent, that is used to control target WontRun. 

Test is run first.  It depends on WillRun and WontRun.  Target WontRun will run only if RunDependent is True.  When it is called as a dependency of Test, its Conditon evaluates to False so it will be skipped.  WillRun runs successfully.  Test then modifies RunDependent to be True.

Test2 is run next.  It also depends on WillRun and WontRun.  When Test2 kicks off, MSBuild looks at the dependency list and sees that WillRun already ran, so it is skipped.  It also notices that WontRun was skipped last time so it fires it.  WontRun's Condition is evaluated and now resolves to True, so it runs.  Test 2 then runs.

Here's the code:

<Project DefaultTargets="Test;Test2"
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <PropertyGroup>
	<RunDependent>False</RunDependent>
    </PropertyGroup>

    <Target Name="WillRun">
	<Message Text="WillRun ran..."/>
    </Target>

    <Target Name="WontRun" Condition=" '$(RunDependent)'=='True' ">
	<Message Text="WontRun ran..."/>
    </Target>

    <Target Name="Test"  DependsOnTargets="WontRun;WillRun">
	<Message Text="Test Ran"/>
	<CreateProperty Value="True">
		<Output TaskParameter="Value"
				PropertyName="RunDependent"/>
	</CreateProperty>
    </Target>

    <Target Name="Test2" DependsOnTargets="WontRun;WillRun">
	<Message Text="Test2 Ran"/>
    </Target>

</Project>

 

And here's the output:

Microsoft (R) Build Engine Version 2.0.50727.42
[Microsoft .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation 2005. All rights reserved.

Build started 4/22/2007 9:36:23 PM.
__________________________________________________
Project "C:\test2.proj" (default targets):

Target WillRun:
WillRun ran...
Target Test:
Test Ran
Target WontRun:
WontRun ran...
Target Test2:
Test2 Ran

Build succeeded.
0 Warning(s)
0 Error(s)

Time Elapsed 00:00:00.01

 

 

Technorati tags:

21 April 2007

ClaimSpace...Is this the answer to too many LiveIds?

Mike Ruminer posted a snippet on his blog about a Microsoft project called ClaimSpace.  He specifically referred to Korby Parnell's post on the subject. 

In a nutshell, ClaimSpace is a way to tag content that you have created as being your own. 

Claimspace will enable you to say, 'I created this resource, wish to be recognized for it on these terms ___, and I hope you find it worthy of your attention. What do you think?'    - Korby Parnell

You can read the full post to get a better idea of what it is and how it is used.  Korby can do a hell-of-a-lot-better job describing it than I can.  What I find interesting about it is that it may solve my LiveId problem.

I started using the MSDN forums and blogging while working at a former employer.  At that time, I created a LiveId using my company email account.  I have since left, but all of the content that I created is still attached to that LiveId with no way to move it over to my personal LiveId or the LiveId I have under my new employer's email address. 

I'm hopeful that with ClaimSpace I'll be able to tag all of my blog entries, forum posts and any other "content" that I create with a single, universal "token" that will allow readers and others to know that it all came from the same person. 

This will also aid in discoverability.  If I find a well thought-out article by an author that is new to me, I can use CardSpace to find all of his other articles.

This seems like it will go a long way to finding and promoting good content and recognizing those that put it out there.  I'm on board with it when it finally arrives!

- Steve

19 April 2007

Visual Studio Codename "Orcas" Beta 1 Now Available

Brian Harry has just announced that the Beta 1 release of Visual Studio Code Name "Orcas" is now available. 

Download Page

What's Included

Crazy, Wacky Stuff Coming from Microsoft Live Labs

Chris Bowen just posted an entry about PhotoSynth CTP from Windows Live Labs.  This is a program that's supposed to take a bunch of pictures of the same general subject and create a 3-D space.  This sounds really cool!  I have a bunch of pictures taken during my vacations that I want to drop in to see how good it is.  I'll post more after I finish playing with it.

- Steve

10 April 2007

Visual Studio Warning: The element 'xxxx' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'yyyy' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'.

How's that for a descriptive title...  I wanted to make sure the search engines could find this posting. :)

During a recent foray into the MSBuild Forums on MSDN, I came across a post from a developer that was asking why he was seeing the above warning on a valid property declaration in his csproj file. 

 

Problem:

When editing MSBuild project files (vbproj, csproj, targets, etc.) in the Visual Studio IDE you see a warning on the first property in a PropertyGroup or the first item in an ItemGroup stating:

Warning  The element 'xxxx' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'yyyy' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Property' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'.

Issue:

When you apply the schema attribute to your Project element, Visual Studio reads in the schema and uses the information indide to provide Intellisense during your editing.  As an offshoot of this, it also warns you when it finds that you have used elements or attributes that are not part of the schema.  The custom property and item elements are not part of the MSBuild schema.


Click thumbnail for full-sized image

Discussion:

The designers of MSBuild created a base schema that outlined the fundamental constructs of the MSBuild project file format.  They designed the system to be open ended so that we would be able to add our own elements to the file outside of those defined in the schema.  This is how we get the ability to set custom properties and item groups as well as being able to use custom tasks.  If the MSBuild system wasn't so flexible, the designers would have had to build the schema with every conceivable property and item group name or run the risk of constraining the use of the tool.


Click thumbnail for full-sized image

Solution:

You can safely ignore this warning.  So does MSBuild validate your project files against the schema?  Yes it does, but I wasn't sure just how it was accomplished, so I fired off an email to Buck Hodges.  He was nice enough to pass it by an as-yet-unnamed-dev on the MSBuild team.  The dev stated that

"...MSBuild does try to validate against the schema.  However, the validation is done at runtime by our code rather than loading the [project] file using a validate reader with the xsd (mainly for perf reasons).  MSBuild should fail any projects which don't adhere to the schema."

So there you have it.  The schema is enforced while still allowing you to customize and extend the MSBuild project file to fit your needs.

Something else to note...

Only the first property or item in the groups gets marked by the IDE as not conforming to the schema.  You will also see the same behavior arise if you use a custom task in your targets.

 

 

Technorati tags: ,

03 April 2007

Intro to MSBuild Presentation Download

Here is the presentation that I gave at Code Camp 7: Deer in the Headlights entitled "Can We Build It? Yes We Can! An Introduction to MSBuild". The zip file comes in at a whopping 19.6mb because of all the Camtasia video that I used. I also packaged in the Powerpoint viewer for anyone that doesn't have Powerpoint on their machine.

Viewing notes:

When you get to a demo slide, just move the mouse around until you see the cursor change to a hand and then click. The video will start. Click again to pause it. When the video completes, use the right arrow key to go to the next slide.

Request:

If you download this, please let me know what you think of it. I'm still working on refining the content. Leave a comment with the good, the bad and the good...(especially the good, I need the ego boost).

Second Request:

If you attended my session and feel like leaving a comment on how it went I'd also appreciate any and all feedback. That was my first time in front of an audience of non-coworkers and I was a bit edgy. I'd like to know what you though of it.

UPDATE: The original presentation download was lost in a fiery database crash at ManicProgrammer.com. I've updated the link below to an updated "Intro to MSBuild" presentation.

Presentation Download

Thanks for putting up with me for an hour and a half!

- Steve