Live Chat Programs

March 25, 2008

A Quick Fix for the Validator SetFocusOnError Bug

Filed under: Live Chat software
The ASP.NET validators have this nice property called “SetFocusOnError” that is supposed to set the focus to the first control that failed validation. This all works great until your validator control is inside a naming container. I ran into this recently when using validators in a DetailsView. Take this simple example:

Also see: SIGPLAN Workshop on Undergraduate Programming Language Curriculum

<%@ Page Language=”C#” %>
<script runat=”server”>
 protected void Page_Load(object sender, EventArgs e)
 {
 if (!IsPostBack)
 DataBind();
 }
</script>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head runat=”server”>
 <title></title>
</head>
<body>
<form id=”_frm” runat=”server”>
 <asp:DetailsView
 ID=”dv1″
 DefaultMode=”Edit”
 DataSource=’<%# new object[1] %>’
 runat=”server”
 >
 <Fields>
 <asp:TemplateField HeaderText=”First Name:”>
 <EditItemTemplate>
 <asp:TextBox ID=”FirstNameTextBox” runat=”server” />
 <asp:RequiredFieldValidator
 ID=”FirstNameValidator1″
 ControlToValidate=”FirstNameTextBox”
 ErrorMessage=”First name is required.”
 Display=”Dynamic”
 EnableClientScript=”false”
 SetFocusOnError=”true”
 ValidationGroup=”bug”
 Text=”*”
 runat=”server”
 />
 </EditItemTemplate>
 </asp:TemplateField>
 </Fields>
 <FooterTemplate>
 <asp:ValidationSummary
 ID=”vs1″
 DisplayMode=”List”
 ValidationGroup=”bug”
 runat=”server”
 />
 <asp:Button
 ID=”Button1″
 Text=”Post Back”
 ValidationGroup=”bug”
 runat=”server”
 />
 </FooterTemplate>
 </asp:DetailsView>
</form>
</body>
</html>

If you run this page and do a view source you’ll see that the FirstNameTextBox gets rendered like this:
(more…)

Determining Whether a File Is an Assembly

Filed under: Live Chat software

Also see: From C# to Java: Part 3

A file is an assembly if and only if it’s managed and it contains an Assembly entry in its CLR metadata.

Determining by hand

A fast way to determine whether a file is an assembly is to run ildasm.exe on it. If it immediately gives an error saying that it may not be a PE file, then it’s not a managed file. But, if it is an assembly, then ildasm will show an entry for the Assembly definition (“.assembly“ in the MANIFEST window or at the bottom of the original window).

Determining programmatically

From unmanaged code, you can call GetAssemblyFromScope() on the IMetaDataAssemblyImport interface for the file. If it returns S_OK, it’s an assembly. If it returns CLDB_E_RECORD_NOTFOUND, it’s not an assembly.

From managed code, if AssemblyName.GetAssemblyName(), Assembly.Load*(), etc. succeeds when given that file, then it’s an assembly. If the load failed with a BadImageFormatException, then it may not be an assembly. There are other reasons, however, why that exception may have been thrown (maybe it’s an assembly but could not be loaded because it has an incorrect format). Coming soon in v2, if the hresult for BadImageFormatException is COR_E_ASSEMBLYEXPECTED, then it’s because it’s not an assembly. Catch the exception and call System.Runtime.InteropServices.Marshal.GetHRForException() to get its hresult to find out.

Note that this assumes that you are not concerned about performance. If you are concerned about that, then the way to op (more…)

When Will Foreign Ownership of US Sports Teams Start ?

Filed under: Live Chat software

Also see: This Guy Proves Anyone with a Keyboard can be Stupid

For a while there, it looked like North American sports teams owners were going to take over European Soccer. The biggest Premiere League names were getting bought up. Then a funny thing happened. The US Dollar turned upside down against major currencies making deals that once looked tenable, all of the sudden seem very, very expensive.

But as is the nature of currency exchange, for every Yin, there is a Yang, or in this case an Abramovich or any number of wealthy Europeans or Russians who are coming to the US in search of bargains. Of course there are also the exploding number of Chinese Billionaires with global aspirations as well.

