 |
|
 |
|
Next: futex question
|
| Author |
Message |
External

Since: Jul 31, 2007 Posts: 108
|
(Msg. 61) Posted: Wed Oct 14, 2009 9:20 am
Post subject: Re: wm menu (was Re: [...] xfce or fluxbox - why not?) [Login to view extended thread Info.] Archived from groups: alt>os>linux>slackware (more info?)
|
|
|
On 2009-10-14, Loki Harfagr <l0k1 DeleteThis @thedarkdesign.free.fr.INVALID> wrote:
> interesting, I can feel the lingo flamewaaaaar a comin' ,-)
Hardly. As I've said often enough, I'm no code kid. Bash is coming
along, albeit a slog. I can basic html at gunpoint. Lisp is somewhat
comprehensible, in a bizarre twisted sorta way. Even python and php
are not too scary at a distance. But, perl? The guy who created that
mess isn't even human.
You make more sense, Loki!
nb |
|
| Back to top |
|
 |  |
External

Since: Aug 28, 2009 Posts: 22
|
(Msg. 62) Posted: Wed Oct 14, 2009 11:20 am
Post subject: Re: wm menu (was Re: [...] xfce or fluxbox - why not?) [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Wed, 14 Oct 2009 09:47:36 -0400, notbob <notbob.TakeThisOut@nothome.com> wrote:
> Lisp is somewhat
> comprehensible, in a bizarre twisted sorta way.
When you're ready for the light: Scheme.
Aaron W. Hsu
--
Of all tyrannies, a tyranny sincerely exercised for the good of its
victims may be the most oppressive. -- C. S. Lewis |
|
| Back to top |
|
 |  |
External

Since: Nov 22, 2008 Posts: 53
|
(Msg. 63) Posted: Wed Oct 14, 2009 5:20 pm
Post subject: Re: wm menu (was Re: [...] xfce or fluxbox - why not?) [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Responding to Loki Harfagr:
> Wed, 14 Oct 2009 10:54:46 +0000, Mike Jones did cat :
>
>> Responding to notbob:
>>
>>> On 2009-10-13, Loki Harfagr <l0k1 RemoveThis @thedarkdesign.free.fr.INVALID>
>>> wrote:
>>>
>>>
>>>> It is quite clear that you never met a lot of programmers, you would
>>>> be surprised to see how many of them do a lot of stuff with blunt
>>>> axes
>>>
>>> True.
>>>
>>> "I don't C++ and I don't CLU and I don't hang with the guys that do".
>>> --notbob
>>>
>>> I took a programming course about 30 yrs ago. Not for me. Probably
>>> why I've been trying to learn bash scripting for 10 yrs.
>>>
>>> nb
>>
>>
>> By the time you "get" bash, you've figured out why perl was created.
>
> interesting, I can feel the lingo flamewaaaaar a comin' ,-)
>
> notbob, when you'll have spent a few weeks/years/eons on Perl you'll
> then know why you're back to the toolbox
Mmmmmmm, ok?
Seeing as I'm still in the early stages of playing around with Perl,
precisely because Bash seems to work like a collection of incantational
kludges, why should I avoid Perl, and what would be a good general
purpose scripting language to learn thats likely to be around for some
time, like Perl has been?
I'm thinking Perl is the one partly because of PCRE in various apps, so
why learn two different things when one covers-all-bases thing will do?
--
*===( http://www.400monkeys.com/God/
*===( http://principiadiscordia.com/
*===( http://www.slackware.com/ |
|
| Back to top |
|
 |  |
External

Since: Nov 02, 2008 Posts: 81
|
(Msg. 64) Posted: Wed Oct 14, 2009 7:20 pm
Post subject: Re: wm menu (was Re: [...] xfce or fluxbox - why not?) [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Wed, 14 Oct 2009 22:10:26 GMT, Mike Jones <Not.RemoveThis@Arizona.Bay> wrote:
>Responding to Loki Harfagr:
>
>> Wed, 14 Oct 2009 10:54:46 +0000, Mike Jones did cat :
>>
>>> Responding to notbob:
>>>
>>>> On 2009-10-13, Loki Harfagr <l0k1.RemoveThis@thedarkdesign.free.fr.INVALID>
>>>> wrote:
>>>>
>>>>
>>>>> It is quite clear that you never met a lot of programmers, you would
>>>>> be surprised to see how many of them do a lot of stuff with blunt
>>>>> axes
>>>>
>>>> True.
>>>>
>>>> "I don't C++ and I don't CLU and I don't hang with the guys that do".
>>>> --notbob
>>>>
>>>> I took a programming course about 30 yrs ago. Not for me. Probably
>>>> why I've been trying to learn bash scripting for 10 yrs.
>>>>
>>>> nb
>>>
>>>
>>> By the time you "get" bash, you've figured out why perl was created.
>>
>> interesting, I can feel the lingo flamewaaaaar a comin' ,-)
>>
>> notbob, when you'll have spent a few weeks/years/eons on Perl you'll
>> then know why you're back to the toolbox
>
>
>Mmmmmmm, ok?
>
>Seeing as I'm still in the early stages of playing around with Perl,
>precisely because Bash seems to work like a collection of incantational
>kludges, why should I avoid Perl, and what would be a good general
>purpose scripting language to learn thats likely to be around for some
>time, like Perl has been?
>
>I'm thinking Perl is the one partly because of PCRE in various apps, so
>why learn two different things when one covers-all-bases thing will do?
bash + (g)awk is good, as awk can be used instead of that weird mix of
sed and cut 'helpers'.
Awk is a language from the '70s, awk programs are compiled at runtime,
like perl.
Perl has the advantage of being able to do everything (anything?), but
the disadvantage of being a write-only language
Since I learned awk I don't use sed, cut and friends -- awk can do
that and more. Awk is good for one-liners as well as the odd thousand
liner, as well as shell script glue logic.
But I don't think this is flamewar territory, the various languages
available for use have their strong and weak points. Play with what
feels good, productive.
I don't go near new languages often 'cos I'm an old fart, poor memory.
Grant.
--
http://bugsplatter.id.au |
|
| Back to top |
|
 |  |
External

Since: Dec 06, 2004 Posts: 75
|
(Msg. 65) Posted: Wed Oct 14, 2009 11:20 pm
Post subject: Re: wm menu (was Re: [...] xfce or fluxbox - why not?) [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Thu, 15 Oct 2009 10:14:50 +1100, Grant wrote:
> Perl has the advantage of being able to do everything (anything?), but
> the disadvantage of being a write-only language
Perl has earned that (undeserved) reputation thanks to shoddy work by
lazy programmers. It need not be a write-only language. My own Perl
programs are quite readable, even if they're not masterpieced of
programming ingenuity.
Just because one *can* write obfuscated code in Perl does not suppose
that one should.
--
----------------------------------------------------------------------
Sylvain Robitaille syl.TakeThisOut@encs.concordia.ca
Systems analyst / AITS Concordia University
Faculty of Engineering and Computer Science Montreal, Quebec, Canada
---------------------------------------------------------------------- |
|
| Back to top |
|
 |  |
External

Since: Nov 02, 2008 Posts: 81
|
(Msg. 66) Posted: Thu Oct 15, 2009 3:20 am
Post subject: Re: wm menu (was Re: [...] xfce or fluxbox - why not?) [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Thu, 15 Oct 2009 03:38:46 +0000 (UTC), Sylvain Robitaille <syl.TakeThisOut@alcor.concordia.ca> wrote:
>On Thu, 15 Oct 2009 10:14:50 +1100, Grant wrote:
>
>> Perl has the advantage of being able to do everything (anything?), but
>> the disadvantage of being a write-only language
>
>Perl has earned that (undeserved) reputation thanks to shoddy work by
>lazy programmers. It need not be a write-only language. My own Perl
>programs are quite readable, even if they're not masterpieced of
>programming ingenuity.
>
>Just because one *can* write obfuscated code in Perl does not suppose
>that one should.
Hmm:
#### query handler
sub do_query($) {
my $q = shift;
my ($a, $cc, $cn, @d, $da, $hi, $lo, $m, $na, $nz, $r, $rf, %rt);
($q, $rf) = split /\s+/, $q, 2; $da = 0;
if ($q !~ /^[0-9\.]+$/) {
++$da;
}
elsif ($q =~ /\./) {
@d = split /\./, $q, 4; $a = 0;
for ($m = 0; $m < 4; $m++) {
if ($d[$m] > 255) { ++$da }
$a *= 256; $a += $d[$m];
}
}
else {
++$da if ($q > 0xffffffff); $a = $q;
}
if ($da) {
$da = $q = $na = $lo = $hi = $cc = '?'; $cn = 'bad query';
}
else {
$lo = 1; $hi = $ip2c_cn; $da = $a;
while ($hi - $lo > 1) {
$m = ($lo + $hi) >> 1;
if ($ip2c_lo[$m] < $a) {
$lo = $m
} else {
$hi = $m
}
}
if ($ip2c_lo[$hi] > $a) { --$hi }
if ($ip2c_hi[$hi] < $a) {
$na = $lo = $hi = '-';
$cc = '--'; $cn = 'unassigned';
}
else {
$cc = $ip2c_cc[$hi]; $cn = $cc_name{$cc};
....
vs
split(addr, a, "."); i = ((a[1]*256+a[2])*256+a[3])*256+a[4]
l = 1; h = ipdatsize
while (h - l > 1) {
m = int((l + h) / 2)
if (ipdata_str[m] < i) { l = m } else { h = m }
}
if (i < ipdata_str[h]) --h
if (i > ipdata_end[h]) return "--:unassigned"
# return country code and country name
return sprintf("%s:%s", ipdata_cc[h], ipname[ipdata_cc[h]])
Grant.
--
http://bugsplatter.id.au |
|
| Back to top |
|
 |  |
External

Since: Jun 11, 2004 Posts: 114
|
(Msg. 67) Posted: Thu Oct 15, 2009 3:20 am
Post subject: Re: wm menu (was Re: [...] xfce or fluxbox - why not?) [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On 2009-10-15, Grant <g_r_a_n_t_ RemoveThis @bugsplatter.id.au> wrote:
>
> Hmm:
>
> #### query handler
> sub do_query($) {
>
> my $q = shift;
> my ($a, $cc, $cn, @d, $da, $hi, $lo, $m, $na, $nz, $r, $rf, %rt);
>
> ($q, $rf) = split /\s+/, $q, 2; $da = 0;
>
> if ($q !~ /^[0-9\.]+$/) {
> ++$da;
> }
[snip]
If this subroutine is doing what I think (trying to map an IP address to
a country code?), you'd probably be better off using a module. Thus
Sylvain's point is still valid--just because you can write unreadable
Perl doesn't mean you have to.
Anyway, religious wars are offtopic.
--keith
--
kkeller-usenet RemoveThis @wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information |
|
| Back to top |
|
 |  |
External

Since: Nov 02, 2008 Posts: 81
|
(Msg. 68) Posted: Thu Oct 15, 2009 5:20 am
Post subject: Re: wm menu (was Re: [...] xfce or fluxbox - why not?) [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Wed, 14 Oct 2009 23:14:56 -0700, Keith Keller <kkeller-usenet.DeleteThis@wombat.san-francisco.ca.us> wrote:
....
>If this subroutine is doing what I think (trying to map an IP address to
>a country code?), you'd probably be better off using a module. Thus
>Sylvain's point is still valid--just because you can write unreadable
>Perl doesn't mean you have to.
What? 'cos I didn't write a module? A module doesn't make the
code more readable.
Grant.
--
http://bugsplatter.id.au |
|
| Back to top |
|
 |  |
External

Since: Jun 11, 2004 Posts: 114
|
(Msg. 69) Posted: Thu Oct 15, 2009 10:40 am
Post subject: Re: wm menu (was Re: [...] xfce or fluxbox - why not?) [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On 2009-10-15, Grant <g_r_a_n_t_.RemoveThis@bugsplatter.id.au> wrote:
> On Wed, 14 Oct 2009 23:14:56 -0700, Keith Keller <kkeller-usenet.RemoveThis@wombat.san-francisco.ca.us> wrote:
>
> ...
>>If this subroutine is doing what I think (trying to map an IP address to
>>a country code?), you'd probably be better off using a module. Thus
>>Sylvain's point is still valid--just because you can write unreadable
>>Perl doesn't mean you have to.
>
> What? 'cos I didn't write a module?
No, because you didn't use an existing module. There is (for example)
http://search.cpan.org/~nwetters/IP-Country-2.27/lib/IP/Country.pm
which claims to do "fast lookup of country codes from IP addresses".
(There may be other modules that do the same thing; I didn't look.)
> A module doesn't make the code more readable.
Using a module makes *your* code more readable, even if the module
itself is not.
--keith
--
kkeller-usenet.RemoveThis@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information |
|
| Back to top |
|
 |  |
External

Since: Dec 06, 2004 Posts: 75
|
(Msg. 70) Posted: Thu Oct 15, 2009 11:20 am
Post subject: Re: wm menu (was Re: [...] xfce or fluxbox - why not?) [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Thu, 15 Oct 2009 19:40:50 +1100, Grant wrote:
> What? 'cos I didn't write a module? A module doesn't make the
> code more readable.
No, but proper variable names might have gone a long way towards making
the example you posted more readable.
Just because Perl allows you to be lazy doesn't mean you should be, and
just because you can post a barely readable Perl snippet doesn't mean
that Perl forces that style on the programmer.
--
----------------------------------------------------------------------
Sylvain Robitaille syl DeleteThis @encs.concordia.ca
Systems analyst / AITS Concordia University
Faculty of Engineering and Computer Science Montreal, Quebec, Canada
---------------------------------------------------------------------- |
|
| Back to top |
|
 |  |
External

Since: Nov 19, 2008 Posts: 37
|
(Msg. 71) Posted: Thu Oct 15, 2009 1:20 pm
Post subject: Re: wm menu (was Re: [...] xfce or fluxbox - why not?) [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Thu, 15 Oct 2009 14:28:59 +0000, Sylvain Robitaille did cat :
> On Thu, 15 Oct 2009 19:40:50 +1100, Grant wrote:
>
>> What? 'cos I didn't write a module? A module doesn't make the code
>> more readable.
>
> No, but proper variable names might have gone a long way towards making
> the example you posted more readable.
>
> Just because Perl allows you to be lazy doesn't mean you should be, and
> just because you can post a barely readable Perl snippet doesn't mean
> that Perl forces that style on the programmer.
well, that's right, a counterproof has never made a proof, but
really the Perl code posted by Grant is a part of the 5p100
best, in readability and reuseability, Perl code I've ever seen.
I reckon that these 5p100 are far below the 1p100 best read*
Perl code I've met (and I use a lot of them) but in contrast
most bash and awk code (besides golf/obfuscation games  have
a better overall readability and consistence.
Now, there are also some factors positive for the use of
Perl, like presence of a huge base of network modules,
or like the fact that a product you use (e.g. Mimedefang)
uses a good set of good libs and modules and UI properly
written in Perl.
Still, I'm waiting with a smile and impatient fear the day when
Perl6 will out and spread a new veil of language looting over the
naive world of dirty code writers ,D) |
|
| Back to top |
|
 |  |
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
 |
|
|