Geeks With Blogs
Eron Wright - All Killer No Filler blog
21
Mar 06

Join me at my new blog at MSN Spaces.  Thanks geekswithblogs for the solid hosting; I plan to leave these posts up here until Spaces can import them in some magical future.



You might be wondering why some classes in the .NET Framework have properties, other classes have GetXXX methods, and some have a combination of the two. The reason is that the semantic, or meaning, is quite different. Consider this class: public class Customer{ public int CustomerID; public string FirstName; public string LastName; public Order[] GetOrders() ......

If you work with SQL Server 2000 and FOR XML functionality, you curse Query Analyzer probably as often as I do. Here are some tips for improving the output: In QA, set “Maximum Characters per Column” setting to 2033 Execute DBCC TRACEON(257) to pretty-print the XML output http://www.winnetmag.com/SQ... ......

You can convert local datetime values to UTC datetime values, and vice-versa, using the built-in GETUTCDATE() function: DECLARE @LocalDate DATETIMESET @LocalDate = GETDATE() -- convert local date to utc dateDECLARE @UTCDate DATETIMESET @UTCDate = DATEADD(Hour, DATEDIFF(Hour, GETUTCDATE(), GETDATE()), @LocalDate) -- convert utc date to local dateDECLARE ......

Comments within a C# method body tend to A) make a problem statement then B) document the steps to solve the problem. The problem statements tend to be multi-line; the details of the solution tend to be single-line. I want the problem statements to stand out. Traditionally I use #region blocks to group the problems. Unfortunately, regions are single-line. ......

I am struck by the consequences of the experience Craig relates in this post: http://staff.develop.com/ca... He is discussing a Wiki site that mysteriously had its page content rolled back to a previous version. Wiki pages generally contain a link to do this, and it is assumed that ......

When catching an exception in C# you need not declare a variable for the exception instance if you do not need it. This will avoid the “unused variable” warning. try { /* ... */ } catch(Exception) // catches without assigning to a variable { // ... } Here is how to rethrow an exception without affecting the stack trace: try { /* ... */ } ......

Edamno has released a VB.NET library for creating various shell extensions Browser Helper Objects Context Menu Handlers IE Menu Buttons InfoTips Property Sheets Thumbnails http://www.mvps.org/emorcil... He also has a library for working with Windows Task Scheduler, and, most importantly, a library for working with OLE ......

It is a known hard problem to match nested parenthesis pairs using regular expressions. Put another way, regular expressions to not typically support counting occurrences. .NET has a little-known RegEx construct for doing just that called the “balancing group definition“: Balancing group definition. Deletes the definition of the previously ......

If you are using IHttpHandlers to serve dynamic content, or generating a large directory structure to be served statically, here is some information you should know. We use a custom IHttpHandler to dynamically serve (and cache) images from our database. For simplicity, the handler uses Request.PhysicalPath as the ultimate cache location. That is, a ......

I have heard Don Box speak about the caviats of using the Indigo service model. He states that service classes should not use transport-specific API - notably the use of HttpContext. The logic is obvious. The problem is that my ASMX web services must often use XSD files that are in the same directory as the ASMX file. HttpContext.Current.Server.... ......

Have you wondered how the XSD tool and the WSDL tool in the .NET Framework can target numerous managed languages? Internally, it uses a great technology called CodeDOM. CodeDOM is a set of classes in the .NET Framework that facilitate code generation. Here is a sample of CodeDOM in action, generating an Order class. using System;using System.CodeDom;using ......

I am so sick of seeing this incorrect usage of try..finally: Stream s = null; try { s = new FileStream(...); ... } finally { if(s!=null) s.Close(); } This is WRONG. The work done in the finally block need only be done if the stream is opened. Until the assignment of 's' completes, the finally block is not to be executed. The 'if' statement is basically ......

I just realized that partial classes will encourage AOP. A small example of this is with respect to import statements. A class might have a dozen import statements. Each import relates to specific functionality of the class. If those functions are largely independent, you can now separate them into multiple partial classes, even within the same source ......

Since seeing MR I have been puzzled over the ending. Last night, I realized something that has really helped. Agent Smith is deleted. It comes down to purpose. Agent Smith's purpose is to kill The One. We are told many times that once a program's purpose is fulfilled it is deleted. Neo sacrifices himself to fulfill Agent Smith's purpose, and thus make ......

Check out this color picker!  Selects the entire scheme for you.  Also, don't miss the “Scheme” dropdown and the brightness/saturation sliders.  RAD!

http://www.pixy.cz/apps/barvy/index-en.html

 



Hello, another thread compelled me to spell out what my supposed state-of-the-art thinking is on database object names. Sql Server has no concept of a namespace for object names. That is, all names for tables and views (and more) must be unique. Well, there is in fact a single namespacing concept - the owner! We create owners for the logical namespaces ......

Regarding PDC, I had a blast! I am pumped about Whidbey, Yukon, Longhorn…everything. Great to be back with my family, Tonya and Ava. Oh and another in beta! The Yukon caching stuff demands a renewed search for “indexed view”-friendly queries. That is, to benefit from Yukon’s cache invalidation stuff, you must follow the constraints ......

Rob Howard presented the expanded support for caching in ASP.NET. Two main features were presented: CacheDependency is now extensible. By overriding a small set of virtual methods, you can implement any cache dependency scheme. For example you can call a web service to check the validity of some data. You can use your custom CacheDependency instance ......

Did you know that you can achieve table-level cache invalidation with ASP.NET today? Here's how: The stock ASP.NET 1.0 CacheDependency class can monitor a local or network file. As the file changes, the appropriate cache entries are evicted from the cache. We can leverage this to achieve near-realtime cache invalidation as database data changes. Write ......

I hammered the SQLXML guys at the PDC today. I want to know whether SQLXML is regarded (rightly) as awesome progressive technology, or merely a step towards either ObjectSpaces or (worse) XML datatypes in Yukon. Some points: SQLXML is not deprecated. It has been ported to fully managed code for Whidbey timeframe. In terms of the internal implementation, ......

Found an interesting paragraph in an iisanswers article. Have not verified this information. http://www.iisanswers.com/a... Connection Limits XP Pro allows 10 connections. This limit is installed by default in the metabase key MaxConnections for W3SVC, and there is no user interface method for modifying the setting. You can change this ......

Wondering how ASP.NET page caching relates to IIS6 kernel-mode caching? With output caching enabled for a Web Form, the page will be served directly from the Windows Server 2003 kernel if VaryByParam=“None“ and no other Vary settings are specified. The framework will not be called in any way - Application_BeginRequest will not fire. If VaryByParam, ......

Alright!  I've been frozen for 30 years but now thawed and ready to blog!

What is karmatron dynamics?  The very science of human destiny!



Copyright © Eron Wright | Powered by: GeeksWithBlogs.net