Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

post bits of code you like

Name: Anonymous 2005-08-02 1:52

i shall start:

open(F,"find -type f|");
while (<F>) {
 $_ = substr($_,2,-1);
 print "$_\n" if $v;
 push @{$dups{substr(`md5sum -b "$_"`,0,31)}}, $_;
}
close(F);

for every file in a directory it checksums the file, then adds the checksum as a key to a hash, the value being an array reference. the filename is then added to the array.

so basically the arrays have a list of files with the same checksum. i use this to find duplicates files.

Name: Anonymous 2006-04-25 12:10

>>169
Oh, yes, I understand. Magic quotes and register globals are pure evil and should be wiped from the face of Earth. For a standard DB interface I like ADODB Lite. It's fast and supports lots of DBs. You don't really need these crazy things except in very exceptional cases and there's always a workaround for them. I'll also add that some things like lambda functions are uncomfortable in PHP, but I think it's overall good for web hacks, web applications (as long as you don't write messy code, but that's a problem of most languages), and system scripts.

PHP has a bad name because it's easy to get started with it, and noobs get started and write really terrible code. A good programmer at Perl or Python would write good, maintainable code at PHP.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List