Archive for the 'code' Category
Wednesday, February 21st, 2007
One way to speed up an ASP.NET application is to trim ViewState as much as possible. You can do it by turning off ViewState for controls which do not need it or to move the ViewState to the server-side by adjusting the Page State Persister. To keep an eye on your ViewState you can use the following link as a bookmarklet which will tell you the length of the ViewState for the current page.
ViewState Length [save this bookmark]
(more...)
Posted in asp.net, code, javascript, software | 1 Comment »
Thursday, February 15th, 2007
Due to my problems with copying large files over a USB 2.0 connection I created the SlowCopy Utility. (Offwhite.SlowCopy.zip) It is a command-line utility which takes a source and destination filename as well as an optional chunk size (MB) and wait time (seconds). I was able to copy that 2.6GB MSDN ISO file off my external drive successfully with this utility when a direct copy was failing after a few seconds. I did it with 100MB chunks with a 2 second wait. After 100MB it sleeps for 2 seconds which allows the buffer to clear before copying more data to the destination file.
(more...)
Posted in code, dotnet, hardware, software, tech | Comments Off
Wednesday, January 31st, 2007
There are some angry people out there who are upset about the decision by Yahoo to start restricting accounts on Flickr.com. Someone asked if there is a way to download their photos from Flickr. I happened to write a little software the other day to pull a Flickr feed and parse the output. This software just saves some of the photo information locally to display a gallery, but it could be modified to instead download and save the files. What I do not know how to get around is the limitation on the size of the feed. It seems it shows less than 20 photos at a time. If there is a way to get to all of the files for a given user id I would be able to find a way around this limitation.
Perhaps one way to help you make this work is to tag your photos with tags like set1, set2, set3 and so on and limit them to 15 per set. If you know a better way to do this, I would appreciate the tip.
(more...)
Posted in code, dotnet, software, tech, web | Comments Off
Friday, January 12th, 2007
I hit MSDN a lot to look up documentation. Since I typically use Firefox which does not have an MSDN option in the search box I wanted to create another quick way to search MSDN. Below is a bit of Javascript which you can save on 1 line as a bookmark. This is commonly called a bookmarklet. It will prompt you for your search terms and then take you to the results.
Search MSDN [save this bookmark]
Posted in code, javascript, microsoft, tech | Comments Off
Thursday, November 30th, 2006

Unit testing has caught as a part of the agile methodologies the past several years. It acts as a second line of defense against problems in a deployed environment with the first line being a successful compilation. For a few years now .NET developers have used NUnit to produce unit tests. It is a clone of the JUnit framework which was created for Java development.
Alongside your projects you can place a set of classes which carry specially marked classes and methods and validate that the compiled code conforms to the project requirements. In doing so, you can have the automated build ensure that a new enhancement or bug fix does not cause an unwanted side effect which breaks compliance. And these tests should be run early and often. The sooner you can discover an error the easier it will be to identify the change which caused it. The use of unit tests speed up the development process and also allow the development team to confidently make changes which may otherwise be considered too risky.
(more...)
Posted in code, msbuild, software, tech | 1 Comment »
Wednesday, November 29th, 2006
An ItemGroup in an MSBuild script defines a list or collection of items. These items are typically files. Often you may use a collection to define a static set of files which exist prior to the build running, but sometimes the build generates output files which are not. In the latter case there is a different approach you must use in defining an ItemGroup definition.
(more...)
Posted in code, msbuild, software, tech | 1 Comment »
Wednesday, November 29th, 2006
I have spent a good deal of time with MSBuild scripts the past couple of years as I have worked on various projects. As I have attempted to make these scripts bend to my wishes I have gradually improved the sample MSBuild script I carry along to each new project. In this series I will cover various ways to use MSBuild and include some tips on what you can do to make your scripts work better for you. But first, what is MSBuild?
The MSBuild utility was introduced with .NET 2.0 and is available with the runtime even if Visual Studio is not installed. It allows for build automation of most Visual Studio project types. Previously, a utility called NAnt was used as a build tool for .NET 1.1 which is modeled after Ant, a tool to build Java projects. The introduction of MSBuild as an official utility was very welcome among the development community as it provides close integration with the existing project and solution files created by Visual Studio. This close integration cuts down on the amount of detail necessary for the build scripts.
(more...)
Posted in code, msbuild, software, tech | 3 Comments »
Sunday, October 1st, 2006
Last week I had an exchange with Geoff over code formatting in a blog and suggested it could be done with Javascript. We both happen to run Wordpress for our blogs and I have also been looking for a way to insert stylized code into blog entries, so I helped him to put together a solution. Pretty soon we had a solution. Initially I suggested that it could be done with a bit of Javascript. He considered creating his own new script, but like any pragmatic developer, he looked and found an existing solution called dp.SyntaxHighlighter instead of starting from scratch.
To get the dp.SyntaxHighlighter working with Wordpress you have to handle a couple of details. First, assuming you have turned off the WYSIWYG edit mode, Wordpress adjusts your text by encoding certain characters (such as &, < and >) before sending it to the web browser. Second, Wordpress places break tags (<br />) at the end of each line. But Wordpress does have support to get around these details.
(more...)
Posted in code, css, javascript, software, tech | 1 Comment »