Steve Trefethen
Contact me Send mail to the author(s)
About Me
View my LinkedIn profile


Powered by discountASP.NET
referal ID: sdtref
Why recommend discountASP.NET?

Archives
Tags
Disclaimer
The posts on this weblog are provided �AS IS� with no warranties, and confer no rights. The opinions expressed herein are my own personal opinions and do not represent my employer�s view in any way.
# Monday, July 28, 2008

Retrieving XML from Microsoft SQL Server

Posted @ 2:43AM

Categories: howto | Programming

Tags:  | 

A

fter completing work on the EDI Invoicing system I’ve recently started work on the other half of the equation, Purchase Order processing. There’s an existing system in place but it’s old, brittle and doesn’t support everything the system requires these days. The new CCNET based Invoice processing is humming along nicely and has handled over $3 million in invoices.

EDI CCNET Web Dashboard

Getting XML from a SqlDataReader

Like the invoicing system the purchase order side needs to query the database fetching PO data for conversion to EDI and transmission to the trading partner. I’ve been looking for clean ways to produce XML from a SqlDataReader and discovered this post by Roy Osherove. IMO, the interesting piece of that post isn’t necessarily Roy’s VB code but what’s found in the comments. Specifically, the comment I’m referring to is related to using a DbDataAdapter descendent like this:

public class DataReaderAdapter : DbDataAdapter { public int FillFromReader(DataTable dataTable, IDataReader dataReader) { return this.Fill(dataTable, dataReader); } protected override RowUpdatedEventArgs CreateRowUpdatedEvent(
DataRow dataRow,
IDbCommand command, StatementType statementType,
DataTableMapping tableMapping)
{ return null; } protected override RowUpdatingEventArgs CreateRowUpdatingEvent(
DataRow dataRow,
IDbCommand command, StatementType statementType,
DataTableMapping tableMapping)
{ return null; } protected override void OnRowUpdated(RowUpdatedEventArgs value) { } protected override void OnRowUpdating(RowUpdatingEventArgs value) { } }

A descendent is necessary here to help expose the inherited, protected Fill(...) method. Once you have the data in a DataTable you can simply call WriteXml() and viola! But there is an easier way (at least for MSSQL)!

Fetching XML from SQL Server using "FOR XML"

After mentioning the above to John Waters, Falafel’s CTO, he proposed querying directly FOR XML (literally), an MSSQL feature I wasn’t unaware of (no surprise there having been a non-database guy for so long). Using SqlCommand’s ExecuteXmlReader makes creating an XmlDocument very easy as you can see below. Simply setup the SqlCommand normally and use its ExecuteXmlReader() method:

using (XmlReader reader= command.ExecuteXmlReader())
{
   try
    {
       reader.Read();
       return new XmlDocument().Load(reader);
    }
   finally
    {
        reader.Close();
    }
}

The SQL statement looks like this:

1 SELECT * FROM SA_OrderHeader WHERE OrderHeaderID = @OrderHeaderID FOR XML, AUTO ROOT('details')

Notice "AUTO ROOT" which allows you to control the name of the root node of the returned XML document, very handy.

Having said all this I’m sure there are other ways to accomplish the same thing so please let me know what you’ve come up with.

# Thursday, July 17, 2008

TestComplete Training Online

Posted @ 1:21AM

Categories: Technology | Testing

Tags:  | 

I joined Falafel Software a little over a year ago now and in that time I’ve done a lot of online training for TestComplete. For those Delphi fans TC is written in Delphi a fact I usually slip into the training sessions. Online training is, or perhaps more accurately was a new business (it’s no longer new) for Falafel that I was able to pioneer. One thing I looked forward to when I changed jobs was the ability to try and do different things and online training is certainly different! I’d been straight-up programming for nearly a decade at Borland/CodeGear and at Falafel I’ve had the opportunity to be involved and have influence in many different parts of the business which has been a lot of fun.

Presenter’s view of online training

When I sit back and think about all the technology used during TestComplete online training I’m really amazed. We use a multitude of software to present all of the different testing functionality TC supports including:

TestComplete Made Easy
  • TestComplete (of course, that’s obvious right)
  • Microsoft’s PowerPoint
  • GotoMeeting the software that powers desktop sharing
  • AutomatedQA’s Remote Agent for Distributed HTTP Load Testing
  • Virtual PC to demonstrate Distributed testing support
  • NUnit to demonstrate TC’s integrated unit testing
  • VS.NET 2008 to demo support for:
  • Microsoft SQL Server Express 2005 to demonstrate Data Driven Testing (DDT)
  • Visual Studio Team Foundation Server to demonstrate TC’s integrated support
  • Automated Build Studio if/when the discussion leads to Continuous Integration
  • Acrobat reader for the TestComplete Made Easy courseware (which I helped author) and that you can print for yourself from Lulu.
Out of all of this GotoMeeting is the software that facilitates online training and is very cool. It allows for sharing of one’s desktop to multiple PC’s at the same time in different locations. Connecting to GotoMeeting is very straight forward and I’ve yet to run into any problems setting it up which is saying a lot. Additionally, you can turn control over to an attendee as well as display an attendees desktop. In fact, I’ve conducted a number of classes with people scattered around the country which is interesting in and of itself. (Note to attendees, when you ask to share your desktop be sure you haven’t been chatting something in the GotoMeeting chat window you wouldn’t want others in the class to see :-) ) Here is a screenshot of what things look like on the presenter’s end of things:

TestComplete Online Training Desktop

As you can see there’s quite a bit running not including any of the sample applications used to illustrate features.

Along with the online training Falafel provides the above book in PDF form as well as source code to all of the examples and additional TestComplete projects illustrating nearly every type of testing supported by TC.

Since referral commissions go in my pocket this post wouldn’t be complete without a plug right? So, if you or your company is interested in either online or onsite training on AutomatedQA’s TestComplete please contact me and I’ll be happy to provide you more information or help get you signed up!

# Monday, July 14, 2008

Screenshots on the iPod Touch and other enhancements in v2.0

Posted @ 11:11PM

Categories: Tips

Tags:

iPod Touch screen shot feature in v2.0
With the release of v2.0 firmware for the iPhone/iPod Touch Apple added a much needed feature which is the ability to take screenshots. If you hold the home button down and press and release the power button the screen will blank out for a split second giving the illusion of a photo being taken, a very nice touch. The screenshot is stored in your photos and easily accessible. When you reconnect to Windows you’ll first see this prompt:

Windows AutoPlay dialog for importing iPod Touch pictures

If you select the highlighted option you’ll see the following prompt:

Vista’s Importing Pictures and Video dialog

Which will allow you to quickly grab these screenshots for use in things like blog posts.  :-)

Keyboard Improvements

There are a number of other nice features in the v2.0 firmware like this minor but super useful change in keyboard layout (below left). Notice the spacebar is 1/3 size and the @ symbol and the period are provided for things like email addresses. The screenshot on the right illustrates the new password handling where the last character that you typed stays on screen for a second before switching to a dot which makes it easier to correctly enter passwords (notice the spacebar in this case is full size).

image   image

# Saturday, July 12, 2008

Review of iPhone v2.0 applications

Posted @ 12:37AM

Categories: Recommended

Tags:

I’m going to use this post to rate the iPhone/iPod Touch applications I’ve tried using a one to five rating. In alphabetical order:

  • Apple’s Remote -  
    I think this is a great little app.
  • Banner -  
    Cool scrolling LED sign app, free but missing a number of key features like scroll speed, color etc. still cool
  • Bloomberg -  
    Ignore’s accelerometer so no wide screen reading. I think I like the white text on black but we’ll see. Portfolio tracking could be a bit better but hey, it’s free!
  • BofA Banking App -
    It’s just their web site in an app
  • Facebook -  
    The update-to-date address book alone is awesome
  • Google’s Mobile App -
    Like BofA there are just a bunch of links to web apps. I’ll have to play more with the search capabilities to see how those improve on the web version.
  • NY Times -
    Seems pretty slow, though nice to have.
  • Pandora - (added July 13, 2008)
    Radio comes to the Touch!
  • Tap Tap Revenge - (added July 16, 2008)
    I can’t stop laughing when the dots start streaming down faster than my reflexes can handle!!
  • Where -
    For the longest time it displayed the large red "W" then returned to the home screen. IOW, it did nothing. I think their servers are probably getting pounded as just browsing to www.where.com is very slow or times out. It’s working now though only in pieces but I can see there is a ton of stuff to look at. I’m not sure I like bubble selector at the bottom.

