php-general Digest 30 Apr 2011 02:17:53 -0000 Issue 7289

Topics (messages 312565 through 312576):

Re: What's faster using if else or arrays?
        312565 by: Steve Staples
        312567 by: Robert Cummings
        312573 by: tedd
        312576 by: Tamara Temple

question about Pear Auth and Pear MDB2
        312566 by: Michael Mitchell

Re: gd Graphics Library Question (EXIF)
        312568 by: Gerardo Benitez
        312569 by: Stuart Dallas

Re: PHP delete confirmation
        312570 by: Jim Lucas
        312571 by: Ashley Sheridan

Re: Flattery will get you nowhere
        312572 by: tedd
        312575 by: Jonesy

Wiki formatting class or something similar
        312574 by: Andre Polykanine

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
On Thu, 2011-04-28 at 19:19 -0400, Robert Cummings wrote:
> On 11-04-28 06:37 PM, [email protected] wrote:
> > Thanks switch and case seems to be more faster for the job and a lot cleaner
> > ------Original Message------
> > From: Andre Polykanine
> > To: [email protected]
> > Cc: [email protected]
> > Subject: Re: [PHP] What's faster using if else or arrays?
> > Sent: Apr 28, 2011 6:17 PM
> >
> > Hello Dholmes1031,
> >
> > I would write it like this:
> > switch($foo) {
> >             case 5: $dothis; break;
> > case 3: $dothat; break;
> > default: $donothing; break;
> > }
> 
> This sounds like a job for *dun dun dun* GOTO!
> 
> Kidding, of course ;)
> 
> Cheers,
> Rob.
> -- 

you should be removed and banned from this list for even just THINKING
about using a GOTO!  :P

(yes, there are still *SOME* (and i use that loosely) benefits to the
GOTO command, but in reality, no.)

Steve


--- End Message ---
--- Begin Message ---
On 11-04-29 08:04 AM, Steve Staples wrote:
On Thu, 2011-04-28 at 19:19 -0400, Robert Cummings wrote:
On 11-04-28 06:37 PM, [email protected] wrote:
Thanks switch and case seems to be more faster for the job and a lot cleaner
------Original Message------
From: Andre Polykanine
To: [email protected]
Cc: [email protected]
Subject: Re: [PHP] What's faster using if else or arrays?
Sent: Apr 28, 2011 6:17 PM

Hello Dholmes1031,

I would write it like this:
switch($foo) {
             case 5: $dothis; break;
case 3: $dothat; break;
default: $donothing; break;
}

This sounds like a job for *dun dun dun* GOTO!

Kidding, of course ;)

Cheers,
Rob.
--

you should be removed and banned from this list for even just THINKING
about using a GOTO!  :P

(yes, there are still *SOME* (and i use that loosely) benefits to the
GOTO command, but in reality, no.)

I've written parsers in the past that would have benefited greatly from GOTO. So, in reality (for me anyways), yes. Also, tracking state variables or using break with level parameter to escape from multi level loops isn't any clearer than a goto, so sometimes its succinctness adds clarity to the code making maintenance simpler. But obviously the above was in jest :)

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

--- End Message ---
--- Begin Message ---
At 7:19 PM -0400 4/28/11, Robert Cummings wrote:
On 11-04-28 06:37 PM, [email protected] wrote:
Thanks switch and case seems to be more faster for the job and a lot cleaner
Hello Dholmes1031,

I would write it like this:
switch($foo) {
            case 5: $dothis; break;
case 3: $dothat; break;
default: $donothing; break;
}

This sounds like a job for *dun dun dun* GOTO!

Kidding, of course ;)

Cheers,
Rob.

Rob:

Actually, goto could be used for this -- but I would rather use switch.

Cheers,

tedd

--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---

On Apr 29, 2011, at 8:32 AM, Robert Cummings wrote:

