Archives
-
Using Reflection to call an overloaded method on a dynamically loaded assembly
I had some fun today! I have a factory class for database access (it handles the creation of classes from either System.Data.SqlClient or Oracle's Oracle.DataAccess). The Oracle.DataAccess assembly is dynamically loaded if it's needed. Consequently, I use reflection when I need to interact with the Oracle types.
-
SQL Server 2000 Enterprise Manager Tip
This is too cool! From Scott Mitchell's blog:
-
RSS Feed made simple
Here's a great introductory article on creating an RSS feed for your site. This is basically the skeleton I used to add an RSS feed to our local user group's site.
-
A Great time at GLUGNET
On Thursday I did my COM Interop presentation for the Greater Lansing User Group .NET. I had a great time! They have a really nice group of people there. Good pizza and good prizes (an XBox!). Unfortunately, presenters were not eligible... :)
-
Why you can't unload an assembly
Josh Holmes and I had dinner with Chris Kinsman last night. He's in town for our .NET User Group meeting tonight. One of the topics that came up was unloading an assembly and the need for a separate AppDomain. We all remembered that there were some blog posts about this but couldn't recall details. I did some googling today and found a couple of relevant posts:
-
Whew! It's finally over!
Windows Automatic Update has been bugging me for a couple of months now to install the XP SP2 upgrade. I've been putting it off but tonight I decided I'd finally just get it over with and install it. It took almost 45 minutes to perform the update! I remember doing this on my desktop a week or so ago and it only took around 10 or 15 minutes. I guess thats the different between a 2-month old 2.5 GHZ desktop and a 2-year old 1.8 GHZ laptop... :)
-
Controlling log4net output
If you've used log4net before, you know it's a simple and easy way to add some pretty powerful logging capabilities to your application. I recently had log4net configured to log to both a text file and the console. I had the logging level configured for all messages, but I didn't want everything going to the console. After some digging through the docs I found out that you can add the "Threshold" parameter to an appender to control the logging level for a single appender:
-
Scripting a SQL 2000 Database
Local .NET guru (and VP of our .NET User Group) Josh Holmes pointed me to a handy little utility for scripting an entire SQL 2000 database (objects + data). I've used it a few times and it's a pretty neat way to pass around a database.
-
Naming threads from the thread pool
I was doing some multithreaded programming today and ran into a small problem. While googling for a fix, I found a very interesting item from earlier this year: Be careful naming threads that come from the thread pool (via the asynchronous programming model):
-
Ian Griffiths on Delegates and Events
In response to a question on the Developmentor WinForms mailing list, Ian Griffiths had a great introductory explanation on delegates and events.
-
Speaking in Lansing on Dec. 16th
I'll be presenting at the Greater Lansing User Group .NET on December 16th in Lansing, Michigan. I'll be giving a presentation on COM Interop -- specifically, creating .NET objects that will be exposed to existing, COM-based applications. If you're in the area, stop by!
-
DataReaders, Stored Procedures and Output parameters
If you're running a stored procedure via ExecuteReader and the stored procedure has some output parameters, you won't be able to access the values of the output parameters until you're done with the IDataReader. Thanks to Bill Vaughn for an MSDN article that cleared this up for me. See the section "Using a DataReader to Process the RETURN Value and OUTPUT Parameters". Note how he calls the DataReader's Close() method before accessing the output or return values.
-
Michigan's second .NET To Go Roadshow
If you missed the October ".NET To Go Mobility Roadshow" held at Microsoft's Detroit office in Southfield, MI don't worry. You've got another chance to attend the roadshow in Grand Rapids, MI on Dec. 2nd, 2004. You'll get the same great content as well as a chance to win a mobile device.
-
Tom Barnaby at this month's User Group!
This month our local .NET User Group, GANG, has an INETA speaker -- Tom Barnaby. The topic is "Understanding Web Services" and should be a good one for those who haven't jumped into web services yet. If you're in the metro-Detroit area this Wednesday, stop by the Microsoft offices in Southfield for some free Pizza and good .NET stuff!
-
Getting back in the swing of things
Man -- a whole month without posting. That was painful. I've been so busy at work and home that I haven't fired up RSSBandit for weeks. But I ran it tonight and let it fill up with tons of news that I'm slowly scanning.
-
Fun with Reflection
I was working with an application that stored some permission information in an integer in the database. Each bit of the integer represented a particular permission. The meaning of each bit came from an enumeration defined in a VB6 DLL. I needed to dig into some of these existing permission values to find out which permissions were enabled based on which bits were set in the database.
-
How to Seamlessly Deploy ASP.NET Applications with Wise for Windows Installer
Local Regional Directory Bill Wagner (co-founder of SRT Solutions) will be hosting a "webinar" on using Wise for Windows Installer for installing and configuring data-drive web applications. The webinar is free and takes place tomorrow morning at 8:30 AM EST. For registration information, go to http://www.wise.com/wfwi_webcasts.asp.
-
Having some fun...
<GeekMessage>
-
Get The Dirt on Disposing
Chris Lyon had a great post on "Demystifying Dispose" that anyone doing .NET development should read (and I assume all three of my readers are doing .NET developemnt!).
-
Tools for content, KM, blogs, and RSS
I'm cleaning out my "Items For Follow Up" folder in RSS Bandit and realized I forgot to blog this when it was announced. Bill Wagner (local Microsoft Regional Director and co-founder of SRT Solutions here in Michigan) asked me to participate in an interactive session to discuss corporate content and how to manage and use it: newsletters, press releases, blogs, wikis, etc... I'll be joined by some heavy hitters: Bill French, co-founder of MyST Technology Partners and Catherine Hayes, Managing Parter at Inner Circle Media.
-
The Big 'O'
Darren Neimke writes about a blog entry he found dealing with "OO True Believers" and how some developers become so obsessed with object oritented'ness that it clouds their vision.
-
.NET To Go comes to Detroit
The .NET To Go Mobility Roadshow is coming to Detroit! Wednesday, October 20th from 5:15pm - 9:00pm at the Microsoft offices in Southfield, Michigan. Even though they've got some decent sized conference rooms, make sure you get a spot by registering today.
-
Jonathon Goodyear on Rich vs. Browser Interfaces
Source: Rich Client or Browser Interface
-
Differences in WinForms ListBox and ASP.NET ListBox
In regards to my sample code "Adjusting to life without ItemData", I've had a few emails asking if this will work in ASP.NET as well. Unfortunately, it won't. The ASP.NET ListBox.Items collection is a ListItemCollection object. This collection's Add method only accepts ListItem objects which contain a simple Text/Value pair. This is all because of the way this gets translated down to HTML using the standard <OPTION> tag.
-
Rich UI in a browser?
Rocky Lhotka blogs about the "browser wars" and presents an interesting view on it's use:
-
Detecting changes in the system.
Did you know you can easily tell when the user installs a new font? Or what if they changed their display settings? Check out the Microsoft.Win32.SystemEvents class.
-
Anybody want a gmail account?
I've got 6 invites. If you want one, send me your first name, last name and email address to patrick@mvps.org
-
COM Interop Presentation
I gave a presentation last month to our local .NET User Group on COM Interop. It was fun and the slides are available if you're interested.
-
Scoble & Headlines, Me & Images
Last night at our local .NET User Group meeting I was catching up on my RSS feeds as Eric Maino was doing his nUnit presentation (no offense to Eric but this was stuff I already knew). I stumbled across Scoble's post about writing descriptive headlines to help get your posts read. I totally agree. I've been so busy that I had 500+ items in RSS Bandit to read. Obviously I couldn't read them all so the headline of the post was a key factor in whether I read it or not.
-
ATI and .NET
Interesting news: ATI's all-new CATALYST Control Center (for tweaking the settings of your ATI video card) requires the 1.1 .NET framework. I haven't looked at it yet so I don't know if the whole thing or just part of it was done in .NET. I'll install it on my new machine at home tonight and start poking around with ILDASM! :)
-
Single-stepping IL
Ever wanted to single-step through IL code? I haven't myself, but someone else did and Microsoft's Serge Lidin shows you how.
-
Paul Vick's DNS Problems
Paul Vick left a comment to my original post explaining that he's having DNS problems and they should be cleared up in the next few days.
-
Paul Vick's blog: MIA?
Anyone else notice that Paul Vick's blog is gone? It appears the domain name has been scooped up by someone else (it redirects to qp.org -- but whois still shows Paul as the owner). Hopefully he'll start up again at blogs.msdn.com.
-
My 15Seconds Article
I recently wrote an article for 15Seconds.com and it has been published today. Check out "COM Interop Exposed" and let me know your opinions. I plan on doing a follow-up article on exposing .NET events to COM clients (i.e. COM's Connection Point Protocol -- IConnectionPoint, IConnectionPointContainer, etc...).
-
Interfaces "Flattened" during COM Export
While researching a question someone asked, I discovered that TLBEXP will "flatten" out your .NET interface hierarchy.
-
One year with .Text!
How ironic! I was googling today for something .NET related and came across a link to my old Radio weblog. I clicked on the link and read my last post. It mentioned my move to weblogs.asp.net -- and it was dated one year ago today! Anyway, it's been a great year with .Text and I've never had any problems like I used to with Radio. Thanks Scott!
-
Creating a COM object from a ProgID
Suppose you have an architecture where you expose interfaces to your clients and they can create their own COM objects to extend your application by simply implementing one of your interfaces. You don't force them to use a particular ProgID (they may have multiple objects that implement the same interface). Instead, the ProgIDs are stored somewhere (database, XML file, whatever).
-
Was that assembly built in Debug or Release?
Ted Graham posts about determing if an assembly is a debug assembly or a release assembly. His solution was to use the AssemblyDescription attribute:
-
REGASM, COM and Type Libraries
If you've ever done any work with making .NET components that are exposed to COM, you're familiar with REGASM. This utility makes registry entries to make your .NET object look like a COM object. In its simplest form, you can do:
-
Determining if a COM+ application is running.
I needed to know if one of my COM+ applications was currently running. Some Googling came up with an "ApplicationInstances" collection by interop'ing with the COMAdmin library, but that only works for XP and Win2K3 Server. Of course, I needed this for Win2k.
-
Whidbey gets FTP support
From Brad Abrams:
-
Cool Screensaver
Ok, kind of off-topic, but we're all geeks, aren't we? Found this cool Matrix-style screensaver that's highly customizable (and small too -- only 50k).
-
Explorer Tip - Showing Assembly Version
Got a neat tip today from the boss! Consider the following Explorer view:
-
No more DotNetMagic on SourceForge?
I know that DotNetMagic had gone commercial last year, but I thought the last free version was being maintained at SourceForge. I searched there for "dotnetmagic" and found nothing. Google showed a lot of references to the project at http://sourceforge.net/projects/dotnetmagic/, but SourceForge says this isn't a valid project.
-
nUnit "Features".
I was pulling my hair out today. I had a test fixture containing a particular test case I didn't want to run anymore -- but I didn't want to remove the code. Instead of adding the "Ignore" attribute, I simply commented out the attribute with "//". After re-compiling, the method was still showing up! I shutdown nUnit and restarted. There was the method! I checked it out with ILDASM -- no "Test" attribute. What was going on?!
-
"Severely discounted" VB.NET Training
Carl Franklin is giving back some training goodness to the INETA community:
-
The 'Optional' keyword
Thom Robbins had a quick post explaining the 'Optional' keyword in VB.NET. For those with a VB6/COM background, you should be aware that the optional parameters behave differently. I blogged about this last September (scroll down near the end of the post).
-
Reflector and Fonts
Kudos to Phil Scott for creating an add-in for Reflector that increases the font size to something suitable for presenting to a class. And further kudos for keeping the post up after being informed via a comment that it's simply a command-line setting. Thanks Phil! I learned something new today too!
-
Windows Update slow....
I went to the Windows Update Site today to make sure my desktop at work was properly patched to avoid the sasser virus. Boy, is it running S...L...O...W... Looks like a lot of other people are checking for the patch too.
-
Write Your Own .NET RSS Feed in C#
A great article on writing your own RSS Feed component in C#. Even shows you how to set up a custom HTTP Handler for .rss files.
-
One Week with RSSBandit
Last Monday I fired up SharpReader for the first time in close to five days. I was out of town the previous week and didn't have Internet access during the day. At night, I was either too tired or too busy to keep caught up on my feeds. During the lengthy update process, SharpReader locked up on me. I had to kill it with Task Manager. I started it up again and after a few minutes of updating, it was again locked up. I did this about two more times and it finally managed to complete the update process. I really don't know what was killing it -- the sheer volume of information to download? Perhaps. I was irked enough to download, install and try RSSBandit.
-
CodeDom Article
The Vice President of our local .NET User Group, Josh Holmes has gotten an article published on the Fawcette Reports web site. The article compares the CodeDom to Reflection.Emit.
-
.NET Developer Jump Start
A colleague just forwarded me an email he received about some free, online training sessions provided by Microsoft. They're supposed to be "a great way to get a sense of what .NET offers without making a commitment". Anyone reading this is probably well-versed in .NET, but others you know may be interested in this.
-
Quick IL Reference
If you're a casual browser of IL via ILDASM and are curious about an opcode or two, check out the System.Reflection.Emit.OpCodes class for a quick summary of what each of the opcodes does.
-
SharpReader & Threads
Anyone else have any instances where SharpReader's worker threads hang? Right now (and this happens at least once or twice a day) SharpReader is showing me "15+190" in the status bar (15 feeds busy updating with 190 still to go). And it's just sitting there. No updates are coming in. I've dropped the default number of threads to use down from 25 to try and correct the problem. I usually have to close SharpReader and re-open it and that fixes it
-
Unit Testing and the GAC
Note to self: If you make changes to an assembly that is in the GAC, make sure you uninstall it from the GAC before running your unit tests. I was doing some refactoring and changed the signatures of a couple of methods. Recompiled and ran my nUnit unit tests and was getting a very odd "System.MissingMethodException". I was baffled until I recalled that the old version of this assembly was still in the GAC so that's what my unit tests were running.
-
DotNetNuke Upgrade
I've gotten a number of questions regarding the upgrade of DotNetNuke I did for our local .NET User Group. It seems that before I fixed the problem (which, in reality, isn't really fixed yet) Google got it's virtual hands on the error message and it's now a top search result for DotNetNuke upgrade problems. So I'll repeat here what I've told a few other folks.
-
Offshoring: Not the easiest answer.
Dell admits it has "learned its lesson" after being forced to drop its Indian call center last year following customer complaints about the quality of service.
Read more... -
Handy KB Article on SQL Server Versions
Someone asked how to determine what version and service pack level of SQL Server you're running. I dug around on MSDN and found a handy KB article that shows you how!
-
Are RCW's not CLS-compliant?
I'm working on .NET assembly that interops with some old VB6 code. I've generated the wrapper with TLBIMP.EXE and everything is working fine.
-
Silence of the bits...
Yikes. Four weeks of no updates. I hate going that long but luckily, work has kept me busy with some .NET stuff so I can't really complain. Been busy with a couple of things outside of work too:
-
Case sensitivity!
Why don't more people use a case-sensitive SQL Server? I was installing the latest 1.x version of DotNetNuke and had some database problems. I found the database create scripts in the "database" subdirectory and decided I'd run them individually and see if anything pops up. It sure did! This code only works on a case-insensitive database. If your database is case-sensitive, the scripts fail. Why? How hard is it to write it against a case-sensitive database? That will guarantee that it will run on either one.
-
Oracle and data types
Today I was working on a factory class for database abstraction since the project I'm working on needs to support both SQL Server and Oracle. I had previously prototyped with Microsoft's .NET provider for Oracle but have switched to Oracle's ODP.NET data provider. When running my unit tests on the converted code I hit an error when creating an OracleParameter:
-
Next GANG Meeting
The next Great Lakes Area .NET Users Group (GANG) meeting will be held tomorrow, Feb. 18th at the Microsoft offices in Southfield, MI.
-
Why strong name an assembly?
DevelopMentor's Richard Blewett has posted an excellent set of bullet-points on some of the benefits of strong-naming an assembly.
-
Integrating WinForms with VB6
I wanted to add a dialog to an existing VB6 application, but I wanted to use some of the features of .NET (anchoring, docking, etc...). With COM-interop, I thought it would be pretty easy. For a test, I whipped up a super-quick WinForms app, but changed the output type from "Windows Application" to a "Class Library". I ran REGASM on the DLL to expose it to COM then placed it in the GAC. A few quick lines of VB6 code instantiated and ran the form:
-
What?! Win2k & NT4 Source Code Leaked?
-
Invalid PInvoke Metadata!
I was writing some new unit tests last night. I hadn't run the nUnit GUI since upgrading to VS.NET 2003 (and the 1.1 framework). When running a test that was connecting to a SQL Server, I got a wierd error:
-
Finally! Star Wars on DVD!
The Star Wars Trilogy on DVD to be released on September 21st.
-
Last Day for DevDays Early Bird Registration
-
Feeding the lawn?
So I'm working on a design document for a class. I hit F7 to check my spelling and grammar and it seems Word wants to change my "Serializable" class to a "Fertilizable" class. No thanks. I'll just add "Serializable" to my dictionary... :)
-
RSS Generator Component
Build an RSS Generator Component. From Visual Studio Magazine:
-
Javascript Calendar
-
Serialization and Inheritence
My problem with my approach in my prototype code was that I inherited from a class that implemented ISerializable. Normal serialization uses reflection to determine the members of an object to serialize (it's dynamic). An object that implements ISerializable usually does so to implement its own serialization -- i.e. not using reflection. Therefore, when you derive from a class that implementes ISerializable, the serialization probably won't see any extra fields/properties you've added to the class (I tested this in my prototype and that is exactly what happened when deriving from Hashtable).
-
Cont'd: Deserialization Problems
Anyone see the big problem with my approach below? I actually thought about this last night but didn't test it until this morning -- and my hunch was right. I'll post more when I get some time at lunch...
-
Deserialization Problems
While prototyping something today, I had an object that I wanted to be able to serialize out to disk. This object was derived from Hashtable, which already implemented the ISerializable interface so I thought I was all set. Serialization worked fine. Then I went to deserialize it and I got the following error:
-
Spirit's problem? Could be buffer overflow.
-
Versioning in .NET
I was doing some prototype work and wanted to investigate versioning issues. I was changing version numbers of some dependent assemblies and not having any problems with .NET finding the right version. I was puzzled at some of my findings so I checked the docs. My bad:
-
C#'s const vs. readonly
A quick synopsis on the differences between 'const' and 'readonly' in C#:
-
VS.NET Tip
Here's a simple VS.NET Tip:
-
Be careful with filtered Exceptions
While researching a good exception handling strategy for the company I work for, I came across an interesting issue with filtered exceptions.
-
Mars curse continues...
Before Spirit's triumphant landing, many news stories talked about the 66% failure rate of Mars land missions. Spirit's mission has been smooth -- until today:
-
Application Isolation and Assembly.LoadFrom
A thread on the Developmentor ADVANCED-DOTNET list produced a nice link explaining some of the intricacies of Assembly.LoadFrom. Here's a snippet:
-
Ian Griffiths Blogs!
I just noticed that DevelopMentor guru Ian Griffiths is blogging! If you've spent any time on the DevelopMentor .NET mailing lists, then you know Ian Griffiths knows .NET -- especially Windows Forms. Subscribed!