a footnote to the retreat of the mind

HelmsDeep

The latest Atlantic contains an article by Brian Christian on the annual Turing Test held in Brighton, England.  In order to pass the Turing Test (also known as the Loebner Prize) a computer program must be able to fool 30 percent of the people it interacts with that it is human.  In 2008, one program missed this goal by only one vote.

In the article, Christian quotes Douglas Hofstadter, the author of Godel, Escher, Bach, on the problem of ‘The Sentence.’   The Sentence is the perennial attempt to frame the all-important definition “The human being is the only animal that …”  We once thought this sentence could be completed with uses language, uses tools, does mathematics, or plays chess, only to be confounded each time by further discoveries about the natural and mechanical world.

‘Sometimes it seems,’ says Douglas Hofstadter […] ‘as though each new step towards AI, rather than producing something which everyone agrees is real intelligence, merely reveals what real intelligence is not.’  While at first this seems a consoling position – one that keeps our unique claim to thought intact – it does bear the uncomfortable appearance of a gradual retreat, like a medieval army withdrawing from the castle to the keep.  But the retreat can’t continue indefinitely.  Consider: if everything that we thought hinged on thinking turns out to not involve it, then … what is thinking?  It would seem to reduce to either an epiphenomenon – a kind of exhaust thrown off by the brain – or, worse, an illusion.  Where is the keep of our selfhood? [emphasis mine]

I have always been a fan of footnotes.  In complex academic works, it is usually the footnotes that contain the most fascinating insights.  They are, in a sense, the epiphenomena of the academic world. 

Stephen H. Voss has a fine translation of Descartes’s The Passions of the Soul, a work Descartes wrote for Princess Elizabeth of Bohemia years after separating the mind and the body in his Meditations on First Philosophy.  What comes out in this later work – and to which attention is drawn in Voss’s footnotes — is that the line between mind and body is not a geographical division like that between countries, but rather a kinesthetic separation between the inside and the outside.  In The Passions, Descartes even begins talking about the inner soul and the interior of the soul, further subdividing the line between self and world.

Concerning this, Voss writes in footnote 78:

Since the soul has no parts […], it is hard to see how to distinguish theoretically the interieur, let alone le plus interieur, of the soul from the rest of it.  As we intimated in note 27* in Part I, it is perhaps more reasonable to see such passages as signs of Descartes’s genuinely neo-Stoic attitude toward the world.  We have seen his focus successively narrow in this work: the body, the pineal gland, the soul, and now its ‘interior.’  A similar itinerary can be traced in the First Meditation: objects that are very small or far away, familiar nearby objects, the body and its senses, the soul and its reason.  And so can one more: examining ‘the great book of the world’ on military travels through several countries; Amsterdam, Leyden, and the isolated village of Egmond; and finally the palace in Stockholm.  What walled fastness can ever provide security? [emphasis mine]

I’ve always wondered if this kinesthetic problem of interiors and exteriors is related to the solution of using metalanguages to avoid problems of self-referentiality in logic.  In particular, I’m thinking of Douglas Hofstadter’s chapter in Godel, Escher, Bach describing Russell and Whitehead’s Principia Matematica,  called “Banishing Strange Loops”:

Russell and Whitehead did subscribe to this view [that self-reference is the root of all evil in logic], and accordingly, Principia Mathematica was a mammoth exercise in exorcising Strange Loops from logic, set theory, and number theory.  The idea of their system was basically this.  A set of the lowest ‘type’ could contain only ‘objects’ as members – not sets.  A set of the next type up could only contain objects, or sets of the lowest type.  In general, a set of a given type could only contain sets of lower type, or objects.  Every set would belong to a specific type.  Clearly, no set could contain itself because it would have to belong to a type higher than its own type […]  To all appearances, then, this theory of types, which we might also call the ‘theory of the abolition of Strange Loops’, successfully rids set theory of its paradoxes, but only at the cost of introducing an artificial-seeming hierarchy, and of disallowing the formation of certain kinds of sets…

This connection I am (less-than-tentatively) proposing, of course, only works if interior and exterior can be mapped to the notions of higher and lower level languages.  This is, however, how we typically think of the emergent self in evolutionary biology.  The highest part of the mind — the most selfish bit – is also the last to have developed in time, while the lizard brain, which the higher functions always seek to constrain, is also considered the part that is least ourselves – it is a mechanical, biological process, and when that lizard brain is in control, we are out of control.


*footnote 27: A pervasive Cartesian conviction is that what is far away can deceive, while what is close at hand can give security.  That is true not only of epistemic security (in addition to the present passage, see Meditations 1 and 3: AT VII, 18 and 37: CSM II, 12-13 and 27; and a. 1 above), but also of emotional security (see Discourse, Part 3: AT VI, 25-27: CSM I, 123-124; and aa 147-148 below).

