What could cause this casting error?#

Error:

Unable to cast object of type 'System.Collections.Generic.List`1[EditQuoteController+UnsavedQuoteItemInfo]' to type 'System.Collections.Generic.List`1[EditQuoteController+UnsavedQuoteItemInfo]'.

Yes, you read that right.  Unable to cast object of type X to type X.

I have seen this type of error once before and it was when there were multiple assemblies referencing different version of a common assembly, so even though their names were the same, their versions were different.

But in this instance there is nothing like this that could be having an impact.  All of the classes of consequence are in the same assembly.

Also, I don't get exception very often, only every now and then.

UPDATE:

I think maybe this is happening between builds on my development machine b/c I am storing some data in the session.  So the version in session was from the last build?  Doesn't sound like a great explanation, but it's the best I have at this point.

UPDATE 2:

I am pretty sure that what I wrote in the last update is what is actually happening. 

I used this code:

Try
    list = CType(view.Session.Item(Me.UnsavedKey), List(Of UnsavedQuoteItemInfo))
Catch ex As System.InvalidCastException
    Dim sError As String = "Unable to cast from type " & _
        view.Session.Item(Me.UnsavedKey).GetType.AssemblyQualifiedName & _
        " to type " & GetType(List(Of UnsavedQuoteItemInfo)).AssemblyQualifiedName & _
        ".  The session has been cleared."
    view.Session.Item(Me.UnsavedKey) = Nothing
    Throw New System.ApplicationException(sError)
End Try

Which producted the following 2 types:

System.Collections.Generic.List`1[[EditQuoteController+UnsavedQuoteItemInfo, App_Web_bp-bbqew, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=2.0.0.0, Culture=neutral PublicKeyToken=b77a5c561934e089

System.Collections.Generic.List`1[[EditQuoteController+UnsavedQuoteItemInfo, App_Web_ve7ziow-, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. 

I am guessing this is a by product of using the web site project, instead of web application project.  There are some other reasons why we wanted to use web site instead of web app on this project, so you don't have to scold me: we made the right choice.

But it seems that every time I make a change to the project, it creates a new dynamically named assembly.  So even though the classes are really the same, they are globally different as far as asp.net is concerned.

 

Categories:  |  |  | 
Monday, January 14, 2008 3:14:02 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Validate XML Against A Schema Online#

Have you ever wanted to validate an xml document against a schema, but didn't have any applications at your disposal to do it?

You can use the schema validate tool on decisionsoft.com:

http://tools.decisionsoft.com/schemaValidate/

You upload a schema and an xml doc, and it will attempte to validate the xml against the schema.

Categories:  | 
Monday, January 14, 2008 8:58:18 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Using Redirects The Right Way For SEO#

Rob Howard has a nice article on how to use the 301 redirect (permanent redirect) in order to get search engines to spider the new page, as opposed to just using Response.Redirect, which will send a 302 (temporary redirect) to the client.

Categories:  |  | 
Thursday, January 10, 2008 2:49:33 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

WebAii Website Automated Testing Framework#

I am always on the lookout for better and easier ways to automate testing of my applications.  Mostly, this stems from my teams not being too keen on implementing testing, so the easier I can make it, the easier it will be to convince others to write tests.

So Phil Haack has suggested a free framework called WebAii, and after taking a quick look, it looks promising.

It supports some nice features like mouse/keyboard actions for Ajax testing, and dom actions (find an element and click it, or whatever).  It also supports unit testing your javascript functions by having your test call the functions.  It also integrates with Nunit.  Nice!

Hopefully I can find some free time (HAHAHHAAH) when I can test this out more in a project.

 

Categories:  |  |  |  | 
Thursday, January 10, 2008 1:55:44 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Why is VZ Access Manager Screwing With Me?#

Since moving from my old Rev 0 Verizon card, to the new Rev A built in EVDO card in my new Lenovo laptop, I have had a lot more problems with my service.

It could be that with my old setup, I could simply tell the network adapter to connect and it would take care of dialing out and setting up the connection.  In other words, I didn't have to go through VZ Access Manager.

But now, I am forced to use VZAM, and I have to say, I think it pretty much sucks.

In the last 10 minutes, here are 2 wonderful issues I have run into:

I have had this several times recently... my friend Pete who works a lot with this stuff told me that Error 913 ... "It basically means that Verizon is stupid and can't figure out if it should let your account login."

Usually I just keep trying and eventually I get allowed to login and connect.

The other cool thing that has happened a few times recnetly is that it changes my connection to "dormant" even though I am clearly not dormant (actively using the internet).

 

 

So while it is "dormant" I basically can't transmit any data, and it sometimes will not even let me disconnect and try reconnecting.

I don't have any solutions to these problems, but they are very frustrating.

In 2 years, WiMax should be fully rolled out in Chicago, so I look forward to trying another product, but in the mean time, I am stuck with VZW.

 

Categories:  | 
Tuesday, December 25, 2007 8:51:19 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Calculate the Total#

We all know ticketmaster is the leader in screwing people when it comes to buying tickets.  You want 4 $28 tickets?  Ok, that will be $165.  What?

Well, I just got done booking a flight on ATA:

Base Fare Per Passenger: $238.00
Taxes and Fees Per Passenger: $102.50

Yes, the taxes and fees are over $100 per ticket!

Here are some other fees that some airlines apply AFTER you have finished comparing which airline to use (which tickets are cheapest):

$2.50: U.S. security tax ("the Sept. 11 fee");
$4.50: U.S. passenger facility charge (Chicago O'Hare);
$14.50: U.S. international departure tax;
$24.23: U.K. passenger service charge;
$37.27: U.K. air passenger duty;
$14.50: U.S. international arrival tax;
$5: U.S. customs fee;
$7: U.S. immigration fee;
$5: U.S. Department of Agriculture inspection fee;
$130: United Airlines fuel surcharge.

$130 fuel surcharge???  Gimme a break.

 

Categories:  | 
Tuesday, December 04, 2007 1:12:13 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Free Flyout and Alternating Panel Controls#

These are some nice looking, cross browser compliant, ASP.NET based, free controls from Obout.com

Flyout can perform stuff like this:

But almost more interesting is how it can be used in conjunction with traditional controls.  For example, you can wire up a nice looking "Alt Text" effect for images and labels, and you can provide some nice explanation in the flyout for how to properly fill in a control.  The example they give on their site shows a textbox for "Routing Number" and when you click on the textbox it shows this in the flyout:

 

 

The alternating content control which is called "Show" (Show examples) can rotate through some content like so:

These are both free controls.  Very nice!

 

Categories:  |  | 
Friday, November 30, 2007 2:18:56 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

How To Strip Off the Time From DateTime (or Just Get The Date Portion)#

Every now and then I go to my blog to lookup something I wrote before only to find that I never posted it.

I would have bet someone $20 that I had posted something on how to strip off the time from a DateTime in SQL.  Why would you do this?

Well, lets say that have some autogenerated DateTime field (CreatedOn?) that you later want to join with another field, but the other field only knows the DATE when something happened, not the exact Date and Time.

So, you can use the following code to just get the DATE and zero out the time component:

SELECT CAST( CONVERT( CHAR(8), GetDate(), 112) AS DATETIME)

Categories:  |  | 
Tuesday, November 27, 2007 2:59:44 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Black Friday Success and Insanity!#

Being a computer guy, I used to go the Black Friday sales most years.  There was always something worth getting.  A cheap computer, a laptop, a DVD player, packs of CD-Rs, hard drives, DVDs etc.

But when you get out of college and are earning real money, the idea of saving a few hundred bucks isn't as big of a deal as it used to be.  So for a few years, I skipped the early morning sales in favor of sleeping in.

Before, we would usually get in line around 4am, with the stores opening at 6am.  If we showed up 2 hours before opening, we would usually be around 30-50th in line, which was usually plenty to get whatever we were after.

So this year when I saw that Circuit City was selling the Sharp Aquos 46" 1080p HD LCD flat panel TV for $1299 ($1200 off what they were asking before) I figued it would be worth trying to pickup one, as both my wife and I had agreed that we needed a new TV in our living room.

My first clue that things had changed was when I was driving home from Thanksgiving dinner at my aunts when I saw about 50-75 people already standing in line at the Best Buy by her house.  It was not even 9pm yet!!

INSANE!!  These people had tents out and fires going.  It was really really cold out, and these people were insane.

I drove past the Circuit City by my house, which only had 25 or so people in front of it, but still.... it was only 9:30!

I went home and did some research.  Circuit City was going to be passing out tickets for their most in demand items, which I figured would include the TV. 

 From most the posts online, it seemed that 3am might be when they come out with the tickets.  So, after some deep consideration, (and amazingly some encouragement from my wife) we decided to go (my wife does this stuff with me, she is really a keeper) at 2:45 am, stick around for (hopefully 15 minutes) to see if we would get one of the tickets for the TV.  If not, we would just go home and go back to bed.

So, at 2:25, after 2 hours of sleep, the alarm went off and we got up.  I put on a undershirt, 2 tshirts, a long sleeve shirt, a sweat shirt, a windbreaker, and a coat.  On my legs I had 2 pairs of sweat paints, some warmup pants and jeans.  But I only had 2 pairs of socks, so before it would be all over, my toes would be frozen, but the rest of me was nice and warm.

So we showed up at Circuit City at 2:50am to find a line of people 200 or so long.  It stretched across the entire Circuit City, across the parking lot, across the entire ALDIstore next to it before making a right turn and heading out 200 ft into the parking lot.

The store on the right is not Circuit City, it is ALDI.  Circuit City is 100 yards away behind the ALDI.

You can see in the picture above the entrance to ALDI in the background.  Circuit City is on the other side of the parking lot, out of view.  It's about 100 yards away.  Below you can see how far the line continued in the other direction.

In the other direction the line stretched the length of the parking lot. 

We talked with a few people, and it seemed that everyone was here for the TVs.  Great.... (not).  Kathleen convinced me to stick around for a little bit longer, but as time ticked on, it became clear that our plan of finding out our fate at 3am was not going to work out.

3:15, 3:30, 4:00... still nothing.

Then at 4:15 they started passing out the tickets.  Only a few items made it back to our place in line, and they were nothing I wanted.  We asked about the TVs, expecting to hear that they were all accounted for, but the guy said that they were NOT ticket items, and that we would have to go to the TV section and either find (if they were on the floor) or order one.

It was still not looking good, but Kathleen again convinced me to stay.  She had some things she wanted too, stuff like USB flash drives for her students and some The Office DVDs for her brother. 

So we waited till 5:00 with me taking a 5 minute break to warm up my toes in the car. 

When we finally got into the store, Kathleen managed to get in line before me in the TV section, so I went searching for her items.

I found 5 flash drives (the limit) and the DVDs she wanted, paid for them, and met her back in line that had formed in the TV section of the store.

It was now 5:30 or so, and she was getting pretty close to the front.  There were 2 people in front of her when we heard the guy tell the person that they got the last 46" Aquos TV.

I was pretty bummbed to hear this, not because I didn't expect it, but because we had come so close.

The guy behind Kathleen was beside himself, as he had been in line since 9pm the night before.  When he got into the store, they sent him to the wrong line to buy the TV, and he had to get back into line behind a lot of other people... that must have really sucked.

So I told her to ask about the 42", assuming that the 46" was gone.

However, the lady in front of us found out that they could "special order" the TVs from the warehouse inventory, so long as we paid the $70 for them to deliver it to our house. 

This was the best news I had heard all day!

We placed the order, but I was not going to celebrate until the TV was in the house.  I could see them pulling some kind of crap and trying to get out of honoring the sale if they ran out of inventory in the warehouse or something.

But, this morning they came rolling up with our new TV!

It looks great!

So the lessons I learned are:

1) Wear 3 pairs of socks

2) Black friday has gotten WAY worse the last 2 years

3) I am lucky to be married to someone who likes to go do these crazy things with me

 

