Monday, June 27, 2011

Number to Word with MS-EXCEL (USD sample)

Continuing the previous post on how to spell number to Indonesian Words, here Me tried to share on how to do it in English.

Option Explicit
'Main Function
Function SpellNumber(ByVal MyNumber)
    Dim Dollars, Cents, Temp
    Dim DecimalPlace, Count
    ReDim Place(9) As String
    Place(2) = " Thousand "
    Place(3) = " Million "
    Place(4) = " Billion "
    Place(5) = " Trillion "
    ' String representation of amount.
    MyNumber = Trim(Str(MyNumber))
    ' Position of decimal place 0 if none.
    DecimalPlace = InStr(MyNumber, ".")
    ' Convert cents and set MyNumber to dollar amount.
    If DecimalPlace > 0 Then
        Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
                  "00", 2))
        MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
    End If
    Count = 1
    Do While MyNumber <> ""
        Temp = GetHundreds(Right(MyNumber, 3))
        If Temp <> "" Then Dollars = Temp & Place(Count) & Dollars
        If Len(MyNumber) > 3 Then
            MyNumber = Left(MyNumber, Len(MyNumber) - 3)
        Else
            MyNumber = ""
        End If
        Count = Count + 1
    Loop
    Select Case Dollars
        Case ""
            Dollars = "No Dollars"
        Case "One"
            Dollars = "One Dollar"
         Case Else
            Dollars = Dollars & " Dollars"
    End Select
    Select Case Cents
        Case ""
            Cents = " and No Cents"
        Case "One"
            Cents = " and One Cent"
              Case Else
            Cents = " and " & Cents & " Cents"
    End Select
    SpellNumber = Dollars & Cents
End Function
     

Number to Word with MS-EXCEL (IDR sample)

This is the function to make my life easier (in the Excel Term though :^_^):
Function Terbilang(n As Long) As String 'max 2.147.483.647
    Dim satuan As Variant, Minus As Boolean
    On Error GoTo terbilang_error
   
    satuan = Array("", "Satu", "Dua", "Tiga", "Empat", "Lima", "Enam", "Tujuh", "Delapan", "Sembilan", "Sepuluh", "Sebelas")
    If n < 0 Then
        Minus = True
        n = n * -1
    End If
    Select Case n
        Case 0 To 11
            Terbilang = " " + satuan(Fix(n))
        Case 12 To 19
            Terbilang = Terbilang(n Mod 10) + " Belas"
        Case 20 To 99
            Terbilang = Terbilang(Fix(n / 10)) + " Puluh" + Terbilang(n Mod 10)

Wednesday, June 15, 2011

[Tips] How to find out Nokia MAC Address

Just 4 Share.

In case you want to connect your Nokia to your office's Hotspot via your mobile but they need to recognize it first by the MAC Address. So flip in and out all your Nokia's menu but won't find any related to that. What should you do?
  1. Call the service center (what a waste of time / money)
  2. Read the manual book (of course...!! But it sit nicely and warm at your drawer back at home)
  3. Ask for the service code to anyone you knew (this could be the salvation you seek, but unfortunately no one in your parameter would know that)
So here we are, trying to save you some hour of labor... The Service Code... (hurraayyy...!) :D

            *#62209526#     : MAC Address Number
            *#06#               : IMEI Serial Number


Wednesday, June 8, 2011

[Tips & Trick] PHP Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server:

As the title stated, quite a troublesome issue here at my work. Wasted quite enough time for Me to take a nap :P

All was started when Me got assigned to move certain web server to a new machine. The configurations are PHP inside the Mikocok Internet Information Services (IIS for short) using ISAPI and Mikocok SQL Server 2005 Express.

To make the story short, all preparation had been done. The MS-SQL is up and running. PHP installed using manual process, that's Unzipping the ZIP Package to C:\php, set the Windows' Path to Include it, Modified the php.ini to enable MSSQL and LDAP extensions, adding windows' Environment Variables (PHPRC=C:\php). Set the IIS to use PHP5ISAPI.DLL as a binding to PHP compiler and set the ".php" as the file extension used for PHP. Me also have checked the PHP configuration through function. All is well according the phpinfo data.

And then the merit paid-off... :(

All Me did was trying to connect to the MS-SQL DB and the Error Message goes:
PHP Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server:
Trying was all Me could do as quickly as Me could. Googling (if it even a word :D), Checking all the configs, the required files and even reinstalling the entire system to make sure all is mimicking the old one. None of them to bare any fruit.

And so days gone by to weeks, while the user is reverted to the old system. But managements are still at Me wit until this very day, when me come back to uncle Google to have another session. Finally, there's an article which me have failed to see before. Its' all about the version of one particular file which is used by the IIS to communicate with the MS-SQL DB. The One and Awesome:
NTWDBLIB.DLL (cheers and applause...!!!!)
as the article (you can find it here) said that:
"...ntwdblib.dll Version - On some systems the ntwdblib.dll version is too old to work correctly with PHP. If your version does not end in 80.194.0 it's probably too old..."
And so me check... Indeed Me version was still 2000.2.8.0! You could find this by pressing Alt+Enter at C:\php\ntwdblib.dll file.

And so Me download the file from the link provided in the above article, replace the file and Restart the IIS.And so Me problem solved. The Application is up and running now, with the DB Connection issue resolved.

For backup purpose, there was also a Mirror of the file to DOWNLOAD HERE.

[Tips & Trick] PHP Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server:

As the title stated, quite a troublesome issue here at my work. Wasted quite enough time for Me to take a nap :P

All was started when Me got assigned to move certain web server to a new machine. The configurations are PHP inside the Mikocok Internet Information Services (IIS for short) using ISAPI and Mikocok SQL Server 2005 Express.

To make the story short, all preparation had been done. The MS-SQL is up and running. PHP installed using manual process, that's Unzipping the ZIP Package to C:\php, set the Windows' Path to Include it, Modified the php.ini to enable MSSQL and LDAP extensions, adding windows' Environment Variables (PHPRC=C:\php). Set the IIS to use PHP5ISAPI.DLL as a binding to PHP compiler and set the ".php" as the file extension used for PHP. Me also have checked the PHP configuration through function. All is well according the phpinfo data.

And then the merit paid-off... :(

All Me did was trying to connect to the MS-SQL DB and the Error Message goes:
PHP Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server:
Trying was all Me could do as quickly as Me could. Googling (if it even a word :D), Checking all the configs, the required files and even reinstalling the entire system to make sure all is mimicking the old one. None of them to bare any fruit.

And so days gone by to weeks, while the user is reverted to the old system. But managements are still at Me wit until this very day, when me come back to uncle Google to have another session. Finally, there's an article which me have failed to see before. Its' all about the version of one particular file which is used by the IIS to communicate with the MS-SQL DB. The One and Awesome:
NTWDBLIB.DLL (cheers and applause...!!!!)
as the article (you can find it here) said that:
"...ntwdblib.dll Version - On some systems the ntwdblib.dll version is too old to work correctly with PHP. If your version does not end in 80.194.0 it's probably too old..."
And so me check... Indeed Me version was still 2000.2.8.0! You could find this by pressing Alt+Enter at C:\php\ntwdblib.dll file.

And so Me download the file from the link provided in the above article, replace the file and Restart the IIS.And so Me problem solved. The Application is up and running now, with the DB Connection issue resolved.

For backup purpose, there was also a Mirror of the file to DOWNLOAD HERE.