Tuesday, February 28, 2012

"The Dark Room" YouTube Walkthrough Spoiler Cheat Guide Thingy

"You awake to find yourself in a dark room."

Here's a map of The Dark Room.

Note that there are a number of false restarts, where it looks like you've restarted the game, but you're actually in an alternate version of the opening with different actions.

"Error" is the best fair ending, I think. There's another fine ending at the bottom of the map called "Alright Then."

But there's a trick to finding the "100% Good Ending." In "Turn Around Redux", which you can reach like this:
  1. Go North
  2. Find Light Switch
  3. I See
  4. Listen
  5. Kill Self
  6. Hold Breath
  7. Pass Time
  8. Dig
  9. Treasure
  10. Turn around
The sound is backwards. Reverse it using a program like Audacity to hear the coded message. (Note the comments; try making the last one big.)

Sunday, June 26, 2011

Style Safari Input Type=Submit Buttons

In my HTML forms, I like to allow users to submit the form by pressing the Enter key, without JavaScript. The easiest way to do that is to include an <input type=submit> button.
<form>
  <input name="x">
  <input type="submit">
</form>
But beware: on Safari (and other WebKit browsers?), <input type=submit> buttons resist CSS styling.
<form>
  <input name="x">
  <style>
  .button {
    font-weight: bolder; /* THIS LINE DOES NOTHING IN SAFARI :-( */
  }
  </style>
  <input class="button" type="submit">
</form>
TIL: if you want to force them to be styled, you can use a WebKit proprietary CSS property, -webkit-appearance: none.
<form>
  <input name="x">
  <style>
  .button {
    -webkit-appearance: none;
    font-weight: bolder;
  }
  </style>
  <input class="button" type="submit">
</form>
If you do that, your buttons will look pretty ugly at first, but with a little work, you can make really cool CSS buttons.

Sunday, March 06, 2011

Convert PS1 Font from Mac to Windows

It's not uncommon to receive a font from a designer that works fine on the Mac, but can't be opened on Windows.

This happened to me today. When I viewed the font in the Finder, the font had no filename extension, but Get Info said its Kind was "Postcript Type 1 outline font." Unfortunately, when I zipped the file and opened the zip file on Windows, the file was 0KB long; not very useful!

Here's how I fixed the problem.

To convert it, I used FontForge. FontForge is a Unix utility that kinda sorta works on OSX. They don't provide an installer for OSX, so the easiest way to install it is by using MacPorts. MacPorts comes with an installer, but you have to install Xcode in order to use it. Xcode can be found on your original OSX install DVDs, on DVD 2. If you can't find those, you can download Xcode for free from Apple, but you have to register as an Apple developer. It's a hassle.

Anyway, assuming you can find and install a copy of Xcode and MacPorts, you should be able to run "sudo port install fontforge" and wait an hour for macports to download a bunch of code from the Internet, compile it, and install it on your machine.

Finally, finally, you can run "fontforge" to open the program. Double-click on your font, and select the File / Generate Fonts ... menu. Select "TrueType" in the list of font types, and save it. It might give you some warnings; I ignored all warnings with no ill effects, but your mileage may vary. This created a .ttf font which worked great on my Windows machine.

Saturday, January 29, 2011

Play YouTube Videos at Double Speed

I enjoy watching video lectures on YouTube at double speed. (It saves a lot of time!)

Here's how. Download VLC and run it. Under the File menu, "Open Network ..." and paste in the YouTube URL. Then, under Playback, select Faster or Slower as needed.

