Search Results

Search found 15255 results on 611 pages for 'sparse array'.

Page 21/611 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • [PHP Array] - Sorting data and print out in alphabetic order

    - by kwokwai
    Hi all, I got an array which contains some data like this: $arrs = Array("ABC_efg", "@@zzAG", "@$abc", "ABC_abc") I was trying to print the data out in this way (Printing in alphabetic order): [String begins with character A] ABC_abc ABC_efg [String begins with character other than A to Z] @$abc @@zzAG I don't know how to do it.

    Read the article

  • using an array in a custom formula in crystal reports xi

    - by Kim Sharpe
    I have a formula which is working; the formula uses an array. I tried to extract the formula to create a custom formula but now get an error in the syntax. I am wondering if the array is causing the problem as the error is on the line: last_element_current:=val(sc_array[1]) + 1; and the error is: the ) is missing and highlights the variable sc_array before the index [1].

    Read the article

  • function with array variable

    - by mtokoly
    How do I pass an array through a function, for example: $data = array( 'color' => 'red', 'height' => 'tall' ); something($data); function something($data) { if ($data['color'] == 'red') { // do something } } how can I get the function to recognize $data[color] and $data[height]?

    Read the article

  • Array split by range?

    - by acidzombie24
    I have an array, i don't know the length but i do know it will be =48bytes. The first 48bytes are the header and i need to split the header into two. Whats the easiest way? I am hoping something as simple as header.split(32); would work ([0] is 32 bytes [1] being 16 assuming header is an array of 48bytes) using .NET

    Read the article

  • Simple PHP Array Problem - IF EXIT

    - by elmas
    Hi, how can i convert this into an array? if someone searches for "lo" he gets the text "no query", but how can i do this for more words? i tried it with array('1','2').. if ($query == 'lo') { exit ('No Query.'); } i want something like this if ($query == 'lo', 'mip', 'get') { exit ('No Query.'); } so, if someone types mip he gets the message.. thank you!!

    Read the article

  • C++ array initialization without assignment

    - by david
    This question is related to the post here. Is it possible to initialize an array without assigning it? For example, class foo's constructor wants an array of size 3, so I want to call foo( { 0, 0, 0 } ). I've tried this, and it does not work. I'd like to be able to initialize objects of type foo in other objects' constructor initialization lists. Is this possible?

    Read the article

  • Parsing returned array in javascript

    - by Dan
    I'm making a call to PayPal's credit card processor, and after a successful/unsuccessful transaction it returns me a string that looks like this: DoDirectPayment failed: Array ( [TIMESTAMP] = 2010%2d05%2d02T23%3a33%3a28Z [CORRELATIONID] = 8c503f5c6c861 [ACK] = Failure [VERSION] = 51%2e0 [BUILD] = 1268624 [L_ERRORCODE0] = 10527 [L_SHORTMESSAGE0] = Invalid%20Data [L_LONGMESSAGE0] = This%20transaction%20cannot%20be%20processed%2e%20Please%20enter%20a%20valid%20credit%20card%20number%20and%20type%2e [L_SEVERITYCODE0] = Error [AMT] = 90%2e00 [CURRENCYCODE] = USD ) I'm not a javascript pro, but how exactly can I turn that into a parseable array? Thank you!

    Read the article

  • Perl, convert hash to array

    - by Mike
    If I have a hash in Perl that contains complete and sequential integer mappings (ie, all keys from from 0 to n are mapped to something), is there a means of converting this to an Array? I know I could iterate over the key/value pairs and place them into a new array, but something tells me there should be a built-in means of doing this.

    Read the article

  • number of elements in a static array of a predefined size

    - by cppb
    I have an array like this: int a[100]; I am filling only the first 4 elements in this array: a[0] = 1; a[1] = 2; a[2] = 3; a[3] = 4; When I do sizeof(a)/sizeof(a[0]) it returns 100. Is there a way I can get number of elements to which I have assinged a value and thus filtering out the remaining 96 unassigned elements? thanks

    Read the article

  • creating and returning an array from a method

    - by Troy
    howdy, i currently have a method that checks what is around the centre item in a 3x3 grid, if what is in the 8 adjacent positions is containing what i am checking for i want to mark that square on an array with length 7 as being 1. to do this i need to create and return an array in my method, is it possible to do this?

    Read the article

  • How can I sort an array, yet exclude certain elements (to be kept at the same position in the array)

    - by calumbrodie
    This will be implemented in Javascript (jQuery) but I suppose the method could be used in any language. I have an array of items and I need to perform a sort. However there are some items in the array that have to be kept in the same position (same index). The array in question is build from a list of <li> elements and I'm using .data() values attached to the list item as the value on which to sort. What approach would be best here? <ul id="fruit"> <li class="stay">bananas</li> <li>oranges</li> <li>pears</li> <li>apples</li> <li class="stay">grapes</li> <li>pineapples</li> </ul> <script type="text/javascript"> var sugarcontent = new Array('32','21','11','45','8','99'); $('#fruit li').each(function(i,e){ $(this).data(sugarcontent[i]); }) </script> I want the list sorted with the following result... <ul id="fruit"> <li class="stay">bananas</li> <!-- score = 32 --> <li>pineapples</li> <!-- score = 99 --> <li>apples</li> <!-- score = 45 --> <li>oranges</li> <!-- score = 21 --> <li class="stay">grapes</li> <!-- score = 8 --> <li>pears</li> <!-- score = 11 --> </ul> Thanks!

    Read the article

  • add array element to row returned from sql query

    - by bert
    I want to add an additional value into an array before passing it to json_encode function, but I can't get the syntax right. $result = db_query($query); // $row is a database query result resource while ($row = db_fetch_object($result)) { $stack[] = $row; // I am trying to 'inject' array element here $stack[]['x'] = "test"; } echo json_encode($stack);

    Read the article

  • How to replace {tag_INDEX} with array[INDEX] element

    - by ekapek
    Hi, I have string like this; "String {tag_0} text {tag_2} and {tag_1}" Now i need to replace all {tag_INDEX} with elements from array $myArray = array('a','b','c'); so after replacement it should looks like: "String a text c and b" What is the best way to do this? I'm trying with preg_replace and preg_replace_callback but without any good results

    Read the article

  • PHP Array in MySQL IN() function?

    - by Trez
    Is it possible to assign php array in MySQL IN() function? for example, $numbers = array('8001254656','8886953265','88864357445','80021536245'); $sql = mysql_query("SELECT * FROM `number_table` WHERE `number` IN ($numbers)"); Any Ideas? Thanks,

    Read the article

  • How to build array of 'bad' values

    - by JM4
    I am processing a form and in turn, receiving a response code based on the information submitted. I have a list of approximately 40 response codes (and their meaning) in my hands and am trying to build an 'if' statement that checks against a predefined array and returns a specific value. Just not sure how to do this First pass conceptually: $bads = array (1,2,3,4,5,6) if ($output['responsecode'] == (any value in $bads) { echo "you suck"; }

    Read the article

  • Reading data file into an array C#

    - by Whitey
    I have an array like this: int[,] iMap = new int[iMapHeight, iMapWidth] { { 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, }; And I want the same thing coming from a data file. The file should be structured like this preferably: 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 Which will ultimately make an array like above with all values set to 0. What would be the best way to do this? Would I read one line from the file and then split each characters separately and transfer it to the new array? Or perhaps read a line, and then read each character and put that in the array? Thanks for any help.

    Read the article

  • C++ pointer to different array

    - by begun
    Assume I have an array a and an array b. Both have the same type and size but different values. Now I create 3 or so pointers that point to different elements in a, you could say a[ 0 ], a[ 4 ] and a[ 13 ]. Now if I overwrite a with b via a=b - Where will the pointers point? Do the pointers still point to their original positions in a but the values they point to are now those of b?

    Read the article

  • C/C++ efficient bit array

    - by aaa
    hi. Can you recommend efficient/clean way to manipulate arbitrary length bit array? right now I am using regular int/char bitmask, but those are not very clean when array length is greater than datatype length. std vector<bool> is not available for me. thanks

    Read the article

  • check that int array contains !=0 value using lambda

    - by netmajor
    hey, I have two-dimension array List<List<int>> boardArray How can I enumerate throw this array to check that it contains other value than 0 ? I think about boardArray.Contains and ForEach ,cause it return bool value but I don't have too much experience with lambda expression :/ Please help :)

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >