Short Persistent URLs for Database Queries

by Peter Tyrrell Thursday, November 22, 2007 5:09 PM

Inmagic Webpublisher canned query URLs can be very very long, so I wrote a .NET HttpHandler that shortens them and bolsters their persistence into the bargain.

Here's an example of a very long Webpublisher query string that displays a single record from the sample cars database.


See? Looooooooong. Not at all memorable, and difficult to display or pass around. But with the handler in play, I can now shorten it:

Both get the same result:



A classic best-seller, the Porsche 911's anodized aluminum tub chassis has a strong front brace for extra support. A steel mount holds the engine snugly in place. Mounted on 25-degree caster blocks, the A-arms are longer than most and can be adjusted for low-speed steering or short tracks. The upper links have coated turnbuckles which can also be adjusted for different terrains. The rear suspension uses extra-long arms and variable shocks. The engine is side mounted and sits lower than many models. The clutch, which happens to double as the brake drum, is mounted on the crankshaft.


In the case of the short URL, the original query remains valid, but is held in the application's web.config:

        <add name="mycarquery" uniqueIDField="Product-Number" queryParameters="/dbtw-wpd/exec/dbtwpub.dll?AC=qbe_query&amp;TN=cars" />

The original query is called upon with an alias: qn=mycarquery. The id parameter is appended to focus the query to a single record, or, if no id parameter, the base query is run as-is.

The short URL path is /shorturl.ashx, but this is completely imaginary. And configurable in web.config:

    <add verb="GET" path="shorturl.ashx" type="Andornot.Web.PermanentUrlHandler"/>
    <add verb="GET" path="/shorturl" type="Andornot.Web.PermanentUrlHandler"/>
    <add verb="GET" path="whatever/" type="Andornot.Web.PermanentUrlHandler"/>

Using the examples above, any one of the following would be valid.




None of the paths exist on disk, which is what an HttpHandler is all about. The handler hijacks the request to any path bound to it, whether the path exists on disk or not.


Mapping entire queries to simple aliases has some immediate and obvious advantages:

  • Short URLs.
  • URLs are friendlier, more memorable, and hackable. (If you are trying to make your information available this is a *good* thing.)
  • You can map almost any URL path you want to the handler, in order to organize query paths into pleasing hierarchies of your own devising:
    • e.g. /catalog/queries?qn=mycatalogquery
    • /archives/photos?qn=myphotoquery
    • etc.
  • You can define and update queries in one central location.
  • URLs become more persistent. Modifications to queries will not break URLs already in the wild:
    • Switch from Dbtext to Content Server without breaking any canned queries
    • Switch display forms or any parameter
    • Switch hostname, even

SubSonic Code Generation within the Visual Studio IDE: Step-by-Step Instructions

by Ted Jardine Tuesday, November 20, 2007 1:19 PM

Update: the title of this post is probably misleading as it's not all the steps for using SubSonic. There's plenty of material out there already on that (for i.e. how to set your build provider for Web Site Projects, how to set your config files for class libraries or Web Application Projects, how to set up your database, etc.) - the best place to start looking for that info is This post refers to how to get using the subsonic.exe from within Visual Studio to regenerate your code on demand.

I've been using SubSonic for one of my latest projects and I really like what I've seen thus far. I'll save a further review for a possible other post, but since I've just repaved my machine and I'm setting everything back up again, I had forgotten how to configure the Visual Studio IDE to easily regenerate code using SubSonic (with a Web Application Project or Class Library - not the auto build provider).

