Re: [PHP] Open form in new window

2013-03-06 Thread Ray
snip

  
  No - you meant to say per the form's TARGET attribute
 
 No, I meant to say exactly what I said, namely ACTION.
 
 The Target attribute deals with frames -- I have not done frames since 1995.
 
 For a more in-depth Target explanation, please review:
 
 http://www.htmlcodetutorial.com/forms/_FORM_TARGET.html
 

If you read your own link you will see a reference to target=_blank this 
opens the document in a new tab/window. 

If there is a way to open a new window/tab with the action attribute I would 
love to be educated.
sibling page of your link
http://www.htmlcodetutorial.com/forms/_FORM_ACTION.html
 


 However, I do not think that is what is being discussed here -- at least it
 is not what I was talking about.

agreed

 
 Cheers,
 
 tedd
 
snip

Ray

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



Re: [PHP] Can't connect to MySQL via PHP

2013-01-12 Thread Ray
On January 12, 2013 11:25:58 AM Rick Dwyer wrote:
 Hello all.
 
 I used the code below successfully to connect to a MySQL db on one hosting
 provider.  I've moved the code to a new hosting provider with new values
 and it returns:
 
 Access denied for user 'user'@'db.hostprovider.net' (using password: YES)
 
 Even though I can copy and paste these three values (host, user and pass)
 and paste into Navicat to make a connection.  So the credentials are
 correct, but they are not authenticating when used in PHP.  I've tried
 making host localhost and 127.0.0.1… both with the same result.
 
 Can someone tell me what I am doing wrong here?
 
 Appreciate it.
 
 Thanks,
 --Rick
 
 


are navcat and php on the same machine? mysql user accounts can and often do 
take into account which machine the connection is comming from?




 
 $db_name = mydb;
 $vc_host= db.hostprovider.net;
 $vc_user= user;
 $vc_pass= pass;
 
 $connection = @mysql_connect($vc_host, $vc_user, $vc_pass);
 $db = mysql_select_db($db_name, $connection);
 
 echo mysql_error();
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

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



[PHP] seg fault with pecl ps extension

2012-11-28 Thread Ray
Hello,
I'm not positive if this is the right list, or if other info is required.
If this is the wrong list, please recomend a better one. If other info is 
desired, just ask.

I am having some problems with the PECL PS (postscript) extension. For some 
commands, everything works properly, but when the code tries to deal with 
fonts, it seg faults and core dumps. In my code, the problem appears to be 
caused by the ps_setfont command. 
I have some code that uses it that used to work, but no longer does. I have 
confirmed the same behaviour with the example code that ships with the 
extension, glyphlist.php for a specific example. I have un-installed and 
reinstalled the php5-ps (64 bit) package through the package manager to no 
effect.  

sample code and system info follows sig.

any assistance appreciated,
Ray

system is Kubuntu 12.10 64bit, kernel version 3.5.0-18,  php 5.4.6-1ubuntu1.1 
according to php -v

my sample code:
if two marked lines are left in, seg faults, otherwise works
?php
$file=pstest.ps;
$fonts_dir='./fonts/';
$font_size=30;
$dr2=50;

$psdoc = ps_new();
ps_set_parameter($psdoc, 'SearchPath', $fonts_dir);

if (!ps_open_file($psdoc, $file)) 
{
print Cannot open PostScript file $file \n;
exit;
}

ps_set_info ($psdoc, 'Orientation' , 'Portrait');

ps_begin_page ($psdoc, 596, 842); 
$psfont = ps_findfont($psdoc, ArialMT, );
echo br$psfontbr;
ps_setfont($psdoc, $psfont, $font_size);//works if these two lines
ps_show_xy($psdoc, 'Hello World', 30, 400);//are commented out,
ps_setcolor ($psdoc , 'both' , 'rgb', 1, 0, 0, 0);
ps_arc ($psdoc, 30, 230, $dr2, 0, 360);
ps_stroke($psdoc);

ps_end_page($psdoc);
ps_delete($psdoc);
?

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



Re: [PHP] seg fault with pecl ps extension

2012-11-28 Thread Ray
On November 29, 2012 12:00:44 AM Adam Richardson wrote:
 On Wed, Nov 28, 2012 at 10:50 PM, Ray r...@stilltech.net wrote:
  Hello,
  I'm not positive if this is the right list, or if other info is required.
  If this is the wrong list, please recomend a better one. If other info is
  desired, just ask.
  
  I am having some problems with the PECL PS (postscript) extension. For
  some
  commands, everything works properly, but when the code tries to deal with
  fonts, it seg faults and core dumps. In my code, the problem appears to be
  caused by the ps_setfont command.
  I have some code that uses it that used to work, but no longer does. I
  have
  confirmed the same behaviour with the example code that ships with the
  extension, glyphlist.php for a specific example. I have un-installed and
  reinstalled the php5-ps (64 bit) package through the package manager to no
  effect.
 
 Hi Ray,
 
 Does this issue coincide with an upgrade to PHP 5.4, and if so, which
 version of PHP were you running before?
 
 You could try to email the maintainer listed, Uwe Steinmann 
 u...@steinmann.cx or ste...@php.net, but it looks like it's been a while
 since anyone has touched that code.
 
 If this is because of backwards incompatible changes in PHP (e.g.,
 http://www.php.net/manual/en/migration54.incompatible.php,
 http://php.net/manual/en/migration53.incompatible.php), you could try to
 avoid the PHP bindings Uwe developed and merely use PHP to call a C program
 that directly deals with his project pslib:
 http://pslib.sourceforge.net/
 
 Sorry for the trouble,
 
 Adam
 
 --
 Nephtali:  A simple, flexible, fast, and security-focused PHP framework
 http://nephtaliproject.com

Adam,
Don't apologize. Thanks for the reply.
It certainly could be due to an upgrade. I wrote my code a while ago, then let 
it sit. A few days ago I tried to use it again. I first had to deal with a 
change in the way call by reference worked in php. (I had to delete the '' 
from some function calls.) Did that correspond to the 5.3 - 5.4 upgrade?
I will look at the links you provided.
Thanks again.
Ray

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



Re: [PHP] session variables and SVG documents

2010-02-01 Thread Ray Solomon

From: Aurelie REYMUND aurely...@gmail.com
Sent: Monday, February 01, 2010 3:37 AM
To: php-general@lists.php.net
Subject: [PHP] session variables and SVG documents


Hello,

I have the following problem with the Adobe SVG viewer:
I try to generate a SVG document using PHP. the following code is working
well under Firefox, as well as IE with ASV:

?php

header(Content-type: image/svg+xml);

$graph_title = 'title';


print('?xml version=1.0 encoding=iso-8859-1 standalone=no?');
$svgwidth=500;
$svgheight=400;
?

!DOCTYPE svg PUBLIC -//W3C//DTD SVG 1.0//EN 
http://www.w3.org/TR/SVG/DTD/svg10.dtd;
svg width=?php echo $svgwidth; ?px height=?php echo $svgheight; 
?px

xmlns=http://www.w3.org/2000/svg;
   descThis is a php-random rectangle test/desc
?php
srand((double) microtime() * 100); //initalizing random generator
for ($i = 0; $i  20; $i+=1) {
   $x = floor(rand(0,$svgwidth-1)); //avoid getting a range 0..0 for rand
function
   $y = floor(rand(0,$svgheight-1));
   $width = floor(rand(0,$svgwidth-$x)); //avoid getting rect outside of
viewbox
   $height = floor(rand(0,$svgheight-$y));
   $red = floor(rand(0,255));
   $blue = floor(rand(0,255));
   $green = floor(rand(0,255));
   $color = rgb(.$red.,.$green.,.$
blue.);
   print \trect x=\$x\ y=\$y\ width=\$width\ height=\$height\
style=\fill:$color;\/\n;
}
?
   text x=?php echo $svgwidth/2;?px y=300 style=font-size:15;
text-anchor=middleThe servers Date and Time is: ?php print
(strftime(%Y-%m-%d, %H:%M:%S)); ?/text
   text x=?php echo $svgwidth/2;?px y=340 style=font-size:15;
text-anchor=middleYou are running:/text
   text x=?php echo $svgwidth/2;?px y=360 style=font-size:15;
text-anchor=middle?php print $HTTP_USER_AGENT; ?/text
/svg

If now I want to include the session_start() at the beginning of the code,
in IE I got a pop-up dialog called download file

What am I doing wrong ?

Regards,
Aurelie




It appears IE does not support svg yet and you need a plugin for it.

However, you could also design your code differently by using Imagemagick to 
convert the svg to png.

If that suits your needs, then use the modified code below:


?php

header(Content-type: image/png);

$graph_title = 'title';

$svgwidth=500;
$svgheight=400;

$svg = '?xml version=1.0 encoding=iso-8859-1 standalone=no?
svg width='.$svgwidth.'px height='.$svgheight.'px 
xmlns=http://www.w3.org/2000/svg;

   descThis is a php-random rectangle test/desc';


for ($i = 0; $i  20; $i++) {
$x = floor(rand(0,$svgwidth-1));
$y = floor(rand(0,$svgheight-1));
$width = floor(rand(0,$svgwidth-$x));
$height = floor(rand(0,$svgheight-$y));
$red = floor(rand(0,255));
$blue = floor(rand(0,255));
$green = floor(rand(0,255));
$color = rgb(.$red.,.$green.,.$blue.);
	$svg .= \trect x=\$x\ y=\$y\ width=\$width\ height=\$height\ 
style=\fill:$color;\/\n;

}

   $svg .= 'text x='.($svgwidth/2).'px y=300 style=font-size:15; 
text-anchor=middleThe servers Date and Time is: '.date(Y-m-d, 
H:m:s).'/text
   text x='.($svgwidth/2).'px y=340 style=font-size:15; 
text-anchor=middleYou are running:/text
   text x='.($svgwidth/2).'px y=360 style=font-size:15; 
text-anchor=middle'.$HTTP_USER_AGENT.'/text

/svg';


file_put_contents('/tmp/image.svg', $svg);

exec(/usr/bin/rsvg /tmp/image.svg /tmp/image.png);

echo file_get_contents('/tmp/image.png');
?

-Ray Solomon



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



Re: [PHP] Sanitizing potential MySQL strings with no database connection

2009-10-20 Thread Ray Solomon
- Original Message - 
From: Ashley Sheridan a...@ashleysheridan.co.uk

To: Dotan Cohen dotanco...@gmail.com
Cc: Jim Lucas li...@cmsws.com; php-general. 
php-general@lists.php.net

Sent: Tuesday, October 20, 2009 4:02 AM
Subject: Re: [PHP] Sanitizing potential MySQL strings with no database 
connection




On Tue, 2009-10-20 at 12:58 +0200, Dotan Cohen wrote:


 Dotan,

 You are making this thing harder then it has to be.

 All you need is to replicate the escaping of the same characters that
 mysql_real_escape_string() escapes.  Simply do that.  They are listed 
 on the

 functions manual page on php.net

 http://php.net/mysql_real_escape_string




This thread is so long, I am suprised to see that nobody has yet recommended 
the use of the OWASP php filters.

It is still very good.

http://www.owasp.org/index.php/OWASP_PHP_Filters

If by chance someone already mentioned it, my bad.

Best Regards 



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



Re: [PHP] Please don't kick me!

2009-10-19 Thread ray
- Original Message - 
From: Philip Thompson philthath...@gmail.com

To: PHP General list php-general@lists.php.net
Sent: Monday, October 19, 2009 1:47 PM
Subject: [PHP] Please don't kick me!



Hi all.

I know this question has been asked a thousand times on the list, but  my 
searches in the archives are not being nice to me. So... please  don't 
kick me.


Currently, we use DOMPDF to generate PDFs from HTML. However, it's no 
longer maintained and it has a few bugs that we just can no longer  live 
with. What PDF generating software do you use? It does not have  to be 
free, but it must run on linux and may be command line or run  through 
code. Some of the ones I have researched are...


html2pdf
html2ps
html2fpdf
xhtml2pdf
fpdf
tcpdf

You're thoughts would be appreciated. Oh, my preference would be to  send 
HTML/CSS to a script and it just automagically convert to PS/PDF.


Thanks,
~Philip





I've been using ezpdf for many years and I think it is still the best option 
available.

Ihttp://www.ros.co.nz/pdf/


Best Regards 



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



Re: [PHP] Back from the dead with a racing question!

2009-07-17 Thread ray
I strongly believe you have nothing to worry about and I think you are 
over-thinking an issue that will never happen to you.

Even if you have 2000 users, you will have nothing to worry about.

