Re[2]: [PHP] fread() behaviour

2008-11-28 Thread ANR Daemon
Greetings, Jochem Maas.
In reply to Your message dated Thursday, November 20, 2008, 22:11:09,

> good stuff from Stut & Craige ... I just wondered, Im pretty sure that the
> usleep(1000) is completely superfluous. fread() will read to the buffer length
> or EOF regardless of how slow the stream trickles in (obviously it may timeout
> if nothing trickles in for ages but that's a different issue and not solved
> with a usleep() AFAICT).

Keep in mind that PHP has configuration limit for maximum execution time of
single command.
If you sure know that your socket could be slow, you'd better use functions
designed especially to work with asyncronous I/O.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



[PHP] Re[2]: How to Execute Multiple SQL Updates Using PHP

2008-11-28 Thread ANR Daemon
Greetings, Nathan Rixham.
In reply to Your message dated Wednesday, November 19, 2008, 23:53:46,

> just my two pennies, unless you've got a good reason to do it all in one
> or some decent performance gain by doign so, leave it out and have the 
> front end functionality as per the clients requirements.

Well, as last resort, there's a transactions exists.
Especially for these times where you DO need to insert/update more than one
row at once, without even smalest possibility of intervention from other
clients.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[4]: [PHP] It's Sunday, and I'm bored...

2008-11-24 Thread ANR Daemon
Greetings, "Richard Heyes".
In reply to Your message dated Tuesday, November 18, 2008, 18:34:27,

> In looking at the manual regarding tagging, it seems an awful chore
> compared to CVS.

It only seems.
In fact, the "copy" command only creating a reference to the specific
revision. So, nothing, at all, being duplicated in reality.
I too was disoriented a bit in the same place, but, to make it clear, SVN
based mostly on structure organisation, than on added features.
In this situation, CVS's "tagging" is a feature, while SVN "tagging" by
referencing your revision in /tags/ branch is a way to organise your work.

> Is this the generally held belief or do I need to go
> back and re-read?

Just read further while you keeping confusing moments in mind.
At some point, they will become clearer... eventually.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[2]: [PHP] It's Sunday, and I'm bored...

2008-11-18 Thread ANR Daemon
Greetings, Govinda.
In reply to Your message dated Monday, November 10, 2008, 3:42:40,

>> Subversion, or svn for short. Helps you maintain code bases. Far
>> better than regular backups (though by no means a replacement).

> I looked it over briefly and it looks smart for serious collaborated  
> efforts..  but i ask - is anyone finding it makes sense for one-man  
> shows?

I'd join the line... "hell yes" is the best possible description. Being
emotional, it's perfectly entitles the time and nerves spent to redo all your
work if you spotted anything wrong at some stage.

> (For the time to get up to speed with this maybe I could just pay more  
> attention to making/naming my own backups?)

Backups has nothing of the usability that CVS/SVN offers.
It's, literally, a time machine.
I seriously recommend the http://svnbook.red-bean.com/
When I've been told that we're moving to SVN and I though that I'd better
start reading sooner, I felt Subversion website almost directly to that book,
and it just eliminated all my quesions, even possible future ones.

>>> It's nice to have at least loose communities like this list so we
>>> solo
>>> freelancers don't think we're simply mad.
>>
>> You are... :-)
> Well yes, but I meant without company..  See when we are in a herd,  
> then even if we're all mad, then somehow it seems alright.  ;-)  We  
> even have professional looking tools to track which version of madness!

hehe :) /agree


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



[PHP] Re: two mysql installations php_mysql.dll extension and libmysql.dll question

2008-11-10 Thread ANR Daemon
Greetings, Daniel Kolbo.
In reply to Your message dated Thursday, November 6, 2008, 1:19:50,

> This question may be more for the MySQL  community.  If so, my
> apologies, please let me know.

> I am using php v 5.2.6.

> I have two versions of MySQL running on my server (windows xp home sp3).

> MySQL v6 is running on localhost:3306
> MySQL v5.0.41 is running on localhost:3307

> I have two installations of phpmyadmin (latest version 3.0.1.1) to 
> manage both of these (i am running a local apache 2.2 server on the same 
> machine on port 8080).  Let's call these two installations phpmy5admin 
> and phpmy6admin.

> I am able to login and create tables on both versions of mysql.  Thus, i 
> suspect the installation of both of these is okay.

> When i view both phpmyadmin installations it gives me the correct 
> corresponding mysql version number on the homepage.

