FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » query: how many use PHP for linux scripts
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
PHP Gui Toolkits (was: query: how many use PHP for linux scripts) [message #185916 is a reply to message #185912] Wed, 14 May 2014 12:58 Go to previous messageGo to next message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma: 0
Senior Member
Jerry Stuckle wrote:

> On 5/14/2014 5:18 AM, crankypuss wrote:
>
>> All that's mostly opinion, and only mentioned because you said you'd
>> never attempt a GUI application in PHP, and I wanted to point out that
>> it isn't so much because of PHP itself that your choice there is
>> sensible (though drawing individual pixels in an interpreted language is
>> somewhat questionable), but because there's simply no good support for
>> writing GUI applications in PHP.
>>
>
> A bit of a misunderstanding here - sorry, I wasn't clear. I would never
> build an application in PHP - GUI or not. It's great for scripts, but
> too wide open for my tastes. I prefer the ability to compartmentalize
> my code more as in C, C++ and Java. Plus, compiled languages are faster.
>
>> That's as it is, but there's no law of the universe which prohibits such
>> support from being developed for PHP or some PHP-derivative.
>
> There is a GUI library with a PHP interface PHP (GTK). I haven't tried
> it, but I would if I had a short script which needed a GUI.

It seems to me that PHPGTK[1] is dead; there is, however, wxPHP[2],
which seems to be actively developed.

[1] <http://gtk.php.net/>
[2] <http://wxphp.org/>

[Xpost & Fup2 comp.lang.php]

--
Christoph M. Becker
Re: query: how many use PHP for linux scripts [message #185918 is a reply to message #185915] Wed, 14 May 2014 14:23 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 14/05/14 13:39, Ben Bacarisse wrote:
> The Natural Philosopher <tnp(at)invalid(dot)invalid> writes:
>
>> On 13/05/14 21:35, Tim Streater wrote:
> <snip>
>>> I can't be arsed to fiddle around with C these days. Too much faffing
>>> around with declarations - and no string handling to speak of either.
>>>
>>> Non-issues in PHP.
>>>
>> string handling is the chief reason I prefer C..
>
> That seems odd since PHP has almost every single low-level C string
> function available to it. You can strspn and strncmp to your heart's
> content in PHP. Pretty much the only ones missing are strcat and strcpy
> but, surely, they can't be why you prefer C.
>
No., I prefer it because ex of the library, its easier to manipulate at
the raw level.

> A PHP translation of C string handling would inevitably be simpler since
> there would be no need manage the storage. That's the biggest advantage
> in my opinion, even if never used any of PHP's more complex string
> manipulation.
>

when managing storage is no harder than

char buf[1024];

I cant see the issue.


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: query: how many use PHP for linux scripts [message #185919 is a reply to message #185918] Wed, 14 May 2014 18:00 Go to previous messageGo to next message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma: 0
Senior Member
The Natural Philosopher wrote:

> On 14/05/14 13:39, Ben Bacarisse wrote:
>
>> That seems odd since PHP has almost every single low-level C string
>> function available to it. You can strspn and strncmp to your heart's
>> content in PHP. Pretty much the only ones missing are strcat and strcpy
>> but, surely, they can't be why you prefer C.
>>
> No., I prefer it because ex of the library, its easier to manipulate at
> the raw level.

I disagree.

>> A PHP translation of C string handling would inevitably be simpler since
>> there would be no need manage the storage. That's the biggest advantage
>> in my opinion, even if never used any of PHP's more complex string
>> manipulation.

ACK.

> when managing storage is no harder than
>
> char buf[1024];
>
> I cant see the issue.

What happens when you store a string (say, user input) with more than
1023 bytes in buf? Oh, well, of course you won't--good luck.

[X post & fup2 comp.lang.php]

--
Christoph M. Becker
Re: query: how many use PHP for linux scripts [message #185920 is a reply to message #185901] Wed, 14 May 2014 19:54 Go to previous messageGo to next message
JEDIDIAH is currently offline  JEDIDIAH
Messages: 4
Registered: May 2014
Karma: 0
Junior Member
On 2014-05-14, The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
> On 14/05/14 09:44, crankypuss wrote:
>> On 05/13/2014 03:10 PM, JEDIDIAH wrote:
>>> PHP is fine if you're working with the web, kind of pointless
>>> otherwise.
>>
>> I find that to be absolutely not the case.
>
> but others don't. They take a personal and opposite view.
>
> PHP CAN be used for other things. But most of us were dong other things
> perfectly well before we discovered PHP and for us PHP only has one
> advantage: its widely supported as a web scripting language.

As a tool for C avoidance, PHP is a bit of a johnny-come-lately.
If that's all you're really interested in, then there are plenty of
more well established options with whatever bells and whistles you're
interested in.

C vs. PHP is just such a weird dichotomy because pure C is so
ancient and PHP is kind of not (and thus somewhat redundant).

On the other hand, PHP has gained itself a reputation for being
the modern day equivalent of Sendmail or BIND in terms of being a
security disaster.

[deletia]

--
Apple: Because the individual is not statistically meaningful. |||
/ | \
Re: query: how many use PHP for linux scripts [message #185921 is a reply to message #185886] Wed, 14 May 2014 19:49 Go to previous messageGo to next message
JEDIDIAH is currently offline  JEDIDIAH
Messages: 4
Registered: May 2014
Karma: 0
Junior Member
On 2014-05-13, Tim Streater <timstreater(at)greenbee(dot)net> wrote:
> In article <slrnln52i9(dot)nki(dot)jedi(at)nomad(dot)mishnet>, JEDIDIAH
> <jedi(at)nomad(dot)mishnet> wrote:
>
>> On 2014-05-13, Tim Streater <timstreater(at)greenbee(dot)net> wrote:
>>> In article <lktn4a$n8q$1(at)news(dot)albasani(dot)net>, The Natural Philosopher
>>> <tnp(at)invalid(dot)invalid> wrote:
>>>
>>>> On 13/05/14 17:32, Johnny wrote:
>>>
>>>> > Linux Shell Scripting Tutorial v1.05r3
>>>> > A Beginner's handbook
>>>> >
>>>> > http://www.freeos.com/guides/lsst/
>>>> Prezactly. PHP is optimised for HTML work really.
>>>
>>> Who cares.
>>>
>>>> There are far better languages to do other stuff in, though I have to
>>>> say I dislike scripting langauges really and prefer to use C wherever
>>>> possible.
>>>
>>> I can't be arsed to fiddle around with C these days. Too much faffing
>>> around with declarations - and no string handling to speak of either.
>>>
>>> Non-issues in PHP.
>>
>> PHP is fine if you're working with the web, kind of pointless otherwise.
>
> Depends what you're doing. My app has 74 PHP scripts, some of which do
> things like communicate with remote hosts, rotate logs, move files
> around, read/write a variety of SQLite databases. Doubtless all this
> could be done in C, but why should I bother.
>

That's a false dichotomy there: C or PHP.

--
Apple: Because the individual is not statistically meaningful. |||
/ | \
Re: query: how many use PHP for linux scripts [message #185922 is a reply to message #185919] Wed, 14 May 2014 20:48 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 14/05/14 19:00, Christoph Michael Becker wrote:
> The Natural Philosopher wrote:
>
>> On 14/05/14 13:39, Ben Bacarisse wrote:
>>
>>> That seems odd since PHP has almost every single low-level C string
>>> function available to it. You can strspn and strncmp to your heart's
>>> content in PHP. Pretty much the only ones missing are strcat and strcpy
>>> but, surely, they can't be why you prefer C.
>>>
>> No., I prefer it because ex of the library, its easier to manipulate at
>> the raw level.
>
> I disagree.
>
>>> A PHP translation of C string handling would inevitably be simpler since
>>> there would be no need manage the storage. That's the biggest advantage
>>> in my opinion, even if never used any of PHP's more complex string
>>> manipulation.
>
> ACK.
>
>> when managing storage is no harder than
>>
>> char buf[1024];
>>
>> I cant see the issue.
>
> What happens when you store a string (say, user input) with more than
> 1023 bytes in buf? Oh, well, of course you won't--good luck.
>

I make sure I don't.
strncpy...

If I really dont know, well then calculate first and malloc.

But modern machines have so MUCH ram its not really worth bothering
about allocating huge stack buffers..



> [X post & fup2 comp.lang.php]
>


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: query: how many use PHP for linux scripts [message #185924 is a reply to message #185920] Wed, 14 May 2014 20:50 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 14/05/14 20:54, JEDIDIAH wrote:
> On 2014-05-14, The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>> On 14/05/14 09:44, crankypuss wrote:
>>> On 05/13/2014 03:10 PM, JEDIDIAH wrote:
>>>> PHP is fine if you're working with the web, kind of pointless
>>>> otherwise.
>>>
>>> I find that to be absolutely not the case.
>>
>> but others don't. They take a personal and opposite view.
>>
>> PHP CAN be used for other things. But most of us were dong other things
>> perfectly well before we discovered PHP and for us PHP only has one
>> advantage: its widely supported as a web scripting language.
>
> As a tool for C avoidance, PHP is a bit of a johnny-come-lately.
> If that's all you're really interested in, then there are plenty of
> more well established options with whatever bells and whistles you're
> interested in.
>
> C vs. PHP is just such a weird dichotomy because pure C is so
> ancient and PHP is kind of not (and thus somewhat redundant).
>

C is still the language that fits everything.

> On the other hand, PHP has gained itself a reputation for being
> the modern day equivalent of Sendmail or BIND in terms of being a
> security disaster.
>

sendmail wasn't a security disaster if you set it up OK and bind - well
I've never had a problem

Nor with PHP either

Juts be carefiul how you use it.

> [deletia]
>


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: query: how many use PHP for linux scripts [message #185925 is a reply to message #185918] Wed, 14 May 2014 21:05 Go to previous messageGo to next message
Ben Bacarisse is currently offline  Ben Bacarisse
Messages: 82
Registered: November 2013
Karma: 0
Member
The Natural Philosopher <tnp(at)invalid(dot)invalid> writes:

> On 14/05/14 13:39, Ben Bacarisse wrote:
>> The Natural Philosopher <tnp(at)invalid(dot)invalid> writes:
>>
>>> On 13/05/14 21:35, Tim Streater wrote:
>> <snip>
>>>> I can't be arsed to fiddle around with C these days. Too much faffing
>>>> around with declarations - and no string handling to speak of either.
>>>>
>>>> Non-issues in PHP.
>>>>
>>> string handling is the chief reason I prefer C..
>>
>> That seems odd since PHP has almost every single low-level C string
>> function available to it. You can strspn and strncmp to your heart's
>> content in PHP. Pretty much the only ones missing are strcat and strcpy
>> but, surely, they can't be why you prefer C.
>>
> No., I prefer it because ex of the library, its easier to manipulate
> at the raw level.

Is "ex of the library" a typo?

Anyway, it still seems odd. I don't know what "its easier to manipulate
at the raw level" means, but if using C's string functions are, for you,
easier than writing PHP's almost identical string functions, so be it.
I can live with one more mystery in my life.

>> A PHP translation of C string handling would inevitably be simpler since
>> there would be no need manage the storage. That's the biggest advantage
>> in my opinion, even if never used any of PHP's more complex string
>> manipulation.
>>
>
> when managing storage is no harder than
>
> char buf[1024];
>
> I cant see the issue.

No, indeed. Maybe you perspective comes from use-case in which either
static or automatic arrays of fixed size are all you need.

--
Ben.
Re: query: how many use PHP for linux scripts [message #185926 is a reply to message #185922] Wed, 14 May 2014 21:18 Go to previous messageGo to next message
Ben Bacarisse is currently offline  Ben Bacarisse
Messages: 82
Registered: November 2013
Karma: 0
Member
The Natural Philosopher <tnp(at)invalid(dot)invalid> writes:

> On 14/05/14 19:00, Christoph Michael Becker wrote:
>> The Natural Philosopher wrote:
>>
>>> On 14/05/14 13:39, Ben Bacarisse wrote:
<snip>
>>>> A PHP translation of C string handling would inevitably be simpler since
>>>> there would be no need manage the storage. That's the biggest advantage
>>>> in my opinion, even if never used any of PHP's more complex string
>>>> manipulation.
>>
>> ACK.
>>
>>> when managing storage is no harder than
>>>
>>> char buf[1024];
>>>
>>> I cant see the issue.
>>
>> What happens when you store a string (say, user input) with more than
>> 1023 bytes in buf? Oh, well, of course you won't--good luck.
>>
>
> I make sure I don't.
> strncpy...

Well, I never saw that coming. You must be one of the few experienced C
programmers to consider strncpy to be a solution for anything!

> If I really dont know, well then calculate first and malloc.

....but then memory management is not a simple as a declaration (which is
where this started). In PHP you need neither.

<snip>
--
Ben.
Re: query: how many use PHP for linux scripts [message #185927 is a reply to message #185904] Wed, 14 May 2014 21:23 Go to previous messageGo to next message
Mike Yetto is currently offline  Mike Yetto
Messages: 4
Registered: May 2014
Karma: 0
Junior Member
Be it known crankypuss <crankypuss(at)nomail(dot)invalid> has declared...
> On 05/13/2014 05:02 PM, Mike Yetto wrote:
>> Be it known Allodoxaphobia <knock_yourself_out(at)example(dot)net> has declared...
>>> Horses. Courses. REXX
>>
>> In VM/CMS and MVS I use REXX and for Linux I prefer shell
>> scripting or perl. As is indicated by its name (a recursive
>> acronym - PHP Hypertext Preprocessor) it's intended use is web
>> pages.
>>
>> Mike "mostly hand signals for the dog" Yetto
>>

> PHP can validly be used for whatever one can use it for, just like any
> other programming tool.

> HOWEVER. Note that Rexx is the VM/CMS "system product interpreter" (or
> at least that's what they used to call it). Something of equal or
> greater capability might someday become the "linux system interpreter",
> and would that be a bad thing?

It would be a neutral thing if it could be ignored, bad if
enforced.

Mike "would enforcement even be possible?" Yetto
--
"Question with boldness even the existence of God; because, if
there be one, he must more approve of the homage of reason than
that of blindfolded fear."
- Thomas Jefferson
Re: query: how many use PHP for linux scripts [message #185928 is a reply to message #185925] Wed, 14 May 2014 22:07 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 14/05/14 22:05, Ben Bacarisse wrote:
> The Natural Philosopher <tnp(at)invalid(dot)invalid> writes:
>
>> On 14/05/14 13:39, Ben Bacarisse wrote:
>>> The Natural Philosopher <tnp(at)invalid(dot)invalid> writes:
>>>
>>>> On 13/05/14 21:35, Tim Streater wrote:
>>> <snip>
>>>> > I can't be arsed to fiddle around with C these days. Too much faffing
>>>> > around with declarations - and no string handling to speak of either.
>>>> >
>>>> > Non-issues in PHP.
>>>> >
>>>> string handling is the chief reason I prefer C..
>>>
>>> That seems odd since PHP has almost every single low-level C string
>>> function available to it. You can strspn and strncmp to your heart's
>>> content in PHP. Pretty much the only ones missing are strcat and strcpy
>>> but, surely, they can't be why you prefer C.
>>>
>> No., I prefer it because ex of the library, its easier to manipulate
>> at the raw level.
>
> Is "ex of the library" a typo?
>

No.

I mean you don't need to use library stuff to manipulate strings in c.




> Anyway, it still seems odd. I don't know what "its easier to manipulate
> at the raw level" means, but if using C's string functions are, for you,
> easier than writing PHP's almost identical string functions, so be it.
> I can live with one more mystery in my life.
>
>>> A PHP translation of C string handling would inevitably be simpler since
>>> there would be no need manage the storage. That's the biggest advantage
>>> in my opinion, even if never used any of PHP's more complex string
>>> manipulation.
>>>
>>
>> when managing storage is no harder than
>>
>> char buf[1024];
>>
>> I cant see the issue.
>
> No, indeed. Maybe you perspective comes from use-case in which either
> static or automatic arrays of fixed size are all you need.
>


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: query: how many use PHP for linux scripts [message #185930 is a reply to message #185926] Wed, 14 May 2014 22:10 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 14/05/14 22:18, Ben Bacarisse wrote:
> The Natural Philosopher <tnp(at)invalid(dot)invalid> writes:
>
>> On 14/05/14 19:00, Christoph Michael Becker wrote:
>>> The Natural Philosopher wrote:
>>>
>>>> On 14/05/14 13:39, Ben Bacarisse wrote:
> <snip>
>>>> > A PHP translation of C string handling would inevitably be simpler since
>>>> > there would be no need manage the storage. That's the biggest advantage
>>>> > in my opinion, even if never used any of PHP's more complex string
>>>> > manipulation.
>>>
>>> ACK.
>>>
>>>> when managing storage is no harder than
>>>>
>>>> char buf[1024];
>>>>
>>>> I cant see the issue.
>>>
>>> What happens when you store a string (say, user input) with more than
>>> 1023 bytes in buf? Oh, well, of course you won't--good luck.
>>>
>>
>> I make sure I don't.
>> strncpy...
>
> Well, I never saw that coming. You must be one of the few experienced C
> programmers to consider strncpy to be a solution for anything!
>
>> If I really dont know, well then calculate first and malloc.
>
> ...but then memory management is not a simple as a declaration (which is
> where this started). In PHP you need neither.
>

well there ya go.

IF I have a string too long for my buffers something has probably
already gone wrong.

And Id rather not push the system into swap - easier to say 'hey buffer
overflow' and abort.

With PHP, throw it too big a string and weirdness happens as it eats
into memory.



And you still need to do things like mysqli_free() to clear down data
structures.

Inconsistent.

> <snip>
>


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: query: how many use PHP for linux scripts [message #185934 is a reply to message #185904] Thu, 15 May 2014 01:16 Go to previous messageGo to next message
Aragorn is currently offline  Aragorn
Messages: 2
Registered: February 2013
Karma: 0
Junior Member
On Wednesday 14 May 2014 11:24, crankypuss conveyed the following to
alt.os.linux...

> PHP can validly be used for whatever one can use it for, just like any
> other programming tool.

Then I don't see how you can possibly object to a Bourne-compatible
POSIX shell.

> HOWEVER. Note that Rexx is the VM/CMS "system product interpreter"
> (or at least that's what they used to call it). Something of equal or
> greater capability might someday become the "linux system
> interpreter", and would that be a bad thing?

A ReXX interpreter exists for GNU/Linux. Check your repositories.

--
= Aragorn =

http://www.linuxcounter.net - registrant #223157
Re: query: how many use PHP for linux scripts [message #185938 is a reply to message #185924] Thu, 15 May 2014 02:49 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 5/14/2014 4:50 PM, The Natural Philosopher wrote:
> On 14/05/14 20:54, JEDIDIAH wrote:
>> On 2014-05-14, The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>>> On 14/05/14 09:44, crankypuss wrote:
>>>> On 05/13/2014 03:10 PM, JEDIDIAH wrote:
>>>> > PHP is fine if you're working with the web, kind of pointless
>>>> > otherwise.
>>>>
>>>> I find that to be absolutely not the case.
>>>
>>> but others don't. They take a personal and opposite view.
>>>
>>> PHP CAN be used for other things. But most of us were dong other things
>>> perfectly well before we discovered PHP and for us PHP only has one
>>> advantage: its widely supported as a web scripting language.
>>
>> As a tool for C avoidance, PHP is a bit of a johnny-come-lately.
>> If that's all you're really interested in, then there are plenty of
>> more well established options with whatever bells and whistles you're
>> interested in.
>>
>> C vs. PHP is just such a weird dichotomy because pure C is so
>> ancient and PHP is kind of not (and thus somewhat redundant).
>>
>
> C is still the language that fits everything.
>

Anyone who thinks "C" is "the language that fits everything" doesn't
know much about programming.

If "C" were so great, why are there so many other languages?

>> On the other hand, PHP has gained itself a reputation for being
>> the modern day equivalent of Sendmail or BIND in terms of being a
>> security disaster.
>>
>
> sendmail wasn't a security disaster if you set it up OK and bind - well
> I've never had a problem
>

Nope, it isn't a security disaster if you don't use it.

> Nor with PHP either
>
> Juts be carefiul how you use it.
>
>> [deletia]
>>
>
>




--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
Re: query: how many use PHP for linux scripts [message #185939 is a reply to message #185925] Thu, 15 May 2014 02:51 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 5/14/2014 5:05 PM, Ben Bacarisse wrote:
> The Natural Philosopher <tnp(at)invalid(dot)invalid> writes:
>
>> On 14/05/14 13:39, Ben Bacarisse wrote:
>>> The Natural Philosopher <tnp(at)invalid(dot)invalid> writes:
>>>
>>>> On 13/05/14 21:35, Tim Streater wrote:
>>> <snip>
>>>> > I can't be arsed to fiddle around with C these days. Too much faffing
>>>> > around with declarations - and no string handling to speak of either.
>>>> >
>>>> > Non-issues in PHP.
>>>> >
>>>> string handling is the chief reason I prefer C..
>>>
>>> That seems odd since PHP has almost every single low-level C string
>>> function available to it. You can strspn and strncmp to your heart's
>>> content in PHP. Pretty much the only ones missing are strcat and strcpy
>>> but, surely, they can't be why you prefer C.
>>>
>> No., I prefer it because ex of the library, its easier to manipulate
>> at the raw level.
>
> Is "ex of the library" a typo?
>
> Anyway, it still seems odd. I don't know what "its easier to manipulate
> at the raw level" means, but if using C's string functions are, for you,
> easier than writing PHP's almost identical string functions, so be it.
> I can live with one more mystery in my life.
>
>>> A PHP translation of C string handling would inevitably be simpler since
>>> there would be no need manage the storage. That's the biggest advantage
>>> in my opinion, even if never used any of PHP's more complex string
>>> manipulation.
>>>
>>
>> when managing storage is no harder than
>>
>> char buf[1024];
>>
>> I cant see the issue.
>
> No, indeed. Maybe you perspective comes from use-case in which either
> static or automatic arrays of fixed size are all you need.
>

Ben, you're arguing with an idiot. TNP has proven multiple times here
he's neither a programmer nor the EE he claims to be.

Why do you think he's afraid to use his real name?

--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
Re: query: how many use PHP for linux scripts [message #185940 is a reply to message #185927] Thu, 15 May 2014 02:53 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 5/14/2014 5:23 PM, Mike Yetto wrote:
> Be it known crankypuss <crankypuss(at)nomail(dot)invalid> has declared...
>> On 05/13/2014 05:02 PM, Mike Yetto wrote:
>>> Be it known Allodoxaphobia <knock_yourself_out(at)example(dot)net> has declared...
>>>> Horses. Courses. REXX
>>>
>>> In VM/CMS and MVS I use REXX and for Linux I prefer shell
>>> scripting or perl. As is indicated by its name (a recursive
>>> acronym - PHP Hypertext Preprocessor) it's intended use is web
>>> pages.
>>>
>>> Mike "mostly hand signals for the dog" Yetto
>>>
>
>> PHP can validly be used for whatever one can use it for, just like any
>> other programming tool.
>
>> HOWEVER. Note that Rexx is the VM/CMS "system product interpreter" (or
>> at least that's what they used to call it). Something of equal or
>> greater capability might someday become the "linux system interpreter",
>> and would that be a bad thing?
>
> It would be a neutral thing if it could be ignored, bad if
> enforced.
>
> Mike "would enforcement even be possible?" Yetto
>

REXX is a good scripting language for many things. I wrote a lot of
REXX scripts when I was working for IBM. Much easier than doing the
same thing in compiled languages such as C.

Even after leaving IBM I used it quite extensively on OS/2. But it is
one of the many languages I unfortunately have not kept up on over the
years.


--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
Re: query: how many use PHP for linux scripts [message #185942 is a reply to message #185912] Thu, 15 May 2014 08:01 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
On 05/14/2014 06:20 AM, Jerry Stuckle wrote:
> On 5/14/2014 5:18 AM, crankypuss wrote:

<snip>

>> Most of the whizbang flashies that are implemented as parts of "GUI"
>> applications are unnecessary anyway if there is adequate support for a
>> good menu system (which mostly, there isn't). And the idea of using a
>> mouse for everything by dragging this or that icon from hither to yon,
>> or double clicking on an icon, is an oversimplification imo that has
>> caused grievous damage to the computing world as a whole. At the same
>> time the ability to click on a link in html is one of its great
>> benefits, and flyovers can be very helpful.
>>
>
> Simplification is good. YOU may not like it, but hundreds of millions
> of computer users do. And that's who these apps are designed for.

Some folks are trying to make a living by writing software. As such
they may tend toward the proprietary side of things. They need to
choose a language that their corporate successors will be able to
support. They need to choose a language in which they can get the job
done on time. Their software needs to cater to the perceived user
demographic. There are a lot of demands, sometimes conflicting demands,
they have to resolve. That situation tends, at least in my experience,
to be very constricting, one could almost say enslaving.

There is however another situation, another point of view. Some of us
have done the "employed as a programmer" thing and survived to lick our
wounds and look around. We can do whatever we choose, however we like,
and if nobody else likes it that's fine, it won't change our standard of
living.

I'm sure there are even more points of view, but the second one is where
I'm coming from. As such, I tend to look at things somewhat differently
than many/most. For example, I don't want to have to write different
code for a web-app versus a local-app, and I don't want to have to write
different code for an X-based app as opposed to an app that will run
without an active X session. I could write assembler but long ago I got
tired of porting code from architecture to architecture, I could write C
or C++ but there are only a relative few kinds of code that require
enough performance and precision to justify putting up with the syntax
and limitations of those languages.

One of the things I learned about software a long time ago is that
there's no single answer, some answers are broken and others not, some
work better or worse than others in some ways, but it isn't a YES/NO
question.
Re: PHP Gui Toolkits [message #185943 is a reply to message #185916] Thu, 15 May 2014 08:04 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
On 05/14/2014 06:58 AM, Christoph Michael Becker wrote:

> It seems to me that PHPGTK[1] is dead; there is, however, wxPHP[2],
> which seems to be actively developed.
>
> [1] <http://gtk.php.net/>
> [2] <http://wxphp.org/>

Thanks for posting that, wasn't aware of wxPHP. Have you investigated
wxPHP? Comments?
Re: query: how many use PHP for linux scripts [message #185944 is a reply to message #185920] Thu, 15 May 2014 08:07 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
On 05/14/2014 01:54 PM, JEDIDIAH wrote:
> On the other hand, PHP has gained itself a reputation for being
> the modern day equivalent of Sendmail or BIND in terms of being a
> security disaster.

I think that's mostly because of builtin session support and its
tendency to be used for mySQL queries that occur clear-text in the url.
Re: query: how many use PHP for linux scripts [message #185945 is a reply to message #185927] Thu, 15 May 2014 08:13 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
On 05/14/2014 03:23 PM, Mike Yetto wrote:
> Be it known crankypuss <crankypuss(at)nomail(dot)invalid> has declared...
>> On 05/13/2014 05:02 PM, Mike Yetto wrote:
>>> Be it known Allodoxaphobia <knock_yourself_out(at)example(dot)net> has declared...
>>>> Horses. Courses. REXX
>>>
>>> In VM/CMS and MVS I use REXX and for Linux I prefer shell
>>> scripting or perl. As is indicated by its name (a recursive
>>> acronym - PHP Hypertext Preprocessor) it's intended use is web
>>> pages.
>>>
>>> Mike "mostly hand signals for the dog" Yetto
>>>
>
>> PHP can validly be used for whatever one can use it for, just like any
>> other programming tool.
>
>> HOWEVER. Note that Rexx is the VM/CMS "system product interpreter" (or
>> at least that's what they used to call it). Something of equal or
>> greater capability might someday become the "linux system interpreter",
>> and would that be a bad thing?
>
> It would be a neutral thing if it could be ignored, bad if
> enforced.
>
> Mike "would enforcement even be possible?" Yetto
>

You mean, kind of like bash is enforced, by being embedded nearly
everywhere from the init system upward?

The nice thing about FOSS is that nothing can truly be enforced when the
source code is available, it can only be enforced within particular
implementations that one can choose.
Re: query: how many use PHP for linux scripts [message #185947 is a reply to message #185945] Thu, 15 May 2014 10:09 Go to previous messageGo to next message
Chris Ahlstrom is currently offline  Chris Ahlstrom
Messages: 3
Registered: May 2014
Karma: 0
Junior Member
crankypuss wrote this copyrighted missive and expects royalties:

> On 05/14/2014 03:23 PM, Mike Yetto wrote:
>
>> It would be a neutral thing if it could be ignored, bad if
>> enforced.
>>
>> Mike "would enforcement even be possible?" Yetto
>
> You mean, kind of like bash is enforced, by being embedded nearly
> everywhere from the init system upward?

It is? I believe Debian switched to dash for the init system a long time
ago.

And you can obviously install any shell you want. Though it is kind of
difficult to avoid adding bashisms to your scripts. :-)

> The nice thing about FOSS is that nothing can truly be enforced when the
> source code is available, it can only be enforced within particular
> implementations that one can choose.


--
Ray's Rule of Precision:
Measure with a micrometer. Mark with chalk. Cut with an axe.
Re: query: how many use PHP for linux scripts [message #185948 is a reply to message #185944] Thu, 15 May 2014 11:58 Go to previous messageGo to next message
Jonathan N. Little is currently offline  Jonathan N. Little
Messages: 12
Registered: February 2011
Karma: 0
Junior Member
crankypuss wrote:
> On 05/14/2014 01:54 PM, JEDIDIAH wrote:
>> On the other hand, PHP has gained itself a reputation for being
>> the modern day equivalent of Sendmail or BIND in terms of being a
>> security disaster.
>
> I think that's mostly because of builtin session support and its
> tendency to be used for mySQL queries that occur clear-text in the url.

That is not the language fault but the "programmer". Some frameworks
are just garbage and the bozo factor is language independent. Some of
the first wide spread SQL injections occurred with ASP.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Re: query: how many use PHP for linux scripts [message #185949 is a reply to message #185944] Thu, 15 May 2014 12:08 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 5/15/2014 4:07 AM, crankypuss wrote:
> On 05/14/2014 01:54 PM, JEDIDIAH wrote:
>> On the other hand, PHP has gained itself a reputation for being
>> the modern day equivalent of Sendmail or BIND in terms of being a
>> security disaster.
>
> I think that's mostly because of builtin session support and its
> tendency to be used for mySQL queries that occur clear-text in the url.

I have to disagree here. Languages are neither secure nor insecure.
Programs are, though.

I think it's more because there are too many people like TNP who call
themselves "programmers" but have no business being near a computer.
PHP is a relatively easy language to learn, but like any language, you
have to know what you're doing to write secure code. Too many people
stop learning before they get to that point.

That's a great part of what quality control and testing is about - not
only feeding the code good input to ensure it responds correctly, but
also feeding it bad input to ensure the code rejects it properly.

But way too many people only check responses to "good" data, and don't
ensure "bad" data is properly rejected. The result is things like SQL
injection and other security issues.

--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
Re: query: how many use PHP for linux scripts [message #185950 is a reply to message #185945] Thu, 15 May 2014 12:02 Go to previous messageGo to next message
Mike Yetto is currently offline  Mike Yetto
Messages: 4
Registered: May 2014
Karma: 0
Junior Member
Be it known crankypuss <crankypuss(at)nomail(dot)invalid> has declared...
> On 05/14/2014 03:23 PM, Mike Yetto wrote:
>> Be it known crankypuss <crankypuss(at)nomail(dot)invalid> has declared...
>>> On 05/13/2014 05:02 PM, Mike Yetto wrote:
>>>> Be it known Allodoxaphobia <knock_yourself_out(at)example(dot)net> has declared...
>>>> > Horses. Courses. REXX
>>>>
>>>> In VM/CMS and MVS I use REXX and for Linux I prefer shell
>>>> scripting or perl. As is indicated by its name (a recursive
>>>> acronym - PHP Hypertext Preprocessor) it's intended use is web
>>>> pages.
>>>>
>>>> Mike "mostly hand signals for the dog" Yetto
>>>>
>>
>>> PHP can validly be used for whatever one can use it for, just like any
>>> other programming tool.
>>
>>> HOWEVER. Note that Rexx is the VM/CMS "system product interpreter" (or
>>> at least that's what they used to call it). Something of equal or
>>> greater capability might someday become the "linux system interpreter",
>>> and would that be a bad thing?
>>
>> It would be a neutral thing if it could be ignored, bad if
>> enforced.
>>
>> Mike "would enforcement even be possible?" Yetto
>>

> You mean, kind of like bash is enforced, by being embedded nearly
> everywhere from the init system upward?

It isn't enforced if you can use something else. It can be
strongly encouraged, however.

Mike "step away from the BASIC interpreter and no one gets hurt" Yetto
--
"Blind belief in authority is the greatest enemy of truth."
- Albert Einstein
Re: PHP Gui Toolkits [message #185952 is a reply to message #185943] Thu, 15 May 2014 12:38 Go to previous messageGo to next message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma: 0
Senior Member
crankypuss wrote:

> On 05/14/2014 06:58 AM, Christoph Michael Becker wrote:
>
>> It seems to me that PHPGTK[1] is dead; there is, however, wxPHP[2],
>> which seems to be actively developed.
>>
>> [1] <http://gtk.php.net/>
>> [2] <http://wxphp.org/>
>
> Thanks for posting that, wasn't aware of wxPHP. Have you investigated
> wxPHP? Comments?

No, not really, due to lack of time and need.

--
Christoph M. Becker
Re: PHP Gui Toolkits [message #185953 is a reply to message #185952] Thu, 15 May 2014 12:59 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 15/05/14 13:38, Christoph Michael Becker wrote:
> crankypuss wrote:
>
>> On 05/14/2014 06:58 AM, Christoph Michael Becker wrote:
>>
>>> It seems to me that PHPGTK[1] is dead; there is, however, wxPHP[2],
>>> which seems to be actively developed.
>>>
>>> [1] <http://gtk.php.net/>
>>> [2] <http://wxphp.org/>
>>
>> Thanks for posting that, wasn't aware of wxPHP. Have you investigated
>> wxPHP? Comments?
>
> No, not really, due to lack of time and need.
>
I've known people who have spent years trying to make a hammer look like
a screwdriver, too..;-)




--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: query: how many use PHP for linux scripts [message #185954 is a reply to message #185915] Thu, 15 May 2014 12:34 Go to previous messageGo to next message
Jasen Betts is currently offline  Jasen Betts
Messages: 11
Registered: February 2013
Karma: 0
Junior Member
On 2014-05-14, Ben Bacarisse <ben(dot)usenet(at)bsb(dot)me(dot)uk> wrote:
> The Natural Philosopher <tnp(at)invalid(dot)invalid> writes:
>
>> On 13/05/14 21:35, Tim Streater wrote:
> <snip>
>>> I can't be arsed to fiddle around with C these days. Too much faffing
>>> around with declarations - and no string handling to speak of either.
>>>
>>> Non-issues in PHP.
>>>
>> string handling is the chief reason I prefer C..
>
> That seems odd since PHP has almost every single low-level C string
> function available to it. You can strspn and strncmp to your heart's
> content in PHP. Pretty much the only ones missing are strcat and strcpy
> but, surely, they can't be why you prefer C.
>
> A PHP translation of C string handling would inevitably be simpler since
> there would be no need manage the storage. That's the biggest advantage
> in my opinion, even if never used any of PHP's more complex string
> manipulation.

white program the reads a text file and swaps every pair of lines and writes
a new file.

so

one
two
three
four


becomes


two
one
four
three





design it to work on any text file.




including files with lines larger than RAM + swap.




if it must work, it's easier in C.


--
umop apisdn


--- news://freenews.netfront.net/ - complaints: news(at)netfront(dot)net ---
Re: query: how many use PHP for linux scripts [message #185955 is a reply to message #185954] Thu, 15 May 2014 13:52 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 15/05/14 13:34, Jasen Betts wrote:
> including files with lines larger than RAM + swap.

THAT is challenge!

Have to use temporary files..


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: query: how many use PHP for linux scripts [message #185956 is a reply to message #185954] Thu, 15 May 2014 14:03 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 5/15/2014 8:34 AM, Jasen Betts wrote:
> On 2014-05-14, Ben Bacarisse <ben(dot)usenet(at)bsb(dot)me(dot)uk> wrote:
>> The Natural Philosopher <tnp(at)invalid(dot)invalid> writes:
>>
>>> On 13/05/14 21:35, Tim Streater wrote:
>> <snip>
>>>> I can't be arsed to fiddle around with C these days. Too much faffing
>>>> around with declarations - and no string handling to speak of either.
>>>>
>>>> Non-issues in PHP.
>>>>
>>> string handling is the chief reason I prefer C..
>>
>> That seems odd since PHP has almost every single low-level C string
>> function available to it. You can strspn and strncmp to your heart's
>> content in PHP. Pretty much the only ones missing are strcat and strcpy
>> but, surely, they can't be why you prefer C.
>>
>> A PHP translation of C string handling would inevitably be simpler since
>> there would be no need manage the storage. That's the biggest advantage
>> in my opinion, even if never used any of PHP's more complex string
>> manipulation.
>
> white program the reads a text file and swaps every pair of lines and writes
> a new file.
>
> so
>
> one
> two
> three
> four
>
>
> becomes
>
>
> two
> one
> four
> three
>
>
>
>
>
> design it to work on any text file.
>
>
>
>
> including files with lines larger than RAM + swap.
>
>
>
>
> if it must work, it's easier in C.
>
>

And just how realistic is this? Anyone can come up with an example that
highlights the advantages (or disadvantages) of a particular language.
Your "test" is pretty worthless.

And BTW - I could easily do this in PHP, JAVA and even BASIC just as
easily (in some cases even more so) than in C.

--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
Re: query: how many use PHP for linux scripts [message #185957 is a reply to message #185938] Thu, 15 May 2014 14:45 Go to previous messageGo to next message
JEDIDIAH is currently offline  JEDIDIAH
Messages: 4
Registered: May 2014
Karma: 0
Junior Member
On 2014-05-15, Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
> On 5/14/2014 4:50 PM, The Natural Philosopher wrote:
>> On 14/05/14 20:54, JEDIDIAH wrote:
>>> On 2014-05-14, The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>>>> On 14/05/14 09:44, crankypuss wrote:
>>>> > On 05/13/2014 03:10 PM, JEDIDIAH wrote:
>>>> >> PHP is fine if you're working with the web, kind of pointless
>>>> >> otherwise.
>>>> >
>>>> > I find that to be absolutely not the case.
>>>>
>>>> but others don't. They take a personal and opposite view.
>>>>
>>>> PHP CAN be used for other things. But most of us were dong other things
>>>> perfectly well before we discovered PHP and for us PHP only has one
>>>> advantage: its widely supported as a web scripting language.
>>>
>>> As a tool for C avoidance, PHP is a bit of a johnny-come-lately.
>>> If that's all you're really interested in, then there are plenty of
>>> more well established options with whatever bells and whistles you're

[deletia]

>>> On the other hand, PHP has gained itself a reputation for being
>>> the modern day equivalent of Sendmail or BIND in terms of being a
>>> security disaster.
>>>
>>
>> sendmail wasn't a security disaster if you set it up OK and bind - well
>> I've never had a problem

"if you set it up OK"

Well that's the problem right there. Sendmail was/is a complex and powerful
beast with a large number of features that were irrelevant to people 10 or 15
years ago. Nevermind now. It was overkill in most use cases and it's flexibility
a source of problems.

Something simpler and better tailored is less likely to be set up wrong.

>>
>
> Nope, it isn't a security disaster if you don't use it.
>
>> Nor with PHP either
>>
>> Juts be carefiul how you use it.

The problem is that lots of people aren't. Then they distribute
their work widely to people in no position to clean up after them.

--
vi isn't easy to use. |||
/ | \
vi is easy to REPLACE.
Re: query: how many use PHP for linux scripts [message #185958 is a reply to message #185954] Thu, 15 May 2014 15:26 Go to previous messageGo to next message
Ben Bacarisse is currently offline  Ben Bacarisse
Messages: 82
Registered: November 2013
Karma: 0
Member
Jasen Betts <jasen(at)xnet(dot)co(dot)nz> writes:

> On 2014-05-14, Ben Bacarisse <ben(dot)usenet(at)bsb(dot)me(dot)uk> wrote:
>> The Natural Philosopher <tnp(at)invalid(dot)invalid> writes:
>>
>>> On 13/05/14 21:35, Tim Streater wrote:
>> <snip>
>>>> I can't be arsed to fiddle around with C these days. Too much faffing
>>>> around with declarations - and no string handling to speak of either.
>>>>
>>>> Non-issues in PHP.
>>>>
>>> string handling is the chief reason I prefer C..
>>
>> That seems odd since PHP has almost every single low-level C string
>> function available to it. You can strspn and strncmp to your heart's
>> content in PHP. Pretty much the only ones missing are strcat and strcpy
>> but, surely, they can't be why you prefer C.
>>
>> A PHP translation of C string handling would inevitably be simpler since
>> there would be no need manage the storage. That's the biggest advantage
>> in my opinion, even if never used any of PHP's more complex string
>> manipulation.
>
> white program the reads a text file and swaps every pair of lines and writes
> a new file.

I'd go:

function write_line($fin, $fout)
{
while (($c = fgetc($fin)) !== false && fputs($fout, $c) && $c != "\n");
return $c !== false;
}

function skip_line($fin, $fout)
{
while (($c = fgetc($fin)) !== false && $c != "\n");
return $c !== false;
}

function write_swapped_pair($fin, $fout)
{
$here = ftell($fin);
skip_line($fin, $fout);
if (write_line($fin, $fout))
return fseek($fin, $here) == 0 &&
write_line($fin, $fout) &&
skip_line($fin, $fout);
else return false;
}

function write_swapped_lines($fin, $fout)
{
while (write_swapped_pair($fin, $fout));
}

the behaviour with an odd number of lines, and when then last line is
not properly terminated, was not given so I took the easiest option!

This is not much more than a translation of what I'd do in C, which in a
way was my point.

The main difference is exchanging the test for EOF to false which takes
a little care (!== rather than !=), but then testing for EOF in C takes
case (you must use the right type variable). I don't think this is a
counter-example, but it's possible I missed the point your were making.

--
Ben.
Re: query: how many use PHP for linux scripts [message #185959 is a reply to message #185948] Thu, 15 May 2014 15:55 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
On 05/15/2014 05:58 AM, Jonathan N. Little wrote:
> crankypuss wrote:
>> On 05/14/2014 01:54 PM, JEDIDIAH wrote:
>>> On the other hand, PHP has gained itself a reputation for being
>>> the modern day equivalent of Sendmail or BIND in terms of being a
>>> security disaster.
>>
>> I think that's mostly because of builtin session support and its
>> tendency to be used for mySQL queries that occur clear-text in the url.
>
> That is not the language fault but the "programmer". Some frameworks
> are just garbage and the bozo factor is language independent. Some of
> the first wide spread SQL injections occurred with ASP.
>

Yes, I agree, and thought that was obvious; sorry I was unclear.
Re: query: how many use PHP for linux scripts [message #185961 is a reply to message #185949] Thu, 15 May 2014 16:04 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
On 05/15/2014 06:08 AM, Jerry Stuckle wrote:
> On 5/15/2014 4:07 AM, crankypuss wrote:
>> On 05/14/2014 01:54 PM, JEDIDIAH wrote:
>>> On the other hand, PHP has gained itself a reputation for being
>>> the modern day equivalent of Sendmail or BIND in terms of being a
>>> security disaster.
>>
>> I think that's mostly because of builtin session support and its
>> tendency to be used for mySQL queries that occur clear-text in the url.
>
> I have to disagree here. Languages are neither secure nor insecure.
> Programs are, though.
>
> I think it's more because there are too many people like TNP who call
> themselves "programmers" but have no business being near a computer. PHP
> is a relatively easy language to learn, but like any language, you have
> to know what you're doing to write secure code. Too many people stop
> learning before they get to that point.
>
> That's a great part of what quality control and testing is about - not
> only feeding the code good input to ensure it responds correctly, but
> also feeding it bad input to ensure the code rejects it properly.
>
> But way too many people only check responses to "good" data, and don't
> ensure "bad" data is properly rejected. The result is things like SQL
> injection and other security issues.
>

See what I get for being unclear? <g> See my reply to JNL.
Re: query: how many use PHP for linux scripts [message #185962 is a reply to message #185954] Thu, 15 May 2014 16:07 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
On 05/15/2014 06:34 AM, Jasen Betts wrote:
> On 2014-05-14, Ben Bacarisse <ben(dot)usenet(at)bsb(dot)me(dot)uk> wrote:
>> The Natural Philosopher <tnp(at)invalid(dot)invalid> writes:
>>
>>> On 13/05/14 21:35, Tim Streater wrote:
>> <snip>
>>>> I can't be arsed to fiddle around with C these days. Too much faffing
>>>> around with declarations - and no string handling to speak of either.
>>>>
>>>> Non-issues in PHP.
>>>>
>>> string handling is the chief reason I prefer C..
>>
>> That seems odd since PHP has almost every single low-level C string
>> function available to it. You can strspn and strncmp to your heart's
>> content in PHP. Pretty much the only ones missing are strcat and strcpy
>> but, surely, they can't be why you prefer C.
>>
>> A PHP translation of C string handling would inevitably be simpler since
>> there would be no need manage the storage. That's the biggest advantage
>> in my opinion, even if never used any of PHP's more complex string
>> manipulation.
>
> white program the reads a text file and swaps every pair of lines and writes
> a new file.
>
> so
>
> one
> two
> three
> four
>
>
> becomes
>
>
> two
> one
> four
> three
>
>
>
>
>
> design it to work on any text file.
>
>
>
>
> including files with lines larger than RAM + swap.
>
>
>
>
> if it must work, it's easier in C.
>
>

Read 2 lines, swap, write 2 lines to output file, rinse & repeat, what's
the big deal? (Maybe I'm not getting it, I *am* feeling kind of stupid
this morning.)
Re: query: how many use PHP for linux scripts [message #185964 is a reply to message #185955] Thu, 15 May 2014 16:13 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
On 05/15/2014 07:52 AM, The Natural Philosopher wrote:
> On 15/05/14 13:34, Jasen Betts wrote:
>> including files with lines larger than RAM + swap.
>
> THAT is challenge!
>
> Have to use temporary files..
>
>

Whatever for? You need enough "disk" space to contain the input file
and the output file, you need enough memory to contain the two largest
contiguous records and the code to read-2-(swap-2)-write-2. Whether the
swap involves actual data movement or not is a nit, it boils down to a
file-copy 2 lines at a time. (Wouldn't surprise me if the "cp" command
has some option for this kind of thing along with the rest of the
kitchen sink... or is that "tar" that I'm thinking of...)

Unless of course I'm missing something, I'm feeling stupider with each
post about this exercise that I read. <g>
Re: query: how many use PHP for linux scripts [message #185965 is a reply to message #185947] Thu, 15 May 2014 16:16 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
On 05/15/2014 04:09 AM, Chris Ahlstrom wrote:
> crankypuss wrote this copyrighted missive and expects royalties:
>
>> On 05/14/2014 03:23 PM, Mike Yetto wrote:
>>
>>> It would be a neutral thing if it could be ignored, bad if
>>> enforced.
>>>
>>> Mike "would enforcement even be possible?" Yetto
>>
>> You mean, kind of like bash is enforced, by being embedded nearly
>> everywhere from the init system upward?
>
> It is? I believe Debian switched to dash for the init system a long time
> ago.
>
> And you can obviously install any shell you want. Though it is kind of
> difficult to avoid adding bashisms to your scripts. :-)

Sure. I haven't looked at a make file in upwards of a decade but the
last time I looked at one it looked kinda like script code.

>> The nice thing about FOSS is that nothing can truly be enforced when the
>> source code is available, it can only be enforced within particular
>> implementations that one can choose.

I left that paragraph unsnipped on purpose hoping maybe someone would
read it. <g>
Re: query: how many use PHP for linux scripts [message #185966 is a reply to message #185957] Thu, 15 May 2014 16:35 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 15/05/14 15:45, JEDIDIAH wrote:
> On 2014-05-15, Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>> On 5/14/2014 4:50 PM, The Natural Philosopher wrote:
>>> On 14/05/14 20:54, JEDIDIAH wrote:
>>>> On 2014-05-14, The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>>>> > On 14/05/14 09:44, crankypuss wrote:
>>>> >> On 05/13/2014 03:10 PM, JEDIDIAH wrote:
>>>> >>> PHP is fine if you're working with the web, kind of pointless
>>>> >>> otherwise.
>>>> >>
>>>> >> I find that to be absolutely not the case.
>>>> >
>>>> > but others don't. They take a personal and opposite view.
>>>> >
>>>> > PHP CAN be used for other things. But most of us were dong other things
>>>> > perfectly well before we discovered PHP and for us PHP only has one
>>>> > advantage: its widely supported as a web scripting language.
>>>>
>>>> As a tool for C avoidance, PHP is a bit of a johnny-come-lately.
>>>> If that's all you're really interested in, then there are plenty of
>>>> more well established options with whatever bells and whistles you're
>
> [deletia]
>
>>>> On the other hand, PHP has gained itself a reputation for being
>>>> the modern day equivalent of Sendmail or BIND in terms of being a
>>>> security disaster.
>>>>
>>>
>>> sendmail wasn't a security disaster if you set it up OK and bind - well
>>> I've never had a problem
>
> "if you set it up OK"
>
> Well that's the problem right there. Sendmail was/is a complex and powerful
> beast with a large number of features that were irrelevant to people 10 or 15
> years ago. Nevermind now. It was overkill in most use cases and it's flexibility
> a source of problems.
>
ah well. I was probably the no 1 expert in setting it up.

totally threw away the stock config fle and wrote one from scratch. All
table driven.


> Something simpler and better tailored is less likely to be set up wrong.
>
>>>
>>
>> Nope, it isn't a security disaster if you don't use it.
>>
>>> Nor with PHP either
>>>
>>> Juts be carefiul how you use it.
>
> The problem is that lots of people aren't. Then they distribute
> their work widely to people in no position to clean up after them.
>


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: query: how many use PHP for linux scripts [message #185967 is a reply to message #185962] Thu, 15 May 2014 16:37 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 15/05/14 17:07, crankypuss wrote:
> On 05/15/2014 06:34 AM, Jasen Betts wrote:
>> On 2014-05-14, Ben Bacarisse <ben(dot)usenet(at)bsb(dot)me(dot)uk> wrote:
>>> The Natural Philosopher <tnp(at)invalid(dot)invalid> writes:
>>>
>>>> On 13/05/14 21:35, Tim Streater wrote:
>>> <snip>
>>>> > I can't be arsed to fiddle around with C these days. Too much faffing
>>>> > around with declarations - and no string handling to speak of either.
>>>> >
>>>> > Non-issues in PHP.
>>>> >
>>>> string handling is the chief reason I prefer C..
>>>
>>> That seems odd since PHP has almost every single low-level C string
>>> function available to it. You can strspn and strncmp to your heart's
>>> content in PHP. Pretty much the only ones missing are strcat and strcpy
>>> but, surely, they can't be why you prefer C.
>>>
>>> A PHP translation of C string handling would inevitably be simpler since
>>> there would be no need manage the storage. That's the biggest advantage
>>> in my opinion, even if never used any of PHP's more complex string
>>> manipulation.
>>
>> white program the reads a text file and swaps every pair of lines and
>> writes
>> a new file.
>>
>> so
>>
>> one
>> two
>> three
>> four
>>
>>
>> becomes
>>
>>
>> two
>> one
>> four
>> three
>>
>>
>>
>>
>>
>> design it to work on any text file.
>>
>>
>>
>>
>> including files with lines larger than RAM + swap.
>>
>>
>>
>>
>> if it must work, it's easier in C.
>>
>>
>
> Read 2 lines, swap, write 2 lines to output file, rinse & repeat, what's
> the big deal? (Maybe I'm not getting it, I *am* feeling kind of stupid
> this morning.)

its where you put the lines that wont fit in even virtual memory..


And I think he is making a point.

When the standard tools and assumptions of the language let you down, C
will get you the solution where PHP will not.



--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: query: how many use PHP for linux scripts [message #185968 is a reply to message #185964] Thu, 15 May 2014 16:48 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 15/05/14 17:13, crankypuss wrote:
> On 05/15/2014 07:52 AM, The Natural Philosopher wrote:
>> On 15/05/14 13:34, Jasen Betts wrote:
>>> including files with lines larger than RAM + swap.
>>
>> THAT is challenge!
>>
>> Have to use temporary files..
>>
>>
>
> Whatever for? You need enough "disk" space to contain the input file
> and the output file, you need enough memory to contain the two largest
> contiguous records

but in the case specified, you dont have that space.


and the code to read-2-(swap-2)-write-2. Whether the
> swap involves actual data movement or not is a nit, it boils down to a
> file-copy 2 lines at a time. (Wouldn't surprise me if the "cp" command
> has some option for this kind of thing along with the rest of the
> kitchen sink... or is that "tar" that I'm thinking of...)
>
> Unless of course I'm missing something, I'm feeling stupider with each
> post about this exercise that I read. <g>

"*lines* larger than RAM + swap" is the key.

you need to essentially read through the input file and tag where the
line begins and ends are.

THEN start reading it sequentially from the tag marks and assembling the
output a few megabytes at a time

i.e. you will end up wit at worst enough storage needed to hold an array
of 'line start and end' offsets in the original file.

Or if space is REALLY tight you do it the way COBOL used to do things.
Yuu scan the file to the first line end and then write thet second line
out, too the new file, then store that location as line 3, and write
line one to the tail of file 2, and so on

The point is that's fairly trivial with C. It doesn't ENFORCE a
particular way of dealing with files on you.

And C with a good library can be really high level too.

BUT if that doesn't work for you, no problem in going near to the
hardware either.


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: query: how many use PHP for linux scripts [message #185969 is a reply to message #185947] Thu, 15 May 2014 16:49 Go to previous messageGo to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Chris Ahlstrom wrote:

> crankypuss wrote this copyrighted missive and expects royalties:
>> On 05/14/2014 03:23 PM, Mike Yetto wrote:
>>> It would be a neutral thing if it could be ignored, bad if
>>> enforced.
>>>
>>> Mike "would enforcement even be possible?" Yetto
>>
>> You mean, kind of like bash is enforced, by being embedded nearly
>> everywhere from the init system upward?
>
> It is? I believe Debian switched to dash for the init system a long time
> ago.

What is “the init system”? My Debian GNU/Linux installations all use bash
(since about 10 years), I am not aware that I had to install anything for
that. In fact, I had to install dash in order to try it.

> And you can obviously install any shell you want. Though it is kind of
> difficult to avoid adding bashisms to your scripts. :-)

As they are in many cases not bashisms at all, but cshisms and kshisms.

<https://en.wikipedia.org/wiki/Bash_(Unix_shell)>


F'up2 comp.unix.shell, please stop cross-hierarchy cross-posting

PointedEars
--
Sometimes, what you learn is wrong. If those wrong ideas are close to the
root of the knowledge tree you build on a particular subject, pruning the
bad branches can sometimes cause the whole tree to collapse.
-- Mike Duffy in cljs, <news:Xns9FB6521286DB8invalidcom(at)94(dot)75(dot)214(dot)39>
Pages (3): [ «    1  2  3    »]  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to get the POST name of a field in a form that uses a counter
Next Topic: PHP-SOAP/5.4.21 SoapClient terminating POST without waiting for reply, but still complaining "error fetching http headers".
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Mar 28 21:52:30 GMT 2024

Total time taken to generate the page: 0.03079 seconds