Posts

Showing posts from April, 2007

Microsoft Silverlight 1.1 Alpha is here!

Image
If you pick up a starving dog and make him prosperous, he will not bite you. This is the principal difference between a dog and a man. - Mark Twain At the MVP Summit in March, Scott Guthrie and friends previewed the 1.1 Alpha of Silverlight (named of course, after my good friend David Silverlight , who runs XMLPitstop.com and other fine sites). We weren't allowed to talk about it until now - and the 1.1 Alpha is now available - along with some nice Quickstart SDK samples . Among other fine features, this offers a reduced-set WPF runtime hosted in Internet Explorer, streaming video, and - SURPRISE - Managed code in the browser -- including Javascript access to managed code! Get it while it's hot! Now the big question you'll hear is whether this is going to be a "Flash killer". I don't think that will happen right away, but when you look at the streaming video codec and DRM support, support for managed code, dynamic XAML loading and much more, it certainly repr

C# vs VB.NET Case - Sensitivity: what to do

Hegel was right when he said that we learn from history that man can never learn anything from history. -- George Bernard Shaw This one seems to keep coming up, and basically revolves around developer misunderstanding (or more frequently, lack of knowledge) of Naming Guidelines. The typical question often looks like the following: "I have a class implented in a c# dll which has two different properties of same name Say "A" and "a". Now, is their any way to use any one or both of these properties of this class in a vb.net project.because it will give the following error Error 2 'A' is ambiguous because multiple kinds of members with this name exist in class 'ClassLibrary3.Class1'" Yes, there is a solution: Write your classes and methods correctly in the first place! Case Sensitivity To avoid confusion and guarantee cross-language interoperation, follow these rules regarding the use of case sensitivity: Do not use names that require case sen

Enterprise Library 3.0 (April 2007) Goodness

The significant problems we have cannot be solved at the same level of thinking with which we created them. - Einstein I'm working on a migration of an Application Framework from EntLib 2.0 to Enterprise Library 3.0 (April 2007) for a big client, and I'm quite impressed with Enterprise Library 3.0. This has gotten to the point where it is much more mature, and now sports some very AOP-ish bits with Policy Injection and Validation that really are nicely done -- and extensible. This is reminiscent of some of the GAT work with dependency injection that Daniel Cazzulino and Victor Aprea were doing a little over a year ago when I talked with them at the 2005 MVP Summit. There are still a few rough edges, namely that WCSF integration (coming late May to a machine near you) is not complete. However, some developers, such as David Hayden , can't wait, and David has done his own integration (probably cursing all along the way) which you can download. I can see a growing tide of d

CCR - Concurrency and Coordination Runtime for asynchronous processing

The Microsoft Robotics Studio ( http://msdn.microsoft.com/robotics/ ), which was recently released, has a unique set of assemblies called Concurrency and Coordination Runtime (CCR). The CCR.Core assembly is only 154KB. Unfortunately, the only way you can get it (currently) is to download and install the entire April 2007 CTP: ( http://www.microsoft.com/downloads/details.aspx?FamilyId=71D96DE4-E3D9-496E-B48E-B35697C88FF1&displaylang=en ) -- at 54.3 MB. The central feature of the CCR is that it makes programming asynchronous behavior much simpler than the typical challenge of writing threaded code. When an application's thread performs synchronous I/O requests, the application is giving up control of the thread's processing to the I/O device (a hard drive, a network, etc.). The application's responsiveness then becomes unpredictable. When threads are suspended waiting for I/O requests to complete, the application tends to create more threads in an attempt to accomplish mo

Orcas and Visual Studio 2005: So happy together...

Well, unless you've had your head buried in endless code and don't ever come up for air, you know that Visual Studio Codename "Orcas" BETA 1 is out, and you have two choices: 1) Download all the pieces for a VPC installation and run it in a VM, or 2) Download the iso image and install it on the machine proper. I've never been enamored of number 1; I just don't like the feeling of running something in a virtual machine and dealing with all the memory and other issues; and besides, I want to really test this thing out and the best way to do that, in my book, is to take the plunge. Now of course the question becomes -- is it going to be happy with being on the same OS as Visual Studio 2005, and vice-versa? For me, the answer is "yes". So far I have noticed nothing unusual at all. Each guy acts like he knows nothing about the other, and as far as I'm concerned, that's perfectly fine with me! They do mention prominently that when you uninstall Orc

ISP's DNS Got you down? Try This.

