Re: [PHP] Hello everybody - php newbie from switzerland

2010-04-22 Thread Per Jessen
Dan Joseph wrote:

> On Wed, Apr 21, 2010 at 8:38 PM, David McGlone 
> wrote:
> 
>>
>> Are we gonna have to have a discussion on the use of "threading"? LOL
>>
>>
>>
> We just might.  Personally, I use it to sow holes in the toe of my
> socks.
> 

My newsreader supports threading. 


-- 
Per Jessen, Zürich (7.4°C)


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



Re: [PHP] Want a answer about php-cgi

2010-04-22 Thread Sharl.Jimh.Tsin
who can give me a sample to build a cgi version of php 5.3.x?

i really have no idea now...

Best regards,
Sharl.Jimh.Tsin



在 2010年4月21日 下午7:32,Sharl.Jimh.Tsin  写道:
> added it,but still no found. 囧rz
>
> Best regards,
> Sharl.Jimh.Tsin
>
>
>
> 2010/4/21 Sharl.Jimh.Tsin :
>> Sorry,i don't add it.
>>
>> and i can not find them in the ./configure --help context.
>>
>> does this string really exist?
>>
>> thankx a lot.
>>
>> Best regards,
>> Sharl.Jimh.Tsin
>>
>>
>>
>> 2010/4/21 shiplu :
>>> Did you try   --with-fastcgi or --enable-fastcgi
>>>
>>>
>>>
>>>
>>>
>>> Shiplu Mokaddim
>>> My talks, http://talk.cmyweb.net
>>> Follow me, http://twitter.com/shiplu
>>> SUST Programmers, http://groups.google.com/group/p2psust
>>> Innovation distinguishes bet ... ... (ask Steve Jobs the rest)
>>>
>>>
>>>
>>> On Wed, Apr 21, 2010 at 5:17 PM, Sharl.Jimh.Tsin  
>>> wrote:
 i can not find php-cgi file in the bin/sbin directory. WHY?
>>>
>>
>

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



[PHP] Re: replying to list (I give up)

2010-04-22 Thread O. Lavell
Michelle Konzack wrote:
> Hello David McGlone,
> 
> Am 2010-04-21 08:27:18, hacktest Du folgendes herunter:
>> I give up. trying to reply to messages on this list is tedious. I can't
>> pinpoint whether it's because the list is set up to make replies go to
>> the OP or the OP has his reply-to in his mail client set, or most
>> people are hitting the reply-to button instead of simply reply.
> 
> You are using Evolution and I am wondering, why you do not use the
> "List-Reply Button"!

There is no such button in the Evolution version I am using, but Ctrl+L 
works just as well.

I prefer to read this list as an nntp newsgroup on news.php.net.


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



[PHP] Re: Want a answer about php-cgi

2010-04-22 Thread Lupus Michaelis

Le 21/04/2010 12:17, Sharl.Jimh.Tsin a écrit :


i can not find php-cgi file in the bin/sbin directory. WHY?
("--disable-cgi" is not used)


  cd to your build directory, then type next command :

  find . -name php5-cgi -or -name php-cgi


--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

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



Re: [PHP] Re: Want a answer about php-cgi

2010-04-22 Thread Sharl.Jimh.Tsin
thanks for your reply.

i think i have know the reason now.

the CGI version of php is not built by default,we MUST add
"--enable-cgi" to configure explicitly.

Best regards,
Sharl.Jimh.Tsin



2010/4/22 Lupus Michaelis :
> Le 21/04/2010 12:17, Sharl.Jimh.Tsin a écrit :
>
>> i can not find php-cgi file in the bin/sbin directory. WHY?
>> ("--disable-cgi" is not used)
>
>  cd to your build directory, then type next command :
>
>  find . -name php5-cgi -or -name php-cgi
>
>
> --
> Mickaël Wolff aka Lupus Michaelis
> http://lupusmic.org
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] CD, DVD, and Blu-Ray (Not PHP)

2010-04-22 Thread Ashley Sheridan
On Wed, 2010-04-21 at 13:16 -0400, tedd wrote:

> Hi gang:
> 
> I'm no expert on media, but the only difference between CD, DVD, 
> Blu-Ray is the amount of data they can hold, right? IOW, you can 
> still record video, audio, pictures, files, all digital data on all 
> media - it's just that Blu-Ray can hold more than DVD and DVD holds 
> more than CD, isn't that right?
> 
> Cheers,
> 
> tedd
> 
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 


I believe they each have certain formats as well, i.e. the way that data
is stored on them. So data stored on a DVD would be laid out in a
different filesystem to a CD with the same data.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Re: replying to list

2010-04-22 Thread Ashley Sheridan
On Wed, 2010-04-21 at 19:15 +0200, Michelle Konzack wrote:

> Can you not adapt the toolbar?


I did find
http://www.mail-archive.com/evolut...@lists.ximian.com/msg01302.html but
it looks to be Linux-only. I would assume there's an equivalent method
out there for Windows and Macs.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Re: Getting Array to Display

2010-04-22 Thread Ashley Sheridan
On Wed, 2010-04-21 at 14:18 -0400, Gary wrote:

> As an addition to the issue, when I do a SELECT FROM and call for a specific 
> keyword, it does not return any records..
> 
> 
> Gary
> 
> 
> ""Gary""  wrote in message 
> news:70.50.63467.0020f...@pb1.pair.com...
> >I have a form that I have a (ever growing) list of checkboxes,  Here is a
> > sample of  the code for it.
> >
> > 
> >
> > It seems to go in, when I say seems to, I get a result of Array in the
> > table, the code is listed below.  I have tried various solutions I found 
> > in
> > searching the issue, but have only been able to so far get Array.
> >
> >  echo 'Id NumberDate
> > EnteredCaptionWhere
> > TakenKeywordsDescriptionImage';
> >  while ($row = mysqli_fetch_array($data)) {
> >
> >echo '' . $row['image_id']. '';
> >   echo '' . $row['submitted']. '';
> >echo '' . $row['caption']. '';
> >echo '' . $row['where_taken'] . '';
> >echo '' . $row['keyword']. '';
> >   echo '' . $row['description'] . '';
> >  if (is_file($row['image_file'])) {
> >  echo ' > height="100px"/>';
> >  }
> >
> > As a bonus question, does anyone have any idea why the image would show up
> > in IE8, and not FF?
> >
> > Thanks for your help.
> >
> > Gary
> >
> >
> >
> > __ Information from ESET Smart Security, version of virus 
> > signature database 5047 (20100421) __
> >
> > The message was checked by ESET Smart Security.
> >
> > http://www.eset.com
> >
> >
> >
> >
> >
> > __ Information from ESET NOD32 Antivirus, version of virus 
> > signature database 5048 (20100421) __
> >
> > The message was checked by ESET NOD32 Antivirus.
> >
> > http://www.eset.com
> >
> >
> > 
> 
> 
> __ Information from ESET NOD32 Antivirus, version of virus signature 
> database 5048 (20100421) __
> 
> The message was checked by ESET NOD32 Antivirus.
> 
> http://www.eset.com
> 
> 
> 
> 


That's because you havn't stored any keywords in the DB! You've stored
the word 'Array'. Have you actually looked at the data with phpMyAdmin
at all?

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Getting Array to Display

2010-04-22 Thread Ashley Sheridan
On Wed, 2010-04-21 at 14:31 -0400, Gary wrote:

> Ashley
> 
> If I were to create a child table, would the Type be a Bool?
> 
> Gary
> 
> 
> "Ashley Sheridan"  wrote in message 
> news:1271862971.20937.19.ca...@localhost...
> > On Wed, 2010-04-21 at 11:01 -0400, Gary wrote:
> >
> >> Ashley
> >>
> >> Thank you for your reply.
> >>
> >> I was trying to get the structure of the DB into a text form, cant seem 
> >> to
> >> find that (phpmyadmin).
> >>
> >> This is the insert code
> >>
> >>  >> $caption=($_POST['caption']);
> >> $keyword=($_POST['keyword']);
> >> $description=($_POST['description']);
> >> $image_file=($_POST['image_file']);
> >> $where_taken=($_POST['where_taken']);
> >>
> >> $dbc=mysqli_connect('', '', '', 'images');
> >>
> >> $query="INSERT INTO images(caption, where_taken, keyword, description,
> >> image_file) VALUES
> >> ('$caption','$where_taken','$keyword','$description','$image_file')";
> >>  if (isset($_POST['submit'])) {
> >>
> >>  $how_many = count($keyword);
> >>  echo 'keywords chosen: '.$how_many.'';
> >>  if ($how_many>0) {
> >>  echo 'You chose the following keywords:';
> >>  }
> >>  for ($i=0; $i<$how_many; $i++) {
> >>  echo ($i+1) . '- ' . $keyword[$i] . '';
> >>}
> >>   echo "";
> >>  }
> >> $result = mysqli_query($dbc, $query)
> >> or die('Error querying database.');
> >>
> >> if($result == true) {
> >>echo "Successfully Inserted $image_file into database";
> >>} else {
> >>echo "Some Error Occured While Inserting Records";
> >>}
> >>
> >> mysqli_close($dbc);
> >> ?>
> >>
> >> I hope that helps, and again thank you for your reply.
> >>
> >> gary
> >>
> >>
> >> "Ashley Sheridan"  wrote in message
> >> news:1271858245.20937.10.ca...@localhost...
> >> > On Wed, 2010-04-21 at 09:47 -0400, Gary wrote:
> >> >
> >> >> I have a form that I have a (ever growing) list of checkboxes,  Here 
> >> >> is a
> >> >> sample of  the code for it.
> >> >>
> >> >>  
> >> >>
> >> >> It seems to go in, when I say seems to, I get a result of Array in the
> >> >> table, the code is listed below.  I have tried various solutions I 
> >> >> found
> >> >> in
> >> >> searching the issue, but have only been able to so far get Array.
> >> >>
> >> >>   echo 'Id NumberDate
> >> >> EnteredCaptionWhere
> >> >> TakenKeywordsDescriptionImage';
> >> >>   while ($row = mysqli_fetch_array($data)) {
> >> >>
> >> >> echo '' . $row['image_id']. '';
> >> >>echo '' . $row['submitted']. '';
> >> >> echo '' . $row['caption']. '';
> >> >> echo '' . $row['where_taken'] . '';
> >> >> echo '' . $row['keyword']. '';
> >> >>echo '' . $row['description'] . '';
> >> >>   if (is_file($row['image_file'])) {
> >> >>   echo ' >> >> height="100px"/>';
> >> >>   }
> >> >>
> >> >> As a bonus question, does anyone have any idea why the image would 
> >> >> show
> >> >> up
> >> >> in IE8, and not FF?
> >> >>
> >> >> Thanks for your help.
> >> >>
> >> >> Gary
> >> >>
> >> >>
> >> >>
> >> >> __ Information from ESET Smart Security, version of virus
> >> >> signature database 5047 (20100421) __
> >> >>
> >> >> The message was checked by ESET Smart Security.
> >> >>
> >> >> http://www.eset.com
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >
> >> >
> >> > You say you're getting an entry of Array in your table. Is this after
> >> > performing an insert query from the form? If so, we're gonna need to 
> >> > see
> >> > the code for that! If it's that you're retrieving from the DB and
> >> > getting Array as the output, then it could be that you're using string
> >> > functions on an array. However, as you said images are displaying, I
> >> > don't think that's the case. Maybe some of the fields in the DB have a
> >> > string literal of 'Array' as their value?
> >> >
> >> > As for the images not displaying correctly, have you tried to just open
> >> > those images up in a browser using their uri? Just copy and paste it
> >> > from the  tag. It might give more input on exactly what is
> >> > happening with the image.
> >> >
> >> > Thanks,
> >> > Ash
> >> > http://www.ashleysheridan.co.uk
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > __ Information from ESET NOD32 Antivirus, version of virus
> >> > signature database 5047 (20100421) __
> >> >
> >> > The message was checked by ESET NOD32 Antivirus.
> >> >
> >> > http://www.eset.com
> >> >
> >> >
> >>
> >>
> >> __ Information from ESET NOD32 Antivirus, version of virus 
> >> signature database 5047 (20100421) __
> >>
> >> The message was checked by ESET NOD32 Antivirus.
> >>
> >> http://www.eset.com
> >>
> >>
> >>
> >>
> >
> >
> > You're inserting the string 'Array' into the DB. The form you have is
> > sending an actual array, but the insert statement can only insert a
> > single string. The string of the array is, as you've found out, 'Array'.
> >
> > Consider normalising the DB and having a keywords table with 3 fields:
> > id, image_id, keyword.
> >
>

Re: [PHP] Re: replying to list (I give up)

2010-04-22 Thread Ashley Sheridan
On Wed, 2010-04-21 at 19:55 +, Bobby Pejman wrote:

> I must say, I never heard or even thought of the idea of calling it LookOut. 
> Hahaha.  It made me laugh for a good 10 minutes and if that term is open 
> source, I will be using it ;)
> 
> -Original Message-
> From: "Bob McConnell" 
> Date: Wed, 21 Apr 2010 15:01:55 
> To: Michelle Konzack; 
> 
> Subject: RE: [PHP] Re: replying to list (I give up)
> From: Michelle Konzack
> 
> > Hello Peter Lind,
> > 
> > Am 2010-04-21 15:47:54, hacktest Du folgendes herunter:
> >> And waste time every single time you post to the list ... why do
> >> people become programmers/developers again? To end creating technical
> >> solutions they can then avoid using by doing extra, pointless manual
> >> work?
> > 
> > Hmmm, being a Programmer/Developer since 1982 and have ever used
> decent
> > tools to accomplish a task...  including the right  MUA  which
> simplify
> > the Programmers/Developers daily mailing tasks.
> > 
> >> Anyway, if there's no chance of changing the minds of the people
> >> administering the list, the discussion might as well end now.
> > 
> > Why should Programmers/Developers bother with non-reliable  MUAs
> which
> > do not support Programmers/Developers daily mailing tasks?
> > 
> > If YOU are a Programmer/Developer why do you bother with a
> non-suitable
> > MUA?
> 
> Probably because we don't have a choice. There is a legion of PHBs that
> make those decisions for us, obviously without having any information
> about what tools are really needed. I have to hand edit every response I
> send here and to several other lists in order to add the quote markers
> and move my content to the correct location. Lookout no longer offers
> that option. It also lacks the reply-to-list action as well as several
> others that would make life easier and simpler for everyone. I can't
> replace it because it is closely bound to our Exchange servers for
> scheduling and planning. So I won't have an option until after I retire,
> and then I won't need this list at all. Fortunately, that is only a
> couple of years away at most.
> 
> Bob McConnell
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


