|
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 13 Jun 2004 07:26:55 -0000 Issue 2818
php-general-digest-help
lists.php.net
Date: Sun Jun 13 2004 - 02:26:55 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 13 Jun 2004 07:26:55 -0000 Issue 2818
Topics (messages 188160 through 188176):
Re: PHP 5/OOP, Functionality similar to an Abstract method?
188160 by: Chris
Re: export from mysql to csv file
188161 by: Kim Steinhaug
Re: Header target?
188162 by: Kim Steinhaug
Re: array_rand() not random
188163 by: Kim Steinhaug
Multidimensional Array advice from a newbie
188164 by: grahama.siren.cc
Re: Best Lossless Hi-Res Photo Storage with PHP
188165 by: Kim Steinhaug
188176 by: Galen
Re: PHP pros and cons
188166 by: Steve Douville
>>>>>> THREADS IN PHP
188167 by: jack bauer
188172 by: Aidan Lister
188173 by: Ryan A
Re: finding text strings in html code
188168 by: Curt Zirzow
session_start() warnings
188169 by: PaoAge
188170 by: Larry E. Ullman
188171 by: PaoAge
Cookie Security?
188174 by: phpmail
[PHP5] Super constructor?
188175 by: FrzzMan
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Justin Patrin wrote:
> Chris wrote:
>
>> I have an abstract class with quite a few 'children'. Essentially I
>> want to be able to interchange calls between children (Take a script,
>> written with ClassA and redefine the variable as ClassB etc.)
>>
>> Though there is a large subset of methods all of these children
>> declare, there are a few which only *some* declare. What I think I'm
>> looking for is a variation on an abstract method that, if not defined
>> in a child, will do nothing. Using an abstract method forces me to
>> declare the method in the child with an empty body.
>>
>
> AFAIK, there is no support for this explicitly in PHP5. You would have
> to implement something yourself, like putting a die() or exit in the
> abstract method in the parent class.
>
> If you just want an empty funciton anyway, why don't you just put an
> empty function in the parent? I don't see why you would need PHP to
> yell at you when you don't want to do antyhing with it anyway.
>
When I said "will do nothing" I was meaning the method call, not the
entire script. I can't put anything into an abstract method, it only
defines the method name and argument list, a body is nto allowed in an
abstract method.
Upon further reflection it appears that the abstract method is what I
really want. I'll just have to implement an empty body.
Thanks
attached mail follows:
You are also probably using PHPMyAdmin, if not you should be using this.
Exporting to CVS is fairly simple, and if your used to quering the databsae
you should be able to do this very easilly yourself if your looking for a
sollution you can do from scripts.
Basically what you do is simply do a "select * from table", which will give
you
every coloumn of the database, Thereafter loop through the entire dataset
and use the mysql_fetch_array function, then use this :
foreach ($temp AS $key=>$value){
// $key = coloumn name
// $temp[$key] = coloumn value
if(!is_numeric($key))
echo $key . " : " . $temp[$key] . "<br>";
}
Where $temp is the $temp = mysql_fetch_array($dataset_from_query);
If your into >100.000 entries in the database you will need to do some
smart quering, or alter the php.ini to handle more than the standard 30
sec timout. Basically you could also go in "rounds" of limit 0,50000
thereafter
limit 50000,50000 but that wasnt your question.
--
--
Kim Steinhaug
----------------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
----------------------------------------------------------------------
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
----------------------------------------------------------------------
"Dustin Krysak" <mailinglists
digitalcollision.com> wrote in message
news:7604EBE9-BC16-11D8-A188-000A95902366
digitalcollision.com...
> Can anyone point me to an existing script or tutorial to learn this?
>
> Thanks in advance!
>
> d
attached mail follows:
Steve Douville had a long answer, the short answer : no
--
--
Kim Steinhaug
----------------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
----------------------------------------------------------------------
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
----------------------------------------------------------------------
"Bob Lockie" <bjlockie
lockie.ca> wrote in message
news:40CA573D.8090808
lockie.ca...
> Is it possible to specify the target frame in a "Header" call?
> I have a form that submits in one frame and I want it to redirect to
> another frame in some cases.
attached mail follows:
Hmm... Ive been having same problems with mysql and picking random
numbers, I ended up having to program a rather more sofisticated
system to eliminate the stats you were referring to.
You could, not that it will be any better, try another approach :
Something like :
$count = count($your_data_array);
$random = rand(0, $count);
echo $your_data_array[$random];
PHP is maby using the same random function for both the array_rand and
rand for all I know but its worth a go.
The harder way would be to include an internal counter for your elements you
want to be randomized, so that when an item is selected you count it. Then
the
next time you calculate the random element you take the accual hits into
meassure.
There are like a 1000 ways to do this so use your imagination.
One way could be to use some sessions, and when a user hits the page you
precalculate the random sort for all your elements, and store that in the
session.
Then for each and every visit form that visitor you just go along with the
pre-randomed
data. This way your user will get a truly randomized experienced, and youll
be showing
off all the elements even if the random function in itself is abit
"non-random".
Im sure there also exists a mathematical approach calculating a sort of the
elements based
on the earlier views (meaning that we count each view).
--
--
Kim Steinhaug
----------------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
----------------------------------------------------------------------
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
----------------------------------------------------------------------
"Nori Heikkinen" <nori+lists-php
maenad.net> wrote in message
news:20040611174531.GM11409
merlin.sccs.swarthmore.edu...
attached mail follows:
Hi :)
I am creating an XML file out of a mysql query with nested arrays.
Currently I can get 1 element and 1 child with a properly formatted XML
file with the below script .
My question is: How do I add 3 to 4 more child elements to the below
'playlist' array ?
Currently ,I have one parent 'Artist' and one child 'english' ...
I need to add more child elements to the 'Artist' array like urlPath,
spanish, biography, etc
My addled thoughts...
So, would the multidimensional array be like:
$playlist[ [$artist [ ] ] [$media[ ] ] [$mediaElement]
] ?
for the 'trackName' child:
$playlist [ "Artist 1" ] [ "Track 1" ] [ "trackName" ]
or for 'urlPath' child :
$playlist [ "Artist 1" ] [ "Track 1" ] [ "urlPath" ]
Do I have to add another dimension to the 'playlist' array? Do I need
another foreach loop ?
Is there an easier more efficient way to do this?
Be nice to spell out the schema in some way in the script...in case you
need to add more levels...like a 'subCategory'
I am a bit new to this so any help would be greatly appretiated ....
head is spinning a bit
<?php
$db = mysql_connect('127.0.0.1','name','pass');
if (!$db)
{
echo 'Error:Could Not Connect';
exit;
}
mysql_select_db('univision');
$sql = 'SELECT artist.artist_name, media.english, media.path ';
$sql .= 'FROM media, artist ';
$sql .= 'WHERE artist.artist_id = media.artist_id LIMIT 0, 30 ';
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result))
{
$playlist[$row['artist_name']] [] = $row['english'];
//would like to add more children here...
}
$xml = "<sirenreels>\n";
foreach ($playlist as $artist => $media)
{
$num_media = count($media);
$xml .= "<artist>\n";
$xml .= "\t<meta>\n";
$xml .= "\t\t<title>".$artist."</title>\n";
$xml .= "\t</meta>\n";
$xml .= "\t<content>\n";
foreach ($media as $mediaVal)
{
$xml .= "\t\t<media>\n";
$xml .= "\t\t\t<english_name>".$mediaVal."</english_name>\n";
///add more children
///add more children
$xml .= "\t\t</media>\n";
}
$xml .= "\t</content>\n";
$xml .= "</artist>\n";
}
$xml .= "</sirenreels>\n";
print $xml
attached mail follows:
well, there are formats that have impressed me. The Mpg-4 format
which requires plugins all over the place is really amazing, from e-vue.
They also provide a plugin atleast for IE to browse the images.
I dont know if you can compress images outside the windows platform
however.
If your looking for supreme quality however, you would need to stay
away from the lossy formats and probably go for TIFF which is a great
format and is also supported by any major software. PNG however is
abit "strange", woudnt sendt PNG images to a publisher...
You could ZIP the TIF images on the HD to same space, you often
get good results on this. This would also make the downloads better
for the user, and since all the browsing online would use thumbnails you
dont need to waste CPU do depack the images, since you all users
can depack a ZIP file (thats the least you would expect from a user that
purchase a High resolution image).
Ive created such systems myself, and my sollution was another :
Plug in a new harddrive. We save the images as jpg, tif, eps, ai or whatever
the original image was created as, and create thumbnails at various
resolutions in high compressed jpg for fast browsing. Often I tend to
ZIP the lossless images aswell, but then again I dont need to since HD isnt
a problem atleast in my case.
Hope this helps.
--
--
Kim Steinhaug
----------------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
----------------------------------------------------------------------
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
----------------------------------------------------------------------
"Galen" <phplist
zinkconsulting.com> wrote in message
news:7DAC70A6-BC3C-11D8-BE8C-000D932A3B7E
zinkconsulting.com...
> I'm working on a photo site and most of it is working. The intent is to
> store original high-resolution photos that will only be accessed when
> purchased, and then a variety of thumbnails that will be accessed when
> viewing. Because they're high-resolution, I need maximal image
> compression but I can't sacrifice image quality. With hundreds (or
> more) of many megapixel images, space requirements quickly soar.
>
> I am currently using PNG, but that's not all that great for lossless
> photo compression. JPEG 2000 is significantly better in terms of file
> size, but I haven't ever used that with PHP (and it seems I'll have to
> use it via ImageMagick or something). Are there any other (free)
> formats for high image compression out there that I can use (maybe even
> just via the shell) with PHP?
attached mail follows:
On Jun 12, 2004, at 4:36 PM, Kim Steinhaug wrote:
> well, there are formats that have impressed me. The Mpg-4 format
> which requires plugins all over the place is really amazing, from
> e-vue.
> They also provide a plugin atleast for IE to browse the images.
>
> I dont know if you can compress images outside the windows platform
> however.
>
That's a key problem. I don't touch Windows unless I have to, so I
don't primarily run it at home and my servers _never_ run it, so this
format is totally out of the running - I need to be able to
compress/decompress on *nix based machines.
> If your looking for supreme quality however, you would need to stay
> away from the lossy formats and probably go for TIFF which is a great
> format and is also supported by any major software. PNG however is
> abit "strange", woudnt sendt PNG images to a publisher...
>
>
> You could ZIP the TIF images on the HD to same space, you often
> get good results on this. This would also make the downloads better
> for the user, and since all the browsing online would use thumbnails
> you
> dont need to waste CPU do depack the images, since you all users
> can depack a ZIP file (thats the least you would expect from a user
> that
> purchase a High resolution image).
I've experimented, PNG is notably better than ZIP for compressing image
material. PNG retains 100% quality and offers the smallest file sizes
around in a file that can be read by almost any system (i.e. all
half-recent browsers, photoshop, most other graphics applications,
etc). There's no reason I can't also offer a TIFF file, but I'll
primarily route the user to the PNG file because it's simply the
smallest download yet retains 100% quality and is a completely "free"
format.
>
> Ive created such systems myself, and my sollution was another :
> Plug in a new harddrive. We save the images as jpg, tif, eps, ai or
> whatever
> the original image was created as, and create thumbnails at various
> resolutions in high compressed jpg for fast browsing. Often I tend to
> ZIP the lossless images aswell, but then again I dont need to since HD
> isnt
> a problem atleast in my case.
>
I have a similar system implemented with thumbnails and caching and all
sorts of things. Works great. But hard drive space is a major concern,
so I have to be more conservative with the hi-res versions.
> Hope this helps.
>
Well, it's good to know that somebody else works with this sort of
thing. Although I was really hoping to hear from someone who's worked
with JPEG 2000 lossless (much higher than PNG image compression ratio!)
via ImageMagick or something similar to that. Or perhaps any other
interesting solutions people have come up with that beat PNG for
compression. More thoughts anybody?
attached mail follows:
Yes, pardon me for actually providing to the spirit of this list, to help
people find ways to meet their objectives. Just saying "no" isn't very
constructive, now is it? :-)
"Kim Steinhaug" <kim
steinhaug.com> wrote in message
news:20040612230111.93909.qmail
pb1.pair.com...
> Steve Douville had a long answer, the short answer : no
>
> --
> --
> Kim Steinhaug
> ----------------------------------------------------------------------
> There are 10 types of people when it comes to binary numbers:
> those who understand them, and those who don't.
> ----------------------------------------------------------------------
> www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
> ----------------------------------------------------------------------
>
>
> "Bob Lockie" <bjlockie
lockie.ca> wrote in message
> news:40CA573D.8090808
lockie.ca...
> > Is it possible to specify the target frame in a "Header" call?
> > I have a form that submits in one frame and I want it to redirect to
> > another frame in some cases.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>
attached mail follows:
hi,
i'm looking for a methode to use threads in php (on linux)
attached mail follows:
Please don't "hype" your post, or you'll find, as do many children, no one
will pay it any attention.
"Jack Bauer" <jackbauer
elict.org> wrote in message
news:20040613002922.46256.qmail
pb1.pair.com...
> hi,
>
> i'm looking for a methode to use threads in php (on linux)
attached mail follows:
> Please don't "hype" your post, or you'll find, as do many children, no
> one
> will pay it any attention.
>>>>>>>>> YEP, THE ABOVE IS TRUE! <<<<<<<<<
:-p
attached mail follows:
* Thus wrote Kathleen Ballard (klb5770
yahoo.com):
> I am beginning a project that will involve moving data
> from an mssql table to xml files.
>
> ...
>
> I have played with code using substr/str_pos, running
> html tidy with exec() and it works. But searching the
> archives, it seems like the new html tidy tags in php5
> will be more useful. In most cases the target text is
> in a one row, one cell table.
>
> Any advice on how to attack this would be appreciated.
> I can handle the coding, I just have a feeling I am
> approaching this from the hard way.
I think you're on the right track with using tidy's php5 features.
Here is some more documentation on tidy, hopefully it will push
your approach in the right direction:
http://www.coggeshall.org/tidy.php
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
attached mail follows:
Hi, all:
When I use session_start function, I receive the following warning messages:
Warning: session_start(): Cannot send session cookie - headers already
sent by (output started at
/home/w4t3c101/public_html/ListClientInfo.php:2) in
/home/w4t3c101/public_html/SessionControl.php on line 9
Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
/home/w4t3c101/public_html/ListClientInfo.php:2) in
/home/w4t3c101/public_html/SessionControl.php on line 9
Can anyone explain why it happens and how to solve the warnings. Thanks :)
attached mail follows:
> When I use session_start function, I receive the following warning
> messages:
>
> Warning: session_start(): Cannot send session cookie - headers already
> sent by (output started at
> /home/w4t3c101/public_html/ListClientInfo.php:2) in
> /home/w4t3c101/public_html/SessionControl.php on line 9
> Warning: session_start(): Cannot send session cache limiter - headers
> already sent (output started at
> /home/w4t3c101/public_html/ListClientInfo.php:2) in
> /home/w4t3c101/public_html/SessionControl.php on line 9
>
> Can anyone explain why it happens and how to solve the warnings.
> Thanks :)
Something on or about line 2 of ListClientInfo.php is sending data to
the Web browser. This could be HTML, plain text, or blank spaces. Get
rid of that and you'll get rid of the warnings.
Larry
attached mail follows:
Larry E . Ullman wrote:
>> When I use session_start function, I receive the following warning
>> messages:
>>
>> Warning: session_start(): Cannot send session cookie - headers already
>> sent by (output started at
>> /home/w4t3c101/public_html/ListClientInfo.php:2) in
>> /home/w4t3c101/public_html/SessionControl.php on line 9
>> Warning: session_start(): Cannot send session cache limiter - headers
>> already sent (output started at
>> /home/w4t3c101/public_html/ListClientInfo.php:2) in
>> /home/w4t3c101/public_html/SessionControl.php on line 9
>>
>> Can anyone explain why it happens and how to solve the warnings.
>> Thanks :)
>
>
> Something on or about line 2 of ListClientInfo.php is sending data to
> the Web browser. This could be HTML, plain text, or blank spaces. Get
> rid of that and you'll get rid of the warnings.
>
> Larry
Thanks, I got it. I leave a line of space before I use include directive.
attached mail follows:
My login script sets unique, secure, cookies that identify the user. Some of my pages only display content if a secure cookie is present. Is this a bad idea for secure pages with sensitive details as I have heard that cookies can be faked? I am always interested in creating a secure environment for my website visitors and I want to make sure I am protecting their privacy. Any help on this matter is greatly appreciated.
Thanks,
~Sean V.
attached mail follows:
Hi guys, hey don't laugh at the subject, in fact I don't what to call
it, so let's call it super constructor :D
Let's see following code...
class Base
{
__construct()
{
// Do something
}
}
class One extends Base
{
__construct()
{
// Do nothing
}
}
class OneMore extends One
{
__construct()
{
// Do things :D
}
}
So when I create an instance of OneMore class by:
$OneMoreInstance = new OneMore()
The __construct() method of class OneMore will be called, not the one of
One and Base, right?
So is there any way around to make the Base class have a contructor that
will be called everytime one of its child initialize?
My problem, I want all of the classes in my object are extend from one
base class, so they are all have some common properties and function,
but PHP won't implicit call the contructor (that's the right way)...
btw, in my case, this is bad, as bad as every constructor would be called...
Well, hope you understand what I'm trying to say...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]