AVS Forum has a nice thread dedicated to the Marantz SR8500 Receiver. The linked page contains information which is either not included or that I was otherwise unable to locate in the manual for this receiver (and I've read every word of that forsaken thing) -- how to change the A and B speaker selectors via the universal remote control that comes with the unit.
Press AMP and then the 6 button.
Now, only if I could find the original universal remote control...
In PHP, there is an alternative if-statement syntax. I didn't find it listed on the PHP.net control-structures documentation. It goes like this:
<?php
if (!function_exists('ptrfun'):
/**
* This isn't the real ptrfun() function like you would find in C. This is
* just a poorly named and subsequently rather stupid example function.
*
* @return int
*/
function ptrfun() {
// Return the integer which represents what the future unix-timestamp will
// be one minute from now.
return mktime() + 60;
}
endif;
?>
Okay. The above example seems horrid, confusing, and overcomplicated. Here is the 'real' example with less chatter:
<?php
if (...):
// {Whatever code you want goes in here}.
endif;
?>
**This note was added for my own personal reference.**
This comment at php.net contains a valuable piece of wisdom:
If you need to compare a variable with a value, instead of doing: <?php if ($foo == 3) bar(); ?> do: <?php if (3 == $foo) bar(); ?> This way, if/when you forget the second equals sign (=), the statement will become: <?php if (3 = $foo) bar(); ?> and PHP will evaluate the statement and report an error.
Howto: Coax a BASH shell script into splitting for-loop elements by newline instead of whitespace (whitespace is the default behaviour).
#!/bin/bash IFS_BAK=$IFS IFS=" " for f in `ls -1 .`; do echo "I found a directory! => $d" done IFS=$IFS_BAK IFS_BAK=
This is really being posted for future reference by me, as I seem to keep forgetting that the "magic" variable name is IFS and not EOL.
Keywords: IFS, EOL, end of line, for-loop, newline, end-of-line,
Today my buddy showed me Prado, a PHP framework I don't think I've seen before. I'll report back on what I think of it once I've checked it out and formed an opinion on the matter. (;
One-liners for randomizing the order of lines in a file:
Using only the Bash command line:
cat dead.letter | while read -r line; do echo "$RANDOM $line"; done | sed 's/^/0000/' | sed 's/^0*\([0-9]\{5\}[ ].*$\)/\1/' | sort | sed -r 's/^[0-9]+ //'
Using Perl:
perl -e '$filename="dead.letter";use List::Util "shuffle";open FILE,"<$filename" or die("unable to open $filename for reading\n");print shuffle();'
Even shorter with Perl:
cat dead.letter | perl -e '@a=<>;while(@a){print splice(@a,rand(@a),1)}'
Interesting Article:
"Making Wrong Code Look Wrong"
By Joel Spolsky
Every article I have ever read by Joel Spolsky has been an excellent read. Thank you Joel!!