Monday, September 24, 2007

How to install Firebird ODBC Drivers

The Firebird ODBC drivers may obtain from I haven't try the Windows Full Install .exe file yet. The following are steps for manual installation. The following files are needed:
  1. IscDbc.dll
  2. OdbcJdbc.dll
  3. OdbcJdbcSetup.dll
  4. OdbcJdbc.chm
Try your best to download these files and keep in a folder. For example: c:\temp Then go to cmd prompt to perform Manual Install
cd c:\temp %windir%\system32\RegSvr32.EXE .\OdbcJdbcSetup.dll
Manual Uninstall
cd c:\temp %windir%\system32\RegSvr32.EXE /u .\OdbcJdbcSetup.dll
Always set full path for RegSvr32.EXE and always set .\ before OdbcJdbcSetup.dll After finish install, you may go to Control Panel | Administrative Tools | Data Sources (ODBC) | Drivers to make sure the Firebird ODBC Driver has installed.

Sunday, September 23, 2007

Problems running a "LARGE" win32 application compiled by Delphi in Windows 98

Windows 98 kernel is not NT kernel. There are limitations on the application resource (*.RES) size and EXE file size. Application Resource Size If you encounter:
  1. "There is not enough free momory to run this program. Quit one or more programs, and then try again" OR
  2. "There is not enough memory to start "MyApp.EXE". Quit some programs, and then try again.
But you are very sure you have more than enough memory to run the application. This is most probably you have too much resource items in the application. In Delphi application, the resource items could be DFM form, cursor, resource string and etc. From the test I did, the maximum number of resource items is 1035. The size of resource doesn't cause any problem in my test. I have try to put a 10-20 mega bytes resource in the application and it still run well in windows 98. However, if you have more than 1035 resource items even each item has size of 1 byte, you will encounter the error as well. Application File Size If you encounter:
  1. "A device attached to the system is not functioning" OR
  2. The MyApp.EXE is linked to missing export MyPackage.BPL:@MyUnit@TMyClass@...
This error occurs on Delphi application compiled with runtime packages (.BPL). It is most probably the runtime package size is too big for Windows 98 to handle. From the test I did, if my runtime package file size beyond 7-8 M, I will most probably encounter the error. Unfortunately, I have no actual figure on it. To solve the problem, try split the runtime packages to smaller size. The error message prompted will display the package, pascal unit and class that cause the problem. You can use this information to check where you should start split the package. I guess this human readable information will available only if you compile the packages with debug symbol.

Tuesday, September 11, 2007

Using TPopupMenu control in Delphi

Imagine a form that has several controls. If we right click on the control especially controls like TEdit or TMemo, a default popup menu will shown on screen with common clipboard operations like cut, copy, paste and etc. However, if we
  1. Drop a TPopupMenu component on the form
  2. Defines some menu items for the TPopupMenu component
  3. Bind the TPopupMenu component to the Form (TForm.PopupMenu)
  4. Compile and Run the application
Right click on any controls on the form will always show the PopupMenu we defined. The default popup menu will no longer shown. What if we want
  1. Right Click on Form show the TPopupMenu component
  2. Right Click on controls show the default popup menu
There are at least 2 ways to achieve that:
  1. Trap the TForm.OnMouseDown event
  2. Trap the TForm.OnContextPopup event
Both ways have similar coding but the second way is preferable and more complete. The OnMouseDown event will only trigger when we right click the mouse. However, right click is not the only way to fire the popup menu. We may use keyboard to trigger as well. Here is the coding for OnContextPopup event handler:
procedure TForm1.AfterConstruction;
Self.PopupMenu.AutoPopup := False;

procedure TForm1.FormContextPopup(Sender: TObject; MousePos: TPoint; var
Handled: Boolean);
var C: TControl;
 P: TPoint;
Handled := False;
C := ControlAtPos(MousePos, True, True, True);
if C = nil then begin
 P := ClientToScreen(MousePos);
 Self.PopupMenu.Popup(P.X, P.Y);
 Handled := True;

Sunday, September 02, 2007

Install and Configure Fedora Core 7

I love the distribution of Fedora Core 7 in DVD ISO format. Once download it, I can mount the ISO file access the contents of the FC7 files. There are plenty of installation methods. The most usual method I used is FTP or HTTP installation. To start the installation, I burn the diskboot.img to a USB flash drive (using dd - diskdump utility). The PC must support USB flash drive boot. Once up, the installation is easy and straight. With the help of virtual machine and ISO, I can setup my Fedora Core on virtual machine running on windows OS (2000, XP or Vista). Then I can setup FTP or HTTP server on virtual machine to serve as installation server. I then use the USB flash drive to boot the machine that support USB flash drive booting and start installing my Fedora Core remotely. This installation method is clean and easy, I only require a working TCP network environment. No DVD RW-Device and no wasting of a DVD-R disc. Help to save the earth, huh. However, there is a PXE installation that I haven't have time to explore it yet. The linux OS evolve in last 10 years. There are plenty of new things to learn and research. Some things that I used in last 10 years wasn't exist anymore. Especially for user like me who still use the bash shell to configure the linux OS instead of GNOME X-Windows. Logical Volume Management (LVM) I am not familiar with LVM and do not know why Fedora partition my hard drive LVM instead of the Primary partition that I am familiar with. The first problem I found it hard to use the LVM is it is not easy to mount a file system on LVM partition. If all mounted LVM has same logical volme name, I have problem to manage the LVM. Instead, I have to rename it or use the UUID of LVM. SELINUX I am not familiar with SELINUX, I turn it off usually. TELNET Telnet no longer come with Fedora since FC 6. It make us difficult to access the linux machine on windows desktop. To overcome this, I have to find a SSH client. SSH Client for Windows - Tera Terms Pro It is fast and easy. YUM YUM allows me to download and install RPMs from internet. It help to resolve the package dependencies. XINETD xinetd service wasn't come with FC7. I do not know if they have alternative ways. However, CVS service needs it. I YUM the xinetd to install it. SAMBA Samba that come with FC7 now use database to store user name and password instead of smbpasswd by default. Firebird 2.01 Firebird 2.0.1 needs compat-libstdc++-33 package X-Windows I used to access my fedora machine on my windows desktop. However, I always need to find X-Windows Client and configure my x-server to make both able to communicate with X-DMCP. It seems VNC is a new new ways to access.