php-general Digest 29 Oct 2005 09:47:24 -0000 Issue 3764

Topics (messages 224791 through 224800):

Re: calling static method within class
        224791 by: Carlo Razzeto
        224798 by: Tom Rogers

Re: foreach / unset
        224792 by: Richard Lynch

UTF-8 to ISO-8859-1
        224793 by: Richard Lynch

Re: OCI8
        224794 by: Richard Lynch

Re: Decompressing a string with zlib problems
        224795 by: Graham Anderson

Re: DataCodecCompress and zLib problem (solved)
        224796 by: Graham Anderson
        224797 by: Graham Anderson

Referencing Containing (Non-Parent) Object?
        224799 by: Morgan Doocy

Re: Inserting NULL Integer Values
        224800 by: Bogdan Ribic

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 ---
If you're expecting the statement 

Echo Foo::getUs(); 

To echo "me& me" it will not because you never returned $us from the
getUs() method. I'm assuming also that xxx is a variable to mean "some
class library" correct?

Carlo Razzeto
Programmer
Mortgage Information Services
Phone: (216) 514-1025 ex. 1212

-----Original Message-----
From: blackwater dev [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 28, 2005 1:13 PM
To: [email protected]
Subject: [PHP] calling static method within class

I have a class that won't be instantiated...so basically just a bunch
of static methods.

How do I call one of the class' static methods from within another
method?  Can't use this, and self doesn't work...this is php4.

Thanks.

Class Foo{

   function getMe(){
    return "me";

  }

  function getUs(){
   $us=xxx::getMe();
   $us.="& me";

  }
}

echo Foo::getUs();

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


Disclaimer: This message (including any attachments) contains confidential 
information intended for a specific individual and purpose, and is protected by 
law. If you are not the intended recipient, you should delete this message. Any 
disclosure, copying, or distribution of this message, or the taking of any 
action based on it, is strictly prohibited.

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

Saturday, October 29, 2005, 5:42:15 AM, you wrote:
CR> If you're expecting the statement 

CR> Echo Foo::getUs(); 

CR> To echo "me& me" it will not because you never returned $us from the
CR> getUs() method. I'm assuming also that xxx is a variable to mean "some
CR> class library" correct?

CR> Carlo Razzeto
CR> Programmer
CR> Mortgage Information Services
CR> Phone: (216) 514-1025 ex. 1212

CR> -----Original Message-----
CR> From: blackwater dev [mailto:[EMAIL PROTECTED] 
CR> Sent: Friday, October 28, 2005 1:13 PM
CR> To: [email protected]
CR> Subject: [PHP] calling static method within class

CR> I have a class that won't be instantiated...so basically just a bunch
CR> of static methods.

CR> How do I call one of the class' static methods from within another
CR> method?  Can't use this, and self doesn't work...this is php4.

CR> Thanks.

CR> Class Foo{

CR>    function getMe(){
CR>     return "me";

CR>   }

CR>   function getUs(){
CR>    $us=xxx::getMe();
CR>    $us.="& me";

CR>   }
CR> }

CR> echo Foo::getUs();

Just use the class name Foo::getMe()

Class Foo{

   function getMe(){
    return "me";

  }

  function getUs(){
   $us=Foo::getMe();
   $us.="& me";

  }
}

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
On Fri, October 28, 2005 8:47 am, Jochem Maas wrote:
> John Nichel wrote:
>> Richard Lynch wrote:
>>
>>> Somewhere in the manual (damned if I can find it now) it says (or
>>> used
>>> to say) that you can or can't safely do this:
>>>
>>> while (list($k, $v) = each($array)){
>>>   if (...) unset($array[$k]);
>>> }
>>>
>>> I don't even remember if it's safe or not, but I swear I saw it not
>>> that long ago...
>>>
>>> Anyway, can you do *this* safely as a DOCUMENTED FEATURE:
>>>
>>> foreach($array as $k => $v){
>>>   if (...) unset($array[$k]);
>>> }
>>>
>>> I'm sure I could test it and maybe find out if "it works" but is it
>>> documented behaviour I can rely on?  I'm sure not finding this in
>>> the
>>> manual now that I go looking for it, though I know I saw it there
>>> before.

I would think it would be just fine *EXCEPT* that the "internal
pointer"  of the original array is being incremented in parallel with
the copied array key/values, so it ends up at the "end" after the
"foreach"

So, unless it's a DOCUMENTED FEATURE rather than an implementation
detail, I don't really want to rely on unset($original[$k]) "working"
because who knows what might change in PHP6 with the "internal
pointer" and unsetting the current entry it points to, or, rather, the
entry it previously pointed to.

I know for sure that while/list/each and an integer-indexed array and
(unset($array[$k + 1])) is a big mistake :-)

>> I would *think* (just my opinion without much thought on a Friday
>> morning) that this would/could be unsafe _if_ it was a for loop on a
>> numerical indexed array.  Of course, my thinking may change after my
>> first bottle of Dew. ;)

