[PHP] From Cold Fusion back to PHP...

2001-01-17 Thread W Luke

Hi,

I started PHP in 1999, and wrote just one Web Site based on it. I started to
have a good feel for it and found it easy to implement, as well as it being
powerful. Shortly after that though, I was given the opportunity to learn
Cold Fusion, and haven't looked back since today.

I've got a possible contrat that I'm interested in taking on, in PHP and
MySql. What I would like to discuss with everyone, (it might more relevant
to past or current CF programmers - I apologise if it's a litte OT), is the
best way to get back into PHP from CF?

When I got into CF, I found it so much easier than PHP - I loved
Datasources, as they are so simple to connect to the database. Just give it
a name and - bingo. I also found it so much easier, and quicker, coming up
with code for querying and retrieving data from DBs, and displaying it in a
Table. And combining it with HTML is a dream, when with PHP I found I was
getting errors, and horrible ugly Tables.

Are my fears in "re-learning" PHP well founded - or might my experience in
Cold Fusion have helped?

I'd be really interested to hear your comments.

Will


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] From Cold Fusion back to PHP...

2001-01-17 Thread W Luke


> Hello, I'am a french CF developper and I've just started to dev in PHP.
> You're right! Cold fusion is much easier than PHP but I think it's just a
> question of "experience".

That's one reason yeah.  But aside from all the advanages of PHP, it seems a
task that would take one step in Cold Fusion takes two in PHP.

> It's true, cold fusion is easier but it's due (partialy) to Cold fusion
> studio. The Allaire Editor simplifies the work of the developer.

That's true - it's a great tool.  The best feature though is the embedded
documentation.  I wonder when or if there will be such a tool for PHP?

Will

--
[EMAIL PROTECTED] -=- www.lukrative.com
Classifieds -=- www.localbounty.com



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Weighted Lists

2005-02-09 Thread W Luke
Hi,

I've been fascinated by Flickr's, del.icio.us and other sites' usage
of these Weighted Lists.  It's simple but effective and I really want
to use it for a project I'm doing.

So I had a look at Nick Olejniczak's plugin for Wordpress (available
here: www.nicholasjon.com) but am struggling to understand the logic
behind it.

What I need is to dump all words (taken from the DB) from just one
column into an array.  Filter out common words
(the,a,it,at,you,me,he,she etc), then calculate most frequent words to
provide the weighted list.  Has anyone attempted this?

Thanks for any insights

-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



Re: [PHP] Re: Weighted Lists

2005-02-10 Thread W Luke
On Wed, 09 Feb 2005 10:56:51 -0800 (PST), Matthew Weier O'Phinney
<[EMAIL PROTECTED]> wrote:
> * W Luke <[EMAIL PROTECTED]>:
> > I've been fascinated by Flickr's, del.icio.us and other sites' usage
> > of these Weighted Lists.  It's simple but effective and I really want
> > to use it for a project I'm doing.
> >
> > So I had a look at Nick Olejniczak's plugin for Wordpress (available
> > here: www.nicholasjon.com) but am struggling to understand the logic
> > behind it.
> >
> > What I need is to dump all words (taken from the DB) from just one
> > column into an array.  Filter out common words
> > (the,a,it,at,you,me,he,she etc), then calculate most frequent words to
> > provide the weighted list.  Has anyone attempted this?
> 
> Funny you should mention this -- I'm working on something like this
> right now for work.
> 
> Basically, you need to:
> 
> * define a list of common words to skip
> * define weighting (I weight items in a title and in text differently,
>   for instance -- usually you weight by which field you're using); store
>   weighting in an associative array
> * define a weights array (associative array of word => score)
> * separate all text from the column into words (build a words array)
> * loop over the words array
>   * skip if the word is a common word
>   * increment word element in weights array by the weight
> 
> The sticky issues are: what is a word (you'll need to build a regexp for
> that), and how will you weight words (usually by field). Once you have
> all this, you populate a database table for use as a reverse lookup.

Thanks Matthew - a similar logic to what I'm using, although mine (so
far) is a little clunky.  I might ping you later on today if that's
ok, to talk a bit more and share notes.

Regards,
-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



[PHP] Replacing spaces with commas

2005-04-17 Thread W Luke
Hi,

I have about 200 records in a table, and I need to update 2 of the
fields.  The first is easy, but the second contains a list of keywords
all separated by spaces; I need to replace the spaces with commas.  Is
this something I can do with some clever SQL, or shall I just do it in
PHP?

Any ideas appreciated

Cheers,
-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



Re: [PHP] Replacing spaces with commas

2005-04-17 Thread W Luke
On 4/17/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> > I have about 200 records in a table, and I need to update 2 of the
> > fields.  The first is easy, but the second contains a list of keywords
> > all separated by spaces; I need to replace the spaces with commas.  Is
> > this something I can do with some clever SQL, or shall I just do it in
> > PHP?
> 
> Well I have not used this function, but it looks like it would do what
> you want (this is from MySQL):
> 
> REPLACE(str,from_str,to_str)

Now why didn't I think of that?  Easy as pie - thanks Tom, working
like a charm...
-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



[PHP] Regex nightmares

2005-05-23 Thread W Luke
Hi,

I really struggle with regex, and would appreciate some guidance. 
Basically, I have a whole load of files (HTML) which are updated every
few minutes.  I need to go through each line, looking for the word
CONFIRMED: (which is always in capitals, and always superseded by a
colon).  The line looks like this:

22.5 J.Smith at Thropton, CONFIRMED: more text here, including commas
and info on the appointment etc

There are other similar appointments that haven't yet been confirmed,
so..I just need to pick out the confirmed ones.  Once the regex finds
"CONFIRMED:" I also need it to grab the text up to and including the
date (22.5).  I don't really need any text *after* "CONFIRMED:" yet,
but possible in the future.

There seem to be a lot of tutorials on, eg, getting hrefs from anchor
tags, but I can't get my head around this particular one.  Any ideas
or pointers would be great

Cheers

Will

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



[PHP] Using SELECT IN with arrays

2005-02-02 Thread W Luke
Hi.

I'm trying to execute a query which does a SELECT IN on an
array...here's how it stands:

$doms = implode( "','", $domarray );

$d=$_GET['d']

$qmailsql = "SELECT mq.id,
mq.user,
mq.domain,
mq.sender,
mq.arrive_time,
mq.subject,
mq.body_preview,
mq.relay
FROM mail_quarantine AS mq
WHERE  //??
ORDER BY mq.arrive_time DESC LIMIT 50";

$doms is a "master array" of a user's domains.  $d is a
comma-seperated and unexploded list of domains to filter the SELECT
down with.  (error checking is already in place)

So basically I need to find *all* domains in $d (dom1.com,dom2.net)
which appear in $doms, then extract all the other info
(mq.user,mq.sender etc).

I've spent all day trying to work it out, but I think my *logic* is
wrong...any ideas much appreciated

Thanks
-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



Re: [PHP] Using SELECT IN with arrays

2005-02-02 Thread W Luke
On Thu, 3 Feb 2005 08:37:44 +0800, Jason Wong <[EMAIL PROTECTED]> wrote:

> > $doms is a "master array" of a user's domains.  $d is a
> > comma-seperated and unexploded list of domains to filter the SELECT
> > down with.  (error checking is already in place)
> 
> 1) make both $d and $doms into array
> 2) use array_intersect() to find the $d's that match $doms
> 3) convert the matches into a comma separated string with single quotes around
> the individual values
> 4) SELECT blah WHERE domain IN(comma separated string with single quotes
> around the individual values)

Wicked - thanks Jason

-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



[PHP] Escaping using htmlentities

2005-02-03 Thread W Luke
Hi.

htmlentities has worked pretty well so far for me...except when it
comes across something like "ñw" or "ñ0w" in an RSS feed (v2)

It tries to convert the ñ - and it does, but because the ñ
doesn't have a space next to the w or the 0w, it breaks the XML and it
comes out as ñ0w which, I think, is "bad XML"

I thought ampersands were my biggest worry, but this has got me really
stumped!  I'm not even sure if I'm *right* in thinking the problem is
the lack of spaces between the "special" characters.  Can anyone shed
any light on this?

Thanks

-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



Re: [PHP] newbie question regarding forms and drop down list

2005-02-03 Thread W Luke
On Thu, 3 Feb 2005 15:45:51 -0800, Max Krone <[EMAIL PROTECTED]> wrote:

> I assume I am just missing something dumb. Could someone please
> enlighten me. I can post my code if it will help.

