The quality of the lucid dream environment alvin January 8, 2017 - 9:48am

I sometimes think the quality of the lucid dream environment (aka, the dream holodeck) isn’t quite like it is back here in the physical world, but during lucid dreams the last two mornings I’ve been walking around and exploring the details, and I keep saying,“Man, this is good.” The environment is so life-like I have to keep checking my hands to make sure I’m asleep.

My preferred writing environment alvin July 27, 2016 - 5:19pm

When working from home, my preferred writing environment is to use a huge fixed-width font on a large monitor with a matte finish, and nothing else on the screen. I write my text using either Markdown or LaTeX, depending on what the output format is going to be. (Yoda and Meditating Guy make me feel a little less crazy when I’m talking to myself.)

Scala: How to set environment variables when running external commands alvin June 19, 2015 - 11:27am

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is a short recipe, Recipe 12.19, “How to set environment variables when running external commands.”


You need to set one or more environment variables when running an external command.


Specify the environment variables when calling a Process factory method (an apply method in the Process object).

Why Apple didn't use sapphire alvin January 26, 2015 - 7:26pm

This is a nice article on time.com about why Apple didn’t use sapphire in the iPhone 6 or upcoming Apple Watch.

Eclipse Android FAQ: How to set up your Eclipse Android development environment

Eclipse Android FAQ: How to set up the Eclipse Android development environment, including the Eclipse ADT and Android SDK.

After a little digging around I figured out how to install an Eclipse Android development environment, and I thought I'd share my installation notes here. The notes are a little shorter than my usual detailed explanations, but hopefully they're long enough.

To get the Android development environment working with Eclipse, you need to install two components onto your development system:

Perl - Access shell environment variables through Perl associative arrays

Perl shell environment variables FAQ: How can I access Unix shell environment variables from a Perl script?

One of the great features of the Perl language is it's support of associative arrays. Unlike normal arrays, whose subscripts can only be integers, the subscripts of associative arrays are text strings. This may not sound like much yet, but with associative arrays (or hashes as they're now called) we can create fairly complex data structures with Perl.

How to determine if your Java application is running on Mac OS X

If you're developing a Swing/Java application to run on multiple platforms, at some point you'll probably have to make some tweaks for each operating system. Yes, there are differences in Swing behavior between Mac OS X, Linux, and Windows, and you'll want to account for those.

Perl environment variables - How to access Perl environment variables alvin May 21, 2009 - 6:55pm

Here's a quick example program that demonstrates how to access environment variables from within your Perl programs:

# environment variables are held in the %ENV hash
foreach $key (sort keys %ENV)
  print "$key is $ENV{$key}\n";

Using this simple Perl foreach loop, here's a subset of the output this script prints on my MacBook Pro:

Java - Getting the hostname on Windows Server 2003 alvin December 16, 2008 - 7:52am

Funny, this seems about five years late, but using Java, if you want to get the HOSTNAME on Windows Server 2003 (and possibly any version of Windows 2000), you have to do a little extra work. The environment variable you need to access on those versions of Windows is referred to as COMPUTERNAME, so in my case, since my software is going to be running on a lot of different (and currently-unknown) computer systems, I created a little convenience method to handle this problem.

How to determine the directory your Java application was started in (user.dir)

If you ever need to determine what directory your Java code is being run from (essentially the current working directory), you can get this information from the system properties, specifically the System.getProperty or System.getProperties methods.

The following line of Java code shows how to determine what directory your Java application was started in. This information is stored in the user.dir system property, which you access like this: