Missing headers on FCPD arrest text file for 1-2-2015

Yes, I know.  The FCPD arrests/tickets dump posted on January 2nd does not have a header row.

No, I don’t have any information as to whether this is a one time thing, or a permanent change moving forward into 2015.  What I do have is a copy of the January 2nd 2015 arrests/tickets file with headers that you can download.

(And yes, I’ve created an issue on my Fixed Width Text File Toolkit repository (GitHub) for figuring out the best way to handle files without header information.)

Using RDP Clients with VirtualBox machines

I’ve been working with VirtualBox a lot recently, but one obstacle I’ve banged my head against repeatedly was getting a Remote Desktop Client (like Microsoft Terminal Services Client, for instance) to successfully connect.  It was peculiar because I could ping the VM ip address, connect through SSH, made sure I had the Extension Pack installed and so on, but the RDP client just kept timing out without any helpful explanation.

Finally I went back and read the documentation and figured out my mistake.  I had assumed I should use the IP address of my virtual machine as the target, but according to the documentation (see below) I should have been using the IP address of the host instead.

Chapter 7. Remote virtual machines

Since VRDP is backwards-compatible to RDP, you can use any standard RDP viewer to connect to such a remote virtual machine (examples follow below). For this to work, you must specify the IP address of your host system (not of the virtual machine!) as the server address to connect to, as well as the port number that the VRDP server is using.

I guess VirtualBox on the host must provide some sort of proxy/passthrough service, and that you set different ports for each virtual machine if you need to switch back and forth between different VMs? So you might tell VM #1 to use port 3389, VM #2 to use port 3390, and so on, for example.

Hopefully this will save someone a little time and frustration (or remind me if I should forget) in the future.

Using JavaScript to Solve a Trivia Question

This weekend, I wound up visiting a restaurant with an irritating trivia question on their welcoming chalkboard: “How many numbers between 0 and 200 contain the number ‘1’ in them?”  (e.g. 1, 10, 11, etc.) Puzzles like this tend to stick in my craw, so I tucked it away in my “stuff to figure out later when I have more time” stack.

Since I don’t know a mathematical algorithm to generate a sequence of numbers that contain the number 1 in them, the only way I see to solve this puzzle is “brute force.” Although we can do this manually on a piece of paper fairly quickly (i.e. write the numbers 0 through 200, circle the ones that have a one in them, and then count the circled numbers), that approach is a manual process and can’t be easily reused with different parameters. It also doesn’t scale well if the range of numbers to be checked grows significantly (e.g. between 0 and 10,000).

. . . .
<script type="text/javascript">

    function howManyXinYthruZ(x, startY, endZ) {

        counter = 0; // initialize a counter

        // iterate from first number to last
        for (a = startY; a <= endZ; a++) {

            // convert number to string . . .
            aString = a.toString();

            // so we can search for X
            if (aString.search(x) != -1) {

                // if we find one, ding the counter
                counter++;

                // purely optional, for "proof"
                console.log(a);
                }
            }

    // share the final tally of matches
    console.log("count: " + counter);
}

    // invoke the function to solve the puzzle
    howManyXinYthruZ( 1, 0, 200);

</script>
. . . .

If you run this little script in a blank page in your browser and then crack open the console, you’ll see a list of all the numbers that match the specified the criteria as well as the final total of matches (i.e. 119).

The nice part of this is that if I ever encounter another trivia question similar to this one (i.e. “How many numbers between 3000 and 5000 have the number 3 in them?”), I can quickly and easily solve it with one function call:

howManyXinYthruZ( 3, 3000, 5000);

// 1,271 in case you’re curious

Not bad, JavaScript.  Not bad.