Outlook is a pita sometimes. At my last job I just used Evolution and
connected over the OWA, as at the time I had to use my own laptop
because of a lack of computers available.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Re: replying to list (I give up)[SOLVED TO A DEGREE]

2010-04-22 Thread Ashley Sheridan
On Wed, 2010-04-21 at 15:55 -0500, Karl DeSaulniers wrote:

> On Apr 21, 2010, at 1:51 PM, Jay Blanchard wrote:
> 
> > Then write an interface (using PHP of course) that
> > only responds to the list when you generate a reply.
> 
> LOL
> WT??
> 
> WHY would we want to do that? Much unnecessary work when an admin  
> could set a reply-to and all would be solved.
> With all due respect, if I was going to go through all that trouble  
> just so I could hit reply instead of reply-all or reply-list or reply- 
> group,
> I would write an email list program that discussed PHP (in PHP) and I  
> would set the reply-to to go to my list email.
> :)
> 
> Not to mention, the admin can set all of them to go to the list email.
> 
> reply-to
> reply-list
> reply-group
> 
> They just have to set the headers to point there. Much easier than  
> what was suggested.
> 
> That aside, I think David was just wondering why it was set up that  
> way in the first part.
> More a question for a admin, then the list, but it is on the list  
> none the less.
> I would have sent that one to the Admin directly.
> 
> It is curious though, why the admin of the PHP lists depend on  
> special case scenarios such as reply-list or reply-group.
> To me, thats kind of like saying you can only click buttons on our  
> website if you use Internet Explorer.
> Everyone else has to view the source and copy the urls to navigate.
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
> 
> 


I believe Dan Brown mentioned a very good reason why this is not as
simple an issue as just changing the reply-to. Not everyone who posts to
the list subscribes to the list, so being copied into the emails is good
for them. Suddenly changing the way things work could actually be
detrimental to the list. Imagine how many people joined up *after*
posting a question and receiving a good answer.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Re: replying to list (I give up)

2010-04-22 Thread David McGlone
On Wednesday 21 April 2010 12:16:28 O. Lavell wrote:
> Michelle Konzack wrote:
> > Hello David McGlone,
> >
> > Am 2010-04-21 08:27:18, hacktest Du folgendes herunter:
> >> I give up. trying to reply to messages on this list is tedious. I can't
> >> pinpoint whether it's because the list is set up to make replies go to
> >> the OP or the OP has his reply-to in his mail client set, or most
> >> people are hitting the reply-to button instead of simply reply.
> >
> > You are using Evolution and I am wondering, why you do not use the
> > "List-Reply Button"!
> 
> There is no such button in the Evolution version I am using, but Ctrl+L
> works just as well.
> 
> I prefer to read this list as an nntp newsgroup on news.php.net.
> 

I switched to Kontact where I am able to add a "reply to list" button on the 
tool bar.

I put it right beside the "reply" so when I go to hit the "reply" It will 
remind me of which one I actually need to hit.

I'm trying to make my computer work for me so I can focus on PHP, not the 
other way around. So after 16 years, I'm done tinkering with my OS's. It gets 
old and writing scripts for every little thing that I think will make my life 
easier is just a thing of the past for me.

Now-a-days the only tinkering I have to do is adding my samba shares to fstab 
when I do fresh installs, and installing apps I use that aren't included by 
default.

Simple, quick and to the point. Thats all I care about anymore.

-- 
Blessings,
David M.

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



Re: [PHP] CD, DVD, and Blu-Ray (Not PHP)

2010-04-22 Thread Richard Quadling
On 21 April 2010 18:16, tedd  wrote:
> Hi gang:
>
> I'm no expert on media, but the only difference between CD, DVD, Blu-Ray is
> the amount of data they can hold, right? IOW, you can still record video,
> audio, pictures, files, all digital data on all media - it's just that
> Blu-Ray can hold more than DVD and DVD holds more than CD, isn't that right?
>
> Cheers,
>
> tedd
>
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

As mentioned, in terms of just data, then pretty much yes. Capacity is the key.

But, CD, DVD and BlueRay really only describe the technology in the
loosest of terms.

CDs can be created in several formats:

