Friday, June 29, 2007

Last night our customer G's marketing won the prestigious Information Age, Effective IT Award 2007 for 'Most Effective Use Of Software'.   This is a Windows Mobile solution linked to JD Edwards using SQL Compact and the .Net Compact Framework.   I  was the software architect and developer along with my good friend Neil Robertson as part of our role at Anglia Business Solutions.

http://www.effectiveit.com/awards

 

This award was awarded to us for a Mobile label checking application saving our customer (G's Marketing) an estimated £10,000,000 in a single year.   Microsoft case study at -

http://www.binaryrefinery.com/main/PermaLink,guid,0c94a6de-04e3-45a6-b5ff-abf3c65f7f53.aspx

Needless to say we're all a bit chuffed this morning..

Friday, June 29, 2007 8:46:09 AM UTC  #    Comments [0]  | 
Monday, June 25, 2007

It seems that my Windows Live Barcode/QR Code generator is being used all over the place now.

Here's a Spanish Blog post from another happy punter..

http://wmugperu.org/blogs/cfong/archive/2007/06/24/QR-Test.aspx

 

 

Technorati tags:
Monday, June 25, 2007 12:52:01 PM UTC  #    Comments [0]  | 
Saturday, June 23, 2007

I wanted to show what the two queries that I put up show you about a SQL Merge Publication.     We've incorporated them into a couple of web-pages that provide a single repository for all of the cab files that constitute a mobile LOB application,  see below.

image

This web page lets us manage the version of the software currently running on the device,   if the version number changes a new version of the application is pulled down the next time it synchronises with the SQL publication.   In addition it lets me upload securely any updates that I need to deploy.

 

Clicking a given publication, takes you into the detail.

image

Note that it shows record-counts applying the filter specified.   In addition we can substitute the Host_Name() function in any of the filter criteria with the contents of the publication filter criteria textbox. .    This is a massive time saver as we can see exactly what would be sent down to the mobile device ahead of any coding.

 

+ it's just based on two simple bits of SQL that I posted previously.

 

Technorati tags: ,
Saturday, June 23, 2007 7:27:41 AM UTC  #    Comments [0]  | 
Friday, June 22, 2007

Follow yesterday's post to get a list of SQL publications on a given server.   The following for a given SQL Merge publication will list all of the articles within a publication.

This is really useful for a quick sanity check to ensure all those tables that you want to publish out to your mobile device are indeed setup.

 

Here's the SQL 

 

select sysmergearticles.name  from dbo.sysmergearticles,
sysmergepublications
where sysmergearticles.pubid=sysmergepublications.pubid
and sysmergepublications.name='YOUR PUBLICATION NAME'
order by 1

 

Technorati tags: ,
Friday, June 22, 2007 2:14:17 PM UTC  #    Comments [0]  | 
Thursday, June 21, 2007

I wanted to get a list of SQL merge publications on a given SQL database.

This stored procedure does the business, give it a whirl

 

exec sp_helpmergepublication

Thursday, June 21, 2007 9:50:43 PM UTC  #    Comments [0]  | 
Monday, June 18, 2007

Has just delivered my copy of the Mobile Developers Handbook from Amazon (check out my previous posts).

This is one seriously complete tome (wow, that's a first time for using that word, tome (whoops I said it again) ) to all that is .Net Compact Framework.

I've had a quick flick and I am humbled by how complete this book is, and what a small segment I know of .Net CF as I just see the LOB application stuff.   Andy, Daniel and Peter cover it all, including Orcas (aka Visual Studio 2008) and Compact Framework 3.5.

Brilliant.....

Monday, June 18, 2007 9:05:56 PM UTC  #    Comments [0]  | 

Neil Cowburn, posted about a new .Net CF group on Facebook.

http://blog.opennetcf.org/ncowburn/2007/06/18/NETCompactFrameworkGroupOnFacebook.aspx

Lets all have a nice old chat over there...

Monday, June 18, 2007 7:25:04 PM UTC  #    Comments [0]  | 

I've been working on a project where there was little point in synchronising data if the Mobile device was out of network range (for obvious reasons)

So rather than wait for an HTTP timeout type error thrown by the SQL Compact Merge replication, I needed a quick way to determine if the mobile device is connected to any sort of network.

This bit of code has been kicking about for a while and it simply returns if the mobile device has any IP address other than that of localhost -

 

 

 

public static bool OnNetwork()
        {
            IPHostEntry mydev = Dns.GetHostEntry(Dns.GetHostName());

            for (int nindex = 0; nindex < mydev.AddressList.Length; nindex++)
            {
                string aux = mydev.AddressList[nindex].ToString();
                if (aux != "127.0.0.1") return true;
            }
            return false;

        }
 
So putting the above bit of code in a background thread and calling it periodically is a nice simple way to detect if a device is in network range.  I then raise an event if the state changes.
Now I know what your thinking?   Windows Mobile 5/6 ships with the 'State and Notification Broker API'.   Given this I thought I ought to update my approach for newer devices.     Reading -
http://www.developer.com/ws/pc/article.php/3547381
I thought it would make sense to implement it this way as it is much less hassle than a background thread. So the code behind a simple form to achieve this, looks like this.
 
namespace DeviceApplication10
{
    public partial class Form1 : Form
    {
        SystemState foundnet = new SystemState(
                           SystemProperty.ConnectionsNetworkCount);

        private  bool onnetwork()
        {
            IPHostEntry mydev = Dns.GetHostEntry(Dns.GetHostName());

            for (int nindex = 0; nindex < mydev.AddressList.Length; nindex++)
            {
                string aux = mydev.AddressList[nindex].ToString();
                if (aux != "127.0.0.1") return true;
            }
            return false;

        }
        public Form1()
        {
            InitializeComponent();
            foundnet.Changed += new ChangeEventHandler(foundnet_Changed);
        }

        void foundnet_Changed(object sender, ChangeEventArgs args)
        {
            if (onnetwork())
            {
                // do some stuff as we are now on the network, like work out SSID of current wireless network etc.
            }
           
        }
    }
}

The above event fires when the number of network connections change.   I then do a quick call to my onnetwork() method when the event fires, just to be certain than we can talk to the outside world.

So, why is this post called Drive By?    Well the above allows my Windows Mobile device to automatically  detect when I park my car at home as it knows when I'm on my home wireless network.      Geeky but cool...

 

Technorati tags:
Monday, June 18, 2007 10:59:43 AM UTC  #    Comments [0]  | 
Friday, June 15, 2007

image

A mobile Salesrep and Warehouse system that I put in place has made the UK Financial Times this week.  Case study at -

http://www.ft.com/cms/s/a29445de-183b-11dc-b736-000b5df10621.html

Friday, June 15, 2007 4:03:44 PM UTC  #    Comments [0]  | 
Thursday, June 14, 2007

This nifty little tool, takes a UK Orange branded SPV e650 and turns it back to look like nature intended it (aka like a HTC S710)l  For details and download see -

http://www.modaco.com/index.php?showtopic=255845

Thursday, June 14, 2007 5:52:06 AM UTC  #    Comments [0]  | 
Wednesday, June 13, 2007

I think I should get commission for the number of Soti's Pocket Controller's I've indirectly sold.    I'm pleased to see the product has reached a Windows Vista  Friendly v6.

If you haven't seen this great bit of low cost software go have a look  at

http://www.soti.net/default.asp?Cmd=Products&SubCmd=PCPro

Its only $34.95,   what a bargain!  

Technorati tags: ,
 | 
Wednesday, June 13, 2007 8:01:34 PM UTC  #    Comments [0]  | 

One of the most time consuming tasks, I find with building LOB apps,  is setting up columns on Datagrid.   You know the game run your application see that column one is truncating the text in a database column.   Widen the column and run again,  repeat until very bored.

A while back I took the step to programmatically adding a grid style to each class we build (using Anglia's meta build tool Datamaker).   This saves so much time as most of the display widths are always pretty close to perfect.    One of my colleagues and friends Michael Holland has further refined this process to counter for different DPI screens (cool).   Here's an example of what we produce automatically.

 

      public static DataGridTableStyle GridStyle
        {
            get
            {
                DataGridTableStyle gridstyle = new DataGridTableStyle();
                gridstyle.MappingName = "Output[]";
                DataGridColumnStyle tempcol = null;

                // Maps To Database Field - [100]
                tempcol = new DataGridTextBoxColumn();
                tempcol.MappingName = "Onezerozero_Label";
                tempcol.HeaderText = "100";
                tempcol.Width = 60;
                tempcol.NullText = "N/A";
                gridstyle.GridColumnStyles.Add(tempcol);

                // Maps To Database Field - [1000]
                tempcol = new DataGridTextBoxColumn();
                tempcol.MappingName = "Onezerozerozero_Label";
                tempcol.HeaderText = "1000";
                tempcol.Width = 60;
                tempcol.NullText = "N/A";
                gridstyle.GridColumnStyles.Add(tempcol);

            return (SqlParameter[])returnparams.ToArray(typeof(SqlParameter));
        }
}

This saves, Soooo much time particularly when having to deploy to the device emulator.     If we need to omit certain columns or swap the order around, its just a cut and paste job.

Technorati tags: ,
Wednesday, June 13, 2007 7:53:53 PM UTC  #    Comments [0]  | 

Andy Wigley; Daniel Moth and  Peter Foot's book is on Amazon UK.

This is a serious bible that's targeted at developers at all levels.

http://www.amazon.co.uk/s/ref=nb_ss_w_h_/203-9372971-3321537?url=search-alias%3Daps&field-keywords=Mobile+Development+Handbook+

 

I've just ordered my copy.   I wondered if Andy, Daniel and Peter will sign it for me?

Wednesday, June 13, 2007 7:23:21 PM UTC  #    Comments [1]  | 
Tuesday, June 12, 2007

Is it me?   Or is the Apple Iphone launch reminiscent of the launch of the original Newton?

Where are real devices?

I guess its called mystique...

Tuesday, June 12, 2007 8:50:06 PM UTC  #    Comments [0]  | 
Saturday, June 09, 2007

So I've been looking for a way to programmatically, create lots of Windows Live Barcode/QR tags.

Windows Live Barcode 

(go on see if you can read the above tag!  (you'll need to print it, I've found) )

 

For those unfamiliar QR tags were briefly branded by Microsoft as Windows Live Barcode but has strangely disappeared.

What is Windows Live Barcode
Windows Live Barcode is a set of services that transfer information between various media (PCs, billboards, magazines etc.) and handsets via Quick Response Code (QR Code), a two-dimensional barcode. It provides a new method for people to exchange information and enjoy various online services on handsets. Windows Live Barcode aims to enhance handset utility and provide you with more convenience and flexibility.

What is QR Code
The QR Code is a two-dimensional barcode. It contains a considerably greater volume of information in both vertical and horizontal directions than typical barcode in one dimension.

I found a reader for most popular Windows Mobile devices over at

http://www.quickmark.com.tw/download.html

I'm well aware of other near field communication technologies existing like ShotCode,  but I thought I'd have a crack at doing my own QR code generator.

 

For those interested try it out.   From Visual Studio add a web reference to -

http://www.binaryrefinery.com/qrweb/webservice.asmx

The service lets you pass in a string, and returns a byte array containing the image.

The parameters are as follows -

public byte[] GetString(ref string status,string user,string password,string strtext)

 

User and password need to be both set to br0wncow! for now.

 

 

This service is experimental and shouldn't be used for a production grade app.   However  love to hear any feedback you have.   + you can also prove that my maths is OK/adequate for generating the codes.

 

In addition,  you can encode vcards,  vcals, web bookmarks etc.   which seems to work pretty nicely automatically popping up the appropriate app.  on successful scan.  (wicked).

 

Saturday, June 09, 2007 6:55:28 AM UTC  #    Comments [2]  | 
Friday, June 08, 2007
Thursday, June 07, 2007

So in the line of business application space,  I often need to acquire external inputs from real world devices,  such as weigh scales,   pressure and moisture sensors.

 

I've often use WebService calls directly from the mobile device to call services on P.C's hooked up to measuring equipment usually via a serial port.

However increasingly I use insert triggers on SQL tables to fire off requests to physical devices (using managed code) stored procedures.   So, the action of syncing SQL Compact causes results from devices to be captured.    This technique works really well and ensures that SQL Compact syncrhonisation is the only data exchange from the mobile device.   This keeps things simple (always good).     The only downside is that when standing next to a weigh scale etc. with a mobile device you have to be in range of the wireless network.   

So upshot of all of this,  is that our end user can wander around taking weight's and measurements almost 'magically' with no physical connection from the mobile device they are using...

 

Technorati tags:
Thursday, June 07, 2007 7:46:25 PM UTC  #    Comments [2]  | 
Tuesday, June 05, 2007

So I'm probably talking rubbish (its been known).   Windows CE is a highly optimised  small scale robust operating system.  It does a superb job at building low and building fast. 

  

However does the core design goals of Windows CE fit with the very different world that we in the .Net CF space occupy?   Its all gravy,    but looking from the outside in, do the guys that do the kind of BSP Platform builder kind of stuff (in C++) seem very much removed from what I do in the day job of building quick and fast  .Net CF LOB apps.

Project Singularity  (go live search it),   is this the way forward,  what will all the clever C++ guys do?

 

Come on heckle  lets start a riot...

Technorati tags: ,
Tuesday, June 05, 2007 10:56:35 PM UTC  #    Comments [0]  | 

So Now I have my SPV e650, printing photo's direct to a Bluetooth connected printer.

I went for a totally crude solution, which just looks for black/white pixels in an image.   So with buffer being a stringbuilder we're going to send out to the printer go have a peek at...

 

  public void LoadImage(Bitmap _bmp, int x, int y)
        {

            buffer.Append("EG ");
            
            buffer.Append("4 ");
            buffer.Append(_bmp.Height + " ");
        
            buffer.Append(x + " ");
            buffer.Append(y + " ");
            for (int xcount = 0; xcount < _bmp.Width; xcount++)
            {
                for (int ycount = 0; ycount < _bmp.Height; ycount++)
                {
                   int gotcol= _bmp.GetPixel(xcount, ycount).ToArgb();
                    if (gotcol == -1)
                        buffer.Append("F");
                    else
                        buffer.Append("0");
                  
                }
               
            }
            buffer.Append(eol);
          

        }
Technorati tags: ,
Tuesday, June 05, 2007 10:31:46 PM UTC  #    Comments [0]  | 
Sunday, June 03, 2007

So I've been on a mission this weekend, getting a Zebra belt mounted Bluetooth printer to print photo's from a mobile application.

So I built a simple test program that outputs CPCL printing commands to a Zebra MZ220 Bluetooth printer.  

My helper library wraps the CPCL command set as follows -

CPCLPrinter prn = new CPCLPrinter("COM18");
            prn.StartLabel();
            prn.PageWidth(300);
            prn.Center();
            prn.Text(0,7,0,140,114,"Hello World");
            prn.EndLabel();
          
            prn.Print();
  prn.Dispose();

So far so good.   I'm simply using the System.IO.Ports namespace to talk to the Bluetooth mapped serial port.

So next question is how to print Bitmaps.     These printers are all about reliable repeated printouts.   So catering for on the fly generated images so dynamically generating images is something a little different.

The first challenge is that these printers are black and white,  so we need a way of reducing the colour depth of our inbound Bitmap.

Next will be to convert to PCX format.

Then we'll need to send this over to the printer.

Finally we need to wrap it into a simple app. that takes a photo and starts the whole process.

Will keep you posted on progress.

Technorati tags: ,
Sunday, June 03, 2007 2:31:33 PM UTC  #    Comments [1]  | 

Theme design by Jelle Druyts

Pick a theme: