php-general Digest 15 May 2009 11:46:21 -0000 Issue 6122

Topics (messages 292594 through 292609):

PHP Email Setup problem
        292594 by: Moses
        292597 by: Shawn McKenzie

Re: suggestion required
        292595 by: Nathan Rixham
        292609 by: Pravinc

Re: Software to read/write Excel to CD?
        292596 by: Nathan Rixham
        292603 by: Matt Graham
        292607 by: Peter Ford

Re: php ssl connection timeout issue
        292598 by: Nathan Rixham
        292599 by: Jerry Zhao
        292600 by: Nathan Rixham
        292601 by: Jerry Zhao
        292602 by: Nathan Rixham

Re: php & html integration
        292604 by: Michael A. Peters
        292608 by: Robert Cummings

auto suggest alternate properties in class
        292605 by: Daevid Vincent

Parse ini file problem
        292606 by: Thodoris

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 ---
Hi Everyone

I have tried to configure my php.in file so as allow me to send email in PHP
from local server.
I added the lines in php.ini file
  sendmail_path = /usr/sbin/sendmail -t
  sendmail_from = n...@localhost

Therafter restarted my apache by:

sudo /etc/init.d/apache2 restart

However, I get the following error when I restart mt apache

  apache2: Could not reliably determine the server's fully qualified domain
name, using 12... for ServerName

Thanks.

Moses

--- End Message ---
--- Begin Message ---
Moses wrote:
> Hi Everyone
> 
> I have tried to configure my php.in file so as allow me to send email in PHP
> from local server.
> I added the lines in php.ini file
>   sendmail_path = /usr/sbin/sendmail -t
>   sendmail_from = n...@localhost
> 
> Therafter restarted my apache by:
> 
> sudo /etc/init.d/apache2 restart
> 
> However, I get the following error when I restart mt apache
> 
>   apache2: Could not reliably determine the server's fully qualified domain
> name, using 12... for ServerName
> 
> Thanks.
> 
> Moses
> 

That has nothing to do with PHP or sendmail, it's in the Apache conf.
You would see this whether you configured sendmail or not.  AFAIK it's
not a problem, especially on a dev box.

-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---
Pravinc wrote:
Hey all,

I have one flex+PHP application.

Main purpose of the site is to sell T-shirts online.

Flex is used for generating different designs on available tshirt.

Something similar to Cafepress dot com.

I want to generate 300 DPI tshirt image from flex and send it to PHP side
for processing.

Now the question is Flex doen't support direct image generation.

So flex send's a Bytearray for 300 dpi image which is quite Bigger.some time
it crashes the browser while processing..because of heavy data..

And can not store in any of MySQL datatype.

Also storing in a txt file is too much time taking process..

Any Suggestion or help to come out fron this issue..


Hi,

ByteArray should be fine, simply ensure you pack it before sending, then unpack it and read the floats back out with php to get the pixel values, you can then recompile with gd or suchlike (set pixel methods) and save as an image.

Your alternative is to go with flash player 10 specific action script 3 and use vectors or fxg (on this note there are also some svg parsers for action script, 3rd party for fp9) - this approach will give you the same results but substantially less bytesize - whilst giving you no loss in quality seeing as they are vectors)

one recommendation I would make is to use display objects throughout the process clientside, then BitmapData.draw( DisplayObject ) to a BitmapData, then getPixels on that to get your bytearray at the last minute.

If you really come up short you can look at using alchemy to embed some C processing code in there, it really speeds up the process of working with huge ByteArrays as the c code is preoptimised and runs much faster.

Many Regards,

Nathan

--- End Message ---
--- Begin Message ---
Hey thanks for your quick reply,

Here is what i have done


This is my flex code
====================

var issFront:ImageSnapshot =
ImageSnapshot.captureImage(_model.productDesigner._boundingBox, dpi, new
PNGEncoder(), false);
var ba:ByteArray = issFront.data;
ba.compress();
jpegBackProcessParams.jpegstreamFront = ba;


first capturing image then converting into bytearray
then compressing and then sending this parameter to PHP side using AMF-PHP

This is my PHP side Code
========================

1# way
========
$data = $data["jpegstreamFront"];
$data = $data->data;
$data = @gzuncompress($data);
@file_put_contents("../../pictures_final/hello.png",$data);


2# way
========
$data = $data["jpegstreamFront"];
$data = $data->data;
$data = @gzuncompress($data);$fp =
@fopen("../../pictures_final/hello.txt","w+");
@fwrite($fp,$data,strlen($data));
@fclose($fp);


1# way
========
I tried generating Image directly from byte array ...

2# way
========
I tried second way to store the byte array in text file and then generate
300 DPI image using file operation and file_put_contents ......


In both case 
when Flex sends 300 Dpi size image around(2600x3000)
And data depending upon the design in Image......
And the browser get hang...


The issue is with sending Flex data to PHP side....
Once I got byte array data in PHP side its not a big deal to generate
image..



Regards
Pravin Chhasatiya 

-----Original Message-----
From: Nathan Rixham [mailto:nrix...@gmail.com] 
Sent: Friday, May 15, 2009 3:21 AM
To: Pravinc
Cc: php-gene...@lists.php.net
Subject: Re: suggestion required

Pravinc wrote:
> Hey all,
> 
> I have one flex+PHP application.
> 
> Main purpose of the site is to sell T-shirts online.
> 
>  
> 
> Flex is used for generating different designs on available tshirt.
> 
> Something similar to Cafepress dot com.
> 
>  
> 
> I want to generate 300 DPI tshirt image from flex and send it to PHP side
> for processing.
> 
> Now the question is Flex doen't support direct image generation.
> 
> So flex send's a Bytearray for 300 dpi image which is quite Bigger.some
time
> it crashes the browser while processing..because of heavy data..
> 
>  
> 
> And can not store in any of MySQL datatype.
> 
> Also storing in a txt file is too much time taking process..
> 
>  
> 
> Any Suggestion or help to come out fron this issue..
> 

Hi,

ByteArray should be fine, simply ensure you pack it before sending, then 
unpack it and read the floats back out with php to get the pixel values, 
you can then recompile with gd or suchlike (set pixel methods) and save 
as an image.

Your alternative is to go with flash player 10 specific action script 3 
and use vectors or fxg (on this note there are also some svg parsers for 
action script, 3rd party for fp9) - this approach will give you the same 
results but substantially less bytesize - whilst giving you no loss in 
quality seeing as they are vectors)

one recommendation I would make is to use display objects throughout the 
process clientside, then BitmapData.draw( DisplayObject ) to a 
BitmapData, then getPixels on that to get your bytearray at the last minute.

If you really come up short you can look at using alchemy to embed some 
C processing code in there, it really speeds up the process of working 
with huge ByteArrays as the c code is preoptimised and runs much faster.

Many Regards,

Nathan


--- End Message ---
--- Begin Message ---
Paul M Foster wrote:
On Thu, May 14, 2009 at 03:22:12PM -0500, Skip Evans wrote:

Hey all,

I'm inheriting a project that was unsuccessfully off-shored
and is now in such bad shape (I've seen the code. It's awful)
that they are firing the off-shore company and starting over.

One of the things the other company said was possible, and I'm
not familiar with... if I understand correctly, is to create a
CD with not just an Excel spreadsheet, but software on that CD
that when placed in another computer will open the
spreadsheet, allow it to be modified and rewritten back to the CD.

This is part of the requirements.

Does anyone know of such software and its name?

Maybe offshore, but not here. There are only two possibilities. First
include a copy of Excel on the CD and somehow make it autorun. Yeah,
Microsoft would *love* that. Second, include some other program which
would do the same thing. Good luck with that.

And now the kicker-- write the spreadsheet back to CD. Okay, maybe, if
it's a CD-RW. But who's going to pay attention to that little detail?
And as far as I know, writing to a CD is far more complicated than
writing to a hard drive. You can't overwrite data on a CD-RW. Once
written, it's written. You have to cover up the section that was written
to (in software), and then write the contents again. Eventually, you'll
run out of room. And it almost necessitates having a copy of some
CD-writing software on the CD, since there may not be such software on
the client machine. And all this assumes the user is running Windows.
The binaries for one OS won't run on a different OS.

Now, watch. Someone will get on and say, "Oh sure, you can do that with
such-and-such software. I did it the other day." In which case, just
forget I said anything. ;-}

Paul


or take the easy approach and use a memory card instead - or better yet inform them that you are a web developer and in these crazy modern times you can actually do this online or even "save to the internet" - crazy as it may seem.

and finally, the offshore company was fired for a reason, just say "no they were talking bollocks but we can offer you x y and z"

google spreadsheets

--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
> Paul M Foster wrote:
>> On Thu, May 14, 2009 at 03:22:12PM -0500, Skip Evans wrote:
>>> One of the things the other company said was possible, and I'm
>>> not familiar with... if I understand correctly, is to create a
>>> CD with not just an Excel spreadsheet, but software on that CD
>>> that when placed in another computer will open the
>>> spreadsheet, allow it to be modified and rewritten back to the CD.

It has to be a CD-RW, the CD-RW has to be in UDF format, and the host
machine has to be able to read and rewrite CD-RWs in UDF.  This is
actually not that tough to arrange--it just has nothing to do with
PHP.  'DozeXP should be able to do this, and Linux will do this if the
right kernel options are on.  Don't know about OS X.

>> Second, include some other program which
>> would do the same thing. Good luck with that.

