Subscribe | Alerts via Email
View All Quotes
“The most difficult part of requirements gathering is not the act of recording what the users want; it is the exploratory, developmental activity of helping users figure out what they want.”
-Steve McConnell
<October 2007>
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

©2010 Cal Zant
Sign In
Total Posts: 106
This Year: 5
This Month: 1
This Week: 0
Comments: 2

At my company, we use SourceSafe 2005 for source control.  It allows administrators to configure it to have one of the following check-out models:

  • Exclusive Check-Out Model: Lock-Modify-Unlock mode that only allows one user to modify a resource at a time.
  • Multiple Check-Out Model: Copy-Modify-Merge mode that allows multiple users to modify a resource at a time, after which a merge operation is performed at which point any conflicts between the changes can be addressed and resolved.  In my experience, the merge can typically be done automatically without any issues.

Although we usually only have two people working in the project at a time, there are still times when it would be convenient to allow both users to modify different sections of the file at the same time.  However, the few times we have done that one of the developers gets an error message the next time they try to build the solution that says "Access to the path _ is denied."  We didn't notice that this was the file that required the merge for a while, but finally pinpointed that to be the problem.

I found a blog post that explained the issue.  It turns out the "Include inheritable permissions from this object's parent" property of the merge files had been cleared.  If you simply re-check this property, the solution should build properly.  This is just seems to be a bug with the merge functionality in SourceSafe, and will hopefully be something they fix in the future.

Friday, October 19, 2007 1:23:45 PM (Central Standard Time, UTC-06:00)  # 

I use .netTiers as my data access and business logic layers in some of my web applications, and recently started using it on one that is hosted on a server I don't have access to.  .netTiers is based on the Enterprise Library, but allows you to choose which version you want to target.  I am targeting the latest version, Enterprise Library 3.1 (May 2007 release).  My application built and seemed to be working fine on my local machine, but when I tried to move the code out to the hosted server I got an error saying:

Security Exception
That assembly does not allow partially trusted callers.

After a little research, I figured out that the Enterprise Library runs at the "full" trust level out of the box, which is more than the company hosting my application would allow.  Like most major hosting services, they only allow applications to run under "medium" trust ... which is actually a good thing because it isolates your application from others that may be running on the same machine.  Medium trust applications also have no registry access, no event log access, no ability to use reflection, and file system access is limited to the application's virtual directory.

Fortunately, I did find a few "hacks" out there that allowed me to modify the library to run in "medium" trust environments.  I eventually built some new dll's for the Enterprise Library that I used to replace the ones in my application.  Even though the process was a little painful, I finally got it to work.  To save you from going through the same hassle, the link below will allow you to download the customized, medium trust dll files I built.  I bet if you are having a similar problem that the one I described, you can probably just copy the dll's you need over the ones currently in your application.

App Blocks bin Folder.zip (1.12 MB)

