Showing posts from 2007

Porting fron VC6 to VC7 compiler errors


Code which compiles in VC6

typedef priority_queue*,//value type
deque*>,//container type
Command::Compare > REQUESTQUEUE; //comapritor

typedef map::iterator REQUESTQUEUEITR;

std::map RequestQueue;
std::map::iterator CurrentItr;

Changes to be done to compile in VC7

typedef priority_queue*,//value type
deque*>,//container type
typename Command::Compare > REQUESTQUEUE; //comapritor

typedef typename map::iterator REQUESTQUEUEITR;

//todo make this a priority queue - priority_queue

std::map RequestQueue;
typename std::map::iterator CurrentItr;



vc7 nested class template cannot access private class declared in class

vc7 dependent name is not a type

A little Perl goes a long way

I have found Perl as very powerful language , a must in the toolkit for any programmer

Here are some Perl code snippets.

It is always better to start your perl code with

use strict;
use warnings;

With this you have to declare variable before you use them


my $SearchStep=0;
my $line;

Also if you want to use special Perl modules like for example working with ini files , you
include it

use IniFiles;

Everything is pretty simple in Perl, only thing is that the syntax can become unreadable; so
put in a lot of comments

# This is a comment

Okay let us jump in -- here is the code to open a file

my $FilePath = "system1.txt";
my $opened =open (FH, $FilePath) ;
if( !$opened)
print "Cannot open file\n";

and to read line by line from the file

my $line;
while ( $line =)
chomp ($line);

Now to test if a line matches a perl pattern


/i stands for case insensitive search.

Okay a few other matche examples ( basically the better you are at regular exp…

Java JVM high memory usage problems

Though I have some three four years experience in C++ ,I did not have
that much oppurtunity to work in Java. Currenly I was doing some
analysis for a very simple CLI and was surprised to come with a memory
restriction. I found that if I use Java for developing the CLI
application I will be exhausting the memory of our Application Server
(AS). Just to mention the architecture ,users (telecom operators) use
a metaframe server client ( =something like remote desktop) to login
to the AS and then open a GUI to work on it. With Java I can service
only about 15 clients with the available memory . I just checked the
reason for this resource crunch and found that already many Java based
GUI's are served by the AS and each is taking some 25 MB or more. The
first thing I thought is that adding more RAM will solve this ( though
this is not an easy option) . Then I understood that a 32 bit system
can have just about 3 gb ram for applciations and our AS had already 4
GB with 1.5 GB VM also configured. The…

Windebug and Adplus for debugging process hang

1. Set the symbol, especillay windows symbols

2. Set the souce and image

3. Load the extension dll ( for !locks command ) if not already loaded

.load C:\Program Files\Debugging Tools for Windows\winxp\kdexts.dll

4. Use the !ntsdexts.locks ( or !locks) command to see a list of critical section

:004> !ntsdexts.locks

CritSec ntdll!LdrpLoaderLock+0 at 7C889D94
LockCount -6902
RecursionCount 1
OwningThread 2b3c
EntryCount 0
ContentionCount 28f3
*** Locked

CritSec +12f9b4 at 0012F9B4
LockCount 0
RecursionCount 0
OwningThread 0
*** Locked

CritSec +12f70c at 0012F70C
LockCount 0
RecursionCount 0
OwningThread 0
*** Locked

CritSec +128202c at 0128202C
LockCount -2
RecursionCount 1
OwningThread 3d9c
EntryCount 0
ContentionCount 0
*** Locked

A 'LockCount' other than 0 means that many threads are waitiing on this and it is the suspect

6. Do a …

windbg command

Wednesday, 25 August 2004
To list all modules loaded by the process -LM
(shows the loaded module address also)

: WinDebug thread commands

To see all threads ~
To freeze all threads ~*F
to unfreeze thread 1 ~1U
to set the thread ~S

copying to stl list
If destination is an empty list


copy(lstOfInt.begin(),lstOfInt.end(),lstOfIntDest.begin() ); -->WRONG
copy(lstOfInt.begin(),lstOfInt.end(),back_inserter(lstOfIntDest) ); -->CORRECT

CORBA - C++ Client (ACE TAO) Java Server (JacORB) A simple example

Step 1
I downloaded the binary relaease of JacOrb
Extracted the zip file to
E:\Program Files\JacORB-2.2.4\
Step 2
Then also downloaded Ant
Also jdk was downloaded and installed
Step 3
Then created the batch file (to set the path)
Set ANT_HOME=E:\Program Files\Java_Ant\apache-ant-1.6.5
Set JAVA_HOME=E:\Program Files\Java\jdk1.5.0_03
Set JACORB_HOME=E:\Program Files\JacORB-2.2.4
----now to configure JacORB -
In the command promt
E:\Program Files\Java_Ant\apache-ant-1.6.5>ant jaco
E:\Program Files\Java_Ant\apache-ant-1.6.5>ant idlcmd
okay that’s done
Now write the idl

--- test1.idl------
module Quoter1
//a test interface
interface Stock
double price(); //to get the quote of the stock
readonly attribute string symbol;
readonly attribute string fullname;
//interface to get the stock object
exception InvalidStockSymbol {};
//to get the desired stock object …