A quick trip to NYC to shop for currency induced bargains need not stop on 5th or Madison Ave. It is just a matter of time, and maybe not much of it, before we start to see our sports teams gobbled up. With the international
flavor of both the NHL and NBA, is there a better way to “mainstream” a person, product or service into the US than through the purchase of a sports franchise ?

With the lack of Salary Cap of MLB, why couldn’t or wouldn’t an ultra Wealthy (as in guys or girls who make me look poor) Sports Fan take advantage of the fall in the value of the dollar and come in and buy an Iconic or even mid market franchise and spend spend spend ?

With the price of NFL franchises now past a billion dollars with half the Dolphins apparently selling for more than 550mm, how many individuals in this country that don’t already own a franchise actu (more…)

Sometimes, it’s the small things..

Filed under: Live Chat software

Also see: Infrequent blogging

Also see: Data Types a la Carte

Also see: ReflectionTypeLoadException

I’m a Firefox guy. The only reason I use it instead of IE is that it feels faster. Seriously.

I find it incredibly annoying that the only websites I frequent that require IE are those run by Microsoft. I’ve nothing against IE (I’ve never had the malware problems), but these websites disrupt whatever I’m doing. Most times I’ll just avoid the site. A good example is the MSN Video portion of MSN. Occasionally I’ll click a link leading to a video, at which point I’m told that I can’t watch it in anything but IE. This is odd since 1/2 of the emails I get link to funny videos on websites that do let me watch them in my browser of choice. Instead of launching IE and watching the (advertiser-supported) MSN Videos I simply move on. I’ve got too much stuff to do to be inconvenienced by this.

Which is why I was pleasantly surprised by the following error message. The site doesn’t support Firefox — but they’re working on correcting it. It’s a problem, and they’re fixing it. Bravo!


http://weblogs.asp.net/jkey/archive/2006/04/30/444551.aspx

We Live in an “Open Book” World, the Lie of Information Overload

Filed under: Live Chat software

Also see: Win friends and influence your team

In school, there were two kinds of tests. The regular kind where you learned and memorized all you could and then did your best on the test. The 2nd kind was the Open Book Test. Where you could use your notes and text books to figure out the answer to a question.

The 2nd was always preferable to the first because it was always a lot easier to prepare reference than to memorize.

Come finals time, a schedule of traditional tests meant packaging hours and hours to study. It was the ultimate experience of Information Overload. It also was the quickest way to forget everything you just learned the minute the tests were over. In fact, if you hung out with my friends and me, the minute tests were over, every penny we had was destined to be spent on beverages that killed more than a few braincells.

Today, life is so much simpler. I can’t remember the last time I had to go to the library or bookstore to search for a book on a topic that was important to me. I can’t remember the last time I HAD to invest the time to read a book as opposed to choosing to read a book that I wanted to read.

There was a time when I would scour online forums looking for any information that would give me an edge. Those days are long gone.

Today, I still read a ton of magazines that I both enjoy and which give me a solid foundation of information that help me professionally and personally, but I don’t stress that I might miss something. I don’t stress if I don’t read an issue immediately when it com (more…)

Channel 9 Interview

Filed under: Live Chat software

Charles Torre and Robert Scoble (behind the camera) dropped by my office to chat with me about the loader for MSDN’s Channel 9: part I and part II.
Also, check out the PDC video I was in for Channel 9: http://channel9.msdn.com/ShowPost.aspx?PostID=79591
http://blogs.msdn.com/suzcook/archive/2005/02/11/channel-9-interview.aspx

Load(AssemblyName)

Filed under: Live Chat software

Also see: Startup, Shutdown and related matters

Also see: ReflectionTypeLoadException

Also see: Turning bitboards from potential moves into legal moves, pawn moves, and conditional rules.

Also see: Hosting

Calling Load(AssemblyName) is not necessarily the same as calling Load(String). If the AssemblyName.CodeBase is not set, then they do do the same thing. So, if you’ve set the AssemblyName.Name, CultureInfo, public key token / public key and/or Version properties, it would be the same as if you had specified those properties in a String (as a display name ) and passed that to Load(String).

If the CodeBase is set, but the Name is not, however, then it’s the same as calling Assembly.LoadFrom() on that CodeBase.

