Saturday, October 4, 2014

December 2013 Trip to Nicaragua

Went to Nicaragua with friends last December. Here are links to the various (incomplete) photo albums. One more will be added soon.
  • Nicaragua Day 1: BWI and León's Parque Central 
  • Nicaragua Day 2: León 
  • Nicaragua, Day 3, León, León Viejo, and Las Peñitas 
  • Nicaragua Day 4, Granada & Baseball 
  • Nicaragua Day 5: Lago Nicaragua 
  • Nicaragua Day 5: Parque Nacional Volcan Masaya 
  • Nicaragua Day 5: Apoyo Lagoon and Evening in Granada 
  • Nicaragua Day 6, Granada and Butterfly Preserve 
  • Nicaragua Day 7, Convent San Francisco and Granada Waterfront

Tuesday, July 8, 2014

HTTPS Everywhere Rule Sets for UMBC,

The server supports TLS, but my browser's HTTPS Everywhere seems unaware of this fact. So I wrote a rule set for that server. I have previously posted here an HTTPS Everywhere rule set for an oft-used (by me) server at UMBC; for convenience, this is reproduced below.

<ruleset name="tools-ietf">
  <target host="" />

  <rule from="^http://tools\.ietf\.org/" to="" />

<ruleset name="userpages-UMBC">
  <target host="" />

  <rule from="^http://userpages\.umbc\.edu/" to=""/>

Where do these rules go? See the EFF docs or my prior description.

Sunday, May 18, 2014

Geek Clock: They can do Better

Let's start at 1 o'clock and work our way around in a clockwise fashion.
  • tan π/4 would be cleaner.
  • round(∏) is fine, but how about ⌊π⌋ instead?
  • Log 55 is ambiguous, misleading, and inexact--and who capitalizes a log function? Most people will assume the base is 10, except computer scientists might first think 2. But clearly this is intended to be natural log. So, why not say what you mean? ln 55.  For precision, this could be wrapped in a floor function. So, my suggestion: ⌊ln 55⌋
  • 16/2 is boring. How about 2instead?
  • Similarly, 3x3 would be better-written 32.
  • g? Do they mean 9.8 m/s/s? How about 128?
  • For 11, is that 0b? 06? Make it clear: 0xb or b_16. Add a leading zero if you want--I don't care.
  • 11002 is fine for 12.

Monday, February 17, 2014

Java's java.util.Date Class

Teaching Java programming to novices forces me to sometimes revisit the basics in my own understanding, or the edges of what I understand.

java.util.Date has come up a couple times this semester, and I thought I would verify the behavior of Date for dates at and before 1970-01-01. Here's my simple test code:

//Time-stamp: <2014-02-17 11:14:34 jdm>

import java.util.Date;

public class TimeZero {

  public static void main(String[] args) {

    final int yearsAgo = Integer.parseInt(args[0]);
    final double msAgo = yearsAgo
      * 365.25 // days per year
      * 24     // hours per day
      * 60     // minutes per hour
      * 60     // seconds per minute
      * 1000;  // ms per second
    final Date d = new Date((long) -msAgo);

  } // main()

} // class TimeZero

I'm neglecting leap seconds in my calculation of ms before 1970-01-01 (called msAgo). Assuming that a year averages 365.25 days is also not quite right, but since 2000 was one of those leap years divisible by 400, it's pretty close for recent years. Providing zero as input acts as expected (once one takes the time zone difference between here and Greenwich into account):

> java TimeZero 0
Wed Dec 31 19:00:00 EST 1969

Three years earlier seems to be about right, given that 1968 was a leap year:

> java TimeZero 3
Sun Jan 01 01:00:00 EST 1967

1000 years before 1970 looks good:

> java TimeZero 1000
Sat Dec 18 19:00:00 EST 969

Let's look around near the beginning of CE and the end of BCE (boundary conditions):

> java TimeZero 1967
Tue Dec 19 01:00:00 EST 2
> java TimeZero 1968
Sun Dec 18 19:00:00 EST 1
> java TimeZero 1969
Sat Dec 18 13:00:00 EST 1

