php-general Digest 13 Sep 2008 14:10:01 -0000 Issue 5679
Topics (messages 280053 through 280062):
Re: Email - Best practice/advice please
280053 by: Ross McKay
Re: Why MS Won't Retire Browsers -- was: Interntet Explorer 8 beater 2
280054 by: Ashley Sheridan
Re: Browser could not get mp3 files from http site
280055 by: Ashley Sheridan
Re: switch case - to require the break statements seems strange to me
280056 by: Ashley Sheridan
280062 by: Eric Gorr
Re: php image and javascript include
280057 by: Ashley Sheridan
Re: check if a file is included
280058 by: Ashley Sheridan
280060 by: Eric Butera
280061 by: Ashley Sheridan
Re: Thank you...
280059 by: Ashley Sheridan
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 ---
Tom Chubb wrote:
>I have read somewhere before about creating a message id with the date&time
>and a random number.
Something like this:
'<' . date('U') . '.' . rand() . '.php@' . $_SERVER['SERVER_NAME'] . '>'
>Still I think I'm going to be ending up down the phpmailer route!
It's the easiest route, and will catch some other problems for you into
the bargain.
--
Ross McKay, Toronto, NSW Australia
"Let the laddie play wi the knife - he'll learn"
- The Wee Book of Calvin
--- End Message ---
--- Begin Message ---
Wow, anyone could be mistaken for thinking you two were Microshaft
employees...
<tirade>
Vista sucks because:
* it uses far more memory than it should, even with the visual effects
turned off
* IE7 on Vista is more flaky than IE7 on XP FACT!
* The registry hacks to get around the draconian limits on Vista are not
easily applied for all users
* It's a battle trying to edit what it thinks are system files, even if
they're not
* It doesn't really offer all that much over XP
</tirade>
And I even have one for IE7 if you really want to hear it:
<tirade>
* They've moved all the buttons around to a non-standard layout (hmm,
remind me of Office 2007)
* They changed the rendering method *again*
* Still no support for some really standard CSS
* For a browser with half the components in memory, it still takes too
long to start up
* More security holes than any other browser
</tirade>
I'd go on, but I don't want to write a university thesis...
Ash
www.ashleysheridan.co.uk
--- Begin Message ---
On Sep 12, 2008, at 10:18 AM, Boyd, Todd M. wrote:
-----Original Message-----
From: Sancar Saran [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 11, 2008 6:15 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Why MS Won't Retire Browsers -- was: Interntet
Explorer 8 beater 2
Because,
M$ earning money from Win GUI. No WinGUI no money.
From the begining, M$ try to broke web compatibilty in every way...
Sure M$ has bad records about software quality. But even ask
yourself.
WHY IE
(especially 5 and 6) SO buggy even M$ standards.
M$ isn't mr nice guy and they wont get a dime from web.
They hate web and internet from begining.
M$ is anti web IT company. They are too big they are to bold (or
bald)
to
accept changing market and they got too much money on
bank to do someting very very stupid.
Like Windows VISTA.
Don't expect anything good from M$...
<tirade>
Okay... here it goes. I'm sick and tired of people talking trash on
Windows Vista. It came pre-installed on my laptop (Home Premium...
not Business Pro, sadly) and I haven't had any issues with it
whatsoever. Some of my WinXP programs don't show up in the start
menu when they're installed... but it's not Microsoft's fault that
software companies haven't taken the initiative to adapt to the new
Vista framework (which, let's be honest, can't require all that much
effort in most cases where base-level operating system stuff isn't
involved in the actual program).
Annoyed with the UAC that asks you to confirm every administrative
decision you make on your computer? Quit being a weenie and just
automate it with RegEdit (or, if you're using Business, there is an
explicit option for it in the Control Panel).
Annoyed with all the bells and whistles in the Aero theme that is
installed by default? Don't use it! I remember the first time I
installed a Linux distro that came pre-bundled with KDE... I took
the time to remove all the fading, transparency, window animations,
bouncing cursors, etc. (actually, I just switched to XFCE instead).
I don't see the difference. If you want to get high and mighty with
a retort about rolling your own Linux distribution--well, you've
just sailed far beyond ANY pre-packaged OS (Mac, Windows, Linux, or
otherwise) and the point is moot.
Find a new scapegoat to complain about, PLEASE. Bitch about WebKit's
lack of XMLDOM instantiation. Bitch about Google launching pay-for-
play high resolution satellite imagery. Bitch about the Xandros EEE
being squashed by Intel. Bitch about Facebook's API and their
draconic limitations on markup language and Javascript... but this
"Vista sucks and I won't comment as to why" broken record has run
its course.
</tirade>
Have a lovely day!
Todd Boyd
Web Programmer
Three Votes Todd!! In total agreement.
I've been meaning to make a similar post & statement not just here (in
PHP mailing list), but in an abundant number of places all across the
Internet horizon. And My PC didn't come bundled with Vista, in fact, I
actually Upgraded from XP personally & manually.
I have no stock options in Microsoft, and I have nothing personal with
them - Just another commodity user/customer. And I couldn't have said
it any better.
Cheers!
---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.
[Email] [EMAIL PROTECTED]
[Web] http://www.rahulsjohari.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- End Message ---
--- Begin Message ---
As far as I'm aware, the embed tag is not supported in any HTML
standard, and as such, it's a little hit and miss. Depending on what you
want to achieve, you should look towards the object tag instead:
http://joliclic.free.fr/html/object-tag/en/
Ash
www.ashleysheridan.co.uk
--- Begin Message ---
On Fri, Sep 12, 2008 at 4:14 AM, hce <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a php file audio.php to send mp3 file audio.mp3 to browsers,
> the browser needs following html code to play mp3 file. I thought it
> should work if I put the the audio.mp3 file in the same localtion with
> the http://www.myweb.com/audio.php. But the browser could not get the
> audio.mp3. I guess something is missing here, please correct me.
>
> <embed target="audio.mp3"
> .....
> />
>
> Thank you.
>
> Jim
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Hi Jim, can you post your code that handles this. Going there and looking
at the source, it only says the file could not be found.
--
-Dan Joseph
www.canishosting.com - Plans start @ $1.99/month.
"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."
--- End Message ---
--- End Message ---
--- Begin Message ---
Well, I've often found the need to treat several conditions with the
same set of statements within a switch:
switch($some_number)
{
case 1:
case 2:
{
// do some shizzle
break;
}
case 3:
{
// foshizzle that nizzle
break;
}
default:
{
// dizzle everything else here
}
}
You never need a break in the last case, and you don't need a default
case if you know all the values you expect, although if you do have one,
I believe it does have to be the last statement.
Ash
www.ashleysheridan.co.uk
--- Begin Message ---
At 10:58 AM +0100 9/12/08, Luke wrote:
I wonder if this is a shared trait between C and PHP (since I
understand PHP is written in C) that the break; and the default: are
placed for good practice in all switch statements since they prevent
memory leaks?
First, the evolution of computer languages from rocks to what we have
now has produced numerous logic constructs. Those that are
successful, remain and appear again and again in subsequent
languages. Those that are not successful fade way. As a result, all
languages are converging on a successful set logic constructs.
The CASE statement has been one of those concepts that has been
successful and I expect it to remain -- whereas, others like DO/WHILE
may fade away -- I never found reason to use it.
I may be wrong, I seem to remember that the CASE statement preceded
the ELSE IF statement -- and is one of the reasons why I never use it
(being dyslexic is another). If I was THE PHP czar, I would drop-kick
ELSE IF -- for me it's perfectly useless and confusing. YMMV.
Second, as for memory leaks??? The CASE statement, nor any other
logic configuration, has anything to do with memory leaks -- that's
different.
I am sure there are people who will disagree, but a memory leak is a
condition that comes about from declaring a memory allocation (a
specific size) for a variable and then later upon discarding that
variable and releasing its memory back into the free memory an error
is made in its size.
In other words, memory leaks are accounting errors in memory
allocations that reduces the amount of available free memory OR worse
yet, mistakenly assigns memory to new variables that is still in use
and has not been released -- all of which can crash a program.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- End Message ---
--- Begin Message ---
On Sep 12, 2008, at 5:13 PM, Robert Cummings wrote:
On Fri, 2008-09-12 at 16:51 -0400, Eric Gorr wrote:
On Sep 12, 2008, at 4:27 PM, Robert Cummings wrote:
On Fri, 2008-09-12 at 16:11 -0400, Eric Gorr wrote:
On Sep 12, 2008, at 3:44 PM, Robert Cummings wrote:
I don't see how that in any way makes an argument for or against.
Once
still must spend client's money wasting time on code that has
questionable merit. Yes, some debugging code is a great boon in
any
application, but littered everywhere to fulfill someone's
subjective
philosophical ideal when sometimes it's just plain unnecessary...
wasteful IMHO.
As far as I know, no one has yet come up with a proof showing when
debugging code is and/or is not necessary.
The simple fact is that bugs can popup anywhere and spending a
client's time and money by spending a few minutes writing all of
the
simple test cases throughout an application can be well worth it as
it
can save far more of the client's time and money by not wasting
it on
tracking down bugs that could have been easily caught.
It is impractical to include debugging code for every conditional
in a
program.
I have yet to see any evidence that it is impractical, especially
after one has gotten into the habit. After all, for switch
statements,
adding in a default case takes mere seconds.
Yes but if you do for case, you SHOULD do for if/else if/else which is
an analagous approach.
Doubly impractical to do so in PHP unless you have some way to
prevent said debugging code from running in production.
It isn't hard to prevent a code path from running in a production
environment and allowing it to run in a development environment. Just
one example, in PHP, would be globally defining something like
PRODUCTION and then testing to see if it has a value of 1 or 0 and
then writing an if statement to test the value before executing some
code.
There you go... you just ran a useless branch. Replacing one code path
with another is hardly an optimial solution. What if your case
statement
is in a tight loop that runs a million times?
How could that possibly matter since the code is never supposed to be
executed to begin with and if it is executed it would immediately
imply there is a bug?
Furthermore, the whole point of these test cases is for those parts
of
the code which are never supposed to be executed to begin with, so
that alone will aid in preventing said debugging code from executing
in production...and if said debugging code does run in production,
would that be such a bad thing (assuming it doesn't interfere with
the
user)? After all, because it (like the default switch case) was
executed, it immediately implies there was a problem...
If they're never supposed ot be executed then why are you adding extra
code? That sounds like a need for better logic skills, not a need for
debugging code.
Because, it is never supposed to be ... not never will be. Bug's cause
all kind of things to happen...including code paths that aren't
supposed to happen.
I doubt any client would believe it a good thing that a bug that
should have been caught in development wasn't caught until production
because mere minutes weren't spent putting in debug code that would
have caught these bugs.
Maybe you're
confusing debugging code with unit tests. As I said earlier, it is
far
more practical to do so for complex conditions where a reader might
easily get lost. Rather useless for simplistic cases.
Until one finds it has saved hours because a problem was caught, I
can
understand why some would think that it is rather useless.
I've spent hours on bugs before, they were never once related to not
having put debugging fluff into a simple set of case statements. They
were almost always related to lack of comments in a complex or hackish
chunk of code.
Great. I hope that continues.
--- End Message ---
--- Begin Message ---
I've never been a huge fan of Vi or Vim, but I am a fan of coding in a
text editor, not a GUI, I just guess I prefer Kate. I know for certain
that one thing that really bugs me about Dreamweaver is the fact that it
has a tendency to really nerf up the spacing, and it replaces tabs with
spaces more often than not. It's all about the tabs to space things out,
adding spaces just makes the files bigger!
Ash
www.ashleysheridan.co.uk
--- Begin Message ---
On Fri, 2008-09-12 at 15:11 +0200, Børge Holen wrote:
> On Friday 12 September 2008 12:02:13 you wrote:
> > there's three letters
> >
> > VIM!
>
> yes and amiga still kicks ass. The old fashioned way works, ok. But ... after
> a while, you still do the same old thing the same old way, while everything
> passes you by. I love vim for reading and editing a file here or there, make
> a script to do some backup there, shortcuts for doing a lot of small thing.
> Still I draw a line when having to do projects with more than a few files,
> there are new and better ways.
> But your not that far off, I feel sorry for those guys still thinking nano
> and
> joe is the world ;D
Keep your pity, I'm in no need of it :)
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- End Message ---
--- Begin Message ---
Could you not check one of the variables in the $_SERVER array to
determine if the script called by the browser is the current file?
Ash
www.ashleysheridan.co.uk
--- Begin Message ---
On Fri, Sep 12, 2008 at 8:44 AM, clive <[EMAIL PROTECTED]> wrote:
> I have a file called interceptor.php, which I would like to make use of in
> two ways
>
> 1. either call it directly from the browser or
> 2. included from another file
>
> I know I could use something like this to see if it was called via a url
> like http://www.site.com/interceptor.php :
>
> if (strstr('interceptor',$__SERVER["REQUEST_URI"])) {
> // url
> } else {
> //probably included
> }
>
> but I would like to know if there is a neater, cleaner, sparkly way of doing
> this.
>
> Thanks
>
> Clive
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
http://us3.php.net/get_included_files
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- End Message ---
--- Begin Message ---
On Fri, Sep 12, 2008 at 7:41 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
> Could you not check one of the variables in the $_SERVER array to
> determine if the script called by the browser is the current file?
>
> ---------- Forwarded message ----------
> To: clive <[EMAIL PROTECTED]>
>> 2. included from another file
Don't forget #2. I just threw it out as a suggestion because the
current requested file might not be intercept.php. If I were trying
to do such a thing I'd probably go about it differently altogether
depending on why I needed to know what was in the file.
--- End Message ---
--- Begin Message ---
Well checking the $_SERVER array will tell you if the current page
requested by the visitor is the script you want to check for. There's
something in an if statement in PHP called else, so you can check if it
isn't... That should do exactly what you just asked.
Ash
www.ashleysheridan.co.uk
--- Begin Message ---
On Fri, Sep 12, 2008 at 7:41 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
> Could you not check one of the variables in the $_SERVER array to
> determine if the script called by the browser is the current file?
>
> ---------- Forwarded message ----------
> To: clive <[EMAIL PROTECTED]>
>> 2. included from another file
Don't forget #2. I just threw it out as a suggestion because the
current requested file might not be intercept.php. If I were trying
to do such a thing I'd probably go about it differently altogether
depending on why I needed to know what was in the file.
--- End Message ---
--- End Message ---
--- Begin Message ---
Send me the doll and the beer...
Ash
www.ashleysheridan.co.uk
--- Begin Message ---
On Fri, 2008-09-12 at 14:39 -0400, tedd wrote:
> At 2:31 PM -0400 9/12/08, Robert Cummings wrote:
> >On Fri, 2008-09-12 at 14:24 -0400, tedd wrote:>
> >
> >I don't drink beer -- send money. :-)
> >
> >No, no, no... send me Tedd's beer!
> >
> >Cheers,
> >Rob.
>
> No, no, no send me both our monies!
>
> Beside, Rob will just spill the beer on his blow-up doll anyway.
Actually, I use the beer to inflate the doll. It's a great party
trick ;) But it's not my doll if you recall.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- End Message ---