Adsense

Tuesday, June 26, 2007

Vista, IIS7 & DotNetNuke - NullReferenceException at GetEnabledLocales()

Upgraded to Vista with IIS7 and started getting an error when trying to run an existing DotNetNuke ASP.Net project I've been working on.

Here's a snippet from the stack trace...

DotNetNuke.Services.Exceptions.PageLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Services.Localization.Localization.GetEnabledLocales()

Was able to figure this one out after playing with the IIS7 settings for a while. You need to update your IIS application to use a different application pool than the default. Right click on your application in IIS and select Advanced Settings. Under Behavior change the Application Pool from DefaultAppPool to Classic .NET AppPool.

That should clear up this issue for you.

Monday, June 25, 2007

Pandora's Box - Play Pandora minimized or in your system tray...

If you have read my post about iTunes vs Pandora, you'd know that I dig the new online service for streaming tunes at work. The only problem with the service, in my opinion, is that you need to leave a browser window open while listening...

I started to look for a solution to allow you to either minimize your Pandora or play it in your System Tray. I found a cool little app that lets you do just this. You even get a nice context menu from the system tray icon that allows you to issue commands to Pandora without having opening it.

Makes Pandora even better IMO! Check it out.

Installing Infragistics on Vista Ultimate with IIS 7.0

I just upgraded to Windows Vista this weekend and am trying to get my development box up and running. We us Infragistics in a couple of our ASP.Net projects and I'm finding that it's not quite as straight forward to install it on Vista.

I found a great site with a walk-through of how to setup your Vista and IIS to allows Infragistics to install correctly.

Basically you need to do the following...

  • Disable User Account Control (UAC)
  • Restart your machine
  • Edit the path of your IIS WWWRoot folder in the registry
    • Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\PathWWWRoot
    • Change "%SystemDrive%\inetpub\wwwroot" to "C:\inetpub\wwwroot"
  • Enable IIS 6.0 Compatibility in the "Turn Windows features on or off" section of the Programs menu (make sure to check all the child boxes)

That should allow you to get your infragistics installed on Windows Vista Ultimate and IIS 7.0.

Developing on Windows Vista

I recently took the plunge and installed Vista Ultimate on my Dev box. I'm sure this will have it's ups and downs, but on the bright side... It will most definitely spawn lots of blog posts.

I will be installing Orcas soon and playing around too. I will also be focusing as much as I can on WPF, WCF, and WWF, so I'm sure I will have a lot of fun stuff to blog about for the next few months (after I get back from my Honeymoon that is. Yay for Hawaii...!)

Wednesday, June 20, 2007

Oracle - Returning newly inserted row's primary key using "returning" keyword. Using a select statement instead of values and getting &q

This goes along with my last post. We were trying to use the returning statement to return the value of a newly inserted row when using an OracleDataAdapter and Parameter.Direction = ParameterDirection.ReturnValue. The difference is, we were using a select statement instead of values() as our input parameters.

Here is a simple example...

OracleDataAdapter oda = new OracleDataAdapter();
oda.InsertCommand = RemedyMD.CreateCommand();
oda.InsertCommand.CommandType = CommandType.Text;
oda.InsertCommand.CommandText =
"INSERT INTO users (name, email) (select name, email where firstName = :firstName) returning userID into :out";
oda.InsertCommand.Parameters.Add("firstName", OracleType.VarChar);
oda.InsertCommand.Parameters["firstName"].Value = firstName;

oda.InsertCommand.Parameters.Add("out", OracleType.Number);
oda.InsertCommand.Parameters["out"].Direction = ParameterDirection.ReturnValue;

oda.InsertCommand.ExecuteNonQuery();

When you try to execute this query, you will get an oracle error. ORA-00933: SQL command not properly ended. After researching this for a couple of hours trying to figure out how to get it to work, I found out that there is NO way to get it to work. Either you have to use Values() instead of your select statement, or perform a second statement to retrieve the newly created primary key value.

Oracle - Getting the primary key value of a newly inserted row using the "returning" keyword and an OracleDataAdapter

I learned how to use an OracleDataAdapter Parameter as an "out parameter" by setting it's direction = ParameterDirection.ReturnValue. Using this with an insert statement is a great way to return the primary key value of the newly inserted row.

Here is a simple example...

OracleDataAdapter oda = new OracleDataAdapter();
oda.InsertCommand = RemedyMD.CreateCommand();
oda.InsertCommand.CommandType = CommandType.Text;
oda.InsertCommand.CommandText =
"INSERT INTO users (name, email) VALUES (:name, :email) " +
"returning userID into :out";

oda.InsertCommand.Parameters.Add("name", OracleType.VarChar);
oda.InsertCommand.Parameters["name"].Value = userName;
oda.InsertCommand.Parameters.Add("email", OracleType.VarChar);
oda.InsertCommand.Parameters["email"].Value = userEmail;

oda.InsertCommand.Parameters.Add("out", OracleType.Number);
oda.InsertCommand.Parameters["out"].Direction = ParameterDirection.ReturnValue;

oda.InsertCommand.ExecuteNonQuery();

After executing the query, you can then pull the returned value out like this...
int  newUserId = -1;

