Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
No, it's not possible to generate 100% random numbers using a computer because it's what you call a deterministic device. A computer can't pick a random number off the top of its "head" like a human can. A computer can generate what you call a pseudo-random number, and a program/function/algorithm that does this is called a PRNG (pseudo-random number generator). These rely on some mathematical tricks and a seed value. Giving it the same seed will result in the same pseudo-random number. The seed is often based on the computer's internal clock.
-
I'm not quite sure what you mean? If they "work" individually, can't you just include the header at the top, and the footer at the bottom? <?php include 'header.php' ?> some content <?php include 'footer.php' ?>
-
Okay, so I've disabled that warning now. Clear cache to get the updates (or wait seven days until the cache expires).
-
That would be when someone has used jsMath in a post. Either install the jsMath TeX fonts, or see if the notice can be disabled in the mentioned control panel (note the little button in the bottom right corner saying "jsMath").
-
I would imagine you clicked the "Topic Solved" button. Just mark it as "not solved".
-
Don't take language courses. Take theoretical courses. With a solid background in theory, picking up a new language is easy.
-
Why don't you read the article I linked to?
-
http://en.wikipedia.org/wiki/Net_neutrality
-
Right, so we know that the volume of a cone is given by [imath]V=\frac{1}{3}\pi r^2 h[/imath] where [imath]h[/imath] is the height. You were right about substituting in something (though you did it incorrectly). Seeing as [imath]r=\frac{3h}{2}[/imath] for this particular cone, we can substitute that in to only have one variable: [math] \begin{split} V&=\frac{1}{3}\pi r^2 h \\ &=\frac{1}{3}\pi \left( \frac{3h}{2} \right)^2 h \\ &=\frac{1}{3}\pi \frac{9h^2}{4} h \\ &=\frac{1}{3} \cdot \frac{9h^3\cdot\pi}{4} \\ &=\frac{3\pi}{4} h^3 \end{split} [/math] If we solve for [imath]h[/imath] then we get: [math]\begin{split} V=\frac{3\pi}{4} h^3 \Rightarrow \frac{4V}{3\pi} = h^3 \Rightarrow h = \sqrt[3]{\frac{4V}{3\pi}} \end{split}[/math] As you also said, we know that [imath]\frac{dV}{dt} = 10t[/imath] where [imath]t[/imath] is the time. Using the above we can also find [imath]\frac{dh}{dV}[/imath], but what we're looking for is [imath]\frac{dh}{dt}[/imath]. That is where the chain rule comes in, because [imath]\frac{dh}{dt} = \frac{dh}{dV} \cdot \frac{dV}{dt}[/imath]. Your turn I don't mind that as long as the poster makes it clear that it's homework.
-
Well, you have to do something like this first: $res = mysql_query('SELECT id, name, parent FROM stuff ORDER BY parent DESC, id') or trigger_error('Query failed: ' . mysql_error(), E_USER_ERROR); $vertices = array(); while ($vertex = mysql_fetch_assoc($res)) { $vertices[] = $vertex; } You'll of course have to adjust the query.
-
[SOLVED] rand (1000, 1025)(2000,2025)(3000,3025)
Daniel0 replied to markvaughn2006's topic in PHP Coding Help
I suppose you could always do like this: $rand = array(rand(1000,1025), rand(2000,2025), rand(3000,3025)); $num = $rand[rand(0,2)]; Edit: Or like this: $first = rand(1,3) * 1000; $num = rand($first, $first + 25); -
Try having a look at the manual page again http://dk.php.net/manual/en/mysqli-stmt.bind-param.php
-
[SOLVED] round to nearest 5 or 10 with 2 decimal places
Daniel0 replied to Vivid Lust's topic in PHP Coding Help
Just don't do it in an array, but do the change directly. -
My suggestion is to hire a designer.
-
$sevenDaysAgo = strtotime('-7 days'); $query = 'SELECT DISTINCT `URL` FROM hits WHERE `cat`="language" AND `Time` >= ' . $sevenDaysAgo; $result = someSortOfFunctionThatExecutesQueries($query);
-
Just do it like you would always create arrays. You can manipulate $_SESSION like any other variable.
-
It looks pretty unappealing. The loading screen that comes up all the time seems rather pointless, and the green color doesn't fit the white background. The lack of distinction between regular text and links is problematic, and the general lack of color makes it dull and boring. Also, why did you use textareas for fields on the contact form? Overall it looks pretty unappealing and unprofessional. I would never buy web design services from a website like that. The thing about statistics also sounds lame. If statistics demand you have 15 seconds to catch my attention, then why are you wasting my time with information that is not relevant to what I'm looking for?
-
Get the timestamp from seven days ago and select all rows with a timestamp greater than or equal to what you just computed.
-
Assuming you're using Apache, add this to your httpd.conf file: AddType application/x-httpd-php .mod
-
I don't think you'll get much help with ASP in a board called "PHP Coding Help" on a website called "PHP Freaks"...
-
Hmm... I would fetch all the vertices in the tree first, and then generate the trees from that. Something like this should do it: <?php // SELECT id, name, parent FROM stuff ORDER BY parent DESC, id; /** * Data set from above query. */ $vertices = array( array( 'id' => 5, 'name' => 'Child3', 'parent' => 2, ), array( 'id' => 3, 'name' => 'Child1', 'parent' => 1, ), array( 'id' => 4, 'name' => 'Child2', 'parent' => 1, ), array( 'id' => 1, 'name' => 'Cat1', 'parent' => null, ), array( 'id' => 2, 'name' => 'Cat2', 'parent' => null, ), ); /** * Generate tree */ $subtrees = $trees = array(); foreach ($vertices as $vertex) { $v = array( 'id' => $vertex['id'], 'name' => $vertex['name'], 'children' => array(), ); if (isset($subtrees[$vertex['id']])) { $v['children'] = $subtrees[$vertex['id']]; } if ($vertex['parent'] === null) { $trees[] = $v; } else if (!isset($subtrees[$vertex['parent']])) { $subtrees[$vertex['parent']] = array($v); } else { $subtrees[$vertex['parent']][] = $v; } } unset($subtrees); /** * Generate HTML */ function getSubtreeOptions(array $subtreeRoot, $level = 0) { $html = sprintf('%s<option value="%d">%s%s</option>' . PHP_EOL, str_repeat("\t", $level + 1), $subtreeRoot['id'], $level > 0 ? str_repeat(' ', $level) . '|_' : null, $subtreeRoot['name']); foreach ($subtreeRoot['children'] as $child) { $html .= getSubtreeOptions($child, $level + 1); } return $html; } echo '<select name="stuff">' . PHP_EOL; foreach ($trees as $root) { echo getSubtreeOptions($root); } echo '</select>'; That will output: <select name="stuff"> <option value="1">Cat1</option> <option value="3"> |_Child1</option> <option value="4"> |_Child2</option> <option value="2">Cat2</option> <option value="5"> |_Child3</option> </select> In your table you should represent parent=NULL for tree roots. It's not an optimal way of storing trees in a relational database, however. It's good enough if you always only fetch the entire tree, but if you at some occasions only need a particular subtree that will be more difficult. Have a look at modified pre-order tree traversal/nested set.
-
[SOLVED] how to run wampsever using ipaddress?
Daniel0 replied to chennaibala's topic in Apache HTTP Server
Yeah, he can connect to it, but it serves a 403. -
[SOLVED] how to run wampsever using ipaddress?
Daniel0 replied to chennaibala's topic in Apache HTTP Server
Hmm... Try checking Apache's error log. It sometimes tells why it returns a 403 error. -
[SOLVED] how to run wampsever using ipaddress?
Daniel0 replied to chennaibala's topic in Apache HTTP Server
Does it work when you're accessing it directly from the server (i.e. http://localhost on that computer)? Do you have read permissions on D:\wamp\www? Did you restart Apache after changing httpd.conf?