Audio CD / CD-DA / Red Book - This is what you put in your CD player
to listen to music. Can also be extended to be CD-Text, CD+Graphics
(CD+G), CD+Extended Graphics (CD+EG, CD+XG)
Super Audio CD
CD-MIDI
CD-ROM
Video CD (VCD)
Super Video CD (SVCD)
Photo CD (Kodak's format)
CD-i (Philip's)
Enhanced CD / CD Extra / CD Plus
VinylDisc - This one is actually a CD on 1 side and the label has a
vinyl track - can support upto 3 minutes of audio. Need a record
player to listen to it.

And that is JUST CD.

DVD and BlueRay have their own standard and formats.

So, even though the disks all look the same, each format
limits/determines what it can contain, how it is organised and what
the player has to be.

http://en.wikipedia.org/wiki/Compact_disc
http://en.wikipedia.org/wiki/DVD
http://en.wikipedia.org/wiki/Blu-ray_Disc




-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Re: replying to list (I give up)

2010-04-22 Thread Mitul Modi
Hi,

I am planning to install on embedded device. Please help me to reduce the
binary footprint.

thanks,
Mitul modi


[PHP] Updating cli executable on MS-Windows

2010-04-22 Thread Bob McConnell
I downloaded the MS-Windows cli from The PHP Group a while ago. It
claims to be version 5.2.10. But now I can't find where I got it, nor
where to get the updates. What is the easiest way to upgrade it to
5.2.13?

  D:\Code\Tests>php --version
  PHP 5.2.10 (cli) (built: Jun 17 2009 16:16:57)
  Copyright (c) 1997-2009 The PHP Group
  Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

Bob McConnell

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



Re: [PHP] Re: replying to list (I give up)

2010-04-22 Thread Daniel Brown
On Thu, Apr 22, 2010 at 08:52, Mitul Modi  wrote:
> Hi,
>
> I am planning to install on embedded device. Please help me to reduce the
> binary footprint.

You sent two messages to the Install list and then hijacked this
thread.  Send a new message to php-general@lists.php.net and ask for
help.  If you don't get a response, you'll have to try somewhere else,
because it's possible that no one here knows the answer you're trying
to find.  In no case, however, should you ever hijack a thread like
this.

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Looking for hosting or dedicated servers?  Ask me how we can fit your budget!

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



Re: [PHP] Updating cli executable on MS-Windows

2010-04-22 Thread Richard Quadling
On 22 April 2010 14:42, Bob McConnell  wrote:
> I downloaded the MS-Windows cli from The PHP Group a while ago. It
> claims to be version 5.2.10. But now I can't find where I got it, nor
> where to get the updates. What is the easiest way to upgrade it to
> 5.2.13?
>
>  D:\Code\Tests>php --version
>  PHP 5.2.10 (cli) (built: Jun 17 2009 16:16:57)
>  Copyright (c) 1997-2009 The PHP Group
>  Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
>
> Bob McConnell
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

You can look in the Museum  at http://museum.php.net/php5/ for all the
official releases.

 php-5.2.10-Win32.zip 18-Jun-2009 01:44  10.0M
 php-5.2.10-nts-Win32.zip 18-Jun-2009 01:44   9.9M
 php-5.2.10-nts-win32-installer.msi   18-Jun-2009 01:44  18.5M
 php-5.2.10-win32-installer.msi   18-Jun-2009 01:44  18.6M
 php-5.2.10.tar.bz2   17-Jun-2009 14:43   8.4M
 php-5.2.10.tar.gz17-Jun-2009 14:43  10.9M


-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



[PHP] Math Question....

2010-04-22 Thread Dan Joseph
Howdy,

This is a math question, but I'm doing the code in PHP, and have expunged
all resources... hoping someone can guide me here.  For some reason, I can't
figure this out.

I want to take a group of items, and divide them into equal groups based on
a max per group.  Example.

1,252,398 -- divide into equal groups with only 30 items per group max.

Can anyone guide me towards an algorithm or formula name to solve this?  PHP
code or Math stuff is fine.  Either way...

Thanks...

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Math Question....

2010-04-22 Thread Stephen

Dan Joseph wrote:

I want to take a group of items, and divide them into equal groups based on
a max per group.  Example.

1,252,398 -- divide into equal groups with only 30 items per group max.


  

1,252,398 DIV 30 = 41,746 groups of 30.

1,252,398 MOD 30 = 18 items in last group

Stephen


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



Re: [PHP] Math Question....

2010-04-22 Thread Dan Joseph
On Thu, Apr 22, 2010 at 10:12 AM, Stephen  wrote:

> 1,252,398 DIV 30 = 41,746 groups of 30.
>
> 1,252,398 MOD 30 = 18 items in last group
>
Well, the only problem with going that route, is the one group is not
equally sized to the others.  18 is ok for a group in this instance, but if
it was a remainder of only 1 or 2, there would be an issue.  Which is where
I come to looking for a the right method to break it equally.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Math Question....

2010-04-22 Thread Ashley Sheridan
On Thu, 2010-04-22 at 10:17 -0400, Dan Joseph wrote:

> On Thu, Apr 22, 2010 at 10:12 AM, Stephen  wrote:
> 
> > 1,252,398 DIV 30 = 41,746 groups of 30.
> >
> > 1,252,398 MOD 30 = 18 items in last group
> >
> Well, the only problem with going that route, is the one group is not
> equally sized to the others.  18 is ok for a group in this instance, but if
> it was a remainder of only 1 or 2, there would be an issue.  Which is where
> I come to looking for a the right method to break it equally.
> 


How do you mean break it equally? If the number doesn't fit, then you've
got a remainder, and no math is going to change that. How do you want
that remainder distributed?

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] Re: Math Question....

2010-04-22 Thread Jo�o C�ndido de Souza Neto
for ($g = $maxpergroup; $g > 0; $g++) {
if ($items mod $g <> 0) continue;
$Groups = $items div $g;
}

Maybe it can helps you.

"Dan Joseph"  escreveu na mensagem 
news:q2oa20394491004220707x980cef5ej2b310c97d1230...@mail.gmail.com...
> Howdy,
>
> This is a math question, but I'm doing the code in PHP, and have expunged
> all resources... hoping someone can guide me here.  For some reason, I 
> can't
> figure this out.
>
> I want to take a group of items, and divide them into equal groups based 
> on
> a max per group.  Example.
>
> 1,252,398 -- divide into equal groups with only 30 items per group max.
>
> Can anyone guide me towards an algorithm or formula name to solve this? 
> PHP
> code or Math stuff is fine.  Either way...
>
> Thanks...
>
> -- 
> -Dan Joseph
>
> www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
> Code "NEWTHINGS" for 10% off initial order
>
> http://www.facebook.com/canishosting
> http://www.facebook.com/originalpoetry
> 



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



Re: [PHP] Math Question....

2010-04-22 Thread Richard Quadling
On 22 April 2010 15:13, Ashley Sheridan  wrote:
> On Thu, 2010-04-22 at 10:17 -0400, Dan Joseph wrote:
>
>> On Thu, Apr 22, 2010 at 10:12 AM, Stephen  wrote:
>>
>> > 1,252,398 DIV 30 = 41,746 groups of 30.
>> >
>> > 1,252,398 MOD 30 = 18 items in last group
>> >
>> Well, the only problem with going that route, is the one group is not
>> equally sized to the others.  18 is ok for a group in this instance, but if
>> it was a remainder of only 1 or 2, there would be an issue.  Which is where
>> I come to looking for a the right method to break it equally.
>>
>
>
> How do you mean break it equally? If the number doesn't fit, then you've
> got a remainder, and no math is going to change that. How do you want
> that remainder distributed?
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

It sounds like you are looking for factors.

http://www.algebra.com/algebra/homework/divisibility/factor-any-number-1.solver

Solution by Find factors of any number

1252398 is NOT a prime number: 1252398 = 2 * 3 * 7 * 29819
Work Shown

1252398 is divisible by 2: 1252398 = 626199 * 2.
626199 is divisible by 3: 626199 = 208733 * 3.
208733 is divisible by 7: 208733 = 29819 * 7.
29819 is not divisible by anything.

So 29819 by 42 (7*3*2)

would be a route.


Take note of 
http://www.algebra.com/algebra/homework/divisibility/Prime_factorization_algorithm.wikipedia,
which has the comment ...

"Many cryptographic protocols are based on the difficultly of
factoring large composite integers or a related problem, the RSA
problem. An algorithm which efficiently factors an arbitrary integer
would render RSA-based public-key cryptography insecure.".




-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Math Question....

2010-04-22 Thread Richard Quadling
On 22 April 2010 15:26, Richard Quadling  wrote:
> On 22 April 2010 15:13, Ashley Sheridan  wrote:
>> On Thu, 2010-04-22 at 10:17 -0400, Dan Joseph wrote:
>>
>>> On Thu, Apr 22, 2010 at 10:12 AM, Stephen  wrote:
>>>
>>> > 1,252,398 DIV 30 = 41,746 groups of 30.
>>> >
>>> > 1,252,398 MOD 30 = 18 items in last group
>>> >
>>> Well, the only problem with going that route, is the one group is not
>>> equally sized to the others.  18 is ok for a group in this instance, but if
>>> it was a remainder of only 1 or 2, there would be an issue.  Which is where
>>> I come to looking for a the right method to break it equally.
>>>
>>
>>
>> How do you mean break it equally? If the number doesn't fit, then you've
>> got a remainder, and no math is going to change that. How do you want
>> that remainder distributed?
>>
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>>
>>
>>
>
> It sounds like you are looking for factors.
>
> http://www.algebra.com/algebra/homework/divisibility/factor-any-number-1.solver
>
> Solution by Find factors of any number
>
> 1252398 is NOT a prime number: 1252398 = 2 * 3 * 7 * 29819
> Work Shown
>
> 1252398 is divisible by 2: 1252398 = 626199 * 2.
> 626199 is divisible by 3: 626199 = 208733 * 3.
> 208733 is divisible by 7: 208733 = 29819 * 7.
> 29819 is not divisible by anything.
>
> So 29819 by 42 (7*3*2)
>
> would be a route.
>
>
> Take note of 
> http://www.algebra.com/algebra/homework/divisibility/Prime_factorization_algorithm.wikipedia,
> which has the comment ...
>
> "Many cryptographic protocols are based on the difficultly of
> factoring large composite integers or a related problem, the RSA
> problem. An algorithm which efficiently factors an arbitrary integer
> would render RSA-based public-key cryptography insecure.".
>
>
>
>
> --
> -
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>

Aha. Missed the "30" bit.

So, having found the factors, you would need to process them to find
the largest combination under 30.

2*3
2*3*7
2*7
3*7

are the possibilities (ignoring any number over 30).

Of which 3*7 is the largest.

So, 1,252,398 divided by 21 = 59,638


Is that the sort of thing you are looking for?

-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



RE: [PHP] Math Question....

2010-04-22 Thread Jason
-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 22 April 2010 15:13
To: Dan Joseph
Cc: PHP eMail List
Subject: Re: [PHP] Math Question

On Thu, 2010-04-22 at 10:17 -0400, Dan Joseph wrote:

> On Thu, Apr 22, 2010 at 10:12 AM, Stephen  wrote:
> 
> > 1,252,398 DIV 30 = 41,746 groups of 30.
> >
> > 1,252,398 MOD 30 = 18 items in last group
> >
> Well, the only problem with going that route, is the one group is not
> equally sized to the others.  18 is ok for a group in this instance, but
if
> it was a remainder of only 1 or 2, there would be an issue.  Which is
where
> I come to looking for a the right method to break it equally.
> 
>
>
>How do you mean break it equally? If the number doesn't fit, then you've
>got a remainder, and no math is going to change that. How do you want
>that remainder distributed?
>
>Thanks,
>Ash
>http://www.ashleysheridan.co.uk
>
>
>

Perhaps a round-robin approach is called for?



HTH
J


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



Re: [PHP] Math Question....

2010-04-22 Thread Dan Joseph
On Thu, Apr 22, 2010 at 10:29 AM, Richard Quadling  wrote:

>  >
> > It sounds like you are looking for factors.
> >
> >
> http://www.algebra.com/algebra/homework/divisibility/factor-any-number-1.solver
> >
> > Solution by Find factors of any number
> >
> > 1252398 is NOT a prime number: 1252398 = 2 * 3 * 7 * 29819
> > Work Shown
> >
> > 1252398 is divisible by 2: 1252398 = 626199 * 2.
> > 626199 is divisible by 3: 626199 = 208733 * 3.
> > 208733 is divisible by 7: 208733 = 29819 * 7.
> > 29819 is not divisible by anything.
> >
> > So 29819 by 42 (7*3*2)
> >
> > would be a route.
>
> Aha. Missed the "30" bit.
>
> So, having found the factors, you would need to process them to find
> the largest combination under 30.
>
> 2*3
> 2*3*7
> 2*7
> 3*7
>
> are the possibilities (ignoring any number over 30).
>
> Of which 3*7 is the largest.
>
> So, 1,252,398 divided by 21 = 59,638
>
>
> Is that the sort of thing you are looking for?
>
>

Yes, that looks exactly what like what I'm looking for.  I'm going to try
and wake up the algebra side of my brain that hasn't been used in years and
see if I can digest all this.

For the 2, 3, and 7, that is based solely on the last number being divisible
by a prime number?

Joao, Jason, thanks for the code.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Math Question....

2010-04-22 Thread Peter van der Does
On Thu, 22 Apr 2010 10:17:10 -0400
Dan Joseph  wrote:

> On Thu, Apr 22, 2010 at 10:12 AM, Stephen 
> wrote:
> 
> > 1,252,398 DIV 30 = 41,746 groups of 30.
> >
> > 1,252,398 MOD 30 = 18 items in last group
> >
> Well, the only problem with going that route, is the one group is not
> equally sized to the others.  18 is ok for a group in this instance,
> but if it was a remainder of only 1 or 2, there would be an issue.
> Which is where I come to looking for a the right method to break it
> equally.
> 

My take on it:

$Items=1252398;
$MaxInGroup=30;
for ($x=$MaxInGroup; $x>1;$x--) {
$remainder=$Items % $x;
// Change 17 to the max amount allowed in the last group
if ($remainder == 0 || $remainder >= 17) { // 
$groups = (int) ($Items /$x)+1;
echo $groups."\n";
echo $remainder;
break;
}
}

-- 
Peter van der Does

GPG key: E77E8E98

IRC: Ganseki on irc.freenode.net
Twitter: @petervanderdoes

WordPress Plugin Developer
Blog: http://blog.avirtualhome.com
Forums: http://forums.avirtualhome.com
Twitter: @avhsoftware

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



Re: [PHP] Math Question....

2010-04-22 Thread Peter van der Does
On Thu, 22 Apr 2010 10:49:11 -0400
Peter van der Does  wrote:


> 
> My take on it:
> 
> $Items=1252398;
> $MaxInGroup=30;
> for ($x=$MaxInGroup; $x>1;$x--) {
>   $remainder=$Items % $x;
>   // Change 17 to the max amount allowed in the last group
>   if ($remainder == 0 || $remainder >= 17) { // 
>   $groups = (int) ($Items /$x)+1;
>   echo $groups."\n";
>   echo $remainder;
>   break;
>   }
> }
> 
Bugfixed LOL:
$Items=1252398;
$MaxInGroup=30;
for ($x=$MaxInGroup; $x>1;$x--) {
$remainder=$Items % $x;
// Change 17 to the max amount allowed in a group
if ($remainder == 0 || $remainder >= 17) {
$groups = (int) ($Items /$x);
if ($remainder > 0 ) {
$groups++;
}
echo $groups."\n";
echo $remainder;
break;
}
}

-- 
Peter van der Does

GPG key: E77E8E98

IRC: Ganseki on irc.freenode.net
Twitter: @petervanderdoes

WordPress Plugin Developer
Blog: http://blog.avirtualhome.com
Forums: http://forums.avirtualhome.com
Twitter: @avhsoftware

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



Re: [PHP] Re: replying to list (I give up)[SOLVED TO A DEGREE]

2010-04-22 Thread Peter Lind
On 22 April 2010 12:14, Ashley Sheridan  wrote:
> I believe Dan Brown mentioned a very good reason why this is not as
> simple an issue as just changing the reply-to. Not everyone who posts to
> the list subscribes to the list, so being copied into the emails is good
> for them. Suddenly changing the way things work could actually be
> detrimental to the list. Imagine how many people joined up *after*
> posting a question and receiving a good answer.

That wouldn't change - they only get copied in when you choose
'reply-all' and that would work the same whether or not a 'reply-to'
is used.

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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



Re: [PHP] Updating cli executable on MS-Windows

2010-04-22 Thread Richard Quadling
On 22 April 2010 14:42, Bob McConnell  wrote:
> I downloaded the MS-Windows cli from The PHP Group a while ago. It
> claims to be version 5.2.10. But now I can't find where I got it, nor
> where to get the updates. What is the easiest way to upgrade it to
> 5.2.13?
>
>  D:\Code\Tests>php --version
>  PHP 5.2.10 (cli) (built: Jun 17 2009 16:16:57)
>  Copyright (c) 1997-2009 The PHP Group
>  Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
>
> Bob McConnell
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

You can get the latest V5.2.x from http://windows.php.net/download/


-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Re: replying to list (I give up)[SOLVED TO A DEGREE]

2010-04-22 Thread Ashley Sheridan
On Thu, 2010-04-22 at 17:06 +0200, Peter Lind wrote:

> On 22 April 2010 12:14, Ashley Sheridan  wrote:
> > I believe Dan Brown mentioned a very good reason why this is not as
> > simple an issue as just changing the reply-to. Not everyone who posts to
> > the list subscribes to the list, so being copied into the emails is good
> > for them. Suddenly changing the way things work could actually be
> > detrimental to the list. Imagine how many people joined up *after*
> > posting a question and receiving a good answer.
> 
> That wouldn't change - they only get copied in when you choose
> 'reply-all' and that would work the same whether or not a 'reply-to'
> is used.
> 
> Regards
> Peter
> 


It would change for the first reply. You say you just want to hit reply
to reply to the list. Now if anyone hits reply, because the reply-to'
header has been changed, the reply goes to the list and not the op.
They're not subscribed and so they miss out.

The way things stand, hitting reply instead of reply to all sends the
reply back to the op only. It happens on this list often and doesn't
cause many issues as the op or replyer notices and sends/copies the list
back in again.

Changing the reply-to header would mean that if someone just hit reply,
the unsubscribed op wouldn't get the reply at all, and any further
replies to that thread would all be to the list only and the
unsubscribed op would never know.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Re: replying to list (I give up)[SOLVED TO A DEGREE]

2010-04-22 Thread Peter Lind
On 22 April 2010 17:05, Ashley Sheridan  wrote:
>
> On Thu, 2010-04-22 at 17:06 +0200, Peter Lind wrote:
>
> On 22 April 2010 12:14, Ashley Sheridan  wrote:
> > I believe Dan Brown mentioned a very good reason why this is not as
> > simple an issue as just changing the reply-to. Not everyone who posts to
> > the list subscribes to the list, so being copied into the emails is good
> > for them. Suddenly changing the way things work could actually be
> > detrimental to the list. Imagine how many people joined up *after*
> > posting a question and receiving a good answer.
>
> That wouldn't change - they only get copied in when you choose
> 'reply-all' and that would work the same whether or not a 'reply-to'
> is used.
>
> Regards
> Peter
>
>
> It would change for the first reply. You say you just want to hit reply to 
> reply to the list. Now if anyone hits reply, because the reply-to' header has 
> been changed, the reply goes to the list and not the op. They're not 
> subscribed and so they miss out.

You seem to forget the amount of people stating "remove the other
addresses" from the "reply-all" response. Also, if you don't want to
subscribe to a mailing list, the onus is really on you to make sure
you get the response if any comes.

> The way things stand, hitting reply instead of reply to all sends the reply 
> back to the op only. It happens on this list often and doesn't cause many 
> issues as the op or replyer notices and sends/copies the list back in again.

It's rather annoying and easily avoided. The question is whether this
problem is bigger than people not subscribed to the list not getting a
response, because people use "reply" instead of "reply all".

> Changing the reply-to header would mean that if someone just hit reply, the 
> unsubscribed op wouldn't get the reply at all, and any further replies to 
> that thread would all be to the list only and the unsubscribed op would never 
> know.

Emailing a mailing list and expecting an automated response is ... I
don't want to be negative or arrogant, but I think there's a general
and rather problematic lack of experience there. It's a bit like
walking past a group of people, yelling a question at them, then
expecting one of them to run back to you with the answer after you've
passed. Would you normally expect that kind of behaviour?
 Apart from that, if in the current scenario you just hit 'reply' and
send the email off to the OP, the list doesn't get the benefit - and
the OP is not going to change that fact, as they're not subscribed to
the list and won't notice anyway. Which is worse, one person having to
check the answer by looking at the mailing list archive or the rest of
the list not benefiting at all from the answer?

Regards
Peter

--

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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



Re: [PHP] Re: replying to list (I give up)[SOLVED TO A DEGREE]

2010-04-22 Thread Ashley Sheridan
On Thu, 2010-04-22 at 17:35 +0200, Peter Lind wrote:

> Which is worse, one person having to
> check the answer by looking at the mailing list archive or the rest of
> the list not benefiting at all from the answer?


Well, as that one person was the one who needed the help enough to ask
the question in the first place...

I just don't agree that the reply-to field should be changed. Most email
clients are intelligent enough to recognise mailing lists when they see
them, and those that aren't, well, I don't think the world should have
to change to fit in with poor software. I know that often people don't
have a choice with what is installed on a computer, but surely it's
better trying to speak to whoever is in-charge of that to ask them to
change their procedures than get however many shared systems (i.e.
mailing lists) to change their methods?

I guess I'm too far gone down the open source route now to 'get' the
closed source problems that many people face in their offices. If I
don't like a piece of software, I can choose different software, contact
the developers, or even attempt to create a workaround myself.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Math Question....

2010-04-22 Thread Richard Quadling
On 22 April 2010 14:48, Dan Joseph  wrote:
> On Thu, Apr 22, 2010 at 10:29 AM, Richard Quadling > wrote:
>
>>  >
>> > It sounds like you are looking for factors.
>> >
>> >
>> http://www.algebra.com/algebra/homework/divisibility/factor-any-number-1.solver
>> >
>> > Solution by Find factors of any number
>> >
>> > 1252398 is NOT a prime number: 1252398 = 2 * 3 * 7 * 29819
>> > Work Shown
>> >
>> > 1252398 is divisible by 2: 1252398 = 626199 * 2.
>> > 626199 is divisible by 3: 626199 = 208733 * 3.
>> > 208733 is divisible by 7: 208733 = 29819 * 7.
>> > 29819 is not divisible by anything.
>> >
>> > So 29819 by 42 (7*3*2)
>> >
>> > would be a route.
>>
>> Aha. Missed the "30" bit.
>>
>> So, having found the factors, you would need to process them to find
>> the largest combination under 30.
>>
>> 2*3
>> 2*3*7
>> 2*7
>> 3*7
>>
>> are the possibilities (ignoring any number over 30).
>>
>> Of which 3*7 is the largest.
>>
>> So, 1,252,398 divided by 21 = 59,638
>>
>>
>> Is that the sort of thing you are looking for?
>>
>>
>
> Yes, that looks exactly what like what I'm looking for.  I'm going to try
> and wake up the algebra side of my brain that hasn't been used in years and
> see if I can digest all this.
>
> For the 2, 3, and 7, that is based solely on the last number being divisible
> by a prime number?
>
> Joao, Jason, thanks for the code.
>
> --
> -Dan Joseph
>
> www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
> Code "NEWTHINGS" for 10% off initial order
>
> http://www.facebook.com/canishosting
> http://www.facebook.com/originalpoetry
>

This seems to be working ...

= $GroupSize)
{
break;
}
}