I don't know about you, but Brighthouse (Time Warner, RoadRunner, whatever you call it) has some real DNS issues here in cfl (that's "Central Florida" as in cfl.rr.com). Sometimes it just goes completely out, other times it works for some sites and not for others. If you have a similar problem, obviously the first step is to complain to the provider. Of course, that doesn't always work. One suggestion I tried is to use the OpenDNS Service (it's free). You can visit their welcome page here (if you aren't hooked up yet, they will guide you through it). It doesn't matter if you have a wireless router or whatever. Just update the "Preferred DNS" entries in your network connection, reboot, and you are up. It seems to be fast and reliable. It automatically protects against known phishing sites, and it even automatically corrects your url spelling mistakes! For a real quickie, the entries: OPENDNS: 208.67.222.222 208.67.220.220 These people at OpenD

Simple XOR Encryption With T-SQL and Built-in Functions

Some time ago I presented an article about why XOR encryption can be a useful "just enough" technique to easily handle encryption and decryption of strings such as connection strings in configuration files. By carefully choosing the value to use as the operand in the XOR function, we can create an encrypted string that is "XML Safe". One such ASCII value I found was the integer 129. The advantage of XOR is that it is bidirectional - when you XOR the result of a previous XOR operation, you get back the original value. This means you only need one method to both encrypt and decrypt a string. I should hasten to note that XOR encryption is NOT a strong encryption algorithm - it's probably one of the first things a determined hacker would try. However, for simply keeping your stuff "away from prying eyes" -- it can often be "just enough". The following example illustrates how one can create a UDF in SQL Server to perform the same operation. CREATE

Musings About Software Pricing

Do you believe that much of the commercial software you see in the marketplace as a developer is overpriced? I'm talking about software that developers buy - tools, frameworks, special-purpose stuff that you could probably write by yourself, but you feel it would be cheaper in terms of your valuable time to purchase it instead? I muse about this because recently my site partner and I purchased some ad - serving software for our site. We got a discount from the $700 price, but I still thought it was kind of pricey. Like any developer, the first thing I looked at was "how easy is this to install and configure". The other thing I did was go to the vendor's site and look around. The first thing I noticed was that there was one of those annoying animated drop-down "in your face" advertisements when their home page loaded. I don't think I have to explain why this tactic immediately puts you on my "do not visit this site again" list. It's tacky, u

New! SiteMap xml AutoDiscovery with Robots.txt

Apparently Google, Yahoo and MSN all getting together about agreeing to use the Sitemap xml format to index your web site is having some good fallout. They've all agreed to look at your robots.txt file (which all crawlers look for) and you can now point to your sitemap url from there, and they will happily chew upon it! To do this, simply add the following line to your robots.txt file: Sitemap: http://www.example.com/sitemap.xml You need to provide the complete URL for your Sitemap on this line. They will pick it up --wherever you put it in your robots.txt file. This directive is not specific to user-agent. If you have multiple Sitemaps, you can point to your Sitemap index file on this line. Details about the Sitemaps protocol including this addition are available on the protocol website here: http://www.sitemaps.org . The Google sitemap invention and protocol is a great SEO tool for your web site or blog. We have used this on our eggheadcafe.com site since the inception of sitem

How to use Word and Excel in ASP.NET: Don't!

I have seen so many of these that it just makes me shake my head: "How can I use Excel on IIS in ASP.NET (or Word, or any Office program)".... The answer is, you can try, but it is neither supported or recommended. Here is why: 1. User Identity: Office Applications assume a user identity when they are run, even when they are started via Automation. They attempt to initialize toolbars, menus, options, printers, and some add-ins based on settings in the user registry hive for the user who launches the application. Many services run under accounts that have no user profiles (such as the SYSTEM or IWAM_[servername] accounts), and therefore Office may fail to initialize properly on startup, returning an error on CreateObject or CoCreateInstance. So, right off the bat, you've got a real problem, OK? 2. Interactivity with the Desktop: Office Applications assume that they are being run under an interactive desktop, and may in some circumstances need to be made visible for certa

How to Delete All the Stored Procedures in a SQL Server 2005 Database

I've been going through the learning curve with CodeSmith and the initial results are pretty interesting, especially with the free NetTiers template set. Man, does that generate a bunch of stored procs, entity and domain objects and controls! If you get used to the model, you are virtually going to get yourself an entire application in one 5-second CodeSmith "Swoop"! One of the things I came up with while monkeying around with the Database schema was the need to delete all the generated stored procs so CodeSmith can be pointed back at a "procedure-less" database for another take. The problem is you don't want to just select everything with type 'p' from SysObjects - because there are system procedures there such as for diagrams. Also, you cannot just do an ad-hoc delete, because you'll get an error message; Sql Server is trying to prevent you from shooting yourself in the foot. Here is an easy way to do it: First, right - click on the query pane

Er, Ms.Secretary Pelosi? How about it?

House Speaker Nancy Pelosi provided a good example yesterday why members of Congress should not attempt to "help out" the Secretary of State when traveling abroad. After a meeting with Syrian dictator Bashar al-Assad in Damascus,Pelosi announced that she had delivered a message from Israeli Prime Minister Ehud Olmert that "Israel was ready to engage in peace talks" with Syria. She added that Mr. Assad was ready to "resume the peace process" as well. The problem: The Israeli prime minister said no such thing. In fact, Mr. Olmert told Ms. Pelosi that "a number of Senate and House members who recently visited Damascus received the impression that despite the declarations of Bashar Assad, there is no change in the position of his country regarding a possible peace process with Israel." Ms. Pelosi not only misrepresented Israel's position but was virtually alone in failing to realize that Assad's statements were propaganda. Mr. Olmert specific

Making your assembly run "as Administrator" in Vista

This came from one of my favorites in the C# newsgroup, Willy DeNoyette. I'll simply post the questions and answers directly, since there is no need to modify it except for some formatting and cleanup: Q) I need to restart the "Windows Audio Service" (audiosrv) via C#. I'm using the ServiceController Class to do this. It is no problem under XP and no problem under vista if UAC is disabled. But with enabled UAC i'm getting a "access refused" exception. I also tried to do it via console with "net start ..." but the same error appears. Three questions: 1. Is it possible to restart the "windows audio service" if UAC is enabled ? A) Yes when running as full "Administrator". That is start the console (cmd interpreter) by right clicking "Run as Administrator". 2. Why does the exception occur? If I do some other stuff, e.g. starting regedit via Process.Start() the user gets asked if he really wants that. I would expect the