Best way of saving an array of integers to use later?

I am having trouble figuring out where to initialize an array of integers so it is available everywhere. It's just a simple array of integers to be used as indices into another array. So I figured an ordinary C array like this is sufficient:
int arrayOfIndices[] = {3, 11, 12, 25, 26, 43, 50, 53, 58, 59, 62, 76, 77, 81, 94, 95, 110, 113, 114, 117, 118, 123, 136, 152};
It's ok to just use an ordinary C array for this, right? It seems that it is much harder to initialize a similar NSArray of integers. Or is there an easy way to do that?
One problem I'm having is I'm having trouble figure out where to stick the above array so that it is usable through the program. With my NSArray objects I've been defining them in the interface, then initializing them in viewDidLoad with retain.
Is there something analogous I can do with ordinary C int arrays? Or, alternatively, an easy way to initialize an NSArray of integers so I can deal with them like I do with other NSArrays?
Thanks,
doug

Never mind. It looks like just not putting anything in the interface file and sticking the definition of the C int array at the top of my implementation file where I import files and define some other stuff works fine.
doug

Similar Messages

  • AS3 Best way to clear an array

    What is the best way to clear an array? (performance and resources)
    array.length = 0;
    array = [];
    array.splice(0);

    that's creating a new array which is extra work, and it's adding an array to the objects that flash will gc, and that's extra work.
    assigning the length to 0 is the most efficient way to clear an array.

  • What is the best way for sharing an iPad with 2 iPhones using different Apple acount ?

    What is the best way for sharing an iPad with 2 iPhones using different Apple acount ?

    You can't share with other devices if you are using different Apple ID's and iTunes account on them. You can only share if you use the same ID.

  • Best way to pass an array of waveforms inbetween VIs

    In my VI I am developing I have multiple data sources that output a single waveform. I group these waveforms togeather to make a wave form array. The user selects which waveform they would like to display and they are displayed on a graph on a different form. Right now I have each different graph VI generating the whole array and displaying the selected element.
    My question is, this seems to be not efficent because I am generating data in 3 spots. I would think it would be better to generate it in one spot and then pass only the need data to the three graph VIs. What is the best way todo this? A global variable? Queue? Any suggestions?

    You're probably tired of hearing me say this, but the global function idea is the best.
    A global variable makes a COPY of the data each time you read it. That takes time, and memory. If each of 3 window reads the global, and picks out a channel, then you've made 3 copies of the original data. Depending on your data size, that may or may not be a problem.
    A queue means that once you read the data, it's lost from the queue. If window A reads from the queue, that data chunk is not in the queue any longer, so Window B can't read that same data.
    If the main window generates the data and deposits it in a global function, then each window can ask the global function for a specific channel to display.
    DATA STORAGE.vi:
    Inputs:
    WRITE/read (bool
    ean)
    DATA IN (2-D array of DBL, for example)
    Channel Index (I32)
    Outputs:
    DATA OUT: 1-D array of DBL (or waveform, maybe).
    Code:
    WHILE
    If WRITE/read
    Store DATA IN in a shift reg.
    else
    Pass Shift reg IN to Shift reg Out.
    Pick out channel via CHANNEL INDEX
    Pass selected data to DATA OUT.
    Loop NEVER.
    The purpose of the loop is just to have a shift reg. It doesn't really loop - it executes once per call.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Best way to return an array of values from c++?

    I have a a group of structs made of a mix of primitive types in c++. I need to return these to Java but Im not sure the best way to return them quickly.
    Should I create a class corresponding to the structure in Java then create the class in C++ and set its fields and return that? Or should I create arrays of different primitive types and return those? Can I even do that? Say, store a group of arrays of different types in a jobjectArray and return that? If I can, what would be the return type? Object[][]?

    Java side:
    package jni;
    import java.nio.ByteBuffer;
    import java.nio.ByteOrder;
    * @author Ian Schneider
    public class Struct {
        static {
            System.loadLibrary("struct");
        public static void doit() {
            ByteBuffer bytes = ByteBuffer.allocateDirect(structSize());
            bytes.order(ByteOrder.nativeOrder());
            getData(bytes);
            System.out.println("int : " + bytes.getInt());
            System.out.println("double : " + bytes.getDouble());
        private static native void getData(ByteBuffer bytes);
        private static native int structSize();
        public static void main(String[] args) throws Exception {
            doit();
    }C side (I'm not a C programmer, so be nice):
    #include "jni_Struct.h"
    struct foo {
      int x;
      double y;
    } foo;
    JNIEXPORT void JNICALL Java_jni_Struct_getData
      (JNIEnv * env, jobject obj, jobject buf) {
      struct foo * f = (void*) malloc(sizeof(foo));
      f->x = 123;
      f->y = 456.;
      void * data = (void *) (*env)->GetDirectBufferAddress(env,buf);
      memcpy(data,f,sizeof(foo));
      free(f);
    JNIEXPORT jint JNICALL Java_jni_Struct_structSize
      (JNIEnv * env, jobject obj) {
      return sizeof(foo);
    }This is a bit simplistic as foo is static in size (no pointers), but hopefully you get the point.

  • Best way to create an array of bound values (to the resourceManager for example)

    What's the best practice for creating an array (array collection) where each element is bound to another value?
    An example would be an array of error strings that are used by an application.  Each string needs to change as the resource manager changes.
    Passing a list of strings to a list control is another example.  These should get localized as well.

    hobby1 wrote:
    Crossrulz, I was planning on handling it like this: 
    I have a total of 17 element I need to build an array from.  Each case would include another element to be written to the array.  Is this the correct way to handle this?
    Thats one way to do it.  Not nearly as efficient as using the Build Array, but it will work.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Looking for a best way to arrange an array of Pop Up windows with repeating small imgs

    I would like to find out what is the best way to approach setting up various Pop Up windows.
    Here is my set up:
    I have 20+ product images which act as buttons and each brings a user to a unique section with the pop up window where a large photo of this product in use is displayed. In addition to this photo in the pop up window are additional product images (which were also used to create a photographed assembly)
    I figured that since I repeat my product images on the pop up windows and all of them are already used in the product page let me use them again in the pop up window. So I arranged the pop up windows in each separate labeled section in which I reused the product images buttons from the products page and put the UI Loader into each separate labeled section which loads the big assebly photo of that product in use.
    Here are my questions:
    - Should each product have a separate labeled section with a pop up window
         This way I can reuse a number of already existing product button images and load only the high resolution assemble image
          However I end up having a lot of sections labeled for each product
    - or it should be arranged as follows:
         var sourceVar:String;
         function my_btnDown(event:MouseEvent):void {
         sourceVar="product_popups/product1_popUp.swf;
         gotoAndPlay("productsLoader");//where "productsLoader" is the labeled secion of my UI Loader
         This way I end up with one labeled section but have to implement up to 5 buttons on each new Pop Up.  In a sence I make the size of a loading pop up .swf a bit bigger by not recycling the existing buttons, but my assumption that I will have an easier funcitonality of the site?
    I am not sure which way would be a better or more appropriate way to go?

    Léonie-
    You are totally correct regarding custom tags instead of keywords depending upon the instance.
    My main point is that Folders are mostly misused. Images need to be keyworded or tagged and linked to Albums, generally not put in folders. With digital images almost always folder organization of images is just wrong, because folders by definition locate an image in just a single category. And few images are ever just in a single category.
    Some usage of folders can be helpful. Folders of Projects (e.g. 2001 Projects, Client royalfrenchel, etc.) make sense to help collapse a large number of Projects. However note that even in that simple two-folder example images cannot be in both folders at the same time without splitting the folders up.
    IMO users should spend  time carefully establishing how to keyword/tag and aggressively avoid using folders as much as possible. Eg. in Arturo's instance "week5" should be a keyword, not a folder. That way if one wants to make a brochure and use 5-week-old puppy pix it is an easy search on "week5" to retrieve pix to create an Album to peruse for brochure purposes. If "week5" instead comprises multiple deeply nested Folders subset to every litter of every Dam the process of retrieving becomes a nightmare.
    I welcome further discussion of this important topic.
    -Allen

  • TS3367 I own iPad mini and iPhone 4. I'd like to use FaceTime to talk to my partner whilst I'm in hospital. What's the best way of setting it up. Can I use my apple username for both devices?

    So have iPad mini and iPhone. But I'd like to leave my iPad with my partner whilst I'm in hospital so we can FaceTime each other.
    What's the best way of setting this up!

    http://support.apple.com/kb/HT4319

  • WHAT IS THE BEST WAY TO CREATE AN XSD FILE (TO BE USED BY SOAP ADAPTER)

    Dear friends
    I have a simple scenario.
    OUTBOUND DATA  -->  SOAP ADAPTER  --> ( XI )  -->  RFC ADAPTER  --> INBOUND DATA
    The XML file that I got from mapping area of IR (Design) is as follows
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_NAME_SOURCE xmlns:ns0="http://test3.com">
       <FIRSTNAME>DAVE</FIRSTNAME>
       <LASTNAME>SMITH</LASTNAME>
    </ns0:MT_NAME_SOURCE>
    If you notice, there are only 2 fields.
    I need to create an XSD file and import it as an external object, which I can use for SOAP Adapter.
    Which is the best way to create it.
    Also, I need to know if there is any step by step of sending a message from XML SPY. I have downloaded this software, but am not able to undertand how to use this.
    Hope to hear from any experts on this forum.
    Thanks in advance
    Ram

    Hi Ram,
    See the below blog..
    It shows how to send SOAP message using XML Spy.
    It also shows how to generate wsdl.
    /people/siva.maranani/blog/2005/09/03/invoke-webservices-using-sapxi
    Regards,
    Sumit

  • Best way to Transform one XML to another XML using SSIS

    I am using Altova Mapforce tool to transform one XML into another XML, but now we are planning to use any other best way of using XSLT transformation. Could you guys shed me some light on different approaches and which one would be best based on time and
    cost constraint.
    In Altova Map force Tool, due to below reasons we wanted to avoid that,
    Resource cannot work parallely in single XSLT
    Maintanence is very difficult
    Licensed version of tool
    When the XML size grows, new resourse are feeling difficult to edit the XSLT etc.,
    Related to .net approaches would be best.
    Can we create XSLT by using SSIS to transfrom one xml into another xml format.
    In .net code we can do, but feel that it is time consuming due to large size of XML.
    Any other best way for handling XSLT transformation or any tool

    XSLT can be applied to an XML file fed as a source, but it does not resolve #1. I by the way do not understand this point, technically.
    For SSIS to go live in prod you need to deplete a SQL Server license (CPU + CALs).
    The time to transform in SSIS will be equal to doing in .net code as the whole SSIS is coded in .Net, too.
    Here, in this section of the forum we may not have the needed expertise in XSLT or XML transformations.
    In my IT life, XML transformations were done in Java if on a *NIX box. On Windows a C# .net app webservice did it. The most interesting implementation, and if you are a heavy users of XML is to use a dedicated database as Base X, it has an XLSLT transform
    moduleL http://docs.basex.org/wiki/XSLT_Module
    Arthur
    MyBlog
    Twitter

  • I have an intel iMac OS X 10.8.3 and haven't yet backed up anything. Please advice on best ways of backing up everything before it's too late - external drive etc.

    I have in Intel iMac OS X 10.8.3 and haven't yet backed up anything.  Please advise on best ways of backing up everything (external drive etc?) before it's too late.

    Buy any external hard drive - USB/Firewire/Thunderbolt, etc that is compatible with your Mac. Opinions will vary, but I use Western Digital externals without problem, others will suggest LaCie, but there are no shortage of other manufacturers making equally good drives, I'm sure. It's preferable to buy a drive that is equal to the size of your internal HD, some will say twice the size. Mine are less than the size of my internal HD, but I don't have masses of data.
    The simple and free option is to then connect the drive to the Mac and turn on Time Machine. Leave the drive permanently connected and it will backup your data regularly.
    An alternative, and my preferred option is to use SuperDuper! or Carbon Copy Cloner to make regular bootable clones of your drive. Some (me included) keep multiple backups - clones and TMachine.
    When I had my HD replace recently I re-installed from the clone and was back where I left off in around an hour.

  • Best way to retrieve page source from a webserver using a fixed schedule??

    Right now I have a working program that will get the html source from a webserver, parse it and format to a more readable format. (In the future I would like to send a message with its content to a cellphone). But for now I would just like to know the best way to keep the connection object alive, while being able to call a GET request for the source (without having to create a new object everytime), in this case it is the bufferedreader. (The getSource() method is called in a thread every minute.
    What would be the best way to achieve this?
    Here is a snippet of the code for the web class.
    public class cWeb {
    static {
    try {
    myUrl = new URL("http://xxx.xxx.xxx/index.html");
    catch (MalformedURLException murle){
    System.out.println(murle.getMessage());
    catch (IOException ioe){}
    public static void getSource()
    String inputLine = null;
    pageSource = null; // this is a global var used in parse
    try {
    BufferedReader in = new BufferedReader(
    new InputStreamReader(
    myUrl.openConnection().getInputStream()));
    while ((inputLine = in.readLine()) != null)
    pageSource += inputLine;
    in.close();
    catch (MalformedURLException murle){}
    catch (IOException ioe){}
    }

    Hi,
    The data can be passed using URL parameters.
    In NW04s, Web Dynpro provides "Suspend" and "Resume" plugs for transferring the control to Non-WebDynpro framework and back to Web Dynpro application.
    1. Define an outbound plug of type suspend in the interface view
    -Suspend plug automatically generates a parameter with the name URL of type string
    2. Define a method (e.g. onActionSuspend) in the view controller, set return type void
    3. Define an action in the view controller (e.g. suspend, the event handler is onActionSuspend)
    4.Create the URL‘
    URL = newString(URLofTheExternalFrameworkapplication+ paramsString)
    5.Implement the FirePlug
    wdThis.wdGetTopLevelComponentInterfaceViewController().wdFirePlugSuspend(URL);
    6.Define an inbound plug of type resume in interface view.
    public void onPlugResumePlug{
    String resumepara=
    WDWebContextAdapter.getWebContext.getRequestParamet
    er/“param1“);
    From the non-WD framework,
    1. you have to get the currentURL
    String wdUrl= getCurrentUrl();
    2. Decode the URL
    try{
    wdUrl= URLDecoder.decode(wdUrl,“ISO-8859-1“);
    3.Then you can build the URL by appending URL params
    wdResumeUrl= wdUrl+ 'param1=' + result + 'param2'
    4. invoke it, the WD application would be resumed without getting timed out.
    If you don't have plugs of type Suspend and Resume in interface view in your IDE, then it maybe in the later versions of NW04s.
    Hope this helps.
    Thanks and Regards,
    Rohit Jaiswal

  • Best Way To Build An Array Of Many Elements

    Simple question for you LabVIEW experts: I want to build an array of many element for use in my code.  The problem is I have 20 elements I need to insert into the "Build Array Function."  This takes up much code space and is really not that clean.  I was thinking of using a For Loop and use the iteration terminal as the index for each element.  The For Loop would then use auto indexing and build this array for me.
    Is there a more efficient way to do this?  Thanks!

    hobby1 wrote:
    Crossrulz, I was planning on handling it like this: 
    I have a total of 17 element I need to build an array from.  Each case would include another element to be written to the array.  Is this the correct way to handle this?
    Thats one way to do it.  Not nearly as efficient as using the Build Array, but it will work.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • What is the best way to display different array values to appropriate indicators?

    I am using DAQmx Read vi and its output is an array. I need a way to pass each value to an appropriate front panel indicator, so I can monitor each sensor. I tried using "Index Array" and passing the array element to the indicators but it looks sloppy. Is there a more professional way? Thanks!
    Attachments:
    Mole.vi ‏215 KB

    Try using the Array to Cluster function in the Cluster subpallet. If you put all of your indicators in the same cluster on your front panel, you can then pass the array data to this function and then pass it directly to the cluster without having to index the array.
    criag

  • Best Way to do this array manipulation

    I have an array as follows:
    61 3 51 5 61.2 3.4 51.3 4.3 61 7 51 4
    where the data is in sets of two so array[0] and array[1] make up one data set (61,3) and the next data set is (51,5) then (61.2,3.4) ect. What I want to do is to clean this array up so that any data set where the X values are within some set value, say 1 then they are seen as duplicates and removed, unless the y values differ by more than 1. So for example this set would clean up to
    61 3 51 5 61 7
    Is there any nice way to do this in labview?
    Thanks.
    Intern NSWCCD Carderock.

    I tried to use the following VI but it doesnt seem to work, any suggestions? Thanks.
    Intern NSWCCD Carderock.
    Attachments:
    try.vi ‏82 KB

Maybe you are looking for

  • ITUNES WON'T OPEN!!!   PLEASE HELP ME I'M GOING INSANE!!

    I have a dell computer.. I have Windows XP I got itunes wiht a new ipod mini in the fall. everything was going great, I even upgraded to the new itunes and everything was fine until about a month ago when it just quit on me. when I try to open itunes

  • Sync iPod 2G notes with mac?

    I have a new Macbook, and I often take notes on my old iPod 2G. So I tried to find a way to sync my iPod notes with my Mac notes application. But there is no function for this in iTunes and I heard that you can only sync with the Mac notes app with i

  • Reg Delivery schdules message to vendor

    Hi We have simple schedule agreement[No JIT/FRC] with lots of items, lets assume 100 line items Suppose 80 of these materials has open GR's [Release created] Now when i send Delivery schedules message[Print/Email] to vendor, it will have all 80 mater

  • MacBook (Mid 2007)

    Is a MacBook (Mid 2007) compatiable with snow leopard?

  • After installing Dreamweaver CC Trial it will not launch.

    After successfully install the Trial for Dreamweaver CC it does not open when launched. The application seems to start to open and the exits without any error message. I'm running on a Mac mini (Late 2012) running Yosemite (10.10.3).