Unfortunately, there's a catch: YouTube throttles download speeds. You can only download one second of video per second. So you'll have to wait for the video to finish downloading and then watch it. (Hey, at least you don't have to sit there and watch it download!)

Alternately, you can use VLC's Streaming/Exporting wizard to save the video to disk first.

Have fun!

Monday, August 16, 2010

Permanent Windows command-line aliases with doskey and AutoRun

On Unix, you can configure command line aliases, like this: "alias lls=ls -l". From then on, running "lls" will automatically run "ls -l", saving you a few keystrokes. The alias will go away whenever you open a command prompt; to make the alias permanent, you can save it in your .profile or .bashrc.

On Windows, you can do the same thing using the DOSKEY utility to create "macros" like this: "doskey ls=dir". Doskey macros are basically equivalent to Unix aliases (though they have different advanced features).

Automatically loading your Doskey macros is a bit more trouble, however. Doskey allows you to export a macro file, like this: "doskey /macros > my-favorite-macros.txt". You can then import your macro file like this: "doskey /macrofile=my-favorite-macros.txt".

Instead of your .profile, you'll need to configure your AutoRun registry value, in "HKEY_CURRENT_USER\Software\Microsoft\Command Processor". I have my AutoRun set to "c:\dev\autorun.bat" which runs a variety of helpful utilities.

I hope this helps!

Sunday, May 09, 2010

Customize Android Browser Scaling with target-densityDpi

It was hard to find this little gem, so I thought I'd share it with the world: the Android team has implemented a custom meta viewport property to allow you to customize browser scaling for high resolution (HDPI) screens, like the WVGA 480x854 Motorola Droid and 480x800 Nexus One. [This is as opposed to medium resolution (MDPI) HVGA 320x480 T-Mobile G1 or myTouch 3G.]

You can use it like this, for example: <meta name="viewport" content="width=device-width, target-densityDpi=device-dpi">

What's Browser Scaling?

Here, ppk explains why a pixel is not a pixel. The CSS "px" unit may differ from a device's actual pixels, as the browser "scales" images and fonts to a larger size than you requested. (The browser just naturally assumes you didn't really mean "pixels" when you said "px," and helpfully tries to resize your content to make it readable on high-resolution phone screens.)

The Nexus One and Motorola Droid (and any other WVGA devices) will scale pixels even if you use the <meta name="viewport"> tag to instruct it not to do this. Worse, they using a non-integer scaling factor (e.g. 1.5x zoom, to scale 320px to 480px) which makes images look really weird.

target-densityDpi to the rescue!

Use this new undocumented <meta name="viewport"> property: target-densityDpi. The only existing documentation is in the Android check-in comment:

Add dpi support for WebView.

In the "viewport" meta tag, you can specify "target-densityDpi".
If it is not specified, it uses the default, 160dpi as of today.
Then the 1.0 scale factor specified in the viewport tag means 100%
on G1 and 150% on Sholes. If you set "target-densityDpi" to
"device-dpi", then the 1.0 scale factor means 100% on both G1 and Sholes.

Implemented Safari's window.devicePixelRatio and css media query
device-pixel-ratio.

So if you use "device-dpi" and modify the css for font-size and image
src depending on window.devicePixelRatio, you can get a better page on
Sholes/Passion.

Here is a list of options for "target-densityDpi".

device-dpi:    Use the device's native dpi as target dpi.
low-dpi:       120dpi
medium-dpi:    160dpi, which is also the default as of today
high-dpi:      240dpi
<number>:      We take any number between 70 and 400 as a valid target dpi.

Fix http://b/issue?id=2071943

So how do I use it?

Like this, for example: <meta name="viewport" content="width=device-width, target-densityDpi=device-dpi">

You may also want to add the "user-scalable=no" property to prevent the user from zooming in/out and to guarantee that your images are exactly as you designed them. You can read more about other viewport properties in Apple's documentation which originally defines the

Wednesday, April 14, 2010

Choice of Broadsides now available on iPhone, Android, Web

Choice of Broadsides, our newest game, is now available on iPhone, Android and on the web.

"Choice of Broadsides" is a multiple-choice swashbuckling naval adventure, in the spirit of C. S. Forester's Hornblower or Patrick O'Brian’s Aubrey/Maturin books, with a dash of Jane Austen.

We hope you enjoy the app, and we hope that you tell all of your friends about it! Our initial download rate determines our App Store ranking. Basically, the more times you download in the first week, the better we'll rank.

Share and enjoy!