If I choose lots of files tactics,
then I become to have directory
traversal security problem?
I need to write login system,
and lots of file tactics means
make lots of id files and use
scandir.
so the directory would have
aaa.txt (contents is aaa_pass)
bbb.txt (contents is bbb_pass)
ccc.txt (contents is ccc_pass)
and when some...
Hey, I've implemented a tree in a mysql table using:
http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
This is the method where you have a table like:
+-------------+----------------------+-----+-----+
| category_id | name | lft | rgt |
+-------------+----------------------+-----+-----+
| 1 ...
I have split a large text file into a number of sets of smaller ones for performance testing that i'm doing. There are a number of directories like this:
/home/brianly/output-02 (contains 2 files myfile.chunk.00 and myfile.chunk.01)
/home/brianly/output-04 (contains 4 files...)
/home/brianly/output-06 (contains 6 files...)
It's import...
If i had a function like this...
void myfunction(node* root)
{
for(int i = 0; i<root->children.size();i++)
{
myfunction(root->children[i]);
}
}
granted thats just the part of the function I have a question on, but would that be n^2 or just n, for big O? I guess the question is if you have a for loop and inside that for...
Consider the situation where you have two lists of nodes of which all you know is that one is a representation of a preorder traversal of some tree and the other a representation of a postorder traversal of the same tree.
I believe it is possible to reconstruct the tree exactly from these two lists, and I think I have an algorithm to d...
I'm trying to implement dynamic reloading objects in Python, that reflect code changes live.
Modules reloading is working, but I have to recreate every instance of the modules' classes for changes to become effective.
The problem is that objects data (objects __dict__ content) is lost during the process.
So I tried another approach:
...
I'm looking for an elegant Python program that does a BFS traveral of a DAG:
Node A is connected to B (A->B) if A "depends on" B (think of python package Foo "depending upon" Bar: Foo->Bar).
In a graph of about 7000 such nodes, I want to sort all nodes such that for all possible (i, j) where 1>=i<j<=7000 .. depends(Ni, Nj) is False. d...
What equation is needed to move a point on an isometric plane in a 2d space?
I've looked several places on the tubes. Mostly here. and I haven't been able to decipher it. I'm not a math major, unfortunately.
What I need to do is move a point from (0,0) to (1,0) or (0,1) on an isometric plane consisting of 10px blocks. In normal-ville ...
I'm writing a function which generates all paths in a tree as xpath statements and storing them in a bag below is a naive (sorry this is long) and below that is my attempt to optimize it:
/**
* Create the structural fingerprint of a tree. Defined as the multiset of
* all paths and their multiplicities
*/
protected Multiset<String> cr...
Here is the problem:
I have to find a path from the starting point to the destination with following considerations.
In the given graph a point could be either
(1) A Checkpoint--> this point must
be there in the final path calculated
(2) A Mine--> this point should not
be there in the final path calculated
(3) A neutral point--> thi...
Hello fellow coders,
Does anyone know the algorithm for doing a post order traversal of a binary tree WITHOUT using recursion.
Any information would be greatly appreciated.
...
Hello everyone,
I am trying to get my data which is hierarchically set up with a tree traversal model into an < ul> in order to show on my site.
Here is my code:
function getCats($) {
// retrieve all children of $parent
$query = "SELECT max(rght) as max from t_categories";
$row = C_DB::fetchSingleRow($query);
$max = $row["max...
I want to allow the user to click a start point and then click an ending point and be able to manipulate various form elements between the two points that were selected.
The page is a table with numerous rows and each row contains the relevant information to manipulate/save an answer to the question in that row. Each row has a hidden in...
How can I find a binary tree from a given traversal method (inorder,post-order,pre-order)?
...
Hi,
i have 5 div's of the same class but different id stacking on top of each other. how do I traverse them using javascript? they are named div1, div2, div3, etc...
also, how do i change each div's attribute while traversing?
thank you very much.
tam.
...
Consider the following table:
<table>
<thead>
<tr>
<th scope="col" />
<th scope="col">A</th>
<th scope="col">B</th>
<th scope="col">C</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Apples</td>
<td>Oranges<...
I have to write a method that returns a set of all elements in a bag with no duplicate entries allowed. The data is held in a BST, and I'm trying to do this by using a TreeSet, but I'm having trouble working out how to traverse the tree and add each node's data to the TreeSet.
I can only manage the following:
Set<E> uniqueSet() {
No...
Thanks for looking, all helpful answers are voted up.
This is my markup. I'm trying to find 2 consecutive divs cmk1 and cmk2 with the content RIGHT and HERE in consecutive order.
div id 1 shouldn't match because there's a right but not here.
div id 3 shouldn't match because there's a here but no right.
I'm trying to find something t...
This one has me stumped.
<div id="container">
<div id="store"></div>
<div id="contact"></div>
</div>
I'm looking for the contact divs position as child of "container". So just to be extra clear, if i'm looking for 'contact's position, i need jquery to return the number 1.
any help is greatly appreciated!
thanks!
...
I have a table, containing rows, contaning cells - and some of them contain an img as follows:
<img id="FormView1_btnSave_row1%1%new" style="border-width: 0px; cursor: pointer;"
src="grafik/ok_16x16.gif" onclick="cleverStuff(this)"/>
In the function cleverStuff I would like to operate on the line that follows the line in which the but...