php-general Digest 9 Sep 2004 09:32:45 -0000 Issue 2985

Topics (messages 196169 through 196199):

Re: Users of RDBMS
        196169 by: John Nichel
        196170 by: Dan Joseph
        196171 by: Dan Joseph
        196174 by: John Nichel
        196175 by: M. Sokolewicz
        196188 by: John Nichel
        196189 by: Greg Donald
        196198 by: Lester Caine

Timing on an internal email
        196172 by: Alex Hogan
        196176 by: Sean Smith
        196177 by: Marek Kilimajer
        196178 by: Alex Hogan

Lambert's Projection and PHP
        196173 by: Ville Mattila
        196181 by: Michal Migurski

htmlentities()
        196179 by: Anthony Ritter
        196182 by: Chris Shiflett
        196183 by: Jim Grill
        196184 by: Jim Grill
        196185 by: Paul Birnstihl
        196186 by: Anthony Ritter

Tidy installation problem in php 4.3.8
        196180 by: Lizet Pe�a de Sola

Re: Convert Smart Quotes to Sraight Quotes - Need Help!
        196187 by: Tom Rogers

Re: data grids...
        196190 by: Aidan Lister
        196191 by: Brent Clements
        196197 by: Nadim Attari

Explode, Arrays and Checkboxes
        196192 by: Matt Winslow
        196193 by: zareef ahmed
        196194 by: Curt Zirzow
        196195 by: Curt Zirzow

why should $_SESSION be slower than other arrays?
        196196 by: Aaron Voisine

A somewhat faster alternative to is_dir and is_file?
        196199 by: Wouter van Vliet

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 --- Pahlevanzadeh Mohsen wrote:
Dears,
I need to create user for MySQL.
Please guide me......

I keep forgetting that this it the MySQL list.

--
John C. Nichel
�berGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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

