think logo

Site Info

Categories

Archives

Meta

Geo

Museum

Recent Posts

Recent Comments

 

February 2012
S M T W T F S
« May    
 1234
567891011
12131415161718
19202122232425
26272829  

Remotely boot your iPad and launch an app

May 25, 2011

I’m one step further along on the quest for the Holy Grail of kiosk displays. We use a lot of iPads here at the museum, most of them are either in Lab Shield brackets or built into cabinets. The whole idea behind building a kiosk is to make it hard for people to break into your device, so naturally the power and home buttons are behind lock and key.

The trouble is, there are a few quirks in the iPads. One is that after running for a few days, the display seems to lose its sensitivity to touch. The only way so far to deal with that seems to be to open the bracket, hit the power button to make it sleep, then hit it again to make it wake up. Then launch the app again and lock the whole thing back up. Not something the visitor services people want to do a lot. Nor I.

Sometimes visitors also break out of the kiosk app (we’re using iCab Mobile, an absolutely fantastic app, by the way). I have no idea how, but sometimes the iPad will be doing something completely different. One of ours now has a spiffy new home screen background thanks to someone who got in.

I’m very hopeful that my newly found method of remote booting/app launching will help at least take some of the pain out of the reset process.  Here’s how:

  1. Jailbreak the iPad (only works on iPad 1′s for now)
  2. Install OpenSSH (I installed the whole BigBoss Recommended Tools suite)
  3. Install Activator
  4. Determine the IP address of the iPad
  5. ssh in as root, change the password right away!
  6. Set up Activator to launch whatever app (e.g. iCabMobile) you want to have start up at boot time. Hook the app to the “Anywhere -> Power -> Connected” event.
  7. If you’re still ssh’ed in from step 5, type ‘reboot<return>

Voilá. Your iPad will reboot, and if you’re crossing your fingers just right, the app will launch after it boots. It seems to do this pretty reliably unless you do it too many times in too short a time.

I’ve set up ssh keys for the iPad so that I can run a command like this from my desktop machine:

ssh -i .ssh/id_rsa_ipadkiosk root@192.168.1.52 reboot

Next up on my list is to build a web app that lets us reboot any iPad. Then we can carry around an iPad running the web app, and reboot troublesome exhibits with the swipe of a finger.

Update: I should note that for this to work, the iPad has to be plugged in to a power source. During the boot sequence the hardware must sense the power source and generate the same event that gets generated if you plug it in after it’s booted.

Mac OS X user idle time in Python

March 3, 2011

I’m still on the quest for the perfect free kiosk app for Mac OS X. I’ve used Plainview to good effect in several exhibits. I’ve used Opera in one, and I’m using Firefox with R-Kiosk in another. Which program to use depends a lot on the nature of the web page(s) to be displayed in the kiosk and the way the user expects to interact with the kiosk.

For the Firefox kiosk, I needed a sure-fire way to reload the home page after a certain amount of idle time. The trouble is that Firefox doesn’t lend itself to be controlled via AppleScript. A lot of poking around led me to learn about AppleScript System Events being able to simulate a keypress, that Option-Home will make Firefox load the home page, and that there’s a really handy little application called Full Key Codes that tells you what the key code is for any key you press on a Mac.

That let me put together this handy little Python script that watches how long it’s been since a user has done something. First it waits until there’s been any user activity at all, then it waits until there’s been no activity for 90 seconds. Then it uses osascript to run a little bit of AppleScript that sends Option-Home (key code 115) to Firefox.

I suspect there’s a way to eliminate the osascript by using the Python objc module, but this is good enough for me…

#!/usr/bin/env python
 
#========================================================================
#
# idle.py - makes Firefox load home page after user inactivity
#
#       Set the value of 'timeout' to the number of seconds of idle
#       time you want to allow before reloading the home page
#
#       Comment out the calls to status() if you don't want to see any
#       messages
#
#========================================================================
 
from subprocess import Popen
from time import sleep
from Quartz.CoreGraphics import *
 
# From /System/Library/Frameworks/IOKit.framework/Versions/A/Headers/hidsystem/IOLLEvent.h
NX_ALLEVENTS = int(4294967295)  # 32-bits, all on.
 
# Set this value to the number of seconds of idle time before
# resetting Firefox
timeout = 90.0
 
def status(state, last, idle):
    """Print out some info about where we are """
    print "%10s %.1f %.1f" % (state, last, idle)
 
def getIdleTime():
    """Get number of seconds since last user input"""
    idle = CGEventSourceSecondsSinceLastEventType(1, NX_ALLEVENTS)
    return idle
 
