[28737] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 10101 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 28 17:14:09 2006

Date: Thu, 28 Dec 2006 11:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 28 Dec 2006     Volume: 10 Number: 10101

Today's topics:
    Re: bringing a process to foreground. <rajendra.prasad@in.bosch.com>
    Re: bringing a process to foreground. <ch.l.ngre@online.de>
        Bringing a window to foreground. <rajendra.prasad@in.bosch.com>
        Cannot print images with Win32::Printer <rob.johansen@gmail.com>
        Different methods to call a subroutine! pod69@gmx.net
    Re: Different methods to call a subroutine! <spamtrap@dot-app.org>
    Re: Different methods to call a subroutine! <kenslaterpa@hotmail.com>
    Re: Different methods to call a subroutine! <rvtol+news@isolution.nl>
    Re: Different methods to call a subroutine! <mritty@gmail.com>
        How do I convert an array of x-y coordiates in to a ima Eadmund@letterbee.com
    Re: How do I convert an array of x-y coordiates in to a <sun_tong_001@users.sourceforge.net>
        new CPAN modules on Thu Dec 28 2006 (Randal Schwartz)
    Re: perl dbi sybase number of columns? <DJStunks@gmail.com>
        Superformula with Perl? <guba@vi-anec.de>
    Re: Superformula with Perl? <zentara@highstream.net>
    Re: Why would I use Perl in place of C/C++? <een-niet-bestaande-kleineaap@xs4all.nl>
    Re: Why would I use Perl in place of C/C++? <een-niet-bestaande-kleineaap@xs4all.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 28 Dec 2006 15:40:11 +0530
From: "rajendra" <rajendra.prasad@in.bosch.com>
Subject: Re: bringing a process to foreground.
Message-Id: <en04pv$bhj$1@news4.fe.internet.bosch.com>

Hello All,
Please find my small script.

use Tk;
$main=MainWindow->new;
$main->Button(-text => "Click",-command => \&disp)->pack(-side =>'left');
$text1=$main->Text(-width => 40 ,-height => 2)->pack;
$text1->bind('<Enter>',\&disp);

MainLoop;

sub disp
{
 $text1->insert('end',"Hello");
}

What should I add for this script to bring the window that gets generated by
this script to foreground even if I change my focus?..
"Ch Lamprecht" <ch.l.ngre@online.de> wrote in message
news:em41o7$odb$1@online.de...
> aakash wrote:
>
>
>
> > "Ch Lamprecht" <ch.l.ngre@online.de> wrote
> >>rajendra wrote:
> >>>the time, I get the TK window for login, if I change my focus to some
> >>>other
> >>>process, the Perl TK window will be in background.
> >>>So I would like to know how to bring this Perl TK window to foreground.
> >>>
>
> >>if you are on windows, you can use
> >>
> >>$main_window->attributes(-topmost => 1);
> >>
> >>That will work with MainWindow or Toplevel objects.
>  > When i tried to use the below(above) command it gives me an error :
"Can't
>  > call
>  > method "attributes" on unblessed reference at ( folllowed by line no.)"
>
> Hi aakash,
> please post a short but complete example.
> Please don' top-post.
>
> Christoph
> -- 
>
> perl -e "print scalar reverse q/ed.enilno@ergn.l.hc/"




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

Date: Thu, 28 Dec 2006 11:58:26 +0100
From: Ch Lamprecht <ch.l.ngre@online.de>
Subject: Re: bringing a process to foreground.
Message-Id: <en080h$nuf$2@online.de>

rajendra wrote:
> Hello All,
> Please find my small script.
> 
> use Tk;
> $main=MainWindow->new;
> $main->Button(-text => "Click",-command => \&disp)->pack(-side =>'left');
> $text1=$main->Text(-width => 40 ,-height => 2)->pack;
> $text1->bind('<Enter>',\&disp);

$main->after(500,sub{$main->attributes(-topmost=> 1)});
# this works on windows
> 
> MainLoop;
> 
> sub disp
> {
>  $text1->insert('end',"Hello");
> }
> 
> What should I add for this script to bring the window that gets generated by
> this script to foreground even if I change my focus?..

Again: It's easier to follow the discussion if you don't top-post.

Christoph

-- 

perl -e "print scalar reverse q/ed.enilno@ergn.l.hc/"


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

