Author Archives: Nicolas Riousset

How to fix download issues to your Verifone terminal ?

So, you just started Verifone development, and you’re trying to download your first “hello world” application to your Verix or eVo terminal. You’ve got your terminal connected to your PC RS-232 port using the verifone download cable, your application and its signature file are ready, and you run the ddl.exe command from the eVo/Verix SDK, something like :

ddl *GO=HelloWorld.out Debug\HelloWorld.out debug\HelloWorld.out.p7s

And all you get is an endless dot progress bar, with no download ever happening. Continue reading

How to fix error “L6221E: Execution region CODE overlaps with Execution region DATA” ?

Your Verifone Verix application was working just fine, until a small change caused the linker to fail with the following error :

Error: L6221E: Execution region CODE overlaps with Execution region DATA

ARM DS5 or ARM WorkBench doesn’t give you more explanations, but you noticed that reverting your change solves the issue. You are most likely working on a project whose original code wasn’t written by you, and you have no clue about the source of the problem.

First, take a look at the ARM website for more info about this error.

The issue comes from an increase of the size of the executable code triggered by your last change. Continue reading

How to delete from a table records which do not exist in another one ?

So, you want to delete records from a table when they are not in another one. To cleanup orphans for example.

The query is easy to write, but depending on the implementation, it may be really slow.

Let’s say you have two tables, A and B, with an “ident” prmary key column in each of them. You want to delete from A records whose “ident” is not in B.

The easiest way is to write :
[code lang=”sql”]
SELECT *
FROM A
WHERE NOT EXISTS ( SELECT * FROM B WHERE B.Ident = A.Ident)
[/code]
Another way :
[code lang=”sql”]
DELETE
FROM A
WHERE A.Ident NOT IN ( SELECT B.Ident FROM B )
[/code]
However, if both queries are corrects, they may be really long execute. That’s because for each record in A, the query must go through all the records in B to ensure there’s no match.

The following query is much faster, since we don’t use a “NOT IN” query, but a “IN” query. The subquery can be constructed once for all, and not for each records, and the comparison stops as soon as the record is found:
[code lang=”sql”]
DELETE
FROM A
WHERE A.Ident IN (SELECT A2.Ident from A A2 LEFT JOIN B on A2.Ident = B.Ident WHERE B.Ident IS NULL)
[/code]
 

Creating a new document in a MDI application

Suppose you want to create a new document manually in your MDI application. The following code allows to do this. It assumes that theApp is a CWinApp derived class holding a pointer m_pMyDocTpl to the CMultiDocTemplate which will instantiate your document. But you can use the CWinApp::GetFirstDocTemplatePosition() and CWinApp::GetNextDocTemplate() functions to select the type of document template.

CMultiDocTemplate* pDocTpl = theApp.m_pDocTpl;
CDocument* pDoc     = pMyDocTpl->CreateNewDocument();
CFrameWnd* pFrame   = pDocTpl->CreateNewFrame( pDoc, NULL);
pDocTpl->InitialUpdateFrame( pFrame, pDoc);