Wednesday, December 13, 2006

Bold decision ?!!#$

Today was my first day in a product company ,was busy trying to figure their(our) product architecture its huge,robust and beautyfull .Iam sure iam going to have a nicetime there,before i leave i will give you an hint of the product company ,it has got a famous CRM product .So watch out for more domain specific info on this blog .

Dont Dare!!!

So guys please dont think i have shutdown this blog iam recuperating from a financial .... ,it has nothing to do with the Sensex crashing :) :) . Keep on watching .

Tuesday, November 14, 2006

Leaving on a Jet plane

These are the lines taken from John Denver dont think iam leaving on a jet plane :).
Iam going home will be back by monday.Yahoo!!!!!!!!!!!!

Monday, November 13, 2006

Mysterious "sys" Files

I had Checked the options in the folder option dialog from the tools menu .
1.Show hidden Folders and files
2.Show hidden system files .

And in the drive were the OS is installed i saw two main files:-
1.hiberfil.sys
2.pagefile.sys

Now wat are these files they look pretty big in size.I ventured out to explore and here are my findings
1. hiberfil.sys
Wen you enable hibernation in your system ,the system compresses the system info into this file so that at startup it can load up (for persistence).
2. pagefile.sys.
This is used by the system for VM and swaping .you can set the size of this file .

More info on this will be put shortly .

Thursday, November 09, 2006

Services Information

All the information related to services that are run when the sytem boots and other information like which shouldnot run ,etc .. are stored in the registry .Next thing that comes into mind is were is it stored ,it's in HKLM\System\CurrentControlSet\Services all the keys under it have the DWORD value "start" which will be different which determines wether it needs to be run at start,suspended etc .

All the changes which we do to the services through services.msc or msconfig ( type in Run Window) changes this start flag .

Now since you are equipped with these information explore for yourself .

Registry repository

All these years i used to think were the information shown in the registry was stored :-

1. is it in a dll ( Many application store the data in dll's)
OR
2. is it in a file .

Well at last i tumbled over the files which contains those information and these are :-
1. System.dat
2. User.dat

Yes ,registry is a collection of the data present in these two files .

Vista RTM done

Atlast the long awaited vista release is done .vista has been released to the market for manufacturing of CD .
You can read more here :-
http://www.computerworld.com/action/article.do?command=viewArticleBasic&articleId=9004886&intsrc=hm_list

Monday, November 06, 2006

SUSIE Q by CCR

SUSIE Q by CCR(Credence ClearWater revival) is my latest favourite song .

My first product out

I was working on NSW -07 product for the past three months and iam pleased to anounce that my(teams) hard work has been paid of ,the beta of the Basic ,standard(With NAV) and premier (with NAV and NSR )are out Please download and let me know about your experience .Soon you can see these on your favourite shops by december .
NOTE:-
NAV - NortonAntiVirus
NSW - Norton SystemWorks
NSR - Norton Save And Restore .

Sunday, October 01, 2006

Test Post

Atlast posts are working .

Wednesday, September 27, 2006

Hi Guys

Sorry for the big delay , i was really busy with work will try to put some intresting things shortly.

Sunday, August 20, 2006

Check SafeMode

How do you check wether a system is in safe mode or not .
Check out the Api GetSytemMetrics(SM_CLEANBOOT)its return value of 0 means its in normal mode or else its in safe mode or in cleanboot.

NOTE:- This is needed because in safemode most of the services are stoped and maybe your app cant move forward without some services .
The services that are runing can be checked by typing msconfig in the run command .

Namespace a Real Boon

Sometimes it hapens that we have to use the classes provided by third party people and when two classes have the same name it leads to class redefenition compile time error and we can't change the header files because they are the root of the lib implementaion or others.

So how do you resolve this :-
namespace FirstClass
{
#include "FirstClass.h"
}

namespace SecondClass
{
#include "SecondClass.h"
}
FirstClass::CMyclass and the SecondClass::CMyClass are refering to two different classes therby resolving the compile time error.
But maybe you have to look out for the linktime error :).

NOTE:- Any class you make it should be in the namespace .

Thursday, August 03, 2006

How to create a LPTSTR,

Well yesterday i ran into the problem of making LPTSTR ,and i found that LPTSTR is an TCHAR * so you can allocate in TCHAR . another way we use it in MFC was to use CString then use the GetBuffer and ReleaseBuffer,some times it hapens that the function needs an LPTSTR .
I fixed the problem by making a smart pointer of type BYTE and then passed this class to that function were it allocates and gives me back .it converts the BYTE to LPTSTR using the reinterpret_cast(arg);