I think it's always been okay to unset the *CURRENT* element, but if
you started dinking with other elements, in some sort of poor-man's
relational algorithm, you'd be in trouble.

foreach doesn't DOCUMENT unset-ing either way...

>>> PS
>>> I'm being dragged kicking and screaming into using this new-fangled
>>> 'foreach' thing instead of while/list/each, and I don't really care
>>> for it so far. :-)
>
> new-fangled is putting the boat out a bit thought :-) it's been around
> since 4.0,
> I guess your looking forward to being able to use foreach to iterate
> over php5 object ;-)

For me, who started in PHP 3.0 RC 2, PHP 4.0 *is* new-fangled.  PHP 5
is just *more* new-fangled.

I suppose by PHP6 I'll be just plain obsolete and have to start
looking for a new language. :-v

>> For the longest time, I hated foreach.  Looked at other people's
>> code
>> who used it, and just wanted to strangle them.  However, I was sorta
>> forced into it about 8 months ago, and now I'm in the camp of,
>> "Damn, I
>> really like this".

I don't like it precisely because it's not documented "what if"...

while/list/each actually HAD documentation at one point that it was
kosher to unset() the current element, but no other.

Though that also seems to have gone missing from the manual, possibly
in the Great Purge of not so long ago (from a PHP3.0rc2 persepctive of
time).

I also just don't care for the clever crammed syntax and the "as"
keyword.  It just doesn't go through my brain easily, no matter how
many times I see it.

I guess I'm just so used to assignments being left <- right, where
foreach has it right -> left for what's being assigned to what...

How about:

eachfrom([$k => ] $v = $array){
}

Now, see, that would make perfect sense to me...

[shrug]

DSFDF

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
So, I'm parsing some XML and dumping some stuff to a web-site.

The character-encoding for the HTML of the output has already been set
by headers() to ISO-8859-1 for me, and I'm stuck with that.

So be it.

The XML has this at the top:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

We don't (and won't soon) have recode nor iconv installed, but
utf8_recode() is there.

So, my question is:

Can I just:
utf8_recode($all_the_xml_file);

Or do I have to utf8_recode() every single chunk of data between the
tags?  Ugh.

Oh well.  At least I had fun writing the parallel XML feed reader,
which sped things up by about 40% over sequential file_get_contents-es
:-)

I should find out if I can OS that class.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Fri, October 28, 2005 10:19 am, Kilbride, James wrote:
> I'm running php5.0.5 and I'm trying to get connected to an oracle
> server. Pear's DB requires the PHP OCI8 extension. The php website
> doesn't give 'installation' instructions for getting php_oci8.dll
> which
> seems to be required in order to connect to an Oracle server. I've got
> the oracle instant client downloaded and I have oracle client 8.1
> installed already. I just can't seem to figure out how to get php to
> recognize oracle. Can anybody help out with this?

php_oci8.dll is the "extension" of PHP which connects PHP and the
Oracle instant client you already downloaded.  Or, possibly, has that
client already embedded within it, and with PHP wrappers around it.

That doesn't tell you where it is, but at least you know WHAT it is
that you are missing.

If it's not in the php.zip file you downloaded, you can google for
"php_oci8.dll" and maybe come up with a trusted source, and check for
more downloads in http://php.net/ to see if maybe it's packaged
separately.

Hope that helps at least a little.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Well, maybe QT has a very wacked out version of zLib ?
This is what I sent to the Quicktime API list:

//---------------------------------------------------------------------- ----------

Ok, here we go :)

Isn't looking through  reams of hex data a blast ?
Kind of like a hot poker in the eye ;)

curl  -l -i "http://www.siren.cc/siren/reel/Library/php/zlib.php";

Here are two versions of the SAME  test movie exported from Livestage:
One version has compressed movie headers
The other version has uncompressed movie headers

With zLib, I am using gzcompress at compression level 6, and gzuncompress. All the string data below was converted from hex with the pack() function.
The actual php script I wrote for this test is way way below.

