php-general Digest 6 Apr 2010 02:00:57 -0000 Issue 6677

Topics (messages 303834 through 303843):

Re: convert a string into an array
        303834 by: Ashley Sheridan
        303843 by: Nilesh Govindarajan

problems with utf-8 conversion
        303835 by: sudhir patil
        303837 by: Nathan Rixham
        303838 by: sudhir patil

Re: Constructor usage
        303836 by: Peter Pei

Logical reason for strtotime('east') and strtotime('west') returning valid 
results?
        303839 by: Colin Guthrie
        303840 by: Kevin Kinsey

include path in httpd.conf
        303841 by: ad
        303842 by: Ashley Sheridan

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On Mon, 2010-04-05 at 05:53 +0100, Nathan Rixham wrote:

> you sure you're only smoking cigarettes?
> 
> has to be one of the most random replies to any php thread I've ever
> seen - awesome!
> 
> regards
> 
> Rene Veerman wrote:
> > yea i'm not the only one with those type of problems. sometimes times
> > slows down in my room so much not even my speakers sound normal
> > anymore; equipment that doesn't work (despite being crappy and known
> > by it's patterns of refusal to work; still EXTRA abnormal since about
> > a week or so)...
> > 
> > it sounds like the "who's reading my passwords with me while i type 'm
> > in... === 'is there anyone looking over my shoulder despite no living
> > humans even in my entire properly locked room (with strong walls)'....
> > 
> > the idea here is; take a break. work on a different project for a week
> > or so, but the best idea is; move around through the country side and
> > realize that your car will get gas at every gasstation... check your
> > atm cards, but not your online banking account status, just to buy a
> > pack of cigarettes with an atm card. and then, buy not 1 or 2 packs of
> > your favorite smokes(cigarettes in this case), but buy 10 packs with
> > that card, and make sure you have enough good old cash that you know
> > to be truely valid (coins are best) to get just "2 large packs of
> > cigarettes"..
> > 
> > things like that will give you the confidence you need to proceed on
> > your project i think..
> > 
> > the #1 rule i use (when you dont yet have any need for a #0 rule or a
> > #-1 rule (dont add those lightly and never on a whim or hope of being
> > saved from death in the next 5 minutes)) is: truely honest living
> > humans should never use the same type of lie construct in the same
> > type of situation for the second time within at least 1 to 3 weeks..
> > but hey, necessity may require you to break any rule...
> > 
> > rules? only guidelines are usefull ;) (pirates of the caribean #1 movie)
> > 
> > 
> > On Sat, Apr 3, 2010 at 1:05 AM, Andre Polykanine <an...@oire.org> wrote:
> >> Hello everyone,
> >>
> >> It's quite simple but I'm still stuck.
> >> What I need is the following: I have an array as a parameter of my
> >> custom function. However, I'd like to allow users to enter a string
> >> instead of an array. In this case (if the parameter is a string), it
> >> must be replaced with an array containing only one item - actually,
> >> that string.
> >> What I'm doing gives me (presumably) errors;
> >> function Send ($tonames, $toemails, $subject, $message) {
> >> ...
> >> if ((!is_array($tonames)) || (!is_array($toemails))) {
> >> $tonames[]=$tonames;
> >> $toemails[]=$toemails;
> >> }
> >>
> >> I can't give the new array a new name since I address it further in a
> >> loop as my function's parameter... hope you understand what I'm
> >> saying)
> >> Thanks!
> >>
> >> --
> >> With best regards from Ukraine,
> >> Andre
> >> Http://oire.org/ - The Fantasy blogs of Oire
> >> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> >> jabber.org
> >> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> >> Twitter: http://twitter.com/m_elensule
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> 
> 


Virus maybe?

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
On 04/05/10 19:39, Ashley Sheridan wrote:
On Mon, 2010-04-05 at 05:53 +0100, Nathan Rixham wrote:

you sure you're only smoking cigarettes?

has to be one of the most random replies to any php thread I've ever
seen - awesome!

regards

Rene Veerman wrote:
yea i'm not the only one with those type of problems. sometimes times
slows down in my room so much not even my speakers sound normal
anymore; equipment that doesn't work (despite being crappy and known
by it's patterns of refusal to work; still EXTRA abnormal since about
a week or so)...

it sounds like the "who's reading my passwords with me while i type 'm
in... === 'is there anyone looking over my shoulder despite no living
humans even in my entire properly locked room (with strong walls)'....

the idea here is; take a break. work on a different project for a week
or so, but the best idea is; move around through the country side and
realize that your car will get gas at every gasstation... check your
atm cards, but not your online banking account status, just to buy a
pack of cigarettes with an atm card. and then, buy not 1 or 2 packs of
your favorite smokes(cigarettes in this case), but buy 10 packs with
that card, and make sure you have enough good old cash that you know
to be truely valid (coins are best) to get just "2 large packs of
cigarettes"..

things like that will give you the confidence you need to proceed on
your project i think..

the #1 rule i use (when you dont yet have any need for a #0 rule or a
#-1 rule (dont add those lightly and never on a whim or hope of being
saved from death in the next 5 minutes)) is: truely honest living
humans should never use the same type of lie construct in the same
type of situation for the second time within at least 1 to 3 weeks..
but hey, necessity may require you to break any rule...

rules? only guidelines are usefull ;) (pirates of the caribean #1 movie)


On Sat, Apr 3, 2010 at 1:05 AM, Andre Polykanine<an...@oire.org>  wrote:
Hello everyone,

It's quite simple but I'm still stuck.
What I need is the following: I have an array as a parameter of my
custom function. However, I'd like to allow users to enter a string
instead of an array. In this case (if the parameter is a string), it
must be replaced with an array containing only one item - actually,
that string.
What I'm doing gives me (presumably) errors;
function Send ($tonames, $toemails, $subject, $message) {
...
if ((!is_array($tonames)) || (!is_array($toemails))) {
$tonames[]=$tonames;
$toemails[]=$toemails;
}

I can't give the new array a new name since I address it further in a
loop as my function's parameter... hope you understand what I'm
saying)
Thanks!

--
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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






Virus maybe?

Thanks,
Ash
http://www.ashleysheridan.co.uk




Now where does a virus come in here LOL ?

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

--- End Message ---
--- Begin Message ---
I have csv file with special characters, stored in default 
encoding(ISO-8859-1). I am convert file contents(string) to UTF-8using iconv. 
This doesn't convert special characters properly, shows broken on fronted. Page 
encoding & meta tag are properly set to utf-8.

Characters are shown properly on frontend if i save file encoding as 
utf-8(Using notepad). But iconv doesn't convert characters properly to UTF-8.

$value = iconv("Latin1","utf-8", $value);
having problem with below mentioned character

’ &#8217; &rsquo; right single quotation mark 
Any idea or suggestions to fix this would be helpful.

Thanks in advance,
Sudhir



      Your Mail works best with the New Yahoo Optimized IE8. Get it NOW! 
http://downloads.yahoo.com/in/internetexplorer/

--- End Message ---
--- Begin Message ---
sudhir patil wrote:
> I have csv file with special characters, stored in default 
> encoding(ISO-8859-1). I am convert file contents(string) to UTF-8using iconv. 
> This doesn't convert special characters properly, shows broken on fronted. 
> Page encoding & meta tag are properly set to utf-8.
> 
> Characters are shown properly on frontend if i save file encoding as 
> utf-8(Using notepad). But iconv doesn't convert characters properly to UTF-8.
> 
> $value = iconv("Latin1","utf-8", $value);
> having problem with below mentioned character
> 
> ’ &#8217; &rsquo; right single quotation mark 
> Any idea or suggestions to fix this would be helpful.
> 

1: try utf8_encode instead of iconv
2: check the headers being sent and that they include:
      "Content-Type: text/html; charset=UTF-8"
   as this normally overwrites and choice you make in html.

a good way of debugging this is to view the page in firefox and see menu
option "View -> Charecter Encoding -> xxxx"; the one presently selected
is generally the pages "real" encoding, and you can flick between
iso-8859-1 / utf-8 to see which one "fixes" your problem (then change
headers accordingly).

regards!

--- End Message ---
--- Begin Message ---
Thanks Nathan,

i tried with utf8_encode, that doesn't help. Yes both content-type & metatag 
are set to utf-8.

When i try utf-8 converted csv everything shows up properly. Issue is when i 
try to change encoding in php, special characters are messed up.

Character that i am facing problem with is

’ &#8217; &rsquo; right single quotation mark 
Thanks,
Sudhir



----- Original Message ----
From: Nathan Rixham <nrix...@gmail.com>
To: sudhir patil <sudhirpat...@yahoo.co.in>
Cc: php-gene...@lists.php.net
Sent: Mon, 5 April, 2010 8:19:54 PM
Subject: Re: problems with utf-8 conversion

sudhir patil wrote:
> I have csv file with special characters, stored in default 
> encoding(ISO-8859-1). I am convert file contents(string) to UTF-8using iconv. 
> This doesn't convert special characters properly, shows broken on fronted. 
> Page encoding & meta tag are properly set to utf-8.
> 
> Characters are shown properly on frontend if i save file encoding as 
> utf-8(Using notepad). But iconv doesn't convert characters properly to UTF-8.
> 
> $value = iconv("Latin1","utf-8", $value);
> having problem with below mentioned character
> 
> ’ ’ &rsquo; right single quotation mark 
> Any idea or suggestions to fix this would be helpful.
> 

1: try utf8_encode instead of iconv
2: check the headers being sent and that they include:
      "Content-Type: text/html; charset=UTF-8"
   as this normally overwrites and choice you make in html.

a good way of debugging this is to view the page in firefox and see menu
option "View -> Charecter Encoding -> xxxx"; the one presently selected
is generally the pages "real" encoding, and you can flick between
iso-8859-1 / utf-8 to see which one "fixes" your problem (then change
headers accordingly).

regards!



      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
http://in.yahoo.com/

--- End Message ---
--- Begin Message --- On Sun, 04 Apr 2010 17:46:19 -0600, Nathan Rixham <nrix...@gmail.com> wrote:

Larry Garfield wrote:
Hi folks.  Somewhat philosophical question here.

I have heard, although not confirmed, that the trend in the Java world in the past several years has been away from constructors. That is, rather than
this:

class Foo {
  public void Foo(Object a, Object b, Object c) {}
}

Foo f = new Foo(a, b, c);

The preference is now for this:

class Foo {
  public void setA(Object a) {}
  public void setB(Object b) {}
  public void setC(Object c) {}
}

Foo f = new Foo(a, b, c);
f.setA(a);
f.setB(b);
f.setC(c);

I suppose there is some logic there when working with factories, which you should be doing in general. However, I don't know if that makes the same
degree of sense in PHP, even though the OO models are quite similar.

So, I'll throw the question out. Who uses example 1 above vs. example 2 when
writing dependency-injection-based OOP?  Why?  What trade-offs have you
encountered, and was it worth it?


Other than theoretical reasons, one practical reason to have getters and setters is to make live easier for IDE's.

I never thought the above two are in conflict. Usually parameterized constructors are provided along with getters and setters - each is used for good reasons.
--- End Message ---
--- Begin Message ---
Hi,

Long time no speak!


As part of a quick filter I'm writing I try to interpret free text
strings as dates and textual data.

Sometimes, this goes wrong.

For example, I discovered that some words (or strings beginning with
those words) will return false positives:

e.g.:

[co...@jimmy Search (working)]$ php -r 'var_dump(strtotime("east"));'
int(1270514111)
[co...@jimmy Search (working)]$ php -r 'var_dump(strtotime("west"));'
int(1270488914)
[co...@jimmy Search (working)]$ php -r 'var_dump(strtotime("now"));'
int(1270488928)


The last one is valid! But the other two appear to do much the same thing...

Can anyone think of why this would be valid results before I report this
to the relevant authorities?

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


--- End Message ---
--- Begin Message ---
Colin Guthrie wrote:

For example, I discovered that some words (or strings beginning with
those words) will return false positives:

e.g.:

[co...@jimmy Search (working)]$ php -r 'var_dump(strtotime("east"));'
int(1270514111)
[co...@jimmy Search (working)]$ php -r 'var_dump(strtotime("west"));'
int(1270488914)
[co...@jimmy Search (working)]$ php -r 'var_dump(strtotime("now"));'
int(1270488928)


The last one is valid! But the other two appear to do much the same thing...

Can anyone think of why this would be valid results before I report this
to the relevant authorities?

Time Zones?

[11] Mon 05.Apr.2010 13:05:41 [ad...@archangel][~]
php -r "echo date('r',strtotime('now'));"
Mon, 05 Apr 2010 13:05:47 -0500

This is correct for my timezone (US Central Daylight Time).

[12] Mon 05.Apr.2010 13:05:47 [ad...@archangel][~]
php -r "echo date('r',strtotime('east'));"
Mon, 05 Apr 2010 14:05:51 -0500

This is correct for the time zone east of me, US Eastern Daylight Time.
However, the TZ offset is wrong for that TZ, it's still mine.

[13] Mon 05.Apr.2010 13:05:51
[kad...@archangel][~]
php -r "echo date('r',strtotime('west'));"
Mon, 05 Apr 2010 07:05:59 -0500

This is correct for American Samoa, but I've no idea why :-D

Nonetheless, I'm suspecting the programmers had something
like this in mind.  Isn't strtotime() based on some GNU utility?

Kevin Kinsey

--- End Message ---
--- Begin Message --- I have several virtual hosts on a dedicated server. In a IFmodule mod_php5c container in an httpd.conf include file I have the following to create a unique include path for each virtual host:

IfModule mod_php5.c>
php_value include_path ".:/home/virtual/site#/path/to/include"
php_admin_flag safe_mode off
</IfModule>

For one of the virtual hosts I've set up a dev site in a subdomain at dev.site#.com for development. In the root directory of this development site I have an .htacces file to create another unique include_path solely for this development subdomain.

php_value include_path  ".:/home/virtual/site#/path/to/dev/includes"

Also in the httpd.conf I have
    <Directory /home/virtual/site#/path/to/dev/root/>
        Allow from all
        AllowOverride All
        Order allow,deny
    </Directory>


The configuration is CentOS 5.3, Apache/2.2.3, PHP 5.1.6

I recently upgraded the OS from FC6 and the PHP version and I have not been able to get the include_path to change for this dev.subdomain. Even after restarting apache it PHPinfo tells me it is reading the server php.ini and the virtual host include path for the httpd.conf but it is ignoring the .htaccess file. I've even tried putting the php.ini with specific settings in the /home/virtual/site#/root directory to no avail.

Any ideas how to make this work or even a better set up?

Thanks in advance.


--- End Message ---
--- Begin Message ---
On Mon, 2010-04-05 at 19:40 -0400, ad wrote:

> I have several virtual hosts on a dedicated server. 
> In a IFmodule mod_php5c container in an httpd.conf  include file I have 
> the following to create a unique include path for each virtual host:
>  
> IfModule mod_php5.c>
> php_value include_path ".:/home/virtual/site#/path/to/include"
> php_admin_flag safe_mode off
> </IfModule>
>  
>  For one of the virtual hosts I've set up a dev site in a subdomain at 
>  dev.site#.com for development.
>  In the root directory of this development site I have an .htacces file 
>  to create another unique include_path solely for this development subdomain.
>  
>  php_value include_path  ".:/home/virtual/site#/path/to/dev/includes"
>  
>  Also in the httpd.conf I have
>      <Directory /home/virtual/site#/path/to/dev/root/>
>          Allow from all
>          AllowOverride All
>          Order allow,deny
>      </Directory>
>  
> 
>  The configuration is CentOS 5.3, Apache/2.2.3, PHP 5.1.6
>  
>  I recently upgraded the OS from FC6 and the PHP version and I have not 
>  been able to get the include_path to change for this dev.subdomain.  
>  Even after restarting apache it PHPinfo tells me it is reading the 
>  server php.ini and the virtual host include path for the httpd.conf but 
>  it is ignoring the .htaccess file. 
>  
>  I've even tried putting the php.ini with specific settings in the 
>  /home/virtual/site#/root directory to no avail.
>  
> Any ideas how to make this work or even a better set up?
>  
> Thanks in advance.
> 
> 


Are you able to determine if you can set any attributes with
the .htaccess file? Is it possible the .htaccess isn't being processed
at all?

I'm not sure why the virtual server settings are being ignored in the
httpd.conf file though. Have you checked any other .conf files in that
directory to see that they are not being set there? As far as I can
remember, the .conf files in that directory are executed in alphabetical
order, so a different file might be overriding your settings?

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---

Reply via email to