php-general Digest 12 Aug 2007 11:47:53 -0000 Issue 4957

Topics (messages 260713 through 260727):

Re: convert (windows-1250) to (utf-8)
        260713 by: Tijnema
        260716 by: brian
        260724 by: Alain Roger

Re: manual vs. meta refresh
        260714 by: Richard Lynch
        260718 by: Geoff Nicol
        260719 by: Robert Cummings
        260720 by: Geoff Nicol
        260721 by: Robert Cummings
        260722 by: Richard Lynch
        260723 by: Robert Cummings
        260727 by: Tijnema

Re: question about note on php.net
        260715 by: brian

Re: Running a server process
        260717 by: Nathan Wallis

PostgreSQL and select nextval
        260725 by: Alain Roger

What's is the needed configuration to enable SOAP?
        260726 by: Brice

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 8/11/07, Alain Roger <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I import a csv file (which includes characters from "windows-1250" charset)
> to postgreSQL database which is in UTF-8.
> How can i convert windows-1250 to utf-8 charset ?
>
> thanks a lot,
>
> --

I personally never worked with different charsets, but this might help you:
http://www.php.net/manual/en/function.mb-convert-encoding.php

Tijnema

-- 
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

--- End Message ---
--- Begin Message ---
Alain Roger wrote:
Hi,

I import a csv file (which includes characters from "windows-1250" charset)
to postgreSQL database which is in UTF-8.
How can i convert windows-1250 to utf-8 charset ?


Try the iconv functions:

http://www.php.net/manual/en/function.iconv.php

$out = iconv('ISO-8859-2', 'UTF-8', $in);

This page may be of use, as well:
http://en.wikipedia.org/wiki/Windows-1250

"Windows-1250 is *similar* to ISO-8859-2 ..."

brian

--- End Message ---
--- Begin Message ---
and why not :
$out = iconv('windows-1250','UTF-8', $in); ???

Alain

On 8/12/07, brian <[EMAIL PROTECTED]> wrote:
>
> Alain Roger wrote:
> > Hi,
> >
> > I import a csv file (which includes characters from "windows-1250"
> charset)
> > to postgreSQL database which is in UTF-8.
> > How can i convert windows-1250 to utf-8 charset ?
> >
>
> Try the iconv functions:
>
> http://www.php.net/manual/en/function.iconv.php
>
> $out = iconv('ISO-8859-2', 'UTF-8', $in);
>
> This page may be of use, as well:
> http://en.wikipedia.org/wiki/Windows-1250
>
> "Windows-1250 is *similar* to ISO-8859-2 ..."
>
> brian
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.3
Apache 2.2.4
PHP 5.2.3

--- End Message ---
--- Begin Message ---
On Fri, August 10, 2007 6:51 pm, Geoff Nicol wrote:
> That was my first thought as well but you will still have to use a
> session
> variable or cookie for the page following redirect to know it was a
> meta-refresh.

No.

For the page following, you can use some other GET parameter, such as
"was_meta_refresh_before"

So long as you are not using the same GET parameter, you can bounce
back and forth all day.

-- 
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 ---
And if they do a manual refresh on the page you re-directed to, the
"was_meta_refresh_before" flag will be set.
How will you tell it from a meta-refresh redirect?

You need to use a cookie or session id. Regardless, by reading the whole
thread and 'cheating off the other students' this has been pretty beat to
death.

On 8/11/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
>
> On Fri, August 10, 2007 6:51 pm, Geoff Nicol wrote:
> > That was my first thought as well but you will still have to use a
> > session
> > variable or cookie for the page following redirect to know it was a
> > meta-refresh.
>
> No.
>
> For the page following, you can use some other GET parameter, such as
> "was_meta_refresh_before"
>
> So long as you are not using the same GET parameter, you can bounce
> back and forth all day.
>
> --
> 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 Sat, 2007-08-11 at 18:26 -0700, Geoff Nicol wrote:
> And if they do a manual refresh on the page you re-directed to, the
> "was_meta_refresh_before" flag will be set.
> How will you tell it from a meta-refresh redirect?

