1,038 Posted Topics

Member Avatar for ShawnCplus

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++] …

Member Avatar for arkoenig
0
232
Member Avatar for serkan sendur

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 …

Member Avatar for bertyhell
0
52K
Member Avatar for nathenastle

[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 …

Member Avatar for red_ruewei
0
344
Member Avatar for jakesee

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

Member Avatar for Setvir
-1
479
Member Avatar for cluelessguy

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.

Member Avatar for prerna21
0
344
Member Avatar for ShawnCplus

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 …

Member Avatar for TonyAR
0
733
Member Avatar for mickeymoose

[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 …

Member Avatar for looxlmc
0
411
Member Avatar for nick3592

No, they can't. That's all stored on the server. Either in the DB or on the filesystem depending on your settings.

Member Avatar for karuppasamy
0
114
Member Avatar for knight fyre

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.

Member Avatar for helioptra
0
274
Member Avatar for jnthsler

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.

Member Avatar for LisaM2004
0
122
Member Avatar for OurNation

Gesticulating slimy octopi throw crustaceans across a purple-sploched reef, all chaotically driven by climactic storms.

Member Avatar for torham
0
14K
Member Avatar for demodav

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]

Member Avatar for scaiferw
0
278
Member Avatar for Chad Gary
Member Avatar for hinde

[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.

Member Avatar for SKANK!!!!!
0
2K
Member Avatar for mrjoli021

it means your query failed. use mysqli_error to figure out what went wrong.

Member Avatar for ShawnCplus
0
107
Member Avatar for A_Dubbs

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 …

Member Avatar for delpi767
-2
121
Member Avatar for Venom Rush
Member Avatar for gamestoenjoy

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.

Member Avatar for rajarajan2017
0
83
Member Avatar for bsewell

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)?

Member Avatar for rajarajan2017
0
236
Member Avatar for Mestika

Try looking for ajax calls on timers (settimeout, etc.). Loop is a bad way to describe what you want to do

Member Avatar for ShawnCplus
0
85
Member Avatar for mission_PHP

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]

Member Avatar for mission_PHP
0
182
Member Avatar for D4n1sD

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.

Member Avatar for Tekkno
0
148
Member Avatar for 3pmSunday

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.

Member Avatar for jas11
0
102
Member Avatar for chakde
Member Avatar for Exploded Fiber

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

Member Avatar for Exploded Fiber
0
145
Member Avatar for William Hemsworth

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

Member Avatar for vivosmith
2
425
Member Avatar for faizal4cool

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>

Member Avatar for ShawnCplus
0
112
Member Avatar for Cap'nKirk

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]

Member Avatar for Cap'nKirk
0
144
Member Avatar for Morty222

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 …

Member Avatar for ShawnCplus
0
98
Member Avatar for Stefano Mtangoo

[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). …

Member Avatar for phyrtech
0
121
Member Avatar for Phil++
Re: MD5

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 …

Member Avatar for diafol
0
91
Member Avatar for cwarn23

What you're looking to get is the hostname, not the IP. [url]http://us.php.net/manual/en/function.gethostbyaddr.php[/url]

Member Avatar for kvprajapati
0
2K
Member Avatar for cwarn23

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 …

Member Avatar for cwarn23
0
111
Member Avatar for Kitten84

[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]

Member Avatar for Kitten84
0
2K
Member Avatar for Venom Rush

(GD) You'll want a combination of [url]http://php.net/imagecopymerge[/url], [icode]imagecreatefrom<type>[/icode], and [url]php.net://imagefilter[/url]

Member Avatar for ShawnCplus
0
81
Member Avatar for elijahmangwe

What is your question exactly? Pasting a homework assignment isn't a question.

Member Avatar for ShawnCplus
0
53
Member Avatar for muralibobby2015

[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 …

Member Avatar for ShawnCplus
0
123
Member Avatar for sDJh

[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]

Member Avatar for ShawnCplus
0
174
Member Avatar for nigelburrell
Member Avatar for ripraw
0
1K
Member Avatar for xylude

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'); …

Member Avatar for xylude
0
83
Member Avatar for kevindougans

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 …

Member Avatar for pbcomput
3
206
Member Avatar for manikandan_dani
Member Avatar for mairtinomarta

If you have to change the ID of an element you're probably doing something else wrong.

Member Avatar for mairtinomarta
0
158
Member Avatar for ElegantElephant

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 …

Member Avatar for ElegantElephant
0
132
Member Avatar for ElegantElephant

You don't need a loop. [code=php] if (!in_array($fileExt, array('doc', 'docx', 'pdf'))) { // your stuff [/code]

Member Avatar for ElegantElephant
0
97
Member Avatar for samaru

[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 …

Member Avatar for berniestein2001
0
639
Member Avatar for Paladine

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 …

Member Avatar for Pointman
0
854
Member Avatar for ndeniche
Member Avatar for kewp
0
317
Member Avatar for jaydee123

You have the object inside a <noscript> block so it's not being rendered if you have javascript enabled.

Member Avatar for ShawnCplus
0
104
Member Avatar for peck3277

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 …

Member Avatar for harshbavaliya
0
102

The End.