Monday, January 10, 2011

XML Vs. ISO

Coming Soon ...

Credit Card Transaction

Auth
Authorization
Capture
Pre-authorization/Post-authorization
Sale
Description Preauthorizes and postauthorizes in one step. In the U.S., an Auth is typically used for credit card purchases that do not require physical shipment of goods or for check purchases in which the processor requires an Auth transaction. For credit card transactions, an approved Auth places a hold on the account holder's “open-to-buy” balance and the purchase is immediately ready to be settled.
What You Need to Know In an Auth transaction, a PreAuth and a PostAuth are performed simultaneously. In the U.S., purchases of hard goods (that is, goods that must be shipped) must go through a PreAuth and a PostAuth in two separate steps. If you must meet this requirement, use the Auth transaction type only when you transfer products electronically, that is when you deliver soft goods. Use a PreAuth and a PostAuth for purchases of hard goods.
No funds are transferred during a Sale. Funds are transferred when a batch is settled.
ref:secure-epayments.hsbc.com
More Coming Soon ...

Monday, October 26, 2009

Coding

As a coder i am describing some point, that i faced at the time of coding.
1. Make some automation for your code, so that you can test it up-to some extend.(that will do all unit testing and can also do regression testing without help of QA people. :)).
And it is also easy to test and find bug in your code, as no user interaction required.

2. Today i faced a problem in passing a array of structure in to function. my problem that i am unable to assign a integer value to element of an structure. and the reason is, i am not initializing the structure before using it ;) .
So moral if the story "always initialize memory of all variable before using it other wise you have to fight with lots of run time or compile time bug."

3. Make Logger which can be disable/enable compile time.
For this use #define .
This will reduce code size. And your code never crash due to logs ;) .
I post the Solution with complete code here... :)
http://www.cplusplus.com/forum/general/14694/#msg78546

////////////////////////////////////////////////////////Logger.h//////////////////////////////////////////////////////
#define _ING_DEBUG_MODE_ 1

#ifdef _ING_DEBUG_MODE_
void vLogFileLine(char * pchFile, int inLineNumber);
void vLogMessage(char * pchFormat, ...);
#define LOG_ING(b) { vLogFileLine(__FILE__, __LINE__ ); vLogMessage b; }
#else
#define LOG_ING(b)
#endif




////////////////////////////////////////////////////////Logger.c//////////////////////////////////////////////////////
#ifdef _ING_DEBUG_MODE_
void vLogFileLine(char * pchFile, int inLineNumber)
{
 char FileData[100] = {"\0"} ;
 sprintf( FileData ,"File->%s Line->%d Data->" , pchFile , inLineNumber ) ;
 PrintStrGB2312(FileData,FmtHalfWidthHeight);//Print API
}
void vLogMessage(char * pchFormat, ...)
{
 short len = 0 , i = 0;
 char prnBuffer[1000] = { "\0" };
 va_list va;
 va_start(va, pchFormat);
 vsprintf(prnBuffer, pchFormat, va);
 va_end(va);
 len = 1 + (strlen(prnBuffer) / 49) ;
 while(len-- > 0)
  PrintStrGB2312(&prnBuffer[(i++)*48],FmtHalfWidthHeight);//Print API
}
#endif
////////////////////////////////////////////////////////main.c//////////////////////////////////////////////////////
void main()
{
     LOG(("anand rai")); 
     LOG(("length %d" , 1239));
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
 
4. Random number without Using rand() function.
Today i faced a problem during use of rand() function. As the SDK, i am working on doesn't support rand() function.
For the solution of this i use one method. I read system time in yyyymmddhhmmss format then add all digits and take the mode of desire range.
In this way i get the desire random number in a range.

5. Some day before i was just stuck with a problem of accessing linux m/c via window m/c.
My requirement was to copy some data from my win m/c to linux box then execute that data on linux m/c with a very small setup and in a single click.
I just Google on net and found that two thing i can use:-
Putty for commands.
PSCP for data transfer.

Then big question :- I need to do it in single click!!!
then i found that there are lots of putty and PSCP commands available that i can use in batch file which will execute by a single click. And all will be execute in background.
And size of all setups is less then 1 MB... :)
The commands are:-









hit counter