I manage db's on large scales and have run into every problem I never 
imaginged and always figured out how to fix it.
Throughout the years I have heard this particular issue come up among 
novices and the heard vaugue suggestions given from people with little 
experience.


There is no way you are going to run across a race condition because 
queries that are waiting to be processes have the status of wait while a 
table is locked.

Its basically put into a queue.
You can use INSERT DELAYED to better manage this if you are using MYISAM if 
you experience a much higher volume of inserts.


For apps that have a very high INSERT frequency, I suggest using INNODB so 
you won't experience table locking.


For your case, you have only 10 users and that is absolutely nothing to 
worry about.


If you are concerned about multiple users accessing a row of data at the 
same time, you will need to use INNODB and implement transactional queries.


This assumes you are using mysql of course. If you are using mssql, then I 
cannot provide a good answer because I do not use that db.


-Ray Solomon



- Original Message - 
From: Jason Pruim ja...@jasonpruim.com

To: PHP-General List php-general@lists.php.net
Sent: Friday, July 17, 2009 8:12 AM
Subject: [PHP] Back from the dead with a racing question!



Hi everyone!

So some of you may have noticed that I have been away for quite  awhile... 
Been trying to get settled (Moved across the country) and  getting a job.


And now that that is done I have a question about a project that I  might 
be doing for my current employer and want to do it properly.


If all goes through, I'll be writing an online database that upwards  of 
10 people will be using at various times through out the day.  Basically, 
in a form they fill out a model number, customer name,  phone number etc. 
etc.. And then submit the form. After submitting  they need to write the 
log number on some paperwork. If I have 2  people submit the form at the 
same time, I'm thinking I could end up  with a race condition and they 
might get the wrong log number (The log  number is simply a consecutive 
record number)


Do I need to be reading up on locking tables/rows? Or in my situation  as 
I've briefly described it do I not have to worry about it? Or is  there a 
third door with the magic bullet that will solve all my  problems? :)


Any advice is greatly appreciated as always, RTFMing is good as well,  as 
long as M is defined :)


I'm not afraid of google either, just need the right terms to hit it  with 
so I don't go into search overload as the commercials for a  rival 
search engine claim :)


Thanks Everyone!



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




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



[PHP] Re: Remote MySQL Connecton Problems

2009-05-07 Thread Ray Hauge

Nathan Rixham wrote:

Ray Hauge wrote:

Hello everyone,

I've run into a bit of a sticky situation trying to connect to a 
remote MySQL database.  Here's the background:


Connecting from the command line on the web server works.

Connecting from a different vhost works.

There's no information in mysql_error.  In fact, mysql_select_db('db') 
or die(mysql_error()); doesn't produce any output.


The only way I know this isn't working is when I try to run a query, 
the result resource is NULL.


If I copy the contents of the query and run it on the command line, 
from the web server, I get the results I expected.


I manage both servers.  I added the new login on the MySQL server and 
also ran flush privileges.  I've gone so far as to reboot both the 
MySQL process and the apache process.


The versions of MySQL are slightly different 5.0.24a (web) vs 5.0.36(db).

It's getting late and I'm just grasping for straws.

Thanks!
Ray


and thus:
database server works - yes
user and login works locally - yes
user and login works remotely - yes
user and login works on box in question - yes

further debug:
do mysql connections work for any host at all in php? - todo
is the mysql module for php installed - todo check phpinfo() output
is error reporting enabled - todo set error_reporting to E_ALL
does a simple query such as show databases return any results
is query properly formatted and are variables properly replaced in php 
version - todo check


I'd reckon that by the time you've checked all the above - you'll have 
your own solution :)


regards!


Thanks Nathan!

I'm not sure what the problem was.  I think I was tired and trying too 
hard to solve an issue that didn't exist.  I was thinking that 
var_export($db_conn) would display MySQL Resource Id #1 or something 
similar, but it was displaying NULL.  I took out all my debugging code 
and it's working fine now.


Ray

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



[PHP] Remote MySQL Connecton Problems

2009-05-06 Thread Ray Hauge

Hello everyone,

I've run into a bit of a sticky situation trying to connect to a remote 
MySQL database.  Here's the background:


Connecting from the command line on the web server works.

Connecting from a different vhost works.

There's no information in mysql_error.  In fact, mysql_select_db('db') 
or die(mysql_error()); doesn't produce any output.


The only way I know this isn't working is when I try to run a query, the 
result resource is NULL.


If I copy the contents of the query and run it on the command line, from 
the web server, I get the results I expected.


I manage both servers.  I added the new login on the MySQL server and 
also ran flush privileges.  I've gone so far as to reboot both the MySQL 
process and the apache process.


The versions of MySQL are slightly different 5.0.24a (web) vs 5.0.36(db).

It's getting late and I'm just grasping for straws.

Thanks!
Ray

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



Re: [PHP] problems with gnupg extension.

2009-04-20 Thread Ray
On Monday 13 April 2009 10:17:28 Ray wrote:
 Hello all,

 I'm trying to use the gnupg extension and I think everything is properly
 installed.

 I'm just using test data. I'm encrypting and then immediately decrypting.
 But the decryption is failing with a unhelpful error message.

 error message :
 Warning: gnupg::decrypt() [gnupg.decrypt]: decrypt failed in
 /path/to/test2.php on line 18

 any help or suggestions would be very much appreciated. details follow.
 Ray



 full output:

 raw data: this is a test


 encoded data:

  -BEGIN PGP MESSAGE-
 Version: GnuPG v2.0.11 (FreeBSD)

 hQIOA9qOyyMyQ2/bEAgArxLuVw5eShkL+/g9SCGcBm5/J1G78zrh6dWFisPFqWg1
 MP3zj/QnWiD9zEtLmGJazP51pV2TpySpEbILze8sz6c/imRBYLrHhbxO6W1LJqXq
 rALUPDIe4qKtM7mC+K9EdFdkYRzWxi45eTK1DQtQazhqelWIb1NuaVu8vUKk/pIy
 duE0juP2j+8OHIlx36sUcATkvBO5a7Ak9tGUT5T5lRqjMzKa6TPuCsZukmVh43BG
 uqpz7H83LinwOCfUnyq3R2e/vIM2cv8t7jz17acOfYslonMxNz54i8jR8COmCmLY
 NhGORZUSLauyWGxAIDvkDcTFD4Jd5KxaXcMPEE7zwAf9HUWmKtqOqn825AjlBxNj
 7gXEOtpsRMiYiYuISzHvitpPWXQPOPsoGnPRZZBvCNJcvAgg6hMx5c4Y7tGXTsma
 2hkC9f4959kBwiGAFnQxJqz2pMDW+N3X23f+kwSrU7KoNrhnxUV1ywcUGaebwYM8
 emIygCm6mS7T81JtXxhMto0sSqeE/zwHc3/03/KP57V7j2tHib4dN9ZOfB6yiubF
 PIwog0JYagjOfyNdGh3vRzvcYdDOqyWMgtY6XpZJwPESJlOADHVt5n844oHthRD3
 MJVjwqjEz5qQiPq+kOmd4AdkpkEkRcCweYNEXVXPxpmlrduuu8kc4wsA5v3YXZ/C
 x9JNAVKW9tdPSxDoxbEKyAhVdurQAxmYe7FaCLl74lACQaUg/Otwb86pjUBesgx6
 mXhQv+epG71sKY+LSDxGi8dSgbOOmfI2L09zy9XTEQ4=
 =85vG
 -END PGP MESSAGE-


 [if this line is blank, the decrypt key should have been added correctly]]

 Warning: gnupg::decrypt() [gnupg.decrypt]: decrypt failed in
 /path/to/test2.php on line 18


 decoded data:




 Code:

 ?php
 $raw_data=this is a test;
 $passphrase=test;
 $recipient=m...@example.com;

 putenv('GNUPGHOME=/www/ohfinder/keys');
 $gpg = new gnupg();
 $gpg - seterrormode(gnupg::ERROR_WARNING);
 echo raw data: $raw_databr;
 $gpg-addencryptkey($recipient);
 $encrypted = $gpg-encrypt($raw_data);
 echo brbrencoded data: pre $encrypted/prebr;

 $gpg-adddecryptkey($recipient, $passphrase);
 echo $gpg - geterror();
 echo [if this line is blank, the decrypt key should have been added
 correctly]];
 echo 'br';
 $plaintext = $gpg-decrypt($encrypted);
 echo $gpg - geterror();
 echo brbrdecoded data: pre $plaintext /pre;
 ?


Any suggestions, Anyone?
Ray

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



[PHP] problems with gnupg extension.

2009-04-13 Thread Ray
Hello all,

I'm trying to use the gnupg extension and I think everything is properly 
installed.

I'm just using test data. I'm encrypting and then immediately decrypting. But 
the decryption is failing with a unhelpful error message.

error message :  
Warning: gnupg::decrypt() [gnupg.decrypt]: decrypt failed in 
/path/to/test2.php on line 18 

any help or suggestions would be very much appreciated. details follow.
Ray



full output:

raw data: this is a test


encoded data:

 -BEGIN PGP MESSAGE-
Version: GnuPG v2.0.11 (FreeBSD)

hQIOA9qOyyMyQ2/bEAgArxLuVw5eShkL+/g9SCGcBm5/J1G78zrh6dWFisPFqWg1
MP3zj/QnWiD9zEtLmGJazP51pV2TpySpEbILze8sz6c/imRBYLrHhbxO6W1LJqXq
rALUPDIe4qKtM7mC+K9EdFdkYRzWxi45eTK1DQtQazhqelWIb1NuaVu8vUKk/pIy
duE0juP2j+8OHIlx36sUcATkvBO5a7Ak9tGUT5T5lRqjMzKa6TPuCsZukmVh43BG
uqpz7H83LinwOCfUnyq3R2e/vIM2cv8t7jz17acOfYslonMxNz54i8jR8COmCmLY
NhGORZUSLauyWGxAIDvkDcTFD4Jd5KxaXcMPEE7zwAf9HUWmKtqOqn825AjlBxNj
7gXEOtpsRMiYiYuISzHvitpPWXQPOPsoGnPRZZBvCNJcvAgg6hMx5c4Y7tGXTsma
2hkC9f4959kBwiGAFnQxJqz2pMDW+N3X23f+kwSrU7KoNrhnxUV1ywcUGaebwYM8
emIygCm6mS7T81JtXxhMto0sSqeE/zwHc3/03/KP57V7j2tHib4dN9ZOfB6yiubF
PIwog0JYagjOfyNdGh3vRzvcYdDOqyWMgtY6XpZJwPESJlOADHVt5n844oHthRD3
MJVjwqjEz5qQiPq+kOmd4AdkpkEkRcCweYNEXVXPxpmlrduuu8kc4wsA5v3YXZ/C
x9JNAVKW9tdPSxDoxbEKyAhVdurQAxmYe7FaCLl74lACQaUg/Otwb86pjUBesgx6
mXhQv+epG71sKY+LSDxGi8dSgbOOmfI2L09zy9XTEQ4=
=85vG
-END PGP MESSAGE-


[if this line is blank, the decrypt key should have been added correctly]]

Warning: gnupg::decrypt() [gnupg.decrypt]: decrypt failed in 
/path/to/test2.php on line 18


decoded data: 




Code:

?php
$raw_data=this is a test;
$passphrase=test;
$recipient=m...@example.com;

putenv('GNUPGHOME=/www/ohfinder/keys');
$gpg = new gnupg();
$gpg - seterrormode(gnupg::ERROR_WARNING);
echo raw data: $raw_databr;
$gpg-addencryptkey($recipient);
$encrypted = $gpg-encrypt($raw_data);
echo brbrencoded data: pre $encrypted/prebr;

$gpg-adddecryptkey($recipient, $passphrase);
echo $gpg - geterror();
echo [if this line is blank, the decrypt key should have been added 
correctly]];
echo 'br';
$plaintext = $gpg-decrypt($encrypted);
echo $gpg - geterror();
echo brbrdecoded data: pre $plaintext /pre;
?

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



Re: [PHP] What is wrong with this code

2009-04-03 Thread Ray
On Friday 03 April 2009 13:08:45 Gary wrote:
 This is driving me nuts.  I am getting blank emails and the only
 information that is being passed to MySQL is the IP address.

 Can someone tell me what is wrong with this?

 form method=post action=?php echo $_SERVER['PHP_SELF']; ?
  div id=important style=visibility:hidden;
pIf you can see this, it's an anti-spam measure.  Please don't
fill in the address field./p
label for=addressAddress/label
input type=text name=address id=address //div