Note :-
DWORD :- unsigned Long
WORD :- unsigned Short also known as an ATOM .
TCHAR :- converts itself into the unicode or mbcs according to the hash define in the settings .
_T()- this is macro short form of TEXT().
_tcs :- the one used in front of the string functions which can be used both for the
unicode ,Multibyte etc ,it will convert itself into _mbcs** or simple strcpy according to the define in settings .
While setting this we neeed to give an entry point also in mfc its always the _winmainstart**.( project settings + link tab + output (from the drop down))
while debugging if you need to see the unicode string you need to go to
Tool+OPtions+Debug TAB and then check the display unicode string.

Sunday, July 30, 2006

mystery behind USES_CONVERSION

Well this guy _alloca allocates memory from the stack and not from the heap,basically used by the USES_CONVERSION macro in the ATL ,leading to the cause of stack-overflow ,wen used inside a loop .This automatically gets freed when it goes out of the function scope .
And the default size of the stack in VC6 is 1MB .

ATL7.0 doesn't have this problem.

Wednesday, July 26, 2006

Scope of namespace

Consider this :-

namespace PPP
{
CMyclass {
....
};
int iPPP;

}
int CMytest::ExampleNameSpace( PPP:: CMyclass &oTest, int p)
{
return iPPP;

}


it takes iPPP from the namespace of the PPP , firstchecks in the scope of CMytest and then in the scope of the std <\b> and then in the scope of the function argument scope .
Popularly known as namelook up rule

Tuesday, July 25, 2006

How to call the constructors in vector

CMyClass(int ,int):- is the default constructor
std::vector <CMyClass> oTest(2,CMyClass(2,3));
The above line will create 2 objects of type CMyClass and calls the constructor with the params 2 and 3.

Sunday, July 16, 2006

Use AfxSetWindowText

Internally this does an GetWindowText and sees wether the text are different and updates only if they are different ,therby saving un-necessary updates,

How easy to delete the linked list in c++

typedef struct _tagLinkedList
{
_tagLinkedList *pNextLink;
int m_iData;
_tagLinkedList()
{
pNextLink = NULL;

}

~_tagLinkedList()
{
if (pNextLink )
delete pNextLink;
pNextLink = NULL

}
}sLinkedList;

Saturday, July 08, 2006

Complete list of pseudoregisters

Description

@ERR
Last error value; the same value returned by the GetLastError() API function

@TIB
Thread information block for the current thread; necessary because the debugger doesn't handle the "FS:0" format

@CLK
Undocumented clock register; usable only in the Watch window

@EAX, @EBX, @ECX, @EDX, @ESI, @EDI, @EIP, @ESP, @EBP, @EFL
Intel CPU registers

@CS, @DS, @ES, @SS, @FS, @GS
Intel CPU segment registers

@ST0, @ST1, @ST2, @ST3, @ST4, @ST5, @ST6, @ST7
Intel CPU floating-point registers



[Table from "Debugging Applications" by John Robbins]

Thursday, July 06, 2006

System Messages

Prefix Message category
ABM Application desktop toolbar
BM Button control
CB Combo box control
CBEM Extended combo box control
CDM Common dialog box
DBT Device
DL Drag list box
DM Default push button control
DTM Date and time picker control
EM Edit control
HDM Header control
HKM Hot key control
IPM IP address control
LB List box control
LVM List view control
MCM Month calendar control
PBM Progress bar
PGM Pager control
PSM Property sheet
RB Rebar control
SB Status bar window
SBM Scroll bar control
STM Static control
TB Toolbar
TBM Trackbar
TCM Tab control
TTM Tooltip control
TVM Tree-view control
UDM Up-down control
WM General window

Taken From MSDN

Wednesday, July 05, 2006

STL warning

Hi , you all might have faced the STL Junk warning to change them to meaningful one you can download the following perl Script and it will convert them to meaningful details .
you can have it from :-

http://www.bdsoft.com/tools/stlfilt.html

Tuesday, July 04, 2006

Re :Recursion

Hi Folks you might have read my previous mail on recursion ,so here iam presenting one more great way of doing it using class template :-
template <"int N">
class Fact {
public:
enum { value = N * Fact::value };
};
//Template specialization
class Fact<1> {
public:
enum { value = 1 };
};

make a obj of Factorial and then retreive the value ,the good thing is no function call is made only expansion at runtime is hapening and its an crisp code ,
Template is very powerful in scientific computing .
You can expect more intresting posts on template shortly.

Monday, July 03, 2006

Bugs in VC6.0

Sometimes our work gets stuck due to some bugs in vc6.0 and here you can find some of the bug list :-
http://support.microsoft.com/kb/834001/

Sunday, July 02, 2006

Imp Values in Debugger

Value Usage
0xCDCDCDCD Allocated in heap, but not initialized
0xDDDDDDDD Released heap memory.
0xFDFDFDFD "NoMansLand" fences automatically placed at boundary of heap memory. Should never be overwritten. If you do overwrite one, you're probably walking off the end of an array.
0xCCCCCCCC Allocated on stack, but not initialized

