<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>NXgetinfo() problem</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P DIR=LTR><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">I</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">&#8217;</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">m posting this following a conversation with Paul Kienzle</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">&#8211;</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">he</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">had</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">initially</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">executed the following</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">via</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">python</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">:</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">NXmakedata(10 element NX_CHAR) </FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">NXopendata()</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">NXgetinfo()</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">NXgetinfo returned 0 for the</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">array</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">size</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">when the</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">data</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">type</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">wa</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">s</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">NX_CHAR</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">,</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">but</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">size</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">10 for any other</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">data</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">type</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">.</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">The problem</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">is</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> related to the default stripping of spaces from strings by the NeXus API</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">&#8211;</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">passing</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> NOSTRIP to NXopen() results in NXgetinfo</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">returning 10 for the string size.</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> </SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">T</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">his raises the general</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> question</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">: how can you determine the maximum size you can write to a</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">NX_CHAR</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">array?</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">The NeXus file may not have been opened NOSTRIP by a user of the python API, so to use the NOSTRIP workaround would mean</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">python</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">opening the file with NOSTRIP</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">and then emulating the stripping behaviour</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">.</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">The documentation for NXgetinfo()</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">does</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> not</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">say</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> whether</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">,</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">for a string, it should return the current or declared size -</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">i</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">s a new</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">API function</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> the only way</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">?</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> If NXgetinfo</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">()</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> has only been used to</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">determine how much memory to allocate</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">for a string</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">then changing it would not break anything; however if code relie</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">s</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> on it effectively doing a strlen() then</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">this</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"></FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"> <FONT SIZE=2 FACE="Arial">may</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial"> break.</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">Freddie</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>


<br><p>
<hr/>  <BR />Scanned by iCritical.
</p>
<br></BODY>
</HTML>