This seems odd, but the Gregorian calendar does not have a year zero (see and Date.toString() does not include CE/BCE indication. I played around with calendars in my locale to get the era, but cal.get(Calendar.ERA) returns an int, which makes no sense whatsoever, and the problem isn't interesting enough to spend more time on.

However, I am willing to say the Java Date and Calendar hierarchies are entirely too complicated for day-to-day uses. This is one of the few places where I endorse using non-standard class libraries.

Sunday, September 8, 2013

Common Fate of Android Tablets, or a Quick 2013 Nexus 7 Review

I'm on my third Android tablet. Or fourth, but who's counting?

My first tablet was a Samsung Galaxy 5 bought in September 2012. This was mis-marketed as an MP3 player, which it did fine, but 5" was a great size for a handheld GPS device walking through cities, and fit easily into most pockets. It included an FM receiver, rear and front facing cameras, etc. I liked it. The big drawbacks were that it was too small for most reading or surfing activities, and it didn't have enough RAM to upgrade past Android 2.3.5. In December I managed to find the one place on Charles Ave where there was a drop-off between the sidewalk and the adjacent turf, stepped wrong, and fell, landing on my shoulder and on the Galaxy that had slipped out of my chest pocket. No Gorilla glass on this one.

I replaced it with a Nexus 10, decided that was too big, and replaced that immediately with a 2012 Nexus 7.

The Nexus 7 was overall fine, but the sound quality of the built-in speakers was terrible and produced insufficient volume to listen to podcasts or streaming radio from just a few feet away or with any background noise. The UI was sluggish. Touch a search area, and wait a few seconds before the keyboard appears. Type a key, and wait a few seconds before the character appears on the screen. No built-in FM receiver, but with TuneIn, this is not usually a big deal. Other than the speakers, the largest deficiency was the lack of a rear-facing camera.  Got QR Droid? You won't be using it on this thing. I also found 16 GB to be slightly restrictive, but of course there is AndFTP's sftp feature, and my home desktop runs an sftp server, so moving stuff back-and-forth was a breeze--a great improvement over plugging in the USB cable and hoping Linux decides to recognize the device. Anyhow, I get around 20Mb/s between my Nexus and desktop via 802.11 (and an Ethernet hop). The one time I had two droids downloading from the server concurrently I got 30Mb/s measured at the server. Not bad.

I liked the size of the Nexus 7: fairly easy to hand-carry, and I picked up a small messenger bag that can carry that and a few other things while I wander about listening to podcasts.

Friday I dropped my Nexus 7. Even though it was in a decent M-Edge cover, the screen cracked, and much of the screen no longer behaves as a touch screen. No Gorilla glass on this one, either.

So I picked up a 2013 Nexus 7. I have not had it long, but my initial impression is that Asus did a great job. The sound quality is okay, but importantly it can kick out enough volume to be easily heard from several feet away. The UI is more responsive than the older Nexus 7. The rear-facing camera is a great addition. 32 GB of flash memory is a big improvement over my past 16 GB--I won't have to juggle among movies on the device.

I'll probably write more about the 2013 Nexus 7 later.

Aside: the guy from the Office Depot (la oficina de la marihuana) really, really wanted to sell me a protection plan for the Nexus. He went so far as to tell me I'd probably want to replace the battery in a year or so. Despite my tendency to break things, I never buy protection plans, as they are usually pure profit for the seller.

Sunday, August 25, 2013

Slightly Interesting Javascript Benchmark

I have an Asus CG5275 desktop, and decided to try out the Mandelbrot JavaScript benchmark at with the three browsers I use most, Chrome 29.0.1547.57, Firefox 23.0, and Opera 12.16. I expected Opera to be the slowest, and was not disappointed.

The mild surprise was that Firefox was almost four times as fast as Chrome. Here are my timings on the Asus with the above-mentioned URL and browsers:

Browser             Size    Time      Relative
Chrome 29.0.1547.57 500x500  9562 ms  3.86
Firefox 23.0        500x500  2478 ms  1
Opera 12.16         500x500 19464 ms  7.85

Opera took just about twice as long as Chrome, and Firefox was almost 4 times as fast as Chrome. This is on an Intel i5 at 3.2 GHz running Linux Mint 15, Mate, kernel 3.8.0-29-generic. It's a 4-core machine, which makes me curious about the almost 4x speedup of Firefox vs.. Chrome.

[ Note added about 15 minutes after original posting: Mate's System Monitor makes it appear that all three versions use just a single core. No real surprise--this is JavaScript, after all. ]

Tuesday, July 23, 2013

Scrollbars a page at a time, not a huge jump at a time

I've been really annoyed by Rhythmbox scrollbar behavior of late: when I click in the "trough" of the scrollbar, instead of moving the view by about a page up or down, it moves a distance corresponding to the point in the trough clicked. This is pretty bad for large text areas, such as a large music library. I complained to the Rhythmbox folks and Jonathan Matthew replied that this is default gtk behavior. This struck me as odd since I haven't noticed it in other applications, however Jonathan was right.

Google led me to a Gentoo site where ebichu was having the same issue, and posted the solution. I can't thank him there since I don't have a password, but he or she deserves thanks. The fix is to add a line to /etc/gtk-3.0/settings.ini:

gtk-primary-button-warps-slider = false

So they apparently call this slider warping. Very user-hostile.

Sunday, July 21, 2013

Mindspring's 14 Deadly Sins

Worth keeping in mind and adapting for just about any business. From Wikipedia, and credited to Mike McQuarry:

THE 14 DEADLY SINS OF MINDSPRING (or ways that we can be just like everybody else)
  1. Give lousy service--busy signals, disconnects, downtime, and ring no answers.
  2. Rely on outside vendors who let us down.
  3. Make internal procedures easy on us, even if it means negatively affecting or inconveniencing the customer.
  4. Joke about how dumb the customers are.
  5. Finger point at how other departments are not doing their jobs.
  6. Customers can't get immediate "live" help from sales or support.
  7. Poor coordination across departments.
  8. Show up at a demo, sales call, trade show, or meeting unprepared.
  9. Ignore the competition; they are far inferior to us.
  10. Miss deadlines that we commit to internally and externally.
  11. Make recruiting, hiring, and training a lower priority because we are too busy doing other tasks.
  12. Look for the next job assignment, instead of focusing on the current one.
  13. Office gossip, rumors, and politics.
  14. Rely on dissatisfied customers to be your service monitors.
I took the liberty of correcting the grammar in two places: 'jobs' in 5 was singular, and 9 contained a comma splice. Also, Wikipedia used a hyphen rather than a dash in 1; since it's unclear if this was Wikipedia's error or Mindspring's, I did not correct the Wikipedia page.

Thursday, July 18, 2013

Texas? New York?

Lewis Black nails it.

Deceased YouTube link replaced with one directly to the Daily Show, 2014-07-08.

Sunday, June 23, 2013

Full-Disk Encryption, Linux Mint 15

Plaa's instructions for full-disk encryption at work fine for Linux Mint 15. This is for a new installation, or a new Mint partition. Do it.

For convenience, I have reproduced his instructions here:

(1) Boot your system using the Linux Mint 15 live CD or USB stick.
(2) Open a terminal and enter the following commands:

$ sudo apt-get remove ubiquity
$ sudo apt-get update
$ sudo apt-get install ubiquity
$ sudo ubiquity

Wednesday, June 12, 2013

We are Twitter's Twits, not their Customers

I've been disturbed by the invasive nature of many, many android apps. For example, here are the permissions requested by the Twitter app:

  • Why does Twitter need my location? They don't.
  • Why does Twitter need access to my accounts (note plural)? They don't. Why would I want to hand this over to them? That would be simply stupid.
  • Why would my contacts want me to hand their information over to Twitter? The naive ones may not to think to care, but most would likely prefer that I did not.
  • Why does Twitter need access to my Google service configuration? They don't. 
Clearly, we are not Twitter's customers, but rather Twitter's twits. Why use their app when you can simply log in to their service via browser?

Additionally, there are some ads that are simply blatant phishing attempts:

This is from the tunein app, which provides searches for radio stations and radio programs to stream. It's a nice service. It's ad-supported. The ad above, just above the highlighted Related tab, says I have one new message. So if I click that, where does it take me? Not to a message, or, rather, not to a message from anyone I could imagine listening to. It's a phishing ploy.

Tuesday, June 11, 2013

Monday, June 10, 2013

Classic CS1 Test Question Answer

Q:  What are the primary reasons for using procedures and functions?

A:  The primary reasons for using procedures and functions is for
instability.  A function is part of an expression and is used to
determine what the program must do.  A procedure is a statement in
itself and the great thing about it is that any variable declared
within a procedure can be referred to from anywhere in the program.

The date on the file I re-stumbled across this in is December 1996, though it could be older. I suspect this is an answer I received on a test, but it may have been something going around the Internet at the time.

Monday, June 3, 2013

UMBC Frogs, Over a Stream Near a Pond, 2013-05-11 17:30

This plays well in Firefox, but on my Linux system neither Opera nor Chrome can deal with it.

However, you can access the media stream directly at

Tuesday, May 28, 2013

Comcast and Verizon in Competition Again

I understand that Comcast and Verizon have opened restaurants across the street from one another, that their prices are identical, that each wait staff is apathetic, and, though each serves a full menu, every diner is forced to order everything. Also, prospective customers find menus in their junk mail and left at their homes daily.