On 11-04-29 08:04 AM, Steve Staples wrote:
On Thu, 2011-04-28 at 19:19 -0400, Robert Cummings wrote:
On 11-04-28 06:37 PM, [email protected] wrote:
Thanks switch and case seems to be more faster for the job and a lot cleaner
------Original Message------
From: Andre Polykanine
To: [email protected]
Cc: [email protected]
Subject: Re: [PHP] What's faster using if else or arrays?
Sent: Apr 28, 2011 6:17 PM

Hello Dholmes1031,

I would write it like this:
switch($foo) {
            case 5: $dothis; break;
case 3: $dothat; break;
default: $donothing; break;
}

This sounds like a job for *dun dun dun* GOTO!

Kidding, of course ;)

Cheers,
Rob.
--

you should be removed and banned from this list for even just THINKING
about using a GOTO!  :P

(yes, there are still *SOME* (and i use that loosely) benefits to the
GOTO command, but in reality, no.)

People, people, don't you realize that break IS a goto?? It's just one of limited scope.



--- End Message ---
--- Begin Message ---
Hi, I'm a bit of a newbie at PHP and programming in general.

Reading a PHP book by Larry Ullman, I  was given instructions to install
Pear Auth package and also Pear DB.

As the Pear website said that DB has been deprecated in favor of MDB2, I
installed this latter package.

However, I am getting this error message when I require Auth.php...


*Fatal error*: Class 'DB' not found in *
/Users/michaelmitchell/pear/share/pear/Auth/Container/DB.php* on line *150*
*
*
I'm not sure if this means I have done something wrong (if so, what?) or if
this is somehow indicating that the Auth package is referring to the
deprecated Pear DB package? or something else

Thank you if you can help.
*
*

--- End Message ---
--- Begin Message ---
Hi Mitch, you could try with
http://www.php.net/manual/en/function.exif-read-data.php

I did a test with image jpg and this was the result:
FILE . FileName: bruce_lee_black_white.jpg<br/>
FILE . FileDateTime: 1304086298<br/>
FILE . FileSize: 33464<br/>
FILE . FileType: 2<br/>
FILE . MimeType: image/jpeg<br/>
FILE . SectionsFound: COMMENT<br/>
COMPUTED . html: width="353" height="450"<br/>
COMPUTED . Height: 450<br/>
COMPUTED . Width: 353<br/>
COMPUTED . IsColor: 1<br/>
COMMENT . 0: LEAD Technologies Inc. V1.01<br/>

Anyway taking account

*EXIF headers tend to be present in JPEG/TIFF images generated by digital
cameras, but unfortunately each digital camera maker has a different idea of
how to actually tag their images, so you can't always rely on a specific
Exif header being present. *

Regards.
Gerardo.





On Thu, Apr 28, 2011 at 11:33 PM, Mitch <[email protected]> wrote:

> I have written a lightweight, easy to use photo album "system" in
> HTML/PHP/MySQL.In addition to the Photo Album side I have written a series
> of Admin Utilities to manage it with. One of the administrative utilities
> uploads photos from my local drive, resizes them to be more efficient on
> disk space, creates thumbnails and populates the database with as much
> "default" data as can be deduced.
>
> After all of this was written, I decided to see if I could pull EXIF data
> to supply some of the technical data for the DB. To my surprise, the only
> EXIF data in the JPEG files was data in the File, Computed and Comments
> sections.
>
> Why don't the gd utilities retain the original EXIF data? Is there any way
> to do so? I use the following gd utilities to resize and create the new JPEG
> image files:
>
> imagecreatefromjpeg
> imagesx
> imagesy
> imagercreatetruecolor
> imagecopyresized
> imagejpeg
>
> Thanks in advance,
> Mitch
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Gerardo Benitez
-------------------------
www.webseficientes.com.ar
Diseño web, programación, Seo