rsort($Factors);

return reset($Factors);
}

echo findBestFactors($argv[1], $argv[2], $Factors), PHP_EOL;
?>


factors 1252398988 5000

outputs  ...

4882

and 21 for your value 1252398

-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Math Question....

2010-04-22 Thread Dan Joseph
On Thu, Apr 22, 2010 at 12:16 PM, Richard Quadling  wrote:

>  On 22 April 2010 14:48, Dan Joseph  wrote:
> This seems to be working ...
>
>  function findBestFactors($Value, $GroupSize, array &$Factors = null)
>{
>$Factors = array();
>foreach(range(1, ceil(sqrt($Value))) as $Factor)
>{
>if (0 == ($Value % $Factor))
>{
>if ($Factor <= $GroupSize)
>{
>$Factors[] = $Factor;
>}
>if ($Factor != ($OtherFactor = ($Value / $Factor))
> && $OtherFactor
> <= $GroupSize)
>{
>$Factors[] = $OtherFactor;
>}
>}
>
>if ($Factor >= $GroupSize)
>{
>break;
>}
>}
>
>rsort($Factors);
>
>return reset($Factors);
>}
>
> echo findBestFactors($argv[1], $argv[2], $Factors), PHP_EOL;
> ?>
>
>
> factors 1252398988 5000
>
> outputs  ...
>
> 4882
>
> and 21 for your value 1252398
>
>
>
Wow!  thanks...  I just plopped it into phped and fired off some tests, and
I agree, seems to work fine.  I appreciate your help today.  I am still
looking over the algebra stuff, and am now comparing it to your code.  This
will get me moving forward better in my project.  Thank you!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


