Thursday, 25 August 2011

Where XNA beats up Silverlight

   Finally a blog post. I am in the process of updating (it's more of a rewriting) Boxfiles for Mango. Till now I have rewritten the Dropbox library from scratch (took off all the dependencies Hammock, Json.Net and now it's pure HttpWebRequest) and developed a library for accessing Skydrive resources (it works and it is possible to list the folders and download the files mainly what I need to get the modified Office files back to Dropbox). Anyway the Skydrive API it's a mess for the moment and I really hope they will get a "clean" API. The current version of the Rest Api is usable only for contacts, photos and videos. I will post both libraries on Codeplex (very probable after I finish the update of Boxfiles). 
    So what is this post all about. One of the features of the new version of Boxfiles will be pinch to zoom. Searching on the web I have found the XNA and the Silverlight solutions. I've started with Silverlight and with pinch to zoom added the application would easily eat more than 90MB of RAM while the image window is opened.  Digging up on what was consuming so much memory it turned up that the image window eats around 40 MB of memory (also because I have enabled CacheMode="BitmapCache" in order to have a smooth zoom). This is an abomination for a simple page with one menu and an Image control displaying a file  of 3MB. I than remembered that, in Mango, Silverlight and Xna can "live" together. The feature was introduced for enabling Silverlight in Xna (menus and stuff) , but in this particular case I will use Xna in Silverlight. I've created a project where I can compare the pinch to zoom on both Xna and Silverlight. The results are not bad: XNA uses around 10MB while Silverlight uses 40MB and the pinch to zoom is much smoother in Xna (the sample starts with 10MB of memory occupied).




    In order to have a realistic comparison I've added an ApplicationBar to the Xna window and both of the windows have a Menu where you can force the GC to collect. While testing the solution I've found a really strange behavior (in my opinion it's a memory leak of the image control and maybe somebody from Microsoft should have a look into it): the Silverlight window, after the first launch, was not releasing 10MB of memory. In order to release the memory I had to manually remove the Image control from the ContentPanel and give it a null value.


ContentPanel.Children.Remove(image);
image = null;

If you play with the solution just comment the two lines located in OnNavigatedFrom (ImageSilverlight.xaml.cs) and you will see the leak.

Here is the Source Code

NAMASTE!

Monday, 18 July 2011

Mono is back

  Great news today... Mono is back. Looks like the Xamarin guys were able to convince Novell to take over the Mono project. You can read more on Miguel de Icaza post. Now the first thing I hope is to be able to reactivate my Monotouch license on my new Macbook (for more than two months I got no answer to my emails - Xamarin or Novell). Multiplatform mobile development... Sweet

Saturday, 16 July 2011

Windows Phone 7 Marketplace What to expect


  We all know that the actual version of Windows Phone 7 Marketplace can be better and that a new version is coming. As a registered developer with an active application on the marketplace I've been invited to compile a survey on the Windows Phone 7 Marketplace. The survey had a very interesting part where you select what you would like to included in the next version of the Marketplace. Here is the list with what might come in the next version of the Marketplace. If you see items that are doubled it's because the system they used for evaluating was to cycle on the same answers where you select which one is the most important and which one is the least important in groups of 4:
  1. Real-time app download information: "Watch number of app downloads in real time (no delay). App downloads are categorized by user market, device and mobile operator.
  2. Annual paid subscriptions for technical support: "You can buy a paid subscription for advanced technical support."
  3. App emulator: "Users can check out a full version of the app in a browser window, prior to downloading or purchasing."
  4. Web marketplace: "An online web marketplace for users to browse the app catalog and make purchases; apps downloaded/purchased on the web marketplace show up instantly on their phones without the need to tether to the PC or perform any user action."
  5. Easy app updates: "The App Hub will retain metadata, artwork and descriptions from prior versions and make it easier to submit updates."
  6. Paid featured slots: "Bid money for a featured app slot within the web and phone marketplace clients. Featured slots are assigned based on a real-time auction to the highest bidder."
  7. Early access to updates: "Developers will have early access to OS upgrades to help them update their apps to take advantage of new features."
  8. Flexible pricing: "This will enable developers to price your app differently in different markets and also have more price tiers to choose from."
  9. Private distribution of apps: "Apps can be published hidden in the marketplace, so only users with a special deeplink are able to download the app. This can be used for private distribution scenarios where you don't want your app to show up in the general catalog."
  10. More intuitive category structure: "Changes to the category structure to make it more intuitive, add additional categories like education etc."
  11. Respond to user reviews: "View and respond to user reviews. Draft responses to user reviews from your App Hub account without seeing the real user email address. Users receive your response and can optionally come back and change their review."
  12. App gifting: "Allow users to gift apps to other users, paying on their behalf. The gift recipient gets an email with instructions on how to redeem the app."
  13. Role-based developer accounts: "Multiple user accounts can be created to manage your AppHub account, with different permissions. For example, one account could have permissions for viewing download/payout reports (your finance manager) but no permissions for submitting or editing existing apps. Another account could have permissions to submit apps or edit metadata, but no access to reporting."
  14. Additional payment methods like PayPal: "Ability to pay App Hub fees with PayPal. Ability to buy apps or in app purchases using PayPal."
  15. Discount offers/coupons: "Ability to generate and offer a discount coupon to users (x% or $x off) for app promotions, etc. Users can enter the coupon code during checkout. Coupons can be unique (one time use only) and have an expiration date. Coupons can be easily generated from your App Hub account."
  16. In-app commerce: "Ability to charge users a small amount of money from within the application. This can be used for selling extra content (e.g. a new game level, accessories) or unlocking new app functionality."
  17. Screen capture tool: "Tool for capturing the right size (480x800) screenshots off the emulator or a phone tethered to the PC."
  18. Video content in-app description: "Ability to upload videos to showcase app for users to see from PC or web interface while browsing the catalog."
  19. App analytics: "Get real-time information on number of application runs, active users, app installs and uninstalls, etc. to understand how often your app is being used."
  20. Simplified identity validation: "A simplified identity validation process that will be based on your credit card details and/or email verification."
  21. More frequent payouts: "We will lower the payout threshold and so you will receive your payouts more frequently ."
 All are great features. Let's hope they will implement all of them



NAMASTE

Friday, 15 July 2011

WP7 Network Printing

   As promised I am publishing the sample for network printing on Windows Phone 7 Mango. It is a proof of concept and it is the same I did more than a year ago on Monotouch.  It uses sockets to connect to a network printer and send one page that contains two rectangles (one with shadow and one without shadow) and some text. It is an implementation of PCL5 (not a complete one of course). Hope that somebody will take the time to finish implementation. If so please let me know cause I will need it.

Source code

NAMASTE

Thursday, 14 July 2011

My Monday thoughts on Thursday

  For more than three weeks I wanted to do a post on Monday called "My Monday thoughts". Too bad that on Monday I always have a lot of work to do and never got it done.
   Three weeks ago was about localization and ignorance. The italian "garante" for personal data privacy, Francesco Pizzetti, declared that smartphone are dangerous because they are always "tracking" us at any step. That, in my opinion, is pure ignorance. First of all somebody has to explain to him that GPS is a receiver not a transmiter and that having a cellular phone (any cellular phone) is having a tracking device (the mobile operator is logging the sequence of cells where your phone is connecting). So if you don't want to be tracked don't buy a cell. Than there is the question what is the mobile operator doing with this data? Almost all the time it is used for statistics, and then, when an authority asks for it they are used in investigations. Would I mind being tracked by Google, Apple or Microsoft? Not really and if this could help them make better products I would agree to do it. Does anyone ask you if you want your data logged by the mobile operator? I remember the guy that discovered the logged positions on his iPhone and everybody saw it like a big problem. But if anybody, besides Apple, arrives to read that data it means that he already has access at your emails, contacts, phone calls which are more sensitive than the log of your position. If you don't have anything to hide being logged or not is not such a big deal and in some cases could save your life (accident in the mountains for example) . On the other side the persons that usually vote against it are in parliament and some of them have things to hide.
    Two weeks ago  I had a week of holiday and I was in Nice, France. Wanted to blog a lot instead I just wrote an article about Mango, fixed some bugs for some clients, and ported the code for network printing on WP7 in order to write a blog post (still have to try it with the printer). I arrived at the conclusion that writing along with a glass of wine is much easier. The project that eats almost all my time at this moment is a Home automation/Domotic one. The client wanted the WPF:


and in my spare time (usually from 10pm-1am) , for a demo for Microsoft Italy, I've developed the Windows Phone 7 client that uses sockets:

  I intend to finish the application before the Mango Marketplace opens and have it as a free version with a fixed plant in our office.
     This Monday I was pretty sad because I had the occasion to go Microsoft WPC and present Boxfiles for Dropbox on stage and could not go. The problem was that my visa (I am romanian and need a visa) was not ready. Anyway I already have in mind version 2.0: multilingual , add Skydrive support in order to be able to upload files to dropbox from skydrive when mango arrives (this is the only way to get your modified word, excel docs back to dropbox). Also 2.1 plans: background download/ upload of files.
     Today I am just happy that my article was published. But one of the things I am more happy about is that in all this period I made new friends: Lorenzo Barbieri, Roberto Freato, Alessandro Scaradova, Matteo Pagani, Michele Locuratolo. It's good to feel part of a group that share the same passion for mobile development ( DotNetLombardia). A special thanks to Lorenzo Barbieri and Roberto Freato for making it happen. 

Getting back soon with the post on Network printing on Windows Phone 7

NAMASTE

Wednesday, 22 June 2011

Thursday, 16 June 2011

Metro Style UI in iOS 5

      Today, when I've changed my SIM card, I've noticed this screen on my iPhone:


 
     The icon seems more an WP7 icon then an iPhone one.  Good choice the Metro UI :)

