Friday, November 30, 2007

For a while now, I've been putting a startup check on our mobile applications to make sure the system clock is set correctly.    This step is vital to ensure that as the mobile solution runs any time stamps written out by the device are indeed correct.

With the majority of my application,  I do automatically set the time of the device by calling a web-service method to return the date and time.   See

http://www.binaryrefinery.com/main/PermaLink,guid,3734207e-a530-4197-bbde-d563a4e90e6e.aspx

 

However, its good practice to ensure that the device clock is set vaguely accurately before we go much further on startup.   To this extent I've added this bit of code to the startup of my applications -

 

while (DateTime.Now.Year < 2007)
            {
                MessageBox.Show("Clock needs to be set correctly on device, before this application will run.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                 Application.DoEvents();
                ProcessStartInfo pstart = new ProcessStartInfo();
                pstart.FileName = @"\windows\clock.exe";
                pstart.UseShellExecute = true;

                Process procstart = new Process();
                procstart.StartInfo = pstart;
                procstart.Start();

                while (!procstart.HasExited)
                {
                    System.Threading.Thread.Sleep(1000);
                    Application.DoEvents();
                }
            }

 

This bit of code will automatically shoot the user over to the set clock control panel  and wait for them to correct the clock. 

Friday, November 30, 2007 9:59:58 AM UTC  #    Comments [2]  | 
Thursday, November 22, 2007

OK, after the recent diversion of seeing just how difficult it is to code a webpage that works on the iPhone/Ipod.  Concluding that it is a bit of a flaff.    I'm back to the familiar world of compact framework.

 

As promised before,   I said that I would go through the source of a user control that presented a scrolling ticker.    The objective of the project was to build a re-usable smooooth control that allowed for text wider than the width of the control to scroll.

image

 

So to use the control,   you can drag and drop it onto your form.  To control it, use either -

 

this.tickerControl1.Text = "News Flash, this just in, we have received unofficial reports of a ticker working on Windows mobile";

or if you have an array of elements this works too -

       string[] elems = new string[6];

        elems[0]="Hello World";
        elems[1] = "Another Test";

        elems[2] = "Looking Good";

        elems[3] = "Scrolling Well";

        elems[4] = "At Last";

        elems[5] = "More Stuff";

        this.tickerControl1.Elements = elems;
        this.tickerControl1.Speed = 100;

 

Lets let you have a play first,  here is the project source.      Please download here -

 http://www.binaryrefinery.com/main/content/binary/mobileticker.zip

Next time,  I'll walk through how the code works.

We'll talk soon...

 

Technorati Tags:
Thursday, November 22, 2007 9:33:30 PM UTC  #    Comments [0]  | 
Tuesday, November 20, 2007

Yes,   I've done it.   I've created an iPhone/iPod version of this blog.

Really, I did this just for interest to understand how different you have to code pages to be Safari compliant (that's the web browser on all things Apple).

The reality of coding a web-page to take full advantage of the iPhone platform is a bit tricky.    Especially hampered by lack of Javascript debugger in the Windows version of Safari.   I got inspired by looking at -

http://iphone.facebook.com

(best viewed under Safari)

Anyway,  here's what you need to get going.

Firstly you need a copy of Safari which at least gives you a sporting chance of seeing what your eventual web pages will look like on an iPhone/iPod -

http://www.apple.com/safari/

Next I used the iPhone developers guide to work out how to code up the web-pages -

http://developer.apple.com/iphone/devcenter/

The next step was to go and get some ideas,  for how my site should look

http://iphoneapplicationlist.com/

Almost there...    So,   next step was to build my site.   Basically I took the mobile version of my blog that's at -

http://www.binaryrefinery.com/mobile

I came up with -

http://www.binaryrefinery.com/i

Now if your using Internet explorer to view the above you'll be disappointed.   However on Safari,  it looks great and kind of (if I dare say so myself) polished.

Please view source on my pages to nick all that I've done.

And finally...   I modified my auto redirect page to detect iPhones/iPods hitting my site.

www.binaryrefinery.com/main/PermaLink,guid,fec7f2ca-503d-45b2-9684-9cd0787ec3c7.aspx

 

I would show you a screenshot,  but while spoil the surprise :-)

 

Technorati Tags: ,
Tuesday, November 20, 2007 9:16:19 PM UTC  #    Comments [0]  | 
Saturday, November 17, 2007

I've been on a mission with Virtual Earth this week   needing to quickly plot customers locations on a map.

I needed to find the longitude and latitude of a given location.   so what better way than to use the pan and scroll capability of the VE map to let the user find the location then quickly click to retrieve the location under the cursor.

image

This is what I came up with (just click to find the co-ordinates of where you are) -

http://www.binaryrefinery.com/main/content/binary/map_loc.htm

Saturday, November 17, 2007 9:28:39 PM UTC  #    Comments [0]  | 
Thursday, November 08, 2007

So I'm back on the blog.   Its been our financial year end at work,  so I've been offline for a bit concentrating on the day job.

Anyhow...   Back in the world of mobile line of business, things have been pretty hectic.   I'm really pleased with myself (smug grin) for printing sticky barcode labels and putting them on the side of all of the label printers I use.   The barcode contains the name of the shared printer.    The mobile operative simply scans the printer they wish to print to.    When calling from the mobile device web-services,  I pass the printer the user has selected.      The web-service does the printing and as if by magic we print out where the user has requested.

Thursday, November 08, 2007 8:50:02 PM UTC  #    Comments [0]  | 

Theme design by Jelle Druyts

Pick a theme: