Search Results

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

Page 36/610 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • How to make an mutable C array for this data type?

    - by mystify
    There's this instance variable in my objective-c class: ALuint source; I need to have an mutable array of OpenAL Sources, so in this case probably I need a mutable C-array. But how would I create one? There are many questions regarding that: 1) How to create an mutable C-array? 2) How to add something to that mutable C-array? 3) How to remove something from that mutable C-array? 4) What memory management pitfalls must I be aware of? Must i free() it in my -dealloc method? And yes, I think this is something for the nice community wiki...

    Read the article

  • Make an array of two.

    - by marharépa
    Hello! I'd like to make an array which tells my site's pages where to show in PHP. In $sor["site_id"] i've got two or four chars-lenght strings. example: 23, 42, 13, 1 In my other array (called to $pages_show) i want to give all the site_ids to an other id. $parancs="SELECT * FROM pages ORDER BY id"; $eredmeny=mysql_query($parancs) or die("Hibás SQL:".$parancs); while($sor=mysql_fetch_array($eredmeny)) { $pages[]=array( "id"=>$sor["id"], "name"=>$sor["name"], "title"=>$sor["title"], "description"=>$sor["description"], "keywords"=>$sor["keywords"] ); // this makes my pages array with the information about that page. $shower = explode(", ",$sor["site_id"]); // this is explode my site_id $pages_show[]=array( "id"=>$sor["id"], "where"=>$shower //to 'where' i want to put all the explode's elements one-by-one, to get the result like down ); This script gives me the following result: Array (3) 0 => Array (2) id => "29" where => Array (2) 0 => "17" 1 => "16" 1 => Array (2) id => "30" where => Array (1) 0 => "17" 2 => Array (2) id => "31" where => Array (1) 0 => "17" But in this case I'd like to be this: Array (4) 0 => Array (2) id => "29" where => "17" 1 => Array (2) id => "29" where => "16" 2 => Array (2) id => "30" where => "17" 3 => Array (2) id => "31" where => "17" Thanks for your help.

    Read the article

  • Problems with 3D Array for Voxel Data

    - by Sean M.
    I'm trying to implement a voxel engine in C++ using OpenGL, and I've been working on the rendering of the world. In order to render, I have a 3D array of uint16's that hold that id of the block at the point. I also have a 3D array of uint8's that I am using to store the visibility data for that point, where each bit represents if a face is visible. I have it so the blocks render and all of the proper faces are hidden if needed, but all of the blocks are offset by a power of 2 from where they are stored in the array. So the block at [0][0][0] is rendered at (0, 0, 0), and the block at 11 is rendered at (1, 1, 1), but the block at [2][2][2] is rendered at (4, 4, 4) and the block at [3][3][3] is rendered at (8, 8, 8), and so on and so forth. This is the result of drawing the above situation: I'm still a little new to the more advanced concepts of C++, like triple pointers, which I'm using for the 3D array, so I think the error is somewhere in there. This is the code for creating the arrays: uint16*** _blockData; //Contains a 3D array of uint16s that are the ids of the blocks in the region uint8*** _visibilityData; //Contains a 3D array of bytes that hold the visibility data for the faces //Allocate memory for the world data _blockData = new uint16**[REGION_DIM]; for (int i = 0; i < REGION_DIM; i++) { _blockData[i] = new uint16*[REGION_DIM]; for (int j = 0; j < REGION_DIM; j++) _blockData[i][j] = new uint16[REGION_DIM]; } //Allocate memory for the visibility _visibilityData = new uint8**[REGION_DIM]; for (int i = 0; i < REGION_DIM; i++) { _visibilityData[i] = new uint8*[REGION_DIM]; for (int j = 0; j < REGION_DIM; j++) _visibilityData[i][j] = new uint8[REGION_DIM]; } Here is the code used to create the block mesh for the region: //Check if the positive x face is visible, this happens for every face //Block::VERT_X_POS is just an array of non-transformed cube verts for one face //These checks are in a triple loop, which goes over every place in the array if (_visibilityData[x][y][z] & 0x01 > 0) { _vertexData->AddData(&(translateVertices(Block::VERT_X_POS, x, y, z)[0]), sizeof(Block::VERT_X_POS)); } //This is a seperate method, not in the loop glm::vec3* translateVertices(const glm::vec3 data[], uint16 x, uint16 y, uint16 z) { glm::vec3* copy = new glm::vec3[6]; memcpy(&copy, &data, sizeof(data)); for(int i = 0; i < 6; i++) copy[i] += glm::vec3(x, -y, z); //Make +y go down instead return copy; } I cannot see where the blocks may be getting offset by more than they should be, and certainly not why the offsets are a power of 2. Any help is greatly appreciated. Thanks.

    Read the article

  • php getting unique values of a multidimensional array

    - by Mark
    I have an array like this: $a = array ( 0 => array ( 'value' => 'America', ), 1 => array ( 'value' => 'England', ), 2 => array ( 'value' => 'Australia', ), 3 => array ( 'value' => 'America', ), 4 => array ( 'value' => 'England', ), 5 => array ( 'value' => 'Canada', ), ) How can I remove the duplicate values so that I get this: $a = array ( 0 => array ( 'value' => 'America', ), 1 => array ( 'value' => 'England', ), 2 => array ( 'value' => 'Australia', ), 4 => array ( 'value' => 'Canada', ), ) I tried using array_unique, but that doesn't work due to this array being multidimensional, I think. Thanks!

    Read the article

  • Exception.Data population bug?

    - by Christopher
    Okay, .NET geniuses, here's the relevant part of my code: adapter.Fill(table); return; } catch(Exception ex) { SqlException sqlEx = ex as SqlException; I have an exception that's being thrown by adapter.Fill(), and when I put a breakpoint on the first line in the exception handler, the Exception.Data property already contains a key that is unique to my application. The thing is that it does not happen every time, but only when this exception is thrown within ~2 seconds of it last being thrown. Explain that!! :) Thanks!

    Read the article

  • wsdl return an array of complex types

    - by Anand
    hi, I have defined a web service that will return the data from my mysql data base. I have written the web service in php. Now I have defined a complex type as follows: $server->wsdl->addComplexType( 'Category', 'complexType', 'struct', 'all', '', array( 'category_parent_id' => array('name' => 'category_parent_id', 'type' => 'xsd:int'), 'category_child_id' => array('name' => 'category_child_id', 'type' => 'xsd:int'), 'category_list' => array('name' => 'category_list', 'type' => 'xsd:int') ) ); The above complex type is a row in a table in my database. Now my function must send an array of these rows so how do I achieve the same My code is as follows: require_once('./nusoap/nusoap.php'); $server = new soap_server; $server-configureWSDL('productwsdl', 'urn:productwsdl'); // Register the data structures used by the service $server-wsdl-addComplexType( 'Category', 'complexType', 'struct', 'all', '', array( 'category_parent_id' = array('name' = 'category_parent_id', 'type' = 'xsd:int'), 'category_child_id' = array('name' = 'category_child_id', 'type' = 'xsd:int'), 'category_list' = array('name' = 'category_list', 'type' = 'xsd:int') ) ); $server-register('getaproduct', // method name array(), // input parameters //array('return' = array('result' = 'tns:Category')), // output parameters array('return' = 'tns:Category'), // output parameters 'urn:productwsdl', // namespace 'urn:productwsdl#getaproduct', // soapaction 'rpc', // style 'encoded', // use 'Get the product categories' // documentation ); function getaproduct() { $conn = mysql_connect('localhost','root',''); mysql_select_db('sssl', $conn); $sql = "SELECT * FROM jos_vm_category_xref"; $q = mysql_query($sql); while($r = mysql_fetch_array($q)) { $items[] = array('category_parent_id'=$r['category_parent_id'], 'category_child_id'=$r['category_child_id'], 'category_list'=$r['category_list']); } return $items; } // Use the request to (try to) invoke the service $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server-service($HTTP_RAW_POST_DATA);

    Read the article

  • perl array of array of hashes sorting

    - by srk
    @aoaoh; $aoaoh[0][0]{21} = 31; $aoaoh[0][0]{22} = 31; $aoaoh[0][0]{23} = 17; for $k(0.. $#aoaoh) { for $i(0.. $#aoaoh) { for $val (keys %{$aoaoh[$i][$k]}) { print "$val=$aoaoh[$i][$k]{$val}"; print "\n"; }} } output is 22=31 21=31 23=17 but i expect it to be 21=31 22=31 23=17 Please tell me where is this wrong.. Also how do i sort the values so that i get the output as 23=17 22=31 21=31 (if 2 keys have same value then key with higher value come first)

    Read the article

  • Nested form using accepts_nested_attributes_for with pre-population from another table

    - by mikeydelamonde
    I'm using Rails 2.3.5 and have a nested structure as follows: Lists has_many Items Items_Features has_many Features Items_Features has_many Items Items_Features has a text field to hold the value of the feature Then I have a nested form with partials to update and display this so that it updates Lists, Items and Items_Features What I want to do is generate input fields for each of the rows in features so that the user can fill in a value and it gets inserted/updated in items_features. I also want a label next to the box to display the feature name. It might look like this: List name: Cheeses Item1 name: Edam Feature, hardness: - fill in - <= this list of features from feature table Feature, smell: - fill in - How can I interrupt the nice and easy accepts_nested_attributes_for system to display this as I want?

    Read the article

  • How to send array by post method

    - by GanChinHock.com
    Following is my sample form. <form METHOD="post" METHOD="post" ACTION="index.php" METHOD="post" METHOD="post" METHOD="post"> <input TYPE="text" NAME="array[]" /> <input TYPE="text" NAME="array[]" /> <input TYPE="text" NAME="array[]" /> <input TYPE="text" NAME="array[]" /> <input TYPE="text" NAME="array[]" /> <input TYPE="text" NAME="array[]" /> <input TYPE="text" NAME="array[]" /> <input TYPE="text" NAME="array[]" /> <input TYPE="text" NAME="array[]" /> <input TYPE="text" NAME="array[]" /> <input TYPE="submit" NAME="submit" VALUE="Submit" /> </form> Basically I have 10 inputs of array. Assume my domain is http://domain.com and the file above is index.php. I am trying to fill the form automatically by using the following method. http://domain.com/index.php?array[]=John&array[]=Kelly ... & array[]=Steven Unfortunately, it is not working. :(

    Read the article

  • jquery array: find elements that appear twice in the array

    - by tsiger
    For a markup like this: <div id="set1"> <div id="100">a div</div> <div id="101">another div</div> <div id="102">another div 2</div> <div id="120">same div</div> </div> <div id="set2"> <div id="105">a different div> <div id="101">another div</div> <div id="110">more divs</div> <div id="120">same div</div> </div> As you can see both #set1 and #set2 contain 2 divs with the same id (101, 120). Is it possible somehow with jQuery to find the common elements and add a class to the divs in #set1 that have the same id with divs in #set2? In other words after the script run the above code would look like this: <div id="set1"> <div id="100">a div</div> <div id="101" class="added">another div</div> <div id="102">another div 2</div> <div id="120" class="added">same div</div> </div> <div id="set2"> <div id="105">a different div> <div id="101">another div</div> <div id="110">more divs</div> <div id="120">same div</div> </div>

    Read the article

  • Dynamic CCK fields population

    - by boogie
    Hi, How can I create two CCK fields where the latter has values based on the first selection? In my case I have a few programs which can be selected and then projects that are related to programs. I need to have two separate fields for them. Example: Programs: Program1 Program2 Projects: Project1 (related to Program1) Project2 (related to Program2) Project3 (related to Program2) If program "Program1" is selected, then the user should only be able to select "Project1" and in case of "Program2" is selected, the options should be "Project2" or "Project3". I'm using Drupal 6.20 and I've already tried using Conditional Fields and Computed Fields modules, but they don't really solve my problem. Any help is much appreciated!

    Read the article

  • Reporting. MS Word templates population required

    - by Andrew Florko
    Application we developed fills MS Word templates with data from Database. Customers require to have ability edit Word templates via MS Word (change style, font, layout e.t.c) with no additional software to be installed and no training. AFAIK, Sql Reporting Services and Crystal Reports can't populate MS Word templates produced in MS Word. So we implemented our custom solution that maps .net classes onto xml-saved MS Word documents. It looks like we declare class MyTemplate { // maps to [age] field declared in ms document straight in the text int Age { get; set; } // maps to table by attributes applied to property (omitted) List<Person> Persons { get; set; } } We also implemented images insertion. Are there any free libraries for this task or may be you use your own MS-word templators in your projects?

    Read the article

  • HP p410i array controller - what happens if i add memory?

    - by James
    I have a p410i array controller that only has 256ram. We want to create a raid 5 so we have procured a 512 write back cache module. If we install the write back cache, will this erase the existing raid information. The server currently has 2 disks in raid 1. 6 are spare waiting for an upgrade to create a raid 5. the concern is if we replace/upgrade the memory for the controller, we will wipe the existing production raid 1 array. Thanks in advance.

    Read the article

  • CodeIgniter Form Validaton + JS. Form re-population.

    - by solefald
    Hello. I have a from with a checkbox, and depending on the checkbox state 2 different divs are shown. var alias = document.getElementById('alias'); var list = document.getElementById('list'); if(document.getElementById('isList').checked) { alias.style.display = 'none'; list.style.display = 'table-row'; } else { alias.style.display = 'table-row'; list.style.display = 'none'; } Here is the HTML/PHP (relevant) part: <tr id="alias" style="display:table-row;"> <td>' . form_label('Destination:', 'destination') . '</td> <td>' . form_textarea('destination') . '</td> </tr> <tr id="list" style="display:none;"> <td>' . form_label('File Path:', 'list_path') . '</td> <td>' . form_input('list_path') . '</td> </tr> alias div is shown by default on page load, list shown then i click on isList checkbox, and alias is shown again when i click on the checkbox again. This part works great and pretty straight froward. Now, I add CodeIgniter Form Validation plugin, set appropriate rules and set-up validation plugin to re-populate the form with. Without checkbox enabled everything works great. On errors form is re-populated. However, when form is submitted with checkbox enabled, I have an issue. CI's Form Validation plugin re-populates the form, and re-enables the checkbox, but the list div that is supposed to be shown when checkbox enabled is not there, and instead the alias div is shown. Is there any way around this issue? Can i have the list div shown on list validation error? Also, i would like to avoid using JavaScript form validation, and stick with my good old PHP. Thank you in advance. -i

    Read the article

  • Combobox population problem

    - by Luke
    So I have a combobox - the designer code: this.cmbStatusBox.Items.AddRange(new object[] { "Ordered", "Cooking", "In-transit", "Delivered"}); The formload code: if (mainForm.boolEdit == true) { this.cmbStatusBox.Items.AddRange(new object[] { "Cooking", "In-transit", "Delivered"}); } else { this.cmbStatusBox.Items.AddRange(new object[] { "Ordered"}); } As you can see, I am trying to make the combobox have different values. As things stand, i get both whats in the designer and in formload in the comboboxes. How can i stop this? I also have an edit function, so when i edit a record, i want the combo box to be populated by what is already saved. Just a random question, can you stop the user entering a value that isn't in the combo box? Thankyou

    Read the article

  • application specific seed data population

    - by user339108
    Env: JBoss, (h2, MySQl, postgres), JPA, Hibernate 3.3.x @Id @GeneratedValue(strategy = IDENTITY) private Integer key; Currently our primary keys are created using the above annotation. We expect to support a large number of users (~million users), what key should be used. Should it be Integer or Long or should I use the unsigned versions of the above declarations. We have a j2ee application which needs to be populated with some seed data on installation. On purchase, the customer creates his own data on top of the application. We just want to make sure that there is enough room to ship, modify or add data for future releases. What would be the best mechanism to support this, we had looked at starting all table identifiers from a certain id (say 1000) but this mandates modifying primary key generation to have table or sequence based generators and we have around ~100 tables. We are not sure if this is the right strategy for this. If we use a signed integer approach for the key, would it make sense to have the seed data as everything starting from 0 and below (i.e -ve numbers), so that all customer specific data will be available on 0 and above (i.e. +ve numbers)

    Read the article

  • paypal_adaptive gem in Rails: Dynamic Receiver "Population" (Chained Payments)

    - by Jmlevick
    Note: I didn't find a better title for this O.o Hello, Humm... Look, what I want to do is to have a Rails app where a visitor can click a button/link to make a "special" chained payment using Paypal; Currently I have a Users registration form that has one field for the user to enter his/her paypal account email, and as I saw here: http://marker.to/XGg9MR it is possible to specify the primary reciever and the secondary ones by adding such info in a controller action when using the paypal_adaptive gem in a rails app. The thing is, I don't want to hard code the secondary reciever as I need to specify a different secondary reciever from time to time, (being specific my primary reciever will always be the same, but depending on what button/link the visitor clicks, the secondary one is going to change) and I want that secondary reciever email to be the paypal e-mail account from one of the registered users when the visitor clicks on their specific button/link... My question is: Is it possible to create such enviroment functionality in my app using the current implementation of the paypal_adaptive gem? Could someone point me in the right direction on how to accomplish such thing? I'm still learning rails and also I'm really new in the paypal handling universe with this framework! XD P.S. Thanks! :)

    Read the article

  • Passing an array of an array of char to a function

    - by L.A. Rabida
    In my program, I may need to load a large file, but not always. So I have defined: char** largefilecontents; string fileName="large.txt"; When I need to load the file, the program calles this function: bool isitok=LoadLargeFile(fileName,largefilecontents); And the function is: bool LoadLargeFile(string &filename, char ** &lines) { if (lines) delete [] lines; ifstream largeFile; #ifdef LINUX largeFile.open(filename.c_str()); #endif #ifdef WINDOWS largeFile.open(filename.c_str(),ios::binary); #endif if (!largeFile.is_open()) return false; lines=new char *[10000]; if (!lines) return false; largeFile.clear(); largeFile.seekg(ios::beg); for (int i=0; i>-1; i++) { string line=""; getline(largeFile,line); if (largeFile.tellg()==-1) break; //when end of file is reached, tellg returns -1 lines[i]=new char[line.length()]; lines[i]=const_cast<char*>(line.c_str()); cout << lines[i] << endl; //debug output } return true; } When I view the debug output of this function, "cout << lines[i] << endl;", it is fine. But when I then check this in the main program like this, it is all messed up: for (i=0; i<10000; i++) cout << largefilecontents[i] << endl; So within the function LoadLargeFile(), the results are fine, but without LoadLargeFile(), the results are all messed up. My guess is that the char ** &lines part of the function isn't right, but I do not know what this should be. Could someone help me? Thank you in advance!

    Read the article

  • Put an array of Objects in nodes of another array of Objects [JAVA]

    - by zengr
    public class hello { public static void main(String[] args) { Object[] newarray = new Object[1]; Object[] obj = new Object[2]; obj[0] = "Number1"; //string value obj[1] = "Number2"; //string value newarray[0] = obj; //this works Object[] tmp_obj = new Object[2]; tmp_obj = newarray[0]; //obviously does not work System.out.println(tmp_obj[0]); //nope System.out.println(tmp_obj[1]); //nope } } So, now if I want to access the values "Number1" and "Number2" which are stored in obj[0] and obj[1]; obj is in newarray[0]. what should I do? Is this a possible? Thanks

    Read the article

  • Drop down list population fails after validation fails

    - by sarah
    Hi All, I am polpulating data in drop down reading from request scope,i am doing validaiton of fe w field after submission i wont get data in drop down i am using struts and the corresponding form bean defn is like <action path="/userProcess" name="userForm" type="com.actions.UserManagementAction" parameter="method" input="/views/AddUsers.jsp" scope="request" > <forward name="success" path="/views/User_Management.jsp" /> </action> and the drop down listing is <select name="roleName"> <c:forEach items="${roleNames}" var="role"> <option value="${role}">${role}</option> </c:forEach> </select> how should i handle this ?

    Read the article

  • How to get an array of members of an array

    - by Mystere Man
    Suppose I have a class public class Foo { public Bar { get; set; } } Then I have another class public class Gloop { public List<Foo> Foos { get; set; } } What's the easiest way to get a List of Foo.Bars? I'm using C# 4.0 and can use Linq if that is the best choice. My first thought was something like

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >