[PHP] Re: php-general Digest 20 Sep 2013 17:33:26 -0000 Issue 8369

2013-09-20 Thread Bill Guion

On Sep 20, 2013, at 1:33 PM, php-general-digest-h...@lists.php.net wrote:

 Friday's Question
   322111 by: Tedd Sperling
 --
 
 From: Tedd Sperling t...@sperling.com
 Subject: Friday's Question
 Date: September 20, 2013 12:51:49 PM EDT
 To: php-general@lists.php.net
 
 
 Hi gang:
 
 Do you use a Mousepad?
 
 My reason for asking is that I've used a Mousepad ever since mice first came 
 out (back when they had one ball).
 
 Now that mice are optical (no balls), Mousepads are not really needed -- or 
 so I'll told by the college -- you see, they don't provide Mousepads for 
 their student's computers.
 
 As such, I wondered what's the percentage of programmers still using a 
 Mousepad?
 
 Secondly, are Mousepads used primarily by older programmers (like me) while 
 younger programmers don't use Mousepads, or what?
 
 So -- please respond with:
 
 Age: *
 Mousepad: Yes/No
 
 Thank you,
 
 tedd
 
 PS: * If you don't want to provide your actual age, then indicate your age by 
 stating young, middle-age, old-age, ancient, or whatever term 
 describes your age.
 
 Alternate -- I claim that you can tell a man's age by ten-times the number of 
 personal products he routinely uses, for example:
 
 Years Old - Personal Products
 10Toothpaste
 20Toothpaste, Deodorant
 30Toothpaste, Deodorant, Aftershave
 40Toothpaste, Deodorant, Aftershave, Minoxidil
 50Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H
 60Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag Bomb
 70Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag Bomb, 
 Fixodent
 
 So, you could indicate age by stating Bag Bomb like me.
 
 ___
 tedd sperling
 t...@sperling.com


Age: 72 years, 7 days  toothpaste, deodorant, aftershave. Don't need the rest, 
yet.
Mousepad: Yes. I find it easier to clean the mousepad than to try to clean the 
keyboard tray/desktop/whatever.


 -= Bill =-
-- 

A day without sunshine is like a day in Seattle.



[PHP] Re: Seeking a scheduling algorithm

2012-07-14 Thread Bill Guion
On Jul 14, 2012, at 4:53 PM, php-general-digest-h...@lists.php.net wrote:

 From: Tedd Sperling t...@sperling.com
 Subject: Seeking a scheduling algorithm
 Date: July 14, 2012 4:53:15 PM EDT
 To: php-general@lists.php.net
 
 
 Hi gang:
 
 Does anyone have a resource, or better yet code, to solve the scheduling 
 problem described below?
 
 Let's say you have a week calendar that has openings between 8:00am to 5:00pm 
 for Monday through Friday (40 hours).
 
 Then you have an assortment of appointments that must be scheduled into the 
 week calendar. Some of the appointments are simply a one hour per week, while 
 others may be two, three, four, or five times per week and each appointment 
 for an hour or more (up to eight hours).
 
 The problem is, knowing what appointments (i.e., twice a week for 2 hours, 
 three times a week for one hour, etc.) must be scheduled for the week, what 
 is the most efficient way to schedule these appointments into that week?
 
 The most efficient way is defined as scheduling appointments with little, or 
 no, gaps in between appointments. For example, four one-hour appointments on 
 Monday between 8:00am to 12:00pm is better than four one-hour appointments 
 spread out between 8:00am to 5:00pm.
 
 Anyone have any solutions, ideas, resources, code?
 
 Thanks,
 
 tedd
 
 _
 t...@sperling.com
 http://sperling.com
 


Tedd,

There is an old general rule that the most time efficient way to schedule is to 
put the big time requests on the schedule first. In this case, that would 
mean schedule all five times a week requests first, then the four times a week, 
then the three times a week. The two hour requests should be scheduled next: 
three times a week and twice a week can be scheduled at the same time. Then 
fill in the rest with the one hour requests.

Hope that makes sense.

 -= Bill =-
-- 

A closed mouth gathers no feet.



Re: Re: [PHP] Round with money_format

2011-09-17 Thread Bill Guion
On Sep 17, 2011, at 3:46 AM, Cyril Lopez wrote:

 From: Cyril Lopez cy...@nethik.fr
 Date: September 16, 2011 10:58:28 AM EDT
 To: php-general@lists.php.net
 Subject: Round with money_format
 
 Hi,
 
 Can someone help me understand how money_format() rounds numbers ?
 
 ?php
 setlocale(LC_ALL, 'fr_FR.UTF-8');
 $price = 12.665;
 echo money_format('%i',$price);
 // 12.66 EUR, 12.67 EUR expected
 
 $price2 = 12.666;
 echo money_format('%i',$price2);
 // 12.67 EUR, ok
 
 echo round($price,2);
 // 12.67, ok
 echo round($price2,2);
 // 12.67, ok
 ?
 
 Misconfiguration ? Bug ?
 Thanks !
 
 Cyril
 
 Config :
 Debian Lenny, PHP 5.3.8

As someone else pointed out, rounding rules vary by locale, but I was taught 
40+ years ago in graduate school programming class, 4 rounds down, 6 rounds up, 
and 5 rounds to the even number. This means 65 rounds to 6, while 75 rounds to 
8. Your example seems to follow that rule.

 -= Bill =-
-- 

Virtuous action will never go unpunished.


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



Re: [PHP] Newbie Question

2011-01-06 Thread Bill Guion

At 11:37 AM -0500 01/06/11, tedd wrote:


At 8:16 PM -0500 1/5/11, Daniel Brown wrote:
On Wed, Jan 5, 2011 at 19:45, David Harkness 
davi...@highgearmedia.com wrote:

[snip!]


 Most companies will gladly give their product away to put it in 
the hands of soon-to-be-professionals. :)


Tedd had his chance to be professional back in the forties (the
eighteen-forties, I believe).  Now he teaches others who still have a
chance.  ;-P

Which reminds me of an old thread from back in 2008, where I
posted Tedd's senior class picture.  You can see it here:

http://links.parasane.net/tb46


Again, you got it wrong, o' wise one -- that's a picture of my son's 
senior class.


I'm the one on the left fogging a smart-ass who refused to get out of my


Fogging must be a REAL OLD Fashioned term. Please clarify.

 -= Bill =-


chariot's way.

Boy, those were the good old days when I could flog a smart-ass.

Cheers,

tedd

PS: It's not Friday yet.

--
---
http://sperling.com/



--

Don't find fault. Find a remedy. - Henry Ford
  



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



[PHP] Problem with Include

2010-12-19 Thread Bill Guion
In an effort to clean up some code, I tried taking four lines out of 
6 or 7 programs and putting them into an include file. The file 
structure is


Root
  data
clubs.php
  include
fmt.inc

Originally, clubs.php had the following code:

?PHP
$file_name= basename($_SERVER['PHP_SELF']);
$last_modified = filemtime($file_name);
print(This page last modified );
print(date(m/j/y, $last_modified));

?

This code works - on the web page I get

This page last modified 12/18/2010

which is correct.

So then I did the following:
Create an include file, fmt.inc with the following code:

$file_name= basename($_SERVER['PHP_SELF']);
$last_modified = filemtime($file_name);
print(This page last modified );
print(date(m/j/y, $last_modified));

and then in the original file, I have

?PHP
include ../include/fmt.inc;
?

On my web page, I then get

$file_name= basename($_SERVER['PHP_SELF']);$last_modified = 
filemtime($file_name);print(This page last modified ); 
print(date(m/j/y, $last_modified));


(all on one line).

I would really like to understand why the include construct doesn't 
give the same results as the original?


 -= Bill =-

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