[PHP] Replace a space with a newline every 2 spaces

2010-04-22 Thread Paul Halliday
Ex:

"This is the string and it is this long"

This is
the string
and it
is this
long

I found some long functions to achieve this but I couldn't help but
think that it could be done in a couple lines.

Possible?

Thanks.

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



[PHP] collect string from string

2010-04-22 Thread saeed ahmed
hello friend,

I have a string like below
"

===Pronunciation===
* {{enPR|tē}}, {{IPA|/tiː/}}, {{SAMPA|/ti:/}}
* {{audio|en-us-tea.ogg|Audio (US)}}
* {{audio|En-uk-tea.ogg|Audio (UK)}}
*: {{rhymes|iː}}
* {{homophones|T|te|tee|ti}}


# {{uncountable}} The dried leaves or buds of the [[tea plant]],
''[[w:Camellia sinensis|Camellia sinensis]]''.
#: ''Go to the supermarket and buy some '''tea'''.''
# {{uncountable}} The drink made by [[infuse|infusing]] these dried
leaves or buds in hot water.
Usage notes
In the [[United Kingdom]], [[Canada]], other English speaking
[[Commonwealth]] countries, and in northern areas of the [[United
States]], ''tea'' is assumed to mean [[hot]] tea and is usually served
in a [[teapot]] with separate [[cup]]s, or sometimes served directly
in cups such as for large groups or for [[takeout]].

In southern areas of the United States, ''tea'' is assumed to mean
[[iced tea]] and is usually served with ice, either in a [[pitcher]]
with separate [[glass]]es or directly in glasses.

Strictly speaking, "tea" has been reserved for [[infusion]]s made from
leaves of ''[[w:Camellia sinensis|Camellia sinensis]]''. Infusions
made from other [[herb]]s such as [[rooibos]], [[mint]]{{,}} and
[[chamomile]] are called [[tisane]]s. In recent years the word "tea"
has been extended to include the herbal infusions.

Synonyms
* {{italbrac-colon|dried leaves of tea plant}} [[tea leaves]]
* {{italbrac-colon|drink made by infusing parts of various other
plants}} [[herb tea]], [[herbal tea]], [[infusion]], [[tisane]]

Derived terms

"

now I want to collect only the string which are start with '#'. how
can I do this? please suggest me.


-
Regards
Saeed Ahmed
http://saeed05.wordpress.com
-


Re: [PHP] collect string from string

2010-04-22 Thread Ashley Sheridan
On Thu, 2010-04-22 at 23:41 +0600, saeed ahmed wrote:

> hello friend,
> 
> I have a string like below
> "
> 
> ===Pronunciation===
> * {{enPR|tē}}, {{IPA|/tiː/}}, {{SAMPA|/ti:/}}
> * {{audio|en-us-tea.ogg|Audio (US)}}
> * {{audio|En-uk-tea.ogg|Audio (UK)}}
> *: {{rhymes|iː}}
> * {{homophones|T|te|tee|ti}}
> 
> 
> # {{uncountable}} The dried leaves or buds of the [[tea plant]],
> ''[[w:Camellia sinensis|Camellia sinensis]]''.
> #: ''Go to the supermarket and buy some '''tea'''.''
> # {{uncountable}} The drink made by [[infuse|infusing]] these dried
> leaves or buds in hot water.
> Usage notes
> In the [[United Kingdom]], [[Canada]], other English speaking
> [[Commonwealth]] countries, and in northern areas of the [[United
> States]], ''tea'' is assumed to mean [[hot]] tea and is usually served
> in a [[teapot]] with separate [[cup]]s, or sometimes served directly
> in cups such as for large groups or for [[takeout]].
> 
> In southern areas of the United States, ''tea'' is assumed to mean
> [[iced tea]] and is usually served with ice, either in a [[pitcher]]
> with separate [[glass]]es or directly in glasses.
> 
> Strictly speaking, "tea" has been reserved for [[infusion]]s made from
> leaves of ''[[w:Camellia sinensis|Camellia sinensis]]''. Infusions
> made from other [[herb]]s such as [[rooibos]], [[mint]]{{,}} and
> [[chamomile]] are called [[tisane]]s. In recent years the word "tea"
> has been extended to include the herbal infusions.
> 
> Synonyms
> * {{italbrac-colon|dried leaves of tea plant}} [[tea leaves]]
> * {{italbrac-colon|drink made by infusing parts of various other
> plants}} [[herb tea]], [[herbal tea]], [[infusion]], [[tisane]]
> 
> Derived terms
> 
> "
> 
> now I want to collect only the string which are start with '#'. how
> can I do this? please suggest me.
> 
> 
> -
> Regards
> Saeed Ahmed
> http://saeed05.wordpress.com
> -


If the text is in a file, use file() to read the contents into an array
and then check the first character.

Alternatively, if the text is in a string, you could use a regex to pull
out only matching lines. This is an untested regex, but it should do the
trick:

/^(\#.+)$/g

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Replace a space with a newline every 2 spaces

2010-04-22 Thread Andrew Ballard
On Thu, Apr 22, 2010 at 1:29 PM, Paul Halliday  wrote:
> Ex:
>
> "This is the string and it is this long"
>
> This is
> the string
> and it
> is this
> long
>
> I found some long functions to achieve this but I couldn't help but
> think that it could be done in a couple lines.
>
> Possible?
>
> Thanks.
>

I'm not sure it's the best method, but it didn't take long to come up with this:



Andrew

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



[PHP] Using usort in a class

2010-04-22 Thread Ashley Sheridan
I've not had to do this before, and now that I am, I've hit a bit of a
wall:

Basically, I've an array that might look like this (the number of
elements may vary, but the letter is always unique and remains a single
character):

Array(
0 => '2h'
1 => '1d'
2 => '2w'
)

