Wednesday, 11 July 2012

Technical things I learnt

1. dos programming - for loop
http://www.jamesewelch.com/2008/05/01/how-to-write-a-dos-batch-file-to-loop-through-files/
2. Problem with Linker errors in VC++ Build:-
Error description:-
the symbol '...' is not defined error VS2005 visual studio 2005
Sol: the problem could be in .ncb file referring to old symbols hence to resolve just delete the .ncb file and rebuiild the vc++ project again.
courtesy:-
http://www.tech-archive.net/Archive/VisualStudio/microsoft.public.vstudio.general/2009-11/msg00019.html
3. Leadtools unresolved external symbol error:-
http://support.leadtools.com/CS/forums/10949/ShowPost.aspx
http://support.leadtools.com/CS/forums/15340/ShowPost.aspx
http://support.leadtools.com/CS/forums/37489/ShowPost.aspx -->added ltwvc2_u.lib, ltwvc_a.lib solved the problem
4. I created dynamic library (.dll) using C language .program  compiled(using Microsoft Visual Studio 2008)...but it shows some link
errors
1.LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol  _main reference**d in function ___tmainCRTStartup
It appears that the project is set to build a console application, not a  DLL. Go to Project | Properties | General | Configuration Type, make  sure it's set to Dynamic Library (.dll)

Courtesy:-http://social.msdn.microsoft.com/Forums/ar/vclanguage/thread/1e63a755-d783-41ea-b303-b3a3696d28ce

5. WHEN IS THE UpdateWindows() called?
whenever there is an initialization like a window has been intialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindows();
Courtesy:- http://www.cs.sjsu.edu/faculty/pearce/mfc/chp6/chapter6.htm
6. Tell me something about InitInstance, CDocument, CFrameWnd
CSingleDocTemplate and CMultiDocTemplate are derived from the CDocTemplate class, which encapsulates three protected CRuntimeClass pointers:
class CDocTemplate : public CCmdTarget
{
public:
   virtual CDocument* CreateNewDocument();
   virtual CFrameWnd* CreateNewFrame(CDocument* pDoc,
                                          CFrameWnd* pOther);
   virtual CDocument* OpenDocumentFile(...) = 0;
   // etc.
protected:
   CRuntimeClass* m_pDocClass;
   CRuntimeClass* m_pFrameClass;
   CRuntimeClass* m_pViewClass;
};
InitInstance() creates a document template holding pointers to objects representing CTestDoc, CMainFrame, and CTestView, then adds the document template to a list of templates managed by theApp.
The following class diagram shows the relationship between these classes:

     _______________
    |  |
    |    CWinApp |
    |_______________|  ____________________
     ^   |      |
     |   |   CRuntimeClass   |
     |   |      |
     |   |___________________|
     |    ^3
     |    |
     _______|________   |
    |  |   |1
    |    CTestApp |1      * |-------------------|
    |_______________|______________>| CDocumentTemplate |
    |  InitInstance |  |      |
    |_______________|  |___________________|
          ^
          |
      _______________________  |
     |   |  |
     |    CSingleDocTemplate |--------|
     |_______________________|  |
          |
          |
          |
      _______________________  |
     |   |  |
     |    CMultiDocTemplate  |--------|
     |_______________________|  |



Although an application could have many document templates, it is more common to have one.
InitInstance() indirectly calls the OpenDocumentFile() member function of the first document template on its list:
pTemplate->OpenDocumentFile(NULL);
This function (eventually) creates the application's main frame, initial document, and initial view using the dynamic instantiation feature discussed earlier:
CDocument* pDocument = (CDocument*)m_pDocClass->CreateObject();
CFrameWnd* pFrame = (CFrameWnd*)m_pFrameClass->CreateObject();
CWnd* pView = (CWnd*) m_pNewViewClass->CreateObject();
Dynamic instantiation is used because the framework can't anticipate the types of document and views we will create until we run the App Wizard.
Applications with Multiple Document and View Types
While a multi-document application allows users to open multiple views of multiple documents, the documents are generally all instances of the same CDocument-derived class, and the views are generally all instances of the same CView-derived class. But what if an application requires multiple types of documents and views? For example, workspaces, projects, and C++ files can be viewed as three distinct types of documents users may edit in Visual C++. While Microsoft Word only allows users to edit a single type of document, users may view their documents using three different types of views: normal, outline, and page layout.
It's not too difficult to create MFC applications with multiple view and document types. The trick is to edit InitInstance() by adding the creation and installation of additional document templates.

Courtesy:- http://www.cs.sjsu.edu/faculty/pearce/mfc/chp6/chapter6.htm
  _____________________________________________________________________________
  |  Sequence | Description
  |_______________________|____________________________________________________
  |    | CMyDoc Object construct
  |    | CMyView obj Construct
  |    | View Window Created
  |    | CMyView::OnCreate called (if mapped)
  |    | CMyDoc:OnNewDoc Called
  |  Application | CMyView::OnIntialUpdate called
  |  Starts  | View object intialized
  |    | View window invalidated
  |    | CMyView::OnDraw called
  |    |
  |    |
  |    |
  |_______________________|____________________________________________________
  |  User edits data| CMyView Functions update CMyDoc data members
  |_______________________|____________________________________________________
  |   |
  |  User exits app | CMyView obj destroyed
  |    | CMyDoc Obj destroyed
  |_______________________|_____________________________________________________
