php-general Digest 17 Oct 2006 15:00:32 -0000 Issue 4406
Topics (messages 243232 through 243249):
_SERVER["HTTP_ACCEPT_LANGUAGE"] en-us
243232 by: John Taylor-Johnston
243233 by: Stut
Re: A no brainer...
243234 by: Roman Neuhauser
Re: Text from Excel csv file loaded into MySQL table
243235 by: Alan Milnes
How to recognise url in a block of text
243236 by: AYSERVE.NET
243238 by: AYSERVE.NET
243246 by: AYSERVE.NET
243247 by: Al
243248 by: Roman Neuhauser
Re: Nicht gelesen: [PHP] How to recognise url in a block of text
243237 by: AYSERVE.NET
looking for the developer of webcbq
243239 by: Gregory Machin
[PEAR] help pear quickform FormBuilder and checkboxes
243240 by: Marco Sottana
Re: Empfangsbestätigung (angezeigt) - Re: [PHP] How to recognise url in a block
of text
243241 by: AYSERVE.NET
Re: mktime()'s is_dst deprecated, but needed?
243242 by: Ivo F.A.C. Fokkema
random string
243243 by: Ross
243244 by: Ross
243245 by: Brice
pdflib - change text color mid-sentence
243249 by: j1c.wildit.net.au
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 ---
This is what http_accept_language gives me depending on which browser.
Depending on the visitor in my region, it will either be French or English.
_SERVER["HTTP_ACCEPT_LANGUAGE"] en-us,en;q=0.8,fr;q=0.5,fr-ca;q=0.3
_SERVER["HTTP_ACCEPT_LANGUAGE"] fr-ca,en-us;q=0.5
Is this a reasonable approach?
if(stristr($_SERVER["HTTP_HOST"],"fr"))
{ include("french.htm");}else{ include("english.htm");}
--- End Message ---
--- Begin Message ---
John Taylor-Johnston wrote:
This is what http_accept_language gives me depending on which browser.
Depending on the visitor in my region, it will either be French or
English.
_SERVER["HTTP_ACCEPT_LANGUAGE"] en-us,en;q=0.8,fr;q=0.5,fr-ca;q=0.3
_SERVER["HTTP_ACCEPT_LANGUAGE"] fr-ca,en-us;q=0.5
Is this a reasonable approach?
if(stristr($_SERVER["HTTP_HOST"],"fr"))
{ include("french.htm");}else{ include("english.htm");}
No it's not unless you want to ignore the users preferred language. The
order is important in that header - the first language is the preferred
language. So in the first example you should serve english.htm and
french.htm in the second. If you only have english and french, your best
bet is to do the following...
if (substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) == 'fr')
{
include('french.htm');
}
else
{
include('english.htm');
}
However, if you don't care about their preferred language, and want to
serve french.htm if they specify french at all in their language
preferences then what you've got will do that.
-Stut
--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2006-10-16 16:40:34 -0700:
>
> On Oct 16, 2006, at 6:20 PM, Roman Neuhauser wrote:
> > Modern filesystems cope well with large directories (plus it's
> > quite trivial to derive a directory hierarchy from the
> > filenames). Looking at the numbers produced by timing various
> > operations in a directory with exactly 100,000 files on sw RAID 1
> > (2 SATA disks) in my desktop i'd say this concern is completely
> > baseless.
>
> I knew that you could get PHP to use a directory structure for the
> session data files, but hearing that you can have 100k files in a
> single directory and not run into performance issues or problems is
> news to me. Which OS are you running?
FreeBSD. What do your tests show, on what OS/version/FS?
> >>It still uses files, but hopefully you don't hit them very often,
> >>especially when you're dealing with the same table records.
> >
> > A RDBMS is basically required to hit the disk with the data on
> > commit. One of the defining features of a RDBMS, Durability, says
> > that once you commit, the data is there no matter what. The
> > host OS may crash right after the commit has been acked, the data
> > must stay.
> >
> > You can turn on query caching in MySQL, but this will give you
> > *nothing* for purposes of session storage.
>
> Unless session storage is used to save time in retrieving data,
> right? I'm seeing your point on the writing, but what about reading?
>
> I think it would be kind of fun to run some actual tests.
Check out the query cache in the MySQL 5.0 manual, it clearly
says that any modification of a table (INSERT, UPDATE, ALTER
TABLE...) will invalidate all cache entries that use that table.
IOW, request from any visitor such that it starts or updates
a session invalidates query cache entries for all sessions.
Max cache hits for any single cache entry depend on the number
of requests a visitor can produce in sequence without updating the
session table, number of concurrent visitors, request frequency...
You're likely to max cache hits for any entry at 1, and all but
that one will be purged with 0 cache hits.
> >>Also, having raw data is always faster than having to process it
> >>before you can use it.
> >
> > I don't know what that means.
> > Bytes in files on disk are as raw
> > as it gets, you get one roundtrip process -> kernel -> process;
> > compare the communication protocol MySQL (or just any other DB)
> > uses where data is marshalled by the client, and unmarshalled by
> > the server, overhead of the database process(es) taking part in
> > the write...
> If you pull a record from the db, you can access the data. Or you
> can query the db, get the serialized data, de-serialize it, and now
> access the data.
That's not really filesystem vs. database, that's "to serialize or
not to serialize".
> I tested this previously and found the database to be faster.
> The references I gave supported this and listed additional benefits.
The article from Chris Shiflett contains zero quantifications of the
purported performance benefits.
> Things change tho, especially with technology. It seems like we
> should be able to test this pretty easily. I actually think it would
> be fun to do as well. Do you have a box we can test this on?
> Meanwhile, I'll check one of my boxes to see if I can use it. If
> anything, it'll be interesting to see if two systems report the same.
Yes I can provide a testbed, just post a testing methodology
proposal.
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
--- End Message ---
--- Begin Message ---
Richard Lynch wrote:
Ah...
Try something like this:
<?php
$file = fopen($filename, "r") or die("Could not open $filename");
while (!feof($file)){
$values = fgetcsv($file, 1000000);
array_walk($values, 'mysql_real_escape_string');
$values_sql = implode("', '", $values);
$query = "insert into invw2wfinal ";
$query .= "values('$values') ";
$result = mysql_query($query) or die(mysql_error());
}
?>
This assumes that no record (all 4 fields) with overhead is move than
1Mb in size -- Change the 1000000 if you have monster fields. And
count on needing to tweak my.cnf in that case anyway.
Looks a lot neater than my code! Is it version dependent? Running on
MySQL 4.1.21 and PHP 4.4.4 (not my Server so I can't control that)
generates the following warnings:-
"mysql_real_escape_string() expects parameter 2 to be resource, integer"
for each of the fields then when it goes to do the query it returns
"Column count doesn't match value count at row 1", if I echo the query
it reads "insert into invw2wtest values('Array')".
Thanks,
Alan
--- End Message ---
--- Begin Message ---
Please, I need help on how to to recognise url in a block of text being
retrieved from a database and present it as a link within that text.
I will appreciate any help.
Regards,
Bunmi
--- End Message ---
--- Begin Message ---
Hello,
Thanks Toby. The aim is to show the entire text taken from the database
(mysql) with the link within the text showing as a clickable link. Not
just to remove entirely.
Regards,
Bunmi
www.ayserve.net
www.budelak.com
Toby Osbourn wrote:
Hello,
I would suggest first of all splitting the block of text into single
words (I would assume you would use " " as the delimiter for this
assuming the text stored on the database is readable and not just
random words delimited by something else).
The use the eregi() function to see if any of the words contain either
www. or http://www.
If they do simply store them in an array or directly output them to
your page.
Regards
Toby
On 17/10/06, *AYSERVE.NET <http://AYSERVE.NET>* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Please, I need help on how to to recognise url in a block of text
being
retrieved from a database and present it as a link within that text.
I will appreciate any help.
Regards,
Bunmi
--
PHP General Mailing List ( http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
http://www.borninblood.co.uk
--- End Message ---
--- Begin Message ---
Thanks Alan. Retuen receipt disabled.
Who can help regarding my problem below. I will appreciate any assistance.
Regards,
Bunmi
www.ayserve.net., www.budelak.com
AYSERVE.NET wrote:
Hello,
Thanks Toby. The aim is to show the entire text taken from the
database (mysql) with the link within the text showing as a clickable
link. Not just to remove entirely.
Regards,
Bunmi
www.ayserve.net
www.budelak.com
Toby Osbourn wrote:
Hello,
I would suggest first of all splitting the block of text into single
words (I would assume you would use " " as the delimiter for this
assuming the text stored on the database is readable and not just
random words delimited by something else).
The use the eregi() function to see if any of the words contain
either www. or http://www.
If they do simply store them in an array or directly output them to
your page.
Regards
Toby
On 17/10/06, *AYSERVE.NET <http://AYSERVE.NET>* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Please, I need help on how to to recognise url in a block of text
being
retrieved from a database and present it as a link within that text.
I will appreciate any help.
Regards,
Bunmi
--
PHP General Mailing List ( http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
http://www.borninblood.co.uk
--- End Message ---
--- Begin Message ---
AYSERVE.NET wrote:
Please, I need help on how to to recognise url in a block of text being
retrieved from a database and present it as a link within that text.
I will appreciate any help.
Regards,
Bunmi
Show us some examples of URL substrings, with any variations, you want to
handle.
Most likely a regex function will do the job.
--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2006-10-17 15:13:50 +0100:
> Who can help regarding my problem below. I will appreciate any assistance.
> >>On 17/10/06, *AYSERVE.NET <http://AYSERVE.NET>* <[EMAIL PROTECTED]
> >><mailto:[EMAIL PROTECTED]>> wrote:
> >>
> >> Please, I need help on how to to recognise url in a block of text
> >> being retrieved from a database and present it as a link within
> >> that text.
Study [REs] and [URIs]. come back with specific questions if you hit
any problems.
[REs] http://www.php.net/manual/en/ref.pcre.php
[URIs] http://www.rfc-editor.org/rfc/rfc3986.txt
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
--- End Message ---
--- Begin Message ---
I did not see any text in your mail.
--- End Message ---
--- Begin Message ---
Hi
I'm looking for the developer of webcbq, I'm trying to get it to work on
fc5_64 but I have hit a wall there are some errors I can't see why the
variables are being populated ... and I think is was writtn in php 3 because
I have had to change alot on the syntax of the code to get it half way
working ...
here are the errors ....
*Notice*: Undefined variable: nuevoPadre in *
/var/www/html/webcbq/parents.php* on line *38*
*Notice*: Undefined variable: borrarRegla in *
/var/www/html/webcbq/parents.php* on line *53*
*Notice*: Undefined variable: modificarRegla in *
/var/www/html/webcbq/parents.php* on line *67*
*Notice*: Undefined variable: cambiarNombre in *
/var/www/html/webcbq/parents.php* on line *76*
*Notice*: Undefined variable: nuevaRegla in *
/var/www/html/webcbq/children.php* on line *38*
*Notice*: Undefined variable: borrarRegla in *
/var/www/html/webcbq/children.php* on line *51*
*Notice*: Undefined variable: modificarRegla in *
/var/www/html/webcbq/children.php* on line *63*
*Notice*: Undefined variable: cambiarNombre in *
/var/www/html/webcbq/children.php* on line *72*
Many thanks
--
Gregory Machin
[EMAIL PROTECTED]
www.linuxpro.co.za
--- End Message ---
--- Begin Message ---
> marco schrieb:
>> [code]
>> function preGenerateForm()
>> {
>> $this->fb_preDefElements['alive'] =
>> HTML_QuickForm::
>> createElement('advcheckbox','alive','Ali
>> ve',null,null,$this->alive);
>> }
>> [/code]
>> this code generate a only one checkbox..
>> i would like to generate a list of checkbox so i tryed [code]
>> function preGenerateForm(&$fb) { $box=array(); $box[]=&
>> HTML_QuickForm::createElement('advcheckbox','checkbox_intention',null,
>> '0',null,'0'); $box[]=&
>> HTML_QuickForm::createElement('advcheckbox','checkbox_intention',null,
>> '1',null,'1'); $box[]=&
>> HTML_QuickForm::createElement('advcheckbox','checkbox_intention',null,
>> '2',null,'2'); $this->fb_preDefElements['checkbox_intention'] =
>> $box; }
>> [/code]
>> but this don't save correctly.. field called "checkbox_intention" is a
>> varchar(200) and a i would like
>> to save as a list
>> so if i generate []labelA []labelB []labelC []labelD and i check A,C
>> i save in my
>> field "valueA,ValueC"
>> please help me.. i just send my request of help in forum.. but nobody
>> answer me
>
> Hi Marco,
>
> I read your code and your description, and I am still not sure I
> understand what you want to achieve. Please try to rephrase.
>
> If your problem is that the elements are not being properly grouped
> together, try to put the array of elements into a QuickForm group:
>
> $group =& new HTML_QuickForm_group('checkbox_intention', 'Intention',
> $box);
> $this->fb_preDefElements['checkbox_intention'] =& $group;
>
> See also:
> http://pear.php.net/manual/en/package.html.html-quickform.php#package.html.html-quickform.groups
>
> CU
> Markus
Hallo Marcus,
Thanks a lot for your availability,
i update my code so :
[code]
function preGenerateForm() {
$box=array();
$box[]=&
HTML_QuickForm::createElement('advcheckbox','checkbox_intention',null,
'0',null,'0');
$box[]=&
HTML_QuickForm::createElement('advcheckbox','checkbox_intention',null,
'1',null,'1');
$box[]=&
HTML_QuickForm::createElement('advcheckbox','checkbox_intention',null,
'2',null,'2');
$group =& new HTML_QuickForm_group('checkbox_intention', 'Intention',
$box);
$this->fb_preDefElements['checkbox_intention'] =& $group;
}
[/code]
but it makes an error
[error]
Notice: Array to string conversion in /usr/share/php5/PEAR/DB/DataObject.php
on line 1218
[/error]
[input]
Intention 0 1 2
[/input]
even if i check 0 and 1 and 2 in output
[output]
Intention [ ]0 [ ]1 [x]2
[/output]
Your suggest is near to the correct code version but as you've seen up,
there's also some problemes, please help me another one
--- End Message ---
--- Begin Message ---
Sorry,
I don't speak german.
Regards,
Bunmi
www.ayserve.net, www.budelak.com
[EMAIL PROTECTED] wrote:
Dies ist eine Empfangsbestätigung für eine Nachricht, die Sie an [EMAIL
PROTECTED] gesendet haben.
Hinweis: Diese Empfangsbestätigung sagt nur aus, dass die Nachricht am Computer
des Empfängers angezeigt wurde. Es gibt keine Garantie, dass der Empfänger die
Nachrichteninhalte gelesen oder verstanden hat.
------------------------------------------------------------------------
Reporting-UA: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.7)
Gecko/20060909 Thunderbird/1.5.0.7
Final-Recipient: rfc822;[EMAIL PROTECTED]
Original-Message-ID: <[EMAIL PROTECTED]>
Disposition: manual-action/MDN-sent-manually; displayed
------------------------------------------------------------------------
Return-path: <[EMAIL PROTECTED]>
Envelope-to: [EMAIL PROTECTED]
Delivery-date: Tue, 17 Oct 2006 10:17:06 +0200
Received: from lists.php.net ([216.92.131.4])
by mail.comtrance.net with esmtp (Exim 4.60)
(envelope-from <[EMAIL PROTECTED]>)
id 1GZk8H-0000sW-Ca
for [EMAIL PROTECTED]; Tue, 17 Oct 2006 10:17:06 +0200
X-Host-Fingerprint: 216.92.131.4 lists.php.net
Received: from [216.92.131.4] ([216.92.131.4:7357] helo=lists.php.net)
by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP
id 16/03-04054-A1194354 for <[EMAIL PROTECTED]>; Tue, 17 Oct 2006
04:15:23 -0400
Received: (qmail 8561 invoked by uid 1010); 17 Oct 2006 08:15:16 -0000
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: <mailto:[EMAIL PROTECTED]>
list-unsubscribe: <mailto:[EMAIL PROTECTED]>
list-post: <mailto:[email protected]>
Delivered-To: mailing list [email protected]
Received: (qmail 8553 invoked by uid 1010); 17 Oct 2006 08:15:15 -0000
Delivered-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; spf=permerror;
sender-id=unknown
Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; sender-id=unknown
Received-SPF: error (pb1.pair.com: domain ayserve.net from 70.84.85.66 cause
and error)
X-PHP-List-Original-Sender: [EMAIL PROTECTED]
X-Host-Fingerprint: 70.84.85.66 bmw.websitewelcome.com Linux 2.6
Message-ID: <[EMAIL PROTECTED]>
Disposition-Notification-To: "AYSERVE.NET" <[EMAIL PROTECTED]>
Date: Tue, 17 Oct 2006 09:13:53 +0100
From: "AYSERVE.NET" <[EMAIL PROTECTED]>
User-Agent: Thunderbird 1.5.0.7 (Windows/20060909)
MIME-Version: 1.0
To: Toby Osbourn <[EMAIL PROTECTED]>,
[email protected]
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
In-Reply-To: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-AntiAbuse: This header was added to track abuse, please include it with any
abuse report
X-AntiAbuse: Primary Hostname - bmw.websitewelcome.com
X-AntiAbuse: Original Domain - lists.php.net
X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12]
X-AntiAbuse: Sender Address Domain - ayserve.net
X-Source:
X-Source-Args:
X-Source-Dir:
Subject: Re: [PHP] How to recognise url in a block of text
--- End Message ---
--- Begin Message ---
On Sun, 15 Oct 2006 13:22:02 +0200, Zora wrote:
> Hi all,
>
> (first time I send an email here, so please be forgiving if something
> doesn't follow expected rules.)
>
> My web application allows users to enter time stamps (date and time)
> given as local times. The time stamp is to be stored as UTC into the
> data base.
>
> Since we have summer and winter times (dst) there's an hour in the
> autumn which exists twice in local time (it's 2:00 - 3:00 at the last
> sunday in october here). Only the user knows which of these two hour is
> intended to be stored into the data base, no program ever can decide
> that by itself. Thus, the user has to add a character to the supplied
> time stamp.
>
> E.g.
> "<last sunday in october>, 02:30 A" is summer time (e.g. GMT +02:00),
> "<last sunday in october>, 02:30 B" is winter time (e.g. GMT +01:00).
>
> My php function used the "is_dst" parameter of mktime() responding to
> the user given "A" or "B".
>
> How's that to solve in the future if "is_dst" doesn't exist any more?
> (For now, it still works but gives a log line everytime the function is
> called - E_STRICT is set).
>
> Thanks for your help,
>
> Zora
Hi Zora,
How is the data stored in the database? By the timestamp of your
local time? In that case, you could just increment the timestamp by one
hour if someone sets summertime. You can also feed the mktime the
incremented hour, cause it will calculate the time correctly even with
values that are out of range (such as 25 hours, 75 minutes, etc).
Hope this helps,
Ivo
--- End Message ---
--- Begin Message ---
Hi,
I want to randomise a string
$myrandom = rand("ross", "andrea");
echo $myrandom;
I know this doesn't work but is there a built in function to do this?
R.
--- End Message ---
--- Begin Message ---
Hi,
I want to randomise a string
$myrandom = rand("ross", "andrea");
echo $myrandom;
I know this doesn't work but is there a built in function to do this?
R.
--- End Message ---
--- Begin Message ---
On 10/17/06, Ross <[EMAIL PROTECTED]> wrote:
Hi,
I want to randomise a string
$myrandom = rand("ross", "andrea");
I suggest :
$array_name = array("rose","andrea");
$myrandom = array_rand($array_name);
echo $myrandom[0];
Brice.
I know this doesn't work but is there a built in function to do this?
R.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi,
I'm having some problems with a pdf file I'm compiling dynamically with
pdflib, and my searches for answers have come up empty, so I'm hoping
someone else out there has faced the same problem and came up with a
solution.
I want to change the text color of a word mid-sentence when outputting
text to a pdf file.
I've looked at pdf_show_boxed and pdf_show_xy, but I dont think either
would actually work the way I need, and I'm hoping their is an easier way
than trying to step through a long string word by word, then changing
color to display one word, and then trying to continue while making it all
look as though it flows. This, of course, would open up all kinds of
issues in terms of line feeds and the like
If anyone has any advice or could help in any way, please let me know
because this has been frustrating.
Thanks in advance,
Michael.
--- End Message ---