CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Brendan Tompkins [MVP]

Blog First. Ask Questions Later.

June 2005 - Posts

  • Dreading writing your "Blog'n to PDC" entry? Use my PDCContestEntryService and Win a COM in .NET Book

    This post is a bunch of things, wrapped up in one.  First and foremost, it’s my Official entry into the “Blog’n to PDC” contest.  Secondly, it’s way for you to create your own entry into this contest, with very little effort and HTML-Smithing. Third, it’s a shameless plug for WSMQ, my pet project.  Forth, it’s a demonstration of WSE, Amazon’s Web Services, and Google’s Web Services. And finally, it’s a contest (and I’ve always wanted to do one of those!)

    How can one blog post be all these things?

    Well, when I started brainstorming my entry to the PDC contest, I sat there thinking what a pain it was and how boring my post would be.  In fact, for a moment I thought about not entering.  "I wish I could just connect to a service, tell it a bit about me, and it would do all the work for me,”  I thought “but who would waste an entire evening writing such a service?”  Just as I was thinking this, I realized that I’m just lazy enough to write a bunch of code to avoid doing any real work.  In a few hours, I had thrown together a web service that, given a little bit about you, will automatically create a custom blog post suitable for entering you into this PDC contest

     No, really, I’m serious. Stop laughing. I’ve even hosted it, so all you have to do is bang some code against said web service, and voila! Your very own PDC entry. Here’s the endpoint URL:

    http://www.wsmq.com/PDCService/PDCContestEntryService.asmx

    This service does the following things:

    • Does a google search for links linking to your blog, and adds them to your entry post, so they know you're serious.
    • Looks up your interests at Amazon, and returns a list of books that match your interest, and adds them to your entry post.
    • Finally, registers your entry in a WSMQ Hosted public queue, and gets a list of other coders who have done the same, and adds this list to your entry post.  * I had to fit in my queue service somehow

    You can even download the solution code here, including an NUnit unit test project (which you can actually use as a client to talk to the service.)

    As an added bonus, I’ll randomly select one of the bloggers who use my service, and send them a copy of  COM Programming with Microsoft .NET by John Paul Mueller, Julian Templeman

    Have fun, and good luck to everyone who enters!

    -Brendan

    Oh, an here’s my auto-generated post entry:


    I’m Blog’n my way to the PDC!

    If you haven’t heard, Channel9 has started a contest where you can win a ticket to the PDC, including an airline ticket and hotel!  This is one amazing contest, and all you have to do to enter is have a blog, and post why you should win the prize.  So here’s my official entry:

    blogging my way to pdc

    Here's some information to help you get to know me better:

    Why me?

    Why do I want to go to the PDC? Because I love to blog! And I'm prolific! Here's some of my more popular blog posts links according to Google :

  • Brendan Tompkins
    Archives. June 2005 (9); May 2005 (9); April 2005 (10); March 2005 (20);
    February 2005 (25); January 2005 (12); December 2004 (15); November 2004 (19) ...
  • Brendan Tompkins
    Archives. June 2005 (8); May 2005 (9); April 2005 (10); March 2005 (20);
    February 2005 (25); January 2005 (12); December 2004 (15); November 2004 (19) ...
  • Brendan Tompkins : A Simple InfoPath Web Viewer Control
    Archives. June 2005 (8); May 2005 (9); April 2005 (10); March 2005 (20);
    February 2005 (25); January 2005 (12); December 2004 (15); November 2004 (19) ...
  • Brendan Tompkins : Is eLearning the $500 Toilet Seat of the ...
    Archives. June 2005 (5); May 2005 (9); April 2005 (10); March 2005 (20);
    February 2005 (25); January 2005 (12); December 2004 (15); November 2004 (19) ...
  • Brendan Tompkins
    ... So, my new blog address will be http://codebetter.com/blogs/brendan.tompkins, my
    new RSS feed address is http://codebetter.com/blogs/brendan.tompkins/Rss.aspx. ...

      What are my interests?

       Well, here’s a list of books that I'll probably be reading on the plane to LAX :

      Did I type up all this ugly HTML for this Blog post myself?

      Heck no!  I’m lazy!  But that’s exactly why I need to go to PDC!  The PDC is all about the future, and in the future, we’ll all be using cool technology to do things like typing tedious, boring contest entries.  I’m getting a head start on the salad days, so I figured out how to use this ASMX web service that Brendan wrote! To prove it, you can see that I'm on this list of other, lazy coders who would rather sit back and use a distributed Web Service to their work!   Here’s that list:

    • Dynamically Generate Windows Media Videos in .NET

      I recently worked on a project here at the port archiving our gate camera images in SQL Server.  The cool thing about having these images archived is that we can do all sorts of cool things with the raw bytes, such as stream them as  slideshow, pull up a specific image from a given date, or combine multiple frames to dynamically create a video from a given time period.

      Combining images into a WMV movie from .NET turned out to be quite an interesting project.  Kirk Marple, expert in all things media,graciously donated a bunch of wrapper code to the WMF SDK,  which he says he took inspiration from this article here at CodeProject. 

      I’ve taken a lot of this code and put together a library which you can use to generate WMV videos on the fly, from a variety of different input types 1) A list of image files 2) An array of Bitmap objects and 3) A SQL DataReader containing the raw image bytes.  I’ve put together a small console app that can be used as a utility (MovieMaker.exe) for combining multiple files into a WMV movie, it can be run via the command line, like so:

      MovieMaker.exe profile_file_name output_file_name [input filter ex: *.bmp] [input directory]

      Here’s an example movie assembled from 5 bitmap files.

      The only tricky part of this is creating the appropriate Windows Media Encoder Profile (prx) file.  To do this, you’ll need to download the free Microsoft Windows Media - Windows Media Encoder 9 Series. You’ll also need this installed on any machine running this, since the code uses the WMEncoder to extract the profile information it needs to write the video.

      The console app demonstrates how to quickly write images to a WMV file, but you’ll probably find the WMVLib class itself more useful in your applications.  Using the WMVLib class is easy,  the most straight-forward usage is to call SaveVideo with the output file name, profile file name, and list of bitmap files to write to the video:

      public static void SaveVideo(
         string fileName,
         string profileFileName,
         string[] files
      );

      Here’s a snipped of code from the MovieMaker.exe app that shows how to encode a directory of files, given an output and profile file name.

          // Find the input files

          string [] files = Directory.GetFiles(inputDirectory, fileFilter);

       

          // Throw exceptions if we have any missing info

          if(files.Length < 1)

            throw new Exception("No JPEG files found!");

          if(outputFileName.Length == 0)

            throw new ArgumentException("No output file specified!");

          if(prxFileName.Length == 0)

            throw new ArgumentException("No profile file specified!");

       

          // Finally save the video

          WMVService.SaveVideo(outputFileName, prxFileName, files);

       

          Console.WriteLine();

          Console.WriteLine(String.Format("{0} frames written to file {1}", files.Length, outputFileName)); 

      The WMVLib’s SaveVideo method is also overloaded for source input types, such as a Bitmap array and DataReader.

      Download the following applications to play around with this stuff or integrate it into your own applications. 

      You also may want to look into the following resources when digging into this stuff:

      Good luck, and if you have questions, topics or code to share relating to windows media, feel free to post them in our Windows Media and GDI+ forum.

      -Brendan

    • Brittle Software : Precise/Indepth

      I’ve been thinking of doing a review of Precise/Indepth for SQL Server.   I just did a Google and found this review by none other than Larkware’s Mike Gunderloy.

      Product Review: Precise/Indepth for SQL Server

      Precise worked with Microsoft to hook up a new high-speed, low-impact sampling technology to the SQL Server engine. This allows the new product to collect and analyze very detailed performance information in the short term and over time, to identify both immediate problems and long-term issues. The Precise screen can show you which statements are being executed, which ones take the longest to execute, and how tables and other objects are bring used. You can summarize resource consumption by program, user, or type of application for a business-centric rollup view.

      I’ll admit, the kinds of statistics you can get from your databases are amazing, if you can keep the application running. We’ve struggled with keeping the software running, had a host of licensing issues and *broken clients.  The supposed gold-mine of data that this software collects is basically rendered useless by a host of technical problems. It’s the classic “Brittle” software application. 

      All Brittle Software is Not Created Equal.

      So, fine you may think. “Lots of software is brittle, but look what it does for you?”  Well, in my opinion, the big danger with brittle software crops up when it’s software that’s used infrequently.  Since it’s used only occasionally, it’s not a priority for support and maintenance. As more things change in the hosted environment, the software tends to rot in place.  A setting here, a config problem there, pretty soon the software is broken.  Lots of applications need hand holding, and day to day maintenance, and even the most brittle applications can be kept running with constant care. But when an application is rarely used, like Precise/Indepth, it’ll tend to stay in a state of brokenness.

      This is what has happened to us here.  We’ve had this software for months, and I think I’ve managed to actually use it a half a dozen times.

      “Well, You Just Don’t Know What You’re Doing Then”

      This could be true.  But, our IT shop can’t keep this software running, and we manage pretty well otherwise.  Perhaps we’re stretched too thin.  Perhaps we need to hire a Precise/Indepth administrator.  Perhaps we need to hire a Vertias consultants to come in and save the day.

      Perhaps this application can work fine within some organizations, but the fact that we can’t work with it here enough for me to say they should be going back to the drawing board with this one.  I’ve got this idea that software should work after it’s installed.  Call me crazy.

      At the end of the day, we’re looking for other SQL Monitoring applications.  If you know of any applications for SQL Server performance monitoring, or have similar or opposite experiences with Precise/Indepth feel free to post a comment.

      -Brendan

      *It appears that they use a VB front end, with some third-party OCX controls that other applications use.. Can you say “DLL Hell?”

    • Community Server Homepage Controls 1.1 Update

      Last week, I posted the code for our Community Server Homepage Controls

      Control 1: FeaturedArticle
      Purpose: This control shows one featured article, along with the excerpt and the author’s avatar.
      Files Needed : FeaturedArticle.cs, Skin-FeaturedArticle.ascx

      Control 2: AggregateCompactPostList
      Purpose: Shows a configurable number of latest and most popular posts.
      Files Needed : AggregateCompactPostList.cs, Skin-AggregateCompactPostList.ascx, AggregatePostList.cs, AggregatePostList.ascx

      Control 3: AggregateCompactArticleList
      Purpose: Displays an article’s category title, excerpt, and published articles.
      Files Needed : AggregateCompactArticleList.cs, Skin-AggregateCompactArticleList.ascx, AggregatePostList.cs, AggregatePostList.ascx.

      A bunch of people commented that these controls break with 1.1, and there were indeed some breaking changes that had to be fixed.  I’ve also added our AggregateCompactBlogList, which we use on our blogs page to display the list of bloggers on the site.

      You can download the source files here, containing the 1.0 and 1.1 versions.

      -Brendan 

       

    • Community Server 1.1 Upgrade

      I just completed our upgrade to Community Server 1.1. So far, things look good and I've already noticed that many things that weren't working quite right before, are working now.   Thanks again to everyone who worked on this fine piece of software we're using.

      I should be able to start blogging again soon, hopefully.  For now, I've been spending my blogging time working on this site.  Not that I'm complaining  tho.. :)  It's fun to be able to support such a nice bunch of people, and Sahil. :)

      If you have any suggestions, comments or find a bug, please post it in the forums

      Thanks for being part of our community!

      Brendan


    • Community Server Homepage Controls

      If you read us through our website, you’ve probably noticed that we launched our new homepage yesterday. Community Server didn’t have exactly the controls I needed to create the new homepage, so I had to create new controls that did what I wanted.  Fortunately, CS did gave me the building blocks I needed to quickly assemble the new page.  I wanted to post here the source files, in case anyone wants to create a similar page with Community Server. I created three new controls.  Here’s what they look like on the home page.

      Control 1:   FeaturedArticle
      Purpose: This control shows one featured article, along with the excerpt and the author’s avatar.
      Files Needed : FeaturedArticle.cs, Skin-FeaturedArticle.ascx

      Control 2:   AggregateCompactPostList
      Purpose: Shows a configurable number of latest and most popular posts.
      Files Needed : AggregateCompactPostList.cs, Skin-AggregateCompactPostList.ascx, AggregatePostList.cs, AggregatePostList.ascx

      Control 3:   AggregateCompactArticleList
      Purpose: Displays an article’s category title, excerpt, and published articles.
      Files Needed : AggregateCompactArticleList.cs, Skin-AggregateCompactArticleList.ascx, AggregatePostList.cs, AggregatePostList.ascx

      You’ll also need some css styles added to CommunityServer’s style sheet (via default.aspx in the Themes/default/style directory)

      All CS files go in the CommunityServerBlogs project in the Controls/AggregateBlogControls directory, and all ascx files go in the CommunityServerWeb project in the Themes/Default/Skins/Blogs directory.

      You can download the source files here.  Shoot me an email if you need help implementing this, or if I left anything out.

      -Brendan

    • We know that too much of a good thing in your aggregators stinks...

      You may have noticed that we have a serious multiple-post problem here at CodeBetter.Com.  This problem only shows up in some aggregators, but can result in a bunch of phony new posts all day long.  I know that this can be extremely annoying, not to mention a big waste of the world’s network resources.

      I think I may have found a fix for this, but I’m holding my breath...  You may see a bunch of repeat posts once more in your aggregators, as I’ve changed the way CommunityServer assigns a posts’ GUID, but that should be the last of the repeats.

      Hopefully.

      If not, I’d say just sit back, relax, and pretend to be surprised when you see a post about the .NET powered battlebot at TechEd for the 15th time. 

      If this is a true fix, I’ll post the code for the fix tomorrow.

      -Brendan

    • Windows Server 2003 Service Pack 1 SetPassword Issue

      Yesterday evening, I installed SP1 for Windows Server 2003 on our Web Servers.  This morning, we got reports that new users couldn't be created on our site.  Upon investigation, it turned out that the code for creating users was failing on the following lines of code:

          /// <summary>

          /// Sets the password.

          /// </summary>

          /// <param name="userEntry">User entry.</param>

          /// <param name="password">Password.</param>

          public static void SetPassword(DirectoryEntry userEntry, string password)

          {

            object[] oPassword = new object[] {password};

            userEntry.Invoke("SetPassword", oPassword );

            userEntry.CommitChanges();

          }

      The error we were getting was  'Network path was not found'.  It turns out that this service pack tightened security around invoking SetPassword on the ASDI, (which makes sense since this is usually what service packs do, tighten security).

      In looking for an answer, I found the following gem on the microsoft.public.adsi.general group, specifically this post here.

       I use ADSI to manage servers in different domains,  
      different networks (AD, NT DC's, standalone, servers, no
      trusts, etc.) all managed from one point. I've observed
      many problems where some ADSI properties/methods work and
      others don't, in almost all cases it always came down to
      Name Resolution
      .

      Since these servers are in our DMZ, it made sense that this could be true for what we were experiencing.

      The Solution?

      The solution for us was to make sure the IP of the LDAP server was listed in our HOSTS file.  Previously it was listed in LMHOSTS only. We have to use these files to give our inside IP addresses visibility on our DMZ (or so our network admin tells me).  Just wanted to put this out there, because this was something that worked before, pre SP1, when the IP to the LDAP server was listed in the HOSTS file only.

      -Brendan



    • CodeBetter.Com Mission Statement (Mostly Happy Talk)

      Yesterday, I blogged that we’ve published the CodeBetter.Com FAQ.  We’ve also put together a mission statement.

      CodeBetter.Com Mission Statement (Mostly Happy Talk)

      CodeBetter.Com exists in order to help foster awareness of better practices, superior tools, proven methodologies and techniques within the software development community. We do this by providing developers of all levels a place to teach and learn about these topics through blog and forum posts, articles, software reviews, tools and examples.

      You can visit the entire CodeBetter.Com Manifesto here, which also lists our bylaws.

      -Brendan

      PS:  Sorry about the double posts in some aggregators!  We’re looking for a solution to this, and promise that it will be fixed soon.

    • The CodeBetter.Com FAQ

      We've recently received a lot of requests for blogging accounts here at CodeBetter.Com, which is flattering to say the least.  Unfortunately for those searching for new places to blog, we're not currently offering blogging accounts.  The biggest reason is that since we don't run any advertisements, we each pay a dues to maintain the site (which has over 1GB traffic per day already!) and we simply can't afford the disk space, time and maintenance fees that hosting lots of blogs would certainly require.

      There are other reasons too, but we've managed to put together the CodeBetter.Com FAQ, which you can read here.

      Hopefully, this will answer any questions you may have about CodeBetter, such as:

      Q: Is CodeBetter.Com a Palindrome?
      A: Someday it will be.

      and

      Q: Will we ever get to see Sahil naked?
      A: You're disgusting.

      So, hopefully the FAQ will answer these and other various and sundry questions you may have about CodeBetter.

      -B

    More Posts

    Our Sponsors

    Free Tech Publications