Archives

Archives / 2009 / December
  • SQL Server encountered error 0x80070422 while communicating with full-text filter daemon host (FDHost) process.

    When trying to do a full text search with SQL Server 2008 I received this error:

    SQL Server encountered error 0x80070422 while communicating with full-text filter daemon host (FDHost) process. Make sure that the FDHost process is running. To re-start the FDHost process, run the sp_fulltext_service 'restart_all_fdhosts' command or restart the SQL Server instance.

    I was able to track this down to the SQL Full-text Filter Daemon Launcher service being disabled.  Enabling and starting the service resolved the issue for me.

    image

    It is interesting to note that the service is set to a Startup Type of Manual but after a restart of my machine the service is started, so SQL Server 2008 must be starting it.  Having the service disabled probably prevented SQL Server from starting it the first time I went to run a full-text search.

    See this post (SQL Server encountered error 0x80070422 (FIXED)) for the same error message but I did not do all the steps he did (I just enabled and started the service).



  • How to change the Target Framework Version for a Visual Basic Project

    Today I received the following warning message from Visual Studio while adding a reference in a Visual Basic project:

    image

    The Target Framework version for the project ‘XXXX’ is higher than the current Target Framework version. 
    Would you like to add this reference to your project anyway?

    This warning message makes complete sense since the Visual Basic project I was working on is targeting the .NET Framework 2.0 and the project that was being referenced targeted the .NET Framework 3.5.  The only issue was that I was not able to figure out how to change the Target Framework Version in a Visual Basic project.

    In a C# project it is pretty easy; right-click on the project and choose properties and in the Application tab (vertical tab) you will see the Target Framework dropdown box:

    image

    But in Visual Basic it is hidden.  Here is where I found how to change the Target Framework version after searching for a bit:

    Right-click on the project and choose properties and then select the Compile tab (vertical tab).
    image

    At the bottom of the Project > Compile tab you will find an Advanced Compile Options… button.
    image

    In this dialog called the Advanced Compiler Settings is where you will find how to change the Target Framework version for Visual Basic.

    image



  • GDI+ Error when converting Tiff to Jpeg: Parameter is not valid

    One of the web applications that I work on is Instant Church Directory, a website that helps churches create a church photo directory.  Since the main focus of the application is to create a photo directory, customers are uploading all sorts of images into Instant Church Directory and the application needs to correctly convert and store the images and insert them in the final output, which is a PDF.

    Since the web application was launched in September 2008 we have had an issue with some Tiff images that are uploaded and throw a System.ArgumentException when the image is converted to a Jpeg.

    System.ArgumentException: Parameter is not valid. at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams) at System.Drawing.Image.Save(Stream stream, ImageFormat format)

    Today I was finally able to track it down to the Tiff image being created (or modified) by Adobe Photoshop and Adobe Photoshop is adding extra Property Items (meta data tags) into the image.

    With the help of Bob Powell’s tool: Discovering the Property Items present in an image, I was able to see that the Adobe Photoshop Tiff images included several additional property items that were not present in other Tiff images that worked.  Removing the tags from the original image prior to converting it to a Jpeg resolved the issue.

    Here is a list of all of the Microsoft Windows GDI+ image property tags in numerical order

    The PropertyTagICCProfile is id 0x8773 and the other tag that I removed to resolve this issue is id 0x935C (this Property Item is not defined in the list above but it has a header in it with “Adobe Photoshop Document Data Block”).  Property Items 0x02BC and 0x8649 are also not defined in the GDI+ list above and also are added by Adobe Photoshop but they did not cause any issues so I just left them (although if removing the first two do not work for you then try removing the other two also). 

    Here is the code that I used to remove the offending Property Items from the Tiff image before converting it to a Jpeg in order to prevent the GDI+ Parameter is not valid exception:

    // Check if this is a Tiff file
    if (bmp.RawFormat.Guid.Equals(ImageFormat.Tiff.Guid))
    {
        //loop through all of the Properties
        //looking for the offending property items added by Photoshop
        foreach (PropertyItem pItem in bmp.PropertyItems)
        {
            switch (pItem.Id)
            {
                //ICC Profile tag (PropertyTagICCProfile)
                //Remove this tag for Tiff to be converted to Jpeg.
                case 0x8773:
                    bmp.RemovePropertyItem(0x8773);
                    break;

                //Unknown tag added by Adobe Photoshop
                //"Adobe Photoshop Document Data Block".
                //Removing this tag for Tiff to be converted to Jpeg
                case 0x935C:
                    bmp.RemovePropertyItem(0x935C);
                    break;

                default:
                    break;
            }
        }
    }

    //convert the image to jpeg
    System.IO.MemoryStream ms = new System.IO.MemoryStream();
    bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
    bmp.Dispose();
    bmp = new Bitmap(ms);

    Technorati Tags: ,,


  • Amazon is offering free one-day shipping for the Kindle

    I love this.  Amazon is offering free one-day shipping for their Kindle starting tomorrow December 23.  This means you can buy the Kindle up until midnight (EST) on December 23, 2009 and still have it delivered in time for Christmas.  (There is free 2-day shipping if you buy it today.)  What an awesome way to bring in new customers. 

    Kudos to the Amazon marketing team for coming up with this marketing idea.  But I think the real credit should go to all of the Amazon people who made the free one-day shipping a reality.  I am sure tons of marketing people have had the idea to use free one-day shipping right before Christmas to promote a product but have not had the behind the scenes infrastructure to actually pull it off.

    Check out the count down clock on their home page too:

    image

    Technorati Tags: ,


  • StackOverflow to Google Index in 30 minutes

    This is pretty amazing.  I asked a question on StackOverflow and 30 minutes later (while I was still trying to find the answer on my own) I found my question indexed in Google’s search results.  WOW!

    image

    image

    Bing didn’t have my StackOverflow question… but it did have an answer for me.

    +1 for Google getting my StackOverflow question indexed so fast.
    +10 for Bing getting me the answer.

    Technorati Tags: ,,


  • jQuery: How to check if button is disabled

    You can use jQuery to trigger a button click from the client.  In this certain situation, I needed to make sure the button was not disabled prior to clicking.  In jQuery you can use the “is” function to check if the button is disabled like this:

    <script type="text/javascript">
        $(document).ready(function() {
        if ($('#StartButton').is(':disabled') == false) {
                $('#StartButton').click();
            }
        });
    </script>

     

    Technorati Tags:


  • Changing up how my Someday/Maybes are organized

    I am a big fan of Getting Things Done (GTD) and highly recommend the GTD book and the methodology to everyone and anyone. 

    I do not consider myself a GTD Black belt yet but I am continually progressing and getting better and better at GTD each and everyday.  One of the areas of GTD that I consider to be my weakest is the Organize part of GTD.  I tend to resist moving projects and next actions that are truly someday/maybes into my someday/maybe list.  This is because my someday/maybe list has become so large that I do not review it regularly and no longer is it a trusted part of my GTD system.

    But I am also a big fan of keeping things flat.  I want to keep the overhead associated with running a GTD system at a minimum and having everything flat is a huge win for me in this area.  Up until now I had a single someday/maybe section (I use OneNote) for all of my someday/maybes but it definitely has become overwhelming and I am resisting putting things into the blackhole that is my someday/maybe list.

    I am going to try separating them into the various roles that I have:

    • Developer
    • Husband
    • Father
    • Homeowner
    • Entrepreneur

    image

    I will see if this will allow me to keep my Next Action and Project list clean by feeling completely comfortable moving a stale item into my someday/maybe list (now that I can review these regularly… something I was not doing to my someday/maybes which is why I resisted moving items there in the first place).

    Technorati Tags: ,


  • Amazon Same Day Shipping

    Back in October I heard that Amazon was introducing same day shipping delivery for some cities. Today I received an email for being an Amazon Prime member reminding me that Amazon has the ability to deliver an item to me within the same day.  But what is really amazing is the cut-off times; in Seattle you can order an item up to 1PM and get it delivered to you that same day:

    image

    That is amazing!  Talk about reducing the friction in buying… Amazon is an expert!  Just ask me how many items I bought for Christmas through Amazon Prime just because I get free two-day shipping.

    Technorati Tags:


  • Where to find the Subversion Binaries (svn.exe)?

    I was setting up CruiseControl.NET for the Vaasnet automated build system and I needed the Subversion binaries.  This is my first project that I had used Subversion for source control and up until now I had just been using TortoiseSVN for interacting with the source control repository. 

    CruiseControl.NET needs the Subversion binaries since this is how it communicates with your Subversion repository (through svn.exe).  Finding just the binaries ended up being a particularly difficult task.  Eventually I figured it out… posting here for anyone else that also runs into this issue:

    1. Start here: Tigris.org – Getting Subversion
    2. Head down to the Windows section and click on the Tigris.org link:
      • image
    3. Look for the latest version MSI installer (at the time this post was written v. 1.6.6)
      • image
      • Name: Setup-Subversion-1.6.6.msi
    4. Run this installation app and you will get svn.exe installed on your machine.
      • On Windows Server 2008 64-bit the default install path will be:
        • C:\Program Files (x86)\Subversion\bin\svn.exe

    Hopefully this will help someone else in the future.

    EDIT (2011-01-25): Alec Taylor found up to date ones here:

    EDIT (2012-01-27):

    See http://nightlybuilds.tortoisesvn.net/  for instructions on the correct folder for the stable release.  The "latest" folder is the nightly build.

    Technorati Tags: ,


  • URL Authorization role service required for IIS7 system.webServer/security/authorization

    Why isn’t IIS7 authorization working in my asp.net website?  I was trying to secure a folder in my asp.net application using the IIS7 system.webServer/security/authorization configuration settings.  In the past you could do this through the ASP.NET configuration by adding an authorization section to the system.web section in your web.config.   But now with IIS7, you can use the new system.webServer/security/authorization section to specify authorization rules.  The benefit of system.webServer authorization over system.web authorization is that the former applies for all requests to that particular location, the latter only protects asp.net requests (requests that come through the asp.net pipeline).

    So, since I am developing this application on IIS7, I wanted to use the new IIS7 system.webServer authorization section to protect a particular folder.  To do this, I added the following section to my web.config file:

    <location path="admin">
      <system.webServer>
        <security>
          <authorization>
            <remove users="*" roles="" verbs="" />
            <add accessType="Allow" users="" roles="administrators" />
          </authorization>
        </security>
      </system.webServer>
    </location>

    and tested the url http://localhost/admin and… it didn’t work.  What should have happened is I should have been redirected to the forms authentication login page, but instead I was served the content under the /admin folder.  Not what I wanted; the /admin folder should now require an authenticated user and the forms authentication identity to be part of the administrators role.

    What is going on?!?!?  Everything looked correct.  I confirmed that IIS authentication was set correctly: anonymous and forms authentication only.  I confirmed that the system.web/authorization section was working.  I tried in multiple browsers to make sure it wasn’t a cookie or a caching issue.  Still I was left scratching my head… why were settings in the IIS7 system.webServer/security/authorization not getting picked up?

    Finally, with the help of Scott Forsyth, I checked the Server Manager IIS Roles that were enabled.  Server Manager > Roles > Web Server (IIS) > Add Role Services

    image

    image

    Notice that the URL Authorization role service is not installed. 

    image

     

    That was it.  IIS7 did not have the role service installed so it was not understanding that section of the web.config file.

    After installing the IIS URL Authorization role service, a request to http://localhost/admin redirected to the forms authentication login page and required a user that was in the administrators role.



  • CruiseControl.NET Configuration Reference

    For some reason it is very difficult for me to find the CruiseControl.NET configuration reference online.  Most of the time I end up on an older reference which is out of date and just not correct. 

    This is the CruiseControl.NET reference that appears to be up-to-date:

    CruiseControl.NET Configuration Reference 
    http://confluence.public.thoughtworks.org/display/CCNET/The+CruiseControl+Configuration+Block

    On the bottom of each page is a list of the children for each configuration block and at the top is the breadcrumb for how far you have drilled down into the tree.

    image

    image

    And then you can view the full CruiseControl.NET configuration hierarchy here.

    This blog post is mostly for me but also, if I am having a tough time finding the reference then I imagine a lot of other people are too.



  • Prevent CruiseControl.NET error “Source control operation failed: Working copy locked svn”

    My CruiseControl.NET build system was running into an error whenever two projects were trying to build at the same time.  Both of these projects try to go out to our subversion source control repository and one will win and the other gets locked out.

    The build will then fail with this type of error:

    ThoughtWorks.CruiseControl.Core.CruiseControlException: Source control operation failed: svn: Working copy 'XXXX' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) .

    To get around this issue you can use the “queue” attribute of the project node:

    image

    Here is the Thoughtworks CruiseControl.NET Project configuration reference section: http://confluence.public.thoughtworks.org/display/CCNET/Project+Configuration+Block

    Originally I did not set a queue value for each project that is built.  The default in this instance is the project name, so each project ends up in its own queue and therefore they will build as soon as possible and cause the locking error.

    From the Thoughtworks reference:

    queue 
    The name of the integration queue that this project will use. By default, each project runs in its own queue. (Added in CCNet 1.3) 

    So by setting the queue for each of the projects to the same value (since all of the projects are related), each of them will wait and build one at a time, resolving the “Source control operation failed: svn: Working copy 'XXXX' locked svn” error.

    Note: You can also set the queuePriority to indicate the order the project should build when it is in the queue.

    This StackOverflow post lead me to this solution: How can I prevent concurrent builds in CruiseControl.NET?



  • Handle the button click event from an ASP.NET ListView control

    Here is how you can handle the event of a button from within an ASP.NET ListView control.

    Add your button to the ListView Template like you would any other control:

    <asp:ListView ItemPlaceholderID="Test" runat="server" ID="ListView1" >
        <ItemTemplate>
            <asp:Button runat="server" Text='<%# Eval("MyProperty") %>' CommandArgument='<%# Eval("MyProperty") %>' /><br />
        </ItemTemplate>
    </asp:ListView>

    image

    And then handle the ListView.ItemCommand event in your code:

    image

    That is really all there is to it.  The ListView will bubble up the Button’s click event to the ListView_ItemCommand event handler and then you can handle it there.  You can also use the CommandArgument property to send button specific data, such as the particular ID of the row or item that the user clicked the button for.

    This call also be used on some of the other databound controls such as the ASP.NET Repeater.

     

    Full Example Code:

    ListViewButtonExample.aspx:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ListViewButtonExample.aspx.cs" Inherits="ListViewButtonExample" %>
    <html>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ListView ItemPlaceholderID="Test" runat="server" ID="ListView1" >
                <LayoutTemplate>
                    <asp:Literal runat="server" ID="Test"></asp:Literal>
                </LayoutTemplate>
                <ItemTemplate>
                    <asp:Literal runat="server" Text='<%# Eval("MyProperty") %>'></asp:Literal>
                    <asp:Button runat="server" Text='<%# Eval("MyProperty") %>' CommandArgument='<%# Eval("MyProperty") %>' /><br />
                </ItemTemplate>
            </asp:ListView>
            <asp:Literal runat="server" ID="Literal1"></asp:Literal>
        </div>
        </form>
    </body>
    </html>

    ListViewButtonExample.aspx.cs:
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.Security;
    using System.Collections;

    public class MyObject
    {
        public String MyProperty { get; set; }
    }
    public partial class ListViewButtonExample : System.Web.UI.Page
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            ListView1.ItemCommand += new EventHandler<ListViewCommandEventArgs>(ListView1_ItemCommand);
        }

        void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Literal1.Text = "You clicked the " + (String)e.CommandArgument + " button";
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                List<MyObject> col = new List<MyObject>();
                col.Add(new MyObject { MyProperty = "test 1" });
                col.Add(new MyObject { MyProperty = "test 2" });
                ListView1.DataSource = col;
                ListView1.DataBind();
            }
        }
    }

     

    Technorati Tags: ,


  • IIS7 Search Engine Optimization Toolkit does not like HTML5 Doctype

    The IIS7 Search Engine Optimization (SEO) Toolkit is an awesome tool to review your site and indicate any problems with the html that may cause search engines not to index your website properly.  Check out Scott Guthrie’s post on the IIS7 Search Engine Optimization Toolkit or you can download it from the IIS website at the tool’s home: IIS7 SEO Toolkit.

    But I ran into an issue with the tool the other day where it was not returning the proper results.  I ran it against a website I was working on and it only crawled one page and returned results that were just not correct:

    image

    The errors: “The title is missing.”, “The description is missing.”, and “The <h1> tag is missing.” were incorrect since I had all of those on the home page of the site I was testing, but also it was curious that it was not crawling any other urls off of that home page.

    AND the content tab even showed all of these things in the html that the tool had retrieved:

    image

    Eventually I was able to track it down to using the HTML5 Doctype tag:

    <!DOCTYPE html>

    The HTML5 document type is not official yet but I have gone ahead and started using as recommended by many developers but apparently the IIS7 SEO Toolkit does not like this doctype yet.  Temporarily I switched it to another doctype:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

    And the SEO Toolkit worked as expected.  Just a heads up for any other developers that run into this when using HTML5 DOCTYPE.

    UPDATE (2009-12-07):

    Dave Cox added a comment about it not being the HTML5 DOCTYPE per say but the whitespace that comes before it.  Having a line of whitespace AND the HTML5 DOCTYPE causes the IIS7 SEO Toolkit not to read the content correctly.

    Bad:
    image

    Good:
    image

    I am using ASP.NET MVC in this project so that means my master page will look like this; the DOCTYPE declaration on the same line as the Master page directive:

    image