Tuesday, November 25, 2008

having trouble with no "active" class being generated for menu's or primary/secondary links (
  • ) in Drupal 6.x? It has been documented that 6.x has issues with generating an active class ... at 6.5 the active
  • is classed as "active-trail", so if you are bringing in a theme that worked at 5.x this might be the issue.

    For me it was a naming issue within my primary links configuration (the same would be true for a menu). You must use a Drupal recognizable path such as "" for your homepage or "data" for a page at "http://www.yoursite.com/data". To avoid this, make sure to select this menu when creating new content.
  • Monday, November 10, 2008

    with the php domdocument class was getting the following error:

    Warning: main() [function.main]: unterminated entity reference 64-bit

    this error was occurring when trying to set the name of an anchor element ... the same error popped up when setting both within the constructor and through the nodeValue method. I haven't tested the solution via the constructor, but by wrapping the value with the built-in htmlspecialchars(), I solved this error

    i.e.:
    $anchornode = $doc->createElement('a');
    $anchornode->nodeValue = htmlspecialchars("$somevalue");

    create dom html with php, getelementbyid doesn't work

    I leverage the domdocument php class to create elegant, dynamic html documents via the dom tree. However, I was finding that the "getelementbyid" method was not returning elements as expected. The reason for this is that I had not defined a DTD, which is necessary in this case because we only specify that we are saving as HTML at the end of the process, so the domdocument object is only understood as generic XML, which has no predefined "id." To create a DTD use this code (here using 4.01 transitional html):

    $doc = new DOMDocument();
    $doc->loadHTML('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">;');
    there are so many options with pear's db library for php, I sometimes forget the optimal code for getting a sql result as an array that I can easily use within php. The code below fully demonstrates connecting to and getting an associative array with an 'order by' field as the array key. This code is for a postgres rdms, but could easily be modified for mysql, sqlserver, etc. Parameters are in caps surrounded by '%' in the form %PARAMETER%.

    require_once 'DB.php';

    $dsn = "pgsql://%LOGIN%:%PASSWORD%@%HOST%/%DBNAME%";
    $dbh =& DB::connect ($dsn);
    if (PEAR::isError($dbh)) {
    die($dbh->getMessage());
    }

    $dbh->setFetchMode(DB_FETCHMODE_ASSOC);
    $res =& $dbh->getAssoc('%SQL STATEMENT, USE 'ORDER BY' TO DEFINE ARRAY KEY%');

    if (PEAR::isError($res)) {
    die($res->getMessage());
    }

    Tuesday, September 30, 2008

    When defining projection from ArcCatalog (shapefile properties) I get an error message "Failed to Alter the Spatial Reference". If I try to do this from the "Define Projection" geoprocessing tool (ArcToolbox) I get this error insted: "Cannot create a projection file for filepath Failed to execute (DefineProjection).

    I solved this problem by accesing the shapefile through a mapped drive (a.k.a. "Z:\") within ArcCatalog, rather than its \\server\drive$ pathname.

    Friday, September 19, 2008

    There are multiple caching levels to be mindful of with a typical ArcGIS Server environment. This factor often makes debugging difficult. Below I have made an expanding list of issues related to cahcing as well as the various cache levels to clear when debugging.

    Issues related to caching: query does not return correct field as defined in 'outFields' query property

    Cache Levels
    1. AGS web service cache, this can be cleared by restarting the AGS web service from ArcCatalog or by web admin interface
    2. Tile cache, cleared by 'deleting cache', and then reconfiguring tile cache within service properties of the web service
    3. Web browser cache, cleared by clearing cache of web browser
    4. REST API cache, cleared by going to http://yourserveraddress/ArcGIS/rest/admin/cache and clearing cache manually
    5. KML cache, if using a Google hosted KML with your application, to have this load dynamically you need to add a random number to the end of your kml address ... google it!

    Wednesday, September 17, 2008

    To do a non-boolean conditional insert in SQL Server (the "where exists" clause is best for boolean), use the "where in" clause along with an inner join, in the following form:

    INSERT INTO [Destination Table]([Destination Field1],[Destination Field2],[...])
    SELECT [Origin Field1],[Origin Field2],[...]
    FROM [Origin Table]
    WHERE ([Test Field A, could be from origin] Not In (select [Test Field B] from
    [Test Table, could be destination]));