label for=nameName:/label
input name=name type=text /br /
label for=emailEmail Address:/label
 input name=email type=text /
 br /
 label for=nameComments:/label
 textarea name=comments cols=50 rows=/textarea
 input name=submit type=button value=submit //form
shouldn't this   be submit?

 ?php

 // Receiving variables


 $ip= $_SERVER['REMOTE_ADDR'];
 $name = $_POST['name'];
 $email = $_POST['email'];
 $comments = $_POST['comments'];


I hope this is simplified code, and you're going to do more filtering above?

 //spam filter, do not touch
  if ($_POST['address'] != '' ){


 die(Changed field);

 }

 //endo fo spam filter

 $header = From: $email\n
 . Reply-To: $email\n;
 $subject = Response from Assessment Lawyer;
 $email_to = sanitized;
 $message = name: $name\n
 . email: $email\n
 . comments: $comments\n
 .Visitors IP: $ip\n;
 mail($email_to, $subject, $message, $header);




 $dbc= mysqli_connect(sanitized,sanitized,sanitized,sanitized)// I have
 removed the actual information, but it was connecting!
 or die('Could not connect to db');

 $query = INSERT INTO sanitized VALUES(0,'$name',
 '$email','$comments','$ip');

 $result = mysqli_query($dbc, $query)
 or die('Error querying database.');



 mysqli_close($dbc);

 echo 'Thank you $name for submitting your inquiry!br /';
 echo 'You have supplied the following information:br /';
 echo 'Name: $name br /';
 echo 'Email Address: $email br /';
 echo 'Comments: $comments';

 ?



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



Re: [PHP] Script execution

2009-03-09 Thread Ray
On Monday 09 March 2009 15:38:37 Michael A. Peters wrote:
 George Larson wrote:
  Thanks everybody!
 
  I guess I was a little vague.  I'm working on an OpenSUSE setup with
  Apache, MySQL and PHP.  I just knew that my confusion was because of my
  Windows up-bringing.
 
  The writing I referred to was to a file.  One example is I had a script
  that was pulling data from a database and using it to generate PDF files.
   This would work fine from the command line but not if I pointed a
  browser at it.  It wasn't an important difference because that script is
  a cronjob anyway.  I just wanted to understand what was going on and how
  I could change it -- if I find later that I need to.

 Give the user apache runs as permission to write to the directory where
 the PDF files are generated.

 I don't know what use apache run as on SuSE but if it was, say, www - as
 root:

 chown www /path/to/directory/where/you/want/the/output


I only scanned the thread, So apologies if someone else already said this.
Another problem I've come across is that the path variable is not the same 
when run under the browser as on the command line, so instead of issuing  
command   
you need
/path/to/command
Ray

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


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



Re: [PHP] Robert Cummings

2008-09-30 Thread Ray Hauge

Daniel Brown wrote:

All:

What was pointed as a passing mention in one thread I thought was
worth note in a thread of its own.  As quoted by Rob:


BTW, while we're off topic... my wife delivered our third child (second
boy) 3 minutes after midnight yesterday :)


I'd say that deserves a round of congratulations.  Many - most,
probably - of you know Rob from here, and have seen his help and
dedication - as well as his annoying wit ;-P - offered to any and all
on this list.  Quite often, it's offered when you don't especially
want it.  Nonetheless, it's great news, and I think we should all take
a moment and wonder: why the hell aren't you at the hospital with your
wife and newborn son, Rob?  ;-P

Congrats to the Cummings family!



Oh wow, congrats Rob!  We just had our second (and last after my 
surgery) 5 months ago.


Enjoy the lack of sleep :)

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Zend Platform

2008-09-09 Thread Ray Hauge

Stut wrote:

On 9 Sep 2008, at 18:52, Nathan Rixham wrote:
Short and sweet; does anybody have any practical experience; thoughts 
or case studies in regards to implementing the Zend Platform.


Yeah, I used it in my previous job a coupla years ago. It looks great, 
the marketing hype is well executed but as usual the reality is far from 
the promise. There are some aspects I really like, but mainly in 
concept. What you actually get is expensive extra bloat to install on 
your servers.


* The bytecode cache can be replaced by one of several free solutions 
out there.


* The job queue is a great idea but the implementation is problematic at 
best. Avoid this if you can.


* The centralised logging and the alerting features are nice - this is 
probably the only but I really found useful.


* The clustering features I did not use so didn't look at too closely, 
but it didn't appear to offer anything that couldn't be replicated 
pretty easily with open source tools.


At the end of the day what you're buying is marketing hype, and there 
are people out there who fall for it hook line and sinker. My advice is 
that unless you have someone insisting you use ZP, don't. And even if 
you do I urge you to look at what you actually need from it and evaluate 
alternatives before making a commitment. Have you ever heard about 
Facebook, Yahoo or any other big player using it?


Don't get me wrong, I think Zend is a great company, but I just don't 
see the value in ZP. For the price of the license you could add another 
server which will give you far better ROI and higher capacity then ZP 
could ever achieve.


And don't get me started on what they've done to Zend Studio. I've 
switched to Aptana - same platform, but cheaper and a lot more stable. 
Shame!


-Stut



I agree with most of your post.  The error logging features are great. 
I haven't used ZP for a while, but when I did it was nice to get an 
alert right away of what happened, and it also captured the variables in 
use at the time so that you could see why it happened.  If the error 
reporting is what you're looking for, then the bytecode caching is a 
nice addition, but like you said there are OSS alternatives.


I also completely agree with the Zend Studio comment.  I've switched 
back to Zend Studio 5.5, because the Eclipse version was just so 
unintuitive... especially for debugging.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] What font/size do you use for programming?

2008-07-08 Thread Ray Hauge

tedd wrote:

Hi gang:

I'm running a Mac (so I know mine is a bit different size wise) but I'm 
currently using Veranda at 14 point for coding.


Just out of curiosity, what font and size do you ppls use for your 
programming?


Cheers,

tedd



12pt Adobe Sans MM (Zend Studio) on a 19 LCD @ 1280x1024 running Linux.

I'm not doing PHP at my new job anymore (bummer), but the terminal I use 
to connect to the OpenVMS server uses auto font scaling to make it super 
huge (the programs only support 80 and 132 character screen widths).


BTW, MUMPS is a very interesting language.  By interesting I really mean 
crazy, but I suppose it is really old.


F I=1:1:10 W VALUE: _I,! ; Writes VALUE:  . I each on a new line

Sorry for venturing off-topic, but I told you!

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Convert PDF Files to PCL-Files

2008-07-04 Thread Ray Hauge

jogisarge wrote:

Hello @all,

i am running php5 on a IBM i5 V5R4.
now i have to print exisiting pdf-files.

the problem is, i cant use external programms like pdftops or other stuff
like this, because the php core runs in the pase environment.

is there any possibility to convert existing pdfs to pcl files ?

bye jo






I don't know if IBM has a port of the linux command pdf2ps (to post 
script).  There should be some sort of converter from post script to 
PCL, but I'm not completely sure on that.  I'm not currently aware of a 
straight converter.  Sorry if that's not much of a help.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Another canvas example

2008-06-24 Thread Ray Hauge

Richard Heyes wrote:

Pretty sweet! My only problem with it is that I had to use the keyboard
to get to the Attach button, since I couldn't click on it with it
being behind the pie chart in the page's Z-order.


Yes, no way around (I think). Even with the buttons z-index set to 99 it 
still shows up behind the beachball.


TAB and the spacebar are your friends I guess... :-)



You could make the z-index of the beachball at 1, and then put the rest 
of the page in a div with a z-index higher than 1.  The beachball should 
then still appear, but be under the div, which allows you to click the 
button.  I ran into the same issue with a game I've been making:


http://www.primateapplications.com/trackattack/

Since you're working with the Canvas, you can be reasonably sure that 
the browser would support doing this.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Another canvas example

2008-06-24 Thread Ray Hauge

Richard Heyes wrote:

Pretty sweet! My only problem with it is that I had to use the keyboard
to get to the Attach button, since I couldn't click on it with it
being behind the pie chart in the page's Z-order.


Yes, no way around (I think). Even with the buttons z-index set to 99 it 
still shows up behind the beachball.


TAB and the spacebar are your friends I guess... :-)



Oh, I forgot to mention that you'll have to make the css position 
attribute relative.  Then the z-index will work.  I think that's what I 
had to do for the same issue. *


* I had to get up in the middle of the night to check some production 
issues and checked my email while waiting.  My memory might not be fully 
functioning :)


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Re: Another canvas example

2008-06-24 Thread Ray Hauge

Per Jessen wrote:

Colin Guthrie wrote:


http://www.primateapplications.com/trackattack/

Since you're working with the Canvas, you can be reasonably sure that
the browser would support doing this.

Dude, that's cool it's killed my productivity, but it's cool :D


The Playmobil website has a very similar one, except it's water-pipes
and Flash. 



/Per Jessen, Zürich




My son likes trains, and I was using this as an excuse to learn 
JavaScript better.  My wife's favorite NES game (yes, I collect NES 
games) was/is Pipe Dream, so I modeled it after that game.  It uses 
Soundmanager2 to play the music and sounds through Flash.  All the code 
is inline, just to make it easier for people to view the code.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Another canvas example

2008-06-24 Thread Ray Hauge

Daniel Brown wrote:

On Tue, Jun 24, 2008 at 3:53 AM, Ray Hauge [EMAIL PROTECTED] wrote:

http://www.primateapplications.com/trackattack/


Ray,

This displays perfectly fine, but does not function beyond looking
pretty on Firefox 3 (Linux/KDE).  I am, however, probably going to
play that game for a bit on my non-Linux (I refuse to say the name!)
machine.

Maybe Rich could turn his canvas example into the first
HTML/CSS/JavaScript beach volleyball game.  It would be the closest
some of us would probably get to detaching from our desks and getting
onto a beach to play anyway.



Strange, I've tested it on Kubuntu Hardy  FF 3, SuSE SLED 10.1  FF2, 
Windows FF23 Safari Opera 9.5 IE67, Mac OSX Safari.  I'd be interested 
in what error you got, just email me off-list if you like.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Another canvas example

2008-06-21 Thread Ray Hauge

Richard Heyes wrote:

Hi,

Latest in my new series of look at me, aren't I cool canvas examples 
is here:


http://www.phpguru.org/pie/pie.html

Works in IE7 too. And Opera. Ooh.



Awesome stuff.  I think the canvas element will be my next adventure. 
I've been learning JavaScript a lot recently.  That's been an 
interesting experience that I'm glad I did.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] climb up the path

2008-06-20 Thread Iv Ray

Jim Lucas wrote:
 Iv Ray wrote:
 Jim Lucas wrote:
 So, saying that it is outside the source does not tell me if it is
 outside the document root.

A, right.

It is outside the document root.

 Use your include_path php_ini setting

A, right...

Didn't think of it.

Actually, I do not like the include_path - it is too esoteric... - kind 
of a fog - I prefer to know where things I call come from :) - as it is 
said in Harry Potter - Never trust an object of magic if you do not 
know where it keep its brains. ;)


But thanks, anyway!

Iv

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



Re: [PHP] climb up the path

2008-06-20 Thread Iv Ray

Richard Heyes wrote:
i need a way to get the path to the parent folder of the folder i am 
in. one dirty way i found is this -


require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR .
 ..  . DIRECTORY_SEPARATOR .
 config.php);

i can also explode() and reassemble all folders except the last, but 
this looks also dirty...


is there a direct way?


There's nothing dirty about dirname(), and for your issue, just call it 
twice:


dirname(dirname(__FILE__));


I called dirty the .. in my example.

Yes, dirname(dirname(__FILE__)); is the way to go - I was just too 
brainwashed and did not think I can apply it to a directory, too.


Thanks,
Iv

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



Re: [PHP] Re: Military Service WAS [PHP] Capitalization of variable

2008-06-20 Thread Iv Ray

Per Jessen wrote:

Call me .. uh no, I'm getting sick ... you guys are so completely and
utterly off-topic - please take it off-line.


It was obviously off-topic from the beginning,... however it felt 
somehow OK... - I mean, it gave the list a personal touch and every 
successful organization dreams of its people having a more personal touch.


I'd also hate it if the list goes greatly off-topic inflated, but, I 
think, I'd hate it exactly as much if it was a dry on-topic thing where 
nobody says anything personal. If we were not so divided in time and 
space, we would occasionally meet for a beer - for me the off-topic 
explosions are the digital equivalent of this.


Iv

--

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



Re: [PHP] http response 200

2008-06-20 Thread Iv Ray

joaquinbordado wrote:
 'm a total newbie..i just want to know how can i display an http 
