This operation cannot be completed because of dialog or database engine failures.

September 21st, 2008 4 comments

And now!  It's time to play..."Guess what the error message means!"

Ladies and gentlemen...the error of the night IS: "This operation cannot be completed because of database engine failures.  Please try again later."  This error occurs in Microsoft Publisher when attempting to create a Mail Merge using a CSV file.

Does it mean...

a) Your CSV file was deleted.
b) Your CSV file is corrupted.
c) Your CSV file has a stupid period in the file name.

Read more...

Javascript Drag-and-Drop

September 14th, 2008 No comments

I spent a lot of time trying to find a simple, lightweight, drag-and-drop example to learn from.  Finally I located a drag-and-drop demo from the fine folks at WebToolkit.  The Javascript is only 50 lines which impressed even me.  I've tested this to work with Firefox, IE, and Opera.

Here's how to use it.  The element must have position:absolute; or position:relative;.
var dragable = dragHandler.attach(document.getElementById('some_element_id'));
/*This function will be called when dragging starts.  Note that we do not write begin(); here. */
dragable.dragBegin = begin;
/*This function will be called every time the element moves.*/
dragable.drag = drag;
/*This function will be called when dragging ends.*/
dragable.dragEnd = end;
The last three lines are optional.  You can write your own functions (here, imaginitively named 'begin', 'drag', and 'end') that will be run when you specify.

Here's a Drag-and-Drop example I made.  Check the source code for the rest of the Javascript.

Phenomenal Gluten-Free Pie Crust

August 10th, 2008 No comments

I just made an awesome quiche in the absolute best pie crust I have ever made.  As a bonus, it was gluten-free.  As an additional bonus, it disappeared in no time flat.  Quiche recipe to follow next week - stay tuned.

In a food processor, place 1 cup white rice flour, ¼ teaspoon baking powder, and ¼ teaspoon salt.  Pulse a few times with feed chute covered.  Cut ¼ cup butter into small pieces and add to food processor.  Process until butter is mixed in with flour mixture.  Add 1 egg and 2 teaspoons cold water and process just until evenly combined.  As this dough will not stick together as gluten dough would, simply turn the entire mixture into a pie plate and press around and up the edges with a fork.  Place in fridge while preparing filling.

This is based on the recipe from Chaotic Cooking.

Wheat-Free Banana Bread

July 7th, 2008 1 comment

I've finally come up with a banana bread recipe that is wheat-free, is at least relatively healthyish and, in Ms. Mango's and my opinion, is quite tasty.  Here it is:

Combine 1½ cups barley flour, 1 cup sugar, 1½ teaspoons baking soda, and ¼ teaspoon salt.  Use a food processor, two table knives, or a pastry blender to cut in ¼ cup cold butter.

In a separate bowl, mash 4 very ripe bananas, leaving a few small chunks of banana if you desire.  To the bananas, add 4 eggs.  Beat well.  Fold in the flour mixture and mix until just blended.  Transfer to a greased loaf pan and bake at 350° Fahrenheit for 90 minutes.

I have tried all the following variations with excellent success:
- Add ½ cup of chocolate chips or chopped nuts.
- Replace the butter with shortening for a non-dairy version.
- Use an alternative sugar such as evaporated cane juice.

"Did you just...un-veganize a vegan recipe...?"
"Er...yeah, I guess I did.  Still want to marry me?"

Setting Variables with .htaccess

June 9th, 2008 No comments

I was thinking a few months ago how handy it would be if I could set server variables with .htaccess.  In particular was the path to which I had installed my customer management software.  Many programs had used its include file, both in the software's directory and outside of it, requiring me to hard-code its path.  And, of course, it is good programming practice NOT to hard-code paths.

I was told then that this was impossible.  I like to think that I am the first to make a great discovery, but it is likely that the person that told me that was just wrong.

SetEnv cm_path /home/mango/public_html/cm

and in PHP, you simply access the cm_path variable like this:

$_SERVER['cm_path']

Simply Accounting Encountered a Problem

June 3rd, 2008 No comments

I was just looking over this blog's stats and was amused to note that 17% of hits from search engines were from people searching for "Simply Accounting Encountered a Problem".

Well, I hope the article about how I fixed it is helping some people.

Silly Microsoft...

May 23rd, 2008 No comments

Windows has the following information about this file type. This page will help you find software needed to open your file.
Extension: *.wmv
File Type: Unknown
Description: Windows does not recognize this file type.

*sigh*

Chronicles of Simply Accounting 2008 and msvcr80.dll

May 15th, 2008 1 comment

In a previous post, I said, "According to Google, I am apparently the only person in the world who likes Simply Accounting more than QuickBooks."  I am beginning to discover why.

After happily using the trial Simply Accounting 2008 for a few months, I finally got around to activating it.  Simply promptly quit working.  Completely.  When I tried to load any data file, even the test company, it would get as far as "Verifying database..." and then bring up an error that said, "Simply Accounting by Sage 2008 has encountered a problem and needs to close."

This was frustrating.

Read more...

Preventing Double-Clicked Submit Buttons

May 7th, 2008 No comments

Today I decided I needed to figure out a way to prevent people double-clicking Submit buttons.  Now, before you get all horrified, I already did have protection server-side.  But if the Submit button was double-clicked, the user would get a confusing "Duplicate transaction" message.  Guess who would have to explain that one?

Disabling the Submit button was trivial, but in the scenario that the user's computer was not able to contact the server and the user clicked the Back button, the Submit button stayed disabled.  The following Javascript solves both problems.  Simply add onsubmit='return submitOnce;' to your <form> tag.

This has worked successfully with Firefox, IE, and Opera.  Please comment if you test it with any other browsers.
var form_submitted = false;
function submitOnce() {
 if (navigator.appName == "Microsoft Internet Explorer" || navigator.appName == "Netscape" || navigator.appName == "Opera") {
  if (form_submitted == false) {
   form_submitted = true;
   window.onunload = function() { form_submitted = false; }
   return true;
   } else {
   return false;
   }
  } else {
  return true;
  }
 }

Toshiba Laptops' Multimedia Keys and iTunes

April 26th, 2008 8 comments

Here is, as far as I know, the best way to make Toshiba Laptops' Play/Pause/Stop keys work with iTunes.

iTunes only has limited support for multimedia keys out of the box.  They work only when the iTunes window is activated.  So, here's a plugin one can use to make it work even when minimized.  I found the plugin on the Aqua-Soft Forums site.  You can browse the thread if you want, or just download the plugin: iTunes multimedia keys play pause stop minimized.  Just put it in the C:\Program Files\iTunes\Plug-Ins folder.  (In rare cases, it won't work in this folder - see the thread for more info.)

Next, we need to make the Toshiba multimedia keys work like normal multimedia keys.  For reasons known only to Toshiba, the keys on my laptop have completely different scancode mappings from standard multimedia keys.  Fortunately, on Windows 2000/XP/2003/Vista, we can remap them.

Here's a registry file I built that solved the problem for me (I use a Toshiba Satellite M70): Toshiba multimedia keys play pause stop.  Just download this to the desktop, and double-click it to run it.  You may wish to back up your registry before doing so, though I have yet to see any issues caused by this.

For more information about scancode mappings, or if the file above didn't work, keep reading...

Read more...

Online Icon Maker

April 6th, 2008 2 comments

I make icons about once a year, and every time I go to do it, I always seem to have uninstalled my icon making program in my endless quest to keep Murray neat and tidy.  I took a peek at the error log today on my company's web server and found a seemingly endless list of 404 errors for favicon.ico, so I decided to make one.  I found a great little online tool to do it, and here it is: Online Icon Maker

Some of my favourite authors

March 28th, 2008 No comments

I was beginning to think of some of my favourite authors and noted it odd that none of them, as far as I know, have ever published a book.  There is something to be said for internet humorists, and I don't believe it's said nearly enough.  That said, I'd like to tip my hat to the following very talented people, in no particular order:

Read more...

Using MySQL to fix broken "Other Payments"

March 26th, 2008 No comments

UPDATE: Astonishingly, this issue has been fixed in Release C.

D. Stewart and Mafalda write: "There is a glitch in Simply 2008 that allows you type 20 characters in the "Invoice/Ref." line, but really is only supposed to allow 15.  So, if you try and go back to look up or adjust an entry (I'm finding this in the payables/make other payment section so far) Simply crashes.  In order to fix this you need to send your data file to them to get fixed, it takes 4-5 business days and you cannot work on the data file until the fixed one is sent back to you.  And after it is sent back to you the only way to prevent it is to not enter more than 15 characters.  There will be no patch coming out for this, it apparently will not be fixed until the 2009 version."

4-5 business days, Sage!?  I figured this out in fifteen minutes!

Read more...

Some nifty PHP date/time functions

March 8th, 2008 No comments

I wrote two date/time functions in PHP that I was really pleased with so thought I'd post them.

  • string friendlydate ( numeric or string $input )
    Return value is a day in relation to today in the format "Today", "Yesterday", "Wednesday", "March 2", or "November 7, 2007".
  • string howlong ( numeric or string $a, numeric or string $b ) Return value is the approximate length of time between two dates, $a and $b.  Examples are "4 seconds ago", "1 minute from now", "1 hour ago", "yesterday", "2 months ago", "1 year ago".

Read more...

I thought of a great way to order results in MySQL

March 6th, 2008 No comments

While writing a Power Search module for my accounting/customer management software, I came up with a great way to order results in MySQL.

The problem was this: some of our accounts are listed under a business name, and some are listed under a person's name.  You couldn't order by `BusinessName`,`LastName` because all the accounts that didn't have a business name listed would appear first in the list.  If you reversed it, all the accounts who had only a business name would appear first in the list.  The solution, fortunately, was beyond simple:

order by CONCAT(`BusinessName`,`LastName`,`FirstName`)

This is equivalent to saying "Sort by BusinessName, if it doesn't exist then sort by LastName, if it doesn't exist then sort by FirstName.  Yay!

Using the Microsoft Loopback Adapter

January 26th, 2008 1 comment

Being the programmer that he is, Mango has set up a few test servers on his laptop.  While we have the greatest confidence in our software, we like to subject ourselves to our efforts first, before a production server.

While traveling the other day and without an Internet connection, Mango discovered that none of his local servers would work due to a DNS issue.  He'd placed their names in his HOSTS file with the IP 127.0.0.1, but without an internet connection, the only name that would resolve was "localhost".

Microsoft actually had a solution for this exact problem.  It's a virtual adapter called the Microsoft Loopback Adapter.  Here's how to install it: use hosts file with cable disconnected

My htmlspecialchars() functions for Javascript

December 22nd, 2007 3 comments

I thought I'd post my htmlspecialchars() functions for Javascript.  This should mimic the PHP version of htmlspecialchars().  I also include rhtmlspecialchars() in case you need to do the reverse.

Read more...

Words of Wisdom from Bobsentme

November 2nd, 2007 No comments

In case anyone is wondering, to open the services.msc console for a remote server from a command line is:

runas /user:(administrator account) cmd.exe&&services.msc /a /computer=(computername)

Apparently, according to Google, I'm the only person in the world that's ever figured that out.

My horoscope for today

June 19th, 2007 No comments

"Your interest in a wide variety of unusual subjects can earn you friendship or admiration."

That's not only accurate, that's spooky-accurate!

More signs you're a geek...

May 8th, 2007 No comments

- A female friend tells you she wants you to see her rack and so emails you a picture.
- You open it up expecting to see a picture of a metal frame commonly used to hold servers.
- It actually IS a picture of a metal frame commonly used to hold servers.

Happy birthday!

May 5th, 2007 No comments

Happy birthday to Toao.net!  "The Fruits of my Labour" is one year old today.

Name that tune!

April 30th, 2007 3 comments

Does anyone recognize this music?  I heard it years and years ago and never actually found out the title or its artist.  This version here is me on the piano, but I'd love to one day hear an original recording or find some lyrics, if it has any.

Unknown Song.mp3

USB Printers and Terminal Services

December 26th, 2006 No comments

This one day at the previous job, we were trying to map this USB printer via Terminal Services.

Emphasis on 'trying' as it wouldn't automatically map. It had to be manually mapped at every logon, which was problematic, as I was the only one with that kind of access.

I noticed the LPT printers mapped without a problem, so I shared the printer, mapped it to LPT2, and installed a printer to LPT2. Then, I connected to the Terminal Server. It mapped beautifully.  I tricked it!!

This was a solution that the tech before me, the point-of-sale company's techs, and apparently five Microsoft phone support techs couldn't figure out.  I should have been somewhat happy about this.  However, the tech before me, along with the point-of-sale company's techs had proven themselves less than competent on several occasions.  And Microsoft is, well, Microsoft.  Out-teching them was not an accomplishment to celebrate over.

But I digress.  Back to Terminal Services and its eccentricities.

This does not entirely make sense to me.  A good analogy for this solution would be getting lost and going to a gas station for directions, only the directions they give you are "put on a disguise, drive 'round the block, and come back." So you put on one of those fake moustache and glasses things, drive 'round the block and back to the gas station, (where now nobody recognizes you) and THEN they give you directions to where you want to go.

Windows...

On behalf of Toao.net...

December 25th, 2006 No comments

...Merry Chrismas!  Here is a Christmas song:

Christmas In My Heart

AJAX Communicate Function

November 14th, 2006 No comments

I've had a few requests to post my AJAX Communicate Function, so here it is. As you can see, you may pass four arguments to it. The first is 'method', which may be either GET or POST (defaults to GET), 'url' and 'querystring', which are self-explanatory, and 'failure'. The 'failure' argument may contain code to be evaluated in case of failure. This can be triggered due to anything from the server giving a 404 error to the user suddenly losing their network connection. This is optional, but useful.

Read more...