[31243] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2488 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 22 21:09:46 2009

Date: Mon, 22 Jun 2009 18:09:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 22 Jun 2009     Volume: 11 Number: 2488

Today's topics:
    Re: FAQ 4.7 How do I multiply matrices? <tzz@lifelogs.com>
        new CPAN modules on Mon Jun 22 2009 (Randal Schwartz)
        replace hard return followed by a tab <massion@gmx.de>
    Re: replace hard return followed by a tab <spamfriends@arcor.de>
    Re: replace hard return followed by a tab (Doug Miller)
    Re: replace hard return followed by a tab <jurgenex@hotmail.com>
    Re: replace hard return followed by a tab <marc.girod@gmail.com>
    Re: replace hard return followed by a tab <massion@gmx.de>
    Re: replace hard return followed by a tab <spamfriends@arcor.de>
    Re: replace hard return followed by a tab sln@netherlands.com
    Re: replace hard return followed by a tab <marspamrgol@gspammail.com>
    Re: SetUID <glex_no-spam@qwest-spam-no.invalid>
        suicide attacks is financial confusion issue <whatnextur@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 22 Jun 2009 15:18:14 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: FAQ 4.7 How do I multiply matrices?
Message-Id: <87ab4058ft.fsf@lifelogs.com>

On Sat, 20 Jun 2009 07:10:38 +0000 (UTC) Lars Eighner <usenet@larseighner.com> wrote: 

LE> In our last episode, <56eug6-mr5.ln1@blue.stonehenge.com>, the lovely and
LE> talented PerlFAQ Server broadcast on comp.lang.perl.misc:

>> 4.7: How do I multiply matrices?

LE> Provide candlelight, a nice wine with dinner, mood music, and get out of the
LE> way.  The rest is really up to the matricies.

I've found the dating questionnaire for 2-dimensional matrices:

1) Enter your height:

2) Enter your width:

3) If you could be any eigenvector, which one would you be?

Ted


------------------------------

