[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Catching all that goes to $stderr

Pavel Smerk

7/28/2006 3:21:00 AM

Hello,

how can I catch all output going to $stderr (e.g. to send some warning
emails time to time in case of daemon etc.)?

Thanks,

P.
6 Answers

Sean O'Halpin

7/28/2006 2:18:00 PM

0

On 7/28/06, Pavel Smerk <smerk@fi.muni.cz> wrote:
> Hello,
>
> how can I catch all output going to $stderr (e.g. to send some warning
> emails time to time in case of daemon etc.)?
>
> Thanks,
>
> P.
>
>
Something like this?

ioproxy = STDERR.dup

def ioproxy.write(*args, &block)
p args
#STDERR.write(*args, &block) # if you want to pass it on to real STDERR
end

$stderr = ioproxy
puts "hello"
$stderr.puts "error!"
puts "world"
warn "oops!"

__END__
hello
["error!"]
["\n"]
world
["oops!"]
["\n"]

The newlines are because puts prints its args + newline. You could
easily filter that in the write method.

Regards,
Sean

Stile4aly

8/14/2010 2:20:00 AM

0

On Aug 13, 7:57 am, "vict0r" <l...@oocom.netb> wrote:
> Harry Hope wrote:
> >http://www.politico.com/news/stories/0810/...
>
> > 8/13/10
>
> > GOP flirting with disaster on Latinos
>
> > By JANET MURGUIA
>
> > The National Council of La Raza honored Sen. Lindsey Graham (R-S.C.)
> > in 2007 for his work on immigration.
>
> > "We are going to solve this [immigration] problem," Graham said that
> > night.
>
> > "We're not going to run people down. We're not going to scapegoat
> > people. We're going to tell the bigots to shut up, and we're going to
> > get this right."
>
> > Now, Graham talks about immigrant women giving birth in the United
> > States as a "drop and leave" calculation - as if describing animals.
>
> > This is the surest sign yet that the Republican Party has written off
> > the Latino community in the midterm elections.
> > ............................................................................ ..................................
>
> > The Numbers:
>
> > Latinos are the youngest and fastest-growing group of voters in the
> > country.
>
> > What does that mean?
>
> > In 1994, 3.5 million Latinos went to the polls.
>
> > By 2008, that number was 10 million.
>
> > There are still nearly 8 million Latinos who are eligible but have not
> > yet registered to vote.
>
> > Moreover, a half-million young Latino citizens will turn 18 every year
> > for the next 20 years, according to Democracia U.S.A.
>
> > This Latino vote has already been credited with turning several red
> > states blue, or at least purple.
>
> > Yet, because of increasingly anti-Latino positioning, the Republican
> > Party has been hemorrhaging Latino support since 2004.
>
> > That was the high-water mark - when President George W. Bush won 43
> > percent of the Latino vote.
>
> > Sen. John McCain (R-Ariz.) received just 30 percent in 2008.
>
> > A recent survey by the National Association of Latino Elected and
> > Appointed Officials shows support for this year's California
> > Republican candidates for senator and governor is in the teens.
>
> > ............................................................................ ............................................
>
> > On immigration, Republicans are choosing to trade sound national
> > policy for cheap political points.
>
> > Yet they are sacrificing more than that.
>
> > If they continue, they are likely to receive little support from
> > Latinos not just this year but for many elections to come.
>
> > Rather than trying to win hearts and minds, Republicans have chosen to
> > scapegoat the Latino community in hopes of energizing their base.
>
> > The real question is whether the GOP realizes the cost of its actions.
> > The party is mortgaging its future.
>
> > Republicans' tunnel-vision focus on 2010 could mean they're flirting
> > with permanent minority status.
> > ________________________________________________________
>
> > It's nice to hear the sound of RePIGs committing suicide.
>
> > Harry
>
> To curb criminal activity by aliens, to defend against acts of international
> terrorism, to protect American workers from unfair labor competition,
> and to relieve pressure on public services by strengthening border security
> and stabilizing immigration into the United States.
>
> IN THE SENATE OF THE UNITED STATES AUGUST 4 (legislative day, JUNE 30), 1993
>
> Mr. HARRY REID introduced the following bill; which was read twice and
> referred to the Committee on the Judiciary
>
> TITLE X-CITIZENSHIP 4 SEC. 1001. BASIS OF CITIZENSHIP CLARIFIED. In the
> exercise of its powers under section of the Fourteenth Article of Amendment
> to the Constitution of the United States, the Congress has determined and
> hereby declares that any person born after the date of enactment of this
> title to a mother who is neither a citizen of the United States nor admitted
> to the United States as a lawful permanent resident, and which person is a
> national or citizen of another country of which either of his or her natural
> parents is a national or citizen, or is entitled upon application to become
> a national or citizen of such country, shall be considered as born subject
> to the jurisdiction of that foreign country and not subject to the
> jurisdiction of the United States within the meaning of section 1 of such
> Article and shall therefore not be a citizen of the United States or of any
> State solely by reason of physical presence within the United States at the
> moment of birth.
>
> http://frwebgate.access.gpo.gov/cgi-bin/getdoc.cgi?dbname=1......
>
> ---
>
> Translation:  Harry Reid wanted to end birthright citizenship.
>
> You were saying?

http://voices.washingtonpost.com/plum-line/2010/08/yes_reid_tried_to_end_bir...

"Guess what: It happens to be true that Reid did introduce such a
bill. And it was indefensible. But here's the thing: I've learned that
Reid already apologized profusely for this in a speech in 2006,
admitted he was wrong, and described this as the "low point" of his
career. In other words, Reid himself agrees that it was indefensible."

and

"That is a low point of my legislative career, the low point of my
governmental career," Reid said. He went on to tell the assembled
Senators that his wife had chastized him for the move. "She, in
effect, said: I can't believe that you have done it," Reid recounted.
"But I had done it."

He was wrong then. He's admitted he was wrong. Republicans on the
other hand seem to prefer to be wrong.

Ramon F Herrera

8/14/2010 3:00:00 AM

0

On Aug 13, 9:57 am, "vict0r" <l...@oocom.netb> wrote:

> Translation:  Harry Reid wanted to end birthright citizenship.
>
> You were saying?

So?

Democrats were pro slavery.

Translation: they move from being BAD guys to being GOOD ones.

Dems evolve.

Repubs devolve.

-Ramon


Ramon F Herrera

8/14/2010 3:05:00 AM

0

On Aug 13, 9:20 pm, Stile4aly <stile4...@yahoo.com> wrote:
> On Aug 13, 7:57 am, "vict0r" <l...@oocom.netb> wrote:
>
>
>
> > Harry Hope wrote:
> > >http://www.politico.com/news/stories/0810/...
>
> > > 8/13/10
>
> > > GOP flirting with disaster on Latinos
>
> > > By JANET MURGUIA
>
> > > The National Council of La Raza honored Sen. Lindsey Graham (R-S.C.)
> > > in 2007 for his work on immigration.
>
> > > "We are going to solve this [immigration] problem," Graham said that
> > > night.
>
> > > "We're not going to run people down. We're not going to scapegoat
> > > people. We're going to tell the bigots to shut up, and we're going to
> > > get this right."
>
> > > Now, Graham talks about immigrant women giving birth in the United
> > > States as a "drop and leave" calculation - as if describing animals.
>
> > > This is the surest sign yet that the Republican Party has written off
> > > the Latino community in the midterm elections.
> > > ............................................................................ ..................................
>
> > > The Numbers:
>
> > > Latinos are the youngest and fastest-growing group of voters in the
> > > country.
>
> > > What does that mean?
>
> > > In 1994, 3.5 million Latinos went to the polls.
>
> > > By 2008, that number was 10 million.
>
> > > There are still nearly 8 million Latinos who are eligible but have not
> > > yet registered to vote.
>
> > > Moreover, a half-million young Latino citizens will turn 18 every year
> > > for the next 20 years, according to Democracia U.S.A.
>
> > > This Latino vote has already been credited with turning several red
> > > states blue, or at least purple.
>
> > > Yet, because of increasingly anti-Latino positioning, the Republican
> > > Party has been hemorrhaging Latino support since 2004.
>
> > > That was the high-water mark - when President George W. Bush won 43
> > > percent of the Latino vote.
>
> > > Sen. John McCain (R-Ariz.) received just 30 percent in 2008.
>
> > > A recent survey by the National Association of Latino Elected and
> > > Appointed Officials shows support for this year's California
> > > Republican candidates for senator and governor is in the teens.
>
> > > ............................................................................ ............................................
>
> > > On immigration, Republicans are choosing to trade sound national
> > > policy for cheap political points.
>
> > > Yet they are sacrificing more than that.
>
> > > If they continue, they are likely to receive little support from
> > > Latinos not just this year but for many elections to come.
>
> > > Rather than trying to win hearts and minds, Republicans have chosen to
> > > scapegoat the Latino community in hopes of energizing their base.
>
> > > The real question is whether the GOP realizes the cost of its actions.
> > > The party is mortgaging its future.
>
> > > Republicans' tunnel-vision focus on 2010 could mean they're flirting
> > > with permanent minority status.
> > > ________________________________________________________
>
> > > It's nice to hear the sound of RePIGs committing suicide.
>
> > > Harry
>
> > To curb criminal activity by aliens, to defend against acts of international
> > terrorism, to protect American workers from unfair labor competition,
> > and to relieve pressure on public services by strengthening border security
> > and stabilizing immigration into the United States.
>
> > IN THE SENATE OF THE UNITED STATES AUGUST 4 (legislative day, JUNE 30), 1993
>
> > Mr. HARRY REID introduced the following bill; which was read twice and
> > referred to the Committee on the Judiciary
>
> > TITLE X-CITIZENSHIP 4 SEC. 1001. BASIS OF CITIZENSHIP CLARIFIED. In the
> > exercise of its powers under section of the Fourteenth Article of Amendment
> > to the Constitution of the United States, the Congress has determined and
> > hereby declares that any person born after the date of enactment of this
> > title to a mother who is neither a citizen of the United States nor admitted
> > to the United States as a lawful permanent resident, and which person is a
> > national or citizen of another country of which either of his or her natural
> > parents is a national or citizen, or is entitled upon application to become
> > a national or citizen of such country, shall be considered as born subject
> > to the jurisdiction of that foreign country and not subject to the
> > jurisdiction of the United States within the meaning of section 1 of such
> > Article and shall therefore not be a citizen of the United States or of any
> > State solely by reason of physical presence within the United States at the
> > moment of birth.
>
> >http://frwebgate.access.gpo.gov/cgi-bin/getdoc.cgi?dbname=1.......
>
> > ---
>
> > Translation:  Harry Reid wanted to end birthright citizenship.
>
> > You were saying?
>
> http://voices.washingtonpost.com/plum-line/2010/08/yes_reid......
>
> "Guess what: It happens to be true that Reid did introduce such a
> bill. And it was indefensible. But here's the thing: I've learned that
> Reid already apologized profusely for this in a speech in 2006,
> admitted he was wrong, and described this as the "low point" of his
> career. In other words, Reid himself agrees that it was indefensible."
>
> and
>
> "That is a low point of my legislative career, the low point of my
> governmental career," Reid said. He went on to tell the assembled
> Senators that his wife had chastized him for the move. "She, in
> effect, said: I can't believe that you have done it," Reid recounted.
> "But I had done it."
>
> He was wrong then.  He's admitted he was wrong.

> Republicans on the other hand seem to prefer to be wrong.

"Armey said socially conservative Latino and African American voters
are natural constituents for the GOP — if Republicans don't push them
away.

"The party was born with the Emancipation Proclamation," he said. But
today, he added, "it can't get a black vote to save its life."

http://blogs.chron.com/txpotomac/2010/03/dick_armey_blasts_republic...

-Ramon

vict0r

8/14/2010 2:37:00 PM

0

Stile4aly wrote:
> On Aug 13, 7:57 am, "vict0r" <l...@oocom.netb> wrote:
>> Harry Hope wrote:
>>> http://www.politico.com/news/stories/0810/...
>>
>>> 8/13/10
>>
>>> GOP flirting with disaster on Latinos
>>
>>> By JANET MURGUIA
>>
>>> The National Council of La Raza honored Sen. Lindsey Graham (R-S.C.)
>>> in 2007 for his work on immigration.
>>
>>> "We are going to solve this [immigration] problem," Graham said that
>>> night.
>>
>>> "We're not going to run people down. We're not going to scapegoat
>>> people. We're going to tell the bigots to shut up, and we're going
>>> to
>>> get this right."
>>
>>> Now, Graham talks about immigrant women giving birth in the United
>>> States as a "drop and leave" calculation - as if describing animals.
>>
>>> This is the surest sign yet that the Republican Party has written
>>> off
>>> the Latino community in the midterm elections.
>>> ...........................................................................
>>> ..................................
>>
>>> The Numbers:
>>
>>> Latinos are the youngest and fastest-growing group of voters in the
>>> country.
>>
>>> What does that mean?
>>
>>> In 1994, 3.5 million Latinos went to the polls.
>>
>>> By 2008, that number was 10 million.
>>
>>> There are still nearly 8 million Latinos who are eligible but have
>>> not
>>> yet registered to vote.
>>
>>> Moreover, a half-million young Latino citizens will turn 18 every
>>> year
>>> for the next 20 years, according to Democracia U.S.A.
>>
>>> This Latino vote has already been credited with turning several red
>>> states blue, or at least purple.
>>
>>> Yet, because of increasingly anti-Latino positioning, the Republican
>>> Party has been hemorrhaging Latino support since 2004.
>>
>>> That was the high-water mark - when President George W. Bush won 43
>>> percent of the Latino vote.
>>
>>> Sen. John McCain (R-Ariz.) received just 30 percent in 2008.
>>
>>> A recent survey by the National Association of Latino Elected and
>>> Appointed Officials shows support for this year's California
>>> Republican candidates for senator and governor is in the teens.
>>
>>> ...........................................................................
>>> ............................................
>>
>>> On immigration, Republicans are choosing to trade sound national
>>> policy for cheap political points.
>>
>>> Yet they are sacrificing more than that.
>>
>>> If they continue, they are likely to receive little support from
>>> Latinos not just this year but for many elections to come.
>>
>>> Rather than trying to win hearts and minds, Republicans have chosen
>>> to
>>> scapegoat the Latino community in hopes of energizing their base.
>>
>>> The real question is whether the GOP realizes the cost of its
>>> actions.
>>> The party is mortgaging its future.
>>
>>> Republicans' tunnel-vision focus on 2010 could mean they're flirting
>>> with permanent minority status.
>>> ________________________________________________________
>>
>>> It's nice to hear the sound of RePIGs committing suicide.
>>
>>> Harry
>>
>> To curb criminal activity by aliens, to defend against acts of
>> international terrorism, to protect American workers from unfair
>> labor competition,
>> and to relieve pressure on public services by strengthening border
>> security and stabilizing immigration into the United States.
>>
>> IN THE SENATE OF THE UNITED STATES AUGUST 4 (legislative day, JUNE
>> 30), 1993
>>
>> Mr. HARRY REID introduced the following bill; which was read twice
>> and referred to the Committee on the Judiciary
>>
>> TITLE X-CITIZENSHIP 4 SEC. 1001. BASIS OF CITIZENSHIP CLARIFIED. In
>> the exercise of its powers under section of the Fourteenth Article
>> of Amendment to the Constitution of the United States, the Congress
>> has determined and hereby declares that any person born after the
>> date of enactment of this title to a mother who is neither a citizen
>> of the United States nor admitted to the United States as a lawful
>> permanent resident, and which person is a national or citizen of
>> another country of which either of his or her natural parents is a
>> national or citizen, or is entitled upon application to become a
>> national or citizen of such country, shall be considered as born
>> subject to the jurisdiction of that foreign country and not subject
>> to the jurisdiction of the United States within the meaning of
>> section 1 of such Article and shall therefore not be a citizen of
>> the United States or of any State solely by reason of physical
>> presence within the United States at the moment of birth.
>>
>> http://frwebgate.access.gpo.gov/cgi-bin/getdoc.cgi?dbname=1......
>>
>> ---
>>
>> Translation: Harry Reid wanted to end birthright citizenship.
>>
>> You were saying?
>
> http://voices.washingtonpost.com/plum-line/2010/08/yes_reid_tried_to_end_bir...
>
> "Guess what: It happens to be true that Reid did introduce such a
> bill. And it was indefensible. But here's the thing: I've learned that
> Reid already apologized profusely for this in a speech in 2006,

13 years later? Man he must have been all broken up about it. I'm sure it
had nothing to do with the hispanic population increasing dramatically
during that decade.

> admitted he was wrong, and described this as the "low point" of his
> career. In other words, Reid himself agrees that it was indefensible."
> and
>
> "That is a low point of my legislative career, the low point of my
> governmental career," Reid said. He went on to tell the assembled
> Senators that his wife had chastized him for the move. "She, in
> effect, said: I can't believe that you have done it," Reid recounted.
> "But I had done it."
>
> He was wrong then. He's admitted he was wrong. Republicans on the
> other hand seem to prefer to be wrong.

If you mean Lindsey Grahams idiocy, Graham is not a conservative, he's on
your side and you can have him (cap and tax, amnesty, voting for Kagan). He
only piped up about the 14th amendment because it would make him appear
tough on illegal immigration and make true conservatives look bad while he
knew it had no chance to go anywhere.

Harry Reid's anti "alien" bill was major legislation that he spent serious
time and deliberation creating, not some off the cuff remark designed to
give ammo to the media and the left (same thing) to attack the tea party.
The man was 54 years old when he wrote it. Did he not know his own beliefs
on illegal immigration by then? And 13 years passed before this uh, wave of
regret swept over him.

It seems more like his first position was the sincere one, then after
millions more illegals streamed in, he deferred to the political clout of
these persons who are citizens of a foreign nation. It is wrong on many
levels; none of which Harry has acknowledged or apologized for.




Stile4aly

8/14/2010 6:52:00 PM

0

On Aug 14, 7:36 am, "vict0r" <l...@oocom.netb> wrote:
> Stile4aly wrote:
> > On Aug 13, 7:57 am, "vict0r" <l...@oocom.netb> wrote:
> >> Harry Hope wrote:
> >>>http://www.politico.com/news/stories/0810/...
>
> >>> 8/13/10
>
> >>> GOP flirting with disaster on Latinos
>
> >>> By JANET MURGUIA
>
> >>> The National Council of La Raza honored Sen. Lindsey Graham (R-S.C.)
> >>> in 2007 for his work on immigration.
>
> >>> "We are going to solve this [immigration] problem," Graham said that
> >>> night.
>
> >>> "We're not going to run people down. We're not going to scapegoat
> >>> people. We're going to tell the bigots to shut up, and we're going
> >>> to
> >>> get this right."
>
> >>> Now, Graham talks about immigrant women giving birth in the United
> >>> States as a "drop and leave" calculation - as if describing animals.
>
> >>> This is the surest sign yet that the Republican Party has written
> >>> off
> >>> the Latino community in the midterm elections.
> >>> ............................................................................
> >>> ..................................
>
> >>> The Numbers:
>
> >>> Latinos are the youngest and fastest-growing group of voters in the
> >>> country.
>
> >>> What does that mean?
>
> >>> In 1994, 3.5 million Latinos went to the polls.
>
> >>> By 2008, that number was 10 million.
>
> >>> There are still nearly 8 million Latinos who are eligible but have
> >>> not
> >>> yet registered to vote.
>
> >>> Moreover, a half-million young Latino citizens will turn 18 every
> >>> year
> >>> for the next 20 years, according to Democracia U.S.A.
>
> >>> This Latino vote has already been credited with turning several red
> >>> states blue, or at least purple.
>
> >>> Yet, because of increasingly anti-Latino positioning, the Republican
> >>> Party has been hemorrhaging Latino support since 2004.
>
> >>> That was the high-water mark - when President George W. Bush won 43
> >>> percent of the Latino vote.
>
> >>> Sen. John McCain (R-Ariz.) received just 30 percent in 2008.
>
> >>> A recent survey by the National Association of Latino Elected and
> >>> Appointed Officials shows support for this year's California
> >>> Republican candidates for senator and governor is in the teens.
>
> >>> ............................................................................
> >>> ............................................
>
> >>> On immigration, Republicans are choosing to trade sound national
> >>> policy for cheap political points.
>
> >>> Yet they are sacrificing more than that.
>
> >>> If they continue, they are likely to receive little support from
> >>> Latinos not just this year but for many elections to come.
>
> >>> Rather than trying to win hearts and minds, Republicans have chosen
> >>> to
> >>> scapegoat the Latino community in hopes of energizing their base.
>
> >>> The real question is whether the GOP realizes the cost of its
> >>> actions.
> >>> The party is mortgaging its future.
>
> >>> Republicans' tunnel-vision focus on 2010 could mean they're flirting
> >>> with permanent minority status.
> >>> ________________________________________________________
>
> >>> It's nice to hear the sound of RePIGs committing suicide.
>
> >>> Harry
>
> >> To curb criminal activity by aliens, to defend against acts of
> >> international terrorism, to protect American workers from unfair
> >> labor competition,
> >> and to relieve pressure on public services by strengthening border
> >> security and stabilizing immigration into the United States.
>
> >> IN THE SENATE OF THE UNITED STATES AUGUST 4 (legislative day, JUNE
> >> 30), 1993
>
> >> Mr. HARRY REID introduced the following bill; which was read twice
> >> and referred to the Committee on the Judiciary
>
> >> TITLE X-CITIZENSHIP 4 SEC. 1001. BASIS OF CITIZENSHIP CLARIFIED. In
> >> the exercise of its powers under section of the Fourteenth Article
> >> of Amendment to the Constitution of the United States, the Congress
> >> has determined and hereby declares that any person born after the
> >> date of enactment of this title to a mother who is neither a citizen
> >> of the United States nor admitted to the United States as a lawful
> >> permanent resident, and which person is a national or citizen of
> >> another country of which either of his or her natural parents is a
> >> national or citizen, or is entitled upon application to become a
> >> national or citizen of such country, shall be considered as born
> >> subject to the jurisdiction of that foreign country and not subject
> >> to the jurisdiction of the United States within the meaning of
> >> section 1 of such Article and shall therefore not be a citizen of
> >> the United States or of any State solely by reason of physical
> >> presence within the United States at the moment of birth.
>
> >>http://frwebgate.access.gpo.gov/cgi-bin/getdoc.cgi?dbname=1.......
>
> >> ---
>
> >> Translation: Harry Reid wanted to end birthright citizenship.
>
> >> You were saying?
>
> >http://voices.washingtonpost.com/plum-line/2010/08/yes_reid......
>
> > "Guess what: It happens to be true that Reid did introduce such a
> > bill. And it was indefensible. But here's the thing: I've learned that
> > Reid already apologized profusely for this in a speech in 2006,
>
> 13 years later?  Man he must have been all broken up about it.  I'm sure it
> had nothing to do with the hispanic population increasing dramatically
> during that decade.
>
> > admitted he was wrong, and described this as the "low point" of his
> > career. In other words, Reid himself agrees that it was indefensible."
> > and
>
> > "That is a low point of my legislative career, the low point of my
> > governmental career," Reid said. He went on to tell the assembled
> > Senators that his wife had chastized him for the move. "She, in
> > effect, said: I can't believe that you have done it," Reid recounted.
> > "But I had done it."
>
> > He was wrong then.  He's admitted he was wrong.  Republicans on the
> > other hand seem to prefer to be wrong.
>
> If you mean Lindsey Grahams idiocy, Graham is not a conservative, he's on
> your side and you can have him (cap and tax, amnesty, voting for Kagan).  He
> only piped up about the 14th amendment because it would make him appear
> tough on illegal immigration and make true conservatives look bad while he
> knew it had no chance to go anywhere.
>
> Harry Reid's anti "alien" bill was major legislation that he spent serious
> time and deliberation creating, not some off the cuff remark designed to
> give ammo to the media and the left (same thing) to attack the tea party.
> The man was 54 years old when he wrote it.  Did he not know his own beliefs
> on illegal immigration by then?  And 13 years passed before this uh, wave of
> regret swept over him.
>
> It seems more like his first position was the sincere one, then after
> millions more illegals streamed in, he deferred to the political clout of
> these persons who are citizens of a foreign nation.  It is wrong on many
> levels; none of which Harry has acknowledged or apologized for.

Only someone whose every opinion is based on the political beliefs of
his party could believe others to view the world in the same way.