Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
tye's scratchpadby tye (Sage) |
on Jun 01, 2004 at 15:35 UTC ( [id://358135]=scratchpad: print w/replies, xml ) | Need Help?? |
Part of proving that Geo::Distance is lousy at what it claims to do:
Note that the parens around the && expression are optional. I refused to stand by and let my kids 'learn' that "elemeno" and "and" are two of the 24 letters of the English alphabet, as so many children 'learn' from the ubiquitous Alphabet Song. The transformation of the song is nearly trivial, using the exact same tune, and can be illustrated by drawing out the two versions, two characters per beat:
You simply delay "k" one beat and let the song flow naturally from there. Don't put up with a broken Alphabet Song any longer. One of my current "chat clients": (similar to fullpage chat)
Cool vi macro: @p runs Perl code between #! and __END__ lines on any text after the __END__, preserving the perl code. The "let" command to set @p only works in vim, but the macro (drop the quotes and replace \r with ^V^M -- probably by typing ^V^V^V^M) works in any reasonable vi-alike. L goes to the bottom of the current screen so that the next bit is unlikely to fail (which would halt the macro); ?^#! searches for the first line of the 'script'; /^__END__ searches for the end of what needs to be pasted because it won't be output when perl is run; y'' yanks from the __END__ through the #! line; '' jumps back to the __END__; p pastes the perl code (so the original copy above can remain in the editor buffer); !Gperl runs the bottom of the file (the freshly pasted Perl code and the text to be filtered). G goes to the bottom of the results after filtering. For example, when processing error logs (which are usually too verbose for any one task), I'll trim the log repeatedly, often reusing parts of saved trimming code (in part because I prefer Perl regexes). Part of the value of this method is if I get such code wrong, I can just "u" (undo), adjust the code, and try again. (But I also often have filters that makes sense to apply more than once.)
An improved win32_socket() for perl/win32/win32sck.c:
"End View" puzzle (courtesy Games magazine): Each row / column must contain A, B, and C exactly once (and some blanks). Hints around the outside indicate the closest letter in that row or column.
produces: but only within PerlMonk's mod_perl.
Win32's ideas about "Latin-1": C=(€) ,(‚) f(ƒ) ,,(„) ...(…) +(†) ++(‡) ^(ˆ) %(‰) S(Š) <(‹) CE(Œ) Z(Ž) '(‘) '(’) ``(“) ''(”) *(•) -(–) --(—) ~(˜) tm(™) s(š) >(›) ce(œ) z(ž) Y(Ÿ)
"The only words that end in 'illy' are silly":
egrep "ill?y$" Enable1.txt | perl -pe "s/ll?y$/l/" | xargs perl -ne "BEGIN {$r= join '|', @ARGV; @ARGV= 'Enable1.txt'} print if /^($r)$/" | xargs perl -ne "BEGIN{$r= join '|', @ARGV; @ARGV= 'Enable1.txt'} print if /^($r)/" | grep "ly$" I hate the amount of work required to build ad-hoc strings in C++. Here is what I think is a cool idea but it appears that MS VC++ is not up to the challenge: which would be used like: Problems that MS VC++ has with this:
Anyway, perhaps someone else will find it useful.
Untested. ):
Simpler Fletcher's Checksum in Perl:
░ ░░░░░░░░░ ░ ░ ░░░ ░ ░░░░░░░░░░░░░░░░░░░ ░ ░!░"░#░$░%░&░'░(░)░*░+░,░-░.░/░0░1░2░3░4░5░6░7░8░9░:░;░<░=░>░?░ ░@░A░B░C░D░E░F░G░H░I░J░K░L░M░N░O░P░Q░R░S░T░U░V░W░X░Y░Z░[░\░]░^░_░ ░`░a░b░c░d░e░f░g░h░i░j░k░l░m░n░o░p░q░r░s░t░u░v░w░x░y░z░{░|░}░~░░ ░€░?░‚░ƒ░„░…░†░‡░ˆ░‰░Š░‹░Œ░?░Ž░?░?░‘░’░“░”░•░–░—░˜░™░š░›░œ░?░ž░Ÿ░ ░ ░¡░¢░£░¤░¥░¦░§░¨░©░ª░«░¬░░®░¯░°░±░²░³░´░µ░¶░·░¸░¹░º░»░¼░½░¾░¿░ ░À░Á░Â░Ã░Ä░Å░Æ░Ç░È░É░Ê░Ë░Ì░Í░Î░Ï░Ð░Ñ░Ò░Ó░Ô░Õ░Ö░×░Ø░Ù░Ú░Û░Ü░Ý░Þ░ß░ ░à░á░â░ã░ä░å░æ░ç░è░é░ê░ë░ì░í░î░ï░ð░ñ░ò░ó░ô░õ░ö░÷░ø░ù░ú░û░ü░ý░þ░ÿ░root? Way too big!Still too big!Still too big?Not too big?Surely, not too bigIs this even big?_______ Partners feed the community ( ( ) ( ) ) (___(_______) | |\ V /| | Software supports the @ @ \ / @ @ transformation of the audience | | | | +-------+ +-----------+ |Partner| +-------+ | Active | +-------+ +-------+ |Regular| |participant| | +---------+ |Visitor| | user | +-----------+ Colaberation |Potential| +-------+ +-------+ Communication tools |audience | Accessibility Usability tools | +---------+ design design | | +----------------------------------------------------------------+ | Community portal | +----------------------------------------------------------------+ Content Portal Portal Security & management management plug-in SW connectivity tools tools design tools tools +---------+ +----------+ +------+ | Content |_Collaberation_| Portal |__Collaberation__| Site | |providers| tools |management| tools |admins| +---------+ | team | +------+ +----------+ Data Collaberation Content is at management tools the root of tools +----------+ the software +-------+ | Portal | |Content| | software | Purpose is at +-------+ |developers| A tree the root of +----------+ grows in the content codelandbased on graphic (cc) by Jeff Zucker, jZed the estatat mantra: It is by will alone I set your things in motion. It is by the signature that wills acquire legitimacy, the fingers acquire stains, the stains become an eyesore. It is by will alone I set your things in motion.
|
|