Date: Mon, 22 Jun 2009 04:42:27 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon Jun 22 2009
Message-Id: <KLMIEr.suz@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Apache-SWIT-0.47
http://search.cpan.org/~bosu/Apache-SWIT-0.47/
mod_perl based application server with integrated testing. 
----
Apache-SWIT-Security-0.12
http://search.cpan.org/~bosu/Apache-SWIT-Security-0.12/
security subsystem for Apache::SWIT 
----
Class-Builtin-0.01
http://search.cpan.org/~dankogai/Class-Builtin-0.01/
Scalar/Array/Hash as objects 
----
Class-Builtin-0.02
http://search.cpan.org/~dankogai/Class-Builtin-0.02/
Scalar/Array/Hash as objects 
----
Class-MOP-0.87
http://search.cpan.org/~drolsky/Class-MOP-0.87/
A Meta Object Protocol for Perl 5 
----
Clone-Closure-0.04
http://search.cpan.org/~bmorrow/Clone-Closure-0.04/
A clone that knows how to clone closures 
----
Date-WeekOfYear-1.04
http://search.cpan.org/~gng/Date-WeekOfYear-1.04/
Simple routine to return the week of the year (as well as the year) 
----
Dist-Zilla-Plugin-Prepender-0.2.0
http://search.cpan.org/~jquelin/Dist-Zilla-Plugin-Prepender-0.2.0/
prepend lines at the top of your perl files 
----
Email-Sample-0.01
http://search.cpan.org/~cornelius/Email-Sample-0.01/
generate sample email for testing 
----
Fey-ORM-0.25
http://search.cpan.org/~drolsky/Fey-ORM-0.25/
A Fey-based ORM 
----
File-Path-2.07_03
http://search.cpan.org/~dland/File-Path-2.07_03/
Create or remove directory trees 
----
Finance-Quote-Grab-2
http://search.cpan.org/~kryde/Finance-Quote-Grab-2/
----
Geo-Google-Latitude-0.02
http://search.cpan.org/~mrdvt/Geo-Google-Latitude-0.02/
Retrieves a Google Latitude Public Location Badge 
----
Geo-Google-Latitude-0.03
http://search.cpan.org/~mrdvt/Geo-Google-Latitude-0.03/
Retrieves a Google Latitude Public Location Badge 
----
Grades-0.07
http://search.cpan.org/~drbean/Grades-0.07/
A collocation of homework, classwork and exams 
----
Graph-Implicit-0.01
http://search.cpan.org/~doy/Graph-Implicit-0.01/
graph algorithms for implicitly specified graphs 
----
Gtk2-Ex-Clock-9
http://search.cpan.org/~kryde/Gtk2-Ex-Clock-9/
simple digital clock widget 
----
Hash-Search-0.03
http://search.cpan.org/~xestia/Hash-Search-0.03/
Search and return hash keys using regular expressions 
----
LaTeX-Pod-0.18_02
http://search.cpan.org/~schubiger/LaTeX-Pod-0.18_02/
Transform LaTeX source files to POD (Plain old documentation) 
----
Moose-0.82
http://search.cpan.org/~drolsky/Moose-0.82/
A postmodern object system for Perl 5 
----
MooseX-Singleton-0.18
http://search.cpan.org/~drolsky/MooseX-Singleton-0.18/
turn your Moose class into a singleton 
----
Net-IMAP-Simple-1.1899_07
http://search.cpan.org/~jettero/Net-IMAP-Simple-1.1899_07/
Perl extension for simple IMAP account handling. 
----
Net-MythWeb-0.33
http://search.cpan.org/~lbrocard/Net-MythWeb-0.33/
Interface to MythTV via MythWeb 
----
Net-Redmine-0.08
http://search.cpan.org/~gugod/Net-Redmine-0.08/
A mechanized-based programming API against redmine server. 
----
Net-Twitter-3.02000
http://search.cpan.org/~mmims/Net-Twitter-3.02000/
A perl interface to the Twitter API 
----
PApp-SQL-1.05
http://search.cpan.org/~mlehmann/PApp-SQL-1.05/
absolutely easy yet fast and powerful sql access. 
----
Padre-Plugin-Ecliptic-0.11
http://search.cpan.org/~azawawi/Padre-Plugin-Ecliptic-0.11/
Padre plugin that provides Eclipse-like useful features 
----
Padre-Plugin-Perl6-0.44
http://search.cpan.org/~azawawi/Padre-Plugin-Perl6-0.44/
Padre plugin for Perl6 
----
Parse-Dia-SQL-0.10_01
http://search.cpan.org/~aff/Parse-Dia-SQL-0.10_01/
Convert Dia class diagrams into SQL. 
----
Pod-Abstract-0.19
http://search.cpan.org/~blilburne/Pod-Abstract-0.19/
Abstract document tree for Perl POD documents 
----
Syntax-Highlight-Perl6-0.63
http://search.cpan.org/~azawawi/Syntax-Highlight-Perl6-0.63/
Perl 6 Syntax Highlighter 
----
Test-Cukes-0.06
http://search.cpan.org/~gugod/Test-Cukes-0.06/
A BBD test tool inspired by Cucumber 
----
Test-MockTime-DateCalc-2
http://search.cpan.org/~kryde/Test-MockTime-DateCalc-2/
fake time for Date::Calc functions 
----
Unicode-LineBreak-1.001.510
http://search.cpan.org/~nezumi/Unicode-LineBreak-1.001.510/
UAX #14 Unicode Line Breaking Algorithm 
----
Unicode-LineBreak-1.002.510
http://search.cpan.org/~nezumi/Unicode-LineBreak-1.002.510/
UAX #14 Unicode Line Breaking Algorithm 
----
Win32-SqlServer-2.005
http://search.cpan.org/~sommar/Win32-SqlServer-2.005/
Access SQL Server from Perl via OLE DB 
----
ZConf-Mail-1.2.0
http://search.cpan.org/~vvelox/ZConf-Mail-1.2.0/
Misc mail client functions backed by ZConf. 
----
myrtscht-0.02
http://search.cpan.org/~myrtscht/myrtscht-0.02/
My Round robin Tournament SCHeduling for Table tennis 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