The upshot:
1)Using zlib to compress and decompress a movie header seems to work fine :)

2)Attempting to 'gzuncompress' a movie header that was compressed in Livestage gives an error. I doubt this is fault of Livestage which I assume is simply calling DataCodecCompress or an equivalent function, no ?

3) The Livestage'd compressed movie header output IS NOT THE SAME as a the zLib'd compressed movie header output

Maybe I am not starting at the correct point in the compressed movie header string?
hopefully, this is enough to start a dialog.


here is the output:

//-----------------------------------------------------
The uncompressed movie header string is:
[EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstco&? code?sean emk
hjkedtligudta
namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play

//-----------------------------------------------------
Compressed in Livestage: the compressed movie header string is:
?cmvd?x??S?n1?l?P?H ՂV"[EMAIL PROTECTED] [EMAIL PROTECTED]| ?=??9???[?????o??~4???k??e?soo?C7?
??P???7?&Fs???4?ǻ?
?,?u????gU?K?s?ꬲҋld?f^?&;H????J`Z?PK3#?\?A?? Mͷa???oe8?0%?<??????*J2?3??!?܊Y?;?D??O??7?;޸??;?Vr??C??m?R????? ӂ[Cߢ??o???8a\dK??\?3?r??Z?ߋJ??\HA?????ԯ*Sj?A??*0?F?] 9 c?8×?oZ6f p?;-?hM?? fb?A?!?O?9


//-----------------------------------------------------
The zlib version of the uncompressed movie header using gzcompress at level 6 is: [EMAIL PROTECTED]@??T?U?m?EU??`?HHٰ??!3??̌??I9K?-8E?8??H?s?qb?EG? 4o???=??:?:ϧ??4?ß?/????D??k??>.-?o????[6F?̏K?N?Y?յ??Ѝ???P??????? 撡?h?̻#?g\Y??LYWXϊB?,Qt?~XX?Erd?f^??M???J`Y?BKsA2?.ez):=????Z?p?aJ:? [EMAIL PROTECTED]" ??????'?_??7':S?<?{Η3?b????1Z?/?c?p??? o????;ʹh??̄????h?>?]?Z??b????Fd??(87ɷ???4?$?ZmP?l?Ri#uѝpO_?kô?V? Я??p?.-t???R?,?)?b?Y*?K??-?$??T
????u??n??UarC??,??t_????

//-----------------------------------------------------
the uncompressed zlib movie header string  using gzuncompress is:
[EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstco&? code?sean emk
hjkedtligudta
namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play

//-----------------------------------------------------
Here is the attempt to use gzuncompress with the movieheader compressed in Livestage:
<br />
<b>Warning</b>: gzuncompress(): data error in <b>/home/www/siren/ siren/reel/Library/php/zlib.php</b> on line <b>34</b><br />



Here is the PHP script:
<?php
$uncompressed_movieheader_hex="000003DE6D6F6F760000006C6D76686400000000B F883792BF883792000002580000025800010000010000000000000000000000000100000 000000000000000000000000001000000000000000000000000000040000000000000000 000025800000000000000000000000000000000000000020000030D7472616B0000005C7 46B686400000003BF883792BF8837920000000100000000000002580000000000000000F FFE000000000000000100000000000000000000000000000001000000000000000000000 000000040000000000200000002000000000024656474730000001C656C7374000000000 00000010000025800000000000100000000026E6D646961000000206D64686400000000B F883792BF8837920000025800000258000000480000003F68646C72000000006D686C727 37072746170706C00000001000101C11E53707269746520416E696D6174696F6E204D656 469612048616E646C6572000002076D696E6600000020676D686400000018676D696E000 000000040FFFFFFFFFFFF000000000000003968646C720000000064686C72616C6973617 0706C10000001000101D2184170706C6520416C69617320446174612048616E646C65720 000002464696E660000001C6472656600000000000000010000000C616C6973000000010 00000907374626C0000002C7374736400000000000000010000001C00000000000000000 0000001000000007A6C69620000000000000018737474730000000000000001000000010 00002580000001C737473630000000000000001000000010000000100000001000000147 374737A000000000000021D00000001000000147374636F0000000000000001000004260 00000F2636F6465000000000000000000000000000000DE7365616E00000001000000090 00000000000001A000000650000000100000000000000000000000000000000001600000 06D0000000100000000000000000001000000180000006B0000000100000000000000000 000000A000000150000006800000001000000000000000001000000150000006A0000000 1000000000000000000000000156B6564740000000100000000000000000000000016000 0006C0000000100000000000000000000000000150000006900000001000000000000000 001000000180000006700000001000000000000000000000004000000177564746100000 00B6E616D6564726D000000000000005D7564746100000023A9737772001700004D61646 52077697468204C69766553746167652050726F00000019706C75676D6F7669656E616D6 53D64726D2E6D6F760000000C637479706E6F6E6500000009706C6179000000000000000 008";

$compressed_movieheader_hex="000001D0636D7664000003DE789C9553C16E1331109 D6C9050A1481C0809D582562247C415714010A9871CA854A9170E70706267D7C4F6AE6C3 751F2051CF9037AE52BAAFE021FD08FE003DACE384E77B31107AC7DF278C6F3DEECCC2E4 0F75A97E50200945E141C77B8FCF1EE8200907C09E8003DF5DA39EC9F3FDD5B94BFB7128 0EE136FD91CEDAF7E1E34BBA8F76BA3B965AB736F6FFE43378900180AEE1DEEA950CED71 99137E4264673C9D0C834FFC7BB038C111F0BAE2CC575A1ACABAC6755A5024BA773F5EAA CB2D28B6C64A4665E96263B11489B8D99E14A605AF2504B3323995C0799418E8E4DCDB76 1C5F2DE6F6538CA30251DC93CDDC8FC198CF0802A4A32971D33DF108021DF08A4DC8A59A 33B874412ED9FCE4FA8E637CE3BDEB893B63BBA567212CF03E7430FB7B16DFF52E498EEF AEFF10C63EB38C397B56F5A36662070FF3B2DB9684DF4DA096662CE41F41D2104EC4F1FE 0390D642742D600316FDD7F84E8218AA6BF139DDFDBE4BD397E3A6D2789A9BD32285FB64 9A982BC75F501A27FCE3D7D6D8F0DD3825B1D43DFA2FBF56FB7B4D00738615C644BE98BE CB35C8833CF72919D5AEADF8B4A9DE7BA5C4841141F90E3AD0E3FEFE1D4AF2A531A6AD44 1A5D82A30DF0110468E5D00000039";


$uncompressed_movieheader_string = pack("H*", $uncompressed_movieheader_hex);

echo '//-----------------------------------------------------'."\n\r";
echo "The uncompressed movie header string is:". "\r\n";
echo $uncompressed_movieheader_string."\r\n\r\n";


$compressed_hexstring = pack("H*", $compressed_movieheader_hex);
echo '//-----------------------------------------------------'."\n\r";
echo "Compressed in Livestage: the compressed movie header string is:"."\r\n";
echo $compressed_hexstring."\r\n\r\n";


$compressed_zlib_movieheader_string = gzcompress ($uncompressed_movieheader_string, 6);
echo '//-----------------------------------------------------'."\n\r";
echo "The zlib version of the uncompressed movie header using gzcompress at level 6 is: "."\r\n";
echo $compressed_zlib_movieheader_string."\r\n\r\n";


$decompressed_zlib_movieheader_string= gzuncompress ($compressed_zlib_movieheader_string);
echo '//-----------------------------------------------------'."\n\r";
echo "the uncompressed zlib movie header string using gzuncompress is: "."\r\n";
echo $decompressed_zlib_movieheader_string."\r\n\r\n";


echo '//-----------------------------------------------------'."\n\r";
echo "Here is the attempt to use gzuncompress with the movieheader compressed in Livestage: "."\r\n";
$decompressLSCompressedMovieHeader= gzuncompress($compressed_hexstring);
echo $decompressLSCompressedMovieHeader."\r\n\r\n";


?>




On Oct 28, 2005, at 8:15 AM, Robin Vickery wrote:

On 10/28/05, Graham Anderson <[EMAIL PROTECTED]> wrote:

I am having problems decompressing a zlib'd string located in a file.

In the file headers, the compression says that it is  zlib.
But, when I  'gzinflate' the string, I get the error: gzinflate():
data error in <b
Is the below NOT a zlib or some strange variant ?

<?php
$hex="C0636D7664000003DE789C95533B4E [...]


Is this thread any help?

http://lists.apple.com/archives/QuickTime-java/2003/Sep/msg00038.html

Looking at your binary data in a hex editor, you've got what looks
like a cmvd header at the start.  If the next four bytes are the
length of the compressed data, then you've got probably got 990 bytes
following that that you should be decompressing.

-robin


--- End Message ---
--- Begin Message ---
DOH!
OK, I was starting at the wrong place in the hex....
I misread the QTFF docs which include two more atoms on the next page:

Four-character code           Atom type
'cmvd'                                    Compressed movie data
Uncompressed size            32-bit integer


The correct output is now:
//-----------------------------------------------------
The uncompressed movie header string is:
[EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstco&? code?sean emk
hjkedtligudta
namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play

//-----------------------------------------------------
Compressed in Livestage: the compressed movie header string is:
x??S?n1?l?P?H ՂV"[EMAIL PROTECTED]@? Z???^w?????| ?=??9???[?????o??~4???k??e?soo?C7?
??P???7?&Fs???4?ǻ?
?,?u????gU?K?s?ꬲҋld?f^?&;H????J`Z?PK3#?\?A?? Mͷa???oe8?0%?<??????*J2?3??!?܊Y?;?D??O??7?;޸??;?Vr??C??m?R????? ӂ[Cߢ??o???8a\dK??\?3?r??Z?ߋJ??\HA?????ԯ*Sj?A??*0? F?] c?8×?oZ6f p?;-?hM?? fb?A?!?O?9

//-----------------------------------------------------
The zlib version of the uncompressed movie header using gzcompress at level 6 is: [EMAIL PROTECTED]@??T?U?m?EU??`?HHٰ??!3??̌??I9K?-8E?8??H?s?qb?EG? 4o???=??:?:ϧ??4?ß?/????D??k??>.-?o????[6F?̏K?N?Y?յ??Ѝ???P??????? 撡?h?̻#?g\Y??LYWXϊB?,Qt?~XX?Erd?f^??M???J`Y?BKsA2?.ez):=????Z?p?aJ:? [EMAIL PROTECTED]" ??????'?_??7':S?<?{Η3?b????1Z?/?c?p??? o????;ʹh??̄????h?>?]?Z??b????Fd??(87ɷ???4?$?ZmP?l?Ri#uѝpO_?kô?V? Я??p?.-t???R?,?)?b?Y*?K??-?$??T
????u??n??UarC??,??t_????

//-----------------------------------------------------
the uncompressed zlib movie header string  using gzuncompress is:
[EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstco&? code?sean emk
hjkedtligudta
namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play

//-----------------------------------------------------
Here is the attempt to use gzuncompress with the movieheader compressed in Livestage: [EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstcoe? code?sean emk
hjkedtligudta
namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play



On Oct 28, 2005, at 2:26 PM, Graham Anderson wrote:

Ok, here we go :)

Isn't looking through  reams of hex data a blast ?
Kind of like a hot poker in the eye ;)

curl  -l -i "http://www.siren.cc/siren/reel/Library/php/zlib.php";

Here are two versions of the SAME  test movie exported from Livestage:
One version has compressed movie headers
The other version has uncompressed movie headers

With zLib, I am using gzcompress at compression level 6, and gzuncompress. All the string data below was converted from hex with the pack() function.
The actual php script I wrote for this test is way way below.

The upshot:
1)Using zlib to compress and decompress a movie header seems to work fine :)

2)Attempting to 'gzuncompress' a movie header that was compressed in Livestage gives an error. I doubt this is fault of Livestage which I assume is simply calling DataCodecCompress or an equivalent function, no ?

3) The Livestage'd compressed movie header output IS NOT THE SAME as a the zLib'd compressed movie header output

Maybe I am not starting at the correct point in the compressed movie header string?
hopefully, this is enough to start a dialog.


here is the output:

//-----------------------------------------------------
The uncompressed movie header string is:
[EMAIL PROTECTED] mdhd??7???7?XXH? hdlrmhlrsprtappl?Sprite Animation Media Handlerminf [EMAIL PROTECTED] 9hdlrdhlralisappl?Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstco&? code?sean emk
hjkedtligudta
namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play

//-----------------------------------------------------
Compressed in Livestage: the compressed movie header string is:
?cmvd?x??S?n1?l?P?H ՂV"[EMAIL PROTECTED] [EMAIL PROTECTED]| ?=??9???[?????o??~4???k??e?soo?C7?
??P???7?&Fs???4?ǻ?
?,?u????gU?K?s?ꬲҋld?f^?&;H????J`Z?PK3#?\?A?? Mͷa???oe8?0%?<??????*J2?3??!?܊Y?;?D??O??7?;޸??;?Vr??C??m?R????? ӂ[Cߢ??o???8a\dK??\?3?r??Z?ߋJ??\HA?????ԯ*Sj?A??*0?F?] 9 c?8×?oZ6f p?;-?hM?? fb?A?!?O?9


//-----------------------------------------------------
The zlib version of the uncompressed movie header using gzcompress at level 6 is: [EMAIL PROTECTED]@??T?U?m?EU??`?HHٰ??!3??̌??I9K?-8E?8??H?s?qb?EG? 4o???=??:?:ϧ??4?ß?/????D??k??>.-?o????[6F?̏K?N?Y?յ??Ѝ??? P???????撡?h?̻#?g\Y??LYWXϊB?,Qt?~XX?Erd?f^??M???J`Y? BKsA2?.ez):=????Z?p?aJ:[EMAIL PROTECTED]" ??????'?_??7':S? <?{Η3?b????1Z?/?c?p???o????;ʹh??̄????h?>?]?Z??b????Fd??(87ɷ???4? $?ZmP?l?Ri#uѝpO_?kô?V?Я??p?.-t???R?,?)?b?Y*?K??-?$??T
????u??n??UarC??,??t_????

//-----------------------------------------------------
the uncompressed zlib movie header string  using gzuncompress is:
[EMAIL PROTECTED] mdhd??7???7?XXH? hdlrmhlrsprtappl?Sprite Animation Media Handlerminf [EMAIL PROTECTED] 9hdlrdhlralisappl?Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstco&? code?sean emk
hjkedtligudta
namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play

//-----------------------------------------------------
Here is the attempt to use gzuncompress with the movieheader compressed in Livestage:
<br />
<b>Warning</b>: gzuncompress(): data error in <b>/home/www/siren/ siren/reel/Library/php/zlib.php</b> on line <b>34</b><br />



Here is the PHP script:
<?php
$uncompressed_movieheader_hex="000003DE6D6F6F760000006C6D7668640000000 0BF883792BF88379200000258000002580001000001000000000000000000000000010 0000000000000000000000000000001000000000000000000000000000040000000000 000000000025800000000000000000000000000000000000000020000030D7472616B0 000005C746B686400000003BF883792BF8837920000000100000000000002580000000 000000000FFFE000000000000000100000000000000000000000000000001000000000 000000000000000000040000000000200000002000000000024656474730000001C656 C737400000000000000010000025800000000000100000000026E6D646961000000206 D64686400000000BF883792BF8837920000025800000258000000480000003F68646C7 2000000006D686C72737072746170706C00000001000101C11E53707269746520416E6 96D6174696F6E204D656469612048616E646C6572000002076D696E6600000020676D6 86400000018676D696E000000000040FFFFFFFFFFFF000000000000003968646C72000 0000064686C72616C69736170706C10000001000101D2184170706C6520416C6961732 0446174612048616E646C65720000002464696E660000001C647265660000000000000 0010000000C616C697300000001000000907374626C0000002C7374736400000000000 000010000001C000000000000000000000001000000007A6C696200000000000000187 3747473000000000000000100000001000002580000001C73747363000000000000000 1000000010000000100000001000000147374737A000000000000021D0000000100000 0147374636F000000000000000100000426000000F2636F64650000000000000000000 00000000000DE7365616E0000000100000009000000000000001A00000065000000010 000000000000000000000000000000000160000006D000000010000000000000000000 1000000180000006B0000000100000000000000000000000A000000150000006800000 001000000000000000001000000150000006A000000010000000000000000000000001 56B65647400000001000000000000000000000000160000006C0000000100000000000 0000000000000001500000069000000010000000000000000010000001800000067000 0000100000000000000000000000400000017756474610000000B6E616D6564726D000 000000000005D7564746100000023A9737772001700004D6164652077697468204C697 66553746167652050726F00000019706C75676D6F7669656E616D653D64726D2E6D6F7 60000000C637479706E6F6E6500000009706C6179000000000000000008";

$compressed_movieheader_hex="000001D0636D7664000003DE789C9553C16E13311 09D6C9050A1481C0809D582562247C415714010A9871CA854A9170E70706267D7C4F6A E6C3751F2051CF9037AE52BAAFE021FD08FE003DACE384E77B31107AC7DF278C6F3DEE CCC2E40F75A97E50200945E141C77B8FCF1EE8200907C09E8003DF5DA39EC9F3FDD5B9 4BFB71280EE136FD91CEDAF7E1E34BBA8F76BA3B965AB736F6FFE43378900180AEE1DE EA950CED7199137E4264673C9D0C834FFC7BB038C111F0BAE2CC575A1ACABAC6755A50 24BA773F5EAACB2D28B6C64A4665E96263B11489B8D99E14A605AF2504B3323995C079 9418E8E4DCDB761C5F2DE6F6538CA30251DC93CDDC8FC198CF0802A4A32971D33DF108 021DF08A4DC8A59A33B874412ED9FCE4FA8E637CE3BDEB893B63BBA567212CF03E7430 FB7B16DFF52E498EEFAEFF10C63EB38C397B56F5A36662070FF3B2DB9684DF4DA09666 2CE41F41D2104EC4F1FE0390D642742D600316FDD7F84E8218AA6BF139DDFDBE4BD397 E3A6D2789A9BD32285FB649A982BC75F501A27FCE3D7D6D8F0DD3825B1D43DFA2FBF56 FB7B4D00738615C644BE98BECB35C8833CF72919D5AEADF8B4A9DE7BA5C4841141F90E 3AD0E3FEFE1D4AF2A531A6AD441A5D82A30DF0110468E5D00000039";


$uncompressed_movieheader_string = pack("H*", $uncompressed_movieheader_hex);

echo '//-----------------------------------------------------'."\n\r";
echo "The uncompressed movie header string is:". "\r\n";
echo $uncompressed_movieheader_string."\r\n\r\n";


$compressed_hexstring = pack("H*", $compressed_movieheader_hex);
echo '//-----------------------------------------------------'."\n\r";
echo "Compressed in Livestage: the compressed movie header string is:"."\r\n";
echo $compressed_hexstring."\r\n\r\n";


$compressed_zlib_movieheader_string = gzcompress ($uncompressed_movieheader_string, 6);
echo '//-----------------------------------------------------'."\n\r";
echo "The zlib version of the uncompressed movie header using gzcompress at level 6 is: "."\r\n";
echo $compressed_zlib_movieheader_string."\r\n\r\n";


$decompressed_zlib_movieheader_string= gzuncompress ($compressed_zlib_movieheader_string);
echo '//-----------------------------------------------------'."\n\r";
echo "the uncompressed zlib movie header string using gzuncompress is: "."\r\n";
echo $decompressed_zlib_movieheader_string."\r\n\r\n";


echo '//-----------------------------------------------------'."\n\r";
echo "Here is the attempt to use gzuncompress with the movieheader compressed in Livestage: "."\r\n"; $decompressLSCompressedMovieHeader= gzuncompress ($compressed_hexstring);
echo $decompressLSCompressedMovieHeader."\r\n\r\n";


?>



On Oct 28, 2005, at 12:17 PM, Graham Anderson wrote:


will do ...
and report back....

g


On Oct 28, 2005, at 8:20 AM, Steve Israelson wrote:



Write a program.
Take a buffer of test data.
Compress it using the data compressor and the zlib component.
Save that data.
Compare it to the same data compressed using YOUR zlib, or try to decompress it.
That should help clarify things.


On 28-Oct-05, at 8:07 AM, Graham Anderson wrote:




Well, after sleeping on this,
I need the zlib Library on my server to correctly decompress a QT zlib'd movie header


If I have to process a movie with a compressed movie header, I'm screwed :(

So, what's the deal with zlib and QT ?







_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/grahama% 40siren.cc

This email sent to [EMAIL PROTECTED]



_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/grahama% 40siren.cc

This email sent to [EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
DOH!
OK, I was starting at the wrong place in the hex....
I misread the QTFF docs which include two more atoms on the NEXT page:

Four-character code           Atom type
'cmvd'                                    Compressed movie data
Uncompressed size            32-bit integer


The correct output is now:
//-----------------------------------------------------
The uncompressed movie header string is:
[EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstco&? code?sean emk
hjkedtligudta
namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play

//-----------------------------------------------------
Compressed in Livestage: the compressed movie header string is:
x??S?n1?l?P?H ՂV"[EMAIL PROTECTED]@? Z???^w?????| ?=??9???[?????o??~4???k??e?soo?C7?
??P???7?&Fs???4?ǻ?
?,?u????gU?K?s?ꬲҋld?f^?&;H????J`Z?PK3#?\?A?? Mͷa???oe8?0%?<??????*J2?3??!?܊Y?;?D??O??7?;޸??;?Vr??C??m?R????? ӂ[Cߢ??o???8a\dK??\?3?r??Z?ߋJ??\HA?????ԯ*Sj?A??*0? F?] c?8×?oZ6f p?;-?hM?? fb?A?!?O?9

//-----------------------------------------------------
The zlib version of the uncompressed movie header using gzcompress at level 6 is: [EMAIL PROTECTED]@??T?U?m?EU??`?HHٰ??!3??̌??I9K?-8E?8??H?s?qb?EG? 4o???=??:?:ϧ??4?ß?/????D??k??>.-?o????[6F?̏K?N?Y?յ??Ѝ???P??????? 撡?h?̻#?g\Y??LYWXϊB?,Qt?~XX?Erd?f^??M???J`Y?BKsA2?.ez):=????Z?p?aJ:? [EMAIL PROTECTED]" ??????'?_??7':S?<?{Η3?b????1Z?/?c?p??? o????;ʹh??̄????h?>?]?Z??b????Fd??(87ɷ???4?$?ZmP?l?Ri#uѝpO_?kô?V? Я??p?.-t???R?,?)?b?Y*?K??-?$??T
????u??n??UarC??,??t_????

//-----------------------------------------------------
the uncompressed zlib movie header string  using gzuncompress is:
[EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstco&? code?sean emk
hjkedtligudta
namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play

//-----------------------------------------------------
Here is the attempt to use gzuncompress with the movieheader compressed in Livestage: [EMAIL PROTECTED] mdhd??7???7?XXH?hdlrmhlrsprtappl? Sprite Animation Media Handlerminf [EMAIL PROTECTED] Apple Alias Data Handler$dinfdref alis?stbl,stsdzlibsttsXstscstszstcoe? code?sean emk
hjkedtligudta
namedrm]udta#?swrMade with LiveStage Proplugmoviename=drm.mov ctypnone play
--- End Message ---
--- Begin Message ---
I'm trying to figure out if PHP has the facility to reference containing, 
non-parent objects. I have three classes, embedded hierarchically, but which 
are NOT extended classes of their containing objects. I'd like to be able to 
reference variables in the higher-level objects from the lower-level objects.

To illustrate:

<?php

class Country {
        var $name;
        var $states;
        
        function Country($name = '', $states = array()) {
                $this->name = $name;
                $this->states = $states;
        }
}

class State {
        var $name;
        var $cities;
        
        function State($name = '', $cities = array()) {
                $this->name = $name;
                $this->cities = $cities;
        }
}

class City {
        var $name;
        
        fuction City($name = '') {
                $this->name = '';
        }
        
        function name_with_state() {
                return "$this->name, " . /* parent node reference */->name;
        }
}

$countries = array (
        'USA' => new Country('United States',
                array (
                        'WA' => new State('Washington',
                                array (
                                        'SEA' => new City('Seattle'),
                                        'GEG' => new City('Spokane')
                                )
                        ),
                        'CA' => new State('California',
                                array (
                                        'LAX' => new City('Los Angeles'),
                                        'SFO' => new City('San Francisco')
                                )
                        )
                )
        )
);

echo $countries['USA']->states['WA']->cities['SEA']->name_with_state();
// Output: 'Seattle, Washington'

?>

Obviously, just extending Country doesn't make sense: a State isn't a type of 
Country, and a City isn't a type of State -- but States are part of Countries, 
and Cities are part of States. Plus, if City was just an extended State (which 
in turn is an extended Country), it would contain both a $states and a $cities 
variable. Which doesn't make sense.

What, if anything, do I replace /* parent node reference */ with in 
City::name_with_state()?

Thanks,

Morgan

--- End Message ---
--- Begin Message ---
Oliver Grätz wrote:
Shaun schrieb:

$qid = mysql_query('INSERT INTO MYTABLE (
                               column1,
                               column2,
                              ) VALUES (
                               "'.$value1.'",
                               "'.$value2.'"
                              )');


A bit off-topic but important: Always make sure that you check the
contents of $value1 and $value2 before putting them into the query!
With

$value1 = 'xyz","xyz"); DELETE FROM MYTABLE;';

you might get surprising results!

This is called SQL injection and it's important to escape all the values
before putting them into the statement.


Did you try that? This doesn't work on my machine:

mysql_query("DELETE FROM mytable; DELETE FROM mytable;");

ie, mysql extension won't let me do more than one statement at a time.

--

   Open source PHP code generator for DB operations
   http://sourceforge.net/projects/bfrcg/

--- End Message ---

Reply via email to