php-general Digest 11 Aug 2007 09:59:06 -0000 Issue 4955
Topics (messages 260643 through 260677):
Re: Thoughts about music library
260643 by: Børge Holen
simplexml_load_file()
260644 by: Panquekas
Re: php 4.4.7 make install with pear causes zend freeing errors
260645 by: John Mendenhall
Re: string as file
260646 by: Dan
260671 by: Richard Lynch
Re: Forwarding $_POST[]...
260647 by: Dan
260668 by: Richard Lynch
Re: Code Igniter for 'novices' ?
260648 by: Dan
Re: Open Source Job Wanted system
260649 by: Joey
260650 by: Richard Lynch
Re: manual vs. meta refresh
260651 by: Richard Lynch
260663 by: Tijnema
260674 by: Robert Cummings
Re: PHP on .NET DLR
260652 by: Richard Lynch
Re: and newlines under windows
260653 by: Richard Lynch
Re: Recursion and threaded message boards...
260654 by: Richard Lynch
Re: Friday morning brain farts....
260655 by: Richard Lynch
260656 by: Richard Lynch
260657 by: Richard Lynch
260658 by: Richard Lynch
Re: function -> action
260659 by: Richard Lynch
Re: multiple data to insert to database
260660 by: Richard Lynch
Re: Import XLS file with UTF-8
260661 by: Richard Lynch
Re: Running a server process
260662 by: Richard Lynch
Re: help with ming library
260664 by: Richard Lynch
Re: permissions for include()
260665 by: Richard Lynch
Re: get and post together
260666 by: Richard Lynch
Re: preg_match_all to match <img> tags
260667 by: Richard Lynch
Re: Exceptions
260669 by: Richard Lynch
Re: Segmentation fault on PHP CLI
260670 by: Richard Lynch
Re: I know this is not easy and I'm not stupid but...
260672 by: Richard Lynch
Re: magic quotes
260673 by: Richard Lynch
Concatenation vs. Interpolation
260675 by: AmirBehzad Eslami
reading a word document
260676 by: Tom Cruickshank
problem in <tr>
260677 by: shivendra
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 ---
On Wednesday 08 August 2007 03:16, Richard Lynch wrote:
> On Tue, August 7, 2007 3:20 am, Colin Guthrie wrote:
> > Børge Holen wrote:
> >> On Monday 06 August 2007 23:39, Colin Guthrie wrote:
> >>> Børge Holen wrote:
> >>>> I'm building an web interface for my music collection.
> >>>
> >>> I'd have a quick look at mp3act. It does pretty much what you want
> >>> I think.
> >>
> >> yes, but where is the fun in that? ;D
> >> and if something irritate me, it simple to fix it when I built it
> >
> > Indeed :p
>
> I had no problem hacking the DDJ source when I found something I
> didn't like... :-)
Yes, but then again, I get lost in someone elses code(thats beside the
point ;)
>
> And, really, you still should at least survey the popular ones to
> steal their ideas :-)
Jup did that, quite a lot. They seem to ponder on the exact same question that
I have, and I can't seem to find any techincal reasons for why and why not on
these subjects, I can think of quite a few, but would appreciate some other
point of view. Someone with more experience on the correct way of doing
things, and not as a finished program witch works.
>
> Maybe you'll find one you like and can live with their source code.
Hardly, I like making stuff and learn as I go.
>
> Maybe you'll still want to roll your own.
>
> But at least take a look at the car-lot of pre-built wheels, eh?
See above. =D
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
--
---
Børge
http://www.arivene.net
---
--- End Message ---
--- Begin Message ---
Hello,
I'm doing an script which it'll "read" the xml values, but I have one
problem doing that.
On the xml there is a tag that has an hífen in the middle, so when I do
"echo $xml->comment-id" it gives me an error.
How can I make this work?
Thanks in advantage.
--- End Message ---
--- Begin Message ---
> On 8/10/07, John Mendenhall <[EMAIL PROTECTED]> wrote:
> > Per my previous message, I have recently upgraded from
> > php 4.4.0, to php 4.4.7. My configure options are as
> > follows:
> >
> <snip>
> >
> > I would like to know what I am doing wrong here.
> > When I turn off pear, this does not happen.
> > When I try to upgrade or install pear packages,
> > I get the same types of errors.
>
> What are you doing with PHP4???
We have several clients with web applications and
sites that break when we attempted to upgrade to
php5. Upgrading to php5 is a priority. However,
we are unable to do this at this time.
JohnM
--
john mendenhall
[EMAIL PROTECTED]
surf utopia
internet services
--- End Message ---
--- Begin Message ---
Well, I have no idea what the Phython StringIO method does. Could someone
explain in PHP terms maybe? Google gave me this explaining stringIO
http://docs.python.org/lib/module-StringIO.html . It didnt' make much sense
still after reading it though.
- Dan
"Rick Pasotto" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Does php have a facility similar to python's stringIO?
What I'm wanting to do is similar to a mail merge. IOW, I know I can
create an include file like:
$out = <<<EOT
This is an example of $var1 and $var2.
EOT;
and then after assigning values to $var1 and $var2 include that file. I
can later use different values for $var1 and $var2 and get a different
$out with a second include.
Can I someout "include" a string instead of a file? Or maybe there is
some completely different way to do what I want.
--
"I have always in my own thought summed up individual liberty, and
business liberty, and every other kind of liberty, in the phrase
that is common in the sporting world, "A free field and no favor."
-- Woodrow Wilson, U.S. President, 1915
Rick Pasotto [EMAIL PROTECTED] http://www.niof.net
--- End Message ---
--- Begin Message ---
Reading that, I think it's similar to this:
http://php.net/stream
I'm really not sure what the OP wants, though...
On Thu, August 9, 2007 6:32 pm, Dan wrote:
> Well, I have no idea what the Phython StringIO method does. Could
> someone
> explain in PHP terms maybe? Google gave me this explaining stringIO
> http://docs.python.org/lib/module-StringIO.html . It didnt' make much
> sense
> still after reading it though.
>
> - Dan
>
> "Rick Pasotto" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Does php have a facility similar to python's stringIO?
>>
>> What I'm wanting to do is similar to a mail merge. IOW, I know I can
>> create an include file like:
>>
>> $out = <<<EOT
>> This is an example of $var1 and $var2.
>> EOT;
>>
>> and then after assigning values to $var1 and $var2 include that
>> file. I
>> can later use different values for $var1 and $var2 and get a
>> different
>> $out with a second include.
>>
>> Can I someout "include" a string instead of a file? Or maybe there
>> is
>> some completely different way to do what I want.
>>
>> --
>> "I have always in my own thought summed up individual liberty, and
>> business liberty, and every other kind of liberty, in the phrase
>> that is common in the sporting world, "A free field and no favor."
>> -- Woodrow Wilson, U.S. President, 1915
>> Rick Pasotto [EMAIL PROTECTED] http://www.niof.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
I have a suspicion that this is something like.
1. User enters info
2. Checks if info is indeed valid
|_ If not then ask the user for correct info
3. Done process the info
Is this right?
You can do this buy having PHP post to itself, it checks if the info is
valid and if it isn't it renders a page asking for correct info and
resubmits to itself till it gets what it wants. Then it does whatever you
want it to.
Other than that yes, it can be somewhat annoying trying to move data between
PHP files, especially if you want seperate scripts to be more object
oriented in that each has a specific function. Does anyone know of an easy
to pass data between PHP files?
- Dan
""Tony Di Croce"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I keep wanting to do something, and either I dont know how to do it, or I'm
doing something wrong and need to rethink things.
Quite often, I have a form that submits to a php script via POST and after
doing some processing (or more frequently, asking the user a question),
I'd
like to forward those $_POST[] vars to another script (or even the same
script).
I could do something complicated and store the $_POST vars in $_SESSION[],
but what I'd rather do is simply add a var to $_POST[] and resubmit this
to
the same .php.
Is their any way to do this, or do I need to rethink things?
td
--
Publish technical articles @ skilledwords.com and get 100% of the
ad-revenue!
http://www.skilledwords.com
--- End Message ---
--- Begin Message ---
On Thu, August 9, 2007 1:04 pm, Tony Di Croce wrote:
> I keep wanting to do something, and either I dont know how to do it,
> or I'm
> doing something wrong and need to rethink things.
>
> Quite often, I have a form that submits to a php script via POST and
> after
> doing some processing (or more frequently, asking the user a
> question), I'd
> like to forward those $_POST[] vars to another script (or even the
> same
> script).
>
> I could do something complicated and store the $_POST vars in
> $_SESSION[],
> but what I'd rather do is simply add a var to $_POST[] and resubmit
> this to
> the same .php.
>
> Is their any way to do this, or do I need to rethink things?
Both. :-)
You can use http://php.net/curl to POST whatever you want, wherever
you want.
But you probably should just re-think things and not have to do that
in the first place if it's your own web application you are building.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
Um yeah. The PHPpatterns.com site hasn't been updated for years. Plus I'm
unable to find any actual content on anything there. I looked through the
indexes but didn't find anything.
""Nathan Nobbe"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
steve,
though i havent used code igniter i consider the tutorials on the site
demonstrating how to use it quite valuable.
i think they are valuable because they can show people who arent familiar
w/
a development flow,
using an mvc framework, what its like, in general.
i have heard good things about code igniter.
if you want to learn the core values, i recommend opp and design patterns.
here is a nice free site to get you headed in the right direction for php.
http://www.phppatterns.com/docs/start
-nathan
On 8/9/07, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
Hi all,
This isn't a 'which framework is better than the other' question. I'm a
novice developer and I'm looking to conform to an MVC model for my
applications. I was wondering if anyone would be kind enough and has used
code igniter, to respond to me and let me know their thoughts on it, and
if
it's a good framework to work with as a novice.
I eventually hope to learn the core values and build my own robust
framework.
Thanks :-)
--- End Message ---
--- Begin Message ---
Hey Nathan,
Actually what I was looking for was an application so that I could have a
service like craiglist.
Joey
From: Nathan Nobbe [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 09, 2007 3:46 PM
To: Joey
Cc: PHP
Subject: Re: [PHP] Open Source Job Wanted system
craigslist is out there, but i havent posted a resume on there..
-nathan
On 8/9/07, Joey <[EMAIL PROTECTED]> wrote:
Has anybody had any experience with any open source Job posting systems out
there?
Thanks!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Thu, August 9, 2007 1:54 pm, Joey wrote:
> Has anybody had any experience with any open source Job posting
> systems out
> there?
Check this out:
http://jobcoin.com/
I haven't had a chance to install it and play with it yet, but it sure
seems reasonable in its approach.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Fri, August 10, 2007 1:26 pm, Kevin Murphy wrote:
> I doubt this, but is there any way to determine via PHP if a browser
> was refreshed automatically via a META tag vs the person clicking the
> refresh button?
You could embed something in the META tag's URL such as:
<meta http-equiv="refresh"
content="5;http://example.com?from_meta_tag=1" >
You would then need to re-direct back to the URL *without* the GET
parameter from_meta_tag=1 so that their refresh button would not be
going to that URL with from_meta_tag in it.
Kind of kludgy, but should work
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On 8/11/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
> On Fri, August 10, 2007 1:26 pm, Kevin Murphy wrote:
> > I doubt this, but is there any way to determine via PHP if a browser
> > was refreshed automatically via a META tag vs the person clicking the
> > refresh button?
>
> You could embed something in the META tag's URL such as:
>
> <meta http-equiv="refresh"
> content="5;http://example.com?from_meta_tag=1" >
>
> You would then need to re-direct back to the URL *without* the GET
> parameter from_meta_tag=1 so that their refresh button would not be
> going to that URL with from_meta_tag in it.
>
> Kind of kludgy, but should work
>
Do you guys read other replies first before making a reply yourself?
You're the third one making the same reply...
Tijnema
--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info
--- End Message ---
--- Begin Message ---
On Sat, 2007-08-11 at 02:10 +0200, Tijnema wrote:
> On 8/11/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
> > On Fri, August 10, 2007 1:26 pm, Kevin Murphy wrote:
> > > I doubt this, but is there any way to determine via PHP if a browser
> > > was refreshed automatically via a META tag vs the person clicking the
> > > refresh button?
> >
> > You could embed something in the META tag's URL such as:
> >
> > <meta http-equiv="refresh"
> > content="5;http://example.com?from_meta_tag=1" >
> >
> > You would then need to re-direct back to the URL *without* the GET
> > parameter from_meta_tag=1 so that their refresh button would not be
> > going to that URL with from_meta_tag in it.
> >
> > Kind of kludgy, but should work
> Do you guys read other replies first before making a reply yourself?
> You're the third one making the same reply...
Richard was providing a solution to handle the case of a meta redirect
after a metaredirect. He indicates making a redirect (server side would
be the interpretation) to remove the meta redirect flag in the meta
redirects URL. However, it's still flawed since upon a server side
redirect the script would think a manual refresh had occurred :)
However, it can be done embedding an ID in the URL indicating that a
serverside redirect has occurred, then saving that value to a database
so upon a manual refresh that ID is detected as having been used already
and so the manual redirect is detected. Yes, yes, this is kludgy
indeed :)
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................
--- End Message ---
--- Begin Message ---
On Fri, August 10, 2007 12:12 pm, Sancar Saran wrote:
> Once upon a time I try to ignite PHP community to develop some kind of
> client
> side php, which failed, because lack of interest (or because of
> javascript).
> In open source world everthing boosted from personal interest.
Wez did a PHPScript thingie that I think works as an ActiveX
controller or somesuch...
It's in PECL.
Never found time to play with it, but it sure looks interesting...
I've got ZERO interest in anything .net related, personally.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Fri, August 10, 2007 11:48 am, Faither wrote:
> I'm kind of lost with how str_replace , preg_replace, ereg_replace or
> even explode are handling a "\n"-ewline.
.
.
.
> Is it even possible under windows? ^^
In Linux, the newline is "\n", but...
Under Windows, the newline isn't "\n", it's "\r\n"
In the Mac world it's "\r"
Now the browsers are running on whatever platform, and the user is
copying/pasting in text or whatever, and the data you get PROBABLY is
using the newline encoding of the web browser client platform.
So, to normalize any input with newlines, do this:
//assuming basic ASCII text data input:
$data = str_replace("\r\n", "\n", $data);
$data = str_replace("\r", "\n", $data);
Store that normalized text in the database.
When you DISPLAY the text to the user, you might want to use:
echo nl2br($data);
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Fri, August 10, 2007 11:23 am, Tony Di Croce wrote:
> I have to write some PHP backend code for a threaded message board.
> The db
> has a message table, and each message has a parent id.
>
> Does anyone have any advice for someone whos never done this in PHP?
>
> I'm currently thinking that I write function that takes a db row as an
> argument, and initially, it is passed the root node of the whole tree.
> It is
> also probably passed a string variable.
>
> The first thing it will do is append the code for itself to the
> string.
>
> Then it will query the DB for all its children (with an order by post
> timestamp), and for every child, it will call itself on that child
> row.
>
> Am I on the right track? (I've done simmilar things in C++, just not
> in
> PHP)...
What you describe will "work" if you don't care about performance...
If there's any heavy activity at all, you'll be swamping your Database
in recursive "child" lookup queries.
Google for "SQL Tree Traversal" and you should find quite a few
solutions.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Fri, August 10, 2007 9:43 am, Jason Pruim wrote:
> I want to be able to sort that info so my sql query looks like:
> "Select * from current order by '$order';" and $order is populated by
> a GET when they click on a link: "<A href=index.php?order='Last'>Sort
> by last name</A>" Now... the whole PHP page is being included in
> a .shtml page to actually display it and make it look purrdee :)
You probably don't want to slap the '$order' into your query for two
reasons:
#1. If $order comes directly from the GET (or POST or COOKIE) data,
then it's untrusted, and should be filtered to be SURE it's not Evil.
#2. Assuming you want to order by some kind of column name, you don't
want the apostrophes on it.
> How do I get it to resort the info and include the new sort on the
> page?
>
> I'm not sure if this has anything to do with it but:
>
> $order = $_GET['order']; <------Line 6
>
> [Fri Aug 10 10:42:04 2007] [error] PHP Notice: Undefined index:
> order in /Volumes/RAIDer/webserver/Documents/tests/legion/index.php
> on line 6
//default to lastname order:
$order = isset($_GET['order']) ? $_GET['order'] : 'lastname';
> Any help will be greatly appreciated.. And if it solves the problem
> I'll name some of my kids* after you!
I'd be happier if you spent some time reading this:
http://phpsec.org
and then filtered your $order so that you KNOW it's valid:
switch($order){
case 'lastname':
case 'firstname':
case 'age':
case 'gender':
//pass through valid $order
break;
default:
error_log("Attempted hack of order: $order");
die("Invalid Sort Option");
break;
}
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Fri, August 10, 2007 10:00 am, Daniel Brown wrote:
> It's safe to ignore the `Undefined index` notices. That will just
> appear if a variable is referenced without first being instantiated or
> defined. No biggie, just put this at the head of your code:
>
> ini_set("error_reporting",E_ALL & ~E_NOTICE);
PLEASE DO NOT DO THIS!!!
Ignoring Undefined index notices will, sooner or later, waste your
time because you'll be trying to find a bug CAUSED by a typo that is
blatantly obvious if you pay attention -- but you'll waste days, maybe
weeks, trying to figure out what went wrong where.
Not to mention that there are a lot of OTHER E_NOTICE messages that
are more serious than "Undefined index"
Fixing your code is always a better option than ignoring error
messages about your code.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Fri, August 10, 2007 10:18 am, Daniel Brown wrote:
> So you're all going to tell me that you have E_NOTICE set to
> report on your sites?
Damn right I do!
That's the FIRST thing I change on any new development site, anywhere,
anytime.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Fri, August 10, 2007 10:43 am, Robert Cummings wrote:
> On Fri, 2007-08-10 at 11:40 -0400, Daniel Brown wrote:
>> On 8/10/07, Stut <[EMAIL PROTECTED]> wrote:
>> > If PHP thinks something might be wrong it will tell you. Why on
>> earth
>> > would you want to ignore it? You think you're smarter than PHP?
>> Really?
>>
>> Okay, Stut, let's not make Friday the official "Flame Dan Brown"
>> holiday this week. I vote that it should be later in the year.
>>
>> However, it should also be noted that my development is never
>> done
>> on a production server attached to the Internet, for one; and on my
>> development machine, E_NOTICE is always enabled. I just fail to see
>> the benefit in alerting visitors to the site that there may have
>> been
>> something overlooked at some point.
>
> Why would it alert visitors? You don't have display errors set to on
> for
> a production server do you? *EEEEEEEEEK*. Send it to a log file. The
> reason it's good to enable notices on a production server is because
> your visitors are like a horde of testers, they'll probably hit every
> nook and cranny of your code that you might have missed during
> testing.
There are a few billion Google pages that show that way too many web
developers have display_errors "ON".
I'd STILL say they're better off with E_NOTICE!
If they're not bright enough to set things up with errors going to log
files, they're DEFINITELY not bright enough to write code without
E_NOTICE turned on. :-)
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Fri, August 10, 2007 9:40 am, Martin Alterisio wrote:
> 2007/8/7, Richard Lynch <[EMAIL PROTECTED]>:
>>
>> On Fri, August 3, 2007 1:38 am, Ralph Kutschera wrote:
>> > I'm working on a project, where we distinguish between
>> "functions"
>> > and
>> > "actions" in design, although in PHP both are implemented as
>> > functions.
>> > Is there a chance that PHP can use the word "action" as
>> "function"?
>> >
>> > E.g.:
>> > public function doSomething() { .... }
>> > public action doSomethingElse() { ... }
>> >
>> > ... is actually the same but would help to see the design also in
>> the
>> > code.
>>
>> You might be able to do this with the Run-Kit extension...
>
>
> I was unaware that run-kit was able to do this kind of things, could
> you
> explain a little more about how would this extension could handle code
> with
> alien keywords.
I do not know exactly what the Run-Kit extension allows you to
re-define -- I only know that it lets you re-define a LOT of low-level
PHP stuff on the fly...
It may not be possible at all to introduce a new keyword with run-kit.
> It might be easier, however, to hack some kind of pre-processor that
>> would search for PCRE '\\s*action\\s*' and replace it with '
>> function
>> '
>>
>> You'd have to pre-process generate your actual PHP files that get
>> executed, but the source you use would just have the 'action' in it.
>
> Actually is not that simple. There are some considerations that should
> be
> taken into account, such as the loss of error information (file and
> line
> number where the error occurs) and exception information (stack trace
> does
> not point to the right place), and parsing correctly the code as to
> replace
> the action keyword where it actually applies. I made some
> experimentation
> with preprocessing php code with added keywords, that might help you
> if you
> wish to use such a solution:
> http://www.phpclasses.org/browse/package/4001.html
If one is simply mapping:
public action foo
into:
public function foo
then the line number isn't going to change, and, assuming you've been
reasonable about generating the real PHP code, the filename won't
change, just the directory.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Fri, August 10, 2007 8:36 am, Alain Roger wrote:
> I would like to know what is the best way and fastest to insert into
> PostgreSQL around 25.000 records (extracted from CSV file).
> Should i use the standard pg_exec($dbconn, "insert into..."); for each
> record ?
25.000 records is not THAT large, so try it and see if it's acceptable
performance.
If not, ask the PostgreSQL list/forum how to bulk load a CSV file, as
it's not a PHP question, it's a PostgreSQL question.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Fri, August 10, 2007 8:04 am, Alain Roger wrote:
> So now i know how to import the content of the CSV file to database,
> however, before to import to database i do a simple test.
> in fact, i display in my browser all content of my CSV file.
>
> unfortunately, not all characters are displayed correctly.
> in PHP page include <meta http-equiv="Content-Type"
> content="text/html;
> charset=UTF-8"> but it does not help to display the Slovak Characters
> which
> are correctly display in EXCEL when i open the CSV file with it.
> i tried to display a standar slovak web page in my browser and it
> works
> perfectly well.
>
> So where could be the problem ?
> thanks a lot,
If the webserver is sending a DIFFERENT charset in the headers, then
the browser may be using that charset instead.
Install FireFox and LiveHttpHeaders plugin to see the headers.
Or just slap:
header("Content-type: text/html; charset=UTF-8");
in the PHP.
MS IE in particular, you actually need BOTH the HTTP header and the
META tag if you really want it to for sure use that charset.
I've had pages where IE would ignore the header and use some other
charset, to disastrous effect, until I put in the META tag. :-(
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Fri, August 10, 2007 6:26 am, Nathan Wallis wrote:
> I have a windows application the performs a certain task that I need
> it to
> perform. I am in the process of developing my site and am really
> interested
> in the functionality of the site at the moment and haven't set about
> putting
> the details in place, so I am using the php function
>
> exec ("start ....... ");
>
> To run the process.
>
> It works.
>
> That is it works with just me using the site. I am wondering how this
> would
> effect performance if say 500 people were executing this php function
> around
> the same time and the processing overlapped.
Don't wonder.
Run ab (Apache Benchmark) and find out.
Or use valgrind/callgrind to find out.
Or use wget to find out.
Or use that whack-a-mole benchmark or SuperSmack or whatever it is.
> Is there anyway to make
> an
> executable run as a service, I am guessing at the terminology that I
> should
> use here, but I feel there would be a much more efficient way of
> performing
> this task.
Any program can be run as a "service" (Un*x: daemon)
Writing that program to do something useful and, more so, efficient,
is a bit challenging.
Here's a sample "talkback service" that just spits out whatever you
put in:
http://php.net/sockets
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Fri, August 10, 2007 6:24 am, Diana wrote:
> How do I install the ming library on windows??
> I copied the php_ming.dll that I had on another computer and enabled
> this
> line in php.ini extension=php_ming.dll
> but I still get that error Call to undefined function Ming_setScale()
There are several ways this could have gone wrong...
First is that you HAVE to have the exact right version of php_ming.dll
to match your PHP version, or it won't work. There should be
something in your webserver error logs from PHP/webserver startup
time-frame if this is the problem.
Next is the question of whether you are editing the right php.ini.
<?php phpinfo();?> will tell you.
Then is the question of whether your php_ming.dll is in the
extensions_directory set in that php.ini
Finally, there is the question of "permissions" to read/execute that
DLL. And in Windows, that's a bit of a pig's breakfast, as MS changed
it in every release, so you just have to right-click and poke around
until you find it.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Thu, August 9, 2007 8:15 pm, jekillen wrote:
>
> On Aug 8, 2007, at 9:34 PM, Richard Lynch wrote:
>
>> On Wed, August 8, 2007 7:52 pm, jekillen wrote:
>> Apache runs as the "User" setting in httpd.conf
>>
>> If that "User" can rwx the files, then PHP can rwx the files.
>>
>> If not, not.
>>
>> It's that simple.
>
> Thanks, so if I make the directory and file outside of the document
> root owner noboby with rwx for owner only, that will work?
The directory should be 'x' for the user to be able to use it.
The file itself has no need to be 'x' unless you plan to
http://php.net/exec it.
I cannot say if it will work if you use 'nobody' because I don't know
if you have "User nobody" in your httpd.conf or not.
If you do, it will.
If you don't, it won't.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Thu, August 9, 2007 7:55 pm, Daevid Vincent wrote:
> It has a size limit for one (maybe 1k chars?)
The limit has been increased with each version of the HTTP spec, and
implementors have always been encouraged to make the limit as high as
practical.
But they could not claim to be implementing the spec with a limit
SMALLER than the spec.
> and it is trivial for
> someone to modify.
I am always concerned when I see this statement in isolation with
respect to GET, as it might imply to the reader that POST is somehow
harder to modify.
Nothing could be further than the truth!
Any moron can use "Save as..." on a FORM page, then alter each
VALUE="..." to whatever they like, or add more INPUT tags, and then
open the form and click "submit" to send whatever POST data they like!
Similarly, it is equally trivial to open up your own cookie files (in
most browsers) and alter the contents.
> I generally use GET when I think it's a page "setup" the user may wish
> to bookmark (ie: page.php?orderby=name&descending=1&report=69 )
Definitely use GET if you want it bookmarkable.
> And POST for submitting data that I want to save. (ie: add a new user
> and all their glory).
Definitely use POST if it "changes" anything server-side.
Google for "HTTP idempotent" for more info on this.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Thu, August 9, 2007 6:45 pm, Ólafur Waage wrote:
> I know this isn't exactly a php related question but due to the
> quality of answers ive seen lately ill give this a shot. (yes yes im
> smoothing up the crowd before the question)
>
> I have a weblog system that i am creating, the trouble is that if a
> user links to an external image larger than 500pixels in width, it
> messes with the whole layout.
>
> I had found some regex code im using atm but its not good at matching
> the entire image tag. It seems to ignore properties after the src
> declaration and not match tags that have properties before the src
> declaration .
>
> preg_match_all("/\< *[img][^\>]*[src] *= *[\"\']{0,1}([^\"\'\ >]*)/i",
> $data, $matches);
> print_r($matches);
>
> This currently makes two arrays for me, the source location from all
> img tags and a large part of the tag itself. But not the entire tag.
>
> What i do is i match the img tag, find the src, get the image
> properties, and if the width is more than 500, i shrink it down and
> add width="X" and height="Y" properties to the image tag.
>
> How can i match an image tag correctly so it does not cause any issues
> with how the user adds the image.
Scaling the image in the browser is horrible for performance on the
client side...
The entire image still gets downloaded, and then the poor browser has
to scale this monster image down.
You may want to re-think your plan of attack...
You could, for example, force users to only use "registered" images,
and if they "register" an image large than 500, use http://php.net/gd
to scale it down.
As far as matching the image tag correctly goes, I'd have to suggest
that you try using a DOM to parse the HTML instead of regex.
That said, to get the WHOLE img tag in the same vein as you are using
now:
preg_match_all("/\< *[img][^\>]*[src] *= *[\"\']{0,1}([^\"\'\ >]*>)/i",
Note the addition of a closing ">" which will mark the end of the img
tag.
The [img] and [src] are kind of wonky, really, as they would also
match this bit of nonsense:
Sometimes <i src="foo">italics</i> could have bogus attributes.
YMMV
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Thu, August 9, 2007 11:50 am, Peter Pan wrote:
> I'm having an issue where throwing Exceptions are displaying a blank
> page
> even though the Exception is being caught in a try...catch statement.
> This
> is happening on our production server where warnings, errors,
> exceptions,
> etc. are not to be displayed to the user. The assumption is that even
> though an Exception is being thrown it should be caught rather than
> displaying a blank page. Is there a specific configuration variable
> that
> needs to be set in php.ini to allow warnings to not be displayed but
> Exceptions to still be caught? Or is this just a bug? Here is some
> code
> that replicates the issue:
It is also possible that you have some kind of syntax or fatal error
that doesn't allow PHP to continue...
Log errors rather than displaying them and check your webserver logs.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Thu, August 9, 2007 8:43 am, Martin Marques wrote:
> I have a script which I run from cron. I'm testing it directly from
> the
> console:
>
> /usr/bin/php -f /path/to/script.php
>
> The thing is:
>
> Script executes great, and everything it has to do gets done, but it
> throughs a segmentation fault at the end.
>
> Is there anyway to debug PHP CLI? I'm using php5 from debian etch:
You'll have to recompile with --enable-debug, but, yes, you can debug
PHP CLI.
Actually, it's even easier than debugging webserver SAPIs, really, as
you don't have to jump through the hoop of starting Apache with -X or
whatever to get the single instance in the foreground.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Thu, August 9, 2007 1:24 am, Phil Curry wrote:
$userValues = ' 1';
> line 102 echo ($userValues['afterDark']); // outputs 1
>
> line 103 if ( $userValues['afterDark'] == 0 ) { // passes
When using echo to display debug output ALWAYS surround the data with
some kind of delimiter:
echo "'", ($userValues['afterDark']), "'";
Or, use var_dump or print_r to have PHP do this for you.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Thu, August 9, 2007 8:23 am, Bastien Koert wrote:
> you could use ini_set at the top of the script to turn the magic
> quotes off...
No, you could not.
Lonnnnnnnnnngggggg before ini_set is called, PHP has *already* applied
the Magic Quotes "feature" and munged your data.
:-)
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
Hi,
FASTER CODE!
This question involves Coding Style, Readability, Write-ability and
Performance.
Some people use the . operator to concat an string to a variable, some
people use interpolation (embeding variable into string).
=====================
1st Method (Concatenation)
$str = 'My name is ' . $name;
2nd Method (Interpolation)
$str = "My name is $name";
=====================
I know that the 1st Method is much faster, according to
some benchmarks, which one of them is available
in the book "Advanced PHP Programming, page 470".
Could we consider the 1st Method as a "Best Practice", which offers
better Performance?
I know that the performance here is not very much, but is it
considerable in a high-traffic website?
Thank you in advanced for sharing your opinions,
Behzad
--- End Message ---
--- Begin Message ---
Hello,
Would anyone know or could point me to a link which might have a way for
php to read a word document?
The code will run on linux, so unfortunately cannot use COM.
I've done research on a third application tool which converts docs to html,
but have yet to find one which keeps proper formatting and doesn't need root
to install it.
Would appreicate any help. Thanks!!
Tom
--- End Message ---
--- Begin Message ---
hello friends,
i need your ehlp,actually i have a tablbe in my php page,the format is
something like this:
<table>
<tr name="t1" id="t1">
<td>monu</td><td>23</td>
</tr>
<tr name="t2" id="t2">
<td>monu</td><td>23</td>
</tr>
</table>
What i want,when i click a row like row "t1" the values of this particuler
row,i means to say the value in <td>s((monu,23) of this row is send to some
other page
similarly,when i click the row2 "t2" same function perform.pls help me its
urgent
--
View this message in context:
http://www.nabble.com/problem-in-%3Ctr%3E-tf4253021.html#a12104148
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---