Posts

"Internet Explorer has stopped working" Redux (unfortunately)

OK. Now I'm annoyed . I've already UnBlogged about this here and now I'm seeing it again . If I use our search facility on eggheadcafe.com and enter "which control posted back" you'll get this url: http://www.eggheadcafe.com/articles/20050609.asp . When I click on this in IE 7.0 (on Windows Vista, dear Reader...) I get the dreaded "Internet Explorer has stopped working" BS. Some people get this, others don't. For me, the page comes up and almost at the point where the browser has completely loaded it, that's where IE blows up. There's nothing unusual about that page, it's like every other article on the eggheadcafe.com site. Lots of people have reported this issue with lots of different web pages, just because it doesn't happen to you doesn't mean everyone else is nuts, OK? Yeesh! No wonder they call it "Internet Exploder"! It doesn't matter if I reset IE, it doesn't matter if I run "as Administrator...

Read / Write Large Value (Blob) Types in SQL Server 2005 with ADO.NET 2.0

I saw somebody's post on the C# newsgroup recently where they had posted some chunked code to use a do / while GetBytes pattern to read from a Varbinary(MAX) column. The code was fine, but it sure was a lot of code, because the individual who posted it was accumulating the entire block of data in memory anyway and then proceeding to use it. There is a much simpler way, with SQL 2005 and ADO.NET 2.0: //-- READ - reading a varBinary(MAX) columm... System.Data.SqlTypes.SqlBytes myBytes; System.Data.SqlClient.SqlDataReader dr; System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(); dr = cmd.ExecuteReader(CommandBehavior.SequentialAccess); // SequentialAccess allows chunked reading with offsets, etc. myBytes = dr.GetSqlBytes(1); // return a SqlBytes type containing the entire contents of the column System.IO.Stream s = myBytes.Stream; // get the stream property Bitmap B = new ...

Bong Hits for Jesus, Mescaline for Moses...

Please. Give me a break, OK? This kid wants to exercise his right to free speech on a public sidewalk across from his school's outdoor event, and the fyookin' Principal comes across the street and physically takes down his banner and supends him from school for five days? Somebody is smoking SOMETHING, but it ain't common sense -- that's for sure! I should note that this happened in 2002 - it's coming up now because the Supreme Court of the United States agreed to hear it today. This is not a small deal - its a very big deal - but we'll probably have to wait for summer 2007 before the Court rules on it. Look, I grew up smoking pot. I can't smoke it any more, maybe I'm too old, I don't know - it makes me crazy now. But one thing I know is this - compared to alcohol, pot could be the most innocuous illegal substance there is - provided you have enough sense not to go driving on the freeway while you're high. Let's not forget that not too many y...

MVP Summit Musings - 2007

Each year, Microsoft invites current MVPs (Most Valuable Professionals) to Seattle for their annual MVP Summit. MVP's get access to Product Group specialists and other dignitaries from Microsoft who share their visions of what Microsoft is doing and where they are going. Some of this information is "not to be disclosed", meaning that the MVP can find out about it but we aren't supposed to talk about it until the bits are released. In sum, we get wined, dined, and seminar-ed to death. This year, as I did last year, I had mixed feelings about the whole thing. Yes, I got to meet and talk with people who I respect such as Scott Guthrie ("Mr. ASP.NET") and Anders Hejlsberg, "up close and personal" which is always gratifying, as well as my MVP lead Rafael Munoz, who has been a fantastic resource for me as a .NET professional. Among other notables too numerous to detail, I also ran into Jason Alexander and Rob Howard, and we got a chance to chat about the...

IDisposable and Conservative Politics

There is a saying "You become a Conservative when you've got something to conserve". In the programming world, it could be said that "You should only implement IDisposable when you've got something to Dispose". Here is an interesting Q/A interchange between a confused C# newsgroup poster, with some very good answers by Barry Kelly : Q: "A discussion arose recently in a code review about whether or not one should implement IDisposible (and then call it) on an object which has neither unmanaged resources nor managed resources which are resource intensive (db connections, filestreams, etc.)." A: If a class implements IDisposable, that tells me as a programmer that I *need* to call Dispose() when appropriate. If the class doesn't own other objects which implement IDisposable, and isn't likely to do so, then I would say - don't implement it. But if you do implement it, implement it properly. Create a protected virtual void Dispose(bool dispo...

