Thursday, February 22, 2007

And sadly, that woman was not Grace Hopper.  The winner of the coveted 2006 Turing award is none other than Fran Allen.  No, I've never heard of her either.  Apparently, she has been a lifelong IBM software engineer, and her accomplishments include, uh, er, something to do with optimizing compilers.  She is apparently the head of many different computing organizations and has spent a great deal of time teaching classes as an adjunct professor.  This reminds me of the adage, "those who can, do, those who can't, teach".  I'm at a loss to explain why Ms. Allen was selected to win the Turing award, other than she is an aging female software engineer, and she is still alive to receive the award in person.  She didn't even have an entry in Wikipedia until a few days ago, what's with that?

It's my opinion that if the ACM wanted to give this award to a woman that badly, they should have honored Grace Hopper posthumously, with her family receiving the prize.  Hopper had a major impact on the world of computing, with the invention of the COBOL programming language, and this impact was felt most forcefully as we approached the year 1900.  COBOL has always been the de facto standard for big-iron mainframes that crunch data in back offices that are impervious to its stench.  And to prove the point that people will actually pay money to romance a pig wearing lipstick, Fujitsu is keeping the corpse alive with NetCOBOL for .Net.

So I give my personal award for best lifetime achievement to a woman in the IT industry to Grace Hopper.  If it weren't for her contributions, we may still be using a variant of RPG or PL/I.  Nuff said.

posted on Thursday, February 22, 2007 3:09:58 PM (Central Standard Time, UTC-06:00) by Christopher S. Velazquez
Evolution of the Programmer.  The evolution of the "Hello World" program from high school (in BASIC) to master programmer (as a C++ COM library) and then through management.

posted on Thursday, February 22, 2007 11:46:25 AM (Central Standard Time, UTC-06:00) by Christopher S. Velazquez
 Tuesday, February 20, 2007

You've seen Google spreadsheets and online word processing.  But how about Visio diagramming?  Introducing Gliffy, a free service for drawing diagrams reminiscent of Visio and sharing them online.

Here's one I tried.  It's not quite up to Visio standards, but not far behind either.

 

posted on Tuesday, February 20, 2007 5:27:28 PM (Central Standard Time, UTC-06:00) by Christopher S. Velazquez
 Friday, February 16, 2007

Well this has been a slow news week.  No astronauts went ballistic this week, and the hype over the death of what's-her-name is over.  The usual body count from Iraq and our casual acceptance of new encroachments by Big Brother just aren't news anymore.

Garfield, eat your heart out

So I guess I'll just introduce my beloved cat, Spot.  We have three cats, but Spot is decidedly "mine"; she often hangs out on the gate waiting for me to come home from work.  I picked her from the litter a month before she was ready to be adopted.  She is about 4 years old now.  When she was about a year old, she was exploring one of our neighbor's abandoned cabins and accidently fell down the chimney.  The fireplace had been boarded shut, so she was trapped in the chimney just above the flue.  I wondered what happened to her, and after about a day and a half of her missing, I heard a very faint meowing.  I found her and rescued her from the cabin, but she had blown out her vocal cords trying to get somebody's attention.  As a result, she barely meows any more.  Now she's kind of fat and indulgent, so I guess it's true that pets and their owners start to look alike.  I took this photo of her this morning; she has spent the night sleeping on some pizza boxes from the night before.

"It's not the fur that makes you look fat", quips my daughter Aria.

Something to think about

I think I've finally discovered the absolute worst programming language.  It's called "Whitespace", and it's even worse than brainf*ck.  All commands in the language are composed of whitespace.  This is not a joke.  I'm seriously considering porting this to Whitespace.NET.  Anyone want to join me?

posted on Friday, February 16, 2007 9:06:45 AM (Central Standard Time, UTC-06:00) by Christopher S. Velazquez
 Friday, February 09, 2007

Remarkable benefits of NASA technology

Having spent the past week in the Clear Lake City area of Houston, in light of the recent flap with astronaut Lisa Marie Nowak, I guess it should not come as a surprise that every time I passed by the NASA Johnson Space Center there was a queue of reporters waiting to have there smiling faces videotaped in front of the NASA front entrance.  Of course, the most interesting aspect of this stranger-than-fiction drama was the fact that Nowak drove from Houston to Orlando while wearing a special "space diaper" that obviated the need for pit stops.  I asked the guard at the gate of NASA if there was any way I could buy or otherwise obtain one of these coveted "space diapers", but he didn't find the humor in this so I left before he could call the cops.

 Lisa Marie Nowak and Nick Nolte.  Separated at birth?  I report, you decide.

A Valentine poem

Valentine's Day is right around the corner, so you should set your MS Outlook reminder to give you the electric cattle prod sometime before Wednesday.  Of course, I like to stay on top of these things, so to speak.  Therefore, in order to display my more sensitive side to my lovely wife, I embarked upon some original poetry.  Chicks dig poetry.  Without further adieu...

