BoundFields, DataFormatString, and HtmlEncode

Ran into this again today.

<asp:BoundField
  DataField="FollowUpDate"
  DataFormatString="{0:MMM-dd-yy}"
  HtmlEncode="false"
  HeaderText="Follow Up Date" />

If you are doing a boundfield in an asp.net gridview, and you play on using the DataFormatString, you have to set HtmlEncode to false.

Kinda stupid, but that’s life.

Learning Spanish

I have been toying with the idea of trying to learn spanish… the class I most hated in school.

I have no idea where this desire came from, and more than I can explain my rather sudden interest in traveling and soccer (lots of EPL games on my DVR).

So I have been working with some Rosetta Stone CDs as well as listening to some podcasts ( www.coffeebreakspanish.com and www.notesinspanish.com ).  I have improved a little, but I think there is only so much you can do with reading/listening and not really having to interact with people who are speaking the native language.

I found this page that talks about the COE Language Proficiency Scale.  I think on this scale I would be only an A2:

A2 – Can understand sentences and frequently used expressions related to areas of most immediate relevance (e.g. very basic personal and family information, shopping, local geography, employment). Can communicate in simple and routine tasks requiring a simple and direct exchange of information on familiar and routine matters. Can describe in simple terms aspects of his/her background, immediate environment and matters in areas of immediate need. 

And I think I would like to be at the B2 level:

B2 – Can understand the main ideas of complex text on both concrete and abstract topics, including technical discussions in his/her field of specialisation. Can interact with a degree of fluency and spontaneity that makes regular interaction with native speakers quite possible without strain for either party. Can produce clear, detailed text on a wide range of subjects and explain a viewpoint on a topical issue giving the advantages and disadvantages of various options.

So while the ipods and Rosetta Stone are good, I think if I want to take it to the next level I need to take lessons.  I found 2 places that offer lessons online from native speakers over Skype. 

Nulengua (http://www.nulengua.com/) charges $10/hour and WebSpanish (http://www.webspanish.com/) charges $15 / hour.  Both are very cheap as the tutors are based in South America, so I guess I need to decide if I am going to bit the bullet and sign up for some of these.

The only thing holding me back at this point is the fact that I don’t have any free time as it is, and also I am trying to factor in my tendency for being really interested in something only to lose interest over time, get burnt out, whatever. 

I think the term my mom used to use was that I was “very intense” when it came to things I was interested in.  So right now, I would love to spend a lot of time learning these things, but 6 months from now will I still have the same interest, and therefore be glad that I spent as much time as I did on learning spanish.  Or, will I be on to something else with my limited free time?

Sometimes I feel like simply being aware of my tendency to overly invest time in things like this has the opposite effect, causing me to over compensate and avoid moving forward.

Anyway, I am lucky enough to have a wonderful wife who puts up with my ebb and flow, and is willing to do the lessons with me.  Just need to find some time to get started.

 

I guess it does not get cold in Silicon Valley

I am having a very hard time using my iphone headphones outside these days in Chicago.  It gets pretty cold, and the plastic that they wrap the wires in freezes up almost instantly, making the cable stiff like a piece of solder.

So when you turn your head, the headphone wires don’t move and the ear buds pop out of your head.  Pretty poor design.

I guess it doesn’t get this cold in Silicon Valley, where Apple has it’s headquaters.

 

Http error 403.6 Forbidden IP Address

Have you ever come across this error message?

403.6
Forbidden IP address of the client has been rejected

If you are using Small Business Server you might come into this quite fast as by default it will lock down IIS to keep machines who are not on the same subnet from accessing the web server.

This means if you VPN in you can’t browse the intranet site.  Oops, that’s not good.

To fix this problem, you need to edit the website and iis application properties in IIS.  On the Directory Security tab edi the IP address and domain name restrictions.  Change the settings on there from “Deny” to “Grant” and you will be all set.

 

Using a STYLE block on a page with a Master Page

I have been asked this a few times, so I decided to write up a little article on it.

The problem is that when you are using master pages in asp.net, the <HEAD> is usually inside the master page template.  So if you are on a page that needs a 1 off change or addition to the style of the rest of the site, you are unable to create a <STYLE> element in your content page.

Well, you CAN create one, but then VS.Net won’t show you the designer for your page b/c it keeps asking you to clean up the HTML problems on your page.

The solution I have used is to create a 2nd content place holder in the master page head.  But, I might as well not duplicate effort here, as Rick Strahl has already written the article I am about to write (and apparently, even someone else beat him to the punch).

http://www.west-wind.com/WebLog/posts/5706.aspx

This works very well for this type of situation. 

 

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.

 

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.