> -----Original Message-----
> From: Jay Blanchard [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 08, 2004 3:37 PM
> To: Pahlevanzadeh Mohsen; [EMAIL PROTECTED]
> Subject: RE: [PHP] Users of RDBMS
> 
> [snip]
> I need to create user for MySQL.
> Please guide me......
> [/snip]
> 
> I will guide you to the MySQL lists at http://lists.mysql.com/
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

I should share this image I found...



--- End Message ---
--- Begin Message ---
Hi,

> PHP != MySQL
> 
> http://dev.mysql.com/doc/mysql/en/index.html

        Shouldn't that be:

        if ( PHP != MySQL )
        {
                Header( "Location:
http://dev.mysql.com/doc/mysql/en/index.html"; );
        }

-Dan Joseph

--- End Message ---
--- Begin Message --- Joshua D. Drake wrote:
PHP != MySQL


MySQL != RDBMS

Please tell me you're kidding.

--
John C. Nichel
�berGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message --- John Nichel wrote:
Joshua D. Drake wrote:

PHP != MySQL



MySQL != RDBMS


Please tell me you're kidding.

that's a funny one... could've sworn it actually was one...
--- End Message ---
--- Begin Message ---
M. Sokolewicz wrote:

John Nichel wrote:

Joshua D. Drake wrote:

PHP != MySQL




MySQL != RDBMS



Please tell me you're kidding.

that's a funny one... could've sworn it actually was one...

All this time the MySQL AB people have been lying to us. It's actually an Excel spreadsheet. ;)


--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

--- End Message ---
--- Begin Message ---
On Wed, 8 Sep 2004 13:14:57 -0700 (PDT), Joshua D. Drake
<[EMAIL PROTECTED]> wrote:
> MySQL != RDBMS
> 
> http://www.postgresql.org

Yup.

I recently became a Postgres user after 5+ years using MySQL.  I am
very impressed with it so far.  The price is right and the license is
very friendly for all.


-- 
Greg Donald
http://destiney.com/

--- End Message ---
--- Begin Message ---
John Nichel wrote:

M. Sokolewicz wrote:

John Nichel wrote:

Joshua D. Drake wrote:

PHP != MySQL

MySQL != RDBMS

Please tell me you're kidding.

that's a funny one... could've sworn it actually was one...

All this time the MySQL AB people have been lying to us. It's actually an Excel spreadsheet. ;)

Well RDBMS things like Foreign Key's and constraints used to be documented but did not actually work, so what else was not provided ;)


--
Lester Caine
-----------------------------
L.S.Caine Electronic Services

--- End Message ---
--- Begin Message ---
Hi all,

I want to set up a delivery date and time for emails to be sent. (I'm
using phpmailer)

I'm coming up blank on how to do this.  I thought that I could put a
timing condition on a page that I know will be accessed daily that
would look for the date then call the function that will do the mail
outs on the appropriate date, but there has to be a better way.

Is this something that I'll have to do outside of php?


alex hogan

--- End Message ---
--- Begin Message --- You can have the php script written so that it performs the functions you want then setup a cron job to run that script at a given time or interval. I do this with daily and weekly operations now. It works great.

Alex Hogan wrote:
Hi all,

I want to set up a delivery date and time for emails to be sent. (I'm
using phpmailer)

I'm coming up blank on how to do this.  I thought that I could put a
timing condition on a page that I know will be accessed daily that
would look for the date then call the function that will do the mail
outs on the appropriate date, but there has to be a better way.

Is this something that I'll have to do outside of php?


alex hogan

--- End Message ---
--- Begin Message --- Alex Hogan wrote:
Hi all,

I want to set up a delivery date and time for emails to be sent. (I'm
using phpmailer)

I'm coming up blank on how to do this.  I thought that I could put a
timing condition on a page that I know will be accessed daily that
would look for the date then call the function that will do the mail
outs on the appropriate date, but there has to be a better way.

Sure.


Is this something that I'll have to do outside of php?

Not necessarily outside of php, but outside of webserver. You need to setup a cron job that will execute the phpmailer script.

--- End Message ---
--- Begin Message ---
> Not necessarily outside of php, but outside of webserver. You need to
> setup a cron job that will execute the phpmailer script.

Gotcha..,

My webserver is a windows box, so I can just run a task schedule and give it;
php.exe myfile.php
and that should do it?

Would it be more efficient as a command line task or as an instance of
the browser?



alex hogan

--- End Message ---
--- Begin Message ---
Hello,

I'm working with a system that draws a map from certain information. Lambert's projection seems to suit well to our needs.

Now I should generate a function that converts the lat/lon coordinates to the x,y coordinates using the Lambert's projection. As I couldn't find any ready-to-use script, I decided to write it from scratch... Well, no results at the moment. ;)

I found a formula explaining the projection at http://mathworld.wolfram.com/LambertConformalConicProjection.html . Unfortunately there is no explanation that what units x and y are, so drawing them or further convertion is impossible.

Now I would appreciate your help with this case. Any help is appreciated! Scripts, formulaes and other stuff give valuable help for the project.

Thank you!

Ville Mattila
Ikaalinen, Finland

--- End Message ---
--- Begin Message ---
> I'm working with a system that draws a map from certain information.
> Lambert's projection seems to suit well to our needs.

...

> I found a formula explaining the projection at
> http://mathworld.wolfram.com/LambertConformalConicProjection.html .
> Unfortunately there is no explanation that what units x and y are, so
> drawing them or further conversion is impossible.

x and y are the Cartesian coordinates on the projected map.
To be useful, they generally need to be scaled, translated, and rotated to
the particular dimensions of the map you wish to output.

I have a small library of classes which implement albers conical equal
are, lambert azimuthal equal area, and lambert conformal conic
projections here:
        http://mike.teczno.com/map-code.tar

Those files are the beginnings of something I am planning to contribute to
the PEAR project, so if anyone has feedback or other projects they wish to
see added, they are very welcome.

See the test/lambert_conformal_conic.php file for an example of usage and
a brief unit test. Note that the reference latitude & longitude and the
standard parallels described in the mathworld write-up are the four
arguments to the constructor, and that all lat/long units are expected in
radian, not degrees. Sorry that the comments aren't as extensive as they
ought to be.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca            http://mike.teczno.com/contact.html

--- End Message ---
--- Begin Message ---
Copied and pasted the following sample script from the php manual and this
outputs:

...........
<?php
$str = "A 'quote' is <b>bold</b>";
echo htmlentities($str);

?>
..............

// outputs: A 'quote' is <b>bold</b>

Not sure why the I am still getting the tags and spaces after the call to
htmlentities().

Thank you for any help.
TR

--- End Message ---
--- Begin Message ---
--- Anthony Ritter <[EMAIL PROTECTED]> wrote:
> Copied and pasted the following sample script from the php manual
> and this outputs:
> 
> ...........
> <?php
> $str = "A 'quote' is <b>bold</b>";
> echo htmlentities($str);
> 
> ?>
> ..............
> 
> // outputs: A 'quote' is <b>bold</b>
> 
> Not sure why the I am still getting the tags and spaces after
> the call to htmlentities().

View source, and I think you'll understand. Or, remove the call to
htmlentities().

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming Fall 2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

--- End Message ---
--- Begin Message ---
> Copied and pasted the following sample script from the php manual and this
> outputs:
>
> ...........
> <?php
> $str = "A 'quote' is <b>bold</b>";
> echo htmlentities($str);
>
> ?>
> ..............
>
> // outputs: A 'quote' is <b>bold</b>
>
> Not sure why the I am still getting the tags and spaces after the call to
> htmlentities().
>
> Thank you for any help.
> TR


Are you looking at the html source?? I get A 'quote' is <b>bold</b> when I
load the page *BUT* viewing the source gives me this: A 'quote' is
&lt;b&gt;bold&lt;/b&gt;

;-)

