Earlier this year I published a small library that performs multiple tasks of number system conversion on this post. As some fellow devs were a bit skeptic about the code and demanded to see the source code, I have created an open-source project on Codeplex with the name WP7NUMConvert and included the conversion library in there.

The link to the project is:


If anyone would like to particpate in the project, be my guest.


Book: Guide to Cisco Routers Configuration

  • Provides a guide to the configuration of Cisco routers
  • Presents detailed and easy-to-follow “how-to” instructions
  • For beginners and advanced users alike

This work provides a guide to the configuration of Cisco routers, from tasks for beginners to advanced operations. A collection of detailed “how-to” instructions are presented, which will be of use to all professionals and students who engage with Cisco routers in the field or in the lab. The guide starts with the simple step-by-step task of connecting the router and performing basic configuration, before building up to complex and sensitive operations such as router IOS upgrade and Site-to-Site VPNs.

Published: August, 2012 by Springer

Guide to Cisco Routers Configuration

Guide to Cisco Routers Configuration

A Gathering of Small Number Systems Conversions and Operations for WP7

* UPDATE: I have found many bugs and issues with this original code of this library. For an expanded (and working version) you can look at WP7NC.

I know its not too much but I gathered about 16 number-conversion operations and few logical operators in a small DLL for Windows Phone devs who might need it. The functions are:

Converts a decimal number into a binary number in the form of string  (ex: 10 becomes “1010”)

Converts a decimal number into a binary number in the form of an array of ones and zeros.

Converts a binary number in the form of a string into a decimal number.

Converts a binary array into a decimal number.

Converts a hexadecimal number int he form of a string into a decimal number.

Converts decimal number into a hexadecimal number in the form of string.

Converts a hexadecimal number in the form of a string into a binary number, also in the form of string.

Converts a binary number in the form of a string into a hexadecimal number, also in the form of string.

Perform bitwise AND operation between two binary numbers in the form of a string.

Perform bitwise and between two hexadecimal numbers in the form of a string.

Perform bitwise OR operation between two binary numbers in the form of a string.

Perform bitwise OR operation between two hexadecimal numbers in the form of a string.

Perform bitwise XOR operation between two binary numbers in the form of a string.

Perform bitwise XOR operation between two hexadecimal numbers in the form of a string.

Perform bitwise NOT operation to a binary number in the form of a string.

Perform bitwise NOT operation to a hexadecimal number in the form of a string.

* UPDATE 02-12-2012: I have found out many minor mistakes in some of the conversion function. Thus, I have removed the file and re-written the library as an open-source project. More details can be found here.

Here is the download link:

NumberSystem.DLL v1.0 (10 kbytes)


If you have a suggestion to expand this library, please write it down in the comments or tweet it to me, and I’ll try to include it.

How to Handle the User’s Refusal of the License Agreement/Privacy Policy in WP7 Apps

Its a good idea to put the apps privacy policy, or license agreement or whatever you need the user to agree on before using the app, in a separate page and navigate to it in the first run.
There are two scenarios to do this, you either set the privacy policy page as the default and check if the user agreed on it on every run using the IsolatedStorageSetting. If the user did agree, the app navigates to the MainPage. Personally, I do not prefer this way because the privacy page is loaded on every run.
The more feasible scenario is to load the MainPage and during its loading, check if the user have agreed on the policy or not. If not, the app navigates to the policy. Sounds simple, doesnt it? No its not.
What should happen if the user reject the agreement? The app should close itself, right? Sorry, this can not happen in Silverlight apps (its possible in XNA though). There is not single command in Silverlight that gets the app to shutdown.
There is a possible solution to go around this. First of all, we will be using the second scenario where the app’s MainPage is loaded first and after checking the IsolatedStorageSettings, the app navigates to the privacy policy page. If you are not familiar with IsolatedStorageSettings, there is a very simple tutorial that was put together by the good folks at WindowsPhoneGeek.

You can create a setting called “AgreedToPrivacyPolicy” and assign to it a “TRUE” value after the user agrees to it. The main trick here is that on the policy page you should put only one button “I Agree”. Do not put an “I Don’t Agree” button because there is no command to handle it straight forward. To facilitate the use of the IsolatedStorageSettings in the application, identify the settings in the “Partial Public Class MainPage” like this:

In the MainPage_Loaded sub put the code:

Line 6 is very important, and I will explain to you why later on.
After navigating to your privacy policy, the user clicks on I agree and in the button_click sub you add the lines:

If the user wishes to reject the privacy policy, the user will hit the back button. This would navigate the app to the MainPage and the checking that we added earlier will be invoked again, and again this will navigate the user to the privacy policy page, where it should in fact take the user out of the app. This can be easily achieved by adding the following code to the PrivacyPolicy_Loaded sub:

Line 2 here removes the MainPage from the back list such that when the user presses back, the user goes directly out of the app without invoking an exception. This is, in my opinion, the best way to exit and application.
One more thing is the case where the user accepts the agreement and then the app navigates to the MainPage. What happens if the user presses back from there? Will the user be navigated back to the PrivacyPolicy page? The answer is NO. Because we covered that already in line 6 in the first code snippet in this article. We told the MainPage to check if there is a previous page in the Back Stack and if there is, erase it.

The KeyCode Glitch in Windows Phone 7

Mobile application development is a very new field for me. Being a university professor has got me through some VB courses that were not so deep, but I might not call myself a professional developer. Anyway, few weeks ago I had an increasing interest in mobile application development and I decided to start with WP7 development because I had some experience in the VB environment.

I installed the Visual Studio 2010 Express for Windows Phone. I started having some trouble when I needed to get a TextBox (which is a simple text entry space) to receive only numbers from the user and not allow the user to enter anything but numbers.

A simple solution would be the use of an event called KeyDown that is triggered whenever a key is pressed. Afterwards, I need to filter the pressed key such that if it is a number, it would pass, and any other key would be ignored. The easiest way to do this is through the key codes from 48 to 57 which are the correspondent codes to the keys “0”, “1”, “2”,….”9″. So I wrote a simple line of code to do the required:

This line basically ends the handling of the key that is pressed if it is not a digit.
What came as a shock to me was that when testing the app on the emulator on the computer, I found out that other characters (some symbols) where also showing up in the textbox along with the numbers. Symbols like ( ) $ % where also “pressable” in the text box. After digging for a while, I found out that these symbols had the same key codes as the digits ..!!!
To get a solid ground of this finding, I created a simplified app that simply shows the key code of the key that you are pressing on the virtual keyboard. Yes. Numbers and few symbols have the same key codes. After testing, the numbers and the symbols having the same key codes such as were frustrating; number 2 and @, number 3 and #, and all the others. The capital and small letters also have the same codes.
Apparently, I was not the only one who had this few other developers also had that issue. Since I have not yet received my Windows phone, I was not able to confirm that this is an Emulator glitch or an OS glitch.
If you have an unlocked Windows phone and Visual Studio, and you would like to confirm, or deny, that issue, download the .xap file of the app I did to view the codes of pressed keys and comment back in here. Here is the app download link to the KeyCodeDisplay.xap.

Moving on to the app development, if you are wondering how to go around this in the WP7 app that you are developing, here is one of the solutions. Use an event called KeyUp instead of the KeyDown used earlier, and put this code in it

I know that changing the InputScope can handle the situation with a PhoneNumberInputScope, but still the special characters such as “.” can cause you a problem. Another case is when you need a limited number of characters to be acceptable instead of the whole keyboard. I needed to use a similar method in my app PassworderPro when I had to create a textbox that accepts only capital letters.

Sending Error Reports from Windows Phone 7 Application

Sometimes it impossible to test for ALL possible exceptions. Sometimes you test on a device and it works, and another device gives a certain exception. In most cases, it is useful for the developer to receive error reports from users. This, of course, happens with the user’s will to cooperate by sending an email containing the exception details.

The simple code I put together is in VB (yes I am an antique-collecting dude who just loves VB), prepares an email for the user to be sent to your support email. Sometimes I am really frustrated how almost all WP7 development article give C# codes.

this code goes into “App.xaml.vb” to handle all unhandled exceptions by displaying a messagebox to the user asking him/her to send the details of the error to the developer.

You have to put this as the first line in your App.xaml.vb :

Afterwards, you’re good to go.