Date: Thu, 28 Dec 2006 17:01:41 +0530
From: "rajendra" <rajendra.prasad@in.bosch.com>
Subject: Bringing a window to foreground.
Message-Id: <en09il$evj$1@news4.fe.internet.bosch.com>

Hello All,
 Please find my small script.

 use Tk;
 $main=MainWindow->new;
 $main->Button(-text => "Click",-command => \&disp)->pack(-side =>'left');
 $text1=$main->Text(-width => 40 ,-height => 2)->pack;
 $text1->bind('<Enter>',\&disp);

$main->after(500,sub{$main->attributes(-topmost=> 1)});
# this works on windows

 MainLoop;

 sub disp
 {
  $text1->insert('end',"Hello");
 }

 What should I add for this script to bring the window that gets generated
by
 this script to foreground even if I change my focus?..




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

Date: 28 Dec 2006 08:40:38 -0800
From: "Rob" <rob.johansen@gmail.com>
Subject: Cannot print images with Win32::Printer
Message-Id: <1167324037.959780.321800@79g2000cws.googlegroups.com>

Hi all,

I'm trying to use the Win32::Printer module to make my Perl program
capable of printing images (inline bitmaps and/or .bmp files). I've got
my code to the point of displaying the standard Windows "Print" dialog
box, but as soon as I click OK to print the image, I get the following
error:

"FreeImage is not supported in this build!"

According to the Win32::Printer documentation, bitmap support requires
that FreeImage.dll be "somewhere in your system path", so I downloaded
it from http://freeimage.sourceforge.net/download.html and tried it in
several directories on my path. Still no joy.

BTW, I'm running ActivePerl 5.8.7.815 in Windows XP, and I installed
Win32::Printer using ppm. Any ideas on how to get FreeImage supported?
Is there a better way to print bitmaps with Perl?

Thanks in advance,
Rob



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

Date: 28 Dec 2006 10:02:03 -0800
From: pod69@gmx.net
Subject: Different methods to call a subroutine!
Message-Id: <1167328923.395617.306020@79g2000cws.googlegroups.com>

Hello,

Is there any difference if i call a subroutine wit subroutine() or
&subroutine() - whats the different with the "&"!
Can anyone tell me that?

thx



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

Date: Thu, 28 Dec 2006 13:19:44 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Different methods to call a subroutine!
Message-Id: <m23b6zyjb3.fsf@Sherm-Pendleys-Computer.local>

pod69@gmx.net writes:

> Is there any difference if i call a subroutine wit subroutine() or
> &subroutine() - whats the different with the "&"!
> Can anyone tell me that?

It's explained in "perldoc perlsub".

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: 28 Dec 2006 10:20:52 -0800
From: "kens" <kenslaterpa@hotmail.com>
Subject: Re: Different methods to call a subroutine!
Message-Id: <1167330052.824191.157420@48g2000cwx.googlegroups.com>


pod69@gmx.net wrote:
> Hello,
>
> Is there any difference if i call a subroutine wit subroutine() or
> &subroutine() - whats the different with the "&"!
> Can anyone tell me that?
> 
> thx

Take a look at the documentation:

   perldoc perlsub

Ken



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

Date: Thu, 28 Dec 2006 19:38:18 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Different methods to call a subroutine!
Message-Id: <en16ik.1ac.1@news.isolution.nl>

pod69@gmx.net schreef:

> Is there any difference if i call a subroutine wit subroutine() or
> &subroutine() - whats the different with the "&"!
> Can anyone tell me that?

See perlsub.

-- 
Affijn, Ruud

"Gewoon is een tijger."


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

Date: 28 Dec 2006 10:59:28 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Different methods to call a subroutine!
Message-Id: <1167332367.947261.232900@42g2000cwt.googlegroups.com>

pod69@gmx.net wrote:
> Is there any difference if i call a subroutine wit subroutine() or
> &subroutine() - whats the different with the "&"!
> Can anyone tell me that?

Everyone so far has instructed you to read `perldoc perlsub`.  That's
good advice.  To help you narrow it down, the shortest answer is:

& disables prototype-checking and passes the current @_.

Search for "prototype" and "@_" within perlsub for more details.

Paul Lalli



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

Date: 28 Dec 2006 06:14:23 -0800
From: Eadmund@letterbee.com
Subject: How do I convert an array of x-y coordiates in to a image?
Message-Id: <1167315263.642080.137840@42g2000cwt.googlegroups.com>

