Motorola DROID does not wake up when it should

June 16th, 2010

As mentioned in this article:

http://groups.google.com/group/android-developers/browse_thread/thread/848268d0702d51bb?pli=1

The Motorola DROID on Android 2.1 has an issue where it can go into a deep sleep, and the alarm fails to wake up the device. This can cause late device notifications. Please see the article for specific recommendations on how to avoid the issue, including not using the power button to turn the display off. Other phones do not seem to be affected by this issue.

This issue is significant for Presentation Timer, as it now has a vibration service. A future version of the code may include a watchdog timer option to make sure that the device will be able to vibrate with the screen off.

Notes on using Presentation Timer.

June 6th, 2010

I think it might be useful to discuss how to use the Presentation Timer.

First of all, the software does not keep the display on. However, if the display is turned back on, the timer is still keeping time. To keep the display on for a finite duration, go to your phone Settings, and change the screen timeout. Another option is to keep the phone plugged in, and enable Applications->Development->Stay Awake.

To turn the display off, touch the power button on the phone. The application will keep track of elapsed time when the display is back on.

Settings are remembered if you use the “Home” button, instead of the “Back” button. If the timer was running when the Home button was pressed, the application will make sure the display is showing the proper elapsed time when you start it up again.

Full screen mode is enabled by pressing the color box, and you should then see full screen with countdown. Pressing the screen will switch the application back to the settings page.

A future version of the application will probably enable sounds or vibration, so please send me suggestions of what you prefer.

Presentation Timer for Android.

May 23rd, 2010

Helps you practice giving a presentation. Starts with a green light, turns to yellow when your time is about up, and then turns red. You can find it on the Android Market or here:
http://www.androidzoom.com/android_applications/productivity/presentation-timer_hdqh.html

Please let me know if you have any feedbacks or suggestions concerning the software.

Deleting search history on Google Maps

May 9th, 2010

As of the date of this post, it is only possible to delete your search history from Google Maps using this procedure.

1. Uninstall or upgrade your version of Google Maps

It doesn’t take too long to perform this procedure. Unfortunately a more straightforward method is currently missing from the Android version of this software.

Charging Motorola Droid

May 6th, 2010

Using the USB cable to charge your Droid from the computer is very slow. Using the supplied charger connected to the wall is much faster. If your droid does not charge, or charges too slowly, use the wall charger instead.

Note that even if a third party charger fits your Droid, it may or may not work. This is since they have special circuitry which queries the power supply for the maximum amount of current it can provide. Many chargers do not have this circuitry.

Bash tab completion

March 8th, 2009

Making tab completion too fancy is very annoying. It hides files you think should be there, but are not. To stop the insanity for bash, use:

complete -r

in your start up files.

HItting the tab key should only ever list files, and never domain names, or user names. Being too smart for its own good misleads users to not seeing the files they know are there. Typing “complete” with no arguments shows use all of the crazy rules that someone thought was appropriate, but I find appalling.

For example, why should bash know anything about mpg123?

complete -o filenames -F _filedir_xspec mpg123

It’s just plain wrong.

MediaWiki Getting math to work

March 8th, 2009

I first started by looking at:
http://meta.wikimedia.org/wiki/Troubleshooting_math_display_errors

These settings in my “LocalSettings.php” seemed to help get math to work on linux:

$wgEnableUploads = true;
$wgUseTeX = true;
$wgUploadPath = "{$wgScriptPath}/images";
$wgUploadDirectory = "{$IP}/images";
$wgMathPath = "{$wgUploadPath}/math";
$wgMathDirectory = "{$wgUploadDirectory}/math";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";

where “images/math” and “images/tmp” should exist in the directory structure of your installation. Also make sure they are writable by the webserver. On Ubuntu:

mkdir images/tmp
mkdir images/math
chown -R www-data:www-data images

These settings seemed to get rid of the horrible memory exhaustion errors when doing simple stuff:

ini_set( 'memory_limit', '64M' );

Note that you need to have OCaml and make installed to compile texvc in the “math” directory of your installation. Here is everything I installed (using apt-get) on ubuntu to get this to work:

apt-get install ocaml
apt-get install latex
apt-get install dvips
apt-get install texlive
apt-get install ghostscript

Let me know if I accidently omitted anything from this discussion.

Fixing tecplot eps for psfrag. (Version 2)

March 3rd, 2009

A new version since the one here: http://www.computerwhisperer.com/?p=17.

perl ./fixeps.pl < export.eps > export3.eps

This version handles rotated text on the axis, too. It converts:

4694 11610 m
gs 90.0 ro
(V) sh
gr
4694 12195 m
gs 90.0 ro
(5) sh
gr

to

4694 11610 m
gs 90.0 ro
(V5) sh

New Script:

#!/usr/bin/perl
use strict;
while (<STDIN>)
{
  my $hasgs = 0;
  if (/^\((.*)\) sh$/)
  {
    my $string = $1;
    while (<STDIN>)
    {
      if (/m$/)
      {
        next;
      }
      elsif (/^gr/ or /^gs/)
      {
        $hasgs = 1;
      }
      elsif (/^\((.*)\) sh$/)
      {
        $string .= $1;
      }
      else
      {
        if ($hasgs)
        {
          print "($string) sh\ngr\n";
        }
        else
        {
          print "($string) sh\n";
        }
        print "$_";
        last;
      }
    }
  }
  else
  {
    print "$_";
  }
}

Fixing tecplot eps for psfrag.

March 2nd, 2009

This script takes an eps on stdin and writes a new one on standard out.  It essentially groups text in the show command so that psfrag will now work on strings of text.

It reads to standard input and writes to standard output. For example:

 perl ./fixeps.pl < export.eps > export2.eps

Code:

#!usr/bin/perl
use strict;
while (< STDIN >)
{
  if (/^\((.*)\) sh$/)
  {
    my $string = $1;
    while (<STDIN>)
    {
      if (/m$/)
      {
        next;
      }
      elsif (/^\((.*)\) sh$/)
      {
        $string .= $1;
      }
      else
      {
        print "($string) sh\n";
        print "$_";
        last;
      }
    }
  }
  else
  {
    print "$_";
  }
}

It replaces:

21835 20017 m
(N) sh
22353 20017 m
(0) sh

with

21835 20017 m
(N0) sh

In the eps, so I can do this in latex:

\psfrag{N0}{$N_0$}
\psfrag{s0}{$s_0$}
\psfrag{x0}{$x_0$}
\psfrag{S(Beta)}{$S\left(\beta\right)$}

And have the legend looking really pretty in a math font.

Attached are before and after images of psfrag:
before1
after

Create pdf thumbnails

February 16th, 2009

This perl script uses ImageMagick to convert the first page of a directory structure of pdf’s into a 600 pixel wide png thumbnail.  The [0] in file.pdf[0] means to convert only the first page.

#!/usr/bin/perl -w
use strict;

my $tmp = `find . -iname '*.pdf'`;
print "$tmp\n";
my @files = split(/\n/, "$tmp");
foreach my $file (@files)
{
  my $outfile = "${file}.png";
  if (! -f $outfile)
  {
    my $command = "convert -thumbnail 600 '$file\[0\]' '$file.png'\n";
    print $command;
    `$command`
  }
  else
  {
    print "$outfile already exists\n";
  }
}