Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. That's my point though - this is with a dual-boot setup (perhaps that wasn't clear?), so it's not possible for both mysql servers to be running.
  2. Hmm - perhaps you're right. Not knowing an awful lot about it, i kinda assumed there wouldn't be any concurrency issues since the data would be being read by two instances at the same time.
  3. I keep meaning to write one, but i've not had time as yet. Other than that, all i can suggest is that you google. If you look for examples of retrieving data from facebook, myspace etc (there are a fair number of these) it might help you get the general gist.
  4. Or you could just store it in an integer field.
  5. As long as it's not the British government watching over it, i dont mind too much.
  6. You don't call it explicitly; rather you specify the function to be called when the stage is changed. Assuming you are still using the last code you posted, you need to add this line: xmlHttp.onreadystatechange=stateChanged; After this line: xmlHttp.open("GET","amount_check.php" + queryString, true);
  7. The first thing to check would be that you have indexes on the fields you are searching on.
  8. Having taken a look at the website in question; it's not as simple as that. You'll need to make two requests - the first to log in, the second to the page containing the data. You'll need to specify more curl options, including post fields and a cookie jar.
  9. I'm trying to change my datadir on ubuntu so that i'm working with the same database if im in windows or ubuntu. I assume this is just a case of changing the datadir to the same folder (i'm using fs-driver to provide access to my home folder, which is a separate partition, in windows) in both windows and ubuntu. I changed the datadir in windows first and moved the files with no problem. However, i can't get this to work in ubuntu. I changed the datadir in my /etc/mysql/my.cnf file to "/home/ben/MySQL/data" and also changed the owner of the folder : "sudo chown -R mysql:mysql ./MySQL/data". I've tried a fair few variations, without success. Whenever i try to start the mysql server again, it fails. No error - not sure if there should be. I'm very inexperienced with this kind of thing, so i'm probably missing something simple. Any ideas anyone? Edit: I also noticed in the my.cnf file, it metions altering /etc/apparmor.d/usr.sbin.mysqld. I've no idea what this really is, but I did try modifying the lines that referenced the original data dir without success.
  10. That's actually a pretty good idea. That's how i approached it too: <?php $start = time(); function generate_primes($num){ $generated = 1; $x = 3; $primes = array(); $primes[0] = 2; for($x=3;;$x+=2){ $prime = TRUE; for($y=2;$y<=sqrt($x);$y++){ if($x % $y == 0){ $prime = FALSE; break; } } if($prime===TRUE){ $primes[$generated++] = $x; if($generated>=$num){ break; } } } return $primes; } function calc_sum($n){ $sum = 0; $primes = generate_primes($n*$n); $squares = ceil($n/2); if($n % 2==0){ $sum = array_sum(array_slice($primes,0,4)); $index = 3; for($x=2;$x<=$squares;$x++){ for($y=0;$y<4;$y++){ $index += 2*$x-1; $sum += $primes[$index]; } } }else{ $sum = 4; /* 2 is the center of the spiral; count it for both diagonals */ $index = 0; for($x=1;$x<$squares;$x++){ for($y=0;$y<4;$y++){ $index += 2*$x; $sum += $primes[$index]; } } } return $sum; } echo 'Sum of diagonals for n=500: '.calc_sum(500); $time = time() - $start; echo '<br />Time taken: '.$time.' seconds'; ?> The prime number generation is slightly more efficient than yours ddrudik. To check if x is prime, it's only necessarily to check if it is divisible by numbers up to sqrt(x), not x/2. I managed to run this for n=500, though it did take almost 3 minutes. Sum of diagonals for n=500: 1107323275 Time taken: 174 seconds
  11. I'm not convinced that it's necessarily an inefficiency in your code that is the problem. If n=2007, then it's necessary to generate 4028049 primes (2007^2). That's not really a trivial task.
  12. What's not working? What happens? Do you get error messages? Have you tried echoing $data1 to make sure you're retrieving the webpage ok?
  13. To find which ID's are duplicated, you could use this: SELECT evo_parent_id,COUNT(evo_parent_id) as cnt FROM yourtable GROUP BY evo_parent_id HAVING cnt > 1
  14. If you install the firebug plugin for firefox, you could just select the text and it'll bring up all the CSS information relating to it.
  15. When i click that, I get an error: "The membergroup doesn't exist or is invalid. "
  16. To pass an array as a string, you should serialize() it.
  17. You're looking for a WYSIWYG editor; TinyMCE for example.
  18. Can't recommend a particular one i'm afraid, though if you google you'll find loads. If you want to give it a go yourself, then you'll need to use the imagecopyresampled() function on the uploaded image to create a thumbnail. Edit: In fact, if you look at the examples given on that page you'll get a pretty good idea of what to do.
  19. Not quite. You would want separate arrays for each field. Also, you dont need to be figuring out the number of rows in the table. You want something like this: $i=0; while($Row = mysql_fetch_row($Result)){ echo "<input ... name=\"position[$i]\">"; echo "<input ... name=\"firstname[$i]\">"; //etc $i++; }
  20. To be honest, most forum software looks fairly similar. Who's to say who's copied who?
  21. Firstly, welcome to the forums. Second, the way to present code is to use the or tags as appropriate As for your problem, you should be using arrays. For example: <input type="text" name="textfield[0]" /><br /> <input type="text" name="textfield[1]" /><br /> <input type="text" name="textfield[2]" /><br /> You can then cycle through them like so: foreach($_POST['textfield'] as $key => value){ echo "The key was $key and it's value was $value<br />"; } As for nested forms; i've never tried, but it wouldn't surprise me to find they don't work. It looks as if you're trying to have multiple submit buttons? That's entirely possible - just check which one has actually been pressed in your form processing.
  22. Or, you could just nest your if statements properly. Consider the following pseudo code: if(file is uploaded){ //create the thumbnail if(thumbnail is created){ //try to execute the query if(query is successful){ //everything worked }else{ //query failed } }else{ //thumbnail not created } }else{ //file not uploaded } Also, to create a thumbnail, you should be resizing the file that's already been uploaded.
  23. What one might think is logical is never how it is in the real world.
  24. That's one of the reasons that a decent IDE helps so much; shows you the function prototype as you type the function
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.