Beyond My Mind

April 27, 2006

CD Selector: A “run from cd” tool

Filed under: Research — mahbub @ 3:17 pm

In my research lab we develop programs that uses `A’ geometric kernel. As the projects are inherited from previous students, most of them are built around `A’ 7, an old version with several architechtural problems. In many cases we wanted to run these programs off the CD or any removable device as we are not allowed to install `A’ in the other computers. So I created this program so that, any kind of program can run from the CD, with the dlls located in the CD. I am pasting the user manual below.

This document describes how to create applications that rely on external dlls such as `A’. In this regard it’s should be mentioned that the approach is good for any kind of dll based application.


  1. `A’ dll requires to be put into the system path. This can be achieved by copying all the relevant dlls (for debug version use files from NT_DLLD and for release version use NT_DLL files) into windows system directory or into the program directory. Copying in this manner is not good. `A’ usually uses PATH environmental variables to achieve this. But this requires administrative privileges and may not be always doable due to license restrictions. One can copy the dlls into a folder and create a BATCH file updating the path variable to include the `A’ dll directory, then calling the program. Thus the program will “see” the `A’ directory in its path and will not complain.
  2. System files may not match from the development system to other system. Specially program compiled with DEBUG switch turned on will contain debug symbol and will look for debug version of all dlls thus screwing up in other computers that don’t have the dlls with correct debug symbols.


After trying different options this seemed most suitable. An application has been developed in Visual C++ that itself is compiled as static program, so it does not depend on dlls. It reads a file named “CDSelector.inf” of the following format:



[Feature Tutor 2]




[NRep Output Generator]


[Shen’s GDT System]









The common portion is applied to all programs. The common portion sets some environment variables applicable for all applications.

The other portions starting with an enclosed name within left [ and right ] is a separate program. Each program can define as many variables as it wants to followed by a line containing the path to the program. So the CDSelector will read the “CDSelector.inf” and list down the programs as shown below:

Double click the program name or select the name and click Run to run the program. You can place comment by using “;” or “rem” in front of a line.

To solve the problem associated with system variables, trying to run the program using this CDSelector and see what error message you get. If you get a crash try to see the file name that caused the problem by clicking “Details” button note down the file name. Copy the file from the development machine, usually from windows system directory and place it inside the folder containing the application. This will hopefully solve the problem. Try running the program in different versions of Windows and different computers.

To run from a CD you can place a “Autorun.inf” inside the root of the CD containing:



icon= CDSelector.exe,0

It can be downloaded here.

Powered by Qumana

April 22, 2006

A C++ Color class for using with opengl

Filed under: Uncategorized — mahbub @ 9:05 pm

I know this is nothing new. But when I was looking for something similar to C# color class with tons of predefined color values I found one wihich somehow matches with my requirement but that was for MFC. So I took the predefined color codes from that class and added some function for my own purpose. Code project have two of them hosted there. Here are the links:

I will not paste the entire file here, just a portion. The files can be downloaded from here. Let me discuss some of the characterstic of the class

The entire class is inside Mahbub namespace. The Color class has four color components for red, green, blue and alpha. It has a option to store a name for it as well. But the memory is never allocated if no name is specified. You can use random number generator and generate random color from it. I used Mersenne Twister random number generator with it. Also I used a Mathematics wrapper class with it. I will post the Mathematics wrapper class description later. You can download it from here or just replace with appropriate function from math.h.

Here is an example usage of it:

Color a = Color::RED;


If you find it useful or have any suggestion please don’t forget to let me know, udvranto (a) yahoo.

Powered by Qumana

April 20, 2006

Programming language: language or translator?

Filed under: Uncategorized — mahbub @ 2:24 pm

This view towards the language came to my mind today while I was attending a rather boring class on an interesting topic. I had to spend last two days doing C++ coding and was thinking about it in the class. What is programming language?

When you write something in assembly language what happens? The compiler translates it into machine code and its excuted in the machine. The same notion is applied everywhere. So essentially every compiler is a translator, a mapping between two sets of instruction. I think YACC and other parser tool came out of this concept. Gotta read something on these.

Blog at