Follow me on Twitter at Twitter.com/wbm
FYI, I'm blogging most of my stuff over at More Wally now.
You might want to add my rss feed to your reader at:http://morewally.com/cs/blogs/wallym/rss.aspx
January 2011 - Posts - Wallace B. McClure

Wallace B. McClure

All About Wally McClure - The musings of Wallym on Web, HTML5, Mobile, MonoTouch for iPhone, MonoDroid for Android, and Windows Azure.

News

Personal Blog

Work Blog

.NET

Book Authors

Business

Family

Friends

Georgia Tech Bloggers

Personal

Archives

January 2011 - Posts

Writing to the UI with MonoDroid using RunOnUIThread

I've been pulling my hair out over the past day or so trying to update the UI in my test app.  I was having problem after problem.  I finally got down to my base problem.  I could not write out to my TextView.  WTF could be causing that?  I can write to my UI in other parts of my app.  This is pure craziness.  I thought long and hard and nothing was coming to me.  Wait, the light bulb went on.  I am in the wrong thread.  Great, how do I write in the correct thread?  MonoDroid supports the entire AsyncTask set of objects, but this seemed like overkill.  I was reading and came across RunOnUIThread().......Bing..........The lightbulb has been invented...BlueStar Airlines (oh wait, wrong context). Anyway, here is what I needed:

this.RunOnUiThread(() => TextViewControl.Text = "Hello World");

Enjoy!!!!!!!  Remember kiddies, running on the main ui for off device operations is bad, not as bad as crossing the streams bad, but bad as in trying to drive on a flat tire bad. It won't kill you, but it does keep you from getting anywhere.
Posted: Jan 17 2011, 06:00 AM by Wallym | with 1 comment(s)
Filed under: , ,
Calling a REST Based JSON Endpoint with HTTP POST and WCF

Note: I always forget this stuff, so I'm putting it my blog to help me remember it.

Calling a JSON REST based service with some params isn't that hard.  I have an endpoint that has this interface:

        [WebInvoke(UriTemplate = "/Login",
            Method="POST",
            BodyStyle = WebMessageBodyStyle.Wrapped,
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json )]
        [OperationContract]
        bool Login(LoginData ld);

The LoginData class is defined like this:

    [DataContract]
    public class LoginData
    {
        [DataMember]
        public string UserName { get; set; }
        [DataMember]
        public string PassWord { get; set; }
        [DataMember]
        public string AppKey { get; set; }
    }
 

Now that you see my method to call to login as well as the class that is passed for the login, the body of the login request looks like this:

{ "ld" : {  "UserName":"testuser", "PassWord":"ackkkk", "AppKey":"blah" } }

The header (in Fiddler), looks like this:

User-Agent: Fiddler
Host: hostname
Content-Length: 76
Content-Type: application/json

And finally, my url to POST against is:

http://www.something.com/...../someservice.svc/Login

And there you have it, calling a WCF JSON Endpoint thru REST (and HTTP POST)
Posted: Jan 16 2011, 06:00 AM by Wallym | with no comments
Filed under: , ,
How did I get here? My route to Android, iPhone, Windows Phone 7, and interest in Mobile Devices