Hi,

Does anyone know how to convert an array of x-y coordinates, plotting a
shape, in to a image (BMP, GIFF etc) in Perl? I have Image magic etc.

Regards

Eadmund



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

Date: 28 Dec 2006 16:09:17 GMT
From: * Tong * <sun_tong_001@users.sourceforge.net>
Subject: Re: How do I convert an array of x-y coordiates in to a image?
Message-Id: <4593ec2d$0$15491$88260bb3@free.teranews.com>

On Thu, 28 Dec 2006 06:14:23 -0800, Eadmund wrote:

> Does anyone know how to convert an array of x-y coordinates, plotting a
> shape, in to a image (BMP, GIFF etc) in Perl? I have Image magic etc.

gnuplot, no programming necessary.


-- 
Tong (remove underscore(s) to reply)
  http://xpt.sourceforge.net/

-- 
Posted via a free Usenet account from http://www.teranews.com



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

Date: Thu, 28 Dec 2006 05:42:14 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Dec 28 2006
Message-Id: <JAyyIE.17Iq@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.

Algorithm-RabinKarp-0.41_1
http://search.cpan.org/~nnunley/Algorithm-RabinKarp-0.41_1/
Rabin-Karp streaming hash
----
Argv-1.18
http://search.cpan.org/~dsb/Argv-1.18/
Provide an OO interface to an arg vector
----
Argv-1.19
http://search.cpan.org/~dsb/Argv-1.19/
Provide an OO interface to an arg vector
----
Catalyst-Plugin-DBIC-Schema-Profiler-0.01
http://search.cpan.org/~yamamoto/Catalyst-Plugin-DBIC-Schema-Profiler-0.01/
----
Class-TransparentFactory-0.02
http://search.cpan.org/~gaal/Class-TransparentFactory-0.02/
Transparently choose a provider class with an automatic facade
----
ClearCase-Argv-1.24
http://search.cpan.org/~dsb/ClearCase-Argv-1.24/
ClearCase-specific subclass of Argv
----
Config-Patch-0.07
http://search.cpan.org/~mschilli/Config-Patch-0.07/
Patch configuration files and unpatch them later
----
Danga-Socket-1.56
http://search.cpan.org/~bradfitz/Danga-Socket-1.56/
Event loop and event-driven async socket base class
----
Data-Domain-0.02
http://search.cpan.org/~dami/Data-Domain-0.02/
Data description and validation
----
Data-Tabulate-0.02
http://search.cpan.org/~reneeb/Data-Tabulate-0.02/
Table generation!
----
Data-Tabulate-Plugin-ASCIITable-0.01
http://search.cpan.org/~reneeb/Data-Tabulate-Plugin-ASCIITable-0.01/
generate ASCII tables with Data::Tabulate
----
Data-Tabulate-Plugin-HTMLTable-0.01
http://search.cpan.org/~reneeb/Data-Tabulate-Plugin-HTMLTable-0.01/
HTML::Table plugin for Data::Tabulate
----
Directory-Scratch-0.11
http://search.cpan.org/~jrockway/Directory-Scratch-0.11/
Easy-to-use self-cleaning scratch space.
----
Errno-1.10
http://search.cpan.org/~gbarr/Errno-1.10/
System errno constants
----
File-Attributes-0.03
http://search.cpan.org/~jrockway/File-Attributes-0.03/
Manipulate file metadata
----
Geography-JapanesePrefectures-Walker-0.02
http://search.cpan.org/~nekokak/Geography-JapanesePrefectures-Walker-0.02/
Geography::JapanesePrefectures's wrappers.
----
List-MRU-0.04
http://search.cpan.org/~gavinc/List-MRU-0.04/
Perl module implementing a simple fixed-size MRU-ordered list.
----
Net-Dev-Tools-Syslog-1.0.0
http://search.cpan.org/~sparsons/Net-Dev-Tools-Syslog-1.0.0/
Send, Listen Parse Syslog messages.
----
Net-Prizm-0.01
http://search.cpan.org/~jef/Net-Prizm-0.01/
Perl client interface to Motorola Canopy Prizm
----
Net-SPOCP-0.14
http://search.cpan.org/~leifj/Net-SPOCP-0.14/
Perl implementation of the SPOCP protocol
----
Net-Z3950-SimpleServer-1.05
http://search.cpan.org/~sondberg/Net-Z3950-SimpleServer-1.05/
Simple Perl API for building Z39.50 servers.
----
Object-InsideOut-3.08
http://search.cpan.org/~jdhedden/Object-InsideOut-3.08/
Comprehensive inside-out object support module
----
PDF-Table-0.9.3
http://search.cpan.org/~omega/PDF-Table-0.9.3/
A utility class for building table layouts in a PDF::API2 object.
----
POE-Component-AI-MegaHAL-1.04
http://search.cpan.org/~bingos/POE-Component-AI-MegaHAL-1.04/
A non-blocking wrapper around AI::MegaHAL.
----
RPC-Object-0.16
http://search.cpan.org/~jwu/RPC-Object-0.16/
A lightweight implementation for remote procedure calls
----
Rsync-Config-0.1
http://search.cpan.org/~diablo/Rsync-Config-0.1/
----
Test-CheckManifest-1.0
http://search.cpan.org/~reneeb/Test-CheckManifest-1.0/
Check if your Manifest matches your distro
----
WebService-Audioscrobbler-0.03
http://search.cpan.org/~nilsonsfj/WebService-Audioscrobbler-0.03/
An object-oriented interface to the Audioscrobbler WebService API
----
WebService-Audioscrobbler-0.04
http://search.cpan.org/~nilsonsfj/WebService-Audioscrobbler-0.04/
An object-oriented interface to the Audioscrobbler WebService API


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/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 27 Dec 2006 18:36:17 -0800
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: perl dbi sybase number of columns?
Message-Id: <1167273377.227658.3560@42g2000cwt.googlegroups.com>

