Jun 26

For an internal competition project here in Avanade, my colleagues and I implemented a location aware service works on the cloud. So I’ve many outcomes from that project and want to share them with you. Our aim was to go get the a location data, based on Latitude and Longitude but alas our HTC Touch devices don’t have GPS hardware installed in. So I decided to go for GSM CellID based location awareness and worked quite well. So here is the first step to demonstrate the basic structure on how to get GSM CellId with couple of lines C# code. I just referred to MSDN codebase the RIL_GetCellTowerInfo function in the Radio Interface Layer (RIL) API. 

 

        1.Call RIL_Initialize to get a RIL handle

        2. Call RIL_GetCellTowerInfo to get the information about the cell tower the phone is connected to

The “Cell” string that FindMe displays seems to be a combination of the dwCellID, dwLocationAreaCode and dwMobileCountryCode

       3. Call RIL_Deinitialize to release the RIL handle

 

You can find the code here. GetCellDetails.rar (24.03 kb)  I’ll add other steps to decode geo info (latitude and longitude data) from that cellID identifiers soon. Meanwhile you can check http://www.opencellid.org/ and similar services from other public or commercial vendors and get more info on GSM CellID.

 

May 22
I was quite lucky that I haven't faced with that problem. Actually I haven't implemented web services (on SSL) integration lately. But I've seen many questions, mails about that bug in Compact Framework. Thanks guys in development team, they announced a hotfix for that bug. The link is : FIX: A System.Net.WebException occurs when you run an application to send HTTPS Web requests to a server in an embedded device.
Tags: |
May 22

Peter Nowak has published a complete library on CodePlex for creating Managed Services for Windows Mobile.

Project Description

This lightweight library contains functionality for creating Windows like Services in managed code, as creating Windows Services in Windows Mobile/Windows CE isn't supported. The library is compatible with the .NET Compact Framework 2.0 and higher.

Details

The .NET Compact Framework doesn't offer any functionality for creating Windows Services in full managed code, as like on the .NET Framework. Therefore this library enables creating Service in managed code to be like Windows Services as near as possible.
This library bases on Pavel Bánský's blog post, on how to create Services in Windows Mobile in managed code.

Features

  • Easy to use library in managed code. No P/Invoke required.
  • Based on the .NET Compact Framework 2.0 for maximum compatibility.
  • Extra samples to show, how to use this library.
  • Service Launcher application to start services automatically on system start
  • Additional Service Manager Utility is available for controlling Services similar to Windows.

 

 

Mar 26

Chris Tacke shows in his blogpost, how to create a Screen Capture with less than 10 lines of code. Without any P/Invoke or any more hacking, it just uses managed code. Really and very simple, thanks Chris.

Jan 06

I heard many complains about slow startups of mobile applications and also got questions how to increase the startup performance. In most of the projects, the problem was a design issue, just like trying to connect a remote server on startup or populating big datasets etc.. But on the other hand, if you think your startup sequance is totaly clear and correct than you may find some more things to do in general.

Take a look at the article on how to optimize the your application's loading time.
http://blogs.msdn.com/raffael/archive/2009/01/05/netcf-improve-startup-performances.aspx

Dec 01
The Microsoft Patterns & Practices (p&p) team delivers applied engineering guidance that helps software architects, developers, and their teams take full advantage of Microsoft’s platform technologies in their custom application development efforts. Working with the Windows Mobile team the p&p team has updated their Mobile Architecture Pocket Guide, which provides real world information and best practices for mobile development. Definitely worth taking the time to give it a read.
Nov 28
Have you heard of the MSDN Code Gallery? Well here it is: http://code.msdn.microsoft.com/.

If you are a developer blogger or just want to make some code public for others to enjoy, this is an option to upload stuff without having to have a dedicated public server.
Tags: |
Oct 30

As some of you may have already heard, Enterprise Library 4.1 was released by the Patterns & Practices group at Microsoft. I used to implement application blocks from Enterprise Library’s previous versions in my previous projects. So I decided to take a quick look for personal update.

Installing this version of Enterprise Library is much better than previous installations, as this one gives you the choice to extract AND build the different application blocks at the same time, instead of using a different installer to extract and build the source codes.  The change log for this release is available here (highly recommended to read).  If you’re looking to upgrade your skills with Enterprise Library, I strongly suggest the Hands On Labs and the Getting Started tutorials for each of the application blocks. 

For more information about Enterprise Library (resources, tutorials, news, etc.) I strongly recommend you referring to these sites:
Pieter's Blog on Enterprise Development
Tom Hollander's blog
Patterns And Practices Guidance

Oct 03