------------------------------

Date: Sun, 21 Jun 2009 22:43:27 -0700 (PDT)
From: Francois Massion <massion@gmx.de>
Subject: replace hard return followed by a tab
Message-Id: <d9fcd081-e73b-437b-95aa-0df4b994f3dc@l32g2000vba.googlegroups.com>

I have a list of entries in a table which is available as a tab-
separated text. In the first column there is either a string or
nothing, in the second column there is a string.

It looks like this:

Category [Tab] Architecture [Hard return]
[Tab] Technology [Hard return]
[Tab] Medicine [Hard return)

What I want to achieve is:

Category [Tab] Architexture; Technology; Medicine [Hard return]


Here my code:

@entry = <DATA>;
foreach $entry (@entry) {

  chomp $entry;
  $entry=~ s/(\r|\n){1,}\t/; /mg;
  print "$entry\n" ;

}

I have tried different modifiers and more simple replacements like s/\n
\t/; /g;, but to no avail.

Any suggestion?


------------------------------

Date: Mon, 22 Jun 2009 10:19:26 +0200
From: "Mathias J. Hennig" <spamfriends@arcor.de>
Subject: Re: replace hard return followed by a tab
Message-Id: <4a3f3f00$0$31341$9b4e6d93@newsspool4.arcor-online.net>

Francois Massion wrote:
> I have a list of entries in a table which is available as a tab-
> separated text. In the first column there is either a string or
> nothing, in the second column there is a string.
> 
> It looks like this:
> 
> Category [Tab] Architecture [Hard return]
> [Tab] Technology [Hard return]
> [Tab] Medicine [Hard return)
> 
> What I want to achieve is:
> 
> Category [Tab] Architexture; Technology; Medicine [Hard return]


$ cat data
Category        Architecture
        Technology
        Medicine
Category        Architecture
        Technology
        Medicine
$ cat test.pl
#!perl
use strict;

$_= <>, chomp, print;
chomp, /^\t(.*)/? print "; $1": print "\n$_" while <>;
print "\n";

$ cat data | ./test.pl
Category        Architecture; Technology; Medicine
Category        Architecture; Technology; Medicine
$


This is the way I would go - just a suggestion... ;)

Greets
Matze


------------------------------

Date: Mon, 22 Jun 2009 11:41:58 GMT
From: spambait@milmac.com (Doug Miller)
Subject: Re: replace hard return followed by a tab
Message-Id: <b6K%l.290$iz2.9@nlpi070.nbdc.sbc.com>

In article <4a3f3f00$0$31341$9b4e6d93@newsspool4.arcor-online.net>, "Mathias J. Hennig" <spamfriends@arcor.de> wrote:

>$ cat data | ./test.pl

Winning today's UUOC (Useless Use Of Cat) Award.

Instead:

/test.pl < data


------------------------------

Date: Mon, 22 Jun 2009 05:04:37 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: replace hard return followed by a tab
Message-Id: <foru35hptruske3t1t9bfari6lujt6phf6@4ax.com>

Francois Massion <massion@gmx.de> wrote:
>I have a list of entries in a table which is available as a tab-
>separated text. In the first column there is either a string or
>nothing, in the second column there is a string.
>
>It looks like this:
>
>Category [Tab] Architecture [Hard return]
>[Tab] Technology [Hard return]
>[Tab] Medicine [Hard return)
>
>What I want to achieve is:
>
>Category [Tab] Architexture; Technology; Medicine [Hard return]
>
>
>Here my code:
>
>@entry = <DATA>;
>foreach $entry (@entry) {
>
>  chomp $entry;

You are removing the \n here, ...

>  $entry=~ s/(\r|\n){1,}\t/; /mg;

 ... therefore it is pointless to search for it here.

Replace the body of the loop with (code untested):

	chomp $entry; 
	print "\n" unless $entry =~ s/^\t/; /;
	print $entry;

You will also have to add an additional print "\n"; after the loop to
close the very last line.

jue	



------------------------------

Date: Mon, 22 Jun 2009 08:13:51 -0700 (PDT)
From: Marc Girod <marc.girod@gmail.com>
Subject: Re: replace hard return followed by a tab
Message-Id: <e18d9b01-9754-4994-9b93-258406b1d0eb@a7g2000yqk.googlegroups.com>

On Jun 22, 6:43=A0am, Francois Massion <mass...@gmx.de> wrote:

> Any suggestion?

Your input is not made of line records.
So, you need to change the input separator.

Also, I am not sure what is a hard line separator on your platform.
I use \r?\n to cope for both unix and Windows.

So, here is my own go:

use strict;

$/=3D'';
$_ =3D <DATA>;
s/\r?\n\t/; /mg;
print;

__DATA__
Category	Architecture
	Technology
	Medicine


------------------------------

Date: Mon, 22 Jun 2009 08:54:30 -0700 (PDT)
From: Francois Massion <massion@gmx.de>
Subject: Re: replace hard return followed by a tab
Message-Id: <bd6a1ae1-56c1-4485-97e8-d4e56500f227@h28g2000yqd.googlegroups.com>

On 22 Jun., 14:04, J=FCrgen Exner <jurge...@hotmail.com> wrote:
> Francois Massion <mass...@gmx.de> wrote:
> >I have a list of entries in a table which is available as a tab-
> >separated text. In the first column there is either a string or
> >nothing, in the second column there is a string.
>
> >It looks like this:
>
> >Category [Tab] Architecture [Hard return]
> >[Tab] Technology [Hard return]
> >[Tab] Medicine [Hard return)
>
> >What I want to achieve is:
>
> >Category [Tab] Architexture; Technology; Medicine [Hard return]
>
> >Here my code:
>
> >@entry =3D <DATA>;
> >foreach $entry (@entry) {
>
> > =A0chomp $entry;
>
> You are removing the \n here, ...
>
> > =A0$entry=3D~ s/(\r|\n){1,}\t/; /mg;
>
> ... therefore it is pointless to search for it here.
>
> Replace the body of the loop with (code untested):
>
> =A0 =A0 =A0 =A0 chomp $entry;
> =A0 =A0 =A0 =A0 print "\n" unless $entry =3D~ s/^\t/; /;
> =A0 =A0 =A0 =A0 print $entry;
>
> You will also have to add an additional print "\n"; after the loop to
> close the very last line.
>
> jue =A0 =A0- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

That works fine! Thanks a lot.
Francois


------------------------------

Date: Mon, 22 Jun 2009 18:50:13 +0200
From: "Mathias J. Hennig" <spamfriends@arcor.de>
Subject: Re: replace hard return followed by a tab
Message-Id: <4a3fb6ba$0$31871$9b4e6d93@newsspool3.arcor-online.net>

Doug Miller wrote:
> In article <4a3f3f00$0$31341$9b4e6d93@newsspool4.arcor-online.net>, "Mathias J. Hennig" <spamfriends@arcor.de> wrote:
> 
>> $ cat data | ./test.pl
> 
> Winning today's UUOC (Useless Use Of Cat) Award.
> 
> Instead:
> 
> /test.pl < data

Yeah, I have won! Never won something before - and now I have got two
prizes: An award and a lesson at no charge! Thank you.


------------------------------

Date: Mon, 22 Jun 2009 10:16:00 -0700
From: sln@netherlands.com
Subject: Re: replace hard return followed by a tab
Message-Id: <dmev35djqnodqe72v9vlvcnhrmf1481vp4@4ax.com>

On Sun, 21 Jun 2009 22:43:27 -0700 (PDT), Francois Massion <massion@gmx.de> wrote:

>I have a list of entries in a table which is available as a tab-
>separated text. In the first column there is either a string or
>nothing, in the second column there is a string.
>
>It looks like this:
>
>Category [Tab] Architecture [Hard return]
>[Tab] Technology [Hard return]
>[Tab] Medicine [Hard return)
>
>What I want to achieve is:
>
>Category [Tab] Architexture; Technology; Medicine [Hard return]
>
>
>Here my code:
>
>@entry = <DATA>;
>foreach $entry (@entry) {
>
>  chomp $entry;
>  $entry=~ s/(\r|\n){1,}\t/; /mg;
>  print "$entry\n" ;
>
>}
>
>I have tried different modifiers and more simple replacements like s/\n
>\t/; /g;, but to no avail.
>
>Any suggestion?

This is another way. Though, all you really need is:
  s/ *\n+\t+ */; /g
  s/^\n+//mg

-sln

==============================
output:

Category1        Architecture; Technology; Medicine
Category2        Architecture; Technology; Medicine
Category3        Architecture; Technology; Medicine
Category4        Architecture; Technology; Medicine

Category1        Architecture; Technology; Medicine
Category2        Architecture; Technology; Medicine
Category3        Architecture; Technology; Medicine
Category4        Architecture; Technology; Medicine

-----------------------------
use strict;
use warnings;

my $data = join '', <DATA>;

# Normalize data
$data =~ s/ *\n+\t+ */; /g;
$data =~ s/^\n+//mg;
print $data,"\n";

# Create records from data
#my @lines = split /\n/, $data;
print "$_\n" for (split /\n/, $data);

__DATA__

Category1 	 Architecture 
	 Technology 
	 Medicine 

Category2 	 Architecture 
	 Technology 
	 Medicine 

Category3 	 Architecture 
	 Technology 
	 Medicine 

Category4 	 Architecture 
	 Technology 
	 Medicine 




------------------------------

Date: Mon, 22 Jun 2009 21:50:32 +0200
From: marrgol <marspamrgol@gspammail.com>
Subject: Re: replace hard return followed by a tab
Message-Id: <h1one9$3i2$1@atlantis.news.neostrada.pl>

On 2009-06-22 13:41, Doug Miller wrote:
>> $ cat data | ./test.pl
> 
> Winning today's UUOC (Useless Use Of Cat) Award.
> 
> Instead:
> 
> ./test.pl < data

UUOR?  ;-)

-- 
mrg


------------------------------

Date: Mon, 22 Jun 2009 17:45:27 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: SetUID
Message-Id: <4a400988$0$89397$815e3792@news.qwest.net>

maylcc wrote:
[...]
> thanks for your reply. i am trying to implement a test password script
> which accepts user id and password and using these parameters to auth
> against the server (linux) /etc/passwd and shadow. any suggestion?

First you say you want to update a password on a Linux server, now
you're saying you want to auth[enticate] against the server?

If you want to verify authentication, forget about /etc/passwd
and simply authenticate using telnet/ssh/whatever, provided
they have shell access.

You could also build an htpasswd file, based on /etc/shadow,
and use HTTP authentication.

If you're trying to build a Web interface to set shell
passwords, without some form of pre-authentication, you're asking
for trouble. The first thing JoeHacker will do is put in
'root', or your username, and some password, then your
server is toast.


------------------------------

Date: Sun, 21 Jun 2009 21:30:49 -0700 (PDT)
From: "whatnext@gmail.com" <whatnextur@gmail.com>
Subject: suicide attacks is financial confusion issue
Message-Id: <1a8ad9d8-0327-4178-b57b-abf9984993c5@c19g2000prh.googlegroups.com>

All too often we are reminded that terrorism continues to inflict pain
and suffering on people=92s lives all over the world. Almost no week
goes by without an act of terrorism taking place somewhere in the
world, indiscriminately affecting innocent people who just happened to
be in the wrong place at the wrong time. Countering this scourge is in
the interest of all nations and the issue has been on the agenda of
the United Nations for decades.




for more info visit http://terrorismsearch.blogspot.com


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 2488
***************************************


home help back first fref pref prev next nref lref last post