php-general Digest 14 Nov 2009 21:30:26 -0000 Issue 6442

2009-11-14 Thread php-general-digest-help

php-general Digest 14 Nov 2009 21:30:26 - Issue 6442

Topics (messages 299815 through 299822):

Re: is Aptana taking a crap on the face of PHP?
299815 by: Daevid Vincent

Re: creating combobox in excel sheet?
299816 by: Kim Madsen

Re: RIGHT Function?
299817 by: sono-io.fannullone.us
299818 by: Jim Lucas
299819 by: sono-io.fannullone.us
299820 by: sono-io.fannullone.us
299821 by: Jim Lucas

exec() problem
299822 by: A. Mannini

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


--
---BeginMessage---
 -Original Message-
 From: tedd [mailto:tedd.sperl...@gmail.com] 
 Sent: Friday, November 13, 2009 6:06 AM

 You also have apps like GoLive and Dreamweaver that make excellent 
 IDE's -- you don't have to use the WYSIWYG junk.
 
 I'm learning to use Eclipse and it's great, but it doesn't handle the 
 hundreds of smaller projects together like GoLive does -- or I 
 haven't learn how to yet.

Just in case you're not clear or haven't used Aptana before. 

* It *is* an Eclipse offering (like Zend) 
* It is NOT a WYSIWYG.
* It has outstanding color-coding, way more than any other IDE I've ever
seen. 
* It Handles jQuery and other JS libraries with completion.
* It does ruby and python as well -- very convenient for someone like me who
works in all three languages.
* It has a very nice code formatter (like Zend has)
* It is FREE (unlike Zend's retarded $500 price tag).

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

Jim Lucas wrote on 2009-11-13 17:06:

Kim Madsen wrote:

Hey

I'm working on creating excel sheets from these classes:

http://articles.sitepoint.com/article/pear-spreadsheet_excel_writer/3

http://pear.php.net/package/Spreadsheet_Excel_Writer/download/

Does anyone know how to create a combo box from PHP with these (or other
classes)? By combobox I mean the select / dropdown box in HTML.



Where will your combobox reside?


In the excel sheet. Let me clarify my last posting:

By combobox I mean _like_ the select / dropdown box _is made_ in HTML.


What will your combobox contain/display?


some data, could be yes, no, maybe, these 3 data should be in the 
dropdown box when the user click the arrow. I simply wanna generate the 
list I can create in OpenOffice calc by selecting 
data-validity-criteria and select list in allow then adding 
yes[enter]no[enter]maybe[enter]


What are you going to generating your combobox with?  


PHP was the thought, with data from a database


Are you wanting to build it with one of the two listed software packages?


Yes, if possible. Otherwise another class/function is also fine.

--
Kind regards
Kim Emax - masterminds.dk
---End Message---
---BeginMessage---
	I think I've solved a problem that I had posted back in September.   
Here's a recap:


==
	I need to grab a dollar amount from a text field in a MySQL db that  
can contain more information than just the price.  Here are 4 examples  
of what could be in that field:


48,(min)
2.66

24,(min)
10.50

4,(min)
104.82

98.56

	If there is more info in that field than just the price (as in the  
first 3 examples), the price is always on the 2nd line.

==

	The following code works with the tests I've given it so far, but I  
just want to double check before I go live with it:


...
if ($position = strpos($item['unitprice'], ')') )
	$price = $ . number_format(substr($item['unitprice'], $position +  
1),2);

else
$price = $ . number_format($item['unitprice'],2);
...

Legend:
$item['unitprice'] is coming from a MySQL statement

	I'm grabbing the position of the right parentheses and adding 1 to  
it.  Then the substr grabs everything from that point to the end of  
the string, correct?  If there isn't a ) in the field, then the else  
statement should be performed.


	Can anyone see any errors in my code?  Would there be a better way to  
write this?


Thanks again,
Frank
---End Message---
---BeginMessage---
sono...@fannullone.us wrote:
 I think I've solved a problem that I had posted back in September. 
 Here's a recap:
 
 ==
 I need to grab a dollar amount from a text field in a MySQL db that
 can contain more information than just the price.  Here are 4 examples
 of what could be in that field:
 
 48,(min)
 2.66
 
 24,(min)
 10.50
 
 4,(min)
 104.82
 
 98.56
 
 If there is more info in that field than just the price (as in the
 first 3 examples), the price is always on the 2nd line.
 ==
 
 The following code works with the tests I've given it so far, but I
 just want to double check before I go live with it:
 
 ...
 if ($position = strpos($item['unitprice'], ')') )
 $price 

[PHP] exec() problem

2009-11-14 Thread A. Mannini

 Hi all,

i've a problem using exec() on a Linux server with PHP 5.2.9 on Apache 
2.2.13. Safe mode is OFF and Apache isn't chrooted.


I would run /usr/lib/mailman/bin/find_member -l list email so i used 
exec(sudo run /usr/lib/mailman/bin/find_member -l list 
email,$output) and set /etc/sudoers with apache ALL=NOPASSWD: 
/usr/lib/mailman/bin/find_memberbut it doesn't work.


I tried simple commands /bin/ls works, sudo -V work but sudo 
/bin/ls doesn't work.


I get return code 1 and no messages in logs..

What is worng?

Thanks

Alessandro

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



Re: [PHP] exec() problem

2009-11-14 Thread Ashley Sheridan
On Sat, 2009-11-14 at 22:20 +0100, A. Mannini wrote:

 Hi all,
 
 i've a problem using exec() on a Linux server with PHP 5.2.9 on Apache 
 2.2.13. Safe mode is OFF and Apache isn't chrooted.
 
 I would run /usr/lib/mailman/bin/find_member -l list email so i used 
 exec(sudo run /usr/lib/mailman/bin/find_member -l list 
 email,$output) and set /etc/sudoers with apache ALL=NOPASSWD: 
 /usr/lib/mailman/bin/find_memberbut it doesn't work.
 
 I tried simple commands /bin/ls works, sudo -V work but sudo 
 /bin/ls doesn't work.
 
 I get return code 1 and no messages in logs..
 
 What is worng?
 
 Thanks
 
 Alessandro
 


Did you mean to put 'run' into the exec call?

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] exec() problem