OOO Calc, which should be just fine for basic tasks and is Free.

>> And now the kicker-- write the spreadsheet back to CD. Okay, maybe, if
>> it's a CD-RW. But who's going to pay attention to that little detail?
>> And as far as I know, writing to a CD is far more complicated than
>> writing to a hard drive. You can't overwrite data on a CD-RW.

UDF, which has been a standard for quite some time, allows this.  The
main thing you lose is some space on the CD-RW.

>I've never heard of anything like that, there are so many unknown
>variables that I would really feel for the poor team who had to take
>that project on!

It sounds like whoever defined the requirements was trying to solve a
problem in the wrong way.  Why drag physical media into this when you
have the Net available?  And if the clients don't have the Net
available, *why not*?

-- 
Matt G / Dances With Crows
The Crow202 Blog:  http://crow202.org/wordpress/
There is no Darkness in Eternity/But only Light too dim for us to see



--- End Message ---
--- Begin Message ---
Matt Graham wrote:
> Ashley Sheridan wrote:
>> Paul M Foster wrote:
>>> On Thu, May 14, 2009 at 03:22:12PM -0500, Skip Evans wrote:
>>>> One of the things the other company said was possible, and I'm
>>>> not familiar with... if I understand correctly, is to create a
>>>> CD with not just an Excel spreadsheet, but software on that CD
>>>> that when placed in another computer will open the
>>>> spreadsheet, allow it to be modified and rewritten back to the CD.
> 
> It has to be a CD-RW, the CD-RW has to be in UDF format, and the host
> machine has to be able to read and rewrite CD-RWs in UDF.  This is
> actually not that tough to arrange--it just has nothing to do with
> PHP.  'DozeXP should be able to do this, and Linux will do this if the
> right kernel options are on.  Don't know about OS X.
> 
>>> Second, include some other program which
>>> would do the same thing. Good luck with that.
> 
> OOO Calc, which should be just fine for basic tasks and is Free.
> 
>>> And now the kicker-- write the spreadsheet back to CD. Okay, maybe, if
>>> it's a CD-RW. But who's going to pay attention to that little detail?
>>> And as far as I know, writing to a CD is far more complicated than
>>> writing to a hard drive. You can't overwrite data on a CD-RW.
> 
> UDF, which has been a standard for quite some time, allows this.  The
> main thing you lose is some space on the CD-RW.
> 
>> I've never heard of anything like that, there are so many unknown
>> variables that I would really feel for the poor team who had to take
>> that project on!
> 
> It sounds like whoever defined the requirements was trying to solve a
> problem in the wrong way.  Why drag physical media into this when you
> have the Net available?  And if the clients don't have the Net
> available, *why not*?
> 


It *is* possible to be offline, and so far from anywhere that the only com links
are to satellites... (expensive).

I suspect that a USB key is a better option (and more physically portable) than
a UFB CD.

But why write an Excel spreadsheet - why not save the data in something more
portable like CSV that ExCel and read and write to once you are back at base?



-- 
Peter Ford                              phone: 01580 893333
Developer                               fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

--- End Message ---
--- Begin Message ---
Jerry Zhao wrote:
Hi,

I am having trouble connecting to https sites using php's builtin ssl
functions.
I tried:
file_get_contents('https://securesite')
fsockopen('ssl://securesite', 443, $errno, $errstr,20)

and same errors every time:
SSL: connection timeout
Failed to enable crypto

Call to openssl_error_string() returns no error.
Curl worked both within php and as standalone client.
The strange thing is that the connection seemed to be dropped immediately
upon contact with the server, i.e., the call to the above functions failed
immediately, which I think contradicts the "timeout" error.

Any tips on the cause of this issue or how to debug this is appreciated.

Regards,

Jerry.


assuming you've checked for mod_ssl and tried connecting up to an ssl server you know works fine?

then check for bad ssl certificates on the remote server.

--- End Message ---
--- Begin Message ---
I tried different combination of ssl clients and servers, it all points to
problems on the client side of my new php build. The same code worked on an
older php build.


On Thu, May 14, 2009 at 4:57 PM, Nathan Rixham <nrix...@gmail.com> wrote:

> Jerry Zhao wrote:
>
>> Hi,
>>
>> I am having trouble connecting to https sites using php's builtin ssl
>> functions.
>> I tried:
>> file_get_contents('https://securesite')
>> fsockopen('ssl://securesite', 443, $errno, $errstr,20)
>>
>> and same errors every time:
>> SSL: connection timeout
>> Failed to enable crypto
>>
>> Call to openssl_error_string() returns no error.
>> Curl worked both within php and as standalone client.
>> The strange thing is that the connection seemed to be dropped immediately
>> upon contact with the server, i.e., the call to the above functions failed
>> immediately, which I think contradicts the "timeout" error.
>>
>> Any tips on the cause of this issue or how to debug this is appreciated.
>>
>> Regards,
>>
>> Jerry.
>>
>>
> assuming you've checked for mod_ssl and tried connecting up to an ssl
> server you know works fine?
>
> then check for bad ssl certificates on the remote server.
>

--- End Message ---
--- Begin Message ---
Jerry Zhao wrote:
I tried different combination of ssl clients and servers, it all points to
problems on the client side of my new php build. The same code worked on an
older php build.


checked the output of print_r( stream_get_wrappers() );?

--- End Message ---
--- Begin Message ---
On Thu, May 14, 2009 at 5:05 PM, Nathan Rixham <nrix...@gmail.com> wrote:

> Jerry Zhao wrote:
>
>> I tried different combination of ssl clients and servers, it all points to
>> problems on the client side of my new php build. The same code worked on
>> an
>> older php build.
>>
>>
> checked the output of print_r( stream_get_wrappers() );?


 Array ( [0] => php [1] => file [2] => data [3] => http [4] => ftp [5] =>
compress.bzip2 [6] => https [7] => ftps [8] => compress.zlib )

--- End Message ---
--- Begin Message ---
Jerry Zhao wrote:
On Thu, May 14, 2009 at 5:05 PM, Nathan Rixham <nrix...@gmail.com> wrote:

Jerry Zhao wrote:

I tried different combination of ssl clients and servers, it all points to
problems on the client side of my new php build. The same code worked on
an
older php build.


checked the output of print_r( stream_get_wrappers() );?


 Array ( [0] => php [1] => file [2] => data [3] => http [4] => ftp [5] =>
compress.bzip2 [6] => https [7] => ftps [8] => compress.zlib )


so you've got ssl support, next up you visited the url in a browser to check the ssl certificate? odds are it's invalid and that an exception has been made on the old php server
--- End Message ---
--- Begin Message ---
tedd wrote:


<h1>
<?php echo("Hello World"); ?>
</h1>

and Hello World will be show as a H1 headline.

Please note, the "()" seen in my use of echo is not necessary -- it's just another one of those things that I do that no one else does. It's not wrong, but it serves no purpose other than it looks good and makes sense *to me* YMMV.

I do it that way as well.

--- End Message ---
--- Begin Message ---
On Thu, 2009-05-14 at 17:24 -0700, Michael A. Peters wrote:
> tedd wrote:
> 
> > 
> > <h1>
> > <?php echo("Hello World"); ?>
> > </h1>
> > 
> > and Hello World will be show as a H1 headline.
> > 
> > Please note, the "()" seen in my use of echo is not necessary -- it's 
> > just another one of those things that I do that no one else does. It's 
> > not wrong, but it serves no purpose other than it looks good and makes 
> > sense *to me* YMMV.
> 
> I do it that way as well.

Me too... for require and include also.

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


--- End Message ---
--- Begin Message ---
Here's a handy little routine I just wrote to suggest properties you're
trying to erroneously set that don't exist in a class. For example:

Attempted to __get() non-existant property/variable 'operator_id' in class
'User'.
 
checking for operator and suggesting the following:
 
    * id_operator
    * operator_name
    * operator_code
 
enjoy.
 
 /**
  * Suggests alternative properties should a __get() or __set() fail
  *
  * @param  string $property
  * @return string
  * @author Daevid Vincent [dae...@daevid.com]
  * @date    05/12/09
  * @see  __get(), __set(), __call()
  */
 public function suggest_alternative($property)
 {
  $parts = explode('_',$property);
  foreach($parts as $i => $p) if ($p == '_' || $p == 'id')
unset($parts[$i]);
 
  echo 'checking for <b>'.implode(', ',$parts)."</b> and suggesting the
following:<br/>\n";
 
  echo "<ul>";
     foreach($this as $key => $value)
   foreach($parts as $p)
    if (stripos($key, $p) !== false) print '<li>'.$key."</li>\n";
  echo "</ul>";
 }
 
just put it in your __get() or __set() like so:
 
 public function __get($property)
 {
      echo "<p><font color='#ff0000'>Attempted to __get() non-existant
property/variable '".$property."' in class
'".$this->get_class_name()."'.</font><p>\n";
   $this->suggest_alternative($property);
   exit;
 }


--- End Message ---
--- Begin Message --- I am trying to parse an ini conf file using parse_ini_file but fails without returning something. I found this which is probably the reason:

http://bugs.php.net/bug.php?id=44544

(the $ in the values)

The problem is that this file has more than 7500 lines so it's kind of difficult to use quotes in all fields and there are several other reasons that I want to avoid quoting the values. In addition to that PHP 5.3 (which fixes this) is not stable yet and thus I can't install it in a production machine.

So does anybody know any workarounds??

--
Thodoris


--- End Message ---

Reply via email to