Phrase of the day: Redundant Appetizer

From a New Yorker portrait of horror maestro Guillermo Del Toro:

We drove east to Burbank. Del Toro is devoted to the Valley—he calls it “that blessed no man’s land that posh people avoid in L.A.” We pulled into Ribs U.S.A., a frayed establishment on Olive Avenue. Del Toro ordered ribs and a lemonade, along with a redundant appetizer of “riblets.”

Read more http://www.newyorker.com/reporting/2011/02/07/110207fa_fact_zalewski#ixzz1Ds2RpTzs

How to Hotwire your WP7 Phone Battery

Steve-McQueen-Bullitt

My project manager was out last night and forgot to recharge her WP7 phone.  With the particular model she has, once the battery completely loses its charge, you can no longer recharge it simply by plugging in the phone charger. 

The problem seems to be that the phone always needs to boot up just a little when it is plugged in.  If there is no charge left, then that minimal necessary change is simply missing.

Since we have the same model, the first thing we did was to verify that the problem was with the battery by switching out her battery for mine.  It was definitely the battery.

The next thing we did was scour the Internet to find out if others were having this issue.  Indeed they were.  And not only people with Windows Phone but also some people with Android phones.  In the process, we also found a seemingly crazy solution that involves stripping up a USB cable and recharging the battery directly.  Of course, we couldn’t resist trying to hotwire a phone and it worked perfectly.  Here’s what you do.

WP_000081

First, find an old USB cable you don’t need anymore.  It doesn’t matter what’s on the other end of the wire as long as one end is USB.  Cut The Wire!

WP_000083

Next, strip the cut end to remove the plastic from the wire.  You’ll want to strip about 3/4 of an inch off.  This will expose a thin foil wrapper around the internal wires and filament.  Remove the foil.

WP_000094

Bend back the filament as well as the extra interior wires to expose just the red and the black wires.  These are the wires that actually carry the charge in a USB cable.

The interior wires are too thin to actually strip.  What you can do, however, is cut the red and the black wires at an angle.  This will expose enough of the copper to work with.

WP_000101

Pull your battery out of your Windows Phone device.  Your phone battery will indicate where the positive and the negative touch points are.  Plug your USB connector to your laptop.  Take the other cut end and touch the red wire to the positive and the black wire to the negative.

RED => Positive

BLACK => Negative

Hold the wire to the battery for about two minutes.  People will ask what you are doing if, like me, you do this in the office.  Try to be creative with your response.

After two minutes, put the battery back in your phone and plug your phone in to recharge it.  The battery is still at 0 per cent, but now has just enough charge so the phone is able to start up and begin charging normally.

It’s a bit MacGuyveresque, but makes for a great story.

Drinking the F# Kool-Aid

Friend Colin Whitlatch just sent me the following C# code snippet to mess with my Saturday morning.  Note the underscore:

 

Action<object> strangeLambda = _ => 
    Console.WriteLine("F# Rules");
strangeLambda(null);
Console.ReadLine();

The Modern Tech-Savvy Bourgeoisie

easyoneasyoff

My good friend Corey Schuman and I were talking about modern life this afternoon.  Modern life is basically pretty good – if your concern is culture.

Chinese manufacturing has kept clothes prices basically level for the past twenty years – America probably has one of the best dressed populations in the world.  If you like fashion, you are covered.

Electronic books have not only made access to classics ridiculously easy but also practically free.  With a Kindle you can download the complete works of Shakespeare, Dickens, Proust, Joyce, Plato and Aristotle for under ten dollars.  Life is good for the reader.

If you like music, a subscription to a standard music service like Zune or Rhapsody for about fifteen dollars a month (or a la carte with iTunes) will grant you access to all the great performances of the Western musical tradition, from Bach to Beethoven to Mozart to John Williams.  For very little money, anyone can hole up for a few months and become an expert on the greatest music known to man.

Fans of fine art, likewise, have free and remarkable access to high-rez images of – well — anything.  What more need be said.

And if you like movies, there is always Netflix.  According to a recent report, a third of all Internet traffic after dinner is dedicated to streaming movies from Netflix … and it isn’t all crap.  The classics are well represented.  I promised my friend a list of movies worth streaming and currently available for streaming — here they are.  The Italian masters are well-represented on Netflix, as is the French Nouvelle Vague.  German cinema from the 70’s (as well as lots of Hitchcock) was recently removed, but hopefully they will come back soon. 

The only caveat is that my cinematic tastes are heavily influenced by the Marxist film criticism I read in college, so my apologies in advance for that:

Kurosawa:
Yojimbo
Seven Samurai
Ran
Rashomon
Ikiru

Yasujiro Ozu:
Tokyo Story

De Sica:
The Bicycle Thief
Umberto D.

Pasolini:
Gospel According to St. Matthew

Hitchcock:
The 39 Steps

Truffaut:
Jules and Jim
the 400 Blows
Shoot the Piano Player

Goddard:
Breathless

Jean Renoir:
the Rules of the Game
Grand Illusion

Jean Cocteau:
Beauty and the Beast

Bunuel:
Un Chien Andalou

Fritz Lang:
M
Testament of Dr. Mabuse

Fellini:
La Strada
La Dolce Vita
8 1/2

Marcel Carne:
Children of Paradise

Bergman:
Smiles of a Summer Night
Virgin Spring
Wild Strawberries
Persona
Fanny and Alexander

Eisenstein:
The Battleship Potemkin

American Cinema:
His Girl Friday
All About Eve
The Lady Eve
The Palm Beach Story
My Man Godfrey
The Third Man
The Grapes of Wrath
The Bells of St Mary’s
On the Waterfront
Bonnie and Clyde
The Sting
Butch Cassidy and the Sundance Kid
Network
Doctor Zhivago
Mean Streets
Manhattan
A Clockwork Orange
Apocalypse Now
Blazing Saddles
Jaws

Windows Phone 7 Side Loading

Side loading is a topic familiar to Windows Phone developers but not so familiar to those who might need to work with these developers and require an understanding of the functionality in order to be more effective.

Side loading refers to deploying applications directly to a device without going through the official Microsoft Marketplace. You may want to side load an application for prototyping, demos and reviews. 

In an enterprise environment, you may additionally want to side load applications that are intended only for internal consumption. Unfortunately, an enterprise solution is not available for the first iteration of Windows Phone. It may be included in a future release.

The side loading capabilities of Windows Phone 7 are somewhat restrictive. You may side load applications either to a software emulator running on a PC or to a physical device. Side loading to the WP7 software emulator requires the installation of the Windows Phone Developer Tools. In addition to various products (Visual Studio Express, Blend for WP7), the Windows Phone Developer Tools includes the Application Deployment utility which you will use for side loading. You must be running Windows Vista or Windows 7 in order to install the Developer Tools.

The Windows Phone Developer Tools may be downloaded here.

Side loading to a Windows Phone device additionally requires installation of the latest Zune software.

The Zune software may be downloaded here.

Deploying to a WP7 device is similar to deploying to the WP7 emulator. Besides the requirement that Zune software be running in order to deploy to a device, there is an additional restriction that you can only deploy to an “unlocked” developer device. A Marketplace account is required to unlock a WP7 device, and only five three developer devices can be unlocked for each marketplace account. A Marketplace account requires an annual membership fee of $99. A full membership, allowing for the publication of applications to the marketplace, can be purchased here and generally requires a two to three week verification period. Finally, only ten applications may be side loaded onto any device.

Deploying to the Emulator

Once the Windows Phone Developer Tools have been successfully installed, you may side load to the emulator by using the Application Deployment utility. You can find the Application Deployment utility by going to your Start Menu on the taskbar.

taskbar

Select “All Programs” from the Start Menu. Find and open the menu folder named Windows Phone Developer Tools.

admenu

This will open the Application Deployment utility.

ad

The Target dropdown has two entries. From the Application Deployment utility, apps can be deployed either to the emulator or to a device. To deploy to the emulator, select “Windows Phone 7 Emulator” as the target.

You will be deploying a XAP file, which is a file with a “.xap” extension. A XAP file is the basic unit for a phone application, much as an executable is the basic unit for a typical windows application. It includes the code as well as all the images and other assets required to run a specific phone application. Use the browse button to find the XAP file you want to deploy to the emulator.

Once a XAP file has been selected, press the “Deploy” button. If the emulator is not already running, deployment will start the emulator for you.

The emulator is a bare-bones version of the Windows Phone OS. It has most of the functionality found on a Windows Phone device but is lacking many of the applications you will typically find on a standard WP7 device. In fact, the Start screen on the emulator only contains Internet Explorer.

wp7startscreen

Select the right facing arrow at the top right corner to bring up all applications. You will find your newly loaded app on the applications screen.

Deploying to a Windows Phone

Once the WP7 Dev Tools and the Zune software have been successfully installed, you must run the Zune software before attempting to side load. You do not need to be logged into your Zune account in order to side load an app.

zune

While the Zune software is running, open the Application Deployment utility by following the steps enumerated above for side loading to the software emulator.

As pointed out above, the device must be “unlocked” as a developer device in order for deployment to occur.  The device does not have to be unlocked by you.  Hypothetically, you can simply ask someone with an annual Marketplace subscription to unlock the device for you.

Connect your device to your PC using a micro-USB cable (typically included with the device). The lock screen must be slid out of the way for deployment to occur.

In order to deploy to your device, you will select “Windows Phone 7 Device” as the deployment target in the Application Deployment utility rather than “Windows Phone 7 Emulator”.

To finish deploying to an unlocked device, follow the steps outlined above for deploying to the emulator.

* Special thanks to WP7 MVP Joel Johnson for reviewing this document and making necessary corrections to my understanding of how side loading works.

WP7 Tip: disabling the Pivot Control swipe gesture

don't try this at home

A common question on WP7 message boards and mailing lists concerns how to cancel a pivot control’s built-in page swiping when you have another control in the pivot that takes swipe gestures: for instance, a Slider!

The standard Microsoft response to these queries is that you shouldn’t do it.  It creates UX confusion and is a “bad practice.”  The assumption is that users don’t think contextually, and will expect swiping to always do the same thing on a page.  This is one of those “sounds good enough” answers, and seems eminently reasonable with respect to a slider control inside a pivot panel.  Besides, you can always just orient your slider vertically, so there is even an out. 

On the other hand, WP7 textboxes use hold-and-swipe to manipulate the cursor in a textbox.  Is it poor UX or a bad practice to use textboxes inside of a pivot control?  Should I try to find a way to orient my textboxes vertically?  What about the Toggle Switch control?

Consider also that swiping is the quintessential phone gesture.  Every new WP7 control in 2011 will attempt to take advantage of it.  It would be a shame if we couldn’t use any of them with the pivot.

This post will address how to do the unspeakable: add a working, horizontally oriented slider to a pivot control.  If you understand how to add a slider to a pivot, you will be able to add any sort of control to a pivot.  For additional takes on this “Don’t Try This At Home” topic you should read Derik Whittaker’s post as well as Miloud B’s post.

In a nutshell, the keys to making this work are to use the IsHitTestVisible property of the pivot control in order to disable swiping.  Then use the static Touch class’s FrameReported event to determine when to re-enable it.

Create a new project in Visual Studio.  If the Pivot control is not available in your toolbox, right click on the toolbox and select “Choose Items…”  Scroll until you find the Pivot and select it.  Open MainPage.xaml in design view.  Drag the Pivot control into the Content grid.  Grab the sizing handles for the Pivot and drag them around until the Pivot fills the Content grid (everything under the Application Title and Page Title textblocks).

Two pivot panels are initially stubbed in for the Pivot control.  Drag a Slider control into the first panel (“item1”).  If you run the application now, you will encounter strange behavior in which the slider bar is successfully moved when you swipe it, but at the same time the pivot panel also attempts to page to a new panel.

swipeme

To fix this, handle your slider control’s ManipulationStarted event and set the pivot’s IsHitTestVisible property to false in order to disable it while the swipe for the Slider is being handled. 

When the swipe is completed, you will need to re-enable the pivot.  You cannot do this on the MouseLeftButtonUp event since this gets disabled on all child controls when you set IsHitTestVisible to false on a container.  Putting it in the ManipulationCompleted event is possible, but results in inconsistent behavior.

Instead, take advantage of the lower level touch API.  Check to see when an up touch gesture occurs over your slider  and set the pivot’s IsHitTestVisible property to true when it does.  This can be hooked up in the page constructor like so:

Touch.FrameReported += (s, e) =>
{
    if (e.GetPrimaryTouchPoint(slider1).Action == TouchAction.Up)
    { 
        pivot1.IsHitTestVisible = true; 
    }
};

Here is the relevant XAML:

<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <controls:Pivot  HorizontalAlignment="Stretch" Margin="6,6,0,0" 
                        Name="pivot1" Title="pivot" 
                        VerticalAlignment="Top" Height="595">
        <controls:PivotItem Header="item1">
            <Grid>
                <Slider  Height="107" HorizontalAlignment="Left" 
                            Margin="-4,109,0,0" Name="slider1" 
                            VerticalAlignment="Top" Width="460" 
                            SmallChange="1" 
                            Maximum="100" 
                            Value="30" 
            ManipulationStarted="slider1_ManipulationStarted" />
            </Grid>
        </controls:PivotItem>
        <controls:PivotItem Header="item2">
            <Grid />
        </controls:PivotItem>
    </controls:Pivot>
</Grid>

And here is the code-behind:

public MainPage()
{
    InitializeComponent();
    Touch.FrameReported += (s, e) =>
    {
        if (e.GetPrimaryTouchPoint(slider1).Action == TouchAction.Up)
        { 
            pivot1.IsHitTestVisible = true; 
        }
    };
}

private void slider1_ManipulationStarted(object sender
    , ManipulationStartedEventArgs e)
{
    pivot1.IsHitTestVisible = false;
}

The Minority Report Demo You’ve been Waiting For

The Emerging Experiences Team at Razorfish has been working with NUI concepts on MS Surface for several years – and more recently on Windows Phone.  When the Kinect sensor became available we quickly grabbed the hardware and started exploring what could be done with it.  The above demo (coded and filmed by Steve Dawson) uses the Kinect and a physics engine to provide an experience that is Sorcerer’s Apprentice meets Minority Report.  Enjoy!

[Over the weekend we made it onto Endgadget and Gizmodo.]

Re-examining WP7 Launchers and Choosers

One of the questions every developer must face when a new technology like WP7 comes on the scene is whether to jump onboard early (in the CTP and Beta stages) or wait until a platform RTMs.  The advantage of the former is that one has a longer lead time to learn the technology and establish oneself as an authority on the technology inside one’s company or on the web.  The advantage of the latter is that one doesn’t waste time learning things about the technology that are in flux and may go away; instead one can wait for the experts to say what they have to say and learn from that.

A possible advantage to deferring the groking of a new technology is that one also has less to unlearn.  Early adopters often make the mistake of assuming that they do not have to re-examine what they already know when the technology RTMs.  The problem for those who defer learning new technologies is that, if they are not careful, they may inherit the bad information disseminated by those early adopters and insiders, and suddenly we are all stuck in a situation where what counts as common knowledge is simply wrong.

Probably the worst case of this for Windows Phone developers occurred with launchers and choosers.  The original metaphor seemed clear enough: launchers are fire-and-forget components, choosers return information.  This turns out not to be completely true, however.  Save operations, which are considered launchers, must return information about whether each save was successful.  They aren’t really fire-and-forget. 

Another early lesson WP7 developers learned was that all launchers and choosers cause an application to tombstone – and thus was created one of the most obscure and difficult aspects of Windows Phone development.  As WP7 went from Beta to RTM, however, it was decided that this didn’t always make sense.  Recovering from tombstoning is time-consuming.  Why force an app to tombstone for something like the CameraCaptureTask when the user will most likely return to the application immediately after the task is completed?  To find out more about deferred tombstoning, see Why Deactivated is Not the Same as Tombstoning.

Just to make things a little more complicated, it isn’t just the four choosers which turn out to not force tombstoning.  MediaPlayerLauncher, one of the eleven launchers, also implements deferred tombstoning.  The PhoneCallTask also does not throw an application into tombstoning mode (additionally, it also never seems to trigger the Deactivated event).  Incoming phone calls, outgoing phone calls, the five choosers and MediaPlayerLauncher all merely suspend (or pause) the application, keeping all the pages along with their state in memory.

If you are confused, welcome to the club.  The original metaphor of having launchers and choosers broke down bit by bit through subsequent iterations of the Windows Phone platform.  Experts quote each other based on these different iterations.  After a while, no one is sure anymore exactly how launchers and choosers work.

The solution, naturally, is to trust but verify everything you read.  You can find out whether an application is actually tombstoned when a task (the generic name for both launchers and choosers) is initiated by placing a simple debug message in the constructor of the page that launches the task.  If the constructor is called when you press back from the task, then your application was tombstoned.  If the constructor is not called, then you know the page has been retained in memory and tombstoning did not occur.

Once you have verified something like this, always write it down somewhere.  Here’s the chart I keep for myself to help remember the behavior of various launchers and choosers.  It is for the RTM version of Windows Phone only.  Please take it with a grain of salt.

Task

Launcher

Chooser

Returns Data

Defers Tombstoning

Suspends Application

CameraCaptureTask

 

X

X

X

X

EmailAddressChooserTask

 

X

X

X

X

EmailComposeTask

X

       

MarketplaceDetailTask

X

       

MarketplaceHubTask

X

       

MarketplaceReviewTask

X

       

MarketplaceSearchTask

X

       

MediaPlayerLauncher

X

   

X

X

PhoneCallTask

X

     

X

PhoneNumberChooserTask

 

X

X

X

X

PhotoChooserTask

 

X

X

X

X

SaveEmailAddressTask

X

 

X

   

SavePhoneNumberTask

   

X

   

SearchTask

X

       

SmsComposeTask

X

       

WebBrowserTask

X