Thursday, November 03, 2011

Matlab relative path issue in prj and MWArray.dll nightmare on Windows 7 64 bit

Whenever you want to create a deployment project, you obviously would like to add it to source control repository for others to use..... But you will face a major issue...
The main problem is that the .prj file which deploytool creates contains absolute paths which will not work on other computers!. This is really bad to see that this is still the case in MatLab R2011a.... Really! So I decided to use Visual Studio 2005 vcproj file to maintain my deployment project because Visual Studio 2005 project support relative path pretty damn well! Thank you Microsoft Visual Studio Team!. I decided to create a WIN32 utility using MFC to convert the relative path to absolute path using the vcproj file and generate a Matlab PRJ file. In my case I am targetting C# .Net Assembly. Here is the source code!


#define _CRT_SECURE_NO_DEPRECATE
#include "stdafx.h"
#include "vcproj2matlabprj.h"
#include
#include
#include
#include
#include
#include "xmlParser.h"
#include "win32utility.h"

CString RelativePathToAbsolutePath(LPCTSTR contentRelativePath,LPCTSTR rootPath, BOOL &bRelativePathToParentFolders);

void PrintFileName(XMLNode xNode,LPCTSTR pszRootFolder);

FILE *_pOutMakeFile = NULL;


#if !defined (WIN32)
#define _strdup strdup
#endif

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

// The one and only application object

CWinApp theApp;

using namespace std;

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;

// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
_tprintf(_T("Fatal Error: MFC initialization failed\n"));
nRetCode = 1;
}
else
{
CString strRootFolder;
CString strVCProjShortFilename;
CString csPath;
CString csFilenameNoExt;
CString csExtension;
CString strVCProj;
CString strMathlabProj;
CString strMathLabRootPath;
CString strClassName;
CString strNamespace;

if ( argc < 4 )
{
printf("Usage: %s [MathLab 2011a RootPath EG: \"C:\\MATLAB\\R2011a\"]\n",argv[0]);
return 1;
}

XMLNode xMainNode=XMLNode::openFileHelper(argv[1],"VisualStudioProject");

strRootFolder = CString(argv[1]);
strMathlabProj = CString(argv[2]);
GetPathFromFileName(strRootFolder);

strVCProj = CString(argv[1]);
strVCProjShortFilename = CString(argv[1]);
strMathLabRootPath = CString(argv[3]);

GetFileNameComponents(strMathlabProj, // in
csPath, csFilenameNoExt, csExtension); // out


if ( xMainNode.isEmpty() )
{
printf("Not valid input file [%s]\n", argv[1]);
return 2;
}

XMLNode xNode;

xNode = xMainNode.getChildNode("Configurations");

// Try to open output file
_pOutMakeFile = fopen(argv[2],"w");
if ( _pOutMakeFile == NULL )
{
printf("Can not open output file [%s]\n", argv[2]);
return 3;
}

// Generate Header
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n",csFilenameNoExt.GetBuffer(0),csPath.GetBuffer(0),strMathlabProj.GetBuffer(0));
fprintf(_pOutMakeFile,"%s\n",strMathlabProj.GetBuffer(0));
fprintf(_pOutMakeFile,".NET Assembly\n");
fprintf(_pOutMakeFile,"%s\n",csFilenameNoExt.GetBuffer(0));
fprintf(_pOutMakeFile,"${PROJECT_ROOT}\\%s\\src\n",csFilenameNoExt.GetBuffer(0));
fprintf(_pOutMakeFile,"${PROJECT_ROOT}\\%s\\distrib\n",csFilenameNoExt.GetBuffer(0));
fprintf(_pOutMakeFile,"true\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"all\n");
fprintf(_pOutMakeFile,"
\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"on\n");
fprintf(_pOutMakeFile,"on\n");
fprintf(_pOutMakeFile,"on\n");
fprintf(_pOutMakeFile,"on\n");
fprintf(_pOutMakeFile,"on\n");
fprintf(_pOutMakeFile,"
\n");
fprintf(_pOutMakeFile,"option.net.framework.default\n");
fprintf(_pOutMakeFile,"option.assembly.type.private\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"false\n");
fprintf(_pOutMakeFile,"false\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
strNamespace = csFilenameNoExt;
strNamespace.MakeUpper();
fprintf(_pOutMakeFile,"%s\n",strNamespace.GetBuffer(0));
strClassName = csFilenameNoExt;
fprintf(_pOutMakeFile,"C%s\n",strClassName.GetBuffer(0));
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"
\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n",strClassName.GetBuffer(0));

// Print list of files
xNode = xMainNode.getChildNode("Files");
PrintFileName(xNode,strRootFolder);

fprintf(_pOutMakeFile,"
\n");
fprintf(_pOutMakeFile,"
\n");
fprintf(_pOutMakeFile,"
\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"%sdistrib\\%sNative.dll\n",csFilenameNoExt.GetBuffer(0),csFilenameNoExt.GetBuffer(0),strRootFolder.GetBuffer(0),csFilenameNoExt.GetBuffer(0));
fprintf(_pOutMakeFile,"%sdistrib\\%s.dll\n",csFilenameNoExt.GetBuffer(0),csFilenameNoExt.GetBuffer(0),strRootFolder.GetBuffer(0),csFilenameNoExt.GetBuffer(0));
fprintf(_pOutMakeFile,"%sdistrib\\readme.txt\n",csFilenameNoExt.GetBuffer(0),strRootFolder.GetBuffer(0));
fprintf(_pOutMakeFile,"%sdistrib\\%s_overview.html\n",csFilenameNoExt.GetBuffer(0),csFilenameNoExt.GetBuffer(0),strRootFolder.GetBuffer(0),csFilenameNoExt.GetBuffer(0));
fprintf(_pOutMakeFile,"
\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"%s\n",strMathLabRootPath.GetBuffer(0));
fprintf(_pOutMakeFile,"\n");
//fprintf(_pOutMakeFile,"C:\\My Documents\\MATLAB\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\general\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\ops\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\lang\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\elmat\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\randfun\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\elfun\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\specfun\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\matfun\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\datafun\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\polyfun\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\funfun\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\sparfun\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\scribe\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\graph2d\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\graph3d\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\specgraph\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\graphics\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\uitools\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\strfun\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\imagesci\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\iofun\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\audiovideo\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\timefun\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\datatypes\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\verctrl\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\codetools\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\helptools\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\winfun\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\winfun\\NET\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\demos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\timeseries\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\hds\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\guide\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\plottools\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\local\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\matlab\\datamanager\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\simulink\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\instrument\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\coder\\matlabcoder\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\simulink\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\simulink\\slresolve\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\blocks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\components\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\fixedandfloat\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\fixedandfloat\\obsolete\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\simdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\simdemos\\aerospace\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\simdemos\\automotive\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\simdemos\\industrial\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\simdemos\\simfeatures\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\simdemos\\simgeneral\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\dee\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\glue\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\glue\\studio\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\dastudio\\depviewer\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\stateflow\\stateflow\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\simulink\\MPlayIO\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\simulink\\dataobjectwizard\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\hdlshared\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\rtw\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\asap2\\asap2\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\asap2\\asap2\\user\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\common\\can\\blocks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\common\\tgtcommon\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\connectivity\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\pil\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\shared\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\rtw\\datadiff\\GUI\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\rtw\\datadiff\\GUI\\Icons\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\rtw\\datadiff\\API\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\rtw\\cgv\\API\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\rtw\\misra\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulinkcoder\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\accel\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\blocks\\library\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\blocks\\obsolete\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\fixedandfloat\\fxpdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\simulink\\modeladvisor\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\simulink\\modeladvisor\\fixpt\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\stateflow\\sfdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\stateflow\\coder\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\adivdsp\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\adivdsp\\vdspdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\adivdsp\\mdlinfo\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\adivdsp\\tfl\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\adivdsp\\vdspblks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\adivdsp\\rtw\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\aero\\aero\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\mapgeodesy\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\aero\\astdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\asynciolib\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\AUTOSAR\\AUTOSAR\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\blackfin\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\blackfin\\blks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\blackfin\\blks\\mex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\blackfin\\blks\\masks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\blackfin\\blackfindemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\c166\\c166\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\c166\\blocks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\c166\\c166demos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\foundation\\utils\\resource_config\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\can\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\can\\canblks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\can\\canmasks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\can\\canmex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\cgir_fe\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\coder\\codegendemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\coder\\emlcodermex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\coder_foundation\\tfl\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\simtargets\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\coder\\coder\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\comm\\comm\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\comm\\commutilities\\comminit\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\comm\\commutilities\\commmex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\comm\\commutilities\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\comm\\commdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\comm\\commdeprecated\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\help\\toolbox\\comm\\examples\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\testconsole\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\comparisons\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\compiler\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\compiler\\compilerdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\control\\control\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\control\\ctrlguis\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\control\\ctrlobsolete\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\control\\ctrlutil\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\control\\ctrldemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\help\\toolbox\\control\\examples\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\controllib\\engine\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\controllib\\engine\\options\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\controllib\\engine\\optim\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\controllib\\general\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\controllib\\graphics\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\controllib\\requirements\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\curvefit\\curvefit\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\curvefit\\splines\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\curvefit\\cftoolgui\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\curvefit\\sftoolgui\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\curvefit\\curvefitdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\optimlib\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\daq\\daq\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\daq\\daqguis\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\daq\\daqdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\daq\\daqblks\\daqblks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\daq\\daqblks\\daqmasks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\daq\\daqblks\\daqmex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\dastudio\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\des\\desblks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\des\\desmasks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\des\\desmex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\des\\desdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\distcomp\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\distcomp\\distcomp\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\distcomp\\user\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\distcomp\\mpi\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\distcomp\\pctdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\distcomp\\parallel\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\distcomp\\parallel\\util\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\distcomp\\lang\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\distcomp\\cluster\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\distcomp\\gpu\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\dotnetbuilder\\dotnetbuilder\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\dotnetbuilder\\dotnetbuilderdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\dsp\\dsp\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\dsp\\dsputilities\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\dsp\\dsputilities\\dspinit\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\dsp\\dsputilities\\dspmex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\dsp\\dspdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\filterdesignlib\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\system\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\dspblks\\dspblks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\dspblks\\dspmex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\fixedpoint\\fixedpoint\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\help\\toolbox\\dsp\\examples\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\dsp\\filterdesign\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\eclipseide\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\eclipseide\\eclipseidedemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\eclipseide\\mdlinfo\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\eclipseide\\registry\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\eclipseide\\tfl\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\edalink\\edalink\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\edalink\\foundation\\hdllink\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\edalink\\extensions\\modelsim\\modelsim\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\edalink\\extensions\\modelsim\\modelsimdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\edalink\\extensions\\incisive\\incisive\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\edalink\\extensions\\incisive\\incisivedemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\edalink\\extensions\\discovery\\discovery\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\edalink\\extensions\\discovery\\discoverydemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\tlmgenerator\\foundation\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\tlmgenerator\\foundation\\rtw\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\tlmgenerator\\foundation\\tlmgeneratordemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\eda\\edagraph\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\eda\\fil\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\eda\\fil\\fildemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\eda\\fpgaautomation\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\eda\\hdlparser\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\ecoder\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\ecoder\\ecoderdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\mpt\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\mpt\\mpt\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\mpt\\user_specific\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\embeddedcoder\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\eml\\eml\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\exlink\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\fixedpoint\\fidemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\fixedpoint\\fixedpointtool\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\spcuilib\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\siglib\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\fixpoint\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\fixpoint\\fpca\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\edalink\\extensions\\fpgaautomation\\fpgademos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ghsmulti\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ghsmulti\\multidemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ghsmulti\\mdlinfo\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ghsmulti\\multiblks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ghsmulti\\tfl\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ghsmulti\\rtw\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\hdlcoder\\hdlcoder\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\hdlcoder\\hdlcoder\\hdlwa\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\hdlcoder\\hdlcoderdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\hdlfilter\\hdlfilter\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\hdlfilter\\hdlfiltdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\iarew\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\iarew\\blks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\iarew\\iarewdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\iarew\\mdlinfo\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\iarew\\templates\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\pjtgenerator\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\pjtgenerator\\rtw\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\pjtgenerator\\hookpoints\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\pjtgenerator\\tgtpref2\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\pjtgenerator\\profiler\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\pjtgenerator\\mdlinfo\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\pjtgenerator\\blks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\pjtgenerator\\blks\\masks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\pjtgenerator\\blks\\tlc_c\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\pjtgenerator\\blks\\utils\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\autointerface\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\autointerface\\ideregisterplugins\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\util\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\errorhandler\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\lfsocket\\lfsocket\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\foundation\\xmakefile\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\idelinkdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\ident\\ident\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\ident\\nlident\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\ident\\idobsolete\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\ident\\idguis\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\ident\\idutils\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\ident\\iddemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\ident\\iddemos\\examples\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\ident\\idhelp\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\images\\colorspaces\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\images\\images\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\images\\imdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\images\\imuitools\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\images\\iptformats\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\images\\iptutils\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\imageslib\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\imaq\\imaq\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\imaqlib\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\imaq\\imaqdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\imaq\\imaqblks\\imaqblks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\imaq\\imaqblks\\imaqmasks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\imaq\\imaqblks\\imaqmex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\instrument\\instrument\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\instrument\\instrumentdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\instrument\\instrumentblks\\instrumentblks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\instrument\\instrumentblks\\instrumentmex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\instrument\\instrumentblks\\instrumentmasks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\sam\\m3i\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\slvnv\\simcoverage\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\mpc555dk\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\mpc555dk\\common\\configuration\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\mpc555dk\\mpc555demos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\mpc555dk\\mpc555dk\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\mpc555dk\\pil\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\mpc555dk\\rt\\blockset\\mfiles\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\mpc555dk\\rt\\blockset\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\optim\\optim\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\optim\\optimdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\data_manager\\data_manager\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\equation_language\\equation_language\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\foundation\\foundation\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\gl\\core\\m\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\gl\\sli\\m\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\logging\\base\\m\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\logging\\mli\\m\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\network_engine\\ne_support\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\network_engine\\network_engine\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\ne_sli\\ne_sli\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\pmir\\pmir\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\pm_sli\\pm_sli\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\powersys\\powersys\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\powersys\\DR\\DR\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\powersys\\drives\\drives\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\powersys\\facts\\facts\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\powersys\\DR\\DRdemo\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\powersys\\drives\\drivesdemo\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\powersys\\facts\\factsdemo\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\powersys\\powerdemo\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\simscape\\compiler\\core\\m\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\simscape\\compiler\\sli\\m\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\simscape\\simscapedemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\simscape\\engine\\core\\m\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\simscape\\engine\\mli\\m\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\simscape\\engine\\sli\\m\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\simscape\\foundation\\simscape\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\simscape_language\\simscape_language\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\simscape\\library\\m\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\simscape\\simscape\\m\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\simulation\\base\\m\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\physmod\\unit_manager\\unit_manager\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\slvnv\\reqmgt\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\slvnv\\slvnv\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\slvnv\\rmidemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rf\\rf\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rf\\rfdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rf\\rftool\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rfblks\\rfblks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rfblks\\rfblksmasks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rfblks\\rfblksmex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rfblks\\rfblksdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rptgen\\rptgen\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rptgen\\rptgenv1\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rptgen\\rptgendemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rptgenext\\rptgenext\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rptgenext\\rptgenextv1\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rptgenext\\rptgenextdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\rptgen\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\rtwin\\rtwin\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\rtwin\\rtwindemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\rtwdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\rtwdemos\\rsimdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simulink\\blocks\\sb2sl\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\eml\\eml\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\sigbldr\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\slcontrollib\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\signal\\signal\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\signal\\sigtools\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\signal\\sptoolgui\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\signal\\sigdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simrf\\simrf\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simrf\\simrfmasks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\simrf\\simrfdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\help\\toolbox\\simrf\\examples\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\sl3d\\sl3d\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\sl3d\\sl3ddemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\slcontrol\\slcontrol\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\slcontrol\\slctrlguis\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\slcontrol\\slctrlutil\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\slcontrol\\slctrldemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\slcontrol\\slctrlobsolete\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\sldv\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\slvnv\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rptgenext\\slxmlcomp\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\stats\\stats\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\stats\\statsdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\stats\\classreg\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\statslib\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\symbolic\\symbolic\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\symbolic\\symbolicdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\targetdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\foundation\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\foundation\\utils\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\foundation\\blks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\foundation\\blks\\mex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\foundation\\blks\\masks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic2000\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic2000\\rtw\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic2000\\utils\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic2000\\blks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic2000\\blks\\mex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic2000\\blks\\masks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic2000\\tic2000demos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic6000\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic6000\\rtw\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic6000\\tfl\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic6000\\utils\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic6000\\blks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic6000\\blks\\mex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic6000\\blks\\sysobj_mex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic6000\\blks\\masks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic6000\\tic6000demos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\operatingsystem\\linux\\blks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\operatingsystem\\linux\\blks\\masks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\operatingsystem\\linux\\blks\\mex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\operatingsystem\\linux\\src\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\operatingsystem\\vxworks\\blks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\operatingsystem\\vxworks\\blks\\mex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\operatingsystem\\vxworks\\blks\\masks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\operatingsystem\\vxworks\\src\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\operatingsystem\\windows\\blks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\operatingsystem\\windows\\blks\\masks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\operatingsystem\\windows\\blks\\mex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\intelhost\\tfl\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\shared\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\shared\\ti\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\shared\\ti\\mdlinfo\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\shared\\ti\\utils\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\shared\\ti\\blks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\shared\\ti\\blks\\mex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\shared\\ti\\blks\\masks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\etargets\\etargets\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\etargets\\etargets\\demoutils\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\testmeaslib\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\tasking\\tasking\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\tasking\\taskingdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rtw\\targets\\tasking\\tasking\\taskingblks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\testmeaslib\\general\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\testmeaslib\\graphics\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\shared\\testmeaslib\\simulink\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic5000\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic5000\\blks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic5000\\blks\\mex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic5000\\blks\\masks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\target\\extensions\\processor\\tic5000\\tic5000demos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ticcs\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ticcs\\ccsblks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ticcs\\ccsdemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ticcs\\ccsdemos\\util\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ticcs\\ccslinkblks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ticcs\\ccslinkblks\\rtdxsimblks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ticcs\\lic\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ticcs\\mdlinfo\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ticcs\\tfl\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ticcs\\util\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ticcs\\rtw\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\ticcs\\envChecker\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\vision\\vision\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\vision\\visionutilities\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\vision\\visionutilities\\visioninit\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\vision\\visionutilities\\visionmex\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\vision\\visiondemos\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\help\\toolbox\\vision\\examples\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\wavelet\\wavelet\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\wavelet\\wmultisig1d\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\wavelet\\wavedemo\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\wavelet\\compression\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\wrworkbench\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\wrworkbench\\mdlinfo\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\wrworkbench\\registry\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\idelink\\extensions\\wrworkbench\\wrworkbenchblks\n");
fprintf(_pOutMakeFile,"${MATLAB_ROOT}\\toolbox\\rptgen\\xmlcomp\n");
fprintf(_pOutMakeFile,"
\n");
fprintf(_pOutMakeFile,"
\n");
fprintf(_pOutMakeFile,"\n");
fprintf(_pOutMakeFile,"false\n");
fprintf(_pOutMakeFile,"false\n");
fprintf(_pOutMakeFile,"true\n");
fprintf(_pOutMakeFile,"false\n");
fprintf(_pOutMakeFile,"true\n");
fprintf(_pOutMakeFile,"false\n");
fprintf(_pOutMakeFile,"false\n");
fprintf(_pOutMakeFile,"false\n");
fprintf(_pOutMakeFile,"5.1\n");
fprintf(_pOutMakeFile,"true\n");
fprintf(_pOutMakeFile,"false\n");
fprintf(_pOutMakeFile,"win32\n");
fprintf(_pOutMakeFile,"true\n");
fprintf(_pOutMakeFile,"
\n");
fprintf(_pOutMakeFile,"
\n");
fprintf(_pOutMakeFile,"
\n\n");
}

return nRetCode;
}

void PrintFileName(XMLNode xParentNode, LPCTSTR pszRootFolder)
{
CString strRootFolder = pszRootFolder;

int n=xParentNode.nChildNode();
for( int i = 0; i < n; i ++ )
{
XMLNode xNode = xParentNode.getChildNode(i);
if ( !strcmp(xNode.getName(), "File" ) )
{
const char *pcFileName = xNode.getAttribute("RelativePath");
char *pcNewStr = _strdup(pcFileName );

// Find the file extension
char *ext = strrchr(pcNewStr, '.');
if ( NULL != ext && !strcmp(ext, ".m"))
{
CString strFullFilename;
BOOL bRelativePathToParentFolders;
CString strRelativePath = pcNewStr;

if (IsCurrentDirPath(&strRelativePath))
{
CString strSubPath;
// remove .\ and append path
int pos = strRelativePath.Find("\\");
int len = strRelativePath.GetLength();
if ( pos > 0 ) {
strSubPath = strRelativePath.Right(len-pos-1);
}
// append
strFullFilename = strRootFolder + strSubPath;
}
else
{
strFullFilename = RelativePathToAbsolutePath(strRelativePath,strRootFolder, bRelativePathToParentFolders);
}

fprintf(_pOutMakeFile,"%s\n", strFullFilename.GetBuffer(0) );
}

free( pcNewStr );
}
else
{
PrintFileName(xNode,strRootFolder);
}
}
}


CString RelativePathToAbsolutePath(LPCTSTR contentRelativePath,LPCTSTR rootPath, BOOL &bRelativePathToParentFolders)
{
CString strContentPath;
CString strFullPath;
CString tempPath = _T("");

strContentPath.Format(_T("%s"),contentRelativePath);
tempPath.Format(_T("%s"),contentRelativePath);

// First let's convert to the right kind of path seps:
strContentPath.Replace('/', PATH_SEPARATOR);
CString fullPath = rootPath;
int sepIndex = fullPath.ReverseFind(PATH_SEPARATOR);

// put those together, and we've got our full path
if (sepIndex >= 0)
{
BOOL gotPath = FALSE;
CString strAbsoluteFullPath;
bool bRelativeUp = false;

CString beginStr = strContentPath.Left(3);
bRelativeUp = ( beginStr.CompareNoCase(REL_PATH_STR_WIN) == 0 || beginStr.CompareNoCase(REL_PATH_STR_MAC) == 0 || beginStr.CompareNoCase(REL_PATH_STR_UNIX) == 0 );
bRelativePathToParentFolders = bRelativeUp;

strFullPath = fullPath.Left(sepIndex + 1);

if (!strContentPath.IsEmpty() && strFullPath != contentRelativePath && bRelativeUp) {
CString extension;
int period = strContentPath.ReverseFind('.');
if ( period >= 0 )
extension = strContentPath.Right(strContentPath.GetLength()-period-1);

if ( (extension.GetLength() == 3) || (extension.GetLength() == 1)) {
//strContentPath.Replace(_T("..\\"), _T(".\\"));
CreateFullPath(&strAbsoluteFullPath, strFullPath, strContentPath);
strFullPath = strAbsoluteFullPath;
strFullPath.Replace('/', PATH_SEPARATOR);

gotPath = FileExist(strFullPath);
if (gotPath)
return strFullPath;
else
return CString(_T(""));

}
else
return CString(_T(""));
}
else
{
int sepIndex = strContentPath.ReverseFind(PATH_SEPARATOR);
if (sepIndex >= 0) {
// We have a full path already
gotPath = FileExist(strContentPath);
if (gotPath)
return strContentPath;
}

// We have a relative path (subfolder)
CString extension = _T("");
int period = strContentPath.ReverseFind('.');
if ( period >= 0 )
extension = strContentPath.Right(strContentPath.GetLength()-period-1);

if (extension.GetLength() == 3) {
// single file name no sub folder
strFullPath = strFullPath + strContentPath;
gotPath = FileExist(strFullPath);
if (gotPath)
return strFullPath;
else
return CString(_T(""));
}
}
}
else
{
strFullPath = fullPath;
}

strFullPath += tempPath;

return strFullPath;
}

This will solve the following issue :)

http://stackoverflow.com/questions/1790417/matlab-deployment-add-files-to-source-control

Now let's look at a sample Matlab script which can be converted to an assembly.

Follow the following link

http://www.mathworks.com/matlabcentral/fileexchange/12987-integrating-matlab-with-c

There is a big problem when targeting .NET 4.0 for a client referencing a generated assembly targeting .NET 4.0 as far as I am concerned which should be fixed ASAP by Mathworks. This problem still remains with Matlab R2011a.
A C# client targeting .NET 4.0 will not run on Windows 7 64 bit. When the C# client will try to instantiate the class wrapper for the generated Matlab assembly using new, an exception will be thrown. Only 32 bit OS such as the old Windows XP will support both the .NET Framework 2.0 and 4.0. But not Windows 7 64 bit running as 32 bit. There is a dependency with .NET 2.0 for MWArray.dll at least I can't find the v4 version anywhere under C:\MATLAB\R2011a. Because .NET Framework 2.0 won't install on Windows 7 64 bit, I highly request the Mathworks folks to release MWArray.dll for .NET 4.0 and create a dependency with the 4.0 version when building the assembly. I always check target 4.0 but the dependency is still the 2.0. Maybe this is a fallback and I am missing the 4.0 version or maybe it is not supported.

Deployment Runtime

http://www.mathworks.com/help/toolbox/compiler/f12-999353.html


Thanks!

Google engineer Steve Yegge let the frustration fly in a post regarding the Mountain View's plucky social network

http://www.minyanville.com/dailyfeed/2011/10/13/google-engineer-calls-google-a/

Tuesday, November 01, 2011

Really adobe

One update every two months.... Give me break!!!!

Sept 13, 2011 10.1.1 Q Latest release. This a regular quarterly update with security enhancements, improvements to stability, and bug fixes.
Jun 14, 2011 10.1 Q This is a major update that provides security fixes, feature updates, and major enhancements such as Protected View for Acrobat.
Apr 21, 2011 10.0.3 OOC This patch fixes a vulnerability and provides an updated Flash player.
Mar 21, 2011 10.0.2 OOC This patch fixes a vulnerability and provides an updated Flash player.
Feb 8 2011 10.0.1 Q Numerous security fixes as well as improvements to Protected Mode, QTP support, Flash, and support for SCCM via newly released SCUP catalogs.

Convert Mathlab to C# assembly

Step 1 Install Mathlab 2011

Step 2 Install Visual Studio 2010

Step 3 native compiler

make sure you runmex -setup to select your target C++ compiler



Step 4 To create an Assembly launch Mathlab 2011

Select New Deployment Project then select the target Type



Step 5 Finally build .NET Assembly

The sub folder will contain the Assembly DLL and Native DLL

Small, simple, cross-platform, free and fast C++ XML Parser

Small, simple, cross-platform, free and fast C++ XML Parser

Business Intelligence
TIMi added value
This project started from his frustration that he could not find any simple, portable XML Parser to use inside all my projects (for example, inside the award-winning TIMi software suite created by the Business-Insight company). Let's look at the well-known Xerces C++ library: The complete Xerces project is 53 MB! (11 MB compressed in a zipfile). In 2003, He was developping many small tools. He was using XML as standard for all my input/ouput configuration and data files. The source code of his small tools was usually around 600KB. In these conditions, don't you think at 53MB to be able to read an XML file is a little bit "too much"? So he created his own XML parser. His XML parser "library" is composed of only 2 files: a .cpp file and a .h file. The total size is 104 KB

Here is how it works: The XML parser loads a full XML file in memory, it parses the file and it generates a tree structure representing the XML file. Of course, you can also parse XML data that you have already stored yourself into a memory buffer. Thereafter, you can easily "explore" the tree to get your data. You can also modify the tree using "add" and "delete" functions
and regenerate a formatted XML string from a subtree. Memory management is totally transparent through the use of smart pointers (in other words, you will never have to do any new, delete, malloc or free)("Smart pointers" are a primitive version of the garbage collector in Java).

To the best of his knowledge, there exists no other "non-validating C++ XML parser" that is as simple and as powerfull.

Well Tiny XML is pretty powerful too!

Here are the characteristics of the XMLparser library:

Non-validating XML parser written in standard C++ (DTD's or XSD's informations are ignored).

Cross-plateform: the library is currently used every day on Solaris, Linux (32bit and 64bit) and Windows to manipulate "small" PMML documents (10 MB).
The library has been tested and is working flawlessly using the following compilers: gcc (under linux, Mac OS X Tiger and under many unix flavours), Visual Studio 6.0, Visual Studio .NET (under Windows 9x,NT,2000,XP,Vista,CE,mobile), Intel C/C++ compiler, SUN CC compiler, C++ Borland Compiler. The library is also used under Apple OS, iPhone/iPad OS, Amiga OS, QNX and under the Netburner plateform. To the best of my knowledge, i think that all plateforms are now supported.
The parser builds a tree structure that you can "explore" easily (DOM-type parser).
The parser can be used to generate XML strings from subtrees (it's called rendering). You can also save subtrees directly to files (automatic "Byte Order Mark"-BOM support).
Modification or "from scratch creation" of large XML tree structures in memory using funtions like addChild, addAttribute, updateAttribute, deleteAttribute,...
It's SIMPLE: no need to learn how to use dozens of classes: there is only one simple class: the 'XMLNode' class (that represents one node of the XML tree).

Very efficient (Efficiency is required to be able to handle BIG files):
The string parser is very efficient: It does only one pass over the XML string to create the tree. It does the minimal amount of memory allocations. For example: it does NOT use slow STL::String class but plain, simple and fast C malloc 's. It also allocates large chunk of memory instead of many small chunks. Inside Visual C++, the "debug versions" of the memory allocation functions are very slow: Do not forget to compile in "release mode" to get maximum speed.
The "tree exploration" is very efficient because all operations on the 'XMLNode' class are handled through references: there are no memory copy, no memory allocation, never.

The XML string rendering is very efficient: It does one pass to compute the total memory size of the XML string and a second pass to actually create the string. There is thus only one memory allocation and no extra memory copy. Other libraries are slower because they are using the string concatenation operator that requires many memory (re-)allocations and memory copy.

In-memory parsing
Supports XML namespaces
Very small and totally stand-alone (not built on top of something else). Uses only standard library (and only for the 'fopen' and the 'fread' functions to load the XML file).

Easy to integrate into you own projects: it's only 2 files! The .h file does not contain any implementation code. Compilation is thus very fast.
Robust.
Optionnally, if you define the C++ prepocessor directives STRICT_PARSING and/or APPROXIMATE_PARSING, the library can be "forgiving" in case of errors inside the XML.

He has tried to respect the XML-specs given at: http://www.w3.org/TR/REC-xml/
Fully integrated error handling :
The string parser gives you the precise position and type of the error inside the XML string (if an error is detected).
The library allows you to "explore" a part of the tree that is missing. However data extracted from "missing subtrees" will be NULL. This way, it's really easy to code "error handling" procedures.

Thread-safe (however the global parameters "guessUnicodeChar" and"strictUTF8Parsing" must be unique because they are shared by all threads).
Full Native Supports for a wide range of character sets & encodings: ANSI (legacy) / UTF-8 / Shift-JIS / GB2312 / Big5 / GBK.
Under Windows, Linux, Linux 64 bits & Solaris, they have additionnaly: Unicode 16bit / Unicode 32bit widechar characters support that includes:
For the unicode version of the library: Automatic conversion to Unicode before parsing (if the input XML file is standard ansi 8bit characters).
For the ascii version of the library: Automatic conversion to legacy or UTF-8 before parsing (if the input XML file is unicode 16 or 32bit wide characters).

The XMLParser library is able to handle successfuly chinese, japanese, cyrilic and other extended characters thanks to an extended UTF-8 encoding support, Shift-JIS (japanese) and to GB2312/Big5/GBK encoding support (chinese) (see this UTF-8-demo that shows the characters available). If you are still experiencing character encoding problems, he suggest you to convert your XML files to UTF-8 using a tool like iconv (precompiled win32 binary).

Transparent memory management through the use of smart pointers.

Support for a wide range of clearTags that are containing unformatted text:
{![CDATA[ ... ]]}, {!-- ... --}, {PRE} ... {/PRE}, {!DOCTYPE ... }
Unformatted texts are not parsed by the library and can contain items that are usually 'forbidden' in XML (for example: html code)
Support for inclusion of pure binary data (images, sounds,...) into the XML document using the four provided ultrafast Base64 conversion functions.
The library is under the Aladdin Free Public License(AFPL).


A small tutorial
Let's assume that you want to parse the XML file "PMMLModel.xml" that contains:
( all < replace by { and all > replace by } )

{?xml version="1.0" encoding="ISO-8859-1"?>
{PMML version="3.0" xmlns="http://www.dmg.org/PMML-3-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema_instance"}
{Header copyright="Frank Vanden Berghen"}
Hello World!
{Application name="<Condor>" version="1.99beta" /}
{/Header}
{Extension name="keys"}
{Key name="urn"}{/Key}
{/Extension}
{DataDictionary}
{DataField name="persfam" optype="continuous" dataType="double"}
{Value value="9.900000e+001" property="missing" /}
{/DataField}
{DataField name="prov" optype="continuous" dataType="double" /}
{DataField name="urb" optype="continuous" dataType="double" /}
{DataField name="ses" optype="continuous" dataType="double" /}
{/DataDictionary}
{RegressionModel functionName="regression" modelType="linearRegression"} {RegressionTable intercept="0.00796037"}
{NumericPredictor name="persfam" coefficient="-0.00275951" /}
{NumericPredictor name="prov" coefficient="0.000319433" /}
{NumericPredictor name="ses" coefficient="-0.000454307" /}
{NONNumericPredictor name="testXmlExample" />
{/RegressionTable}
{/RegressionModel}
{/PMML}

Let's analyse line by line the following small example program:

#include // to get "printf" function
#include // to get "free" function
#include "xmlParser.h"

int main(int argc, char **argv)
{
// this open and parse the XML file:
XMLNode xMainNode=XMLNode::openFileHelper("PMMLModel.xml","PMML");
// this prints "":
XMLNode xNode=xMainNode.getChildNode("Header");
printf("Application Name is: '%s'\n", xNode.getChildNode("Application").getAttribute("name"));
// this prints "Hello world!":
printf("Text inside Header tag is :'%s'\n", xNode.getText());
// this gets the number of "NumericPredictor" tags: xNode=xMainNode.getChildNode("RegressionModel").getChildNode("RegressionTable");
int n=xNode.nChildNode("NumericPredictor");
// this prints the "coefficient" value for all the "NumericPredictor" tags:
for (int i=0; i printf("coeff %i=%f\n",i+1,atof(xNode.getChildNode("NumericPredictor",i).getAttribute("coefficient")));
// this prints a formatted ouput based on the content of the first "Extension" tag of the XML file:
char *t=xMainNode.getChildNode("Extension").createXMLString(true); printf("%s\n",t);
free(t);
return 0;
}

Thursday, October 20, 2011

XML Parser using XmlReader from an XML string in C#

System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
Byte[] pBytes = encoding.GetBytes(strXML);
MemoryStream pMem = new MemoryStream(pBytes, 0, pBytes.Length, true, true);
XmlReader reader = XmlReader.Create(pMem);
string s = Encoding.UTF8.GetString(pMem.GetBuffer(), 0, (int)pMem.Position);
XmlElement element;
XmlDocument xmlDoc = new XmlDocument();
pMem.Seek(0, SeekOrigin.Begin);


while (reader.Read())
{
XmlNode node = null;
switch (reader.NodeType)
{
case XmlNodeType.Element:
bool fEmptyElement = reader.IsEmptyElement;
element = xmlDoc.CreateElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
//element.IsEmpty = fEmptyElement;
//ReadAttributes(reader, element);
//if (!fEmptyElement) {
//parent.AppendChild(element);
//parent = element;
//continue;
//}
//node = element;
break;

case XmlNodeType.EndElement:
//if (parent.ParentNode == null)
//{
// syntax error in document.
// IXmlLineInfo li = (IXmlLineInfo)reader;
// throw new XmlException(string.Format(SR.UnexpectedToken,"", li.LineNumber, li.LinePosition), null, li.LineNumber, li.LinePosition);
// }
//parent = parent.ParentNode;
continue;

case XmlNodeType.EntityReference:
if (reader.CanResolveEntity)
{
reader.ResolveEntity();
}
continue;

case XmlNodeType.EndEntity:
continue;

case XmlNodeType.Attribute:
//node = LoadAttributeNode(parent);
break;

case XmlNodeType.Text:
node = xmlDoc.CreateTextNode(reader.Value);
break;

case XmlNodeType.SignificantWhitespace:
node = xmlDoc.CreateSignificantWhitespace(reader.Value);
break;

case XmlNodeType.Whitespace:
//if (preserveWhitespace) {
// node = xmlDoc.CreateWhitespace(reader.Value);
// break;
//}
//else {
//continue;
//}
continue;
case XmlNodeType.CDATA:
node = xmlDoc.CreateCDataSection(reader.Value);
break;

case XmlNodeType.XmlDeclaration:
break;

case XmlNodeType.ProcessingInstruction:
node = xmlDoc.CreateProcessingInstruction(reader.Name, reader.Value);
break;

case XmlNodeType.Comment:
node = xmlDoc.CreateComment(reader.Value);
break;

case XmlNodeType.DocumentType:
string pubid = r.GetAttribute("PUBLIC");
string sysid = r.GetAttribute("SYSTEM");
node = xmlDoc.CreateDocumentType(reader.Name, pubid, sysid, reader.Value);
break;

default:
//UnexpectedNodeType(reader.NodeType);
break;
}
}

Monday, October 17, 2011

SearchIndexer.exe really suck !!!

Will slow down your computer bit time....
Will suck 1 GB of memory in less than 5 minutes....

Whoever wrote this at Microsoft should be fire!!!

Turn off indexing and speed up Windows XP
If you don't use Windows XP's built-in search often (like every day), disabling indexing can significantly speed up your PC.

By default Windows XP indexes files on your hard drive and stores them in memory to speed up its' built-in search. But if you rarely use Windows search, turn off indexing to free up memory and CPU horsepower for the files and applications you actually do use. A few simple how-to steps after the jump.

To turn off indexing:

Open up "My Computer."
Right-click on your hard drive (usually "C:") and choose "Properties."
Uncheck the box at the bottom that reads "Allow Indexing Service to..."
Click OK, and files will be removed from memory. This removal may take a few minutes to complete.
To disable the indexing service:

In the "Start" menu, choose "Run."
Type "services.msc" and press Enter.
Scroll-down to "Indexing Service" and double-click it.
If the service status is "Running", then stop it by pressing the "Stop" button.
To make sure this service doesn't run again, under "Startup Type:", choose "Disabled."
Windows search will still work if you perform these steps, but it will work more slowly than if indexing was enabled.

Brute force WTF (aka What The Fuck!)

And to avoid rebooting the machine kill the process searchindexer.exe point to C:\WINDOWS\system32 and rename searchindexer.exe to searchindexer.exe.old.
This time you should be good. If you don't rename searchindexer.exe process will be automatically restarted....

Thursday, October 13, 2011

Farewell Dennis Ritchie

int main( int argc, char **argv )
{
printf( "Goodbye, world. :(\n" );
}



L'eulogie par Bjarne Stroustrup:

"
Before C, there was far more hardware diversity than we see in the
industry today. Computers proudly sported not just deliciously
different and offbeat instruction sets, but varied wildly in almost
everything, right down to even things as fundamental as character bit
widths (8 bits per byte doesn’t suit you? how about 9? or 7? or how
about sometimes 6 and sometimes 12?) and memory addressing (don’t like
16-bit pointers? how about 18-bit pointers, and oh by the way those
aren’t pointers to bytes, they’re pointers to words?).

There was no such thing as a general-purpose program that was both
portable across a variety of hardware and also efficient enough to
compete with custom code written for just that hardware. Fortran did
okay for array-oriented number-crunching code, but nobody could do it
for general-purpose code such as what you’d use to build just about
anything down to, oh, say, an operating system.

So this young upstart whippersnapper comes along and decides to try to
specify a language that will let people write programs that are: (a)
high-level, with structures and functions; (b) portable to just about
any kind of hardware; and (c) efficient on that hardware so that
they’re competitive with handcrafted nonportable custom assembler code
on that hardware. A high-level, portable, efficient systems
programming language.

How silly. Everyone knew it couldn’t be done.

C is a poster child for why it’s essential to keep those people who
know a thing can’t be done from bothering the people who are doing it.
(And keep them out of the way while the same inventors, being anything
but lazy and always in search of new problems to conquer, go on to use
the world’s first portable and efficient programming language to build
the world’s first portable operating system, not knowing that was
impossible too.)

Thanks, Dennis.
"

https://plus.google.com/u/0/101960720994009339267/posts/33mmANQZDtY

The UNIX Time-Sharing System
http://www.alcatel-lucent.com/bstj/vol57-1978/articles/bstj57-6-1905.pdf

UNIX Time-Sharing System: A Retrospective
http://www.alcatel-lucent.com/bstj/vol57-1978/articles/bstj57-6-1947.pdf

UNIX Time-Sharing System: The C Programming Language
http://www.alcatel-lucent.com/bstj/vol57-1978/articles/bstj57-6-1991.pdf

http://geektionnerd.net/un-genie-est-mort/

Friday, October 07, 2011

Farewell Steve

I remember when it all started, moving that turtle around on the screen in elementary school using Logo then came the Apple I.

I remember programming Basic on an Apple ][ playing, karateka, sorcelery choplifter and loderunner.

I remember playing chess master on the mac+ of my uncle.

I remember beeing impressed by the 16 millions color of the Next Cube and it's DSP processor and I remember looking at the Next computer in Reims and drooling on being able to compile anything on it.

I remember seeing Toy Story and some cool pixar CGI done with renderman.

I remember working on a car adapter for the iPod at Motorola when the stock rise begin

I remember the simplicity of the iPod Touch.

I remember trading an iPod touch against two Adobe products to listen to music in my car after quite some resistence.

I remember comparing Microsoft, Google, Apple and the NASDAQ chart on yahoo and Google finance web site and see how Apple reaches 400$ and became the largest company in US by passing Chevron.

I remember enjoying writing COCOA code for Adobe on a very slick Mac Book Pro 17 inch.

I remember seeing Steve so incredibly excited to give a “small token” of appreciation at the Apple all-hands by giving everyone an iPod shuffle.

I remember the war between Apple and Adobe around Flash and in the end I think you made the right decision and left an open window for engineer to replace FLash by HTML5.

I remember seeing the words pancreatic cancer on the internet.

I remember my first iPhone 4 and that I will have an iPad soon :)

I remember my optimism and the world optimisim of seeing Steve beating this thing like Phil Lesh, the bassist of the Grateful Dead who defeated prostate cancer. This is sad to see that the one-year relative survival rate for pancreatic cancer is 20%, and the five-year rate is 4%.


This week many folks stopped by the Apple campus to pay some respects and remember Steve.


The parking lot was packed. There was some security, a bench with some flowers, some candles, and an iPad with the photo of Steve on the display.


Silence, Sadness and Loss.

Steve touched our lives in so many personal, and emotional ways. Thanks you for being different and a genius leader!


You will be missed Steve!

http://www.cnn.com/2011/10/05/us/obit-steve-jobs/index.html

Friday, September 09, 2011

Electric Commander PERL system call limition

If you ever wanted to execute a UI process on Windows using an Electric Commander step written in perl you will realize that you can only execute binary using STD IO in case your agent is running as a service.
One reason is that Electric commander will pipe all STD IO to its internal logging mecanism associated to each JOB you are running for each STEP.

Complete reason has been posted here
https://electriccloud.zendesk.com/entries/64647-kbec-00037-running-steps-that-require-an-interactive-windows-desktop-on-the-agent-machine

The only workaround I found is to implement an IOCP WIN32 service that you can use to send message using SOCKET. At this point the IOCP WIN32 service can execute the native application including complex application which may require OLE AUTOMATION. EG Itunes :), Microsoft Excel, etc...

Will not work

my $exePath = 'C:/Program Files/Notepad++/Notepad++.exe';
print "Execute $exePath \n";
$exitCode = system($exePath );

The process is spawn. I can see it using the Task Manager under Process tab but the Process doesn't receive ACTIVATION.

Here is the script that I use!

use IO::Socket;
use ElectricCommander;
use Cwd;
use Time::Local;

use Win32::Process;
use Win32::TieRegistry;
use Win32::TieRegistry qw(:KEY_);

my $regKey;
my $UserShellFoldersKey;
my $valueString;
my $exitCode = -1;
my $process;

# if you need to request current user folder
$regKey = new Win32::TieRegistry "CUser",
{ Access=>KEY_READ(), Delimiter=>"/" };
$UserShellFoldersKey = $regKey->Open( "Software/Microsoft/Windows/CurrentVersion/Explorer/User Shell Folders" );

# Get value data:
$valueString= $UserShellFoldersKey->GetValue("Personal");


my $launchedByUser = '$[/myJob/launchedByUser]';
my $jobName = '$[/myJob/jobName]';

my $build_test_dir = 'C:\\ec_workspace\\'.$jobName.'\\';


my $msg = '';

#the caller
my $sock_call = new IO::Socket::INET (
PeerAddr => 'localhost',
PeerPort => '4000',
Proto => 'tcp',
);
if ($sock_call)
{
print $sock_call "LaunchNotepad++\n";
my $sock_addr = recv($sock_call,$msg,190,0);
print $msg;

close($sock_call);
}
else
{
print "ERROR Could not create client socket to IOCP Broadcom Automation Service!\n";
die "Could not create client socket to IOCP Broadcom Automation Service $!\n";
}


}

The IOCP server (WIN32 service) is very small and powerful because it is using asynchronous IO so it can handle a lot of simultaneous request comming from multiple Electric commander JOBS. In my case the IOCP server will take care of enumerating the target process before executing it because the target process was not single instance and in my case if two JOBS were running at the same time I wanted to make sure not to end up with two running instances. Off course you can limit this inside Electric Commander itself by preventing job concurrency but then the UI can be left open at the end of its execution. Maybe you want to Remote Desktop the machine the next day to look at results. During this time you want to prevent others automation to be executed. To perform synchronisation the script can wait on idle for the same time used by the automation process to complete. You know this only after monitoring the automation process. Once you know you'll have to tune your step.

Electric Commander is very powerful. I wish I could afford the license to use it to perform recuring video security monitoring and reporting on a server running at home because once you can send message using local socket between EC apache instance and your process, you are entitled to implement a million of creative ideas!

Automation server and bot rules the world! Aren't they ?

IOCP Server

int CALLBACK WinMain(HINSTANCE hInstance,HINSTANCE ,LPSTR ,int ){
....
init();
run();
}

static void init(void)
{
init_winsock();
create_io_completion_port();
create_listening_socket();
bind_listening_socket();
start_listening();
load_accept_ex();
start_accepting();
}

static void run(void)
{
DWORD length;
BOOL resultOk;
WSAOVERLAPPED* ovl_res;
SocketState* socketState;

for (;;)
{
resultOk = get_completion_status(&length, &socketState, &ovl_res);

switch (socketState->operation)
{
case OP_ACCEPT:
OutputDebugString(L"* operation ACCEPT completed\n");
accept_completed(resultOk, length, socketState, ovl_res);
break;

case OP_READ:
OutputDebugString(L"* operation READ completed\n");
read_completed(resultOk, length, socketState, ovl_res);
break;

case OP_WRITE:
OutputDebugString(L"* operation WRITE completed\n");
write_completed(resultOk, length, socketState, ovl_res);
break;

default:
OutputDebugString(L"* error, unknown operation!!!\n");
destroy_connection(socketState, ovl_res); // hope for the best!
break;
} // switch
} // for
}

static void read_completed(BOOL resultOk, DWORD length,
SocketState* socketState, WSAOVERLAPPED* ovl)
{

if (resultOk)
{
if (length > 0)
{
_TCHAR message[512];
_sntprintf(message,512,L"* read operation completed, %d bytes read\n", length);
OutputDebugString(message);


wchar_t *pwText = NULL;
pwText = new wchar_t[length];
if(!pwText)
{
delete []pwText;
}
memset(pwText,0,length*sizeof(wchar_t));
MultiByteToWideChar (CP_ACP, 0, socketState->buf, -1, pwText, length-1 );

_sntprintf(message,512,L"* buffer: %s\n", pwText);
OutputDebugString(message);


HINSTANCE hInstanceMobCat = NULL;
HWND hWndMobCat = NULL;
DWORD dwProcessIdMobcat = 0;

if (_tcsicmp(pwText,L"LaunchNotepad++")==0)
{
std::string szExecutable = "C:\\Program Files\\Notepad++\\Notepad++.exe";

bstrExecutable = utf8toUTF16(szExecutable);
// Can't call ShellExecuteEx on main thread since it runs a message loop!
// That would let windows messages sneak in before they are expected (Bug 2507120)
HANDLE const hShellExecThread = CreateThread(NULL, 0, callShellExecThreadProc, bstrExecutable, 0, NULL);
if (!hShellExecThread)
{
}
DWORD result = WaitForSingleObject( hShellExecThread, INFINITE );
if( result == WAIT_FAILED )
{
}
DWORD exitCode = 5;
BOOL success = ::GetExitCodeProcess( hShellExecThread, &exitCode );
if( !success ) exitCode = 5;
CloseHandle(hShellExecThread);
}

delete []pwText;

// starts another write back to caller
socketState->length = length;
start_writing(socketState, ovl);
}
else // length == 0
{
OutputDebugString(L"* connection closed by client\n");
destroy_connection(socketState, ovl);
}
}
else // !resultOk, assumes connection was reset
{ int err = GetLastError();

_TCHAR message[512];

_sntprintf(message,512,L"* error %d in recv, assuming connection was reset by client\n", err);

OutputDebugString(message);
destroy_connection(socketState, ovl);
}
}

Monday, August 15, 2011

GOOGLE buying MMI

One of those acquisition to remember

http://www.businessinsider.com/live-google-and-motorola-explain-the-big-acquisition-2011-8


http://www.businessinsider.com/google-just-admitted-that-android-is-a-mess-2011-8

Wednesday, August 03, 2011

Android Monkey Script DispatchPress Bug

When using Monkey Script I noticed that DispatchPress(KEYCODE_BACK)
is doing nothing which really suck. In many cases this is due to the fact that the Activity doesn't consume the Key event.
The solution to this problem is to use a mix of monkey script and
adb shell input command in a sequence.

1 Using monkey script gave some great timing
control. Wait a certain amount of second for the activity and is a
blocking adb call.
2 Finally sending adb shell input keyevent 4 will end the running APK.

EG

adb shell monkey -p com.my.application -v -v -v -f /sdcard/monkey_script.txt 1
adb shell input keyevent 4

Wednesday, July 27, 2011

How to rotate or flip a video inside Adobe Premiere

When recording video with iPhone or Android device it is possible to record an up side down video. In this case you'll probably need to rotate/flip the video using Adobe Premiere before exporting the video to H264 :)

To do so here is what you can do in Adobe Premiere CS3/CS4 and probably CS5

Hit [Window] > [Effect Controls] *To see the panel*

Click on the clip that you want to flip

Hit [Video effects] > [Motion] > [Rotation]

Type in 180 instead of 0.

Friday, July 22, 2011

Virtual Earth

When I was integrating Virtual Earth 3D in a GPS location software
I noticed that the default InfoBox for a push pin added on the map has a fixed size. When looking at Microroft documentation they said that the style can be overriden by calling map.ClearInfoBoxStyles().

http://msdn.microsoft.com/en-us/library/bb412441.aspx#Y792

Well this is working for 2D map but for 3D the info box is blanked.

The Virtual Earth CSS is poorly documented but I found a way to override the style sheet without calling ClearInfoBoxStyles and then be able to view bigger infobox.
Include the following at the top of your hosting page

/* override VE css to resize infoboxes */

.ero .ero-body
{
width:550px!important;
overflow: auto;
}

.ero .firstChild
{
width:540px!important;
}

Wednesday, June 15, 2011

Android Monkey Script

Monkey: The Monkey is a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner.

Monkey script is unfortunately poorly documented but it is pretty easy to write monkey script after looking at the Monkey Script Java source code itself. The Java Source code is the code in charge of parsing the monkey script and dispatching all monkey script event in a timely manner.

development/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java

/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.android.commands.monkey;

import android.os.SystemClock;
import android.view.KeyEvent;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.StringTokenizer;

/**
* monkey event queue. It takes a script to produce events
*
* sample script format:
* type= raw events
* count= 10
* speed= 1.0
* start data >>
* captureDispatchPointer(5109520,5109520,0,230.75429,458.1814,0.20784314,
* 0.06666667,0,0.0,0.0,65539,0)
* captureDispatchKey(5113146,5113146,0,20,0,0,0,0)
* captureDispatchFlip(true)
* ...
*/
public class MonkeySourceScript implements MonkeyEventSource {
private int mEventCountInScript = 0; //total number of events in the file
private int mVerbose = 0;
private double mSpeed = 1.0;
private String mScriptFileName;
private MonkeyEventQueue mQ;

private static final String HEADER_TYPE = "type=";
private static final String HEADER_COUNT = "count=";
private static final String HEADER_SPEED = "speed=";

private long mLastRecordedDownTimeKey = 0;
private long mLastRecordedDownTimeMotion = 0;
private long mLastExportDownTimeKey = 0;
private long mLastExportDownTimeMotion = 0;
private long mLastExportEventTime = -1;
private long mLastRecordedEventTime = -1;

private static final boolean THIS_DEBUG = false;
// a parameter that compensates the difference of real elapsed time and
// time in theory
private static final long SLEEP_COMPENSATE_DIFF = 16;

// maximum number of events that we read at one time
private static final int MAX_ONE_TIME_READS = 100;

// number of additional events added to the script
// add HOME_KEY down and up events to make start UI consistent in each round
private static final int POLICY_ADDITIONAL_EVENT_COUNT = 2;

// event key word in the capture log
private static final String EVENT_KEYWORD_POINTER = "DispatchPointer";
private static final String EVENT_KEYWORD_TRACKBALL = "DispatchTrackball";
private static final String EVENT_KEYWORD_KEY = "DispatchKey";
private static final String EVENT_KEYWORD_FLIP = "DispatchFlip";

// a line at the end of the header
private static final String STARTING_DATA_LINE = "start data >>";
private boolean mFileOpened = false;

FileInputStream mFStream;
DataInputStream mInputStream;
BufferedReader mBufferReader;

public MonkeySourceScript(String filename, long throttle) {
mScriptFileName = filename;
mQ = new MonkeyEventQueue(throttle);
}

/**
*
* @return the number of total events that will be generated in a round
*/
public int getOneRoundEventCount() {
//plus one home key down and up event
return mEventCountInScript + POLICY_ADDITIONAL_EVENT_COUNT;
}

private void resetValue() {
mLastRecordedDownTimeKey = 0;
mLastRecordedDownTimeMotion = 0;
mLastExportDownTimeKey = 0;
mLastExportDownTimeMotion = 0;
mLastRecordedEventTime = -1;
mLastExportEventTime = -1;
}

private boolean readScriptHeader() {
mEventCountInScript = -1;
mFileOpened = false;
try {
if (THIS_DEBUG) {
System.out.println("reading script header");
}

mFStream = new FileInputStream(mScriptFileName);
mInputStream = new DataInputStream(mFStream);
mBufferReader = new BufferedReader(
new InputStreamReader(mInputStream));
String sLine;
while ((sLine = mBufferReader.readLine()) != null) {
sLine = sLine.trim();
if (sLine.indexOf(HEADER_TYPE) >= 0) {
// at this point, we only have one type of script
} else if (sLine.indexOf(HEADER_COUNT) >= 0) {
try {
mEventCountInScript = Integer.parseInt(sLine.substring(
HEADER_COUNT.length() + 1).trim());
} catch (NumberFormatException e) {
System.err.println(e);
}
} else if (sLine.indexOf(HEADER_SPEED) >= 0) {
try {
mSpeed = Double.parseDouble(sLine.substring(
HEADER_SPEED.length() + 1).trim());

} catch (NumberFormatException e) {
System.err.println(e);
}
} else if (sLine.indexOf(STARTING_DATA_LINE) >= 0) {
// header ends until we read the start data mark
mFileOpened = true;
if (THIS_DEBUG) {
System.out.println("read script header success");
}
return true;
}
}
} catch (FileNotFoundException e) {
System.err.println(e);
} catch (IOException e) {
System.err.println(e);
}

if (THIS_DEBUG) {
System.out.println("Error in reading script header");
}
return false;
}

private void processLine(String s) {
int index1 = s.indexOf('(');
int index2 = s.indexOf(')');

if (index1 < 0 || index2 < 0) {
return;
}

StringTokenizer st = new StringTokenizer(
s.substring(index1 + 1, index2), ",");

if (s.indexOf(EVENT_KEYWORD_KEY) >= 0) {
// key events
try {
long downTime = Long.parseLong(st.nextToken());
long eventTime = Long.parseLong(st.nextToken());
int action = Integer.parseInt(st.nextToken());
int code = Integer.parseInt(st.nextToken());
int repeat = Integer.parseInt(st.nextToken());
int metaState = Integer.parseInt(st.nextToken());
int device = Integer.parseInt(st.nextToken());
int scancode = Integer.parseInt(st.nextToken());

MonkeyKeyEvent e = new MonkeyKeyEvent(downTime, eventTime,
action, code, repeat, metaState, device, scancode);
mQ.addLast(e);

} catch (NumberFormatException e) {
// something wrong with this line in the script
}
} else if (s.indexOf(EVENT_KEYWORD_POINTER) >= 0 ||
s.indexOf(EVENT_KEYWORD_TRACKBALL) >= 0) {
// trackball/pointer event
try {
long downTime = Long.parseLong(st.nextToken());
long eventTime = Long.parseLong(st.nextToken());
int action = Integer.parseInt(st.nextToken());
float x = Float.parseFloat(st.nextToken());
float y = Float.parseFloat(st.nextToken());
float pressure = Float.parseFloat(st.nextToken());
float size = Float.parseFloat(st.nextToken());
int metaState = Integer.parseInt(st.nextToken());
float xPrecision = Float.parseFloat(st.nextToken());
float yPrecision = Float.parseFloat(st.nextToken());
int device = Integer.parseInt(st.nextToken());
int edgeFlags = Integer.parseInt(st.nextToken());

int type = MonkeyEvent.EVENT_TYPE_TRACKBALL;
if (s.indexOf("Pointer") > 0) {
type = MonkeyEvent.EVENT_TYPE_POINTER;
}
MonkeyMotionEvent e = new MonkeyMotionEvent(type, downTime, eventTime,
action, x, y, pressure, size, metaState, xPrecision, yPrecision,
device, edgeFlags);
mQ.addLast(e);
} catch (NumberFormatException e) {
// we ignore this event
}
} else if (s.indexOf(EVENT_KEYWORD_FLIP) >= 0) {
boolean keyboardOpen = Boolean.parseBoolean(st.nextToken());
MonkeyFlipEvent e = new MonkeyFlipEvent(keyboardOpen);
mQ.addLast(e);
}
}

private void closeFile() {
mFileOpened = false;
if (THIS_DEBUG) {
System.out.println("closing script file");
}

try {
mFStream.close();
mInputStream.close();
} catch (IOException e) {
System.out.println(e);
}
}

/**
* add home key press/release event to the queue
*/
private void addHomeKeyEvent() {
MonkeyKeyEvent e = new MonkeyKeyEvent(KeyEvent.ACTION_DOWN,
KeyEvent.KEYCODE_HOME);
mQ.addLast(e);
e = new MonkeyKeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_HOME);
mQ.addLast(e);
}

/**
* read next batch of events from the provided script file
* @return true if success
*/
private boolean readNextBatch() {
String sLine = null;
int readCount = 0;

if (THIS_DEBUG) {
System.out.println("readNextBatch(): reading next batch of events");
}

if (!mFileOpened) {
if (!readScriptHeader()) {
closeFile();
return false;
}
resetValue();

/*
* In order to allow the Monkey to replay captured events multiple times
* we need to define a default start UI, which is the home screen
* Otherwise, it won't be accurate since the captured events
* could end anywhere
*/
addHomeKeyEvent();
}

try {
while (readCount++ < MAX_ONE_TIME_READS &&
(sLine = mBufferReader.readLine()) != null) {
sLine = sLine.trim();
processLine(sLine);
}
} catch (IOException e) {
System.err.println(e);
return false;
}

if (sLine == null) {
// to the end of the file
if (THIS_DEBUG) {
System.out.println("readNextBatch(): to the end of file");
}
closeFile();
}
return true;
}

/**
* sleep for a period of given time, introducing latency among events
* @param time to sleep in millisecond
*/
private void needSleep(long time) {
if (time < 1) {
return;
}
try {
Thread.sleep(time);
} catch (InterruptedException e) {
}
}

/**
* check whether we can successfully read the header of the script file
*/
public boolean validate() {
boolean b = readNextBatch();
if (mVerbose > 0) {
System.out.println("Replaying " + mEventCountInScript +
" events with speed " + mSpeed);
}
return b;
}

public void setVerbose(int verbose) {
mVerbose = verbose;
}

/**
* adjust key downtime and eventtime according to both
* recorded values and current system time
* @param e KeyEvent
*/
private void adjustKeyEventTime(MonkeyKeyEvent e) {
if (e.getEventTime() < 0) {
return;
}
long thisDownTime = 0;
long thisEventTime = 0;
long expectedDelay = 0;

if (mLastRecordedEventTime <= 0) {
// first time event
thisDownTime = SystemClock.uptimeMillis();
thisEventTime = thisDownTime;
} else {
if (e.getDownTime() != mLastRecordedDownTimeKey) {
thisDownTime = e.getDownTime();
} else {
thisDownTime = mLastExportDownTimeKey;
}
expectedDelay = (long) ((e.getEventTime() -
mLastRecordedEventTime) * mSpeed);
thisEventTime = mLastExportEventTime + expectedDelay;
// add sleep to simulate everything in recording
needSleep(expectedDelay - SLEEP_COMPENSATE_DIFF);
}
mLastRecordedDownTimeKey = e.getDownTime();
mLastRecordedEventTime = e.getEventTime();
e.setDownTime(thisDownTime);
e.setEventTime(thisEventTime);
mLastExportDownTimeKey = thisDownTime;
mLastExportEventTime = thisEventTime;
}

/**
* adjust motion downtime and eventtime according to both
* recorded values and current system time
* @param e KeyEvent
*/
private void adjustMotionEventTime(MonkeyMotionEvent e) {
if (e.getEventTime() < 0) {
return;
}
long thisDownTime = 0;
long thisEventTime = 0;
long expectedDelay = 0;

if (mLastRecordedEventTime <= 0) {
// first time event
thisDownTime = SystemClock.uptimeMillis();
thisEventTime = thisDownTime;
} else {
if (e.getDownTime() != mLastRecordedDownTimeMotion) {
thisDownTime = e.getDownTime();
} else {
thisDownTime = mLastExportDownTimeMotion;
}
expectedDelay = (long) ((e.getEventTime() -
mLastRecordedEventTime) * mSpeed);
thisEventTime = mLastExportEventTime + expectedDelay;
// add sleep to simulate everything in recording
needSleep(expectedDelay - SLEEP_COMPENSATE_DIFF);
}

mLastRecordedDownTimeMotion = e.getDownTime();
mLastRecordedEventTime = e.getEventTime();
e.setDownTime(thisDownTime);
e.setEventTime(thisEventTime);
mLastExportDownTimeMotion = thisDownTime;
mLastExportEventTime = thisEventTime;
}

/**
* if the queue is empty, we generate events first
* @return the first event in the queue, if null, indicating the system crashes
*/
public MonkeyEvent getNextEvent() {
long recordedEventTime = -1;

if (mQ.isEmpty()) {
readNextBatch();
}
MonkeyEvent e = mQ.getFirst();
mQ.removeFirst();

if (e.getEventType() == MonkeyEvent.EVENT_TYPE_KEY) {
adjustKeyEventTime((MonkeyKeyEvent) e);
} else if (e.getEventType() == MonkeyEvent.EVENT_TYPE_POINTER ||
e.getEventType() == MonkeyEvent.EVENT_TYPE_TRACKBALL) {
adjustMotionEventTime((MonkeyMotionEvent) e);
}
return e;
}
}

To write monkey script the first thing you have to do is write a small JAVA application. You can use hello world sample application. You can build it using Eclipse Java IDE and Android Windows SDK. Inside your sample application open the main activity JAVA file and add some code to enumerate the activity of an APK of your choice assuming this application is not presently running. If the application you'd like to automate is running, then use getPackageInfo(), instead of getPackageArchiveInfo().

See code bellow. Run the "rever engineering" application in the debugger with the device attached to your PC/Laptop with USB cable so that you can step into the code.


import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.Log;

public class ReverseEngineering extends Activity
{
static final String TAG = "ReverseEngineering:Log";

/** onStart() is called when the application is on the foreground.
* We shouldn't use onCreate() which is called only once in the phone's process life cycle.
* This function will override what is available in the parent Activity class. */
@Override
public void onStart()
{
// Keep on starting.
super.onStart();
setContentView(R.layout.main);

PackageManager pm = getPackageManager();

PackageInfo info = pm.getPackageArchiveInfo("/data/app/com.company.application-1.apk", PackageManager.GET_ACTIVITIES);
if(info != null){
ApplicationInfo appInfo = info.applicationInfo;
String appName = pm.getApplicationLabel(appInfo).toString();
String packageName = appInfo.packageName;
Log.d(TAG, " appName =" + appName);
Log.d(TAG, " packageName =" + packageName);
}

ActivityInfo[] list = pm.getPackageArchiveInfo("/data/app/com.company.application-1.apk", PackageManager.GET_ACTIVITIES).activities;
for(int i = 0;i< list.length; i++){
String strName = list[i].getClass().getName();
Log.d(TAG, " ActivityInfo =" + strName);
}


Once you know the name of the activity you can invoke, write a small script.
The following script named monkey_script.txt will execute a package and
its activity.

captureDispatchPointer is a tap down action followed by a tap up action at the coordinate x and y EG X 146 and Y 165 as if you were using the touch screen with your finger. To find out the coordinate for a particular screen on the device you need to capture the screen using ddms (android tool) and open the screen with your favorites image editor. Mine is PhotoShop CS5 or Gimp if you don't have that much $ to spend. Development on Android is free after all.

# KEYEVENT http://developer.android.com/reference/android/view/KeyEvent.html# Start of Script
type= user
count= 49
speed= 1.0
start data >>
LaunchActivity(com.company.application.Activity, com.company.application.Activity)
UserWait(2000)
# first screen
captureDispatchPointer(5109520,5109520,0,146,165,0,0,0,0,0,0,0);
captureDispatchPointer(5109521,5109521,1,146,165,0,0,0,0,0,0,0);
UserWait(5000)
# second screen
captureDispatchPointer(5109520,5109520,0,117,268,0,0,0,0,0,0,0);
captureDispatchPointer(5109521,5109521,1,117,268,0,0,0,0,0,0,0);
# second screen selection dialog autoclose on selection
UserWait(2000)
# now access an other screen
captureDispatchPointer(5109520,5109520,0,117,358,0,0,0,0,0,0,0);
captureDispatchPointer(5109521,5109521,1,117,358,0,0,0,0,0,0,0);
UserWait(2000)
# access a selection dialog with only a cancel button. Dialog will autoclose on tap down
captureDispatchPointer(5109520,5109520,0,117,177,0,0,0,0,0,0,0);
captureDispatchPointer(5109521,5109521,1,117,177,0,0,0,0,0,0,0);
UserWait(2000)

A more complex script with android keypad input

# KEYEVENT http://developer.android.com/reference/android/view/KeyEvent.html
# Start of Script
type= user
count= 49
speed= 1.0
start data >>
LaunchActivity(com.mpowerlabs.coin.android, com.mpowerlabs.coin.android.LoginActivity)
# 3120021258
DispatchPress(KEYCODE_3)
UserWait(200)
DispatchPress(KEYCODE_1)
UserWait(200)
DispatchPress(KEYCODE_3)
UserWait(200)
DispatchPress(KEYCODE_5)
UserWait(200)
DispatchPress(KEYCODE_0)
UserWait(200)
DispatchPress(KEYCODE_2)
UserWait(200)
DispatchPress(KEYCODE_1)
UserWait(200)
DispatchPress(KEYCODE_2)
UserWait(200)
DispatchPress(KEYCODE_5)
UserWait(200)
DispatchPress(KEYCODE_8)
UserWait(200)
# Pin 12345
DispatchPress(KEYCODE_DPAD_DOWN)
UserWait(250)
DispatchPress(KEYCODE_1)
UserWait(200)
DispatchPress(KEYCODE_2)
UserWait(200)
DispatchPress(KEYCODE_3)
UserWait(200)
DispatchPress(KEYCODE_4)
UserWait(200)
DispatchPress(KEYCODE_5)
UserWait(200)
# Down and enter
DispatchPress(KEYCODE_DPAD_DOWN)
UserWait(250)
DispatchPress(KEYCODE_ENTER)

To execute the script on the device you need to create a batch file.

1 to make sure the application is deploy on the device
2 push the script
3 execute the script

adb root
adb install com.company.application.apk
adb push monkey_script.txt /sdcard/monkey_script.txt
adb shell monkey -p com.company.application -v -v -v -f /sdcard/monkey_script.txt 1

Hope you'll find this tutorial usefull !

Tuesday, June 14, 2011

Android.mk

Android.mk file syntax specification

Introduction:
-------------

This document describes the syntax of Android.mk build file
written to describe your C and C++ source files to the Android
NDK. To understand what follows, it is assumed that you have
read the docs/OVERVIEW.TXT file that explains their role and
usage.

Overview:
---------

An Android.mk file is written to describe your sources to the
build system. More specifically:

- The file is really a tiny GNU Makefile fragment that will be
parsed one or more times by the build system. As such, you
should try to minimize the variables you declare there and
do not assume that anything is not defined during parsing.

- The file syntax is designed to allow you to group your
sources into 'modules'. A module is one of the following:

- a static library
- a shared library

Only shared libraries will be installed/copied to your
application package. Static libraries can be used to generate
shared libraries though.

You can define one or more modules in each Android.mk file,
and you can use the same source file in several modules.

- The build system handles many details for you. For example, you
don't need to list header files or explicit dependencies between
generated files in your Android.mk. The NDK build system will
compute these automatically for you.

This also means that, when updating to newer releases of the NDK,
you should be able to benefit from new toolchain/platform support
without having to touch your Android.mk files.

Note that the syntax is *very* close to the one used in Android.mk files
distributed with the full open-source Android platform sources. While
the build system implementation that uses them is different, this is
an intentional design decision made to allow reuse of 'external' libraries'
source code easier for application developers.

Simple example:
---------------

Before describing the syntax in details, let's consider the simple
"hello JNI" example, i.e. the files under:

apps/hello-jni/project

Here, we can see:

- The 'src' directory containing the Java sources for the
sample Android project.

- The 'jni' directory containing the native source for
the sample, i.e. 'jni/hello-jni.c'

This source file implements a simple shared library that
implements a native method that returns a string to the
VM application.

- The 'jni/Android.mk' file that describes the shared library
to the NDK build system. Its content is:

---------- cut here ------------------
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := hello-jni
LOCAL_SRC_FILES := hello-jni.c

include $(BUILD_SHARED_LIBRARY)
---------- cut here ------------------

Now, let's explain these lines:

LOCAL_PATH := $(call my-dir)

An Android.mk file must begin with the definition of the LOCAL_PATH variable.
It is used to locate source files in the development tree. In this example,
the macro function 'my-dir', provided by the build system, is used to return
the path of the current directory (i.e. the directory containing the
Android.mk file itself).

include $(CLEAR_VARS)

The CLEAR_VARS variable is provided by the build system and points to a
special GNU Makefile that will clear many LOCAL_XXX variables for you
(e.g. LOCAL_MODULE, LOCAL_SRC_FILES, LOCAL_STATIC_LIBRARIES, etc...),
with the exception of LOCAL_PATH. This is needed because all build
control files are parsed in a single GNU Make execution context where
all variables are global.

LOCAL_MODULE := hello-jni

The LOCAL_MODULE variable must be defined to identify each module you
describe in your Android.mk. The name must be *unique* and not contain
any spaces. Note that the build system will automatically add proper
prefix and suffix to the corresponding generated file. In other words,
a shared library module named 'foo' will generate 'libfoo.so'.

IMPORTANT NOTE:
If you name your module 'libfoo', the build system will not
add another 'lib' prefix and will generate libfoo.so as well.
This is to support Android.mk files that originate from the
Android platform sources, would you need to use these.

LOCAL_SRC_FILES := hello-jni.c

The LOCAL_SRC_FILES variables must contain a list of C and/or C++ source
files that will be built and assembled into a module. Note that you should
not list header and included files here, because the build system will
compute dependencies automatically for you; just list the source files
that will be passed directly to a compiler, and you should be good.

Note that the default extension for C++ source files is '.cpp'. It is
however possible to specify a different one by defining the variable
LOCAL_DEFAULT_CPP_EXTENSION. Don't forget the initial dot (i.e. '.cxx'
will work, but not 'cxx').

include $(BUILD_SHARED_LIBRARY)

The BUILD_SHARED_LIBRARY is a variable provided by the build system that
points to a GNU Makefile script that is in charge of collecting all the
information you defined in LOCAL_XXX variables since the latest
'include $(CLEAR_VARS)' and determine what to build, and how to do it
exactly. There is also BUILD_STATIC_LIBRARY to generate a static library.

There are more complex examples under apps/, with commented
Android.mk files that you can look at.

Reference:
----------

This is the list of variables you should either rely on or define in
an Android.mk. You can define other variables for your own usage, but
the NDK build system reserves the following variable names:

- names that begin with LOCAL_ (e.g. LOCAL_MODULE)
- names that begin with PRIVATE_, NDK_ or APP_ (used internally)
- lower-case names (used internally, e.g. 'my-dir')

If you need to define your own convenience variables in an Android.mk
file, we recommend using the MY_ prefix, for a trivial example:

---------- cut here ------------------
MY_SOURCES := foo.c
ifneq ($(MY_CONFIG_BAR),)
MY_SOURCES += bar.c
endif

LOCAL_SRC_FILES += $(MY_SOURCES)
---------- cut here ------------------

So, here we go:

NDK-provided variables:
- - - - - - - - - - - -

These GNU Make variables are defined by the build system before
your Android.mk file is parsed. Note that under certain circumstances
the NDK might parse your Android.mk several times, each with different
definition for some of these variables.

CLEAR_VARS
Points to a build script that undefines nearly all LOCAL_XXX variables
listed in the "Module-description" section below. You must include
the script before starting a new module, e.g.:

include $(CLEAR_VARS)

BUILD_SHARED_LIBRARY
Points to a build script that collects all the information about the
module you provided in LOCAL_XXX variables and determines how to build
a target shared library from the sources you listed. Note that you
must have LOCAL_MODULE and LOCAL_SRC_FILES defined, at a minimum before
including this file. Example usage:

include $(BUILD_SHARED_LIBRARY)

note that this will generate a file named lib$(LOCAL_MODULE).so

BUILD_STATIC_LIBRARY
A variant of BUILD_SHARED_LIBRARY that is used to build a target static
library instead. Static libraries are not copied into your
project/packages but can be used to build shared libraries (see
LOCAL_STATIC_LIBRARIES and LOCAL_STATIC_WHOLE_LIBRARIES described below).
Example usage:

include $(BUILD_STATIC_LIBRARY)

Note that this will generate a file named lib$(LOCAL_MODULE).a

TARGET_ARCH
Name of the target CPU architecture as it is specified by the
full Android open-source build. This is 'arm' for any ARM-compatible
build, independent of the CPU architecture revision.

TARGET_PLATFORM
Name of the target Android platform when this Android.mk is parsed.
For now, only 'android-3' is supported, which corresponds to the
Android 1.5 platform.

TARGET_ARCH_ABI
Name of the target CPU+ABI when this Android.mk is parsed.
For now, only 'arm' is supported, which really means the following:

ARMv5TE or higher CPU, with 'softfloat' floating point support

Other target ABIs will be introduced in future releases of the NDK
and will have a different name. Note that all ARM-based ABIs will
have 'TARGET_ARCH' defined to 'arm', but may have different
'TARGET_ARCH_ABI'

TARGET_ABI
The concatenation of target platform and abi, it really is defined
as $(TARGET_PLATFORM)-$(TARGET_ARCH_ABI) and is useful when you want
to test against a specific target system image for a real device.

By default, this will be 'android-3-arm'

NDK-provided function macros:
- - - - - - - - - - - - - - -

The following are GNU Make 'function' macros, and must be evaluated
by using '$(call )'. They return textual information.

my-dir
Returns the path of the current Android.mk's directory, relative
to the top of the NDK build system. This is useful to define
LOCAL_PATH at the start of your Android.mk as with:

LOCAL_PATH := $(call my-dir)

all-subdir-makefiles
Returns a list of Android.mk located in all sub-directories of
the current 'my-dir' path. For example, consider the following
hierarchy:

sources/foo/Android.mk
sources/foo/lib1/Android.mk
sources/foo/lib2/Android.mk

If sources/foo/Android.mk contains the single line:

include $(call all-subdir-makefiles)

Then it will include automatically sources/foo/lib1/Android.mk and
sources/foo/lib2/Android.mk

This function can be used to provide deep-nested source directory
hierarchies to the build system. Note that by default, the NDK
will only look for files in sources/*/Android.mk

this-makefile
Returns the path of the current Makefile (i.e. where the function
is called).

parent-makefile
Returns the path of the parent Makefile in the inclusion tree,
i.e. the path of the Makefile that included the current one.

grand-parent-makefile
Guess what...

Module-description variables:
- - - - - - - - - - - - - - -

The following variables are used to describe your module to the build
system. You should define some of them between an 'include $(CLEAR_VARS)'
and an 'include $(BUILD_XXXXX)'. As written previously, $(CLEAR_VARS) is
a script that will undefine/clear all of these variables, unless explicitely
noted in their description.

LOCAL_PATH
This variable is used to give the path of the current file.
You MUST define it at the start of your Android.mk, which can
be done with:

LOCAL_PATH := $(call my-dir)

This variable is *not* cleared by $(CLEAR_VARS) so only one
definition per Android.mk is needed (in case you define several
modules in a single file).

LOCAL_MODULE
This is the name of your module. It must be unique among all
module names, and shall not contain any space. You MUST define
it before including any $(BUILD_XXXX) script.

The module name determines the name of generated files, e.g.
lib.so for a shared library module named . However
you should only refer to other modules with their 'normal'
name (e.g. ) in your NDK build files (either Android.mk
or Application.mk)

LOCAL_SRC_FILES
This is a list of source files that will be built for your module.
Only list the files that will be passed to a compiler, since the
build system automatically computes dependencies for you.

Note that source files names are all relative to LOCAL_PATH and
you can use path components, e.g.:

LOCAL_SRC_FILES := foo.c \
toto/bar.c

NOTE: Always use Unix-style forward slashes (/) in build files.
Windows-style back-slashes will not be handled properly.

LOCAL_CPP_EXTENSION
This is an optional variable that can be defined to indicate
the file extension of C++ source files. The default is '.cpp'
but you can change it. For example:

LOCAL_CPP_EXTENSION := .cxx

LOCAL_C_INCLUDES
An optional list of paths, relative to the NDK *root* directory,
which will be appended to the include search path when compiling
all sources (C, C++ and Assembly). For example:

LOCAL_C_INCLUDES := sources/foo

Or even:

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../foo

These are placed before any corresponding inclusion flag in
LOCAL_CFLAGS / LOCAL_CPPFLAGS

LOCAL_CFLAGS
An optional set of compiler flags that will be passed when building
C *and* C++ source files.

This can be useful to specify additionnal macro definitions or
compile options.

IMPORTANT: Try not to change the optimization/debugging level in
your Android.mk, this can be handled automatically for
you by specifying the appropriate information in
your Application.mk, and will let the NDK generate
useful data files used during debugging.

NOTE: In android-ndk-1.5_r1, the corresponding flags only applied
to C source files, not C++ ones. This has been corrected to
match the full Android build system behaviour. (You can use
LOCAL_CPPFLAGS to specify flags for C++ sources only now).

LOCAL_CXXFLAGS
An alias for LOCAL_CPPFLAGS. Note that use of this flag is obsolete
as it may disappear in future releases of the NDK.

LOCAL_CPPFLAGS
An optional set of compiler flags that will be passed when building
C++ source files *only*. They will appear after the LOCAL_CFLAGS
on the compiler's command-line.

NOTE: In android-ndk-1.5_r1, the corresponding flags applied to
both C and C++ sources. This has been corrected to match the
full Android build system. (You can use LOCAL_CFLAGS to specify
flags for both C and C++ sources now).

LOCAL_STATIC_LIBRARIES
The list of static libraries modules (built with BUILD_STATIC_LIBRARY)
that should be linked to this module. This only makes sense in
shared library modules.

LOCAL_SHARED_LIBRARIES
The list of shared libraries *modules* this module depends on at runtime.
This is necessary at link time and to embed the corresponding information
in the generated file.

Note that this does not append the listed modules to the build graph,
i.e. you should still add them to your application's required modules
in your Application.mk

LOCAL_LDLIBS
The list of additional linker flags to be used when building your
module. This is useful to pass the name of specific system libraries
with the "-l" prefix. For example, the following will tell the linker
to generate a module that links to /system/lib/libz.so at load time:

LOCAL_LDLIBS := -lz

See docs/STABLE-APIS.TXT for the list of exposed system libraries you
can linked against with this NDK release.

LOCAL_ALLOW_UNDEFINED_SYMBOLS
By default, any undefined reference encountered when trying to build
a shared library will result in an "undefined symbol" error. This is a
great help to catch bugs in your source code.

However, if for some reason you need to disable this check, set this
variable to 'true'. Note that the corresponding shared library may fail
to load at runtime.

LOCAL_ARM_MODE
By default, ARM target binaries will be generated in 'thumb' mode, where
each instruction are 16-bit wide. You can define this variable to 'arm'
if you want to force the generation of the module's object files in
'arm' (32-bit instructions) mode. E.g.:

LOCAL_ARM_MODE := arm

Note that you can also instruct the build system to only build specific
sources in arm mode by appending an '.arm' suffix to its source file
name. For example, with:

LOCAL_SRC_FILES := foo.c bar.c.arm

Tells the build system to always compile 'bar.c' in arm mode, and to
build foo.c according to the value of LOCAL_ARM_MODE.

NOTE: Setting APP_OPTIM to 'debug' in your Application.mk will also force
the generation of ARM binaries as well. This is due to bugs in the
toolchain debugger that don't deal too well with thumb code.

Friday, June 03, 2011

PDF Processing with Perl to include in Electric Cloud

I personally love Electric Commander from Electric cloud when it comes to run automated build. Electric Commander comes with a very good Procedure and Steps engine which can integrate on Multiple agent node and be able to execute perl script.
At the end of the build it is always recommanded to generate a nice report sometimes after running complex automation test.


PDF Packages

I like PDF::Reuse, but there are several other options for PDF creation and manipulation on the CPAN.

PDF::API2, by Alfred Reibenschuh, is actively maintained. It is the package of choice if creating new PDF documents from scratch.
PDF::API2::Simple, by Red Tree Systems, is a wrapper over the PDF::API2 module for users who find the PDF::API2 module to difficult to use.
Text::PDF, by Martin Hosken, can work on more than PDF file at the same time and has Truetype font support.
CAM::PDF, by Clotho Advanced Media, is like PDF::Reuse more focused on reading and manipulating existing PDF documents. However, it can work on multiple files at the same time. Use it if you need more features than PDF::Reuse actually provides.
Conclusions
PDF::Reuse is a well-written and well-documented package, which makes it easy to create, combine, and change existing PDF documents. The two sample applications show some of its capabilities. Two limitations should be mentioned however, PDF::Reuse can't reuse existing bookmarks, and after combining different PDF documents some of the inner document hyperlinks might stop working properly.