Things We've Learned Watching COPS

April 25th, 2009 No comments

Lately we've been watching a TV series called COPS.  The show follows law enforcement officers during police activities.  While watching this show, we have learned a few things:

  1. If all of a sudden you see a cop, RUN!!  As fast as you can!  They won't get suspicious!
  2. If you have a large quantity of illegal substances or weapons in your car, don't bother with stop signs or red lights.  It is best to get where you are going as fast as possible.
  3. If an officer asks if you have any drugs on you, and you have a joint behind your ear, say no anyway.  They will never notice something like that.

Read more...

Configure your Linksys VoIP ATA the right way!

March 20th, 2009 57 comments

ATAs made by Linksys (formerly Sipura) are arguably the most popular ATAs amongst consumers and small businesses, because of their wide array of configuration options.  However, their default settings are not appropriate for users in Canada and the USA.  Let's talk about some settings you can use to ensure that your VoIP equipment properly matches your region.  We apologize in advance for Mango's verbosity but truly feel that the information in this article is very important.  If you're in a hurry, read the bold parts, and the last three paragraphs labeled important note.

Please note: Though the Linksys adapters have historically been an industry standard, they are built on old technology.  If you are considering buying a VoIP ATA, we recommend the new OBi ATAs.  The OBi ATAs were built by the same engineers that built the PAP/SPA devices, and are sure to make an already great VoIP experience even better.

We do not recommend the new SPA112 and SPA122. Though the SPA112 and SPA122 are sold by Cisco as successors to the PAP2T and SPA2102, the new devices are not built on the same technology as the old devices and have received poor reception in the community.

Last update: August 6, 2012.

Read more...

Linksys Dial Plan Tips and Tricks

March 6th, 2009 7 comments

One of the most common questions we get asked about VoIP is, "Is it still okay if I dial 10 digits for local calls?"  Regardless of the fact that that's a terrible first question to ask, the answer is up to you.  The dial plan on Linksys devices is one of their most powerful features, and with it, you can configure your dialing rules any way you want.

We were going to write an entire introduction to dial plans but discovered Cisco has rewritten lots of Linksys documentation and done a great job of it.  So instead, here's a link to the Cisco ATA Administration Guide - dial plans start on page 63 of the PDF.

What we will post are some excellent dial plans along with some examples of various tips and tricks you may not have thought of.  These should work with the PAP2T, SPA-2102, SPA-3102, and similar devices.

Read more...

Replacing smart quotes, em-dashes, and ellipses with MySQL or PHP

March 5th, 2009 42 comments

Alternate title: "Help!  My Quotes Appear as Question Marks or Other Strange Characters!"

The "Smart quotes" feature in Microsoft Office transforms straight quotes into curly quotes.  It also transforms hyphens into em-dashes and three periods into ellipses.  While one might think, "How lovely!  My document looks almost as if I'm educated!" readers of said document may not.  Microsoft, in its infinite wisdom, decided to assign special characters such as the ones we just mentioned to a range of codes above 128.  Problem: these codes aren't compatible with other character sets such as ISO-8859-1 or UTF-8, resulting in frustrating issues with non-Microsoft systems.

Keep reading for some PHP and MySQL code to help out with this issue.

Read more...

OV2Tools not working? Let us explain three confusing things.

March 4th, 2009 No comments

Mrs. Mango and I have a diesel Smart car, which I just absolutely love.  He holds a surprisingly large amount of cargo (such as enough equipment for a two-camera video shoot along with the operators), he's all kinds of fun to drive, and as a bonus he's cheaper than the bus.  We've even named him.  Affection aside, I made a Google map with locations of all the Diesel Stations in Vancouver, BC that I could find.  This of course required going to the computer and looking up the map any time we needed gas in an unfamiliar area.  So when I got a TomTom GO720 GPS, I thought it would be a grand idea to create a POI list of the Google map.

As it turned out, this was VERY much easier said than done.

Read more...

reCAPTCHA is cool.

October 13th, 2008 1 comment

I wanted people to be able to leave comments to my articles without having to go through the hassle of signing up and waiting for an email confirmation.  So, I looked for a CAPTCHA plugin for WordPress - one of those "enter the words you see in this picture" programs.  I found reCAPTCHA, and let me tell you, reCAPTCHA has got to be one of the neatest ideas ever.  According to the reCAPTCHA website, "About 60 million CAPTCHAs are solved by humans around the world every day. In each case, roughly ten seconds of human time are being spent. Individually, that's not a lot of time, but in aggregate these little puzzles consume more than 150,000 hours of work each day."

Amazing!  Apparently, a brilliant group of people from the Carnegie Mellon University thought so too.  Their next thought was, "How can we harness those 150,000 hours of work?"  (Why can't I ever have thoughts like that?) They got together with some people digitizing old books and newspapers.  They had a problem.  OCR, technology that is used to convert an image of printed text into digital format, is not perfect and occasionally can't read a word.  reCAPTCHA was born.  The program takes a known word, pairs it with an unknown word, and gives it to a user to enter.  If the user solves the one for which the answer is already known, reCAPTCHA assumes the second is also solved correctly.  Presto!  Word by word, a book is eventually digitized.

Here's an example.  The word on the right was difficult to read.  I assume it's "their".  reCAPTCHA will show this word to a few other people as well, in case I'm wrong.

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!