Courtesy:- http://www.tenouk.com/visualcplusmfc/visualcplusmfc10.html
7. BIGGEST LESSON I LEARNT IN TOOLBAR CRASH IN VC++ IS THAT:-
Invalidate() function in OnDraw should not be there.
8. All Leadtool error codes found in LTerr.h
The Nag Msg-> "Leadtool Specialized product notice" Dialog window is hidden by following:-
http://support.leadtools.com/SupportPortal/CS/forums/17263/ShowPost.aspx

9. Visual C++ does not generate .lib file for a DLL project
http://binglongx.wordpress.com/2009/01/26/visual-c-does-not-generate-lib-file-for-a-dll-project/

10. How to create .lib & .dll from libtiff - check for the script and the filenames
a. edit nmake.opt
b. check makefile.vc
c. run nmake /f makefile.vc (in tools, port, libtiff directories)
d. comment ot pixar, jpeg,zip in tiffconf.h file
11. How to debug from VC++
a. F9 at desired location of the code
b. F5 to start the debugging
c. F10 to step by
d. F11 to step into more deep
e. Project->Properties->Debugging->Arguments+Directory etc.,
Courtesy:- Harinivas
12. Some of the Leadtools Support forum link that helped me, for eg. "RotateViewPerspective" function being not available in V17 library
Ans:
http://support.leadtools.com/SupportPortal/cs/forums/2729/ShowPost.aspx
http://www.leadtools.com/help/leadtools/v175/main/api/dllref/l_rotatebitmap.htm
http://www.leadtools.com/help/leadtools/v175/main/api/dllref/l_reversebitmap.htm

Unix Commands:-
1. tar cvf <filename>.tar <src_dir_name>
2. try - (1) | gzip > <fname.tar.gz>  (eg. tar cvf - foodir | gzip > foo.tar.gz)
3. find . -name \*.tif -exec echo {} \;
4. setenv OWL_INSTANCE /mnt/cal6pdsk02/home/eqa41194/myFiles/kum_etl_raster_testing
5. gunzip -c cr_test.tar.gz | tar xvf - (eg. gunzip -c foo.tar.gz | tar xvf - )
 ------------------------------- gzcat tiff-v3.5.1.tar.gz | tar xf -
6. find . -exec grep  'gcc'  {} +
7. zip -r <zip_to_be_created> <source dir>
8. setenv DEVTOOLS /mnt/styx/devl01/devtools
setenv  OWL_INSTANCE /owl/test/test_instance
setenv OWL_PRODUCT /owl/product/v6.4.3.0/image/sol2/
setenv MY_LD_LIBRARY_PATH $OPENWIN_HOME/lib:$OPENWIN_HOME/lib/X11:/usr/dt/lib:/usr/lib:$SW_OPT/gnu/lib:$SW_OPT/lib:$ORACLE_HOME/lib:/oracle/product/8.1.7/lib:/opt/lib:$OWL_PRODUCT/lib:.
setenv LD_LIBRARY_PATH $MY_LD_LIBRARY_PATH
9. cat -v CVS/Root
10. \cp -r ~/../eqa41194/cr_1565_analyze_image/ht/ref/logs/libs/win32/ .
11. buildall -b owlcomp.lst
12.  pstack core | more
13. stop at main.cc:3
14. \rm -rf xtiff_bad_cvs/
15. sam viewTagDetails rev1_3_28_1
16. sam viewTagDetails rev1_168_50_1
17. grep "^gggg" | cut -d' ' -f2
18. dir <file_to_search> /s /b    -- very fast dos search command line utility
19. unzip filename.ZIP
20. createNewRelease –d ~/CR_1540/co_code_May08 –V v6.3.4.0 owl
21. ~/myFiles/shfiles/removectrlm.sh -find . 0d
22. ls -d /owl/product/v6.3.4.0/ht/ref/logs/loaders/logvector/src/*.h | xargs -n 1 basename
23. find . -name \*.cfg -print
24. ls *.dll | wc -l
25. test_cdm -i 5\5\hdr\5_log_1_crv_2.cdm -d > crv_2.txt
26. Shift + F3 to change the selected test in winword from uppercase to lowercase or viceversa
27. Convert a.txt and write to e.txt.
 dos2unix -n a.txt e.txt
28. ls -p | grep -v / --->lists the files excluding the directory

Sam Commands:-
create branch:
1. sam createBranch Veekay_Analyze_Image_logs logs
2. sam createBranch Veekay_Analyze_Image_owl owl
3. createNewRelease -d ~/CR_1540/branch -V v6.1.4.0 owl
 eg. createNewRelease -d ~/LasLoader/v7.0 -V v7.0.0.0 owl
4. mv v6.1.4.0 cr_1565_analyze_image
5. edit ../ht/build/owlcomp.lst
6. /owl/branch/cr_...../ht > setbuil <path till ht, including ht>eg. /CR_1540/v6.3.6.0/ht
7. cvs checkout -r release-1-0 tc
 url: http://docs.freebsd.org/info/cvs/cvs.info.Tags.html
8.  sam viewBranches | grep 1540
9. sam check-in:-
sam ci -f ci_message -cr 1540
10. more CVS/Tag
11. gen_owl -d /mnt/cal6pdsk02/home/eqa41194/LasLoader/Refine/v6501_17Dec
 This program generates product image.
 11.a: source $HOME/.cshenv --> this command sets the lasloader bin path
12. lscv <to know list of components>
13. ls -p | grep -v / --->lists the files excluding the directory
14. cvs diff -r 1.13 1.12 OXFSchema.xsd
15. cvs log <filename> --->version history