Re: [PHP] Creating an OO Shopping Cart

2006-05-07 Thread Porpoise


""Richard Lynch"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]




Contact the bank with which you already HAVE a merchant account for
your point-of-sale credit card swiper thingies.



You're already working with them, paying them good money for
essentially the "same" services.


Different Service



Almost-for-sure they would be happy to provide you with on-line
merchant account for not too much more than you already pay them.


Not necessarily. In shop POS services are not generally provided by the 
banks either. They are usually provided by a seperate entity (which may be 
*owned* by a bank or several banks [aka Streamline in the UK] and do not 
necessarily provide online clearance as well [Streamline don't for example]. 
There are, however, a number of organisations that do online cc clearance 
and will work in partnership with most of the offline clearing houses. Your 
existing offline clearing-house/bank will usually provide you with a list of 
these, although, they generally *won't* recommend any particular one.




If not, I'm guessing that their competitors WILL do a package deal of
on-line and POS merchant account, for the same price you're paying
now, to lure you away from your current bank.


Firstly, they are not competitors - they are business partners with your POS 
provider and provide a service in conjunction with your existing provider. 
They will not replace it - for the simple reason, these online clearance 
companies are not banks - they are online payment *clearance* companies - 
the actual payments are still conducted through your existing bank accounts.


SNIP 


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



[PHP] Passing an indefinite number of parameters by reference

2006-05-07 Thread Chris Jenkinson

Hi,

Currently I have a function which accepts a limited number of parameters:

call_function($function_name, &$var_1, &$var_2);

I wish to modify the function to accept an indefinite number of 
parameters, which may or may not be references.


The function call_function() then calls the function specified in 
$function_name, with the variables passed as parameters to that function.


Is this possible? Thanks for any help which can be offered.

Chris

--
Chris Jenkinson
[EMAIL PROTECTED]

"Mistrust all in whom the impulse to punish is powerful."
 -- Friedrich Nietzsche, Thus Spoke Zarathustra

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



Re: [PHP] Passing an indefinite number of parameters by reference

2006-05-07 Thread Jochem Maas

Chris Jenkinson wrote:

Hi,

Currently I have a function which accepts a limited number of parameters:

call_function($function_name, &$var_1, &$var_2);

I wish to modify the function to accept an indefinite number of 
parameters, which may or may not be references.


The function call_function() then calls the function specified in 
$function_name, with the variables passed as parameters to that function.


Is this possible? Thanks for any help which can be offered.


I believe it is - BUT it won't be easy, also I think you can only really do this
properly in php5 using a shedload of reflection functionality:

http://php.net/manual/en/language.oop5.reflection.php

although I wonder whether you shouldn't be re-evaluating what it is
your trying to do because I get the impression it's a whole load of work
for probably little payoff (consider that using alot of indirection in your
code will make it harder to understand/read and therefore harder to 
debug/maintain).
why not consider the possibility that all these 'by reference' args could be 
items
in a single 'by reference' array?

btw: have you met call_user_func_array() yet? (not that it
would solve the problem because it doesn't 'do' references) - also,
it's manual page offers a hack for the reference problem your working on.



Chris



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



Re: [PHP] Echo a value from an arrays position

2006-05-07 Thread Jochem Maas

Dave Goodchild wrote:

This may clarify - in php, integer and associate arrays are created
arbitrarily, ie keys can be numbers or strings. So, either create an array
like this:

array('1' => 'first element',
   '2' => 'second element');


if I'm not mistaken the above example will result in an array with
2 *numeric* keys because any strings keys that php that are numeric
(according to the logic of is_numeric()) will be seen as numeric keys.

so the above example could lead to even more confusion!



and call by the key!

On 04/05/06, Jonas Rosling <[EMAIL PROTECTED]> wrote:



Is there any way to call for an element value in an array by the 
position?

Like position 2 in the array and not the key name.

// Jonas

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





--
http://www.web-buddha.co.uk

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!



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



Re: [PHP] Passing an indefinite number of parameters by reference

2006-05-07 Thread Chris Jenkinson

Jochem Maas wrote:

although I wonder whether you shouldn't be re-evaluating what it is
your trying to do because I get the impression it's a whole load of work
for probably little payoff (consider that using alot of indirection in your
code will make it harder to understand/read and therefore harder to 
debug/maintain).
why not consider the possibility that all these 'by reference' args 
could be items

in a single 'by reference' array?


Yes, that would be possible, however that would involve an API change - 
as now functions would have to get their variables out of an array 
rather than just a normal variable defined in the function. At the 
moment I've just decided to add more $var_x parameters.



btw: have you met call_user_func_array() yet? (not that it
would solve the problem because it doesn't 'do' references) - also,
it's manual page offers a hack for the reference problem your working on.


Yes, I briefly considered using it. Another method I tried was building 
a list of parameters and using eval() to call the function. Since I 
can't get the variables by reference, however, I've stuck with just 
passing $var_1, $var_2, etc. to the function.


Thanks for your comments. I think the amount of effort I would spend 
learning how to use the reflection API compared to just using a defined 
number of variables labelled in sequence is not worth it. If there was 
another way, perhaps...


Chris

--
Chris Jenkinson
[EMAIL PROTECTED]

"Mistrust all in whom the impulse to punish is powerful."
 -- Friedrich Nietzsche, Thus Spoke Zarathustra

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



Re: [PHP] Passing an indefinite number of parameters by reference

2006-05-07 Thread Jochem Maas

Chris Jenkinson wrote:

Jochem Maas wrote:


although I wonder whether you shouldn't be re-evaluating what it is
your trying to do because I get the impression it's a whole load of work
for probably little payoff (consider that using alot of indirection in 
your
code will make it harder to understand/read and therefore harder to 
debug/maintain).
why not consider the possibility that all these 'by reference' args 
could be items

in a single 'by reference' array?



Yes, that would be possible, however that would involve an API change - 
as now functions would have to get their variables out of an array 
rather than just a normal variable defined in the function. At the


extract() and compact() would be your friends.


moment I've just decided to add more $var_x parameters.


that smells like bad design (but then again you should see some of my code ;-)




btw: have you met call_user_func_array() yet? (not that it
would solve the problem because it doesn't 'do' references) - also,
it's manual page offers a hack for the reference problem your working on.



Yes, I briefly considered using it. Another method I tried was building 
a list of parameters and using eval() to call the function. Since I 
can't get the variables by reference, however, I've stuck with just 
passing $var_1, $var_2, etc. to the function.


Thanks for your comments. I think the amount of effort I would spend 
learning how to use the reflection API compared to just using a defined 
number of variables labelled in sequence is not worth it. If there was 
another way, perhaps...


i can say with confidence 'no, your  out of luck'.


Chris



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



Re: [PHP] Passing an indefinite number of parameters by reference

2006-05-07 Thread Eric Butera

On 5/7/06, Chris Jenkinson <[EMAIL PROTECTED]> wrote:

Hi,

Currently I have a function which accepts a limited number of parameters:

call_function($function_name, &$var_1, &$var_2);

I wish to modify the function to accept an indefinite number of
parameters, which may or may not be references.

The function call_function() then calls the function specified in
$function_name, with the variables passed as parameters to that function.

Is this possible? Thanks for any help which can be offered.

Chris

--
Chris Jenkinson
[EMAIL PROTECTED]

"Mistrust all in whom the impulse to punish is powerful."
  -- Friedrich Nietzsche, Thus Spoke Zarathustra

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



One thing you could do is (assuming it's php4)

';
   print_r($array);
   echo '';
}

function call_function($name, &$params) {
   call_user_func($name, $params);
}



function test(&$params) {
   extract($params, EXTR_REFS);
   printArray($myarray1);
   printArray($myarray2);
   // prove this is a reference by modifying it
   $myarray2 = array('one', 'two', 'three');
}

$myarray1 = array(3, 6, 9);
$myarray2 = array('two', 'four', 'six');
$myParams['myarray1'] =& $myarray1;
$myParams['myarray2'] =& $myarray2;

call_function('test', $myParams);

// myarray2 now has the values set in test
printArray($myarray2);

?>


Output:

Array
(
   [0] => 3
   [1] => 6
   [2] => 9
)

Array
(
   [0] => two
   [1] => four
   [2] => six
)

Array
(
   [0] => one
   [1] => two
   [2] => three
)


This is a bit of a pain though. :)

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



[PHP] Convert from jpg to gif ... change dpi...

2006-05-07 Thread Gustav Wiberg

Hi there!

Is there any way of converting a jpg to gif and change dpi on the fly?

Best regards
Gustav Wiberg

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



Re: [PHP] Convert from jpg to gif ... change dpi...

2006-05-07 Thread Rory Browne
imagemagick?

On 5/7/06, Gustav Wiberg <[EMAIL PROTECTED]> wrote:
>
> Hi there!
>
> Is there any way of converting a jpg to gif and change dpi on the fly?
>
> Best regards
> Gustav Wiberg
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Passing an indefinite number of parameters by reference

2006-05-07 Thread Tom Rogers
Hi,

Monday, May 8, 2006, 4:20:11 AM, you wrote:
CJ> Hi,

CJ> Currently I have a function which accepts a limited number of parameters:

CJ> call_function($function_name, &$var_1, &$var_2);

CJ> I wish to modify the function to accept an indefinite number of 
CJ> parameters, which may or may not be references.

CJ> The function call_function() then calls the function specified in 
CJ> $function_name, with the variables passed as parameters to that function.

CJ> Is this possible? Thanks for any help which can be offered.

CJ> Chris

Here is a cutdown version of a class loader I use, It works for php4 and
php5 and with references. It should be easy to modify.

 1) {
for ($i = 1; $i < $num_args; $i++) {
  $vars .= ($i > 1)? ',':'';
  $varname = 'variable'.$i;
  $$varname =& $arg_list[$i];
  $vars .= "\$$varname";
}
  }
  $vars .= ');';
  eval($vars);
  return $return;
}
?>

-- 
regards,
Tom

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



[PHP] Socket Functions in PHP

2006-05-07 Thread Oliver John V. Tibi

Hi all,

I suspect I'm having problems with socket functions within my PHP 
application running on Red Hat 2.4.21-4.EL #1/PHP 4.3.2/Apache 2.0.46.


Below is a sample code listing:



function sendRequest($strRequest) {
$parser = NULL;
$logman = new LogManager();

$resource = socket_create( AF_INET, SOCK_STREAM, SOL_TCP );
$logman->append("Connecting to OLS Server...");
$socket_conn = socket_connect( $resource, $serverIP, $serverPort );
if( $socket_conn ) {
		$logman->append("Connected to {$serverIP}:{$serverPort}. Sending XML 
request...");

socket_write( $resource, $strRequest );
$logman->append("XML request sent. Waiting for XML 
response...");
$document = "";
$data = socket_read( $resource, 1024 );

while ($data != "") {
$document .= $data;
$data = socket_read( $resource, 1024 );
}
$logman->append("XML response received.");

$parser = new OlsResponseParser;
// parse the received document using our parser
$parser->parse($document);
}

if ($parser != NULL) {
return $parser->getOlsResponse();
}

return $parser;
}


The following listing is from the logs I have created...


|+---+-++
| LogId | LogDate | LogMessage 
   |

+---+-++
|37 | 2006-05-03 15:39:28 | /new_userpage_process.php initialized. 
Creating buffer...  |
|38 | 2006-05-03 15:39:28 | Connecting to OLS Server... 
|
|39 | 2006-05-03 15:39:28 | Connected to (server):(port). Sending 
XML request... |
|40 | 2006-05-03 15:39:28 | XML request sent. Waiting for XML 
response...  |
|41 | 2006-05-03 15:40:34 | XML response received. 
   |
|42 | 2006-05-03 15:40:34 | Buffering complete. Redirecting to 
thanks.php?actiontype=2 |

+---+-++

 

As you can see, there is a lapse of more than one minutes between 
LogId's 40 and 41, which is very slow on a production environment. The 
script above acts as a client to another application server listening on 
a remote port, running on Java. What the remote application reports is 
that it receives the connection request, receives the request data, and 
transmits the response data at the same second, while my application 
receives the response one minute after the request was sent!


Other implementations in the enterprise using different architectures 
and technologies/languages do not experience the same issue as my app does.


Please help. Comments, suggestions and thoughts through the group or 
private mail are deeply appreciated.


Thanks!
--
Oliver John V. Tibi
Software Programmer/Web Application Developer
IAMD Software Solutions
[EMAIL PROTECTED]
"Live free() or die()."

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