Jim Grill

--- End Message ---
--- Begin Message ---
> Copied and pasted the following sample script from the php manual and this
> outputs:
>
> ...........
> <?php
> $str = "A 'quote' is <b>bold</b>";
> echo htmlentities($str);
>
> ?>
> ..............
>
> // outputs: A 'quote' is <b>bold</b>
>
> Not sure why the I am still getting the tags and spaces after the call to
> htmlentities().
>
> Thank you for any help.
> TR
>

Sorry to spam you, but.... If you are wanting to remove html altogether take
a look at strip_tags()
http://us4.php.net/manual/en/function.strip-tags.php

Jim Grill

--- End Message ---
--- Begin Message ---
Anthony Ritter wrote:

<?php
$str = "A 'quote' is <b>bold</b>";
echo htmlentities($str);
?>
..............

// outputs: A 'quote' is <b>bold</b>

Not sure why the I am still getting the tags and spaces after the call to
htmlentities().

Check out the source code of the output. Maybe you want the strip_tags() function ?

--- End Message ---
--- Begin Message ---
Chris Shiflett wrote:

> View source, and I think you'll understand. Or, remove the call to
> htmlentities().
>
> Chris
..............

Thank you all for your assistance.

Best...
TR
...........

"...when a browser sees  &lt, it prints out a < character instead of
thinking "OK here comes an HTML tag."  This is the same idea (but with a
differnt syntax) as escaping a " or $ charcater inside a double quoted
string..." ~[from Learning PHP5 [O'Reilly] page 102]
--------------------------------


<?php
$str = "I <b>love</b> sweet tea and <div class=\"fancy\">rice.</div> &
tea\n";
echo $str;
echo "<br>";
echo htmlentities($str);
?>

// Output in view source code:

I <b>love</b> sweet tea and <div class="fancy">rice.</div> & tea
<br>I &lt;b&gt;love&lt;/b&gt; sweet tea and &lt;div
class=&quot;fancy&quot;&gt;rice.&lt;/div&gt; &amp; tea

--- End Message ---
--- Begin Message ---
Hi all,
I need to use tidy for cleaning up html in my project, our hosting company
has php 4.3.8, so we need to install tidy and make the installation again.
After several times, the configure and make commands replied no error,
however, the phpinfo() doesn't show the package as installed and when we run
the function ini_set() to set the tidy constants in the php.ini file, it
returns nothing, also any call to the tidy library functions gives
error...any ideas of why this isn't working? After a succesfull
installation, is there any enviroment constant we can check or should set?
Thanks a lot in advance, 
Lizet

--- End Message ---
--- Begin Message ---
Hi,

Wednesday, September 8, 2004, 9:14:53 AM, you wrote:
M> Anyone! I'm out of online resources and answers. I guess this isn't possible
M> to do...

Here is a function/hack I use to clean up text for my php-gtk editor,
I still haven't found a clean solution yet but it may help.


