May, 2005

Posts
  • Eric Gunnerson's Compendium

    Medical Reviews of "House"

    • 7 Comments
    I've been watching "House" this season, and though it's over, I thought you might be interested in a medical perspective on the episodes.
  • Eric Gunnerson's Compendium

    C# vs VC++ 2005

    • 9 Comments

    I'm not sure whether "VC++ 2005" is the right name or not, but whatever the next version of VC++ is called (don't get me started on the VS naming schemes...)

    Chris Sells wrote a post about a review of the new C++ version coming out with Whidbey. In case you haven't been paying attention, the C++ team looked MC++ v1.0 and v.11, and decided that they wanted to do a language that was more tightly coupled to the runtime.

    So, they came up with a way to integrate the .NET features into C++.

    The contention in the post that Chris linked to is that C# is now superfluous. Now, I'm a code-and-let-code kind of guy when it comes to languages - I don't think any one language is the best - so I find such pronouncements interesting.

    What do you think? You can find some information on the new C++ syntax here.

  • Eric Gunnerson's Compendium

    Real Customer Service

    • 0 Comments

    I've written about community subjects from time to time, but an internal discussion brought up an interesting experience I had a few years ago.

    I was on a customer visit at a customer whose identity is thankfully irrelevant to this little story. The local Microsoft sales guys were there discussing whether one of the new (at that time) .NET technologies would work to fix a problem that the customer had with an IBM system that they had bought a number of years earlier. The IBM system wasn't malfunctioning, it merely wasn't architected for the internet age.

    Before we went into the conference room, one of the MS guys talked to us about who was going to be there.  He said, "there will be two or three IBM people in there with us".

    That seemed like a strange situation - pitching your solution when the competitors were in the room. But the MS rep explained that the IBM people were from the services branch of IBM, that they knew that there wasn't a good IBM solution to the customer problem, and they'd support an MS solution if it fixed the customer's problems.

    Now *that's* customer service...

  • Eric Gunnerson's Compendium

    7 Hills of Kirkland

    • 7 Comments

    This morning, I went on the 7 Hills of Kirkland ride. I had been planning on riding with a co-worker, but he got scared and decided to crash his bike on Thursday night so that he wouldn't have to go. Okay, that's not what he *claims*, but I'm pretty sure it's the truth.

    There are three options on this ride:

    Option Distance Elevation Gain
    7 Hills 40.2 3128 feet
    11 Hills 73 5659 feet
    Century 100 7203 feet

    Those are hard rides. As a comparison, the Flying Wheels Summer Century has a similar elevation gain, but spreads it over 100 miles. I was there to ride the 40 mile version.

    The day started poorly. I got up, drove to Kirkland, pulled the bike out, sat down to put on my... shoes... where are my shoes?

    They're sitting back in the kitchen.

    Argh. So, once I picked up my shoes and got back, the other riders I had hoped to ride with had already left, so I did the ride solo.

    What's the ride like? Well, it's hilly. Or, to be more correct, you spend lots of time going uphill, followed by short and fast descents, with little time going flat. The worst hills are the third one (seminary hill) and the sixth one (winery hill). As your turn onto the last pitch on Seminary hill, you can see (and hear) a lone bagpiper playing at the top of the climb. Pretty cool.

    40 miles
    2:32
    15.8 MPH

    7 Hills Elevation Profile (from Topo USA)

  • Eric Gunnerson's Compendium

    Word for the day: Hypnopompic

    • 6 Comments

    Have you ever had the experience where you wake up in the middle of the night and imagine hearing or seeing something that turns out not to be there? Have you ever felt that you couldn't move when you woke up.

    The state of transition between sleeping and wakefullness is know as the hypnopompic state. When you're asleep, your brain turns off your muscles, so that you (or at least, most people) don't actually move around even if they dream that they're moving around. When you transition back to being awake, sometimes your dream is still running.

    There's also the Hypnogogic state, when you're falling asleep.

    Here's an interesting article on this:

    Sleep Paralysis and Associated Hypnagogic and Hypnopompic Experiences

  • Eric Gunnerson's Compendium

    How To Do A Good Performance Investigation

    • 0 Comments

    More sage words from Rico...

    And a followon...

  • Eric Gunnerson's Compendium

    What's wrong with your code?

    • 0 Comments

    I've gone through all the examples that I was planning on talking about, so I'm looking for more examples. If you have one in mind, please drop me an email.

     

  • Eric Gunnerson's Compendium

    What's wrong with this code #7 - Discussion

    • 1 Comments

    In this edition, I presented a small chunk of code that attempted to hook the signal handlers, so that we could do something smart when the user hits CTRL-C, rather than just rolling over and dying (rolling over optional).

    But before I discuss the answers, I'd like to talk about the history of this code. This is one that I wrote, and sent out as an answer to a question. An hour or so later I got a reply from Anders who said, "that won't work because..."

    Well, because of the reason that I'm going to talk about in a little while. But first, the things I wasn't looking for, in a pathetic attempt to generate some sense of expectation, which is really a futile exercise because of what people write in the comments. Maybe I should do one of these where I don't publish the comments until I get to this point.

    Code exits after 10 CTRL_BREAKS

    Um... No. I really should have stated that the problem was not in the Program class

    Logger method doesn't return Bool

    This is a fair criticism, as it might effect whether other handlers get called, but that's probably a fairly rare scenario.

    Should synchronize the access to count because it's static
    Application will keep running after count > 10

    Possibly true, assuming that this method can be called on multiple threads at the same time. Not covered in the MSDN docs, and I'm too lazy to look at the source to see what it does right now. Irrelevant to the main point.

    100000 seconds != 27 hours

    Okay 27/1000 of an hour

    A Hint

    If you compiled this code and ran it, it would very probably run correctly for you. But if you changed Main() to be:

     public static void Main()
     {
      ConsoleCtrl consoleCtrl = new ConsoleCtrl();

      consoleCtrl.ControlEvent += new ConsoleCtrl.ControlEventHandler(Logger);
      GC.Collect();
      GC.WaitForPendingFinalizers();

      Thread.Sleep(100000);
     }

    You would find the problem.

    It has to do with the way that the interop layer deals with delegates that are passed to it. Callbacks are used in different ways in unmanaged code, so the only thing that the interop layer can be sure of is that the callback will be used during the execution of the call, and it makes sure that there is a reference to the delegate during that time.

    But when you return, that's no longer the case, even though SetConsoleCtrlHandler() still needs the delegate, so if the GC collects it, you're in trouble.

    The fix is simple - declare an instance field of type ControlEventHandler, and store the delegate in that instance instead of creating the instance as part of the call to SetConsoleCtrlHandler(). Then everything is fine.

  • Eric Gunnerson's Compendium

    Generics and Wildcards

    • 6 Comments

    Martin write a post entitled Generics: The Importance of Wildcards

    He concludes with:

    Unfortunately, C# will not support wildcards or a similar mechanism. The implementation strategy does not allow the introduction of wildcards (generics are implemented in the runtime instead of by type erasure). This is a bit surprising, since the implementation strategy is often claimed to be superior. What disappoints me is that the designers of C# are not willing to admit that subtyping is an issue and that wildcards are a solution.

    That's a very binary statement, when in fact the implementation of generics both in the .NET and Java worlds are exercises in tradeoffs.

    I agree that subtyping is an issue, and that wildcards are *a* solution (I don't know enough to know whether it is the only solution, or whether a solution that worked only on reference types would be interesting.). But, having looked at the implementation of wildcards in Java, they add a fair amount of complexity to the language, and I'm not sure that the added flexibility that they give you is important enough to add language complexity. I do know that when I was talking to C# users, the ability to do this was not one of the things that came up.

    When I weigh the speculative benefits there against the known benefits of the .NET implementation - collections of primitive types, for example - it's pretty clear which one I would prefer.

  • Eric Gunnerson's Compendium

    Revenge of the Sith

    • 13 Comments

    I've read a number of entries on Revenge of the Sith. For example, Rory wrote one.

    There hasn't been that much written on the plot, however, so I thought I'd cover it here.

    --------------

    Padme is pregnant with twins, but she and Anikan wish to keep their children safe, so she gives birth on a backwater planet, and they then return to their duties. Anikan's training has gone well, but there is friction between him and some of the Jedi council, because of his impatience. He is dispatched with Yoda and Obi-wan to broker a cease-fire between separatists and the Republican forces.

    Chancellor Palpatine is conference with a group of Senators. In an unmanned surveilance center, we see several Jedi creep up stealthily, overpower the guards, and place an explosive device. We switch to a different camera, and we see Palpatine get up and leave the room. The camera pans in close up across the 5 senators, and we see that the 5th one is Padme (aka Queen Amidala) just before the screen dissolves into static as the room shakes.

    Cut to Anikan, Obi-Wan and Yoda. Anikan suddenly looks troubled, senses that Padme is in trouble. He boards his fighter and races back, arriving just as Padme dies. The Chancellor recruits Anakin to find the group that had planted the explosive, and sends him to a planet on the outskirts of the Republic.

    Anikan arrives with the Republic forces to the location the Chancellor had sent them. The Republican forces take out the field generator, and Anikan takes out the guards. He reaches the command center and finds it manned by several members of the Jedi council, who admit to being behind the attack. Enraged, he kills all of them, when Obi-wan and Yoda arrive. They try to convince him to calm down, but unsuccessfully, and they begin a battle (with lots of "light side/dark side" discussion). They travel through corridors, and find Anikan's children playing in a large hanger. At that moment, the fusion reactor powering the site overloads, the roof of the hanger collapses, and Anakin uses the Force to protect his children, but he disappears under a pile of rubble.

    Obi-wan and Yoda leave with the children.

    We see the Chancellor in a medical center. In an operating theater, the last stages of the Vader-ification is taking place. Palpatine leans close and says, "Can you hear me?"

    As the scene fades to black, over the famous breath sounds, we hear, "Yes, master".

    ---------------------

    No, wait, that's the kind of plot that somebody with no talent or screenwriting experience would come up with if he spent 30 minutes thinking about it.

    I'm sure the real one is much better.

     

  • Eric Gunnerson's Compendium

    Swimming to Antarctica

    • 4 Comments

    If you've read either of Lance Armstrong's books, it's probably not a surprise to you that endurance athletes, to put it nicely, tend towards the thin part of the distribution in terms of normality.

    Having said that, this woman is crazy. But in the good sense of the word. From her record-setting crossing of the English Channel at age 16 to her devotion to swimming in water that is 40 degrees or colder, Lynne Cox is a rare breed.

    This is a very interesting read.

  • Eric Gunnerson's Compendium

    Review: Audiotrak OPTOPlay

    • 4 Comments

    I talked about improving my computer sound volume a while ago.

    After thinking about it a bit, I decided that rather than just amplify the mediocre sound, I'd upgrade to something better. I came across a few USB sound cards, and after looking at the various offerings, settled on the OPTOPlay from AudioTrak. It does more than I need - I don't need the digital output - but that really didn't add much to the price, which was about $50.

    One disadvantage is that NewEgg didn't carry it, so I had to wait about 10 days for it to show up.

    On Monday, I brought it in, plugged it into my dev machine, switched to it, and started listening to a song. It sounded great...

    ... for about 10 seconds, at which point the music dropped about 30dB and got hissy. I stopped it, and tried again...

    It played for 7 seconds, at which point it began playing a full 50 mW of white noise into my headphones.

    After trying a few things with no luck, I left a message on their tech support forum. The answer I got was that certain Intel chipsets had problems with audio data, and that if I plugged the device into a USB hub, it might fix the problem.

    And it did. For someone who has been into audio for a while, the notion that adding another device in the chain will fix problems is an interesting notion.

    So, onto the sound quality. I can only describe it as outstanding. Very clear, with plenty of power.

    I was going to write a sentence or two on how the sound compared to the on-board sound, but decided not to. I came up with a few analogies ("like Eddie Van Halen vs. your nephew Josh"), but it didn't seem fair. The average on-board sound system is optimized to match the quality of computer speakers, which means that it's simply awful. When confronted with the hostile electronic environment and fiscal constraints of on-board sound, the designers understandably nipped out early for a pint.

    Acoustical memory is notoriously unreliable, but I think that the sound is slightly better than my iRiver h120.

    Definitely recommended.

  • Eric Gunnerson's Compendium

    What's wrong with this code #7?

    • 15 Comments

    This time, I'll present a runnable program. The ConsoleCtrl class is designed to intercept CTRL-C and, for testing purposes, will exit after it gets 10 of them. Or after a little over 27 hours.

    What's wrong with this code?

    using System;
    using System.Threading;
    using System.Runtime.InteropServices;

    public class ConsoleCtrl
    {

     public enum ConsoleEvent
     {
      CTRL_C = 0,  // From wincom.h
      CTRL_BREAK = 1,
      CTRL_CLOSE = 2,
      CTRL_LOGOFF = 5,
      CTRL_SHUTDOWN = 6
     }

     public delegate void ControlEventHandler(ConsoleEvent consoleEvent);
     public event ControlEventHandler ControlEvent;

     public ConsoleCtrl()
     {
      SetConsoleCtrlHandler(new ControlEventHandler(Handler), true);
     }

     private void Handler(ConsoleEvent consoleEvent)
     {
      if (ControlEvent != null)
       ControlEvent(consoleEvent);
     }

     [DllImport("kernel32.dll")]
     static extern bool SetConsoleCtrlHandler(ControlEventHandler e, bool add);
    }


    public class Program
    {
     static int count = 0;

     public static void Main()
     {
      ConsoleCtrl consoleCtrl = new ConsoleCtrl();

      consoleCtrl.ControlEvent += new ConsoleCtrl.ControlEventHandler(Logger);

      Thread.Sleep(100000);
     }

     private static void Logger(ConsoleCtrl.ConsoleEvent consoleEvent)
     {
      Console.WriteLine(consoleEvent);
      count++;

      if (count == 10)
      {
       Environment.Exit(0);
      }
     }

    }

     

  • Eric Gunnerson's Compendium

    A test

    • 14 Comments

    Lift up your keyboard, turn it over and shake.

    Yuck.

  • Eric Gunnerson's Compendium

    Geocide

    • 1 Comments

    From the Slacker Astronomy extra podcast:

    How to Destroy the Earth

    Sample -

    7. Pulverized by impact with blunt instrument

    • You will need: a big heavy rock, something with a bit of a swing to it... perhaps Mars

    • Method: Criminal, really, that this blindingly obvious method was overlooked for so long. Essentially, anything can be destroyed if you hit it hard enough. ANYTHING. The concept is simple: find a really, really big asteroid or planet, accelerate it up to some dazzling speed, and smash it into Earth, preferably head-on but whatever you can manage. The result: an absolutely spectacular collision, resulting hopefully in Earth (and, most likely, our "cue ball" too) being pulverized out of existence - smashed into any number of large pieces which if the collision is hard enough should have enough energy to overcome their mutual gravity and drift away forever, never to coagulate back into a planet again.

  • Eric Gunnerson's Compendium

    Media Pessimism

    • 2 Comments

    Jim wrote a post entitled Are People Inherently Pessimests?

    I think the answer is no, most of the people I know I would label as "realists". But it's clear that the view we get is fairly pessimistic.

    I was initially going to say that it was because of the focus taken by the media, but after a bit of reflection, I think it's inherent in the current media landscape.

    In the old days - say, the 1970s - each of the major networks had a large news organization, who viewed their goal as "informing the public". There was a gentlemen's agreement that they would limit themselves to "real news". And news was, at that time, pretty good, though the phrase "if it bleeds, it leads" was around at this point.

    Fast forward a bit, and the cable channels come up. This has two big effects:

    1) Network programming has more competition, and therefore news budgets are at risk.
    2) Cable news doesn't comply with the "gentlemen's agreement".

    The second effect switches the question from "is this news?" to "will people watch this?". This puts pressure on the all news organizations, as high ideals (as they say) don't put food on the table - you need people to want to watch this. Hence the shift from reporting to "debate" or "analysis" shows - it's easier (ie cheaper) and (some feel) more entertaining to watch two people debate the motives of political parties on a current issue than to investigate and report on the issue in depth. And you never have to worry about not having enough material to fill time.

    In the case Jim refers to, the viewership potential is much much higher if you report on the worst rather than report on the back. It's not that people are pessimistic, it's that the pessimistic interpretation is more interesting than the mundane one, typically expressed as "Dog bites man" vs. "man bites dog".

    So, I think it's not surprising that we got to this point, as market forces pushed people there. And I don't think blogs are the answer - if anything, blogs just increase the amount of opinion that's out there, not the amount of information.

  • Eric Gunnerson's Compendium

    Make your customers the marketing department

    • 7 Comments
     

    I've been reading GapingVoid for a few months now. Hugh has some very interesting insights, and draws great cartoons, though some of them are not safe for work. Yesterday, he wrote a post titled Make your customers the marketing department, with the cartoon that I've included above. The post has some good points in it, but I'm more interested in the message in the cartoon. I've seen lots of examples at Microsoft where teams have become enamoured with technology, while not connecting with customers.

    Customers are betting their livelihood on your software. If they don't trust you, it doesn't matter what your techology is, though it's a pretty fair bet that if you haven't been talking with customers, what you build will not be a good fit for their needs.

  • Eric Gunnerson's Compendium

    TopoUSA 5.0 Western Edition

    • 4 Comments

    I've been riding a lot of hills recently, getting ready for the 7 Hills of Kirkland on Memorial Day, and I'm getting more used to climbing and less scared of the steeper hills.

    But I've found that there is a dearth of information about the various hills that I ride on. The best source that I've found is the "Larry Kemp climb spreadsheet", which has some good information, but doesn't cover a lot of hills (Larry was killed while bicycling in Europe last spring, and there haven't been any updates since then).

    Every few months, some of the less-experienced riders will ask about routes to get from A to B, and it's really hard to quantify how hard a specific hill is. How does Inglewood compare to Factoria? What about Lake Hills Connector? (for those of you who haven't yet picked up on the exciting hobby of learning hill names in the eastern suburbs of Seattle, bear with me...)

    I'd looked at a couple of topo programs in the past, but the front runner - TopoUSA from DeLorme - was about $100, which was a bit too rich. When I checked last week, I found that I could get an edition for the western US for only $50, so I ordered up a copy, and installed it on my laptop.

    This is a cool and powerful tool. You can set up routes and get their profiles, and supposedly, you can add your own trails (which should be nice because bike routes aren't in MapPoint...), and download the routes to your GPS (which I might use for RSVP this year). It does most of the calculations that you want.

    But, the user interface looks like it was designed in 1987 to run on X Windows. It doesn't use any of the standard Windows UI approaches, so it's really hard to figure how to use it initially. No menu bar, for example.

    Overall, I think that it's pretty good. The map database isn't as good as mappoint is - I know the roads that I ride pretty well, and the mappoint layout seems very good. The TopoUSA version has slight turns where the road is straight, and some turns are sharper than they really are. But, overally, for what I got it for, it's okay.

    I haven't yet verified how good the elevation data is yet.

     

  • Eric Gunnerson's Compendium

    Original Hitchhiker's Guide To the Galaxy Radio Program

    • 9 Comments

    Yesterday, I managed to find the original Hitchhiker's radio series in an archive from KCRW, an NPR station station in Santa Barbara.

    The series consists of 12 half-hour segments, with the full twelve segments covering the the first three books of the trilogy (roughly).

    It's definitely worth a listen, and it's interesting how Adams evolved and filled in things over time.

  • Eric Gunnerson's Compendium

    C# bugs through MSDN Feedback

    • 0 Comments

    Rusty, the C# QA Manager, writes about the fate of bugs reported through MSDN feedback.

    Please let him know what you think of the process.

  • Eric Gunnerson's Compendium

    Hitchhikers Redux

    • 5 Comments

    Rory posted an interesting counterpoint to my review.

    Rory has some good points - I agree that you can't expect a movie to be totally faithful to a book, and I have noticed that there is a distinct correlation between how well somebody liked the book (and, perhaps, how familiar they were with the book), and how disappointed they were with the movie.

    Rory would argue that we are "armchair literary snobs", but I think there's more to it than that.

    Certain books, for whatever reason, resonate with certain people. Adams has a peculiar way of twisting reality in a particular way, and much of that depends on his choice of words. It's funny in a very specific way.

    Somebody running around with a juicer on his head or holding the arm of a robot may also be funny, but not in the same way.

    I'm disappointed with the movie because it didn't capture that particular view of reality (or unreality) that Adams excelled at.

    To risk a poor analogy, I went hoping for a Kevin Smith movie or a Jim Carrey movie, and ended up with a Will Ferell movie. It's still funny, but definitely not in the way that I had hoped it would be funny. It's no longer quirky - it's mainstream, as evidenced by the major role that that Arthur-Trillian "romance" played in the movie, and it's total absence in the book. Just another "me too" movie...

    Come to think of it, the book to movie analogy isn't really fair in this case. Hitchhiker's first showed up as a radio show, morphed into a book, a BBC TV series (which, for all of its faults, is funnier than the movie).

Page 1 of 1 (21 items)