Where did my array elements go????

<code>
for (i=0; i<=19; i++){
NSArray *items = [[chunks objectAtIndex:i]componentsSeparatedByString: @"+"];
NSURL *imgurl = [NSURL URLWithString:[items objectAtIndex:0]];
NSData *data = [NSData dataWithContentsOfURL:imgurl];
NSLog(@"adding image: %@",imgurl);
[imgarr addObject:[[UIImage alloc] initWithData:data cache:NO]];
NSLog(@"with data: %@",[imgarr objectAtIndex:1]);
</code>
ok, "items" is an array of an element in the array "chunks" split at "+" the resulting string at index 0 of "items" is a full href to an image. With a for loop i grab the "data" of the afore mentioned href with NSData dataWithContentsOfURL. I then add the "data" as an UIImage object to the imgarr NSMutableArray. I get no errors on the console adding the objects but when i attempt to read them out I get a null.
if i look at the "data" before being added to the array i get... well.... data! (990000 6655222 0584563 552525.......) so i know that i have something to add but it never happens.
any insight would be greatly appreciated.
Jason

I think Nonnus misread your poorly formatted code post and thought you were trying to add objects to an NSArray (like items ) rather than an NSMutableArray.
In theory what you're doing should work fine but there are acouple things that are missing and/or odd about your code. I don't see imgarr getting alloc/init-ed but it just might not be shown and I also don't know why you always have the *UIImage imagenamed* reference in your code (but this may be an iPhone element I don't know about).
This should work fine:
NSMutableArray *imgarr = [[[NSMutableArray alloc]init];
NSURL *imgurl = [NSURL URLWithString:[items objectAtIndex: 0]];
NSLog(@"finalURL: %@",imgurl);
NSData *data = [NSData dataWithContentsOfURL:imgurl];
UIImage *img = [[UIImage alloc] initWithData:data cache:YES];
[imgarr addObject:img];
Like I said, unless I'm missing something about the UIImage class on the iPhone this is standard Obj-C/Cocoa stuff.
HTH,
=Tod

Similar Messages

  • Import From Elements - where did it go

    I noticed that the Michael Tapes 'Import' video showed an 'Import From Elements' menu item on the file menu. I have the 4.1 beta installed and this item does not appear in the file menu. Where did it go or is there another way to import a PSE catalog straight into LR.
    Here is the video site:
    http://pictureflow.fileburst.com/_Tutorials/Photoshop_LR/01/index.html

    I'm hoping that this whole process is unnecessary. By seeing the "Import from Elements" option, I am currently hoping/assuming that this means it will import the actual PSE Organizer catalog into LR. PSE Organizer uses .psa files for each catalog. I am hoping that by selecting the "Import from Elements" options, LR will take your .psa file (Photoshop Elements Organizer Catalog) and convert it into a .aglib file (Lightroom Library). The tags, categories and subcategories should be converted to the Lightroom equivalent of keywords, parent keywords, and child keywords (or whatever they're called in LR). In doing this, there should be no preparation of anything in PSE Organizer. If I'm understanding what Susan just said she did, it seems that the actions you just took Susan by making everything a category just took away all hierarchical tags (or parent/child information), for their is no heirarchy in the IPTC keywords fields, unless I'm mistaken.
    Once again, I'm assuming this is how it will work and I hope I'm right . . . any other way just doesn't seem to make any sense. The "Import from Elements" option would not be needed if you've already embedded all of your tags into the files (or made all of your tags into categories and embedded that). If that information is already embedded in the file, then just import the files through the typical import dialog and it will find that information. There is no need to worry about the catalog or the "Import from Elements" command at all. My hope is that I don't need to do this and I can just convert the catalog on the fly (much like when you upgrade from say PSE Organizer version 3 to PSE Organizer version 5). Regardless, I will wait until LR is released before I take any steps to start the conversion process. I don't want to compomise something that I've spent years creating and works great already because I'm guessing or assuming how something may or may not work. I guess we shall all know soon enough (or even sooner if a final release tester can confirm this in any way).

  • Where did all my photos go from   Photoshop Elements 5.0?

    Where did all my photos go from Photoshop Elements 5.0? I opened up view and organize and it is empty.

    Did you change catalogs?
    Look under the File menu for Catalogs

  • Installed Elements on my Mac...where did it go?

    I'm using the Akamai installer to install Elements on my new Mac desktop.  I open it, it runs through the steps, gives me a "your software has been installed" message...so, where did the software get installed??? I do not see it anywhere on my computer!  (I am a new Mac user though so maybe I just don't know where to look).  Any input or assistance would be very much appreciated!

      Its usually in the Support Files folder but you may have to enable the viewing of hidden files.
    http://helpx.adobe.com/x-productkb/global/access-hidden-user-library-files.html

  • A basic question/problem with array element as undefined

    Hello everybody,
    thank you for looking at my problem. I'm very new to scripting and javaScript and I've encountered a strange problem. I'm always trying to solve all my problem myself, with documentation (it help to learn) or in the last instance with help of google. But in this case I am stuck. I'm sure its something very simple and elementary.
    Here I have a code which simply loads a text file (txt), loads the content of the file in to a "var content". This text file contents a font family name, each name on a separate line, like:
    Albertus
    Antenna
    Antique
    Arial
    Arimo
    Avant
    Barber1
    Barber2
    Barber3
    Barber4
    Birch
    Blackoak ...etc
    Now, I loop trough the content variable, extract each letter and add it to the "fontList[i]" array. If the character is a line break the fontList[i] array adds another element (i = i + 1); That's how I separate every single name into its own array element;
    The problem which I am having is, when I loop trough the fontList array and $.writeln(fontList[i]) the result in the console is:
    undefinedAlbertus
    undefinedAntenna
    undefinedAntique
    undefinedArial ...etc.
    I seriously don't get it, where the undefined is coming from? As far as I have tested each digit being added into the array element, I can't see anything out of ordinary.
    Here is my code:
    #target illustrator
    var doc = app.documents.add();
    //open file
    var myFile = new File ("c:/ScriptFiles/installedFonts-Families.txt");
    var openFile = myFile.open("r");
    //check if open
    if(openFile == true){
        $.writeln("The file has loaded")}
    else {$.writeln("The file did not load, check the name or the path");}
    //load the file content into a variable
    var content = myFile.read();
    myFile.close();
    var ch;
    var x = 0;
    var fontList = [];
    for (var i = 0; i < content.length; i++) {
        ch = content.charAt (i);
            if((ch) !== (String.fromCharCode(10))) {
                fontList[x] += ch;
            else {
                x ++;
    for ( i = 0; i < fontList.length; i++) {
       $.writeln(fontList[i]);
    doc.close (SaveOptions.DONOTSAVECHANGES);
    Thank you for any help or explanation. If you have any advice on how to improve my practices or any hint, please feel free to say. Thank you

    CarlosCantos wrote an amazing script a while back (2013) that may help you in your endeavor. Below is his code, I had nothing to do with this other then give him praise and I hope it doesn't offend him since it was pasted on the forums here.
    This has helped me do something similar to what your doing.
    Thanks again CarlosCanto
    // script.name = fontList.jsx;
    // script.description = creates a document and makes a list of all fonts seen by Illustrator;
    // script.requirements = none; // runs on CS4 and newer;
    // script.parent = CarlosCanto // 02/17/2013;
    // script.elegant = false;
    #target illustrator
    var edgeSpacing = 10;
    var columnSpacing = 195;
    var docPreset = new DocumentPreset;
    docPreset.width = 800;
    docPreset.height = 600;
    var idoc = documents.addDocument(DocumentColorSpace.CMYK, docPreset);
    var x = edgeSpacing;
    var yyy = (idoc.height - edgeSpacing);
    var fontCount = textFonts.length;
    var col = 1;
    var ABcount = 1;
    for(var i=0; i<fontCount; i++) {
        sFontName = textFonts[i].name;
        var itext = idoc.textFrames.add();
        itext.textRange.characterAttributes.size = 12;
        itext.contents = sFontName;
        //$.writeln(yyy);
        itext.top = yyy;
        itext.left = x;
        itext.textRange.characterAttributes.textFont = textFonts.getByName(textFonts[i].name);
        // check wether the text frame will go off the bottom edge of the document
        if( (yyy-=(itext.height)) <= 20 ) {
            yyy = (idoc.height - edgeSpacing);
            x += columnSpacing;
            col++;
            if (col>4) {
                var ab = idoc.artboards[ABcount-1].artboardRect;
                var abtop = ab[1];
                var ableft = ab[0];
                var abright = ab[2];
                var abbottom = ab[3];
                var ntop = abtop;
                var nleft = abright+edgeSpacing;
                var nbottom = abbottom;
                var nright = abright-ableft+nleft;
                var abRect = [nleft, ntop, nright, nbottom];
                var newAb = idoc.artboards.add(abRect);
                x = nleft+edgeSpacing;
                ABcount++;
                col=1;
        //else yyy-=(itext.height);

  • Why won't all the array elements display?

    Hello,
    I am trying to learn about manipulating arrays.  The example finder includes this one," build array_forum.vi", which shows the two modes, concatenate and append, which I can understand, HOWEVER, I cannot figure out how they built this vi.  For example, I can find the Build Array function, but, I cannot understand how they created the "array of numeric data 1"  "array of numeric data 2"...etc, and I cannot find the functions on the palettes that result in the display "build array concatenate inputs".  Where are these blue functions????
    Where are these functions found on the palette, and how does one construct them like this?
    The other vi shown here, "for loop array_forum.vi" is my attempt to duplicate it, but, it does not show all the elements of the array; instead it displays only ONE element, the last element of the array.  How do I display all the elements of the array I am trying to create using the FOR LOOP?  Am I doing something wrong with the FOR LOOP?
    Thanks,
    dave
    Solved!
    Go to Solution.
    Attachments:
    Build Array_forum.vi ‏12 KB
    for loop array_forum.vi ‏7 KB

    Hello Tim and Nilquist,
    Thanks for your help.  Let me re-state my question.  I have studied the Labview basics, and I understand about REPRESENTATION, data types etc., but, take a look at the attached vi.  In it, I have added an indicator, and the indicator I have added is called ARRAY by default, and it is the shape of a large box.  The original indicators in the original example are small boxes are labelled I-32.  Where did the original indicators come from?  Is my indicator identical to the original ones? I am using LV2011 basic.
    Thanks,
    DAve
    Attachments:
    Build Array_forum_2.vi ‏12 KB

  • Allocate array elements one at a time?

    Is there a way to allocate array elements one at a time?
    The following code will crash because the minimumLogIndices array is not allocated.
    // get all indices where cArray[i] > minimumLog
    int[] minimumLogIndices = null;
    for (int i=0; i < columns; i++)
      if ((cArray[i] > minimumLog))
        minimumLogIndices[i] = i;
    }I would like a statement like:
    minimumLogIndices[i] = new(i);but this is not allowed, of course.
    If I use ArrayList, then the elements can be added one at a time, but I cannot use int.
    null

    int[] minimumLogIndices = new int[columns];As described here:
    http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html
    [Edit] The array will, however, have "holes" in it when cArray[i] <= minimumLog, but that's inevitable if you are using an array.

  • "In initializer for 'mxmlContent', type Object is not assignable to target Array element type..."

    Hi all,
    So I've have built an application on flash builder 4.5 using Christophe Coenraets' tutorial "Building an EmployeeDirectory" (http://www.adobe.com/devnet/flex/articles/employee-directory-android-flex.html#articlecont entAdobe_numberedheader).
    I'm getting this error message "In initializer for 'mxmlContent', type Object is not assignable to target Array element type mx.core.IVisualElement." and then the debugger highlights my code this line of my code "</s:List>" in my EmployeeDetails.mxml file. This started after I coded Part 5, Step 2 "Integrating with the Device Capabilities: Triggering the Actions".   The rest of the code debugged fine.
    I think it relates to Christophe's note "Note: Make sure you import spark.events.IndexChangeEvent (and not mx.events.IndexChangedEvent) for this code to compile.".  I don't know where to place this
    " import spark.events.IndexChangeEvent;" line of code. 
    Any help?  Tks in advance..
    Any help would be greatly appreciated.  Thanks

    You have a DataGrid directly inside a State element. Perhaps wrap it in an AddChild element?
    More information on using states can be found here:
    http://livedocs.adobe.com/flex/3/html/help.html?content=using_states_1.html

  • Type defined array of clusters for holding configuration data - setting default values for each array element

    Hi,
    I was wondering if I could get some information and opinions about using a type defined array of clusters to hold configuration data.  I am creating a program to test multiple DUTs and wanted to have a type defined control for each DUT containing the information needed to create the DAQmx tasks for all of the signals for that DUT.  I am wanting to do this so that the data is hard-coded and not in a file that the user could mess up.
    The type def controls are then put in a subVI that chooses the appropriate one based on the DUT Type enumeration wired to a case structure.  
    I am having problems with the type defined control.  I am seeing issues when attempting to save a unique configuration to each array element in the array of clusters.  Somehow it worked to begin with, but now clicking "Data Operations --> Make Current value default" on individual elements of the cluster or the entire cluster (array element) is not saving the data when I re-open the type def control.  What am I doing wrong?  Am I trying to do something with arrays of clusters that I should not be doing?
    I have attached one of the type defined controls for reference.  I tried changing it to Strict to see if that helped, but no luck.
    To reproduce, change the resource string for array element 0 and make the new value the default value.  Then close the type def, and re-open it.  The old value is still present in that element.  The VI is saved in LabVIEW 2012.
    Solved!
    Go to Solution.
    Attachments:
    CM_AnalogInputs.ctl ‏11 KB

    Values of a typedef are not proprigated to instances of the control. THey will pick it up if created AFTER the data values have been changed. THey will not get updated with future changes. You should either create a VI specifically for hardcoding your values or implement a file based initialization. The file based would be much better and more flexible. If you don't want users to modify the data simply encrypt it. There is a noce blowfish library you can download.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Array Element.Disabled

    I have an existing VI where the original programmer has a 2D array of booleans.
    He sets the Array Disabled property to Disabled and Grayed Out.
    He is also setting the Array Element.Disabled property to Disabled and Grayed Out.
    I am not understanding why it is also necessary to do the latter.

    Yeah, my quick test shows there is no point in also setting the disabled property of the control in the array.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Trying to use .split with an array element

    I have tried multiple ways to split an array element into its components that are separated with a space with this code:
    public static void compareHand(String[] hand){
            for (int i = 0; i < hand.length; i++){
                System.out.println(i);
                System.out.println(hand);
    String[] tokens = hand[i].split("\\s");
    System.out.println(tokens.length);
    for (int j = 0; j < tokens.length; j++){
    System.out.println(tokens);
    I keep getting strange output like the following:
    King of Spades
    3
    [Ljava.lang.String;@10b62c9
    [Ljava.lang.String;@10b62c9
    [Ljava.lang.String;@10b62c9
    where I am expecting:
    King of Spades
    3
    King
    of
    Spades
    Any ideas where I am going wrong?

    public static void compareHand(String[] hand){
             for (int i = 0; i < hand.length; i++){
                  System.out.println(i);
                  System.out.println(hand);
    String[] tokens = hand[i].split("\\s");
    System.out.println(tokens.length);
    for (int j = 0; j < tokens.length; j++){
    System.out.println(tokens); // your error is on this line. Hint ... System.out.println(tokens[...]);

  • Where did my synced files go? I synced them on the tablet, now I want to get them on my PC

    Where did my synced files go? I synced them on the tablet, now I want to get them on my PC
    How do I access them?

    Via Creative Cloud.
    One caveat: If you want to work with PS Touch's native file format (which is PSDX), you'll have to have Photoshop CC (or CS) and the PSDX plug-in.
    Another option would be to export any projects as the PSD file format and open those in Photoshop or Photoshop Elements. If you import these back into PS Touch, note that PSD files will be automatically flattened.

  • Why do I get an "Array element prototype" -17001 error when trying to "View Paths"?

    I added some custom types to my sequence file and to MyTypes.ini, and then opened and updated all of the .seq files under "Components/User". I'm a TestStand Newbie, but I think I did this correctly.
    Now, if I try to "View Paths" in the sequence file, I get the following error:
    Array element prototype does not have a location string!
    Error Code: -17001, Program Error.
    Source 'TSAPI'
    Any idea what's going on?
    Jim Polstra

    Jim,
    Thanks for the explanation and instructions for reproducing the problem.
    I was able to reproduce this here as well and this is definitely not the intended behavior. As far as when this specific problem will be fixed, you can be assured that is being addressed in future releases of TestStand. For now though, we will have to consider a workaround, and it goes as follows:
    It appears that this is happening only with specific type definitions such as "Path" (we haven't identified any others but we can't rule out yet that others don't exist), and it doesn't really have to be placed inside of a custom container type such as you illustrated. If you simply create a custom type that is just an array of "Path"s it will behave the same way when you View >> Paths. What's really funny about this though is that "Path" is simply a custom type based on the "String" intrinsic type. If you create your own custom string type called "MyPath" and replace the "FilePath" field in the "DataFile" container type with a new "FilePath" field based on the "MyPath" datatype, the error won't occur. This is also exactly what we recommend as a workaround. So, simply do the following to implement this:
    1) Open MyTypes.ini and create a new custom type of type "String" named "MyPath".
    2) Delete the field named "FilePath" from the "DataFile" custom type.
    3) Create a new field in the "DataFile" custom container type, again called "FilePath", but make it of type "MyPath".
    4) Save MyTypes.ini
    5) Now try doing a View >> Paths on the MyTypes.ini file as before.
    As a final note, we don't really believe that much concern should be placed on this by end-users in relation to a run-time scenario, as the only thing that is really being affected by this is an edit-time tool. We acknowledge the importance of having all of the design time tools work flawlessly, but it should be made clear that this will most likely not affect anything at run-time.
    I hope this helps, and thank you again for reporting this issue to us. Let me know if you need anything else.
    Jason F.
    Applications Engineer
    National Instruments
    www.ni.com/ask

  • I recently upgraded to Mavericks and I now cannot find under the file menu the option to "Save As" in my Numbers application. Where did it go?

    I recently upgraded to Mavericks and I now cannot find under the file menu the option to "Save As" in my Numbers application. Where did it go?

    In many, many apps Apple has now created a confusing array of "save as..", "export", and "duplicate" all doing essentially the same thing - saving a new copy elsewhere possibly with format changes.  Drives me nuts.
    But its always there.
    Grant

  • Where can I download Elements 11?

    My PC breaked down an now I have a problem. I have product key to Elements 11, but the installation soft is in the graveyard of the computers. I can't download it, because only v. 12. What now?
    Heikki [email protected]

    Well, well.
    I must admit - it was mostly my fault.
    But, when I tried to download, I must did it several times. Often I get
    information: 'downloading breaked for a unknowing reason.' But now is
    ewerything in order.
    Thanks a lot!
    HH
    2013/10/16 nealeh <[email protected]>
       Re: Where can I download Elements 11?  created by nealeh<http://forums.adobe.com/people/nealeh>in
    Photoshop Elements - View the full discussion<http://forums.adobe.com/message/5762639#5762639

Maybe you are looking for

  • Macbook (mid 2012, 9,2) has very poor performance since the day I bought it (less than 2 months ago)

    Problem description: My macbook is extremely slow since the day I bought it (which was less than 2 months ago)…Came preinstalled with Mavericks and 4GB of RAM. Upgraded it to 16GB hoping that would help, but that did very little…then upgraded to Yose

  • My Skype to go number

    I have a US based skype number but will be visiting the UK for an extended period. If someone calls my Skype number will it ring through to me in the UK?

  • Odd fail with com.oreilly.servlets on tomcat 4.1

    I've got a page that uses the com.oreilly.servlets package on tomcat 4.1. It is failing at the point where I first create my MultipartRequest but the error stack doesn't make any reference to the com.oreilly.servlets package, it just says: root cause

  • Embedding photos to a forum

    With my smugmug account, I can embed a photo onto forums by placing the url for the photo between [img] tags. I have tried that with my photos stored on my iweb site, but it won't work. Is there a way to do this? Stefan

  • Problem with newly created CM Repository NOT showing in Repositories Link

    I am new to the Portal and this is the first time that I have created a CM Respository that is reaching out to a network drive (on a different domain and different server, our Platform is Windows).  Here is what I have done so far... 1.  Created a Wi