What apps are you liking?

# Friday, July 11, 2008

Apple's Remote iPhone application rocks!

Posted @ 10:39PM

Categories: Recommended

Tags:

image

With the introduction of v2.0 of the iPhone/iPod Touch software Apple introduced an application called Remote giving you the ability to remotely (surprise) control iTunes on your computer and yes, it’s two way. Personally, I’ve been wanting this sort of functionality for a long time as I’ve had my computer connected to my receiver so I can listen to my Yahoo LaunchCAST station. The downside is the lack of control as my computer is upstairs in my office and my receiver is downstairs in my family room. With Apple’s Remote application can control what’s playing from anywhere in the house, very nice!

I think Remote is a great example of how the iPhone is going to showcase new ways for people to interact with their PC’s remotely. I can already imagine a dozen other situations where I’d like to be able to remotely control other applications on my machine.

Now, where’s Remote Desktop?  :-)

iPod Touch 2.0 finally available only I can't download it

Posted @ 7:47PM

Categories: Hardware

Tags:

Like pretty much everyone it seems I’ve been awaiting the update to v2.0 of the iPhone/iPod software and according to iTunes an update is available as of 7:30pm PST however:

We could not complete your iTunes Store request 
I’ve been able to download a number of what appear to be interesting applications so I’m definitely interested in getting my iPod updated. Here’s what I’ve found:

iPod Touch Applications - Facebook, Google Moblie, NYTimes, Remote, ShoZu, WHERE 
Anyone else find something interesting?

Also, anyone know if the new Exchange support works with Intermedia’s hosted Exchange servers?

[Update: July 11, 2008 9:27pm PST] Now downloading...
[Update: July 11, 2008 9:31pm PST] Backing up, preparing for restore...
[Update: July 11, 2008 10:00pm PST] Done installing, exploring the above apps. Google’s app seems very lame as it’s just a bunch of icons to web pages, what am I missing??


Other iPod posts:
Is the new iPod Touch worth it?
My answer to Apple’s iPod Touch is it worth it?
Protecting the iPod Touch with an Agent 18 Shield Case

# Wednesday, July 02, 2008

Setting Subsonic's connectionstring at runtime

Posted @ 11:51AM

Categories: Open Source | Tips

Tags:  | 

I’m a fan of the Open Source project SubSonic, spearheaded by Rob Conery of Microsoft, which describes itself thusly:

A Super High-fidelity Batman Utility Belt. SubSonic works up your DAL for you, throws in some much-needed utility functions, and generally speeds along your dev cycle.

I’ve seen a few questions on the Internet about setting the SubSonic connectionstring at runtime and thought I’d post what I’ve done. SubSonic includes a tool to generate a DAL for you which picks up settings from your .config file which provides the connectionstring among other things. I’m using SubSonic in a plugin to CruiseControl.NET for EDI processing and here the portion of my ccservice.exe.config file related to SubSonic:

<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" requirePermission="false"/> </configSections> <connectionStrings> <add name="Velocity2" connectionString="Data Source=db;Initial Catalog=db;Persist Security Info=True;" providerName="System.Data.SqlClient" /> </connectionStrings> <SubSonicService defaultProvider="Velocity"> <providers> <clear/> <add name="Velocity" type="Subsonic.SqlDataProvider, SubSonic" connectionStringName="Velocity2" generatedNamespace="VelocitySubSonic" includeTableList="AR_*,CORE_*,EDI_*,II_*,IN_*,SA_*" excludeProcedureList="WMS_InsertImportQueue" /> </providers> </SubSonicService> ...

One of the things I wanted to do is override the connectionstring using a property on my CCNET plugin. To do that I implemented a property like this:

[ReflectorProperty("connectionString")] public string ConnectionString { get { return m_connectionstring; } set { m_connectionstring = value; SubSonic.DataService.GetInstance("Velocity").SetDefaultConnectionString(value); } }
The instance name comes from the name used in the config file above then simply call SetDefaultConnectionString and voila the SubSonic connectionstring is now set at runtime.