Rob Conery has a good Webcast on how to do it all (if you haven't viewed it yet, head over now and do so), but it's a little tedious to work your way through the whole Webcast in order to pick out tool setup instructions. Therefore, I figured I'd jot down how to set up SubSonic DAL generation scripts for easy generation of code in Web Application Projects or Class Libraries. In other words, instead of having to open a command prompt all the time and specify what you want generated and where etc., just create some toolbar items and/or macros to do it for you on demand right in the Visual Studio IDE.


Reference External Tool

  • Tools -> External Tools -> Add
  • Settings for new External Tool:
    • Title: SubSonic DAL
    • Command (to your local sonic.exe location): C:\Program Files\SubSonic\SubSonic 2.0.3\SubCommander\sonic.exe
    • Arguments (means execute the generate command to, in my case, a generated directory in my class library - in other words, where my web.config/app.config file is with all SubSonic config options set): generate /out Generated
    • Initial Directory: $(ProjectDir)
    • Use Ouput window: checked
    • Prompt for arguments: checked (optional)




Create SubSonic toolbar with SubSonic DAL button (optional)

  • Right-click anywhere on blank menu bar and select "Customize"
  • Click "New" for new toolbar and save as "SubSonic":

  • Switch to Commands tab and then select category "Tools"
  • Select External Command n where n is the position of your newly referenced SubSonic DAL tool in the Tools menu:

    In the screen shot above, it's External Command 6. On a new machine with nothing else on it, the number will be External Command 2 as there's only one other tool before it in the menu (Dotfuscator Community Edition).
  • Drag and drop External Command n to the floating SubSonic menu you had just created:

  • When you now press close on the Customize dialogue, your SubSonic menu should now reflect your tool name. In this case that would be "SubSonic DAL."
  • Drag your floating toolbar to wherever you want it on your menu bar. Now, to generate code you can click on it from the Tools dropdown menu, or directly on your menu bar. Of course, you could just go further and create a macro.
  • Note: make sure you're actually in your SubSonic project where your app.config is located when you execute the command - nothing bad will happen if you don''s just that nothing good (code generation) will happen either.



Create another external tool that runs the SubSonic DB versioning command (scripts schema and data for your database!)

  • Do exactly as above for the SubSonic DAL tool, but instead put in the command "version /out \DB"


Tags: tools

Andornot Newsletter - November 2007

by Administrator Thursday, November 15, 2007 3:41 PM
Please check out the latest issue of our newsletter at

In this issue:
  • Andornot Calendars
  • Latest Andornot News
    • Imagine Canada
    • OneSearch at the Saskatoon Public Library
    • City of Burnaby
    • S.J. Mckee Archives and Special Collections
    • BC Teachers' Federation
    • New Brunswick South-East Regional Health Authority
  • Inmagic Updates
    • DB/TextWorks and WebPublisher PRO version 11
    • Inmagic Passes 200th Genie Milestone
    • @Inmagic Newsletter - October 2007
    • Inmagic Partner Days
  • Upgrade pricing
  • Training Workshops
  • Quick Tip
  • Cool Tools
  • Latest Posts from our Developers' Blog
  • New Arrivals
    • Hello Evvy and Calem!

Tags: News | newsletters

Vista, Skype, and a Bluetooth headset

by Peter Tyrrell Wednesday, November 14, 2007 12:05 PM

I've always wanted to sit by the phone looking as sexy as all get out with a great coif, blindingly white teeth, and a weency wireless headset perched on my ear, ready to take your calls. So, this past week, because I could stand it no longer, I purchased a Bluetooth headset and a USB Bluetooth adapter to use with Skype. (The extreme dentistry and plastic surgery makeover will have to come at a later date.)

I had a little trouble getting things to work, but I won through in the end, and now have hands-free Bluetooth telephony working with Skype on Vista.

The Gear

I purchased a Plantronics 510 Bluetooth headset, and an IOGEAR USB Bluetooth adapter, which together cost me $135 from Costco (in Canada). Of course it would have cost me quite literally HALF that if I ordered the same items from the USA, but I was worried I might not even get them working together, and Costco has a fabulous return policy.


Plantronics 510 Bluetooth headset


IOGEAR USB Bluetooth adapter

The Install

I plugged the USB Bluetooth adapter into a free USB port on my desktop machine, and allowed Vista to install native Microsoft Bluetooth drivers, instead of installing drivers from the supplied IOGEAR install CD. This was, in hindsight, probably a mistake. But whatever.

I had the headset paired with the USB adapter in a matter of minutes, but couldn't get any actual sound through to the headset from Skype or anything else. Nor, going the other way, could the computer pick up anything from the headset microphone. So it was "connected" (that's good) but didn't actually work in any way (that's bad).

The Pain Point (or, the Microsoft Bluetooth Stack)

Obviously the Bluetooth drivers were to blame (I said to myself). Maybe I should have installed drivers from the IOGEAR CD after all. Except that I couldn't. The setup.exe on the CD would start... but then just wouldn't proceed. There it was in the taskbar. Doing nothing.

Well, I'm no procmon ninja, so I went to IOGEAR's website to download the latest drivers. And indeed, there was a significant update. You can't trust the drivers that ship with a device anyway, since who knows how long the thing has been gathering dust on a warehouse shelf.

And so I tried to install the latest drivers, but again, setup.exe ran, and did nothing. Curse you, IOGEAR: may a thousand slammer worms infest your intimate recesses.

So I was stuck. Except that when I peered at the teensy tiny pictures in the PDF install manual that came with the latest drivers, I happened to notice that the installer was really just a wrapper for a Widcomm Bluetooth driver set. A-ha!


Yes, this picture in the IOGEAR install manual, in all its original no-quality glory. "Next" is helpfully circled. How nice.

Long story short, I eventually found my way to the original source for Widcomm Bluetooth software in a Windows environment: That installed correctly.

Interestingly, the install seems to add on and plug in to the existing Microsoft Bluetooth stack rather than eradicating and replacing it. A bunch of new functionality appeared in the Bluetooth device settings control panel, including a checkbox to "control Skype(tm) calls using a hands-free device". Well!


Control Skype(TM)? Yes, please!

Windows help was also updated to include some blurb about the new functions, which mostly deal with sharing files and calendar information with Bluetooth-enabled devices.


I'm certain that any ordinary citizen consumer would have gone completely postal in their attempt to get the Bluetooth headset working with the USB adapter. It was definitely not plug n' play.

It's quite unclear to me why the default Microsoft Bluetooth stack is so crippled, and why it doesn't install the full and complete Widcomm Bluetooth driver set right off the bat, or at least alert me to that option. Also, it didn't help that IOGEAR made it appear that I needed an IOGEAR branded driver set, and could only provide a mortally wounded installer, when I really just needed the latest openly available Widcomm drivers.

But, the hands-free headset now works, and the sound quality is very good. I switch from desktop to laptop with ease, as well. I haven't quite figured out how to control Skype from the headset, but that's a minor inconvenience.


DB/TextWorks and WebPublisher PRO version 11 - announcement of release schedule and new features

by Administrator Friday, November 02, 2007 9:17 AM
Inmagic, Inc are currently working on the development of version 11 of DB/TextWorks and WebPublisher PRO.

"The upcoming release of DB/TextWorks and WebPublisher PRO, Version 11, is an important release for customers preparing to migrate to the Microsoft® Vista operating system, and will include numerous new features for improved ease of use and overall user experience.

Inmagic plans to release v11 of DB/TextWorks in late 2007/early 2008. The release of WebPublisher PRO v11 is planned for Q1 2008, after Microsoft releases Windows 2008 Server, to ensure compatibility with Windows 2008 Server. "

See the Inmagic website for a list of new features and functionality. All clients with a current maintenance subscription as of the release date will receive emails with download information. Andornot will also post a news update as soon as the new releases are available.

Please contact us if you have any questions about your maintenance subscription or would like pricing to upgrade to these latest versions.

Tags: News

Month List