« December 2005 | Main | February 2006 »

January 29, 2006

First Effort at Smart Device Development

Just finished my first mobile .NET application.

Things that were easy:

·        Creating a skin for the Treo 700w. I happened to download SOTI Pocket-Controller Professional which had a skin for remote access. I grabbed its bmp file and found the folder that defined the existing skins (C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Deviceemulation\). A quick edit of an existing skin XML file and some Photoshopping of the borrowed skin image followed by using the ToolsàDevice ToolsàForm Factors and Devices UIs in Visual Studio 2005 to copy an existing emulator configuration (Windows Mobile 5.0 Pocket PC Phone Square Emulator) and assign it a new Form Factor.

·        Put an application CAB file on a web server. Using IE on the phone to browse the CAB file triggers a download dialog. Check the open after download box and the installer starts automatically.

·        Getting .NET 2.0 framework installed on the phone.

o       Deploying an application directly to the device triggers installation of the .NET 2.0 runtime.

Things that were hard:

·        Getting internet connectivity within the emulators. Remember to have the emulator cradled (use the ToolsàDevice Emulator Manager) and within the emulator enable a network adapter (FileàConfigureàNetworkàEnable NE2000 PCMCIA network adapter…

·        Understanding the difference between all the available emulators. A Smartphone has a limited UI but includes a phone. Pocket PC has an enhanced UI (it assumes the ability to enter keys on a keyboard, graphical or otherwise). And a Pocket PC Phone has both the enhanced UI and a phone.

·        Getting an ASP.NET 2.0 project deployed from a development server to a deployment server with mixed 1.1 and 2.0 based web apps.

o       Copying doesn’t seem to do anything about configuring the virtual directory or file security settings.

o       Publishing is hidden on one of the menus. It doesn’t do the whole thing either.

o       It would be great to have something generate the xml file from which either the virtual directory or web site was configured.

·        Avoiding ObjectDisposed exceptions when shutting down the windows mobile application. There’s a web request pending at the time of shutdown. The request uses a thread pool work item to implement the request. It looks like the request is completing only to find its world disposed. Resolved by calling Abort on the request, not on the thread. And arranging for the thread to exit cleanly.

·        A related issue is what event’s fire when a windows mobile application is minimized (x in corner is clicked) and when the red button is pressed to turn off the screen. An application continues to run if the OK or minimize button are used to hide the application window while leaving it active. Execution is suspended by the red power button. Execution resumes when the red button is pressed again.

·        Icon colors.

o       Use photoshop to convert the image to indexed colors with the Windows System palette.

o       For some reason, icons installed in the emulator seem to be sticky. They don’t update when the application that owns them is updated.

·        The screen on the Treo 700w is 240 x 240 pixels but after the top and bottom bars are lost to the environment, there’s only a 240 x 188 left. Is there any way to get that space back? When the window form is running in maximized mode, it seems to have the top bar in its client rectangle but there’s still a bar visible.

·        Figuring out how to do resources for localization correctly. The breakthrough was finding the localizable property on a Windows.Forms.Form. Turning this on causes magic to happen in the generated code. Selecting a non-default Language property automatically adds a new resource file. Haven’t chased down the whole satellite assembly building and deployment concept yet. Since a smart device app must stay small, you never want to drag around resources that aren’t used.

·        Getting the application shortcut in the right folder.

o       When you create a Smart Device CAB project to setup a smart device application, the default file system view doesn’t contain the Programs Folder. You can add it manually. This is where the application shortcut has to go.

·        Getting a \r\n sequence into a string resource J. I was moving the string from C# code to the resource editor. “\r\n” was interpreted as a literal, so I tried \u000D\u000A and finally 
. Looking at the resource file in the xml editor showed the last attempt being escaped so I un-escaped them and voila! All I had to do was hit the enter key when replacing the original “\r\n”. Doh.

Things I don’t know how to do yet:

·        Signing the application and CAB file in such a way that the phone doesn’t display the unknown publisher dialog. Many commercial packages behave the same way.

·        Building a smart device installer that triggers an ActiveSyn install. Right now the Smart Device CAB setup project requires that you copy the CAB to the device and run it there. It seems you build an ordinary Windows Setup project but there’s some magic involved in communicating an .ini file to ActiveSync that I just haven’t come across yet.

 

January 28, 2006

Voice Command Cheat Sheet

Credit for this list belongs to this posting.

The only way I know to figure this out on your own is using the “help” voice command.

Voice Command Cheat Sheet for Treo 700w

===== CALLING A CONTACT =====
Commands:
Call <contact>
Call <contact> at home
Call <contact> at work
Call <contact> on mobile
Call <contact> on cell
Call <contact> on cellular
Call <contact> at home two
Call <contact> at work two
Call <contact> at car
Call <contact> on radio
Call <contact> on pager
Call <contact> at assistant
To confirm that you want to make the call after Voice Command responds:
You can say "Yes" or "Correct" to call.
You can say "No" or "Incorrect" to try again.
If Voice Command asks you which location, you can:
Repeat one of the locations that Voice Command offers to call.
Say "No" to try again.

Related commands:
You can say "Call back" to call back the last call that you received.
You can say "Redial" to call back the last call that you made.

Examples:
Call Karen Archer on cell
Call Frank Miller
Call City Light and Power
Call Karen Archer Home

Notes:
Voice Command indexes by the Contact's first and last name if it exists. If you have a nickname entered, you can use that
too. Voice Command will only let you call by company name if there is no first or last name.
You must prefix contact calling with the "call" keyword. If you use "dial", it won't work!


===== DIALING A NUMBER ======
Commands:
Dial <7-digit number>
Dial <10-digit number>
Dial <1+10-digits>
Dial <N-1-1>
Examples:
Dial 555-0200
Dial 800-555-1212
Dial 1-800-555-1212
Dial 411
You must prefix digit dialing with the "dial" keyword. If you use "call", it won't work!


===== CHECKING CALENDAR =====
Commands:
What are my appointments today?
What are my appointments tomorrow?
What's my next appointment?

===== START MENU =====
Commands:
Start <program>

Example:
Start Solitare
Start Messaging
Start Internet Explorer
Start Pictures and Video
Notes:
Voice Command will index any file that is in or inside of \windows\program files
You have to say the file name exactly as it is written. It may be helpful to rename shortcuts.
Also, you can put links to web pages here and go straight to a saved web page this way.

===== MEDIA =====
Commands:
Play music
Play media
Play artist
Play album
Play genre

Play <artist name>
Play <album name>
Play <genre name>
Play <everything>
Play
Pause
Stop
Next
Previous (track)
Shuffle on
Shuffle off
What song is this?
What track is this?

Examples:
Play The Beatles
Play The White Album
Play Rock
Play Everything

Notes:
You cannot play individual tracks using voice
Voice Command will index the media based on the metadata. You can use a metadata editor to groom the fields.

 

 

January 27, 2006

Adding Category Button Macros to Outlook 2003

I wanted a toolbar with buttons to toggle the categories I use most often.

Start macro editor: ToolsàMacroàVisual Basic Editor

Rename the default Project1 name.

Insert a new module.

Rename the new module.

Open the module and code similar to the code below.

Add a new toolbar with buttons for each of the macros.

Change the text and or image options for each toolbar button.

By default the macros won’t run when you restart Outlook because of the default macro security level. You can lower the security level, but it isn’t that hard to sign the macro project file.

If you happen to have access to your domains certificate authority web service (e.g. http://server/certsrv), use it to request a “user” certificate and install it on your computer.

Open the Visual Basic Editor again.

Select the project file.

On the Tools menu select Digital Signature

Click Choose and select the installed certificate.

Save and exit the editor and Outlook.

The first time following this that you restart Outlook and try to run one of the macros, a security dialog will appear. Select the option to always trust yourself J.

That’s it.

Sub ToggleCategoryFamilyAndFriends()

    ToggleCategoryInSelectedMailItems ("Family & Friends")

End Sub

 

Sub ToggleCategoryPurchases()

    ToggleCategoryInSelectedMailItems ("Purchases")

End Sub

 

Sub ToggleCategorySubscriptions()

    ToggleCategoryInSelectedMailItems ("Subscriptions")

End Sub

 

Sub ToggleCategoryInSelectedMailItems(category As String)

    Dim newCat As String

    Dim newCats As String

    Dim oldCats As String

    Dim delim As String

    Dim mode As String

    mode = "unknown"

    delim = ", "

    newCat = category

    Dim objExplorer As Explorer

    Set objExplorer = Application.ActiveExplorer

    For Each item In objExplorer.Selection

        Dim pos As Integer

        newCats = delim + item.Categories + delim

        pos = InStr(newCats, delim + newCat + delim)

        If pos = 0 Then

            If mode = "unknown" Or mode = "add" Then

                mode = "add"

                Dim a As Variant, a1 As Variant

                a = Split(item.Categories + delim + newCat, delim)

                a1 = BubbleSort(a) ' For some reason if I don't assign to a1, a remains unchanged...

                newCats = Join(a, delim)

                item.Categories = newCats

                item.Save

            End If

        Else

            If mode = "unknown" Or mode = "remove" Then

                mode = "remove"

                newCats = Left(newCats, pos - 1) + Mid(newCats, pos + Len(delim + newCat + delim))

                If InStr(newCats, delim) = 1 Then

                    newCats = Mid(newCats, Len(delim))

                End If

                If InStrRev(newCats, delim) = Len(newCats) - Len(delim) + 1 Then

                    newCats = Left(newCats, Len(newCats) - Len(delim))

                End If

                item.Categories = newCats

                item.Save

            End If

        End If

    Next

End Sub

 

Function BubbleSort(ToSort As Variant, Optional SortAscending As Boolean = True) As Variant

    ' Chris Rae's VBA Code Archive - http://chrisrae.com/vba

    ' By Chris Rae, 19/5/99. My thanks to

    ' Will Rickards and Roemer Lievaart

    ' for some fixes.

    Dim AnyChanges As Boolean

    Dim b As Long

    Dim SwapFH As Variant

    Do

        AnyChanges = False

        For b = LBound(ToSort) To UBound(ToSort) - 1

            If (ToSort(b) > ToSort(b + 1) And SortAscending) _

               Or (ToSort(b) < ToSort(b + 1) And Not SortAscending) Then

                ' These two need to be swapped

                SwapFH = ToSort(b)

                ToSort(b) = ToSort(b + 1)

                ToSort(b + 1) = SwapFH

                AnyChanges = True

            End If

        Next b

    Loop Until Not AnyChanges

    BubbleSort = ToSort

End Function

 

 

January 11, 2006

Configuring Exchange Intelligent Message Filter, IMF version 2

This article was most helpful for configuring the Exchange Intelligent Message Filter. It also describes how to enable the Custom Weighting Feature. The key steps are:

  • regsvr32 C:\Program Files\Exchsrvr\bin\MSCFV2\MSExchange.UceContentFilter.dll

·        Use Notepad to create/edit (in Unicode format) the file: C:\Program Files\Exchsrvr\bin\MSCFV2\MSExchange.UceContentFilter.xml

Caution: The MSDN & TechNet documentation hasn’t been updated to indicate what version it refers to. Specifically, the interface for enabling IMF features for a SMTP virtual server was changed between version 1 and version 2. This page, for example, describes the IMF V1 interface.

The filter drops blocked e-mail into the C:\Program Files\Exchsrvr\Mailroot\vsi 1\UceArchive folder. Double clicking on a file with a .EML extension opens it with Outlook Express. Delete the real spam and drop the real mail into the pickup folder.

If you do end up mistakenly installing IMF V1 on top of Exchange SP2, it will appear to succeed with no complaints but will probably not work. You can remove it on the Add/Remove Programs control panel. Then reinstall Exchange SP2. Configuration changes appear to be preserved through all this.

 

 

January 08, 2006

Networking and Exchange Setup

Connecting to Verizon’s wireless internet link: user=<phonenumber>@vzw3g.com, pwd=vzw

Activating phone: call *228

WirelessSync is not needed to sync directly to Exchange Server, just use ActiveSync.

ActiveSync settings can be configured on the PC with the device connected via USB (or possibly Bluetooth). The interface is better on the PC.

Motorola HS850 headset pairing code is 0000. Some forum claims that the headset has crappy sound on the Treo 700w.

Scot Rose, scotr@microsoft.com, 980-776-8726 helped get Exchange Server 2003 with SP2 configured for ActiveSync. Issue was oma (Outlook mobile access) doesn’t work over an SSL connection. KB817379 explains how to clone the /Exchange virtual directory to create a copy that can be accessed only by the local machine (via an IP restriction) and which does not require SSL.

Verizon wireless data support group: 866-788-9387. Case # 1003333828 and # 1003334736. Assisted in experimenting with vtext.com configuration. Created an alias for default phone text message address. Interesting experimental result: When an e-mail was sent from a Verizon Blackberry to my tone@kizmet.org e-mail account, it arrived only on the phone and not on the Exchange server.

Initially ended up with duplicate calendar entries after using PC sync and then switching to Exchange sync. Tried manually deleting them but that’s a non-starter. Did a hard reset of the phone (hold power on button while simultaneously pressing soft reset button under the battery compartment lid). After a hard reset, the phone had to be re-activated and all user settings had to be restored, including internet connection (My ISP settings).

Microsoft claims that until Verizon rolls out new phone firmware that includes MSFP (Messaging and Sercurity Feature Pack), true Exchange push won’t work.

Built a simple Smart Phone 5.0 .NET 2.0 device application and deployed it to the phone. There’s 25.5 MB total of program space, 18.5 used, 7 MB free. The toy app was only 6KB so maybe that’s enough to do something with. Still seems very modest.

I have a 1GB SanDisk SD card in the phone. Programs installed on the SD card appear to crash immediately after restarting the phone when the app was running when the phone was turned off (quick red button tap).

 

January 05, 2006

Combat Hand Signals