php-general Digest 6 Jan 2010 14:46:27 -0000 Issue 6524
Topics (messages 300840 through 300849):
Re: How to get a string from C library into PHP via SWIG?
300840 by: Nathan Nobbe
300841 by: Eric Fowler
pass by reference variable length args
300842 by: viraj
300843 by: Robert Cummings
300844 by: viraj
300845 by: viraj
300846 by: Robert Cummings
After editing only the httpd.conf PHP 5.2.12 works in Apache2.2 on WindowsXP
Professional 2002 SP 3, Can this be?
300847 by: Varuna Seneviratna
300848 by: Jim Lucas
Re: Open source project management tool - PHP
300849 by: Angelo Zanetti
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
On Tue, Jan 5, 2010 at 4:38 PM, Eric Fowler <eric.fow...@gmail.com> wrote:
> A little more information: my crashes all relate to handling the char
> datatype. Floats and ints are happy.
>
> I suspect that a char type in PHP is not the same as a char type in C.
> But I am not sure at all.
>
> More recently I have used cmalloc.i to allocate arrays of chars and
> floats. The floats are happy, the chars crash upon allocation.
>
neat, swig generates php extensions. i wonder Eric, how much functionality
you intend to expose to php, a series of functions, classes? from the
sounds of your earlier description i would imagine maybe one class or a
single set of functions to operate on a single string variable, with
additional parameters for metadata.
im curious, if youre sold on the generator, or if youre interested to just
try your hand writing an extension. if youre strong w/ C you could probly
crank it out quickly. another option would be to version the generated
(swig) C, and repair it by hand, putting those changes in a branch. during
subsequent generations, you could merge the work from said branch and
iterate on that.
of course the other option is to figure out swig, lol. anyways, is this C
of yours for a private project or is it something i could take a peak at; im
halfway curious what youre working w/.
o, and guess what, reading through the swig php page, i discovered you can
write php extensions 'in c++', by creating a thin C wrapper - wow, i had
never thought of that, lol.
-nathan
--- End Message ---
--- Begin Message ---
I will expose only one function, prototyped like the foo() example I described.
cstring.i is not implemented for a PHP target (wah).
I think I will go the shell approach. I have enough time in this already.
Eric
On Tue, Jan 5, 2010 at 6:26 PM, Nathan Nobbe <quickshif...@gmail.com> wrote:
> On Tue, Jan 5, 2010 at 4:38 PM, Eric Fowler <eric.fow...@gmail.com> wrote:
>>
>> A little more information: my crashes all relate to handling the char
>> datatype. Floats and ints are happy.
>>
>> I suspect that a char type in PHP is not the same as a char type in C.
>> But I am not sure at all.
>>
>> More recently I have used cmalloc.i to allocate arrays of chars and
>> floats. The floats are happy, the chars crash upon allocation.
>
> neat, swig generates php extensions. i wonder Eric, how much functionality
> you intend to expose to php, a series of functions, classes? from the
> sounds of your earlier description i would imagine maybe one class or a
> single set of functions to operate on a single string variable, with
> additional parameters for metadata.
> im curious, if youre sold on the generator, or if youre interested to just
> try your hand writing an extension. if youre strong w/ C you could probly
> crank it out quickly. another option would be to version the generated
> (swig) C, and repair it by hand, putting those changes in a branch. during
> subsequent generations, you could merge the work from said branch and
> iterate on that.
> of course the other option is to figure out swig, lol. anyways, is this C
> of yours for a private project or is it something i could take a peak at; im
> halfway curious what youre working w/.
> o, and guess what, reading through the swig php page, i discovered you can
> write php extensions 'in c++', by creating a thin C wrapper - wow, i had
> never thought of that, lol.
> -nathan
--- End Message ---
--- Begin Message ---
hi all,
i'm trying to write a wrapper function for "mysqli_stmt_bind_results".
and expect it to work the same way it accepts and bind results to the
original function.
the problem is, i couldn't find a way to pass the args by reference
via func_get_args and register the out put from call_user_func_array
to the caller scope.. any idea?
here goes few lines which i'm trying hard for past 48 hours.. with no luck.. :(
class stmt {
private $stmt;
public function bind_result() {
$argsToBindResult = func_get_args();
$argList = array($this->stmt);
$argList = array_merge($argList, $argsToBindResult);
call_user_func_array('mysqli_stmt_bind_result', $argList);
}
}
$stmt->prepare('SELECT name,email FROM users WHERE id = ?');
$stmt->bind_param('i',2);
.. ..
$stmt->bind_result($name,$email);
echo $name,$email;
--- End Message ---
--- Begin Message ---
viraj wrote:
hi all,
i'm trying to write a wrapper function for "mysqli_stmt_bind_results".
and expect it to work the same way it accepts and bind results to the
original function.
the problem is, i couldn't find a way to pass the args by reference
via func_get_args and register the out put from call_user_func_array
to the caller scope.. any idea?
here goes few lines which i'm trying hard for past 48 hours.. with no luck.. :(
class stmt {
private $stmt;
public function bind_result() {
$argsToBindResult = func_get_args();
$argList = array($this->stmt);
$argList = array_merge($argList, $argsToBindResult);
call_user_func_array('mysqli_stmt_bind_result', $argList);
}
}
$stmt->prepare('SELECT name,email FROM users WHERE id = ?');
$stmt->bind_param('i',2);
.. ..
$stmt->bind_result($name,$email);
echo $name,$email;
You're out of luck for using the func_get_args() call. The following
method (albeit a dirty method) works:
<?php
function bind_stuff( &$arg1, &$arg2=null, &$arg3=null, &$arg4=null,
&$arg5=null, &$arg6=null, &$arg7=null, &$arg8=null, &$arg9=null )
{
for( $i = 1; $i <= 9; $i++ )
{
${'arg'.$i} = 'bound'.$i;
}
}
bind_stuff( $name, $email );
echo $name."\n";
echo $email."\n";
?>
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
thanks rob!
here goes the working method.
public function bind_result(&$arg1=null,&$arg2=null,&$arg3=null) {
$numArgs = func_num_args();
$args = array();
for ($i=1; $i<= $numArgs; $i++) {
$args['arg' . $i] = &${'arg'.$i};
}
call_user_func_array('mysqli_stmt_bind_result',array_merge(array($this->stmt),$args));
}
$stmt->bind_result($id, $test);
$stmt->fetch();
echo $id, $test;
~viraj
On Wed, Jan 6, 2010 at 10:01 AM, Robert Cummings <rob...@interjinn.com> wrote:
> viraj wrote:
>>
>> hi all,
>> i'm trying to write a wrapper function for "mysqli_stmt_bind_results".
>> and expect it to work the same way it accepts and bind results to the
>> original function.
>>
>> the problem is, i couldn't find a way to pass the args by reference
>> via func_get_args and register the out put from call_user_func_array
>> to the caller scope.. any idea?
>>
>> here goes few lines which i'm trying hard for past 48 hours.. with no
>> luck.. :(
>>
>> class stmt {
>> private $stmt;
>>
>> public function bind_result() {
>> $argsToBindResult = func_get_args();
>> $argList = array($this->stmt);
>> $argList = array_merge($argList, $argsToBindResult);
>> call_user_func_array('mysqli_stmt_bind_result', $argList);
>> }
>> }
>>
>> $stmt->prepare('SELECT name,email FROM users WHERE id = ?');
>> $stmt->bind_param('i',2);
>> .. ..
>> $stmt->bind_result($name,$email);
>> echo $name,$email;
>
> You're out of luck for using the func_get_args() call. The following method
> (albeit a dirty method) works:
>
> <?php
>
> function bind_stuff( &$arg1, &$arg2=null, &$arg3=null, &$arg4=null,
> &$arg5=null, &$arg6=null, &$arg7=null, &$arg8=null, &$arg9=null )
> {
> for( $i = 1; $i <= 9; $i++ )
> {
> ${'arg'.$i} = 'bound'.$i;
> }
> }
>
> bind_stuff( $name, $email );
>
> echo $name."\n";
> echo $email."\n";
>
> ?>
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
--- End Message ---
--- Begin Message ---
if func_get_args supports pass by reference, we could have avoid the
loop and pre-defined arg list.
something like..
extract(func_get_args) :D
cheers!
~viraj
On Wed, Jan 6, 2010 at 11:04 AM, viraj <kali...@gmail.com> wrote:
> thanks rob!
>
> here goes the working method.
>
> public function bind_result(&$arg1=null,&$arg2=null,&$arg3=null) {
> $numArgs = func_num_args();
> $args = array();
> for ($i=1; $i<= $numArgs; $i++) {
> $args['arg' . $i] = &${'arg'.$i};
> }
>
>
> call_user_func_array('mysqli_stmt_bind_result',array_merge(array($this->stmt),$args));
> }
>
> $stmt->bind_result($id, $test);
> $stmt->fetch();
> echo $id, $test;
>
> ~viraj
>
>
> On Wed, Jan 6, 2010 at 10:01 AM, Robert Cummings <rob...@interjinn.com> wrote:
>> viraj wrote:
>>>
>>> hi all,
>>> i'm trying to write a wrapper function for "mysqli_stmt_bind_results".
>>> and expect it to work the same way it accepts and bind results to the
>>> original function.
>>>
>>> the problem is, i couldn't find a way to pass the args by reference
>>> via func_get_args and register the out put from call_user_func_array
>>> to the caller scope.. any idea?
>>>
>>> here goes few lines which i'm trying hard for past 48 hours.. with no
>>> luck.. :(
>>>
>>> class stmt {
>>> private $stmt;
>>>
>>> public function bind_result() {
>>> $argsToBindResult = func_get_args();
>>> $argList = array($this->stmt);
>>> $argList = array_merge($argList, $argsToBindResult);
>>> call_user_func_array('mysqli_stmt_bind_result', $argList);
>>> }
>>> }
>>>
>>> $stmt->prepare('SELECT name,email FROM users WHERE id = ?');
>>> $stmt->bind_param('i',2);
>>> .. ..
>>> $stmt->bind_result($name,$email);
>>> echo $name,$email;
>>
>> You're out of luck for using the func_get_args() call. The following method
>> (albeit a dirty method) works:
>>
>> <?php
>>
>> function bind_stuff( &$arg1, &$arg2=null, &$arg3=null, &$arg4=null,
>> &$arg5=null, &$arg6=null, &$arg7=null, &$arg8=null, &$arg9=null )
>> {
>> for( $i = 1; $i <= 9; $i++ )
>> {
>> ${'arg'.$i} = 'bound'.$i;
>> }
>> }
>>
>> bind_stuff( $name, $email );
>>
>> echo $name."\n";
>> echo $email."\n";
>>
>> ?>
>>
>> Cheers,
>> Rob.
>> --
>> http://www.interjinn.com
>> Application and Templating Framework for PHP
>>
>
--- End Message ---
--- Begin Message ---
viraj wrote:
if func_get_args supports pass by reference, we could have avoid the
loop and pre-defined arg list.
something like..
extract(func_get_args) :D
Absolute! I'm not sure why there isn't some kind of way to retrieve a
reference in this manner, but I suspect it's related to knowing which
parameters were set as reference appropriate values. For instance
contrast the following:
bind_stuff( $id, $test );
Versus the following:
bind_stuff( 5, $test );
Defining the function parameters to use references will generate a fatal
error when 5 is passed since this is a fatal error. How then to enable
variable args to achieve the same result? I guess one could ask PHP to
support something like the following:
$args = func_bind_args( array( true, true ) );
Where $args would then contain a reference where the corresponding index
was set to true in the argument list. Since this isn't very variable,
then the last index set would denote the default for all other args.
Thus the example above could be shortened:
$args = func_bind_args( array( true ) );
Or even:
$args = func_bind_args( true );
Since this is run-time too, then PHP could generate an E_WARNING instead
of E_FATAL and bind a copy instead when no reference was passed.
On further thought, the current func_get_args() could be adapted in this
manner since it currently accepts no arguments.
Anyways... just thoughts. I hit this problem in the past too :)
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
I Edited only the httpd.conf file and the changes I made were
Added: LoadModule php5_module "C:/PHP/php-5.2.12/php5apache2_2.dll"
Changed DocumentRoot and Directory from htdocs to test: DocumentRoot
"C:/Program Files/Apache Software Foundation/Apache2.2/test" and <Directory
"C:/Program Files/Apache Software Foundation/Apache2.2/test">
Added the following
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType image/x-icon .ico
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
There is no php.ini file in PHP installation directory or WINDOWS or
anywhere, there is only the original php.ini-dist and -recommended
But apart from the above PHP works fine.
And also when the URL http://localhost/test is entered the output message is
> Not Found
>
> The requested URL /test was not found on this server.
>
But when a file name residing in the test directory is entered the expected
output is given.
Why is the set of files in the test directory not listed in the browser
output.
--- End Message ---
--- Begin Message ---
Varuna Seneviratna wrote:
I Edited only the httpd.conf file and the changes I made were
Added: LoadModule php5_module "C:/PHP/php-5.2.12/php5apache2_2.dll"
Yes, this is completely do-able. If php cannot find a php.ini file, it uses the defaults it was
compiled with.
Changed DocumentRoot and Directory from htdocs to test: DocumentRoot
"C:/Program Files/Apache Software Foundation/Apache2.2/test" and <Directory
"C:/Program Files/Apache Software Foundation/Apache2.2/test">
Added the following
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType image/x-icon .ico
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
There is no php.ini file in PHP installation directory or WINDOWS or
anywhere, there is only the original php.ini-dist and -recommended
But apart from the above PHP works fine.
And also when the URL http://localhost/test is entered the output message is
Not Found
The requested URL /test was not found on this server.
if your DocumentRoot is set to "C:/Program Files/Apache Software Foundation/Apache2.2/test", then
all you need to do is access http://localhost/ and it will serve up the files from the "C:/Program
Files/Apache Software Foundation/Apache2.2/test" directory.
But when a file name residing in the test directory is entered the expected
output is given.
Not sure what you mean by this. Please provide an example.
Why is the set of files in the test directory not listed in the browser
output.
Because you are trying to look for a file or folder called test in the "C:/Program Files/Apache
Software Foundation/Apache2.2/test" directory.
Jim
--
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
--- End Message ---
--- Begin Message ---
Thanks all, for the responses and advice.
After much research and trying out we decided to go with:
http://www.fengoffice.com/
its PHP based and also uses the EXTJS library. Its got quite a lot of
features (calendar, tasks, email, notes, documents, reporting) etc... with a
great AJAX interface and good functionality.
Regards
Angelo
http://www.wapit.co.za
http://www.elemental.co.za
-----Original Message-----
From: Gaurav Kumar [mailto:kumargauravjuke...@gmail.com]
Sent: 18 December 2009 10:34 AM
To: Robert Cummings
Cc: Angelo Zanetti; php-gene...@lists.php.net
Subject: Re: [PHP] Open source project management tool - PHP
OK one more the list http://dotproject.net/
Its a nice one with all project management features. Easy to use. Just
checkout the website.
Gaurav Kumar
blog.oswebstudio.com
On Fri, Dec 18, 2009 at 12:16 AM, Robert Cummings
<rob...@interjinn.com>wrote:
> Angelo Zanetti wrote:
>
>> Hi guys
>> I would like to know what open source project management tools you use
for
>> your projects.
>>
>> We are looking at installing one that is PHP based and is easy to use.
>>
>> We have found:
>> http://www.projectpier.org/
>>
>> and
>>
>> http://trac.edgewall.org/
>>
>>
>> Has anyone used the above and how did you find them? Also are there any
>> others you would recommend or not recommend and why?
>>
>
> I use Mantis for most bug tracking needs. However, I've recently rolled
out
> OpenGoo for a couple of different clients.
>
> http://fengoffice.com/web/community/community_index.php
>
> 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
>
>
--- End Message ---