To generate those dll's I followed the steps listed below, which are a condensed version I found in this article.

  1. If you don't already have the Enterprise library installed, download and install the Enterprise Library 3.1 (May 2007 release).
  2. Make a complete copy of the EntLibSrc Enterprise Library 3.1 source code folder, and rename it to something like EntLibSrc-PartialTrust.
  3. Go to http://www.codeplex.com/ObjectBuilder/Release/ProjectReleases.aspx?ReleaseId=1613, download ObjectBuilder-1.0.51206.0-source.zip, and unzip it.
  4. Open the solution ObjectBuilder.sln from the root of your ObjectBuilder folder in Visual Studio 2005.
  5. Open the file AssemblyInfo.cs from the Properties folder of the ObjectBuilder project and add the line "[assembly: AllowPartiallyTrustedCallers()]" to the end of the code. (You'll also have to add a reference to the System.Security namespace).
  6. Right-click on the ObjectBuilder project in Solution Explorer and click Rebuild.
  7. Copy Microsoft.Practices.ObjectBuilder.dll from the EntLibSrc-PartialTrust\ObjectBuilder\ObjectBuilder\bin\Debug folder to the Enterprise Library folder EntLibSrc-PartialTrust\App Blocks\Lib, replacing the original signed version of the assembly.
  8. Open the solution EnterpriseLibrary.sln from the folder EntLibSrc-PartialTrust\App Blocks into Visual Studio 2005, and hit CTRL+SHIFT+H to open the "Find and Replace" dialog.  Set the following values:
    • Find what: <Reference Include="Microsoft.Practices.ObjectBuilder, Version=1.0.51206.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
    • Replace with: <Reference Include="Microsoft.Practices.ObjectBuilder, Version=1.0.51206.0, Culture=neutral, PublicKeyToken=null, processorArchitecture=MSIL">
    • Look in: [path]\EntLibSrc-PartialTrust (the full path to your copy of the Enterprise Library source files)
    • Include sub-folders: Yes (checked)
    • Look at these file types: *.csproj
  9. Click Replace All, and the matching files are modified.  VS will give you a few prompts, but just click "Reload" (and maybe "Discard" once) until there are no more alerts.  Click "Save All" from the File menu.
  10. Right-click on the Enterprise Solution entry at the top of the Solution Explorer window and click Rebuild.
  11. Navigate to the EntLibSrc-PartialTrust\App Blocks folder in Windows Explorer and double-click the batch file named BuildLibraryAndCopyAssemblies.bat.
  12. Copy the assemblies you need from the EntLibSrc-PartialTrust\App Blocks\Bin folder into your application's Bin folder.
Thursday, October 18, 2007 6:26:43 PM (Central Standard Time, UTC-06:00)  # 

This is a class I created to handle thumbnail generation and other typical image resizing tasks.  I think it is flexible and simple enough to be used in a variety of situations.  I will define the class and then give a couple of examples of how to use it.

public static class ImageProcessor
{
    /// <summary>
    /// Resizes the image located at the given originalRelativePath, making its longest side equal to the given maxSize 
///
(keeping it proportional), and then saves it to the location indicated by the saveToRelativePath parameter. /// </summary> public static void CreateThumbnail(string originalRelativePath, string saveToRelativePath, int maxSize) { Bitmap originalImage = new Bitmap(HttpContext.Current.Server.MapPath(originalRelativePath)); Bitmap newImage = CreateThumbnail(originalImage, maxSize);         
        FileStream thisFS = new new FileStream(HttpContext.Current.Server.MapPath(saveToRelativePath), FileMode.Create);
        n
ewImage.Save(thisFS, ImageFormat.Jpeg); originalImage.Dispose(); newImage.Dispose(); } /// <summary> /// Returns a Bitmap object that represents the image located at the given relativePath, resized so that it's
/// longest side is
equal to the given maxSize (keeping it proportional). /// </summary> public static Bitmap CreateThumbnail(string relativePath, int maxSize) { Bitmap originalImage = new Bitmap(HttpContext.Current.Server.MapPath(relativePath)); return CreateThumbnail(originalImage, maxSize); } /// <summary> /// Returns a Bitmap object (which is just a generic image object that isn't necessarily related to the .bmp
/// filetype) that is the
same image is the given originalImage, but scaled down to the given size. If it is
/// a vertical image the height would be equal to
the max size, and if it was a horizontal image the width would
/// be the maxSize ... but it always keeps the image proportional.
/// </summary> public static Bitmap CreateThumbnail(Bitmap originalImage, int maxSize) { float newWidth, newHeight; if (originalImage.Width >= originalImage.Height) { newWidth = maxSize; newHeight = (newWidth * (float)originalImage.Height) / (float)originalImage.Width; } else { newHeight = maxSize; newWidth = (newHeight * (float)originalImage.Width) / (float)originalImage.Height; } // Don't ever enlarge the picture ... if the user is trying to resize it to a size that is larger than
// the original, simply
return the same size image as the original with the border around it. if (newHeight >= (float)originalImage.Height || newWidth >= (float)originalImage.Width) { newHeight = (float)originalImage.Height; newWidth = (float)originalImage.Width; } Bitmap newBitmap = new Bitmap(originalImage, (int)newWidth, (int)newHeight); Rectangle recBorder = new Rectangle(0, 0, (int)newWidth - 1, (int)newHeight - 1); Graphics thisGO = Graphics.FromImage(newBitmap); thisGO.DrawRectangle(new Pen(Color.Black), recBorder); originalImage.Dispose(); return newBitmap; } }

