Thursday, May 28, 2009

MFC - More dialogbox - Modal and Modeless

Summary from codersource.net

class MyTestDialog: public CDialog
{
}

Modal Dialogbox:
At the location where the dialog is intended
MyTestDialog dlg;
dlg.DoModal();

Modeless Dialogbox:
At the location where the dialog is intended
MyTestDialog *dlg;
dlg = new MyTestDialog;
dlg->Create(IDR_MYTESTDIALOG);
dlg->ShowWindow(SW_SHOW);

Basic MFC...Barebone

Single Doc Application:

class myWindow: public CFrameWnd
{
}

class myApp: public CWinApp
{
public:
BOOL InitInstance()
{
m_pMainWnd = new myWindow();
m_pMainWnd->ShowWindow(SW_SHOW);
return TRUE;
}
}

Dialog based Application:

class myDialog: public CDialog
{
}

class myApp: public CWinApp
{
public:
BOOL InitInstance()
{
myDialog dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
// handle return from dlg here
return FALSE; // NOTE: Program ended when the dlg is closed
}
}

m_pMainWnd is a member of CWinThread.

Tuesday, May 19, 2009

QuickFixJ Setup

Setup to run QuickFixJ example codes in NetBeans 6.5.1:

1. Download the QuickFixJ binary and source packages and extract it.

2. Create a new project in NetBeans IDE. Let's call it QuickFixJSamples

3. Add these paths:
Source path: quickfixj\examples\src\main\java\
Library: All .jar files under quickfixj\ and quickfixj\lib\

At this point, all samples can be built and executed. But since they are all in one project, there's no practical use of it. Let's toss it.

So to run the 3 samples independently, do this:

1. Create 2 projects:
Banzai:
Copy the banzai example source codes from quickfix to the project src. You should have:
$ProjectFolder\Banzai\src\quickfix\examples\banzai\ui\
Set Main class: quickfix.examples.banzai.Banzai

Executor:
Copy the executor example source codes from quickfix to the project src. You should have:
$ProjectFolder\Executor\src\quickfix\examples\executor\
Set Main class: quickfix.examples.executor.Executor

Build the projects, you get the .jar that can be executed by:
java -jar "$ProjectFolder\Executor\dist\Executor.jar"
java -jar "$ProjectFolder\Banzai\dist\Banzai.jar"

Banzai and Executor talk to each other. The execution price was set to 12.3 somewhere in the code. This should come from realtime database.

Thursday, May 14, 2009

Install interdependent packages

Install interdependent packages

rpm -Uvh glibc-2.2.4-19.3.i386.rpm glibc-common-2.2.4-19.3.i386.rpm --nodeps

rpm -Uvh glibc-2.9-3.i386.rpm glibc-common-2.9-3.i386.rpm --nodeps

Remove packages

rpm -e glibc
(Note: only the name of the package.)