How to speed up MongoDB Inserts/sec?

Writes to MongoDB currently aquire a global write lock, although collection level locking is hopefully coming soon. By using more threads you’re likely introducing more concurrency problems as the threads block eachother while they wait for the lock to be released. Indexes will also slow you down, to get the best insert performance it’s ideal … Read more

Best IDE for Perl 5 [closed]

“Best” is, of course, a matter of taste. Rather than “best”, I’ll answer this as “what editor should I use for Perl if I don’t already have a strong preference for an editor?” I went on a short quest to answer this question for my students. What I recommend now is Atom. It’s free, open … Read more

Variable length look-behind

Use \K as a special case. It’s a variable length positive lookbehind assertion: /eat_(?:apple|pear|orange)_\Ktoday|yesterday/g Alternatively, you can list out your lookbehind assertions separately: /(?:(?<=eat_apple_)|(?<=eat_pear_)|(?<=eat_orange_))today|yesterday/g However, I would propose that it’s going to be a rare problem that could potentially use that feature, but couldn’t be rethought to use a combination of other more common regex … Read more

How do I get a slice from an array reference?

To get a slice starting with an array reference, replace the array name with a block containing the array reference. I’ve used whitespace to spread out the parts, but it’s still the same thing: my @slice = @ array [1,3,2]; my @slice = @ { $aref } [1,3,2]; If the reference inside the block is … Read more

perl $|=1; What is this?

perlvar is your friend. It documents all these cryptic special variables. $OUTPUT_AUTOFLUSH (aka $|): If set to nonzero, forces a flush right away and after every write or print on the currently selected output channel. Default is 0 (regardless of whether the channel is really buffered by the system or not; $| tells you only … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)