jcharth@hotmail.com wrote:
> hello i am using perl dbi with sybase

The whole point of the DBI is to (and I quote) "provide a consistent
database interface, independent of the actual database being used."
Therefore it is entirely unimportant that you are querying a Sybase
database.

> i know that in php is easy to
> find out the number of columns with any sql query.

Isn't PHP great?

> is there a way to
> know how many values are stored in the array that stores the result of
> the query? any code samples? thank.s

did you read the documentation for the module you're trying to use?  or
did you think it would be easier to have us read it to you?

  perldoc DBI

hint: pay particular attention to the section on "Statement Handle
Attributes"

-jp

PS:  I've got $5 that says the response to this message will have no
context at all or will be a top post.  I can feel it!



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

Date: 28 Dec 2006 03:47:05 -0800
From: "guba@vi-anec.de" <guba@vi-anec.de>
Subject: Superformula with Perl?
Message-Id: <1167306424.957247.202020@a3g2000cwd.googlegroups.com>

Hello,

I am wondering how parametric formulas like the Superformula
http://en.wikipedia.org/wiki/Superformula
can be drawn with Perl. GD or ImageMagick has only some graphic
primitives and I can not see how this could be done which such
programs. Or can Perl API to a mathe library be used to
draw such graphs? Thank you for hints!

G=FCnter



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

Date: Thu, 28 Dec 2006 13:33:35 GMT
From: zentara <zentara@highstream.net>
Subject: Re: Superformula with Perl?
Message-Id: <uog7p25gtk00fl2kgvvmbiqcb0994mma9i@4ax.com>

On 28 Dec 2006 03:47:05 -0800, "guba@vi-anec.de" <guba@vi-anec.de>
wrote:

>Hello,
>
>I am wondering how parametric formulas like the Superformula
>http://en.wikipedia.org/wiki/Superformula
>can be drawn with Perl. GD or ImageMagick has only some graphic
>primitives and I can not see how this could be done which such
>programs. Or can Perl API to a mathe library be used to
>draw such graphs? Thank you for hints!
>
>Günter

These are cool, thanks for pointing them out.

If you just want the 2d , gnuplot will do polar coordinates.

But the general solution for 3d, would be to use PDL.
The TriD graphics will do parametric equations.
See http://www.johnlapeyre.com/pdl/pdldoc/newbook/index.html!
for a guide.

Here is a chopped down version from the PDL demo, which is close,
and you could probably modify it for your SuperFormula parametric
equations.

#!/usr/bin/perl
use warnings;
use strict;
use Tk;
use PDL;
use PDL::Graphics::TriD;
use PDL::Graphics::TriD::Contours;
use PDL::Graphics::TriD::GL;
use PDL::Graphics::TriD::Tk;

