Fix CSS positioning and floats in IE

by Peter Tyrrell Friday, February 20, 2009 1:15 PM

I run into CSS position problems with IE6 every so often when using elements that float, or with position:absolute inside a position:relative parent. Not so often that I immediately recall how to fix it, of course, and each time the problem crops up it's just different enough from last time to appear as a separate and unrelated problem. Here's hoping that writing it down will make it stick. And of course, I get some catharsis in pointing a hysterical finger at that Great Satan behind all the problems, IE6 itself, which Norway has declared war on. I'm cheering for Norway, but IE6 has all the staying power and good looks of the cockroach, so I rather suspect it will smugly survive the Norwegian Gambit and become the official browser of the post-nuclear-exchange web.

The best description I've ever read of IE's layout deficiencies are covered in depth in the "On having layout" article at http://www.satzansatz.de/cssd/onhavinglayout.html, but for those who are more interested in applying the fix quickly without whys and wherefores, here it is: force the element to have "layout" by applying a width or height. There is more than one way to do this, but the following fulfills my needs.

Part One - zoom:1

Zoom is an MS proprietary CSS property that forces layout to any element in IE5.5+. Hide zoom with conditional comments if you want the CSS to validate. Doesn't work on IE5.0.

   1: <!--[if lte IE 7]><style type="text/css">
   2:     .someElement { zoom:1; }
   3: </style><![endif]-->
   4:         

More info in the "On having layout" article on hack management: http://www.satzansatz.de/cssd/onhavinglayout.html#hackmanagement.

Part Two - Standards Mode

This should really be part one. Do not allow your website to render in quirks mode! Choose and use a valid doctype before designing your layout so that all browsers render your pages in standards mode. Else you really cannot count on this fix or any other. Unless of course you are designing your site to only be viewed in IE6 come the onset of that nuclear winter, in which case you will also want to consider the usability requirements of your primary end user: the cockroach.

 

Tags:

How to make and use file DSNs for Inmagic ODBC

by Peter Tyrrell Sunday, January 25, 2009 12:24 PM

There are three ways to set up a DSN for ODBC connections: System DSN, User DSN, and File DSN. The first two store the connection settings in the registry, while the third stores all the connection info in a text file. The latter can be easily copied, filed with its parent project, put in source control, and modified by a build process. Plus just having that file there is a reminder that an ODBC connection is an application requirement. (Oh, I *have* forgotten.)

Create the file DSN

You can create a file DSN by opening the ODBC Data Source Administrator dialog (listed as "Data Sources (ODBC)" from the Windows Start Menu), but I have encountered problems doing it that way.* It's easy to do from scratch, anyway.

  1. Create a text file with a .dsn extension: MyFileDsn.dsn
  2. Fill in the contents as follows:
   1: [ODBC]
   2: DRIVER=Inmagic DB/Text Driver (*.tba)
   3: READONLY=1
   4: SERVER=NotTheServer
   5: DBQ=c:\project\textbases\
   6: PWD=INMAGIC
   7: UID=

Notes:

  • Each key-value pair is on its own line separated by a carriage return. Ignore the fact that the view you're looking at on the blog may be wrapping.
  • The Inmagic ODBC driver must be installed on any machine using this connection.
  • ReadOnly can be set to 1 for readonly access. READONLY=0 means write access as well.
  • PWD can be blank if the textbase(s) don't use passwords.
  • UID is always blank.

* E.g. password not being written to the file DSN, and the potential for confusion between 64bit and 32bit ODBC Data Sources, since a 64bit machine has both and has separate Admin dialogs.

Use the file DSN

Pass a connection string to your application which points to the file you created:

   1: // C# file DSN example
   2: string connectionString = "filedsn=c:\MyFileDsn.dsn";

 

Tags: Inmagic ODBC

Index Popups 2008.2.9.10 Update

by Peter Tyrrell Wednesday, September 10, 2008 12:44 PM

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)

 

Virtual PC 2007 networking tip

by Peter Tyrrell Friday, September 05, 2008 5:21 PM

If you want to interact with a virtual machine as part of your network, you need to adjust its networking settings to specifically use one of the host machine's network adapters.

Don't set the adapter to "Shared networking (NAT)". This isolates the virtual machine behind the virtual networking adapter. You'll find you can't even ping the VM from the host.

Good for interacting

vm_adapter_set

Bad for interacting

vm_nat

Tags:

DB/Text trace log format method

by Peter Tyrrell Tuesday, August 05, 2008 11:15 PM

Further to my post of May 2007, where I described how to create a trace log in DB/Text and handle exceptions, here is a method that is handy for building more complex log statements.

   1: // construct formatted log statement
   2: function logFormat(val, arg1, arg2, arg3)
   3: {
   4:     var formattedVal = val;
   5:     if (arg1 != null)    {
   6:         formattedVal = formattedVal.replace("{0}", arg1);
   7:     }
   8:     if (arg2 != null) {
   9:         formattedVal = formattedVal.replace("{1}", arg2);
  10:     }
  11:     if (arg3 != null) {
  12:         formattedVal = formattedVal.replace("{2}", arg3);
  13:     }
  14:     log(formattedVal);
  15: }
  16:  
  17: // write log statement to form box
  18: function log(val)
  19: {
  20:     var box = Form.boxes("boxDebugLog");
  21:     if (box == null)
  22:         return;    
  23:     
  24:     if (box.content != '')
  25:     {
  26:         box.content += "\n";    
  27:     }    
  28:     box.content += val;
  29: }

Overview

logFormat takes a string value and up to 3 arguments, and replaces tokens found in the string value with those arguments. It's based on C#'s string.Format method, and others like it.

Example

It's easier to read (and write) a format string that contains tokens than a string concatenated together with plus signs.

   1: var count = 10;
   2: var name = "Peter";
   3: var duration = 30;
   4:  
   5: function LogTheOldWay()
   6: {
   7:     log(name + " was lashed with a wet noodle " + count + " times for " + duration + " seconds.");
   8: }
   9:  
  10: function LogTheNewWay()
  11: {    
  12:     logFormat("{0} was lashed with a wet noodle {1} times for {2} seconds.", name, count, duration);
  13: }

Update

My example above only proves how piddly my skills really are. There's a *much* better way of doing this that allows for n arguments instead of a maximum of three. I had forgotten that every javascript function has a local property called arguments that contains all parameters passed to the function as an array.

   1: function logFormat(val)
   2: {
   3:     var formattedVal = val;
   4:   for(i = 1; i < arguments.length; i++)
   5:   {
   6:     formattedVal = formattedVal.replace("{" + (i - 1) + "}", arguments[i]);
   7:   }
   8:   return formattedVal;
   9: }

Month List