I get asked all the time how/why I got interested in mobile and jumped on this fairly early.  I tend to give half answers because it wasn't just one thing that took me to mobile, but a whole host of separate ivents culminating in a specific event where I wasdoing market research in May/June 2008.  Let me throw out the events and the facts about me:

  • I tend to like new, different, cool stuff.  I jumped on .NET early on.  I jumped on Ajax early on.  I don't jump on every new technology that comes down the road, I'm probably the only person on the planet that doesn't "get" MVC, though I acknowledge that a lot of people do and it solves a number of problems in the default settings of ASP.NET WebForms.
  • I remember buying an early Windows CE device. It was interesting, but dang, this stylus thing sucks. After I lost my third stylus, i just gave up. 
  • I got my first mobile phone in early 1999.  Reception was crappy, but I could see the value in being mobile.
  • In 1999, I worked on a manufacturing systems project.  One piece of the projects was a set of handheld devices on the shop floor.  While the UI was a crappy DOS based, yes I said DOS as in Disk Operating System Version 6.22, I could see that the wireless world was a direction I wanted to be in.
  • In 2000, Microsoft released the first public alpha of .NET.  Very cool stuff indeed.  One piece of the puzzle was a set of mobile controls for ASP.NET.  I build numerous test apps as well as mobile version using these mobile controls.  Now, the mobile UIs of the time were based on WML, which was crap.
  • I could real all the analysis of mobile and read all about growth rates.  Now, you have to realize that growth rates can be impressive when dealing with small numbers, but I knew it was a comer.
  • In our first book, I got talked out of mobile because of the line from the publisher "Wally, mobile doesn't sell."
  • Blackberry was the dominant device of the mid 2000s.  Its users were referred to as "Crackberry addicts."  Unfortunately, the mobile development experience for native apps was crap and the web experience was fairly rough as well, but if they could get the ecosystem started, other phones and better blackberryies would come out.  I finally jumped into using a blackberry.
  • Sometime around 2006, I heard "Wally, mobile doesn't sell" again.  Now, anyone that knows me knows that someone saying something like this to me means I'll keep trying it.
  • The phones of the mid 2000s were moving to be more graphical, but there were too many that had this idea that they had to use a stylus.  Stylus suck.  They get lost too easily.
  • I worked on a project in 2007 and 2008 for a startup trying to answer the question of "What is there to do where I am at?"  For some reason, they wanted to be tied to PCs.  As it became obvious that they were having problems, their investor asked us to do some market research and to figure out what the marketplace did want.  One of the important things that I figured out was the we lived in a mobile world and if you had a mobile app, it need to be on a mobile device, not tied to a desktop/laptop/netbook device. 
  • If there was any single event, this was it - I was doing some market research and sat and talked to people in a bar/restaurant in Atlanta called "The Grove" on Lavista.  The consensus of the people that I talked to was that they wanted their data where ever they were at, laptop, pc, mobile, whereever.
  • In 2007, Apple released the iPhone.  Wow, what an impressive device, even with all the problems of a 1st generation device.  I bought an iPod Touch 1st generation to understand touch better, one of the best decisions I ever made.
  • I decided in late 2008, to make a move into cloud, for a number of reasons.  I was working on an example app.  In April, 2009, one of my friends at Microsoft said "don't mention my name with this, but you need an iPhone front end for this app."  How do you get on the iPhone.  Well, there are a number of ways including:
    • ObjectiveC.  Its hard to teach an old dog new tricks, and this dog knows .NET, not ObjectiveC.
    • HTML, web, javascript optimized interface.  yeah, this is possible.
    • PhoneGap.  Now, this is interesting, take an html interface and get it to run on the iPhone, Android, Blackberry, and other platforms.  I thought that this way made the most sense for me until.........
    • MonoTouch.  In May/June 2009, Novell announced a way for .NET/c# developers to write apps for the iPhone.  This is the way that made the most sense to me.
    • Titanium by Appcelerator.  This is similar in concept to PhoneGap.  I haven't played with this much but do want to learn more about it.
  • In July, 2009, I emailed one of my contacts at Wrox to see if they would be interested in a short MonoTouch ebook in their Wrox Blox format.  I fully expected another  response along the lines of "Wally, mobile doesn't sell."  The response I got was "Wally, iPhone is H O T, get started immediately, can you have this to me before Labor Day."  Not quite the response I expected.  Thankfully, we didn't make the Labor Day, first draft date. I kept pushing back because I had a feeling that things were not going to be quite as polished and feature rich as necessary.  After all, Novell doesn't have the resouces of Microsoft's developer division.
  • The ebook shipped on November 30, 2009.
  • On about December, 15, 2009, my editor emailed and said "Your ebook is selling really well, lets do a full book and it by March 1 so get started."  Thankfully, guys like Craig Dunn and Chris Hardy were interested along with Martin and Ror joinged us later on.
  • I bought my wife an iPhone 3Gs in early 2010 to go along with all my iPod Touch devices.
  • I tried to pretend in 2010 that I wasn't that interested in mobile and still had interest in the desktop technologies.  I love the technologies and continue to use them today, but that isn't where my interest is right now.  I'm just about all mobile all the time with my energies. 
  • Our book shipped in the beginning of July, 2010 right in the middle of the Apple FUD.
  • I've been looking at Mobile Web as a way around the AppStores and Apple FUD problems of 2010.
  • With all the Apple self FUD, we became interested in Android.
  • I went up to Dino Esposito at DevConnections in Las Vegas at introduced myself. I've always tried to keep up with what Dino has been doing. I was shocked, he wanted to meet me.  We must have talked for 1.5 hours. It was way more time than I deserved. If you get a chance, go and introduce yourself to Dino. He's a great guy.
  • Microsoft released Windows Phone 7 in the Fall of 2010.  I'm not doing development on that platform at this time.  I think they have a very interesting user interface.  The devices are being positively reviewed.  For my purposes, the devices are limited at this point in time.  We'll see what 2011 brings as far as updates to the operating system.  I need multitasking/background processing and html5 in the browser. Add that as well as acceptance in the marketplace and I'll be more interested in the device.
  • Obviosuly, I'm now working on a MonoDroid book .
  • I own Android and iPhone/iOS devices.  I am currently working on some startup ideas and am exploring as much in that area as I can.
  • For 2011, I'm planning on speaking at Android Developer's Conference (AnDevCon) and Mobile Connections.  I'm really excited about this.
  • I have a couple of magazine articles coming out in 2011 on Android and iPhone development with the Mono technologies.
  • is Mono "The Answer"? What's "The Question?" I think it will work for me.  It might work for you, it might not.  it depends on your situation.  Its the current horse that I am riding. I might find a better horse tomorrow.
So, that's how I got here.  I'm in love with mobile.  Mobile native apps on the device as well as mobile web.  I'm into all this cool stuff.  Where are you at?
Getting the Dalvik Debug Monitor Service to run on Windows with Android 2.3 SDK