[PHP] Problem with Include

2010-12-19 Thread Bill Guion
Many, many thanks to Tamara, Govinda, and Ashley. Adding the php tags 
?php  ? to the include file solved the problem.


 -= Bill =-

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



Re: [PHP] Quotes vs. Single Quote

2010-08-06 Thread Bill Guion

At 8:31 AM -0400 08/06/10, tedd wrote:


Cheers,

tedd

PS: Considering that this is Friday. I have a grammar question for 
the group. I said above:


neither CSS, PHP, or any web language exist in a vacuum.

Is the word neither appropriate in this sentence?

Normally, two items can be compared by neither  or nor, but what 
about more than two items? Is it appropriate to use neither  or 
nor for more than two items?


Somewhere along the line, probably in college (if it were before 
college, it would have been so long ago I would have forgotten it), a 
professor said to handle this sort of thing thusly:


neither A, nor B, nor C 

A little more wordy, but completely unambiguous.

 -= Bill =-
--

Don't find fault. Find a remedy. - Henry Ford
  



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



Re: [PHP] [site is acting strange] - blank pages, download index.php, or works fine

2010-07-30 Thread Bill Guion

At 6:45 PM -0600 7/29/10, Tristan wrote:


Yeah like i said site works 95% of the time when navigating. PHP5.2, Mysql
5. The site is completely dynamic so it wouldn't work at all if that was the
case of it not being installed right.

so the other 5% of the time is blank pages and download index.php files. In
Firefox when you get a blank page, if you click view source it will show all
the code that should be there but, I can't tell if it's requesting the page
again when you do that. It never fails 2 times in a row. A refresh will
always fix it. When you look in firebug there is no html so it leads me to
believe FF may be doing just that...going for a second request instead of
viewing currently opened source? In IE8 I would get something like

diagnose problem button

more information drop down with

this problem can be caused by a variety of issues..this is a completely
typical M$ error with no valid help



chrome same thing with

web page cannot be displayed

more information etc...





On Thu, Jul 29, 2010 at 6:36 PM, David McGlone da...@dmcentral.net wrote:


 On Thu, 2010-07-29 at 18:11 -0600, Tristan wrote:
  I have the strangest issue with my host. They can't figure it out and I'm
  completely perplexed. We have other sites running on the server just
 fine.
  However, this new site is acting very weird. Sometimes we get blank
 pages,
  sometimes we get a blank page and then a dialog pops up asking if we want
 to
  download index.php, and then sometimes the site is working fine. Any
 ideas
  on this?
 
  I'm at ends. Appreciate any advice. For authentication we are using mysql
  auth module in apache/linux and proxy pass. We removed proxy pass to see
 if
  that was it but, it wasn't. its a members.domain.com subdomain if that
  helps.

 Do you have php-mysql installed?


 --
 Blessings,
 David M.




Does the page validate at http://jigsaw.w3.org/css-validator/?

 -= Bill =-
--

Don't find fault. Find a remedy. - Henry Ford
  



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



[PHP] Re: html analyzer

2010-05-19 Thread Bill Guion

At 12:30 AM +0200 5/19/10, Rene Veerman wrote:


Hi.

I'm trying to build a html analyzer that looks at natural words in html text.

I'd like to build a routine that walks through the HTML character by
character, but i'm not sure on how to properly walk through escaped 
and ' characters in javascript or other embedded languages. Skipping
the first  and ' is no problem, but after that, the escaped  and ',
they can get difficult imo.

If you have any ideas on this i'd like to hear 'm..

--
-
Greetings from Rene7705,

My free open source webcomponents:
  http://code.google.com/u/rene7705/
  http://mediabeez.ws/downloads (and demos)

http://www.facebook.com/rene7705
-


Renee,