Tuesday, 7 June 2011

iOS 5 HTML5 Speed Reading

   It's hard to start a post when it passed so much time from the last one. So much things to say but when you want to write about them you realize that are not so important/innovative/interesting or at least worth reading about.
   I remember back in April at Mix Keynote when they presented the IE9 mobile edition that Apple was the worst performer in the tests. This is a small part of the Mix keynote where they show how the various devices perform:



          So ever since April I was curious how much time will it take Apple to get back on the track with Safari mobile browser. Luckily I am the "proud" owner of an iOS developer account with no application published on the App Store (I will blame time and now Novell as I had to change my Macbook on which I had activated the Monotouch license and now it's GONE as nobody answers of that part anymore. I can only hope that Miguel and his team will "cook" a new product as soon as possible. All the money we've spent on Monotouch and Monodroid are now a dead investment). But let's get back to the post.... So today I've downloaded the first beta of the iOS 5 and deployed it to my iPhone 4 and ... SURPRISE... after not even two months the Safari browser outperforms Android and Windows Phone 7 (the way they were two months ago). Here is a small video with the test I ran:


         I can hardly wait to be able to install Mango on my device and it seems that this could happen at the end of June for developers (keeping my fingers crossed). In that case Apple and Microsoft are definitely winning a small battle against Google. It is very important to give the tools developers need when they need them and this is not when the phones ship (being able to test on a real device it's a MUST). While for Apple it is an easy battle to win as they develop the hardware so they decide what to do, Microsoft on the other side has to convince the hardware OEMs and the mobile operators to let developers get early access to Mango and also find a way to make it "work" on all the Windows Phone 7 devices available today .
     iOS 5 brings a lot of interesting new features and I agree that some of them are similar/inspired/copied from Windows Phone 7, but if that makes the product better Microsoft should copy and improve some of the iOS features. Here are some things that I still don't like in WP7 :
  • the most annoying in this moment is the email client that doesn't go to the next email when I delete one but comes back to the inbox and make me lose a lot of  time (for the moment I have mobile internet only on my Omnia 7)
  • I still don't like the application list even if now you can use search or jump list
  • HATE the InCall experience with small buttons and the "half" window (I don't understand why)  that doesn't make sense as you usually will push with the face the outer area and the window will go to background or even more annoying instead of closing the call you will send it to the background 
NAMASTE

Thursday, 17 February 2011

WP7 Emulator Tip: Use your hardware keyboard

   Yesterday at MWC I was telling Bryan Agnetta how frustrating it is not to be able to use you hardware keyboard to input text in the Emulator and he told me that as long as he knows there is some shortcut that enables the hardware keyboard in the emulator. Searching with google I've found a post on Brad Tutterow's blog and in fact you can use PgUp to enable the hardware keyboard in the emulator. Hope this tip will help you as much as it helps me. No more frustration...:)

 Here are all the shortcuts:


Page up / page down: Toggle between the software keyboard on the emulator and the hardware keyboard on your development machine.  While using your machine’s keyboard, you can TAB between fields.
F1: Back
F2: Start
F3: Search


Monday, 31 January 2011

Windows Phone Marketplace: More frustration

   I wanted to do this post for quite a while, but never found the time. Hope that someone from Microsoft will have the patience to read this post and take some action. 
    In my opinion the current version of the Windows Phone Marketplace reflects the state of WP7 platform ... unfinished, rushed on the market. Some time ago I wrote a post about the development platform and said that it's frustrating that "normal" developers don't have access to resources that are already present on the platform like: sockets, camera stream, database. The Windows Phone Marketplace is even more frustrating and I experienced that both as individual developer and company account . So let's take it step by step:

1. Registration
  As a company we were already registered as Windows Mobile developers. When Microsoft updated the Marketplace we had to update our account and something went wrong when the XBox account was generated because it was located in USA instead of Italy. This made impossible the publication of any application as the developer website went into error. We contacted Microsoft support and after almost one week the only solution was to generate/subscribe a new account.
  As an individual when subscribing the Developer Program on the same webpage there were 2 prices "Abbonamento annuale Hub App € 99,00" and "L'abbonamento annuale di € 80,00IVA inclusa" but when I received the message from the credit card the real price was €113,85. 

2. Publisher Certification
   I know that Geotrust is responsible for the certification but they represent Microsoft in this process so it's Microsoft that has to do something to improve this service.
  Company account: after waiting for 3-4 days, as we had our application ready for more than two weeks, we contacted them directly. The first time they said that everything was ok and that we will have the account certified the same day. As we had no answer we had to contact them again after two more days in order to finally have the account enabled
  With my personal account was even worst.I have subscribed the Developer program on 24th of Nov. 2010, then received an email on 26th of Nov 2010 that they needed a document that I have sent the same day. Geotrust answered on 3rd of Dec 2010 that they have received the document and they will complete the verification process shortly. I wrote to them on the 3rd of Jan. 2011 asking why my account was not activated and they finally activated the account on 4th of Jan 2011 :).

