Posts Tagged perl script

MediaWiki: Creating a Private Wiki

MediaWiki is the software behind Wikipedia, but you can use it to create your own special-purpose sites. I've used it at work to build an internal company knowledge base, and I'm using it at home to make a Wiki for the fictional world of a roleplaying game I'm in.

It's a pretty polished software package, but out of the box it tends to assume that you are creating something like Wikipedia that is visible to (and editable by) the whole wide world. If that's not what you want, it requires some tuning, which I'll describe in detail after the jump.

Read the rest of this entry »

Tags: , ,

I Was Told There Would Be No Math

The so-called "impossible puzzle" (also known as the "sum and product" puzzle) has been kicking around since 1969. It isn't actually all that hard, but the statement of the puzzle can make it seem intractable when first encountered:

Consider a pair of integers X and Y such that 1 < X < Y and X+Y < 100.
P and S are mathematicians, who know the above constraints and who won't deliberately lie.

In secret, P is told only the product X*Y and S is told only the sum X+Y.

P: "I can't find the numbers."
S: "I knew you couldn't."
P: "Then I know the numbers."
S: "Then I do, too."

Find X and Y.

Note that there are spoilers after the jump. Please read no further should you wish to attempt a solution on your own.

Read the rest of this entry »

Tags: ,

Finding files with identical contents

Need to search a filesystem for all the files which have identical contents? Read on for a Perl script that does that.

Note that this isn't just a solution to the (much simpler) problem of finding files in different directories which have the same name; I'm talking about the actual data inside the file being duplicated. This script also works reasonably efficiently, so it's still useful in cases where you have an extremely large number of files and/or the files in question are very large.

Read the rest of this entry »

Tags: ,