> However, the phpmy6admin gives me a warning saying:
> "Your PHP MySQL library version 5.0.51a differs from your MySQL server 
> version 6.0.7. This may cause unpredictable behavior."

> When i copy the libmysql.dll from the mysql 6 installation directory 
> into the php directory i get a pop up saying apache must shutdown when 
> any php script invokes the mysql module.

> my windows path variables have
> C:\php;C:\Program Files\MySQL
> in that order.

> my mysql installations are at
> C:\Program Files\MySQL\MySQL Server 5.0
> C:\Program Files\MySQL\MySQL Server 6.0

Look, your %PATH% points to nowhere. There's no libMySQL.dll in C:\Program 
Files\MySQL
It should be
C:\php;C:\Program Files\MySQL\MySQL Server 6.0\bin
at least.

> I do suspect the c:\php is being read first, as when i change the 
> libmysql.dll in this folder, i experience different results.

You're right, but it is poor idea to install PHP in C:/php I think :)

> I do not have any libmysql.dll files in my system path.

that's because your %PATH% is wrong. See above.

> My question are:
> 1) Is there a libmysql.dll for version 6?  If so, where do i get it?

Above, look above. I told ya, it's in MySQL /bin directory.

> 2) Does libmysql.dll for version 6 only function properly with an 
> updated php_mysql.dll extension?  If so, where do i get this updated 
> extension?

No, it should work well with any server, even 3.23

> 3) If I get the correct library for version 6 working, will i then have 
> issues running version 5?

Shouldn't have any issues, aside from potential bugs of course.