3. Publication
  This part is not so bad but can be improved. If you submit an application/update but you find a bug it is impossible to cancel the submission even if it's not have been tested. On one hand it's quite normal, but as time is money if the developer finds a bug why not stop the process right away meaning Microsoft won't loose time to test an application that won't pass certification and the developer won't have to wait for the certification to fail in order to be able to submit an updated xap. The alternative would be to create and submit a new application but if you don't pay attention you will end up with two applications on the Marketplace. This happened to me with BoxFiles. I then wanted to split the applications (one for US and the other for the other markets) but this meant that some users won't be able to update the application they bought because if you bought an application that is updated but not available anymore on your Marketplace you won't be able to update. So I've decided to let both of them.
    I have to make compliments to the testing team. They are really well organized and you will usually get an answer in one or two days. This is the only part of the Marketplace that I can say it's great (even if my latest update was postponed because the Dropbox service was not working for 30 min so they could not login or create a new account).

4. Updates 
   The bad part about updates is that it is impossible to write the update text. The user will see that there is an update, but you cannot communicate what is new in this release

5.Reviews
   The first thing that I don't like is the fact that a user can write more than one review. A user should be able to update his review but this should erase his old review (now both of them will be visible). I don't like it because if a user changed his opinion changing it from bad to good a possible buyer will be influenced by the bad review even if the user that wrote the bad review now has another opinion.
   Another aspect is that nobody verifies the reviews. For example one of the bad reviews of my app states that the search section freezes even if, in the old version, there is no search section (1.7 will have it :) ). Another user said that it cannot login in trial version and he will not buy the app even if, for writing an app review, you will have to buy it. It looks like some users are having "fun" trying to make the applications of the others look bad instead of trying to make their applications look good and the Marketplace helps them.
   I also think that the algorithm for calculating an application rate could be improved. I might be mistaken but in this moment is a mean value from all the reviews of an app which, in my opinion, is not reflecting the "state" of the app. I will explain why: an user usually, if everything works, won't take time to do a good review. On the other hand if an application does't work you will be angry and you will do a bad review.  If the developer fixes the things the users that wrote a negative review will usually not take the time to write a positive review. So it would be more fair to calculate an application rating using an weighted average by the application version number. If the first version had many bad reviews and the next one have very good ones but not as many they should count more in the rating as they reflect more precise the actual state of the app. 