Nowadays, we all hear the term “Cloud Computing”, its benefits and some baby-steps* applications going on. Google, Microsoft and Amazon are the main promoters on this game. On my side, I like Google’s services like GMail, GDocs, Agenda etc… and on Amazon’s side EC2 seems extremely cool and powerful.  

But on the other hand two hotshots defined Could Computing as stupidity and just a business fashion. Richard Stallman, founder of the Free Software Foundation and creator of the computer operating system GNU, said that cloud computing was simply a trap aimed at forcing more people to buy into locked, proprietary systems that would cost them more and more over time.

He said: "It's stupidity. It's worse than stupidity: it's a marketing hype campaign,"  

A big anti-Cloud Computing definition also came from Larry Ellison, Oracle’s CEO, as “it is just an industry fashion.” 

They think that the personal data should definitely stay personal and advice to computer users should be keen to keep their information in their own hands, rather than hand it over to a third party. The growing number of people storing information on internet-accessible servers rather than on their own machines, has become a core part of the rise of Web 2.0 applications. Millions of people now upload personal data such as emails, photographs and, increasingly, their work, to sites owned by companies such as Google. 

So what are your ideas about cloud computing on relying to a third party perspective?   


kick it on DotNetKicks.com


*
For sure the Cloud Computing applications on the market are really great but compare them to the near feature opportunities on Cloud Computing. These are relatively tiny-baby-steps.


 

Sep 26

For the software, itself, it is easier to discuss its quality by measuring its performance, memory usage, number of the bugs etc. But what if we talk about the code file, how can we write code that we are proud of.

  • Clarity
  • Number of Lines
  • Performance
  • Comments
  • Exception Management

 

And many other topics can be added to this list for code quality measurement. But we will focus on these five now.


Clarity

Probably you have seen a really “smart” code like the one below:

   1:    public static int GetNextSize(int i)
   2:    {
   3:      //multiply it by four and make sure it is positive
   4:      return i > 0 ? i << 2 : ~(i << 2) + 1;
   5:    }


At least we have a comment line; well we will discuss the comments later on. But as you see you should really focus and evaluate the code before understanding what it is doing. So hiding the code in this way, especially if you work in a team, will create big headaches for your team members and after a while, for you, too. Code should always be clear and transparent for everyone just like the one below.

 

   1:    public static int GetNextSize(int i)
   2:    {
   3:      return Math.Abs(i * 4);  
   4:    }

Steve McConnell : "Good code is its own best documentation."
 

Number of Lines 

Some developers are proud of their big number of code lines. Because this is a proof to show how big the project is. But in the other hand, this is not true. Because more lines of code means more complex, harder to maintain code base or even worse; a sing to the wrong implementation of object orientation or code reuse.  

If you consider two software which function the same, the well structured one has always the less lines of code. The one has less lines of code is easier to maintain and fix the bugs. Which means the lighter is the better. Let me quote Bill Gates: “Measuring programming progress by lines of code is like measuring aircraft building progress by weight“. 

Performance  

Of course a fast functioning program is better than its slow versions and the performance considerations are always in the front lines of the development process. But changing a clearly readable code to its complicated and fast equivalent lines is not always the brilliant idea and there is always a way to implement the same algorithm in a clearer way.  

Well, I don’t mean don’t think about performance optimization but there is always bigger chance in the overall system to optimize. It is more important to focus on the big picture and solve performance problems that are system wide, or refactor code so that changes can be made much faster, than it is to solve a performance problem in a single line of code...unless of course that line of code is being called millions times. 

Comments 

Again I am pretty sure you have seen so many uncommented or not enough commented codes. Even code, itself, is readable or not, comments are important substances. You should always keep in mind to write clear comments like telling it to someone else. Don’t type them in your way but in a common language. 

Exception Management 

Although we are just focusing on the code quality (not the architecture or the software quality) still we need to discuss the exception management. Any unexpected situation can cause the exceptions. Normally the newly started developers go to the solution directly but prefer not to think about any abnormal situation can occur in their solution. So any missing control or a direct assumption can cause a crash in your application.  

In the worst case (probably the simplest) you can catch any exception on Application Domain level and show a common error message screen. But in any case, you shouldn’t let your software crash!  

As you already figured it out, it is not really easy to balance and find the most correct way of coding. If you don’t like the code you’ve written take a step back, review it, fix it, refactor it till you are proud of. Fixing the problems in early stage will have massive returns in the long term.  Searching for the perfect coding will lead you to a better understanding of what you are doing.  

And one more quote from Martin Fowler : “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”
 

credits goes to CodeThinked

kick it on DotNetKicks.com
 
Tags:
Aug 04
Published by Microsoft: http://download.microsoft.com/download/3/B/D/3BDDC5D5-E8CF-4031-A12A-B072ECA27C42/VS2008PETopTenFSEMEA.doc
Tags: |
Software Blogs TopOfBlogs