I agree with the previous post - what you want to do is non-trivial. 
However, to address your question: one approach is to create a single 
quote flag (sqf) and a double quote flag (dqf). When you encounter 
the first quote, set that flag. When you encounter the second quote 
of the same type, clear the flag. At the end, both flags should be 
clear, or the html is mal-formed. You can also get more sophisticated 
and verify that you do not encounter a single, double, single 
sequence, or a double, single, double sequence. That gets more 
involved by remembering which quote was first, second, and third - 
third should be same as second, for example.


 -= Bill =-
--

Don't find fault. Find a remedy. - Henry Ford
  



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



Re: [PHP] åÐ-¡¨-¼· å|»®-åÉ|ó“-ñ@

2010-05-07 Thread Bill Guion

At 8:26 PM -0400 5/6/10, Robert Cummings wrote:


Ashley Sheridan wrote:

[/snip]

If only I could speak Chinese and was gullible I'd love to take them up
on the offer for whatever it is.

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


My Chinese is a bit rusty, but I think it says, please reply on-list 
to this spam message!


:|

Cheers,
Rob.

:)

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


Boy, its a good thing no one on this list would fall for something like that.

 -= Bill =-
--

Don't find fault. Find a remedy. - Henry Ford
  



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



Re: [PHP] Chrome 1.0 released

2008-12-24 Thread Bill Guion

At 9:30 AM -0500 12/14/08, tedd wrote:


At 3:08 PM -0800 12/13/08, Yeti wrote:

I have to defend poor little IE a little now. It supports XHTML and
CSS2 pretty well so far. And those standards came out a couple of
months ago.


Even a blind pig finds an acorn every once in a while.

Cheers,

tedd


Tedd,

You should apologize to all pigs for that comparison.

 -= Bill =-
--

A conclusion is the place where you get tired of thinking.
  



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



Re: [PHP] Mailing lists

2008-11-03 Thread Bill Guion

At 11:00 AM -0400 11/1/08, tedd wrote:


snip

I used to have a theory that intelligence was inversely proportional 
to latitude. To prove my point, I would direct people to observe the 
Upper Peninsula of Michigan, where phrases like Say ya to da UP, 
eh? were common.


When confronted with an discerning opinion, I would add even more 
evidence by telling them to look further north where pronunciation 
of about and a boot merged -- and thus that would usually win my 
argument.


Now, that I am confronted with such a wide latitude (in both 
meanings) of diverse opinion, I must conclude that intelligence and 
ignorance are both amply distributed all over the globe irrespective 
of one's shortcomings in language skills -- thank God.


Cheers,

tedd



I don't know, tedd. I believe it was my college physics instructor 
who taught us that the two most abundant elements in the universe are 
hydrogen and stupidity.


 -= Bill =-
--

Half this game is ninety percent mental.
  -Philadelphia Phillies manager Danny Ozark
  



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



Re: [PHP] The Data Literacy Test

2008-09-25 Thread Bill Guion

At 9:22 AM +0800 9/25/08, Shelley wrote:


2008/9/25 Philip Thompson [EMAIL PROTECTED]


 On Sep 24, 2008, at 7:29 AM, Maciek Sokolewicz wrote:

  tedd wrote:



 At 12:25 PM +0100 9/24/08, Ashley Sheridan wrote:


 On Wed, 2008-09-24 at 09:20 +0800, Shelley wrote:



 
 http://phparch.cn/index.php/php/34-php-basics/202-the-data-literacy-test
 The
 Data Literacy Test:



http://www.phparch.cn/index.php/php/34-php-basics/202-the-data-literacy-test

  What the smeg is this?



 I don't know, but I figure 27.
 Cheers,
 tedd



 yes, I think 27 aswell...

 - Tul



 No no no. We all know the answer is 42.

 ? How come 42?


The answer to the question of Life, The Universe, and Everything, is 42.

 -= Bill =-



--
With best regards,
Shelley Shyan
http://phparch.cn



--

A libertarian, immoral society is enticing you to excesses. Enjoy.
  



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



[PHP] Writing MySQL Update Query with NULL value