> 4) Perhaps I can ignore the warning? (i don't like this option ;)

You'd better find it's root and eliminate it.

On a side note (not much of a side), I highly recommend to download Mysql
Connector/PHP from MySQL site.
php_mysql.dll/libmysql.dll shipped with PHP has known bug, which still not
fixed in 5.2.6 for me.

P.S.
Other way of doing this (solving DLL-hell issue, I mean), is what I'm using
all the way since... let me guess... 1998 may be.

This file being included into Apache httpd.conf:

> LoadFile C:/usr/sbin/php-5.2.2-Win32/libeay32.dll
> LoadFile C:/usr/sbin/php-5.2.2-Win32/ssleay32.dll
>
> LoadFile C:/usr/sbin/php-5.2.2-Win32/libmysql.dll
>
> LoadFile C:/usr/sbin/php-5.2.2-Win32/php5ts.dll
>
> LoadModule php5_module "C:/usr/sbin/php-5.2.2-Win32/php5apache2_2_filter.dll"
>
> 
>   php_admin_value extension_dir "C:/usr/sbin/php-5.2.2-Win32/ext"
>   PHPIniDir "C:/usr/sbin/php-5.2.2-Win32"
> 

That said, I always know which library i've loaded, and if something weird
occur, I know who to blame about that.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[2]: [PHP] wget --spider and ignore_user_abort(TRUE)

2008-11-10 Thread ANR Daemon
Greetings, Martino Dell'Ambrogio.
In reply to Your message dated Tuesday, November 4, 2008, 15:11:45,

> - if I use wget --spider (HEAD request) the script exits just after the
> first output, all the functions below never get executed

It is intended behaviour.
Apache sending headers at the moment first body byte sent, and since it is
HEAD request, Apache shut down the script in case of request completion
(HEADers sent).


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[2]: [PHP] Reg Ex

2008-11-10 Thread ANR Daemon
Greetings, "Diogo Neves".
In reply to Your message dated Friday, October 31, 2008, 20:08:25,

> It depends on what he really want, but pathinfo really is a better option

> My test worked perfectly on files with no extension and without name...

File always have name. Extension is a part of it.

>  var_dump( pathinfo( '.htaccess' ));
> var_dump( pathinfo( 'htaccess' ));
> die( );
> ?>



-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[2]: [PHP] Reg Ex

2008-11-10 Thread ANR Daemon
Greetings, "Boyd, Todd M.".
In reply to Your message dated Friday, October 31, 2008, 17:51:59,

> Someone suggested pathinfo() already... and brought up the issues of
> extensions < 3 chars and files with no "basename" (i.e., ".htaccess")...

> Checked out www.php.net/pathinfo, and ran a demo on my own machine. I
> can't test the .htaccess problem, since I'm running Windows (and M$
> won't let you have files that start with "."), but I tested it with
> "a.b.c.d" and the extension was returned as "d". Basename was "a.b.c".

M$ permissions has nothing to do with your problem.
Notepad - File - Save as - .htaccess, File type: All files

Here you got it.
But it's easier to use more straight tools than stupid explorer.

> Sounds like it will do exactly what you are trying to accomplish. For
> what it's worth, if I were to do it with a regular expression, I would
> use:

> $filename = "us.123.kyle.20081029.zip";
> preg_match('/(.*)\..*$/', $filename, $match);

I should correct you to
#^((.+)(\.[^\.]+)?)$#
Results will be
 1 => Filename
 2 => Basename
 3 => Extension


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[2]: [PHP] Invalid byte sequence for encoding UTF-8

2008-11-06 Thread ANR Daemon
Greetings, paragasu.
In reply to Your message dated Friday, October 31, 2008, 12:39:14,

>>> i am using php with postgresql. when i submit post query to the
>>> server. i have the pg_exec error
>>> 
>>> Warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid
>>> byte sequence for encoding "UTF8": 0x93 HINT: This error can also
>>> happen if the byte sequence does not match the encoding expected by
>>> the server, which is controlled by "client_encoding".
>>> 
>>> is there any function to prevent this type of error. something i can
>>> apply to any POST query
>>> before i submit to pg_query() ?
>>
>> You probably need to tell us which functions you are using to create/modify
>> the UTF8 string that you are sending as data. I does sound like a conversion
>> TO UTF8 is not being carried out somewhere. PHP5 requires that only
>> multi-byte
>> string functions are used to handle UTF8 data
>>
> i do not use any function other that addslashes on the $_POST

Here is what you're doing wrong.
I'm 99% sure you have applied it in wrong place and have your data sent out
already destroyed by addslashes.

Only 2 places where any escaping should occur:
1. before writing data to storage, use appropriate storage-dependent escaping
routine.
2. before sending data to client. Use appropriate encoding routine, such as
htmlentites()

Don't use add*slashes and any kind of it, including magic_quotes*, unless you
surely know what you're doing and why. 

And please, don't top-post.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



[PHP] Re: Printing JPEG

2008-10-30 Thread ANR Daemon
Greetings, "Kyle Terry".
In reply to Your message dated Thursday, October 23, 2008, 15:32:07,

> I'm stuck... What is the best way to send a jpg to a printer with PHP? Looks
> like it is only working with png and bmp...

Example?


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



[PHP] Re[2]: Problem changing file encoding

2008-10-29 Thread ANR Daemon
Greetings, Nathan Rixham.
In reply to Your message dated Wednesday, October 22, 2008, 20:54:22,

> made this a while back.. might help :)
> http://programphp.com/iconv.phps

Sorta... would be wise to have results of this detector cached in some way to
reduce startup times.
But it's nice, very nice piece of code.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



[PHP] Re: PHP Dev Facts

2008-10-16 Thread ANR Daemon
Greetings, Nathan Rixham.
In reply to Your message dated Friday, October 17, 2008, 3:14:18,

> *Procedural or OOP?*

whatever feels applicable.

> *Dev OS*

Win2k, Server 2003

> *Dev PHP Version*

5.2.6

> *Live Server OS*

Whatever.

> *Live Server PHP Version*
5.1.6, 5.2.4, 5.2.6


> *Which HTTP Server Software (+version)?*
Apache all around, 2.2

> *IDE / Dev Environment*
FAR Manager, it's all. farmanager.com

> *Preferred Framework(s)?*
My own, PEAR, Smarty

> *Do you Unit Test?*
If only someone explained it to me... I'd like to do.
But I do use some testing schemes. Don't know how they can be classified.

> *Most Used Internal PHP Class*
Exception?

> *Preferred OS CMS*


> *Anything else you use frequently in you're PHP'ing that's worth 
> mentioning:*
Can't live without cygwin. cygwin.com
I should also mention Colorer project, without which it all would be much more
complicated. http://colorer.sf.net/ (Yeah, it is very much complicated itself,
I know...)


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



[PHP] Re: Variable Variables and Super Global Arrays

2008-10-11 Thread ANR Daemon
Greetings, "daniel danon".
In reply to Your message dated Saturday, October 11, 2008, 2:50:34,

> By php.net manual, "Please note that variable variables cannot be used with
> PHP's Superglobal arrays  within functions or class methods". Is there any
> way to override this problem? Just the not nice eval("return $variable");?

> and in simple words - is there any way to make the following code work:

> $varname = "\$_SERVER['REMOTE_ADDR']";
> $varvalue = $$varname;


First of all, why you need it to work?
Explain real case please.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[2]: [PHP] strtotime problem