When both the CodeBase and the Name are set, then the bind is tried with all the given binding information except the CodeBase (so, again, just like calling Load(String)). If that succeeds, we’re done. But, if that fails, then the bind is tried again with just the CodeBase (just like LoadFrom()). If it fails again, then, of course, the whole bind fails. But, if it succeeds, then we verify that the binding properties in the AssemblyName match the found assembly. If they don’t match, a FileLoadException will be thrown for hresult FUSION_E_REF_DEF_MISMATCH.

So, setting both the CodeBase and the Name is useful for when you want to both load an assembly at a given path into the LoadFrom context, and verify that it has the public key token, etc. that you expect. Of course, as described above (and due to binding context rules ), keep in mind that just because you call Load(AssemblyName) with a CodeBase, it does not mean th

Live Help Software: Live Chat with Users on your websites. It is FREE !
at it will be loaded from that path.


http://blogs.msdn.com/suzcook/archive/2004/08/04/load-assemblyname.aspx

Should “Membership Stores” Be Permitted in Redmond’s Manufacturing Park Zone?

Filed under: Live Chat software

Also see: From C# to Java: Part 3

In coordination with Taylor Development, which among other things owns an undeveloped 60 acre parcel of land that is zoned Manufacturing Park (MP) along Union Hill road in Southeast Redmond (see Redmond zoning map here  and Live.com Map here ), City Staff has presented the Redmond Planning Commission , of which I am a presiding member, with a proposal to expand the list of permitted uses in Redmond’s Manufacturing Park (MP) zone to include “Wholesale/Retail Membership” stores. In other words, they propose to enable folks like Mr. Paul Taylor with the flexibility to build a Costco or Sam’s Club-type store out by the UPS distribution center, east of Target and Mervyns, in SE Redmond. To accommodate this, Redmond City Staff has proposed that we allow such uses in all the MP zone in SE Redmond. throughout the City of Redmond.

Correction, 5/8/2007: I have been informed that the proposed regulatory ammendments to permitted uses in the MP zone would limit wholesale-retail stores to the MP area in Southeast Redmond only.

What do you think? If you live in or near Redmond and especially if you commute through or live in or near to Southeast Redmond near a Manufacturing Park Zone here (to/from Redmond via Avondale Road, Redmond-Fall City Road, Willows Road, or other), I’d like to hear what you think about this proposal. I am one of the Planning Commissioners who will soon vote on whether or not (and why) the City Council should approve this proposed change. Your opinion matters to me. But more importantly, your opinion matters to your fellow residents and elected officials. As such, I encourage you to comment, on public record, by emailing your thoughts to Sarah Stiteler , with the City of Redmond. I’m sure that Sarah can also provide you with the full Technical Committee Report, which I can’t find on the City Web Site (argh!), that outlines why City Staff believes this proposed change to be viable, appropriate, and legal.

(more…)

Avoid DevPath

Filed under: Live Chat software

Also see: Web Access for Visual Studio Team System

I hesitate to talk about this because I don’t want people who don’t know about it to think, “Hey, what’s this DevPath thing? I need that.” But, maybe if I don’t explain how to use it, it will be too much effort for people who don’t already know how. :) (And, for those who already know how and are, in fact, using it, hopefully, they’ll see this and get off that plan.)

The intent of DevPath was to make the development environment less painful. Assemblies could be put there and bound to at runtime, ignoring the assembly version and overriding the GAC.

It turns out that that’s badness for several reasons (below). So, DevPath is soon to be deprecated. Don’t use it - not even in the development environment.

Why It Should Never Be Used
Versioning alone is why you should never, ever use it in a production environment. It subscribes your users to dll hell. See Avoid Partial Binds for details (DevPath causes partial binding, since the version is ignored for the bind).

It’s not good for the dev. env., either - it makes it unnecessarily different from the shipping env., which may lead to uncaught versioning or deployment bugs in the shipping env.

What to Do Instead
If DevPath was a development environment-only solution for you:
I strongly recommend not changing your assembly versions between non-shipping builds instead of using DevPath.

If you are shipping code relying on DevPath:
One thing you could do is create a new AppDomain with the ApplicationBase set to the path you care about. Once you do that, see Executing Code in Another Appdomain.

(more…)

Get free blog up and running in minutes with Blogsome
Theme designed by Jay of onefinejay.com