A Regular Expression that matches CSS lengths

July 2nd, 2008

As a followup to my previous post, here’s a useful regular expression for selecting a valid CSS length. Read the rest of this entry »

A Regular Expression that matches CSS colors

February 28th, 2008

Recently I needed to have a Regular Expression which would match valid CSS colors. After searching the Internets for a while, I concluded that one didn’t exist. So, here’s one that I wrote!

Read the rest of this entry »

Loop through an associative array in JavaScript

January 10th, 2008

Looping through an associative array in JavaScript is straight forward, but does have some catches. You will want to use a for (...in...) loop. This will iterate through every property in the array. In fact it will even treat array.length as a property. To loop through only the elements within the array, you can do something similar to this:

for (var name in associativeArray) {
if (name != "length") {
// Code that interacts with associativeArray[name]
// name will contain the index for each property
}
}

This can also be useful for iterating through all of the properties within an object. Firefox additionally supports iterating through an array using the each keyword like so:

for each (var object in associativeArray) {
// object now contains the actual item and can be directly used.
}

In this case, you do not need to worry about picking up the length property.

Mindy’s Stir Fry

December 19th, 2007

Stir Fry
My wife started to make this dish a while ago. Ever since I’ve begged her to make it as often as possible. It is really good, very simple, and quick to make. This recipe will feed about three people, goes well with rice or noodles, and takes about 30 minutes from start to finish.

Ingredients

  • Stir Fry Veggies - Get enough to fill a wok 3/4 full
  • 1 tbsp. Cornstarch
  • 1/4 Cup Soy Sauce
  • 2 tbsp. Vinegar
  • 3 tbsp. Brown Sugar
  • 1 tsp. Garlic Powder
  • Pineapple Chunks - Keep some of the juice (Optional)
  • Worcestershire Sauce (Optional)

Directions
Begin by cooking the veggies. Depending on how crisp you want them will determine how long to cook them for. Next stir together the cornstarch and soy sauce in a separate cup and then add it to the wok. Add the vinegar, brown sugar, and garlic powder directly to the wok and stir together. If you would like a sweeter or richer flavor, add some pineapple chunks with some juice or Worcestershire sauce. Bring to a boil and serve!

ASP.NET Application, Page, and Control Life Cycles

December 14th, 2007

ASP.NET
About every other week I will need to know something about the life cycle of an ASP.NET page and for some reason it takes me a while to find it on the Internets. Below I’ve added an ordered list of the events which fire during the life cycle of an ASP.NET Application, Page, and Control. And then as a bonus I’ve included an image which shows most of it courtesy of Leon Andrianarivony. Enjoy!

Read the rest of this entry »

How to hide a user account from the welcome screen in Vista

December 11th, 2007

Vista Login

There is a special list in the registry which you can use to prevent user accounts from appearing on Vista’s welcome screen. To add a user account to this list, open the registry editor (regedit.exe) and navigate to:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList]

If SpecialAccounts or UserList does not exist, create it. Create a DWORD registry value for the name of the user that you want to hide and name it the same as the user. Make sure it is set to 0, which will flag the user as being hidden on the welcome screen. If you set it to 1, then it will be visible.

And that’s it!

How to fix broken project references in Visual Studio

December 6th, 2007

Visual Studio

The Problem
Lately I’ve been experiencing some frustrating problems with references to DLL files in a Visual Studio solution. Since I’m working with a team of other programmers, we are obviously using a code versioning system—in this case SourceSafe. It seems that nearly every time I “get the latest version” of the solution from SourceSafe and then try to build it, I will get errors with references to missing DLLs. However, the “missing DLLs” actually exist. The problem is that the references to these DLLs within the solution are wrong.

Because each of the other programmers have a different path to their own copies of the same solution, they also have different paths to the DLLs that are included in that solution. One programmer will notice that his stuff isn’t compiling, he’ll fix the reference error, check it in, and then simultaneously break it on all the other programmers’ machines (Or at least all those will a different file structure).

The Fix
To fix it, you’ll want to use “Reference Paths” within Visual Studio:

  1. In Solution Explorer, right-click your project node and click Properties. The Project Designer should appear.
  2. If you are using Visual Basic, select the References page and click the Reference Paths button. In the Reference Paths dialog box, type the path of the folder that contains the DLL that you want to reference in the Folder field, then click the Add Folder button. If you are using C#, select the Reference Paths page. In the Folder field, type the path of the folder that contains the item you want to reference, and then click the Add Folder button.

That’s it! Reference Paths are saved within each user’s own profile, so they will not be propogated to the other SourceSafe users when you check in your files. When you build a solution, Visual Studio will first try to find the DLL with the hardcoded path that is provided within the solution. If it can’t find it, then it will look within the Reference Paths for the file, where you should now have the correct reference to the DLLs.

References:
http://msdn2.microsoft.com/en-us/library/ayds71se(VS.80).aspx

Orange Dijon Chicken Cordon Bleu

November 17th, 2007

This classic recipe for a main dish is easy, uses common ingredients, and takes about 30 minutes to make. It serves 4 people and goes well with rice or noodles.

Ingredients

  • 4 Chicken Breasts
  • Thinly Sliced Ham
  • Mozzarella Cheese
  • Olive Oil
  • 1 or 2 Cans of Cream of Chicken
  • 1 Cup of Orange Juice or some Lemon Juice
  • Sage
  • Mandarin Oranges

Directions
It is best to work with semi-thawed chicken breasts. Cut a large pocket into each chicken breast. Fill with a slice or two of ham and a few slices of mozzarella cheese. Pour oil into a large cooking pan or wok. Brown the stuffed chicken. Then add a can of Cream of Chicken soup. Add a second if you like extra sauce. Next add the cup of orange juice. If you don’t have any, lemon juice makes a good substitute. If you’re using lemon juice, don’t put nearly as much in. Add in a liberal amount of sage. Bring this to a boil. Once it is boiling and thoroughly cooked, add the mandarin oranges and serve.