1,038 Posted Topics
As the title says: Is the XOR Swap algorithm still viable? I know that temp-swaps are supposedly faster but the shear coolness of an XOR swap makes it more attractive to me. What do you guys/gals think? For anyone that doesn't know what an XOR swap is here goes [code=c++] … | |
Re: The easiest way to delete all rows from a table is this [code=javascript] var Parent = document.getElementById(tableID); while(Parent.hasChildNodes()) { Parent.removeChild(Parent.firstChild); } [/code] Note that when using removeChild that if it removes the last element it will also delete the parent node. I guess it assumes that if you have no … | |
Re: [QUOTE=adnan3250;884489]I do not understand why we (the programmers) use unnecessary huge buggy codes of our own for resizing images??!! As we've phpThumb, custom image resizing functions are just a history. Then why do we manually write those codes again and make our script buggy! Yes I know what I am … | |
Re: wow, that's a lot of ranting without actually answering his question. [code=php] $vars = get_class_vars('Class'); // or $vars = get_class_vars(new Class()); [/code] There are more in-depth methods (see Reflection in the PHP manual) but this will get the job done | |
Re: If the javascript is already on a PHP page then you can just do [code=php] var postID = <?php echo $_GET['postID']; ?>[/code] And keep the rest of your code the same. | |
This is about as simple as it gets with menu generators. Everything is explained in the code. Note that the menu is simply an unordered list so to pretty it up it really relies on the CSS. If you don't want to write any CSS of your own here is … | |
Re: [QUOTE=chand.;925812]I have the same problem and I check all the things and precautions. My code is ok. But I dont know what is the problem. My battery is gone down and I just want to post it to get answers when I came again. So please help I also debug … | |
Re: No, they can't. That's all stored on the server. Either in the DB or on the filesystem depending on your settings. | |
Re: Without rival the most useful javascript debugger/general web development tool is [url=http://getfirebug.com]FireBug[/url] in combination with [url=http://chrispederick.com/work/web-developer/]Web Developer Toolbar[/url]. Firebug has a very powerful debugger complete with conditional breakpoints and source tracing. Web Developer Toolbar has a veritable cornucopia of handy tools for web developers. | |
Re: Can you hear one(1) beep when the machine starts? Also are you sure the monitor cable is connected firmly and plugged in, if the cables aren't secured they pop out fairly easily. | |
Re: Gesticulating slimy octopi throw crustaceans across a purple-sploched reef, all chaotically driven by climactic storms. | |
Re: Yeah, never do that. It's why register globals are deprecated and soon to be removed from the language. I repeat: [B]DON'T DO THAT[/B] | |
Re: [quote]I'm having some issues.[/quote] Please elaborate. | |
Re: [QUOTE=johnnycho;1100435]BTW "cursor:hand" only works in IE. The correct W3C standard is actually "cursor:pointer," which will work across all major browsers.[/QUOTE] Welcome to the community Johnny but try not to revive 4 year old threads in the future. | |
Re: it means your query failed. use mysqli_error to figure out what went wrong. | |
Re: PHP Cookbook ([url=http://www.amazon.com/PHP-Cookbook-Solutions-Examples-Programmers/dp/0596101015/ref=sr_1_1?ie=UTF8&s=books&qid=1273770036&sr=8-1]Amazon[/url]) Is a good start since it's less "Here's how to program in PHP" and more "You know how to program here are some nifty 'recipes' that you can use to build stuff with PHP" It is actually extremely comprehensive it covers everything from building basic forms to … | |
Re: It's definitely possible, use the syntax nav33n used. | |
Re: Any place that you would like asynchronous operations and don't want to send the user to another page. * Submitting a form * Login * Voting/ranking/etc. * Commenting * Pagination * Image galleries * Chat/messaging * etc. inf. ![]() | |
Re: You WANT it to create an infinite loop? And what is the purpose of the outer loop? What is setTimeout _supposed_ to be doing (you're missing a function parameter to setTimeout)? ![]() | |
Re: Try looking for ajax calls on timers (settimeout, etc.). Loop is a bad way to describe what you want to do | |
Re: A great thing about PHP is that because it's so chock-full of crap functions sometimes you find one that's useful :P [url]php.net/wordwrap[/url] | |
Re: Do you mean create an image from a php page that outputs [B]image data[/B], or create an image from a php page that just outputs [B]data[/B]? The first case is easy, just put [iCODE]header('Content-Type: image/png');[/iCODE] at the top. The second one is a bit strange. | |
Re: There is the built in PHP [url=http://www.php.net/mail][inlinecode]mail[/inlinecode][/url] function but there is also a mailer in the [url=http://pear.php.net]PEAR[/url] package for PHP. | |
Re: [icode]i=15[/icode] Should be [icode]i <= 15[/icode] | |
Re: php.net is your friend [url]http://php.net/array_diff[/url] See also # array_ diff_ assoc # array_ diff_ key # array_ diff_ uassoc # array_ diff_ ukey | |
Re: They're pretty easy to make, I made one a long time ago that I called [url=http://www.shawnbiddle.com/files/oracle.php]"The Oracle"[/url]. I didn't add as many edge cases and it didn't use a database but it was fun nonetheless | |
Re: In IE8 there are the IE Developer Tools which, while not as good at inspecting elements and CSS, has a very powerful built-in Javascript debugger. Note that Firebug console.* calls are, for the most part, compatible with the IE Developer Tools. <disclaimer>This being said, use Firebug</disclaimer> | |
Re: Firstly, where is the $directory variable coming from? As for your original question, take a look at [url]php.net/substr[/url] and [url]php.net/strpos[/url] | |
Re: Take a look at how the serialization is built and emulate it for a LIKE clause [code=php] $search_field = 'tstate'; $search_field = 's' . strlen($search_field) . '"' . $search_field . '"'; $search_value = 'MI'; $search_value = 's' . strlen($search_value) . '"' . $search_value . '"'; // s:6:"tstate";s:2:"MI"; $search_string = $search_string … | |
Re: [QUOTE=evstevemd;1168358]What books or tutorial (online/downloadable) shall i learn to be able to make secure page? I need to know different technique and algorithms[/QUOTE] There aren't really that many techniques (and 0 algorithms to remember) to secure your site. MD5 your passwords, scrub your inputs AND outputs, use prepared queries (PDO). … | |
Re: I'm not sure I understand the second part of the question. As to the first part, correct. So far no one has figured out a way to decrypt MD5. There are things like rainbow tables, however, that are essentially massive databases of strings and their corresponding MD5 hashes which are … ![]() | |
Re: What you're looking to get is the hostname, not the IP. [url]http://us.php.net/manual/en/function.gethostbyaddr.php[/url] | |
Re: If you're looking to avoid row corruption you'll definitely want to look into atomic transactions [url]http://dev.mysql.com/doc/refman/5.5/en/ansi-diff-transactions.html[/url] But the issue still remains if you restart mysql while updates are still running there's really nothing you can do, you killed the thread it can't recover if it doesn't exist :P [quote]The only … | |
Re: [code] // don't use new Array(3), just use [] var i, images = []; // use push, don't manually assign the index images.push("somelink1"); images.push("somelink2"); // shuffle the array images.sort(function () { return 0.5 - Math.random(); }); for(var i = 0; i < images.length; i++) { document.write(images[index]); } [/code] | |
Re: (GD) You'll want a combination of [url]http://php.net/imagecopymerge[/url], [icode]imagecreatefrom<type>[/icode], and [url]php.net://imagefilter[/url] | |
Re: What is your question exactly? Pasting a homework assignment isn't a question. | |
Re: [QUOTE=pushpakalpana;1153265]try this [CODE]function search_highlight($needle, $replace, $haystack) { $haystack = eregi_replace($needle,$replace,$haystack); return $haystack; } echo search_highlight($searchtext, "<b><font style='color:white; background-color:grey;'>" . $searchtext . "</font></b>", total description); [/CODE][/QUOTE] [b]DON'T[/b] use ereg* functions. There's a reason why there are GIANT RED WARNINGS at the top of every page of the PHP documentation with these … | |
Re: [icode]$bes is a three-dimensional array[/icode] My bet is that isn't the case, [icode]var_dump($bes);[/icode] before that to see what [icode]$bes[/icode] actually is. That error happens when you try to do something like this. [code=php] $some_string = "Hello"; echo $some_string[0][1]; // PHP Fatal error: Cannot use string offset as an array[/code] | |
Re: You might be able to do [code=sql]WHERE user_role IN ('A', 'S', 'D')[/code] | |
Re: If tArea is a <textarea> then .value won't work, you'll have to user innerHTML [QUOTE=xylude;1147602]I am making a little forum and while trying to add the quote post functionality have come across a problem that has me stumped. Here is my js: [CODE] function addQuote(text) { var tArea = document.getElementById('forumReply_message'); … | |
Re: Extract is almost always bad practice, especially in the use case provided. Case in point: You worked on some code at a job and it uses extract and you leave the job and someone else comes along and inherits the code. "Hmm, there's this bug involving [icode]$somevar[/icode] but I don't … | |
Re: If you have to change the ID of an element you're probably doing something else wrong. | |
Re: The variables $_FILES, $_GET, $_POST, $_REQUEST, etc. are what's known as super-globals. They are special PHP variables that are available everywhere and are based on the current request PHP so even if the function is in a different file as long as it is the same request they'll be populated … | |
Re: You don't need a loop. [code=php] if (!in_array($fileExt, array('doc', 'docx', 'pdf'))) { // your stuff [/code] | |
Re: [QUOTE=FeralReason;893264]I got a copy from my local library. If yours does not have it, they can likely order it from some other library. Amazon has it online. However, there are SO many books in this category (good and bad) that I prefer using them a bit before I actually buy … | |
Re: Well as I was always taught in my A+ certification class, a keyboard is known as an FRU (field replaceable unit) which is a fancy name for, its cheap buy a new one/old one. Unless you want a fancy-pants infared keyboard you can buy one for under 20 bucks so … | |
Re: [code=html]<td id="first">[/code] V [code=html]<td class="first">[/code] | |
Re: You have the object inside a <noscript> block so it's not being rendered if you have javascript enabled. | |
Re: Don't combine logic like that into one giant `if`. Here's a quick example. [code=php] <?php $fields = array('Flavours', 'Sizes', 'Product_Name'); $errors = array(); foreach ($fields as $field) { if (!isset($_POST[$field])) { $errors[] = 'Missing required field ' . $field; continue; } if (!strlen(trim($_POST[$field]))) { $errors[] = $field . ' cannot … |
The End.