Jeff Widmer's Blog

ASP.NET, Window Forms, C#, VB.NET, VB6, ASP 3.0
Machine Setup: Add Notepad to Send To Menu

I always customize my Send To menu to include Notepad.  Having notepad in the SendTo menu allows me to easily open any file and just view the contents in notepad.  Comes in handy when you do not want to load an application just to grab a config setting. 

image

In Windows Vista (and Windows Server 2008) the Send To menu can be edited by modifying the contents of the SendTo folder which can be found here:

C:\Users\[USERNAME]\AppData\Roaming\Microsoft\Windows\SendTo

Just drop a shortcut in there to notepad:

image

Now whenever you right-click on a file and choose Send To you will have the option of selecting Notepad.

-Jeff

Technorati Tags: ,,
Why does Visual Studio not resolve my CSS class names?

Whenever I was working in Visual Studio I always found that it would not resolve the css class names in my html.   The CSS Class names would appear with the green squiggly line in Visual Studio but then the page would render fine when viewing it in the browser.  

image

Also the Design View would never show any of the css styles.  But I have been working with Visual Studio since the very early days and rarely used Design View and since the CSS styles were not rendering it was just another reason not to use Design View. 

I always thought it was just the way Visual Studio worked. 

But recently I was trying to get intellisense to work with jQuery and I read this article by Jeff King: JScript IntelliSense FAQ

In particular I read point #4, third bullet:

Site-Relative Paths - These are paths of the form "/folder/file", and is calculated from the base of your site (http://site/application/folder/file).  This approach is supported by ASP.NET Web Forms and ASP.NET MVC.  However, it is not supported by Visual Studio.  The reason is because Visual Studio does not always know the final deployed location of your site and thus the path resolution cannot be guaranteed.  Given that quite we've seen few folks are using site-relative paths, we could consider making an assumption just resolving this type of path to the root of the project.  Given the risk that you may think your site is working when it's really not, I wanted to see how many people were supportive of this.

Notice the “[Site-Relative Paths are] NOT supported by Visual Studio”.  So this was the solution to why I was not getting intellisense in my javascript.  I always use site relative paths for my javascript files so I need to add this line in to get Visual Studio to find my javascript file:

    <script src="/content/jquery-1.3.2.min.js" type="text/javascript"></script>
    <% if (false) {%>
        <script src="../../content/jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
    <% } %>

So now with the “<% if (false) {%> ” Visual Studio will be able to find the javascript file which contains the intellisense information.

So now I have intellisense showing up in Visual Studio for javascript which is very nice but is not the point of this article.  What I realized is that Visual Studio cannot find any files in to a Site-Relative Path which includes CSS files.  So my CSS file which is referenced like this:

<link href="/content/default.css" rel="stylesheet" type="text/css" />

is not getting found by Visual Studio which now completely explains why I am getting the green squiggly lines in HTML view and why the Design View does not render as expected.  Applying the same fix in for Javascript intellisense to my CSS references:

    <link href="/content/default.css" rel="stylesheet" type="text/css" />
    <% if (false) {%>
        <link href="../../content/default.css" rel="stylesheet" type="text/css" />
    <% } %>

And now Visual Studio can find the CSS file and validate my CSS Class names exist (and Design View looks so much better too… I might start using it :) ): 

image

 

Stack Overflow Question: Why does Visual Studio not resolve my CSS class names?

 

Technorati Tags: ,,

Machine Setup: SourceGear DiffMerge

Another tool I always have on my development machine in SourceGear’s free DiffMerge tool (http://sourcegear.com/diffmerge/)

Not only is this the diff/merge tool from Visual Studio or SourceGear Vault but it also adds some very nice and useful context menus to Windows Explorer for being able to quickly compare two files (or folders):

SourceGear DiffMerge Context Menu

This comes in very handy and since it has a great price (free!) it is one of the tools that gets added to my machine at the beginning.

-Jeff

Machine Setup: OneNote Sort Pages Powertoy

I use Microsoft OneNote a lot for notes, tasks, projects, reference, etc.  One of the addins that I recommend for OneNote is Daniel Escapa’s Sort Pages powertoy

Just run the setup application that you can get from his blog, close and reopen OneNote, and you will end up with a new button in OneNote:

image

Clicking this will alphabetically sort the page in the current notebook.  (NOTE: As Daniel mentions in his blog there is no undo and no confirmation, so be careful when hitting this button.)

-Jeff

Technorati Tags:
Mindjet MindManager stops mouse from working

I recently upgraded my development machine to not only a new computer but also Windows Server 2008.  I also chose to go with Windows Server 2008 64-bit to take advantage of the 8GB RAM that my new computer can handle. 

The upgrade went very smoothly but over the weekend I discovered that one of my tools, MindManager 8, caused issues on my computer.  Installation of MindManager was no problem and activation with my license key also was successful but when MindManager went to open the first tutorial MindMap, my mouse stopped working.  I tried several different things to get my mouse functionality to work including closing MindManager and installing an updated mouse driver but nothing worked.  Whenever MindManager would open a MindMap the mouse would freeze and never come back.

Today I was able to find a work around.  Apparently this issue has to do with Tablet PC Input Service. Not exactly sure why but stopping and restarting the service will free up your mouse. Unfortunately you need to do this with each MindMap that you open.

  • Open MindMap
  • Mouse becomes frozen
  • Stop/Start Tablet PC Input Service
  • Mouse now works again

You can also use these commands from a command prompt window instead of the Services mmc (which really helps when your mouse is not working :D ).

net stop "tablet pc input service"
net start "tablet pc input service"

UPDATE (2009-05-18): Having the Hyper-V feature enabled causes this work-around not to work.  I had enabled Hyper-V and then my mouse became frozen again after opening a MindMap and stopping and starting the Tablet PC Input Service did not free up my mouse.  Not sure why and I did not look into what was going on but just turned off the Hyper-V feature and my work-around above works again.

UPDATE (2009-05-22): I have found that I do not need to stop and start the Tablet PC Input Service after opening each MindMap but only at first.  Right now my work-around at the beginning of each day is (yes, I shut my computer down each night :) ):

  • Open MindManager (which opens the startup mind map)
  • Mouse becomes frozen
  • Stop/Start Tablet PC Input Service
  • Mouse now works again
  • Open MindMap from MindJet Connect Workspace
  • Mouse becomes frozen
  • Stop/Start Tablet PC Input Service
  • Mouse now work again (and opening any other MindMaps will not cause my mouse to freeze)

Technorati Tags: ,,

-Jeff

Bringing TallComponents TallPDF, Microsoft ASP.NET Ajax, Amazon S3, and several other technologies together into Instant Church Directory Online

We recently finished developing and releasing the online version of our Church Photo Directory Software, Instant Church Directory. The idea behind Instant Chclip_image001urch Directory Online is to provide a user interface where you can easily create and update a PDF photo directory for all of your church members. We also took it one step further and include hosting the PDF for you.

Instant Church Directory came together very nicely over the past 4 months and everyone at Communication Resources did an awesome job designing and building the ASP.NET application. I am always interested in how an application of this scale is put together, so below are some of the technologies that power Instant Church Directory Online:

Amazon Simple Storage Service (Amazon S3) - http://aws.amazon.com/s3/
One of the technical design challenges that we knew we had to overcome was hosting and distribution of the church directory PDFs. We could have stored the PDF on our own servers but the costs for storage and bandwidth quickly would have gone out of control. With Amazon S3 we get pretty cheap hosting rates and the additional scalability and reliability features that Amazon uses to power its own websites. It was pretty easy to integrate Amazon S3 into our application and we used this Amazon S3 C# library by Affirma Consulting to help us out.

TallComponents TallPdf - http://www.tallcomponents.comclip_image002
Instant Church Directory on CD (the WinForms version of the product) also used TallComponents TallPDF component to generate the church directory PDF file and we took that technology and ported it to our online church directory engine. One of the great features of TallPDF is the ability to stream the PDF to a file through events (pull generation). This is necessary because with all of the pictures that will get included in each church directory PDF document, we could not store the entire PDF file in memory while creating it. So we use the event driven generation method to write each page of the PDF directory to a file as we are creating it. This gets it out of memory and into a file.

One other thing about TallComponents is their great customer support and fast response times. Asking a question or needing technical help gets a fast response from their ticketing system but also if you find a bug, it will get included in a new build within a couple of weeks. I also love the way they expose all of the feature changes for each version.

SWFUpload - http://www.swfupload.org

We wanted the Flickr image upload experience and so we used this SWFUpload component to give us that look and feel. SWFUpload creates a small Flash movie that is used to post one or more images to our website. The capabilities of the Flash movie along with some JavaScript gives us the progress information that we wanted our customers to see as they upload one or more image files. image


Javascript Image Cropper from http://www.defusion.org.uk/clip_image004
One of the technical challenges we ran into while designing Instant Church Directory was giving the user the ability to crop the image. We looked into several different technologies and models and in the end the best was the JavaScript cropper developed by Defusion.org.uk. This gave us a very responsive image cropper without a large component download.

http://www.defusion.org.uk/code/javascript-image-cropper-ui-using-prototype-scriptaculous/

CruiseControl.Net for automatic builds - http://ccnet.thoughtworks.com/
This is our first application to fully use an automated build and deployment system and we were thrilled with how this all worked and how much it sped up our deployment process. Hats off to Nimble Software Professionals for setting this up for us and getting us going with automated build and deployment.

Microsoft ASP.NET Ajax - http://www.asp.net/ajax
Many of our pages in the Instant Church Directory Online application are Ajax powered and we used Microsoft ASP.NET Ajax to build those pages. We wanted the same smooth transition when switching between individual list items that we had in our WinForms application and the ASP.NET Ajax UpdatePanel control gave us this ability quickly out of the box. I am not an expert with JavaScript so the UpdatePanel is an excellent control to easily get Ajax benefits into your ASP.NET web application.

aspNetPOP3 by Advanced Intellect - http://www.advancedintellect.com/product.aspx?pop3
We use the aspNetPOP3 component from Advanced Intellect to POP all of our customer service emails from our Instant Church Directory Mailbox. I highly recommend this component if you need to pull email from a mailbox through POP3 protocol. Also Advanced Intellect has great customer service if you ever have a question or need some development/technical help.

Orcsweb - http://www.orcsweb.comclip_image005
We have our servers hosted at Orcsweb and I can't say enough about the service and support of the entire Orcsweb team. Rick Barber, Steve Schofield, Jennifer Kurrus, Fredrick Cumbee, Desirée Harris, James Kehr, Pamela Dean, Jeff Graves, and Scott Forsyth (and others that I just don't see) all do an amazing job supporting us and keeping our servers up and running.