2009-11-14 Thread A. Mannini

 Hi all,

i've a problem using exec() on a Linux server with PHP 5.2.9 on Apache
2.2.13. Safe mode is OFF and Apache isn't chrooted.

I would run /usr/lib/mailman/bin/find_member -l list email so i used
exec(sudo run /usr/lib/mailman/bin/find_member -l list
email,$output) and set /etc/sudoers with apache ALL=NOPASSWD:
/usr/lib/mailman/bin/find_memberbut it doesn't work.

I tried simple commands /bin/ls works, sudo -V work but sudo
/bin/ls doesn't work.

I get return code 1 and no messages in logs..

What is worng?

Thanks

Alessandro

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



Re: [PHP] exec() problem

2009-11-14 Thread A. Mannini

Ashley Sheridan ha scritto:


Have you checked to ensure that the exec is actually running at all? 
Check the error logs to see what they say. There may be a problem with 
the string argument for exec(), like an unescaped character that is 
causing an issue


Thanks,
Ash
http://www.ashleysheridan.co.uk




Yes i had no messages in Apache logs so i tried to use error_log in 
php.ini but again no messages.
Don't know if there is a way to see what php module interpeter and try 
to execute.


Thanks

Alessandro

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



Re: [PHP] exec() problem

2009-11-14 Thread Ashley Sheridan
On Sun, 2009-11-15 at 00:06 +0100, A. Mannini wrote:

 Ashley Sheridan ha scritto:
 
  Have you checked to ensure that the exec is actually running at all? 
  Check the error logs to see what they say. There may be a problem with 
  the string argument for exec(), like an unescaped character that is 
  causing an issue
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 
 Yes i had no messages in Apache logs so i tried to use error_log in 
 php.ini but again no messages.
 Don't know if there is a way to see what php module interpeter and try 
 to execute.
 
 Thanks
 
 Alessandro
 


I think for something like that, you should be looking at your system
logs, as that's likely where the errors would log.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] exec() problem

2009-11-14 Thread A. Mannini

Ashley Sheridan ha scritto:

On Sun, 2009-11-15 at 00:06 +0100, A. Mannini wrote:


Ashley Sheridan ha scritto:
Have you checked to ensure that the exec is actually running at all? 
Check the error logs to see what they say. There may be a problem with 
the string argument for exec(), like an unescaped character that is 
causing an issue


Thanks,
Ash
http://www.ashleysheridan.co.uk


Yes i had no messages in Apache logs so i tried to use error_log in 
php.ini but again no messages.
Don't know if there is a way to see what php module interpeter and try 
to execute.


Thanks

Alessandro




I think for something like that, you should be looking at your system
logs, as that's likely where the errors would log.

Thanks,
Ash
http://www.ashleysheridan.co.uk





Looked to all log...nothing! :-(

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



Re: [PHP] exec() problem

2009-11-14 Thread Ashley Sheridan
On Sun, 2009-11-15 at 00:25 +0100, A. Mannini wrote:

 Ashley Sheridan ha scritto:
  On Sun, 2009-11-15 at 00:06 +0100, A. Mannini wrote:
  
  Ashley Sheridan ha scritto:
  Have you checked to ensure that the exec is actually running at all? 
  Check the error logs to see what they say. There may be a problem with 
  the string argument for exec(), like an unescaped character that is 
  causing an issue
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
  Yes i had no messages in Apache logs so i tried to use error_log in 
  php.ini but again no messages.
  Don't know if there is a way to see what php module interpeter and try 
  to execute.
 
  Thanks
 
  Alessandro
 
  
  
  I think for something like that, you should be looking at your system
  logs, as that's likely where the errors would log.
  
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
  
  
  
 
 Looked to all log...nothing! :-(
 


What other logs did you look at?

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] exec() problem

2009-11-14 Thread Kim Madsen

Ashley Sheridan wrote on 2009-11-15 00:23:


Looked to all log...nothing! :-(




What other logs did you look at?


Then do this from a command line:

su - the user apache runs as

copy the command from the ph script and run it from commandline and let 
us see the error you recieve...


--
Kind regards
Kim Emax - masterminds.dk

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



Re: [PHP] exec() problem

2009-11-14 Thread A. Mannini

Ashley Sheridan ha scritto:

On Sun, 2009-11-15 at 00:06 +0100, A. Mannini wrote:


Ashley Sheridan ha scritto:
Have you checked to ensure that the exec is actually running at all? 
Check the error logs to see what they say. There may be a problem with 
the string argument for exec(), like an unescaped character that is 
causing an issue


Thanks,
Ash
http://www.ashleysheridan.co.uk


Yes i had no messages in Apache logs so i tried to use error_log in 
php.ini but again no messages.
Don't know if there is a way to see what php module interpeter and try 
to execute.


Thanks

Alessandro




I think for something like that, you should be looking at your system
logs, as that's likely where the errors would log.

Thanks,
Ash
http://www.ashleysheridan.co.uk





Ok i found that Fedora has, as default, a line Defaults requiretty in 
/etc/sudoers, i disabled that but i get a different message.


sudo: no tty present and no askpass program specified


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



Re: [PHP] exec() problem [SOLVED]

2009-11-14 Thread A. Mannini

Ashley Sheridan ha scritto:

On Sun, 2009-11-15 at 00:06 +0100, A. Mannini wrote:


Ashley Sheridan ha scritto:
Have you checked to ensure that the exec is actually running at all? 
Check the error logs to see what they say. There may be a problem with 
the string argument for exec(), like an unescaped character that is 
causing an issue


Thanks,
Ash
http://www.ashleysheridan.co.uk


Yes i had no messages in Apache logs so i tried to use error_log in 
php.ini but again no messages.
Don't know if there is a way to see what php module interpeter and try 
to execute.


Thanks

Alessandro




I think for something like that, you should be looking at your system
logs, as that's likely where the errors would log.

Thanks,
Ash
http://www.ashleysheridan.co.uk





Ok commenting out Defaults requiretty now it works!

The second message 
sudo: no tty present and no askpass program specified was due to wrong 
command issued during tests.


Many thanks

Alessandro

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



Re: [PHP] RIGHT Function?

2009-11-14 Thread sono-io


On Nov 13, 2009, at 6:34 PM, Jim Lucas wrote:

You basic problem with the PHP_EOL is that when echo'ed out, it  
represents a \n character.

The value you are working with might be \n\r or just \r


	I read the links you sent, plus some others.  It took me awhile, but  
I get it now.  If the return character that was entered into that  
field is not the same as what PHP_EOL is looking for, it won't work.



$parts = preg_split('|[\n\r]+|', $item['unitprice']);


	preg_split works perfectly!  Very similar to Perl's split function.   
Here's what I have now:


$parts = preg_split('|\s+|', $item['unitprice']);
$price = '$'.number_format((count($parts)  1) ?  
$parts[(count($parts)-1)] : $parts[0],2);


	Clean and concise.  Thanks a million, Jim!  I really appreciate your  
helpful responses.


Thanks again,
Frank

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



[PHP] File To Blob Corruption

2009-11-14 Thread Don Wieland

Hello,

I am trying to create an UPLOAD page to Update a Images and PDFs into  
a BLOB field in mySQL. The image keeps getting corrupted (it draws a  
portion of the image and the rest is GRAY) We tried it with Safari and  
Firefox with bad results.


Here is the form that is used to browse and select the file.

!-- Upload Image dialog --
div id=uploadImage
div id=llback/div
centerdiv id=uploadForm
div id=uploadTitleUpload Thumbnail image/div
iframe name=saveImage/iframe
bPlease select the thumbnail image, then press Upload./b
div style=margin-top:14px;margin-bottom:14px;text-align:center;width: 
100%
form target=saveImage method=post action=ajax/saveDialog.php  
enctype=multipart/form-data
Select Thumbnail: input type=file name=img id=img accept=image/ 
jpeg //div

input type=hidden name=obj value=uploadImage /
input type=hidden name=id value=?php echo $Area_id ? /
input type=button value=Upload  
onclick=saveDialog('uploadImage','img','jpg'); input type=button  
value=Cancel onclick=cancelDialog('uploadImage','img')

/form
/div/center
/div

Here is the QUERY to upload the image (saveDialog.php):

if($_POST['obj'] == uploadImage) {
$file = $db-real_escape_string(file_get_contents($_FILES['img'] 
['tmp_name']));

$db-query(UPDATE Areas SET Image = '$file') or die(1.$db-error);

Has anyone else ever run into this type of UPDATE error with images  
and PDF? We really need to get this dealt with ASAP.


Thanks!

Don Wieland
D W   D a t a   C o n c e p t s
~
d...@dwdataconcepts.com
Direct Line - (949) 305-2771

Integrated data solutions to fit your business needs.

Need assistance in dialing in your FileMaker solution? Check out our  
Developer Support Plan at:

http://www.dwdataconcepts.com/DevSup.html

Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro  
9 or higher

http://www.appointment10.com

For a quick overview -
http://www.appointment10.com/Appt10_Promo/Overview.html


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



Re: [PHP] File To Blob Corruption

2009-11-14 Thread German Geek
Hi, Could it have something to do with an eof character being encoded or
something like that? Do you really need to store the files in the DB? It
uses more processing power if stored in the DB because on retrieval, you
have to unescape the string and return it. Modern filesystems are optimised
better for files than databases and storing a filename and returning the
contents is easier to implement than retrieving it from the DB...

http://forums.codewalkers.com/php-applications-45/upload-image-file-to-mysql-as-blob-849194.html

++Tim Hinnerk Heuer++

http://www.ihostnz.com


2009/11/15 Don Wieland d...@dwdataconcepts.com

 Hello,

 I am trying to create an UPLOAD page to Update a Images and PDFs into a
 BLOB field in mySQL. The image keeps getting corrupted (it draws a portion
 of the image and the rest is GRAY) We tried it with Safari and Firefox with
 bad results.

 Here is the form that is used to browse and select the file.

 !-- Upload Image dialog --
 div id=uploadImage
 div id=llback/div
 centerdiv id=uploadForm
 div id=uploadTitleUpload Thumbnail image/div
 iframe name=saveImage/iframe
 bPlease select the thumbnail image, then press Upload./b
 div
 style=margin-top:14px;margin-bottom:14px;text-align:center;width:100%
 form target=saveImage method=post action=ajax/saveDialog.php
 enctype=multipart/form-data
 Select Thumbnail: input type=file name=img id=img
 accept=image/jpeg //div
 input type=hidden name=obj value=uploadImage /
 input type=hidden name=id value=?php echo $Area_id ? /
 input type=button value=Upload
 onclick=saveDialog('uploadImage','img','jpg'); input type=button
 value=Cancel onclick=cancelDialog('uploadImage','img')
 /form
 /div/center
 /div

 Here is the QUERY to upload the image (saveDialog.php):

 if($_POST['obj'] == uploadImage) {
 $file =
 $db-real_escape_string(file_get_contents($_FILES['img']['tmp_name']));
 $db-query(UPDATE Areas SET Image = '$file') or die(1.$db-error);

 Has anyone else ever run into this type of UPDATE error with images and
 PDF? We really need to get this dealt with ASAP.

 Thanks!

 Don Wieland
 D W   D a t a   C o n c e p t s
 ~
 d...@dwdataconcepts.com
 Direct Line - (949) 305-2771

 Integrated data solutions to fit your business needs.

 Need assistance in dialing in your FileMaker solution? Check out our
 Developer Support Plan at:
 http://www.dwdataconcepts.com/DevSup.html

 Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro 9 or
 higher
 http://www.appointment10.com

 For a quick overview -
 http://www.appointment10.com/Appt10_Promo/Overview.html


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




Re: [PHP] uniqid() and repetition of numbers generated

2009-11-14 Thread German Geek
2009/11/14 tedd tedd.sperl...@gmail.com

 A


Interesting thought. My idea on this is to use the approach used when
replicating a DB. It is similar to the namespace idea if not the same:

Say you have 3 databases, you could use mod 3 numbers for A=0, B=1 and C=2
So on A you would have 0, 3, 6, 9, ... on B 1, 4, 7, 10, ... and on C 2, 5,
8, 11. This way you can just use auto increment and set the increment value
3 and the start value to 0,1,2 respectively. Also, this way you will not run
out of numbers until you run out of integers.

++Tim Hinnerk Heuer++

http://www.ihostnz.com


Re: [PHP] What method is best for generating thumbnails in PHP from PDF's?

2009-11-14 Thread German Geek
Hi, I've spent ages trying to figure out a good way for this. Ghostscript
and ImageMagick were slow and not giving satisfactory results because the
colors were wrong in some instances.

The solution for me was to use ImageMagick with X-PDF. You can install xpdf
in any linux distro or even on windows. It has a neat little program called
pdf2ppm which converts a PDF into a bitmap format which convert from
imagemagick can then transform. Even though the ppm images are huge, it
seems to work faster than using just convert.

++Tim Hinnerk Heuer++

http://www.ihostnz.com


2009/11/13 clanc...@cybec.com.au

 On Thu, 12 Nov 2009 09:45:55 -0800 (PST), stephe...@rogers.com (Stephen)
 wrote:

 --- On Thu, 11/12/09, Chris Payne chris_pa...@danmangames.com wrote:
 
  I have been asked to create thumbnails from the first page
  of a PDF
  document on the fly with PHP, I have looked online but am
  confused as
  there doesn't seem 1 simple solution.
 
 Go to sitepoint.com and search for photo gallery in minutes

 Sitepoint: Home ยป Search for photo gallery in minutes

 doesn't find anything for me?


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




Re: [PHP] Re: Need suggestions on PHP frameworks

2009-11-14 Thread German Geek
Which framework to use is more of a religious war than anything, but I would
recommend Symfony. It has a nice architechture and is very extendable.

++Tim Hinnerk Heuer++

http://www.ihostnz.com


2009/11/13 Sudheer Satyanarayana sudhee...@sudheer.net


  I doubt you'll get a reasoned bunch of suggestions, more a religious
 war... :-) Still, I like PEAR components.



 Exactly.

 You have to visit the websites of frameworks, comparison articles, etc and
 find out for yourself which one suits you best.

 Currently, if I get to decide, I choose ZF for all the new PHP projects. I
 am also comfortable with
 * my own framework
 * other frameworks like Symfony
 * framework less projects

 Recently, I wrote about ZF -
 http://techchorus.net/reasons-use-zend-framework

 --

 With warm regards,
 Sudheer. S
 Tech stuff: http://techchorus.net
 Business: http://binaryvibes.co.in



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