php-general Digest 15 May 2008 21:26:39 -0000 Issue 5461

Topics (messages 274359 through 274394):

the class as a namespace
        274359 by: Iv Ray
        274364 by: Iv Ray

Re: SCanning text of PDF documents
        274360 by: Frank Arensmeier
        274366 by: Eric Butera

Re: Using SVN w/ Zend Studio for Eclipse
        274361 by: Iv Ray

Re: Can I install a newer version of php over an older version
        274362 by: Iv Ray
        274388 by: Brady Mitchell

Working with internal data formats
        274363 by: John Gunther
        274373 by: Iv Ray
        274377 by: John Gunther
        274378 by: Robert Cummings
        274379 by: Iv Ray
        274380 by: Robin Vickery

Re: Good HTML parser needed
        274365 by: Eric Butera
        274370 by: Andrew Ballard

Re: Variable Scope from child to parent
        274367 by: Andrew Ballard

Re: how do I stop Firefox doing a conditional get?
        274368 by: Al
        274369 by: Robin Vickery
        274375 by: Per Jessen
        274383 by: Al
        274387 by: Per Jessen

Re: Scripts slowing down?
        274371 by: René Leboeuf
        274376 by: Per Jessen

Re: Validating Form input
        274372 by: tedd

Re: Tracking down the elusive "expecting T_PAAMAYIM_NEKUDOTAYIM"
        274374 by: Daniel Brown

Flush file contents
        274381 by: Mário Gamito
        274384 by: Andrew Ballard

My open source php CMS
        274382 by: Dmitri
        274386 by: admin.buskirkgraphics.com

RE:Windows Service Call from linux php server
        274385 by: admin.buskirkgraphics.com

changing order of items
        274389 by: afan pasalic
        274390 by: Iv Ray
        274391 by: afan pasalic
        274392 by: Eric Butera
        274393 by: afan pasalic
        274394 by: robert

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 ---
Is there a notion of the class as a namespace?

My understanding is that the namespaces are intended to help organize the classes in large projects (and are not perfect).

Is it considered good style to use a class simply to box related functions?