2008-04-13 Thread Bill Guion
I'm trying to write a MySQL UPDATE query where one or more variables 
may be NULL. So, I'm trying something like:


  $last_name = $_POST['last_name'];
  $first_name = $_POST['first_name'];
  $suffix = $_POST['suffix'];
  $suffix = empty($suffix) ? NULL : $suffix;
  $phone = $_POST['phone'];
  $phone_index = $_POST['phone_index'];
  $update_query = UPDATE 'phones'
   SET 'last_name' = $last_name, 'first_name' = $first_name,
   'suffix' = $suffix, 'phone' = $phone
   WHERE 'phone_index' = $phone_index;;

However, when I echo out this query, I get:
UPDATE 'phones' SET 'last_name' = Doe, 'first_name' = John, 'suffix' 
= , 'phone' = 123-456-7890 WHERE 'phone_index' = 323;


I think, for this to properly update the record, it should be:
UPDATE 'phones' SET 'last_name' = Doe, 'first_name' = John, 'suffix' 
= NULL, 'phone' = 123-456-7890 WHERE 'phone_index' = 323;


What am I doing wrong?

 -= Bill =-
--

Nothing is so bad that it can't get worse.



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



[PHP] Re: Quarters

2008-04-11 Thread Bill Guion
Maybe you guys should get a Mac. Works just fine for me on a Mac, OS 
X, Firefox.


 -= Bill =-

At 9:49 AM -0400 4/11/08, tedd wrote:


Hi gang:

Check out my new game:

http://webbytedd.com/quarters/

What do you think?

Cheers,

tedd

PS: I originally wrote the game for the Mac over eight years ago.
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com



--

I plead contemporary insanity.
  



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



Re: [PHP] dynamic boxes problem... JS and PHP

2008-04-09 Thread Bill Guion

At 3:20 PM -0700 4/8/08, Ryan S wrote:


Hey!
Thanks Andrew, will look into those points that you sent me.

First thing to change will be the DOCTYPE I think, as i didht type 
that but must have copied code into a pre-made page...


Cheers!
R



Ryan,

Four observations:

1. Don't try to solve your problem by changing the DOCTYPE. Bad HTML is
   bad HTML. Changing the DOCTYPE may reduce the severity of the problem,
   but it won't solve it.

2. You have interpreted the fact that IE gave you what you expected while
   FF did not as a problem with FF, but the opposite is true. A problem
   with IE allowed it to accept HTML that it should not have accepted. FF
   treated it properly.

3. Firebug is a free download from Mozilla. I have it and it has solved
   more problems for me than I can remember. (Or, maybe I just don't have
   a very good memory.) Get it. You will see your form... tags inside
   the table  /table tags, but not inside any td.../td tags.

4. Learn to use the W3C Markup Validation service -
   http://validator.w3.org/. It will point out many problems that you can
   solve quickly.

 -= Bill =-
--

Murphy's Law Cardinal Conundrum -
The optimist believes we live in the best of all possible worlds.
The pessimist fears this is true.
  



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



[PHP] Re: Quick email address check

2008-03-27 Thread Bill Guion

At 1:28 PM -0400 3/26/08, Al wrote:

I'm scripting a simple registry where the user can input their name 
and email address.


I'd like to do a quick validity check on the email address they just 
inputted. I can check the syntax, etc. but want check if the address 
exists.  I realize that servers can take a long time to bounce etc. 
I'll just deal with this separately.


Is there a better way than simply sending a test email to see if it bounces?

Thanks


I've had pretty good success from the following:

after checking the syntax (exactly one @, at least one . to the right 
of the @, etc.), if it passes the syntax check, I then set $rhs to 
everything to the right of the @. Then I test:


if (!checkdnsrr($rhs, 'MX'))
  {
  invalid
  }
else
  {
  valid
  }

 -= Bill =-
--

You can't tell which way the train went by looking at the track.
  



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



