Search Results

Search found 15239 results on 610 pages for 'array population'.

Page 59/610 | < Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >

  • Turn database result into array

    - by Industrial
    Hi everyone, I have just made the update/add/delete part for the "Closure table" way of organizing query hierarchical data that are shown on page 70 in this slideshare: http://www.slideshare.net/billkarwin/sql-antipatterns-strike-back My database looks like this: Table Categories: ID Name 1 Top value 2 Sub value1 Table CategoryTree: child parent 1 1 2 2 2 1 However, I have a bit of an issue getting the full tree back as an multidimensional array from a single query. Here's what I would like to get back: array ( 'topvalue' = array ( 'Subvalue', 'Subvalue2', 'Subvalue3' = array ('Subvalue 1', 'Subvalue 2', 'Subvalue 3' ) ); ); Update: Found this link, but I still have a hard time to convert it into an array: http://karwin.blogspot.com/2010/03/rendering-trees-with-closure-tables.html

    Read the article

  • C# Array number sorting

    - by athgap
    Hi, I have an array of numbers jumbled up from 0-9. How do I sort them in ascending order? Array.Sort doesn't work for me. Is there another way to do it? Thanks in advance. EDIT: Array.Sort gives me this error. Argument 1: cannot convert from 'string' to 'System.Array' Right now it gives me this output: 0) VersionInfo.xml 2) luizafroes_singapore2951478702.xml 3) virua837890738.xml 4) darkwizar9102314425644.xml 5) snarterz_584609551.xml 6) alysiayeo594136055.xml 1) z-a-n-n2306499277.xml 7) zhangliyi_memories932668799030.xml 8) andy_tan911368887723.xml 9) config.xml k are the numbers from 0-9 string[] valnames = rk2.GetValueNames(); foreach (string k in valnames) { if (k == "MRUListEx") { continue; } Byte[] byteValue = (Byte[])rk2.GetValue(k); UnicodeEncoding unicode = new UnicodeEncoding(); string val = unicode.GetString(byteValue); Array.Sort(k); //Error here richTextBoxRecentDoc.AppendText("\n" + k + ") " + val + "\n"); }

    Read the article

  • dynamic memory allocation of 2d array in which columns are of different size

    - by vishal kumar
    i want to create a 2d array dynamically in c++ language. But in that 2d array columns should be of different size. i mean to say that 2d array should not be in M * N. It should be something like.... 1 2 next line 3 4 5 next line 2 3 4 5 next line 5 next line 4 5 7 I am able to create 2d array in above manner but how to display content of array continously create a problem for me. Please anyone explain me how to come up with this problem.

    Read the article

  • Duplicates in a sorted java array

    - by Max Frazier
    I have to write a method that takes an array of ints that is already sorted in numerical order then remove all the duplicate numbers and return an array of just the numbers that have no duplicates. That array must then be printed out so I can't have any null pointer exceptions. The method has to be in O(n) time, can't use vectors or hashes. This is what I have so far but it only has the first couple numbers in order without duplicates and then just puts the duplicates in the back of the array. I can't create a temporary array because it gives me null pointer exceptions. public static int[] noDups(int[] myArray) { int j = 0; for (int i = 1; i < myArray.length; i++) { if (myArray[i] != myArray[j]) { j++; myArray[j] = myArray[i]; } } return myArray; }

    Read the article

  • sending javascript array to external php file using POST

    - by user1472224
    I am trying to send a javascript array to an external php page, but the only thing the php page is picking up is the fact that I am sending array, not the actual data within the array. javascript - var newArray = [1, 2, 3, 4, 5]; $.ajax({ type: 'POST', url: 'array.php', data: {'something': newArray}, success: function(){ alert("sent"); } }); External PHP Page - <?php echo($_POST['something'])); ?> I know this question has been asked before, but for some reason, this isn't working for me. I have spent the last couple days trying to figure this out as well. Can someone please point me in the right direction. current output (from php page) - Array (thats all the page outputs)

    Read the article

  • Multi dimensional array with get image data

    - by Dave
    I'm really confused with an array im making, its gotten a bit confusing to follow but i believe its the only way for me to approach what im trying to do. My idea here is to store getImageData in an array so i can link each image to an array of data. This is how i create my array: var listObj = { id: uid, extra: [ ctx2.getImageData(abposx,abposy,imgwidth,imgheight) ] }; pixeld.push(listObj); So now im trying to run through the array "pixeld" to find the uid but i don't know how the syntax should be.... this is what i tried: for (j = (pixeld.length-1); j > -1; --j){ if(pixeld[j].extra.data[3] !==0){ //line 220 matches.push(pixeld[j].id); } } The problem is i get this error: Uncaught TypeError: Cannot read property '3' of undefined on line 220 I have marked which line is 220 in the for loop. Any one know what my mistake is ?

    Read the article

  • PHP array of object(stdClass) fusion/intersect?

    - by Gremo
    $arr1 is an associative array of anonymus objects: array 15898 => object(stdClass)[8] public 'date' => int $arr2 is another associative array with two (or more, it's not fixed) properties: array 15898 => object(stdClass)[10] public 'fruits' public 'drinks' I can't find any function for intersect and content fusion when dealing with objects. Basically i'd like to obtain: array 15898 => object(stdClass)[8] public 'date' => int public 'fruits' public 'drinks' Question is: is this even possible?

    Read the article

  • How to split and join array in C++?

    - by Richard Knop
    I have a byte array like this: lzo_bytep out; // my byte array size_t uncompressedImageSize = 921600; out = (lzo_bytep) malloc((uncompressedImageSize + uncompressedImageSize / 16 + 64 + 3)); wrkmem = (lzo_voidp) malloc(LZO1X_1_MEM_COMPRESS); // Now the byte array has 802270 bytes r = lzo1x_1_compress(imageData, uncompressedImageSize, out, &out_len, wrkmem); How can I split it into smaller parts under 65,535 bytes (the byte array is one large packet which I want to sent over UDP which has upper limit 65,535 bytes) and then join those small chunks back into a continuous array?

    Read the article

  • Building an array of arrays

    - by iFloh
    I am trying to get the following loop working to fill an array of arrays: while (condition) { [itemsArray fillFromDB]; if (! [checkArray containsObject:checkFlag]) { // Add existing itemsArray to myArray if (itemsArray.count) { // add the itemsArray to myArray and create a new instance of itemsArray [myArray addObject:itemsArray]; [itemsArray release]; NSMutableArray *itemsArray = [[NSMutableArray alloc] init]; } [itemsArray addObject:myObject]; [checkArray addObject:checkFlag]; } else { [itemsArray addObject:tmpEvent]; } } However I try to shape this loop it falls over the release of itemsArray when I use release (as above), the array does not re-initialise as a new instance with alloc. Whilst expecting emptyness, the next Object is added to the old array. when I use removeAllObjects, my Array is emptied and so is the array attached to myArray. Where am I going in the wrong direction?

    Read the article

  • how to make an array of arrays

    - by yuliya
    hi, how would you write an array of values to other array. In instance, I have a list of IPs and list of requests. I want to have something like [{ip1, request1}, {ip2, request2}, ....]. It's how I would do it, but sure obj will change every time and array will have all the time the same values. ArrayList array = new ArrayList(); Object[] obj = new Object[2]; for (int i=0; i<listSize; i++){ obj[0] = ipList.get(i).toString(); obj[1] = requestList.get(i); array.add(obj);

    Read the article

  • Codeignitor Global Array Declaration

    - by Ajith
    I have a sequence of number like follows 1 - 25, 2 - 60, 3 - 80, 4 - 100 and so on which means that if input is 1 output will be 25 and so on...I need to store it in global array.I would like to use it in multiple pages also.In codeigniter where i can declare a global array and store all these? I am trying like as follows in constants.php $CONFIDENCEVALUE = array(); $CONFIDENCEVALUE[] = array('1'=>25,'2'=>'60','3'=>80,'4'=>100); If it is correct how can access these array value in required pages.Help me please.I am not an expert with codeignitor.Thanks

    Read the article

  • Get Next and Previous Elements in JavaScript array...

    - by Belden
    I have a large array, with non-sequential IDs, that looks something like this: PhotoList[89725] = new Array(); PhotoList[89725]['ImageID'] = '89725'; PhotoList[89725]['ImageSize'] = '123'; PhotoList[89726] = new Array(); PhotoList[89726]['ImageID'] = '89726'; PhotoList[89726]['ImageSize'] = '234'; PhotoList[89727] = new Array(); PhotoList[89727]['ImageID'] = '89727'; PhotoList[89727]['ImageSize'] = '345'; Etc.... I'm trying to figure out, given an ID, how can I can get the next and previous ID... So that I could do something like this: <div id="current">Showing You ID: 89726 Size: 234</div> Get Prev Get Next Obviously, if we're at the end or beginning of the array we just a message...

    Read the article

  • Extreamely fast way to clone the values of an array into a second array?

    - by George
    I am currently working on an application that is responsible for calculating random permutations of a multidemensional array. Currently the bulk of the time in the application is spent copying the array in each iteration (1 million iterations total). On my current system, the entire process takes 50 seconds to complete, 39 of those seconds spent cloning the array. My array cloning routine is the following: public static int[][] CopyArray(this int[][] source) { int[][] destination = new int[source.Length][]; // For each Row for (int y = 0; y < source.Length; y++) { // Initialize Array destination[y] = new int[source[y].Length]; // For each Column for (int x = 0; x < destination[y].Length; x++) { destination[y][x] = source[y][x]; } } return destination; } Is there any way, safe or unsafe, to achieve the same effect as above, much faster?

    Read the article

  • question on find value in array

    - by davit-datuashvili
    i have seen a few days ago such problem there is given two array find elements which are common of these array one of the solution was sort big array and then use binary search algorithm and also there is another algorithm- brute-force algorithm for (int i=0;i<array1.length;i++){ for (int j=0;j<array2.length;j++){ if (array1[i]==array2[j]){ //code here } } it's complexity is O(array1.length*array2.length); and i am interested the first method's complexity is also same yes? because we should sort array first and then use search method binary search algorithm's complexity is log_2(n) so it means that total time will be array.length*log_2(n) and about sort? please explain me which is better

    Read the article

  • Read a file to multiple array byte[]

    - by hankol
    I have an encryption algorithm (AES) that accepts file converted to array byte and encrypt it. Since I am going to process a very big size files, the JVM may go out of memory. I am planing to read the files in multiple array byte. each containing some part of the file. Then I teratively feed the algorithm. Finally merge them to produce encrypted file. So my question is: there any way to read a file part by part to multiple array byte? I thought I can use the following to read the file to array byte: IOUtils.toByteArray(InputStream input). And then split the array into multiple bytes using: Arrays.copyOfRange(). But I am afraid that the first code that reads file to byte will make the JVM to go out of memory. any suggestion please ? thanks

    Read the article

  • Comparing an array of users to an array of structs with user object as attribute, and returning matc

    - by keruilin
    I have an array of users who are friends. Let us call this array: friends I then have an array of structs. Each struct has a user object as an attribute (it also has a rank attribute). Here's what the struct class looks like, to add some context: class Leader < Struct.new(:rank, :user); end Let us call this array of structs: all_leaders_plus_rank I want to compare friends and all_leaders_plus_rank, and add the match from all_leaders_plus_rank to a new array of structs called friendly_leaders.

    Read the article

  • question on revrse array

    - by davit-datuashvili
    we know algorithm how reverse array of n integers for (int i=0;i<n/2;i++){ swap(a[i],a[n-1-i]): } is this method better according the speed of algorithm or not because swap using xor is more fast then in other method here is code public class swap{ public static void main(String[]args){ int a[]=new int[]{2,4,5,7,8,11,13,12,14,24}; System.out.println(" array at the begining:"); for (int i=0;i<a.length;i++){ System.out.println(a[i]); } for (int j=0;j<a.length/2;j++){ a[j]^=a[a.length-1-j]; a[a.length-1-j]^=a[j]; a[j]^=a[a.length-1-j]; } System.out.println("reversed array:"); for (int j=0;j<a.length;j++){ System.out.println(a[j]); } } } //result array at the begining: 2 4 5 7 8 11 13 12 14 24 reversed array: 24 14 12 13 11 8 7 5 4 2

    Read the article

  • Converting byte array to image in xcode?

    - by arizah
    I am getting a byte array(I reckon) in NSMutableArray's object.The NSMutableArray i get is from Xml parsing from a service URL..Now I need to convert that byte array to UIImage ..Gone through google and found to convert to NSData and then UIImage but couldn't understand how..? How can I do it ? My array looks like this : ( { Name = "John"; Image = "/9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJS kcgSlBFRyB2NjIpLCBxdWFsaXR5ID0gODAK/9sAQwAGBAUGBQQGBgUGBwcGCAoQCgoJCQoUDg8MEBcUGBgXF BYWGh0lHxobIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEHBwcKCAoTCgoTKBoWGigoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo/8AAEQgEKwZAAwEiAAIRAQMRAf/........ //big byte array } ) First of all I need to clear whether it is a byte array ?How can I extract image from this ?

    Read the article

  • PotgreSQL 2D array to rows

    - by PostGreSQL newbie
    Hello, I am new to PostgreSQL array's. I am trying to a write a procedure to convert array-into-rows, and wanted following output: alphabet | number ---------+---------- A | 10 B | 10 C | 6 D | 9 E | 3 from following: id | alphabet_series -------+-------------------------------------------------------------------------------------------------- 1 | {{A,10},{B,10},{C,6},{D,9},{E,3},{F,9},{I,10},{J,17},{K,16},{L,17},{M,20},{N,13},{O,19}} I have searched for array-to-rows functions, but they all seems to accept 1-d array. but in this case, it is 2-d array. Any pointers will be appreciated. Many thanks.

    Read the article

  • PHP oop build array

    - by Industrial
    Hi! If I would need to build up an array with OOP based PHP, would this be the proper way to do it? class MyClass { $array = array(); function addElement($value) { $this->array[] = $value; } function fetch() { $return = $this->memcached->getMulti($this->array); return $return; } } PHP file where it will be used: <?php $this->myClass->addElement('key1'); $this->myClass->addElement('key1'); $this->myClass->addElement('key1'); $var = $this->myClass->fetch(); Thanks a lot

    Read the article

  • Finding whether a value is equal to the value of any array element in MATLAB

    - by James
    Hi, Can anyone tell me if there is a way (in MATLAB) to check whether a certain value is equal to any of the values stored within another array? The way I intend to use it is to check whether an element index in one matrix is equal to the values stored in another array (where the stored values are the indexes of the elements which meet a certain criteria). So, if the indices of the elements which meet the criteria are stored in the matrix below: criteriacheck = [3 5 6 8 20]; Going through the main array (called array) & checking if the index matches: for i = 1:numel(array) if i == 'Any value stored in criteriacheck' ... "Do this" end Does anyone have an idea of how I might go about this? Thanks in advance

    Read the article

  • Returning an array from an activity

    - by Boardy
    I am currently working on an android project and I want to be able to startActivityForResult so that I can return an array of. The array is an ArrayList<Spanned> lets say its called myArray. From what I've read I can't return an array directly from the activty using the set result so I was thinking that once the array has added all the data to the array, I can then call the toString function on it, i.e. myArray.toString(). If I do this, I have no idea how I can then convert this back into the original ArrayList<Spanned>. Thanks for any help you can provide.

    Read the article

  • PHP sort multidimensional array by value

    - by stef
    How can I sort this array by the value of the "order" key? Even though the values are currently sequential, they will not always be. Array ( [0] => Array ( [hashtag] => a7e87329b5eab8578f4f1098a152d6f4 [title] => Flower [order] => 3 ) [1] => Array ( [hashtag] => b24ce0cd392a5b0b8dedc66c25213594 [title] => Free [order] => 2 ) [2] => Array ( [hashtag] => e7d31fc0602fb2ede144d18cdffd816b [title] => Ready [order] => 1 ) )

    Read the article

  • Data structure name: combination array/linked list

    - by me_and
    I have come up with a data structure that combines some of the advantages of linked lists with some of the advantages of fixed-size arrays. It seems very obvious to me, and so I'd expect someone to have thought of it and named it already. Does anyone know what this is called: Take a small fixed-size array. If the number of elements you want to put in your array is greater than the size of the array, add a new array and whatever pointers you like between the old and the new. Thus you have: Static array ————————————————————————— |1|2|3|4|5|6|7|8|9|a|b|c| ————————————————————————— Linked list ———— ———— ———— ———— ———— |1|*->|2|*->|3|*->|4|*->|5|*->NULL ———— ———— ———— ———— ———— My thing: ———————————— ———————————— |1|2|3|4|5|*->|6|7|8|9|a|*->NULL ———————————— ————————————

    Read the article

  • question on reverse array

    - by davit-datuashvili
    we know algorithm how reverse array of n integers for (int i=0;i<n/2;i++){ swap(a[i],a[n-1-i]): } is this method better according the speed of algorithm or not because swap using xor is more fast then in other method here is code public class swap { public static void main(String[]args){ int a[]=new int[]{2,4,5,7,8,11,13,12,14,24}; System.out.println(" array at the begining:"); for (int i=0;i<a.length;i++){ System.out.println(a[i]); } for (int j=0;j<a.length/2;j++){ a[j]^=a[a.length-1-j]; a[a.length-1-j]^=a[j]; a[j]^=a[a.length-1-j]; } System.out.println("reversed array:"); for (int j=0;j<a.length;j++){ System.out.println(a[j]); } } } Result: array at the begining: 2 4 5 7 8 11 13 12 14 24 reversed array: 24 14 12 13 11 8 7 5 4 2

    Read the article

< Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >