eventquery.vbs – ERROR: Unable to execute the query for the…

August 6th, 2010

If you received this error when trying to execute eventquery.vbs the cause is an overflow of events past 32,767 (the maximum capacity of a VB6 Integer). There is a very simple fix for this which is to change the data type from an Integer to a Long (which has a maximum capacity of 2,147,483,647).

In eventquery.vbs, scroll down to line 1700 and 1703 and change both CInt to CLng.
Before;

        If CInt(objLogs.Item(arrKeyName(intLoopCount))) > 0 Then
            strFilterLog = arrKeyName(intLoopCount)
            intRecordRangeFrom = 0
            intRecordRangeTo = CInt(objLogs.Item(arrKeyName(intLoopCount)))

After;

        If CLng(objLogs.Item(arrKeyName(intLoopCount))) > 0 Then
            strFilterLog = arrKeyName(intLoopCount)
            intRecordRangeFrom = 0
            intRecordRangeTo = CLng(objLogs.Item(arrKeyName(intLoopCount)))

Or download the already updated eventquery.vbs.

Bookmark and Share

List of Foundation Fieldbus Unit Enumerations

July 8th, 2010

Here’s a current list of Foundation Fieldbus unit enumerations extracted from the freely available DD files.

foundation-fieldbus-list-of-unit-enumerations.txt

Bookmark and Share

thydzikGoogleMap v1.5 – an inline Google map plugin for WordPress

July 6th, 2010

Recently updated and confirmed still working with WordPress 3.0.

The following examples use the included example.xml file.

<markers>
<!-- Marker Z has no html to show nonclickability-->
<marker lat="-31.9554" lng="115.85859"  icon="Z" color="c89bff"/>
<marker lat="-32.053128" lng="115.745869" html="Fremantle"  icon="1" color="6b98ff"/>
<!-- Standard marker with html-->
<marker lat="-32.036036" lng="115.92724" html="Lynwood&lt;br&gt;Residence of the author" color="ffed5c"/>
<marker lat="-31.963013" lng="115.836239" html="Kings Park" icon="KP" color="97ec7d"/>
<!-- Character marker with html that includes link-->
<marker lat="-31.956659" lng="115.869906" html="&lt;a href=&quot;http://perthmint.com.au&quot; rel=&quot;nofollow&quot;&gt;Perth Mint&lt;/a&gt;" icon="$" color="ffffff"/>
<line colour="#0000FF" width="2" opacity="0.75">
	<point lat="-32.027579" lng="115.751266" />
	<point lat="-31.987404" lng="115.769463" />
	<point lat="-31.957697" lng="115.852203" />
	<point lat="-31.963814" lng="115.879326" />
	<point lat="-32.026415" lng="115.942154" />
</line>
</markers>
  • Marker Z – no HTML, nonclickable.
  • Marker 1 – standard maker with some text.
  • Marker Default – no icon defaults to standard Google Maps marker.
  • Marker $ – some symbols can even be displayed on a marker and links in the HTML.
  • Marker KP – up to two characters can be displayed.

The syntax is as follows;

thydzikGoogleMap(example.xml, width, height, zoom, maptype)

where;

  • example.xml is your xml file, and example xml file is included with thdyzikGoogleMap in the plugin directory.
  • width is the optional width parameter, if left out the default width defined in the thydzikGoogleMap options will be used.
  • height is the optional height parameter, if left out the default height defined in the thydzikGoogleMap options will be used.
  • zoom is the optional zoom level from 0 to 17 (0 being the furthest away), if left out zoom will be calculated automatically to fit all points.
  • maptype is the optional map type parameters, which can be (Normal, G_NORMAL_MAP, N), (SATELLITE, G_SATELLITE_MAP, S), (HYBRID, G_HYBRID_MAP, H), (PHYSICAL, G_PHYSICAL_MAP, P, TERRAIN or T) if left out Normal is defined.

Normal, G_NORMAL_MAP, N or left out; i.e. thydzikGoogleMap(example.xml), thydzikGoogleMap will produce a default styled map;

SATELLITE, G_SATELLITE_MAP, S; i.e. thydzikgooglemap(example.xml, 4, S), thydzikGoogleMap will produce a satellite styled map. Note I have included a zoom of 4, and used the abreviation ‘S’;

HYBRID, G_HYBRID_MAP, H; i.e. tHyDzIkGoOgLeMaP(example.xml,hYbRiD,450,225), thydzikGoolgeMap will produce a hybrid styled map. Note I have included a width and height, and proved that capitalisation is not of concern;

PHYSICAL, G_PHYSICAL_MAP, P, TERRAIN or T; i.e thydzikGoogleMap(example.xml,TERRAIN), thydzikGoogleMap will produce a terrain styled map;