function convert_text(&$text,&$content){
    $count = 0;
    $content = '';
    $changed = false;
    for($i=0,$length=strlen($text);$i<$length;$i++){
      //echo ord($text[$i])."\n";
      //echo $text[$i]."\n\n";
      if(ord($text[$i]) > 193 && ord($text[$i]) < 224){
        if(ord($text[$i+1]) > 127 && ord($text[$i+1]) < 192){
          $changed = true;
          //echo "found 2 byte control code ".ord($text[$i])." ".ord($text[$i+1]);
          $str = $text[$i].$text[$i+1];
          $rep = htmlentities($str,ENT_QUOTES,'UTF-8');
          if(!empty($rep) && $str !== $rep){
            $content .= $rep;
            //echo " success-$rep-$rep2-$str\n";
          }else{
            $content .= '?';
            //echo " failed-$rep2-$str\n";
          }
          $i += 1;
        }else{
          $content .= $text[$i];
          echo "Oddball 2 byte ".ord($text[$i])." ".ord($text[$i+1])."\n";
        }
      }
      elseif(ord($text[$i]) > 223 && ord($text[$i]) < 240){ 
        if(ord($text[$i+1]) > 127 && ord($text[$i+1]) < 192){
          if(ord($text[$i+2]) > 127 && ord($text[$i+2]) < 192){
            $changed = true;
            //echo "found 3 byte control code ".ord($text[$i])." ".ord($text[$i+1])." 
".ord($text[$i+2]);
            $str = $text[$i].$text[$i+1].$text[$i+2];
            $rep = htmlentities($str,ENT_QUOTES,'UTF-8');
            if(!empty($rep) && $str !== $rep){
              $content .= $rep;
              //echo " success-$rep-\n";
            }else{
              $content .= '?';
              //echo " failed\n";
            }
            $i += 2;
          }else{
            $content .= $text[$i];
            echo "Oddball 3 byte-3 ".ord($text[$i])." ".ord($text[$i+1])." 
".ord($text[$i+2])."\n";
          }
        }else{
          $content .= $text[$i];
          echo "Oddball 3 byte-2 ".ord($text[$i])." ".ord($text[$i+1])." 
".ord($text[$i+2])."\n";
        }
      }else{
        $content .= $text[$i];
      }
    }
    return $changed;
  }
  //Usage
  $text = "String with quotes";   //original
  $content = '';            //result

  if(convert_text($text,$content)){
    echo $content;
  }else{
    echo $text;
  }

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
http://pear.php.net/package/Structures_DataGrid


"Blackwater Dev" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Does anyone have a nice clean way to provide data grids with php short
> of simply creating a bunch of input boxes or using flash?
>
> Thanks! 

--- End Message ---
--- Begin Message ---
This is what I've used in the past, it's pretty much compatible with all of
the major browsers that users will use.

http://www.activewidgets.com/

-Brent

----- Original Message ----- 
From: "blackwater dev" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 08, 2004 1:15 PM
Subject: [PHP] data grids...


> Does anyone have a nice clean way to provide data grids with php short
> of simply creating a bunch of input boxes or using flash?
>
> Thanks!
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
BlueShoes: PHP Framework and CMS
http://www.blueshoes.org/en/javascript/

Regards,
Nadim Attari
Alienworkers.com


"Blackwater Dev" <[EMAIL PROTECTED]> a �crit dans le message de
news:[EMAIL PROTECTED]
> Does anyone have a nice clean way to provide data grids with php short
> of simply creating a bunch of input boxes or using flash?
>
> Thanks!

--- End Message ---
--- Begin Message ---
I'm not new to PHP, but I have very little experience with arrays.  I have comma 
separated values in a database, that I need to pull out, explode into an array, then 
check certain checkboxes if they exist.

I have two variables:

$x = "2,10,34"
$y = "28,15,16"

I need to explode them both, so that the values of $x are they keys, and the values of 
$y are the values.  Is that possible?

I have a form, with checkboxes that are named $product[1] through [40].  Next to them 
are textboxes labeled $price[1] through [40].  How would make the form, when it loads, 
have $product[2], [10], [34] checked, with $price[2], [10], and [34] equal to "28", 
"15", and "16" respecively.

Any help would be greatly appreciated.

-- 
Matt Winslow
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
HI,