if(int.TryParse(oda .InsertCommand.Parameters["out"].Value.ToString(), out newUserId)){

// Perform additional query that required the newly inserted row's primary key

}

It was fairly hard for me to find (google) this information, so I figured I'd post it in hopes that it would help someone else.

World of Warcraft /Played Total - Can you beat this...?

I quit playing World of Warcraft (WoW) a while back after playing off-and-on since release. I was determined to quit for good, so I actually canceled my account, logged onto my character and sold everything of value, sent it to a good friend who played and deleted all of my characters (mainly a decently equipped 70 rogue.) This astonished many of the people I work with who play WoW, and I thought the reactions I got were truly amazing (and hilarious.) At the time of my rogue's deletion, I think he had a /played in the high 40's (days.) That's a lot of time to have played a video game, even if it was over 2.5ish years... (p.s. I know that I could have sold my account for some decent $$, but I didn't really want someone else playing my toon. Call me crazy. =) )
Back to the point of this post... I have a friend (we'll call him Bob) that I went to school with, and now work with. Bob has played WoW since it was released on November 23, 2004, and continues to play to this day. Most people I know who have played WoW at one point or another got a single character to 60 (now 70) and then mainly played that character with a few sporadic alts here and there. Not Bob...
Bob has 11 character over the level of 60. That's fairly impressive and got me thinking. Just how much time has Bob spent playing WoW since releases. I asked him to get the /played totals on each of his characters so that we could add them all up. I asked a few people around the office to venture a guess at just how much time he's played WoW. I started it off with a guess of 250 Days played.
The rest of the guesses looked something like this...
250, 215, 190, 285, 280, 260, 260, 330, 150, 331, 332 DAYS played!
By this time, the rest of the office had gathered around in awe at our guesses. How could someone play a game "that" much...?
Here is what his characters and /played values look like...
Character # Level Days Hours
1 62 8 18
2 61 8 22
3 65 8 10
4 63 14 19
5 66 17 17
6 70 24 7
7 65 30 7
8 70 24 19
9 70 38 17
10 69 19 5
11 70 62 10
Totals 252 151
Interesting Information Based on these numbers!
Total Days Played: 258.29
Total Hours Played: 6199
WoW Release Date: November, 23, 2004
Date We Did This: June, 19, 2007
Total Days/Hours in between: 938 / 22512
% of time that Bob played WoW during this time: 27.54%
That means... In a span of about 2 years and 7 months, Bob was playing WoW about %27 of the time!
All I can say is... wow. Can anyone out there post more impressive numbers...? I know you guys are out there. The uber gamers!!! Hell, you might be reading this while raiding RIGHT NOW.... We want your numbers! =) Add a comment below...!

Thursday, June 14, 2007

iTunes radio streaming vs Pandora...!

I've been a long-time iTunes user (ever since I stopped using winAmp religiously a few years ago...) I have a ton of MP3s, an iPod, and have been a huge fan of streaming radio feeds while at work or home and not into anything I have in my playlist. There are a ton of stations to choose from, almost any genre, style, country of origin... You name it an you can probably find it on iTunes'...

I heard about Pandora a few months ago and just barely got around to trying it out. I must say, from the second I entered my first artist into Pandora, I've loved it. It started playing one of my favorite songs by that artist immediately and the sound quality was amazing. As I started to fiddle with the site, the power of the idea hit me. Not only play the songs and artists that I suggest to you, but infer what else I might like by my choices... Why didn't they have this years ago...?

If you really like or dislike a new song that comes up, click on the up or down thumb icon and it will update your preferences and modify what comes next... Pandora starts to learn what you like by your interactions with the site. Wether you're adding new songs or artists, or just rating the new stuff they throw at you, you are helping Pandora send you just the types of music you want to hear!

I've only been using the site for one full day now, but I'm already a fan... I've only loaded up iTunes once and that was to update my iPod for a workout. =) We'll have to see if Pandora takes over my streaming audio needs, and even pulls me away from my MP3s. What better way to be introduced to new artists and songs that you might love as much as your preferred artists...

You can even create new Pandora "Stations" which you can customize to a certain type or style of music. I have one for Hard & Fast, Soft & Chill, and Techno so far and can imagine quite a few more that I would want to listen to based on my mood...

If you haven't yet, check it out. =)

Virtual Stock Trading anyone...?

I've been participating in a company game of Virtual Stock Exchange (VSE) that we have running at my current employer. We have about 12 people in the game and it's pretty fun to see how everyone invests, and how well it pans out. If nothing else, it's good to get a better understanding of the markets.

The game is somewhat realistic because it's based off the market and only lags a bit behind. Josh and I setup an Open Game of VSE that anyone can join and participate in. If you're interested, come and create an account and invite your friends and family!

Use the information and directions below to join the game.

Game ID: ezcomeezgo
Game Password: ezcomeezgo

  1. Open this link and read the competition summary:
    http://vse.marketwatch.com/Game/StartViewGame.aspx?id=ezcomeezgo
  2. Click on the 'Join Game' link.
  3. If you are an existing Virtual Stock Exchange member, enter your Email address and Password in the login panel and get set to trade. If you are a new user, follow the link to register - it's easy!
  4. Follow the instructions and start trading!

