Monday, March 25, 2013

The Old Reader

Google Reader is dead!  Long live The Old Reader.  The Old Reader must be the de-facto replacement for Google Reader users.  I started my OPML import and got the following message

There are 33482 users in the import queue ahead of you

Friday, November 09, 2012

Close All But This

The Visual Studio nuclear option when dealing with tabs

Wednesday, June 13, 2012

updatepanels and a borked up HtmlEditorExtender control

I have run into a scenario where embedding an ASP.Net HtmlEditorExtendor inside of a updatepanel will result in the target control not rendering correctly.  This issue occurs when the extender and extended control are not initially present  (for instance when hosted in a edititemtemplate in a formview).

A quick workaround for this is to add a second textbox and extendor outside of the updatepanel.  You can then make the extended textbox invisible by setting its height and width to zero.  My guess is that the reason this corrects the issue is that some resources required by the htmleditorextendor (ie js and css references) never get loaded when the updatepanel is refreshed, but I will have to investigate further to determine the root cause of this issue.

Tuesday, November 22, 2011

Generate repeating strings with LINQ

I ran across a helpful snipped for generating repeating strings with linq today.  I needed to do something similar to the following (in python):

>>> 'chris' * 5

a comment on Igor Ostrovsky's blog provided the answer

string.Join(string.Empty, Enumerable.Repeat("chris", 5).ToArray());

Enumerable.Repeat() to the rescue!

Saturday, January 02, 2010

Halloween 2009

Here are some pictures that I have been meaning to upload from Austin's Lego Halloween costume. I put it together using the box from a case of Diet Pepsi, some pegs I cut out of a ceiling tile (because it was relatively soft and cheap), and some spray paint. I used a jigsaw to cut the ceiling tile and reinforced the box using some glue and extra cardboard before I sanded and painted it. Austin wasn't as crazy about it as I was until the candy started flowing :)

Saturday, July 18, 2009

List Excel Table Names (Sheet Names) with Iron Python

I thought I would share another Iron Python snippet I hacked together a few weeks ago. The PrintTables method accepts a OleDbConnection to the spreadsheet and returns a list of Excel Table (Sheet) names. You are going to have to add something resembling the following:
from System.Data.OleDb import OleDbConnection, OleDbDataAdapter, OleDbCommand, OleDbSchemaGuid

def PrintTables(connection):
names = []
schemaTable = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,Array[object]([None, None, None, "TABLE"]))

if (schemaTable and schemaTable.Columns.Count > 0):
nameIndex = schemaTable.Columns.IndexOf("TABLE_NAME")

for dr in schemaTable.Rows:
return names

Thursday, April 09, 2009

Validating Infopath 2003 DataConnections with IronPython

I have been using IronPython lately to write utility applications- Taking a break from C# to hack away in IronPython is great. Below is a snippet from a utility that I threw together to validate infopath 2003 dataconnections. Using mostly the clr System.Net and System.Xml libraries, I retreived the dataconnection webservice calls from my manifest.xsf file using the following xpath- "/xsf:xDocumentClass/xsf:dataObjects/xsf:dataObject/xsf:query/xsf:webServiceAdapter". I then passed the schema and serviceUrl xml attributes to the PrintStatus method, and ended up with output resembling:

OrderService -> OK

This utility is also handy to quickly verify that all your dataconnection hostnames are pointing to the correct environment- development, production or whatever.
Update: code modified to fixed a incorrect exception handling statement and also to change the "getstatus" method- it now returns a string instead of printing in order to simplify unit testing.
def QueryDataObjectUrl(url):
request = HttpWebRequest.Create(url)
request.Credentials = CredentialCache.DefaultCredentials
response = request.GetResponse()
statusCode = response.StatusCode
statusDescription = response.StatusDescription
except WebException, ex:
statusCode = ex.Response.StatusCode
statusDescription = ex.Message

return statusCode, statusDescription

def GetStatusString(name, urlString):
url = Uri(urlString)
statusCode, statusDescription = QueryDataObjectUrl(url)
if(statusCode == HttpStatusCode.OK):
return "%s -> %s ...%s" % \
(name, url.Host, statusDescription)
return "%s -> %s ...%s" % \
(name, urlString, statusDescription)
except UriFormatException, ex:
return "%s -> %s ...%s" % \
(name, urlString, ex.Message)

Monday, January 12, 2009

New Google Gadget Submission

I submitted a new gadget to google this evening that can be used to encode and decode URL querystrings. I took the javascript off of the Albion Research Ltd. website, which hosts one of the most useful pages on the Internet. I made a few minor updates including removing the form tags, substituting Google's _gel api shortcut in a few spots, and adding in a missing end "</TR>" tag. You can use the button below to add the gadget directly to your iGoogle homepage.

Add to Google

What was my motivation for doing this? To quickly encode and decode sharepoint list guid querystrings of course (without wasting anymore A.R. bandwidth)!

Wednesday, November 12, 2008

Error 0x80004005 while deleting a list field

A quick Sharepoint tip: While calling the UpdateList method of the Lists.asmx web service, you may receive a "Operation Failed" message while attempting to delete a field (with an error code of 0x80004005). One potential cause of this generic error message is that you are trying to delete a read-only field.

The work around for this problem is to simply update the field's ReadOnly property with a value of False using the same method before again calling UpdateList to delete the field.

Update: Another note- you can use the configuration page (http://site/_layouts/FldEdit.aspx?List=<listguid>&Field=<fieldname>) to quickly diagnose any delete field problems you are having as it seems to do a much better job of relaying descriptive error messages than the UpdateList web service does. Even though hidden and read-only fields may not be available through the sharepoint GUI, you can still access them by simply formatting the FldEdit.aspx page querystring as above.

Thursday, September 11, 2008

Programatically Connecting Sharepoint Smart Parts

I recently ran into a (admittedly esoteric) scenario where it made sense to programmatically connect Smart Parts that implemented the SmartPart.IConnectionConsumerControl interface. So, in order to wire up my Smart Parts (in a manner similar to what is described here) , I needed to do a quick search through the Smart Part source on Codeplex in order to identify the following SmartPart.IConnectionConsumerControl connection point IDs of "CellConsumer_WPQ_" and "CellProvider_WPQ_".

Then all that remained was to add code similar to the following to the FeatureActivated Event of my SPFeatureReceiver:

SPLimitedWebPartManager wpm = spFile.GetLimitedWebPartManager(PersonalizationScope.Shared);
WebPart WP1 = wpm.WebParts["WP1"] as WebPart;
WebPart WP2 = wpm.WebParts["WP2"] as WebPart;

if (WP1 != null && WP2 != null)
if ((WP1.ConnectionID.CompareTo(Guid.Empty) == 0)
WP1.ConnectionID = Guid.NewGuid();

if ((WP2.ConnectionID.CompareTo(Guid.Empty) == 0)
WP2.ConnectionID = Guid.NewGuid();

WP1.Connections = GetWSSConnectionsString(


private string GetWSSConnectionsString(Guid ProviderID, Guid ConsumerID)
string ConsumerInterfaceName = "CellConsumer_WPQ_";
string ProviderInterfaceName = "CellProvider_WPQ_";

return string.Format("{0},{1},{2},{3},{2},{3}",