OpenID Prime Time Redux, now with Microsoft!

"We don't all agree on everything. I don't agree with myself on everything..." -- Rudy Giuliani Not too long ago I opined about whether OpenID was really ready for Prime Time A Short while ago, Microsoft announced a deal with JanRain, VeriSign and Sxip to develop integration between Microsoft CardSpace and the open source OpenID project. In addition, the partners announced that Microsoft would be bringing its anti-phishing technology to the OpenId platform - important, because any time you have an open-source, open-standards Single Sign On infrastructure, you are going to attract the dastardly hackers that attempt to abuse it. I believe that these are new technologies that will have a significant impact on the future of the Internet, identity and single-sign-on (SSO) as we know them. OpenID is an open, decentralized, free framework for user-centric digital identity. It attempts to solve the problem of Web single sign-on - something that Microsoft attempted at first ...

Dynamically Loading an Image from an External Assembly

This one came up recently in the C# newsgroup, so I thought I'd take a quick crack at it: private void button1_Click(object sender, EventArgs e) { Assembly asm = Assembly.LoadFrom(System.Environment.CurrentDirectory + @"\AssemblyResources.dll"); Stream strm = asm.GetManifestResourceStream((string)asm.GetManifestResourceNames()[0]); Bitmap b = (Bitmap)Image.FromStream(strm); pictureBox1.Image = b; } What you are doing is: 1) Assuming the "external" assembly is a managed assembly, and it's name is "AssemblyResources.dll", and it resides next to the executable (for ASP.NET you would have to use Server.MapPath or some combination of Request.PhysicalApplicationPath, or the like). We load the assembly into the AppDomain using the LoadFrom method. 2)We extract the resource into a stream using the GetManifestResourceStream method. 3) To make it easier to know the exact names of resources (which can be tricky) I use the GetManifestResourceNames method, whic...

Microsoft Junking GotDotNet.com site

According to the site: "We are phasing out GotDotNet for the following reasons: Microsoft wants to eliminate redundant functionality between GotDotNet and other community resources provided by Microsoft Traffic and usage of GotDotNet features has significantly decreased over the last six months Microsoft wants to reinvest the resources currently used for GotDotNet in new and better community features for our customersPhase Out ScheduleThe GotDotNet phase out will be carried out in phases according the following timetable: (etc, etc)" Basically what we are saying here folks, is "We don't think there's enough interest in this site, and we think we have other resources that are better, so take it or leave it". Well! Sez who? I've got samples up there that have been downloaded OVER 47,000 times, and I myself have downloaded sample code contributed by others probably a hundred times or more. Yes, I know you've got Codeplex.com. It's very nice - but it...

SQL Server: "Don't Reinvent the Wheel" Department

In your travels as a professional software developer, especially when you come into a new position and need to get used to a new enterprise and its programming - related environment - the tools, the programming style, the existing codebase, etc. you get to observe some of the repetitive coding patterns that people resort to in order to solve their problems. One of the most common ones I've observed is where developers do not have a full understanding of how ADO.NET and connection pooling work. It seems almost like instead of seeking out and using best-practices code and techniques, that some people, either through lack of knowledge or just plain being stubborn, feel compelled to "roll their own" DAL and Database layers. Mistakes and poor design often result. Back around 2001, I found the Microsoft Data Access Application Block ("SqlHelper") class, which quickly solved a whole bunch of data access problems for me, and in fact I still use it today - 5 years later ...

Meet Jack Murtha: Official Saboteur of US peace efforts in Iraq (and parallels to programming)

Since last December, Mr. Murtha has become the hero of the antiwar crowd, and, as we've seen with other such individuals, scrutinizing their behavior is considered disrespectful. Few might recall (since many aren't even old enough to remember) that after the massive 1980 Abscam scandal, Mr. Murtha was named by the FBI as an unindicted co-conspirator. Sez Murtha, "Once we get out of there, it will be more stable in Iraq." Oh, Really? Jack Murtha is an idiot. If he has his way and we get out of there, even many left-wing Democrats agree that all hell will break loose, and we will be in much more danger - not only from Al Queda, but from Iran and other destabilizing influences, than we are now. Newt Gingrich: "It's conceivable that Murtha woke up one day a year ago and said, 'You know, if I don't start bashing America, and bashing the military, and repudiating everything I've stood for my whole life, these guys aren't going to allow me to be chai...