--- End Message ---
--- Begin Message ---
On Friday, 29 April 2011 at 03:33, Mitch wrote:
I have written a lightweight, easy to use photo album "system" in 
> HTML/PHP/MySQL.In addition to the Photo Album side I have written a 
> series of Admin Utilities to manage it with. One of the administrative 
> utilities uploads photos from my local drive, resizes them to be more 
> efficient on disk space, creates thumbnails and populates the database 
> with as much "default" data as can be deduced.
> 
> After all of this was written, I decided to see if I could pull EXIF 
> data to supply some of the technical data for the DB. To my surprise, 
> the only EXIF data in the JPEG files was data in the File, Computed and 
> Comments sections.
> 
> Why don't the gd utilities retain the original EXIF data? Is there any 
> way to do so? I use the following gd utilities to resize and create the 
> new JPEG image files:
> 
> imagecreatefromjpeg
> imagesx
> imagesy
> imagercreatetruecolor
> imagecopyresized
> imagejpeg

This is a known shortcoming of the GD library. You won't have that issue with 
ImageMagick: http://php.net/book.imagick

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/





--- End Message ---
--- Begin Message ---
On 4/29/2011 12:06 AM, Geoff Lane wrote:
> On Friday, April 29, 2011, [email protected] wrote:
> 
>> Personally I would use the javascript page navigation is senseless if they
>> miss click.
>  
>> Javascript: Small and simple javascript.
> 
>> onclick="return confirm('Are you sure you want to delete?')"
> 
> Personally, I'd use Javascript and also check that the form was
> submitted after the client-side check. So something like a hidden
> field ('jstest') in the client-side form that is set to 1 by the
> onClick event prior to showing the confirmation box. Then in the
> handling PHP:
> 
> if ($_POST['jstest'] == 1){
>   // the client called us via Javascript::confirm, so we know the
>   // use really wants to delete
> } else {
>   // We weren't called via Javascript::confirm, so we need to
>   // handle the confirmation in PHP
> }
> 
> HTH,
> 

It wasn't a form, it was an HTML <a> tag

--- End Message ---
--- Begin Message ---
"Jim Lucas" <[email protected]> wrote:

>On 4/29/2011 12:06 AM, Geoff Lane wrote:
>> On Friday, April 29, 2011, [email protected] wrote:
>>
>>> Personally I would use the javascript page navigation is senseless
>if they
>>> miss click.
>>
>>> Javascript: Small and simple javascript.
>>
>>> onclick="return confirm('Are you sure you want to delete?')"
>>
>> Personally, I'd use Javascript and also check that the form was
>> submitted after the client-side check. So something like a hidden
>> field ('jstest') in the client-side form that is set to 1 by the
>> onClick event prior to showing the confirmation box. Then in the
>> handling PHP:
>>
>> if ($_POST['jstest'] == 1){
>>   // the client called us via Javascript::confirm, so we know the
>>   // use really wants to delete
>> } else {
>>   // We weren't called via Javascript::confirm, so we need to
>>   // handle the confirmation in PHP
>> }
>>
>> HTH,
>>
>
>It wasn't a form, it was an HTML <a> tag
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

I sure hope that's behind something a search engine can't find, otherwise you 
could find yourself without a lot of things that it deleted as it follows all 
the links. I think I read a couple of things similar to this on daily wtf...



Thanks
Ash
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

--- End Message ---
--- Begin Message ---
At 7:18 PM -0400 4/28/11, Robert Cummings wrote:

Flirting will get you everywhere *bats eyelids*

That'll hurt.

http://php1.net/clients/molemen/

Cheers,

tedd

--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---
On Thu, 28 Apr 2011 19:18:29 -0400, Robert Cummings wrote:

> Flirting will get you everywhere *bats eyelids*

  Dinna know bats even _had_ eyelids....


--- End Message ---
--- Begin Message ---
Hi everyone,
I  allow my users to put some Html into their blogs. I filter it using
a  great  tool  called HtmLawed and written by Dr. Santosh Patnaik (if
you're reading this, many thanks to you!).
However, I would like to give them a possibility to mark-up their text
in  a  more  convenient  way  for beginners (such as Wiki or something
similar).
I searched through http://phpclasses.org/ but didn't find anything.
Could you suggest me something?
And one more question: maybe some of you already have a handy solution
to process smilies? Say, a user writes ":)" and this is replaced by an
image in my directory.
Thanks in advance!

  

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


--- End Message ---

Reply via email to