Jump to content

williamZanelli

Members
  • Posts

    155
  • Joined

  • Last visited

    Never

Everything posted by williamZanelli

  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
  15. Well what I have is two strings eg. [string 1] The forums cool [string 2] The forum's cool So the only that differntiates these two is the apostophe, similary if I have 2 strings eg. [string 3] The forums cool: [string 4] The forums cool; Here the difference is the Semi/Colon - How would I compare 2 strings to see if they're equal, disregarding the colons, commas, apotrophes etc. Does that make sense? Thanks
  16. Just wanted to know what method I could use to compare strings, minus the apostrophe's, commas, full stops etc. I saw it a few days ago.. im prettyy sure it exists!! Thanks for your thoughts
  17. Mattal I tried the following SELECT * FROM sales WHERE prod_category =135 AND DAY( sale_date ) = DAY( DATE_ADD( CURDATE( ) , INTERVAL 1 DAY ) MySQL Throws the following error - #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL.... Any ideas?
  18. ok guys, small problem, I want to know how many of some product sold in the last 24hrs (1hr, 8hrs, etc. will be added later), so I run the following query SELECT * FROM sales WHERE prod_category = 135 AND DATE_ADD(now(), INTERVAL 1 DAY) This returns total sales to me, regardless of what "DATE_ADD(now(), INTERVAL 1 DAY)" is..? Any ideas what I've done worng? Thanks will
  19. Hi guys, I want to enable query profiling in my DB, How do I do this via phpmyadmin? Thanks Will
  20. Hi guys Thanks for your suggestions. What I want to achieve is, someone searches some terms on my website, I return a result with percentage simialrity/relevance to search terms - I've seen this feature on a lot of websites - how is it implemented? I could use %LIKE% but I'm concerned about the accuracy, for example - I have the string "France's news", in my DB I have something like "Frances news" - %Like% would not pick this up?? Thanks for your thoughts on this Will
  21. Hi guys, I needed some help, I want to query my db, but I want to search for something similar to a particular phrase, What I want query is "if a a record with the "username" field, similar to this field exists (say 80% similar) in my DB, bring me that record" I'm not sure hot to phrase this in SQL, I'm using MySQL iif that is of help. Is this even possible? If I cant do this in SQL is there another, efficient way of searching a database for this? Thanks for your thoughts in advance Will
  22. Thanks for this guys. How do I do a var dump? Cheers
  23. Hi guys, Thanks for the prompt responses. The code I have is cumbersome, so I decided to keep it simple. The foreach is like, foreach($array2d as $key => $val) { if($data[$key] != '') { $sql = "......" //loads of business logic etc. The error is thrown at line foreach. Thanks for your thoughts Will
  24. Hi guys, Just wondering if you could tell me whats wrong with the following array $array2d= array( 5 => array( 'fname' => 'Smith', 'sname' => 'smith' ), ); Its had me all day, when I run it inside a foreach, it throws the following warning, Warning: Invalid argument supplied for foreach() - followed by the line number. Thanks for your thoughts 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.