As I found out, DDMS doesn't run by default when you install the Android 2.3 SDK in Windows.  If you start it up, you get an error message "Failed to get the adb version: Cannot run program "adb": CreateProcess error=2, The system cannot find the file specified."  Thankfully, with the magic of internet search engines, I figured out that I had to add the directory that contains adb to my path statement in Windows7.  After that, it just all worked.ddms

Posted: Jan 14 2011, 06:00 AM by Wallym | with 1 comment(s)
Filed under: ,
Bytes by MSDN - Let's talk Cloud

While I was at DevConnections in Las Vegas, I was honored to be interviewed by Tim Huckaby for "Bytes by MSDN" on Cloud Computing.

Here's a short intro from the talk:

Do you believe in the Cloud? Wallace McClure, Founder and Architect of Scalable Development, Inc., does. His customers are extremely interested in the value and economies of scale that Cloud Computing, and more specifically, Windows Azure can bring. Building out an infrastructure that supports your web service or application can be expensive, complicated and time consuming. Or you could look to the Microsoft cloud. The Windows Azure platform is a flexible cloud–computing platform that lets you focus on solving business problems and addressing customer needs. Wally talks about all this, and more, in this interview with Tim Huckaby, and in his Windows Azure podcasts.
Mobile Connections in Las Vegas April 17-21

I'll be speaking at Mobile Connections in Las Vegas.  The event is April 17-21.  The event is a cross platform mobile event.  There will be sessions on iOS, Android, WP7, Blackberry, and cross platform tools.  The sessions I am speaking on are:

Introduction to Android via MonoDroid:
This session will introduce writing native applications geared for the Android Platform based on .NET/C#/Mono. We’ll examine the overall architecture of MonoDroid, discuss how it integrates with Visual Studio, debug with MonoDroid, and look at a couple of example apps written with MonoDroid. This session is targeted to the .NET developer who wants to move to the Android mobile platform. While the session will be introductory for the Android platform, it will be intermediate/expert for those on the .NET platform.

Web Development with HTML5 to target Android, iOS, iPad
This session will examine the features of the mobile browser, and how developers can leverage it to build applications that target mobile devices. This session is for developers looking to target Android, iPhone, WebKit based devices, and other devices through the mobile web with the same application code, development managers looking to Android, iPhone, WebKit based devices, and other devices through the mobile web with the same application code, and developers and development managers looking to build mobile web apps for devices that look like native apps. Attendees will be able to immediately begin building web applications that target the Android and iPhone platforms. The benefits of this approach are:

  • Easy cross platform development
  • No requirement to learn Objective-C/Xcode or Java/Eclipse
  • Applications are immediately upgradeable. There is no requirement to go through the Marketplace or Appstore of either platform.
  • Web developers are easier to find than Objective-C, Blackberry, WebOS, or Java programmer
You can register for the event and get $100 off via this link.
Professional Android Programming with MonoDroid and .NET/C#

Professional Android Programming with MonoDroid and .NET/C# is now listed on Amazon.com and Wiley/Wrox.  Here's a little bit about our book.

Professional Android Programming with MonoDroid and .NET/C# provides experienced .NET and C# developers with the knowledge the need to become successful Android application developers without having to learn another language. Professional Android Programming with MonoDroid and .NET/C# covers:

  • MonoDroid and MonoDevelop
  • Screen controls, UI development
  • Data controls, windows, and controllers
  • Working with data, REST, SOAP, XML, and JSON
  • Tables and layouts
  • Maps, Geolocation, Geocoding, and MonoDroid
  • Device feature support for networking, battery, accelerometer, orientation, and proximity
  • Multimedia, pictures, video, and audio recording and playback
  • Communicating with other applications
  • Internationalization and Localization
  • Deploying apps, and making money
Speaking on MonoDroid - Android Developer Conference (AnDevCon) - March, 2011 in San Francisco

AnDevConI'm honored to announce that I'll be speaking at AnDevCon in March, 2011 in San Francisco.  I've been spending a significant amount of time on iPhone and Android.  I'm trying to get a startup off the ground.  Mobile devices will be an integral part of this startup.  As such, iPhone and Android will be our target devices at this point in time.  I'll be doing an all day pre-class as well as parts of the pre-class as sessions through out the conference.  I'm looking forward to this.  If you are interested in Android Development, please come to this conference.  If you are coming to this conference, please look me up while there.

Posted: Jan 04 2011, 08:00 AM by Wallym | with no comments
Filed under: ,
ASP.NET Podcast Shows #146 & 147 - WebMatrix, Razor, and ASP.NET Web Pages Oh My

Since I forgot to post these shows here, I'll post the links to the shows.  Enjoy:

http://aspnetpodcast.com/CS11/blogs/asp.net_podcast/archive/2010/11/09/asp-net-podcast-show-146-webmatrix-part-1.aspx

http://aspnetpodcast.com/CS11/blogs/asp.net_podcast/archive/2010/11/10/asp-net-show-147-webmatrix-razor-part-ii.aspx

More Posts « Previous page