6. Security
   I let for last the worst of them all. This part is very shameful for Microsoft. A company that teaches Security Best Practices has such a BIG HOLE in their system and they are not patching it. At the start Microsoft was warned that anybody can download any xap directly from Microsoft Marketplace but Microsoft did NOTHING and there are programs circulating on the web that are able to download xaps directly from the Microsoft Marketplace (just search WP7 3MktPlace). It's shameful not because the Marketplace has a bug/hole but it's shameful because Microsoft is not patching it right away. This means that Microsoft has no consideration for developers. Developers are trusting Microsoft giving their intellectual property for selling and when a bug enables anybody to download any xap Microsoft doesn't take action. I remembered that Paul Thurrott wrote a blog post where he was frustrated by the fact that Microsoft is releasing software for the iPhone while Apple in the first three months of the iOS  released four updates to their OS patching bugs and adding new features. Instead of using their developers for iOS Microsoft should use all their forces to get WP7 a valid alternative to Android and iOS. I know that NoDo will lock the possibility to sideload applications on WP7 but if it will still be possible to download any xap from the Marketplace Microsoft will encourage Intellectual Theft as it will be possible to use Reflector to see how an app it's done. Of course Microsoft will say that you can use an obfuscator to protect your xap, but why justify a security problem with a workaround? It is enough to patch the hole: authenticate the download of the xap using the windows live id and verify if the user can download a certain xap.
    Another thing that I've noted is that you see everywhere on twitter/blogs that WP7 has more than 20.000 developers and there are 7.000 apps on the marketplace. Let's say that we have an average of 1.5 apps per publisher so we have 4,666 "active" publishers. Let's round it to 5.000 meaning that only 25% of the developers "concludes" the publishing process. In my opinion this means that developers need more. I really hope there is more in NoDo for developers other than Copy/Paste and speed. There are so many things still missing.

NAMASTE!


Saturday, 25 December 2010

WP7 Barcode Scanning using ZXing and Microsoft.Phone.Media.Extended

     When I first saw this blog post from Kevin Marshall it crossed my mind that it could be used for barcode scanning in order to get the same user experience you have on Android and iPhone. I've contacted Kevin to give me some details/source code for the project and a few days ago he sent me his project that is already posted on his blog here. Kevin also thought of the possibility to use it for barcode scanning, but his sample works only with QR codes. Looking at the project I saw that he was using VideoCamera class that has no Focus capability needed to take a "clean" picture of the barcode. The PhotoCamera class, on the other hand, has Focus  implemented so I simply changed the class from VideoCamera to Photocamera. In the Grab method I call the Focus method and then using the AutoFocusCompleted event I decode the barcode. For decoding I use my ZXing port. The results are pretty good as you can see in this video I've uploaded to YouTube. There are some optimizations that can be done like cropping the WritableBitmap at the dimensions of the red rectangle, but even with the full image (640x480) the speed was acceptable on my LG Optimus 7 .
     The source code and the xap of the app (that you can deploy if you have a developer/unlocked phone) are included in my latest release of the ZXing port available on CodePlex. To compile the source you will need to follow the steps Kevin indicated in this post and also you will find some hints/files here. If you start a new project you will also need to add   "ID_CAP_CAMERA" capability to WMAppManifest.xml. This, for the moment, is a hack and I don't think the application will pass Microsoft certification, but you can try. 
  "Reflecting" Microsoft.Phone.Media.Extended I saw no reason why Microsoft won't give access to developers to this assembly (put it in the SDK)! Why limit developers to do great apps when this is the first thing Microsoft needs for the Windows Phone Platform? 
     Special thanks to Kevin for the source code.


NAMASTE

Thursday, 23 December 2010

DropBox library for Windows Phone 7

    So here it is.... I finally published the DropBox client library on CodePlex. It is a fully functional Dropbox client library for Windows Phone 7 and it is the same I've used to build BoxFiles. The first version of BoxFiles received a pretty bad review from http://wmpoweruser.com as it was using only the official API that doesn't have any method for generating links to files (the only way to open a file in Windows Phone 7), but after some searching I've found the API and I think that the current version (1.3) is a pretty good app. I will keep my bad review as they asked 50$ to review the application again. In the following weeks I will publish a new version of the Backup/Restore IsolatedStorage project using Dropbox instead of WCF.
  I've put a lot of work in this library so if you use it please sustain my work by buying the application and please "try" not to publish a similar app to BoxFiles on the Marketplace. 
   I've also published the Sqlite and the ZXing projects on CodePlex so you can grab the source code directly from there.

  I wish you a Merry Christmas!


NAMASTE

Thursday, 16 December 2010

A phone lifetime: an epic battle between Microsoft and OEM

     Looking back at my blog it seems pretty dead, but I intend to catch up as I am on vacation traveling to Brazil and Bolivia so I have some spare time for writing. It's more than a month since I finished the Dropbox client library (that I will soon post on Codeplex) and also Boxfiles for Dropbox which is the application I am trying to publish on the Marketplace. The whole publishing process was (still is as the app is not yet certified) quite an adventure and even with the support of Microsoft Italy, which I thank, it can take up to one month to have a "functional" AppHub account.
    Getting back to the title of the post. I don't know if there is/will be a battle between Microsoft and the hardware OEM, but I really hope so. I am referring to updating your windows phone 7 device. There are already rumors on the web about the "Mango" release and also about Windows Phone 8. From this point of view Apple has a winning strategy. Buying an iPhone gives the owner the certainty that his device will be up-to-date for at least 2 years (2 major releases- the one installed on the phone and the next one). On the other side there is Google and Android where the majority of the OEM choose not to update the phone OS version even if it's a minor release like 2.1 to 2.2 so in less than 6 months you will have an outdated OS. In this moment having an updated iPhone costs less in two years than having an updated Android phone. So what will be Microsoft position for the new Windows Phone? In the previous version of their mobile platform users were usually left behind between OS version updates (or to be more precise left at the OEM mercy), but the releases of updates/new versions were not so frequent which lead to the "death" of the platform on the consumer side and focus on the enterprise side were having and updated device is not so important.  I hope that Microsoft will battle to bring updates to the OEM devices for at least 2 years which is a logical choice as almost every phone operator will give you a device at an affordable price if you sign-up for at least 24 months. That would be a big plus in the battle with Android platform. 
        So who will win? Microsoft or the OEM? Will Microsoft be interested to update the devices for 24 months and loose some earning from OS licenses but give the users more confidence with the platform and compensate with Marketplace earnings?  My feeling is that the devices out now will be obsolete in one year and won't get any updates.  Maybe this is one of the reasons why the sales are not as good as everyone expected them to be: it is the first version, things are still missing and if I buy a phone now it will not be updated to the next version. Will see...