You could call the code a variety a ways ... here are two examples or how it might be used:

string originalImagePath = Server.MapPath("/images/Original.jpg");
string thumbnailImagePath = Server.MapPath("/images/Thumbnail.jpg");
ImageProcessor.CreateThumbnail(originalImagePath, thumbnailImagePath, 300);

...

Bitmap thumbnail = ClassLibrary.ImageProcessor.CreateThumbnail(new Bitmap(thisFileUpload.PostedFile.InputStream), 50);
thumbnail.Save(thumbnailImagePath, System.Drawing.Imaging.ImageFormat.Jpeg);
Friday, October 12, 2007 8:15:06 AM (Central Standard Time, UTC-06:00)  # 

I have been a long time user of iTunes (started around version 3), and openly admit that in the past it has been a much better product than Windows Media Player and other media player applications ... at least for me.  But, a few weeks ago I heard Scott Hanselman mention in one of his podcasts, that iTunes has been on a downhill spiral since the release of version 7.  There are constant, sometimes daily, updates that prompt me download a new 50MB install file (not just a patch), and really 99% of the changes in those updates are for the new iPhone functionality that Apple thought would be a good idea to tightly bind to iTunes.  But those aren't the only issues. 

I can't remember the native burning software in iTunes ever working on my Dell Precision M90 laptop.  I have read some forum posts that said Apple simply doesn't have 64 bit drivers yet.  Whatever the reason, after I installed iTunes on a clean machine I got an error saying:

iTunes was not property installed. If you wish to import or burn CDs, you need to reinstall iTunes.

There is a 64 bit driver available from Gear Software that I was able to download and install, and it fixed this issue.  However, from that point on every time I opened iTunes I got the error message shown below:

iTunes cannot locate the CD Configuration folder, so you cannot import or burn CDs

After searching and reading a few more forums, I figured out this folder was "missing" from C:\Program Files (x86)\iTunes.  I don't usually make it a habit to go in and delete random folders from the Program Files directory ... so I am thinking this folder was never really there.  Luckily, I had a friend who was able to make a copy of his "CD Configuration" directory from one of his machines.  I copied it into the iTunes directory, and viola ... no more error messages, and CD ripping and burning actually work in iTunes.  You can download a copy of that folder here.  Thanks for the painful process Apple.

Tuesday, October 09, 2007 1:51:16 PM (Central Standard Time, UTC-06:00)  # 

I struggled with this error message for quite some time on one of my home computers.  When I tried to install some software like Adobe Reader or iTunes, the installation would fail and show me a popup alert saying "Invalid Drive: P:\".  This was really frustrating, because it was keeping me from installing some programs I really needed.  

I originally mapped the P: drive to the shared "Pictures" folder on my Windows Home Server (which is very cool by the way), and also changed the "My Pictures" folder for all users to point to that drive instead of the default location.  I did this so everyone would access and store pictures in the same place, and that would be on the Home Server which I had set up to have raid-like fault tolerance (can't loose those pictures).  Since that time I figured out a different way to do this, but although I had disconnected or "unmapped" the P: there was still a key deep in the registry pointing to this location for "My Pictures" ... and that was causing the conflict.

To resolve the issue, all I had to do was go into the Registry Editor (run "regedit") and navigate to folder shown below (the path is shown at the bottom of the window).

Remove registry key referencing mapped drive

I just changed the value of the "My Pictures" key to point to the default location of "C:\Users\Cal\Pictures" ... and the next time I tried to install those programs everything went smoothly.

Sunday, October 07, 2007 3:57:14 PM (Central Standard Time, UTC-06:00)  #