Oh how I love linux... perl... scriptability. I have a fun little command line music player named [Polly]. It is pretty minimalist, really just starting whatever player I like with whatever preferences I like on a whole directory tree of files. One thing that is annoying is that I have to switch over to the terminal and it ^Z to pause and then do 'fg' to play.
So I finally decided to write a simple pause toggle script. I approached this in the most brute force way I could... I just take the list of all my media players and send a massive STOP (effectively ^Z) command to all to pause, and then a massive CONT (effectively 'fg') to all to continue. To determine if I want to pause or continue, I just look to see if I have any paused player processes.
my @commands = qw( ogg123 mpg123 mplayer vlc sidplay2 );
my $cmd = join '\|', @commands;
if(`ps a -o state,cmd | grep '$cmd' | grep ^T`) {
map { `killall -SIGCONT $_ 2>/dev/null` } @commands;
} else {
map { `killall -SIGSTOP $_ 2>/dev/null` } @commands;
}Scott linked an article from new scientist, Memories may be stored on your DNA, which relates with what has been on my mind lately.
I was reading about some hardware evolution experiments while at the bookstore the other day. They were using a FPGA to create (evolve) a sine wave generator, if I recall correctly. The end result of the first run worked perfectly, but had some bizzare attributes -- it programmed a section of the gate array but didn't wire that section to the rest. When the unconnected section was turned off, the circut no longer worked. It also didn't work when the same design was put onto an identical FPGA. As far as the experimenters could tell, the evolved solution depended upon some subtle property of that specific FPGA chip.
In other words: GP solutions cheat like hell.
They will use absolutely any available subtle or side-effect aspects of environmental conditions to push themselves to the next rung on the fitness ladder. An important lesson that I've taken from GP is that artificial / automatic program generation mostly results in programs that make almost no sense from a human programmer perspective, at least partly because of all this cheating. The solutions produced by GP are mostly twisted convoluted things which mostly don't look like they work at all, let alone solve anything.
When a human abstracts things, it ends up taking a much more layered structure, with the meat of the problem usually ending up on the highest layer. Automatic techniques do not succumb to such niceties.
Speaking of human abstraction, I recently stumbled upon the Discordia page of Mark-Jason Dominus which makes a keen observation with fascinating attributes - "In a well-designed computer program, No two components are alike, or even similar." Conceptually, that is, all similar aspects of a program are abstracted. Good programs are themselves not like the beautiful fractals of recursion that lay in the mind of their creator or the algorithms that they represent. You could perhaps think of them as the compressed version -- the most informationally dense form of the logic, information theory might say.
Now take it full circle... from the biological inspired computation back to biology. Biological evolution cheats just like artificial evolution does. At first glance we see all this lovely DNA-level abstraction... but as they dig in they find all sorts of trickery that operates on all levels low and high. Like throwing in some assembly (or even better, some binary executable blobs) into the middle of my blog software. The re-use of DNA (or perhaps the coating on DNA was it?) as memory storage in the brain is completely typical.
If the designers were indeed intelligent, they sure didn't plan on doing any maintenance.
It's been over 4 hours since Android was released... but still no port to the Neo. Pft.
At the last minute I ended up giving a Lightning talk at OSCON 2008 (in the Perl track). I showed my Devel::REPL + Continuity debugging tool.
Here are my notes:
Lightning Talk OSCON 2008
Brock Wilcox
awwaiid@thelackthereof.org
See also:
* Continuity
* Continuity::REPL
* Devel::REPL
* Carp::REPL
* PadWalker
# .... These were then run in the REPL ....
# counter.pl at:
# http://thelackthereof.org/projects/perl/Continuity-Monitor/eg/counter.pl
use PadWalker 'peek_my';
my $h = peek_my 23;
${ $h->{'$counter'} } = 77;
# Then...
sub new_prompt {
my ($request) = @_;
$request->print("Muahahaha!");
return old_prompt(@_);
}
*old_prompt = *prompt;
*prompt = *new_prompt;Some of my family came to visit this weekend, and we did a bunch of sight-seeing. Here are the distance estimates, this is definitely a lower-bound of the amount we walked. I tried to include walks that I know everyone did, and left off a bunch of random trips to the store. Distances are in miles.
TOTAL: 7.14
TOTAL: 3.6
TOTAL: 1.96
TOTAL: 4.2
GRAND TOTAL: 16.9 miles
I'm guessing that adding in more detail could easily add another mile or more. In the end I bet we walked about 20 miles in all. When you trade a car for your feet, make sure you have good shoes!
Comments on TLT - 2008.07.08 - Walkabout
great walkabout notes! --- btw, if in DC area and want a walking companion any time, don't hesitate to ping me (though I'm mostly into jogging) ... (confession: main purpose of this is to test the Comment Count feature) — ^z
-- Mark Zimmermann 2008-08-11 11:53 UTC
META INFORMATION: This is the technical blog and wiki of Brock Wilcox (awwaiid). Entries focus on my current projects, interests, and sometimes life events. If you'd like you can check out the list of All Entries or the RSS Feed. I also have a LiveJournal syndication feed for LJ friends.
2 Comments.
Thanks for adding links!
-- awwaiid 2009-06-13 04:00 UTC
You're very welcome. I hope that clears it up for future readers.
-- Mortal 2009-06-13 22:08 UTC
2 Add Comment