[26538] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8685 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 18 11:05:59 2005

Date: Fri, 18 Nov 2005 08:05:05 -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           Fri, 18 Nov 2005     Volume: 10 Number: 8685

Today's topics:
    Re: /(foo|)/ vs /(foo)?/ <wadew_NOSPAM@ti.com>
        Guaranteed Search Engine Placement - www.GuaranteedTop2 <angelina@nowhere.sci>
    Re: Win32::GUI:  Issues, Accessibility, Clipboard (part <vtatila@mail.student.oulu.fi>
    Re: Win32::GUI:  Issues, Accessibility, Clipboard (part <1usa@llenroc.ude.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 18 Nov 2005 09:22:18 -0600
From: Wade Whitaker <wadew_NOSPAM@ti.com>
Subject: Re: /(foo|)/ vs /(foo)?/
Message-Id: <dlkrja$m37$1@home.itg.ti.com>

kj wrote:
> While looking at someone else's code I came across a regular
> expression that included a construct like /(foo|)/.  As far as I
> can tell, it should produce the same result as /(foo)?/.  But the
> author of the code knows a heck of a lot more Perl than I do, so
> I'm wondering why she would have picked the former over the latter.
> Any ideas?
> 
> Thanks!
> 
> kj
> 
> P.S. I'm aware of the fact that /(|foo)/ would produce very different
> results from /(foo|)/ or /(foo)?/, but that's neither here nor
> there.
I ran into a place where this caused me a problem with a regular expression so 
I came to understand.

(foo)? says give me 1 or 0 occurances of foo.
(|foo) says give me 0 or 1 occurences of foo.
(foo|) says give me 1 or 0 occurences of foo which means that (foo)? is 
redundant syntax in perl that should always be able to be replaced.  i.e. 
search for )? and replace it with a | before at the beginning or the end.
*? and +? are ok because they are saying don't be greedy.
Anyone want to argue against that? Show a case where it is not true?

I found this out while trying to write a regular expression to find the 
matching quote while parsing files.  If I found a '"' I wanted to find the 
matching '"' without matching on '\"'.  It took me a year to finally learn 
enough to do this.

The answer is: m/(["'])(|.*?[^\\])(\1|^Z)/gs works where
                m/(["'])(.*?[^\\])?(\1|^Z)/gs did not.

Previous attempts that did not work are:
#        $$fptr =~ m/\G((?:.*?[^\\])?)($q|^Z)/gs; # find ",'
#        $$fptr =~ m/\G(.*?(?!\\))($q|^Z)/gs; # find ",'
#        $$fptr =~ m/\G((?:.*?(?!\\))?)($q|^Z)/gs; # find ",'
#                    $$fptr =~ m/\G((?:.*?(?!\\$q))?($q|^Z))/gs; # find ",'

Wade


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

Date: Fri, 18 Nov 2005 14:14:31 +0100
From: "Angelina" <angelina@nowhere.sci>
Subject: Guaranteed Search Engine Placement - www.GuaranteedTop20.info
Message-Id: <dlkjo0$pt6$19@pomoranche.gu.net>



-- 
Top listing in Google, Yahoo, MSN, AltaVista, DMOZ and many others. Visit 
http://www.guaranteedtop20.info/addurl/submit.html to see how we can help!







RE: Guaranteed Search Engine Placement
URL: http://www.guaranteedtop20.info/addurl/submit.html
DATE: 11.18.2005




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

Date: Fri, 18 Nov 2005 14:00:10 +0200
From: "Veli-Pekka Tätilä" <vtatila@mail.student.oulu.fi>
Subject: Re: Win32::GUI:  Issues, Accessibility, Clipboard (partially OT)
Message-Id: <dlkfoj$9f5$1@news.oulu.fi>

Rob wrote:
> Veli-Pekka Tätilä wrote:
> Win32::GUI support for Unicode is *very* limited at the moment.  It is
> possible, but you have to jump through some pretty large hoops.
Ok good to know. As the app for which the GUI is to be build essentially 
requires unicode support, I guess Win32::GUI might be out then. But I'll be 
sure to use that lib myself as it is about the only one which is accessible 
on a WIndows machine as I've said.

>> http://sourceforge.net/projects/perl-win32-gui
> New home page at:
> http://perl-win32-gui.sourceforge.net/
I've always just Googled for the home page and it gives my original link 
first. Thanks for pointing out that this site is way out of date.

>> http://jeb.ca/perl/win32-gui-docs/index.pl/home
> That documentation is very old.  Updated (official) docs can be found at:
> http://perl-win32-gui.sourceforge.net/docs/
Hey, you saved my day by pointing this out. I mean, I don't know hhow I've 
managed to miss them but for a long long time I thought my WIn32::GUI 
installation carried out with PPM didn't come with the docs.
Thus I've been browsing on-line the out-dated docs I mentioned. In the end 
it was my own stupidity, I guess, in only glancing at the text version of 
the main HTml files. MOst of the interesting stuff is links in that file. I 
might be wrong, but I also seem to distinctly recall that some early version 
of WIn32::GUI had only one or two files in the .\html\site\lib\win32\gui\ 
folder and it's been ages since I looked, oh well.

> It's pretty advanced if you're coming from a win32 api/C/C++ background.
Quite right, maybe I was comparing it a bit unfairly against Java and Swing. 
I mostly recall my Win32 API programming experiments with horror. The amount 
of lines it took to create a basic window, the explicit event loop and the 
switch statement for event handling come to mind first. I do recall the ease 
with which I manage to create some basic WIndows using WIn32::GUI.

> There's the (very) basic Win32::GUI::GridLayout.
Thanks, I'll check the docs. But I'll also be lazy and fire up a quick 
question asking if it is similar to Java's Grid layout? That is a 
rectangular grid of equal-sized controls.

>> you don't seem to be able to pull in dialogs from resource files
> No, you can't do this, although if you want to raise a feature request 
> <snip>
I think I might. That support with event handling would rock. Though I 
haven't used the mouse too much and need to design with heavy full-screen 
magnification, which is slow, I still prefer dragging and dropping 
conponents in a dialog graphically. That is at least if it is a static 
dialog.

>> where to get the exact font metrics that can be used to write
>> resolution, font and DPI independent code avoid it.
> Me too.
Ah. again glad to hear this is a recognized problem. Petzold seems to use 
functions like
GetSystemMetrics and GetTextMetrics. Maybe these two and the related 
functions could be used possibly by importing them using Win32::API.

> work;  I can't comment in Win32::OLE.
Well, I've noticed that if you load OLE and try to create two or more 
threads the whole of Perl will crash. I asked in the Win32 list and it is a 
known problem with no Perl-only solution.

> try to address some of the accessibility issues that you raised with
> Win32::GUI - in particular with Win32::GUI::Grid IIRC.
Hmm I don't exactly recall this instance. I think I've mostly been 
complaining about TK.
If you can point me to sample code or real world apps that use the most of 
WIn32::GUI I could evaluate the keyboard and screen reader usability if 
you'd like. I've done similar things before, reporting bits and pieces that 
are inaccessible and giving a list of possible work-arounds.

In addition to the problems I've encountered myself with inaccessible apps, 
one document that opened my eyes to how difficult achieving usability is, 
was Sun's early evaluation of Gnome. The document can be found at:

http://developer.gnome.org/projects/gup/ut1_report/report_main.html

But custom GUI libs aren't even bad in comparison to virtual instruments in 
music applications. Though this is VST specific and thus highly OT, many of 
the principles apply to any mouse-oriented interface with custom controls:

http://www.student.oulu.fi/~vtatila/vst_access.html

> To get back on topic, the OP may find the Win32::Clipboard package
> useful
I've used that module succesfully. I'm not sure about the unicode support, 
either. But I've never really gotten the WaitForChange function to work as 
expected so I've been manually polling for changes. Maybe I'm missing 
something in the docs. Here's a simple test app:

use strict; use warnings;
use Win32::Clipboard;
my $clip = Win32::Clipboard->new();
for(;;)
{ # Infinite loop for testing purposes.
   $clip->WaitForChange();
   print 'Got: ', $clip->GetText(), "\n";
} # for

When I run this, it prints the previous clipboard contents on the screen 
even if the contents have not changed since the beginning of the program. 
not only that but it seems to freeze in the WaitForChange method the second 
time even if I copy more text in the clipboard.

-- 
With kind regards Veli-Pekka Tätilä (vtatila@mail.student.oulu.fi)
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila/ 




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

Date: Fri, 18 Nov 2005 12:27:08 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Win32::GUI:  Issues, Accessibility, Clipboard (partially OT)
Message-Id: <Xns97124BCFAEA56asu1cornelledu@127.0.0.1>

"Veli-Pekka Tätilä" <vtatila@mail.student.oulu.fi> wrote in
news:dlkfoj$9f5$1@news.oulu.fi: 
> Rob wrote:
>> Veli-Pekka Tätilä wrote:
>>> http://jeb.ca/perl/win32-gui-docs/index.pl/home
>> That documentation is very old.  Updated (official) docs can be found
>> at: http://perl-win32-gui.sourceforge.net/docs/
> Hey, you saved my day by pointing this out. 

I got a 404 when I tried that page.

http://perl-win32-gui.sourceforge.net/cgi-bin/docs.cgi

seems to work.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

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


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