NAMASTE

Tuesday, 9 November 2010

Telerik RadControls for Windows Phone 7

     I am really happy that Telerik decided to develop controls for WP7. I have been using their silverlight controls since 2007 and they always added great controls. You can already download and try the CTP from the following this link . Even if it's just a CTP there are already many useful controls (Animation, DatePicker, DockPanel, PhoneApplicationFrame, DockPanel, TimePicker, Transition Control, UniformGrid, Window, WrapPanel, LayoutTransform, PickerBox, InfiniteListBox) . I would love to see a ProgressIndicator also and a decent MessageBox (I really don't like the default one). Also if you present a friend that downloads the tools you have the opportunity to win one of the 5 Windows Phone 7.  

   As always it's been a crazy period and I have little (no) time for writing code for the blog. Anyway when I find some spare time (usually from 1 o'clock in the morning till 3) I work on a DropBox library for WP7 (My Greatest Work Almost Completed) that I hope to publish soon along with an updated version of the IsolatedStorage Backup/Restore solution using DropBox. Everything works great: upload, download , create/delete folders and I am pretty excited. It could be a good alternative to Skydrive support that won't be available till early 2011. 

     I've also added a PayPal donation link at the blog this way if you find the source code on this blog useful feel free to donate (the donation will be invested in a brand new Windows Phone 7).

P.S. Wish I could have attended TechEd Europe. I really envy all of you that are attending.

NAMASTE

Thursday, 4 November 2010

The Mobile Developer Journey



You have to look at the full size image

Wednesday, 3 November 2010

How to localize The Title in a WP7 Silverlight application

This is a really interesting post by Pietro Brambati. It combines C++ and Silverlight projects:

http://blogs.msdn.com/b/pietrobr/archive/2010/11/01/how-to-localize-the-title-in-a-wp7-silverlight-application.aspx

Friday, 8 October 2010

WP7 on HTC HD2

Looks like there is hope on getting WP7 running on HD2 thank to Cotulla (you can follow his progress on Twitter http://twitter.com/CotullaCode )

http://www.youtube.com/watch?v=8f_NJatLVQk

In this case HTC HD2 will become the first phone that runs WM 6.5, Android 2.2 and WP 7.


NAMASTE

Wednesday, 6 October 2010

25 years

It's impressive how things have changed in 25 years.


1983
http://www.youtube.com/watch?v=NVtxEA7AEHg

2007
http://www.youtube.com/watch?v=_5Z7eal4uXI

Monday, 4 October 2010

WP7 Multi-language v2

 While working on my WP7 app I had to improve the multi-language library I've posted earlier on my blog http://sviluppomobile.blogspot.com/2010/06/wp7-multilanguage-app-proof-of-concept.html.

What's new in v2:

  1. The LanguageSingleton class has now resources that can be accessed using an indexed property. In the published sample the Save messagebox uses the indexed property lang["MainPage.Messages.saved"] ) 
  2. The LanguageSingleton class implements LanguageChanged property so that every window could set the localized resources when the language changes (in this case is the ItemSource for the PickerBoxDialog developed by Alex Yakhnin)
  3. Implemented multi-language support for ApplicationBarIconButton (the same mechanism using button index as the one used for ApplicationBarMenuItem

I am still not sure if this is the easiest way to implement multi-language support (if someone has a better way to do it please send me a message and I will post it). There is also the M.V.V.M. way, but I think it would be more code to write to obtain the same result.


NAMASTE

Saturday, 2 October 2010

WP7 Device The End of the First Contact

            Today I got an email from Microsoft Italia telling me that I have to send back the test device :(. I think the main reason is that I was not able to deliver an App in short time, but it's not like I didn't tried. September was a crazy month with all my client coming back from holidays and start calling so the only time I had to develop was at night so the results were not as I expect them to be . Anyway I improved a lot the multi-language module (I will post later on the blog the new version) and the app for the Marketplace is UNDER CONSTRUCTION. I wish I had more time to test/improve the sqlite library, the barcode library, but guess I will have to wait and buy a device. 
             So this concludes my first contact with a Windows Phone 7 device. It was short (2 weeks), but intense :). I used it as a daily phone and the overall experience was good. There are some things that I would want them different:

  1. This is the one that bothered me the most: when you are in a call the End call window doesn't cover all the display and the End call button is almost at the bottom of it and too small. The bad part is that a lot of times (especially when I was driving) I pressed a region lower than the button so instead of ending the call it went to the background and had to bring it back by pressing the title
  2. When reading the emails (especially the unread ones) and delete a message the phone brings you back to the list with all the messages instead I would like to automatically go to the next email in the list.
  3. The right arrow in the main screen "eats" a lot of vertical space. That space is completely wasted. It would be much better to take it out and navigate from Home screen to Application List using the Windows button. Maybe three tiles in a row on the homescreen would not be a bad idea.
  4. I really miss the Call and End Call hardware buttons.It is true that you have the OnScreen buttons, but you have to look at the screen and then press End Call button which is not very "intuitive" for a person that did not used an iPhone (my mom left the phone opened for 20 minutes because she did not pressed the end call button)
  5. It would be nice to be able to enable/disable WiFi and Bluetooth from the Homescreen this way you won't have to go to Start->Applications->Settings->Wifi ->Enable/Disable or Start->Settings->WiFi->Enable/Disable if you pinned Settings to start screen. It's something I used a lot in order to save battery power.
  6. Bing doesn't search inside your contacts, emails or calendars. You can however use search inside People hub and inside each of the inboxes (using bing search on the phone it would enable to search emails on all your inboxes in only one search). You cannot search inside your calendar that would be pretty useful feature (let's say you don't remember someone's birthday date)
  7. I miss the possibility to search a contact using the phone keyboard and not the extended one (the t9 search). The keyboard is great but I was used to search contacts with the onscreen phone keyboard in Windows Mobile
  8. Still hate the application list. It is as unusable as I thought it would be. Everything is in alphabetical order without possibility to reorder items so if you are a developer you should use the first letters of the alphabet to name your app this way you have a good probability to have it in the first screen of the application list.
  9. Need to add pdf read capability to emails. This is a MUST but I think it will be available at launch as the email app already takes you to the marketplace to download the reader that, for the moment, it's not available.  
  10. Office is not a theme aware application. If you use light or dark themes it doesn't change and it is light :)
