Skip to content

Metabolomics Fiehn Lab

Sections
Personal tools
You are here: Home » Members » Dr. Tobias Kind » Collector » Programming

Programming Issues

Document Actions
Visual C++ Express:

When a C/C++ application is built using functionality provided by the Visual C++ libraries, it becomes dependent on the presence of those libraries at runtime. In order for the application to run, it must link, either statically or dynamically, to the necessary Visual C++ libraries. see Windows Installer Deployment

For applications built in Visual C++ Express, it is recommended to redistribute Visual C++ libraries using the Visual C++ Redistributable Package (vcredist_x86.exe). Visual C++ Express does not install this package; however, it can be downloaded from Microsoft Visual C++ 2005 Redistributable Package (x86).

R6034 msvcr80.dll "Microsoft.VC80.CRT" vcredist_x86.exe Microsoft_VC80_CRT_x86.msm error for newly compiled programs,
solving the problem of running programs developed with Visual C++ Express on another computer. It is not enough to just copy the msvcr80.dll to another computer or folder! What you need to do is to redistribute your own application *.exe and vcredist_x86.exe.

http://www.codeproject.com/cpp/vcredists_x86.asp
http://blogs.msdn.com/nikolad/archive/2005/09/02/460368.aspx



How to print a long long integer using printf? A rather trivial question, well, not with MS Visual Express C++.
long = FFFFFFFFh = 4,294,967,295d and long long (with 16 byte) = FFFFFFFFFFFFFFFFh = 18,446,744,073,709,551,615d
But printf("%d",longlong) fails. What to take? You can take printf("%llX",longlong) if you can read hexadecimal.
Read more here: Size Prefixes for printf and wprintf Format-Type Specifiers
..
long long OverflowCatcher = 18446744073709551615;
printf("long long: %X \n", OverflowCatcher);
printf("long long: %d \n", OverflowCatcher);
printf("long long: %i \n", OverflowCatcher);
printf("long long: %lli \n", OverflowCatcher);
printf("long long: %o \n", OverflowCatcher);
printf("long long: %u \n", OverflowCatcher);
printf("long long: %f \n", OverflowCatcher);
printf("long long: %Ld \n", OverflowCatcher);
printf("long long: %lld \n", OverflowCatcher);
printf("long long: %llf \n", OverflowCatcher);
printf("long long: %lli \n", OverflowCatcher);
printf("long long: %llu \n", OverflowCatcher);
printf("long long: %Lu \n", OverflowCatcher);
printf("long long: %LX \n", OverflowCatcher);
printf("long long: %I64u \n", OverflowCatcher);
printf("long long: %I64d \n", OverflowCatcher);
printf("long long: %llu \n", OverflowCatcher);
printf("long long: %Lu \n", OverflowCatcher);
printf("long long: %qu \n", OverflowCatcher);
..
long long: FFFFFFFF
long long: -1
long long: -1
long long: -1
long long: 37777777777
long long: 4294967295
long long: -1.#QNAN0
long long: -1
long long: -1
long long: -1.#QNAN0
long long: -1
long long: 18446744073709551615
long long: 4294967295
long long: FFFFFFFF
long long: 18446744073709551615
long long: -1
long long: 18446744073709551615
long long: 4294967295
long long: qu

..
So, use printf("%llu",longlong); or printf("%I64u",longlong) to print a long long integer. Thank you.


Boolean in C or C++?
Using bool in C and MS Visual C++ Express results in: error C2059: syntax error : 'type'
Check with:

     #if !defined(__BOOL_DEFINED)
        printf_s("bool is not supported\n");
    #elif defined(__BOOL_DEFINED)
    printf_s("bool is supported\n");
    #endif

Explanation from Codecomments.com

Your are compiling your code as C (not C++) code. Type 'bool' is not
present in the original C language. It was introduced relatively
recently in new C standard - C99. However, your compiler does not
support C99.

Either forget about 'bool' or use C++.
--
Best regards,
Andrey Tarasevich

Solution: Compile as C++ Code (/TP). Thank you



PubChem and SOAP and Office XP and XML Web Services from Office VBA


PubChem and SOAP and EXCEL+SOAP+VBA and the SOAP toolkit which is deprectated by .NET Webservices
An overview how to use the Entrez Utilities Web Service.

Example: http://www.ncbi.nlm.nih.gov/entrez/eutils/egquery.fcgi?CMD=search&DB=pccompound&term=Taxol
produces as output:

Taxol
pubmed PubMed 11974 Ok pmc PMC 1249 Ok journals Journals 0 Term or Database is not found mesh MeSH 64 Ok books Books 64 Ok omim OMIM 11 Ok omia OMIA 0 Term or Database is not found ncbisearch NCBI Web Site 0 Term or Database is not found nucleotide Nucleotide 169 Ok protein Protein 146 Ok genome Genome 0 Term or Database is not found structure Structure 3 Ok taxonomy Taxonomy 0 Term or Database is not found snp SNP 342 Ok gene Gene 32 Ok unigene UniGene 2 Ok cdd Conserved Domains 2 Ok domains 3D Domains 12 Ok unists UniSTS 0 Term or Database is not found popset PopSet 0 Term or Database is not found geo GEO Profiles 17 Ok gds GEO DataSets 5 Ok homologene HomoloGene 18 Ok cancerchromosomes CancerChromosomes 1 Ok pccompound PubChem Compound 38 Ok pcsubstance PubChem Substance 68 Ok pcassay PubChem BioAssay 134 Ok nlmcatalog NLM Catalog 43 Ok gensat GENSAT 0 Term or Database is not found probe Probe 3 Ok genomeprj Genome Project 0 Term or Database is not found


