Jeff Widmer's Blog
ASP.NET, ASP.NET MVC, C#, VB.NET, IIS7, Windows Forms, VB6, ASP 3.0
-
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).
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 processInstant 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
-
AspAlliance.com Sample Chapter: ASP.NET AJAX in Action
http://aspalliance.com/chapters/book.aspx?isbn=1933988142
There is a new sample book chapter available on the AspAlliance sample book chapters website (http://aspalliance.com/chapters/).
ASP.NET Ajax in Action
by Rama Vavilala, David Barkol, Alessandro Gallo
http://www.amazon.com/gp/product/1933988142Chapter 2: First steps with the Microsoft Ajax Library
From Chapter 2:
"In the age of Ajax programming, web developers need to be more JavaScript proficient than ever. You must accomplish a long list of tasks in an Ajax-enabled page and coordinate activities on the client side. For example, you need the ability to access server resources, process the results quickly, and maintain smooth webpage interactivity. The need for programming patterns that build robust and maintainable code is also on the rise. In a nutshell, a consistent client-side programming environment that works on all modern browsers is essential.
This chapter is the first one dedicated to the Microsoft Ajax Library, which is written on top of JavaScript and constitutes the client portion of the ASP.NET AJAX framework. In the tour of the basic framework components in chapter 1, you began to write code using the library's syntax. This chapter will provide more examples and give you a comprehensive overview of the library's features."The sample chapter is available for download here:
And you can buy the book from Amazon here:
http://aspalliance.com/chapters/book.aspx?isbn=1933988142
http://www.amazon.com/gp/product/1933988142Thanks,
-Jeff -
Clip Command
-
AspAlliance.com Sample Chapter: Visual SourceSafe 2005 Software Configuration Management in Practice
http://aspalliance.com/chapters/book.aspx?isbn=1904811698
There is a new sample book chapter available on the AspAlliance sample book chapters website (http://aspalliance.com/chapters/).
Visual SourceSafe 2005 Software Configuration Management in Practice
by Alexandru SerbanChapter 3: Creating a Service-Oriented Application
The sample chapter is available for download here:
http://aspalliance.com/chapters/book.aspx?isbn=1904811698 -
Internet Explorer and Office Documents - SysFader: iexplore.exe - Application Error
I was getting the error below from Internet Explorer when I would try to open a Word Document (or any other Office document) through Internet Explorer. Apparently this is because I have a mized Office environment. I installed OneNote 2007 but the rest of my Office (Word, Excel, Outlook, etc.) is Office 2003. As mentioned in this post http://biztalkdev.com/blogs/paulwu/archive/2007/03/09/IE7-Crash-when-accessing-MOSS-2007.aspx renaming the OWSSUPP.DLL found here:- C:\Program Files\Microsoft Office\Office12
to another name will solve the problem.
-Jeff---------------------------
SysFader: iexplore.exe - Application Error
---------------------------
The exception unknown software exception (0xc06d007f) occurred in the application at location 0x77e55e02.
---------------------------
OK Cancel
--------------------------- -
IPSwitch WS-FTP Pro and IE7 on Windows Server 2003
Finally figured out here to get IE7 and WS-FTP Pro to work together on a Windows Server 2003 machine.
http://www.ipswitch.com/forums/shwmessage.aspx?ForumID=6&MessageID=19504
It appears the WS-FTP install includes an old version of psapi.dll. Renaming that prevents the "Never" dialog from appearing.
-Jeff
-
AspAlliance Sample Chapter: Beginning Ajax with ASP.NET - Chapter 5: Data Communication: XML, XSLT, and JSON
http://aspalliance.com/chapters/book.aspx?isbn=047178544X
There is a new sample book chapter available on the AspAlliance sample book chapters website (http://aspalliance.com/chapters/).
Beginning Ajax with ASP.NET
by Wallace B. McClure, Scott Cate, Paul Glavich, Craig Shoemaker
http://www.amazon.com/gp/product/047178544X/ref=ase_jeffwids02-20/103-3784218-9431022Chapter 5: Data Communication: XML, XSLT, and JSON http://aspalliance.com/chapters/book.aspx?isbn=047178544X
And you can buy the book from Amazon here:
An important part of any type of distributed application is how data is pushed around between tiers or layers of the application. Additionally, with Ajax, several concepts are fairly important to know and understand, concepts involved with building distributed heterogeneous environments. Accordingly, in this chapter, you are going to look at:
XML - XML is Extensible Markup Language. It is primarily used for data interchange.
XSLT - XSLT is Extensible Stylesheet Language Transformations. XSLT is designed to take XML data from one format and put it into another format.
JSON - JSON is the JavaScript Object Notation. JSON is a lightweight data interchange format.The sample chapter is available for download here:
http://aspalliance.com/chapters/book.aspx?isbn=047178544X
http://www.amazon.com/gp/product/047178544X/ref=ase_jeffwids02-20/103-3784218-9431022Thanks,
-Jeff