And I need to sort them according to their letter. If I wasn't using
classes, I could just use usort($array, 'custom_sort') but when I do
that within my class, I'm told it can't find the function. I've tried
usort($array, $this::custom_sort) and usort($array,
$Gantt_Task::custom_sort), both of which throw up the rather frightening
unexpected double colon error (if you've ever seen one you'll know what
I'm on about!)

Does anyone know how I can do a usort within a class without resorting
to making my sorting function a global function that isn't part of the
class? I'd rather keep this tidy and everything in the class that needs
to be in it, so a random function sitting outside is something I want to
avoid if possible.

Alternatively, if anyone knows a better way than using usort I'm all
ears!

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Using usort in a class

2010-04-22 Thread Adam Richardson
On Thu, Apr 22, 2010 at 2:12 PM, Ashley Sheridan
wrote:

> I've not had to do this before, and now that I am, I've hit a bit of a
> wall:
>
> Basically, I've an array that might look like this (the number of
> elements may vary, but the letter is always unique and remains a single
> character):
>
> Array(
>0 => '2h'
>1 => '1d'
>2 => '2w'
> )
>
> And I need to sort them according to their letter. If I wasn't using
> classes, I could just use usort($array, 'custom_sort') but when I do
> that within my class, I'm told it can't find the function. I've tried
> usort($array, $this::custom_sort) and usort($array,
> $Gantt_Task::custom_sort), both of which throw up the rather frightening
> unexpected double colon error (if you've ever seen one you'll know what
> I'm on about!)
>
> Does anyone know how I can do a usort within a class without resorting
> to making my sorting function a global function that isn't part of the
> class? I'd rather keep this tidy and everything in the class that needs
> to be in it, so a random function sitting outside is something I want to
> avoid if possible.
>
> Alternatively, if anyone knows a better way than using usort I'm all
> ears!
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
Try using an array to pass in the function:

usort($array, array('ClassName', 'staticMethodName'));

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] Using usort in a class

2010-04-22 Thread Ashley Sheridan
On Thu, 2010-04-22 at 14:26 -0400, Adam Richardson wrote:

> On Thu, Apr 22, 2010 at 2:12 PM, Ashley Sheridan
>  wrote:
> 
> I've not had to do this before, and now that I am, I've hit a
> bit of a
> wall:
> 
> Basically, I've an array that might look like this (the number
> of
> elements may vary, but the letter is always unique and remains
> a single
> character):
> 
> Array(
>0 => '2h'
>1 => '1d'
>2 => '2w'
> )
> 
> And I need to sort them according to their letter. If I wasn't
> using
> classes, I could just use usort($array, 'custom_sort') but
> when I do
> that within my class, I'm told it can't find the function.
> I've tried
> usort($array, $this::custom_sort) and usort($array,
> $Gantt_Task::custom_sort), both of which throw up the rather
> frightening
> unexpected double colon error (if you've ever seen one you'll
> know what
> I'm on about!)
> 
> Does anyone know how I can do a usort within a class without
> resorting
> to making my sorting function a global function that isn't
> part of the
> class? I'd rather keep this tidy and everything in the class
> that needs
> to be in it, so a random function sitting outside is something
> I want to
> avoid if possible.
> 
> Alternatively, if anyone knows a better way than using usort
> I'm all
> ears!
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
> 
> 
> Try using an array to pass in the function:
> 
> 
> 
> usort($array, array('ClassName', 'staticMethodName'));
> 
> 
> Adam
> 
> 
> -- 
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
> 

Thanks! I literally just found that answer as your reply came through.
It's a bit of a facepalm moment here right now, as I'm ashamed to say
that the answer was on the manual pages all along, which I'd failed to
read properly :-/

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Using usort in a class

2010-04-22 Thread Adam Richardson
On Thu, Apr 22, 2010 at 2:25 PM, Ashley Sheridan
wrote:

>  On Thu, 2010-04-22 at 14:26 -0400, Adam Richardson wrote:
>
> On Thu, Apr 22, 2010 at 2:12 PM, Ashley Sheridan 
> wrote:
>
>  I've not had to do this before, and now that I am, I've hit a bit of a
> wall:
>
> Basically, I've an array that might look like this (the number of
> elements may vary, but the letter is always unique and remains a single
> character):
>
> Array(
>0 => '2h'
>1 => '1d'
>2 => '2w'
> )
>
> And I need to sort them according to their letter. If I wasn't using
> classes, I could just use usort($array, 'custom_sort') but when I do
> that within my class, I'm told it can't find the function. I've tried
> usort($array, $this::custom_sort) and usort($array,
> $Gantt_Task::custom_sort), both of which throw up the rather frightening
> unexpected double colon error (if you've ever seen one you'll know what
> I'm on about!)
>
> Does anyone know how I can do a usort within a class without resorting
> to making my sorting function a global function that isn't part of the
> class? I'd rather keep this tidy and everything in the class that needs
> to be in it, so a random function sitting outside is something I want to
> avoid if possible.
>
> Alternatively, if anyone knows a better way than using usort I'm all
> ears!
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
> Try using an array to pass in the function:
>
>
>
>  usort($array, array('ClassName', 'staticMethodName'));
>
>
>
>  Adam
>
>
> --
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
>
>
> Thanks! I literally just found that answer as your reply came through. It's
> a bit of a facepalm moment here right now, as I'm ashamed to say that the
> answer was on the manual pages all along, which I'd failed to read properly
> :-/
>
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
No problem ;)

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


[PHP] Re: Re: replying to list (I give up)[SOLVED TO A DEGREE]

2010-04-22 Thread Michelle Konzack
Hello Karl DeSaulniers,

Am 2010-04-21 15:55:41, hacktest Du folgendes herunter:
> WHY would we want to do that? Much unnecessary work when an admin
> could set a reply-to and all would be solved.
> With all due respect, if I was going to go through all that trouble
> just so I could hit reply instead of reply-all or reply-list or
> reply-group,

And WHY do you want to restrict my freedom to  choose  to  which  I  can
respond?  This is something like censorship!

Oh, there ARE Mail-Cients for Windows  which  understand  reply-all  and
reply-list and reply-group

> They just have to set the headers to point there. Much easier than
> what was suggested.

This is associal!

> It is curious though, why the admin of the PHP lists depend on
> special case scenarios such as reply-list or reply-group.
> To me, thats kind of like saying you can only click buttons on our
> website if you use Internet Explorer.
> Everyone else has to view the source and copy the urls to navigate.

On some of my pages you will be kicked off if you come in with  Infernal
Exploder.  Hahaha!

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator

-- 
# Debian GNU/Linux Consultant ##
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsyst...@tdnet France   itsyst...@tdnet UG (haftungsbeschränkt)
Gesch. Michelle Konzack  Gesch. Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz   Kinzigstraße 17
67100 Strasbourg/France 77694 Kehl/Germany
Tel: +33-6-61925193 mobil   Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

  
 

Jabber linux4miche...@jabber.ccc.de
ICQ#328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/


signature.pgp
Description: Digital signature


Re: [PHP] Re: Re: replying to list (I give up)[SOLVED TO A DEGREE]

2010-04-22 Thread Hans Åhlin
Is this the new "threading support" thread?!?!

Why don't nuke everything then its nothing to use or complain about...

**
 Hans Åhlin
   Tel: +46761488019
   http://www.kronan-net.com/
   irc://irc.freenode.net:6667 - TheCoin
**



2010/4/22 Michelle Konzack :
> Hello Karl DeSaulniers,
>
> Am 2010-04-21 15:55:41, hacktest Du folgendes herunter:
>> WHY would we want to do that? Much unnecessary work when an admin
>> could set a reply-to and all would be solved.
>> With all due respect, if I was going to go through all that trouble
>> just so I could hit reply instead of reply-all or reply-list or
>> reply-group,
>
> And WHY do you want to restrict my freedom to  choose  to  which  I  can
> respond?  This is something like censorship!
>
> Oh, there ARE Mail-Cients for Windows  which  understand  reply-all  and
> reply-list and reply-group
>
>> They just have to set the headers to point there. Much easier than
>> what was suggested.
>
> This is associal!
>
>> It is curious though, why the admin of the PHP lists depend on
>> special case scenarios such as reply-list or reply-group.
>> To me, thats kind of like saying you can only click buttons on our
>> website if you use Internet Explorer.
>> Everyone else has to view the source and copy the urls to navigate.
>
> On some of my pages you will be kicked off if you come in with  Infernal
> Exploder.  Hahaha!
>
> Thanks, Greetings and nice Day/Evening
>    Michelle Konzack
>    Systemadministrator
>
> --
> # Debian GNU/Linux Consultant ##
>   Development of Intranet and Embedded Systems with Debian GNU/Linux
>
> itsyst...@tdnet France           itsyst...@tdnet UG (haftungsbeschränkt)
> Gesch. Michelle Konzack          Gesch. Michelle Konzack
>
> Apt. 917 (homeoffice)
> 50, rue de Soultz               Kinzigstraße 17
> 67100 Strasbourg/France         77694 Kehl/Germany
> Tel: +33-6-61925193 mobil       Tel: +49-177-9351947 mobil
> Tel: +33-9-52705884 fix
>
>   
>          
>
> Jabber linux4miche...@jabber.ccc.de
> ICQ    #328449886
>
> Linux-User #280138 with the Linux Counter, http://counter.li.org/
>

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



Re: [PHP] collect string from string

2010-04-22 Thread saeed ahmed
this is not working