ACRONIS and CACLs using mounted volumes

Backup and Restore with Acronis works fine, however if you have a Windows system with different users/admins you may step into problems with ACLS and access controls (even if you do not use EFS) on the new system. It is of course a good idea to backup a recovery agent private key. However this may not help you in some special cases (domain settings). That means after a crash or migration to a new system you can not access your files anymore. A quick check is to mount your backup on a new computer (not the original one) and run  the following programs.

1) The Windows Sysinternals AccessChk tool with GUI and very fast.  If something is wrong it will show ??? in Read/Write/Deny.
2) Windows Support Tools vfi.exe to calculate a CRC-32 (whenever the CRC calculation fails you are in trouble).
3) Run CACLs under the dos console (cmd) which displays or modifies access control lists (ACLs) of files

Turning off/on some switches (do not transfer security desciptors during backup) within ACRONIS 9.1 (according to Acronis Tech Support) does not help for mounted volumes. It helps only during direct restore. You may find some other solutions here: Fundamental Computer Investigation Guide For Windows Overview


JAVA 1.6 (Mustang) and the Eclipse 3.2 profiler (TPTP workbench)

Could not resolve to JVMPI interface
FATAL ERROR: JVMPI, an experimental interface, is no longer supported.
Please use the supported interface: the JVM Tool Interface (JVM TI).
For information on temporary workarounds contact: jvmpi_eol@sun.com
Error occurred during initialization of VM
-Xrun library failed to init: piAgent

See SUN bug report:  JVMPI removed from Mustang

Solution, use JVM 1.5 as Profiler, goto Eclipse Window --> Preferences --> JAVA Installed JREs --> search all and select and older JAVA VM. You can also set the proper execution environment.
Or you can manually profile your stuff with:
java -Xrunhprof:cpu=samples,depth=10,monitor=y,thread=n,doe=y  -server myTestclass.class

Well, not so quick. Under WINDOWS this doesnt work as it should. You can have multiple  JAVA versions  (JVMs) installed.
The current version is controlled via the System --> Control Panel --> JAVA. To be absolutely sure which JAVA engines starts the Eclipse Environment open a command window and type JAVA -version. Additionally use the Sysinternals process explorer to get the selected path for Eclipse.exe. Per default an older JVM is not allowed under Windows, so you need to de-install version 1.6 or use Eclipse 3.3 and JVMTI. Additionally you can go to windows/system32 path and rename JAVAW.exe and JAVA.exe, in this way the older 1.5 version is used via the PATH argument or environment settings (JAVA_HOME).


Eclipse 3.2 and the TPTP Profiler and Agent Controller error
You installed the TPTP Profiler in a certain network environment and it worked, now you changed the host system and want to work locally (no network). This is true for WIN and LINUX.
Now everytime you start profiling the computer wants to make a connection to the computer it was supposedly installed on. Profiling is not possible anymore. (With or without firewall)

ERROR:
IWAT0284E The agent controller is not available on host localhost.
 Make sure that:
* the agent controller is installed.
* the agent controller is configured to communicate with your machine.
* you have the correct host name and port number for the agent controller.
or
IWAT3034E: The agent controller on localhost:10002 is unavailable

Solution:
Goto Eclipse --> Windows --> Preferences --> Profiling and Logging --> hosts
You see two or more hosts (Assume you don't need remote profiling)
1) Local Direct Connection
2) localhost 10002

A) REMOVE the localhost 10002, (local direct connection should work) and apply (1)
B) If this is not possible, go to profile environment, terminate and delete old started projects(!)
C) Close and restart eclipse
D) goto Preferences and delete localhost 10002 now.

Voila! Profiling works.



Using LINUX GUIs (X11) under WIN requires the free Cygwin packet installed.
Do not forget to install the whole X11 package.
Use: cygwin.bat will start a shell or a Cygwin bash shell can be opened.
type startx will start the XWindows environment.

Problems.Error message:
_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root
winValidateArgs - g_iNumScreens: 1 iMaxConsecutiveScreen: 1
(II) XF86Config is not supported
(II) See http://x.cygwin.com/docs/faq/cygwin-x-faq.html for more information
....
Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list!
winPointerWarpCursor - Discarding first warp: 960 600
winInitMultiWindowWM - pthread_mutex_lock () returned.

Solution: Instead of startx use /usr/X11R6/bin/startxwin.sh
this will start XWIN correctly

Well, this is not the right explanation for the solution, bot the configs are different
so it works ;-)


 
Created by kind
Last modified 2007-07-12 02:45 PM
 

Powered by Plone

This site conforms to the following standards: