Jump to content

Shadowing

Members
  • Posts

    722
  • Joined

  • Last visited

Everything posted by Shadowing

  1. It seems like any code that tries to run more then a second or something it hangs up until the 30 seconds is hit. Googled it pretty hard. doesnt seem like anyone else having a issue like this.
  2. PHP 5.3.8 windows xp pro, 32bit Just using what came with XAMMP
  3. this just doesnt make any sense to me. array_unique function works fine now with using mt_rand. I dont understand how rand() was effecting the results of array_unique() reason why is when i was using rand() i did count() on the array before it hit array_unique() and I was getting 600,000. then i did count() after array_unique() and got only 5048. Get what im saying guys? that is crazy wierd.
  4. oh wait i cant remember did you guys say that you was able to also use array_unique function and get 600k results too? just curious even though thats not how i will be doing it anymore. so what is the deal then my server?
  5. ahh yah thats a interesting idea david. I think i may just switch to that idea. that be heck of alot light weight then the 5 loops im using ha.
  6. Holy crap Kicken you are a genius hahaha that solved the problem wow. so why is my rand function worse then yours?
  7. really appreciate you guys helping me out with this cause this problem is really bothering me. specially now that you guys are not having this issue. I'm using a Desktop computer with windows xp pro. Even though i dont think browser should matter i tried it on IE and FF. This machine has a 3 ghz dual core processor with 3 gigs of 800mhz RAM. I dont see how it could be a computer hardware issue due to how its happening between 18 by18 and 20 by 20. I should mention if I do make the execution time unlimited it will eventually work but will take like 10 minutes lol. The max memory you can have apache on is 128mb and mine is set to max. but i dont think its that setting cause i can lower it to 8mb and doesnt effect testing it with 18 by 18. Ive been running only this code nothing else the exact code that kicken posted. So now i took it a step further i opened up a fresh page with nothing on it but this code. Same results if i use "$map_x = 18; $map_y = 18;" the page loads in a fraction of a second. The I try "$map_x = 20; $map_y = 20;" and it times out. its almost like its a setting or something because why would 18 by 18 be a fraction of a second and then 20 by 20 doesnt work. The only error I get Fatal error: Maximum execution time of 30 seconds exceeded in C:\Software\XAMPP\xampp\htdocs\System_Lords\raw.php on line 27 ini_set("display_errors", "1");error_reporting(-1); // creates a stargate address function stargate_address_generator() { $chevron1 = rand(1,38); $chevron2 = rand(1,38); while ($chevron1 == $chevron2) { $chevron2 = rand(1,38); } $chevron3 = rand(1,38); while ($chevron3 == $chevron1 || $chevron3 == $chevron2) { $chevron3 = rand(1,38); } $chevron4 = rand(1,38); while ($chevron4 == $chevron1 || $chevron4 == $chevron2 || $chevron4 == $chevron3) {$chevron4 = rand(1,38);} $chevron5 = rand(1,38); while ($chevron5 == $chevron1 || $chevron5 == $chevron2 || $chevron5 == $chevron3 || $chevron5 == $chevron4) {$chevron5 = rand(1,38); } $chevron6 = rand(1,38); while ($chevron6 == $chevron1 || $chevron6 == $chevron2 || $chevron6 == $chevron3 || $chevron6 == $chevron4 || $chevron6 == $chevron5) { $chevron6 = rand(1,38); } $stargate_address = "$chevron1-$chevron2-$chevron3-$chevron4-$chevron5-$chevron6"; return $stargate_address; } function stargate_address_check() { $map_x = 20; $map_y = 20; $stars_per_sector = 15; $star_amount = $map_x * $map_y * $stars_per_sector; // finds out how many address's needs to be created $stargate_address_array = ''; // advoid undefine error notice $create_address_array = 0; for ($i=0; $i<$star_amount; $i++){ // creates a huge array of address's do { $address = stargate_address_generator(); } while (isset($stargate_address_array[$address])); $stargate_address_array[$address] = 1; } $count = count($stargate_address_array); return $count; } echo stargate_address_check();
  8. Fatal error: Maximum execution time of 30 seconds exceeded I just dont understand why can you all run this code and I cant? I can increase or make the execution time unlimited of course, but it will make the script run soooo slow soon as I set the x and y to 20 times out. but if i do 19 by 19 i create the stars instantly no problem I used kickens exact loop on this. and im only running these two functions now i know something is really wrong if you guys can do this and I cant. my server must not be set up right. My php memory is set to max of 128mb. but i dont believe thats even the issue anyways because i lowered to 16 mb and i can still create 19 by 19 instantly "i know its not really instantly but its a fraction of a second". I googled this sooooo hard the other day and nothing came up saying about this issue.
  9. wierd what the heck why am I only getting this limit. possible some setting i have set for php or something? Yah the chances of a duplicate is very rare. I already wrote code to add back the address's if it found any duplicates. Reason i was doing it like that is cause it woud be more light weight since i wasnt expecting duplicates like samshel said. what is really wierd is that i used in_array to search for uniques while it was creating the array and soon as i tried to create more then 19 by 19 the screen goes white. i mean what the heck lol. Its like any kind of filtering i try to do i cant filter more then 5048 stars. This is really frustrating that you guys arnt having this issue. I"m using apache for my server. Anyways i'll try the key idea. That seems like an amazing idea really brilliant. Sounds like it should work and would be really light weight. Also i didnt know i could assign a key like that lol. So i just learn something will let you guys know
  10. no its not solved. what the heck i never hit solved on it. wierd. hmm
  11. hey Salathe you ran the function "stargate_address_generator" with my code too? what was your return? You will notice this at the top of the function. increase these values will increse how many are in the array if i try 20,20 for these values below and assuming there are no uniques i should get a count of 6000 18,18 works i get 4860 $map_x = 18; $map_y = 18; what does this do? is that a way of filtering for duplicates? $stargate_address_array[$new_address] = $new_address;
  12. hey samshel i tried sort_flag same results but yah i tried with lower amounts as well. i can for example do 4860 and i cant go past 5084. so i dont know real dissapointing lol its not a memory issue so it doesnt make any sense. i can try filtering it as the array is being created and see how intensive that is.
  13. Hey requinix looking through all the array functions. not sure which one you are talking about. i could use array filter in the loop as its being created? I figured it would be doing more work checking for duplicates every time it adds a new element to the array. i'll probably only end up needing 150,000 in the array. i really only have two choices, have mysql do the work or php. and so far mysql failed to create 6000 records for me. so it didnt even come close.
  14. I'm having a problem with removing duplicates values in an array. seems like array_unique wont accept arrays bigger then 5084 also i tried $stargate_address_array= array_keys(array_flip($stargate_address_array)); $stargate_address_array= array_keys(array_count_values($stargate_address_array)); if i count the array before array_unique i get an array account of 600,000 but soon as it hits unique array its count is only 5084. anyone know how to get around this? function stargate_address_check() { $map_x = 200; $map_y = 200; $stars_per_sector = 15; $star_amount = $map_x * $map_y * $stars_per_sector; $stargate_address_array = ''; $create_address_array = 0; while ($create_address_array < $star_amount) { // creates a huge array of address's $new_address = stargate_address_generator(); $stargate_address_array[] = $new_address; ++$create_address_array; } // removes any duplicate address $stargate_address_arrays = array_unique($stargate_address_array); $count = count($stargate_address_arrays); return $count; } echo stargate_address_check(); the function im using to generate the values inside the array // creates a stargate address function stargate_address_generator() { $chevron1 = rand(1,38); $chevron2 = rand(1,38); while ($chevron1 == $chevron2) { $chevron2 = rand(1,38); } $chevron3 = rand(1,38); while ($chevron3 == $chevron1 || $chevron3 == $chevron2) { $chevron3 = rand(1,38); } $chevron4 = rand(1,38); while ($chevron4 == $chevron1 || $chevron4 == $chevron2 || $chevron4 == $chevron3) {$chevron4 = rand(1,38);} $chevron5 = rand(1,38); while ($chevron5 == $chevron1 || $chevron5 == $chevron2 || $chevron5 == $chevron3 || $chevron5 == $chevron4) {$chevron5 = rand(1,38); } $chevron6 = rand(1,38); while ($chevron6 == $chevron1 || $chevron6 == $chevron2 || $chevron6 == $chevron3 || $chevron6 == $chevron4 || $chevron6 == $chevron5) { $chevron6 = rand(1,38); } $stargate_address = "$chevron1-$chevron2-$chevron3-$chevron4-$chevron5-$chevron6"; return $stargate_address; }
  15. Hey guys i have a question not sure where to really ask this at. Im going to make my own ajax chat and i notice someone made one with out using mysql by reading and writing .txt files. Would that be more light weight doing it that way then using mysql? I dont see why it would be. on a level enough to do it so you cant use the awesomness of mysql i mean
  16. Thanks for the responce ragax i got it off a site that was listed in the read first thing on the forum but couldnt get it to work lol what i really want is this Matches 800-555-5555 | 333-444-5555 | 212-666-1234 Non-Matches 000-000-0000 | 123-456-7890 | 2126661234 its for a phone number. only want 3 characters - 3 characters - 4 characters and only numeric
  17. hey guys im trying to check for matches Matches 800-555-5555 | 333-444-5555 | 212-666-1234 Non-Matches 000-000-0000 | 123-456-7890 | 2126661234 Getting hit with alot of parse errors with this. (!preg_match('^(\d{3}-\d{3}-\d{4})*$)', $_POST['current_number'])
  18. Im starting to some what understand firebug now. been sitting here trying alot of things and for some reason my java script still ignores this button. whats crazy is i read the link you gave me and they talk about using "on" but yet i cant find a reference to "on" in any tutor sites i go too. Then someon told me to try using "live" there is only one change_announcements id on the page also. also i tried $("input#change_announcements") the button is type"submit" <input type='submit' name='change_announcements' id='change_announcements' value='Update2'> $("#change_announcements").live("click",function(){ event.preventDefault(); $.ajax({
  19. Thanks thorpe I kinda thought that might be the reason but then i kept thinking why does the <textarea> get read and not the button. but yah the link you gave is saying thats the issue.
  20. For some reason when I use ajax to place a button on a page. I cant get another java/ajax script to read that the button was pushed. Anyone have any obvious idea as to why? When i hit the button the screen refreshes so thats how i know the javascript isnt reading the button. I can read a input form that is placed on the page just not a button. both scripts are like this one below. one for putting the button on the page and a simliar one for clicking on the button. $(document).ready(function() { $("#update_announcements").click(function(event) { event.preventDefault(); $.ajax({ url: "/System_Lords/ajax/announcements.php?functions=announcements_box", type: 'POST', dataType: 'json', data: { announcements: '<?php echo $announcements; ?>' }, success: function(response) { $('#announcements_box').html(response.announcements_box); $('#announcements_button2').html(response.announcements_button); } }); }); });
  21. holy crap thats an amazing idea thanks man. I would of never of doing that. I googled that for a hour and no one mentioned doing this lol. I just realize i could use a php switch for this for the first time if i have alot of functions on a page.
  22. Hey thorpe is it possible to tell ajax to call a php function from a php file or am I stuck with having to use a new php file for every php script I want to run? I sure hope there is a way cause that is going to be messy creating so many files.
  23. using the same id should refresh it when you display your content tell it to go to #number and it will replace what is in the tags with the id of number <div id="number"> </div> or are you saying you dont know how to tell ajax to insert into an id on the page?
  24. alright I get this when I use echo_file_; which it didnt tell me anything I didnt know. so is there away to put a constants in the require path? C:\Software\XAMPP\xampp\htdocs\System_Lords\functions\function_battle.php I was reading some stuff online and is there a way where i can add this to the require file then? require("/function_battle.php"); I was reading a site that says i can do something like this but it doesnt work for me include(dirname(__FILE__).'/function_battle.php');
  25. also b455m4573r you should really be using error control on your queries. What is going to happen is this. When you become better at PHP you are going to realize why its important to use them and you will be going back through pages and pages of code adding it into your queries. like Psycho's example $qstring = $Fixit.",".$offset.",".$rowsperpage; $results = mysql_query($qstring) or die(mysql_error());
×
×
  • 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.