response 200


Don't have time to customize it for you, but that's how it can be done-

header(HTTP/1.0 404 Not Found);
/*
 *
 * I copied the DOCTYPE from what Apache 1.3.34 returns.
 *
 */
echo !DOCTYPE HTML PUBLIC \-//IETF//DTD HTML 2.0//EN\;
echo html;
echo head;
echo title404 Not Found/title;
echo /head;
echo body;
echo h1Not Found/h1;
echo pThe requested URL  . $_SERVER['REQUEST_URL'] . was not found 
on this server./p;

echo hr;

Note, that you must not have any output before sending header(). There 
is a way to check, write back, if interested how.


Iv

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



Re: [PHP] http response 200

2008-06-20 Thread Iv Ray

ryan gacusana wrote:

here is my code
when accessing this url
http://localhost/podcast/podcast.php?mobile=0823172message=2343443=%3Eryan 


This runs on your computer, I can't access it.


else
echo Message has been sent successfully.;
// in this part i want to respond with a status of 200,sorry i just 
started php last wik


Actually... If you print this text, the web server sends status 200 to 
the browser on its own accord. Or am I missing something.


The code I sent you sends custom 404 Not Found - in case you need that.

Iv

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



Re: [PHP] download file from an ajax request

2008-06-20 Thread Iv Ray

pere roca wrote:

hi everybody!

Hi!

is there some way to allow downloading a PHP generated file from an ajax
request?


No idea, but would love to hear if/how you solved it.
Iv

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



Re: [PHP] PDF inline viewer

2008-06-20 Thread Iv Ray

Mário Gamito wrote:

Hi,

Does someone knows of a PHP software that is an inline PDF reader ?
You can view the idea here:
http://www.scribd.com/doc/2025925/Clinical-chemistry-II-Biomedical-Science-practical-1

Any help would be appreciated.

Warm Regards,
Mário Gamito


What will happen if you open the PDF file in iframe? - then you will 
have all controls from the Acrobat Reader plug-in. Or do you need 
something more elaborate?


Iv

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



Re: [PHP] download file from an ajax request

2008-06-20 Thread Iv Ray

Eric Butera wrote:

The only thing I can think of is using JS to create some sort of
IFRAME, meta redirect, window.location, or a popup window, something
that will force the page to hit your download script directly.  I've
never attempted it myself so I'm not sure what sort of issues IE would
have with any of the above.


Well, if we, the illiterate, are going to brainstorm ;) - clicking a 
link/button/image executes JavaScript function, which (via AJAX request) 
hits the php download script. The response will be received by the AJAX 
object.


Nothing php here.

As far as I see the problem, it is - how to pass this response to the 
browser in an elegant way, so that the browser will open a Save as... 
dialogue and will direct the stream there.


One could ask this on a JavaScript/AJAX list.

Iv

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



Re: [PHP] Re: Discussion of method -- config files

2008-06-20 Thread Iv Ray

Al wrote:

I freely use defined constants for all fixed variables in my config file.

It insures they cannot be inadvertently reassigned by a function 
someplace and are available everywhere.


That's a good idea, I have been thinking about this.

Never thought they have global scope, though - a good reminder.


define('MYSQL_HOST',localhost);


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



Re: [PHP] Re: Military Service WAS [PHP] Capitalization of variable

2008-06-19 Thread Iv Ray

Dan Joseph wrote:

I guess the main problem is people don't realize that there are a LOT of
things you can do in the military other than just taking a gun out into the
field and firing at the enemy.  If you want people to believe that mandatory
service is a good thing, they have to do more to get that message out.


www.goarmy.com

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



Re: [PHP] Discussion of method -- config files

2008-06-19 Thread Iv Ray

tedd wrote:

Hi gang:

More of a question of method rather than of right or wrong -- of the 
two methods mentioned here, which way would be better and why?


Initially I used to access global variables using the global keyword -

function foo()
 {
global $bar;
 }

However if the function code is a bit longer, it gets difficult to see 
if $bar is still actually used, after some revisions.


So I switched to using $GLOBALS. Inside $GLOBALS I store variables, 
arrays and initiated objects (for instance $DB, for database access) - 
which I call -


$GLOBALS[DB]-connect;

I do not consider it polluting - it is there to be used. If your code 
is part of something bigger, then you need a convention, and if you 
convention supports this method, it's all right.


For some reason I do not like the :: operator, it's visually too 
unstable :)


Iv

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



Re: [PHP] Re: Search like php.net's URL thingy

2008-06-18 Thread Iv Ray

Ryan S wrote:

Thanks for replying m8, but if you check the rest of the thread you will see 
this has alraedy been solved and the result is
http://ezee.se/ezeeurl.php?do=1

Cheers!
Ryan


How do you protect this thing from being spammed?

I do not know why somebody would spam it, but I have had all kind of 
forms being spammed - it seem there are people out there who find 
immense pleasure in spamming forms, regardless of the result.


Iv

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



Re: [PHP] CAD file decoding

2008-06-18 Thread Iv Ray

Lester Caine wrote:
 Has anybody seen any software that could be used with PHP to extract the
 preview pictures from CAD files such as DXF and the like. I'm looking to
 keep thumbnails of the drawings in much the same was as we generate
 thumbnails of images. So I can display a list of previews before
 downloading the whole file.

It seems DXF files can be accessed with JavaScript.

This sounds a bit peculiar to me, how big are these files?

Iv

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



[PHP] climb up the path

2008-06-18 Thread Iv Ray

hi all,

i need a way to get the path to the parent folder of the folder i am in. 
one dirty way i found is this -


require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR .
 ..  . DIRECTORY_SEPARATOR .
 config.php);

i can also explode() and reassemble all folders except the last, but 
this looks also dirty...


is there a direct way?

iv

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



Re: [PHP] climb up the path

2008-06-18 Thread Iv Ray

James Dempster wrote:
 Personally I use.

 ?php require_once(dirname(dirname(__FILE__)).'/config.php');

 I think it's what most people do.

A... very interesting, thanks.

To get the path only I did this -

$path = dirname(__FILE__);
$parts= explode(DIRECTORY_SEPARATOR, $path);

array_pop($parts);

$INSTALL_PATH = implode(DIRECTORY_SEPARATOR, $parts);

It's kind of long...

If somebody has a better idea, I would be glad to hear.

Iv

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



Re: [PHP] climb up the path

2008-06-18 Thread Iv Ray

Stut wrote:

$path = dirname(dirname(__FILE__));

That will get you the parent directory.

-Stut


A,... right! - me and my limited thinking... - dirname() gives the 
parent of a file AND of a directory, right.


Thanks,
Iv

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



Re: [PHP] climb up the path

2008-06-18 Thread Iv Ray

Jim Lucas wrote:

Iv,

tell me why you are wanting to do this?

If it is the reason I think it is, I can give you a better way to 
accomplish this.


I have the source and a configuration file, which I want outside the 
source - it is different from server to server.


The easiest is to have the configuration file one folder up.

In  the same time I want the source to work wherever it is placed.

So the source sees where it is, and climbs one directory up to read the 
configuration specific for this installation.


I do not want to use ignore in the repository, in order to prevent the 
configuration file from being overwritten.


Iv

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



Re: [PHP] Adding a page with FPDF

2008-06-18 Thread Ray Hauge

Brian Dunning wrote:

Anyone use FPDF?

I'm trying to create a new document in memory, starting with a template 
document - I'm going to add some stuff to it. The template document 
might be any size and dimensions. Here is the code I'm using, and my 
problem is that the resulting document is always an 8.5x11 page. How do 
I get my new document to be the same dimensions as the template doc?


$pdf= new fpdi();
$pagecount = $pdf-setSourceFile(templates/.$pdf_template_name);
$tplidx = $pdf-ImportPage(1);
$pdf-addPage('P');
$pdf-useTemplate($tplidx);



I think you have to specify the page size when you create the $pdf 
variable.  Here's how I've been using it:


$pdf = new fpdi('P','pt','letter');

You might be able to use the FPDF_TPL::getTemplateSize() method to 
figure it out dynamically somehow though:


http://www.setasign.de/support/manuals/fpdf-tpl/fpdf-tpl/fpdf-tpl-gettempaltesize/

It also looks like the useTemplate method might do some legwork for you, 
but I'd have to test...


http://www.setasign.de/support/manuals/fpdf-tpl/fpdf-tpl/fpdf-tpl-usetemplate/

HTH

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Canvas examples

2008-06-16 Thread Ray Hauge

Richard Heyes wrote:
I guess the other browser doesn't do much with canvas ? 


Nope. Eg:

canvas id=foo
This gets shown on none supporting browsers, but not on supportive
browsers.
/canvas

MSIE just shows the text and doesn't do anything with the canvas.

One thing about using a canvas is bandwidth. If it's a big concern I 
would hazard a guess that a bar chart (for example) would cost less in 
terms of code required to build the image compared to JPGraph, and also 
less in terms of output (particularly if you were to use output 
compression).




Another idea for dynamic graphing could be:

http://solutoire.com/plotr/

It also uses the canvas element, but if you use excanvas for IE it'll 
work in most newer browsers.  I've used it in a project to provide 
dynamic bar graphs from a queue so that they could see in semi-real time 
how many customer requests were in different queues.  It was an internal 
app, or else I'd link it :(


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Canvas examples

2008-06-15 Thread Ray Hauge

Richard Heyes wrote:
Does anyone have any more examples of the new canvas element they've 
written?


FF only: http://www.phpguru.org/canvas.html



This is a pretty interesting use of Canvas as well.  Thanks for sharing!

http://ejohn.org/blog/processingjs/

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] PHP connection to external application

2008-06-13 Thread Iv Ray

hce wrote:

Let me first describe the requirement more:

The C program is a major business server


I would not connect applications on low level.

I would think of a web services type of interface - http request and 
xml response (Steven suggested, for example, SOAP - but it does not need 
to be that complicated).


The has several benefits -

a) Clearly defined, the web services gate will not be affected by 
changes in the C program.


b) You can use the web services gate to plug not only your php 
application, but any other application that can (be made to) talk web 
services.


c) The implementation of the php application, in this case, will be 
trivial, resulting in cheaper developers/development/maintenance/expansion.



   (ii) What is the maximum number concurrent requests in a PHP web
application? Will the maximum socket number  / or port number (up to
2^16) be a bottleneck for large number of concurrent requests (hundred
and thousands)?


Nobody can tell you this for your existing infrastructure. The only 
thing you can do is try and optimize.


Iv

--

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



Re: [PHP] UK PHP Host/Developer Required

2008-06-13 Thread Iv Ray
2. It's useful if the host company and the client keep the same office 
hours.


If you have a hosting company with 9 to 5 office hours, you are dead, 
even if it is next door.


Iv

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



Re: [PHP] class? package?

2008-06-13 Thread Iv Ray

Shelley wrote:

I am working on a sns site, and now my practice is grouping classes of a
function


classes of a function... perhaps classes related to certain 
functionality?



(i. e. subscription) together. When I need it, just load the package:
subscription.

Right? ;)


Hm... I do not know your project, but to have many classes just to 
handle subscription, sounds a bit too much to me. Why don't you have a 
class called subscription, which might even extend a class called 
person or user - the subscription class can have methods, for 
instance subscribe and unsubscribe, and because subscription 
extends person or user - it already knows who is the person/user.


And then, for example, to subscribe a person/user, you do -

$subscription-subscribe($list_id);

Other possible actions -

$subscription-un_subscribe($list_id);
$subscription-is_subscriber($list_id);
$subscription-lists();

etc.

This way class subscription packs the methods needed to handle 
subscription related activities, so in your own jargon, this class is 
a package.


Of course, if the subscription process is extremely complicated, you can 
have more classes.


Iv

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



[PHP] PDF to images or something similar

2008-06-13 Thread Ray Mckoy

Hi!.
I need to create a pageflip magazine (you know, a flash magazine).
My client ask me to do a little php program that convert a full pdf 
magazine into a pageflip magazine.
My doubt is: It's possible with php to read a full pdf and make an image 
for each page?


Thanks a lot.

Ray.

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



Re: [PHP] UK PHP Host/Developer Required

2008-06-13 Thread Iv Ray

Robin Vickery wrote:

Out of hours technical support often gets billed at a punitive rate.
Which is a bugger if their out of hours is your working day.


It seems you haven't tried Rackspace (UK) yet.


And while you might get tech support out of hours, accounts and
billing usually keep normal office hours.


True.

But if you pay your bills on time, you will never talk to these.

Iv

PS I am NOT advocating that one should take hosting outside the UK. I do 
projects in Austria and I do have the hosting in the UK.


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