[PHP] Re: Date math

2008-03-24 Thread Bill Guion

At 12:17 AM -0400 3/24/08, Ron Piggott wrote:


I have this math equation this list helped me generate a few weeks ago.
The purpose is to calculate how many days have passed between 2 dates. 

Right now my output ($difference) is 93.958333 days. 


I am finding this a little weird.  Does anyone see anything wrong with
the way this is calculated:

$date1 = strtotime($date1); (March 21st 2008)
$date2 = strtotime($date2); (December 18th 2007)

echo $date1 = 1206072000
echo $date2 = 1197954000

#86400 is 60 seconds x 60 minutes x 24 hours (in other words 1 days
worth of seconds)

$factor = 86400;

$difference = (($date1 - $date2) / $factor);


94 - 93.958333 = .04167

.04167 * 86400 = 3600 = 1 hour. Didn't you pass throught 
daylight savings time prior to 21 March?


 -= Bill =-
--

You can't tell which way the train went by looking at the track.
  



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



[PHP] Pass Variable Names to a Function

2008-02-01 Thread Bill Guion
I would like to use a function to check to see if a session variable 
is set and return the session variable if it is set, and return blank 
if not. Something like


function set_var($var)
  {
  echo var = $var \n;
  if (isset($_SESSION['$var']))
{
return $_SESSION['$var'];
}
  else
{
return ;
}
  }

And I would call the function with set_var($name) or set_var($phone). 
The problem is getting the function to use $var as a variable name, 
rather than a value. What am I missing, please?


 -= Bill =-
--

Diplomacy - telling your boss he has an open mind
instead of saying he has a hole in his head.

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



[PHP] Re: quicktime new window php

2007-11-24 Thread Bill Guion

At 5:26 PM +0530 11/23/07, kNish wrote:


Hi,

  How is it possible to have a hyper link open a new quicktime window


BRgds,

kNish


Not sure if this is what you are looking for or not, but if your html 
code looks like a href=link-to-page target=_toppage name/a, the 
page will open in either a new page or a new tab. That choice is 
dependent on the local browser configuration.


 -= Bill =-
--

Do not confuse liberty with license.
  


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



Re: [PHP] Pragmatically changing a Record Number

2007-09-01 Thread Bill Guion
I don't think you really want to do that, either. You don't need a 
field in the database to accomplish what you are trying to do. 
Execute your query to select the records you want, sorting them into 
what ever order you want. When you display the records on your web 
page, add a PHP variable, say $row_number, which starts at 1, and 
increments by one for each row you display.


 -= Bill =-

At 3:09 PM -0400 8/29/07, Jason Pruim wrote:

And what I'm looking for is away to take rows 4 and 5 and move them 
to rows 2 and 3 so the next record inserted would be row 4 :)




it does not go back and fill in the holes/gaps

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]



--

Reality is the leading cause of stress, for those in touch with it.
  


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



[PHP] Re: determine which string is longer and then what is different in that string

2007-08-26 Thread Bill Guion

At 11:11 PM -0700 8/25/07, Richard Kurth wrote:


I am trying to find out which string is the longest and then find out what
is different between the two string. Sometimes String 2 is longer than
String 1 The script below works sometimes but not all the time.
Is there a better way to do this or tell me what is wrong with the script I
am using

$string1 = 1,2,3,4,5,6,7,8;
$string2 = 1,2,3,4,6,7,8;


Can you give us an example of two strings where the comparison fails? 
I suspect you are looking for the number of entries in the string, 
rather than the length of the string. For example:

$string1 = 1,2,3,4,5,6,9;
$string2 = 1,2,3,10,11,12;

number of entries in $string1 is 7, number of entries in $string2 is 
6, but length($string1) = 13, while length($string2) = 14. Is this 
the problem you are seeing?


 -= Bill =-


--

The greatest calamity is not to have failed,
but to have failed to try.
  


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



[PHP] RE: determine which string is longer and then what is different in that string

