[30246] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1489 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 28 16:20:04 2008

Date: Mon, 28 Apr 2008 13:19:55 -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, 28 Apr 2008     Volume: 11 Number: 1489

Today's topics:
    Re: use of DBI; I am getting multiple error messages mi <hjp-usenet2@hjp.at>
    Re: use of DBI; I am getting multiple error messages mi <hjp-usenet2@hjp.at>
    Re: use of DBI; I am getting multiple error messages mi <hjp-usenet2@hjp.at>
    Re: use of DBI; I am getting multiple error messages mi <hjp-usenet2@hjp.at>
        use perl to draw Venn Diagram <ela@yantai.org>
    Re: use perl to draw Venn Diagram <noreply@gunnar.cc>
    Re: use perl to draw Venn Diagram <ela@yantai.org>
    Re: use perl to draw Venn Diagram <noreply@gunnar.cc>
    Re: use perl to draw Venn Diagram <bugbear@trim_papermule.co.uk_trim>
    Re: use perl to draw Venn Diagram <joost@zeekat.nl>
    Re: use perl to draw Venn Diagram <zentara@highstream.net>
    Re: use perl to draw Venn Diagram <ela@yantai.org>
    Re: use perl to draw Venn Diagram <ela@yantai.org>
    Re: use perl to draw Venn Diagram <joost@zeekat.nl>
    Re: use perl to draw Venn Diagram <ela@yantai.org>
        Very good CGI Programming text book <Webmaster.Pixindia@gmail.com>
        Windows mail. <DaveN@DaveN.COM>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 26 Apr 2008 11:26:44 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: use of DBI; I am getting multiple error messages mixed in with the correct output.
Message-Id: <slrng15tal.uct.hjp-usenet2@hrunkner.hjp.at>

On 2008-04-23 21:29, Ted <r.ted.byers@rogers.com> wrote:
> If this is corect, is there a way to tell it to replace the null value
> found in the row by the string "null"? 
[...]
> I have found it easy t work around nulls in SQL and JDBC and C++, so
> what it the Perl counterpart to the routine idioms I use in these
> other languages?

Search for "Here’s how to convert fetched NULLs" in perldoc DBI.

	hp


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

Date: Sat, 26 Apr 2008 11:55:46 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: use of DBI; I am getting multiple error messages mixed in with the correct output.
Message-Id: <slrng15v14.uct.hjp-usenet2@hrunkner.hjp.at>

On 2008-04-24 02:14, Ted <r.ted.byers@rogers.com> wrote:
> Not quite.  I failed to find them quickly, having started with DBI
> today.  The page for "DBD::mysql" says nothing about either this or
> the fact that DBI translates nulls into undefined.

Why should it? That's not specific to mysql. It is generic DBI behaviour
and therefore documented in perldoc DBI.

	hp


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

Date: Sat, 26 Apr 2008 11:53:10 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: use of DBI; I am getting multiple error messages mixed in with the correct output.
Message-Id: <slrng15usc.uct.hjp-usenet2@hrunkner.hjp.at>

On 2008-04-24 01:05, Ted <r.ted.byers@rogers.com> wrote:
> But null values in SQL are not the same thing as undefined or
> uninitialized values in any other language I know.

Neither are perl undef values the same thing as uninitialized values in
any other language I know.

> In any RDBMS I have worked with, null is a legitimate value that can
> be given to a specific column in a specific row, and it has a very
> specific meaning in a database.

In Perl, undef is a legitimate value that can be given to a scalar, and
it has a very specific meaning in Perl.

> Any SQL programmer knows how to handle nulls, what can and can not be
> done with them, &c.

Any Perl programmer knows how to handle undefs, what can and can not be
done with them, &c.

> That is very different from programming errors where a variable has
> been defined and then used before it has been given a value.

That is very different from programming errors where a variable has been
defined and then used before it has been given a value.

There are no uninitialized variables in Perl. If the programmer doesn't
explicitely initialize a variable, it is implicitely initialized to
undef. This is similar to C implicitely initializing all variables of
static duration to 0 (of the appropriate type). C doesn't initialize
automatic variables, but Perl does.

(The warning about an "uninitialized value" is misleading, IMHO. It
should say "undefined value", or simply "undef". But it is unlikely to
change)


> So I maintain this IS a DBI issue, and there ought to be functionality
> provided within DBI to handle the processing of recordsets, including
> printing them, that can handle null values in a rational manner
> without generating spurious warnings.

There is no unambiguous way to convert a null value to a string. For
every string you choose, it would also be a valid string value.
Therefore it is better to leave that to the programmer.

> At a minimum the DBI documentation ought to say somethng
> about users needing to implement their own processing to handle null
> values when that is not available.

It does. There's a whole section entitled "NULL Values" in perldoc DBI.