Join now, and see if you can win my Open Game competition! The more participants the higher the level of competition.

Web Services, IDictionaries and Serialization... Oh My!

I have been building some .Net web services lately and created one that was trying to return a generic IDictionary. (IDictionary<int, int>) To my surprise and ultimate disappointment, I was presented with the following Server Error when trying to access my webservice...

"The type System.Collections.Generic.Dictionary ..<removed babble>.. is not supported because it implements IDictionary."

It looks like the XmlSerializer is unable to serialize objects that implement IDictionary. How annoying! I use a lot of generic dictionaries and it's a bit of a pain work around this XmlSerializer limitation. I was able to find a solution from this Aaron Skonnard post on the msdn site.

The solution shows you how to write a class that actually wraps your dictionary object. The values of your dictionary are copied to an array of serializable objects which are allowed to be passed through your web service and then deserialized on the other end. Pretty handy and worked really well in our solution.

Aaron warns that the IXmlSerializable interface is undocumented/unsupported feature of the .Net Framework and is subject to change at any time.

Tuesday, June 05, 2007

Apple announces new and improved MacBook Pro...!

The MacBook Pro gets a Face-Life (not that it needed one.) Apple announced that it's MacBook Pro line will be getting a boost with bigger processors, beefier graphics and more space for memory!

The new stats for the three models are...

  • A 15.4-inch version for $1,999
    • 2.2 GHz Intel Core 2 Duo
  • A 15.4-inch version for $2,499
    • 2.4 GHz Intel Core 2 Duo
  • A 17-incher for $2799
    • 2.4 GHz Intel Core 2 Duo

All versions of the new MacBook Pro can support 4GB of RAM instead of just 2GB like the last generation. The newly available video card is Nvidia's GeForce 8600M GT card. The upgraded processors are Intel's latest version of the Centrino, code-named the "Santa Rosa".

I find that I'm having a really hard time NOT being able to justify buying a MacBook Pro, and this new announcement makes that decision even harder! They are sexy, powerful, and have the ability to run both Windows and Mac operating systems. What's not to love...!?!

Friday, June 01, 2007

Firefox 2 - Saved Password Security

Do you use the "Remember passwords for sites" feature in Firefox 2...? It sure is nice to not have to enter your password into those pesky "secure" sites out there like your Banking, E-mail, or other such sites...
It's also great that I don't even have to enable this feature, it just prompts me to start storing passwords after I start using Firefox for the first time! Firefox is great! So lets just assume that the 2nd most popular web browser is appropriately handling this extremely sensitive data.
Or should we...?
How simple could it be for someone to get access to these stored passwords...? As it turns out, using Firefox's default settings (Which I'm sure MOST people are), it's EXTREMELY easy.
All a person needs to do to gain access to your stored passwords in Firefox, assuming that they have a moment's access to your workstation is to perform the following steps...
  1. Click on Tools
  2. Select Options
  3. Click the Security Tab
  4. Click Saved Passwords
  5. Click Show Passwords
This handy-dandy feature supplies the user with a list of web site addresses, user names, and Password (in PLAIN TEXT no less!) This gives a potentially malicious user direct access to everything that they need to find and log into any sites that you have setup to "Remember my Password"! The worst part about all of this is that this is the DEFAULT behavior in Firefox!
This, in my humble opinion, is a huge security flaw in Firefox and I'm blown away by how easy it is for people to unknowingly expose their user names and password to anyone with a few seconds access to their browser...
Posting this information is a double edged sword. On one hand, it alerts potentially "malicious users" to a way to gain access to your passwords. That is not my intentions. On the other hand, getting this information out to as many people as I can (and please help me ein this effort) should allow you to protect yourself from this vulnerability.
So, how can I protect myself?
In Firefox
  • Disable the "Remember password for sites" feature or Setup the "Use a master password" feature in Firefox! These can both be setup in the same place as the "Show Passwords" option listed above!
In General
  • Always lock your workstation when you walk away from it. I never assume that I can trust anyone with free access to my workstation, and I recommend that you do the same!

How to sort a generic IList<T>

Sorting a generic IList
I was trying to sort a generic IList<> and found a fairly simple way of doing it.
Step 1
You need to implement IComparable for the type contained in your IList. For this example I am going to use a simple Language Dto class.
public class LanguageDto : IComparable {
private String name;
public string Name { get { return name; } set { name = value; } }

public LanguageDto(string name) {
this.name = name;
}

#region IComparable Members
public int CompareTo(object obj) {
if (obj is LanguageDto) {
LanguageDto language = (LanguageDto)obj;
return this.name.CompareTo(language.name);
}
throw new ArgumentException(string.Format("Cannot compare a LanguageDto to an {0}", obj.GetType().ToString()));
}
#endregion
}

STEP 2

Sort your IList. To do this you will use the ArrayList.Adapter() method passing in your IList, and then calling the Sort method. Like so...

ArrayList.Adapter((IList)languages).Sort();
Note: languages is of type "IList<LanguageDto>"
Languages should then be a sorted list of your type!