Follow me on Twitter RSS FEED

Arabic currency conversion from numbers to letters

Posted in By waelouf 0 comments

Original Post on CodeProject


Introduction

This project can be useful in many applications, like ERPs, financial applications, or any application used by Arabic speakers to display any number "as digits to characters", which is called - in some Arab countries - "tafqit" or "تفقيط".

Background

It's known that to write a number in Arabic characters, it's a little bit hard, as a number like 123 is written in English as "One Hundred twenty three", but in Arabic, it will be "One Hundred and three and twenty". So, for a big number - say 7 digits - it will be a little bit confusing to write it in this complicated form.

Using the code

The advantage of this code that it's pure SQL , so it will be easy to add it to any function, Stored Procedure, or View. Also, it can be used in both web and Windows applications. To use the code, first run the attached script in the desired database and then use the function called currency_conversion like this:

SELECT dbo.currency_conversion(12.10)


In the last example, the output will be:

currency
------------------------------------------
اثني عشر جنيها و عشره قرشا

(1 row(s) affected)


Points of interest

As I mentioned before, this function can be used in both Windows and web applications as it is just a SQL function. Also, as it's a scalar function, it can be used in both Views and Stored Procedures. You can also modify the script to fit your country's currency; just replace "Egyptian Pound" with your currency

Finally, to download the script, click HERE

The script contains the required table and functions, run it on any database (good or new) and then you can use the function mentioned before (SELECT dbo.currency_conversion(@number))

I hope this is useful.

Unforgivable Bug in Google Calendar Gadget !!!!!!

Posted in By waelouf 0 comments


This bug from Google Desktop, "Google Calendar Gadget V2.0", suddenly I discovered that April have 2 days 29th, and do not ask me how!!!!

Microsoft and Twitter

Posted in By waelouf 0 comments




It seems that Microsoft (specially MSDN) have a kind of tracking to all twitter users who use Visual Studio 2008, if you Added any update containing #VS2008, after couple of hours you will find "MSDN_Forum" follows you.

Adding Microsoft Report Viewer in Microsoft Visual Web Developer Express 2008

Posted in By waelouf 8 comments

If you want to use Microsoft Report viewer by the free version of Microsoft Visual Studio 2008 (Microsoft Visual Web Developer 2008), you cannot !!! because you will not find the reports tab in the toolbox, even you cannot add a new report because the reporting module is completely unavailable in this "Express" version, but I got a simple way to be able to host a report in your application.

First you will need to install Microsoft Report Viewer from here, once you download it you will have the Microsoft.ReportViewer DLLs in your GAC (Global Assembly Cash), next step is to get these DLLs from you GAC to can use it in your application as following:

1- Open your Command Propmpt and write:
CD C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms
If you run the command "dir" here you will find two folders




















These are the two versions of Report Viewer for both visual studio 2005 and 2008, 8.0.0.0 for VS 2005 and 9.0.0.0 for VS 2008.

Next step is to copy the required DLL (Whether 8.0.0.0 or 9.0.0.0 according to the version of web express you are using), then go inside the desired folder, and copy the dll to a destination (check the picture):



















Since you get the dll ... go copy and paste it in in your project, then add a new a new tab in your project, and make the reference to this dll inside the project


















One last step, in the web.config => (system.web/httpHandlers part) add:


add verb="*"
path="Reserved.ReportViewerWebControl.axd"
type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"


That's it ... I wish you good luck :)

Disable F1 effect (help) from browser using javascript

Posted in By waelouf 2 comments

This is a simple way to disable the default help in browser if you want to create your own help :)
Most of the code I "borrowed" from Dan Bartels' Blog and just make couple of modifications on it.

enjoy it


document.onhelp = new Function("return false;");
window.onhelp = new Function("return false;");
document.onkeydown = function (evt) {
if (evt == null) evt = event; if (testKeyCode(evt, 112)) //F1
{
cancelKeyEvent(evt); //don't allow default help popup by F1
alert(navigator.appName); alert("This is the new help");
return false;
}
}

function cancelKeyEvent(evt) {
if (window.createPopup) evt.keyCode = 0;
else evt.preventDefault();
}
function testKeyCode(evt, intKeyCode) {
if (window.createPopup) return evt.keyCode == intKeyCode;
else return evt.which == intKeyCode;
}