Re: [PHP] PHPMailer not working but Squirell mail works

2008-06-13 Thread Iv Ray

Shiplu wrote:

In my web server, I cant send mail by PHPMailer.


What does this mean?

Do you get an error message, etc.?

Iv

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



Re: [PHP] class? package?

2008-06-12 Thread Iv Ray

Shelley wrote:

Probably you have noticed this:
The classes in a package are reused together. If you reuse one of the 
classes in a package, you reuse them all. 


If that's the case, then why not just use one class as one package?
What's the point of splitting a package into several classes? :-(


I think somebody already answered.

It is actually up to you.

My grandmother used to write letters starting with a capital letter, 
writing the whole letter as one long sentence and ending with a dot. 
This would perhaps confuse most high school teachers, but in her case it 
somehow worked :)


If we take this worn out example - if you have a class dog and a class 
cat - it becomes quite clear why you need several classes. You can put 
them in a package called animals - but as other people already noted, 
the packages in php have only a symbolic role, just for clarity of 
code organization.


Iv

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



Re: [PHP] Bulk Email Problems

2008-06-10 Thread Iv Ray

Hi Andre,

I am not sure I understand what is the problem. What does it mean -

that worked fine for the last few 
years resulting in many requests for forgotten passwords and renewed site 
activity.


And what does it mean -

Last year, we sent it again, after a few minor code changes, and had no 
response whatsoever.


Iv

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



Re: [PHP] class? package?

2008-06-10 Thread Iv Ray

If you are designing with OO principles, could you give an explanation of
what is the difference classes and packages?


A class is a language construct, classes are processed/executed by php.

A package is an architectural approach - this is how you combine your 
code/classes.



When I was summarizing the OO principles, that question confused me:
http://phparch.cn/index.php/php/43-php-advanced-programming/170-principles-of-object-oriented-design


If you try to follow all these principles, it might take very long 
before you write even a line of code ;)


Take what you understand and leave the rest for later. You will become 
better, but will never be perfect ;)


Iv

--

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



[PHP] use of static methods after namespaces arrive

2008-05-28 Thread Iv Ray
In which situation would somebody use a static method, instead of a 
function in a namespace, after the namespaces arrive with 5.3?


Iv

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



Re: [PHP] OT Smarty problem

2008-05-28 Thread Iv Ray

Hi George,

I tried your code and it works.

If you have some way of remote assistance I can have a look on-site, 
if you like.


But it could be that you just need a good sleep, and then look again ;)

Iv

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



Re: [PHP] OT Smarty problem

2008-05-28 Thread Iv Ray

Gabriel Sosa wrote:
 try doing this..

 {if $clearance eq 0}

 instead use ==

 i saw that some version of smarty has a bug related to this issue

 BTW .. you could use the options helper [1]

 saludos
 gabriel

Right... I forgot to ask which Smarty version you have. I tried it with 
the last.


Iv

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



Re: [PHP] use of static methods after namespaces arrive

2008-05-28 Thread Iv Ray

Adam Richardson wrote:
If the functionality doesn't conceptually promote the inclusion of the 
variables it works on (i.e., no class variables), doesn't conceptually 
fit a scheme where instances can exist, and likely won't benefit from 
refactoring into component methods, then I could see using a namespaced 
function.


Here I would do the same.

Most of the time, though, I'd probably start out with a class method 
instead of a namespaced function so I could more readily adapt to OOP 
practices if desired as the implementation evolves.


Hm...

Would you consider it safer to convert a static method into an instance 
method, than implementing a namespaced function into a (new) class and 
redirecting the calls?


I am not starting a fight, I am really interested in what you think.

Iv

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



[PHP] Enterprise

2008-05-20 Thread Ray Hauge
I just read an interesting article about enterprise software.  One of 
the most common arguments against PHP tends to be It's not enterprise 
ready.  This article talks more about ruby, but it could be about any 
non-enterprise language as well.


http://lists.canonical.org/pipermail/kragen-tol/2005-April/000772.html

I recently got a new job at a hospital, and the enterprise software 
they have is no where near as high quality as it could/should be.  This 
is my first job at a somewhat large organization (500+ employees) so I 
was kind of shocked at the state of their software.  Typically 
healthcare systems are further behind in the technology adoption, but 
having to deal with workarounds all day long sure gets old.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] XML file locking

2008-05-19 Thread Iv Ray

Kaja wrote:
Does anyone know if any of the PHP 5 XML libraries use flock() internally? 
I'd like to use XMLReader and XMLWriter but I need to make sure theres no 
writing going on while reading and no more than one writer at time.  And if 
I have to use DOM, does DOM lock the file when it calls save()?


Or is there any xml library that allows you to pass in an already opened 
file stream ?


Thanks.


For such a low level question, I think you better ask on the developers 
list.


Iv

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



Re: [PHP] XML file locking

2008-05-19 Thread Iv Ray

bruce wrote:

Couldn't you also create a rather simple test to determine if the locking of 
the file takes place?


I personally do not trust file system level locks. Even if a software is 
not intended to be portable across operating systems, it is possible to 
use different file systems under the same operating system, and the 
rules might be different. Using file system level locks would require 
all possible file systems to be taken into account. And on top of that, 
the file systems are actively developed, so this is one more point to 
monitor, while maintaining the software. A less trouble free way is to 
create a file with the same name and extension .locked or similar, 
prior to read/write operations. Of course, this works only if the file 
is accessing only by one program, or if all programs accessing the file 
follow the same convention - but you should see that many file system 
level locks are advisory, as well.


See this -

http://en.wikipedia.org/wiki/File_locking

--

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



Re: [PHP] changing order of items

2008-05-16 Thread Iv Ray

Eric Butera wrote:

I use this:

http://developer.yahoo.com/yui/examples/dragdrop/dd-reorder.html


Looks good.

I still can't decide for one of these big libraries, prefer to use 
small things which I can fix/change, if the author does not have time 
or desire.


--

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



Re: [PHP] changing order of items

2008-05-16 Thread Iv Ray

afan pasalic wrote:
 But, actually, I need something more simple. Nothing fancy :D.

I thought so from the beginning, just thought - it does not hurt to show 
different possibilities. May be you will not implement it now, but when 
you know about it, it might give you ideas in future.


--

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



Re: [PHP] changing order of items

2008-05-16 Thread Iv Ray

Jason Murray wrote:

I am assuming that each time you click the up or down arrow you are
re-loading the page (via a GET request).  A simple solution to this, would
be to adjust the URLs assigned to the up and down arrows to carry an extra
variable, the item either directly above or directly below the one selected,
and instead of doing whole-sale renumbering, create a swap function.  That
just swaps the position of the two items.


Very good idea.

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



Re: [PHP] question about validation and sql injection

2008-05-16 Thread Iv Ray

Hej Sudhakar,

what a long e-mail ;) !

I would suggest you use e-mail address as user name. There are many good 
reasons why to do so, I will give you some, if you wish.


Iv

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



Re: [PHP] SetEnv directives in VirtualHost configuration not accessible in PHP

2008-05-16 Thread Iv Ray
I had similar problem some time ago, and there was some solution, which 
I can't remember now.


Do you still have the problem?

I'll can have a look, if still needed.

Iv

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



[PHP] the class as a namespace

2008-05-15 Thread Iv Ray

Is there a notion of the class as a namespace?

My understanding is that the namespaces are intended to help organize 
the classes in large projects (and are not perfect).


Is it considered good style to use a class simply to box related functions?

For instance, a class called files, contains functions I need for 
dealing with files - and the instantiated object is _simply_ used to 
access these functions - the instantiated object is not a file in 
itself. Thus what I do is not $INSTANTIATED_OBJECT-save(), but 
$INSTANTIATED_OBJECT-save($file) (though I could do the first if I 
first, say, do $INSTANTIATED_OBJECT-file = $file.


Accessing the functions using the scope resolution operator (::) avoids 
the need to instantiate an object, but does not allow the use of $this, 
and $this can be quite practical in order to group common logic into 
shared methods within the class and thus make the other methods smaller 
in terms of code (of course, one could use file::save, file::delete 
instead of $this-save and $this-delete, but it makes renaming objects 
more difficult).


I would be interested to hear opinions.

Iv

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



Re: [PHP] Can I install a newer version of php over an older version

2008-05-15 Thread Iv Ray

Tony M wrote:
 Can I install a newer version of php over an older version?

Perhaps what you need is this -

Upgrading PHP with the Install

To upgrade, run the installer either graphically or from the command 
line as normal. The installer will read your current install options, 
remove your old installation, and reinstall PHP with the same options as 
before. It is recommended that you use this method of keeping PHP 
updated instead of manually replacing the files in the installation 
directory.


You can read it here -

http://at.php.net/install.windows

Iv

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



Re: [PHP] Using SVN w/ Zend Studio for Eclipse

2008-05-15 Thread Iv Ray

 I do not want to copy the project into a new
 directory as the existing directory is where Apache's DocumentRoot is
 set. And although that's simple to change, I really don't think any
 IDE should mandate where I set my project's directory on the
 filesystem.

I use PDT, and there is no problem to import a project from its current 
location.


It might take you a while to exactly figure out how to do it, Eclipse is 
a bit organic in respect to the organization and working of the menus.


 Also, if I try to create a new project from an SVN
 Repository, it doesn't allow me to select what directory I want the
 code checked out in.

This works very well with PDT and Subclipse.

 Otherwise I'd just cringe and let it overwrite
 what's in my existing document root, since that's all versioned code
 anyhow.

If your current document root is a checked out svn project, 
PDT/Subclipse will see this, no need to overwrite anything.


 If any of you have run into similar frustrations, I'd love to hear it.
 So far I've spent the better part of the evening fiddling with
 extremely rudimentary features which no IDE in any programming
 environment I've ever worked with has imposed on me. Perhaps this
 thing isn't ready for mainstream yet, or perhaps I'm missing something
 obvious.

Again, I work with PDT/Subclipse.

Eclipse is simply too organic compared to what you are used to. Just 
relax and give it a try and you'll love it.


Iv

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



Re: [PHP] the class as a namespace

2008-05-15 Thread Iv Ray

Richard Heyes wrote:
 That's a common use of static classes. Eg:

 HTTP::Redirect($url);

 In fact this (from the article I've read) is exactly how namespaces will
 look like. So in the above example, HTTP could be either a namespace or
 a class.

Right. Namespaces do look similar. And PEAR employs similarly looking
packages naming convention.

So it seems the static classes (which are actually simply classes with
static methods/properties, right) are the best namespaces like way,
until the namespaces arrive.

Thanks for your note,
Iv

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



Re: [PHP] Working with internal data formats

2008-05-15 Thread Iv Ray

John Gunther wrote:
 What technique can I use to take an 8-byte double precision value, as
 stored internally, and assign its value to a PHP float variable without
 having the bytes misinterpreted as a character string.

Does it get misinterpreted, or do you just want to be sure?

The documentation says -

Some references to the type double may remain in the manual. Consider 
double the same as float; the two names exist only for historic reasons.


Does this cover your case?

Iv

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



Re: [PHP] Working with internal data formats

2008-05-15 Thread Iv Ray

John Gunther wrote:
 Example: I extract the 8 bytes 40 58 FF 5C 28 F5 C2 8F from
 an external file

You mean you extract 40 58 FF 5C 28 F5 C2 8F, so to speak, as a 
string, right?


Sorry, for asking, but somehow I do not the case.

--

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



Re: [PHP] changing order of items

2008-05-15 Thread Iv Ray

afan pasalic wrote:

this one bugs me for a while. how to change order.

I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
status value stored in mysql. I can list tasks per status or all.
order number is stored in mysql too.
the easiest way to change order is to have form for each task where you
will enter manually number and then submit (one submit button for whole
form). but, if you change order number for any task you have to change
then all order numbers below the task manually

solution with arrows (or up/down buttons) where you click on arrow and
the task switch the place with its neighbor is easy and fancy. Though,
I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
to 0 and I have to move task 14 to place 6. I have to click first 4
times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
actually happening on screen (of course) before start switching places
with 9, 8, 7, and 6.

how do you avoid this gap?
what solution do you use at all?


You have two different issues - a) how to execute the change, and b) 
what interface to provide.


To execute the change, basically you have to reorder. The best algorithm 
is question of mathematics - you can implement something and improve 
it independently from the interface.


As for the interface, the first is kind of the simplest, but somehow 
primitive. The second is a bit better, but you have noticed, not much 
better. The most elegant, considering the time we live in, would be drag 
 drop AJAX (here - http://tool-man.org/examples/, there are excellent 
examples, perhaps there are more).


It's also a question if tasks really need to be reordered manually. If 
all tasks have a deadline, you might sort them by date. If some don't, 
you can provide them unsorted, until they get one. Sorting tasks by 
moving them up/down works when you have 25 tasks, but it does not work 
when you have 50, 100, 1 000 (if you are a team leader and have 5-7 
people team) - in that case sort by date might be better.


If you get more advanced, and store time needed to complete a task, you 
could automatically shift all tasks (of a person) - when one gets 
delayed or takes longer, than planned.


Hope that helps,
Iv

--

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



Re: [PHP] SCanning text of PDF documents

2008-05-15 Thread Ray Hauge

Angelo Zanetti wrote:

Hi All.

This is a quick question.

A client of ours wants a solution that when a PDF document is uploaded that
we use PHP to scan the documents contents and save it in a DB.

I know you can do this with normal text documents using the file commands
and functions.

Is it possible with PDF documents?

My feeling is NO, but perhaps someone will prove me wrong.

Thanks in advance.

Angelo

Web: http://www.elemental.co.za 






One thing you'll have to watch is that if the PDF was created by a 
scanner, then the text on the PDF is actually just an image and cannot 
be read without OCR.  I got stumped on that one for a while when I was 
doing something similar :)


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] validating using php

2008-05-14 Thread Iv Ray

Sudhakar wrote:
 if( strlen(trim($name) == 0 ) || !preg_match('/^[a-zA-Z ]+$/x', $name) )
 {
 $error.=Name is blank or has special characters ;
 }

You have messed up the brackets. This -

strlen(trim($name) == 0 )

should be -

strlen(trim($name)) == 0

Then the script does what you want.

Iv

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



Re: [PHP] validating textarea using php

2008-05-13 Thread Iv Ray

Sudhakar wrote:
 i do not want
 this to happen, if a user simply hits the spacebar and does not type
 anything i should be able to display an alert message.

From usability point of view such check will, in many cases, generate 
annoyance, and bring nothing.


If I do not want to enter anything, and you error me to enter 
something, I'll do like this -


asdlöfjasdpoöfja spdfj as fsdaölkjf

And your check is dead. If you want something, you will get something.

It is hard (from usability point of view) to validate textarea to that 
extent, and especially - to get reasonable answers...


I work for a scientific database, where all content providers are very 
intelligent, well educated and very disciplined, and the content editors 
still have hard time thinking how to guide the content provider so that 
they provide reasonable input.


Your problem is not so much php related, but a usability and editorial one.

Iv

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



Re: [PHP] creating an xls file from mysql data

2008-05-12 Thread Ray Hauge

Chris wrote:

Richard Kurth wrote:

This script will create an xls file from the data that is sent to it
When I run this it only gets one recored and it is supposet to get all
the records that are past by the  $_POST[selectedcontactlist]
I think I have a } in the wrong place but I can not figure it out
anybody have a suggestion

$_POST[selectedcontactlist]=3,45,65,23,12,4,56; //this is a sample of
what is past

$ExplodeIt = explode(,,rtrim($_POST[selectedcontactlist],,));
$Count = count($ExplodeIt);
for ($i=0; $i  $Count; $i++) {
$sql = SELECT * FROM contacts WHERE id = '$ExplodeIt[$i]';


Instead of doing that, do this:

/**
* This section makes sure the id's you are going to use in your query
are actually integer id's.
* If they aren't, you'll get an sql error.
*
*/
$ids = array();
foreach ($_POST['selectedcontactlist'] as $id) {
  if (!is_int($id)) {
continue;
  }
  $ids[] = $id;
}

// all posted values are duds? show an error.
if (empty($ids)) {
  echo No id's are numeric, try again;
  exit;
}

$sql = select * from contacts where id in ( . implode(',', $ids) . );


That'll get everything for all of those id's and then you can loop over
it all once:

// print out the header for the csv file here.

// then loop over the results:
while ($row = mysql_fetch_assoc($sql_result)) {
  // put it into file here.
}

// close the file
// print it out.



Or you can do it straight from MySQL, which is a lot faster:

SELECT [fields] INTO OUTFILE '/path/to/file.csv' FIELDS TERMINATED BY 
',' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\n' FROM [tables] 
WHERE [conditions]


If you want a header row, then you can use a UNION statement.

--
Ray Hauge
www.primateapplications.com

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



[PHP] getting iostat -x %b with php

2008-05-06 Thread Iv Ray
What is the best way to extract just the drive load information (%b 
column) from iostat -x (on  FreeBSD)?


I imagine to exec() the iostat -x and then process the result with 
regex, but I am not sure if this is the best way - for instance, is %b 
is aways the Nth column in the returned value?


Iv

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



Re: [PHP] peer review (was php framework vs just php?)

2008-04-25 Thread Ray Hauge

Jay Blanchard wrote:

I did a quick and dirty of just one of those functions. This function
takes a table and creates a form based on the table. It needs quite a
bit of refining, but I am willing to share and let you guys and gals
throw suggestions;


I use a very similar style of approach, but it's more on a field by 
field basis rather than a whole form.  I also wrote mine on company 
time, so here's an example:


?php $table = 'customers'; ?
form id='search' name='search' action='' method='post'
table align='center'
tr
td align='right'?php echo UI::getFieldLabel($table, 
'first_name'); ?/td
td colspan='3'?php echo 
UI::getBlankTextField($table, 'first_name'); ?/td

/tr
tr
td align='right'?php echo UI::getFieldLabel($table, 
'city'); ?/td
td?php echo UI::getBlankTextField($table, 'city'); 
?/td

/tr
tr
td align='right'?php echo UI::getFieldLabel($table, 
'state'); ?/td
td?php echo UI::getBlankSelectField($table, 
'state'); ?/td
td align='right'?php echo UI::getFieldLabel($table, 
'zip'); ?/td
td?php echo UI::getBlankTextField($table, 'zip'); 
?/td

/tr
/table
/form

The UI class figures out the max-length of the field, and there are also 
configurations to determine what type of field it is (text, phone, date, 
textarea, etc.) and security settings based on the user logged in.  This 
has helped keep my template files very clean, and I still have full 
control over the form by not including the fields I don't want.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Should This Newbie Learn From Dreamweaver?

2008-04-22 Thread Ray Hauge

revDAVE wrote:

First of all - I know this is an entirely subjective question, and I know
there's no single approach to learning this technology. I'm just looking for
a few hints from seasoned professionals basically whether Dreamweaver
verbose code (at least it looks like that to me at this beginning point) is
all 'needed  necessary'...
 


Like you said it's all subjective, but my opinion is to learn the basics 
first, then you can rely on your tools to take the mundane work out of 
the way for you.  I'd still suggest using an editor with code completion 
though, because it will help you when you're trying to remember 
parameter orders or even function names to a point.


After you feel comfortable with that, then you'll be able to understand 
what the program is doing for you and it won't be a black box that 
really is unsupportable.  I find the best way to do that is to come up 
with some little program that you code up for fun to help get you 
through the learning stages.  You'll learn more figuring out how to get 
something to work than just copying and pasting code.


That's my 2 cents.  Hope that helps.

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Evaluating math without eval()

2008-04-12 Thread Ray Hauge

Jason Norwood-Young wrote:

On Thu, 2008-04-10 at 13:15 +0100, Richard Heyes wrote:

First post to this list! I'm trying to figure out how to evaluate a
string with a mathematical expression and get a result, but without
using eval() as I'm accepting user input into the string. I don't just
want addition, subtraction, multiplication and division - I'd like to
take advantage of other functions like ceil, floor etc. 


So the string 18-10 should give me 8, ceil(1/2)*10 should be 10 (if
my maths is correct) and the string 18-10;\r\nunlink('/var/www/*');
should not execute.
If you can provide your users with distinct inputs (if it's a form) go 
that route.


Thanks Richard

Unfortunately it's not that simple. The equation sits in a DB and can be
anything - eg. ((([valuation]/[purchaseprice])/100)*100)/[numyears]
would be a typical field. [valuation], [purchaseprice] and [numyears]
gets replaced by relevant fields from user-entered data. But the system
is expandable which means I don't know what the equations, data or
fields are going to be beforehand. 


I'm working on some kinda preg_replace function to sanitize the data at
the moment and then run an eval - arg I hate regexp! Ideally eval would
have some kind of sandboxing option, or you could limit the functions
available in an eval.

J




you might be able to leverage a call to expr on a bash sell.  Just 
replace the variables you're expecting with preg_replace or some similar 
function.


http://hacktux.com/bashmath
http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/

I'm not sure if that's any more secure than eval though.

--
Ray Hauge
www.primateapplications.com

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



[PHP] April Fools Easter Egg

2008-04-01 Thread Ray Hauge

Don't forget to check your phpinfo() page for the annual easter egg.

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] April Fools Easter Egg

2008-04-01 Thread Ray Hauge

tedd wrote:

At 9:23 AM -0500 4/1/08, Ray Hauge wrote:

Don't forget to check your phpinfo() page for the annual easter egg.

--
Ray Hauge
www.primateapplications.com



You got me.

Cheers,

tedd



Here's the image that I see on PHP 5.1.0. My 5.2.5 site has a distorted 
image instead of the dog.


5.1.0:
http://www.primateapplications.com/info.php.gif

5.2.5:
http://www.primateapplications.com/info.php

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Dates Again

2008-03-31 Thread Ray Hauge

Zoltán Németh wrote:

VamVan írta:

Hello All,

I have a date in 2008-03-29 12:15:00  format.

   - How can I reduce one day from it?
   - How can I reduce one hour from it?
   - How can I add 1 hour to today's date?

Thanks



just convert it to a timestamp with strtotime()
then you can manipulate it by adding/substracting
- 86400 for a day
- 3600 for an hour
then convert back with strftime()

http://hu.php.net/strtotime
http://hu.php.net/strftime

greets,
Zoltán Németh



I believe you can also use strtoime() 
http://us.php.net/manual/en/function.strtotime.php


$time = strtotime($inputTime);
$time = strtotime('-1 day', $time);
$outputTime = strftime('%Y-%m%d', $time);

I'm not sure which is more efficient, but it helps when you're looking 
for next thursday or other things like that.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] question about linux editor

2008-03-25 Thread Ray Hauge

Sudhakar wrote:

i need to connect to the linux server using an editor. can anyone suggest
which would be an ideal linux editor to connect to the server.
apart from the ip address, username and password are there any other details
i would need to connect to the server.

please advice.

thanks.



I also will typically use SSH + vi, but Zend Studio (not sure about 
Eclipse) can open an SSH connection and edit files that way.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] google books

2008-03-24 Thread Ray Hauge

John Pillion wrote:

Not a PHP question. but could someone point me in the direction of how to
download/display only a portion of a PDF, much like google books does?  For
example, if you have a 200 page pdf, but the user wishes to see the portion
that is on page 150. rather than downloading the entire PDF, only
download/display page 150?

 


I would like to avoid having to split them into 200 individual PDF's
(whether manually or automatically).

 


Any suggestions?

 


- JP




You could use FPDF and FPDI to just load up the one page:

http://www.setasign.de/support/manuals/fpdi/

Just use importPage($thePageNumberYouWanted);

code

$pdf = new fpdi('P', 'pt', 'letter');

$pdf-setSourceFile(self::PATH);
$tpl = $pdf-ImportPage(1);
$pdf-AddPage();
$pdf-useTemplate($tpl, 0, 0);

$data = $pdf-buffer;
$pdf-closeParsers();

header(Content-type: application/pdf);
header(Content-disposition: inline; filename=FileName.pdf);
header(Content-length:  . strlen($data));

echo $data;

/code

I just realized that the version of FPDI I've been using is a little 
old.  There's a new update out, so some of the above code might change a 
little.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] spider

2008-03-21 Thread Ray Hauge

tedd wrote:

Hi gang:

How do you spider a remote web site in php?

I get the general idea, which is to take the root page, strip out the 
links and repeat the process on those links. But, what's the code? Does 
anyone have an example they can share or a direction for me to take?


Also, is there a way to spider through a remote web site gathering 
directory permissions?


I know there are applications, such as Site-sucker, that will travel a 
remote web site looking for anything that it can download and if found, 
do so. But is there a way to determine what the permissions are for 
those directories?


If not, can one attempt to write a file and record the 
failures/successes (0777 directories)?


What I am trying to do is to develop a way to test if a web site is 
secure or not. I'm not trying to develop evil code, but if it can be 
done then I want to know how.


Thanks and Cheers,

tedd



Have a look at something like this:

http://simplehtmldom.sourceforge.net/