I already explained this in previous email. Go read the history of this
thread.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
Rob,

What you suggested, which matches the theory of what I and others suggested,
would certainly work as an ID that changes is involved.

If you read the specific posting by Richard Lynch, which is what I was
replying to, you will note he suggest refreshing to a static
'was_meta_refresh_before' link which of course won't work as refreshing
manually at that point will be indistinguishable from a true meta-refresh
after the redirect has occurred.

Anyways; this thread seems done, there are several solid suggestions on how
to do it properly.

I just didn't want it to close on an incomplete solution, as people
apparently don't read the thread history ;)

-Geoff

On 8/11/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> On Sat, 2007-08-11 at 18:26 -0700, Geoff Nicol wrote:
> > And if they do a manual refresh on the page you re-directed to, the
> > "was_meta_refresh_before" flag will be set.
> > How will you tell it from a meta-refresh redirect?
>
> I already explained this in previous email. Go read the history of this
> thread.
>
> Cheers,
> Rob.
> --
> ...........................................................
> SwarmBuy.com - http://www.swarmbuy.com
>
>     Leveraging the buying power of the masses!
> ...........................................................
>

--- End Message ---
--- Begin Message ---
On Sat, 2007-08-11 at 19:36 -0700, Geoff Nicol wrote:
> Rob,
> 
> What you suggested, which matches the theory of what I and others
> suggested, would certainly work as an ID that changes is involved.
> 
> If you read the specific posting by Richard Lynch, which is what I was
> replying to, you will note he suggest refreshing to a static
> 'was_meta_refresh_before' link which of course won't work as
> refreshing manually at that point will be indistinguishable from a
> true meta-refresh after the redirect has occurred.
> 
> Anyways; this thread seems done, there are several solid suggestions
> on how to do it properly.
> 
> I just didn't want it to close on an incomplete solution, as people
> apparently don't read the thread history ;)

Ah ok, I see what you're saying. Yeah, Richard must have missed that you
can't just redirect to a URL and all is well.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
You don't do it there.

You do whatever it is you have to do in the URL before you re-direct.

Though I guess if you want different output on that page, you would
need to set something somewhere, be it session, database, or a cookie.

On Sat, August 11, 2007 8:25 pm, Geoff Nicol wrote:
> And if they do a manual refresh on the page you re-directed to, the
> "was_meta_refresh_before" flag will be set.
> How will you tell it from a meta-refresh redirect?
>
> You need to use a cookie or session id. Regardless, by reading the
> whole
> thread and 'cheating off the other students' this has been pretty beat
> to
> death.
>
> On 8/11/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
>>
>> On Fri, August 10, 2007 6:51 pm, Geoff Nicol wrote:
>> > That was my first thought as well but you will still have to use a
>> > session
>> > variable or cookie for the page following redirect to know it was
>> a
>> > meta-refresh.
>>
>> No.
>>
>> For the page following, you can use some other GET parameter, such
>> as
>> "was_meta_refresh_before"
>>
>> So long as you are not using the same GET parameter, you can bounce
>> back and forth all day.
>>
>> --
>> 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?
>>
>>
>


-- 
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 Sat, 2007-08-11 at 22:11 -0500, Richard Lynch wrote:
> You don't do it there.
> 
> You do whatever it is you have to do in the URL before you re-direct.
> 
> Though I guess if you want different output on that page, you would
> need to set something somewhere, be it session, database, or a cookie.

