php-windows Digest 11 Feb 2003 23:59:27 -0000 Issue 1583
Topics (messages 18447 through 18472):
reading lines from a file
18447 by: George Pitcher
18448 by: Svensson, B.A.T. (HKG)
18449 by: George Pitcher
18451 by: Svensson, B.A.T. (HKG)
18452 by: George Pitcher
18453 by: Vladimir Galkov
18454 by: Chris Kranz
18455 by: Svensson, B.A.T. (HKG)
18456 by: George Pitcher
18458 by: George Pitcher
18459 by: Jill.Ramonsky.Aculab.com
18460 by: J.Veenhuijsen
18461 by: Svensson, B.A.T. (HKG)
18462 by: Jill.Ramonsky.Aculab.com
18464 by: Svensson, B.A.T. (HKG)
18465 by: Ignatius Reilly
18466 by: Svensson, B.A.T. (HKG)
18467 by: Ignatius Reilly
18468 by: Chris Kranz
18469 by: George Pitcher
18470 by: Svensson, B.A.T. (HKG)
18471 by: Svensson, B.A.T. (HKG)
18472 by: Sven Schnitzke
Re: MySQL: some script I must do
18450 by: Uttam
18463 by: Beach, Jim
Re: [PHP-INST] Re: Problems with mail()
18457 by: "Juan Ant. Marti'nez"
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hi,
I have a huge file that I want to get into a db format.
There are over 5000 records and I need to create fieldnames on the fly.
Each record comprises a number of lines (fields) containing 2 elements
(fieldname [first 5 chars (which need rtrimming)], value [rest of line, some
with lots of text]).
Some fieldnames are duplicated within a record so I need to rename these by
using a counter which is reset for each record (there are at least 5
fieldnames that are affected this way - so 5 counters).
Some values contain subfields so I need to be able to handle these, but this
doesn't look frightening.
And I would like to end up with an array with keys (fieldnames) and values.
But I'm stuck at the first hurdle because I can't find out how to put a line
into a string.
Any pointers?
George in Oxford
===
George Pitcher
HERON Technical Manager
Ingenta plc
23-38 Hythe Bridge Street, Oxford, OX1 2ET
T +44 (0)1865 799137 direct
T +44 (0)1865 799000 switchboard
F +44 (0)1865 799134
E [EMAIL PROTECTED]
www.ingenta.com
Ingenta: Empowering the exchange of academic and professional content
online.
--- End Message ---
--- Begin Message ---
What do you want to do? Parse the file into tab-delimited data
in order to bulk load it into the database?
> -----Original Message-----
> From: George Pitcher [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 11, 2003 11:41 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] reading lines from a file
>
>
> Hi,
>
> I have a huge file that I want to get into a db format.
>
> There are over 5000 records and I need to create fieldnames on the fly.
>
> Each record comprises a number of lines (fields) containing 2 elements
> (fieldname [first 5 chars (which need rtrimming)], value [rest of line, some
> with lots of text]).
>
> Some fieldnames are duplicated within a record so I need to rename these by
> using a counter which is reset for each record (there are at least 5
> fieldnames that are affected this way - so 5 counters).
>
> Some values contain subfields so I need to be able to handle these, but this
> doesn't look frightening.
>
> And I would like to end up with an array with keys (fieldnames) and values.
>
> But I'm stuck at the first hurdle because I can't find out how to put a line
> into a string.
>
> Any pointers?
>
> George in Oxford
>
>
> ===
>
> George Pitcher
> HERON Technical Manager
> Ingenta plc
> 23-38 Hythe Bridge Street, Oxford, OX1 2ET
> T +44 (0)1865 799137 direct
> T +44 (0)1865 799000 switchboard
> F +44 (0)1865 799134
> E [EMAIL PROTECTED]
>
> www.ingenta.com
> Ingenta: Empowering the exchange of academic and professional content
> online.
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Yes, eventually. I want to come up with a good method because this file is
going to be supplied to me on a fairly regular basis.
George
> -----Original Message-----
> From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> Sent: 11 February 2003 10:56 am
> To: George Pitcher; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> What do you want to do? Parse the file into tab-delimited data
> in order to bulk load it into the database?
>
> > -----Original Message-----
> > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 11, 2003 11:41 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-WIN] reading lines from a file
> >
> >
> > Hi,
> >
> > I have a huge file that I want to get into a db format.
> >
> > There are over 5000 records and I need to create fieldnames on the fly.
> >
> > Each record comprises a number of lines (fields) containing 2 elements
> > (fieldname [first 5 chars (which need rtrimming)], value [rest
> of line, some
> > with lots of text]).
> >
> > Some fieldnames are duplicated within a record so I need to
> rename these by
> > using a counter which is reset for each record (there are at least 5
> > fieldnames that are affected this way - so 5 counters).
> >
> > Some values contain subfields so I need to be able to handle
> these, but this
> > doesn't look frightening.
> >
> > And I would like to end up with an array with keys (fieldnames)
> and values.
> >
> > But I'm stuck at the first hurdle because I can't find out how
> to put a line
> > into a string.
> >
> > Any pointers?
> >
> > George in Oxford
> >
> >
> > ===
> >
> > George Pitcher
> > HERON Technical Manager
> > Ingenta plc
> > 23-38 Hythe Bridge Street, Oxford, OX1 2ET
> > T +44 (0)1865 799137 direct
> > T +44 (0)1865 799000 switchboard
> > F +44 (0)1865 799134
> > E [EMAIL PROTECTED]
> >
> > www.ingenta.com
> > Ingenta: Empowering the exchange of academic and professional content
> > online.
> >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
--- End Message ---
--- Begin Message ---
Then you need to write a parser. What's the basic problem then?
> -----Original Message-----
> From: George Pitcher [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 11, 2003 11:59 AM
> To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> Yes, eventually. I want to come up with a good method because this file is
> going to be supplied to me on a fairly regular basis.
>
> George
>
> > -----Original Message-----
> > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> > Sent: 11 February 2003 10:56 am
> > To: George Pitcher; [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] reading lines from a file
> >
> >
> > What do you want to do? Parse the file into tab-delimited data
> > in order to bulk load it into the database?
> >
> > > -----Original Message-----
> > > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, February 11, 2003 11:41 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP-WIN] reading lines from a file
> > >
> > >
> > > Hi,
> > >
> > > I have a huge file that I want to get into a db format.
> > >
> > > There are over 5000 records and I need to create fieldnames on the fly.
> > >
> > > Each record comprises a number of lines (fields) containing 2 elements
> > > (fieldname [first 5 chars (which need rtrimming)], value [rest
> > of line, some
> > > with lots of text]).
> > >
> > > Some fieldnames are duplicated within a record so I need to
> > rename these by
> > > using a counter which is reset for each record (there are at least 5
> > > fieldnames that are affected this way - so 5 counters).
> > >
> > > Some values contain subfields so I need to be able to handle
> > these, but this
> > > doesn't look frightening.
> > >
> > > And I would like to end up with an array with keys (fieldnames)
> > and values.
> > >
> > > But I'm stuck at the first hurdle because I can't find out how
> > to put a line
> > > into a string.
> > >
> > > Any pointers?
> > >
> > > George in Oxford
> > >
> > >
> > > ===
> > >
> > > George Pitcher
> > > HERON Technical Manager
> > > Ingenta plc
> > > 23-38 Hythe Bridge Street, Oxford, OX1 2ET
> > > T +44 (0)1865 799137 direct
> > > T +44 (0)1865 799000 switchboard
> > > F +44 (0)1865 799134
> > > E [EMAIL PROTECTED]
> > >
> > > www.ingenta.com
> > > Ingenta: Empowering the exchange of academic and professional content
> > > online.
> > >
> > >
> > > --
> > > PHP Windows Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
>
--- End Message ---
--- Begin Message ---
Yes, I suppose I do.
I want to be able to take my file, work out a complete of fieldnames and
then create an array which could then be used to, initially, create a table
in MySQL.
I'm not using MySQL for my main system which is based on FileMaker, but will
be moving later this year to MySQL, so it's not a wasted effort.
I know that I can export the MySQL data and push that into FileMaker.
Below (in between ==== lines, is a sample record for parsing. This may help
you understand the problem I have.
=======================================================
NEWRC -T&F eBook data rec.1534 |@ 27/01/2003
VISBN 0203445570
OSBN 0-203-44557-0
EBK1 0203548310
EBK2 0203651057
EBK3 020375381X
EBK4 0203273567
OTOP
OTART
OTI Creative Mathematics
OSUB
USAU Upitis |f Rena |u Queens University |c Kingston, Ontario |x Canada
USAU Phillips |f Eileen |u Teacher |c Vancover |x Canada
USAU Higginson |f William |u Queens University |c Kingston |x Canada
EDIT
INTRO
FORWD Pimm |f David |u The Open University x| UK
TRANS
2BIND 0415164621 |P 70.00 |U 100.00 |B Hb |A |M 1 |T Creative Mathematics
VPR 11.99
USPRI 17.99
OTBPR 19.99 |U 25.95 |D 17/07/1997
USBDG
MFDT
ERT GB US CA AU NZ ZA IE
ORT
NRT
TTY
OBIND eB
PDUE 11/03/2002
VIZE
VEXT 192
OILLS 40 illustrations
LEVEL
OSER
OIMP RoutledgeFalmer
LIBPR
OALT
OPPQ
OCATL This book shows how creative maths can <I>really</I> work. Exploring
the ways in which maths skills can be learned through cross-curricular
activities based on visual arts and music, the book presents maths as a
meaningful and exciting subject which holds no fears for children.<BR> The
authors recognise that while maths-phobia prevails in our increasingly
mathematicised world, attitudes and approaches to teaching the subject need
to be reviewed, and issues such as gender stereotyping, which encourage
maths-apathy, need to be tackled at an early stage.<BR> Within this
collection of classroom-based stories are detailed examples of integrative
mathematic projects; these will give teachers the confidence to try out
cross-curricular activities in their classes. The book also provides support
with difficult areas such as assessment, planning and development.<BR>
Fascinating to read in its own right this book will appeal to the specialist
and non-specialist alike.<BR>
OCONC This book shows how creative maths can <I>really</I> work. Exploring
the ways in which maths skills can be learned through cross-curricular
activities based on visual arts and music, the book presents maths as a
meaningful and exciting subject which holds no fears for children.<BR> The
authors recognise that while maths-phobia prevails in our increasingly
mathematicised world, attitudes and approaches to teaching the subject need
to be reviewed, and issues such as gender stereotyping, which encourage
maths-apathy, need to be tackled at an early stage.<BR> Within this
collection of classroom-based stories are detailed examples of integrative
mathematic projects; these will give teachers the confidence to try out
cross-curricular activities in their classes. The book also provides support
with difficult areas such as assessment, planning and development.<BR>
Fascinating to read in its own right this book will appeal to the specialist
and non-specialist alike.<BR>
OCATS Exploring the ways in which maths skills can be learned through
cross-curricular projects on arts and music, this book presents maths as a
meaningful and exciting subject which holds no fear for children.
OQUO 'This is a fascinating book ... which gives detailed case studies.' |I
Infant Equipment
OCNT
FCONT
OWRIT
VEDIT 1
BICAC U
BSUB1 J
BSUB2 JD
BSUB3
BICAV RF
SUBJ1 SB150000
SUBJ2
SUBJ3
VPROD EB
VACDE WEB
CREAT MFK - AUTO |D 2002 07 19
================================================================
the use of '|' denotes a subfield. My plan is to name the subfield by the
name of the field followed by '_' and the subfield identifier, so that the
one on the last line would appear as 'CREAT_D, and that way I'll be sure to
properly tag those that are belonging to the 'counter-affected' fields.
All help is appreciated.
Cheers
George
> -----Original Message-----
> From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> Sent: 11 February 2003 11:03 am
> To: George Pitcher; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> Then you need to write a parser. What's the basic problem then?
>
> > -----Original Message-----
> > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 11, 2003 11:59 AM
> > To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] reading lines from a file
> >
> >
> > Yes, eventually. I want to come up with a good method because
> this file is
> > going to be supplied to me on a fairly regular basis.
> >
> > George
> >
> > > -----Original Message-----
> > > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> > > Sent: 11 February 2003 10:56 am
> > > To: George Pitcher; [EMAIL PROTECTED]
> > > Subject: RE: [PHP-WIN] reading lines from a file
> > >
> > >
> > > What do you want to do? Parse the file into tab-delimited data
> > > in order to bulk load it into the database?
> > >
> > > > -----Original Message-----
> > > > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > > > Sent: Tuesday, February 11, 2003 11:41 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [PHP-WIN] reading lines from a file
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I have a huge file that I want to get into a db format.
> > > >
> > > > There are over 5000 records and I need to create fieldnames
> on the fly.
> > > >
> > > > Each record comprises a number of lines (fields) containing
> 2 elements
> > > > (fieldname [first 5 chars (which need rtrimming)], value [rest
> > > of line, some
> > > > with lots of text]).
> > > >
> > > > Some fieldnames are duplicated within a record so I need to
> > > rename these by
> > > > using a counter which is reset for each record (there are at least 5
> > > > fieldnames that are affected this way - so 5 counters).
> > > >
> > > > Some values contain subfields so I need to be able to handle
> > > these, but this
> > > > doesn't look frightening.
> > > >
> > > > And I would like to end up with an array with keys (fieldnames)
> > > and values.
> > > >
> > > > But I'm stuck at the first hurdle because I can't find out how
> > > to put a line
> > > > into a string.
> > > >
> > > > Any pointers?
> > > >
> > > > George in Oxford
> > > >
> > > >
> > > > ===
> > > >
> > > > George Pitcher
> > > > HERON Technical Manager
> > > > Ingenta plc
> > > > 23-38 Hythe Bridge Street, Oxford, OX1 2ET
> > > > T +44 (0)1865 799137 direct
> > > > T +44 (0)1865 799000 switchboard
> > > > F +44 (0)1865 799134
> > > > E [EMAIL PROTECTED]
> > > >
> > > > www.ingenta.com
> > > > Ingenta: Empowering the exchange of academic and
> professional content
> > > > online.
> > > >
> > > >
> > > > --
> > > > PHP Windows Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > >
> >
>
--- End Message ---
--- Begin Message ---
somth like this may be:
$f_array = file (FILE_NAME);
for ($i=0; $i<count($f_array); $i++)
{
$arr_str = explode(";", $f_array[$i]);
//***********
// work here with $arr_str as array of str elements (if separator ";")/ if
else use ereg or other way
//***************
}
"George Pitcher" <[EMAIL PROTECTED]> сообщил/сообщила в новостях
следующее: [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Yes, eventually. I want to come up with a good method because this file is
> going to be supplied to me on a fairly regular basis.
>
> George
>
> > -----Original Message-----
> > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> > Sent: 11 February 2003 10:56 am
> > To: George Pitcher; [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] reading lines from a file
> >
> >
> > What do you want to do? Parse the file into tab-delimited data
> > in order to bulk load it into the database?
> >
> > > -----Original Message-----
> > > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, February 11, 2003 11:41 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP-WIN] reading lines from a file
> > >
> > >
> > > Hi,
> > >
> > > I have a huge file that I want to get into a db format.
> > >
> > > There are over 5000 records and I need to create fieldnames on the
fly.
> > >
> > > Each record comprises a number of lines (fields) containing 2 elements
> > > (fieldname [first 5 chars (which need rtrimming)], value [rest
> > of line, some
> > > with lots of text]).
> > >
> > > Some fieldnames are duplicated within a record so I need to
> > rename these by
> > > using a counter which is reset for each record (there are at least 5
> > > fieldnames that are affected this way - so 5 counters).
> > >
> > > Some values contain subfields so I need to be able to handle
> > these, but this
> > > doesn't look frightening.
> > >
> > > And I would like to end up with an array with keys (fieldnames)
> > and values.
> > >
> > > But I'm stuck at the first hurdle because I can't find out how
> > to put a line
> > > into a string.
> > >
> > > Any pointers?
> > >
> > > George in Oxford
> > >
> > >
> > > ===
> > >
> > > George Pitcher
> > > HERON Technical Manager
> > > Ingenta plc
> > > 23-38 Hythe Bridge Street, Oxford, OX1 2ET
> > > T +44 (0)1865 799137 direct
> > > T +44 (0)1865 799000 switchboard
> > > F +44 (0)1865 799134
> > > E [EMAIL PROTECTED]
> > >
> > > www.ingenta.com
> > > Ingenta: Empowering the exchange of academic and professional content
> > > online.
> > >
> > >
> > > --
> > > PHP Windows Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
>
--- End Message ---
--- Begin Message ---
So all you need to do, is read the file in, line by line (see the php
manual) and then break up each line into an array to be added to the db.
This is fairly basic stuff, you just need to look in the php manual, it
sounds like you don't really have a problem as such, you just want
someone to tell you what the code would be?
chris kranz
fatcuban.com
-----Original Message-----
From: George Pitcher [mailto:[EMAIL PROTECTED]]
Sent: 11 February 2003 11:59
To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] reading lines from a file
Yes, I suppose I do.
I want to be able to take my file, work out a complete of fieldnames and
then create an array which could then be used to, initially, create a
table
in MySQL.
I'm not using MySQL for my main system which is based on FileMaker, but
will
be moving later this year to MySQL, so it's not a wasted effort.
I know that I can export the MySQL data and push that into FileMaker.
Below (in between ==== lines, is a sample record for parsing. This may
help
you understand the problem I have.
=======================================================
NEWRC -T&F eBook data rec.1534 |@ 27/01/2003
VISBN 0203445570
OSBN 0-203-44557-0
EBK1 0203548310
EBK2 0203651057
EBK3 020375381X
EBK4 0203273567
OTOP
OTART
OTI Creative Mathematics
OSUB
USAU Upitis |f Rena |u Queens University |c Kingston, Ontario |x Canada
USAU Phillips |f Eileen |u Teacher |c Vancover |x Canada
USAU Higginson |f William |u Queens University |c Kingston |x Canada
EDIT
INTRO
FORWD Pimm |f David |u The Open University x| UK
TRANS
2BIND 0415164621 |P 70.00 |U 100.00 |B Hb |A |M 1 |T Creative
Mathematics
VPR 11.99
USPRI 17.99
OTBPR 19.99 |U 25.95 |D 17/07/1997
USBDG
MFDT
ERT GB US CA AU NZ ZA IE
ORT
NRT
TTY
OBIND eB
PDUE 11/03/2002
VIZE
VEXT 192
OILLS 40 illustrations
LEVEL
OSER
OIMP RoutledgeFalmer
LIBPR
OALT
OPPQ
OCATL This book shows how creative maths can <I>really</I> work.
Exploring
the ways in which maths skills can be learned through cross-curricular
activities based on visual arts and music, the book presents maths as a
meaningful and exciting subject which holds no fears for children.<BR>
The
authors recognise that while maths-phobia prevails in our increasingly
mathematicised world, attitudes and approaches to teaching the subject
need
to be reviewed, and issues such as gender stereotyping, which encourage
maths-apathy, need to be tackled at an early stage.<BR> Within this
collection of classroom-based stories are detailed examples of
integrative
mathematic projects; these will give teachers the confidence to try out
cross-curricular activities in their classes. The book also provides
support
with difficult areas such as assessment, planning and development.<BR>
Fascinating to read in its own right this book will appeal to the
specialist
and non-specialist alike.<BR>
OCONC This book shows how creative maths can <I>really</I> work.
Exploring
the ways in which maths skills can be learned through cross-curricular
activities based on visual arts and music, the book presents maths as a
meaningful and exciting subject which holds no fears for children.<BR>
The
authors recognise that while maths-phobia prevails in our increasingly
mathematicised world, attitudes and approaches to teaching the subject
need
to be reviewed, and issues such as gender stereotyping, which encourage
maths-apathy, need to be tackled at an early stage.<BR> Within this
collection of classroom-based stories are detailed examples of
integrative
mathematic projects; these will give teachers the confidence to try out
cross-curricular activities in their classes. The book also provides
support
with difficult areas such as assessment, planning and development.<BR>
Fascinating to read in its own right this book will appeal to the
specialist
and non-specialist alike.<BR>
OCATS Exploring the ways in which maths skills can be learned through
cross-curricular projects on arts and music, this book presents maths as
a
meaningful and exciting subject which holds no fear for children.
OQUO 'This is a fascinating book ... which gives detailed case
studies.' |I
Infant Equipment
OCNT
FCONT
OWRIT
VEDIT 1
BICAC U
BSUB1 J
BSUB2 JD
BSUB3
BICAV RF
SUBJ1 SB150000
SUBJ2
SUBJ3
VPROD EB
VACDE WEB
CREAT MFK - AUTO |D 2002 07 19
================================================================
the use of '|' denotes a subfield. My plan is to name the subfield by
the
name of the field followed by '_' and the subfield identifier, so that
the
one on the last line would appear as 'CREAT_D, and that way I'll be sure
to
properly tag those that are belonging to the 'counter-affected' fields.
All help is appreciated.
Cheers
George
> -----Original Message-----
> From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> Sent: 11 February 2003 11:03 am
> To: George Pitcher; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> Then you need to write a parser. What's the basic problem then?
>
> > -----Original Message-----
> > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 11, 2003 11:59 AM
> > To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] reading lines from a file
> >
> >
> > Yes, eventually. I want to come up with a good method because
> this file is
> > going to be supplied to me on a fairly regular basis.
> >
> > George
> >
> > > -----Original Message-----
> > > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> > > Sent: 11 February 2003 10:56 am
> > > To: George Pitcher; [EMAIL PROTECTED]
> > > Subject: RE: [PHP-WIN] reading lines from a file
> > >
> > >
> > > What do you want to do? Parse the file into tab-delimited data
> > > in order to bulk load it into the database?
> > >
> > > > -----Original Message-----
> > > > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > > > Sent: Tuesday, February 11, 2003 11:41 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [PHP-WIN] reading lines from a file
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I have a huge file that I want to get into a db format.
> > > >
> > > > There are over 5000 records and I need to create fieldnames
> on the fly.
> > > >
> > > > Each record comprises a number of lines (fields) containing
> 2 elements
> > > > (fieldname [first 5 chars (which need rtrimming)], value [rest
> > > of line, some
> > > > with lots of text]).
> > > >
> > > > Some fieldnames are duplicated within a record so I need to
> > > rename these by
> > > > using a counter which is reset for each record (there are at
least 5
> > > > fieldnames that are affected this way - so 5 counters).
> > > >
> > > > Some values contain subfields so I need to be able to handle
> > > these, but this
> > > > doesn't look frightening.
> > > >
> > > > And I would like to end up with an array with keys (fieldnames)
> > > and values.
> > > >
> > > > But I'm stuck at the first hurdle because I can't find out how
> > > to put a line
> > > > into a string.
> > > >
> > > > Any pointers?
> > > >
> > > > George in Oxford
> > > >
> > > >
> > > > ===
> > > >
> > > > George Pitcher
> > > > HERON Technical Manager
> > > > Ingenta plc
> > > > 23-38 Hythe Bridge Street, Oxford, OX1 2ET
> > > > T +44 (0)1865 799137 direct
> > > > T +44 (0)1865 799000 switchboard
> > > > F +44 (0)1865 799134
> > > > E [EMAIL PROTECTED]
> > > >
> > > > www.ingenta.com
> > > > Ingenta: Empowering the exchange of academic and
> professional content
> > > > online.
> > > >
> > > >
> > > > --
> > > > PHP Windows Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > >
> >
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
before you do anything else, you need to do the following:
* decide what data in this file that you need
* create a data model based on this data
* sufficiently normalize your data
* implement a database schema according to the normalized data
* write a parser that parse data according to the RDBMS schema.
* load data in the RDBMS
* finished
That's what you need to do, and as far I can understand none
of the above activities are related to PHP at this moment.
However, it should be fairly easy to write a parser for
this kind of record layout. I see no major problem with
it.
I would recommend you to consult a professional programmer,
or at least a programmer with some experience with C/C++ or
perl or whatever, and he will for sure be able to make a
parser for you according to some specification that you
can work out together with him/her. (I've seen worse
record layout in my days. ;)
I am sorry for not being able to give you the answer
you wish for.
//Anders
P.S. I am just a bit curious on how big this "huge file" is? D.S.
> -----Original Message-----
> From: George Pitcher [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 11, 2003 12:59 PM
> To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> Yes, I suppose I do.
>
> I want to be able to take my file, work out a complete of fieldnames and
> then create an array which could then be used to, initially, create a table
> in MySQL.
>
> I'm not using MySQL for my main system which is based on FileMaker, but will
> be moving later this year to MySQL, so it's not a wasted effort.
>
> I know that I can export the MySQL data and push that into FileMaker.
>
> Below (in between ==== lines, is a sample record for parsing. This may help
> you understand the problem I have.
>
> =======================================================
> NEWRC -T&F eBook data rec.1534 |@ 27/01/2003
> VISBN 0203445570
> OSBN 0-203-44557-0
> EBK1 0203548310
> EBK2 0203651057
> EBK3 020375381X
> EBK4 0203273567
> OTOP
> OTART
> OTI Creative Mathematics
> OSUB
> USAU Upitis |f Rena |u Queens University |c Kingston, Ontario |x Canada
> USAU Phillips |f Eileen |u Teacher |c Vancover |x Canada
> USAU Higginson |f William |u Queens University |c Kingston |x Canada
> EDIT
> INTRO
> FORWD Pimm |f David |u The Open University x| UK
> TRANS
> 2BIND 0415164621 |P 70.00 |U 100.00 |B Hb |A |M 1 |T Creative Mathematics
> VPR 11.99
> USPRI 17.99
> OTBPR 19.99 |U 25.95 |D 17/07/1997
> USBDG
> MFDT
> ERT GB US CA AU NZ ZA IE
> ORT
> NRT
> TTY
> OBIND eB
> PDUE 11/03/2002
> VIZE
> VEXT 192
> OILLS 40 illustrations
> LEVEL
> OSER
> OIMP RoutledgeFalmer
> LIBPR
> OALT
> OPPQ
> OCATL This book shows how creative maths can <I>really</I> work. Exploring
> the ways in which maths skills can be learned through cross-curricular
> activities based on visual arts and music, the book presents maths as a
> meaningful and exciting subject which holds no fears for children.<BR> The
> authors recognise that while maths-phobia prevails in our increasingly
> mathematicised world, attitudes and approaches to teaching the subject need
> to be reviewed, and issues such as gender stereotyping, which encourage
> maths-apathy, need to be tackled at an early stage.<BR> Within this
> collection of classroom-based stories are detailed examples of integrative
> mathematic projects; these will give teachers the confidence to try out
> cross-curricular activities in their classes. The book also provides support
> with difficult areas such as assessment, planning and development.<BR>
> Fascinating to read in its own right this book will appeal to the specialist
> and non-specialist alike.<BR>
> OCONC This book shows how creative maths can <I>really</I> work. Exploring
> the ways in which maths skills can be learned through cross-curricular
> activities based on visual arts and music, the book presents maths as a
> meaningful and exciting subject which holds no fears for children.<BR> The
> authors recognise that while maths-phobia prevails in our increasingly
> mathematicised world, attitudes and approaches to teaching the subject need
> to be reviewed, and issues such as gender stereotyping, which encourage
> maths-apathy, need to be tackled at an early stage.<BR> Within this
> collection of classroom-based stories are detailed examples of integrative
> mathematic projects; these will give teachers the confidence to try out
> cross-curricular activities in their classes. The book also provides support
> with difficult areas such as assessment, planning and development.<BR>
> Fascinating to read in its own right this book will appeal to the specialist
> and non-specialist alike.<BR>
> OCATS Exploring the ways in which maths skills can be learned through
> cross-curricular projects on arts and music, this book presents maths as a
> meaningful and exciting subject which holds no fear for children.
> OQUO 'This is a fascinating book ... which gives detailed case studies.' |I
> Infant Equipment
> OCNT
> FCONT
> OWRIT
> VEDIT 1
> BICAC U
> BSUB1 J
> BSUB2 JD
> BSUB3
> BICAV RF
> SUBJ1 SB150000
> SUBJ2
> SUBJ3
> VPROD EB
> VACDE WEB
> CREAT MFK - AUTO |D 2002 07 19
> ================================================================
>
> the use of '|' denotes a subfield. My plan is to name the subfield by the
> name of the field followed by '_' and the subfield identifier, so that the
> one on the last line would appear as 'CREAT_D, and that way I'll be sure to
> properly tag those that are belonging to the 'counter-affected' fields.
>
> All help is appreciated.
>
> Cheers
>
> George
>
> > -----Original Message-----
> > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> > Sent: 11 February 2003 11:03 am
> > To: George Pitcher; [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] reading lines from a file
> >
> >
> > Then you need to write a parser. What's the basic problem then?
> >
> > > -----Original Message-----
> > > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, February 11, 2003 11:59 AM
> > > To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED]
> > > Subject: RE: [PHP-WIN] reading lines from a file
> > >
> > >
> > > Yes, eventually. I want to come up with a good method because
> > this file is
> > > going to be supplied to me on a fairly regular basis.
> > >
> > > George
> > >
> > > > -----Original Message-----
> > > > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> > > > Sent: 11 February 2003 10:56 am
> > > > To: George Pitcher; [EMAIL PROTECTED]
> > > > Subject: RE: [PHP-WIN] reading lines from a file
> > > >
> > > >
> > > > What do you want to do? Parse the file into tab-delimited data
> > > > in order to bulk load it into the database?
> > > >
> > > > > -----Original Message-----
> > > > > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Tuesday, February 11, 2003 11:41 AM
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: [PHP-WIN] reading lines from a file
> > > > >
> > > > >
> > > > > Hi,
> > > > >
> > > > > I have a huge file that I want to get into a db format.
> > > > >
> > > > > There are over 5000 records and I need to create fieldnames
> > on the fly.
> > > > >
> > > > > Each record comprises a number of lines (fields) containing
> > 2 elements
> > > > > (fieldname [first 5 chars (which need rtrimming)], value [rest
> > > > of line, some
> > > > > with lots of text]).
> > > > >
> > > > > Some fieldnames are duplicated within a record so I need to
> > > > rename these by
> > > > > using a counter which is reset for each record (there are at least 5
> > > > > fieldnames that are affected this way - so 5 counters).
> > > > >
> > > > > Some values contain subfields so I need to be able to handle
> > > > these, but this
> > > > > doesn't look frightening.
> > > > >
> > > > > And I would like to end up with an array with keys (fieldnames)
> > > > and values.
> > > > >
> > > > > But I'm stuck at the first hurdle because I can't find out how
> > > > to put a line
> > > > > into a string.
> > > > >
> > > > > Any pointers?
> > > > >
> > > > > George in Oxford
> > > > >
> > > > >
> > > > > ===
> > > > >
> > > > > George Pitcher
> > > > > HERON Technical Manager
> > > > > Ingenta plc
> > > > > 23-38 Hythe Bridge Street, Oxford, OX1 2ET
> > > > > T +44 (0)1865 799137 direct
> > > > > T +44 (0)1865 799000 switchboard
> > > > > F +44 (0)1865 799134
> > > > > E [EMAIL PROTECTED]
> > > > >
> > > > > www.ingenta.com
> > > > > Ingenta: Empowering the exchange of academic and
> > professional content
> > > > > online.
> > > > >
> > > > >
> > > > > --
> > > > > PHP Windows Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > >
> > >
> >
>
--- End Message ---
--- Begin Message ---
Chris,
I couldn't find any readline function in the manual - did I miss it?
It isn't as simple as you say, because, to start with, I don't know how many
fields there are going to be, I don't know how I'm going to build my array
to record-level sets.
I'm not really looking for someone to provide the code (snippets accepted
though) but I would appreciate being pointed in the right direction.
Cheers
George
> -----Original Message-----
> From: Chris Kranz [mailto:[EMAIL PROTECTED]]
> Sent: 11 February 2003 12:04 pm
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> So all you need to do, is read the file in, line by line (see the php
> manual) and then break up each line into an array to be added to the db.
>
> This is fairly basic stuff, you just need to look in the php manual, it
> sounds like you don't really have a problem as such, you just want
> someone to tell you what the code would be?
>
> chris kranz
> fatcuban.com
>
>
> -----Original Message-----
> From: George Pitcher [mailto:[EMAIL PROTECTED]]
> Sent: 11 February 2003 11:59
> To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] reading lines from a file
>
> Yes, I suppose I do.
>
> I want to be able to take my file, work out a complete of fieldnames and
> then create an array which could then be used to, initially, create a
> table
> in MySQL.
>
> I'm not using MySQL for my main system which is based on FileMaker, but
> will
> be moving later this year to MySQL, so it's not a wasted effort.
>
> I know that I can export the MySQL data and push that into FileMaker.
>
> Below (in between ==== lines, is a sample record for parsing. This may
> help
> you understand the problem I have.
>
> =======================================================
> NEWRC -T&F eBook data rec.1534 |@ 27/01/2003
> VISBN 0203445570
> OSBN 0-203-44557-0
> EBK1 0203548310
> EBK2 0203651057
> EBK3 020375381X
> EBK4 0203273567
> OTOP
> OTART
> OTI Creative Mathematics
> OSUB
> USAU Upitis |f Rena |u Queens University |c Kingston, Ontario |x Canada
> USAU Phillips |f Eileen |u Teacher |c Vancover |x Canada
> USAU Higginson |f William |u Queens University |c Kingston |x Canada
> EDIT
> INTRO
> FORWD Pimm |f David |u The Open University x| UK
> TRANS
> 2BIND 0415164621 |P 70.00 |U 100.00 |B Hb |A |M 1 |T Creative
> Mathematics
> VPR 11.99
> USPRI 17.99
> OTBPR 19.99 |U 25.95 |D 17/07/1997
> USBDG
> MFDT
> ERT GB US CA AU NZ ZA IE
> ORT
> NRT
> TTY
> OBIND eB
> PDUE 11/03/2002
> VIZE
> VEXT 192
> OILLS 40 illustrations
> LEVEL
> OSER
> OIMP RoutledgeFalmer
> LIBPR
> OALT
> OPPQ
> OCATL This book shows how creative maths can <I>really</I> work.
> Exploring
> the ways in which maths skills can be learned through cross-curricular
> activities based on visual arts and music, the book presents maths as a
> meaningful and exciting subject which holds no fears for children.<BR>
> The
> authors recognise that while maths-phobia prevails in our increasingly
> mathematicised world, attitudes and approaches to teaching the subject
> need
> to be reviewed, and issues such as gender stereotyping, which encourage
> maths-apathy, need to be tackled at an early stage.<BR> Within this
> collection of classroom-based stories are detailed examples of
> integrative
> mathematic projects; these will give teachers the confidence to try out
> cross-curricular activities in their classes. The book also provides
> support
> with difficult areas such as assessment, planning and development.<BR>
> Fascinating to read in its own right this book will appeal to the
> specialist
> and non-specialist alike.<BR>
> OCONC This book shows how creative maths can <I>really</I> work.
> Exploring
> the ways in which maths skills can be learned through cross-curricular
> activities based on visual arts and music, the book presents maths as a
> meaningful and exciting subject which holds no fears for children.<BR>
> The
> authors recognise that while maths-phobia prevails in our increasingly
> mathematicised world, attitudes and approaches to teaching the subject
> need
> to be reviewed, and issues such as gender stereotyping, which encourage
> maths-apathy, need to be tackled at an early stage.<BR> Within this
> collection of classroom-based stories are detailed examples of
> integrative
> mathematic projects; these will give teachers the confidence to try out
> cross-curricular activities in their classes. The book also provides
> support
> with difficult areas such as assessment, planning and development.<BR>
> Fascinating to read in its own right this book will appeal to the
> specialist
> and non-specialist alike.<BR>
> OCATS Exploring the ways in which maths skills can be learned through
> cross-curricular projects on arts and music, this book presents maths as
> a
> meaningful and exciting subject which holds no fear for children.
> OQUO 'This is a fascinating book ... which gives detailed case
> studies.' |I
> Infant Equipment
> OCNT
> FCONT
> OWRIT
> VEDIT 1
> BICAC U
> BSUB1 J
> BSUB2 JD
> BSUB3
> BICAV RF
> SUBJ1 SB150000
> SUBJ2
> SUBJ3
> VPROD EB
> VACDE WEB
> CREAT MFK - AUTO |D 2002 07 19
> ================================================================
>
> the use of '|' denotes a subfield. My plan is to name the subfield by
> the
> name of the field followed by '_' and the subfield identifier, so that
> the
> one on the last line would appear as 'CREAT_D, and that way I'll be sure
> to
> properly tag those that are belonging to the 'counter-affected' fields.
>
> All help is appreciated.
>
> Cheers
>
> George
>
> > -----Original Message-----
> > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> > Sent: 11 February 2003 11:03 am
> > To: George Pitcher; [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] reading lines from a file
> >
> >
> > Then you need to write a parser. What's the basic problem then?
> >
> > > -----Original Message-----
> > > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, February 11, 2003 11:59 AM
> > > To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED]
> > > Subject: RE: [PHP-WIN] reading lines from a file
> > >
> > >
> > > Yes, eventually. I want to come up with a good method because
> > this file is
> > > going to be supplied to me on a fairly regular basis.
> > >
> > > George
> > >
> > > > -----Original Message-----
> > > > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> > > > Sent: 11 February 2003 10:56 am
> > > > To: George Pitcher; [EMAIL PROTECTED]
> > > > Subject: RE: [PHP-WIN] reading lines from a file
> > > >
> > > >
> > > > What do you want to do? Parse the file into tab-delimited data
> > > > in order to bulk load it into the database?
> > > >
> > > > > -----Original Message-----
> > > > > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Tuesday, February 11, 2003 11:41 AM
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: [PHP-WIN] reading lines from a file
> > > > >
> > > > >
> > > > > Hi,
> > > > >
> > > > > I have a huge file that I want to get into a db format.
> > > > >
> > > > > There are over 5000 records and I need to create fieldnames
> > on the fly.
> > > > >
> > > > > Each record comprises a number of lines (fields) containing
> > 2 elements
> > > > > (fieldname [first 5 chars (which need rtrimming)], value [rest
> > > > of line, some
> > > > > with lots of text]).
> > > > >
> > > > > Some fieldnames are duplicated within a record so I need to
> > > > rename these by
> > > > > using a counter which is reset for each record (there are at
> least 5
> > > > > fieldnames that are affected this way - so 5 counters).
> > > > >
> > > > > Some values contain subfields so I need to be able to handle
> > > > these, but this
> > > > > doesn't look frightening.
> > > > >
> > > > > And I would like to end up with an array with keys (fieldnames)
> > > > and values.
> > > > >
> > > > > But I'm stuck at the first hurdle because I can't find out how
> > > > to put a line
> > > > > into a string.
> > > > >
> > > > > Any pointers?
> > > > >
> > > > > George in Oxford
> > > > >
> > > > >
> > > > > ===
> > > > >
> > > > > George Pitcher
> > > > > HERON Technical Manager
> > > > > Ingenta plc
> > > > > 23-38 Hythe Bridge Street, Oxford, OX1 2ET
> > > > > T +44 (0)1865 799137 direct
> > > > > T +44 (0)1865 799000 switchboard
> > > > > F +44 (0)1865 799134
> > > > > E [EMAIL PROTECTED]
> > > > >
> > > > > www.ingenta.com
> > > > > Ingenta: Empowering the exchange of academic and
> > professional content
> > > > > online.
> > > > >
> > > > >
> > > > > --
> > > > > PHP Windows Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > >
> > >
> >
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Anders,
Thanks - I'll see if I can persuade one of the PERL people here to have a
go.
Ta.
george
> -----Original Message-----
> From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> Sent: 11 February 2003 12:24 pm
> To: George Pitcher
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> before you do anything else, you need to do the following:
>
> * decide what data in this file that you need
> * create a data model based on this data
> * sufficiently normalize your data
> * implement a database schema according to the normalized data
> * write a parser that parse data according to the RDBMS schema.
> * load data in the RDBMS
> * finished
>
>
> That's what you need to do, and as far I can understand none
> of the above activities are related to PHP at this moment.
>
> However, it should be fairly easy to write a parser for
> this kind of record layout. I see no major problem with
> it.
>
> I would recommend you to consult a professional programmer,
> or at least a programmer with some experience with C/C++ or
> perl or whatever, and he will for sure be able to make a
> parser for you according to some specification that you
> can work out together with him/her. (I've seen worse
> record layout in my days. ;)
>
> I am sorry for not being able to give you the answer
> you wish for.
>
> //Anders
>
> P.S. I am just a bit curious on how big this "huge file" is? D.S.
>
> > -----Original Message-----
> > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 11, 2003 12:59 PM
> > To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] reading lines from a file
> >
> >
> > Yes, I suppose I do.
> >
> > I want to be able to take my file, work out a complete of fieldnames and
> > then create an array which could then be used to, initially,
> create a table
> > in MySQL.
> >
> > I'm not using MySQL for my main system which is based on
> FileMaker, but will
> > be moving later this year to MySQL, so it's not a wasted effort.
> >
> > I know that I can export the MySQL data and push that into FileMaker.
> >
> > Below (in between ==== lines, is a sample record for parsing.
> This may help
> > you understand the problem I have.
> >
> > =======================================================
> > NEWRC -T&F eBook data rec.1534 |@ 27/01/2003
> > VISBN 0203445570
> > OSBN 0-203-44557-0
> > EBK1 0203548310
> > EBK2 0203651057
> > EBK3 020375381X
> > EBK4 0203273567
> > OTOP
> > OTART
> > OTI Creative Mathematics
> > OSUB
> > USAU Upitis |f Rena |u Queens University |c Kingston, Ontario |x Canada
> > USAU Phillips |f Eileen |u Teacher |c Vancover |x Canada
> > USAU Higginson |f William |u Queens University |c Kingston |x Canada
> > EDIT
> > INTRO
> > FORWD Pimm |f David |u The Open University x| UK
> > TRANS
> > 2BIND 0415164621 |P 70.00 |U 100.00 |B Hb |A |M 1 |T Creative
> Mathematics
> > VPR 11.99
> > USPRI 17.99
> > OTBPR 19.99 |U 25.95 |D 17/07/1997
> > USBDG
> > MFDT
> > ERT GB US CA AU NZ ZA IE
> > ORT
> > NRT
> > TTY
> > OBIND eB
> > PDUE 11/03/2002
> > VIZE
> > VEXT 192
> > OILLS 40 illustrations
> > LEVEL
> > OSER
> > OIMP RoutledgeFalmer
> > LIBPR
> > OALT
> > OPPQ
> > OCATL This book shows how creative maths can <I>really</I>
> work. Exploring
> > the ways in which maths skills can be learned through cross-curricular
> > activities based on visual arts and music, the book presents maths as a
> > meaningful and exciting subject which holds no fears for
> children.<BR> The
> > authors recognise that while maths-phobia prevails in our increasingly
> > mathematicised world, attitudes and approaches to teaching the
> subject need
> > to be reviewed, and issues such as gender stereotyping, which encourage
> > maths-apathy, need to be tackled at an early stage.<BR> Within this
> > collection of classroom-based stories are detailed examples of
> integrative
> > mathematic projects; these will give teachers the confidence to try out
> > cross-curricular activities in their classes. The book also
> provides support
> > with difficult areas such as assessment, planning and development.<BR>
> > Fascinating to read in its own right this book will appeal to
> the specialist
> > and non-specialist alike.<BR>
> > OCONC This book shows how creative maths can <I>really</I>
> work. Exploring
> > the ways in which maths skills can be learned through cross-curricular
> > activities based on visual arts and music, the book presents maths as a
> > meaningful and exciting subject which holds no fears for
> children.<BR> The
> > authors recognise that while maths-phobia prevails in our increasingly
> > mathematicised world, attitudes and approaches to teaching the
> subject need
> > to be reviewed, and issues such as gender stereotyping, which encourage
> > maths-apathy, need to be tackled at an early stage.<BR> Within this
> > collection of classroom-based stories are detailed examples of
> integrative
> > mathematic projects; these will give teachers the confidence to try out
> > cross-curricular activities in their classes. The book also
> provides support
> > with difficult areas such as assessment, planning and development.<BR>
> > Fascinating to read in its own right this book will appeal to
> the specialist
> > and non-specialist alike.<BR>
> > OCATS Exploring the ways in which maths skills can be learned through
> > cross-curricular projects on arts and music, this book presents
> maths as a
> > meaningful and exciting subject which holds no fear for children.
> > OQUO 'This is a fascinating book ... which gives detailed case
> studies.' |I
> > Infant Equipment
> > OCNT
> > FCONT
> > OWRIT
> > VEDIT 1
> > BICAC U
> > BSUB1 J
> > BSUB2 JD
> > BSUB3
> > BICAV RF
> > SUBJ1 SB150000
> > SUBJ2
> > SUBJ3
> > VPROD EB
> > VACDE WEB
> > CREAT MFK - AUTO |D 2002 07 19
> > ================================================================
> >
> > the use of '|' denotes a subfield. My plan is to name the
> subfield by the
> > name of the field followed by '_' and the subfield identifier,
> so that the
> > one on the last line would appear as 'CREAT_D, and that way
> I'll be sure to
> > properly tag those that are belonging to the 'counter-affected' fields.
> >
> > All help is appreciated.
> >
> > Cheers
> >
> > George
> >
> > > -----Original Message-----
> > > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> > > Sent: 11 February 2003 11:03 am
> > > To: George Pitcher; [EMAIL PROTECTED]
> > > Subject: RE: [PHP-WIN] reading lines from a file
> > >
> > >
> > > Then you need to write a parser. What's the basic problem then?
> > >
> > > > -----Original Message-----
> > > > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > > > Sent: Tuesday, February 11, 2003 11:59 AM
> > > > To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED]
> > > > Subject: RE: [PHP-WIN] reading lines from a file
> > > >
> > > >
> > > > Yes, eventually. I want to come up with a good method because
> > > this file is
> > > > going to be supplied to me on a fairly regular basis.
> > > >
> > > > George
> > > >
> > > > > -----Original Message-----
> > > > > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> > > > > Sent: 11 February 2003 10:56 am
> > > > > To: George Pitcher; [EMAIL PROTECTED]
> > > > > Subject: RE: [PHP-WIN] reading lines from a file
> > > > >
> > > > >
> > > > > What do you want to do? Parse the file into tab-delimited data
> > > > > in order to bulk load it into the database?
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > > > > > Sent: Tuesday, February 11, 2003 11:41 AM
> > > > > > To: [EMAIL PROTECTED]
> > > > > > Subject: [PHP-WIN] reading lines from a file
> > > > > >
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I have a huge file that I want to get into a db format.
> > > > > >
> > > > > > There are over 5000 records and I need to create fieldnames
> > > on the fly.
> > > > > >
> > > > > > Each record comprises a number of lines (fields) containing
> > > 2 elements
> > > > > > (fieldname [first 5 chars (which need rtrimming)], value [rest
> > > > > of line, some
> > > > > > with lots of text]).
> > > > > >
> > > > > > Some fieldnames are duplicated within a record so I need to
> > > > > rename these by
> > > > > > using a counter which is reset for each record (there
> are at least 5
> > > > > > fieldnames that are affected this way - so 5 counters).
> > > > > >
> > > > > > Some values contain subfields so I need to be able to handle
> > > > > these, but this
> > > > > > doesn't look frightening.
> > > > > >
> > > > > > And I would like to end up with an array with keys (fieldnames)
> > > > > and values.
> > > > > >
> > > > > > But I'm stuck at the first hurdle because I can't find out how
> > > > > to put a line
> > > > > > into a string.
> > > > > >
> > > > > > Any pointers?
> > > > > >
> > > > > > George in Oxford
> > > > > >
> > > > > >
> > > > > > ===
> > > > > >
> > > > > > George Pitcher
> > > > > > HERON Technical Manager
> > > > > > Ingenta plc
> > > > > > 23-38 Hythe Bridge Street, Oxford, OX1 2ET
> > > > > > T +44 (0)1865 799137 direct
> > > > > > T +44 (0)1865 799000 switchboard
> > > > > > F +44 (0)1865 799134
> > > > > > E [EMAIL PROTECTED]
> > > > > >
> > > > > > www.ingenta.com
> > > > > > Ingenta: Empowering the exchange of academic and
> > > professional content
> > > > > > online.
> > > > > >
> > > > > >
> > > > > > --
> > > > > > PHP Windows Mailing List (http://www.php.net/)
> > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > >
> > > > >
> > > >
> > >
> >
>
--- End Message ---
--- Begin Message ---
Yes
fgets()
It's in the section Filesystem functions. (What a surprise)
You might like the function file() also.
Jill
-----Original Message-----
From: George Pitcher [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 12:25 PM
To: Chris Kranz; [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] reading lines from a file
Chris,
I couldn't find any readline function in the manual - did I miss it?
--- End Message ---
--- Begin Message ---
Is this the same problem we discussed a week ago??
Jochem
George Pitcher wrote:
Hi,
I have a huge file that I want to get into a db format.
There are over 5000 records and I need to create fieldnames on the fly.
Each record comprises a number of lines (fields) containing 2 elements
(fieldname [first 5 chars (which need rtrimming)], value [rest of line, some
with lots of text]).
Some fieldnames are duplicated within a record so I need to rename these by
using a counter which is reset for each record (there are at least 5
fieldnames that are affected this way - so 5 counters).
Some values contain subfields so I need to be able to handle these, but this
doesn't look frightening.
And I would like to end up with an array with keys (fieldnames) and values.
But I'm stuck at the first hurdle because I can't find out how to put a line
into a string.
Any pointers?
George in Oxford
===
George Pitcher
HERON Technical Manager
Ingenta plc
23-38 Hythe Bridge Street, Oxford, OX1 2ET
T +44 (0)1865 799137 direct
T +44 (0)1865 799000 switchboard
F +44 (0)1865 799134
E [EMAIL PROTECTED]
www.ingenta.com
Ingenta: Empowering the exchange of academic and professional content
online.
--- End Message ---
--- Begin Message ---
You DON'T parse large record based file with a web scripting language.
It is as bad recommendation to suggest it. And you just don't do that.
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 11, 2003 1:27 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> Yes
>
> fgets()
> It's in the section Filesystem functions. (What a surprise)
>
> You might like the function file() also.
>
> Jill
>
> -----Original Message-----
> From: George Pitcher [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 11, 2003 12:25 PM
> To: Chris Kranz; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> Chris,
>
> I couldn't find any readline function in the manual - did I miss it?
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Hey, it's not our place to say what someone else can and cannot code.
If someone asks me "What's the function that reads a line from a file?" I'm
happy to answer it.
What they want to use that function for is not my problem - nor yours.
In this forum we can hopefully get answers to questions along the lines of
"How do you do XYZ?" from each other. I know it's bad form to ask "What's
the algorithm for XYZ?", but that wasn't actually asked.
Furthermore, if you read the text _BELOW_ (which is what you ACTUALLY
replied to, and I have included in full, despite the usual netiquette),
you'll find no mention of parsing or record-based files. That was another
email in the same thread. There was no reason to reply to MINE. Your reply
_is not_ a reply to _my_ post.
If you want to talk more about your philosophy please could you start a new
thread, and leave me out of it.
Jill
-----Original Message-----
From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 2:05 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] reading lines from a file
You DON'T parse large record based file with a web scripting language.
It is as bad recommendation to suggest it. And you just don't do that.
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 11, 2003 1:27 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> Yes
>
> fgets()
> It's in the section Filesystem functions. (What a surprise)
>
> You might like the function file() also.
>
> Jill
>
> -----Original Message-----
> From: George Pitcher [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 11, 2003 12:25 PM
> To: Chris Kranz; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> Chris,
>
> I couldn't find any readline function in the manual - did I miss it?
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Point taken.
But I don't understand why you take this personally?
Maybe I should have written "one" instead of "you"?
Anyhow;
First; If a programmer suggest to parse an "huge file" via a
web based script; that programmer is an idiot and should be
fired. Period.
Secondly; weather or not you are right, by maintaining the
very idea of giving "help" to this person you encourage a
very bad solution and at the same time you confuse and make
waste of that persons time. Reading that persons questions/
answer it fairly easy to understand that (s)he has less
experience with programming.
In fact you was not helping this person at all, but rather
contributing to create a mess for this person.
Following the tread it is quite obviously that the people who
answer/"helps" in the thread don't care to investigate what
the person who asked the question actually needed
What a person might ask for it not always whet that person needs.
If you think you don't have this time to investigate what
people really need. Try to avoid to answer then, because it
wont help them, but rather confuse them.
Because why else would one like to answer? Exhibition purposes?
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 11, 2003 3:08 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> Hey, it's not our place to say what someone else can and cannot code.
>
> If someone asks me "What's the function that reads a line from a file?" I'm
> happy to answer it.
> What they want to use that function for is not my problem - nor yours.
>
> In this forum we can hopefully get answers to questions along the lines of
> "How do you do XYZ?" from each other. I know it's bad form to ask "What's
> the algorithm for XYZ?", but that wasn't actually asked.
>
> Furthermore, if you read the text _BELOW_ (which is what you ACTUALLY
> replied to, and I have included in full, despite the usual netiquette),
> you'll find no mention of parsing or record-based files. That was another
> email in the same thread. There was no reason to reply to MINE. Your reply
> _is not_ a reply to _my_ post.
>
> If you want to talk more about your philosophy please could you start a new
> thread, and leave me out of it.
>
> Jill
>
> -----Original Message-----
> From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 11, 2003 2:05 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> You DON'T parse large record based file with a web scripting language.
> It is as bad recommendation to suggest it. And you just don't do that.
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 11, 2003 1:27 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] reading lines from a file
> >
> >
> > Yes
> >
> > fgets()
> > It's in the section Filesystem functions. (What a surprise)
> >
> > You might like the function file() also.
> >
> > Jill
> >
> > -----Original Message-----
> > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 11, 2003 12:25 PM
> > To: Chris Kranz; [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] reading lines from a file
> >
> >
> > Chris,
> >
> > I couldn't find any readline function in the manual - did I miss it?
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Hi Mr Svensson ,
I trust that I am not the only one to be curious to learn more concerning
your remark.
I routinely parse files similar to those of Mr Pitcher, using PHP from the
Windows command line.
So far I have never had any problem generating CSV files containing about a
million rows (Celeron 750, 256 MB).
Would you care to explain in more details why PHP is a MUST DON'T to do
this?
Thanks
Ignatius
____________________________________________
----- Original Message -----
From: "Svensson, B.A.T. (HKG)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 11, 2003 3:04 PM
Subject: RE: [PHP-WIN] reading lines from a file
> You DON'T parse large record based file with a web scripting language.
> It is as bad recommendation to suggest it. And you just don't do that.
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 11, 2003 1:27 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] reading lines from a file
> >
> >
> > Yes
> >
> > fgets()
> > It's in the section Filesystem functions. (What a surprise)
> >
> > You might like the function file() also.
> >
> > Jill
> >
> > -----Original Message-----
> > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 11, 2003 12:25 PM
> > To: Chris Kranz; [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] reading lines from a file
> >
> >
> > Chris,
> >
> > I couldn't find any readline function in the manual - did I miss it?
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
> I trust that I am not the only one to be curious to
> learn more concerning your remark.
[...]
> Would you care to explain in more details why PHP is
> a MUST DON'T to do this?
Hi,
Thanx for your comment.
One can talk about things like load balance for scalability,
and other boring subjects, but I agree that it is of course
hard to establish what is meant with a "good" design without
knowing the purposes. But, my general view goes this:
"Of course you can use a hammer to nail a screw, but
a screw driver will do the job much easier and better."
ARGUMENT OF COUPLING & COHESION:
By using for instance PHP for parsing a large text files,
you are stealing resources from the web server (assuming
PHP runs as an instance within Apache), resources better
used elsewhere for other purposes.
A single application (the parser) can be executed in
its own processing space and given independent priority,
this will favoring parallelism with multi CPU system;
if the parser is smart enough written it might even
utilize several CPU's, possible running with low priority
as a background task.
If the system become over loaded, then parser
application can easily be moved onto another system.
Anyway, the main idea is that you wants to keep the
pears and apples separated from each other.
By the way; You're fired! :)
//Anders
--- End Message ---
--- Begin Message ---
Hi Anders,
Well, of course the parser will consume full resources during several
minutes. But I trust our old fellow George would do the parsing on a
separate machine, and only do the LOAD DATA LOCAL on the production machine
at night or such.
My question was more as to whether there is a fundamental performance
difference for file parsing between PHP at the command line and other
languages such as Perl (which I don't know, so you won't have the
opportunity to fire me because you won't hire me in the first place :-)
Cheers
Ignatius (self-employed idiot, currently pondering about firing himself)
____________________________________________
----- Original Message -----
From: "Svensson, B.A.T. (HKG)" <[EMAIL PROTECTED]>
To: "Ignatius Reilly" <[EMAIL PROTECTED]>
Cc: "Php Win32 list" <[EMAIL PROTECTED]>
Sent: Tuesday, February 11, 2003 4:12 PM
Subject: RE: [PHP-WIN] reading lines from a file
> > I trust that I am not the only one to be curious to
> > learn more concerning your remark.
>
> [...]
>
> > Would you care to explain in more details why PHP is
> > a MUST DON'T to do this?
>
> Hi,
>
> Thanx for your comment.
>
> One can talk about things like load balance for scalability,
> and other boring subjects, but I agree that it is of course
> hard to establish what is meant with a "good" design without
> knowing the purposes. But, my general view goes this:
>
> "Of course you can use a hammer to nail a screw, but
> a screw driver will do the job much easier and better."
>
>
> ARGUMENT OF COUPLING & COHESION:
>
> By using for instance PHP for parsing a large text files,
> you are stealing resources from the web server (assuming
> PHP runs as an instance within Apache), resources better
> used elsewhere for other purposes.
>
> A single application (the parser) can be executed in
> its own processing space and given independent priority,
> this will favoring parallelism with multi CPU system;
> if the parser is smart enough written it might even
> utilize several CPU's, possible running with low priority
> as a background task.
>
> If the system become over loaded, then parser
> application can easily be moved onto another system.
>
> Anyway, the main idea is that you wants to keep the
> pears and apples separated from each other.
>
> By the way; You're fired! :)
>
> //Anders
>
--- End Message ---
--- Begin Message ---
Didn't he just say parse it via command line tho?
This wouldn't take away resources from the web server?
Personally, large batches like this shouldn't be done on your live
webserver anyway. No matter how you accomplish it, your taking away a
lot of system resources. Best way to do it, is to parse it on a separate
computer, then just do a simple db dump with the results.
In this case, is PHP any worse a language than a CGI or c++ program?
Other than being a lot easier to code (in my opinion :p).
I've done the same thing, on many occasions, but I don't run the scripts
on my live server, that's just asking for trouble, especially if you
make a mistake... (thinks back to his recursive directory delete
function)
Hehe :)
chris kranz
fatcuban.com
-----Original Message-----
From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
Sent: 11 February 2003 15:13
To: Ignatius Reilly
Cc: Php Win32 list
Subject: RE: [PHP-WIN] reading lines from a file
> I trust that I am not the only one to be curious to
> learn more concerning your remark.
[...]
> Would you care to explain in more details why PHP is
> a MUST DON'T to do this?
Hi,
Thanx for your comment.
One can talk about things like load balance for scalability,
and other boring subjects, but I agree that it is of course
hard to establish what is meant with a "good" design without
knowing the purposes. But, my general view goes this:
"Of course you can use a hammer to nail a screw, but
a screw driver will do the job much easier and better."
ARGUMENT OF COUPLING & COHESION:
By using for instance PHP for parsing a large text files,
you are stealing resources from the web server (assuming
PHP runs as an instance within Apache), resources better
used elsewhere for other purposes.
A single application (the parser) can be executed in
its own processing space and given independent priority,
this will favoring parallelism with multi CPU system;
if the parser is smart enough written it might even
utilize several CPU's, possible running with low priority
as a background task.
If the system become over loaded, then parser
application can easily be moved onto another system.
Anyway, the main idea is that you wants to keep the
pears and apples separated from each other.
By the way; You're fired! :)
//Anders
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Chris, et al,
Nope, I never mentioned the command line at all, but it is probably how I
would have done it if I hadn't passed it over to the PERL guys.
It would have been useful to go through a parsing routine just to learn how
its done (never know when it might be a useful trick).
Even so, I still have plenty on my plate migrating my Filemaker/Lasso system
over to MySQL/PHP/Java.
Cheers
George
> -----Original Message-----
> From: Chris Kranz [mailto:[EMAIL PROTECTED]]
> Sent: 11 February 2003 4:30 pm
> To: 'Php Win32 list'
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> Didn't he just say parse it via command line tho?
>
> This wouldn't take away resources from the web server?
>
> Personally, large batches like this shouldn't be done on your live
> webserver anyway. No matter how you accomplish it, your taking away a
> lot of system resources. Best way to do it, is to parse it on a separate
> computer, then just do a simple db dump with the results.
>
> In this case, is PHP any worse a language than a CGI or c++ program?
> Other than being a lot easier to code (in my opinion :p).
>
> I've done the same thing, on many occasions, but I don't run the scripts
> on my live server, that's just asking for trouble, especially if you
> make a mistake... (thinks back to his recursive directory delete
> function)
>
> Hehe :)
>
> chris kranz
> fatcuban.com
>
>
> -----Original Message-----
> From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> Sent: 11 February 2003 15:13
> To: Ignatius Reilly
> Cc: Php Win32 list
> Subject: RE: [PHP-WIN] reading lines from a file
>
> > I trust that I am not the only one to be curious to
> > learn more concerning your remark.
>
> [...]
>
> > Would you care to explain in more details why PHP is
> > a MUST DON'T to do this?
>
> Hi,
>
> Thanx for your comment.
>
> One can talk about things like load balance for scalability,
> and other boring subjects, but I agree that it is of course
> hard to establish what is meant with a "good" design without
> knowing the purposes. But, my general view goes this:
>
> "Of course you can use a hammer to nail a screw, but
> a screw driver will do the job much easier and better."
>
>
> ARGUMENT OF COUPLING & COHESION:
>
> By using for instance PHP for parsing a large text files,
> you are stealing resources from the web server (assuming
> PHP runs as an instance within Apache), resources better
> used elsewhere for other purposes.
>
> A single application (the parser) can be executed in
> its own processing space and given independent priority,
> this will favoring parallelism with multi CPU system;
> if the parser is smart enough written it might even
> utilize several CPU's, possible running with low priority
> as a background task.
>
> If the system become over loaded, then parser
> application can easily be moved onto another system.
>
> Anyway, the main idea is that you wants to keep the
> pears and apples separated from each other.
>
> By the way; You're fired! :)
>
> //Anders
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Hi Chris,
in general I agree with you.
My remark were against using a web server for this, running
as a thread under it - or whatever. If somebody do that,
then they waste unnecessary system resources.
Maybe I had a to strong opinion in the first letter; writing
in a haste at work while occupied with other stuff might not
always be good for your way of expressing your self.
Design and implementations is a matter of compromises
between contradicting requirements, and if one does
not have knowledge about the pre requirements, then
one easily can make a faulty judgment about a design.
However, there are some few underlying design principles
that once should try to follow if possible - and in most
case they are. As a general role; if I need to scarify
performance for maintenance in a none time critical section,
then I will scarify performance without hesitation.
Bad performance can always be fixed with faster
hardware later on, but how do you fix bad design?
In using PHP in kind of the same fashion as a script
languages, I have no objection against; is this even
possible? And you are right PHP is no worse than anything
else in that respect.
But the best thing would be if we didn't had to parse files
at all. :) But those things only happens in programming utopia
I have heard.
But I don't agree with your point that PHP necessarily would
be easier than C++, my personal opinion is rather the other
way around. :)
> -----Original Message-----
> From: Chris Kranz [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 11, 2003 5:30 PM
> To: 'Php Win32 list'
> Subject: RE: [PHP-WIN] reading lines from a file
>
>
> Didn't he just say parse it via command line tho?
>
> This wouldn't take away resources from the web server?
>
> Personally, large batches like this shouldn't be done on your live
> webserver anyway. No matter how you accomplish it, your taking away a
> lot of system resources. Best way to do it, is to parse it on a separate
> computer, then just do a simple db dump with the results.
>
> In this case, is PHP any worse a language than a CGI or c++ program?
> Other than being a lot easier to code (in my opinion :p).
>
> I've done the same thing, on many occasions, but I don't run the scripts
> on my live server, that's just asking for trouble, especially if you
> make a mistake... (thinks back to his recursive directory delete
> function)
>
> Hehe :)
>
> chris kranz
> fatcuban.com
>
>
> -----Original Message-----
> From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]]
> Sent: 11 February 2003 15:13
> To: Ignatius Reilly
> Cc: Php Win32 list
> Subject: RE: [PHP-WIN] reading lines from a file
>
> > I trust that I am not the only one to be curious to
> > learn more concerning your remark.
>
> [...]
>
> > Would you care to explain in more details why PHP is
> > a MUST DON'T to do this?
>
> Hi,
>
> Thanx for your comment.
>
> One can talk about things like load balance for scalability,
> and other boring subjects, but I agree that it is of course
> hard to establish what is meant with a "good" design without
> knowing the purposes. But, my general view goes this:
>
> "Of course you can use a hammer to nail a screw, but
> a screw driver will do the job much easier and better."
>
>
> ARGUMENT OF COUPLING & COHESION:
>
> By using for instance PHP for parsing a large text files,
> you are stealing resources from the web server (assuming
> PHP runs as an instance within Apache), resources better
> used elsewhere for other purposes.
>
> A single application (the parser) can be executed in
> its own processing space and given independent priority,
> this will favoring parallelism with multi CPU system;
> if the parser is smart enough written it might even
> utilize several CPU's, possible running with low priority
> as a background task.
>
> If the system become over loaded, then parser
> application can easily be moved onto another system.
>
> Anyway, the main idea is that you wants to keep the
> pears and apples separated from each other.
>
> By the way; You're fired! :)
>
> //Anders
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
If I understand you correctly; the reason why you implemented
this in PHP is because PHP is what you are good/best at?
Also excuse my limited ignorant knowledge about PHP, but
my impression about PHP is that it is runs as an instance
of the web server or something? (Please, correct me if I
made any fundamental mistake here!)
When it comes to perl vs PHP, I believe both of these
languages are interpreted in the host evirionment, and I
can't see any reason why there should be any significant
performance difference between these two.
On the other hand I can imagine an performance difference
on doing this with C/C++, which would be my natural choose
when writing a cmd line parser.
> -----Original Message-----
> From: Ignatius Reilly [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 11, 2003 5:09 PM
> To: Svensson, B.A.T. (HKG)
> Cc: Php Win32 list
> Subject: Re: [PHP-WIN] reading lines from a file
>
>
> Hi Anders,
>
> Well, of course the parser will consume full resources during several
> minutes. But I trust our old fellow George would do the parsing on a
> separate machine, and only do the LOAD DATA LOCAL on the production machine
> at night or such.
>
> My question was more as to whether there is a fundamental performance
> difference for file parsing between PHP at the command line and other
> languages such as Perl (which I don't know, so you won't have the
> opportunity to fire me because you won't hire me in the first place :-)
>
> Cheers
>
> Ignatius (self-employed idiot, currently pondering about firing himself)
____________________________________________
----- Original Message -----
From: "Svensson, B.A.T. (HKG)" <[EMAIL PROTECTED]>
To: "Ignatius Reilly" <[EMAIL PROTECTED]>
Cc: "Php Win32 list" <[EMAIL PROTECTED]>
Sent: Tuesday, February 11, 2003 4:12 PM
Subject: RE: [PHP-WIN] reading lines from a file
> > I trust that I am not the only one to be curious to
> > learn more concerning your remark.
>
> [...]
>
> > Would you care to explain in more details why PHP is
> > a MUST DON'T to do this?
>
> Hi,
>
> Thanx for your comment.
>
> One can talk about things like load balance for scalability,
> and other boring subjects, but I agree that it is of course
> hard to establish what is meant with a "good" design without
> knowing the purposes. But, my general view goes this:
>
> "Of course you can use a hammer to nail a screw, but
> a screw driver will do the job much easier and better."
>
>
> ARGUMENT OF COUPLING & COHESION:
>
> By using for instance PHP for parsing a large text files,
> you are stealing resources from the web server (assuming
> PHP runs as an instance within Apache), resources better
> used elsewhere for other purposes.
>
> A single application (the parser) can be executed in
> its own processing space and given independent priority,
> this will favoring parallelism with multi CPU system;
> if the parser is smart enough written it might even
> utilize several CPU's, possible running with low priority
> as a background task.
>
> If the system become over loaded, then parser
> application can easily be moved onto another system.
>
> Anyway, the main idea is that you wants to keep the
> pears and apples separated from each other.
>
> By the way; You're fired! :)
>
> //Anders
>
--- End Message ---
--- Begin Message ---
Dear Mr. Svensson,
I understand your points (well - mostly) but
----- pleeez don't get too fundamental over that !! ------
This thread is up to 21postings by now and
if I knew a better NG I'd suggest a follow up there!
This one is for helping people get going with PHP in
WIN environment, and as far as I am asked with as
little judgement as possible.
Cheer up and be confident in the judgement of the
respectively responsible. There are aspects to consider
unmentioned and irrelevant w/resp to this NG. So I'd
suggest to keep cool.
Cheers,
--
Sven Schnitzke (another self-employed one on the edge of being fired ...)
--- End Message ---
--- Begin Message ---
i think u shld refer this to mysql mailing list ([EMAIL PROTECTED] /
[EMAIL PROTECTED]) .
-----Original Message-----
From: Rui [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 02:02
To: [EMAIL PROTECTED]
Subject: MySQL: some script I must do
First of all, I must thank all the people who tried to help me in the
earlier prob.
Now I know how to make dump's.
The problem now is that I don't know how should I send the database.
I tried to make a dump > data.TXT and also tried data.sql. Both were in
vain.
I must run some kind of script but I don't know what.
Tried:
\.data.sql
I had to put the also the source, but when I pressed Enter key, an error
apears "ERROR 1046: No database selected"
What's wrong?
Thanks.
Old
message --------------------------------------------------------------------
-------------------
Hy there,
I want to put a mysql database on a external server. My ISP told me that I
need to make a Dump of the data and then make some kind of script that I
couldn't understand.
Could anyone explain what I need to do?
Thanks a lot,
Cya
--- End Message ---
--- Begin Message ---
I asked this question in a forum last week and finally got a helpful
answer. I'm new to databases and I knew how to upload an html file
through a typical ftp client but I couldn't get my head around the
concept of uploading a MySQL database. I'm using phpMyAdmin to manage
MySQL.
BTW, TFM was no help in this instance. If I had understood the language
and realized the connection between "upload" and "dump" I might have
gotten it. But in my beginner's ignorance I was lost.
Here are the steps I received from a kind respondent. (Apparently my
version of phpMyAdmin is different because I had to modify these steps
slightly but I was able to take my first 'dump' without incident. If
this doesn't help, I precisely documented my actual steps and would send
you those later - I don't have it here with me).
ON YOUR LOCAL MACHINE:
Fire up your phpMyAdmin if it's not already running.
Select the relevant database on the left navigation this should show
'View dump (schema) of database'
Select the tab 'Export' on the right
Check option box 'Structure and data' if required
Then check 'Save as file' press 'Go' and you should be prompted to
download an sql dump file.
REMOTE SERVER:
Open up a browser session pointing towards your remote phpmyadmin.
Create a database for your tables and data to be placed into.
Then select this database using the left navigation.
Select the tab 'SQL' on the right
Now you should see a 'Browse ...' button press this and select the local
dump file something.sql
Press go and the sql file should handle the rest for you.
Jim
-----Original Message-----
From: Rui [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 10, 2003 2:32 PM
To: [EMAIL PROTECTED]
Subject: MySQL: some script I must do
First of all, I must thank all the people who tried to help me in the
earlier prob.
Now I know how to make dump's.
The problem now is that I don't know how should I send the database.
I tried to make a dump > data.TXT and also tried data.sql. Both were in
vain.
I must run some kind of script but I don't know what.
Tried:
\.data.sql
I had to put the also the source, but when I pressed Enter key, an error
apears "ERROR 1046: No database selected"
What's wrong?
Thanks.
Old
message
--------------------------------------------------------------------
-------------------
Hy there,
I want to put a mysql database on a external server. My ISP told me that
I
need to make a Dump of the data and then make some kind of script that I
couldn't understand.
Could anyone explain what I need to do?
Thanks a lot,
Cya
--- End Message ---
--- Begin Message ---
Hi,
First of all, thanks for the suggestions. My problem is 'almost' solved.
I have succeeded sending an e-mail with the mail function. The problem
was in the php.ini file. I had limited the execution of phpinfo() and
system() commands. If I enable both commands, the mail() function works
fine.
The problem is that I would like to have both functions limited. PHP is
installed in a multiuser environment and there's a lot of information
available with phpinfo(). Is it possible to make mail() work with
phpinfo() and system() disabled? If that's not possible, how can I limit
the information phpinfo() gives -ideally it should give no information-.
Thanks,
Juanan
Vladimir Galkov wrote:
I feel the qweston become offtopick soon ;-)))))))
1. Look into permissions of the user you set to run web service
2. Use simple <? print phpinfo(); ?> code to look at real values your php
enviroment varibles have.
3. Check
[mail function]
; For Win32 only.
SMTP = < smtp.somewhere.go >
; For Win32 only.
sendmail_from = < [EMAIL PROTECTED] >
4. Write code to send mail threw socets, then you'll see targeted server
ansver on every your request.
""juan ant. martМnez"" <[EMAIL PROTECTED]> сообщил/сообщила в новостях
следующее: [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi,
I'm new to php. I have downloaded and installed PHP 4.3.0 on a Windows
NT 4.0 server. I have tested the configuration and changed the
parameters in php.ini to fit my environment.
The basic code works fine, but one of the things I'd like to do is to
send mails. I have found the sample code and tested the following :
mail("[EMAIL PROTECTED]", "test", "This is a test!","From:
[EMAIL PROTECTED]")
But when I run this code, I get the following error:
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or
custom "From:" header missing in d:\www\mail.php on line 9
In fact, the sendmail_from is configured in the php.ini file (in the
windows directory), and also forced in the line above (I have tried also
without the "From:..." but it does neither work) . The smtp server is
in a remote machine, and in fact, no connection is made from the php
script (I have looked through the logs and there has been no attempt to
connect)
Does anyone know where is the problem? Any suggestions will be welcomed.
Thanks in advance,
Juanan
--- End Message ---