I haven't used it, but if it works you should be able to pull up a list 
of all the a tags quite easily through the DOM ala:


foreach($dom-find('a') as $node)
  echo $node-href . 'br';

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] why use {} around vraiable?

2008-03-20 Thread Ray Hauge

Lamp Lists wrote:

hi,
I saw several times that some people use this
 
$parameters = array(

  'param1' = {$_POST[param1]},
  'param2' = {$_POST[param2]}
 );

or

 $query = mysql_query(SELECT * FROM table1 WHERE id='{$session_id}');

I would use:

$parameters = array(
  'param1' = $_POST[param1],
  'param2' = $_POST[param2]
 );
 
 and


 $query = mysql_query(SELECT * FROM table1 WHERE id=' .$session_id. ' );


does it really matter? is there really difference or these are just two 
styles?

thanks.

-ll


  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


The brackets are used to enforce that the entire contents between them 
is a variable.  It helps when you're using class members.


$example = this is an {$example-text};

It's also handy when you're putting variables in a heredoc.

I would suggest not using {$_POST[param1]}, like you said.  It's 
just going to make PHP figure out the string, then put the value in that 
string.  If you really wanted to make sure it's a string type then you 
can do (string)$_POST['param1'].


The short answer is you can do it the way you're doing and everything 
will work out just fine :)


--
Ray Hauge
www.primateapplications.com

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



[PHP] Closures

2008-03-18 Thread Ray Hauge
I've been reading up on some of the parts of PHP that has been suggested 
could be improved so that I could be more well informed.  One of the 
more interesting (for lack of a better word) suggestions is closures. 
 I've used closures primarily in JavaScript, and they are handy in that 
context, but JavaScript handles events and other more dynamic situations 
like that.


I can't really think of any good examples of why I'd want to use a 
closure instead of just calling functions or class methods in PHP. 
Variable functions and call_user_func*() have worked for any of the 
cases where I did need to be a bit more dynamic.


I found a great summary of some discussion on the internals mailing list 
over here: http://devzone.zend.com/node/view/id/2013#Heading1


After reading that article through, I do like Wez's idea of how to 
create anonymous functions.  The point about it causing confusion with 
people coming from other languages definitely applies though.  This 
article also gives me a second idea for this post.  How many people 
would want closures in PHP?


In summary:

Would you want closures in PHP, and why?

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Closures

2008-03-18 Thread Ray Hauge

Nathan Nobbe wrote:
if we were going to see support for anything anonymous that i would 
welcome it would be anonymous objects and the ability to create an 
object on the fly from an interface as per java 5. 


I'm not sure if this would solve your problem (my lack of java knowledge 
is showing), but you can create objects either by creating a new 
stdClass() object, or by using (object)NULL.  Example:


?php

$object = (object) NULL;

$object-test1 = 1;
$object-test2 = 2;

echo $object-test1 . \n;

echo $object-test2;

?

After trying to add a way to call a function from an object variable, I 
have come to the conclusion that it's kinda ugly.


?php

$obj = (object) NULL;

$obj-test = 2;
$obj-myTestFunc = myTestFunc;

function myTestFunc () {
   return test;
}

echo call_user_func($obj-myTestFunc) . $obj-test;

?

Does anyone have a link to some documentation about the stdClass?  All I 
could find was a bunch of bug reports and other stuff that wasn't what I 
was looking for.  I would have thought there'd be a page for it in the 
manual, but I didn't find one there either.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Objects as array key names??

2008-03-15 Thread Ray Hauge

Jim Lucas wrote:
This question should probably be directed at the PHP Internals list, but 
I thought I would start by asking here first if anybody would even use 
this feature.


It has been brought to my attention that with Perl and Ruby, you can use 
Objects as the value of the key within an array.  The examples that were 
shown to me make me think that this would be an awesome ability to have 
within PHP.


Here is an example of how I would use such a feature.

I have a table of customers.
I have a table customers contact_locations.
This table has a reference ID back to the customers table.

Now, in my array of information that I build I have this.

$res = query('Select c_id, c_first_name, c_last_name FROM customers');

$customers = array();
while ( $row = fetch_assoc($res) ) {
$customers[$row]['contact_locations'] = array();
$SQL = SELECT *
FROM contact_locations
WHERE c_id={$row['c_id']};
$loc_res = query($SQL);
while ( $loc_row = fetch_assoc($loc_res) ) {
$customers[$row]['contact_locations'][] = $loc_row;
}
}


Now, contained within one array $customers I have all the information 
that would be needed for displaying any type of information related to a 
customer or a customers location.


By doing having this feature, I could build the ability to do xPath 
searches within the base array.  That would be nice.


Anyways, what do you all think?  Worth it or not?

Jim Lucas



Maybe I don't get the new concept, but what would be wrong with:

// START CODE //
$cid = null;
$customers = array();

while ( $row = fetch_assoc($res) ) {

$cid = $row['cid'];
$customers[$cid] = $row;
$customers[$cid]['contact_locations'] = array();

$SQL = SELECT *
FROM contact_locations
WHERE c_id={$cid};

$loc_res = query($SQL);

while ( $loc_row = fetch_assoc($loc_res) ) {
$customers[$cid]['contact_locations'][] = $loc_row;
}

}
// END CODE //

Now you can easily reference all of your customers by ID and get any of 
the data you want.  I would actually just load the record I want from 
the database and not chew up all that memory, but this is just an 
example anyway.


I guess it could allow you to somewhat consolidate a two-dimensional 
array down to a single dimension.  In order to use the data, you'd have 
to use array_keys() or something similar to use it though.


It's an interesting idea, but I don't know how practical it would be.

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] What's wrong the __autoload()?

2008-03-13 Thread Ray Hauge

Greg Donald wrote:

On 3/12/08, Ray Hauge [EMAIL PROTECTED] wrote:

You
 come to a PHP mailing list to proclaim that RoR is better?


No dumbass, I have already been here for a long time:


This is my last post on this thread.  It's obvious nobody is going to 
convince anyone else of their being right or wrong.  The issue people 
are having is your attitude from about reply #2 from you on this thread. 
 I just wanted to make that point clear.  Trolling and being 
antagonistic doesn't get you anywhere.


The point of this reply is I didn't say anything about how long you've 
been around here.  The fact is you're still here, and we're talking PHP.


I will give you that you weren't the first to submit an opinion of Ruby 
being the best or the worst.  Your first reply was simply open minded, 
but then you got your feathers all ruffled when someone said they didn't 
like Ruby, albeit in a somewhat negative connotation.


 It's people like you that turn a lot of people off to Ruby.

I choose to use a language for a while before forming an opinion.  I
certainly wouldn't let someone's opinion sway my own inquisitive
nature to have a go at it myself.

The reason it turns people off is you have to work with the community as 
well as the language.  If you want the project to get better, you need 
to be able to work with the community.  I will admit that the PHP 
Internals list can get pretty heated as well, but those arguments are 
usually based on technical opinions and not religious fervor for the 
language*.


* Note: I haven't read a whole lot on the Internals list, but based on 
summaries by PHP|Architect and other sources I have assumed my conclusion.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Unexcepted $this

2008-03-13 Thread Ray Hauge

Eric Butera wrote:

2008/3/13 Anup Shukla [EMAIL PROTECTED]:

Murat BEŞER wrote:
  So what do you thing about on this thing ?
 

 I really would like to figure out the problem.
 However, my simple script to mimic your code did not throw any errors.

 If you could provide some more details, maybe we can figure out the problem.

 --
 Regards,
 Anup Shukla



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




It could just be a special character in the code somewhere.  Since
pushing/pulling files happens across so many servers with different
encodings it happens sometimes.  On OSX there is a text editor named
TextWrangler that has a feature called Zap Gremlins that I use to
get rid of it when it happens.


Would it be possible to post the code you have now to http://pastebin.com/ ?

That might assist in locating odd characters if that's the case, though 
I'd think that your editor would display them as well.  Usually an 
Unexpected  means that you missed a parenthesis or curly brace, etc.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] setcookie

2008-03-12 Thread Ray Hauge

Wolf wrote:



Tim Daff wrote:

Hi,

I am learning PHP, I am trying to set a simple cookie:

html
head
titleCookies/title
/head
body
   ?php setcookie('test', 45, time()+(60*60*24*7)); ?
   /body
/html

Firefox is returning this error:

Warning: Cannot modify header information - headers already sent by 
(output started at /Users/Daff/Sites/php_sandbox/cookies.php:7) in 
/Users/Daff/Sites/php_sandbox/cookies.php on line 7


I have googled this and can't find out what I am doing wrong.  Any 
help you could give me would be much appreciated.


Tim


 ?php setcookie('test', 45, time()+(60*60*24*7)); ?
 html
 head
 titleCookies/title
 /head
 body



 /body
 /html

Cookies HAVE to be at the top of the page...  You output ANYTHING else 
and you get the error you wound up getting.


Wolf




If you're not sure if data has already been sent to the client (I ran 
into an included file having a space after ?) you can use 
http://us3.php.net/manual/en/function.headers-sent.php before you call 
setcookie();


If nothing else it'll help with diagnosing this error when you run into 
it again.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] A Quick Reminder....

2008-03-12 Thread Ray Hauge

Jason Pruim wrote:


On Mar 12, 2008, at 11:06 AM, Daniel Brown wrote:

On Wed, Mar 12, 2008 at 11:01 AM, TG [EMAIL PROTECTED] 
wrote:
How about something OT that we can argue about...   driving on the 
left side

of the road versus the right side.  How does your country compare?


   Here in Pennsyltucky, a lot of people drive on the left, despite
the fact that the whole US is supposed to drive on the right.  It
usually doesn't turn out very good.  .:shakes head, solemnly:.

   Not very good at all.


Up here in the great big hand (Michigan for those who don't know) during 
the winter we have so much snow on the ground that you just kind of 
drive where ever looks like road... Even if it means you have people 
passing on your right going the opposite way.



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]






I'm in Fargo, North Dakota (the that's a state? state).  We experience 
very much the same thing.  Especially on the side roads that don't get 
cleared as well.  You just have to make sure that you don't run into 
each other and you're good.


As far as replies, I like bottom posting because it keeps the 
conversation flow more in tact.  GMail does a good job regardless of 
bottom or top posting though.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] What's wrong the __autoload()?

2008-03-12 Thread Ray Hauge

Greg Donald wrote:

On 3/12/08, Robert Cummings [EMAIL PROTECTED] wrote:

Just because someone got a flashy new toy doesn't mean I want it. I've
 got better things to do than play with flashy toys for the mere purpose
 of playing with flashy toys. I like to use tools that get jobs done.


Translation: I'm too lazy to learn anything new since I already know PHP.

Languages come and go.  There's a reason why we no longer need a
cgi-bin and Perl to make an animated gif.  Going further, who the hell
even uses animated gifs any more?


Ummm, I originally looked into Ruby and RoR because someone spouted off
 better and easier. After reviewing, looking at the language, trying
 some code, reading other peoples blogs, magazine articles, searching the
 web... I decided, using the brain I've been nurturing since I was a
 fetus, that I preferred PHP.


Great, just so long as we're clear on the point that Ruby is better
than PHP, just not for you personally.  I'm totally fine with leaving
the discussion at the differently preferred opinion level.  Sounds
like a cop-out but I'm ok with your holding that position all the
same.


But then who would confront your rhetoric and propaganda?


I do exhibit a bit of rhetoric at times, but in my defense it came
standard with my inquisitive mind.

Conversely I do not know what propaganda you speak of.  I've never
once made a specific claim in favor of Ruby that I couldn't back up
with example code.


You're assuming that we choose PHP over RoR based on having seen a 5
 minute tutorial. Wow, aren't you just full of assumptions.


Ok then, how many projects did you pursue before giving up and
concluding Rails or Ruby was too much effort to learn?  URL?

I will point out it's probably a good thing this same lack of effort
on your part did not occur when you began to learn PHP, otherwise we
wouldn't even be having this discussion.


Interestingly, laziness is one of the biggest motivators of innovation.
 Do more with less.


Well that sure as hell ain't PHP.  ROFL.  More with less, using PHP, hilarious.

/me points to SPL and laughs his ass off


That SHOULD be part of any developers mandate... but
 not blindly.


If by blindly you mean fun, fast, test-driven, productive development,
then yeah I guess so.




I didn't want to have to do this, but read some of Terry Chay's work on 
Ruby.  There are plenty of people who just prefer PHP to RoR.  Some 
people like Java, some people like .NET, etc.  Get over yourself.  You 
come to a PHP mailing list to proclaim that RoR is better?  What did you 
expect?  It's people like you that turn a lot of people off to Ruby. 
The community is insane!


This was a great read.  If nothing else he's funny.

http://terrychay.com/blog/article/php-ruby-evil-good.shtml

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] What's wrong the __autoload()?

2008-03-12 Thread Ray Hauge

Ray Hauge wrote:

Greg Donald wrote:

On 3/12/08, Robert Cummings [EMAIL PROTECTED] wrote:

Just because someone got a flashy new toy doesn't mean I want it. I've
 got better things to do than play with flashy toys for the mere purpose
 of playing with flashy toys. I like to use tools that get jobs done.


Translation: I'm too lazy to learn anything new since I already know PHP.

Languages come and go.  There's a reason why we no longer need a
cgi-bin and Perl to make an animated gif.  Going further, who the hell
even uses animated gifs any more?


Ummm, I originally looked into Ruby and RoR because someone spouted off
 better and easier. After reviewing, looking at the language, trying
 some code, reading other peoples blogs, magazine articles, searching 
the

 web... I decided, using the brain I've been nurturing since I was a
 fetus, that I preferred PHP.


Great, just so long as we're clear on the point that Ruby is better
than PHP, just not for you personally.  I'm totally fine with leaving
the discussion at the differently preferred opinion level.  Sounds
like a cop-out but I'm ok with your holding that position all the
same.


But then who would confront your rhetoric and propaganda?


I do exhibit a bit of rhetoric at times, but in my defense it came
standard with my inquisitive mind.

Conversely I do not know what propaganda you speak of.  I've never
once made a specific claim in favor of Ruby that I couldn't back up
with example code.


You're assuming that we choose PHP over RoR based on having seen a 5
 minute tutorial. Wow, aren't you just full of assumptions.


Ok then, how many projects did you pursue before giving up and
concluding Rails or Ruby was too much effort to learn?  URL?

I will point out it's probably a good thing this same lack of effort
on your part did not occur when you began to learn PHP, otherwise we
wouldn't even be having this discussion.


Interestingly, laziness is one of the biggest motivators of innovation.
 Do more with less.


Well that sure as hell ain't PHP.  ROFL.  More with less, using PHP, 
hilarious.


/me points to SPL and laughs his ass off


That SHOULD be part of any developers mandate... but
 not blindly.


If by blindly you mean fun, fast, test-driven, productive development,
then yeah I guess so.




I didn't want to have to do this, but read some of Terry Chay's work on 
Ruby.  There are plenty of people who just prefer PHP to RoR.  Some 
people like Java, some people like .NET, etc.  Get over yourself.  You 
come to a PHP mailing list to proclaim that RoR is better?  What did you 
expect?  It's people like you that turn a lot of people off to Ruby. The 
community is insane!


This was a great read.  If nothing else he's funny.

http://terrychay.com/blog/article/php-ruby-evil-good.shtml



One last link, because this one is the one that has caused the most 
controversy (for lack of a better word).


http://terrychay.com/blog/article/is-ruby-the-dog-and-php-the-dogfood.shtml

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] CSV speed

2008-03-11 Thread Ray Hauge

Wolf wrote:

Danny Brow wrote:

I have about 10 csv files I need to open to access data. It takes a lot
of time to search each file for the values I need. Would it be best to
just dump all the cvs files to an SQL db and then just grab what I need
from there? I'm starting to think it would make a lot of sense. What do
you guys think?

Thanks,
Dan



Dan,

I can tell you that depending on the size of your files is going to 
dictate the route you want to go.  I have a CSV with 568,000+ lines with 
19 different pieces to each line.  The files are around 180M apiece and 
it takes my server about 2 seconds to run a system grep against the 
files.  I can run a recursive call 7 times against a MySQL database with 
the same information and it takes it about 4 seconds.


IF you have system call ability, a grep wouldn't be bad, otherwise I'd 
suggest loading the csv files into MySQL tables and checking them for 
the information, then dropping the tables when you get the next files. 
You can backup the databases such as a cron job overnight even.


HTH,
Wolf




If you do go the MySQL route, MySQL can import CSV files natively, and 
it'll be a lot faster than doing it through PHP.  Just look up the 
syntax for the LOAD DATA INFILE command... or look here.


http://dev.mysql.com/doc/refman/5.1/en/load-data.html

Here's an example:

LOAD DATA LOCAL INFILE '/importfile.csv'
INTO TABLE test_table
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(field1, filed2, field3);

I've had to do imports of a million or more records from CSV files, and 
PHP is a lot slower than MySQL at importing them :)


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Unexcepted $this

2008-03-10 Thread Ray Hauge

Murat BEŞER wrote:

I can't under stood but PHP gaves me an error:

UnExcepted $this for  || $this-getFileExtension($file) == 'jpg' 

When I removed jpg extension check it's okay... PHP script runs well.

What is the problem :)

public function loadImages($folder) {
$result = $this-filemanager-fecthFiles($folder);
$images = array();
if (sizeof($result)=1  $result !== false) {
foreach ($result as $file) {
if ($this-getFileExtension($file) == 'gif' || 
$this-getFileExtension($file) == 'png' || 
$this-getFileExtension($file) == 'jpg') {

$images[] = array('name'=$file);
}
}
}
return $images;
}



Try storing the value in a variable first.  It'll also have the 
side-effect of being marginally faster too.


$extension = $this-getFileExtension($file);

if ($extension == 'gif' || $extension || 'png' || $extension == 'jpg') {
// do something
}

That might help, but I would think that the way you had it would also 
work.  Let us know what happens when you use the variable like I showed 
above.


Thanks,
--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Unexcepted $this

2008-03-10 Thread Ray Hauge

Philip Thompson wrote:

On Mar 10, 2008, at 8:32 AM, Ray Hauge wrote:


Murat BEŞER wrote:

I can't under stood but PHP gaves me an error:
UnExcepted $this for  || $this-getFileExtension($file) == 'jpg' 
When I removed jpg extension check it's okay... PHP script runs well.
What is the problem :)
public function loadImages($folder) {
   $result = $this-filemanager-fecthFiles($folder);
   $images = array();
   if (sizeof($result)=1  $result !== false) {
   foreach ($result as $file) {
if ($this-getFileExtension($file) == 'gif' || 
$this-getFileExtension($file) == 'png' || 
$this-getFileExtension($file) == 'jpg') {

   $images[] = array('name'=$file);
   }
   }
   }
   return $images;
   }


Try storing the value in a variable first.  It'll also have the 
side-effect of being marginally faster too.


Good call.



$extension = $this-getFileExtension($file);

if ($extension == 'gif' || $extension || 'png' || $extension == 'jpg') {


Correction:

... $extension == 'png' ...

Personally, I like the in_array() version better - it cleaner and you 
can expand upon it more more easily.


$extensions = array('gif, 'png', 'jpg' [, 'm4a'[, 'etc']]);
if (in_array($extension, $extensions)) { ... }



// do something
}

That might help, but I would think that the way you had it would also 
work.  Let us know what happens when you use the variable like I 
showed above.


Thanks,
--
Ray Hauge



HTH,
~Philip

Personally, most of my web applications do not have to factor 13.7 
billion years of space drift in to the calculations, so PHP's rand 
function has been great for me... ~S. Johnson





Thanks for the catch.  I work from home and I hadn't had my coffee yet 
in the morning.  I usually check my news and email right after I get up 
and before I go to  work :)


I have been starting to use in_array more often as well.  Far too many 
times I'll have to go back and add more options later, then the IF 
statement gets huge.  Someday I'll kick the habit for good though.


Oh, it might also be a bit easier to store the acceptable extensions in 
an array before the IF statement


$ext = $this-getFileExtension($file);
$acceptableExtensions = array('png', 'gif', 'jpg');

if ( in_array($ext, $acceptableExtensions) ) {
// do something
}

That way the conditional doesn't grow as more and more values get added.

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] SMTP

2008-03-09 Thread Ray Hauge

Alain Roger wrote:

Hi,

i know that this is not necessary the best forum for that, but i need to get
a real feedback and i guess you already faced the same issue as mine.
basically, i develop php web application on windows XP platform.
So i have apache 2.24 installed and PHP 5.2.4.

now i would like to test if my application send emails, so i've checked my
php.ini file and it seems ok.
i tried to use IIS from windows to define a default SMTP server, but as my
emails are not sent, i guess something is wrong with IIS.

so does it exist a free SMTP server (similar that linux daemon) but running
on windows XP ?
if yes, where can i find it and what steps should i perform to be sure my
emails are sent ?

i do not want to transfer all my web application each time i want to test
email sending...
i would like to test it locally.

thanks for your feedback.



I could be wrong, but I thought that you had to specify the SMTP server 
in the php.ini file.


http://us2.php.net/manual/en/ref.mail.php#ini.smtp

 now i would like to test if my application send emails, so i've 
checked my

 php.ini file and it seems ok.

Maybe that means you already did that.  The second issue might be that 
your SMTP server is MS Exchange, and it requires authentication.


If that is the case, then search for php SMTP authentication:

http://www.google.com/search?q=php+smtp+authenticationie=utf-8oe=utf-8aq=trls=org.mozilla:en-US:officialclient=firefox-a

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] CVS Scripts

2008-03-06 Thread Ray Hauge

Eric Butera wrote:

On Thu, Mar 6, 2008 at 10:58 AM, Adrian Walls [EMAIL PROTECTED] wrote:

Firstly thanks for a sensible reply.

 I am using Zend Studio Server and I haven't upgraded to Zend Studio for
 Eclipse as yet.  It also has some CVS capability not its not what I am
 after.

 Google was my first stop but it didn't turn up anything which appeared to be
 in a stable enough state.  Hence my email to the list to see if anyone else
 had come across such a solution.  My application is built from several
 modules contained with cvs.  Some of these modules are used across projects.
 I wanted to create my own web-based script to check these out of cvs and to
 build and configure the application on the fly.

 I had a look at cruisecontrol but its not really what I am looking for
 either.

 Adrian.






 -Original Message-
 From: Wolf [mailto:[EMAIL PROTECTED]


Sent: 06 March 2008 15:42
 To: Adrian Walls
 Cc: 'Eric Butera'; php-general@lists.php.net
 Subject: RE: [PHP] CVS Scripts

  Adrian Walls [EMAIL PROTECTED] wrote:
  1. It is a legal thing, whether it means anything or not or regardless of
  what anyone else's take is on it.
 
  2. It was a straight forward question I asked.  I guess it was my mistake
  for thinking this was a place to ask questions rather than somewhere to
 take
  the p*ss.  I'll not make the same mistake again.
 
 !-- SNIP --

 We're a bunch of helpful and flippant sods on this list, so take the
 criticism as constructive (trim your own sig file down and remove the white
 space and see if you can NOT send the confidentiality notices when broadcast
 mailing).

 As for automatic CVS via PHP, it depends on your take on it...

 Eclipse has a CVS piece to it which seems to work well (I've installed it,
 but most of my stuff is layered and I don't have a reason for CVS), though
 someone also posted about cruisecontrol on the sourceforge site.

 What have you found and tried via a google search?

 Wolf




Maybe look at Phing[1]?  Skimming over the docs (I know you said you
use CVS) I saw a task you can define to check files out form SVN.
There might be a cvs one somewhere or you could extend it and write
your own.

[1] http://phing.info/



Another option would be to write your own.  If your requirements are 
super specific, then that might be the best route.  I can't imagine it 
would be too difficult.


You can use shell_exec to execute the CVS checkout, and any other CVS 
command necessary.  Don't forget to use escapeshellcmd() either:


http://us3.php.net/manual/en/function.escapeshellcmd.php

After it's checked out, then you can use shell_exec() again to run the 
compile command.  If it takes a long time, you might be best just 
sending the command to the output so you can copy and paste and run it 
yourself, or just make sure you set_time_limit(0), or some amount of 
time it should finish compiling in.


I assume it's an internal app, so you wouldn't have to worry too much 
about it looking pretty or any of the other time consuming operations.


?php

//
// NOTE: Paths are for Linux. Change for Windows as necessary
//

$cmd = escapeshellcmd('/usr/bin/cvs -d :ext:[EMAIL PROTECTED]:/.../cvsroot 
checkout module');


$output = shell_exec($cmd);

// do something with output if you need

$cmd = escapeshellcmd('/path/to/module/configure');

$output = shell_exec($cmd);

echo done!;

?

Something like that anyway.  That's overly simplified of course, but it 
should get you a start if you want to write it yourself.


--
Ray Hauge
www.primateapplications.com

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



  1   2   3   4   5   6   7   8   9   >