Search Results

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

Page 147/610 | < Previous Page | 143 144 145 146 147 148 149 150 151 152 153 154  | Next Page >

  • Representing a very large array of bits in little memory

    - by user614624
    Hello, I would like to represent a structure containing 250 M states(1 bit each) somehow into as less memory as possible (100 k maximum). The operations on it are set/get. I cold not say that it's dense or sparse, it may vary. The language I want to use is C. I looked at other threads here to find something suitable also. A probabilistic structure like Bloom filter for example would not fit because of the possible false answers. Any suggestions please?

    Read the article

  • How to access JSON values(array) in various tables

    - by ramya
    Hi, I am getting results from JSON, NSDictionary *pname=[[res objectAtIndex:i] objectForKey:@"ax21:productName"]; NSString *str = [pname objectForKey:@"$"]; i++; [detArray addObject:str]; [tblviewhome reloadData]; and calling it in table like cell.textLabel.text = [detArray objectAtIndex:indexPath.section]; this displays data in 4 sections.This is displaying data perfectly . JSON connectivity and table are in same class. but how to access this data in another table which is in another view controller. I hope i made my self clear.

    Read the article

  • replace commas with spaces from json array

    - by Alex
    I have a looping function creating: <li id="id1" name="Tag1,Tag2,Tag3"> <li id="id2" name="Tag1,Tag2,Tag3"> $.each(data.posts, function(i, post){ $('<li >', {id: this.id , name: post.tags}) }); How do I replace the commas between the tags with spaces. Also is there a way I can send the tags to a "class" attribute instead of "name". It seems to not work in Safari.

    Read the article

  • javascript replace commas with spaces from json array

    - by Alex
    I have a looping function creating: <li id="id1" name="Tag1,Tag2,Tag3"> <li id="id2" name="Tag1,Tag2,Tag3"> $.each(data.posts, function(i, post){ $('<li >', {id: this.id , name: post.tags}) }); How do I replace the commas between the tags with spaces. Also is there a way I can send the tags to a "class" attribute instead of "name". It seems to not work in Safari.

    Read the article

  • Dynamically created jagged "rectangle" array

    - by gagar1n
    In my project I have a lot of code like this: int[][] a = new int[firstDimension][]; for (int i=0; i<firstDimension; i++) { a[i] = new int[secondDimension]; } Types of elements are different. Is there any way of writing a method like createArray(typeof(int), firstDimension, secondDimension); and getting new int[firstDimension][secondDimension]? Once again, type of elements is known only at runtime.

    Read the article

  • C# : Attachment from byte array?

    - by JL
    I have a byte[] which is a file, and I would like to send it as an attachment using System.Net.Mail. I noticed the attachment class has 1 overload which accepts a stream. Attachment att = new Attachment(Stream contentStream,string name); Is it possible to pass the byte[] through this overload?

    Read the article

  • jQuery: Getting value from input array

    - by betacar
    We have the following form: <form> ... <table width="100%" cellspacing="0" class="datagrid_ppal"> <tbody> <tr> <th scope="row">Area 1 <input name="config_line" type="hidden" value="0,5,50" /></th> <td class="gantt"> </td> <td class="gantt"> </td> <td class="gantt"> </td> ... </tr> </tbody> </table width="100%" cellspacing="0" class="datagrid_ppal"> ... <form> What we need is to get the first, second or third from the hidden input value. We have tried this and didn't work: var value = $('th').children('input:hidden').val(); Can anyone help us? We would really appreciate it.

    Read the article

  • PHP Count the lenght of each value in a array/string (tags)

    - by 2by
    Users writing an article have the option to write some tags, tags are written like this: tag1, tag2, tag3 So tags are stored like: $tags = "tag1, tag2, tag3"; I want to make sure, every tag has a minimum of 3 characters, so i need to validate the tags. I have tried this: $tagsstring = explode(",", $tags); $tagslength = array_map('strlen', $tagsstring); if (min($tagslength) < 3) { echo "Error... Each tag has to be at least 3 characters."; } It seems to work, sometimes... But of you write: tag1, df It wont give an error. Any suggestions?

    Read the article

  • Array Indexing Properties of A Class

    - by Chris
    I have a class that has several properties: class Person { string Name; int Age; DateTime BirthDate; } Then I have a sort of wrapper class with a List<Person>. Within this wrapper class I want to be able to do something like Wrapper["Name"] that returns a new List<string> using .Select(x=>x.Name). How do I create a wrapper class around an IEnumerable that supports mapping a string to the Property name? Something like the pseudo code below, but obviously it doesn't work. I'm 99.9% sure the solution will have to use Reflection and thats fine. class Wrapper { List<Person> PersonList; List<dynamic> this[string Column] { return PersonList.Select(x => x.[Column]).ToList(); } } This may not seem like a good design, but its a fix to eventually enable the correct design from .NET 2.0 days. As I have it right now, the data is stored in Columns, so there is actually a List of Lists within my class right now. Using the above example there would be three ILists (with a string Title) Name, Age, and Birthdate. Everything is currently predicated on addressing the columns by their "string" name. I'm trying to convert the data structure to row based with an IEnumberable interface to allow Linq eventually while still maintaining the functionality of my current code. Is converting the code to a Row based IEnumberable a good idea?

    Read the article

  • Is the following array really multidimensional?

    - by flockofcode
    Book I’ learning from claims that intArray has two dimensions. But since calling intArray.GetLength(1) will result in an IndexoutOfRange exception, couldn’t we claim that unlike rectangular arrays, intArray isn’t really multidimensional and thus has only one dimension? int[][] intArray=new int[3][]; thank you

    Read the article

  • how to use static function in header and compare with float array

    - by ed k
    I wrote this function: static bool colorIsEmpty(const Color col) { return (col[0] == 0 && col[1] == 0 && col[2] == 0 ); } where Color is simply a float[3]; the function doesn't work if col[3] are all 0; but this works: if(col[0] == col[1] == col[2] == 0) { //gets called } however gcc gives me warning: cColorTest.c:212:5: warning: suggest parentheses around comparison in operand of ‘==’ [-Wparentheses] so it would be nice if that function works,why it doesn't work?

    Read the article

  • Update int array based on parent

    - by Pickels
    I have the following int[] in my database: '{0}' '{0,0}' '{0,0,0}' '{0,0,0,0}' This column is used to sort my tree data. Now when a parent updates it's order the children should also update. For example if the second record updates it's order to 1 it should result in the following. '{0}' '{0,1}' '{0,1,0}' '{0,1,0,0}' So I was wondering what the query would be to update record 3 and 4. In case it's not clear what I am asking leave a comment I can add additional information. Screenshot of my actual data:

    Read the article

  • Flexible array member in C-structure

    - by Arpan
    Quoting from the C-std section 6.7.2.1, struct s { int n; double d[]; }; This is a valid structure declaration. I am looking for some practical use of this kind of syntax. To be precise, how is this construct any more or less powerful than keeping a double* as the 2nd element? Or is this another case of 'you-can-do-it-in-multiple-ways'? Arpan

    Read the article

  • Converting keys of an array/object-tree to lowercase

    - by tstenner
    Im currently optimizing a PHP application and found one function being called around 10-20k times, so I'd thought I'd start optimization there. function keysToLower($obj) { if(!is_object($obj) && !is_array($obj)) return $obj; foreach($obj as $key=>$element) { $element=keysToLower($element); if(is_object($obj)) { $obj->{strtolower($key)}=$element; if(!ctype_lower($key)) unset($obj->{$key}); } else if(is_array($obj) && ctype_upper($key)) { $obj[strtolower($key)]=$element; unset($obj[$key]); } } return $obj; } Most of the time is spent in recursive calls (which are quite slow in PHP), but I don't see any way to convert it to a loop. What would you do?

    Read the article

  • Array of datas returning issue, Overwriting

    - by sijith
    Hi, Please help me on this Here i want to save the converted data into new pointers. But everytime the data is overwriting with most recent data. Please check my code TCHAR nameBuffer[256]; //Globally Declared void Caller() { TCHAR* ptszSecondInFile= QStringToTCharBuffer(userName); TCHAR* ptszOutFile=QStringToTCharBuffer(Destinationfilename); } TCHAR *dllmerge::QStringToTCharBuffer( QString buffer ) { memset(nameBuffer, 0, sizeof(nameBuffer)); #if UNICODE _tcscpy_s(nameBuffer, _countof(nameBuffer), buffer.toUtf8()); #else _tcscpy_s(nameBuffer, _countof(nameBuffer), buffer.toLocal8Bit()); #endif _tprintf( _T( "nameBuffer %s\n" ), nameBuffer ); return nameBuffer; } I am gettting ptszSecondInFile and ptszOutFile both same answer. Is it possible to do with TCHAR* nameBuffer[256];

    Read the article

  • How to do elif statments more elegantly if appending to array in python

    - by user1741339
    I am trying to do a more elegant version of this code. This just basically appends a string to categorynumber depending on the number. Would appreciate any help. number = [100,150,200,500] categoryNumber = [] for i in range (0,len(number)): if (number [i] >=1000): categoryNumber.append('number > 1000') elif (number [i] >=200): categoryNumber.append('200 < number < 300') elif (number [i] >=100): categoryNumber.append('100 < number < 200') elif (number [i] >=50): categoryNumber.append('50 < number < 100') elif (number [i] < 50): categoryNumber.append('number < 50') for i in range(0,len(categoryNumber)): print i

    Read the article

  • input tags with array

    - by Dumbledore of flash
    Hi , Recently i am doing a project in which i encountered a strange problem this is the program which previous programmer did MPAN <input name="mpan[]" id="mpan[]" value="" maxlength="2" size="2" > ///this one to read <input name="mpan[]" id="mpan[]" value="" maxlength="3" size="3"> <input name="mpan[]" id="mpan[]" value="" maxlength="3" size="3"> <input name="mpan[]" id="mpan[]" value="" maxlength="2" size="2"> ///this one to read <input name="mpan[]" id="mpan[]" value="" maxlength="11" size="12"> i have to read it from a javascript what i did 1) document.getElementById("mpan").value == not reading script does not work 2) document.getElementById("mpan[]").value == reading first one 3) document.getElementById("mpan[0]").value == script does not work 4) document.getElementById("mpan[3]").value == script does not work can any body tell me how to read this from a javascript program

    Read the article

  • typedef fixed length array

    - by Rajorshi
    Hi, I have to define a 24-bit data type.I am using char[3] to represent the type. Can I typedef char[3] to type24? I tried it in a code sample. I put typedef char[3] type42; in my header file. The compiler did not complain about it. But when I defined a function void foo(type24 val) {} in my C file, it did complain. I would like to be able to define functions like type24_to_int32(type24 val) instead of type24_to_int32(char value[3]).

    Read the article

  • problem with jQuery array being a newBie.

    - by user236106
    <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script> <script type="text/jscript"> $('document').ready(function (){ var clickNo=0; $('div#pics>img').hide() $('div#pics>input').click(function(event){ $('div#pics>img')[0].show('slow'); }) }); </script> </head> <body> <div id="pics"> <input type="button" value="next" /> <--a bunch of img tags .I had to resort to this comment because the system won't let me include the img tag in the code--> </div> </body> </html> I can't understand why the line $('div#picsimg')[0].show('slow'); is not working ?

    Read the article

  • Interview question: C program to sort a binary array in O(n)

    - by Zacky112
    I've comeup with the following program to do it, but it does not seem to work and goes into infinite loop. Its working is similar to quicksort. int main() { int arr[] = {1,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1}; int N = 18; int *front, *last; front = arr; last = arr + N; while(front <= last) { while( (front < last) && (*front == 0) ) front++; while( (front < last) && (*last == 1) ) last--; if( front < last) { int temp = *front; *front = *last; *last = temp; front ++; last--; } } for(int i=0;i<N;i++) printf("%d ",arr[i]); return 0; }

    Read the article

  • Looking for an array (vs linked list) hashtable implementation in C

    - by kingusiu
    hi, I'm looking for a hashtable implementation in C that stores its objects in (twodimensional) arrays rather than linked lists. i.e. if a collision happens, the object that is causing the collision will be stored in the next free row index rather than pushed to the head and first element of a linked list. plus, the objects themselves must be copied to the hashtable, rather than referenced by pointers. (the objects do not live for the whole lifetime of the program but the table does). I know that such an implementation might have serious efficiency drawbacks and is not the "standard way of hashing" but as I work on a very special system-architecture i need those characteristics. thanks

    Read the article

  • C++ sort array of char pointes

    - by user69514
    Can you tell me what's wrong with my method? I ends up putting the same thing everywhre and it's actually not sorting. void sortArrays(){ int i, j; for(i=0; i<counter; i++){ for( j=0; j<i; j++){ if( strcmp(title_arr[i], title_arr[j]) < 0){ char* title_temp = title_arr[i]; title_arr[j] = title_temp; } } }

    Read the article

< Previous Page | 143 144 145 146 147 148 149 150 151 152 153 154  | Next Page >