OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 6 May 2008 17:42:10 -0000 Issue 5444

php-general-digest-helplists.php.net
Date: Tue May 06 2008 - 12:42:10 CDT


php-general Digest 6 May 2008 17:42:10 -0000 Issue 5444

Topics (messages 273931 through 273957):

strange behavior, when converting float to int
        273931 by: Maxim Antonov
        273949 by: Philip Thompson
        273950 by: Paul Scott
        273951 by: Thiago Pojda

Re: Regex to catch <p>s
        273932 by: Aschwin Wesselius
        273933 by: Aschwin Wesselius
        273935 by: Aschwin Wesselius

Difference between imagegif/imagejpeg sending to browser <-> saving to file?
        273934 by: zyro

Handling Incoming Email Attachments
        273936 by: Nirmal Jayasinghe
        273937 by: Aschwin Wesselius
        273939 by: Richard Heyes

getting iostat -x %b with php
        273938 by: Iv Ray

Re: Web page excerpt editor
        273940 by: tedd
        273941 by: Jason Pruim
        273942 by: tedd
        273943 by: tedd
        273945 by: Chris Haensel

Re: Where to start!
        273944 by: tedd
        273948 by: Andrew Ballard
        273957 by: tedd

adding the results of mysql_query
        273946 by: It Maq
        273947 by: M. Sokolewicz
        273953 by: Stut

PHP Web Apps & OpenID
        273952 by: Joe Harman

GD - JPEG to PNG with transparency and color
        273954 by: Travis L. Font

Incorrect version shown in phpinfo() and phpversion() in 5.2.6
        273955 by: Scott Lerman
        273956 by: Daniel Brown

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Hi, all!

Is this a bug?

maxmaximus:~$ /usr/bin/php 1.php
45
45
float(46)

maxmaximus:~$ /usr/bin/php -v
PHP 5.3.0-dev (cli) (built: Apr 4 2008 11:37:33)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies

maxmaximus:~$ cat 1.php
<?php
$i = 10.35 + 20.76 + 5.80 + 5.80 + 3.29;
echo (int)$i;
echo "\n";
echo intval($i);
echo "\n";
var_dump($i);

maxmaximus:~$

attached mail follows:


On May 6, 2008, at 1:38 AM, Maxim Antonov wrote:

> Hi, all!
>
> Is this a bug?
>
> maxmaximus:~$ /usr/bin/php 1.php
> 45
> 45
> float(46)
>
>
> maxmaximus:~$ /usr/bin/php -v
> PHP 5.3.0-dev (cli) (built: Apr 4 2008 11:37:33)
> Copyright (c) 1997-2008 The PHP Group
> Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies
>
>
> maxmaximus:~$ cat 1.php
> <?php
> $i = 10.35 + 20.76 + 5.80 + 5.80 + 3.29;
> echo (int)$i;
> echo "\n";
> echo intval($i);
> echo "\n";
> var_dump($i);
>
> maxmaximus:~$

I got the same results. I'm not exactly sure what's happening, but I'd
be curious to see if there's anyone else who can shed some light.

PHP Version 5.2.4.

~Philip

attached mail follows:


On Tue, 2008-05-06 at 09:34 -0500, Philip Thompson wrote:

> I got the same results. I'm not exactly sure what's happening, but
> I'd
> be curious to see if there's anyone else who can shed some light.
>
> PHP Version 5.2.4.

Is this not coming from the underlying C libs that directly use the FP
on the CPU?

I would say that the compile flags, CPU settings etc would probably have
an impact on accuracy.

--Paul

All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm

attached mail follows:


There is a logical explanation.

        "[...] you need to be aware that the float data type is not always
capable of representing numbers in the way you expect it to."

And then follows a example:
"Consider, for example this simple statement:
                echo (int) ((0.1 + 0.7) * 10);
You would expect that the expression ((0.1 + 0.7) * 10) would evaluate to 8
(and, in fact, if you print it out without the integer conversion, it does).
However the statement above outputs 7 instead. This happens because the
result of this simple arithmetic expression is stored internally as 7.999999
instead of 8; when the value is converted to int, PHP simply truncates away
the fractional part, resulting in a rather significant error (12.5%, to be
exact)." [manually typed]

Zend PHP5 Certification Guide 2nd Edition, Chapter 1 - PHP Basics, page
9-10. SHAFIK, D., RAMSEY, B.
Ed. php|architect nanobooks

Not sure if this is what happening with you as I did not try to reproduce
your error, but looks like it. This book is good, a lot of gotchas. You
should get it :)
        
Regards,
Thiago Henrique Pojda
Desenvolvimento Web
+55 41 3033-7676
thiago.pojdasoftpartech.com.br
Excelência em Softwares Financeiros

-----Mensagem original-----
De: Philip Thompson [mailto:philthathrilgmail.com]
Enviada em: terça-feira, 6 de maio de 2008 11:34
Para: PHP-General List
Assunto: Re: [PHP] strange behavior, when converting float to int

On May 6, 2008, at 1:38 AM, Maxim Antonov wrote:

> Hi, all!
>
> Is this a bug?
>
> maxmaximus:~$ /usr/bin/php 1.php
> 45
> 45
> float(46)
>
>
> maxmaximus:~$ /usr/bin/php -v
> PHP 5.3.0-dev (cli) (built: Apr 4 2008 11:37:33)
> Copyright (c) 1997-2008 The PHP Group
> Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies
>
>
> maxmaximus:~$ cat 1.php
> <?php
> $i = 10.35 + 20.76 + 5.80 + 5.80 + 3.29;
> echo (int)$i;
> echo "\n";
> echo intval($i);
> echo "\n";
> var_dump($i);
>
> maxmaximus:~$

I got the same results. I'm not exactly sure what's happening, but I'd
be curious to see if there's anyone else who can shed some light.

PHP Version 5.2.4.

~Philip

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

attached mail follows:


Ryan S wrote:
> Hey all!
>
> To say I suck at regex is an understatement so really need any help I can get on this, I have a page of text with different html tags in them, but each "block" of text has a <p> or a < class="something"> tag... anybody have any regex that will catch each of these paragraphs and put then into an array
> example:
> array[0]="<p> first block </p>";
> array[1]="<p class="blah"> block X</p>";
>
> Thanks!
> R
>
Hi,

Maybe the example is overkill, but I give you a quick setup that can
save you some time finding HTML tags with a certain attribute.

<?php

$html = <<<END_OF_HTML

<b>hello</b>
<b class="blah">hello</b>
<p>hello</p>
<p class="blah">hello</p>
<a>hello</a>
<a href="url">hello</a>
END_OF_HTML;

$tags = array();
$tags[] = 'p';
$tags[] = 'a';

$tags = implode('|', $tags);

$pattern = '/<('.$tags.')[^>]*>/i';

echo $pattern."\n";

preg_match_all($pattern, $html, $matches);

var_dump($matches);

?>

I'm not an expression guru either, but I think it works OK. I had to
find 'link', 'img', 'a' and other tags in HTML and used a more complex
expression for it which worked like a charm.

It's just an example. For you, you have to leave away the 'a' tag in the
$tags array, to get what you want.

Hope it helps!
--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other....'/

attached mail follows:


Aschwin Wesselius wrote:
> Ryan S wrote:
>> Hey all!
>>
>> To say I suck at regex is an understatement so really need any help I
>> can get on this, I have a page of text with different html tags in
>> them, but each "block" of text has a <p> or a < class="something">
>> tag... anybody have any regex that will catch each of these
>> paragraphs and put then into an array
>> example:
>> array[0]="<p> first block </p>";
>> array[1]="<p class="blah"> block X</p>";
>>
>> Thanks!
>> R
>>
> Hi,
>
> Maybe the example is overkill, but I give you a quick setup that can
> save you some time finding HTML tags with a certain attribute.

Hi,

I'm sorry. I didn't read your request properly. Below you'll have a
correct solution:

<?php

$html = <<<END_OF_HTML

<b>hello</b>
<b class="blah">hello</b>
<p>hello</p>
<p class="blah">hello</p>
<a>hello</a>
<a href="url">this</a>
<a>hello</a>
<a href="regex yo">hello</a>
<a>hello</a>
<a id="2" href="regex yo">hello</a>
<p>that</p>
<p class="blah" title="whatever">hello</p>
END_OF_HTML;

$tags = array();
$tags[] = 'p';
$tags[] = 'a';

$attr = array();
$attr[] = 'class';
$attr[] = 'href';

$vals = array();
$vals[] = 'blah';
$vals[] = 'url';
$vals[] = 'yo';

$text = array();
$text[] = 'hello';
$text[] = 'this';
$text[] = 'that';

$tags = implode('|', $tags);
$attr = implode('|', $attr);
$vals = implode('|', $vals);
$text = implode('|', $text);

$pattern =
'/<('.$tags.')[^>]*('.$attr.')[^>]*('.$vals.')[^>]*>('.$text.')[^<\/]*<\/\1>/i';

echo $pattern."\n";
echo "--------------------\n";

preg_match_all($pattern, $html, $matches);

var_dump($matches);

?>

attached mail follows:


Aschwin Wesselius wrote:
> Aschwin Wesselius wrote:
>> Ryan S wrote:
>>> Hey all!
>>>
>>> To say I suck at regex is an understatement so really need any help
>>> I can get on this, I have a page of text with different html tags in
>>> them, but each "block" of text has a <p> or a < class="something">
>>> tag... anybody have any regex that will catch each of these
>>> paragraphs and put then into an array
>>> example:
>>> array[0]="<p> first block </p>";
>>> array[1]="<p class="blah"> block X</p>";
>>>
>>> Thanks!
>>> R
>>>
>> Hi,
>>
>> Maybe the example is overkill, but I give you a quick setup that can
>> save you some time finding HTML tags with a certain attribute.
>
> Hi,
>
> I'm sorry. I didn't read your request properly. Below you'll have a
> correct solution:
Hi,

It is obvious I haven't had my caffeine yet. This is my last try to get
the pattern straight:

<?php

$html = <<<END_OF_HTML

<b>hello</b>
<b class="blah">hello</b>
<p>those</p>
<p class="blah">hello</p>
<a>hello</a>
<a href="url">this</a>
<a>rose</a>
<a href="regex yo">hello</a>
<a>nose</a>
<a id="2" href="regex yo">hello</a>
<p>that</p>
<p class="blah" title="whatever">hello</p>
END_OF_HTML;

$tags = array();
$tags[] = 'p';
$tags[] = 'a';

$attr = array();
$attr[] = 'class';
$attr[] = 'href';

$vals = array();
$vals[] = 'blah';
$vals[] = 'url';
$vals[] = 'yo';

$text = array();
$text[] = 'hello';
$text[] = 'this';
$text[] = 'that';

$tags = implode('|', $tags);
$attr = implode('|', $attr);
$vals = implode('|', $vals);
$text = implode('|', $text);

$pattern =
'/<('.$tags.')[^>]*('.$attr.')?[^>]*('.$vals.')?[^>]*>('.$text.')[^<\/]*<\/\1>/i';

echo $pattern."\n";
echo "--------------------\n";

preg_match_all($pattern, $html, $matches);

var_dump($matches);

?>
--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other....'/

attached mail follows:


Hello together,

I stumbled onto a curious problem:
i am generating a jpeg/gif with the imagejpeg/imagegif functions (type does
not alter the result).

Example color "#ff0000": The hexToRGB coversion etc is all working fine. The
image (if its send directly to the browser via header and
imagegif/imagejpeg) is displayed 100% correctly.
But if i save it to a file on the servers file system, the red above gets
lime green. And not only those two colors are bugged: It looks like the
whole palette gets scrambled up ???

So my question: Is there a-n-y difference between sending and saving the
image?
Or do I have to do some additional work before an image can be saved
correctly? php func reference says something about using
imagecolortransparent() on the image first to achieve the 89a format (in
case of gif) but again: This does not alter the result either. Also,
transparency is not needed at this point but used in images that are merged
(gifs) to achieve the final result.

Another interesting point:
- generated image sent to browser, properties: ~3kb
- generated image, saved in filesys, properties: ~15kb
What explains that diff in filesize?

Thanks for your help,

greets,

zyro
--
View this message in context: http://www.nabble.com/Difference-between-imagegif-imagejpeg-sending-to-browser-%3C-%3E-saving-to-file--tp17078670p17078670.html
Sent from the PHP - General mailing list archive at Nabble.com.

attached mail follows:


hello all,

I'm trying to figure out a way to manipulate incoming email attachments with
PHP. There'll be a special email address to which the emails with the
attachments would be sent, with a number specified in the subject line. What
I need to do is to grab the attachment (a photo), rename it with the number
specified in the subject line, and move it onto a specific folder on the Web
server [which will be running LAMP].

I couldn't find any online material describing how to manipulate incoming
mail attachments. Can someone give an idea?

Thanks,

Chuck Finster

attached mail follows:


Nirmal Jayasinghe wrote:
> hello all,
>
> I'm trying to figure out a way to manipulate incoming email attachments with
> PHP. There'll be a special email address to which the emails with the
> attachments would be sent, with a number specified in the subject line. What
> I need to do is to grab the attachment (a photo), rename it with the number
> specified in the subject line, and move it onto a specific folder on the Web
> server [which will be running LAMP].
>
> I couldn't find any online material describing how to manipulate incoming
> mail attachments. Can someone give an idea?
Hi,

For handling e-mail in all their sorts (believe me, it is hell), I found
the PECL mailparse the best solution. It can find the attachments and
their MIME-types in a snap. And all the headers are separated too.

You only have to wrap functions around it to do what you want to do.

Be sure to validate the attachments and do not rely on the MIME-type
only. People can spoof that kind of files.
--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other....'/

attached mail follows:


> For handling e-mail in all their sorts (believe me, it is hell), I found
> the PECL mailparse the best solution. It can find the attachments and
> their MIME-types in a snap. And all the headers are separated too.
>
> You only have to wrap functions around it to do what you want to do.
>
> Be sure to validate the attachments and do not rely on the MIME-type
> only. People can spoof that kind of files.

There's also the PEAR mimeDecode class as well. A PHP solution so it
won't require you to reconfigure/compile anything.

--
Richard Heyes

+----------------------------------------+
| Access SSH with a Windows mapped drive |
| http://www.phpguru.org/sftpdrive |
+----------------------------------------+

attached mail follows:


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

attached mail follows:


At 9:52 AM -0400 5/5/08, Jason Pruim wrote:
>On May 5, 2008, at 9:43 AM, tedd wrote:
>>I've been trying to come up with an alternative -- here's my twist:
>>
>>http://www.webbytedd.com/a/easy-page-db
>>
>>Please note the [Edit Mode] link on the top right of the page.
>>
>>I'm not willing to share the code at this point because I haven't
>>worked out all the bugs, but I'm sure the demo expresses my idea.
>>
>>My quandary is how much freedom do I give the client in allowing
>>them to use html tags? The client is not going to deliberately try
>>to mess up their own site, but not having well formed html can
>>create problems.
>>
>>I am open to comments and suggestions.
>
>Hey tedd,
>
>Just as an idea, would it be alot of work to do a "basic" editor,
>and then have an "advanced" button? That way, for the people who
>don't know as much they can just stay in the basic part that lets
>them pretty much type in the info and the editor changes it into
>HTML and advanced basically gives them a blank slate to work with?
>Just a thought..

My idea was to have various web templates set up for the clients to
chose from (my example was one) and then they could edit the text and
images as they wanted.

My only quandary was -- do I allow them to input html or not.

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


On May 6, 2008, at 8:41 AM, tedd wrote:

> At 9:52 AM -0400 5/5/08, Jason Pruim wrote:
>> On May 5, 2008, at 9:43 AM, tedd wrote:
>>
>> Hey tedd,
>>
>> Just as an idea, would it be alot of work to do a "basic" editor,
>> and then have an "advanced" button? That way, for the people who
>> don't know as much they can just stay in the basic part that lets
>> them pretty much type in the info and the editor changes it into
>> HTML and advanced basically gives them a blank slate to work with?
>> Just a thought..
>
> My idea was to have various web templates set up for the clients to
> chose from (my example was one) and then they could edit the text
> and images as they wanted.
>
> My only quandary was -- do I allow them to input html or not.

I misunderstood what you were going for... But this does give me
another idea... Why not give them very simple things like [bold][/
bold] and then you can control it all from css and they don't need to
understand much about HTML?

In fact, if you are using variables in your css, you could set it so
that they could set what color they want [bold] to be.

IE: .bold {font-weight: bold; color: $boldColor;}

Or how ever you would have to define it so that it displayed
correctly.. :) Anyway, just the ideas of a dutch novice take them as
such :)

--

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

attached mail follows:


At 11:19 AM -0400 5/5/08, Eric Butera wrote:
>On Mon, May 5, 2008 at 9:43 AM, tedd <tedd.sperlinggmail.com> wrote:
>> FCKEditor and TinyMCE are impressive in what they do, but they produce a
>> mix of css and html -- that's not good in my book.
>
>This is an interesting idea. Most clients don't want to see a text
>area to input raw html though. In the many years I've done this only
>3 people have ever requested it specifically out of hundreds. You
>might want to look into shoving generated markup through ext/tidy. It
>might have some options to clean up all that embedded css. Maybe I'll
>have to look into it later when I have some free time. I'm tired of
>seeing those mso styles from Word. ;)

You make a good point -- and I agree with the Word problem. I have
clients who cut/paste from Word and then wonder why it don't look
right in their web site?

I have one client who likes using <h1><b><i><br /> tags but doesn't
know much about html -- plus, he's sloppy (lot's of errors). So, I'm
not sure how I am going to handle that.

Currently, my CMS for him is completely devoid of him entering any
html, but that also means I have to program in options for linefeeds,
bold/italic text, font size, and other such things. It's difficult to
pin down all the different combinations of those things.

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


At 8:49 AM -0400 5/6/08, Jason Pruim wrote:
>On May 6, 2008, at 8:41 AM, tedd wrote:
>>My only quandary was -- do I allow them to input html or not.
>
>I misunderstood what you were going for... But this does give me
>another idea... Why not give them very simple things like
>[bold][/bold] and then you can control it all from css and they
>don't need to understand much about HTML?
>
>In fact, if you are using variables in your css, you could set it so
>that they could set what color they want [bold] to be.
>
>IE: .bold {font-weight: bold; color: $boldColor;}
>
>Or how ever you would have to define it so that it displayed
>correctly.. :) Anyway, just the ideas of a dutch novice take them as
>such :)

You're making an honest effort to answer the question I posed, so
it's not that novice.

I've been using variable in css for years, see here:

http://sperling.com/examples/pcss/

But it's a different problem when trying to guide a layman from what
he imagines in his head to what can be done on the web (hey, that
rhymes). :-)

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


-----Original Message-----
From: tedd [mailto:tedd.sperlinggmail.com]
Sent: Tuesday, May 06, 2008 3:02 PM
To: php-generallists.php.net
Subject: Re: [PHP] Web page excerpt editor

At 8:49 AM -0400 5/6/08, Jason Pruim wrote:
>On May 6, 2008, at 8:41 AM, tedd wrote:
>>My only quandary was -- do I allow them to input html or not.
>
>I misunderstood what you were going for... But this does give me
>another idea... Why not give them very simple things like
>[bold][/bold] and then you can control it all from css and they
>don't need to understand much about HTML?
>
>In fact, if you are using variables in your css, you could set it so
>that they could set what color they want [bold] to be.
>
>IE: .bold {font-weight: bold; color: $boldColor;}
>
>Or how ever you would have to define it so that it displayed
>correctly.. :) Anyway, just the ideas of a dutch novice take them as
>such :)

You're making an honest effort to answer the question I posed, so
it's not that novice.

I've been using variable in css for years, see here:

http://sperling.com/examples/pcss/

But it's a different problem when trying to guide a layman from what
he imagines in his head to what can be done on the web (hey, that
rhymes). :-)

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

Tedd,

That is great information for a noob like me! Your page has just been
printed and bookmarked :o) I have been thinking (not google-ing) about how
to do that (CSS with variables) for some time now, without ever trying.

Thanks mate !!

Chris

attached mail follows:


At 1:15 AM -0600 5/5/08, Jorge wrote:
>First I would like to say that I have had PHP experience but not
>enough to say I am a PHP developer.
>
>I want to use PHP to build a site that uses MySQL, I am building it
>from scratch so I don't know where to start, should I start with PHP
>and design a database around my code, or should I designs the db and
>design the site are the db.
>
>is it just a matter of preference or is there a recommended way to do this?

Contrary to all popular belief and religion -- start with an html
page that gathers the information you need/want.

After you decide what you want to gather, then design a flat database
to store that information. A database is nothing more than a place to
store and retrieve stuff.

Don't worry about the higher orders of database design just yet, get
it to work and understand what you are doing.

If you want to better your design, then pick up a couple books on
MySQL and learn what people are arguing about. However, realize that
you can get something working quite well without being a database
expert.

It's easy to get it to work -- but, to get it to work well, takes a
bit more effort.

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


On Tue, May 6, 2008 at 9:21 AM, tedd <tedd.sperlinggmail.com> wrote:
> At 1:15 AM -0600 5/5/08, Jorge wrote:
>
> > First I would like to say that I have had PHP experience but not enough to
> say I am a PHP developer.
> >
> > I want to use PHP to build a site that uses MySQL, I am building it from
> scratch so I don't know where to start, should I start with PHP and design a
> database around my code, or should I designs the db and design the site are
> the db.
> >
> > is it just a matter of preference or is there a recommended way to do
> this?
> >
>
>
> Contrary to all popular belief and religion -- start with an html page that
> gathers the information you need/want.
>
> After you decide what you want to gather, then design a flat database to
> store that information. A database is nothing more than a place to store and
> retrieve stuff.
>
> Don't worry about the higher orders of database design just yet, get it to
> work and understand what you are doing.
>
> If you want to better your design, then pick up a couple books on MySQL and
> learn what people are arguing about. However, realize that you can get
> something working quite well without being a database expert.
>
> It's easy to get it to work -- but, to get it to work well, takes a bit
> more effort.
>
> Cheers,
>
> tedd

I will respectfully (though strongly) disagree here, tedd. If you are
building a guest book and all you need is a place to "store and
retrieve stuff," store it in a file rather than a database. If you
only have one form to collect and store information, this will be more
than sufficient.

If you are doing something more complex where you need to relate
information (say, for example, forum members <-> forum topics <->
forum messages, or customers <-> orders <-> items, etc.) then you are
far better off to think about what you need to store and plan your
database first. Doing that will make your data model much better from
the start, and you can also start planning out what your HTML pages
need to be collecting as it relates to how the data is stored.

Andrew

attached mail follows:


At 10:14 AM -0400 5/6/08, Andrew Ballard wrote:
>On Tue, May 6, 2008 at 9:21 AM, tedd <tedd.sperlinggmail.com> wrote:
>I will respectfully (though strongly) disagree here, tedd. If you are
>building a guest book and all you need is a place to "store and
>retrieve stuff," store it in a file rather than a database. If you
>only have one form to collect and store information, this will be more
>than sufficient.
>
>If you are doing something more complex where you need to relate
>information (say, for example, forum members <-> forum topics <->
>forum messages, or customers <-> orders <-> items, etc.) then you are
>far better off to think about what you need to store and plan your
>database first. Doing that will make your data model much better from
>the start, and you can also start planning out what your HTML pages
>need to be collecting as it relates to how the data is stored.
>
>Andrew

Andrew:

Well, you can certainly disagree -- we all do things differently.
What works for me, doesn't work for you and vise versa -- but that's
the way of things.

I understand relational dB's and how to use them, but I don't think
the OP was talking about that, but rather getting something much more
simple up and running.

Rob, who I respect greatly, said that 90 percent of what you are
doing should be decided before you start programming. But, I never
work that way either.

I always jump right in and use the computer to design stuff. I never
resort to making a story-book layout or poster board work-up or
anything like that. I just don't work that way.

Sure, people can criticize the way I do things if they want, but I
still get things done that work and are usually under budget with
respect to money and time -- so I must be doing something right.

 From my perspective, it's far better for a newbie to actually produce
something than it is to get lost in the details and never see
anything materialize. Besides, trial and error is a great way to
learn.

Oh, and I seldom use the file system for anything. MySQL works just
fine for storing things. I'm even considering Stut's recommendation
to use a dB rather than sessions -- I think there is real value there.

In any event, different strokes for different folks -- happy coding. :-)

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


Hi,

I need to add the result of 4 calls to mysql_query (4 different queries) to the same object so that i can mysql_fetch_object in the same loop.

Is that possible? otherwise is there any other alternative?

Thank you

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

attached mail follows:


It Maq wrote:
> Hi,
>
> I need to add the result of 4 calls to mysql_query (4 different queries) to the same object so that i can mysql_fetch_object in the same loop.
>
> Is that possible? otherwise is there any other alternative?
>
> Thank you
>
>
> ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>

use a UNION (look it up in the mysql manual)

attached mail follows:


On 6 May 2008, at 15:05, It Maq wrote:
> I need to add the result of 4 calls to mysql_query (4 different
> queries) to the same object so that i can mysql_fetch_object in the
> same loop.
>
> Is that possible? otherwise is there any other alternative?

No, but you should be able to do it in one query...

http://dev.mysql.com/doc/refman/5.0/en/union.html

-Stut

--
http://stut.net/

attached mail follows:


Hey Ya'll!

I am curious here if any of you are considering or already using
OpenID or Windows CardSpace? Does anyone see this being a big deal???
from a users stand point it seems like a big hassle to get started
with it and I'm not sure if it would scare people away or not? any
thoughts

I've been looking at some PHP scripts out there for OpenID... does
anyone have one to recommend???

--
Joe Harman

attached mail follows:


Following files:

bg.png - Clear Transparent Image

14416fed5d4f78.jpg - Normal Jpeg Image

 

 

The Code:

 

header('content-type: image/png');

 

$watermark = imagecreatefromjpeg('14416fed5d4f78.jpg');

 

$watermark_width = imagesx($watermark);

$watermark_height = imagesy($watermark);

 

$image = imagecreatetruecolor($watermark_width, $watermark_height);

$image = imagecreatefrompng('bg.png');

 

$size = getimagesize('bg.png');

 

$dest_x = $size[0] - $watermark_width - 5;

$dest_y = $size[1] - $watermark_height - 5;

 

imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0,
$watermark_width, $watermark_height, 100);

 

imagepng($image);

 

imagedestroy($image);

imagedestroy($watermark);

 

 

The Problem:

 

The code above works fine in sense of syntax! bg.png acts as a
transparent border for 14416fed5d4f78.jpg to keep the size of bg.png and
not the size of 14416fed5d4f78.jpg so it doesn't blow up
14416fed5d4f78.jpg. However, the image comes out black/white and has
lost its color!

I looked all over Google and I've found nothing so far that's functional
to give the new created png file the correct colors as the original
14416fed5d4f78.jpg. I figure that I'm missing some small elements to the
process of creating the png...

Anyone have any ideas, pointers, advice, or correct solution to make
this possible?

 
Sincerely,
 
Travis L. Font
Interactive Developer
 
BSN
5901 Broken Sound Parkway NW
6th Floor
Boca Raton, FL 33487
Main Ph.: 561-994-8335 Ext.737
Fax: 561-998-4635
Toll Free: 1-800-939-4071 Ext.737
http://www.bsnonline.net/ / http://www.endorush.com/ / http://www.tlfapparel.com/
 
The 27th Fastest Growing Private Company In America*
The 2nd Fastest Growing Private Company In The Miami-Fort Lauderdale Metro Region*
The 4th Fastest Growing Private Company In The Health Industry*
[*Above Rankings Were Determined By Inc. 500/5,000]
 
This e-mail, and any attachment, is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, re-transmission, copying, dissemination or other use of this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. The contents of this message may contain personal views which are not the views of BSN.

attached mail follows:


Has anyone else seen incorrect information on a phpinfo() page on the
Windows build of 5.2.6? The Apache log shows "Apache/2.0.63 (Win32)
PHP/5.2.6 configured -- resuming normal operations", but phpinfo() and
phpversion() still show 5.2.5. The CLI executable does show the
correct version, though.

--
Scott Lerman

attached mail follows:


On Tue, May 6, 2008 at 11:57 AM, Scott Lerman <smlermangmail.com> wrote:
> Has anyone else seen incorrect information on a phpinfo() page on the
> Windows build of 5.2.6? The Apache log shows "Apache/2.0.63 (Win32)
> PHP/5.2.6 configured -- resuming normal operations", but phpinfo() and
> phpversion() still show 5.2.5. The CLI executable does show the
> correct version, though.

    Did you remember to restart Apache? I know the message you
printed above from the log would indicate such, but it never hurts to
double-check.

    Also, are you certain that it's using the correct DLL by
configuration in both httpd.conf and any .htaccess files?

--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.