> The real error here is that, if I am to believe Ted, that nulls are
> treated as undefined in the DBI translation, and this is plain wrong.
> On the daatabase side, nulls have a specific meaning (and as you well
> said, further on, that meaning is different from that of an empty
> string),

undef also has a specific meaning and that is different from an empty
string. The meaning is not exactly the same as that of SQL null, but I
doubt you'll find two languages where "null" or "nil" or "undef" or
whatever it is called has exactly the same meaning. Most languages have
the concept of "a missing, unknown or undefined value", but the details
differ.

> and DBI ought to at least provide a means of handling them
> correctly from the perspective of a database programmer.

The means are there. You get a specific value which can be distinguished
from any non-null value. How you handle it is up to you.

> The fact is that if I wanted to represent, in a C++ or Java program,
> the idea represented by null in SQL, I could write a class that
> represents that idea and give me the kinds of behaviours I'd require
> of it; something far richer than anything possible with the null
> keywords in either C++ or java.

You can do the same thing in Perl. 

> Therefore, I could do precisely the same thing in Perl, if need be.

Ah, yes. So you realized that yourself. What's stopping you?

> I repeat yet again, it is wrong to think of this as a perl issue,
> rather than an issue of a deficiency in the DBI library.

I see that as a feature, not a deficiency. Why should the DBI force a
slow, clunky interface on me if a lean, fast one suffices in 99% of all
cases? DBI is slow enough as it is. It doesn't have to be slowed down
artificially.

> The mistake here is to assume this is a perl issue.  Perl, like Java
> and C++ and FORTRAN and a host of other programming languages, is
> Turing complete, so anything that can be done in any one of them can
> in principle be done in any of the others.  Surely you know that JDBC
> is to Java as DBI is to Perl.

Yes. And there's the Java way and the there's the Perl way (Ok, there
is more than one Perl way, but you know what I mean). JDBC presents an
interface that is natural to a Java programmer and DBI presents an
interface that is natural to a Perl programmer. You shouldn't expect
them to be identical.

	hp



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

Date: Sat, 26 Apr 2008 12:20:14 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: use of DBI; I am getting multiple error messages mixed in with ?the correct output.
Message-Id: <slrng160ev.uct.hjp-usenet2@hrunkner.hjp.at>

On 2008-04-24 15:46, Ted <r.ted.byers@rogers.com> wrote:
> And where exactly are you getting the idea that the empty string is a
> defined null string.

Common usage. A "null string" is a string of length zero. It has nothing
to do with the concept of NULL in SQL. Using the term "null string"
instead of "empty string" in a thread about DBI is confusing, but since
it is quoted from a book which is not about DBI or SQL, but about Perl,
that's just the way it is. You have to learn that English words can mean
different things depending on context.

So, in Perl the "null string" ("") is defined and distinct from undef,
which is not a string (It is a scalar value, but it is neither a string,
nor a number, nor a reference - and any attempt to use it as such will
yield a warning).


>> > But that is exactly what Wall et al. said about undefined.  I learned
>> > much of what I know about Perl from their book, and they said that an
>> > undefined variable is one that does not have a valid string, number or
>> > reference, and that exactly describes a variable that has not yet been
>> > initialized.

It also exactly describes a variable which has been initialized to
undef.

>> > The empty string is a valid string in all of the languages I use,
>> > and it means something quite different from a SQL null.