2008-10-10 Thread ANR Daemon
Greetings, Thodoris.
In reply to Your message dated Wednesday, October 8, 2008, 16:35:40,


>> From your function name I assume you want to use it in MySQL. In that
>> case, why don't you have MySQL do all the magic for you?
>> eg. INSERT INTO table (col) VALUES (FROM_UNIXTIME($timestamp));
>> (using FROM_UNIXTIME($timestamp) will give you the date-time in "mysql 
>> format" (-MM-DD HH:MM:SS) or any other format (if given via the 
>> 2nd parameter)
>>

> Well I have made these two functions to solve this:

> function dateMysqlToWeb($mysqldate){

> $format = 'd/m/Y';
> $timestamp = strtotime($mysqldate);

> return date($format,$timestamp);

> }

Use SQL DATE_FORMAT instead.
Remember: Request the data you need, not the data stored.

> function dateWebToMysql($webdate){
   
> $format = 'Y-m-d';
> $date_part = explode("/",$webdate);
> $timestamp = mktime(0,0,0,$date_part[1],$date_part[0],$date_part[2]);

> return date($format,$timestamp);

> }

> My basic problem was how to make the user input from a form into a 
> timestamp not how to use it with mysql. Since the format used here is 
> dd/mm/ I can't use the strtotime directly bacause as far as I know 
> from the documentation I don't think that it changes with the timezone 
> (as Stut suggested). So since strtotime understands all these variations 
> like:

> mm/dd/, m/d/yy, mm/d/yy etc

Very basic solution: use 3 editboxes and short javascript sample to confirm
input.
Like
[__]/[__]/[]
...
And fill 'timeconfirm' in onchange/onkeypress event, using verbal format like
Tue, Jan 03, 2008

That way, user actually see which date s/he have entered and you may use it
straightforward.

> I can't use this flexible behavior to get the input if it is not in the 
> American format (and correct me if I am wrong). If I explode I will have 
> to use the fixed format dd/mm/ and I can't use other input formats 
> beside this so I lose this flexible approach.

> It does work for me now but I was wondering if there was a way to avoid
> this.

Not as I know. So, you should either force user to use specific format
(military -MM-DD HH:MM:SS for example) or leave user no chance to enter
wrong data.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[2]: [PHP] Re[2]: The 'at' sign (@) variable prefix

2008-10-10 Thread ANR Daemon
Greetings, Maciek Sokolewicz.
In reply to Your message dated Thursday, October 9, 2008, 20:25:42,

>>>>> If you're using it to deal with possible empty input data, you'd better 
>>>>> do it
>>>>> explicitly enstead.
>>>>>
>>>>> Something like this:
>>>>>
>>>>>  if(!array_key_exists('from_year', $_POST)
>>>>>|| !array_key_exists('from_month', $_POST)
>>>>>|| !array_key_exists('from_day', $_POST)
>>>>>)
>>>>>  {
>>>>>throw new Exception('No start date given', 100);
>>>>>  }
>>>> *cough*
>>>>
>>>> filter_input does this elegantly too ;) as does an isset() on the array 
>>>> index
>>>>
>>> I'm a fan of the isset() method for POST and GET variables, as usually
>>> I'll still want to put something in the variables I'm assigning those
>>> values to, rather than the NULL which gets returned by the @ prefix.
>> 
>> Well, filter_input does not exist in 5.1.6, and iset() does not work 
>> correctly
>> with array keys in general.
> bullshit

Like to see how people calling me... somewhat... when I'm right :)
That just making my day every now and then.

>> > 
>> $a = array ('test' => 1, 'hello' => NULL);
>> 
>> var_dump(isset($a['test']));// TRUE
>> var_dump(isset($a['foo'])); // FALSE
>> var_dump(isset($a['hello']));   // FALSE
>> 
>> // The key 'hello' equals NULL so is considered unset
>> // If you want to check for NULL key values then try: 
>> var_dump(array_key_exists('hello', $a)); // TRUE
>> 
>> ?>
>> 
>> (c) http://php.net/isset

> The only case in which isset() returns false even though it IS set is 
> when the value is null. That is the _only_ difference in functionality 
> between isset and array_key_exists. Let's just ignore the fact that 
> isset is about a dozen times faster than array_key_exists.
> But tell me, how often do you get a NULL value from $_GET or $_POST ? 
> Because let me tell you, I don't see such a value...ever... And even if 
> I did see it, it would not be a VALID value.