Categories:  | 
Saturday, November 24, 2007 6:04:46 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Verizon EVDO Will Not Connect To Broadband Access#

On my new laptop, I had lenovo build it with a Sierra Wireless 1xEV-DO Network Adapter card built in to the laptop.

This means I should be able to access EVDO RevA "BroadbandAccess" basically across all of Chicagoland.  However, lately the VZ Manager software from Verizon has been only connecting me to the dialup-like "NationalAccess" and not the DSL like BroadbandAccess.  The signal shows that it is plenty strong, and I am using in the exact same places where I have used my old EVDO card, and even in places where my laptop worked at first.

This is so frustrating I can't explain it. 

I contacted Verizon, and of course they were no help.

So now I might end up in the situation of having to buy (and keep plugged in all the time) a pcmcia card for the verizon network, even though I already paid to have this functionality built into my laptop. 

This really stinks :(.

Categories:  | 
Friday, November 23, 2007 4:08:30 PM (Central Standard Time, UTC-06:00) #    Comments [1]  | 

 

VS.Net Macro Editor Errors#

When I try to edit some of my Macros I get this nice little message:

Microsoft Visual Studio Macros: An Add-In has caused an access violation while sinking on 'ProjectAdded'.

Google turns up nothing on this guy.

Does anyone out there have any idea how to fix this?

Categories:  |  | 
Monday, November 19, 2007 3:21:26 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

ASP.NET Application Not Reading The Web.Config File#

I recently ran into an interesting problem... my webservice application seemed unable to read info from the web.config file.

I tried adding some invalid < marks to the config file and the app still ran w/o any error (but still wouldn't read the web.config appSettings or connectionString sections).

So I created another IIS application and it worked as expected.

So I deleted the troubled IIS App and recreated it.  Still broken!

The solution was to clear out the ASP.NET Temporarly Files folder in c:\windows\...\...

Once that was gone, and I restarted IIS, everything went back to normal.

 

Categories:  |  | 
Friday, November 16, 2007 10:20:04 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Hey Windows Update, thanks for losing all my work.#

Last nigiht before I went to bed, I was working on a bunch of stuff.

Lots of files, tons of programs, all open to serve the task at hand.

So, at 3am, I was kinda up for some reason, but luck for me, that meant that I got to hear the sound of my laptop rebooting.

I almost got up to go check on it and make sure I wasn't dreaming, but sure enough in the morning I came down to find a login prompt.

Windows Updates on my new laptop. was set to automatically download and install updates at 3am.  Which is a good thing, unless the updates require a restart, which it will do wheather you want it or not.

So I had to turn off automatic updates for this reason, but this brings me to a bigger question.  Couldn't microsoft see this possability and give you and option to download/install but NOT reboot?

They already have a "feature" that is annoying as hell, that bugs you ever 15 minutes when you have installed a windows udpate that requires a reboot, but haven't rebooted yet.  They could just use that to make sure you DO reboot at some time.

Frustrating.

Update: Windows update rebooted my friend Mike's work desktop, even though he had it set to only download and not install updates.  So all those SQL Jobs that were running at the time.... yea they all got screwed up. 

 

Categories:  | 
Thursday, November 15, 2007 7:57:27 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Solution for "Thread was being aborted" exception when you call Response.End (or .Redirect)#

You've probably seen this one.

Whenever you do one of the following:

Response.End()
Response.Redirect("page.aspx")
Server.Transfer("page.aspx")

You end up with a ThreadAbortException, "Thread was being aborted".

I had previously dealt with this by swallowing the ThreadAbortException, which of course isn't a great method, but it worked.

Well today I came across a better way for all of these.

Replace This With This
Response.End HttpContext.Current.ApplicationInstance.CompleteRequest
Response.Redirect("page.aspx") Response.Redirect("page.aspx",false)
Server.Transfer("page.aspx") Server.Execute("page.aspx")
Categories:  |  | 
Tuesday, November 13, 2007 1:06:39 PM (Central Standard Time, UTC-06:00) #    Comments [1]  | 

 

Awk Tutorial and Regular Expressions#
Awk is a tool for processing text files, or data that is treated as text.

For some stuff I have been working on, I tend to use Awk a lot to filter down text being returned from another program (like a ls command).

Here is a nice tutorial on Awk.

Also, when using regular expressions (regexp, or regex) with Awk, here are a few helpful reminders and links.

. matches any character
* zero or more repetitions of the previous character or expression
? zero or one occurrence of the previous expression
+ one or more occurrences of the previous expression


Regexp cheat sheet.

Test regular expressions.

Regexp website (tutorials and more)

Another Regexp tutorial

Categories:  | 
Sunday, November 11, 2007 10:37:56 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Yahoo Music Influencers#

I was having problems getting streaming media to play on my old messed up laptop.

So now that I am finally on my new machine, I can again listen to launchcast (music.yahoo.com).

Launchcast was doing what Pandora Radio is doing, way before Pandora became popular.

Launchcast learns from your ratings and plays music it thinks you would like.  In addition, you can setup other users as "Influencers," which I have done with my brother who also users Launchcast.

So for example, when my brother ranks a song up, eventurally it will play on my station.

See this image for example:

Pretty sweet.

I love this service.  I have found so much music this way. 

 

Categories:  | 
Saturday, November 10, 2007 2:01:47 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

My Dark Theme for Visual Studio.Net#

I have been wanting to try a dark theme for vs.net, but I couldn't quit find one I liked.

So I took bits from here and from Scott Hanselman and created my own.

Take a look at some screen shots, and you can download the settings file at the bottom.

 

 

 

Here is my settings file:
Dark-Theme.vssettings (32.85 KB)

If you like this, please leave a comment!  Thanks.

 

Categories:  |  | 
Friday, November 09, 2007 11:42:25 AM (Central Standard Time, UTC-06:00) #    Comments [1]  | 

 

Site Statistics#
Here are some site statistics for the last 12 months. Over a quater million visitors and almost 750,000 page views. Not bad.

Hits
Total Hits 1,607,524
Average Hits per Day 4,380
Average Hits per Visitor 5.87
Cached Requests 132,924
Failed Requests 157,190
Page Views
Total Page Views 737,197
Average Page Views per Day 2,008
Average Page Views per Visitor 2.69
Visitors
Total Visitors 273,988
Average Visitors per Day 746
Total Unique IPs 49,647
Categories:  | 
Monday, November 05, 2007 1:23:10 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Google Drops My PageRank#

It looks like my previous pagerank of 4 has been dropped to 3.

Google PR™ - Post your Page Rank with MyGooglePageRank.com

This kinda stinks. I would rather be going up than down, but it isn't that big of a deal.

Ironically, one of my other websites that was getting a lot less traffic than this one just jumped from a 3 up to a 4.  Go figure.

Google frequently tinkers with their settings, so I'm sure these numbers will not be static.

Categories:  | 
Monday, November 05, 2007 11:41:33 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

ScottGu Demos Upcoming MVC Framework for ASP.NET#

In a recent gathering of the ALT.NET group, ScottGu gave a demo of the upcoming MVC framework for asp.net.

The article (and video) can be found here.

Lots of people in the ALT community have been working with asp.net and MVC by using one of the OS frameworks out there like Monorail, but I am glad to see that MS is not sitting around waiting on this issue.

Hopefully this will make testing even easier. 

Categories:  |  | 
Tuesday, October 30, 2007 9:44:25 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

All content © 2009, Christopher May, Inc
Open Job Positions
On this page
Google Ads