December 2009 - Posts - More Wally - Wallace B. McClure
in

MoreWally.com

Giving people what they want, More Wally. This is the technical and personal blog site of
Wallace B. (Wally) McClure.

This Blog

Syndication

News

Please goy buy 3-4 copies of my book on MonoTouch titled "Professional Android Programming with Mono for Android for .NET/C# Developers." They make great gifts all year round. Plus, I get about $.25 when you buy a copy.

Technical Sites

More Wally - Wallace B. McClure

This blog will have all kinds of posts about Wally McClure. In it, there will be tons of .NET and computer programming posts as well as Wally's views on life in general. As you might guess, this site and blog help you get More Wally in your life. What more could anyone want? iPhone, Android, MonoTouch, MonoDroid, Mobile, HTML5, .NET, ADO.NET, ASP.NET, AJAX, jQuery, jQuery Mobile, ASP.NET AJAX, and Windows Azure............follow me on twitter at Wally

December 2009 - Posts

  • Be careful what you name a Project or Solution in MonoDevelop

    I downloaded and installed MonoDevelop 2.2 on my Windows 7 laptop as well as installing Mono 2.6.  Everything installed correctly.  I decided to create my first ASP.NET web application and see if this will actually work.  I created an ASP.NET Web Project.  I got the following errors;

    c:\Projects\MonoDevelop\First MD ASP.NET Web App\First MD ASP.NET Web App\Default.aspx(3,3): Error CS1646: Keyword, identifier, or string expected after verbatim specifier: @ (CS1646) (FirstMDASPNETWebApp)

    c:\Projects\MonoDevelop\First MD ASP.NET Web App\First MD ASP.NET Web App\Default.aspx(1,1): Error CS0116: A namespace does not directly contain members such as fields or methods (CS0116) (FirstMDASPNETWebApp)

    What is the cause of this error?  I've been trying to figure this out.  Then it hit me.  I created a new project with no spaces and not dots.  This new project worked.  Awesome.

  • UIPicker in the iPhone with MonoTouch

     UIPicker

    The UIPicker is visually different than the drop down listbox that most .NET developers are familiar, however, it is designed to perform the same type of function.  It allows users to select from a fixed set of data isntead of typing in data in a text box.  Programming with it is fairly simple.  Inherit from the UIPickerViewModel class and then bind the data.

    Here's the class:

    using System;using MonoTouch;using MonoTouch.UIKit;using MonoTouch.Foundation; namespace OpenUrl{  public class ProtocolData : UIPickerViewModel{ public static string[] protocols = new string[]{"http://", "tel:","http://maps.google.com/maps?q=", "sms:","mailto:"};public string[] protocolNames = new string[]{"Web", "Phone Call", "Google Maps", "SMS", "Email"     };AppDelegate ad;public ProtocolData(AppDelegate pad){ad = pad;}public override int GetComponentCount(UIPickerView uipv){return(1);}public override int GetRowsInComponent( UIPickerView uipv, int comp){//each component has its own count.int rows = protocols.Length;return(rows);}public override string GetTitle(UIPickerView uipv, int row, int comp){//each component would get its own title.string output = protocolNames[row];return(output);}public override void Selected(UIPickerView uipv, int row, int comp){ad.SelectedRow = row;}public override float GetComponentWidth(UIPickerView uipv, int comp){return(300f); }public override float GetRowHeight(UIPickerView uipv, int comp){return(40f);  }}}

    And then you bind data doing something like this:

    ProtocolData protocolDataSource = new ProtocolData(this);ProtocolSelection.Model = protocolDataSource;And there you go, you now have a UIPicker with a list of data.

    Want to know more about developing with the iPhone?  Check out my Wrox Blox eBook on developing applications with MonoTouch for the iPhone/iPod touch for .NET/C# developers
  • The Mono / MonoTouch Soft Debugger

    Honestly, I thought that it was really cool when the Novell guys put a soft debugger into Mono/MonoTouch so that it is possible to debug an application running on the iPhone Simulator or on the actual device.  Basically, its a set of code inside of MonoTouch that will talk back to the debugging device.  According to the document, it works in the simulator, an iPhone attached to your macintosh, or over wifi if you are ont eh same network.  Thanks guys!

     monotouch soft debugger

    Want to know more about developing with the iPhone?  Check out my Wrox Blox eBook on developing applications with MonoTouch for the iPhone/iPod touch for .NET/C# developers

  • Putting a Point on a Map in the iPhone

    I wrote the following code to put a point on a map on the iPhone.  It works pretty well.  Basically, I draw a map, then I inherit from the MKAnnotation object and create a new constructor, go out to geocoder and get a lat lon to senter the map on, and finally, I put a point in the center of the map.  I've got to thank Craig Dunn for the inspiration of inheriting from the MKAnnotation object.

    using System;

    using System.Collections.Generic;using System.Linq;using MonoTouch.Foundation;using MonoTouch.UIKit;using MonoTouch.MapKit;using MonoTouch.CoreLocation; namespace Json{public class Application{static void Main (string[] args){UIApplication.Main (args);}} // The name AppDelegate is referenced in the MainWindow.xib file.public partial class AppDelegate : UIApplicationDelegate{// This method is invoked when the application has loaded its // UI and is ready to runpublic override bool FinishedLaunching (UIApplication app, NSDictionary options){// If you have defined a view, add it here:// window.AddSubview (navigationController.View);window.MakeKeyAndVisible (); MapVw.ZoomEnabled = true;MapVw.UserInteractionEnabled = true;MapVw.ScrollEnabled = true;MapVw.ShowsUserLocation = true; btnMap.TouchDown += BtnMapTouchDown; LocationTF.EditingDidEnd += delegate(object sender, EventArgs e) {       UITextField utf = sender as UITextField;       Console.WriteLine("EditingDidEnd is finished.");       utf.ResignFirstResponder();}; LocationTF.Ended += delegate(object sender, EventArgs e) {}; LocationTF.EditingDidEndOnExit += delegate(object sender, EventArgse) {}; return true;} void BtnMapTouchDown (object sender, EventArgs e){GeoCode gCode = new GeoCode();string location = LocationTF.Text;double lat = 0.0, lon = 0.0, radius = 0.0;Location.ResignFirstResponder();gCode.GetLatLon(location, ref lat, ref lon, ref radius);Console.WriteLine("Lat: " + lat.ToString() + " Lon: " + lon.ToString());MapVw.Region = new MKCoordinateRegion(new CLLocationCoordinate2D(lat, lon),                                      new MKCoordinateSpan(.5, .5));MapVw.ZoomEnabled = true;MapVw.UserInteractionEnabled = true;MapVw.ScrollEnabled = true;btnMap.TouchDown += BtnMapTouchDown;gCode = null;} // This method is required in iPhoneOS 3.0public override void OnActivated (UIApplication application){}   }

    }

    The  MKAnnotuation object is inherited like this:

    using System;using MonoTouch.UIKit;using MonoTouch.MapKit;using MonoTouch.CoreLocation;namespace Json{// concept borrowed from Craig Dunn’s blog.   public class ObjAnnotation : MKAnnotation {           private CLLocationCoordinate2D _coordinate;    private string _title, _subtitle;//getters must be overridden to return necessary data.    public override CLLocationCoordinate2D Coordinate {       get { return _coordinate; }    }//title and subtitle are readonly, thus no setter.    public override string Title {       get { return _title; }    }    public override string Subtitle {       get { return _subtitle; }    }    /// <summary>    /// Need this constructor to set the fields, since the public    /// interface of this class is all READ-ONLY    /// <summary>    public ObjAnnotation (CLLocationCoordinate2D Coordinate,                             string Title, string SubTitle) : base()    {       _coordinate=Coordinate;       _title=Title;       _subtitle=SubTitle;    }} }

    The result is this:

    mapping on the iPhone 

    Want to know more about developing with the iPhone?  Check out my Wrox Blox eBook on developing applications with MonoTouch for the iPhone/iPod touch for .NET/C# developers.

  • .NET Talks in 2010

    I've worked up the following talks for 2010.

    If you are interested, get ahold of me.  Contacting me through LinkedIn and Twitter are the best.

    iPhone Development for .NET/C# Developers. The iPhone is the smartphone leader in mindshare and the amount of money spent on applications. This lead in money spent on applications is expected to grow over the next several years. Objective-C is the native language for iPhone development. .NET developers, who work in the largest general area of development frameworks, have looked at iPhone developers with a great deal of envy. But with the release of MonoTouch, .NET/C# developers can apply their knowledge to iPhone development. This talk with show .NET developers how they can write applictions that run natively on the iPhone.  In this talk, the attendee will be able to immediately being writing and exploring code on the .NET
    Intro to Windows Azure. Windows Azure is Microsoft's entry into the cloud computing marketplace.  We'll look at getting an application up and running with azure, data storage in azure, exposing web services over azure, and finally an overview of a running application in Azure.  Attendees will be able to start writing applications for Windows Azure immediately after attending the session.
    Introduction to ASP.NET 4 AJAX Client Templates With the initial release of ASP.NET AJAX, Microsoft released an AJAX solution that allows developers to call from the web browser back to the server and retrieve data. With  ASP.NET 4 Microsoft will provide an improved set of features including an easy and simple way to beind data, use client templates to easy bind data to on the client, provide client side events that can be processed, and an improved set of client side controls.  Attendees will be able to immediately able to use the the features of ASP.NET 4 AJAX in their applications after attending this session. 
    Introduction to the ASP.NET AJAX UpdatePanel This session is a deep dive into the ASP.NET AJAX UpdatePanel.  The UpdatePanel provides for a mechanism to add client side Ajax capabilities through a server side control.  We'll look at: Quick Intro to the UpdatePanel. How to debug with it.  The UpdatePanel provides client side Ajax functionality. We'll look at how to debug with it and see that the UpdatePanel allows for the server side debugging functionality that mostdevelopers are used to. Its client side programmability features.  The UpdatePanel provides a client side interface into its features. We'll look at the events provided and how they allow developers to add to their applications to improve the user experience. Error Handling.  By default, errors are generated as JavaScript alerts, we'll look at the options for handling errors so that user's aren't forced into the annoying JavaScript alert popup. The data format that the UpdatePanel uses.  When does AJAX not use XML or JSON for data transfer? When it the UpdatePanel is used.  We'll look at the Update Panel's data transfer format. History with the UpdatePanel. One of the most frustrating things from a user's standpoint is that hitting back on Ajax application takes them out of the application.  We'll look at what a developer must do so that a user hitting back does not exit from the application, but merely goes back to the previous state of the application.
    Introduction to ASP.NET AJAX With the introduction of ASP.NET AJAX, Microsoft has release support for AJAX applications using their stack of products. We'll look at:
    • What is AJAX.
    • The Script Manager and options on adding web services and client side scripts.
    • Javascript Intellisense increase developer productivity by providing a set of hints regarding the methods that may be called as well as how to add this functionality to scripts that the developer authorizes themself.
    • How to call a Web Service and process the result.
    • How to debug.
    • The UpdatePanel.
    • Integration with ASP.NET Services (Membership, Roles, and Profiles).
    Opening a Windows Azure application with Web Services and then consuming these services in Silverlight - This is a two person talk with Wally McClure and David Silverlight. We'll look at opening up a Windows Azure application through a set of web services for third parties to develop clients that interface with your application.  Items discussed include: Windows Azure in general. Why you want to open your application. The mechanics of opening an applications. Some of the choices that I ran into with regards to the web services. Then we will switch and open up a silverlight application that interfaces with this application.  In it, we'll look at the challenges of using web services for a third party within a silverlight application.

  • My thoughts on MonoTouch as we enter 2010

    What a wild and crazy last 6 months its been for my personal development direction.  I've always been excited about mobile development.  Every couple of years, I ask somebody at Wrox about a book on mobile development.  Every time, the response is along the lines of "You are f***ing kidding."  In June/July, Novell, the NetWare guys, announced MonoTouch.  Its a library that allows developers writing in .NET/C# to target the iPhone.  Wow, .NET developers, who are the largest market of developers could target the iPhone, the smartphone that clearly has the most mindshare.  I sent an exploratory email to someone at Wrox about doing a Wrox Blox on MonoTouch.  The response was almost immediate, "Get me a proposal and get started.  The iPhone is H O T."

    I rebuilt my Macbook and started working with MonoTouch.  I could tell that the product was very early stage.  I'm not sure if the bigger problem was the beta version of MonoTouch or the alpha version of MonoDevelop.  As expected, things started to settle down, bugs were fixed in the product, stability improved, and things got better.  Around the time of the 1.0.0 version of MonoTouch, someone asked me what I thought.  My response was, "I think MonoTouch has really good promise, but it still feels beta like. I hope it feels more complete by year end."  Well, sure enough, it does.

    A good friend of mine and fellow INETA Speaker brought up some really good points about the history of open source software, that open source products were typically a nightmare to configure and get setup correctly.  I remember that statement he made very well.  I didn't disagree with  it at the time.  After having used MonoTouch off and on for the last four months and watched it mature, Novell has produced a product that makes developing for the iPhone fairly easy. 

    The interesting thing is that Novell has made developing for the iPhone in .NET/C# on the Mac easier than developing on Windows for WinMo in .NET/C# with Visual Studio.  Seriously, what is wrong with that picture?

    Overall, I really feel that MonoTouch is becoming a full featured framework for development. As we enter 2010, I'm really glad to add it to my toolbelt. I'm looking forward to new features that Novell is going to add to MonoTouch.

  • 10 Commandments of Mobile Development

    I see all kinds of problems with mobile development and companies trying to do mobile development and I've boiled them down into my 10 Commandments of Mobile Development:

    1. Thou shalt realize that the mobile environment is a diverse ecosystem with many different devices and that cost of developing mobile applications can be large without a good plan.
    2. Thou shalt realize that mobile develop is different from desktop development.
    3. Thou shalt solve singular problems with mobile devices. Leave general purpose to the desktop.
    4. Thou shalt not take an existing desktop application and scale it down to a mobile device.
    5. Thou shalt realize that a mobile device does not have the same features as a desktop with multiple monitors, multiple cores, and 64 bit processors.
    6. Thou shalt realize that simulators are just that simulators and are not the "real thing."
    7. Thou shalt minimize keyboard input and keystrokes required.
    8. Thou shalt be efficient with power utilization. Do not do things because they are cool. Do things because they solve a problem, help the user, or provide value.
    9. Thou should look at asynchronous processing or threading to provide a responsive UI.
    10. Thou shalt not look too far down on web applications running on your device.
    There, I think that about covers it
  • Book PDFs on file sharing sites

    I was working the other day and using some full text search features in Sql Server 2008.  I ran across Hilary Cotter's Sql Server 2008 FTS book.  In doing some additional searching, I ran across some PDFs on some file sharing sites that were suppossed copies of Hilary's book.  Clearly, this is a copyright violation.  There are people out there that are openly advocating that books should be given away.  This is craziness.  If you are an author writing technology books, you aren't going to get rich, so don't do it for monetary reasons.  However, there are editors, tech reviewers, marketing, and the people incharge of printing that need to pay the bills.  Books cost money to produce.  Why are these people not allowed to make money?  I hear the arguments

    • People might end up purchasing your book.  Why pay for the cow when the milk is free?
    • It allows you to expand your marketplace as an author.  Why don't all of the other people associated with the book deserve to be paid?
    • It helps people that are just learning and might not have the money.  Ok, a couple of thoughts on this:
      1. Let's work a deal so that after X number of book sales, my publisher will release the book.  If X number aren't sold, you can make up the difference.
      2. You pay for X number of books. I am sure that with volume, my publisher will provide you with a good deal


  • Customers, feedback, and complaining

    I read with interest Miguel's tweet about people complaining about the change to the MonoDevelop license:

    The best part over the MonoDevelop license change outrage? It comes from people that actively campaign against Mono. 100% fake

    Now, I am a big believe in getting feedback from customers. Feedback is very important.  You need to talk to customers,  You need to find out where their pain is? What tare their concerns? What can you do better?  This can be painful at times.  At the same time, you should remember that not everyone that is giving you feedback necessarily has your best interests at heart.  The feedback could come from someone with a religious ideology, as with Miguel, someone that considers them self a competitor, or anyone else with an axe to grind. Its your job to figure out this part out. 

  • We need Microsoft and Google phones

    I just finished writing why Microsoft and Intel are having problems with tablets and kinda threw mobile into my thoughts.  I now want to go one step further and that is to ramble a little bit on what Microsoft and Google need to do in the phone marketplace.  Microsoft has been competing in the phone marketplace for a while.  They have had success in getting manufacturers to use Windows inside of their hardware.  Google is following the same gameplan.  This is a gameplan of failure. The problem with it is that manufacturers are going to create the easiest product for them to manufacture.  For all the love the Google gets in the press, have you seen the new Droid from Verizon? It almost strained my arm when I tried to pick it up. its heavy.  Really heavy.  When I looked at the product, I felt it was a major embarassment.  I has okie dockey touch on the outside and keyboard input when it is flipped up.  Seriously? Two input types? Are you kidding me? A much better choice would be to have 1 input type and two devices.  RIM sales are up.  iPhone device usage in the US recently passed WinMo sales.  There is limited space in the marketplace for another phone device. 

    Microsoft needs to make a brave choice to save WinMo.  Google needs to make a direction change in their product or they'll be a limited third place product.  The interesting thing is that the choice is the same for both.  Microsoft and Google, you both need to sit down, design, and build a branded device.  Why?  You can build a product that customers want.  Manufacturers are going to build a product that is easy for them to manufacturer, but only Microsoft and Google can take the time and effort to build a product that customers want.  It might seem that this would mean that they are going around their parterners, but they won't be.  Why?  These will be higher end products.  Since they are higher end, they'll be higher priced.  Manufacturers are going after the lowest priced marketplace.  The competition you are going after is not the low end.

  • General Purpose vs. Task Specific

    I read with interest this commentary about Microsoft/Intel ceding the Tablet marketplace to Apple.  I'm not sure that that is intentionally true, but I think that Apple is going to be a very hard nosed competitor in the table device space.  Will Apple be successful in the tablet space?  I don't know, but I know that there is a lesson to be learned here, and that is the general purpose vs. task specific.  Both Microsoft and Intel have been successful in the marketplace with general purpose solutions.  Intel put out the x86 architecture.  It has been a wildly successful CPU because it was better at many of the tasks that single purpose CPUs  tried to do before it.  Microsoft with Windows has been very successful because Windows can be tailored to solve a number of problems that customers have.  Microsoft and Intel have been wildly successful in part due to the attention to solving a set of general problems.

    Unfortunately, this general purpose success has left certain scenarios not solved.  An operating system that is good for the desktop doesn't necessarily work well in a mobile device.  A CPU that works well on the desktop doesn't necessarily perform well in scenarios where power utilization is important, multi-media processing, or any number of specific situations.  The problem that I see Intel and Microsoft having is that they want to take their existing success in general purpose computing and attempt to shoehorn that into a problem.  Look at Windows Mobile in comparison with the Apple iPhone.  The iPhone tries to solve the problem of phone, web content, and multi-media all in one product.  Apple has opened the platform some to allow for third-parties to write applications that run on the platform, but it is hard to argue that the iPhone is a general purpose device.  Now, look at the marketing of Windows Mobile.  The WinMo story is that it can do everything a desktop can do, but in a mobile platform.  There are a number of things wrong with this story.  When was the last time you needed to change an Excel spreadsheet or make edits on a Word document?  Now, what about Intel? There are a large number of features and functions that a desktop needs that mobile devices don't necessarily need.  The result seems to be that Intel's chips, even Atom, and chipsets use too much power for mobile devices.

    Why can't these two great companies see this?  They are happy with their success. Project managers, VPs, Senior VPs, Presidents, Board of Directors, and Chairmen of the Board use words like "Strategic Direction" and other terms.  Unfortunately, the foot soldiers, engineers and software developers, are asked to build a product from the tools that they already have.  In the case of Microsoft and Intel, this is the Windows API and the x86 CPU.  now, the marketplace is a funny thing.  Clearly, MS and Intel could be successful with some subset of the Win and x86 APIs, but I doubt that they are able to figure out what subsets of their products are suitable for the mobile or tablet marketplaces.  Someone in a position of authority has probably decided that the best subset of their product is 100% of their product.  Personally, I would probably have made the same decision, but I would argue that the marketplace has already decided that the general purpose approach has not been successful.

    For Microsoft to be successful in this mobile/tablet marketplace, they need to figure out and produce a version of the Windows API that will fit these marketplaces   For Intel to be successful, they need to produce a power efficient cpu (and system) that will fit into the mobile/table marketplace.

     

  • Thanks

    I wanted to thank everyone that purchased a copy of my MonoTouch ebook.  I got an email from my editor at Wrox last week and he saiys that sales are going very well.  I think mobile is finally panning out!

  • Entity Frame article in Visual Studio Magazine

    Yesterday, I checked the mail and I received my latest copy of Visual Studio Magazine.  On the cover, I'm lead to believe that there is a major article on Entity Frame 4 that will be included in .NET 4.  I quickly opened up the article and after about 15 minutes, I was completely disappointed.  The media has become preoccuppied with sensationalism.  Unfortunately, this has transferred to the technology world.  The EF4 article seemed to be nothing more than an article comparing/contrasting EF4 with EF3.5 and NHibernate with sensationalism sprinkled in.  This is not what I am interested in.  I can understand discussing the new features in EF4, however, the type and amount of material comparing NHibernate with EF4 was unnecessary.  I was interested in an article that would have shown me how to use EF4.  The resulting article basically was a failure.  Give me articles that show me how to use the product.  I'll figure out how to compare/contrast with NHibernate.

  • Web Application Toolkit for Mobile - Did you know about this?

    ** Complete ripoff of the content from the site. This is here so that I can remember where to find it. ** 

    This Web Application Toolkit is designed to demonstrate how to extend an existing ASP.NET MVC Web application to provide access from mobile devices. To enable mobile access, the Web application should have views targeting each of the mobile devices to be supported.

    The MVC pattern helps you create applications that separate the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements. The pattern specifies where each kind of logic should be located in the application. The UI logic belongs in the view. Input logic belongs in the controller. Business logic belongs in the model. This separation helps you manage complexity when you build an application, because it enables you to focus on one aspect of the implementation at a time. For example, you can focus on the view without depending on the business logic.

    In this Web Application Toolkit we use the MVC pattern to create several views targeting different kind of browsers reusing the same business logic. For this implementation, we use the ASP.NET MVC framework which provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications. The ASP.NET MVC framework is a lightweight, highly testable presentation framework that is integrated with existing ASP.NET features, such as master pages and membership-based authentication.

    For extending the Web application to use mobile specific views, this sample provides a reusable component called MobileCapableViewEngine that enables the Web application to show the appropriate view depending on the device's browser that is performing the request.

    Link: http://code.msdn.microsoft.com/WebAppToolkitMobile

  • My MonoTouch ebook is out - Build iPhone apps with C# and run on the iPhone

    My MonoTouch ebook is out.

    This Wrox Blox is for .NET developers who want to learn to develop for the iPhone with C# using MonoTouch and MonoDevelop on the Mac. The iPhone is the smartphone leader in mindshare and the amount of money spent on applications. This lead in money spent on applications is expected to grow over the next several years. Objective-C is the native language for iPhone development. .NET developers, who work in the largest general area of development frameworks, have looked at iPhone developers with a great deal of envy. But with the release of MonoTouch, .NET/C# developers can apply their knowledge to iPhone development. This Wrox Blox will provide you with the basics of development on the iPhone with MonoTouch and MonoDevelop. 

    Table of Contents

    iPhone Requirements 2

    Development Strategies 3

    Web Development with ASP.NET 3

    MonoDevelop and MonoTouch 4

    Visual Studio .NET ➪MonoDevelop 4

    Classes in MonoTouch 4

    What Is MonoTouch? 4

    Namespaces and Classes 5

    Introduction to Development on the Mac with MonoDevelop 6

    Interface Builder 8

    Outlets 10

    Actions 14

    Deploying to an iPhone 15

    Mapping 17

    MKMapView 17

    The Application 18

    Annotating the Map 20

    Debugging 21

    Interacting with Other Applications 22

    UIPicker 22

    NSUrl 24

    UIAlertView 26

    UITableView 26

    DataSource 27

    Binding Data to a UITableView 29

    Customizing UITableView 30

    Accelerometer 33

    Settings 34

    Things to Watch Out For 37

    Resources Used 38

    About Wallace B. McClure 39

     

    Usage Rights for Wiley Wrox Blox 

     

2006 - Wallace B. McClure
Powered by Community Server (Non-Commercial Edition), by Telligent Systems