One of my favorite way to block ads online

Fri Jun 17 07:46:11 UTC 2011

At home I update my host file on my router to block ads using this technique. Basically it circumvents DNS lookups and uses the hosts file on the router to return localhost as the IP address of the ad site instead of the actual IP address. Not revolutionary but effective.

MarkLogic Startup Launchd

Fri Apr 15 08:19:38 UTC 2011

In order to have MarkLogic start up on user login on my Mac, I created the folder ~/Library/LaunchAgents and put this .plist file into that folder. After logging out and re-logging in MarkLogic had been started successfully.

Update - May 23, 2011

I've updated the .plist file to restart instead of start. When MarkLogic starts it doesn't check if it's already started so it will keep the other MarkLogic instances running.

IE perform action after File Input Change Event

Tue Apr 12 08:29:01 UTC 2011

Normally IE won't register that a file input has changed unless the file input loses focus. So, in order to accomplish this, just add a click event to the file input event that sets the focus to another input (submit button will work) after the click. If you do this in a setTimeout call then IE will attempt this call immediately after the File Dialog is dismissed causing a blur event which will then trigger your "change" handler.

Put this in your click handler:

setTimeout("document.getElementById('submit-button').focus()", 0);
      

I'm always amazed how often a setTimeout has gotten me out of problems with IE javascript.

Internal MarkLogic Error

Tue Mar 22 11:05:41 UTC 2011

I received this error today running MarkLogic Server on Mac OS X 10.6 - Internal error: file: Lang/simplified-chinese-std.matrix could not be opened. I was confused. I started looking at internal code thinking that something I might include could be at fault. However, the fix was to restart the MarkLogic server. Hope this helps someone.

Sandisk, LG 570 and firmware flashing

Mon Jan 03 10:27:53 UTC 2011

I was trying to update the firmware on my LG570 blu-ray player. After the wireless download continually failed, I went to the LG support site and downloaded the two ROM files. I attempted to download the instructions as well but the download wouldn't work. I tried to fill out a web form to let them know, but that kept blanking itself after every character that I typed. So, I did eventually find a PDF that told me what to do.

The two zip files need to be extracted and placed on either a flash drive or as files on a CD/DVD. I chose the flash path but I decided to use my Sandisk flash device. It should work, right? No luck. I tried another brand of flash drive and that worked much better. I think the biggest problem was that the Sandisk has two partitions on their devices. One is a CD-ROM partition that has some U3 utility software and the one that worked didn't have that extra partition to confuse my device. So, Sandisk fails for updating firmware - and I'm pretty sure it's failed in the past for the same reason. I'm just now catching on that a Sandisk device might be great as a portable media device, but when it comes to flashing it just can't get the job done.

What I want from a wireless plan

Mon Jun 07 13:36:50 UTC 2010

Here's what I want from a wireless plan:

  1. Calling
  2. Texting
  3. Web Browsing / Maps

Ok, so to get any of this most of the services insist I commit to them for 1-2 years, and pay a bundle for all sorts of services I may or may not use. I don't want rollover, although that is better than just losing your minutes. What I want is the ability to move into different Tiers based on my usage. If I use 200 Megs one month, I get charged for the 200 Meg limit. If I decide to browse more the next month, I want to be bumped to the next plan. No outrageous fees for those extra minutes past my plan or extra data past my allotment.

IE 7 Input Change Bug

Fri May 14 16:39:18 UTC 2010

In IE7 under some conditions the onchange event won't fire for input fields. I recently wanted to run javascript using jQuery to extract the name of the file and print it on the screen. To fix this I ended up extracting the logic that changes the contents of a span on the page into a function, and then calling that function inside a setTimeout call to get around this problem. I've had to use setTimeout before on a similar issue with a race condition and I'm sure glad that call exists. It's solved two of my last two IE bugs. Of course, I only run this hack with IE by checking jQuery with

if (jQuery.browser.msie) { ... }
      

How I Rate Netflix Movies

Fri May 14 16:21:46 UTC 2010

Just a quick rundown on how I rate movies that I watch from Netflix.

  • 5 stars - I own the movie or have changed as a person by watching it (or want to change).
  • 4 stars - I will watch the movie again, but I don't think I need this in my library.
  • 3 stars - Watched - it might not have been horrible but it wasn't anything special.
  • 2 stars - horrible movie that was either offensive, stupid or a combination of those two.
  • 1 star - I'm no longer a friend with whomever recommended this movie to me. Sending hate-mail to the studio.

A small look into my rating system.

My Preferred Way to Stop SSH Dictionary Attacks

Tue May 11 23:03:27 UTC 2010

I did a google search and found aerospacesoftware.com that suggested using iptables to filter ssh traffic and to slow down repeat requests. The default is to let the first request through, and then wait 1 minute before accepting another request. It seems to work like a champ. I already do things like only allow public-key authentication and I have turned off root access as any sysadmin should. Below are the iptables commands I added to my /etc/rc.local file to be run at startup:

iptables -A INPUT -p tcp -m state --syn --state NEW --dport ssh \
      -m limit --limit 1/minute --limit-burst 1 -j ACCEPT
      
      iptables -A INPUT -p tcp -m state --syn --state NEW --dport ssh -j DROP
      

MarkLogic xdmp:to-json()

Thu Apr 29 17:17:26 UTC 2010

I do like that MarkLogic has a to-json function and that I don't need to download third-party code to make something like JSON work, especially in 2010, years after JSON has become a fairly well known standard.

One problem I ran into was that when a sequence is converted to JSON, a JSON array is returned.

('a', 'b', 'c', 'd')
      

becomes

['a', 'b', 'c', 'd']
      

The problem comes when only one value is returned in a sequence, such as ('a'). This now becomes the string 'a' as JSON instead of being a javascript array. I can understand why, but I wanted an array since the autocomplete jQuery UI plugin always uses a javascript array. So, in my code I now check for a sequence of one and concatenate '[' to the beginning and ']' to the end to give me a valid JSON array.

If I could have, I would have changed the autocomplete plugin to accept a string JSON parameter as well and then the MarkLogic code would have worked fine.