--- Matt Winslow <[EMAIL PROTECTED]> wrote:

> I'm not new to PHP, but I have very little
> experience with arrays.  I have comma separated
> values in a database, that I need to pull out,
> explode into an array, then check certain checkboxes
> if they exist.
> 
> I have two variables:
> 
> $x = "2,10,34"
> $y = "28,15,16"
> 
> I need to explode them both, so that the values of
> $x are they keys, and the values of $y are the
> values.  Is that possible?

yes see array_combine function

http://www.php.net/array_combine


> I have a form, with checkboxes that are named
> $product[1] through [40].  Next to them are
> textboxes labeled $price[1] through [40].  How would
> make the form, when it loads, have $product[2],
> [10], [34] checked, with $price[2], [10], and [34]
> equal to "28", "15", and "16" respecively.

a sensible use of foreach and if can easily do so.

zareef ahmed

=====
Homepage :: http://www.zasaifi.com


                
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush

--- End Message ---
--- Begin Message ---
* Thus wrote Matt Winslow:
> I'm not new to PHP, but I have very little experience with arrays.  I have comma 
> separated values in a database, that I need to pull out, explode into an array, then 
> check certain checkboxes if they exist.
> 
> I have two variables:
> 
> $x = "2,10,34"
> $y = "28,15,16"
> 
> I need to explode them both, so that the values of $x are they keys, and the values 
> of $y are the values.  Is that possible?

$final = array();
$Y = explode(',', $y);

foreach(explode(',', $x) as $key => $val ) {
  $final[$val] = $Y[$key];
}

var_dump($final);

> 
> I have a form, with checkboxes that are named $product[1] through [40].  Next to 
> them are textboxes labeled $price[1] through [40].  How would make the form, when it 
> loads, have $product[2], [10], [34] checked, with $price[2], [10], and [34] equal to 
> "28", "15", and "16" respecively.
> 

What is the relationship between the $x,$y and $product,$price?
I'm not sure I quite grasp what your trying to do.

If I understand correctly, the situation you describe ends up not
being a one-one relationship. So a user could select 4 prices with
3 products or vice versa. Which will make things difficult to match
up products/prices.


Curt
-- 
The above comments may offend you. flame at will.

--- End Message ---
--- Begin Message ---
* Thus wrote zareef ahmed:
> HI,
> 
> > 
> > I have two variables:
> > 
> > $x = "2,10,34"
> > $y = "28,15,16"
> > 
> > I need to explode them both, so that the values of
> > $x are they keys, and the values of $y are the
> > values.  Is that possible?
> 
> yes see array_combine function
> 
> http://www.php.net/array_combine

heh.. there are so many array_* functions i forgot about that one.
Sometimes that array documentation can be so overwhelming.


Curt
-- 
The above comments may offend you. flame at will.

--- End Message ---
--- Begin Message ---
I read in the docs several comments that $_SESSION is slower that other
arrays. One
comment even had benchmarking info indicating it was about half as
fast. I don't understand
why this should be. Isn't $_SESSION just a normal super global array
like any other, except 
that it get serialized and written to disk *once at the end* of a
request? Why on earth would this impact the performance of reading and
writing in the middle of a request? Is there some
funkyness going on under the covers that I'm missing? Can it be made to
work as I 
described?

l8r
Aaron


                
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

--- End Message ---
--- Begin Message ---
Howdy,

I've written some, kinda coolish, class that reads directories
recursively with some simple calls. Yihaaa, .. (but I'm not the only
one who has done that, I guess :P). Anyway, during the process of
traversing a directory it checks to see if the "something" that was
found is either a directory or a file, based on that it will do some
things. Fine, works.

But, now that I've got a directory with about 800 files to read I
noticed that it takes the poor script almost two seconds to find the
correct type of all the "somethings". In fact, I timed it on a steady
1.71.

I've tried to use filetype() on the "something", but that took even
longer - while looping through the directory without any checks
finishes in 0.01 seconds.

Now, for the question: does anybody know an alternative method on
checking whether a "something" is either file or directory?

Wouter

(this time, I'm on a Windows XP machine running PHP5 - just tested the
same thing on Linux and PHP 4.3.8 and came out on 0.63 secs, ..)

--- End Message ---

Reply via email to