php-general Digest 27 Oct 2008 12:03:30 -0000 Issue 5758

2008-10-27 Thread php-general-digest-help

php-general Digest 27 Oct 2008 12:03:30 - Issue 5758

Topics (messages 282460 through 282485):

Re: clear a mysql table
282460 by: Bastien Koert

question about using sql server with php
282461 by: Sudhakar
282462 by: Chris

Dynamically creating multi-array field
282463 by: Martin Zvarík
282464 by: Jim Lucas
282465 by: Martin Zvarík
282466 by: Martin Zvarík
282467 by: Jim Lucas
282468 by: Jim Lucas
282469 by: Robert Cummings
282470 by: Robert Cummings
282475 by: Martin Zvarík
282479 by: Lars Torben Wilson
282480 by: Martin Zvarík
282481 by: Lars Torben Wilson
282485 by: tedd

create/write to psd file
282471 by: vuthecuong
282472 by: Ashley Sheridan
282473 by: vuthecuong
282474 by: Ashley Sheridan
282476 by: vuthecuong
282477 by: Martin Zvarík
282478 by: Ashley Sheridan

Re: Interactive canvas example
282482 by: Richard Heyes

Executing a .jar from a php script
282483 by: Bastien Helders

Re: Flags package for PHP?
282484 by: Waynn Lue

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]


--
---BeginMessage---


 truncate cash;


Hey, my wife does that all the time!
-- 

Bastien

Cat, the other other white meat
---End Message---
---BeginMessage---
i have a question about how to use sql database with php instead of using my
sql database

when i use my sql database the php code to connect to the my sql database is
=

$conn = mysql_connect($hostname, $user, $password);

if(!$conn)
{
echo Unable to connect to Database;
}

else
{
mysql_select_db($database, $conn);

$query = mysql_query($selectquery);

mysql_close($conn);
}


if i have to connect to a sql databse instead of my sql database as some
companies use sql database, how can i change the php code to connect, run a
query and close connection to the sql database.

apart from changing the code to connect to sql database is there something
else i need to do.

please advice.

thanks
---End Message---
---BeginMessage---



if i have to connect to a sql databse instead of my sql database as some
companies use sql database, how can i change the php code to connect, run a
query and close connection to the sql database.

apart from changing the code to connect to sql database is there something
else i need to do.


RTFM?

http://www.php.net/mssql


--
Postgresql  php tutorials
http://www.designmagick.com/

---End Message---
---BeginMessage---

PHP Version 5.2.4

?
$node = '[5][1][]';
${'tpl'.$node} = 'some text';

print_r($tpl); // null
?


I really don't like to use the EVAL function, but do I have choice??
This sucks.
---End Message---
---BeginMessage---

Martin Zvarík wrote:

PHP Version 5.2.4

?
$node = '[5][1][]';
${'tpl'.$node} = 'some text';

print_r($tpl); // null
?


I really don't like to use the EVAL function, but do I have choice??
This sucks.



You should print the results that you are looking for!

Are you looking for something like this?

Array
(
[5] = Array
(
[1] = Array
(
[0] = some text
)

)

)

how is the $node string being created?

---End Message---
---BeginMessage---

No offense, but I thought it's obvious what I want to print.

print_r() shows null, and it should print what you just wrote = array field.

It works when first defining with eval():
eval('$tpl'.$node.'=array();');

I guess that's the only way.

Anyway, I appreciate your quick reply,
Martin


Jim Lucas napsal(a):

Martin Zvarík wrote:

PHP Version 5.2.4

?
$node = '[5][1][]';
${'tpl'.$node} = 'some text';

print_r($tpl); // null
?


I really don't like to use the EVAL function, but do I have choice??
This sucks.



You should print the results that you are looking for!

Are you looking for something like this?

Array
(
[5] = Array
(
[1] = Array
(
[0] = some text
)

)

)

how is the $node string being created?


---End Message---
---BeginMessage---

Nope, you have to use the eval() everytime for read/write.



Martin Zvarík napsal(a):

No offense, but I thought it's obvious what I want to print.

print_r() shows null, and it should print what you just wrote = array 
field.


It works when first defining with eval():
eval('$tpl'.$node.'=array();');

I guess that's the only way.

Anyway, I appreciate your quick reply,
Martin


Jim Lucas napsal(a):

Martin Zvarík wrote:

PHP Version 5.2.4

?
$node = '[5][1][]';
${'tpl'.$node} = 'some text';

print_r($tpl); // null
?


I really don't like to use the EVAL function, but do I have choice??
This sucks.



You should print the results that you are 

Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread Robert Cummings
On Sun, 2008-10-26 at 22:39 -0700, Jim Lucas wrote:

 Even slimmer
 
 ?php
 
 $node = '[5][1][]';
 $text = 'some text';
 
 preg_match_all('|\[([^\]\[]*)\]|', $node, $matches,
 PREG_PATTERN_ORDER);
 
 $recursive = $matches[1];
 
 $recursive = array_reverse($recursive);
 
 foreach ( $recursive AS $index ) {
 
   $out = array();
 
   $out[(int)$index] = $text;
 
   $text = $out;
   
 }
 
 print_r($out);
 ?

It's buggy... you need to test for an blank string to properly handle
the append to array case when the index is blank [].

?php

$node = '[5][1][]';
$text = 'some text';

preg_match_all(
'|\[([^\]\[]*)\]|', $node, $matches, PREG_PATTERN_ORDER );

$recursive = $matches[1];
$recursive = array_reverse($recursive);

foreach( $recursive AS $index )
{
$out = array();

if( trim( $index ) === '' )
{
$out[] = $text;
}
else
{
$out[$index] = $text;
}

$text = $out;
}

print_r( $out );

?

I also removed the (int) cast since integer keys will be cast
automatically by PHP and then it will have support for text keys also.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread Robert Cummings
On Mon, 2008-10-27 at 02:09 -0400, Robert Cummings wrote:
 On Sun, 2008-10-26 at 22:39 -0700, Jim Lucas wrote:
 
  Even slimmer
  
  ?php
  
  $node = '[5][1][]';
  $text = 'some text';
  
  preg_match_all('|\[([^\]\[]*)\]|', $node, $matches,
  PREG_PATTERN_ORDER);
  
  $recursive = $matches[1];
  
  $recursive = array_reverse($recursive);
  
  foreach ( $recursive AS $index ) {
  
  $out = array();
  
  $out[(int)$index] = $text;
  
  $text = $out;
  
  }
  
  print_r($out);
  ?
 
 It's buggy... you need to test for an blank string to properly handle
 the append to array case when the index is blank [].
 
 ?php
 
 $node = '[5][1][]';
 $text = 'some text';
 
 preg_match_all(
 '|\[([^\]\[]*)\]|', $node, $matches, PREG_PATTERN_ORDER );
 
 $recursive = $matches[1];
 $recursive = array_reverse($recursive);
 
 foreach( $recursive AS $index )
 {
 $out = array();
 
 if( trim( $index ) === '' )

I probably shouldn't trim... since we're not supporting quotes in any
way, it might be desirable to have a key that is one or more spaces...
for whatever reason :)

Personally, I have a similar implementation I use all the time, but I
use forward slashes to separate keys.

?php

hashPathSet( $hash, 'this/is/the/hash/path', $value )

?

Cheers,
Rob.

 {
 $out[] = $text;
 }
 else
 {
 $out[$index] = $text;
 }
 
 $text = $out;
 }
 
 print_r( $out );
 
 ?
 
 I also removed the (int) cast since integer keys will be cast
 automatically by PHP and then it will have support for text keys also.
 

-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



[PHP] create/write to psd file

2008-10-27 Thread vuthecuong

Hi all
Is there a way to create/read/write to psd file? (photoshop format)

I would like to hear opinion form you:
Do you recommend gd2 or imageMagick to perform this task? and why
thanks in advanced 
-- 
View this message in context: 
http://www.nabble.com/create-write-to-psd-file-tp20182477p20182477.html
Sent from the PHP - General mailing list archive at Nabble.com.


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



Re: [PHP] create/write to psd file

2008-10-27 Thread Ashley Sheridan
On Sun, 2008-10-26 at 23:34 -0700, vuthecuong wrote:
 Hi all
 Is there a way to create/read/write to psd file? (photoshop format)
 
 I would like to hear opinion form you:
 Do you recommend gd2 or imageMagick to perform this task? and why
 thanks in advanced 
 -- 
 View this message in context: 
 http://www.nabble.com/create-write-to-psd-file-tp20182477p20182477.html
 Sent from the PHP - General mailing list archive at Nabble.com.
 
 
Off the top of my head, I don't think this is possible. A quick Google
yields nothing either. I'm assuming it has to be a PSD for the layers?


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] create/write to psd file

2008-10-27 Thread vuthecuong



Ashley Sheridan-3 wrote:
 
 Off the top of my head, I don't think this is possible. A quick Google
 yields nothing either. I'm assuming it has to be a PSD for the layers?
 
Sure. I woudd like to read PSd files with multiple layes, and of course when
I write to it,
I should keep it's layers state also.
Is there any point to resource in some where please?
please help me. I need your help.
Thanks in advanced.

-- 
View this message in context: 
http://www.nabble.com/create-write-to-psd-file-tp20182477p20182544.html
Sent from the PHP - General mailing list archive at Nabble.com.


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



Re: [PHP] create/write to psd file

2008-10-27 Thread Ashley Sheridan
On Sun, 2008-10-26 at 23:45 -0700, vuthecuong wrote:
 
 
 Ashley Sheridan-3 wrote:
  
  Off the top of my head, I don't think this is possible. A quick Google
  yields nothing either. I'm assuming it has to be a PSD for the layers?
  
 Sure. I woudd like to read PSd files with multiple layes, and of course when
 I write to it,
 I should keep it's layers state also.
 Is there any point to resource in some where please?
 please help me. I need your help.
 Thanks in advanced.
 
 -- 
 View this message in context: 
 http://www.nabble.com/create-write-to-psd-file-tp20182477p20182544.html
 Sent from the PHP - General mailing list archive at Nabble.com.
 
 
You want me to point you in the direction of a resource, even though
I've said I couldn't find one...?

The closest I can find is a class which will read a PSD in, although I'm
betting it'll only be a very, very old PSD.

It might be possible to do what you need by using the Gimp, but I'm just
not sure how much is possible with it over the command line.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread Martin Zvarík

:-D :-D :-D :-D :-D :-D :-D :-D
ok :)


Robert Cummings napsal(a):

On Mon, 2008-10-27 at 02:09 -0400, Robert Cummings wrote:
  

On Sun, 2008-10-26 at 22:39 -0700, Jim Lucas wrote:


Even slimmer

?php

$node = '[5][1][]';
$text = 'some text';

preg_match_all('|\[([^\]\[]*)\]|', $node, $matches,
PREG_PATTERN_ORDER);

$recursive = $matches[1];

$recursive = array_reverse($recursive);

foreach ( $recursive AS $index ) {

$out = array();

$out[(int)$index] = $text;

$text = $out;

}

print_r($out);
?
  

It's buggy... you need to test for an blank string to properly handle
the append to array case when the index is blank [].

?php

$node = '[5][1][]';
$text = 'some text';

preg_match_all(
'|\[([^\]\[]*)\]|', $node, $matches, PREG_PATTERN_ORDER );

$recursive = $matches[1];
$recursive = array_reverse($recursive);

foreach( $recursive AS $index )
{
$out = array();

if( trim( $index ) === '' )



I probably shouldn't trim... since we're not supporting quotes in any
way, it might be desirable to have a key that is one or more spaces...
for whatever reason :)

Personally, I have a similar implementation I use all the time, but I
use forward slashes to separate keys.

?php

hashPathSet( $hash, 'this/is/the/hash/path', $value )

?

Cheers,
Rob.

  

{
$out[] = $text;
}
else
{
$out[$index] = $text;
}

$text = $out;
}

print_r( $out );

?

I also removed the (int) cast since integer keys will be cast
automatically by PHP and then it will have support for text keys also.




  


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



Re: [PHP] create/write to psd file

2008-10-27 Thread vuthecuong



Ashley Sheridan-3 wrote:
 
 On Sun, 2008-10-26 at 23:45 -0700, vuthecuong wrote:
 
 
 Ashley Sheridan-3 wrote:
  
  Off the top of my head, I don't think this is possible. A quick Google
  yields nothing either. I'm assuming it has to be a PSD for the layers?
  
 Sure. I woudd like to read PSd files with multiple layes, and of course
 when
 I write to it,
 I should keep it's layers state also.
 Is there any point to resource in some where please?
 please help me. I need your help.
 Thanks in advanced.
 
 -- 
 View this message in context:
 http://www.nabble.com/create-write-to-psd-file-tp20182477p20182544.html
 Sent from the PHP - General mailing list archive at Nabble.com.
 
 
 You want me to point you in the direction of a resource, even though
 I've said I couldn't find one...?
 
 The closest I can find is a class which will read a PSD in, although I'm
 betting it'll only be a very, very old PSD.
 
 It might be possible to do what you need by using the Gimp, but I'm just
 not sure how much is possible with it over the command line.
 
 
 Ash
 www.ashleysheridan.co.uk
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
Thank you for useful info.
Anyway I will check it out.
regards,

-- 
View this message in context: 
http://www.nabble.com/create-write-to-psd-file-tp20182477p20182592.html
Sent from the PHP - General mailing list archive at Nabble.com.


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



Re: [PHP] create/write to psd file

2008-10-27 Thread Martin Zvarík
What I know is that you can control GIMP over the command line = you can 
use  PHP to do this.


Though I guess GIMP doesn't support PSD files, I had to express myself 
anyways.



vuthecuong napsal(a):

Hi all
Is there a way to create/read/write to psd file? (photoshop format)

I would like to hear opinion form you:
Do you recommend gd2 or imageMagick to perform this task? and why
thanks in advanced 


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



Re: [PHP] create/write to psd file

2008-10-27 Thread Ashley Sheridan
On Mon, 2008-10-27 at 07:55 +0100, Martin Zvarík wrote:
 What I know is that you can control GIMP over the command line = you can 
 use  PHP to do this.
 
 Though I guess GIMP doesn't support PSD files, I had to express myself 
 anyways.
 
 
 vuthecuong napsal(a):
  Hi all
  Is there a way to create/read/write to psd file? (photoshop format)
  
  I would like to hear opinion form you:
  Do you recommend gd2 or imageMagick to perform this task? and why
  thanks in advanced 
 
The Gimp does support PSD files, but it has real trouble with the layer
effects that CS introduced. Also, the Gimp cannot natively handle CMYK
images.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread Lars Torben Wilson
2008/10/26 Martin Zvarík [EMAIL PROTECTED]:
 PHP Version 5.2.4

 ?
 $node = '[5][1][]';
 ${'tpl'.$node} = 'some text';

 print_r($tpl); // null
 ?


 I really don't like to use the EVAL function, but do I have choice??
 This sucks.

Hi there,

While this question can spur some neat solutions, it raises a red flag
in that if you need to do this, you probably need to rethink things a
bit.

In cases like this it is easier for people to help if you describe the
actual problem you are trying to solve, not how you think it needs to
be solved. It could be that you don't really need weird (but
beautiful, like Jim's idea) solutions. If you explain why you believe
that you need to do this in the first place, maybe someone can suggest
something else which doesn't require a weird solution (however
beautiful).


Torben

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



Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread Martin Zvarík

2008/10/26 Martin Zvarík [EMAIL PROTECTED]:

PHP Version 5.2.4

?
$node = '[5][1][]';
${'tpl'.$node} = 'some text';

print_r($tpl); // null
?


I really don't like to use the EVAL function, but do I have choice??
This sucks.



Hi there,

While this question can spur some neat solutions, it raises a red flag
in that if you need to do this, you probably need to rethink things a
bit.

In cases like this it is easier for people to help if you describe the
actual problem you are trying to solve, not how you think it needs to
be solved. It could be that you don't really need weird (but
beautiful, like Jim's idea) solutions. If you explain why you believe
that you need to do this in the first place, maybe someone can suggest
something else which doesn't require a weird solution (however
beautiful).


Torben
Hi, I am aware of this, but explaining my problem in this case would 
take me an hour --- and eventually would lead to a) misunderstanding, b) 
weird solution, c) no solution...


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



Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread Lars Torben Wilson
2008/10/27 Martin Zvarík [EMAIL PROTECTED]:

 Hi, I am aware of this, but explaining my problem in this case would take me
 an hour --- and eventually would lead to a) misunderstanding, b) weird
 solution, c) no solution...

Forgive me if I misunderstand, but it seems like you are willing to
trade off an hour at the beginning of the project at the expense of
perhaps many hours of pain later on. Has this thread not already taken
more than an hour?

I find that often if I have a weird question, just taking the time to
formulate and write a good descriptive post to explain the problem
helps me understand why I'm going at it the wrong way to start with.

I remember years ago being faced with the same problem you now have.
It turned out that the most elegant solution was to change the design
so that I didn't need to solve the problem at all.


Torben

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



Re: [PHP] Interactive canvas example

2008-10-27 Thread Richard Heyes
 great job, i can see uses for this in lots of applications

Thanks. I'm hoping the bandwidth and load saving will be quite an incentive.

--
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated October 25th)

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



[PHP]Executing a .jar from a php script

2008-10-27 Thread Bastien Helders
Hi,

I would like to execute a jar file using exec('java -jar JARNAME option'),
but so far, my web application didn't gave me any hint that it did anything
(I tried to echo the result of the function, but nothing), and in fact I
don't think anything was done.
The jar file is in the same folder as the php scripts, so I don't know what
I did wrong.

Best Regards,
Bastien

-- 
haXe - an open source web programming language
http://haxe.org


Re: [PHP] Flags package for PHP?

2008-10-27 Thread Waynn Lue
Thanks for the advice!  I had initially tried it and couldn't seem to get
getopt2 working (and getopt was supposedly deprecated), but eventually found
a good example here: http://www.sitepoint.com/article/php-command-line-1/3/

On Thu, Oct 16, 2008 at 10:31 AM, Jim Lucas [EMAIL PROTECTED] wrote:

 Waynn Lue wrote:
  I'm running some command-line scripts that are taking more and more
  arguments, and I'm wondering whether anyone's used a good flags package
 for
  PHP?  Support for string/int/boolean arguments would be nice, otherwise
 I'll
  just hack together my own.
 
  Thanks for any advice,
  Waynn
 

 I would maybe look into using a standard ini file and then use the
 parse_ini_file [1] function to bring it all together again.

 1 - http://us2.php.net/manual/en/function.parse-ini-file.php

 --
 Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

 Twelfth Night, Act II, Scene V
by William Shakespeare




Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread tedd

At 12:33 AM -0700 10/27/08, Lars Torben Wilson wrote:

2008/10/27 Martin Zvarík [EMAIL PROTECTED]:


 Hi, I am aware of this, but explaining my problem in this case would take me
 an hour --- and eventually would lead to a) misunderstanding, b) weird
 solution, c) no solution...


Forgive me if I misunderstand, but it seems like you are willing to
trade off an hour at the beginning of the project at the expense of
perhaps many hours of pain later on. Has this thread not already taken
more than an hour?

I find that often if I have a weird question, just taking the time to
formulate and write a good descriptive post to explain the problem
helps me understand why I'm going at it the wrong way to start with.

I remember years ago being faced with the same problem you now have.
It turned out that the most elegant solution was to change the design
so that I didn't need to solve the problem at all.

Torben


I agree with Torben.

Quite often when I formulate a question for this 
group, the answer appears before I send the 
question. One needs to fully understand the 
problem themselves and preparing the right 
question helps in finding a solution.


Of course, you can do like so many others do and 
just don't worry about it -- expose your 
ignorance to the group and hope for some magical 
code. Despite my own advice, I've done that 
several times. That works too, but has it's 
downside.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] PHP XSLT caching

2008-10-27 Thread vladimirn

I have one simple question, actually i am interested in your point of view.
Is there any sense in caching xslt itself? If so, then why? If not, then
again why? :)
I think that there is no sense, and that xslt output should be cached.
What do you think?


Per Jessen wrote:
 
 vladimirn wrote:
 
 i was wondering whats the best approach to do next.
 I have an xml file delivered from service of my partner. On my web
 server (windows) i have xslt files used for xml transformation.
 Those files are getting bigger, so i have request to cash them and use
 cashed. 
 
 Your xslt files are source code, so why is there a need to cache them? 
 
 
 /Per Jessen, Zürich
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

-- 
View this message in context: 
http://www.nabble.com/PHP-XSLT-caching-tp20173225p20186499.html
Sent from the PHP - General mailing list archive at Nabble.com.


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



RE: [PHP] question about using sql server with php

2008-10-27 Thread bruce
hey sudhakar..

when you're changing database apps, you're normally going to have to change
the connection codem as well as possibly the query structure for your
different select/insert/etc.. queries.

there should be plenty of examples/tutorials on the net, as well as in the
php.net website.

have fun!


-Original Message-
From: Sudhakar [mailto:[EMAIL PROTECTED]
Sent: Sunday, October 26, 2008 8:49 PM
To: php-general@lists.php.net
Subject: [PHP] question about using sql server with php


i have a question about how to use sql database with php instead of using my
sql database

when i use my sql database the php code to connect to the my sql database is
=

$conn = mysql_connect($hostname, $user, $password);

if(!$conn)
{
echo Unable to connect to Database;
}

else
{
mysql_select_db($database, $conn);

$query = mysql_query($selectquery);

mysql_close($conn);
}


if i have to connect to a sql databse instead of my sql database as some
companies use sql database, how can i change the php code to connect, run a
query and close connection to the sql database.

apart from changing the code to connect to sql database is there something
else i need to do.

please advice.

thanks


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



[PHP] how to kill a session by closing window or tab clicking on X?

2008-10-27 Thread Afan Pasalic

hi.
I'm sorry for posting this more javascript then php question, but it's 
somehow php related.
here is the issue: very often people close the window/tab without 
logging out. I need solution how to recognize when [x] is clicked (or 
File  Close) and kill the session before the window/tab is closed.


few years ago, before firefox and tabs, I solved this by javascript and 
onClose() as a part of body tag. now, it doesn't work anymore.


any suggestion/opinion/experience?

thanks

afan

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



Re: [PHP]Executing a .jar from a php script

2008-10-27 Thread Ólafur Waage
Does the php server have access to run that file? (ie. if its apache,
does he or his group have the rights to run that file)
Also you can try to use $var = system('java -jar JARNAME', $dump); and
try to output from both variables.

2008/10/27 Bastien Helders [EMAIL PROTECTED]:
 Hi,

 I would like to execute a jar file using exec('java -jar JARNAME option'),
 but so far, my web application didn't gave me any hint that it did anything
 (I tried to echo the result of the function, but nothing), and in fact I
 don't think anything was done.
 The jar file is in the same folder as the php scripts, so I don't know what
 I did wrong.

 Best Regards,
 Bastien

 --
 haXe - an open source web programming language
 http://haxe.org


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



Re: [PHP] how to kill a session by closing window or tab clicking on X?

2008-10-27 Thread Bastien Koert
On Mon, Oct 27, 2008 at 10:10 AM, Afan Pasalic [EMAIL PROTECTED] wrote:

 hi.
 I'm sorry for posting this more javascript then php question, but it's
 somehow php related.
 here is the issue: very often people close the window/tab without logging
 out. I need solution how to recognize when [x] is clicked (or File 
 Close) and kill the session before the window/tab is closed.

 few years ago, before firefox and tabs, I solved this by javascript and
 onClose() as a part of body tag. now, it doesn't work anymore.

 any suggestion/opinion/experience?

 thanks

 afan

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


try onBeforeUnload()

-- 

Bastien

Cat, the other other white meat


[PHP] Re: PHP XSLT caching

2008-10-27 Thread Colin Guthrie

vladimirn wrote:

I have one simple question, actually i am interested in your point of view.
Is there any sense in caching xslt itself? If so, then why? If not, then
again why? :)
I think that there is no sense, and that xslt output should be cached.
What do you think?


From your original context it wasn't clear whether you wanted to cache 
the dom document *object* that represents the xslt or the output of the 
transfer after it is applied.


As I explained, (and I think I'm still correct in this), storing the 
object would be kinda pointless as it would have to be serialized to 
string form and then re-parsed on wakeup. Doing this rather than 
reloading from disk again, will save a minor amount of IO and thus time, 
but the saving will be minimal.


So IMO caching the xslt is not worth the effort. Cache the output of the 
transform and load the xslt only when needed.


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/]


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



Re: [PHP] PHP XSLT caching

2008-10-27 Thread Bastien Koert
On Mon, Oct 27, 2008 at 8:12 AM, vladimirn [EMAIL PROTECTED] wrote:


 I have one simple question, actually i am interested in your point of view.
 Is there any sense in caching xslt itself? If so, then why? If not, then
 again why? :)
 I think that there is no sense, and that xslt output should be cached.
 What do you think?


 Per Jessen wrote:
 
  vladimirn wrote:
 
  i was wondering whats the best approach to do next.
  I have an xml file delivered from service of my partner. On my web
  server (windows) i have xslt files used for xml transformation.
  Those files are getting bigger, so i have request to cash them and use
  cashed.
 
  Your xslt files are source code, so why is there a need to cache them?
 
 
  /Per Jessen, Zürich
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

 --
 View this message in context:
 http://www.nabble.com/PHP-XSLT-caching-tp20173225p20186499.html
 Sent from the PHP - General mailing list archive at Nabble.com.


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

 I can see that caching the output would make sense, caching the source xslt
files doesn't make any sense


-- 

Bastien

Cat, the other other white meat


Re: [PHP] question about using sql server with php

2008-10-27 Thread Robbert van Andel
You also need to make sure that your server has the mysql drivers
installed.  A linux server does not come with this support natively.

On Mon, Oct 27, 2008 at 6:19 AM, bruce [EMAIL PROTECTED] wrote:

 hey sudhakar..

 when you're changing database apps, you're normally going to have to change
 the connection codem as well as possibly the query structure for your
 different select/insert/etc.. queries.

 there should be plenty of examples/tutorials on the net, as well as in the
 php.net website.

 have fun!


 -Original Message-
 From: Sudhakar [mailto:[EMAIL PROTECTED]
 Sent: Sunday, October 26, 2008 8:49 PM
 To: php-general@lists.php.net
 Subject: [PHP] question about using sql server with php


 i have a question about how to use sql database with php instead of using
 my
 sql database

 when i use my sql database the php code to connect to the my sql database
 is
 =

 $conn = mysql_connect($hostname, $user, $password);

 if(!$conn)
 {
 echo Unable to connect to Database;
 }

 else
 {
 mysql_select_db($database, $conn);

 $query = mysql_query($selectquery);

 mysql_close($conn);
 }


 if i have to connect to a sql databse instead of my sql database as some
 companies use sql database, how can i change the php code to connect, run a
 query and close connection to the sql database.

 apart from changing the code to connect to sql database is there something
 else i need to do.

 please advice.

 thanks


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




Re: [PHP] how to kill a session by closing window or tab clicking on X?

2008-10-27 Thread Stut

On 27 Oct 2008, at 14:10, Afan Pasalic wrote:
I'm sorry for posting this more javascript then php question, but  
it's somehow php related.
here is the issue: very often people close the window/tab without  
logging out. I need solution how to recognize when [x] is clicked  
(or File  Close) and kill the session before the window/tab is  
closed.


few years ago, before firefox and tabs, I solved this by javascript  
and onClose() as a part of body tag. now, it doesn't work anymore.


any suggestion/opinion/experience?


That event should still fire regardless of whether it's a window, tab  
or iframe. It refers to the page closing, not the window. However, any  
event that fires when the user leaves a page (either by clicking on a  
link or closing the window) is likely to be prevented by popup  
blockers, so you can't rely on it working at all.


A sensible session timeout is the only real solution to this issue,  
possibly aided by a periodic keepalive request.


-Stut

--
http://stut.net/

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



Re: [PHP] how to kill a session by closing window or tab clicking on X?

2008-10-27 Thread Afan Pasalic


Stut wrote:

On 27 Oct 2008, at 14:10, Afan Pasalic wrote:
I'm sorry for posting this more javascript then php question, but 
it's somehow php related.
here is the issue: very often people close the window/tab without 
logging out. I need solution how to recognize when [x] is clicked 
(or File  Close) and kill the session before the window/tab is closed.


few years ago, before firefox and tabs, I solved this by javascript 
and onClose() as a part of body tag. now, it doesn't work anymore.


any suggestion/opinion/experience?


That event should still fire regardless of whether it's a window, tab 
or iframe. It refers to the page closing, not the window. However, any 
event that fires when the user leaves a page (either by clicking on a 
link or closing the window) is likely to be prevented by popup 
blockers, so you can't rely on it working at all.


A sensible session timeout is the only real solution to this issue, 
possibly aided by a periodic keepalive request.


-Stut



as you said, I was asked by pop-up blocker to allow this event. I can 
use it - in case there is no popup blocker but in general, as you said, 
can't rely on this.


session timeout will do the jobe. not exactly the way I want but...

thanks.

afan

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



[PHP] preg_match

2008-10-27 Thread Alex Chamberlain
Hi,

I don’t understand regular expressions at all – I will make an effort to
learn about them one day, but I need a solution today. I want to use the
__autoload function, but not for all my class only those that finish in
‘Controller’. So for instance,

‘ErrorController’ should load ‘errorcontroller.inc.php’
‘IndexController’ should load ‘indexcontroller.inc.php’
‘FooBar’ should NOT load anything whatsoever.

Can you help me write an __autoload function please??

Alex

No virus found in this outgoing message. Scanned by AVG Free 8.0
Checked by AVG - http://www.avg.com 
Version: 8.0.175 / Virus Database: 270.8.3/1748 - Release Date: 27/10/2008
07:57


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



Re: [PHP] preg_match

2008-10-27 Thread Stut

On 27 Oct 2008, at 15:08, Alex Chamberlain wrote:
I don’t understand regular expressions at all – I will make an  
effort to
learn about them one day, but I need a solution today. I want to use  
the
__autoload function, but not for all my class only those that finish  
in

‘Controller’. So for instance,

‘ErrorController’ should load ‘errorcontroller.inc.php’
‘IndexController’ should load ‘indexcontroller.inc.php’
‘FooBar’ should NOT load anything whatsoever.

Can you help me write an __autoload function please??


Have you even tried it? This is not hard, and doesn't need to use any  
regular expressions at all.


We're not here to write code for you, we're here to help when you have  
problems. Try it, see how far you get and send us the code if/when you  
get stuck.


Unless you want to hire me to do it. My rates are pretty reasonable  
for simple stuff like this.


-Stut

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



RE: [PHP] preg_match

2008-10-27 Thread Alex Chamberlain
 -Original Message-
 From: Stut [mailto:[EMAIL PROTECTED]
 Sent: 27 October 2008 15:21
 To: Alex Chamberlain
 Cc: PHP General list
 Subject: Re: [PHP] preg_match
 
 On 27 Oct 2008, at 15:08, Alex Chamberlain wrote:
  I don’t understand regular expressions at all – I will make an
  effort to
  learn about them one day, but I need a solution today. I want to use
  the
  __autoload function, but not for all my class only those that finish
  in
  ‘Controller’. So for instance,
 
  ‘ErrorController’ should load ‘errorcontroller.inc.php’
  ‘IndexController’ should load ‘indexcontroller.inc.php’
  ‘FooBar’ should NOT load anything whatsoever.
 
  Can you help me write an __autoload function please??
 
 Have you even tried it? This is not hard, and doesn't need to use any
 regular expressions at all.
 
 We're not here to write code for you, we're here to help when you have
 problems. Try it, see how far you get and send us the code if/when you
 get stuck.
 
 Unless you want to hire me to do it. My rates are pretty reasonable
 for simple stuff like this.
 
 -Stut

Problem solved:
function __autoload($c) {
  $m = array();
  preg_match('/(?:^[A-Z][a-z]+)Controller/', $c, $m);
  if (count($m)) {
   require_once(realpath(FS_CONTROLLER . '/' . strtolower($m[0]) .
'.inc.php'));
  }
 }

However (perhaps a more appropriate question), do you think there is an
easier/better way to do this??

Alex

No virus found in this outgoing message. Scanned by AVG Free 8.0
Checked by AVG - http://www.avg.com 
Version: 8.0.175 / Virus Database: 270.8.3/1748 - Release Date: 27/10/2008
07:57


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



Re: [PHP] preg_match

2008-10-27 Thread Stut

On 27 Oct 2008, at 15:46, Alex Chamberlain wrote:

Problem solved:
function __autoload($c) {
 $m = array();
 preg_match('/(?:^[A-Z][a-z]+)Controller/', $c, $m);
 if (count($m)) {
  require_once(realpath(FS_CONTROLLER . '/' . strtolower($m[0]) .
'.inc.php'));
 }
}

However (perhaps a more appropriate question), do you think there is  
an

easier/better way to do this??


See, that wasn't so hard was it!!

Personally I'd have gone with something more like this...

function __autoload($class)
{
  if (substr($class, -10) == 'Controller')
  {
// No need for realpath here, it's not doing anything useful
// The _once is probably redundant too, but it may be required
// depending on how your code is arranged.
require FS_CONTROLLER.'/'.strtolower($class).'.inc.php';
  }
}

...but there's always more than one solution.

-Stut

--
http://stut.net/

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



Re: [PHP] preg_match

2008-10-27 Thread Eric Butera
On Mon, Oct 27, 2008 at 11:54 AM, Stut [EMAIL PROTECTED] wrote:
 On 27 Oct 2008, at 15:46, Alex Chamberlain wrote:

 Problem solved:
 function __autoload($c) {
  $m = array();
  preg_match('/(?:^[A-Z][a-z]+)Controller/', $c, $m);
  if (count($m)) {
  require_once(realpath(FS_CONTROLLER . '/' . strtolower($m[0]) .
 '.inc.php'));
  }
 }

 However (perhaps a more appropriate question), do you think there is an
 easier/better way to do this??

 See, that wasn't so hard was it!!

 Personally I'd have gone with something more like this...

 function __autoload($class)
 {
  if (substr($class, -10) == 'Controller')
  {
// No need for realpath here, it's not doing anything useful
// The _once is probably redundant too, but it may be required
// depending on how your code is arranged.
require FS_CONTROLLER.'/'.strtolower($class).'.inc.php';
  }
 }

 ...but there's always more than one solution.

 -Stut

 --
 http://stut.net/

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



I'd just like to add spl autoload is friendlier since __autoload can
only be defined once.

http://us.php.net/manual/en/function.spl-autoload-register.php

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



Re: [PHP] preg_match

2008-10-27 Thread Stut

Please keep the conversation on the list!

On 27 Oct 2008, at 16:06, Alex Chamberlain wrote:

-Original Message-
From: Stut [mailto:[EMAIL PROTECTED]
Sent: 27 October 2008 15:54
To: Alex Chamberlain
Cc: 'PHP General list'
Subject: Re: [PHP] preg_match

On 27 Oct 2008, at 15:46, Alex Chamberlain wrote:

Problem solved:
function __autoload($c) {
$m = array();
preg_match('/(?:^[A-Z][a-z]+)Controller/', $c, $m);
if (count($m)) {
 require_once(realpath(FS_CONTROLLER . '/' . strtolower($m[0]) .
'.inc.php'));
}
}

However (perhaps a more appropriate question), do you think there is
an
easier/better way to do this??


See, that wasn't so hard was it!!

Personally I'd have gone with something more like this...

function __autoload($class)
{
  if (substr($class, -10) == 'Controller')
  {
// No need for realpath here, it's not doing anything useful
// The _once is probably redundant too, but it may be required
// depending on how your code is arranged.
require FS_CONTROLLER.'/'.strtolower($class).'.inc.php';
  }
}

...but there's always more than one solution.

-Stut



Ok, spurred on with the success so far (but not changing the form of  
my code

just yet), I changed it to:

function __autoload($c) {
 $m = array();

 preg_match('/Fred(^[A-Z][a-zA-Z]+)/', $c, $m);
 if (count($m)) {
  require_once(realpath(FS_COMPONENT . '/' . strtolower($m[1]) .
'.inc.php'));
 }

 var_dump($m);

 preg_match('/(?:^[A-Z][a-z]+)Controller/', $c, $m);
 if (count($m)) {
  require_once(realpath(FS_CONTROLLER . '/' . strtolower($m[0]) .
'.inc.php'));
 }
}

With the aim of also matching anything starting with 'Fred'. It  
didn't work

until I took the caret ^ out:

function __autoload($c) {
 $m = array();

 preg_match('/Fred([A-Z][a-zA-Z]+)/', $c, $m);
 if (count($m)) {
  require_once(realpath(FS_COMPONENT . '/' . strtolower($m[1]) .
'.inc.php'));
 }

 var_dump($m);

 preg_match('/(?:^[A-Z][a-z]+)Controller/', $c, $m);
 if (count($m)) {
  require_once(realpath(FS_CONTROLLER . '/' . strtolower($m[0]) .
'.inc.php'));
 }
}

What I don't understand is why I needed it in one, but not in  
another??


If you're going to use regular expressions you need to read the manual  
to understand how they work. There's a whole section of the manual  
that covers this - go read it to understand what the ^ means!


-Stut

--
http://stut.net/

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



Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread Robert Cummings
On Mon, 2008-10-27 at 00:33 -0700, Lars Torben Wilson wrote:
 2008/10/27 Martin Zvarík [EMAIL PROTECTED]:
 
  Hi, I am aware of this, but explaining my problem in this case would take me
  an hour --- and eventually would lead to a) misunderstanding, b) weird
  solution, c) no solution...
 
 Forgive me if I misunderstand, but it seems like you are willing to
 trade off an hour at the beginning of the project at the expense of
 perhaps many hours of pain later on. Has this thread not already taken
 more than an hour?

Took me 3 minutes :)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread Robert Cummings
On Mon, 2008-10-27 at 08:03 -0400, tedd wrote:
 At 12:33 AM -0700 10/27/08, Lars Torben Wilson wrote:
 2008/10/27 Martin Zvarík [EMAIL PROTECTED]:
 
   Hi, I am aware of this, but explaining my problem in this case would take 
  me
   an hour --- and eventually would lead to a) misunderstanding, b) weird
   solution, c) no solution...
 
 Forgive me if I misunderstand, but it seems like you are willing to
 trade off an hour at the beginning of the project at the expense of
 perhaps many hours of pain later on. Has this thread not already taken
 more than an hour?
 
 I find that often if I have a weird question, just taking the time to
 formulate and write a good descriptive post to explain the problem
 helps me understand why I'm going at it the wrong way to start with.
 
 I remember years ago being faced with the same problem you now have.
 It turned out that the most elegant solution was to change the design
 so that I didn't need to solve the problem at all.
 
 Torben
 
 I agree with Torben.
 
 Quite often when I formulate a question for this 
 group, the answer appears before I send the 
 question. One needs to fully understand the 
 problem themselves and preparing the right 
 question helps in finding a solution.
 
 Of course, you can do like so many others do and 
 just don't worry about it -- expose your 
 ignorance to the group and hope for some magical 
 code. Despite my own advice, I've done that 
 several times. That works too, but has it's 
 downside.

Not to necessarily sweep aside the new issue being raised, but there are
certainly times when the kind of thing being requested are indeed
desireable.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



RE: [PHP] preg_match

2008-10-27 Thread Boyd, Todd M.
 -Original Message-
 From: Alex Chamberlain [mailto:[EMAIL PROTECTED]
 Sent: Monday, October 27, 2008 10:09 AM
 To: PHP General list
 Subject: [PHP] preg_match
 
 Hi,
 
 I don't understand regular expressions at all - I will make an effort
 to
 learn about them one day, but I need a solution today. I want to use
 the
 __autoload function, but not for all my class only those that finish
in
 'Controller'. So for instance,
 
 'ErrorController' should load 'errorcontroller.inc.php'
 'IndexController' should load 'indexcontroller.inc.php'
 'FooBar' should NOT load anything whatsoever.
 
 Can you help me write an __autoload function please??

http://www.regular-expressions.info

Awesome website. You should be a veritable RegEx guru after reading that
site for one day. (It'll also tell you what the ^ and $ means, as well
as that (?:) group).


Todd Boyd
Web Programmer

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



[PHP] Launching multiple PHP threads via Scheduled Tasks

2008-10-27 Thread Brian Dunning
I've got a script that downloads files queued from a server, and it's  
launched by a Windows Scheduled Task that launches every minute. My  
understanding of the default behavior is that if the task is still  
running a minute later when it's time to launch again, a duplicate  
thread will not be launched.


The remote server administrator wants me to launch multiple threads  
all day - in my mind the wrong choice, since multiple download threads  
slow everyone one, but that's what he wants.


Anyone know if there's a way to make Windows Scheduled Task launch a  
new thread of the PHP script, regardless of whether it's already  
running?


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



[PHP] Re: Remote Developer Wanted

2008-10-27 Thread Michelle Konzack
Am 2008-10-20 21:50:35, schrieb Shawn McKenzie:
 Here, here.  Even with the worst economy since the great depression
 (ehem), I still wouldn't accept less than $60 an hour and I'm not even a
 professional (not my profession) programmer.  It seems to still be
 working out for me :-)

If you go to a Computershop and let repair your computer, the  bill  you
per hour 50-80 EURO here in Strasbourg.

I work for a minimum of 50 Euro since Strasbourg is the  most  expensive
city of France.  And yes, Paris is cheaper!

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
+49/177/935194750, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


[PHP] Re: Remote Developer Wanted

2008-10-27 Thread Michelle Konzack
Am 2008-10-21 18:21:19, schrieb Jochem Maas:
 Daniel Brown schreef:
  On Tue, Oct 21, 2008 at 12:03 PM, Jochem Maas [EMAIL PROTECTED] wrote:
  and rob myself of the sport? your no fun since your married Shirley ;-)
  
  Coincidentally, that's exactly what my wife says.
 
 your wife calls you Shirley? your definitely doing *something* wrong ... 
 maybe take off the
 dress. :-P

And if he/she is hermaphrodite like me,
then you will have a problem explaining...

:-D

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
+49/177/935194750, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


[PHP] Class for reading/writing/updating PO (gettext) files

2008-10-27 Thread Michelle Konzack
Hello *,

I have an arg with a tool which read in PO/POT (gettext) files.

Under Perl grmpf I can use  under Debian:

[ command 'pkg_desc liblocale-po-perl' ]
Description: Locale::PO perl module
 This module provides methods for manipulating objects that represent
 entries in a gettext po-file (untranslated and translated strings,
 with associated comments). It can load and save complete po-files.


but I like to get something for PHP5.

Any suggestions?

Note:   Pootle is nice, but currently not usable for my needs
and I need a PHP solution for a framework.

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
+49/177/935194750, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


Re: [PHP] question about using sql server with php

2008-10-27 Thread Ashley Sheridan
On Mon, 2008-10-27 at 07:41 -0700, Robbert van Andel wrote:
 You also need to make sure that your server has the mysql drivers
 installed.  A linux server does not come with this support natively.
 
 On Mon, Oct 27, 2008 at 6:19 AM, bruce [EMAIL PROTECTED] wrote:
 
  hey sudhakar..
 
  when you're changing database apps, you're normally going to have to change
  the connection codem as well as possibly the query structure for your
  different select/insert/etc.. queries.
 
  there should be plenty of examples/tutorials on the net, as well as in the
  php.net website.
 
  have fun!
 
 
  -Original Message-
  From: Sudhakar [mailto:[EMAIL PROTECTED]
  Sent: Sunday, October 26, 2008 8:49 PM
  To: php-general@lists.php.net
  Subject: [PHP] question about using sql server with php
 
 
  i have a question about how to use sql database with php instead of using
  my
  sql database
 
  when i use my sql database the php code to connect to the my sql database
  is
  =
 
  $conn = mysql_connect($hostname, $user, $password);
 
  if(!$conn)
  {
  echo Unable to connect to Database;
  }
 
  else
  {
  mysql_select_db($database, $conn);
 
  $query = mysql_query($selectquery);
 
  mysql_close($conn);
  }
 
 
  if i have to connect to a sql databse instead of my sql database as some
  companies use sql database, how can i change the php code to connect, run a
  query and close connection to the sql database.
 
  apart from changing the code to connect to sql database is there something
  else i need to do.
 
  please advice.
 
  thanks
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
What distribution are you using for your server, as every distro I've
ever touched has them. Also, the question was regarding connection to a
mssql database, not mysql. As he didn't specify the operating system,
I'm going out on a limb by thinking the PHP was on a Windows web server
(who would run PHP on a Linux web server to then use the inferior mssql
database?) 


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] how to kill a session by closing window or tab clicking on X?

2008-10-27 Thread Ashley Sheridan
On Mon, 2008-10-27 at 09:56 -0500, Afan Pasalic wrote:
 Stut wrote:
  On 27 Oct 2008, at 14:10, Afan Pasalic wrote:
  I'm sorry for posting this more javascript then php question, but 
  it's somehow php related.
  here is the issue: very often people close the window/tab without 
  logging out. I need solution how to recognize when [x] is clicked 
  (or File  Close) and kill the session before the window/tab is closed.
 
  few years ago, before firefox and tabs, I solved this by javascript 
  and onClose() as a part of body tag. now, it doesn't work anymore.
 
  any suggestion/opinion/experience?
 
  That event should still fire regardless of whether it's a window, tab 
  or iframe. It refers to the page closing, not the window. However, any 
  event that fires when the user leaves a page (either by clicking on a 
  link or closing the window) is likely to be prevented by popup 
  blockers, so you can't rely on it working at all.
 
  A sensible session timeout is the only real solution to this issue, 
  possibly aided by a periodic keepalive request.
 
  -Stut
 
 
 as you said, I was asked by pop-up blocker to allow this event. I can 
 use it - in case there is no popup blocker but in general, as you said, 
 can't rely on this.
 
 session timeout will do the jobe. not exactly the way I want but...
 
 thanks.
 
 afan
 
You could set the timeout to a low value, and have the browser make AJAX
requests at an interval less than this. If you don't get your session
update request from the browser, you can deem it as crashed or closed.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] question about using sql server with php

2008-10-27 Thread Chris

Robbert van Andel wrote:

You also need to make sure that your server has the mysql drivers
installed.  A linux server does not come with this support natively.


He's not using mysql, he's using sql server.

--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] question about using sql server with php

2008-10-27 Thread Robbert van Andel
We use a linux webserver but have a need to connect to MSSQL databases.
Since I used Fedora, I was lucky enough to find the PHP-MSSQL package but
that has only been available via yum recently.  My first attempt at
connecting to MSSQL was much more difficult when I was using FC3.

On Mon, Oct 27, 2008 at 2:02 PM, Ashley Sheridan
[EMAIL PROTECTED]wrote:

 On Mon, 2008-10-27 at 07:41 -0700, Robbert van Andel wrote:
  You also need to make sure that your server has the mysql drivers
  installed.  A linux server does not come with this support natively.
 
  On Mon, Oct 27, 2008 at 6:19 AM, bruce [EMAIL PROTECTED] wrote:
 
   hey sudhakar..
  
   when you're changing database apps, you're normally going to have to
 change
   the connection codem as well as possibly the query structure for your
   different select/insert/etc.. queries.
  
   there should be plenty of examples/tutorials on the net, as well as in
 the
   php.net website.
  
   have fun!
  
  
   -Original Message-
   From: Sudhakar [mailto:[EMAIL PROTECTED]
   Sent: Sunday, October 26, 2008 8:49 PM
   To: php-general@lists.php.net
   Subject: [PHP] question about using sql server with php
  
  
   i have a question about how to use sql database with php instead of
 using
   my
   sql database
  
   when i use my sql database the php code to connect to the my sql
 database
   is
   =
  
   $conn = mysql_connect($hostname, $user, $password);
  
   if(!$conn)
   {
   echo Unable to connect to Database;
   }
  
   else
   {
   mysql_select_db($database, $conn);
  
   $query = mysql_query($selectquery);
  
   mysql_close($conn);
   }
  
  
   if i have to connect to a sql databse instead of my sql database as
 some
   companies use sql database, how can i change the php code to connect,
 run a
   query and close connection to the sql database.
  
   apart from changing the code to connect to sql database is there
 something
   else i need to do.
  
   please advice.
  
   thanks
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 What distribution are you using for your server, as every distro I've
 ever touched has them. Also, the question was regarding connection to a
 mssql database, not mysql. As he didn't specify the operating system,
 I'm going out on a limb by thinking the PHP was on a Windows web server
 (who would run PHP on a Linux web server to then use the inferior mssql
 database?)


 Ash
 www.ashleysheridan.co.uk




[PHP] send emails in php not working

2008-10-27 Thread Marc Fromm
We recently moved to a new server. Our code that would send out emails is no 
longer sending emails.
There are no messages in the httpd logs associated with running the email.php 
files.
The email scripts worked on the old server. Is there a special setting in 
php.ini for sending emails in php or is there a packages that needs to be 
installed on the new server. Below is some sample code that worked on the old 
server

Receive the email request:
  1 html
  2 body
  3
  4 form action=emailFormProcess.php method=post
  5 Your Name: input type=text name=namebr
  6 E-mail: input type=text name = emailbrbr
  7 Commentsbr
  8 textarea name=comments/textareabrbr
  9 input type=submit value=Submit
 10 /form
 11
 12 /body
 13 /html

Process the email request:
  1 html
  2 body
  3
  4 ?
  5 function checkOK($field)
  6 {
  7 if (eregi(\r,$field) || eregi(\n,$field)){
  8 die(Invalid Input!);
  9 }
 10 }
 11
 12 $name=$_POST['name'];
 13 checkOK($name);
 14 $email=$_POST['email'];
 15 checkOK($email);
 16 $comments=$_POST['comments'];
 17 checkOK($comments);
 18 $to=[EMAIL PROTECTED],$email;
 19 $message=$name just filled in your comments form. They 
said:\n$comments\n\nTheir e-mail address iss: $email;
 20 if(mail($to,Comments From Your Site,$message,From: $email\n)) {
 21 echo Thanks for your comments.;
 22 } else {
 23 echo There was a problem sending the mail. Please check that you filled in 
the form correctly.;
 24 }
 25 ?
 26
 27 /html
 28 /body

Thanks

Marc



[PHP] Re: Remote Developer Wanted

2008-10-27 Thread Jay Moore

Michelle Konzack wrote:

Am 2008-10-21 18:21:19, schrieb Jochem Maas:

Daniel Brown schreef:

On Tue, Oct 21, 2008 at 12:03 PM, Jochem Maas [EMAIL PROTECTED] wrote:

and rob myself of the sport? your no fun since your married Shirley ;-)

Coincidentally, that's exactly what my wife says.

your wife calls you Shirley? your definitely doing *something* wrong ... maybe 
take off the
dress. :-P


And if he/she is hermaphrodite like me,
then you will have a problem explaining...

:-D

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant




o_O

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



Re: [PHP] question about using sql server with php

2008-10-27 Thread Robbert van Andel
Sorry, that was a typo.  I meant MSSQL.

On Mon, Oct 27, 2008 at 2:12 PM, Chris [EMAIL PROTECTED] wrote:

 Robbert van Andel wrote:

 You also need to make sure that your server has the mysql drivers
 installed.  A linux server does not come with this support natively.


 He's not using mysql, he's using sql server.


 --
 Postgresql  php tutorials
 http://www.designmagick.com/




Re: [PHP] send emails in php not working

2008-10-27 Thread Chris

Marc Fromm wrote:

We recently moved to a new server. Our code that would send out emails is no 
longer sending emails.
There are no messages in the httpd logs associated with running the email.php 
files.
The email scripts worked on the old server. Is there a special setting in 
php.ini for sending emails in php or is there a packages that needs to be 
installed on the new server. Below is some sample code that worked on the old 
server


You need a local mail server. Choices usually are postfix, exim, 
sendmail or qmail (I suggest postfix) - they are usually the top 4 open 
source ones.


Does email work from command line?

echo 'test' | mail -s 'test' [EMAIL PROTECTED]

--
Postgresql  php tutorials
http://www.designmagick.com/


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



RE: [PHP] send emails in php not working

2008-10-27 Thread Marc Fromm
 You need a local mail server.
Sendmail  8.13.8-2.el5 is installed on the new server and the old server 
(sendmail-8.13.8-1.fc5).
echo 'test' | mail -s 'test' [EMAIL PROTECTED]
The above line sends on email on the old server but not the new server.

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED]
Sent: Monday, October 27, 2008 2:55 PM
To: Marc Fromm
Cc: php-general@lists.php.net
Subject: Re: [PHP] send emails in php not working

Marc Fromm wrote:
 We recently moved to a new server. Our code that would send out emails is no 
 longer sending emails.
 There are no messages in the httpd logs associated with running the email.php 
 files.
 The email scripts worked on the old server. Is there a special setting in 
 php.ini for sending emails in php or is there a packages that needs to be 
 installed on the new server. Below is some sample code that worked on the old 
 server

You need a local mail server. Choices usually are postfix, exim,
sendmail or qmail (I suggest postfix) - they are usually the top 4 open
source ones.

Does email work from command line?

echo 'test' | mail -s 'test' [EMAIL PROTECTED]

--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] send emails in php not working

2008-10-27 Thread Chris

Marc Fromm wrote:

You need a local mail server.

Sendmail  8.13.8-2.el5 is installed on the new server and the old server 
(sendmail-8.13.8-1.fc5).

echo 'test' | mail -s 'test' [EMAIL PROTECTED]

The above line sends on email on the old server but not the new server.


Is sendmail running (ps -ef | grep sendmail)?

Anything in /var/log/mail.log or where-ever sendmail puts it's logs?

It could also be set to queue only and send everything in one bunch 
instead of as it gets emails. I don't know sendmail to tell you how to 
check that.


--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] Launching multiple PHP threads via Scheduled Tasks

2008-10-27 Thread Nick Stinemates
On Mon, Oct 27, 2008 at 11:44:50AM -0700, Brian Dunning wrote:
 I've got a script that downloads files queued from a server, and it's  
 launched by a Windows Scheduled Task that launches every minute. My  
 understanding of the default behavior is that if the task is still  
 running a minute later when it's time to launch again, a duplicate  
 thread will not be launched.

 The remote server administrator wants me to launch multiple threads all 
 day - in my mind the wrong choice, since multiple download threads slow 
 everyone one, but that's what he wants.

 Anyone know if there's a way to make Windows Scheduled Task launch a new 
 thread of the PHP script, regardless of whether it's already running?


Your assumption is semi-correct, mostly because of your choice of language. If 
you would have asked about launvhing another download process, then you would 
be wrong.

A new _process_ *is* spawned by the Windows Scheduled Task launcher.

Here's a proof.

test.bat

 start c:\php\php.exe test.php
 start c:\php\php.exe test.php

test.php:

?php
 sleep(20)
 print slept 20 seconds;
?


Double click on test.bat, you should see 'slept 20 seconds' printed
twice.

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



[PHP] clean data

2008-10-27 Thread blackwater dev
I have a project now where we would like to properly remove unwanted data
before it goes into the db such as ` and of course slashes.  The problem is
I have tons of pages.  Is there an easy way to add in a clean up routine on
the db side to clean it going in and coming out without having to touch each
page that inserts it into the db and each page that presents it?

I'm using a MySQL db.


Thanks!


[PHP] ImageMagick functions

2008-10-27 Thread pichoscosama
When I look at online documentations of PHP I can not see ImageMagick 
functions. Only classes. What happened?

-- 
Allah varsa çocuklar neden ölüyor ki?

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



Re: [PHP] clean data

2008-10-27 Thread Micah Gersten
Are you using MySQL abstraction?  That's the easiest way to control what
data goes into your DB in a central place.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



blackwater dev wrote:
 I have a project now where we would like to properly remove unwanted data
 before it goes into the db such as ` and of course slashes.  The problem is
 I have tons of pages.  Is there an easy way to add in a clean up routine on
 the db side to clean it going in and coming out without having to touch each
 page that inserts it into the db and each page that presents it?

 I'm using a MySQL db.


 Thanks!

   

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



Re: [PHP] clean data

2008-10-27 Thread blackwater dev
Yes, I agree but the code I am inheriting doesn't use abstraction
unfortunately.

On Mon, Oct 27, 2008 at 9:38 PM, Micah Gersten [EMAIL PROTECTED] wrote:

 Are you using MySQL abstraction?  That's the easiest way to control what
 data goes into your DB in a central place.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 blackwater dev wrote:
  I have a project now where we would like to properly remove unwanted data
  before it goes into the db such as ` and of course slashes.  The problem
 is
  I have tons of pages.  Is there an easy way to add in a clean up routine
 on
  the db side to clean it going in and coming out without having to touch
 each
  page that inserts it into the db and each page that presents it?
 
  I'm using a MySQL db.
 
 
  Thanks!
 
 



Re: [PHP] clean data

2008-10-27 Thread Micah Gersten
In that case, I suggest you look to the MySQL lists for tips on handling
data coming in.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



blackwater dev wrote:
 Yes, I agree but the code I am inheriting doesn't use abstraction
 unfortunately.

 On Mon, Oct 27, 2008 at 9:38 PM, Micah Gersten [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:

 Are you using MySQL abstraction?  That's the easiest way to
 control what
 data goes into your DB in a central place.

 Thank you,
 Micah Gersten http://www.onshore.com



 blackwater dev wrote:
  I have a project now where we would like to properly remove
 unwanted data
  before it goes into the db such as ` and of course slashes.  The
 problem is
  I have tons of pages.  Is there an easy way to add in a clean up
 routine on
  the db side to clean it going in and coming out without having
 to touch each
  page that inserts it into the db and each page that presents it?
 
  I'm using a MySQL db.
 
 
  Thanks!
 
 



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



[PHP] Parsing URLs

2008-10-27 Thread Ron Piggott
I would like to parse the URLs in the values after the domain name.  

The URLs are the results of mod re-write statements.  

Example 1:

http://www.domain.com/page/file/

The desired results would be: 
$web_page_access[1] = file

Example 2:

http://www.domain.com/page/file/2/ 

The desired results would be:
$web_page_access[1] = file
$web_page_access[2] = 2

Any help please?

Ron


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



Re: [PHP] Parsing URLs

2008-10-27 Thread Eric Butera
On Mon, Oct 27, 2008 at 10:04 PM, Ron Piggott
[EMAIL PROTECTED] wrote:
 I would like to parse the URLs in the values after the domain name.

 The URLs are the results of mod re-write statements.

 Example 1:

 http://www.domain.com/page/file/

 The desired results would be:
 $web_page_access[1] = file

 Example 2:

 http://www.domain.com/page/file/2/

 The desired results would be:
 $web_page_access[1] = file
 $web_page_access[2] = 2

 Any help please?

 Ron


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



// $uri = htmlspecialchars($SERVER['REQUEST_URI'], ENT_QUOTES, 'UTF-8');
$uri = htmlspecialchars('/page/file/2/', ENT_QUOTES, 'UTF-8');;
$uri = trim($uri, /);
$parts = explode(/, $uri);
var_dump($parts);

or use parse_url to get down to the bits you need.

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



Re: [PHP] Re: Replacing with f*ck and f*cking

2008-10-27 Thread Ryan S
Thanks for all your input guys!

 Scunthorpe

LOL!
Never heard of the place but ...f**k i think i am a geek for finding it funny!
Reminds me of quite  few people tho...

Cheers!
R

2008/10/26 Colin Guthrie [EMAIL PROTECTED]:
 Ashley Sheridan wrote:

 What you really need to watch out for is words which you're going to
 censor which might be part of other names. Sex is an obvious one, as it
 appeared in the borough name of my old address: Middlesex.

 I can't believe you didn't use the infamous Scunthorpe as your example :p

 Col

There was a post on Coding Horror not long ago that brought this one up:
http://google.com/search?q=consbreastution

http://www.codinghorror.com/blog/archives/001176.html

-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

ä-ö-ü-ß-Ä-Ö-Ü





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



Re: [PHP] ImageMagick functions

2008-10-27 Thread Martijn Korse

These classes contain methods which are just normal functions only residing
in a class.


pichoscosama wrote:
 
 When I look at online documentations of PHP I can not see ImageMagick 
 functions. Only classes. What happened?
 
 -- 
 Allah varsa çocuklar neden ölüyor ki?
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 


-
http://devshed.excudo.net http://devshed.excudo.net 
-- 
View this message in context: 
http://www.nabble.com/ImageMagick-functions-tp20199962p20201449.html
Sent from the PHP - General mailing list archive at Nabble.com.


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