Thursday, May 26, 2011

Add an element before the last element of it's kind in jQuery wiht insertBefore()

// Add the new tag (li element) before the last tag (li element)
$('<li>this is a test 3</li>').insertBefore($('li').last());

In an unordered list such as

   <li>this is a test 1</li>
   <li>this is a test 2</li>
   <li>this is a test 4</li>  <------ last element

The above jQuery statement will insert it before the last li element -

<li>this is a test 1</li>
<li>this is a test 2</li>
<li>this is a test 3</li>  <------ inserted here
<li>this is a test 4</li>  <------ still the last element

Sunday, August 8, 2010

Get event keycode in both Firefox and Internet Explorer

This solution should work in both IE and Firefox.

JS -

function getCharCode(event)
var charCode = (event.which) ? event.which : event.keyCode;

// Might want to get the character representation of the Unicode keycode -

var character = String.fromCharCode(keycode);



Just put an onkeypress="getCharCode(event)" event handeler in your input code (textarea, whatever)

Wednesday, July 14, 2010

Open files in a folder recursively with Notepad++

Open Explorer and drag the folder on top of the Notepad++ window (somewhere in the main window).

I'm posting this because I could not find out how to do this quickly with a simple Google search -- hopefully someone else will have this question and stumble on this post through the keywords.

Friday, June 4, 2010

Installing Canon MF3240 on Windows 7 64 bit (x64)

You probably inserted the CD that came with this printer and got a dialog box during the driver installation that complained about 64-bit incompatibility. Thanks, Canon, for providing the 64 bit drivers on the CD! (/sarcasm)

Anyway -- here's how you install the scanner and printer drivers for this device on Windows 7 64-bit machines --

  1. Detach the printer from the computer.
  2. Visit the follow link (
  3. Find the "Select OS" dropdown and select "Windows 7 (x64)" from the list.
  4. Click the red download link (MF3200_MFDrivers_Win_x64_us_EN_7.exe).
  5. Scroll to the bottom of the next page and click "I agree -- begin download".
  6. Save the executable to an easy to remember location on your computer. Browse to the folder in Explorer and run it. It will extract the drivers to a subdirectory in the same directory as the executable called "MF3200_MFDrivers_Win_x64_us_EN_7". Remember the location of this folder for later.
  7. Attach the printer to the computer.
  8. Ignore or cancel out of any automatic prompts that Windows tries to open. It will not be able to find the right drivers on Windows Update or elsewhere.
  9. Click the Start menu button and search for "Device Manager". Open it.
  10. Under both the "Imaging devices" and "Other Devices" tree menu subitems, you will see CanonMF3200 devices (there should be a CanonMF3200 entry in both tree menu subitems). They should have question marks or exclimation marks next to them, meaning they are not functioning or are not installed.
  11. Right click on both of these devices and select "Update Driver Software". Click
    Browse my computer from driver software" and browse to the driver folder ( that you extracted to earlier (called "MF3200_MFDrivers_Win_x64_us_EN_7"). Again, you will need to do this two times -- for both devices (scanner / fax and printer).
  12. You should be done.

Let me know if you need clarification or this does not work.

Friday, April 16, 2010

7-zip not in context menu 64-bit Windows 7

This is a known problem.

Solution / Workaround: Download 7-zip 32 bit version. This version should put items in the context menu.

Thursday, March 25, 2010

MagpieRSS question marks

If you are trying to use MagpieRSS, you might encounter an issue where quotation marks (single and double quotation marks), and other characters, are simply displayed as questions marks (?) in the RSS output.

The issue is an charset issue. 1) You need to tell Magpie to output in utf-8. 2) Additionally, your HTML page needs to be in the same charset.

For 1)

Before any of your MagpieRSS code ... include these PHP statements.



For 2)

Make sure your page has this at the top ... you might need to replace whatever is already defined on the page.

EDIT: Blogger doesn't like META tags ... here is what you need at the top of your page:

Thanks to for the tips.

Saturday, March 6, 2010

Concatenate Date and Time From Two Fields -- MySQL

In this example, I'm checking whether a time slot in a schedule table is in the future.

WHERE concat(date(appt_date)," ",time(start_time)) > NOW( )
ORDER by appt_date desc, start_time desc, end_time desc