def doReset():
    """Use osascript to tell Firefox to reload the home page"""
    reset = """/usr/bin/osascript \
        -e 'tell application "Firefox"' \
        -e ' activate' \
        -e 'end tell' \
        -e 'tell application "System Events"' \
        -e ' key code 115 using option down' \
        -e 'end tell' """
    Popen(reset, shell=True)
    sleep(1)                    # Prevent osascript keypress from triggering below
 
last = 0.0
idle = 0.0
 
while True:
 
    # These two lines can also be at the very end if you don't want to
    # load the home page once when the program starts
    status('--- RESET', last, idle)
    doReset()
 
    idle = getIdleTime()
    last = idle
 
    # Wait for user activity
    while idle >= last:
        status('wait', last, idle)
        sleep(1)
        idle = getIdleTime()
 
    # Wait for idle to become bigger than timeout
    while idle < timeout:
        status('triggered', last, idle)
        sleep(1)
        idle = getIdleTime()

WordPress client IP address, behind a proxy

February 28, 2011

At the museum, we’re running a site where we want people to comment but where we’re also sitting ducks for spam comments. Trouble is, the site is running behind a web proxy. That means that all the comments are seemingly from the same IP address, namely that of the proxy host. That, in turn prevents any meaningful spam detection.

I poked around the web a while, looking for a way to get the real IP addresses, and finally rolled my own solution.

It boils down to this. If you’re running behind an up-to-date apache server that’s doing the proxying for you, all of the incoming HTTP requests should have the X-Fowarded-For header set to the originating client’s IP address.

Once I verified that this is the case, I put this snippet of code into my functions.php file.

function m150_ip_fixup($s) {
  $headers = apache_request_headers();
 
  if (!empty($headers["X-Forwarded-For"])) {
    $_SERVER["REMOTE_ADDR"] = $headers["X-Forwarded-For"];
  }
  return $s;
}
 
add_action( 'pre_comment_on_post', 'm150_ip_fixup');

Now, comments get tagged with their original IP address.

Coming up with a question is also creation

September 30, 2010

To create is not just to produce objects or phenomena.

Coming up [with] a question is also creation.

In fact, a question that has a huge receptive capacity doesn’t even need a definitive answer.

The very essence of a question is its power to elicit the possibilities or reply, to trigger a variety of thoughts.

Questioning is emptiness.

The total quantity of thoughts triggered by questioning is what matters most.

I entreat you not to produce more but to think more.

I believe that the richness of that thinking may very well be the critical resources to giving this world a future.

Kenya Hara at Google

Found via Core77

Review: Rubbermaid 12-Slot Organizer as a Mac mini server rack

July 12, 2010

I needed to do something about the Mac minis that were accumulating on the table in my office. Digging around, I found this Rubbermaid organizer on Amazon.

It turns out to be nearly perfect. The unit is very sturdy, was easy to put together, and the shelf height is just right. There’s enough clearance for airflow but not so much that you feel space is being wasted.

I used self-stick cable tie anchors and cable ties to mount the power bricks and used double-stick mounting tape as stops to keep things in place. The old-style minis are heavy enough and are pretty non-slip, so I just put some tape at the front of the shelf to keep them from sliding off. The one new-style mini was pretty slippery so I used the tape to actually stick the base to the shelf.

The unit came with vertical rods that go in the back of each column of shelves to keep them from sliding out the back, but I decided to leave those out. That way I can slide each shelf forward to get DVDs into the mini, or back to get at the connectors.

The weak spot of the minis is the power cord (at least on the pre-2010 models) which comes out quite easily. I tied those down as well and am pretty sure they won’t jiggle their way out. I have four minis in the rack right now along with a Drobo with 10TB of disk. I’m going to be adding a 5th mini with a stackable disk drive, that’s why there’s double-high slot  still open on the mini side of the rack.

Cable management is an issue, mostly because of the power bricks long cables. I may fiddle with how I fold the cables into the shelves a bit more.

The whole thing plus a UPS and monitor/keyboard/mouse sits nicely on some steel shelves in our A/V equipment room at the museum. I still need to time how long the UPS runs. I’m only going to have the public web site minis on it.

QR Codes in exhibits

April 12, 2010

We’ve put our first QR Code up at the museum as an experiment. This seems like one way to deal with “nth level” information that might be interesting to some visitors but not to others. And it’s a way to make it easy for visitors to bookmark information for themselves.

Generating the QR Code isn’t hard. Google’s Chart api can do it. Basically, anything you put fullowing the “chl=” part of the URL here will generate a code: http://chart.apis.google.com/chart?cht=qr&chs=350×350&chl=http://think.random-stuff.org/

We’ve set aside a specific URL space for our codes to send people to. Each link will first take you to a short URL which will then redirect you to the actual URL relevant to the exhibit. The advantage of this is that we can also put up short, “human readable” links on the exhibits.  That will let us track how often the links are getting used and what mobile devices people are using. We’ve also put an explanatory page at the top level of that space.

There was a little debate about how much we should try to explain QR Codes on the exhibit itself. You can see what we wound up with in the detail photo. Basically we’ve decided that visitors will either (a) recognize the code and know what to do with it, (b) not recognize it and skip over it, or (c) ask someone. The “c” people can be given a printout of the explanatory page.

We’ve decided to introduce the codes slowly and in a way that hopefully doesn’t get in the way of people who don’t know what they are or don’t choose to use them.

Another question was whether we should format the linked pages in a phone-friendly format. The easy answer (because it requires no additional resources…) was not to do that. Phones are getting pretty good at reading full-blown web pages.

For further reading, here’s a March 2009 article titled QR codes in the museum – problems and opportunities with extended object labels

What QR Code app am I using? Right now on my iPhone 3G, I’ve got Barcodes. It’s got a huge number of one-star, negative comments but it works for me. The critical thing you need to know is that it only works on QR Codes, not regular barcodes, and at least with the 3G, you have to take the photo from about 18″ away and then use the app to zoom it to the right size.

Ubuntu on Eee Box B202

April 5, 2010

I’m always on the lookout for low-cost, easily maintained computers to drive displays or do other odd jobs around the museum. The Mac mini is still the gold standard for me. But even with the educational discount, a Mac mini can seem like overkill. We have an exhibit coming up where there’s going to be a projection of a single, still image. Some projectors can take an image from a flash drive, but none of the ones we have laying around can do that. So it was either spend money on a projector that can, or get a computer to drive it. (We could also use a DVD player with a single frame video loop, but that wouldn’t give me full 1024×768 resolution on the projector.) So last week I bought an Eee Box B202 preloaded with Linux.

Initially it was a bust. I hooked it up to a monitor, turned it on, and it booted to a text login prompt. No nice multi-media GUI, nothing. Just login:

Googling around was no help. I couldn’t figure out how to make it start X Windows or anything. The OS that’s on there is called Red Flag Linux. It seemed to have everything it needed, but I don’t have enough Xorg fu to understand how it was supposed to figure out how to configure itself for the monitor I had.

It turns out that was a blessing in disguise. After a little more Googling, I found myself making a bootable USB stick with Ubuntu 9.10 on it. I wound up using the “From Linux” instructions from another Ubuntu box. I debated whether or not to use the netbook distro or the full desktop one. I picked the full one. It turned out to be the right choice.

I did mess with the B202′s BIOS a bit to figure out how to make it boot from the USB stick. I’m not sure whether any of that was strictly necessary, but I had changed a few things to try to get the original software running.

After that it was smooth sailing. Ubuntu booted right up, running from the USB stick. It helpfully presented the option of installing from the stick. Once I made sure it would be able to work with the ethernet and WiFi, I used the installer to reformat the drive and install Ubuntu.

Things went so well, I’m ordering another one. The first one’s going to run our projector. The next one’s going to act as a WiFi to ethernet connection sharing router.

This was my first experience with a LiveCD/LiveUSB/etc. linux. It’s probably unremarkable these days, but I’m impressed with how easy it was to do.

Update: I just got my 2nd Eee Box. This one came with Windows XP pre-installed. Here are the steps needed to install Ubuntu:

  1. When it boots into ExpressGate, click the Exit icon, then hold down DEL to get into the BIOS setup
  2. In BIOS->Tools: Disable ExpressGate, then hit ESC to exit
  3. In BIOS->Boot->Hard Drives: hit + to make 1st drive = USB:SMI USB Disk
  4. Plug in your Ubuntu USB stick
  5. Hit F10 to save and exit

Now it will boot from the USB stick. At this point you can either boot into Ubuntu w/o installing (i.e. run from the stick) or install Ubuntu. If you’re unsure whether you want to go through with this before you try, then choose the first option. Note that it takes a longish time to boot from the stick.

Once it boots, you’ll see an icon in the upper left corner labeled “Install Ubuntu 9.10″. Double-click that to do an installation.

Moving the server

December 18, 2008

Is there anything that’s more nerve-wracking than taking down a perfectly functioning server in order to do something with it? This morning I had to move two servers (a PowerMac G5 running Leopard Server, and a Mac Mini running 10.4) a whopping 6 feet in order to put them onto a dedicated power circuit. I also needed to install software updates.

Before I ever install any updates on a server, I clone the disk with SuperDuper or CCC. That means I also have to first shut down all the services and pull the system off the net, clone the disk, boot the clone to make sure it’s ok, boot the normal disk, do the update, and test everything. Coupled with having to move the computers, 5 disk drives, and a D-Link switch, I didn’t have a fun few hours this morning.  I didn’t update the Leopard Server machine because I couldn’t get the alternate disk to boot. It turns out that the Iomega portable drive I was using (I love these little disks!) wasn’t getting enough power from the G5′s front connector and needed to be plugged in the back. By the time I figured that out, it was too late, the museum staff people were coming in and I had to have the server running again. So I’ll have to do the update another day.

Now one of the remote users on the updated Mini is having trouble getting in via ssh. So is it due to the move, the upgrade, or something completely unrelated? Having tried a bunch of things and looked at the log files, I’m leaning towards “something else”.

The one good thing that comes from this kind of thing is that you learn whether all the services are properly set up to start at boot time.

IFC.com in the house

December 17, 2008

The IFC Media Project came to town today, to hold a panel discussion at the MIT Museum. They brought in more equipment than we’ve ever had anyone bring in. We had to run an auxiliary 60 Amp power drop for their cameras, lights, and recording studio. 

The panel discussion was about crime reporting in various media outlets, primarily print, radio, and TV. Tucker Carlson, Juan Williams, Martin Baron, Candy Altman, and Josh Silver were on the panel. 

There’s not too much of a technology angle to this event, other than that it’s nice to have people come in who know what they are doing. They brought in all their own equipment and a huge staff. Setup started yesterday, went into the wee hours of the night, and resumed again at 5AM this morning. 

The event was held in our Innovation Gallery, where exhibits are meant to come and go. Right now there’s relatively plenty of floor space but we’re going to be putting in a few new exhibits soon so things are going to get tighter again.

Ode to the Mac Mini

December 16, 2008

Rumors about the death of the Mac Mini and now, the rebirth of the Mac Mini prompted me to post my own personal wish that the Mac Mini retain many of its current characteristics. At the MIT Museum, we use Mac Minis whenever we can. They are insanely reliable and are easy to place in just about any situation. Here are four different setups we are currently running on the first floor.

MIT & the Sea - Mac Mini in a box hung from the ceilingThis one is hung in a box near the ceiling. It’s been running for over a year. We set them all to reboot after a power loss, so we almost never need access. When I do need to do anything to it, I grab a ladder and plug in a keyboard & mouse.


 

 

 

CityCar - Mac Mini inside a small enclosureThis one has also been running for about a year. Prior to that it was sitting in a server room for about two years. The enclosure gets a bit warm. We used to have a Shuttle XPC inside but it failed after about 4 months. I think it was the heat.

 


 

 

CityCar - Mac Mini hung under table in wire basket.We have two display tables with baskets attached underneath. The Mini fits in the basket. We used to have two additional setups just like this. This photo is of the CityCar interactive exhibit. There’s another Mini at the other end of the floor in the MIT & the Sea interactive exhibit (below the Mini-in-a-box pictured above).


 

 

Holography - Mini placed on top of large projector, driving small projector.The latest one to be put into service is a Mini that we strapped to the top of a monster Panasonic projector. The Mini drives the smaller projector to the left in the photo. This Mini is running Vine Server so I can access it remotely. Once we’re done tweaking it, I’ll probably shut off the Vine access.


 

 

Our Admissions Desk also uses two Minis, one for the staff to access various admin tools, mail, etc. The other to drive a sign displaying admissions prices, welcoming groups, etc.

In January we’re going to be installing an exhibit developed by the Sociable Media Group at the Media Lab. So far it will have seven Mac Minis in it, as well as an iMac. There will also be a couple of Dells so I guess we’ll see how they hold up in comparison.

My wishlist for the Mini: Keep being ultra-stable, don’t get too heat sensitive. Faster graphics would be nice, but not at the expense of being more finicky.

PS – I have one in my basement at home as well, it’s running this blog, among other things. I think it’s about 3 years old. I have it on a small UPS to deal with short power outages, connected to the web via Verizon FiOS (also very reliable!).