my $TriDW;    # declare the graph object in main, defined in initialize
my $MW = MainWindow->new();
my $bframe = $MW->Frame()->pack( -side => 'top', -fill => 'x' );

# This is the TriD Tk widget it is a Tk Frame widget and has all of the
# attributes of a Frame
$TriDW = $MW->Tk()->pack( -expand => 1, -fill => 'both');

# The exit button
my $e_button = $bframe->Button(
   -text    => "Exit",
   -command => sub { exit }
)->pack( -side => 'right', -anchor => 'nw', -fill => 'y' );

# Sets a default focus style for viewport
#setfocusstyle( 'Pointer' );

# a trick needed to display
# set the graphic  when the window is first opened
$e_button->bind( "<Configure>", [
      sub {
         my $but = shift;
         Torusdemos();
	 $e_button->bind( "<Configure>", '' );
         } ] 
       );

$TriDW->MainLoop;

sub Torusdemos {
   my ( $bh ) = @_;

   return unless defined $TriDW->{ GLwin };
   my $graph;

   $graph = $TriDW->{ GLwin }->current_viewport->graph();

  # define the graph object
      $graph = new PDL::Graphics::TriD::Graph();
      $graph->default_axes();

      my $data;
      my $s = 40;
      my $a = zeroes 2 * $s, $s / 2;
      my $t = $a->xlinvals( 0, 6.284 );
      my $u = $a->ylinvals( 0, 6.284 );
      my $o = 0.5;
      my $i = 0.1;
      my $v = $o + $i * sin $u;

      my $x = $v * sin $t;
      my $y = $v * cos $t;
      my $z = $i * cos( $u ) + $o * sin( 3 * $t );

# color
         $data = new PDL::Graphics::TriD::SLattice(
            [ $x, $y, $z ],
            [
               0.5 *  ( 1 + sin $t ),
               0.5 *  ( 1 + cos $t ),
               0.25 * ( 2 + cos( $u ) + sin( 3 * $t ) )
            ]
         );

#  black and white
#     $data = new PDL::Graphics::TriD::SLattice_S( [ $x, $y, $z ] );

   $graph->add_dataseries( $data, 'Torus-demo' );
   $graph->scalethings();
   $TriDW->current_viewport()->delete_graph( $graph );
   $TriDW->current_viewport()->graph( $graph );
   $TriDW->refresh();
}
__END__


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


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

Date: Thu, 28 Dec 2006 13:08:38 +0100
From: Kleine Aap <een-niet-bestaande-kleineaap@xs4all.nl>
Subject: Re: Why would I use Perl in place of C/C++?
Message-Id: <4593b3b6$0$5078$e4fe514c@dreader24.news.xs4all.nl>

Michele Dondi wrote:

> Classical example: a full program that filters input lines outputting
> only unique ones in whichever order they come can be a simple oneliner
> like the following
>
>   perl -pe"$_ x=!$$_++"

Fascinating! Could someone elaborate on this? Take it apart so to speak?

I know the -p switch automatically wraps the -e code with a loop. But I'm
quite puzzled with the cryptic "$_ x=!$$_++"

I e.g. guess the $$ at the right side of the = is not the process id?




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

Date: Thu, 28 Dec 2006 14:10:51 +0100
From: Kleine Aap <een-niet-bestaande-kleineaap@xs4all.nl>
Subject: Re: Why would I use Perl in place of C/C++?
Message-Id: <4593c25a$0$31939$e4fe514c@dreader31.news.xs4all.nl>

Kleine Aap wrote:

> > Michele Dondi wrote:
> > Classical example: a full program that filters input lines outputting
> > only unique ones in whichever order they come can be a simple oneliner
> > like the following
> >
> >   perl -pe"$_ x=!$$_++"

> Fascinating! Could someone elaborate on this? Take it apart so to speak?
> 
> I know the -p switch automatically wraps the -e code with a loop. But I'm
> quite puzzled with the cryptic "$_ x=!$$_++"
> 
> I e.g. guess the $$ at the right side of the = is not the process id?

Okay, I think I got it already...

The trick is the symbolic reference with the name of the input line? And the
value of which is incremented each time that it occurs in the input? Only
the first time the value is 0 (by implicit initialization) and the !
results in a 1 for the multiplication (x) operator. Next time it occurs the
multiplication operator gets a 0 and hence skips the string.

Black Perl magic indeed :-)



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

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 V10 Issue 10101
****************************************


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