Tuesday, April 29, 2008
CDBurnerXP
This one is new to me, but I don't burn as many CD's as I used to. Frankly, I'm cheap and I can't justify spending money on software that I'll use once every few years. If you're looking for a free CD Burner for Windows, check out CDBurnerXP.
Generic Caching in ASP.NET
If you run a website with a high number of visitors and are interested in learning more about caching, DaveTheKnave has put together a good article on Generic Caching in ASP.NET that is worth checking out.
Sunday, January 20, 2008
Introducing OpenProj
If you're looking for a free replacement for Microsoft Project, look no further. Available for Windows, Mac, Linux and Unix, "OpenProj is a free, open source project management solution."
Wednesday, September 26, 2007
Generate Random SQL Data
If you ever need random data for your SQL tables, be sure to check out http://www.generatedata.com/. Their random data generator generates transact SQL scripts that you can run to insert random data into your database. Other export formats are also available.
Tuesday, September 18, 2007
ASP.NET Login Control Remember Me Doesn't Work
I recently did a quick Google search for an issue I was having with the ASP.NET login control where the Remember Me feature of the control appeared not to be working as I had expected. I found a few hits on Google Groups where users were experiencing the exact same symptom, but nobody was getting an answer to their question.
First of all, I knew that the login control called the FormsAuthentication.SetAuthCookie() method to save the cookie, so I figured it must have something to do with the cookie expiring sooner than I wanted. Knowing that, I looked at the details of the cookie and noticed that it was set to expire 30 minutes in the future. So I did another quick Google search and found a great article on Forms Authentication. Sure enough, there is a section in web.config that is used to configure the authentication cookie, one of which is the timeout. I'd recommend reading that article, first, but this is the authentication section from my web.config with the cookie timeout configured for 30 days.
Hope that helps...
First of all, I knew that the login control called the FormsAuthentication.SetAuthCookie() method to save the cookie, so I figured it must have something to do with the cookie expiring sooner than I wanted. Knowing that, I looked at the details of the cookie and noticed that it was set to expire 30 minutes in the future. So I did another quick Google search and found a great article on Forms Authentication. Sure enough, there is a section in web.config that is used to configure the authentication cookie, one of which is the timeout. I'd recommend reading that article, first, but this is the authentication section from my web.config with the cookie timeout configured for 30 days.
<authentication mode="Forms">
<forms
loginUrl="Login/Login.aspx"
name=".ASPXFORMSAUTH"
protection="All"
timeout="43200"
requireSSL="false"
slidingExpiration="true"
cookieless="UseCookies"
enableCrossAppRedirects="false"
/>
</authentication>Hope that helps...
Tuesday, August 28, 2007
Comparing the Timer Classes in .NET
A few days ago, I ran into some issues with the timer that I was using in my Windows Service. As it turns out, not all timers in .NET are created equal. This article was able to give me some valuable insight that I was able to use to solve my problem.
Friday, August 17, 2007
How To: Disable Clear Type for Office 2007
It could be that I have something wrong with my eyes, but the ClearType fonts that Microsoft now uses for its new Office 2007 suite is incredibly painful to my eyes. If you would like to disable ClearType fonts in Office 2007 and/or have Office respect system settings, try the following:
That's it. Naturally, restart Office if it's already running, but you should notice that the Office 2007 suite now respects the system settings for font smoothing.
- Start -> Run -> Regedt32
- Navigate to the following key:
HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common - Add the following DWORD value:
"RespectSystemFontSmooth" - Set the value to 1
- Close RegEdit
That's it. Naturally, restart Office if it's already running, but you should notice that the Office 2007 suite now respects the system settings for font smoothing.
Friday, August 03, 2007
Programatically Add User to SharePoint 2007
There are a ton of articles out there detailing how to add a user to a SharePoint site; however, it's a struggle to find anything detailing how to perform the operation in a SharePoint 2007 environment.
It's important to note that if you're using multiple membership providers that this code will throw the following Exception "No mapping between account names and security IDs was done". To correct the issue, add "MembershipProviderName:" in front of the username. For example, "SqlMembershipProvider:senfo".
private static void AddUser()
{
try
{
using (SPSite site = new SPSite("http://test1"))
{
ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);
if (!profileManager.UserExists("senfo"))
{
UserProfile profile = profileManager.CreateUserProfile("senfo");
profile[PropertyConstants.WorkEmail].Value = "me@myaddress.com";
profile.Commit();
}
else
{
Console.WriteLine("User already exists...");
}
}
}
catch (UserNotFoundException err)
{
Console.WriteLine(err.ToString());
}
}It's important to note that if you're using multiple membership providers that this code will throw the following Exception "No mapping between account names and security IDs was done". To correct the issue, add "MembershipProviderName:" in front of the username. For example, "SqlMembershipProvider:senfo".
Tuesday, July 31, 2007
Extension Methods
This is the first in a series of posts that I will use to demonstrate some of the cool new features of the new C# 3.0 specification and Visual Studio 2008.
If you asked me, the two coolest new features of C# 3.0 are LINQ and Extension Methods. There have been a ton of articles demonstrating the power of LINQ, so I'll focus my first post on Extension Methods.
So what exactly is an extension method? In as few words as possible, it's a language feature that allows a developer to add new methods to existing types. And I see quite a bit of potential with this feature. For example, adding a SaveAsJpeg() method to the sealed System.Drawing.Bitmap class.
Just a little background so we can begin. An extension method must be declared in a static class, which makes a lot of sense when you think about it.
For demonstration purposes, let's create a static class called StringExtenstions that adds a Reverse() method to the string type.
And believe it or not, that's it. You have just added a Reverse() method to all string types within your assembly. And how do you use it? Good question. Just like you would had the String class always had a Reverse() method.
It should be noted that unlike regular methods, extension methods cannot access private members of the class that they are extending.
Stay tuned for more C# 3.0 goodness.
If you asked me, the two coolest new features of C# 3.0 are LINQ and Extension Methods. There have been a ton of articles demonstrating the power of LINQ, so I'll focus my first post on Extension Methods.
So what exactly is an extension method? In as few words as possible, it's a language feature that allows a developer to add new methods to existing types. And I see quite a bit of potential with this feature. For example, adding a SaveAsJpeg() method to the sealed System.Drawing.Bitmap class.
Just a little background so we can begin. An extension method must be declared in a static class, which makes a lot of sense when you think about it.
For demonstration purposes, let's create a static class called StringExtenstions that adds a Reverse() method to the string type.
public static class StringExtentions
{
public static string Reverse(this string str)
{
StringBuilder sb = new StringBuilder();
// Reverse the string
for (int i = str.Length - 1; i >= 0; i--)
{
sb.Append(str[i]);
}
return sb.ToString();
}
}
And believe it or not, that's it. You have just added a Reverse() method to all string types within your assembly. And how do you use it? Good question. Just like you would had the String class always had a Reverse() method.
string myString = "This is a test";
string reversed = myString.Reverse();
It should be noted that unlike regular methods, extension methods cannot access private members of the class that they are extending.
Stay tuned for more C# 3.0 goodness.
Sunday, June 03, 2007
Don’t buy an HDTV without reading this first
I was recently inquiring about the latest in HDTV technology and I came across a great HDTV survival guide that I thought others might find useful. Definitely worth a read if you're in the market for an HDTV.
Subscribe to:
Posts (Atom)