What are the 7 :) things  I loved about WP7:
  1. Touchscreen experience 
  2. Fluid user interface 
  3. Great keyboard and loved that you can use more than one language keyboard at the same time
  4. One tile for each email account
  5. One calendar to rule them all, one calendar to find them all, one calendar to bring them all and in the darkness bind them :) - depends if your theme is dark or light
  6. Notifications
  7. Great development tools 
What I didn't test and used:
  1. Music and video
  2. Xbox Live
  3. Pictures
The success of the platform will depend a lot on the apps in the Marketplace so if you are a developer try to be there from the start. 


NAMASTE

Monday, 27 September 2010

WP7 Ads

Definitely not the best way to promote Windows Phone 7:


The sad part it's that somebody (hope not Microsoft) paid for this ads when it's common sense that this is a crap.

Wednesday, 22 September 2010

WP7 Application Settings on IsolatedStorage


I'm starting to put together pieces for my WP7 application and one of the features I needed is to save/load application settings. There is already an integrated mechanism using IsolatedStorageSettings.ApplicationSettings, but I've implemented it using an XML file located on the IsolatedStorage. The main reason why I don't use the default one is because I want to upload/backup the file to DropBox or SkyDrive making it possible to share the same settings between various versions of the same application running on different platforms (in my case iOS and WP7) and also the user can restore the settings of an application when he changes the phone or reinstalls the application.

The VS2010 solution I am posting at the end of this entry is structured in 3 projects:

1. ConfigManager is the library used for settings management. It can read/write the settings. It also implements an indexed property, but as WP7 v1 uses Silverlight 3 it's not possible to use bindind to indexed properties (this feature is only available from Silverlight 4). If you want to directly bind settings to UI elements you will have to create bind-able properties . If the configuration file is not found on the IsolatedStorage the library will try to restore the file from Content (have a look at the sample TestConfig). It is possible to manually add values to the settings. There is nothing extraordinary in the source code.
2. TestConfig is a sample project that uses the library ConfigManager. It has a default configuration file deployed in Content (settings.xml). One of the things to pay attention to if you are binding to textboxes is to be sure that the binding is updated before saving the settings (this because if a textbox has focus, you modify it's value and select save settings you will loose the modifications if the binding is not updated). This is why I force the update of the source on TextChanged event:
((TextBox)sender).GetBindingExpression(TextBox.TextProperty).UpdateSource();
not a very elegant solution but it's the only one I found till now.
3. TestConfigMVVM is the same test project using MVVM light library. I did not include a settings file in the content and I load the default values manually.

Hope you will find the library useful and that you could spare the time I've spent in developing this part. The next post will be on synchronization with DropBox.



NAMASTE

Monday, 20 September 2010

WP7 Deploy Db as Content File

Some readers asked me about the possibility to use a database file deployed as Content with the project. Using the file directly from the content folder it is not possible as we do not have read/write access to content files. In fact if we use only the silverlight assemblies we don't have access to any content file. The solution is to use TitleContainer.Openstream from Microsoft.Xna.Framework (a reference should be added manually to your project) to read the content file and then save it to the IsolatedStorage. Once we have the file on IsolatedStorage we can use SQLiteClient to access it.

I've published an updated version of the SQLiteClient project adding a content file (test.db) and there is also ExecuteScalar inside the SQLiteCommand class.



Wednesday, 15 September 2010

WP7 Device Test Day One

Today was my first day of testing a WP7 device as my primary phone. Got the device on Monday, but being a really crazy week, I only got time to configure it today. Still have to install this weekend the development environment(I hope that tomorrow they will release the RTM also for the test devices cause I have a "clean" install of VS 2010 and I would like to keep it that way). The device is the LG and the build is the one that works with the beta tools.
In the past two days knowing that I don't have time to use/configure it I did some tests and got some interesting points. The first one was from my colleague Marius that, in the home screen kept pressing the windows(Start) button and not the arrow to go to the programs. This got me thinking that maybe it would be a good idea to be able to go to the Programs list when pressing Start(Windows) in the Home screen. The second person I gave the phone to play was my wife. She currently owns a Blackberry and I've wanted to see how she'll like the device. Bad luck... Maybe she was a little tired and wasn't in the right mood for trying new things but she didn't like the UI and gave up pretty quick (even if I told her to try the Facebook experience). Another colleague of mine (that owns an Android) returned the phone after 30 minutes of playing even if I've told him that he could play all evening as I did not had time (I will ask him why). So the feedback from the others was not as positive as I was expecting.
No let's get back to my experience. A bug that I've noticed in the beta build is in the initial wizard if you don't have the SIM card and you try to configure the windows live account it will block the device (the user should be able to configure the Wifi before configuring the windows live account in the intial wizard). I also got a "freeze" today using voice search with the word pizza :). At the beginning I did the mistake to add my Facebook account. Don't get me wrong I like the integrated experience but Facebook "polluted" my contact list with 200 people (and I don't have many friends on Facebook) which for me are not really important as phone contacts. I usually surf facebook if I have 10 minutes free time. For me it would be more suitable an Facebook application. So I took out the Facebook account and synchronized everything (calendar and contacts) using Google (it was quite an adventure to find the right programs that synchronize Outlook 2010 with my gmail account). I was good to go to test the phone.
The overall experience is good. The software keyboard is really good (but not better than the one on the iPhone or iPod touch). I have the impression that there is a lot of "wasted" space in the UI. For example when you are in a call you have the Speaker, Mute, Hold, Add speaker buttons that are small and then there is a lot of unused space. They could be a little bigger (even if the precision of the touchscreen is amazing but it would be for visibility and symmetry). Also the font is a little too small in some screens (in the home screen if you don't have really good eyes you will have some difficulties reading the screen). The worst designed part of the phone is still the Application list. It is in alphabetical order and the only thing you can do is to pin an app to the home screen or scroll scroll scroll. I've even tried, from the application list, to press search without being connected to the internet and wrote Marketplace but the result was empty. Let's hope that in the RTM this part will work. Anyway the application list is unusable when you have a lot of applications on the phone.
I am very excited to have a "real" test device and hope soon to start/have time to deliver some apps, modules.

P.S. Today in the car I was trying to call a person and I don't know what I was keep pressing that the phone was asking me if I want to delete the contact (got it at least 3 times today). Strange....


NAMASTE

Friday, 10 September 2010

Get Monotouch with 15% discount

Apple decided to take out the restrictions introduced in the iOS Developer Program earlier this year making Monotouch a "SAFE" environment to develop apps for iOS. Novell is celebrating this decision by offering a 15% discount on Monotouch for the next two weeks. If you are interested just use the discount code "MONO-331" on http://monotouch.net/Store

Friday, 3 September 2010

I hate marketing people

This post was not planned, but I have to write about it. The only reason I am not buying the iPhone 4 is the price. Today, watching the Apple presentation from 1st of September, got another confirmation. The new iPod Touch 32GB, that even Steve Jobs calls an iPhone without the phone and seems to have the exact same hardware of the iPhone, costs (in Italy) 309 Euros. The iPhone4 on the other hand 32GB costs 779 Euro, so 479 Euro for the Skyworks SKY77541/42 GSM module. That's why I hate marketing people: they decide. If they say the product will sell for that much that will be the price, but if you pass on the excitement of having a "cool" gadget you realize it doesn't worth the money. So I guess I will buy an iPod Touch for development and debugging.

P.S. Microsoft should be careful and react fast cause they are completely loosing a market on which they had some shares (that would be the PDA without a phone). The devices are still widely used (especially for restaurants) and will be used for gaming, apps. The iPod Touch is not only music anymore. Again Microsoft will have to choose a name for the OS because Windows Phone 7 without a phone it would be Windows 7 :) which is not the best choice. They've changed so many time the name of the mobile OS so one more won't count. Anyway a Windows Phone 7 without a phone makes a lot of sense to me


NAMASTE

Thursday, 2 September 2010

C# for Mobile Development

A long time without blogging but I have some ideas for my next two posts (will be on Windows Mobile). Today I wanted to talk about developing on mobile platforms. Two weeks ago I joined the Monodroid preview version. So in this moment a C# developer is able to develop on all 3 major mobile platforms (Microsoft, Apple and Google).
My personal opinion on each of the development platforms:
I will start with Android and Monodroid which is the newest arrived. The integration with Visual Studio 2010 is fabulous (they plan to integrate with MonoDevelop also). I was impressed of the "activity" on the Monodroid list since launching of the preview (I have almost 500 messages in 2 weeks and it's not a preview opened to everybody) and even if it's a really early version and most of the things don't work (I've tried to use threading and sqlite library to do some comparative tests but nothing worked) there are already good ideas and a lot of interest to develop on this platform. One of the most "nasty" aspects of Android is developing the UI but Daniel Cazzulino from Clarius Consulting proposed to realize a "fake" WPF UI control just to leverage the designer, and then have a custom serialization that would transform the XAML to the android markup (this way it would be possible to use Blend too). Another aspect about Monodroid that doesn't convince me is the fact that almost everything is a "proxy" to the correspondent Java object so when you run your program every object creates another object in Java and of course this influences on memory requirements and performance. I wanted to test the Sqlite library because is not a Java wrapper and I could have a speed comparison between the Java program and the same Monodroid program (when Sqlite will work I will post the results). Then there is the runtime which has to be installed on the device. So for now I would not pay for Monodroid just to be able to write code in C# which is linked to Java (of course personal opinion and a lot of things can change when they release the first version of Monodroid) .
Then there is iOS and Monotouch. This a "mature" platform arrived at version 3.0. I love the fact that in the end the code is compiled to native code so you won't loose performance. The developer designs the interface with Apple tools and then link them to C#. You have access to feautures missing in WP 7 v1 like sockets, database and the newest one that will come to iOS 4.2 is PRINTING (if you read my blog you probably know that I am pretty "obsessed" with database and printing). Let's hope Microsoft will take Apple example and implement missing features really fast (I am referring at games for mobile where Microsoft is ahead of everyone but Apple just announced on the 1st of September the Game center and my feeling is that Google is preparing something similar for Android 3.0 for the end of the year). I think Monotouch worth every penny the only doubt remains if Apple will ever "block" the apps developed in Monotouch (they don't have any reason, but I've seen some prepotent behavior from Apple lately). You will need a MAC for developing.
The last but not least is WP7. It's is the most integrated development platform. It has everything a developer needs for development (I am not referring to the missing features of WP7) and it's FREE. I am waiting for the first devices to hit the market and "play" some more (I would have loved to have a "test" device and blog about the experience with the phone from usability to development).
In the following weeks I will also test and blog about the new controls from Resco for WP7 and Monotouch.

NAMASTE

Friday, 13 August 2010

Smartphone Market

I saw today the Gartner chart with the smartphone market shares for the Q2 2010. What really impressed me was the "jump" Android did:

What it is interesting is that the iOS won 1% which I think it's the 1% RIM lost but everyone else lost market shares in favor of Google. Looks like it doesn't matter if you have the best OS on the market today(iOs) , but it's better to be "open" - good adoption from the hardware makers, a lot of developers/fans porting/improving/updating Android OS on hardware already on the market (almost every WM owner hopes for an Android port for their devices), wide range of prices for the hardware and developers that have almost everything that they need (multitasking, access to all the resources of the device, error reporting of the applications).
In fact I still don't understand why Microsoft "blocked" the multitasking in favor of battery life. Let full multitasking and then implement a mechanism inside the OS which warns/reports to the user how much an application "eats" in terms of processor/battery. The user can than decide if he sacrifices or not battery life for a certain application. It's always better to warn and let the owner decide than to decide for them. A lot of developers at WP7 Lab in Milano did not agreed with the new tombstoning mechanism but developers obey the rules which might not the case for the owners.
I expected/wanted so bad WP 7 to be perfect, complete from the beginning to have every functionality that it had but with the new UI/programming model instead now it has what it was missing before and misses what it already had. There is still much to be done to get back Microsoft back do to where it was two years ago in the smartphone market.

NAMASTE!

Friday, 6 August 2010

WP7 Device Tests

No I didn't got lucky to have a dev device of my own. Last Wednesday I attended the WP7 Lab event in Milano and everyone wanted a dev device. We even tried to bribe Lorenzo to "forget" some devices in the bar, but as there was only 3 devices available and he had the same event the next day in Rome we didn't got lucky. Anyway I've spent some quality time meeting new people and testing the Samsung and LG dev. phones.

The first project that I've tested was the SqliteClient. Could be my impression, but there is a big difference between how an application looks&feels on the device and on the emulator (it looks a lot better on the device). On the speed part I did some tests on insert (the select/delete work almost identically) and here are some results:

Inserting 2200 Rows with transaction:
Emulator: 0.622 sec
L.G.: 3.35 sec
SAMSUNG: 3.244 sec

Inserting 600 Rows without transaction
Emulator: 7.067 sec
L.G.: 29.054 sec
SAMSUNG: 21.676 sec

On the beta release the device it's 4-5 times slower than the emulator. The Samsung it's faster as it has the storage on a microSd compared to the LG that has it on internal flash.

The other project that I've tested was the barcode reader. On both devices the test samples worked the same as on the emulator. When it comes to the integrated camera this is where the things get a little complicated. The camera app is one of those apps that the hardware manufacture will customize. None of the drivers had a macro function. The Samsung device had no settings to set, and the focus was pretty bad. The LG had the settings menu implemented and a better focus. Without the macro function it was hard to take a "clean" picture of a barcode but when the image was good the library works really fast and precise. I expect a lot on the camera part from HTC. I have to wait October and see.

One thing that got me thinking is when I've asked if Nokia is preparing a WP7 device they didn't say yes, but didn't say no also. It would be a nice achievement for both companies because Nokia does great hardware, but I've never liked Symbian and looking at the market shares they could take WP7 into consideration.

Namaste

Sunday, 1 August 2010

WP7 ZXing Barcode

First of all I want to express my regret that I am not one of the 3.000 developers that received a WP 7 developer device (I read somewhere that there are more than 3.000 users that use Facebook from WP7). I really hoped to have a "real" device, but that's the way the cookie crumbles...
This weekend I had two days of WP 7 fun. What I've wanted to see was the use of ZXing in WP 7. There is already a C# port of the library in the ZXing trunk. Porting it to Silverlight it is quite simple (just have to replace ArrayList with generics lists and HashTable with Dictionary) more details here. So I've downloaded the latest csharp source code from ZXing trunk and compiled the library. This was the simple part because I wanted a "nice" test project. I've used the test images from the ZXing source zip as embedded resources and the gesture recognizer from Clarity Consulting this way the user is able to flick both direction between the test images. It was a project based learning because I've used MVVM and the application was following the pattern till I've ruined it with the CameraCaptureTask and PhotoChooserTask (I was not able to get them in the View Model because I don't receive the notification after I choose/capture a photo but if anyone of you can do it please enlighten me how it's done )

I cannot test CameraCaptureTask and PhotoChooserTask but maybe some of you, lucky enough to have a test device, can test it and let me know how/if it works (even in the beta dev tools the camera is poorly integrated with the apps - you will have to run again the app after selecting camera or photo and you should be able to see the selected photo in the central image of my app this way you can press the Decode button).

This is how the test project looks (don't forget to flick the image)


Here is the source code

Have a look also at this new post

NAMASTE