
anupamsaha
Members-
Posts
251 -
Joined
-
Last visited
Never
About anupamsaha
- Birthday 05/11/1971
Profile Information
-
Gender
Male
-
Location
India
anupamsaha's Achievements

Newbie (1/5)
0
Reputation
-
Thanks @xyph for your note. Let me elaborate my problem here. I have a text file where the actual strings are stored. By "actual", I mean the strings to be searched. These strings are combination of two strings. Now, I have another array where all thestrings are scrambled. Text file (wordlists.txt) milliontrillion unitdecimal crossstraight sumdivide ... The scrambled array: array('divide', 'trillion', 'decimal', 'million', 'straight', 'sum', 'unit',....); I want to traverse through the array and concatenate two strings and mark which are the strings are found from the text file. Any idea about such traversing algorithm which is fast? Thanks!
-
Hello, I have an array as follows: $a = array('a1', 'b1', 'c1'); // this can grow to 1000+ strings as array elements My objective is to traverse through the array quickly and create combination of strings taking two at a time. This means, the following will be the output: array(array('a1','b1'), array('a1','c1'), array('b1','c1')); // no need to create the reverse combinations I wrote the following code to achieve the same, but it's really really slow for a long array (for say, number of elements 1000+) <?php $words = array('a1', 'b1', 'c1'); $result = array(); do { $word1 = array_shift($words); foreach($words as $word2) { $result[] = array($word1, $word2); } } while(count($words)>0); print_r($result); ?> Can anybody help me to implement a faster solution for this? Thanks!
-
Here you go <table> <tr> <td>Enter function y prime:</td> <td><input type="text" size="50" maxlength="" name="yprime" value="<?php echo (isset($_POST['yprime']) ? $_POST['yprime'] : '')?>" /></td> </tr> <tr> <td>Enter number of partitions:</td> <td><input type="text" size="7" maxlength="7" name="partitions" value="<?php echo (isset($_POST['partitions']) ? $_POST['partitions'] : '')?>" /></td> </tr> <tr> <td>Enter initial x value, x(0):</td> <td><input type="text" size="3" maxlength="3" name="initialx" value="<?php echo (isset($_POST['initialx']) ? $_POST['initialx'] : '')?>" /></td> </tr> <tr> <td>Enter the ending x value:</td> <td><input type="text" size="3" maxlength="3" name="endingx" value="<?php echo (isset($_POST['endingx']) ? $_POST['endingx'] : '')?>" /></td> </tr> <tr> <td>Enter initial y value, y(0):</td> <td><input type="text" size="3" maxlength="3" name="initialy" value="<?php echo (isset($_POST['initialy']) ? $_POST['initialy'] : '')?>" /></td> </tr> </table>
-
Seems you have missed to check whether the form is posted or not. Here is the code that I edited. Let us know if it works or not. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><?php function dydx($x,$y){ $equation = 3 * pow($x, 2); return $equation; } ?> <table> <tr> <td>Enter number of partitions:</td> <td><input type="text" size="7" maxlength="7" name="partitions" value="" /></td> </tr> <tr> <td>Enter initial x value, x(0):</td> <td><input type="text" size="3" maxlength="3" name="initialx" value="" /></td> </tr> <tr> <td>Enter the ending x value:</td> <td><input type="text" size="3" maxlength="3" name="endingx" value="" /></td> </tr> <tr> <td>Enter initial y value, y(0):</td> <td><input type="text" size="3" maxlength="3" name="initialy" value="" /></td> </tr> </table> </br> <input type="submit" name="runge kutta name" value="Run Program" /> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST' ) { // make sure that the form is posted $partitions = $_POST['partitions']; $initialx = $_POST['initialx']; $endingx = $_POST['endingx']; $initialy = $_POST['initialy']; if ($_POST['partitions'] != 0) { $h = ($endingx - $initialx)/$partitions; } $a[1] = $initialx; $b[1] = $initialy; for ($i = 1; $i <= $partitions; $i++) { $k1 = dydx($a[$i], $b[$i]); $k2 = dydx($a[$i] + (1/2)*$h, $b[$i] + (1/2)*$h*$k1); $k3 = dydx($a[$i] + (1/2)*$h, $b[$i] + (1/2)*$h*$k2); $k4 = dydx($a[$i] + $h, $b[$i] + $h*$k3); $a[$i + 1] = $a[$i] + $h; $b[$i + 1] = $b[$i] + (1/6)*$h*($k1 + 2*$k2 + 2*$k3 + $k4); } for ($i = 1; $i <= $partitions + 1; $i++) { $xyarray["$a[$i]"] = $b[$i]; } $_SESSION['graph'] = $xyarray; ?> </br> </br> Choose a partition of X: <select name="output"> <?php for ($i = 1; $i <= $partitions + 1; $i++) { echo "<option value=\"$a[$i]\">$a[$i]</option>\n"; } } // if ($_SERVER['REQUEST_METHOD'] == 'POST' ) ends ?> </form>
-
do we need to install mysql & apache server b4 easyphp
anupamsaha replied to sonalee's topic in Third Party Scripts
Moderator has indicated to write full English instead of the shorter version like 'd' for 'the' etc. Each forum has a decorum of communicating with others. Please follow the same as the moderator suggested. What error do you see at the end? -
do we need to install mysql & apache server b4 easyphp
anupamsaha replied to sonalee's topic in Third Party Scripts
Seems a big mess is there already. I would suggest to take backup of your scripts and uninstall MySQL, PHP, Apache, EasyPHP and then install EasyPHP again. -
do we need to install mysql & apache server b4 easyphp
anupamsaha replied to sonalee's topic in Third Party Scripts
Yes. Only install EasyPHP. -
do we need to install mysql & apache server b4 easyphp
anupamsaha replied to sonalee's topic in Third Party Scripts
EasyPHP is a WAMP package including the scripting language PHP, the web server Apache, the SQL server MySQL, as well as easy development tools such as the database manager PhpMyAdmin and the debugger Xdebug. Nothing to configure. It's already done! -
Please provide the code here.
-
Replace Each Instance of a substring with values from an array.
anupamsaha replied to proggR's topic in PHP Coding Help
Did you close the single quote correctly? $db->query = 'SELECT * FROM users WHERE user_name = :name AND user_role = :role'; // I have closed the single quote -
Help with inserting math captcha in registration form
anupamsaha replied to sofia403's topic in PHP Coding Help
The issue that you are facing due to duplicate form element name "Submit" for both the submit button and captcha input text. The submit button overrides the value of captcha field. Change <td><input type="text" name="Submit" value="what's the result?" onclick="this.value=''" /></td> To <td><input type="text" name="security" value="what's the result?" onclick="this.value=''" /></td> Also, change if($_POST['Submit'] != $_SESSION['security_number']) To if($_POST['security'] != $_SESSION['security_number']) -
Yes. You can. I have done this and sure about it. What's the issue that you are facing?