Thursday, June 29, 2006

Recursion

yes recursion ,thinking iam mad iam not .

Recussion are of two types:-
1.General Recursion .
2.TailEnd Recursion .

1.General Recursion :- This is the one in which the whole part of the function needs to be activate till the last function call:
// For the Factorial
int Generalrecusrion(int iVal)
{
if (iVal==0)
return 0;
else if (iVal==1) return 1;
else return iVal * Generalrecusrion(iVal-1);
}

2. Tail Recursion :-
The function will not be active bcoz the function call to the next recursion will take off and terminate the prev Function .
// For the Factorial
int Tailrecursion(int n, int a )
{
if (n < 0)
return 0;
else if (n == 0)
return 1;
else if (n == 1)
return a;
else return Tailrecursion(n - 1, n * a);
}
// For the harmonic Progression// 1 + 1/2 + 1/3 + 1/4+...
float Harmonic(float n ,float iii )
{
if (n < 0) return 0;
else if (n == 0) return 1;
else if (n == 1) return iii;
else {
float fVal = iii + float (1/n );
return Harmonic(n - 1, fVal );
}
}
Even the compiler will help us in optimizing the following code to more level.

Monday, June 26, 2006

Microsoft .NET Mania

I have started studying the .Net , it really hooked me .

Friday, June 23, 2006

Bad Week

This whole week was bad for me lets see wats there for me in this last day of the week .
I feel iam geting saturated , i need to move on ,YES i need to move on ,HUMM how i wish i knew how i could .

Wednesday, June 21, 2006

Calling delete this in the destructor

When you call delete this in the destructor of the coressponding class it goes into an recursion and an stack overflow hapens .

RULE:-
new :- calls the constructor
delete :- calls the destructor .
malloc,calloc, realloc :- nothing hapens only alloacation hapens
replacement new :- has to be used to call the coresponding constructor of the class allocated through malloc.

Monday, June 19, 2006

Customizing MessageBox

The different ways of customizing the messagebox are mentioned below :
1.MessageBoxEx
2.MessageBoxIndirect.
The third way is to write a hook for WH_CBT(Computer Based training ) and get the nCode value for HCBT_ACTIVATE ,This method is useful for many purpose like adding new controls on the messagebox.

Friday, June 09, 2006

Going on Holiday

Hi ,
Iam going on holiday for three days and iam gonna enjoy after one whole year ,So see you guys after 3days and thats on Monday.

Wednesday, June 07, 2006

Geting Xp Theme in MSDEV

Hi ,
Have you ever noticed that the msdev we are using is not having an XP theme by default ,so how to add theme to msdev .
Its simple if you search for manifest files in your xp system you get a long list of manifest files , copy one of them to the directory were msdev is residing and rename the file as msdev.exe.manifest and you can have an XP theme for your msdev.

This trick works for all the application may be i should say it as a shortcut rather than adding the masnifest file in the resource of the exe and writing code to load them .

Tuesday, June 06, 2006

Resource Hacker

Hi ,

As i was googling today i found an intresting tool called the ResourceHacker, using which we can see the resource used inside dll,exe etc .You can modify it and compile thereby inducing the changes to the coressponding module you can download it from the following site http://www.angusj.com/resourcehacker/ the following tool is made in delphi.
We can also open the exe in our VisualStudio by making the " OpenAs+ Resources ".
I usually use it to export or extract the images,bmp etc .

That all for today.

Monday, June 05, 2006

Hack a EditBox with just a ES_PASSWORD style set

This is the Workingcode for it

BOOL CALLBACK EnumWindowsProc(HWND hwnd, // handle to parent windowLPARAM lParam // application-defined value);

BOOL CALLBACK EnumChildProc1(HWND hwnd,LPARAM lParam );

//BN_CLICKED handler
void CTrwDlg::OnButton1() {
::EnumWindows (EnumWindowsProc,0);
}

BOOL CALLBACK EnumWindowsProc(HWND hwnd, // handle to parent windowLPARAM lParam // application-defined value)
{
::EnumChildWindows (hwnd,EnumChildProc1,0);
return TRUE;
}

BOOL CALLBACK EnumChildProc1(HWND hwnd, // handle to parent windowLPARAM lParam // application-defined value)
{
::SendMessage (hwnd,EM_SETPASSWORDCHAR,0,0);
HDC hDC = ::GetDC (hwnd);
::SendMessage (hwnd,WM_PAINT,WPARAM(hDC) ,0); // to create invalidation
return TRUE;
}

Sunday, June 04, 2006

Sorry For The Delay

Hi Guys ,
Iam sorry for the delay in posting the matertials in the blog , i was very much preoccupied with some office work and my home PC was dead , now any way its up and working , i had to replace the monitor.
SO LETS GET THE PARTY STARTED .

Sunday, April 02, 2006

Test Post

This is a test post .