Andornot Consulting Inc.
Home Page
Home Page
 |  | 

Wednesday, September 10, 2008

Index Popups 2008.2.9.10 Update

Index popups for Inmagic Webpublisher Pro have been updated to fix some subtle bugs:

  • Entering certain characters in find box causes invalid XML errors.
  • Previous Page and Last Page do not work with some secondary fieldnames, or when fieldname is provided whose sentence case does not match actual field exactly.
  • Passwords are not passed through after the initial page. (Ok, not so subtle this one.)
  • Code fields can cause invalid XML errors.
  • Last Page fails if icsweb.ini/dbtwpub.ini SoapFormat=0 or SoapFormat=n and fieldname requires modification for XML use.

Unfixable issue:

  • Previous Page fails if icsweb.ini/dbtwpub.ini SoapFormat=0 or SoapFormat=n and fieldname requires modification for XML use. (Can only fix by changing SoapFormat=1 due to Webpublisher restrictions on fetching index lists with a key delta.)

Download Index Popups 2008.2.9.10 (~600 kB)

Labels: ,

Monday, January 28, 2008

Avoid Application Pool Conflicts

In IIS 6.0, different versions of the .NET framework can co-exist on the same website but must use separate application pools. Once a .NET process "grabs" the app pool, other .NET processes are denied its use and report generic server errors in the browser. Which .NET process gets an app pool first depends on which is first requested after an application pool recycle. For example the .NET 2.0 process might get the application pool first, and all .NET 1.1 applications that rely on the application pool fail to run; end users see generic server errors that do not report what is really going on.

Installing Inmagic Webpublisher or Genie

Although Webpublisher inmagicbrowse and Genie inmagicgenie virtual directories are correctly set to use .NET 2.0, the installer lets the parent website determine which application pool to use. A typical Windows 2003 Server might have .NET 1.1 and DefaultAppPool as the default on new websites. If there are any .NET 1.1 applications already on the server that rely on DefaultAppPool, then inmagicbrowse and inmagicgenie are setting the server up for an application pool conflict.

Separate Application Pools

Set up a separate application pool just for Genie, and one for Webpublisher. This way you avoid any conflict with applications currently on the server, but also allow for changes in .NET dependency in future: when Genie starts using .NET 3.5 you won't have to worry about re-organizing application pools. It's also good practice to isolate applications like this so that when one does go down, it doesn't take other applications with it.

Labels: , , ,

Thursday, November 22, 2007

Short Persistent URLs for Database Queries

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.

http://localhost/dbtw-wpd/exec/dbtwpub.dll?AC=GET_RECORD&XC=/dbtw-wpd/exec/dbtwpub.dll&BU=&TN=cars&SN=AUTO29781&SE=267&RN=0&MR=0&TR=0&TX=1000&ES=0&CS=1&XP=&RF=&EF=&DF=&RL=0&EL=0&DL=0&NP=1&ID=&MF=&MQ=&TI=0&DT=&ST=0&IR=1&NR=0&NB=0&SV=0&SS=0&BG=&FG=&QS=&OEX=ISO-8859-1&OEH=ISO-8859-1
 

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:

Porsche

Porsche

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.

Configuration

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

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

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:

<httpHandlers>
    <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"/>
</httpHandlers>

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

http://localhost/shorturl.ashx?qn=mycarquery

http://localhost/shorturl?qn=mycarquery

http://localhost/whatever/?qn=mycarquery

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.

Advantages

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

Labels: , , ,

Friday, June 15, 2007

How to install Inmagic DB/Textworks on Vista

Right-click on the db/textworks installer. Choose "run as administrator". You may be prompted to proceed and/or enter administrative credentials, depending on your Vista setup. The installer will start installing and should work fine.

If you do not run as administrator, you will get an error like this:

Error 1925. You do not have sufficient privileges to complete this installation for all users of the machine. Log on as administrator & retry installation.

You may be confused by this message if you are logged in as an administrator. Welcome to Vista's User Account Control (UAC).

With UAC, you may have logged in as an admin, but you are not running as one. Instead you are prompted to elevate your permissions whenever you attempt an administrator-level operation. It so happens that Inmagic has not updated db/textworks to handle this scenario and give you fair warning. The error message it gives upon failure is at least completely accurate in its diagnosis, but leaves it up to you to manually elevate your permissions.

Here are some other Inmagic-on-Vista related posts on the Andornot Developer Blog:

Labels: , ,

Thursday, June 07, 2007

Fixing short date strings in Textworks

The Problem

1000s of date strings in short date format like m/d/yy. Fine as long as system date settings assume month/day/year. Then system date settings change to day/month/year to conform with international standards. 1000s of date strings are misinterpreted.

E.g. 06/01/2007 Before = June 1, 2007 After = January 6, 2007

The Fix

  1. Export date field and unique ID field to delimited text file.
  2. Use regular expression to switch day and month:
    • find expression: (\d+)/(\d+)/(\d{4})
    • replace expression: \2/\1/\3
  3. Import modified file into Excel or Access, treating the date string field as DateTime so it's interpreted as a proper date, not a string.
  4. Change the format of the date field to a Long Date
    • Access query expression: Format([MyDate], "Long Date")
  5. Import the file with long date back into Textworks, matching on unique ID field; replace field values.
  6. Date strings are now in unambiguous Long Date format, e.g. MMM dd, yyyy.
UPDATE: This comic at xkcd.com is totally awesome. And relevant and stuff. comic

Labels: , ,