Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #13625 > unrolled thread
| Started by | crankypuss <crankypuss@nomail.invalid> |
|---|---|
| First post | 2014-05-13 02:17 -0600 |
| Last post | 2014-05-13 17:26 +0100 |
| Articles | 20 on this page of 93 — 18 participants |
Back to article view | Back to comp.lang.php
query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-13 02:17 -0600
Re: query: how many use PHP for linux scripts Arno Welzel <usenet@arnowelzel.de> - 2014-05-13 10:37 +0200
Re: query: how many use PHP for linux scripts Tim Streater <timstreater@greenbee.net> - 2014-05-13 11:52 +0100
Re: query: how many use PHP for linux scripts "Auric__" <not.my.real@email.address> - 2014-05-13 13:28 +0000
Re: query: how many use PHP for linux scripts "Jonathan N. Little" <lws4art@gmail.com> - 2014-05-13 10:29 -0400
Re: query: how many use PHP for linux scripts Collin Pruitt <hellow+newsgroup@binenv.com> - 2014-05-13 11:00 -0400
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-13 10:05 -0600
Re: query: how many use PHP for linux scripts Johnny <johnny@invalid.net> - 2014-05-13 11:32 -0500
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-13 19:09 +0100
Re: query: how many use PHP for linux scripts Tim Streater <timstreater@greenbee.net> - 2014-05-13 21:35 +0100
Re: query: how many use PHP for linux scripts JEDIDIAH <jedi@nomad.mishnet> - 2014-05-13 16:10 -0500
Re: query: how many use PHP for linux scripts Tim Streater <timstreater@greenbee.net> - 2014-05-13 23:03 +0100
Re: query: how many use PHP for linux scripts Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-13 19:55 -0400
Re: query: how many use PHP for linux scripts Chris Ahlstrom <OFeem1987@teleworm.us> - 2014-05-13 20:26 -0400
Re: query: how many use PHP for linux scripts Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-13 20:37 -0400
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-14 03:18 -0600
Re: query: how many use PHP for linux scripts Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-14 08:20 -0400
PHP Gui Toolkits (was: query: how many use PHP for linux scripts) Christoph Michael Becker <cmbecker69@arcor.de> - 2014-05-14 14:58 +0200
Re: PHP Gui Toolkits crankypuss <crankypuss@nomail.invalid> - 2014-05-15 02:04 -0600
Re: PHP Gui Toolkits Christoph Michael Becker <cmbecker69@arcor.de> - 2014-05-15 14:38 +0200
Re: PHP Gui Toolkits The Natural Philosopher <tnp@invalid.invalid> - 2014-05-15 13:59 +0100
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-15 02:01 -0600
Re: query: how many use PHP for linux scripts Chris Ahlstrom <OFeem1987@teleworm.us> - 2014-05-14 06:40 -0400
Re: query: how many use PHP for linux scripts Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-14 08:23 -0400
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-14 03:00 -0600
Re: query: how many use PHP for linux scripts JEDIDIAH <jedi@nomad.mishnet> - 2014-05-14 14:49 -0500
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-14 02:44 -0600
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-14 10:17 +0100
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-14 03:39 -0600
Re: query: how many use PHP for linux scripts Tim Streater <timstreater@greenbee.net> - 2014-05-14 12:29 +0100
Re: query: how many use PHP for linux scripts JEDIDIAH <jedi@nomad.mishnet> - 2014-05-14 14:54 -0500
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-14 21:50 +0100
Re: query: how many use PHP for linux scripts Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-14 22:49 -0400
Re: query: how many use PHP for linux scripts JEDIDIAH <jedi@nomad.mishnet> - 2014-05-15 09:45 -0500
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-15 17:35 +0100
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-15 02:07 -0600
Re: query: how many use PHP for linux scripts "Jonathan N. Little" <lws4art@gmail.com> - 2014-05-15 07:58 -0400
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-15 09:55 -0600
Re: query: how many use PHP for linux scripts Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-15 08:08 -0400
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-15 10:04 -0600
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-14 04:42 +0100
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-14 03:21 -0600
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-14 12:32 +0100
Re: query: how many use PHP for linux scripts Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-05-14 13:39 +0100
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-14 15:23 +0100
Re: query: how many use PHP for linux scripts Christoph Michael Becker <cmbecker69@arcor.de> - 2014-05-14 20:00 +0200
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-14 21:48 +0100
Re: query: how many use PHP for linux scripts Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-05-14 22:18 +0100
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-14 23:10 +0100
Re: query: how many use PHP for linux scripts Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-05-14 22:05 +0100
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-14 23:07 +0100
Re: query: how many use PHP for linux scripts Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-14 22:51 -0400
Re: query: how many use PHP for linux scripts Jasen Betts <jasen@xnet.co.nz> - 2014-05-15 12:34 +0000
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-15 14:52 +0100
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-15 10:13 -0600
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-15 17:48 +0100
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-16 01:12 -0600
Re: query: how many use PHP for linux scripts Jasen Betts <jasen@xnet.co.nz> - 2014-05-16 11:29 +0000
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-16 13:03 +0100
PHP integers (was: query: how many use PHP for linux scripts) Christoph Michael Becker <cmbecker69@arcor.de> - 2014-05-16 14:16 +0200
Re: query: how many use PHP for linux scripts Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-15 10:03 -0400
Re: query: how many use PHP for linux scripts Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-05-15 16:26 +0100
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-15 10:07 -0600
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-15 17:37 +0100
Re: query: how many use PHP for linux scripts Christoph Michael Becker <cmbecker69@arcor.de> - 2014-05-15 19:14 +0200
Re: query: how many use PHP for linux scripts Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-05-16 02:45 +0100
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-16 09:25 +0100
Re: query: how many use PHP for linux scripts Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-16 09:14 -0400
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-16 01:17 -0600
Re: query: how many use PHP for linux scripts Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-15 19:33 +0200
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-14 02:36 -0600
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-14 10:09 +0100
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-14 03:58 -0600
Re: query: how many use PHP for linux scripts Allodoxaphobia <knock_yourself_out@example.net> - 2014-05-13 21:23 +0000
Re: query: how many use PHP for linux scripts Mike Yetto <unet.lighthouse@xoxy.net> - 2014-05-13 19:02 -0400
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-14 03:24 -0600
Re: query: how many use PHP for linux scripts Mike Yetto <unet.lighthouse@xoxy.net> - 2014-05-14 17:23 -0400
Re: query: how many use PHP for linux scripts Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-14 22:53 -0400
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-15 02:13 -0600
Re: query: how many use PHP for linux scripts Chris Ahlstrom <OFeem1987@teleworm.us> - 2014-05-15 06:09 -0400
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-15 10:16 -0600
Re: query: how many use PHP for linux scripts Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-15 18:49 +0200
Re: query: how many use PHP for linux scripts Jasen Betts <jasen@xnet.co.nz> - 2014-05-16 12:02 +0000
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-16 08:17 -0600
init-system, bash, etc. (was: query: how many use PHP for linux scripts) Christoph Michael Becker <cmbecker69@arcor.de> - 2014-05-16 18:48 +0200
Re: query: how many use PHP for linux scripts Mike Yetto <unet.lighthouse@xoxy.net> - 2014-05-15 08:02 -0400
Re: query: how many use PHP for linux scripts Aragorn <thorongil@telenet.be.invalid> - 2014-05-15 03:16 +0200
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-13 12:20 -0600
Re: query: how many use PHP for linux scripts Johnny <johnny@invalid.net> - 2014-05-13 13:35 -0500
Re: query: how many use PHP for linux scripts Mike Yetto <unet.lighthouse@xoxy.net> - 2014-05-13 19:04 -0400
Re: query: how many use PHP for linux scripts crankypuss <crankypuss@nomail.invalid> - 2014-05-14 03:26 -0600
Re: query: how many use PHP for linux scripts Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-14 08:28 -0400
Re: query: how many use PHP for linux scripts The Natural Philosopher <tnp@invalid.invalid> - 2014-05-13 17:26 +0100
Page 3 of 5 — ← Prev page 1 2 [3] 4 5 Next page →
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2014-05-14 04:42 +0100 |
| Message-ID | <lkuonh$6na$1@news.albasani.net> |
| In reply to | #13646 |
On 13/05/14 21:35, Tim Streater wrote: > In article <lktn4a$n8q$1@news.albasani.net>, The Natural Philosopher > <tnp@invalid.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. > string handling is the chief reason I prefer C.. -- 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.
[toc] | [prev] | [next] | [standalone]
| From | crankypuss <crankypuss@nomail.invalid> |
|---|---|
| Date | 2014-05-14 03:21 -0600 |
| Message-ID | <lkvchm$54l$2@dont-email.me> |
| In reply to | #13657 |
On 05/13/2014 09:42 PM, The Natural Philosopher wrote: > On 13/05/14 21:35, Tim Streater wrote: >> In article <lktn4a$n8q$1@news.albasani.net>, The Natural Philosopher >> <tnp@invalid.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. >> > string handling is the chief reason I prefer C.. > > Is that because you've built your own library of string handling routines for C, or because you like working with all those null-terminated strings supported by stdlib? Personally I think null-terminated strings are only useful for defining some kinds of constant data, but even there it's limiting.
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2014-05-14 12:32 +0100 |
| Message-ID | <lkvk8m$1u3$1@news.albasani.net> |
| In reply to | #13666 |
On 14/05/14 10:21, crankypuss wrote: > On 05/13/2014 09:42 PM, The Natural Philosopher wrote: >> On 13/05/14 21:35, Tim Streater wrote: >>> In article <lktn4a$n8q$1@news.albasani.net>, The Natural Philosopher >>> <tnp@invalid.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. >>> >> string handling is the chief reason I prefer C.. >> >> > > Is that because you've built your own library of string handling > routines for C, or because you like working with all those > null-terminated strings supported by stdlib? > > Personally I think null-terminated strings are only useful for defining > some kinds of constant data, but even there it's limiting. Bit of both. I just get used to thinking of strings in the way C does. and getting irritated when I have to do complex string manipulation in PHP By the time I have tried to find the regexp that works I have usually written the whole program in C. null terminated strings are a perfectly decent way to proceed. you have to either stick a null (or other EOS mark) in or store the length somewhere. OK strlen is faster if the length is stored, but finding the nth through pth byte is not... You still have to so some clumsy copying And I like the way I can tokenise a C string up by using pointers to the characters, then when I find a split char, nulling that byte and advancing the ptr to the next part. C is a language you can just about do ANYTHING in. I've written multitasking shedulers in C..and interrupt handlers Try doing that in perl PHP or Python! And that's why I like it. I only need to learn one language well. I COULD write my web pages in C, but the issues of outputting standard text in huge blocks is a bit of a problem. whereas its the simplest thing in the world for an interpreter. -- 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.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2014-05-14 13:39 +0100 |
| Message-ID | <0.93e9843bc1b5f085d0a5.20140514133906BST.87bnv0edqt.fsf@bsb.me.uk> |
| In reply to | #13657 |
The Natural Philosopher <tnp@invalid.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. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2014-05-14 15:23 +0100 |
| Message-ID | <lkvu9q$m1g$1@news.albasani.net> |
| In reply to | #13678 |
On 14/05/14 13:39, Ben Bacarisse wrote: > The Natural Philosopher <tnp@invalid.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.
[toc] | [prev] | [next] | [standalone]
| From | Christoph Michael Becker <cmbecker69@arcor.de> |
|---|---|
| Date | 2014-05-14 20:00 +0200 |
| Message-ID | <5373af1a$0$6603$9b4e6d93@newsspool4.arcor-online.net> |
| In reply to | #13681 |
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
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2014-05-14 21:48 +0100 |
| Message-ID | <ll0kqj$6rr$1@news.albasani.net> |
| In reply to | #13682 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2014-05-14 22:18 +0100 |
| Message-ID | <0.03dad9f82e5209113034.20140514221814BST.878uq4cb55.fsf@bsb.me.uk> |
| In reply to | #13685 |
The Natural Philosopher <tnp@invalid.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.
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2014-05-14 23:10 +0100 |
| Message-ID | <ll0pke$fqj$2@news.albasani.net> |
| In reply to | #13689 |
On 14/05/14 22:18, Ben Bacarisse wrote: > The Natural Philosopher <tnp@invalid.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.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2014-05-14 22:05 +0100 |
| Message-ID | <0.90aab8aec76b6ce879d4.20140514220528BST.87ha4scbqf.fsf@bsb.me.uk> |
| In reply to | #13681 |
The Natural Philosopher <tnp@invalid.invalid> writes: > On 14/05/14 13:39, Ben Bacarisse wrote: >> The Natural Philosopher <tnp@invalid.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.
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2014-05-14 23:07 +0100 |
| Message-ID | <ll0pe4$fqj$1@news.albasani.net> |
| In reply to | #13688 |
On 14/05/14 22:05, Ben Bacarisse wrote: > The Natural Philosopher <tnp@invalid.invalid> writes: > >> On 14/05/14 13:39, Ben Bacarisse wrote: >>> The Natural Philosopher <tnp@invalid.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.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2014-05-14 22:51 -0400 |
| Message-ID | <ll1a3c$8tm$2@dont-email.me> |
| In reply to | #13688 |
On 5/14/2014 5:05 PM, Ben Bacarisse wrote: > The Natural Philosopher <tnp@invalid.invalid> writes: > >> On 14/05/14 13:39, Ben Bacarisse wrote: >>> The Natural Philosopher <tnp@invalid.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@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Jasen Betts <jasen@xnet.co.nz> |
|---|---|
| Date | 2014-05-15 12:34 +0000 |
| Message-ID | <ll2c99$nr9$4@gonzo.reversiblemaps.ath.cx> |
| In reply to | #13678 |
On 2014-05-14, Ben Bacarisse <ben.usenet@bsb.me.uk> wrote: > The Natural Philosopher <tnp@invalid.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@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2014-05-15 14:52 +0100 |
| Message-ID | <ll2gr1$hse$1@news.albasani.net> |
| In reply to | #13717 |
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.
[toc] | [prev] | [next] | [standalone]
| From | crankypuss <crankypuss@nomail.invalid> |
|---|---|
| Date | 2014-05-15 10:13 -0600 |
| Message-ID | <ll2p3b$m7$1@dont-email.me> |
| In reply to | #13718 |
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>
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2014-05-15 17:48 +0100 |
| Message-ID | <ll2r4f$7v7$1@news.albasani.net> |
| In reply to | #13726 |
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.
[toc] | [prev] | [next] | [standalone]
| From | crankypuss <crankypuss@nomail.invalid> |
|---|---|
| Date | 2014-05-16 01:12 -0600 |
| Message-ID | <ll4doe$a4j$1@dont-email.me> |
| In reply to | #13730 |
On 05/15/2014 10:48 AM, The Natural Philosopher wrote: > 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. Ah, now I see. If you want to make up a difficult problem, that's swell. Throw in the additional requirement that there are so many records that there isn't enough "RAM + swap" to contain all the record offsets. Add an architectural requirement that it support bytes of infinite and variable length if that makes it more fun. PHP has access to the same stream-io routines in stdlib that a C application would use. I have little interest in unsolvable theoretical problems when so many practical problems remain poorly solved.
[toc] | [prev] | [next] | [standalone]
| From | Jasen Betts <jasen@xnet.co.nz> |
|---|---|
| Date | 2014-05-16 11:29 +0000 |
| Message-ID | <ll4sqq$d4t$2@gonzo.reversiblemaps.ath.cx> |
| In reply to | #13718 |
On 2014-05-15, The Natural Philosopher <tnp@invalid.invalid> 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.. You can get these wiith just RAM and lseek64() (etc). -- umop apisdn --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2014-05-16 13:03 +0100 |
| Message-ID | <ll4upu$656$2@news.albasani.net> |
| In reply to | #13739 |
On 16/05/14 12:29, Jasen Betts wrote: > On 2014-05-15, The Natural Philosopher <tnp@invalid.invalid> 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.. > > You can get these wiith just RAM and lseek64() (etc). > > yes..I realised that..collect the metadata, sort it in RAM and then use that top seek read and write.. Does PHP guarantee 64 bit integers? Or are they stored as text? -- 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.
[toc] | [prev] | [next] | [standalone]
| From | Christoph Michael Becker <cmbecker69@arcor.de> |
|---|---|
| Date | 2014-05-16 14:16 +0200 |
| Subject | PHP integers (was: query: how many use PHP for linux scripts) |
| Message-ID | <53760177$0$6697$9b4e6d93@newsspool2.arcor-online.net> |
| In reply to | #13740 |
The Natural Philosopher wrote:
> Does PHP guarantee 64 bit integers? Or are they stored as text?
That depends on the architecture, see PHP_INT_MAX[1]. Actually,
integers are currently stored as long[2], what might change in the
future[3].
[1] <http://www.php.net/manual/en/reserved.constants.php>
"Usually int(2147483647)" seems a questionable statement, though.
[2] <http://lxr.php.net/xref/PHP_5_5/Zend/zend.h#321>
[3] <https://wiki.php.net/rfc/size_t_and_int64_next#proposal>
[X post & fup2 comp.lang.php]
--
Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
Page 3 of 5 — ← Prev page 1 2 [3] 4 5 Next page →
Back to top | Article view | comp.lang.php
csiph-web