Washington Monument
Never looked as grand
As what I have for you
In my hand
Happy Valentine's Day

See what a true romantic I am?  I wonder if I can sell this one to Hallmark?

News from people with similar DNA

My chef brother, Josh, opened his new restaurant, Deep Ellum in Boston last month.  He's been getting some rave reviews from the local press, which is always welcome.  I asked him if he had a web site yet, to which he did not answer.  So I did a registration lookup at DomainTools.com and found that he already did have a domain registered, and when I visited the web site, it was already under construction.  Josh was not happy that I found his web site.  But I hope everyone in Allston gets a chance to sample some of his remarkable cooking.  He's phenomenal.

Yet another case of Texas envy?  I report, you decide.  I'll update when the website is "officially" launched.  Till then, you'll just have to find it yourself.

San Antonio's biggest problem

One thing people certainly will not envy about Texas is that 4 of the 10 "fattest cities" are right here in the Lone Star State, with San Antonio topping that list at position #2, just behind #1 Las Vegas, NV.  Now anyone who's been to San Antonio knows that the food is great here - barbecue, Mexican, and many others.  San Antonio is one of the most hostile cities to bikers, and there are so few bike trails that it's hard to understand how Lance Armstrong got his start here without getting run over.  And the few existing public parks and green spaces in the Alamo City are lame.  If I were king of the world, I would kick the military out of Camp Bullis and turn it into the most wonderful public green space in all of Texas.

On getting noticed by search engines

It's clear that I have much work to do when it comes to search engine optimization.  I read with eager abandon the article on SEO referenced by my friend Big Nellie on his blog.  You would think that because I registered the domain "chrisvelazquez.com" and that my site is called Chris Velazquez, and that in fact my name is actually Chris Velazquez, and has been since birth, that when you type the phrase "Chris Velazquez" in the search engine, that the first entry for "Chris Velazquez" would be one of my own pages.  My home page has the words "Chris Velazquez" in the title tag, the H1 tag, and all over my web site.  Yet if you go to the #1 search engine, you won't find any pages of this website at all unless you place the term "Chris Velazquez" in quotes, and even then it only shows one of the blog pages, sometimes.  It's not that I'm in love with my name; my name is pretty ordinary, and there are a few other people who also have the same name, including a rancher in New Mexico and a film producer.  As you can probably tell, this entire paragraph is an attempt at an experiment to see whether this page will become the first search engine result for the term "Chris Velazquez".  Sorry to have to bore you with all this.

 What Gooooooogle thinks about my website!

 

posted on Friday, February 09, 2007 10:47:10 AM (Central Standard Time, UTC-06:00) by Christopher S. Velazquez
 Wednesday, February 07, 2007

I can't believe that I've been racking my brains for hours trying to figure out how to execute my .NET 2.0 code in Microsoft Excel 2003.  Hopefully this tidbit of information will save somebody else on the web some pain, frustration and time.

Punchline: You need a file called EXCEL.EXE.CONFIG in the same directory as EXCEL.EXE.

I created a class, written in C# and compiled with Visual Studio .NET 2005, with the .NET 2.0 Framework.  This class has a COM Interop wrapper so that it can consumed by ActiveX clients, most notably Excel 2003.  This class was compiled with the "Register for COM interop" setting in the properties turned on.  This arrangement autogenerates the GUIDs and COM interface for you, though I prefer to define my own COM interfaces manually in production code.

Here is a sample class in C#:

// COMClass.cs
using System.Windows.Forms;

namespace AnyCOMLib {
    public class COMClass {
        public void DoSomething() {
            MessageBox.Show("I did something.");
        }
    }
}

When I compiled this C# class, Visual Studio generated the DLL and TLB files I expected.  You can invoke it from a COM client, and it seems to work.  Here is the VB code:

Dim thing As Object
Set thing = CreateObject("AnyCOMLib.COMClass")
thing.DoSomething

I typed out a simple VBScript file with this code, and it worked.  A message box popped up saying "I did something.".

I created a simple VB 6.0 program with this code, and this worked, too.  The same message box displayed.

I created a VBA macro in Excel 2003.  This did not work.  I had a message that read:

Run-time error '-2147024894 (80070002)':
File or assembly name AnyCOMLib, or one of its dependencies, was not found.

So I thought - If I can create a VB6 DLL that can be called from Excel (true) and VB6 code can call my COM-wrapped C# code (also true) then why not create a VB6 DLL that calls my C# code and call that from Excel?  Unfortunately, Excel was not easily fooled by this subversion, and I continued to get the -2147024894 error.  That was a waste of time.

After spinning my wheels for too long, I finally found something helpful.  It turns out that I need a file named Excel.exe.config to be placed in the same directory as Excel.exe (typically at C:\Program Files\Microsoft Office\Office11).  That file has the following format:

<configuration>
    <startup>
        <supportedRuntime version="v2.0.50727"/>
        <supportedRuntime version="v1.1.4322"/>
    </startup>
</configuration>

You have to make sure that you have the correct supportedRuntime elements for the .NET runtime to work.

Here are links to the pages that helped me find out about this:

newsgroup microsoft.public.dotnet.framework.sdk

topic in msnewgroups.net

These were specifically targetted for MS Word, but the same method applies to running .NET assemblies in Excel 2003 as well.

I hope this helps somebody!

posted on Wednesday, February 07, 2007 11:27:09 AM (Central Standard Time, UTC-06:00) by Christopher S. Velazquez
 Friday, February 02, 2007

You can attach the search functionality of your web site right into MSIE 7.0.  If you're using IE7, check out the search widget and see for yourself.

 

What you need:

  • An XML file (or script that generates XML) in the Open Search Description schema.
  • Add a <link /> tag in the <head> section that points that XML file or script

Here is the link tag I added to the hometemplate.blogtemplate dasBlog file:

<link rel="search" type="application/opensearchdescription+xml" href="/blog/opensearch.xml" title="In Chris Velazquez's words" />

I put this right before the line that has <%radio.macros.headLinks ()%>.  I'm not a dasBlog guru, or I would figure out how to get this in as a headLink.  Suggestions are welcome!

Now I need the file (opensearch.xml) that it points to:

<?xml version="1.0"?>
    <OpenSearchDescription
        xmlns="
http://a9.com/-/spec/opensearch/1.1/">
    <ShortName>In Chris Velazquez's words</ShortName>
    <Description>In Chris Velazquez's words</Description>
    <Url type="text/html" method="get" template="
http://www.chrisvelazquez.com/blog/SearchView.aspx?q={searchTerms}"/>
</OpenSearchDescription>

The template attribute has {searchTerms}, which is where the parameter would normally be entered.

 

Here are some of the custom search providers I use in MSIE 7

posted on Friday, February 02, 2007 12:40:43 PM (Central Standard Time, UTC-06:00) by Christopher S. Velazquez

This describes yet another way to do things.  Suppose you have input coming from a common source, but based on the content of that input, you want your program to do different things.  Naturally, the first thing you think of is the switch statement.  But I've stumbled across an interesting alternative.

Here is a simplified class in C# that uses a switch statement:

public class MyGame: IGame {
   
    public string ExecuteCommand(string command, string parameter) {
        string result;
        switch (command) {
            case "ECHO":
                result = DoEcho(parameters);
                break;
            case "JOIN":
                result = DoJoin(parameters);
                break;
            case "READY":
                result = DoReady(parameters);
                break;
            default:
                result = DoError();
                break:
        }
        return result;
    }
   
    public string DoEcho(string parameters) {
        string result;
        // code here
        return result;
    }
   
    public string DoJoin(string parameters) {
        string result;
        // code here
        return result;
    }
   
    public string DoReady(string parameters) {
        string result;
        // code here
        return result;
    }
   
    public string DoError() {
        string result;
        // code here
        return result;
    }
}

I decided to play around with generics to see if I could come up with an alternative to "switch".  By using a Dictionary of delegates, I can look up what the appropriate action to take would be, and then do it in a generic fashion.

public class MyGame: IGame {
   
   
private delegate string CommandHandler(string parameters);
   
protected Dictionary<string, CommandHandler> commandHandlers =
new Dictionary<string, CommandHandler>();
   
    public MyGame() {
        commandHandlers["ECHO"] = new CommandHandler(DoEcho);
        commandHandlers["JOIN"] = new CommandHandler(DoJoin);
        commandHandlers["READY"] = new CommandHandler(DoReady);
    }
   
    public string ExecuteCommand(string command, string parameter) {
        CommandHandler handler;
        if (commandHandlers.TryGetValue(command, out handler)) {
            return handler.Invoke(parameter);
        } else {
            return DoError();
        }
    }
   
    // handler code is same above.
   
}

I don't know about you, but this is much more satisfying at varying levels.  I've never liked the switch statement syntax, ever, and this code is easier on the eyes.  This transforms the dispatch mechanism from a procedural approach to a table-driven approach.  The one disadvantage is that all the dispatch methods must have the same figure, but usually uniformity is a welcome attribute to code.  One cool thing is that by adding a new handler, Resharper will automagically generate the signature for the new dispatch method.

A place where this approach might be useful is by assigning abstract factory methods as delegates.  Those have to be uniform, by design contract.

One thing I would like to see is the ability to assign all of the elements in the dictionary in a single statement.  I understand this will be a new feature in C# 3.0, but I haven't experimented with that yet.  I just downloaded the SDK yesterday!

posted on Friday, February 02, 2007 11:10:53 AM (Central Standard Time, UTC-06:00) by Christopher S. Velazquez