That's not an argument in the matter of code readability, portability and
understandability.
"Better be safe than sorry" (c) folk

When you want to check if array key has meaningful value or not, disregarding
it's content and/or presence, use isset(). But that have never happened to me
in, like, 10 years. And knowing if key is present critical for foreach() cycle.

On the other side, for every my project bigger than single page I always use
purifying function to cleanup/normalize _GET/_POST/_REQUEST.
And for every project I always have list of used user variables and it's
expected types/values. If variable have been passed, required, but contains
unreliable value, I could change it to NULL (which is, as you mentioned,
cannot be set by user) to indicate that it was passed to script AND purged
in validation process. (Have never used it but having such ability is for good)


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[2]: [PHP] Re[2]: The 'at' sign (@) variable prefix

2008-10-09 Thread ANR Daemon
Greetings, Ashley Sheridan.
In reply to Your message dated Wednesday, October 8, 2008, 23:08:37,

>> > If you're using it to deal with possible empty input data, you'd better do 
>> > it
>> > explicitly enstead.
>> >
>> > Something like this:
>> >
>> >  if(!array_key_exists('from_year', $_POST)
>> >|| !array_key_exists('from_month', $_POST)
>> >|| !array_key_exists('from_day', $_POST)
>> >)
>> >  {
>> >throw new Exception('No start date given', 100);
>> >  }
>> 
>> *cough*
>> 
>> filter_input does this elegantly too ;) as does an isset() on the array index
>> 
> I'm a fan of the isset() method for POST and GET variables, as usually
> I'll still want to put something in the variables I'm assigning those
> values to, rather than the NULL which gets returned by the @ prefix.

Well, filter_input does not exist in 5.1.6, and iset() does not work correctly
with array keys in general.

 1, 'hello' => NULL);

var_dump(isset($a['test']));// TRUE
var_dump(isset($a['foo'])); // FALSE
var_dump(isset($a['hello']));   // FALSE

// The key 'hello' equals NULL so is considered unset
// If you want to check for NULL key values then try: 
var_dump(array_key_exists('hello', $a)); // TRUE

?>

(c) http://php.net/isset


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



[PHP] Re[2]: The 'at' sign (@) variable prefix

2008-10-08 Thread ANR Daemon
Greetings, ""Crash" Dummy".
In reply to Your message dated Tuesday, October 7, 2008, 15:54:14,

>>> mike schreef:

>>>> Mon, Oct 6, 2008 at 12:17 PM, Daniel Brown <[EMAIL PROTECTED]
>>>> wrote:

>>>>>> I will get an error, but if I prefix the value with '@',

>>>>>> [EMAIL PROTECTED]"q"];

>>>>> The @ is an error control operator, used to buffer the output
>>>>> and store it in a variable - $php_errormsg.   It's better to
>>>>> write clean, secure code, of course but sometimes error
>>>>> control is a good thing, too.  why not just use:
>>>> $query = isset($_GET['q']) ? $_GET['q'] : '';

>>>> that way it's always set.

>>>> or even better (what I recommend):
>>>> $query = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);

>>>> and get an empty string or a sanitized string, depending on if
>>>> something exists.

>>> Mike's ways are both better than suppressing the error not only
>>> because error suppression in general sucks but because it's
>>> actually less performant to trigger this kind of error.

>> I second that. The @ symbol actually does this:

>> @action();

>> Becomes:

>> $old = ini_set("error_reporting", 0);
>> action();
>> ini_set("error_reporting", $old);

>> So, if you put that a hundred times all over your code, the errors
>> might be suppressed but your app is slow too.

> Thank you all. As I said, I learned this by osmosis, applying other
> people's code. I am not fluent in PHP. That is why I wanted a
> reference in the documents. I do not sprinkle the @ symbol through my
> code to avoid careful construction, I used it in a specific instance
> to deal with an empty query string, over which I had no control. I
> will study the alternatives offered here and do some recoding.

If you're using it to deal with possible empty input data, you'd better do it
explicitly enstead.

Something like this:

  if(!array_key_exists('from_year', $_POST)
|| !array_key_exists('from_month', $_POST)
|| !array_key_exists('from_day', $_POST)
)
  {
throw new Exception('No start date given', 100);
  }



-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re: [PHP] Convert local dates into GMT+1 dates

2008-09-27 Thread ANR Daemon
Greetings, debussy007.
In reply to Your message dated Friday, September 26, 2008, 16:52:18,

> I have local dates (Belgium), which I want to convert to GMT+1 date.
> The dates are stored in the DB and are of the following format:  '2008-06-24
> 23:30:02'

