July 14, 2009

Converting Between List and String Types

These handy functions let you easily convert from a generic string List to a delimited string, or from a delimited string to a string List: /// /// Converts List to string with given separator./// /// The list./// The separator./// public static string ListToString( List list,string separator){ StringBuilder sb = new

Evaluating an Object’s PropertyPath

PropertyPaths are a very useful binding concept, and can be useful in other instances as well. However, .NET 3.5 does not support evaluating PropertyPaths against objects directly without using binding. Here’s a workaround: public static class DataBinder{ private static readonly DependencyProperty DummyProperty = DependencyProperty.RegisterAttached( “Dummy”, typeof(Object), typeof(DependencyObject), new UIPropertyMetadata(null)); public

Get a Table Description in Oracle’s PL/SQL

If you’re with an organization that requires you to document everything that you do (and if you’re not required to, there’s something wrong!), you’ll no doubt have to document any database changes and additions you make. But when some table hasn’t been documented, you can easily keep your audit trail

Encrypt and Decrypt Configuration File Sections from a Command Line

You may find that you need to encrypt some sections of configuration files (such as Web.config) to protect sensitive information. Yet you may also need to decrypt that information to debug a running application. You can do that in .NET 2.0 and higher using the aspnet_regiis.exe command-line utility. The utility

Determine Whether a Field Exists in an ADODB.Recordset

Sometimes, you may need to perform conditional logic based on whether a field does or does not exist in a recordset. To check for the existence of a field, simply loop through the ADODB.Recordset Fields collection, looking for the specified field name: Private Function FieldExistsInRS( _ ByRef rs As adodb.Recordset,

Embedded Jetty and Spring: The Lightweight Antidote for Java EE Complexity

n my 15 years as a software professional I’ve never seen a software stack as unproductive?not to mention as verbose or complicated?as J2EE, despite its enterprise-grade features. Every single J2EE project I have ever worked on ended the same way: me looking at long lines of Ant build scripts constantly

Understanding Java’s Integer Pool Can Avoid Problems

The next time you come across a situation where two Integers defined with equal values fail an equivalency (==) test, remember this tip. Suppose you have two integers defined as follows: Integer i1 = 128Integer i2 = 128 If you then execute the test (i1 == i2), the returned result