http://automated-chaos.blogspot.com/2008/06/qtp-iban-validation-in-vbscript.html
"June 25, 2008
QTP: IBAN validation in VBScript
IBAN stands for International Bank Account Number and is the old new toy of the banking community. Also hot in Europe because of SEPA. IBAN should make life easier, and maybe it does. For IT guys, IBAN is just another standard. And despite IT guys like standards (that is why they have so many of them), IBAN is a standard designed by the banking people making things a little more complicated.
The things you want to do with IBAN is validate it or just calculate the checksum on your own. The formula for the checksum is not very complex, but has some twists in it. For example, when dealing with Alpha characters, the A is transposed to 10, the B to 11 etc. In the IT world, we would transpose A to 65, B to 66… The things you don't want is validate them exactly right for for every country on this little planet. Maybe they want it, but definitely, you don't. And if they want it, get yourself a new toy called SOAP and connect to it through a service.
After searching the internet, I discovered that code for IBAN validation through any Visual Basic language was rare. I gathered the snippets I found useful and created my own IBAN functions.
How it works is all in the comments in the code, keeping your scripts maintainable and documented if you want to use it:
' This code was created by Bas M. Dam and first published on
' http://automated-chaos.blogspot.com
' You can use and distribute this code freely, as long as you
' keep this commentblock intact.
' RETRIEVING THE CHECKSUM
' There are two methods to get the checksum. The first is the
' one used in automated processes where there is an iban prototype.
' the checksum is replaced by zeros:
' MsgBox getIBANchecksum("LC00BANK1234567890", empty) 'returns 86
' The other way is a more user fiendly appraoch if only the separate
' segments are known like bank code or clearing house:
' MsgBox getIBANchecksum("BANK1234567890", "LC") 'returns 86
' CREATE AN IBAN NUMBER
' This is implemented in the makeIBAN() function for your convenience
' Msgbox makeIBAN("LC", "BANK", empty, "1234567890")
' returns LC86BANK1234567890
' Or just the simple implementation:
' Msgbox makeIBAN("LCBANK1234567890", empty, empty, empty)
' returns LC86BANK1234567890
' CHECK AN IBAN NUMBER
' And finally, you want to check if something is IBAN. You can
' use the getIBANchecksum function for it. If the result is 97,
' then you have a real IBAN, when it returns -1, there is something
' wrong with the IBAN and if it returns another number, the checksum
' is not correct
' Msgbox getIBANchecksum("LC86BANK1234567890", empty) 'returns 97
' Msgbox getIBANchecksum("LC68BANK1234567890", empty) 'returns 18
' Msgbox getIBANchecksum("LC68BANK1234567891", empty) 'returns 88
' Msgbox getIBANchecksum("LC86BANK123456789%", empty) 'returns -1
' To do this the simple way, you can make use of the isIBAN() function
' that simply returns True or False:
' Msgbox isIBAN("LC86BANK1234567890") 'returns True
' Msgbox isIBAN("LC68BANK1234567890") 'returns False
' Msgbox isIBAN("LC86BANK123456789%") 'returns False
' SPECIAL CHARACTERS
' You can use typographical characters as stated in the skipChars string.
' For now, the following characters can be used: space.-_,/
' These characters are often used to make an IBAN more readible, but are
' not taken into the checksum calculation. between the landcode
' and checksum, never a typographical character can be used.
' Msgbox isIBAN("LC86 BANK 1234 5678 90") 'returns True
' Msgbox isIBAN("LC86BANK1234.56.78.90") 'returns True
' Msgbox isIBAN("LC-86-BANK-1234-567890") 'returns False, there can not
'be a separation char between
'landcode and checksum.
' Msgbox isIBAN("LC*86*BANK*1234*567890") 'returns False, * is not a special char
' Function to check on an IBAN
Public Function isIBAN(sIban)
isIBAN = (getIBANchecksum(sIban, empty) = 97)
End Function
' Function to create an IBAN. Any of the arguments can be empty, as
' long as the first not empty argument starts with the landcode
Public function makeIBAN(landcode, bankcode, sortcode, accountnr)
dim realLandcode, sPurged
sPurged = mid(landcode & bankcode & sortcode & accountnr, 3)
realLandcode = left(landcode & bankcode & sortcode & accountnr, 2)
makeIBAN = realLandcode & getIBANchecksum(sPurged, realLandcode) & sPurged
End Function
' Function to get an IBAN checksum. Landcode can be empty, but then, the landcode
' must be included in the first two characters of sIban, followed by two zero's
Public Function getIBANchecksum(sIban, landcode)
Dim sLCCS 'Land Code and Check Sum
Dim sIbanMixed
Dim sIbanDigits
Dim char
Dim i
Dim skipChars
skipChars = " .-_,/"
' Marginal length check
If Len(sIban) < 5 Or Len(sIban) > 35 Then
getIBANchecksum = -1
Exit Function
End If
If landcode = empty Then
sLCCS = Left(sIban, 4) ' Extract land code and check sum
sIbanMixed = Right(sIban, Len(sIban) - 4) & UCase(sLCCS)
else
sLCCS = landcode & "00"
sIbanMixed = sIban & UCase(sLCCS)
End If
For i = 1 To Len(sIbanMixed)
char = Mid(sIbanMixed, i, 1)
'Check on digits
If IsNumeric(char) Then
sIbanDigits = sIbanDigits & char
'Check on typographical characters
elseif instr(skipChars, char) Then
'skip this character, but continue
'Check on non-uppercase other characters
elseif Asc(char) < 65 OR Asc(char) > 90 then
getIBANchecksum = -1
Exit function
'Transform characters to digits
else
sIbanDigits = sIbanDigits & (Asc(char) - 55)
End If
Next
getIBANchecksum = 98 - largeModulus(sIbanDigits, 97)
End Function
' Calculates the modulus of large integers that are actually
' strings. Also usefull for implementation in Excel VBA
' (there is a known bug in Excel and large number modulus)
Private Function largeModulus(sNumber, modulus)
Dim i, sRebuild(), j, r
j = 0
sNumber = cStr(sNumber)
For i = 1 To Len(sNumber) + 6 Step 6
ReDim Preserve sRebuild(j)
sRebuild(j) = Mid(sNumber, i, 6)
j = j + 1
Next
r = sRebuild(0) Mod modulus
For i = 0 To UBound(sRebuild) - 1
r = (r & sRebuild(i + 1)) Mod modulus
Next
largeModulus = r
End Function
The knowledge about the IBAN validation and some code tricks I retrieved from the internet, so it is my turn to to give it back to the community. The functions are also useful in Excel VBA, but not extensively tested. The isIBAN() function is great to use it in your spreadsheet itself, or use it as conditional formatting:"
I will put this code into Excel file, instead of doing it as manual before. Woa, so many ideas today, too many stuffs need to do, which is good worth for doing?
Leadership & Project Management
Saturday, September 27, 2008
Testing Dashboard and Test Automation Framework ideas
I got into a nice testing blog
http://abouttesting.blogspot.com/
Right here, he has a nice post on the idea to create a Testing Dashboard, it is really useful to Test Leader or even Test Manager, who will make a plan for testing effort, and decide product delivery on some critical specs.
What I really can use, apply right now is to apply into our "Test Summary Report", and "Task Allocation, Assignment". I will put together some formulas to show the Critical, Serverity, Priority, etc. information base on the input/output data test requirements
And here I got some new ideas to improve my current Automation Framework
"
Here is a brief description what happens when running tests using my test automation framework (and some future plans).
Data model:
Each test suite has one or more test scenarios which has one or more test cases.
When running test suites, a unique test run is created which has one or more test case execution queues.
All data is in a MS SQL Server database.
In automation GUI:
1. Select run mode, New or Resume (If resume select a test run which is not completed).
2. Select one or more test suites if New.
3. For each test suite select test level, test days duration, test environment and test tool if New.
4. For each test tool instance, select global run options like reporting, e-mail etc.
5. Press run button for each test tool instance which is not aleady running.
6. Test run is started for each test tool instance via Scheduled tasks.
For each test tool:
7a. Execute each test case in queue until all is executed or cancelled (could happen if a prevoius nested test case fails).
In test run report GUI:
7b. Follow test run progress during run-time (now also reporting at step basis).
In test case dashboard GUI:
7c. Latest test case result are shown during run-time for each version och configuration.
Known limits:
Parallel execution is not implemented (you cannot use multiple test tool instances for a test run in order to decrease test execution time).
Supported tools:
QTP
TestBatchRunner (home made tool for running java batch jobs)
TestAPIRunner (home made tool for Web Service, XML API and http requests)
Future plans:
Implement support for more tools (thinking of trying Selenium).
Learn Java and OO (natural language choice since our AUT is written in Java and allowing for more collaboration with Development).
Rewrite test framework using OO-concept in Java (currently in VBScript and JavaScript) if Selenium works OK
"
http://abouttesting.blogspot.com/
Right here, he has a nice post on the idea to create a Testing Dashboard, it is really useful to Test Leader or even Test Manager, who will make a plan for testing effort, and decide product delivery on some critical specs.
What I really can use, apply right now is to apply into our "Test Summary Report", and "Task Allocation, Assignment". I will put together some formulas to show the Critical, Serverity, Priority, etc. information base on the input/output data test requirements
And here I got some new ideas to improve my current Automation Framework
"
Here is a brief description what happens when running tests using my test automation framework (and some future plans).
Data model:
Each test suite has one or more test scenarios which has one or more test cases.
When running test suites, a unique test run is created which has one or more test case execution queues.
All data is in a MS SQL Server database.
In automation GUI:
1. Select run mode, New or Resume (If resume select a test run which is not completed).
2. Select one or more test suites if New.
3. For each test suite select test level, test days duration, test environment and test tool if New.
4. For each test tool instance, select global run options like reporting, e-mail etc.
5. Press run button for each test tool instance which is not aleady running.
6. Test run is started for each test tool instance via Scheduled tasks.
For each test tool:
7a. Execute each test case in queue until all is executed or cancelled (could happen if a prevoius nested test case fails).
In test run report GUI:
7b. Follow test run progress during run-time (now also reporting at step basis).
In test case dashboard GUI:
7c. Latest test case result are shown during run-time for each version och configuration.
Known limits:
Parallel execution is not implemented (you cannot use multiple test tool instances for a test run in order to decrease test execution time).
Supported tools:
QTP
TestBatchRunner (home made tool for running java batch jobs)
TestAPIRunner (home made tool for Web Service, XML API and http requests)
Future plans:
Implement support for more tools (thinking of trying Selenium).
Learn Java and OO (natural language choice since our AUT is written in Java and allowing for more collaboration with Development).
Rewrite test framework using OO-concept in Java (currently in VBScript and JavaScript) if Selenium works OK
"
Những website nên theo dõi mỗi tháng
NGO
http://ngocentre.org.vn/
Technology & Communication Update
http://www.tmcnet.com/
Vietnam Testing Board
http://www.vietnamesetestingboard.org/zbxe/?mid=welcome
This is for technical update
http://www.sqaforums.com/postlist.php?Cat=0&Board=UBB20
http://lehongphong.net/forums/forumdisplay.php?f=14
https://www.myacm.org/dashboard.cfm?svc=services&CFID=94441&CFTOKEN=53091900
http://acmsel.safaribooksonline.com/
http://www.taitran.com/blog/
http://www.buunguyen.net/blog/
http://myproclub.com/duysblog/
If you want to find any car racing poster? the link below
http://www.posterclassics.com/i2/Monaco-Gran-Prix-Posters-by-Turner.html
News on IT, Grow through acquisition, Partner Recruitment Strategy, etc.
http://www.everythingchannel.com/software-and-services
Business News in Vietnamese
http://www.doanhnghiep24g.vn
Project Management
http://ericbrown.com/sample-projects
http://www.slideshare.net/tag/quicktest
http://www.slideshare.net/tag/qtp
http://www.slideshare.net/tag/java
http://myimpulselive.com/
http://www.zdnetasia.com/news/business/0,39044229,62057407,00.htm
http://www.devx.com/MS_Azure/Article/41863
http://www.linuxworld.com/news/2009/083109-best-of-open-source-software.html?fsrc=rss-linux-news&source=NWWNLE_nlt_linux_2009-09-02
http://www.linuxworld.com/news/2009/083109-open-source-bi-vendor-pentaho-pushes.html?fsrc=rss-linux-news&source=NWWNLE_nlt_linux_2009-09-02
http://www.apc.com/prod_docs/results.cfm?DocType=Trade-Off+Tool&keyword=Calculator
http://www.apcmedia.com/salestools/WTOL-7B6SFC_R0_EN.swf
http://vietbao.vn/Xa-hoi/Nguoi-thanh-dat-ca-biet/40028178/422/
http://www.vietmark.vn
http://www.smileandmove.com/video/
http://www.techcrunch.com/2007/07/06/facebook-users-up-89-over-last-year-demographic-shift/
http://www.digitalbuzzblog.com/fluent-the-razorfish-social-influence-marketing-report/
http://sharepoint.microsoft.com/2010/Sneak_Peek/Pages/default.aspx
http://msdnvietnam.net/
http://www.anthemww.com/about
http://tumblr.webbyawards.com/post/120724708/webby-gala-highlight-reel
http://www.hellosoursally.com/
http://ngocentre.org.vn/
Technology & Communication Update
http://www.tmcnet.com/
Vietnam Testing Board
http://www.vietnamesetestingboard.org/zbxe/?mid=welcome
This is for technical update
http://www.sqaforums.com/postlist.php?Cat=0&Board=UBB20
http://lehongphong.net/forums/forumdisplay.php?f=14
https://www.myacm.org/dashboard.cfm?svc=services&CFID=94441&CFTOKEN=53091900
http://acmsel.safaribooksonline.com/
http://www.taitran.com/blog/
http://www.buunguyen.net/blog/
http://myproclub.com/duysblog/
If you want to find any car racing poster? the link below
http://www.posterclassics.com/i2/Monaco-Gran-Prix-Posters-by-Turner.html
News on IT, Grow through acquisition, Partner Recruitment Strategy, etc.
http://www.everythingchannel.com/software-and-services
Business News in Vietnamese
http://www.doanhnghiep24g.vn
Project Management
http://ericbrown.com/sample-projects
http://www.slideshare.net/tag/quicktest
http://www.slideshare.net/tag/qtp
http://www.slideshare.net/tag/java
http://myimpulselive.com/
http://www.zdnetasia.com/news/business/0,39044229,62057407,00.htm
http://www.devx.com/MS_Azure/Article/41863
http://www.linuxworld.com/news/2009/083109-best-of-open-source-software.html?fsrc=rss-linux-news&source=NWWNLE_nlt_linux_2009-09-02
http://www.linuxworld.com/news/2009/083109-open-source-bi-vendor-pentaho-pushes.html?fsrc=rss-linux-news&source=NWWNLE_nlt_linux_2009-09-02
http://www.apc.com/prod_docs/results.cfm?DocType=Trade-Off+Tool&keyword=Calculator
http://www.apcmedia.com/salestools/WTOL-7B6SFC_R0_EN.swf
http://vietbao.vn/Xa-hoi/Nguoi-thanh-dat-ca-biet/40028178/422/
http://www.vietmark.vn
http://www.smileandmove.com/video/
http://www.techcrunch.com/2007/07/06/facebook-users-up-89-over-last-year-demographic-shift/
http://www.digitalbuzzblog.com/fluent-the-razorfish-social-influence-marketing-report/
http://sharepoint.microsoft.com/2010/Sneak_Peek/Pages/default.aspx
http://msdnvietnam.net/
http://www.anthemww.com/about
http://tumblr.webbyawards.com/post/120724708/webby-gala-highlight-reel
http://www.hellosoursally.com/
Thursday, September 25, 2008
Cannot XManager into Solaris box
It's funny stuff, but somehow it would be useful, if you are new with Solaris
I tried to xmanager into Solaris box, but i got no response from the xmanager server
1/ I did exported DISPLAY to the local server by using IP address to avoid any miss DNS resolution. But it was unsuccessful
#DISPLAY=172.x.x.x:0.0
export DISPLAY
2/ I log into system by using SSH, check the DNS resolution. I nslookup the computer name 'pha3-1', it returned right IP. But when i nslookup the IP, it didn't return the right computer name ;-), fix it
3/ Again, I tried to xmanager, perfect, i appeared the login screen, but I wasn't able to login by root
4/ Then I back to SSH console, then check /etc/default/login, find CONSOLE=/dev/console, woa, it doesn't permit to login by root, # it
Finally, I was able to xmanager by root to Solaris box
Updated Sept 26, 2008
Today, i tried to xmanager int RHEL5, and face another problem, "cannot login"
SOLUTIONS:
----------
vi /etc/gdm/gdm-config
add tag
[xdmcp]
Enable=true
[security]
AllowRootLogin=true
Then restart X-Window
#init 3
#init 5
Ref links:
http://www.netsarang.com/products/xmg_faq.html
Tip and Trick: i cannot find any tag with name [security] in the /etc/gdm/gdm-config
then i went into /usr/share/gdm/defaults.conf. Then i saw the tag, and default parameter as well. Without this tag, you can only xmanager without root permission
I tried to xmanager into Solaris box, but i got no response from the xmanager server
1/ I did exported DISPLAY to the local server by using IP address to avoid any miss DNS resolution. But it was unsuccessful
#DISPLAY=172.x.x.x:0.0
export DISPLAY
2/ I log into system by using SSH, check the DNS resolution. I nslookup the computer name 'pha3-1', it returned right IP. But when i nslookup the IP, it didn't return the right computer name ;-), fix it
3/ Again, I tried to xmanager, perfect, i appeared the login screen, but I wasn't able to login by root
4/ Then I back to SSH console, then check /etc/default/login, find CONSOLE=/dev/console, woa, it doesn't permit to login by root, # it
Finally, I was able to xmanager by root to Solaris box
Updated Sept 26, 2008
Today, i tried to xmanager int RHEL5, and face another problem, "cannot login"
SOLUTIONS:
----------
vi /etc/gdm/gdm-config
add tag
[xdmcp]
Enable=true
[security]
AllowRootLogin=true
Then restart X-Window
#init 3
#init 5
Ref links:
http://www.netsarang.com/products/xmg_faq.html
Tip and Trick: i cannot find any tag with name [security] in the /etc/gdm/gdm-config
then i went into /usr/share/gdm/defaults.conf. Then i saw the tag, and default parameter as well. Without this tag, you can only xmanager without root permission
Wednesday, September 24, 2008
Finding 1 candidate for QA position, good in system-programming (C#, C++) and Unix/Linux, DBMS is a plus
As my understand so far, there are many good candidates, they have their own blog, so i would use this chance to recruite them. I will search around blog Yahoo 360*, Blogger, Opera to find candidate, anyway, if you like this information, or know someone else, please drop me a message
This position is to work for CSC Vietnam, the most competitive, and attractive company in Vietnam
This position is to work for CSC Vietnam, the most competitive, and attractive company in Vietnam
Tuesday, September 23, 2008
Travel: some interesting, useful pages/links
Subscribe to:
Posts (Atom)