Getting element of array returns a pointer?

Hi to All,
I have a code:
/tt [[0 1 2] [10 11 12] [20 21 22]] def
tt 0 get    /ttr exch def          % ttr = [0 1 2]
ttr 2 777 put                      % ttr = [0 1 777]
tt pstack                          %  tt = [[0 1 777] [10 11 12] [20 21 22]]
I thought tt should not be changed. But it is. Why is this? How may I avoid this?
Thank you in advance,
JackK

In addition, try this. Composite objects (arrays, dictionaries, strings) are allocated from a potentially limited pool of memory so the programmer has full control of the memory allocation process. Only specific operators such as array, string, dict will allocate memory (and the parser as it sees literals of these types). So, if another operator returns a composite object, it follows that no memory was allocated, and it was not copied. It is therefore a reference to the original (a pointer, if you prefer, though PostScript avoids the term).
If you're a C programmer it can help to think of PostScript objects as 8 byte structures. A structure could (but would not exactly) contain the object type and simple value. For an array, the structure would contain the type and a pointer to the array memory, length and offset. The array memory is a list of 8 byte structures.
getinterval makes a new object (8 byte) containing a pointer to the same array memory, but a different length and offset.
get returns a copy of one of the 8 byte structures from the array memory. For a simple type (e.g. real) this copy is complete and separate. If the element is an array the 8 bytes are copied, but the pointer to the array memory, length and offset are unaltered. Essentially it is the same array.
Indeed, if you translated this example to C it would be the same array.

Similar Messages

  • Simple c array in struct pointer question

    i have a two struct like so:
    typedef struct {
           uint8_t data[256];
    } foo1;
    typedef struct {
           uint32_t data_ptr;
    } foo2;
    foo1 * ctx;
    foo2    ply;
    if i want to get the pointer to the data array in ctx and assigned to data_ptr would i do it like so:
    ply.data_ptr = &(ctx->data);

    &(ctx->data) returns a pointer to an array of 256 integers. This type will look something like uint8_t (*data_ptr)[256]. Instead you should do what falconindy suggested above:
    ply.data_ptr = ctx->data
    To avoid gcc warnings (which you should always avoid), data_ptr needs to be declared the correct type of pointer. Since ctx->data by itself is nothing more than a pointer to an 8-bit wide integer you want (uint8_t *). ((void *) also works)

  • How I average data with 78,74,73 and 55 points respectively and end up with an array of 78 points for the average?

    Hi
    As the questions states, how do I average data with 78,74,73 and 55 points respectively and obtain an array of 78 points? 
    When I use the plus vi, Labview somehow produces an array of 55 points when I do the average (see attached vi).
    I have been unlucky in trying to get good results.
    Can anyone help?
    Thank you.
    Attachments:
    average4.vi ‏40 KB

    The add function is polymorphic. It accepts arrays as well as numerics, but you need to understand one thing about array operations in LV. Operations performed on arrays of different sizes will always (I think) work based on the smallest array. For example, if you auto index 2 arrays of different sizes into a for loop, the number of times the loop will run will be the size of the small array. The same is true here - when you wire 2 arrays of different sizes to the add function, only the first N elements of the larger array get processed. The rest are dumped. That's why you get 55 elements.
    Attached is a modification of your VI which shows 2 things:
    The bottom part is your algorithm, only cleaned up. Note how much easier it would be to read now. You should always write clean code. Also, note that I have changed the representation on some of the data from DBL to I32. This is because this is the representation the array function work with and your code had the DBLs coerced for no reason.
    The top part is a different algorithm which should do what you want. Note that like Mike said, the arrays with smaller sizes will have 0s appended at the end, so if you want to avoid that, you will have to modify the last part, where the averaging is done and only divide those columns which are long enough.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!
    Attachments:
    average4MOD.vi ‏63 KB

  • How to removie a duplicate element of array

    i have this code so far can someone please help
    public static int [] remove(int[] a, int[] b){
    for(int i = 0; i < a.length; i++) {
    if(a[i] == b) {
    int[] newInt = new int[a.length - 1];
    return newInt; // We need something here
    return a;

    First, please use [ code] and [ code] tags to denote code; it makes it much more readable.
    Second, your arguments for the function don't make sense with relation to your subject. So, running on the asumption that I know what you mean through the subject, here goes:
    You probably want the arguments to be:
    (int[] a, int b)Whereby you want to remove the element that equals b . So, what you would want to do in such a situation is:
    for(i = 0 to a.length) {
    if(a[i] == b) {
      //You have reached the element to throw away.  Set a flag saying you have reached this point
    // If the flag is set, add a[i+1] to the new array; otherwise add a[i] to the new array.
    return a;

  • How can I get the data array from SQL Server Database?

    Hi,
    I can write a data array(2D)into a table of my SQL Server Database. The data array was writen to a column with image type. I know a data array is transformed a binary string when writing into database, but I dont know how to get the data array when I fetch the binary string from database.
    My question is:
    How to transform the binary string into data array? which vi's should I use? I have tried unflatten from string but failed.
    Any response is appriciated.
    Red

    happyxh0518 wrote:
    > I can write a data array(2D)into a table of my SQL Server Database.
    > The data array was writen to a column with image type. I know a data
    > array is transformed a binary string when writing into database, but I
    > dont know how to get the data array when I fetch the binary string
    > from database.
    >
    > My question is:
    > How to transform the binary string into data array? which vi's should
    > I use? I have tried unflatten from string but failed.
    In order to use Unflatten from string you first need to Flatten it
    before writing it. Also depending on the database driver, the returned
    data may actually not be binary but Hexadecimal encoded ASCII which you
    would first have to decode to binray.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • When i try to see some of my photos the photos appear and when i click on the individual photos I get a circle with an exclamation point. What's going on?

    Why am I getting a circle with an exclamation point when I try to acces my photos ?

    The ! turns up when iPhoto loses the connection between the thumbnail in the iPhoto Window and the file it represents.
    Try these in order - from best option on down...
    1. Do you have an up-to-date back up? If so, try copy the library6.iphoto file from the back up to the iPhoto Library (Right Click -> Show Package Contents) allowing it to overwrite the damaged file.
    2. Download <a href="http://www.fatcatsoftware.com/iplm/"><b><u>iPhoto Library Manager</b></u></a> and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.
    3. If neither of these work then you'll need to create and populate a new library.
    To create and populate a new *iPhoto 08* library:
    Note this will give you a working library with the same Events and pictures as before, however, you will lose your albums, keywords, modified versions, books, calendars etc.
    In the iPhoto Preferences -> Events Uncheck the box at 'Imported Items from the Finder'
    Move the iPhoto Library to the desktop
    Launch iPhoto. It will ask if you wish to create a new Library. Say Yes.
    Go into the iPhoto Library (Right Click -> Show Package Contents) on your desktop and find the Originals folder. From the Originals folder drag the individual Event Folders to the iPhoto Window and it will recreate them in the new library.
    When you're sure all is well you can delete the iPhoto Library on your desktop.
    In the future, in addition to your usual back up routine, you might like to make a copy of the library6.iPhoto file whenever you have made changes to the library as protection against database corruption.

  • Can't seem to get Elements 8 to accept RAW files

    I have been using Elements 8 for 1-1/2 years and just made the switch to a Canon DSLR camera.  I want to generate RAW images and process them with Elements.  I just can't seem to get Elements to show a RAW converter.  Period.  I have uploaded plug-in's and even tried getting the Canon supplied photo editing program to read RAW as well.  Zilch.  What do I need to do (step by step) to get this method of image manipulation to work.  Is Elements 8 a dead horse when it comes to working with a Canon RAW file?  I'd rather not invest in a newer Elements program just yet.  Help!

    The information provided pointed me in the right direction, but the outcome was the same. Apparently, Photoshop Elements 8 needs the 6.4 version in order to be compatible with Canon RAW files.  I went back to Adobe, but they were unable to provide me with the link for the file extension (or plug-in) to make things improve.  I also installed the DNG converter, but when I tried to move over Canon RAW images, I kept getting "does not recognize file."   Huh?

  • When I click on the pic, all I get is a huge blurry exclamation point.

    Prior to today's upgrade, I could highlight "photos" under Library, double click on any of the pics and get a blown up version of the picture. Now when I do that, I get a blown up blurry exclamation point. Thoughts?

    Thoughts?
    The ! turns up when iPhoto loses the connection between the thumbnail in the iPhoto Window and the file it represents.
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.
    Regards
    TD

  • How do I pass a 1D LabView array as a pointer to an array in a C DLL?

    Hello,
    I am trying to pass a 1D Labview array of DOUBLE to a C DLL which is expecting a pointer to an array of DOUBLE.  I have read that LabView stores arrays as a pointer to a pointer and that the first element of a LabView array is actually the size of the array.  So I think my question is then how do I dereference the first pointer and pass in a pointer which points to the second element in the array?    
    Any thoughts out there?
    Thanks!

    Hi justyou,
    There are many, many resources on this topic, so I will guide you to the two most useful ones:
    The "Call DLL.vi" example that ships with LabVIEW explains how to use almost any data type when executing DLLs. The "Call DLL.vi" can be found by browsing the Example Finder.
    Integrating DLLs. This page is the portal for DLL interation related resources. Read the tutorials and try the examples...
    This should give you some ideas.
    Have fun!
    - Philip Courtois, Thinkbot Solutions

  • Re: My experience in getting the 90 day return ban

    Returned today a BOSE Soundlink Mini.  Turns out my grandson prefers a more "sporty" bluetooth portable speaker!  I was going to return the BOSE and check out the JBL Charge 2. However when  I noticed that the CS agent was looking hard at a piece of paper the register had just spit out my plans were abruptly  changed!   He handed it to me with a rather "sheepish" expression when he told me I had been banned from future returns for 90 days!  He said he had never seen this before.  Boy, didn't I feel special!!
    I had questions so, as the notice instructed me to do if I had any questions, I called TRE.  The nice but very hard to understand agent was quick to tell me there is nothing they can do regarding the ban except to send me a list of my returns.  According to the piece of paper the CS agent gave me, I could dispute the accuracy or completeness of the info.  Apparently this would be an act of futility since I had already been told nothing can be done about my ban.  
    I told the nice foreign lady that I did not want to go through the hassle.  Instead, I looked for and found this forum to let me vent my feelings about this most egregious BB policy.  Giving an outside organization authority to determine which customers will and who will not be banned is iresponsibe and from a marketing standpoint,  just plain stupid!  
    Although I did not get a list of my returns, I believe I know at least two of them in addition to the one today mentioned earlier.
    * As an "early adapter" I am sometimes disappointed with the latest best and greatest new product.  Case in point is the Motorola Moto 360 I purchased from BB.   I returned it because of its short battery life.  It wouldn't even last one day.  This has since become a well known defect and Motorola has issued an update to improve battery life.
    * Since I liked the concept of the Smart Watch, I purchased a Pebble Watch. I returned it the next day as the screen was defective.
    There may have been others but I cannot recall them.
    Well, .... thanks for listing.  It's a real shame too since I had my eye on several items from BB during the Black Friday extravaganza.  No way could I be 100% positive whether or not I would need to return an item!  Since I do not want to get stuck with a below par or defective item,  Amazon, Walmart, etc will be getting my business and Best Buy can kiss my rear end good by forever.
    you could be of assistance however, .....  Please advise how I can cancel my Best Buy account.  You may donate what points I may have to your favorite charity!
    Thank you
    Sam in Statesville, NC

     A few days ago I joined this forum to vent my feelings about Best Buy's allowing a third-party source to determine who should be penalized with the 90 day return ban.  Apparently since I was new, I couldn't initiate a new thread so I had to piggy-back on another member's thread:  "My experience in getting the 90 day return ban".  You can read my comments   here
    I ordered the RAR report and here are my findings.  All of this info can be verified by BB:
    * SKU 5064393 - Samsung Galaxy 2 pad - Purchased 8/5/12 - returned 8/15/12 .... NOTICE: 2012!! ... I had decided to change from Apple IOS to ANDROID IOS.   Didn't like it as I thought I would.  Returned the Samsung and stayed with my Apple iPad Air
    * SKU 9713881 - Pebble Smart Watch  - Purchased 9/29/14 - returned 9/30/12 .... Screen was DOA.  Defective.  Returned next day to BB.  While there, purchased the new MOTO 360 (see next item)
    * SKU 9169039 - Motorola MOTO 360  -  Purchased 9/30/14 - Returned 10/3/14 ... Didn't take long to know this watch was not yet ready for prime time.  Watch wouldn't last one day on the battery.  This was a well  known defect at the time on the MOTO 360.  Battery life has since been improved with a firmware update.  This is what you get sometimes when one is an early adapter like me!  Purchased another Pebble Watch while I was there ... figured I would give the Pebble another chance.
    ** NOT ON RAR REPORT ** SKU 9713809 - Pebble Smart Watch - Purchased 10/3/14 on BestBuy.Com  .... Still wearing it and love it **
    ** NOT ON RAR REPORT ** SKU 8004007 - Leap Frog plus accessories - Purchased 10/28/14 BB in Gainesville, GA ... Grandaughter still enjoying her Leap Frong
    * SKU 9154107 - BOSE Soundlink Mini - Purchased 11/11/14 - Returned 11/24/14 .... Gift for 16 year-old grandson. I picked out one I would like to have.  Grandson had different ideas.  BOSE was "old fashioned" looking.  He much preferred the JBL Charge 2 or the Logitech Ultimate Ears Boom in colors.  HERE'S THE KICKER!!!  This was the return where I was presented the "WARNING 90 DAY RETURN BAN"!    I was going to buy my Grandson the JBL after I returned the BOSE.  Needless to say, I did not do so.  Instead, WalMart was happy to take my money!!!  My Grandson is now happy with his Red Charge 2.
    I never received any notice that I was in danger of being "banned" for 90 days.  I was "awarded" my ban the day I returned the BOSE speaker! 
    BEST BUY ..... considering the above information (all of which can be verified) do you really think I deserved the 90 day ban.  If someone at you company had the chance to review my purchase record prior to my ban do you think I would still have been banned?  Would you have lost a customer? (NO).   Would you have prevented some bad publicity getting out because of a disgruntled customer (YES).
    And, ... one last thing.  Over the Thanksgiving holiday I purchased a 4K 55" TV,  Denon AVR-S900W Receiver and a set of Definitive Technology- ProCinema speakers. Non of which I purchased from Best Buy.

  • How to call a routine that returns a pointer using jni

    hi this is ravi kiran,
    i have a situation where i need to call a c-routine from my java program that returns a pointer.
    how can i get the content of the pointer that the routine is returning.
    plz help me
    thanx in advance

    Return it as a java long.
    When you need to use it again then pass it in as a long and cast it to a pointer.
    If you need to free it then you should consider writing a finalize() method (one of the few times it is appropriate) and a destroy() method as well.

  • Datasocket: Get 2D text Array from DSS

    Measurement Studio 8.x with VS C++ 2003
    Hey, how can I get an 2D text array from a datasocket server. I know how to get simple values from a DS with Measurement Studio, but I'm not able to get the 2D text array. What typ of variable should I choose to convert the CNiDataSocketData?
    (I have VI which shows me the 2D-Array so it's only a problem with my code and not with transfer...)
    Thanks for your help!

    Hi AnTri,
    to convert the CNiDataSocketData you should choose the CNiVariant and the SAFEARRAY datatype.
    Take a look at the following sourcecode:
    CNiDataSocketData data
    CNiVariant vVariant(data); //CNiDataSocketData to CNiVariant
    SAFEARRAY * safearray;
    BSTR pString;
    CString cString;
    long lIndex[2];
    lIndex[0] = 0;
    lIndex[1] = 0;
    safearray = vVariant.parray; //get the safearray from CNiVariant
    SafeArrayGetElement(safearray, (long*)&lIndex,(void*)&pString); // get element from safearray
    cString = pString;
    Best regards,
    Benjamin

  • Clicking on another app I get the video automatically returning to normal screen view

    I wonder why, if I put a youtube video in full screen and I click on another app WHILE THE VIDEO IS PLAYING all remain this way. On the contrary, if I first stop the video, clicking on another app I get the video automatically returning to normal screen view... This is very annoying. Is it possible to avoid this?
    Thanks

    Sorry, Mozilla doesn't support the patent-encumbered and royalty-encumbered H.264 standard, they support the OGG/Theodora and WebM free open source standards.
    Microsoft has a H.264 plugin for Firefox, but it is for Windows7 not WinXP or Win Vista. <br />
    http://www.interoperabilitybridges.com/html5-extension-for-wmp-plugin
    There may be other H.264 Firefox plugins out there for WinXP, so do a Google search. Or maybe contact support for that DVR security system and see if they know of or have a Firefox plugin.

  • How to get number of rows return in SELECT query

    i'm very new in java, i have a question:
    - How to get number of rows return in SELECT query?
    (i use SQL Server 2000 Driver for JDBC and everything are done, i only want to know problems above)
    Thanks.

    make the result set scroll insensitve, do rs.last(), get the row num, and call rs.beforeFirst(), then you can process the result set like you currently do.
             String sql = "select * from testing";
             PreparedStatement ps =
              con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
             ResultSet rs = ps.executeQuery();
             rs.last();
             System.out.println("Row count = " + rs.getRow());
             rs.beforeFirst();~Tim
    NOTE: Ugly, but does the trick.

  • When I turn on my computer I get the message APPLESyncNotifer.exe   Entry Point not found.

    Have a 5th generation nano and when I connect to my computer I get a message APPLESyncNotifer.exe  Entry Point Not Found. Not a computer geek so I am stumped. Anyone out there who could help? I have reinstalled ITunes and restarted my computer to not avail.

    Copying & pasting SQLIte3.dll worked out well for your computer?
    Just read your trouble with your iPod nano 5th generation & Windows PC, how about trying the one I found on this community before?
    Click the start button and type in 'msconfig' in search, and, in system structure utitily, click on the tab of 'startup' and check off the box of 'AppleSyncnotifier.exe' and reboost your system.(You have to follow down till the end of the place of the file.) That'll solve your trouble.
    I don't know you connect iPad or iPhone at all, that may change the solution? Hoping this suggestion also work out for you & your PC.

Maybe you are looking for

  • External Hard drive no longer showing up

    Hi all, hope you can help. I have an external hard drive that I use as a TIme Machine Drive, the other day my wife decided I was wasting electricy by having the hard drive on, si se turned it off without ejecting it, thanks love. Now the Hard drive w

  • 'Some images are missing because they were deleted from the document'

    Hi, I created a document in Pages v5.2 last week and have just opened it and received the following message: 'Some images are missing because they were deleted from the document' When I try and replace the missing images I get the following message:

  • Best option for protecting the palm wrest area from staining?

    My new white MacBook is scheduled to be delivered tomorrow. I currently use a blackbook. Anyway, I have kind of oily skin, and I'm worried about staining on the white plastic on the new computer where my palms rest during use. What's the best option

  • Error message in Itune, after uninstalling and reinstalling of itune

    I have uninstalled the itunes by following the instructions in apple website, removing intunes, quicktime and other components in my computer. Then after I reinstalled the itunes 10, it doesnt launch the itunes and gives me a message that "The itunes

  • PDF Export with fixed column widths ignores page break on Analysis item

    Hi experts, we use the column width modification to define fixed column width in a analysis item. On the same Web template we want to export the whole template including the analysis item to PDF format. First of all everything worked properly, but th