True, but irrelevant. Nobody ever claimed that they were the same (well,
Oracle does, but that's their problem).


>> We're not talking about the empty string any more, the above is
>> talking about an undefined value. As I pointed out in the two scripts,
>> $b="" and $b=undef are two totally different things.
>>
> Agreed.  But the empty string is not a defined null,

Nobody said it was. "Null string" is a synonym for "empty string". In
Perl (defined("")) happens to be true.

	hp


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

Date: Mon, 28 Apr 2008 07:59:55 +0800
From: "Ela" <ela@yantai.org>
Subject: use perl to draw Venn Diagram
Message-Id: <fv341t$cdh$1@ijustice.itsc.cuhk.edu.hk>

Perl has a GD library. But its circle, arc, line and alike seem to have 
limited applications.

I just want to plot 2 circles, one with solid line and another with dotted 
line, overlapping with each other according to an input overlapping 
parameter (I guess this feature may be achieved by locating the 2 centers 
accordingly). Finally write some texts in the centers of the 2 circles. Any 
suggestions? Matlab can achieve that easily and is Perl really unable to do 
that?






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

Date: Mon, 28 Apr 2008 02:51:44 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: use perl to draw Venn Diagram
Message-Id: <67kld7F2pnq62U1@mid.individual.net>

Ela wrote:
> Perl has a GD library.

No. Perl has an interface to the GD Graphics Library.

http://search.cpan.org/perldoc?GD

> But its circle, arc, line and alike seem to have limited applications.

How did you come to that conclusion?

> I just want to plot 2 circles, one with solid line and another with dotted 
> line, overlapping with each other according to an input overlapping 
> parameter (I guess this feature may be achieved by locating the 2 centers 
> accordingly). Finally write some texts in the centers of the 2 circles.

Interesting. Have you written any code yet?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Mon, 28 Apr 2008 12:21:08 +0800
From: "Ela" <ela@yantai.org>
Subject: Re: use perl to draw Venn Diagram
Message-Id: <fv3jbm$j92$1@ijustice.itsc.cuhk.edu.hk>

>> I just want to plot 2 circles, one with solid line and another with 
>> dotted line, overlapping with each other according to an input 
>> overlapping parameter (I guess this feature may be achieved by locating 
>> the 2 centers accordingly). Finally write some texts in the centers of 
>> the 2 circles.
>
> Interesting. Have you written any code yet?
>
> -- 
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl

In Matlab, I can specify parameters like: LineWidth, LineStyle and so. I'm 
not asking others to post their codes but would like to know whether such 
parameters exist or not. Because after reading

Graphics_Programming_with_Perl by Martien_Verbruggen-Manning

I did not find any clues. 




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

Date: Mon, 28 Apr 2008 06:48:48 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: use perl to draw Venn Diagram
Message-Id: <67l39oF2pa361U1@mid.individual.net>

Ela wrote:
> Gunnar Hjalmarsson wrote:
>> Ela wrote:
>>> I just want to plot 2 circles, one with solid line and another with 
>>> dotted line, overlapping with each other according to an input 
>>> overlapping parameter (I guess this feature may be achieved by 
>>> locating the 2 centers accordingly). Finally write some texts in the 
>>> centers of the 2 circles.
>> 
>> Interesting. Have you written any code yet?
> 
> In Matlab, I can specify parameters like: LineWidth, LineStyle and so. I'm 
> not asking others to post their codes but would like to know whether such 
> parameters exist or not.

Then read the docs for GD.pm (link provided in my previous message).

> Because after reading
> 
> Graphics_Programming_with_Perl by Martien_Verbruggen-Manning
> 
> I did not find any clues.

But you didn't read the GD.pm docs, right?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Mon, 28 Apr 2008 09:38:07 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: use perl to draw Venn Diagram
Message-Id: <1fudnYjoy6tyEYjVnZ2dneKdnZydnZ2d@plusnet>

Ela wrote:
>  Matlab can achieve that easily and is Perl really unable to do
> that?

Matlab is a rather impressive body of work;
I see no reason to assume that perl should be
a full match for all it's functionality.

   BugBear


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

Date: Mon, 28 Apr 2008 13:42:43 +0200
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: use perl to draw Venn Diagram
Message-Id: <871w4qcij0.fsf@zeekat.nl>

"Ela" <ela@yantai.org> writes:

> In Matlab, I can specify parameters like: LineWidth, LineStyle and so. I'm 
> not asking others to post their codes but would like to know whether such 
> parameters exist or not. Because after reading
>
> Graphics_Programming_with_Perl by Martien_Verbruggen-Manning
>
> I did not find any clues. 

GD can do that. Read its docs. 

Personally, I prefer Cairo...

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/


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

Date: Mon, 28 Apr 2008 09:24:23 -0400
From: zentara <zentara@highstream.net>
Subject: Re: use perl to draw Venn Diagram
Message-Id: <3pjb14tgcrf1lh2j5jkbr2garcmu90q9k1@4ax.com>

On Mon, 28 Apr 2008 07:59:55 +0800, "Ela" <ela@yantai.org> wrote:

>Perl has a GD library. But its circle, arc, line and alike seem to have 
>limited applications.
>
>I just want to plot 2 circles, one with solid line and another with dotted 
>line, overlapping with each other according to an input overlapping 
>parameter (I guess this feature may be achieved by locating the 2 centers 
>accordingly). Finally write some texts in the centers of the 2 circles. Any 
>suggestions? Matlab can achieve that easily and is Perl really unable to do 
>that?

Yeah, see my replies in http://perlmonks.org?node_id=502389  for ways to
do it with Tk, Gtk2, and Tk::Zinc.

Writing text is a simple addition. You can also save the Canvases if
desired to a pdf or jpg, etc, and you can add mouse-dragging if wanted.

zentara


-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html


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

Date: Mon, 28 Apr 2008 22:45:08 +0800
From: "Ela" <ela@yantai.org>
Subject: Re: use perl to draw Venn Diagram
Message-Id: <fv4ntn$457$1@ijustice.itsc.cuhk.edu.hk>

> Then read the docs for GD.pm (link provided in my previous message).
>
>> Because after reading
>>
>> Graphics_Programming_with_Perl by Martien_Verbruggen-Manning
>>
>> I did not find any clues.
>
> But you didn't read the GD.pm docs, right?
>
> -- 
Thanks a lot, Gunnar Hjalmarsson. But the doc and google search don't tell 
me how to use gdstyled and gdbrushed to draw a circle with a dashed/dotted 
line.





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

Date: Mon, 28 Apr 2008 22:56:28 +0800
From: "Ela" <ela@yantai.org>
Subject: Re: use perl to draw Venn Diagram
Message-Id: <fv4oiu$4ep$1@ijustice.itsc.cuhk.edu.hk>

> Yeah, see my replies in http://perlmonks.org?node_id=502389  for ways to
> do it with Tk, Gtk2, and Tk::Zinc.
>
> Writing text is a simple addition. You can also save the Canvases if
> desired to a pdf or jpg, etc, and you can add mouse-dragging if wanted.
>
Thanks, zentara. Instead of drawing a sophisticated Venn diagram like yours, 
I just need simple ones. And the fatal error is that I can't install 
X-related onto computer. Is there any workaround? I need to produce ~1000 
Venn diagrams...




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

Date: Mon, 28 Apr 2008 17:08:46 +0200
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: use perl to draw Venn Diagram
Message-Id: <878wyy585d.fsf@zeekat.nl>

"Ela" <ela@yantai.org> writes:

> Thanks a lot, Gunnar Hjalmarsson. But the doc and google search don't tell 
> me how to use gdstyled and gdbrushed to draw a circle with a dashed/dotted 
> line.

The following is copied directly from the getStyle section of the GD
docs at <http://search.cpan.org/~lds/GD-2.39/GD.pm>:

      # Set a style consisting of 4 pixels of yellow,
      # 4 pixels of blue, and a 2 pixel gap
      $myImage->setStyle($yellow,$yellow,$yellow,$yellow,
                         $blue,$blue,$blue,$blue,
                         gdTransparent,gdTransparent);
      $myImage->arc(50,50,25,25,0,360,gdStyled);

You could probably also use brushes instead. Anyway all the
information is really there in the docs. If you're unable to create a
working script from that, you may want to post at least what you've
got now and what you're having difficulty with *exactly*. Just
claiming GD doesn't do what you want when it clearly does and even
provide examples in the docs isn't helping.

Take some time to read the full manpage linked above, it's not that
big and you should be able to figure it out yourself.

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/


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

Date: Mon, 28 Apr 2008 23:55:57 +0800
From: "Ela" <ela@yantai.org>
Subject: Re: use perl to draw Venn Diagram
Message-Id: <fv4s2g$6ap$1@ijustice.itsc.cuhk.edu.hk>

> You could probably also use brushes instead. Anyway all the
> information is really there in the docs. If you're unable to create a
> working script from that, you may want to post at least what you've
> got now and what you're having difficulty with *exactly*. Just
> claiming GD doesn't do what you want when it clearly does and even
> provide examples in the docs isn't helping.
>
> Take some time to read the full manpage linked above, it's not that
> big and you should be able to figure it out yourself.
>
I feel sorry for not understanding what "holes" refer to... Not 
complimenting Matlab, but I am used to its elegant library to provide 
intuitive and powerful functions... Certainly, GD provides a greater control 
over how wide the holes can be... 




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

Date: Sat, 26 Apr 2008 11:43:14 -0700 (PDT)
From: tutorialwebs <Webmaster.Pixindia@gmail.com>
Subject: Very good CGI Programming text book
Message-Id: <d5a12fed-7095-4465-a019-e600c722bf11@b5g2000pri.googlegroups.com>


CGI Programming text book
http://www.365x24live.com/CGI%20Programming%20Unleashed/index.htm

Java Script Text Book
http://www.365x24live.com/JavaScript/INDEX.HTM

Applied Cryptography
http://www.365x24live.com/Applied%20Cryptography/ewtoc.html

Vb Script Text Book
http://www.365x24live.com/vbscript/index.html

CGI Programming text book
http://www.365x24live.com/CGI%20Programming%20Unleashed/index.htm

Java Text Book
http://www.365x24live.com/java/index.html

Programmer's Guide Nokia WAP Server API 1
http://www.365x24live.com/nokia/1.html


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

Date: Mon, 28 Apr 2008 13:18:23 +0100
From: "DaveN" <DaveN@DaveN.COM>
Subject: Windows mail.
Message-Id: <sgjRj.106123$fx2.56061@newsfe08.ams2>

Hi.

Does anyone have example scripts to work with Windows Mail and in particular
with usenet groups?  I want to build a spam filter to run on all the groups
I am subscribed to.

-- 
DaveN 




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

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 1489
***************************************


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