/^(\#.+)$/g

I have tried the preg_match function

-
Regards
Saeed Ahmed
http://saeed05.wordpress.com
-


On Thu, Apr 22, 2010 at 11:39 PM, Ashley Sheridan
wrote:

>  On Thu, 2010-04-22 at 23:41 +0600, saeed ahmed wrote:
>
> hello friend,
>
> I have a string like below
> "
>
> ===Pronunciation===
> * {{enPR|tē}}, {{IPA|/tiː/}}, {{SAMPA|/ti:/}}
> * {{audio|en-us-tea.ogg|Audio (US)}}
> * {{audio|En-uk-tea.ogg|Audio (UK)}}
> *: {{rhymes|iː}}
> * {{homophones|T|te|tee|ti}}
>
>
> # {{uncountable}} The dried leaves or buds of the [[tea plant]],
> ''[[w:Camellia sinensis|Camellia sinensis]]''.
> #: ''Go to the supermarket and buy some '''tea'''.''
> # {{uncountable}} The drink made by [[infuse|infusing]] these dried
> leaves or buds in hot water.
> Usage notes
> In the [[United Kingdom]], [[Canada]], other English speaking
> [[Commonwealth]] countries, and in northern areas of the [[United
> States]], ''tea'' is assumed to mean [[hot]] tea and is usually served
> in a [[teapot]] with separate [[cup]]s, or sometimes served directly
> in cups such as for large groups or for [[takeout]].
>
> In southern areas of the United States, ''tea'' is assumed to mean
> [[iced tea]] and is usually served with ice, either in a [[pitcher]]
> with separate [[glass]]es or directly in glasses.
>
> Strictly speaking, "tea" has been reserved for [[infusion]]s made from
> leaves of ''[[w:Camellia sinensis|Camellia sinensis]]''. Infusions
> made from other [[herb]]s such as [[rooibos]], [[mint]]{{,}} and
> [[chamomile]] are called [[tisane]]s. In recent years the word "tea"
> has been extended to include the herbal infusions.
>
> Synonyms
> * {{italbrac-colon|dried leaves of tea plant}} [[tea leaves]]
> * {{italbrac-colon|drink made by infusing parts of various other
> plants}} [[herb tea]], [[herbal tea]], [[infusion]], [[tisane]]
>
> Derived terms
>
> "
>
> now I want to collect only the string which are start with '#'. how
> can I do this? please suggest me.
>
>
> -
> Regards
> Saeed Ahmedhttp://saeed05.wordpress.com
> -
>
>
> If the text is in a file, use file() to read the contents into an array and
> then check the first character.
>
> Alternatively, if the text is in a string, you could use a regex to pull
> out only matching lines. This is an untested regex, but it should do the
> trick:
>
> /^(\#.+)$/g
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


Re: [PHP] Re: Re: replying to list (I give up)[SOLVED TO A DEGREE]

2010-04-22 Thread Karl DeSaulniers

:)

On Apr 22, 2010, at 2:26 PM, Michelle Konzack wrote:


Hello Karl DeSaulniers,

Am 2010-04-21 15:55:41, hacktest Du folgendes herunter:

WHY would we want to do that? Much unnecessary work when an admin
could set a reply-to and all would be solved.
With all due respect, if I was going to go through all that trouble
just so I could hit reply instead of reply-all or reply-list or
reply-group,


And WHY do you want to restrict my freedom to  choose  to  which   
I  can

respond?  This is something like censorship!


? I think you read wrong. I wouldn't be hindering your ability to use  
other reply buttons.
Nothing anyone really can do about the reply-all. if they are going  
to reply-all then they are the ones choosing that.
When I hit reply though, just reply and not reply-all, list, or  
group, I think it should go back to the list. thats all.


You can hit any reply button you like. ;)



Oh, there ARE Mail-Cients for Windows  which  understand  reply- 
all  and

reply-list and reply-group


I am on a Mac, so I don't know what this comment has to do with me.
I think your referring to the Windows users comment someone else said.
The point I had was that there is no need to have a message from the  
list reply back to the poster, but the list.





They just have to set the headers to point there. Much easier than
what was suggested.


This is associal!


No  opensocial..
I wouldnt be against setting the reply-list and reply-group for other  
people. :)






It is curious though, why the admin of the PHP lists depend on
special case scenarios such as reply-list or reply-group.
To me, thats kind of like saying you can only click buttons on our
website if you use Internet Explorer.
Everyone else has to view the source and copy the urls to navigate.


On some of my pages you will be kicked off if you come in with   
Infernal

Exploder.  Hahaha!


lol



Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator




But alas, I am done. There really is nothing I can do but accept how  
the process is set up.
It is not the most efficient list, but one of the best in terms of  
people and knowledge,

so like I said before, I will keep deleting emails.

Best,


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] collect string from string

2010-04-22 Thread Michiel Sikma
You need to use the multiline modifier.

Try this:
preg_match_all("/^(\#.*)/im", $my_string, $matches);
print_r($matches);

The result:

Array
(
[0] => Array
(
[0] => # {{uncountable}} The dried leaves or buds of the [[tea
plant]],
[1] => #: ''Go to the supermarket and buy some '''tea'''.''
[2] => # {{uncountable}} The drink made by [[infuse|infusing]]
these dried
)

[1] => Array
(
[0] => # {{uncountable}} The dried leaves or buds of the [[tea
plant]],
[1] => #: ''Go to the supermarket and buy some '''tea'''.''
[2] => # {{uncountable}} The drink made by [[infuse|infusing]]
these dried
)

)

Michiel

On 22 April 2010 22:38, saeed ahmed  wrote:

> this is not working
>
> /^(\#.+)$/g
>
> I have tried the preg_match function
>
> -
> Regards
> Saeed Ahmed
> http://saeed05.wordpress.com
> -
>
>
> On Thu, Apr 22, 2010 at 11:39 PM, Ashley Sheridan
> wrote:
>
> >  On Thu, 2010-04-22 at 23:41 +0600, saeed ahmed wrote:
> >
> > hello friend,
> >
> > I have a string like below
> > "
> >
> > ===Pronunciation===
> > * {{enPR|tē}}, {{IPA|/tiː/}}, {{SAMPA|/ti:/}}
> > * {{audio|en-us-tea.ogg|Audio (US)}}
> > * {{audio|En-uk-tea.ogg|Audio (UK)}}
> > *: {{rhymes|iː}}
> > * {{homophones|T|te|tee|ti}}
> >
> >
> > # {{uncountable}} The dried leaves or buds of the [[tea plant]],
> > ''[[w:Camellia sinensis|Camellia sinensis]]''.
> > #: ''Go to the supermarket and buy some '''tea'''.''
> > # {{uncountable}} The drink made by [[infuse|infusing]] these dried
> > leaves or buds in hot water.
> > Usage notes
> > In the [[United Kingdom]], [[Canada]], other English speaking
> > [[Commonwealth]] countries, and in northern areas of the [[United
> > States]], ''tea'' is assumed to mean [[hot]] tea and is usually served
> > in a [[teapot]] with separate [[cup]]s, or sometimes served directly
> > in cups such as for large groups or for [[takeout]].
> >
> > In southern areas of the United States, ''tea'' is assumed to mean
> > [[iced tea]] and is usually served with ice, either in a [[pitcher]]
> > with separate [[glass]]es or directly in glasses.
> >
> > Strictly speaking, "tea" has been reserved for [[infusion]]s made from
> > leaves of ''[[w:Camellia sinensis|Camellia sinensis]]''. Infusions
> > made from other [[herb]]s such as [[rooibos]], [[mint]]{{,}} and
> > [[chamomile]] are called [[tisane]]s. In recent years the word "tea"
> > has been extended to include the herbal infusions.
> >
> > Synonyms
> > * {{italbrac-colon|dried leaves of tea plant}} [[tea leaves]]
> > * {{italbrac-colon|drink made by infusing parts of various other
> > plants}} [[herb tea]], [[herbal tea]], [[infusion]], [[tisane]]
> >
> > Derived terms
> >
> > "
> >
> > now I want to collect only the string which are start with '#'. how
> > can I do this? please suggest me.
> >
> >
> > -
> > Regards
> > Saeed Ahmedhttp://saeed05.wordpress.com
> > -
> >
> >
> > If the text is in a file, use file() to read the contents into an array
> and
> > then check the first character.
> >
> > Alternatively, if the text is in a string, you could use a regex to pull
> > out only matching lines. This is an untested regex, but it should do the
> > trick:
> >
> > /^(\#.+)$/g
> >
> >   Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >
>


Re: [PHP] collect string from string

2010-04-22 Thread Ashley Sheridan
On Fri, 2010-04-23 at 02:38 +0600, saeed ahmed wrote:

> this is not working
> 
> /^(\#.+)$/g
> 
> I have tried the preg_match function
> 
> -
> Regards
> Saeed Ahmed
> http://saeed05.wordpress.com
> -
> 
> 
> On Thu, Apr 22, 2010 at 11:39 PM, Ashley Sheridan
> wrote:
> 
> >  On Thu, 2010-04-22 at 23:41 +0600, saeed ahmed wrote:
> >
> > hello friend,
> >
> > I have a string like below
> > "
> >
> > ===Pronunciation===
> > * {{enPR|tē}}, {{IPA|/tiː/}}, {{SAMPA|/ti:/}}
> > * {{audio|en-us-tea.ogg|Audio (US)}}
> > * {{audio|En-uk-tea.ogg|Audio (UK)}}
> > *: {{rhymes|iː}}
> > * {{homophones|T|te|tee|ti}}
> >
> >
> > # {{uncountable}} The dried leaves or buds of the [[tea plant]],
> > ''[[w:Camellia sinensis|Camellia sinensis]]''.
> > #: ''Go to the supermarket and buy some '''tea'''.''
> > # {{uncountable}} The drink made by [[infuse|infusing]] these dried
> > leaves or buds in hot water.
> > Usage notes
> > In the [[United Kingdom]], [[Canada]], other English speaking
> > [[Commonwealth]] countries, and in northern areas of the [[United
> > States]], ''tea'' is assumed to mean [[hot]] tea and is usually served
> > in a [[teapot]] with separate [[cup]]s, or sometimes served directly
> > in cups such as for large groups or for [[takeout]].
> >
> > In southern areas of the United States, ''tea'' is assumed to mean
> > [[iced tea]] and is usually served with ice, either in a [[pitcher]]
> > with separate [[glass]]es or directly in glasses.
> >
> > Strictly speaking, "tea" has been reserved for [[infusion]]s made from
> > leaves of ''[[w:Camellia sinensis|Camellia sinensis]]''. Infusions
> > made from other [[herb]]s such as [[rooibos]], [[mint]]{{,}} and
> > [[chamomile]] are called [[tisane]]s. In recent years the word "tea"
> > has been extended to include the herbal infusions.
> >
> > Synonyms
> > * {{italbrac-colon|dried leaves of tea plant}} [[tea leaves]]
> > * {{italbrac-colon|drink made by infusing parts of various other
> > plants}} [[herb tea]], [[herbal tea]], [[infusion]], [[tisane]]
> >
> > Derived terms
> >
> > "
> >
> > now I want to collect only the string which are start with '#'. how
> > can I do this? please suggest me.
> >
> >
> > -
> > Regards
> > Saeed Ahmedhttp://saeed05.wordpress.com
> > -
> >
> >
> > If the text is in a file, use file() to read the contents into an array and
> > then check the first character.
> >
> > Alternatively, if the text is in a string, you could use a regex to pull
> > out only matching lines. This is an untested regex, but it should do the
> > trick:
> >
> > /^(\#.+)$/g
> >
> >   Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >


Do you have a bit more information other than 'not working'. Are you
receiving an error of some kind? I'm assuming your data is in a string
variable if you're using preg_match() yes?

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] collect string from string

2010-04-22 Thread Ashley Sheridan
On Fri, 2010-04-23 at 00:44 +0200, Michiel Sikma wrote:

> You need to use the multiline modifier.
> 
> Try this:
> preg_match_all("/^(\#.*)/im", $my_string, $matches);
> print_r($matches);
> 
> The result:
> 
> Array
> (
> [0] => Array
> (
> [0] => # {{uncountable}} The dried leaves or buds of the [[tea
> plant]],
> [1] => #: ''Go to the supermarket and buy some '''tea'''.''
> [2] => # {{uncountable}} The drink made by [[infuse|infusing]]
> these dried
> )
> 
> [1] => Array
> (
> [0] => # {{uncountable}} The dried leaves or buds of the [[tea
> plant]],
> [1] => #: ''Go to the supermarket and buy some '''tea'''.''
> [2] => # {{uncountable}} The drink made by [[infuse|infusing]]
> these dried
> )
> 
> )
> 
> Michiel
> 
> On 22 April 2010 22:38, saeed ahmed  wrote:
> 
> > this is not working
> >
> > /^(\#.+)$/g
> >
> > I have tried the preg_match function
> >
> > -
> > Regards
> > Saeed Ahmed
> > http://saeed05.wordpress.com
> > -
> >
> >
> > On Thu, Apr 22, 2010 at 11:39 PM, Ashley Sheridan
> > wrote:
> >
> > >  On Thu, 2010-04-22 at 23:41 +0600, saeed ahmed wrote:
> > >
> > > hello friend,
> > >
> > > I have a string like below
> > > "
> > >
> > > ===Pronunciation===
> > > * {{enPR|tē}}, {{IPA|/tiː/}}, {{SAMPA|/ti:/}}
> > > * {{audio|en-us-tea.ogg|Audio (US)}}
> > > * {{audio|En-uk-tea.ogg|Audio (UK)}}
> > > *: {{rhymes|iː}}
> > > * {{homophones|T|te|tee|ti}}
> > >
> > >
> > > # {{uncountable}} The dried leaves or buds of the [[tea plant]],
> > > ''[[w:Camellia sinensis|Camellia sinensis]]''.
> > > #: ''Go to the supermarket and buy some '''tea'''.''
> > > # {{uncountable}} The drink made by [[infuse|infusing]] these dried
> > > leaves or buds in hot water.
> > > Usage notes
> > > In the [[United Kingdom]], [[Canada]], other English speaking
> > > [[Commonwealth]] countries, and in northern areas of the [[United
> > > States]], ''tea'' is assumed to mean [[hot]] tea and is usually served
> > > in a [[teapot]] with separate [[cup]]s, or sometimes served directly
> > > in cups such as for large groups or for [[takeout]].
> > >
> > > In southern areas of the United States, ''tea'' is assumed to mean
> > > [[iced tea]] and is usually served with ice, either in a [[pitcher]]
> > > with separate [[glass]]es or directly in glasses.
> > >
> > > Strictly speaking, "tea" has been reserved for [[infusion]]s made from
> > > leaves of ''[[w:Camellia sinensis|Camellia sinensis]]''. Infusions
> > > made from other [[herb]]s such as [[rooibos]], [[mint]]{{,}} and
> > > [[chamomile]] are called [[tisane]]s. In recent years the word "tea"
> > > has been extended to include the herbal infusions.
> > >
> > > Synonyms
> > > * {{italbrac-colon|dried leaves of tea plant}} [[tea leaves]]
> > > * {{italbrac-colon|drink made by infusing parts of various other
> > > plants}} [[herb tea]], [[herbal tea]], [[infusion]], [[tisane]]
> > >
> > > Derived terms
> > >
> > > "
> > >
> > > now I want to collect only the string which are start with '#'. how
> > > can I do this? please suggest me.
> > >
> > >
> > > -
> > > Regards
> > > Saeed Ahmedhttp://saeed05.wordpress.com
> > > -
> > >
> > >
> > > If the text is in a file, use file() to read the contents into an array
> > and
> > > then check the first character.
> > >
> > > Alternatively, if the text is in a string, you could use a regex to pull
> > > out only matching lines. This is an untested regex, but it should do the
> > > trick:
> > >
> > > /^(\#.+)$/g
> > >
> > >   Thanks,
> > > Ash
> > > http://www.ashleysheridan.co.uk
> > >
> > >
> > >
> >


Ah, ignore my last reply then! I used the g modifier, forgetting it
wasn't the multi-line one in PHP!

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] collect string from string

2010-04-22 Thread saeed ahmed
yes I have used preg_match_all and preg_match. now its working.  thanks a
lot guys

-
Regards
Saeed Ahmed
http://saeed05.wordpress.com
-


On Fri, Apr 23, 2010 at 4:40 AM, Ashley Sheridan
wrote:

>  On Fri, 2010-04-23 at 02:38 +0600, saeed ahmed wrote:
>
>
> this is not working
>
> /^(\#.+)$/g
>
> I have tried the preg_match function
>
> -
> Regards
> Saeed Ahmedhttp://saeed05.wordpress.com
> -
>
>
> On Thu, Apr 22, 2010 at 11:39 PM, Ashley Sheridan
> 
> wrote:
>
> >  On Thu, 2010-04-22 at 23:41 +0600, saeed ahmed wrote:
> >
> > hello friend,
> >
> > I have a string like below
> > "
> >
> > ===Pronunciation===
> > * {{enPR|tē}}, {{IPA|/tiː/}}, {{SAMPA|/ti:/}}
> > * {{audio|en-us-tea.ogg|Audio (US)}}
> > * {{audio|En-uk-tea.ogg|Audio (UK)}}
> > *: {{rhymes|iː}}
> > * {{homophones|T|te|tee|ti}}
> >
> >
> > # {{uncountable}} The dried leaves or buds of the [[tea plant]],
> > ''[[w:Camellia sinensis|Camellia sinensis]]''.
> > #: ''Go to the supermarket and buy some '''tea'''.''
> > # {{uncountable}} The drink made by [[infuse|infusing]] these dried
> > leaves or buds in hot water.
> > Usage notes
> > In the [[United Kingdom]], [[Canada]], other English speaking
> > [[Commonwealth]] countries, and in northern areas of the [[United
> > States]], ''tea'' is assumed to mean [[hot]] tea and is usually served
> > in a [[teapot]] with separate [[cup]]s, or sometimes served directly
> > in cups such as for large groups or for [[takeout]].
> >
> > In southern areas of the United States, ''tea'' is assumed to mean
> > [[iced tea]] and is usually served with ice, either in a [[pitcher]]
> > with separate [[glass]]es or directly in glasses.
> >
> > Strictly speaking, "tea" has been reserved for [[infusion]]s made from
> > leaves of ''[[w:Camellia sinensis|Camellia sinensis]]''. Infusions
> > made from other [[herb]]s such as [[rooibos]], [[mint]]{{,}} and
> > [[chamomile]] are called [[tisane]]s. In recent years the word "tea"
> > has been extended to include the herbal infusions.
> >
> > Synonyms
> > * {{italbrac-colon|dried leaves of tea plant}} [[tea leaves]]
> > * {{italbrac-colon|drink made by infusing parts of various other
> > plants}} [[herb tea]], [[herbal tea]], [[infusion]], [[tisane]]
> >
> > Derived terms
> >
> > "
> >
> > now I want to collect only the string which are start with '#'. how
> > can I do this? please suggest me.
> >
> >
> > -
> > Regards
> > Saeed Ahmedhttp://saeed05.wordpress.com
>
> > -
> >
> >
> > If the text is in a file, use file() to read the contents into an array and
> > then check the first character.
> >
> > Alternatively, if the text is in a string, you could use a regex to pull
> > out only matching lines. This is an untested regex, but it should do the
> > trick:
> >
> > /^(\#.+)$/g
> >
> >   Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >
>
>
> Do you have a bit more information other than 'not working'. Are you
> receiving an error of some kind? I'm assuming your data is in a string
> variable if you're using preg_match() yes?
>
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


Re: [PHP] collect string from string

2010-04-22 Thread Michiel Sikma
On 23 April 2010 00:42, Ashley Sheridan  wrote:

>  On Fri, 2010-04-23 at 00:44 +0200, Michiel Sikma wrote:
>
-snip-

> Ah, ignore my last reply then! I used the g modifier, forgetting it wasn't
> the multi-line one in PHP!
>
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
It's the global modifier in other implementations (JS, Perl, Java, etc), but
it doesn't quite work like the multiline modifier in those implementations
either. The effect of having it is like the difference between PHP's
preg_match() and preg_match_all(). That's why PHP actually doesn't have a g
modifier.

Michiel


[PHP] Re: Replace a space with a newline every 2 spaces

2010-04-22 Thread Lupus Michaelis

Le 22/04/2010 19:29, Paul Halliday a écrit :


I found some long functions to achieve this but I couldn't help but
think that it could be done in a couple lines.

Possible?


http://us.php.net/manual/en/function.wordwrap.php

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

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



RE: [PHP] Updating cli executable on MS-Windows

2010-04-22 Thread Bob McConnell
From: Richard Quadling
> On 22 April 2010 14:42, Bob McConnell  wrote:
>> I downloaded the MS-Windows cli from The PHP Group a while ago. It
>> claims to be version 5.2.10. But now I can't find where I got it, nor
>> where to get the updates. What is the easiest way to upgrade it to
>> 5.2.13?
>>
>>  D:\Code\Tests>php --version
>>  PHP 5.2.10 (cli) (built: Jun 17 2009 16:16:57)
>>  Copyright (c) 1997-2009 The PHP Group
>>  Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
>>
>> Bob McConnell
> 
> You can get the latest V5.2.x from http://windows.php.net/download/

Which one has just the cli installer? I don't want any server files installed 
on my workstation.

Bob McConnell

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