2007-08-26 Thread Bill Guion

At 6:00 PM -0700 8/26/07, Richard Kurth wrote:





 I am trying to find out which string is the longest and then
 find out
 what is different between the two string. Sometimes String 2
 is longer
 than String 1 The script below works sometimes but not all the time.
 Is there a better way to do this or tell me what is wrong with the
 script I am using
 
 $string1 = 1,2,3,4,5,6,7,8;
 $string2 = 1,2,3,4,6,7,8;
 
 
 Can you give us an example of two strings where the comparison fails?
 I suspect you are looking for the number of entries in the
 string, rather than the length of the string. For example:
 $string1 = 1,2,3,4,5,6,9;
 $string2 = 1,2,3,10,11,12;

 number of entries in $string1 is 7, number of entries in
 $string2 is 6, but length($string1) = 13, while
 length($string2) = 14. Is this the problem you are seeing?


Yes that is the problem $string2 is what is saved in the database and
string1 is coming from a form. The form has every thing that is in the
database but could have some items added and some removed. I need to know
what is different so I can add to or remove from a separate table so both
tables are the same.


How about something like

$array_string1 = explode(',' , $string1);
$array_string2 = explode(',' , $string2);
$len_string1 = count($array_string1);
$len_string2 = count($array_string2);

Now you can compare the number of elements in $string1 ($len_string1) 
vs. the number of elements in $string2 ($len_string2). And the two 
arrays can be compared to see what the differences are.


You haven't really provided enough information about what is really 
going on (nor is it necessary to do so), but is it possible that the 
two strings could be different but have the same number of elements? 
If so, then the lenght of the strings is not particularly relevant, 
and you might just want to compare the specific elements of both 
strings with each other.


 -= Bill =-
--

If you're living on the edge, make sure you're wearing your seat belt.
  


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



Re: [PHP] Getting mysql_query results into an array

2007-02-14 Thread Bill Guion

At 6:22 PM -0600 2/13/07, Richard Lynch wrote:



The most efficient way is Don't do that. :-)

Simply loop through the results and do whatever you want to do with
them, and don't put them into an array at all.

This question has appeared before, and usually breaks down to one of
these scenarios:

#1


snip 1



#2


snip 2



#2 does occasionally have an exception to the rule, where the SQL
query is nasty and the PHP is fast and easy, but that's awfully rare.




How about scenario #3: I wish to output my data in (for example) 
three columns, as a phone book does. To make the example simple, 
assume 15 data points. I wish the output to look like


1   611
2   712
3   813
4   914
5  1015

So when I'm outputting row 1, I need data points 1, 6, and 11. Isn't 
it easier to generate the query, put in array, and output the rows 
from the array? Keep in mind, the number of data points might be 
variable, the constraints being n columns with approximately the same 
number of data point in each column.


 -= Bill =-
--

The secret of life is...I can't tell you.  It's a secret.
  


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



Re: [PHP] Extracting XMP text from Jpeg

2007-01-13 Thread Bill Guion

At 8:05 PM +0200 1/13/07, Dotan Cohen wrote:



Hehehe... Good thing that I didn't post a picture of Gush:
http://dotancohen.com/gallery/img-122.html



I presume Gush is an advanced computer mouse?

 -= Bill =-

--

Jury: a panel of 12 men and women selected
to decide who has the better lawyer.
  


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



[PHP] Re: comparing a string

2006-06-23 Thread Bill Guion

At 9:28 PM -0500 6/21/06, Rafael wrote:

snip

The only possible values of strcmp() are: 1, 0  -1.


Hmmm. My manual says: Compares two strings; returns a number less 
than 0 if the first string is less than the second, 0 if the two 
strings are equal, and a number greater than 0 if the first string is 
greater than the second. Sounds like values other than -1, 0, and +1 
are possible.


 -= Bill =-
--

You never know who's right, but you always know who's in charge.
  


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