You've reached the internet home of Chris Sells, who has a long history as a contributing member of the Windows developer community. He enjoys long walks on the beach and various computer technologies.
Friday, May 27, 2005, 3:41 PM in The Spout
The Logic of Logic
Here. The one where I re-discover the good parts of constraint logic programming.
Friday, May 27, 2005, 11:17 AM in Fun
Studs from Microsoft
I have no idea where the "Studs from Microsoft" video came from or how old it is and I had to download it first before playing it, but it was totally worth it to see Bill Nye as a 'softie and to watch those women run for their lives instead of facing the possibility of dating any of us. : )
[via jj5 (would doesn't like people to know he exists, let alone link to him...)]
Friday, May 27, 2005, 12:00 AM in The Spout
The Logic of Logic
My son came to me the other day and said, "Dad, I need help with a math problem." The problem went like this:
We're going out to dinner taking 1-6 grandparents, 1-10 parents and/or 1-40 children
Grandparents cost $3 for dinner, parents $2 and children $0.50
There must be 20 total people at dinner and it must cost $20
How many grandparents, parents and children are going to dinner?
The reason this problem is interesting is because there are 3 variables, but only 2 equations:
grandparents * 3 + parents * 2 + children * .5 = 20
grandparents + parents + children = 20
Being a coder, I sat down to write the program to enumerate all possible solutions:
class Program {
static void Main(string[] args) {
for( int grandparents = 1; grandparents < 7; ++grandparents ) {
for( int parents = 1; parents < 11; ++parents ) {
for( int children = 2; children < 41; children += 2 ) {
double dollars = grandparents * 3 + parents * 2 + children * .50;
int people = grandparents + parents + children;
if( dollars == 20 && people == 20 ) {
Console.WriteLine("grand parents= {0}, parents= {1}, kids= {2}",
grandparents, parents, children);
}
}
}
}
}
}
Running this program saves my son the time to figure out the solution through tedious trial-and-error (plus, he didn't even have to write the program, since I did that part -- tricky little bastard, isn't he?!?) by producing the following output:
grand parents= 1, parents= 5, kids= 14
That was all well and good 'til Alex, a friend of mine, boiled the problem down to a single-statement Prolog program for me (although this program doesn't capture the range of values the variables can take on):
people_at_the_meal(Grandparents, Parents, Children) :- Grandparents * 3 + Parents * 2 + Children * 0.5 = 20, Grandparents + Parents + Children = 20.
Then I went on to regale Alex about the time my grandmother asked me to schedule her tennis tournament for her on my computer. She had requirements like, "everyone has to place everyone else at least once" and "you have to lose twice to be out of the tournament" and "nobody can play twice in a row" (it's not good politics for a computer program to kill old ladies...). My grandmother's problem statement doesn't fit the traditional algorithmic statements that I'm used to using computers for, nor was I ever able to re-form the problem in those terms (it's not like my grandma was ever going to leave me a bunch of money anyway...). Alex completely understood and informed me that the NBA has the same problem (with slightly sprier players) and they use logic programs to solve it. In fact, in his experience, these problems happen all the time in the business world.
Constraint Logic Programs (CLPs) break down into constants, variables over ranges and relations of truth, which together make up the constraints in a logic system. In my son's case, the constants are the numbers, e.g. 3, 20, etc, the variables are the number of people of each type and the relations form the constraints, e.g. the sum of all people must be 20. The CLP "solver" (in Alex's parlance) provides the logic over a particular "domain" (real numbers in our case) and knows how to do all the iteration and forward and backward chaining to solve the people_at_the_meal problem. A different solver would be able to solve my grandmother's and the NBA's scheduling problem.
It was only after most of this discussion that I realized that I recognized the syntax that Alex had produced: it was Prolog, a CLP language I had blocked. I had taken a Prolog course in it in college and absolutely hated it, but not because of the things that allowed me to solve these kinds of problems: that was great. The things I hated were all of the algorithmic things that I needed to be able to do that Prolog was terrible at, e.g. take input, product output, suck in facts from data external to the system (like the NBA player roster), etc. CLPs themselves are damn cool.
Thursday, May 26, 2005, 9:45 PM in Fun
I am a Gauntlet Adventurer
![]() I strive to improve my living conditions by hoarding gold, food, and sometimes keys and potions. I love adventure, fighting, and particularly winning - especially when there's a prize at stake. I occasionally get lost inside buildings and can't find the exit. I need food badly. What Video Game Character Are You? |
BTW, wander around building 10 one time and you'll know I'm not kidding... : )
Wednesday, May 25, 2005, 8:08 AM in Fun
XBox 360 Game Videos
I'm sure you've heard the news and read the specs and you might even have seen the celebrity-ridden MTV special. Now, see what it'll really be about.
Wednesday, May 25, 2005, 7:02 AM in Tools
C++ is dead, long live C++!
Congrats to the VC++ 2005 team for a write-up like this!
"The truth is that this new development in C++ seriously undermines the justification for C# as a language. C++ programmers yet to learn C# simply don't need to now. What's the point? They will find the full productivity of Visual Studio 2005 right there at their fingertips supporting the language they know and love. Why should they move to something that is slower and less feature rich?"
He goes on with choice words about those of us that use C# as either "poor folk who have already invested time in it," "Java types moving to .NET and smart enough to avoid J#" or "dev-celebs and style gurus will realize that it’s in their interest to keep pushing the C# fashion wagon." I don't know which camp I fall into, but I love the phrase "dev-celeb!" : )
I remember being in a conference room many years ago with about 10 members of the VC++ team on one side of the table and me on the other with them drilling me for about an hour on what would it take for me to love C++ and give up C#. I asked for the power and performance of C++ and the simplicity of C#. According to The Grumpy Programmer, they've not only delivered on this promise, but
"the painful, balls-on-the-table truth is that C# has lost its point."
Luckily, no one asked me to put any of my body parts on the conference table that day, but you gotta love a guy that can turn a phrase like that. : )
Tuesday, May 24, 2005, 8:08 PM in The Spout
Frequent Flier Miles Suck (Airlines Suck)
I just called to cash in my Alaska Airlines miles on it's partner airline Northwest for a trip 5 weeks in advance and they told me that they don't have any seats available. I know is complete bullshit, because when I search for the flights on the web directly, they're happy to sell me a seat for the specific day I want.
What they mean is, "Oh no, sir, people actually want to pay to fly that day; we couldn't possible honor our frequent flier commitments to award you travel on that day!"
Blackout dates, "saver seats," coach seats built for pigmes... the whole airline industry sucks and you can tell them I said so!
Tuesday, May 24, 2005, 11:29 AM in The Spout
Story-Driven Development
I'm a big believer in the "write the story first" method of software engineering. Like "client-first development" or the increasingly popular "test-driven development," "story-driven development" is about writing what we want from our software before we write the software. This is different from "spec-driven development" or even "design-driven development" in that I mean actually writing the equivalent of one or more MSDN Magazine articles that you'd like to publish when your product is complete. I can't tell you how many issues I'm able to work through using this technique and it's highly recommended if you think in prose. Of course, as the product evolves, so do the articles until the perfect storm happens when the product matches the article and vice versa (modulo bugs, this typically indicates beta 1).
Today, after 5 months of marination, I awoke with the "Intro to Our Stuff" article in my head and I've started outlining it. This one is really "Intro to Our Stuff for Developers" piece, which corresponding "Intro to Our Stuff for IT Pros" and "Intro to Our Stuff for Business Analysts" pieces that needs to happen, too.
Tuesday, May 24, 2005, 8:07 AM in Fun
Cat Swimmer
I was searching with the boys this morning and found this:
I just thought I'd share. : )
Monday, May 23, 2005, 10:59 AM in Fun
Episode III: ROTS doesn't suck and other opinions
My sons and I (and my 11-year old boy's "date!!!") all enjoyed Star Wars Episode III: Revenge of the Sith. I know it didn't have much in the way of decent dialog or acting, but when compared to the other 5 in the series (especially episodes I and II), it rocked. I've only seen it once, but right now it's tied for first in my mind with A New Hope (I know some snobs like The Empire Strikes Back best, but I still love the feel of the first one).
Also, I liked Unleashed a great deal. Not only did I enjoy the fighting, but I really enjoyed the relationship between Danny and his new family.
On the other hand, in spite of being a huge Frank Miller fan in general and a Sin City comic book fan specifically, I couldn't stand that silly movie. I wanted to see a movie version, not the comic book version projected onto the screen!
In other news, I'm still waiting for a sequel to The Matrix. I don't count this fan-boy movie or this one. Anyone got a release date to a follow on worth the time to watch?
Monday, May 23, 2005, 10:45 AM in .NET
Avalon + Indigo Beta 1 Release Candidate
Today Microsoft has published the release candidate of Avalon and Indigo Beta 1. The most interesting features of this release over the CTP releases of the past is that these bits work on Visual Studio 2005 beta 2, both full and express. Enjoy!
Wednesday, May 18, 2005, 12:06 PM
Avalon Wants You!
The Avalon team is hiring. For example, here's a software development engineer (SDE) position on the Avalon team:
"The Avalon team is developing the next generation UI, document and media platform for Longhorn (the next version of Windows). Our group's mission is to transform the development experience and to leverage the immense power of graphics hardware to bring new and compelling features to Windows and Windows applications. We are looking for an individual contributor to help us design and implement an extensible architecture to provide rich Imaging (codecs, effects, metadata, wide-gamut color) and solutions. This individual will work with other groups across the systems division as well as cross-division that are dependent on this functionality. Strong problem solving and cross-group skills are required. Experience with C, C++, C#, and text and imaging/graphics technologies (e.g. publishing tools, Flash, SVG, etc.) are pluses. At least a BA/BS degree in Computer Science or related technical discipline preferred."
If you're a UI or a media person, I can't imagine a better place for you then on the Avalon team, and this isn't the only Avalon-related position we've got. In fact, I did a query today and found 25 SDE positions at MS with the keyword "Avalon" in the description. Come one, come all! We're having an Avalon party at Microsoft and we'd love you to come and join us. : )
Friday, May 13, 2005, 4:47 PM in Tools
"dumpbin" is now "link -dump"
Apparently in Whidbey, "dumpbin" (and some other tools that were merely wrappers around link) has been dumped. To get to it now, do "link -dump -dumpbin_options" e.g. "link -dump -exports" does what "dumpbin -exports" used to do. In fact, if you just do "link -dump" the usage you get is labeled as the dumpbin usage. : )
BTW, it looks like "lib," while still there, is also "link -lib" and "editbin" becomes "link -edit."
Friday, May 13, 2005, 3:25 PM in Tools
When did the cmd shell start doing this?!?
Imagine the following C program:
// cmdio.c
#include <stdio.h>
void main() {
char s[256] = "";
printf(">");
scanf("%s", s);
printf("%s\n", s);
}
If I run this from a command shell and I enter "hi" [Enter], it looks like this:
C:\>cmdio.exe
>hi
hi
If I run it again using "lo" [Enter] this time, it would look like this:
C:\>cmdio.exe
>lo
lo
Here's the thing that blew me away. Anytime I run it after the 1st from the same cmd shell, I get history! For example, running it a 3rd time and pressing [Up Arrow][Enter] gives me this!
C:\>cmdio.exe
>lo
lo
The up and down arrows work, F7 works, F8 works, they all work! When the heck did the shell start keeping track of per sub-command histories and why haven't I noticed it 'til now?!?
Thursday, May 12, 2005, 4:21 PM in The Spout
Survey: Windows Forms Programming 2ed Length
There has been some publisher/author controversy around the length of the 2ed of Windows Forms Programming. WF2 has essentially doubled in size, so I was happy that it looks like we're be less than twice the number of pages (700 for 1ed vs. estimated 1200 for 2ed). However, when I sent this estimate to my publisher last month, they were less than pleased. Apparently if you go above 800 pages, that tends to scare people and may cut into sales. Here are the options we wrestled with:
- Cut 400 pages of material out of the WF2 book, leaving it on the cutting room floor
- Ship a 1200 page WF2 book, increasing the cover price by $10
- Move 400 pages of material out of the WF2 book, releasing them as freely available PDF files on the web (continuing to index and refer to this material in the printed book)
- Split the book into two volumes, priced accordingly (probably $35 each)
There's one piece of information that I'm share later that caused us to lean one way more than the other, but I'm curious what readers would choose when given this choice.
P.S. Believe me when I tell you that we've been diligent about cutting stuff that doesn't belong in the book, although I admit that we've been unwilling to cut material that will be generally useful for WinForms programmers, even if it does decrease sales. I'm still hoping we'll be able to get the page count below 1200, but the upshot is that option #1 has always been a non-starter for me.
P.P.S. I expect the first three reviews on Amazon to be complaints about whichever method we choose and reminising about how wonderful it was to get all of WinForms in 700 pages. Those kinds of complaints should be forwarded to the WinForms team in emails that start with "You put too much good stuff into WinForms 2.0!" : )