converter

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:

[crayon lang=”vb”]Public Shared Function Dec2BinStr(ByVal Dec As Long) As String[/crayon]

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

[crayon lang=”vb”]Public Shared Function Dec2BinAry(ByVal Dec As Long) As Integer()[/crayon]

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

[crayon lang=”vb”]Public Shared Function BinStr2Dec(ByVal Bin As String) As Long[/crayon]

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

[crayon lang=”vb”]Public Shared Function BinAry2Dec(ByVal Bin() As Integer) As Long[/crayon]

Converts a binary array into a decimal number.

[crayon lang=”vb”]Public Shared Function HexStr2Dec(ByVal Hex As String) As Long[/crayon]

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

[crayon lang=”vb”]Public Shared Function Dec2HexStr(ByVal Dec As Long) As String[/crayon]

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

[crayon lang=”vb”]Public Shared Function HexStr2BinStr(ByVal Hex As String) As String[/crayon]

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

[crayon lang=”vb”]Public Function BinStr2HexStr(ByVal Bin As String) As String[/crayon]

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

[crayon lang=”vb”]Public Function BinStrAnd(ByVal Bin1 As String, ByVal Bin2 As String) As String[/crayon]

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

[crayon lang=”vb”]Public Function HexStrAnd(ByVal Hex1 As String, ByVal Hex2 As String) As String[/crayon]

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

[crayon lang=”vb”]Public Function BinStrOr(ByVal Bin1 As String, ByVal Bin2 As String) As String[/crayon]

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

[crayon lang=”vb”]Public Function HexStrOr(ByVal Hex1 As String, ByVal Hex2 As String) As String[/crayon]

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

[crayon lang=”vb”]Public Function BinStrXOR(ByVal Bin1 As String, ByVal Bin2 As String) As String[/crayon]

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

[crayon lang=”vb”]Public Function HexStrXOR(ByVal Hex1 As String, ByVal Hex2 As String) As String[/crayon]

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

[crayon lang=”vb”]Public Function BinStrNot(ByVal Bin As String) As String[/crayon]

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

[crayon lang=”vb”]Public Function HexStrNot(ByVal Bin As String) As String[/crayon]

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.

App: Hijri

Hijri

 Hijri for Windows Phone and Hijri Converter for Windows 8


* If you like Hijri for Windows phone, you might also like Saudi Calendar app (التقويم السعودي).

Hijri is a simple application that performs conversion between Hijri and Gregorian dates. It provides a simple interface to convert Hijri-to-Gregorian and Gregorian-to-Hijri dates.

Hijri (for Windows Phone):

In v1.1 a nice feature was added to the converter. This feature is a live tile that shows you today’s date in Hijri, and updates automatically.

The v1.0 of this application used the online service provided by IslamicFinder.org because of the high accuracy of the conversion on this site. Anyway, starting from v1.1, I have moved the service to my own private server so that the conversion is much faster now.

Starting from version 2.0, the conversion is being done using the open API conversion service provided by www.HijriCal.org. The conversion methods used by the HijriCal.org API are:

1. Um-Alqura Calendar (the official calendar of Saudi Arabia). This calendar provides conversion for Hijri dates from 1350 to 1500 hijri. The dates before or after that are converted using option 2.

2. The Hijri calculation method used by Center of Oriental Studies in Zurich University.

If you spot any bugs, please send me reports. Also if you have any suggestions for features to include in the next version, please feel free to contact me on   info (at) mohammedalani.com

Important Notes Regarding the live tile:

1. If you want to turn off the periodic automatic updating of the live tile, please do it from inside the applications. Do not turn the task off from the phone “Settings” menu as it would cause a conflict with the application settings.

2. If you turn off the auto-update of live tile, the live tile will be updated when you start the application.

3. In case you don’t see the date on the live tile, just wait for a few seconds, the tile will flip and show you the date on the back.

4. If you do not open the application for 14 days, the live tile will stop being updated. This is WP7 restriction, for all periodic tasks.

 

Changelog:

v2.0: (Expected Release date 1-1-2013)

* Move the conversion service to Hijrical.org.

v1.1: (Release date 25-2-2012)

* Added a live tile that shows today’s date in Hijri. This tile updates automatically, and you have the choice to enable and disable the automatic updates.

* Some UI improvements:

-Show number-only keyboard when entering day and year.

-Larger font for the month list.

* Change ads to AdMob

* Added checking for network connectivity to prevent irregular application closing.

 v1.0:

Initial release of application on 26-01-2012.

 

Marketplace Link:

http://www.windowsphone.com/en-US/apps/09c24938-538a-42ae-b9d7-2de8b828ab60

 

Hijri Converter (for Windows 8):

Extra -simple interface with online conversion for highest possible accuracy.

 

Changelog:

v1.0: (Expected Release date 12-12-2012)

* First app release.

 

Windows Store Link:

will be available on release.

 

Privacy Policy:

This application collects anonymous user stats to help improve the service provided. All data collected are anonymous and will be kept securely and not provided to any other entity.

By using this application, you are agree to this privacy policy and to the Terms of Service and Privacy Policy of HijriCal.org as the main conversion service provider.