Camtasia Studio by TechSmith - http://www.techsmith.com/camtasia.asp
We used Camtasia to record all of our tutorial videos for showing how to use Instant Church Directory Online. Camtasia is an excellent screen recorder that is very easy to use to quickly produce a video. You can check out the tutorials that we created with it here:

Instant Church Directory Online Tutorials and Demos

I would love to hear any comments anyone has on the application - there is a 30-day free trial but unfortunately we do not have a demo account available to share.  Or post any comments/questions on any of the technologies above.

-Jeff
Chief Architect
Communication Resources

nvarchar(max) parameters need the size set to -1

SQL Server 2005 supports a new data type nvarchar(max). This is one of the new max datatypes that are to replace ntext, text, and image in a future version of SQL Server (according to SQL Server Books Online) but you should start using them now.

I recently used the nvarchar(max) data type for the first time in a stored procedure and I had some difficulty setting the parameter size in my C# code. I tried leaving off the size or setting it to the size of the string that was being passed to the stored procedure but none of these worked. Eventually I figured out that you have to set the size to -1 to get it to work.

Here is an example of how to create the SqlClient.SqlParameter:

System.Data.SqlClient.SqlParameter param;
param = new System.Data.SqlClient.SqlParameter();
param.ParameterName = "@Message";
param.SqlDbType = System.Data.SqlDbType.NVarChar;
param.Size = -1;
cmd.Parameters.Add(param);

Correcting Moire pattern interference when resizing images

The latest version of Instant Church Directory includes enhancements to the image cropping and resizing engine.  In particular, the previous version exhibited a Moire pattern (or zebra pattern) in certain photos when we were resizing or scaling the images.  

A Moire pattern in images is an interference pattern that creates artifacts in the image due to poor sampling (wikipedia: http://en.wikipedia.org/wiki/Moir%C3%A9_pattern).

For instance the picture on the left is the original photo of a person and their shirt.  The one on the right is the one from within Instant Church Directory (version 1.0) that exhibited the Moire pattern (or the zebra pattern).

image image

To fix this we needed to make sure to set the InterpolationMode to High Quality when manipulating the image using the System.Drawing.Graphics object.  There are several values you can set for the InterpolationMode with HighQualityBicubic being the best quality.

Graphics g = Graphics.FromImage(bmp2);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; g.DrawImage(OrignalImage, 0, 0, bmp2.Width, bmp2.Height);

I want to give a reference to this Code Project article - Image Resizing - outperform GDI+ by Libor Tinka that pointed me in the right direction to solve this problem.

Instant Church Directory 2008

Today we released an updated version of our Church Photo Directory Software, Instant Church Directory.  The new and/or updated features include:

    •    New pastor's page
    •    Improved photo-cropping engine and capabilities
    •    Unlimited number of activity pages
    •    Font sizing for the roster pages
    •    Improved installation process

Instant Church Directory is a WinForms application written in Microsoft .NET 2.0.  The idea behind Instant Church Directory is to be able to quickly create a photo directory for your church in just a couple of hours.  If you have ever tried to put together a photo directory for your church (or any other organization) then you will understand what an overwhelming task this can be - our goal is to make this simple for you. 

-Jeff
Chief Architect
Communication Resources

OneNote Shared Notebooks - Part 1: Windows Files Shares

David Rasmussen is starting a series of posts on sharing OneNote Notebooks.  Not only is this interesting for people who are setting up OneNote Notebooks for sharing in either a home or corporate environment, but the articles are chuck full of information on file sharing in general.  I am very interested for him to get to his second and fifth parts in the series (SharePoint and WebDAV).  At Communication Resources, we are using OneNote Notebooks to share all of our corporate information.  We are a 100% virtual company (no office building) with employees in 5 different states.  Currently we are storing our OneNote Notebooks in SharePoint but we are seeing some performance issues (I believe the upcoming Vista SP1 has solved these issues).  Overall, we absolutely LOVE OneNote and could not have developed our new Church Directory Software Application (Instant Church Directory) without OneNote.

 You can get to David Rasmussen's first part of his blog post series here:

OneNote Shared Notebooks - Options and Troubleshooting - Part 1: Windows File Shares

More Posts Next page »