Jump to content


  • Posts

  • Joined

  • Last visited


Everything posted by spaceman12

  1. Visit my facebook style chat @ brightstar.99k.org/obf.php I use XMPP framework to push out the data in a nearly real time
  2. Hello, I'm just too vague over my understanding as to what I know so far may be true or not. Suppose, I have a text file stored on the server. We all know that when a file stored on a server is opened for viewing, some bandwidth is consumned and the consumption increases with every refresh of the page and so on. So if i use $.get on the client browser to reteieve the contents of the text file stored on the server, will it affect the server bandwidth consumption? I just want to make it clear that it is just a plain text file. I'm looking for all posibilities as to how I can retrieve the contents of the text file stored on the server from the client browser without necesarily having to consumned any server bandwidth. thank you all in advance!
  3. thanks alot, that did the job pretty well. However, i'd like to know if 'return' in javascript is so same in function as to exit() in php? Thanks
  4. I have been trying to sort this out by myself but it seems like I just can't figure to work it out correctly. Suppose, I have a string like this- var string="Where are you and Iam so sorry I cannot sleep I cannot dream tonight"; Here, lets assume that the string that I want to search for it is Where var search= new RegExp["^Where$"]; I'm sure the object split() has got to do something with string and then do a testing. Like this var array=new array(); array=string.split(" "); if(search.test(array)) { document.write('true'); } Despite all my efforts to make it work, I just can't. In php, we could have easily split the string into arrays using explode and call the function if(in_array($search,$array)) { echo "true"; } Please help(I'm just not very familiar with javascript) .Thanks
  5. it requires ajax and jquery for certain. It aint so easy,..unless u hire some freelancer to do it for u. I could also do that but i'm too engrosed in the development of a project atm.
  6. FINAL OUTPUT is the generated unique id in either of the conditional case implemented within da code!
  7. m giving u some ideas as how to accomplish the result u desire. As is in ur case, a lighter code is only required. Join output adds up together the alpha and nume strings. While loops in da code ensures that by all means, any value inserted in da db is unique with 100 percent guarantee! XD
  8. This I wrote for a fellow for non repetative unique id generation. However, the string lenght of the id is abt 9-10. Make so alteration withn da code so as to generate only 5 characters and made it useful for urself <?php $str_alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; $str_num=1234567890; $shuffle_alpha=str_shuffle($str_alpha); $shuffle_num=str_shuffle($str_num); $alpha=str_split($shuffle_alpha,7); $num=str_split($shuffle_num,3); $rand_alpha=mt_rand(0,6); $rand_num=mt_rand(0,2); $rand_alpha_output=$alpha[$rand_alpha]; $rand_num_output=$num[$rand_num]; $join_output=$rand_alpha_output.$rand_num_output; if(file_exists('printed_id.txt')) { $getID=file_get_contents('printed_id.txt'); $printed_id=explode(PHP_EOL,$getID); while($final_output=str_shuffle($join_output)) { if(!in_array($final_output,$printed_id)) { $final_output=str_shuffle($join_output);//valid id for further usage and processing break; } } echo $final_output; $fileOPN=fopen('printed_id.txt','a+'); fwrite($fileOPN,$final_output); fwrite($fileOPN,"\r\n"); } else { $final_output=str_shuffle($join_output); $fileOPN=fopen('printed_id.txt','a+'); fwrite($fileOPN,$final_output); fwrite($fileOPN,"\r\n"); echo $final_output;//valid id for further usage and processing } ?>
  9. Do it this ways which is alot cleaner. $pincode=$row['pincode']; If(strlen($pincode)==4) { $pincode='0'.$pincode; }
  10. preg_match() function in php i a regular search expression. For details of its usage, please visit http://www.php.net Here is a sample of code that i made which i believe will be useful to you FOR CASE SENSITIVE SEARCH <?php $string="Sol 3 Drawer Chests Antique Pine Bedside Chest"; $word='Chest'; if(preg_match("*$word*",$string)) { echo $word." "."found"; } else echo $word." ".'not forund'; ?> FOR CASE-INSENSITIVE SEARCH <?php $string="Sol 3 Drawer Chests Antique Pine Bedside Chest"; $word='chest'; if(strcasecmp($word,$string)) { echo $word." "."found"; } else echo $word." ".'not forund'; ?>
  11. in ur case, stristr() is so very unreliable. Used preg_match() for an absolute error free. It is multifold reliable than the former.
  12. the foremost and 1st thing that a webmaster has in his mind is adds! And most probably, adds is the one important thing that every webmaster is looking up to when comes to revenues generation....!! Wow, this site is the next best to wikipedia XD
  13. php with html and css along would be just too boring to get on alone with any type of project or web apps at this stage of time. It is an added advantage for us all to learn which we deem has a greater prospect in the future and in the days to come rather than doing the same traditional thing over and over again. Ajax and jquery along with php is an absolute piece of ingredients for a dynamic content delivery. So its better not to ignore this. For instance, while filling up for a registration form, u r required to put a username whos value of existence in the db must b unique. There is no way in hell that the user will know if the username he fills in has been taken not until he gets down to clicks the SUBMIT BUTTON, and to our dismay if its already taken, he had to take in all the trouble of fillin up the infos again and resubmit it. However, with ajax, u can bind any occuring events with some kind of function and execute it behind the server using php, all these without the knowledge of the users, In the above example, as soon as u leave off the input field, it can always be set to trigger an ajax call using the onblur event in ur html code which wil eventualy let u know at instant about the consequence of the username u entered been taken thus abstainin u from the display of any relevent annoyin errors if any after the click of submit button.
  14. if u are a relative beginner to php, instead avert ur interest of learning to python.Now I have progres myself so much in php (to the level that i could write out any programing if som1 ask me) that its a lil bit difficult for me to adapt to the new environment of python where the two are a complete contrast to each other in terms of everything from syntax to functions to variables! But coming this summer and i surely wil why so suden interes in learnin python? Wel, m developin a browser based chat system comparable to those incoporated in gtalk and facebook. This is the time wher i come to grabs the fact abt the importance of python as a dynamic programin language in this era of modernisation.
  15. P.S. the instant real time updates as notifications and the delivery of instant chat messages in facebook is because of Tornado server. This new techniques replaces the traditional polling! thus conserving a huge server banthwidth!
  16. its completely useles to search for books written by some third parties when u cud read it from the online documentation authored by the developers themselves. Also, mastering php is of no use unless u want to pursue a carreer out of it. On the other hand, i would recomment u to have a fair knowlege on all language. For instance, ajax helps refresh half a page without necesarily havin to reload the whole page as against to wht php would nornally do. Jquery is an absolute fundamental piece of elements in all high-tech web designs. Python is another powerful language which completes the task where php is not capable of. The super fast loading speed of FACEBOOK( faster than google) is because of the implementations of non-blocking tornado server. The chat system of all web based browser is jquery art of work. Tornado is a server oriented framework writen in python.
  17. The title says it all,..well as all u can see, there are many methods to accomplish this done but not before undergoing through a heavy tasking process. For instance, 1. Open the file 2. Reads the content of the file into array. 3. Find out the desire line of text that we want to replace. 4. Make that line of text as variable and assigns with the new data(that we want to replace) as its values. 5.open another file. 6.Write the whole contents to the file opened in 5. 7. Put the contents back to the file of original. Can anyone contributes a better way to get this done? Like replace/delete a specific line without affecting other characters or anything therein? Thanx. P.S reading and using str_replace to make the alteration always ends up in giving some kind of result beyond desired after the first round of code execution.
  18. NULL and blank are so very different! When the table is configured to accept null values, it wil b shown as NULL for cell with null values otherwise it is not null.
  19. thank u for the response. However, i'd like to make a clarification that the data stored on the text files are almost invisble as it is auto cleared by the server itself on the event of succesful javascript generation. Tht is, it is immediately appended into the browser as soon as the desired blocks of codes are generated. As, this is chiefly a browser related stuff, i necesarily dont find it useful to use database,most importantly on the ground that it might utilize heavy resources and workload as compared against lightweight text. Any suggestion welcome
  20. Hello, I'm developing a browser based chat clients(like the one facebook and gtalk uses) which requires an instant generation of of blocks of html code on clicks. So, what i'am basically trying to do is first writes it down the generated code on a text file using php fwrite function and load it immediately into the site as soon as it is done. Some disadvantages using this system of techniques is the various calculations involved which i believe will delay in the deleivery of the code generated. On the otherhand, this is not so in the case of mysql database as all the values are uniquely stored and determined but the whole lot process of querying and reteieving is another factor that i believe will slow down the performance. please tell me which gonna be a faster one...thanks, p.s almost 50percent coding done
  21. you may proceed as like this: As you have stated in your post that you used a dropdown box as an alternative for selecting an option, you could assign each each option a value as like this- name='option' value='1' name='option' value='2' on the datacheck.php if (!empty($_POST['TEST1'])) { if($_POST['option']==1) { header(['Location: http://mysite.com/sage/page1.php'); } else { header('Location: http://mysite.com/sage/page2.php'); } } else { echo 'Please fill in the form'; }
  22. to grab the exact code, you need to pace the ad.html in your localhost or the result wont be as what you want if you grab it from other external links.
  23. Either you echo it out and you will see all the output or you will only get the value that was at last.
  24. Hello, thos tutorial that you find elsewhere on the net are so difficult to understand. Can somebody please help me find an absolute begginer's gude to begin with the subject as stated in the thread topics? thanks
  • 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.