Friday, January 20, 2012

Apple and the educational e-book business fiasco

The tech world is abuzz with Apple's new iBook app that lets authors create their own interactive e-books. The catch is that the books, if sold (not free), may only be sold via the Apple eco-system.

I believe that educational material needs to be inexpensive and easily accessible to the masses. And it must not be controlled by one company.

Apple needs to promote and assist the publishing industry in developing an open interactive e-book standard for all kinds of textbooks, not just K-12 textbooks. Students should have the freedom to choose the best reader app on the best device they can afford. Those who love the iPad and can afford it will increase Apple's sales in the student world, while those who can afford a lesser expensive tablet or laptop or netbook will not be left out of the educational experience.

Wednesday, January 11, 2012

Visual Studio referenced library namespace problem

Using Visual Studio 2010, I made a WCF Service Library. It took a while to figure out how to test the code. The solution was simple though: 
  • Make a WCF Service Library project, selected form the Visual C# / WCF tab on the New Project dialog.
  • In the same solution space, add a new App project selected from the Visual C# / Windows tab on the New Project dialog.
  • In the Windows App project, Add a Reference to the WCF library project.
  • In the main function of the Windows App, use intellisense to type out the library name space [dot] interface class name and make a new object of the same type.
  • Use any of the exposed methods or properties of the object.

If you need to make a WCF app, which may in turn use the WCF library, there is a problem.

If you use Visual Studio 2010 to build the app then debug it, it just shows the list of files in the folder. If you click the .svc file for the app, it shows you a help page showing you how to generate the client application code to use the WCF app. This is so because the WCF app needs a host. The debugger generates a virtual IIS host. But to invoke the methods of the WCF app, you still need a client app that calls its methods.
So how do you quickly start to debug a WCF app?
  • Make a WCF Service App project, selected form the Visual C# / WCF tab on the New Project dialog.
  • Add a new App project of type Visual C# in the same solution space.
  • Add a Service Reference to the WCF library project. Give it a namespace, say Appname.
  • Use intellisense to type out the library name space [dot] interface class name and make a new object of the type.
  • Use any of the exposed methods or properties of the object.
  • Build the solution and... you get an error of the sort "The type 'Appname' does not exist in the type 'Client.Appname.Client'". What gives?
The problem is due to a bug in the visual studio automatic code generator, and you need to fix it manually:
  • Double click the error to open the Reference.cs file that has the error.
  • Search and replace all error occurrences of Client.Appname with Appname (use your own client and app names). To make sure you are replacing the correct ones, make sure there is a squiggly line under that app name, and remove the stuff starting from the dot before it, back one word.