php shift in a hierarchy array
Hello. I have the next array: Array( [id] => 1 [children] => Array( [2] => Array( [id] => 2 [inactive] => true [children] => Array( [4] => Array( [id] => 4 [children] => Array() ) ) ) [3] => array( [id] => 3 ...
Hello. I have the next array: Array( [id] => 1 [children] => Array( [2] => Array( [id] => 2 [inactive] => true [children] => Array( [4] => Array( [id] => 4 [children] => Array() ) ) ) [3] => array( [id] => 3 ...
#include <stdio.h> #include <stdlib.h> int main() { int *numeros = malloc(sizeof(int) * 3 * 3); numeros[900] = 10; printf("%d", numeros[900]); free(numeros); return 0; } Why exactly this prints out 10 when I haven't allocated enough memory? I'm pretty sure I'm missing something big on pointers/etc. Thanks for help...
Hello. I made a structure like so: struct ponto { int x; int y; int z; }; 1) Can I initialize the int's with a default value? int var = value; doesn't seem to work, compiler says "syntax error before '=' token" or something of sorts. 2) I need to work with several of these like in a array of structures, but I only know ho...
How would I auto generate an array (in PHP) for AA - ZZ and so on like AAA - ZZZ $column_arr2= range("aa", "zz"); // NOT Working $row_arr = range(0,1000); $column_arr = range("a", "z"); echo "Column2<pre>".print_r($column_arr2, true)."</pre><br />"; // prints a - z echo "Row<pre>".print_r($row_arr, true)."</pre><br />"; echo "Column...
hello, can anyone tell me the error in this java declaration String[][] t=new String[15][15]; this works fine and if i use String[][] t=new String[][]; because i need to declare the variable t as dynamic as i am not sure how much values i am going to store in t. ...
I am looking at trying to place a hover() method onto each array element. Then when the cursor rolls over the character, it is copied into another div. I am kinda lost. Do you have suggestions? <html> <head> <script type="text/javascript" scr="http://code.jquery.com/jquery.min.js"> </head> <body> <script type="text/javascript"> ...
I have this array in PHP array(5) { ["mai_id"] => string(1) "3" ["mai_logo"] => string(0) "" ["mai_title"] => string(16) "Vitrine Cultural" ["mai_description"] => NULL ["mai_description2"] => NULL } And I'd like to remove ["mai_description"] and get only array(5) { ["mai_id"] => string(1) "3" ["mai_logo"] => string(0) ...
Hi all, Im trying to put the contents of a simple command in to a bash array however im having a bit of trouble. df -h | awk '{ print $5" "$6 }' gives percentage used in the file systems on my system output looks like this: 1% /dev 1% /dev/shm 1% /var/run 0% /var/lock 22% /boot 22% /home 22% /home/steve I would then like to put ea...
please help me, my problem is: in one .txt file i have rpgoCPpref = { ["enabled"] = true, ["button"] = true, ["debug"] = false, ["questsfull"] = false, ["tooltipshtml"] = true, ["tooltip"] = true, ["verbose"] = false, ["scan"] = { ["inventory"] = true, ["talents"] = true, ["glyphs"] = true, ["honor"] = true, ["reputat...
Bit of background for those who don't know DirectX. A vertex is not just an XYZ position, it can have other data in it as well. DirectX uses a system known as Flexible Vertex Format, FVF, to let you define what format you want your vertexs to be in. You define these by passing a number to DirectX that use bitwise or to build it up, eg (D...
I'll try and explain this the best I can. I have an array called $linkSets, and it has array entires that look like: <string>,<integer> <string>,<integer> <string>,<integer> I also have a priority list, that goes in this order: 22 -> 18 -> 35 -> 34. I would like to check each integer in the $linkSets array, and get the best <string> ...
I am attempting to shuffle an array, but the way I am doing it only works about every fifth time. I would greatly appreciate if someone could explain why it is not working properly and perhaps propose a tweak. private Button[] scrambleBoard(Button[] buttons) { for (int x = 100 * buttons.Count(); x > 0; x--) { Random rand...
is there an algorithm that is faster than binary search, for searching in sorted values of array? in my case, I have a sorted values (could be any type values) in an A array, I need to return n if the value I was looking is in range of A[n] and A[n+1] ...
I'll start with the code: var s = ["hi"]; console.log(s); s[0] = "bye"; console.log(s); Simple, right? In response to this, Firebug says: ["hi"] ["bye"] Wonderful, but Chrome's JavaScript console (7.0.517.41 beta) says: ["bye"] ["bye"] Have I done something wrong, or is Chrome's JavaScript console being exceptionally lazy about...
I am trying to serialize a class that contains a List of other objects. I am using the json.net library. I am serializing as follows: return Newtonsoft.Json.JsonConvert.SerializeObject(businessObject, Newtonsoft.Json.Formatting.None); The json that is produced does serialize ok, but the List does not seem to be serialized as a json ...
C++03 §4.2 N°1: An lvalue or rvalue of type “array of N T” or “array of unknown bound of T” can be converted to an rvalue of type “pointer to T.” The result is a pointer to the first element of the array. What has been confusing in this statement for a long time for me was that I didn't quite understand what an rvalue of array type woul...
Hi, I am making game of life in 2D array. I need to determine when all adjacent cells are empty so I just test all of them. It works well unless the cell being checked is the boundary. Then of course testing X+1 throws an exception as the index is out of the array boundaries. Can I handle this somehow instead of handling the exception? T...
Hello, So the thing is that i'm new to OOP php and i seems can't find answer to how to retrieve specific value from Object array. So i run my request to the User class and method find_by_sql: $getAct = User::find_by_sql($sql); Response i get is: Array ( [0] => User Object ( [id] => 6 [permissions...
I have 3 code snippets: (1) x = array([[]]) #x.ndim=2 x=append(x,[[1,2]]) #after this, x.ndim=1??????????????????? x=append(x,[[3,4]],axis=0) #error b/c dimension (2) x = array([[]]) #x.ndim=2 x=append(x,[[1,2]],axis=0) #error b/c dimension????????????????? (3) x=append([[1,2]],[[3,4]],axis=0) #Good The (???????????) i...
Hi, I have a mongodb object as follows: array ( '_id' => new MongoId("4cc97fb0247ae8747ec5fefb"), 'posts' => array ( 0 => array ( 'comment' => 'Eamorr', 'fromUname' => 'Eamorr', 'time' => 1288273840, 'UTC' => '2010-10-28T14:50:40+01:00', 'ip' => '127.0.0.1', 'id' => '123lasdfiqwoei28a...