Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
more useful options
 
PerlMonks

tye

by tye (Archbishop)
 | Log in | Create a new user | The Monastery Gates | Super Search | 
 | Seekers of Perl Wisdom | Meditations | PerlMonks Discussion | 
 | Obfuscation | Reviews | Cool Uses For Perl | Perl News | Q&A | Tutorials | 
 | Poetry | Recent Threads | Newest Nodes | Donate | What's New | 

on Jul 14, 2000 at 22:45 UTC ( #22609=user: print w/ replies, xml ) Need Help??

This node contains no javas‎crip‎t.

Current favorite CSS hacks for user settings:

auto-sizing text areas
textarea { width: 100% }
bland signatures
div.pmsig, div.pmsig td, div.pmsig font { color: black; background-color: white; font-size: 10px; font-family: serif; }


Some people treat computers like refrigerators in that they don't want to bother replacing them more than once a decade. Others treat them like fridges in that they think you are unclean if you have anything in one that is older than a few weeks.


Why Perl5's dereferencing is better than Perl6's:
#34370 +(6)- [X]
<tye> and deref'ing is easy to remember because robots, ->[ , use simple integer indices while samuri, ->{ , have names for everything, and aliens, ->( , use functional programming

<Petruchio> From what I can tell, people get along better when they simply show that they're willing to waste time on each other.


For all your nodelette sorrow.

Ever have one of those days when the Monastery pages just won't come up if you are logged in but everything seems fine if you aren't logged in?

Well, one of the things that changes based on whether you are logged in is which nodelettes you see. Some of the nodelets are pretty fancy. A while ago, the CPAN nodelet would sometimes refuse to finish, which prevents any of the page from rendering. Just recently, the Everything nodelet had a similar problem. The solution is to turn off those nodelets but that leads to a chicken-and-egg problem. Until now!

You'll need to bookmark the links in the next paragraph because I can't make a link to my homenode that doesn't display nodelets. The following links are special because they specify "&displaytype=raw", which turns off nodelets. Unfortunately, this option doesn't work for regular nodes nor homenodes. Luckilly, it works for the login screen and the user settings page:

If you aren't logged in, then go login first. Once you are logged in, go to your user settings and turn off any nodelets that you think might be the source of your problems.


Possible patch for usergroup display page:

my $str= "<TABLE>\n"; foreach (@$ref){ my $N = selectNode $_; $str .= "<TR><TD>" . linkNode($N) . "</TD><TD>(last here " . parsetime(lasttime) . " <I>(" . timesince($$NODE{lasttime}) . ")</I></TD></TR>\n"; } $str . "</TABLE>;
keys%{{@list,reverse@list}}
package Semaphore::SmokeSignals; use strict; use vars qw( $VERSION @EXPORT_OK ); BEGIN { $VERSION= 0.001_001; @EXPORT_OK= qw( LightUp ); require IO::Handle; require Exporter; *import= \&Exporter::import; if( eval { require bytes; 1 } ) { bytes->import(); } } sub _smoke { 0 } sub _stoke { 1 } sub _bytes { 2 } sub _puffs { 3 } sub LightUp { return __PACKAGE__->Ignite( @_ ); } sub Ignite { my( $class, @fuel )= @_; $class ||= __PACKAGE__; @fuel= 1 if ! @fuel; my $bytes= length $fuel[0]; my $smoke= IO::Handle->new(); my $stoke= IO::Handle->new(); pipe( $smoke, $stoke ) or _croak( "Can't ignite pipe: $!\n" ); binmode $smoke; binmode $stoke; my $me= bless [], $class; $me->[_smoke]= $smoke; $me->[_stoke]= $stoke; $me->[_bytes]= $bytes; $me->[_puffs]= 0 + @fuel; for my $puff ( @fuel ) { $me->_Stoke( $puff ); } return $me; } sub _MagicDragon { return __PACKAGE__ . '::Puff'; } sub Puff { my( $me )= @_; return $me->_MagicDragon()->Inhale( $me ); } sub _Bogart { my( $me )= @_; my( $smoke )= $me->[_smoke]; my $puff; sysread( $smoke, $puff, 1 ) or die "Can't toke pipe: $!\n"; return $puff; } sub _Stoke { my( $me, $puff )= @_; my $stoke= $me->[_stoke]; my $bytes= $me->[_bytes]; if( $bytes != length $puff ) { _croak( "Tokin ($puff) is ", length($puff), " bytes, not $byte +s!" ); } syswrite( $stoke, $puff ) or die "Can't stoke pipe: $!\n"; } sub Extinguish { my( $me )= @_; for my $puffs ( $me->[_puffs] ) { while( $puffs ) { $me->_Bogart(); --$puffs; } } close $me->[_stoke]; close $me->[_smoke]; } sub _croak { require Carp; Carp::croak( @_ ); } package Semaphore::SmokeSignals::Puff; sub Inhale { my( $class, $pipe )= @_; my $puff= $pipe->_Bogart(); return bless [ $pipe, $puff ], $class; } sub Sniff { my( $me )= @_; return $me->[1]; } sub Exhale { my( $me )= @_; return if ! @$me; my( $pipe, $puff )= splice @$me; $pipe->_Stoke( $puff ); } sub DESTROY { my( $me )= @_; $me->Exhale(); } 1; __END__ =head1 NAME Semaphore::SmokeSignals - A mutex and an LRU from crack pipe technolog +y =head1 SYNOPSIS use Semaphore::SmokeSignals qw( LightUp ); BEGIN { my $pipe= LightUp(); sub threadSafe { my $puff= $pipe->Puff(); # Only one thread will run this code at a time! } } =head1 DES‎CRIP‎TION A friend couldn't get APR::ThreadMutex to work so I offered to roll my + own mutual exclusion code when, *bong*, I realized this would be trivial t +o do with a simple pipe. It is easiest to use as a very simple mutex (see Synopsis above). You can also use this as a semaphore on a relatively small number of r +elatively small tokins (each tokin must be the same number of bytes and the tota +l number of bytes should be less than your system buffer size or else th +ings will hang). It also happens to give out tokins in LRU order (least recently used). To use it as a semaphore / LRU: BEGIN { my $bong= LightUp( 0..9 ); my @pool; sub sharesResource { my $dragon= $bong->Puff(); # Only 10 threads at once can run this code! my $puff= $dragon->Sniff(); # $puff is 0..9 and is unique among the threads here now Do_exclusive_stuff_with( $pool[$puff] ); if( ... ) { $dragon->Exhale(); # Return our tokin prematurely die ExpensivePostMortem(); } } sub stowParaphenalia { # Calling all magic dragons; waiting for them to exhale: $bong->Extinguish(); ... } } =head1 PLANS A future version will allow for non-blocking checking as to whether th +ere are any tokins currently available and for setting a maximum wait time. A future version will allow for using a named pipe to make it easy for + several processes to share one pipe. =head1 CONTRIBUTORS Author: Tye McQueen, http://perlmonks.org/?node=tye =cut

Login:
Password
remember me
What's my password?
Create A New User

Community Ads
Chatterbox
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users
Others imbibing at the Monastery: (8)
GrandFather
wfsp
FunkyMonk
atcroft
herveus
Spooty
Eyck
gnosti
As of 2009-11-21 09:10 GMT
Sections
The Monastery Gates
Seekers of Perl Wisdom
Meditations
PerlMonks Discussion
Categorized Q&A
Tutorials
Obfuscated Code
Perl Poetry
Cool Uses for Perl
Perl News
Information
PerlMonks FAQ
Guide to the Monastery
What's New at PerlMonks
Voting/Experience System
Tutorials
Reviews
Library
Perl FAQs
Other Info Sources
Find Nodes
Nodes You Wrote
Super Search
List Nodes By Users
Newest Nodes
Recently Active Threads
Selected Best Nodes
Best Nodes
Worst Nodes
Saints in our Book
Leftovers
The St. Larry Wall Shrine
Offering Plate
Awards
Craft
Snippets Section
Code Catacombs
Quests
Editor Requests
Buy PerlMonks Gear
PerlMonks Merchandise
Planet Perl
Perlsphere
Use Perl
Perl.com
Perl 5 Wiki
Perl Jobs
Perl Mongers
Perl Directory
Perl documentation
CPAN
Random Node
Voting Booth

Future historians will find that the material characteristic of the current era is...

Aluminium
Plastic
Oil
Water
Carbon dioxide
Copper
Iron
Silicon
Salt
Uranium
Hydrogen
Other

Results (729 votes), past polls