Code please, Max!

-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



[PHP] Replacing 2 strings

2005-05-29 Thread W Luke
Hi,

I have some text in a file which, when it's dumped to a var, needs to
be replaced.  In its raw form, it looks like this: <^JIM_JONES> and I
need to remove the <^_ and > characters and have it read "Jim-Jones"

It's nestled in amongst a load of other text - I'm fopen'ing a file
and reading it line by line - the text-to-replace is just in a var
named $text1

Any ideas would be great

Will

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



Re: [PHP] Replacing 2 strings

2005-05-30 Thread W Luke
On 30/05/05, Brian V Bonini <[EMAIL PROTECTED]> wrote:
> On Sun, 2005-05-29 at 12:22, W Luke wrote:
> > Hi,
> >
> > I have some text in a file which, when it's dumped to a var, needs to
> > be replaced.  In its raw form, it looks like this: <^JIM_JONES> and I
> > need to remove the <^_ and > characters and have it read "Jim-Jones"
> >
> > It's nestled in amongst a load of other text - I'm fopen'ing a file
> > and reading it line by line - the text-to-replace is just in a var
> > named $text1

> Someone much more clever that I can probably come up with something much
> cleaner and efficient but This works...

Thanks Brian, that worked a treat.  Altered it slightly, but
essentially it was just what I needed.

Lifesaver, thanks.
-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



Re: [PHP] Replacing 2 strings

2005-05-30 Thread W Luke
On 30/05/05, Brian V Bonini <[EMAIL PROTECTED]> wrote:
> On Mon, 2005-05-30 at 11:13, Murray @ PlanetThoughtful wrote:
> > > Someone much more clever that I can probably come up with something much
> > > cleaner and efficient but This works...
> >
> > Definitely not more clever and arguably not more efficient, but a different
> > way of handling this might be:
> >
> >  >
> > function replace($string){
> >   $string = preg_replace("/(<|\^|>)/", "",$string);
> >   $string = str_replace("_", " ", $string);
> >   $string = ucwords(strtolower($string));
> >   $string = str_replace(" ", "-", $string);
> >   return $string;
> > }
> >
> > echo replace("<^JIM_JONES>");
> >
> > ?>
> 
> AHHH! ucwords(); I probably looked right at it a million times.. I knew
> there had to be something to do that

This is a great help, thanks to both.  One question I have though. 
How do I just leave the formatting "as is"?  In the loop you gave me,
Brian...:

   foreach($pieces as $char) {
   $first_letter[] = $char{0};
   $remainder[] = strtolower(substr($char, 1));
   }

   $result = array_merge($first_letter, $remainder);
   list($frstltr,$lstltr,$frstwrd,$lstwrd) = $result;
   $string = $frstltr . $frstwrd . " v " . $lstltr . $lstwrd;
  
return $string;
   }

I can't see how I can disregard strtolower without disrupting the rest
of the function!  My problem is $string contains a whole load of text,
the formatting of which needs to be retained...

-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



Re: [PHP] Replacing 2 strings

2005-05-30 Thread W Luke
On 30/05/05, Brian V Bonini <[EMAIL PROTECTED]> wrote:

[...]

> > Again, an example that is as close to your real-world needs as possible
> > would be very helpful.
> 
> The original request was: "the text-to-replace is just in a var named
> $text1".
> 
> I read that to mean you'd already extracted "<^JIM_JONES>" into $text1

Sorry - my mistake/fault.  $text1 always begins with <^JIM_JONES> by
is followed by various other stuff:

<^JIM_JONES> Leicester, 1720.  Oxford, 1800 CONFIRMED: meeting at 19.10

And I'd like it to read, simply, JIM JONES: (I think having the name
in Caps would be best for now) and leave the rest of the text
unaltered:

JIM JONES: Leicester, 1720.  Oxford, 1800 CONFIRMED: meeting at 19.10

Things like "Leicester" need to be capitalised, and CONFIRMED needs to
be in caps, so...hope this explains things a bit better.  And if
you're both too busy, no problem!

Thanks,
-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



Re: [PHP] Replacing 2 strings