Does that means your dates stored as strings? Or as dates?

> So I think I'll need to check wether the date in DB is GMT+1 or GMT+2
> (winter or summer), if date is GMT+2, subtract one hour from the date.

If you have it stored in DB, it is right date and time, whatever that means
for that specific moment. I can't see where you have problem or what you 
want to achieve by CHANGING dates in such way.
Care to explain?


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



[PHP] Re[2]: Unicode problems

2008-09-27 Thread ANR Daemon
Greetings, "Thiago H. Pojda".
In reply to Your message dated Friday, September 26, 2008, 18:33:22,

>> I had similar problems, I cant get the whole situation out of what you
>> wrote but here are two hints.
>>
>> If you got SSH Access you can try to import the DB by following command
>>

> I don't have SSH access :/

>>
>> Otherwise if you can't access the server on this way you can set the whole
>> DB connection on the PHP application to the wanted charset by using
>> following function "mysql_set_charset" - but as this one just works on PHP
>> 5.2.3 you can do the same (not recommendet way) over the "Set names"
>> MysqlQuery - this Query just needs to be run after the connection has been
>> established (mysql_connect()).
>>

> Tried without success.

>> Just have a look at the doc of the mysql_set_charset function there you see
>> on the third comment a implementation of this function for all who have an
>> earlier PHP Version than 5.2.3 (
>> http://de3.php.net/manual/de/function.mysql-set-charset.php)
>>
>> Hope I could help.


> Actually all the responses did help. While I was researching I figured some
> weird stuff. I tried MySQL 4.0 examples for CAST() and CONVERT() and all I
> got were syntax errors. This DB is broke.

> I did the following:

> 1) Extract the DB script from the working one;
> 2) Manually added "CHARSET=utf8" for each create table;
> 3) Converted this script to UTF8 and opened with a ANSI reader and all the
> accented chars got funny. Great! That's what I wanted.
> 4) Applied the script into the database and more frustration. *Some* lines
> were in utf8 and some in latin1.