For instance, a class called "files", contains functions I need for dealing with files - and the instantiated object is _simply_ used to access these functions - the instantiated object is not a file in itself. Thus what I do is not $INSTANTIATED_OBJECT->save(), but $INSTANTIATED_OBJECT->save($file) (though I could do the first if I first, say, do $INSTANTIATED_OBJECT->file = $file.

Accessing the functions using the scope resolution operator (::) avoids the need to instantiate an object, but does not allow the use of $this, and $this can be quite practical in order to group common logic into shared methods within the class and thus make the other methods smaller in terms of code (of course, one could use file::save, file::delete instead of $this->save and $this->delete, but it makes renaming objects more difficult).

I would be interested to hear opinions.

Iv

--- End Message ---
--- Begin Message ---
Richard Heyes wrote:
> That's a common use of static classes. Eg:
>
> HTTP::Redirect($url);
>
> In fact this (from the article I've read) is exactly how namespaces will
> look like. So in the above example, HTTP could be either a namespace or
> a class.

Right. Namespaces do look similar. And PEAR employs similarly looking
packages naming convention.

So it seems the static classes (which are actually simply classes with
static methods/properties, right) are the best "namespaces like" way,
until the namespaces arrive.

Thanks for your note,
Iv

--- End Message ---
--- Begin Message --- A reliable solution depends partly on the pdf document itself. Consider if your pdf document contains roted text or text that spans about several different blocks/pages. My experience with ps2acsii and other ghostscript related tools is that sometimes it works quite well, sometimes the output is rather messy.

The most reliable way of extracting text from a pdf is (I think) a product called PDF TET from PDFlib Gmbh. Yes, it costs some money for a license, but you are able to get almost everything out of the pdf then.

http://www.pdflib.com/products/tet/

Maybe some magic with OpenOffice could do the trick as well?

//frank

15 maj 2008 kl. 10.19 skrev Angelo Zanetti:

Hi All.

This is a quick question.

A client of ours wants a solution that when a PDF document is uploaded that
we use PHP to scan the documents contents and save it in a DB.

I know you can do this with normal text documents using the file commands
and functions.

Is it possible with PDF documents?

My feeling is NO, but perhaps someone will prove me wrong.

Thanks in advance.

Angelo

Web: http://www.elemental.co.za



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





Frank Arensmeier
........................................................................ ........................
Webmaster & IT Development

NIKE Hydraulics AB
Box 1107
631 80 Eskilstuna
Sweden

phone +46 - (0)16 16 82 34
fax +46 - (0)16 13 93 16
[EMAIL PROTECTED]
www.nikehydraulics.se
........................................................................ ........................




--- End Message ---
--- Begin Message ---
On Thu, May 15, 2008 at 4:19 AM, Angelo Zanetti <[EMAIL PROTECTED]> wrote:
> Hi All.
>
> This is a quick question.
>
> A client of ours wants a solution that when a PDF document is uploaded that
> we use PHP to scan the documents contents and save it in a DB.
>
> I know you can do this with normal text documents using the file commands
> and functions.
>
> Is it possible with PDF documents?
>
> My feeling is NO, but perhaps someone will prove me wrong.
>
> Thanks in advance.
>
> Angelo
>
> Web: http://www.elemental.co.za
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

You might want to look at Zend_Pdf.

--- End Message ---
--- Begin Message ---
> I do not want to copy the project into a new
> directory as the existing directory is where Apache's DocumentRoot is
> set. And although that's simple to change, I really don't think any
> IDE should mandate where I set my project's directory on the
> filesystem.

I use PDT, and there is no problem to import a project from its current location.

It might take you a while to exactly figure out how to do it, Eclipse is a bit organic in respect to the organization and working of the menus.

> Also, if I try to create a new project from an SVN
> Repository, it doesn't allow me to select what directory I want the
> code checked out in.

This works very well with PDT and Subclipse.

> Otherwise I'd just cringe and let it overwrite
> what's in my existing document root, since that's all versioned code
> anyhow.

If your current document root is a checked out svn project, PDT/Subclipse will "see" this, no need to overwrite anything.

> If any of you have run into similar frustrations, I'd love to hear it.
> So far I've spent the better part of the evening fiddling with
> extremely rudimentary features which no IDE in any programming
> environment I've ever worked with has imposed on me. Perhaps this
> thing isn't ready for mainstream yet, or perhaps I'm missing something
> obvious.

Again, I work with PDT/Subclipse.

Eclipse is simply too organic compared to what you are used to. Just relax and give it a try and you'll love it.

Iv

--- End Message ---
--- Begin Message ---
Tony M wrote:
> Can I install a newer version of php over an older version?

Perhaps what you need is this -

"Upgrading PHP with the Install

To upgrade, run the installer either graphically or from the command line as normal. The installer will read your current install options, remove your old installation, and reinstall PHP with the same options as before. It is recommended that you use this method of keeping PHP updated instead of manually replacing the files in the installation directory."

You can read it here -

http://at.php.net/install.windows

Iv

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

On May 14, 2008, at 854PM, Tony M wrote:

Can I install a newer version of php over an older version ?

I am new to php and am in the process of installing it and reading various tutorials.

I always suggest using XAMPP (http://xampp.org) or a similar package that will install MySQL, PHP and Apache all for you in one bundle on development machines. It's much faster, easier to manage and it just works!

That said, I don't advocate using XAMPP on a production server. For a production server it's worth taking the time to install each individually so you know exactly how each one is configured.

Brady

--- End Message ---
--- Begin Message --- What technique can I use to take an 8-byte double precision value, as stored internally, and assign its value to a PHP float variable without having the bytes misinterpreted as a character string.
--- End Message ---
--- Begin Message ---
John Gunther wrote:
> What technique can I use to take an 8-byte double precision value, as
> stored internally, and assign its value to a PHP float variable without
> having the bytes misinterpreted as a character string.

Does it get misinterpreted, or do you just want to be sure?

The documentation says -

"Some references to the type "double" may remain in the manual. Consider double the same as float; the two names exist only for historic reasons."

Does this cover your case?

Iv

--- End Message ---
--- Begin Message ---
Iv Ray wrote:
John Gunther wrote:
 > What technique can I use to take an 8-byte double precision value, as
 > stored internally, and assign its value to a PHP float variable without
 > having the bytes misinterpreted as a character string.

Does it get misinterpreted, or do you just want to be sure?

The documentation says -

"Some references to the type "double" may remain in the manual. Consider double the same as float; the two names exist only for historic reasons."

Does this cover your case?

Iv
No.

Example: I extract the 8 bytes 40 58 FF 5C 28 F5 C2 8F from an external file, which is the internal double precision float representation of the decimal value 99.99. Starting with that byte string, how can I create a PHP variable whose value is 99.99?
--- End Message ---
--- Begin Message ---
On Thu, 2008-05-15 at 10:33 -0400, John Gunther wrote:
> Iv Ray wrote:
> > John Gunther wrote:
> >  > What technique can I use to take an 8-byte double precision value, as
> >  > stored internally, and assign its value to a PHP float variable without
> >  > having the bytes misinterpreted as a character string.
> > 
> > Does it get misinterpreted, or do you just want to be sure?
> > 
> > The documentation says -
> > 
> > "Some references to the type "double" may remain in the manual. Consider 
> > double the same as float; the two names exist only for historic reasons."
> > 
> > Does this cover your case?
> > 
> > Iv
> No.
> 
> Example: I extract the 8 bytes 40 58 FF 5C 28 F5 C2 8F from an external 
> file, which is the internal double precision float representation of the 
> decimal value 99.99. Starting with that byte string, how can I create a 
> PHP variable whose value is 99.99?

http://www.php.net/manual/en/function.unpack.php

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
John Gunther wrote:
> Example: I extract the 8 bytes 40 58 FF 5C 28 F5 C2 8F from
> an external file

You mean you "extract" "40 58 FF 5C 28 F5 C2 8F", so to speak, as a string, right?

Sorry, for asking, but somehow I do not the case.

--

--- End Message ---
--- Begin Message ---
On 15/05/2008, John Gunther <[EMAIL PROTECTED]> wrote:
> Iv Ray wrote:
>
> > John Gunther wrote:
> >  > What technique can I use to take an 8-byte double precision value, as
> >  > stored internally, and assign its value to a PHP float variable without
> >  > having the bytes misinterpreted as a character string.
> >
> > Does it get misinterpreted, or do you just want to be sure?
> >
> > The documentation says -
> >
> > "Some references to the type "double" may remain in the manual. Consider
> double the same as float; the two names exist only for historic reasons."
> >
> > Does this cover your case?
> >
> > Iv
> >
>  No.
>
>  Example: I extract the 8 bytes 40 58 FF 5C 28 F5 C2 8F from an external
> file, which is the internal double precision float representation of the
> decimal value 99.99. Starting with that byte string, how can I create a PHP
> variable whose value is 99.99?

Reversing the order of bytes then using unpack('d') works for me.

<?php
$bytes = pack('H*', '4058FF5C28F5C28F');

$output = unpack('d', strrev($bytes));
print array_shift($output) . "\n";
// 99.99
?>

--- End Message ---
--- Begin Message ---
On Wed, May 14, 2008 at 10:56 PM, Yi Wang <[EMAIL PROTECTED]> wrote:
> Can anyone provide some code that can't be stripped by strip_tags?
>
>
> On 5/15/08, Eric Butera <[EMAIL PROTECTED]> wrote:
>> On Wed, May 14, 2008 at 11:38 AM, Robert Cummings <[EMAIL PROTECTED]> wrote:
>>  >
>>  >
>>  >  On Wed, 2008-05-14 at 11:18 -0400, Eric Butera wrote:
>>  >  > On Tue, May 13, 2008 at 4:07 AM, James Dempster <[EMAIL PROTECTED]> 
>> wrote:
>>  >  > > http://htmlpurifier.org/
>>  >  > >
>>  >  > >  --
>>  >  > >  /James
>>  >  > >
>>  >  >
>>  >  > This is the only real solution.
>>  >
>>  >  That depends... if I'm the webmaster and I want to input arbitrary HTML,
>>  >  then htmlpurifier is unnecessary.
>>  >
>>  >
>>  >
>>  >  Cheers,
>>  >  Rob.
>>  >  --
>>  >  http://www.interjinn.com
>>  >  Application and Templating Framework for PHP
>>  >
>>  >
>>
>>
>> OP said "users."  Strip tags doesn't bother with tag attributes so
>>  that is a security hole.  Any regex type solution will encounter the
>>  same set of issues.
>>
>>  Htmlpurifier actually strips down and re-builds your html from the
>>  ground against a nice whitelist filtering system that you can
>>  customize to your needs.  No nasty tags/attributes will get through
>>  unless you want them to.
>>
>>
>>  --
>>  PHP General Mailing List (http://www.php.net/)
>>  To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> Regards,
> Wang Yi
>

I meant if you used the allow tags parameter.  If you allow say the
<b> tag, then you could say <b key="value"> and it would pass right
through.

<?php

$str = "<b>hi</b><b onMouseOver='alert(/xss/);'>xss</b>";

echo "raw:\n";
var_dump($str);

echo "strip tags:\n";
var_dump(strip_tags($str));

echo "allow b:\n";
var_dump(strip_tags($str, '<b>'));
?>

raw:
string '<b>hi</b><b onMouseOver='alert(/xss/);'>xss</b>' (length=47)
strip tags:
string 'hixss' (length=5)
allow b:
string '<b>hi</b><b onMouseOver='alert(/xss/);'>xss</b>' (length=47)

--- End Message ---
--- Begin Message ---
On Tue, May 13, 2008 at 6:06 AM, Per Jessen <[EMAIL PROTECTED]> wrote:
> Shelley wrote:
>
>> I want to know whether there are some good HTML parsers written in
>> PHP.
>>
>> That is,
>> the parser checks whether html tags like table, tr, td, div, dt, dl,
>> dd, script, ul, li, span, h1, h2, etc. are nested correctly.
>> If any tags not matched, just remove them.
>
> Except for the last part, any XML parser will do.  Sablotron, xalan,
> libxsl etc.
>
>
> /Per Jessen, Zürich

... except when the HTML is not well formed XML, as I find is often
the case when accepting input from users. That "last part," as you
say, is kind of essential. It could be as simple as tags that don't
close in HTML (e.g. <img>, <br>, <hr>) or it could be something much
trickier to clean up such as mismatched tags, improper nesting,
missing closing tags (since some browsers are too forgiving of not
closing <td>, <li> or <option>), HTML entities that are not valid in
XML, etc. In these cases, the DOM-type parsers will usually choke. You
might be able to salvage something with the stream-based parsers like
SAX. (I've never tried it.)

Andrew

--- End Message ---
--- Begin Message ---
Ok, I forgot to reply-all to the list. Here we go again.

On Wed, May 14, 2008 at 6:33 PM, Tyson Vanover <[EMAIL PROTECTED]> wrote:
> I am trying to get a child class to pass an array of valid keys to it's
> parent when the constructor is run, and the parent appends the data to one
>> of it's array of valid keys.  Then it walks through an array pulling out
> values that have valid keys, and putting them in an array for processing
> later.  I have tried explicitly stating the variable scope.
>
> abstract class parentclass
> {
>  protected $vkeys= array('title1','title2','title3');
>  protected $a;
>
>  function __construct($set = NULL, $special = NULL)
>  {
>    self::$this->vkeys= array_merge(self::$this->vkeys, $special);
>    foreach($set as $key=>$value)
>    {
>      if (in_array($key,self::$this->vkeys))
>      {
>        $this->a[$key] = $value;
>      }
>    }
>    print_r(self::$this->vkeys);  //output below
>    print_r(self::$this->a);  //output below
>  }
> }
>
> class childclass extends parentclass
> {
>  protected $vkeys= array('titleA', 'titleB', 'TitleC');
>
>  function __construct($set, $special = NULL)
>  {
>    parent::__construct($set, self::$this->vkeys);
>    unset(self::$this->vkeys);
>  }
> }
>
> Unfortunately it seems to duplicate the child's array instead of appending.
>  Explicitly stating scope does not seem to help.
>
>
> print_r(self::$this->vkeys);
> Array (
>  [0] => titleA
>  [1] => titleB
>  [2] => titleB
>  [3] => titleA
>  [4] => titleB
>  [5] => titleB
> )
>
> print_r(self::$this->a);
> Array()
>
> Any thoughts?

A couple. First, as Gabriel said, replace self::$this-> with just
$this->. Second, the protected variable $vkeys in the childclass
effectively overwrites the variable of the same name in the parent
class, so it already has the values you are trying to merge
(array('titleA', 'titleB', 'TitleC')) when the childclass is
instantiated before you even call the constructor. That's why the
constructor duplicates the values. Try this  for the constructor for
your childclass:

    function __construct($set, $special = array())
    {
        $merged = array_merge($special, array('titleA', 'titleB', 'TitleC'));
        parent::__construct($set, $merged);
    }



Andrew
>

--- End Message ---
--- Begin Message ---
Make certain your steam is compressed http://www.whatsmyip.org/mod_gzip_test/



Per Jessen wrote:
Robin Vickery wrote:

2008/5/14 Per Jessen <[EMAIL PROTECTED]>:
 The issue is - I'd like this page to appear to be as "real time" as
 possible, and the occasional delay caused by the conditional get is
 a nuisance.  My images are clearly cached, so how do I prevent
 Firefox from doing the conditional get ?  There must be some HTTP
 header I  can use.
You can use either or both of 'Expires' or  'Cache-Control'

I've just now added 'Cache-Control' - I was already using 'Expires', but
that wasn't sufficient.  Thanks.


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
On 15/05/2008, Al <[EMAIL PROTECTED]> wrote:
> Make certain your steam is compressed
> http://www.whatsmyip.org/mod_gzip_test/

Compressed steam can be dangerous:

http://en.wikipedia.org/wiki/2007_New_York_City_steam_explosion

-robin

--- End Message ---
--- Begin Message ---
Al wrote:

> Make certain your steam is compressed
> http://www.whatsmyip.org/mod_gzip_test/
> 

The files I was having the problem with are GIFs, so already LZW
compressed. 


/Per Jessen, Zürich


--- End Message ---
--- Begin Message --- Try by not LZW compressing and the use ob_start() and flush() so your files are gzip compressed. I don't know if Firefox knows how to readily handle LZW on the fly. It does know how to handle gzip.

Per Jessen wrote:
Al wrote:

Make certain your steam is compressed
http://www.whatsmyip.org/mod_gzip_test/


The files I was having the problem with are GIFs, so already LZW
compressed.

/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Al wrote:

> Per Jessen wrote:
>> Al wrote:
>> 
>>> Make certain your steam is compressed
>>> http://www.whatsmyip.org/mod_gzip_test/
>>>
>> 
>> The files I was having the problem with are GIFs, so already LZW
>> compressed.
>> 
> Try by not LZW compressing and the use ob_start() and flush() so your
> files are gzip compressed. I don't know if Firefox knows how to
> readily handle LZW on the fly. It does know how to handle gzip.

Al, thanks for suggestion, but you're talking rubbish.  _All_ browsers
understand GIFs, and they are all LZW compressed.  There's absolutely
zero point in trying to gzip them as well. 


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Per Jessen a écrit :
René Leboeuf wrote:

The user sending emails is "trusted" by sendmail, and the sending
program is located on the sendmail machine.


No need to use SMTP then.  You should just be calling sendmail to drop
the emails into the queue. And that should not be slowing down.

According to our tests, using SMTP is twice as fast as calling sendmail!



Mail is sent via PHPMailer. PHPMailer offers to send mail via PHP's
mail() function, or by calling the sendmail program or using SMTP.
SMTP may use persistent connections or not. All these modes were
tested and they all slow down after a while.

They _all_ slow down after a while?  How many emails are you sending in
this way?

Some of our mailing are +100.000 emails...



It's easily tested.  Just generate a script with 10000 calls to the
mail() function (send to [EMAIL PROTECTED] with NNNNN = random
number).  If that goes through without slowing down, mail() and your
sendmail daemon are not to blame.

I had tried with 1000mails and noticed no slow down. I'll try with some more.

But if mail() and sendmail are not the problem, what could it be???

Thanks for helping.

DJL


--- End Message ---
--- Begin Message ---
René Leboeuf wrote:

> Per Jessen a écrit :
>> René Leboeuf wrote:
>> 
>>> The user sending emails is "trusted" by sendmail, and the sending
>>> program is located on the sendmail machine.
>>>
>> 
>> No need to use SMTP then.  You should just be calling sendmail to
>> drop
>> the emails into the queue.  And that should not be slowing down.
> 
> According to our tests, using SMTP is twice as fast as calling
> sendmail!

Really ??  That's very unusual as all sendmail does is file your email
into a disk-based queue, so using SMTP is only superfluous overhead. 
Anyway, if it works for you, it's not important.  

>>> Mail is sent via PHPMailer. PHPMailer offers to send mail via PHP's
>>> mail() function, or by calling the sendmail program or using SMTP.
>>> SMTP may use persistent connections or not. All these modes were
>>> tested and they all slow down after a while.
>> 
>> They _all_ slow down after a while?  How many emails are you sending
>> in this way?
> 
> Some of our mailing are +100.000 emails...

There is a possibility that your filesystem is having difficulties
dealing with that many files, escpecially if they are all in one
directory.  Which mailserver and which filesystem are you using? 


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
At 9:48 PM -0500 5/14/08, Chris W wrote:
I was wondering what others think of my approach to form validation. I know many use Java script to do various validation. However, since there is no way to be sure the data sent to the server is actually valid, you have to check it in your php code on the server anyway. Granted you don't have to, but if you don't, you are just asking for someone to hack your system, or at the very least screw up your data. So my question is since you have to do a validity check on the server, why bother with the Java script? The only advantage I can see to doing it with Java script is it will cut down on the errors in data that get to the server and then in turn reduce the number for resubmits and keep traffic down a little. However since none of the projects I have worked on are very high traffic sites, that hasn't been much of a concern.

Any thoughts?

Use javascript to enhance the user experience, but always validate server-side.

If you are clever, you can tie the two together via ajax and present a nice data collection scheme that is both user-friendly and secure.

Cheers,

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

--- End Message ---
--- Begin Message ---
    Since I keep getting off-list and on-list replies, apparently not
everyone reads the threads as they should.  As you'll see from the
message below, I'm aware that it's in all languages.  It was meant
jokingly, but I forgot to type in the smiley face.

    Otherwise, thanks (to the eleven or so of you) who responded.  ;-P

---------- Forwarded message ----------
From: Daniel Brown <[EMAIL PROTECTED]>
Date: Wed, May 14, 2008 at 5:05 PM
Subject: Re: [PHP] Tracking down the elusive "expecting T_PAAMAYIM_NEKUDOTAYIM"
To: mike <[EMAIL PROTECTED]>
Cc: Tyson Vanover <[EMAIL PROTECTED]>, [EMAIL PROTECTED]


On Wed, May 14, 2008 at 4:51 PM, mike <[EMAIL PROTECTED]> wrote:
> I've got that before and I am not using a Hebrew version of PHP :)

   Yeah, just a joke.  I forgot to put the Trademark ;-P in its place.

   The etymology of that message could be attributed to the fact that
Zeev and Andi are Israeli.  Just taking a guess at it though.

-- 
</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.

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

How do I open a file and flush all it's contents to insert new ones and close again ?

I've browsed through the fopen function aguments and didn't find one that do this (or I misunderstood one of them).

Any help would be appreciated.

Warm Regards,
Mário Gamito

--- End Message ---
--- Begin Message ---
On Thu, May 15, 2008 at 11:20 AM, Mário Gamito <[EMAIL PROTECTED]> wrote:
> Hi,
>
> How do I open a file and flush all it's contents to insert new ones and
> close again ?
>
> I've browsed through the fopen function aguments and didn't find one that do
> this (or I misunderstood one of them).
>
> Any help would be appreciated.
>
> Warm Regards,
> Mário Gamito
>

That's what the mode parameter is for. You want "w".

http://www.php.net/manual/en/function.fopen.php

Andrew

--- End Message ---
--- Begin Message --- Hello, first of all, sorry for this plug, I am looking for interested developers. I just want to let you know about my open source project that uses over 15 pear classes and uses pear installer as the primary means to install it I also wrote a web-based interface for using pear installer to install upgrades and modules

I created some flash-based demos on how to install it.

I really hope to find some interested developers to join this project. It became too big for me.

Please at least look at it, watch the demos:

http://dev.sharedlog.com/index.php?a=personal&uid=1002

I will be adding more demos on how to use other feature.

The anonymous svn is here for anyone who is interested.
http://dev.sharedlog.com/svn/

Is there a better more appropriate list to announce such project?

--

Open Source ALL content management
with streaming video
http://wiki.sharedlog.com



--- End Message ---
--- Begin Message ---
Page Not Found.....





Hello, first of all, sorry for this plug, I am looking for interested 
developers.
I just want to let you know about my open source project that uses over 
15 pear classes and uses pear installer as the primary means to install it
I also wrote a web-based interface for using pear installer to install 
upgrades and modules

I created some flash-based demos on how to install it.

I really hope to find some interested developers to join this project. 
It became too big for me.

Please at least look at it, watch the demos:

http://dev.sharedlog.com/index.php?a=personal&uid=1002

I will be adding more demos on how to use other feature.

The anonymous svn is here for anyone who is interested.
http://dev.sharedlog.com/svn/

Is there a better more appropriate list to announce such project?

-- 

Open Source ALL content management
with streaming video
http://wiki.sharedlog.com



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

--- End Message ---
--- Begin Message ---
I used soap to perfect the Windows service call and resolved the issue so 
simple it kills me. Not happy with the huge upgrade of php process but happy 
with final results.

Resolution:
<?php
$wsdl= "http://user:[EMAIL PROTECTED]/WebService/service.asmx?WSDL";
$soap = new soapclient($wsdl,"wsdl");
$soap->setCredentials("user","password");
$proxy = $soap->getProxy();
$parameters = 
array(Username=>"",Password=>"",caltalk=>"",canum=>"",audio=>"",STime=>"",Email=>"");
$result = $proxy->makeCall($parameters); 
?>

I have one more question if you have time?

I have been requested to give a live results query. I need to not only pull 
results from mysql using php, but I have to display the results like a cicso 
Switch. 

I have to display channels in use realtime. Without refreshing the page a 
gazillion times, is there another method of constantly pulling the data from 
mysql and displaying it in the php script for realtime switch status? 

I looked into AJAX but it seems to pull all the data up into a global of static 
data it does not refresh or regrab every so many seconds, so the display is not 
realtime. 

I do not know that Ajax has this ability does it?
 
Is there a way to refresh the mysql pull in php I am unaware of?

--- End Message ---
--- Begin Message ---
this one bugs me for a while. how to change order.

I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
status value stored in mysql. I can list tasks per status or all.
order number is stored in mysql too.
the easiest way to change order is to have form for each task where you
will enter manually number and then submit (one submit button for whole
form). but, if you change order number for any task you have to change
then all order numbers "below" the task manually

solution with "arrows" (or up/down buttons) where you click on arrow and
the task switch the place with its "neighbor" is easy and fancy. Though,
I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
to 0 and I have to move task 14 to place 6. I have to click first 4
times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
actually happening on screen (of course) before start switching places
with 9, 8, 7, and 6.

how do you avoid this "gap"?
what solution do you use at all?

thanks for any help.

-afan


--- End Message ---
--- Begin Message ---
afan pasalic wrote:
this one bugs me for a while. how to change order.

I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
status value stored in mysql. I can list tasks per status or all.
order number is stored in mysql too.
the easiest way to change order is to have form for each task where you
will enter manually number and then submit (one submit button for whole
form). but, if you change order number for any task you have to change
then all order numbers "below" the task manually

solution with "arrows" (or up/down buttons) where you click on arrow and
the task switch the place with its "neighbor" is easy and fancy. Though,
I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
to 0 and I have to move task 14 to place 6. I have to click first 4
times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
actually happening on screen (of course) before start switching places
with 9, 8, 7, and 6.

how do you avoid this "gap"?
what solution do you use at all?

You have two different issues - a) how to execute the change, and b) what interface to provide.

To execute the change, basically you have to reorder. The best algorithm is question of mathematics - you can implement "something" and improve it independently from the interface.

As for the interface, the first is kind of the simplest, but somehow primitive. The second is a bit better, but you have noticed, not much better. The most elegant, considering the time we live in, would be drag & drop AJAX (here - http://tool-man.org/examples/, there are excellent examples, perhaps there are more).

It's also a question if tasks really need to be reordered manually. If all tasks have a deadline, you might sort them by date. If some don't, you can provide them unsorted, until they get one. Sorting tasks by moving them up/down works when you have 25 tasks, but it does not work when you have 50, 100, 1 000 (if you are a team leader and have 5-7 people team) - in that case sort by date might be better.

If you get more advanced, and store time needed to complete a task, you could automatically shift all tasks (of a person) - when one gets delayed or takes longer, than planned.

Hope that helps,
Iv

--

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

Iv Ray wrote:
> afan pasalic wrote:
>> this one bugs me for a while. how to change order.
>>
>> I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
>> status value stored in mysql. I can list tasks per status or all.
>> order number is stored in mysql too.
>> the easiest way to change order is to have form for each task where you
>> will enter manually number and then submit (one submit button for whole
>> form). but, if you change order number for any task you have to change
>> then all order numbers "below" the task manually
>>
>> solution with "arrows" (or up/down buttons) where you click on arrow and
>> the task switch the place with its "neighbor" is easy and fancy. Though,
>> I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
>> to 0 and I have to move task 14 to place 6. I have to click first 4
>> times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
>> actually happening on screen (of course) before start switching places
>> with 9, 8, 7, and 6.
>>
>> how do you avoid this "gap"?
>> what solution do you use at all?
>
> You have two different issues - a) how to execute the change, and b)
> what interface to provide.
>
> To execute the change, basically you have to reorder. The best
> algorithm is question of mathematics - you can implement "something"
> and improve it independently from the interface.
>
> As for the interface, the first is kind of the simplest, but somehow
> primitive. The second is a bit better, but you have noticed, not much
> better. The most elegant, considering the time we live in, would be
> drag & drop AJAX (here - http://tool-man.org/examples/, there are
> excellent examples, perhaps there are more).
>
> It's also a question if tasks really need to be reordered manually. If
> all tasks have a deadline, you might sort them by date. If some don't,
> you can provide them unsorted, until they get one. Sorting tasks by
> moving them up/down works when you have 25 tasks, but it does not work
> when you have 50, 100, 1 000 (if you are a team leader and have 5-7
> people team) - in that case sort by date might be better.
>
> If you get more advanced, and store time needed to complete a task,
> you could automatically shift all tasks (of a person) - when one gets
> delayed or takes longer, than planned.
>
> Hope that helps,
> Iv

thanks Iv,
though, in my case, the task list will never be more then 25 and we can
talk about "small" list.
and, I need to sort them by order_no (bitter to say "priority_no")

thanks for link. the Dag & Drop sortable list is really cool!


--- End Message ---
--- Begin Message ---
On Thu, May 15, 2008 at 2:49 PM, afan pasalic <[EMAIL PROTECTED]> wrote:
>
>
> Iv Ray wrote:
>> afan pasalic wrote:
>>> this one bugs me for a while. how to change order.
>>>
>>> I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
>>> status value stored in mysql. I can list tasks per status or all.
>>> order number is stored in mysql too.
>>> the easiest way to change order is to have form for each task where you
>>> will enter manually number and then submit (one submit button for whole
>>> form). but, if you change order number for any task you have to change
>>> then all order numbers "below" the task manually
>>>
>>> solution with "arrows" (or up/down buttons) where you click on arrow and
>>> the task switch the place with its "neighbor" is easy and fancy. Though,
>>> I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
>>> to 0 and I have to move task 14 to place 6. I have to click first 4
>>> times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
>>> actually happening on screen (of course) before start switching places
>>> with 9, 8, 7, and 6.
>>>
>>> how do you avoid this "gap"?
>>> what solution do you use at all?
>>
>> You have two different issues - a) how to execute the change, and b)
>> what interface to provide.
>>
>> To execute the change, basically you have to reorder. The best
>> algorithm is question of mathematics - you can implement "something"
>> and improve it independently from the interface.
>>
>> As for the interface, the first is kind of the simplest, but somehow
>> primitive. The second is a bit better, but you have noticed, not much
>> better. The most elegant, considering the time we live in, would be
>> drag & drop AJAX (here - http://tool-man.org/examples/, there are
>> excellent examples, perhaps there are more).
>>
>> It's also a question if tasks really need to be reordered manually. If
>> all tasks have a deadline, you might sort them by date. If some don't,
>> you can provide them unsorted, until they get one. Sorting tasks by
>> moving them up/down works when you have 25 tasks, but it does not work
>> when you have 50, 100, 1 000 (if you are a team leader and have 5-7
>> people team) - in that case sort by date might be better.
>>
>> If you get more advanced, and store time needed to complete a task,
>> you could automatically shift all tasks (of a person) - when one gets
>> delayed or takes longer, than planned.
>>
>> Hope that helps,
>> Iv
>
> thanks Iv,
> though, in my case, the task list will never be more then 25 and we can
> talk about "small" list.
> and, I need to sort them by order_no (bitter to say "priority_no")
>
> thanks for link. the Dag & Drop sortable list is really cool!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I use this:

http://developer.yahoo.com/yui/examples/dragdrop/dd-reorder.html

--- End Message ---
--- Begin Message ---
Eric Butera wrote:
> On Thu, May 15, 2008 at 2:49 PM, afan pasalic <[EMAIL PROTECTED]> wrote:
>   
>> Iv Ray wrote:
>>     
>>> afan pasalic wrote:
>>>       
>>>> this one bugs me for a while. how to change order.
>>>>
>>>> I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
>>>> status value stored in mysql. I can list tasks per status or all.
>>>> order number is stored in mysql too.
>>>> the easiest way to change order is to have form for each task where you
>>>> will enter manually number and then submit (one submit button for whole
>>>> form). but, if you change order number for any task you have to change
>>>> then all order numbers "below" the task manually
>>>>
>>>> solution with "arrows" (or up/down buttons) where you click on arrow and
>>>> the task switch the place with its "neighbor" is easy and fancy. Though,
>>>> I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
>>>> to 0 and I have to move task 14 to place 6. I have to click first 4
>>>> times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
>>>> actually happening on screen (of course) before start switching places
>>>> with 9, 8, 7, and 6.
>>>>
>>>> how do you avoid this "gap"?
>>>> what solution do you use at all?
>>>>         
>>> You have two different issues - a) how to execute the change, and b)
>>> what interface to provide.
>>>
>>> To execute the change, basically you have to reorder. The best
>>> algorithm is question of mathematics - you can implement "something"
>>> and improve it independently from the interface.
>>>
>>> As for the interface, the first is kind of the simplest, but somehow
>>> primitive. The second is a bit better, but you have noticed, not much
>>> better. The most elegant, considering the time we live in, would be
>>> drag & drop AJAX (here - http://tool-man.org/examples/, there are
>>> excellent examples, perhaps there are more).
>>>
>>> It's also a question if tasks really need to be reordered manually. If
>>> all tasks have a deadline, you might sort them by date. If some don't,
>>> you can provide them unsorted, until they get one. Sorting tasks by
>>> moving them up/down works when you have 25 tasks, but it does not work
>>> when you have 50, 100, 1 000 (if you are a team leader and have 5-7
>>> people team) - in that case sort by date might be better.
>>>
>>> If you get more advanced, and store time needed to complete a task,
>>> you could automatically shift all tasks (of a person) - when one gets
>>> delayed or takes longer, than planned.
>>>
>>> Hope that helps,
>>> Iv
>>>       
>> thanks Iv,
>> though, in my case, the task list will never be more then 25 and we can
>> talk about "small" list.
>> and, I need to sort them by order_no (bitter to say "priority_no")
>>
>> thanks for link. the Dag & Drop sortable list is really cool!
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>     
>
> I use this:
>
> http://developer.yahoo.com/yui/examples/dragdrop/dd-reorder.html
>   
This one is good too.
But, actually, I need something more simple. Nothing "fancy" :D.



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

On May 15, 2008, at 11:58 AM, afan pasalic wrote:

Eric Butera wrote:

I use this:

http://developer.yahoo.com/yui/examples/dragdrop/dd-reorder.html

This one is good too.
But, actually, I need something more simple. Nothing "fancy" :D.



for something very simple how about add a drop down list for each item:

[chooose position..]
{ - before task 1 }
{ - before task 2 }
{ - before task 3 }
{ - before task 4 }
{ - at the end    }

and when user clicks save, the php side will do it's magic and update. i think there is a limitation especially if the user decides to reorder many items. but then if you are handy with the javascript/ajax then just do a visual update which can make it easier for the user.
--- End Message ---

Reply via email to