2005-05-31 Thread W Luke
On 31/05/05, Murray @ PlanetThoughtful <[EMAIL PROTECTED]> wrote:
> >  >
> > function replace($string){
> >   preg_match("/^<\^([a-zA-Z]+?)_([a-zA-Z]+?)>/", $string, $matcharr);
> >   $string = str_replace($matcharr[0], $matcharr[1] . " " .$matcharr[2]
> > . ":", $string);
> >   return $string;
> >
> > }
> >
> > $string = "<^JIM_JONES> Leicester, 1720.  Oxford, 1800 CONFIRMED: meeting
> > at
> > 19.10";
> > echo replace($string);
> >
> > ?>
> >
> > One of the small benefits of this solution is that Will doesn't need to
> > know
> > what is contained in the target substring beforehand.
> 
> I should get into the habit of listing the assumptions my code makes.
> 
> In the above example, the following assumptions are present:
> 
> - The target substring (in this example, "<^JIM_JONES>") must *always*
> appear at the beginning of the string for the function to perform its task
> 
> - The target substring will *always* begin with "<^", will feature a "_"
> between the two name elements, and will conclude with ">"
> 
> - There will only be two name elements within the target substring (ie will
> match "<^JIM_JONES>" and "<^MARY_BETH>" but will not match "<^JIM>" or
> "<^MARY_BETH_JONES>")
> 
> - The function will only replace the first incidence of the target
> substring. In the eventuality that the target substring value appears
> multiple times in the string being processed, all other instances will be
> left unchanged.
> 
> - All other contents of the string being processed can vary without impact
> on the function.

Thanks Murray, and Brian - both excellent and I'm really grateful for
the help!  Clueless when it comes to these types of problems, so
thanks very much,

-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



Re: [PHP] Replacing 2 strings

2005-06-01 Thread W Luke
On 31/05/05, W Luke <[EMAIL PROTECTED]> wrote:
> On 31/05/05, Murray @ PlanetThoughtful <[EMAIL PROTECTED]> wrote:
> > >  > >
> > > function replace($string){
> > >   preg_match("/^<\^([a-zA-Z]+?)_([a-zA-Z]+?)>/", $string, $matcharr);
> > >   $string = str_replace($matcharr[0], $matcharr[1] . " " .$matcharr[2]
> > > . ":", $string);
> > >   return $string;
> > >
> > > }
> > >
> > > $string = "<^JIM_JONES> Leicester, 1720.  Oxford, 1800 CONFIRMED: meeting
> > > at
> > > 19.10";
> > > echo replace($string);
> > >
> > > ?>
> > >
> > > One of the small benefits of this solution is that Will doesn't need to
> > > know
> > > what is contained in the target substring beforehand.
> >
> > I should get into the habit of listing the assumptions my code makes.
> >
> > In the above example, the following assumptions are present:
> >
> > - The target substring (in this example, "<^JIM_JONES>") must *always*
> > appear at the beginning of the string for the function to perform its task
> >
> > - The target substring will *always* begin with "<^", will feature a "_"
> > between the two name elements, and will conclude with ">"
> >
> > - There will only be two name elements within the target substring (ie will
> > match "<^JIM_JONES>" and "<^MARY_BETH>" but will not match "<^JIM>" or
> > "<^MARY_BETH_JONES>")
> >
> > - The function will only replace the first incidence of the target
> > substring. In the eventuality that the target substring value appears
> > multiple times in the string being processed, all other instances will be
> > left unchanged.
> >
> > - All other contents of the string being processed can vary without impact
> > on the function.
> 
> Thanks Murray, and Brian - both excellent and I'm really grateful for
> the help!  Clueless when it comes to these types of problems, so
> thanks very much,

One more question, then I'll leave you alone - promise!  How simple
would it be to split the two names into 2 vars ($n1 $n2)?
-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



[PHP] Group By problems

2005-07-03 Thread W Luke
Hi,

I used to have problems with this in Cold Fusion - and I'm still
struggling this time in PHP!

Very basic.  Looping over 2 tables - an email table, and a data-table.
 I'm using * just for ease for the time being:

SELECT * FROM f_c_users,f_comments WHERE fcEmail=cemail GROUP by fcEmail

If there are more than one records in the data table *per* email, then
I want to group them into one email per user.  Instead of sending
10/20/100 emails per person for each record in the data-table.  So I
just want to collate everyone's data into one email.

Any thoughts welcome!

Cheers

-- 
Will   
-- The Corridor of Uncertainty --
-- http://www.cricket.mailliw.com/

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