Jump to content

williamZanelli

Members
  • Posts

    155
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

williamZanelli's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Hi guys, I have a scalability question - I have a for loop - after which I end with a String, 150 chars long - I write this to a log file. I;m thinking, if I rather than write to log file after each iteration, would it be better to append the Sting after each iteration, and write at the end of the loop? How long could my String be, I can potentially 1000 iterations * 150 chars - is it advisable to have such a long String in memory? Thanks for your advice
  2. Check your message for detailed response.
  3. Its not spam guys! Look at my track record of questions....
  4. Haha Thorpe, Thanks for the reply. Its not spam I can assure you of this. Priavte message me and I will provide my email, we can chat that way?
  5. Hi guys, I'm using cURL multi to send out post requests. My code is something like below - but with many more handles.. I'd like to send out 10,000+ requests [i have an array with 10k+ cURL handles,], whats the best and most efficient way of doing this? Thanks for your help & advice in advance. <?php //taken from http://php.net/manual/en/function.curl-multi-init.php // create both cURL resources $ch1 = curl_init(); $ch2 = curl_init(); // set URL and other appropriate options curl_setopt($ch1, CURLOPT_URL, "http://lxr.php.net/"); curl_setopt($ch1, CURLOPT_HEADER, 0); curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/"); curl_setopt($ch2, CURLOPT_HEADER, 0); //create the multiple cURL handle $mh = curl_multi_init(); //add the two handles curl_multi_add_handle($mh,$ch1); curl_multi_add_handle($mh,$ch2); $active = null; //execute the handles do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); while ($active && $mrc == CURLM_OK) { if (curl_multi_select($mh) != -1) { do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); } } //close the handles curl_multi_remove_handle($mh, $ch1); curl_multi_remove_handle($mh, $ch2); curl_multi_close($mh); ?>
  6. Hi guys, I have a for loop, that queries my database, sometimes, close to 240 times, I want to minmise the DB access - what would be ideal is if I can query a result set, such as this.. $result = mysql_query($sql,$con); Is it possible for me to now run a query on $result. Such as select * from sometable where age >= '24' So, rather than access the DB over and over again, I just query the result set, which will be much faster. Any ideas on this one guys? Cheers Zain
  7. Well at the moment there's been no such issue with heavy load etc. However, given that I'm implementing code in this section, I'd much rather do the best way possibe - than to do a half ass job and then later realise its not as efficient/proper way of doing it.
  8. Hi guys, Periodically I have a need to execute some local PHP file to clean/update the DB - it takes some parameters. So I use a Cron file, that has WGET statments passing arguments in the URL. The benefit of this is to me is, I can manually via the browser execute the same file. I have been told that using PHP CLI is more efficient, Can anyone shed any light on this? Is it more efficient? Would i be able to manually excecute the PHP CLI file via a browser? Thanks for your thoughts in advance.
  9. Hi guys, I need you advice, I normally get some good hints/pointers from here.. 1. Im looking for a good multi user CMS, that gives me (admin) full access on being to able to modify & disable, pages created by the users. 2. I want to have an independent signup - so any user can signup, get confirmation email and be able to create his or her page. 3. I want to have the ability to limit the number of pages a user can create, and choose the CMS (they see to update their page) 4. I want the CMS to be rich, in the sense that it allow users to totally customise their page/pages - background colors etc. completely. Any recommendations for open (or even propitary CMS's) would be nice. Thanks in advance.
  10. Hi guys, I'm parsing some data from a Spanish source, it has spanish chars inside CDATA brackets, chars like "é" - when I view source, the character ("é") is dispalyed as "&#xED;" - I've tried numerous ways or replacing this character.. with some other letter and it doesnt seem to work. Here's some code function handleSpanishCharacters($input) { $translate['&#xED;'] = "a";// $translate['á'] = "a"; $search = array_keys($translate); $replace = array_values($translate); return str_replace($search,$replace,$input); } What am I doing wrong? Does someone have a working solution that I can use? Any ideas on how I could fix this darrn prob? Cheers Will
  11. Awesome stuff MadTechie.. works like charm :D
  12. Basically, I'm reading some XML, parsing from one source, and based on this and some other atrributes from my DB, I'm constructing a new XML document. Here's some sample code.. $output = new SimpleXMLElement("<root></root>"); //Add other child nodes etc.. file_put_contents($this->filePath, $output->asXML()); Any idea how I could chnage the encoding of the outputed file? Thanks for your help.
  13. Its not set, The only thing is says is - <?xml version="1.0"?> Not entirely sure how I can add the encoding to this. Surely its possible? They have it in this example - http://www.w3schools.com/PHP/func_simplexml__construct.asp Thanks in advance for your thoughts.
  14. Hi guys, I'm constructing a PHP document, using SimpleXML- I want to set the encolding of the document to "ISO-8859-1" - how do I do this.. This prob is driving me nuts... Can someone please help? Thanks in advance. Will
×
×
  • 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.