Reading XML from different folder
The XML can be in any location, as long as the whole path is specified i.e. thydzikgooglemap(http://thydzik.com/geocaching/karratha-mar08/karratha-mar08.xml). Yes, even links in the marker text are preserved.

Reading XML from different domain
The XML can even be on a different domain, as long as the whole path is specified. i.e. thydzikgooglemap(http://sonyaandtravis.com/maps/clare-melbourne08.xml).

Bookmark and Share

How to Unlock Garmin maps

July 4th, 2010

For information only, How to Unlock Garmin maps.

First get your hands on the desired Garmin City Navigator Downloadable Update for your country/city (MapSource A).
In the compressed file should be the folders IMG, support and Windows plus a readme.txt.

You will need a version of Garmin MapSource 6.13.1 or older which does NOT support Unlocking via the internet (MapSource B).
This can be found in older version of the downloaded map update files (perhaps a 2007/2008 version).

Run the CN.msi installation file to install the old version of MapSource (B).

Run MapSource (B) and the UnlockWizard.

Now get your hands on Garmin Unlock Generator V1.5,
Enter your 10 digit Unit ID, and select map product , enter the FID (MapID) of the newest Downloadable Update (the one you want to Unlock).
Click generate, copy the 25 digit map unlock code and paste this into the UnlockWizard.

At this stage you will have the older version of MapSource (B) with some old map.

Run the CNMENT2010Update_ENU.msi file in IMG folder (MapSource A).

Run MapSource (A). That’s it. The map should now be Unlocked.

Bookmark and Share

thydzik’s WordPress Tool – a WordPress error and link extractor

June 25th, 2010

Here is a simple tool that might be useful to others, it does two main things;

  1. Parses your post’s content as XML and spits out any possible errors, and
  2. Extracts all external links, which can be exported as an Excel Tab delimited file.

Post’s content errors

Each post’s content is wrapped with XML dummy tags and then passed with Microsoft’s XML parser. A feature of this parser is to check the XML structure when reading and output any errors. The WordPress Tool simply displays this raw output for each post. I have found it does do a good job of ‘typo’ errors, but depending on the content it may be erroneous, especially if you have code snippets and such.

Post’s external links

This was the main reason for designing this tool, I needed to extract all the links and confirm they met my ‘lowercase word hyphen word’ standard. You can export the links as a Tab delimited file, simply open it up in Excel.

How to use

  1. Download a WordPress eXtended RSS export of your blog. Go to Tools -> Export of your Admin page.
  2. Run thydzik’s WordPress Tool.
  3. Click ‘Select File’ and browse to the downloaded xml file.
  4. A report of links will automatically be generated, click the Errors radio button to see the error report.
  5. On either the Links or Errors option, click Export to export to a tab delimited file for Excel (note post content is not included in the file).

Screenshots

thydzik's WordPress Tool - Post content error example

thydzik's WordPress Tool - Post content links example

Download

Download thydzik’s WordPress Tool

Bookmark and Share

8 Suits – eight suited playing cards

June 12th, 2010

8 Suits, as you guessed is a deck of playing cards with an additional 4 suits, the clover, tear, crescent and star for a total of 104 cards plus a number of jokers.

Priced at $12 USD per deck plus $5 per postage ($13 per postage internationally), it is a little steeper than The Fat Pack, at roughly $16 USD including international postage. Unfortunately, I discovered the former after ordering the 8 Suits.

8 Suits - 8 suited playing cards
8 Suits - new suits clover, tear, crescent and star
8 Suits - height of deck

The following show how 8 suits affect the probability of standard poker hands;

Poker Hand         No of Combinations        Probability
--------------------------------------------------------
Royal Flush                         8       0.0000000870
Straight Flush                     72       0.0000007829
Five of a Kind                    728       0.0000079163
Flush                          10,216       0.0001110887
Four of a kind                 87,360       0.0009499522
Full House                    244,608       0.0026598662
Straight                      327,600       0.0035623208
Three of a Kind             3,075,072       0.0334383181
Two Pair                    5,381,376       0.0585170567
Pair                       41,000,960       0.4458442418
No Pair                    41,834,520       0.4549083692

Total                      91,962,520       1.000000000

To view the probabilities for any other numbers of suits.

Bookmark and Share

Poker hands probability calculator for any number of suits and ranks (denominations)

June 12th, 2010

After purchasing a 5 suited deck of cards and an 8 suited deck of cards, I decided to work out how the numbers of suits affect the probabilities of each poker hand.

Further, the following can calculate combinations and probabilities for any number of suits and any number of ranks (number of denominations).

You will notice;

  • at 5 suits a Flush overtakes a Full House,
  • at 6 suits a Flush overtakes a Four of a Kind, and
  • at 13 suits a Flush overtakes a Five of a Kind.

If you don’t believe the numbers, you are more than welcome to add them up and email me.

(thanks to CodeCogs for there LaTeX Engine)

Bookmark and Share

PHP Factorial and Combination functions

June 11th, 2010

A quick post on two functions for PHP that provide factorial and combination support.

function factorial($n) {
	if ($n <= 1) {
		return 1;
	} else {
		return factorial($n - 1) * $n;
	}
}

function combinations($n, $k) {
	//note this defualts to 0 if $n < $k
	if ($n < $k) {
		return 0;
	} else {
		return factorial($n)/(factorial($k)*factorial(($n - $k)));
	}
}
Bookmark and Share