I think you're missing the point Richard. Yes you can detect the meta
redirect or manual refresh using your method. But only the first can be
detected because when the page is served up to the browser again either
the special meta redirect URL is active, non special normal URL is
active, or a super special I'm redirecting but don't count me URL is
active. Now what happens when the user does a manual refresh again? It's
not about output, it's about detecting subsequent refreshes and
determining again the source of the refresh. You must have some kind of
session tracking system in place, be it a regular session or a database
query that can check if an ID was already detected that indicates to
discount the page load from any statistics.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
On 8/12/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Sat, 2007-08-11 at 22:11 -0500, Richard Lynch wrote:
> > You don't do it there.
> >
> > You do whatever it is you have to do in the URL before you re-direct.
> >
> > Though I guess if you want different output on that page, you would
> > need to set something somewhere, be it session, database, or a cookie.
>
> I think you're missing the point Richard. Yes you can detect the meta
> redirect or manual refresh using your method. But only the first can be
> detected because when the page is served up to the browser again either
> the special meta redirect URL is active, non special normal URL is
> active, or a super special I'm redirecting but don't count me URL is
> active. Now what happens when the user does a manual refresh again? It's
> not about output, it's about detecting subsequent refreshes and
> determining again the source of the refresh. You must have some kind of
> session tracking system in place, be it a regular session or a database
> query that can check if an ID was already detected that indicates to
> discount the page load from any statistics.
>
> Cheers,
> Rob.

I think you Rob missed a part of Richard's first reply:
"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."

Tijnema
-- 
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

--- End Message ---
--- Begin Message ---
Michael Cooper wrote:
Hello, I have a question--is the note from equazcion here correct? It
is left unchallenged on the page but I can't see how it is correct since I am under the impression that the environment is refreshed each page load and the function or method definitions (including those for session_set_save_handler) would need to be re-established each page, not each session. I am having tremendous difficulty debugging some code I wrote and eliminating my uncertainty regarding this point would be greatly helpful. Any advice would be appreciated. Thanks!

Because i'm already procrastinating ...

google "site:php.net equazcion"

http://www.php.net/session_set_save_handler

wherein:

equazcion
10-Mar-2007 02:44
I know this might be obvious, but session_set_save_handler() should
only be called once per session, or else your saved data will keep
getting reset.

If your script doesn't have a predictable start page that will only
be called only once per session, place the session_set_save_handler
statement in an include file, and call it via require_once().

I doubt that this is correct. The save handler that is being set is not, in itself, a part of the session, but a function that is to be used to act upon the session. That is, there isn't anything inherent to the session in the function. Thus, it wouldn't be saved as *a part of* the session. It's just a handler. It's not as if the function, itself, were a container for the session vars.

My $.02

--- End Message ---
--- Begin Message ---
Thanks for the info guys.

Sockets sound interesting.  Will check the out more.

I have played with sockets and flash before, but I will read up more.

>From what you are saying I gather that 500 people with an open socket to the
program is a lot different to 500 people spawning their own process.

Thanks again,

Nathan


-----Original Message-----
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 11, 2007 10:10 AM
To: Nathan Wallis
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Running a server process

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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Hi,

I'm getting an error message when i run the following SQL request :
$sql = "INSERT INTO tmp_importedxls (rec_id, publisher) VALUES (SELECT
nextval('tmp_importedxls_rec_id_seq'),'$pb')";

Error in SQL query: ERROR: syntax error at or near "SELECT" LINE 2: VALUES
(SELECT nextval('tmp_importedxls_rec_id_seq'),' ^

I have the feeling that we can not use the select nextval(...) SQL request
in an INSERT INTO one under PHP.
Is it true?

thanks
-- 
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.3
Apache 2.2.4
PHP 5.2.3

--- End Message ---
--- Begin Message ---
Hello all,

I have a little problem with Soap. I programmed a script which works
well on all server except one. I had an 'HTTP Error : Couldn't open
socket connection to server' Too bad for me it's the main one.

I wonder if  there is a configuration problem? I just saw that socket
is disabled on the main server. Is soap extension needs to enable
socket? Google and php documentation said nothing about that.

Thanks in advance for your help.

Brice Favre

--- End Message ---

Reply via email to