> I can only imagine the hosting is forcing this kind of behaviour so the
> client has to switch DBMS. (I don't see how, but well).

> I'm still trying and researching. If anyone else have any idea, please
> reply.

Well, it is much OT in PHP group, but see.
What you said database does not have latin1, that cant be true.
Try

  SHOW CHARACTER SET;

that should list all available charsets.
Then set connection to receive your data in right encoding.

  SET NAMES encoding;

Or, if you're using right version of PHP, simply use
mysql_set_charset('encoding');


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[4]: [PHP] Don't understand what is this $arr['N']['#']

2008-09-27 Thread ANR Daemon
Greetings, "Richard Heyes".
In reply to Your message dated Friday, September 26, 2008, 12:41:32,

>> Please don't top post any more. thank you.

> Because it's such a cardinal sin and will result in you being sent
> straight to hell. I've heard that it's not so nice there at this time
> of year, though the heat is more bearable.

to the bottom !
from the top
to read
it's easier
Because


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[2]: [PHP] Don't understand what is this $arr['N']['#']

2008-09-25 Thread ANR Daemon
Greetings, It flance.
In reply to Your message dated Thursday, September 25, 2008, 0:21:59,

>> > > -Original Message-
>> > > I am working on the code of a former employee and
>> I don't understand
>> > > what this  $arr['N']['#'] refers
>> to.
>> > >
>> > > I know it is a multidimensional associative array
>> but the # i don't
>> > > what this means.
>> >
>> > '#' is just a string value.
>> >
>> > It has no special meaning whatsoever.
>> 
>> 
>> except in the deranged world of the original author :D

> You're right. Because associative arrays are meant to make code easier to 
> understand by using meaningful indexes.

That, actually, COULD be meaningful index. In some cases.

Please don't top post any more. thank you.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[2]: [PHP] translations for PHP app

2008-09-09 Thread ANR Daemon
Greetings, Wolf.
In reply to Your message dated Monday, September 8, 2008, 15:08:22,

>> I'm looking for professional translations from English of the following:
>> - admin.php lang file just under 150 PHP defines
>> - user.php lang file just under 30 PHP defines
>> - a javascript file with about 25 single word defines
>> - about 19 PHP files with 2 defines in each
>> 
>> Most defines are 1 or 2 words with a few being sentences.
>> 
>> I need translations from English into the most common languages of my
>> users: Spanish, French, Italian, Chinese, Indian, Russian.  Also, anyone
>> having expertise in other languages, I would love to have them, please
>> contact me.
>> 
>> I also have a 30+ page user guide for using my software.  Many pages
>> contain large graphics, but the English text I woul love to have
>> translated.
>> 
>> Of course I will pay.  PayPal only.

> Have you tried blowfish or the Google Translator?  The last time I tried
> the google one, it did a whole page on the fly and seemed to be pretty
> good at it.

Looks you aren't understand, what Shawn want.
He do not want to translate English text in his own language to understand it,
in which area these automated translators pretty good. They're giving you some
common meaning of the text, but nothing more.
Instead, he want his own, already English text translated to some foreign
languages. That can be done ONLY by native speakers, who know English AND the
field, to which that specific text related.
As example, I can point to the EVE-online and their attempt to hire foreign
company to translate game interface to Russian... That said, it was complete
failure. Two times. They simply wasted their money, because all they know
about game is the text they were translated.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[2]: [PHP] Problem of Connection Character Sets and Collations

2008-09-09 Thread ANR Daemon
Greetings, [EMAIL PROTECTED]
In reply to Your message dated Monday, September 8, 2008, 19:35:22,

>>>For displaying with unicode Character Sets problem :
>>>
>>>MySQL :
>>
>>MySQL question. There's got to be a mailing list on http://www.mysql.com

>>>phpmyadmin :
>>
>>PHPMyAdmin question. PHPMyAdmin, while written in PHP, is not PHP. This
>>would be like asking Internet Explorer questions in a Visual C/C++
>>mailing list/forum.

> So, do you means as the following (If we need define the unicode
> character sets )?

No, he means, that you must do your homework yourself. (That is, must as
opposite to should)
And he told you where to go to get the info you need.
>From your first post, it is clearly looks like skill-checking test of some
sort. And if it is, you must read and understand documentation about mentioned
things.
I've left required info in quotation. Read it again, if you didn't understand
it first time.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[2]: [PHP] Length of Exception text?

2008-09-09 Thread ANR Daemon
Greetings, Peter Ford.
In reply to Your message dated Tuesday, September 9, 2008, 12:37:30,

>>>>> I've been working on some PEAR-based app last week and I ran into
>>>>> problem.
>>>>> While I debugging app, my backtrace always trimmed at some point.
>>>>> First time I though it was my mistake, and switched back to standard
>>>>> "Exception" class.
>>>>> But nothing changed.
>>>>>
>>>>> If I print everything by hands, it's all full and good, but if I let 
>>>>> PHP print
>>>
>>>> what do you mean by:
>>>
>>>> 1. print by hand
>>>
>>> Catch excetion and manually call getTraceAsString.
>>>
>>>> 2. let PHP print
>>>
>>> Do not catch exception, let PHP behave on it's own way.
>> 
>> are you printing to screen or to error_log (or syslog)? I believe 
>> error_log has a limit as to the
>> length of the string that will actually be logged ... I can't remember 
>> whether this
>> was php, apache or system related.
>> 
> You want the php.ini setting:

> log_errors_max_len

> It defaults to 1024 characters: presumably that includes the preamble giving 
> you 
> 1015 or so to play with.

> If you set it to zero then you get unlimited log messages. 'course that might 
> fill your logs up a bit...

Good catch indeed. I was confused by the strange limit (not 1023-1024 as I
expect that), so I haven't checked if this setting affecting things.

And don't worry about my log :) I want it enabled for php-cli.ini only, for
development purposes.
On live suite, exceptions generally never breaking out to {main} scope.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[2]: [PHP] Length of Exception text?

2008-09-08 Thread ANR Daemon
Greetings, Jochem Maas.
In reply to Your message dated Sunday, September 7, 2008, 20:56:37,

>> I've been working on some PEAR-based app last week and I ran into problem.
>> While I debugging app, my backtrace always trimmed at some point.
>> First time I though it was my mistake, and switched back to standard
>> "Exception" class.
>> But nothing changed.
>> 
>> If I print everything by hands, it's all full and good, but if I let PHP 
>> print

> what do you mean by:

> 1. print by hand

Catch excetion and manually call getTraceAsString.

> 2. let PHP print

Do not catch exception, let PHP behave on it's own way.

>> exception message, it getting trimmed at 1015 characters, rendering backtrace
>> almost useless.
>> Say, only my own code producing 4-5 lines, PEAR stuff adding about 8, plus
>> converting PEAR_Error to Exception at least 2 lines. All-in-all, up to 15
>> lines so far, and backtrace trimmed at 6'th or 7'th line.
>> Is there any way to affect this behaviour without recompiling PHP?



-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



[PHP] Re[2]: Path of the class file of an object

2008-09-06 Thread ANR Daemon
Greetings, "Ali Çevik".
In reply to Your message dated Sunday, September 7, 2008, 1:51:33,

>>>> I need a procedure or an implementation that gives path of the class file
>>>> of
>>>> an object which I pass as a parameter.
>>>>
>>>> Example;
>>>>
>>>> Assume I have a class file located at C:\htdocs\Foo.class.php
>>>>
>>>> In code after I include Foo.class.php;
>>>>
>>>> >>> $foo = new Foo();
>>>> Echo some_procedure($foo);
>>>> ?>
>>>>
>>>> I'm looking an implementation for that "some_procedure", which would make
>>>> this program to print C:\htdocs\Foo.class.php .
>>>> I have been googling around and also checked php.net but I wasn't able
>>>> to
>>>> find anything about this subject.
>>>>
>>>> It would be really helpful if someone knows that kind of procedure or at
>>>> least has an implementation of it.
>>>>
>>>
>>> The only way I know to do this would be to add a method to your class to
>>> give it to you.
>>>
>>> class Foo
>>> {
>>>public function getClassFilename()
>>>{
>>>return __FILE__;
>>>}
>>> }

> Hmm, that should do the trick. Thanks a lot!
> But still, I wish there were a way of doing that, without altering the
> class behaviour.

(top posting fixed)

Ok, if you prefer backward solution - hook your own error-handler and cause an
error in class, then you'll have path to it's file in backtrace.
I mean, knowing the filename of this or that function absolutely meaningless,
unless you're running into problem of some sort.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



[PHP] Re: Path of the class file of an object

2008-09-06 Thread ANR Daemon
Greetings, "Ali Çevik".
In reply to Your message dated Saturday, September 6, 2008, 23:08:45,

> I need a procedure or an implementation that gives path of the class file of
> an object which I pass as a parameter.

> Example;

> Assume I have a class file located at C:\htdocs\Foo.class.php

> In code after I include Foo.class.php;

>  $foo = new Foo();
> Echo some_procedure($foo);
?>>

> I'm looking an implementation for that "some_procedure", which would make
> this program to print C:\htdocs\Foo.class.php .
> I have been googling around and also checked php.net but I wasn't able to
> find anything about this subject.

> It would be really helpful if someone knows that kind of procedure or at
> least has an implementation of it.

> Thanks in advance,

Include a method in your class, which would simply "return __FILE__;".
If all what you need is to print path to file containing class, if you
accessing your object as string, you could utilize magic of __toString().


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[4]: [PHP] Sending username/password

2008-09-06 Thread ANR Daemon
Greetings, "Richard Heyes".
In reply to Your message dated Saturday, September 6, 2008, 21:26:25,

>> I'd recommend HTTP_Client in that case.

> You could, but that uses HTTP_Request by the looks of it.

You're right, but HTTP_Client offers some additional tools to, as you said,
mimicking web browsers behaviour.
Including cookies handling.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



[PHP] Length of Exception text?

2008-09-06 Thread ANR Daemon
Greetings, All.

I've been working on some PEAR-based app last week and I ran into problem.
While I debugging app, my backtrace always trimmed at some point.
First time I though it was my mistake, and switched back to standard
"Exception" class.
But nothing changed.

If I print everything by hands, it's all full and good, but if I let PHP print
exception message, it getting trimmed at 1015 characters, rendering backtrace
almost useless.
Say, only my own code producing 4-5 lines, PEAR stuff adding about 8, plus
converting PEAR_Error to Exception at least 2 lines. All-in-all, up to 15
lines so far, and backtrace trimmed at 6'th or 7'th line.
Is there any way to affect this behaviour without recompiling PHP?


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re[2]: [PHP] Sending username/password

2008-09-06 Thread ANR Daemon
Greetings, "Richard Heyes".
In reply to Your message dated Saturday, September 6, 2008, 18:53:31,

>> Seriously... you should just read the site. It's a library that mimics 
>> browser behavior. It will follow "Location:" headers, push POST variables, 
>> etc. Why not just give the page a glance?
>>
>> http://us3.php.net/manual/en/intro.curl.php

> If you don't have access to Curl, you could also look at the PEAR
> HTTP_Request class. IIRC this supports HTTP Basic authentication.

I'd recommend HTTP_Client in that case.


-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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