[PHP] shared memory access - shmod_open

2007-12-06 Thread Rolf_

Dear List,

I have a problem working with shmop_open() in a Solaris environment. The
following cli-script works fine, except shmod_open returns a warning 'unable
to attach or create shared memory segment':



I checked the $sem_key with the Solaris ipcs command. The file exists and
the read/write rights are correct. I tried explictly to call shmop_open with
the right key - the error message remains the same. 

Checking out different access mode like "r" does not succeed too. In the
Xdebug output, php changes the value 0644 to 420, i.e.
shmop_open(1258300033, 'w', 420, 1). Of course, I compiled php with
--enable-shmop.

Does anyone has an idea what I might also check?

Thanks in advance,
Rolf_
-- 
View this message in context: 
http://www.nabble.com/shared-memory-access---shmod_open-tf4954760.html#a14188465
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] Professional inquiry for you freelancers

2007-12-06 Thread Jochem Maas
Steve Finkelstein wrote:
> Hi all,

...

> 
> Basically what I'm asking is, am I going to be end up being a jack of
> all trades, master of none, if I continue pursuing design AND
> development? 

leonardo da vinci - i.e. there is nothing to say you can't be a master of
all trades. but realistically you may wish to focus more energy on the
development side of things :-) any design skills you choose to aquire
are going to be a bonus.

> Is there plenty of work out there for folks who just
> stick to development?

yes.

> 
> Thanks for your humble opinions.  Appreciate the feedback!

humble?

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



Re: [PHP] Calendar

2007-12-06 Thread Richard Heyes

On Dec 5, 2007 6:09 AM, Richard Heyes <[EMAIL PROTECTED]> wrote:

There is not much "simple" about a calendar, especially when you start
dealing with recurring events. How far into the future your calendar
allow events to recur will depend at least in part on how you intend
to store them. For instance, you can store them in a database where
you create a separate event row for each occurrence (though still be
linked by a common ID as you said), but you'll probably set your
limits based on storage to prevent adding a daily event for the next
10 years.

Stipulating an event to be daily could be as simple as a 0 or 1 flag. So
where's the storage concern?


The storage concern comes if you opt to store one copy of the event
for every day for as long as the event recurs. Why? Perhaps you want
to provide the ability to alter the time of a specific instance of a
recurring event (or delete one instance altogether) without changing
the other instances.


So you could have a table which contains events, and a table which 
contains exceptions. Simple and minimal storage requirements. Since 
exceptions will be, as their name suggests, exceptional, storage 
requirements will be small.


--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

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



Re: [PHP] zip codes and lat/longs

2007-12-06 Thread Daniel Brown
On Dec 5, 2007 8:58 PM, tedd <[EMAIL PROTECTED]> wrote:
> Hi gang:
>
> I'm entertaining how to determine what zip codes fall within a 50
> mile radius of another zip code.
>
> Anyone done this before?
>
> Also, does anyone have any sources for zip codes and lat/long databases?

Tedd,

I have all of this in a MySQL database already, with census
information, water table info, and more.  If you want to take a look,
let me know and I'll give you a peek via phpMyAdmin to see if it'll
match your needs.

For you, it's free.  All else must PAY  ;-P

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] zip codes and lat/longs

2007-12-06 Thread Jason Pruim


On Dec 6, 2007, at 10:29 AM, Daniel Brown wrote:


On Dec 5, 2007 8:58 PM, tedd <[EMAIL PROTECTED]> wrote:

Hi gang:

I'm entertaining how to determine what zip codes fall within a 50
mile radius of another zip code.

Anyone done this before?

Also, does anyone have any sources for zip codes and lat/long  
databases?


   Tedd,

   I have all of this in a MySQL database already, with census
information, water table info, and more.  If you want to take a look,
let me know and I'll give you a peek via phpMyAdmin to see if it'll
match your needs.

   For you, it's free.  All else must PAY  ;-P


You know...

in the mailing industry people pay $1,000 a year for that kind of  
info? Master Brown? :) ole Buddy, ole Pal :) any chance I could sneak  
a peak at it? Maybe I need to look into writing my own geo mapping  
software...


--

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

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



Re: [PHP] zip codes and lat/longs

2007-12-06 Thread Daniel Brown
On Dec 6, 2007 10:49 AM, Jason Pruim <[EMAIL PROTECTED]> wrote:
>
> On Dec 6, 2007, at 10:29 AM, Daniel Brown wrote:
>
> > On Dec 5, 2007 8:58 PM, tedd <[EMAIL PROTECTED]> wrote:
> >> Hi gang:
> >>
> >> I'm entertaining how to determine what zip codes fall within a 50
> >> mile radius of another zip code.
> >>
> >> Anyone done this before?
> >>
> >> Also, does anyone have any sources for zip codes and lat/long
> >> databases?
> >
> >Tedd,
> >
> >I have all of this in a MySQL database already, with census
> > information, water table info, and more.  If you want to take a look,
> > let me know and I'll give you a peek via phpMyAdmin to see if it'll
> > match your needs.
> >
> >For you, it's free.  All else must PAY  ;-P
>
> You know...
>
> in the mailing industry people pay $1,000 a year for that kind of
> info? Master Brown? :) ole Buddy, ole Pal :) any chance I could sneak
> a peak at it? Maybe I need to look into writing my own geo mapping
> software...
>

You sell it, you can have 50% of whatever revenue it generates,
without having to do a bit of code.

It took me over a year to compile all of the information.  I know
I probably could've found it somewhere else for a few hundred dollars,
but I wanted to do it as a project for myself so I did.  ;-P

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] Professional inquiry for you freelancers

2007-12-06 Thread Steve Finkelstein
Wow, I fire off an e-mail before I hit the sack and wake up with
several great feedback!

No worries on the quality of humbleness, Daniel. ;-)

Overall, I do enjoy design. Heck, I wish I had more of a creative mind
and the logical programming mind at times. I just want to make sure
I'm not cutting myself short in the long run by limiting my coding
capabilities because of time I'm investing hours on end into a copy of
Photoshop that my company has picked up for me.

I really do appreciate the feedback. I'm going to run with it and see
how it goes.

Cheers all,

- sf

On 12/6/07, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Dec 6, 2007 3:23 AM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> > Steve Finkelstein wrote:
> > > Thanks for your humble opinions.  Appreciate the feedback!
> >
> > humble?
>
> People on this list are anything BUT humble, Steve.
>
> Now, as for my own petty opinion
>
> I always tell new clients that people are either expertly creative
> or technical, and that I'm very much the latter, but not the former.
> I can't design to save my ass.  I can put the HTML code together, but
> I may as well be colorblind when it comes to a good combination.  I'm
> just not good at coming up with a nice, clean layout so I
> generally have a friend, my pre-wife (who does some design work), or
> someone I know from online do the design part, if even only in
> PhotoShop, then I integrate it with my code.  Less hassle for me,
> overall, so I can focus on providing excellent code (see, no one here
> is humble!), without having it look like chewed-up and spit-out food
> that someone realized they didn't like just a bit too late.
>
> --
> Daniel P. Brown
> [Phone Numbers Go Here!]
> [They're Hidden From View!]
>
> If at first you don't succeed, stick to what you know best so that you
> can make enough money to pay someone else to do it for you.
>

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



Re: [PHP] zip codes and lat/longs

2007-12-06 Thread mike
After reading this I decided to figure out what the issue was.

It was the MySQL result set. Somehow the columns changed and messed up
the float values. So I just whipped this up quick to reload the data
(and possibly update it too)

Here's the quick-and-dirty:

1) download ZCTA (the text version) from
http://www.census.gov/geo/www/gazetteer/places2k.html
2) run this

db_query("TRUNCATE TABLE data_zips");

$fp = fopen('zcta5.txt', 'r');
while(!feof($fp)) {
$line = fgets($fp, 2048);
$line = chop($line);
$zip = substr($line, 2, 5);
$lat = substr($line, 137, 9);
$long = substr($line, 146, 12);
db_query("INSERT INTO data_zips(zip, latitude, longitude)
VALUES('$zip', '$lat', '$long')");
}
fclose($fp);

schema:

CREATE TABLE `data_zips` (
  `zip` mediumint(5) unsigned zerofill NOT NULL default '0',
  `latitude` float(9,6) NOT NULL default '0.00',
  `longitude` float(9,6) NOT NULL default '0.00',
  PRIMARY KEY  (`zip`),
  KEY `latitude` (`latitude`),
  KEY `longitude` (`longitude`));

I believe now you have everything you need :)


On 12/6/07, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Dec 5, 2007 8:58 PM, tedd <[EMAIL PROTECTED]> wrote:
> > Hi gang:
> >
> > I'm entertaining how to determine what zip codes fall within a 50
> > mile radius of another zip code.
> >
> > Anyone done this before?
> >
> > Also, does anyone have any sources for zip codes and lat/long databases?
>
>Tedd,
>
>I have all of this in a MySQL database already, with census
> information, water table info, and more.  If you want to take a look,
> let me know and I'll give you a peek via phpMyAdmin to see if it'll
> match your needs.
>
>For you, it's free.  All else must PAY  ;-P
>
> --
> Daniel P. Brown
> [Phone Numbers Go Here!]
> [They're Hidden From View!]
>
> If at first you don't succeed, stick to what you know best so that you
> can make enough money to pay someone else to do it for you.
>
> --
> 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] Professional inquiry for you freelancers

2007-12-06 Thread Daniel Brown
On Dec 6, 2007 3:23 AM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> Steve Finkelstein wrote:
> > Thanks for your humble opinions.  Appreciate the feedback!
>
> humble?

People on this list are anything BUT humble, Steve.

Now, as for my own petty opinion

I always tell new clients that people are either expertly creative
or technical, and that I'm very much the latter, but not the former.
I can't design to save my ass.  I can put the HTML code together, but
I may as well be colorblind when it comes to a good combination.  I'm
just not good at coming up with a nice, clean layout so I
generally have a friend, my pre-wife (who does some design work), or
someone I know from online do the design part, if even only in
PhotoShop, then I integrate it with my code.  Less hassle for me,
overall, so I can focus on providing excellent code (see, no one here
is humble!), without having it look like chewed-up and spit-out food
that someone realized they didn't like just a bit too late.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] shared memory access - shmod_open

2007-12-06 Thread Daniel Brown
On Dec 6, 2007 3:44 AM, Rolf_ <[EMAIL PROTECTED]> wrote:
>
> Dear List,
>
> I have a problem working with shmop_open() in a Solaris environment. The
> following cli-script works fine, except shmod_open returns a warning 'unable
> to attach or create shared memory segment':
[snip!]

Rolf,

I don't know if it will help you in your exact situation, but
here's a link to someone who had a similar problem, found in the
archives:
http://archives.neohapsis.com/archives/php/2005-11/0028.html

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] Professional inquiry for you freelancers

2007-12-06 Thread Daniel Brown
On Dec 6, 2007 11:00 AM, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
> Wow, I fire off an e-mail before I hit the sack and wake up with
> several great feedback!
>
> No worries on the quality of humbleness, Daniel. ;-)
>
> Overall, I do enjoy design. Heck, I wish I had more of a creative mind
> and the logical programming mind at times. I just want to make sure
> I'm not cutting myself short in the long run by limiting my coding
> capabilities because of time I'm investing hours on end into a copy of
> Photoshop that my company has picked up for me.
>
> I really do appreciate the feedback. I'm going to run with it and see
> how it goes.
>
> Cheers all,
>
> - sf

And good luck with it!

Dude, as long as you're enjoying what you're doing, you're going
to do a better job of it.  So don't limit yourself for any reason.

[A shooting star flashes over my head, music plays, and the words
"The More You Know!" appear in front of me]

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] zip codes and lat/longs

2007-12-06 Thread Daniel Brown
On Dec 6, 2007 11:02 AM, mike <[EMAIL PROTECTED]> wrote:
[snip!]
> 1) download ZCTA (the text version) from
> http://www.census.gov/geo/www/gazetteer/places2k.html
[snip!]

How you say?  Son of the bitch.

Well, my database still has more information, including nearby ZIP
codes, et cetera.  It's about 38MB, total.

Still son of the son of the son of the bitch.  Great-grandson
of the bitch.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



RE: [PHP] zip codes and lat/longs

2007-12-06 Thread Jay Blanchard
[snip]
I'm entertaining how to determine what zip codes fall within a 50 
mile radius of another zip code.

Anyone done this before?

Also, does anyone have any sources for zip codes and lat/long databases?

TIA for any help/suggestions.
[/snip]

Here is a code snip that I use to determine things within a certain
radius (5 miles) of a zip code;

/* calcs for distance */
function distance($lat1, $lon1, $lat2, $lon2) { 
$theta = $lon1 - $lon2; 
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) +
cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); 
$dist = acos($dist); 
$dist = rad2deg($dist); 
$miles = $dist * 60 * 1.1515;

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



Re: [PHP] zip codes and lat/longs

2007-12-06 Thread mike
You can use the formula to figure out how many zip codes are within the radius

Here's a snippet of old code that did that:

$radius = 50; // in miles

$uchk = db_query("SELECT uz.zip FROM user_zip WHERE uid=$visitor[uid]");
if(db_numrows($uchk) == 1) {
list($vz) = db_rows($uchk);
$zchk = db_query("SELECT latitude,longitude
FROM z_data_zips WHERE zip=$vz");
list($vlat,$vlong) = db_rows($zchk);
db_free($zchk);
$zips = db_query("SELECT z.zip FROM data_zips
z WHERE CEIL(69*DEGREES(ACOS(SIN(RADIANS(z.latitude)) *
SIN(RADIANS($vlat)) + COS(RADIANS(z.latitude)) * COS(RADIANS($vlat)) *
COS(RADIANS(z.longitude - $vlong) < $radius");
$ziplist = "";
if(db_numrows($zips) > 0) {
while(list($zip) = db_rows($zips)) {
$ziplist .= "'$zip',";
}
db_free($zips);
$ziplist =
substr($ziplist,0,strlen($ziplist)-1);
$query .= " user_zips IN($ziplist)";
}
}
db_free($uchk);



On 12/6/07, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Dec 6, 2007 11:02 AM, mike <[EMAIL PROTECTED]> wrote:
> [snip!]
> > 1) download ZCTA (the text version) from
> > http://www.census.gov/geo/www/gazetteer/places2k.html
> [snip!]
>
>How you say?  Son of the bitch.
>
>Well, my database still has more information, including nearby ZIP
> codes, et cetera.  It's about 38MB, total.
>
>Still son of the son of the son of the bitch.  Great-grandson
> of the bitch.
>
> --
> Daniel P. Brown
> [Phone Numbers Go Here!]
> [They're Hidden From View!]
>
> If at first you don't succeed, stick to what you know best so that you
> can make enough money to pay someone else to do it for you.
>

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



Re: [PHP] zip codes and lat/longs

2007-12-06 Thread Daniel Brown
On Dec 6, 2007 11:12 AM, mike <[EMAIL PROTECTED]> wrote:
> You can use the formula to figure out how many zip codes are within the radius

Or you can stop shooting me in the ass by showing me things that
make me wonder why I wasted all that time!  ;-P

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] zip codes and lat/longs

2007-12-06 Thread Richard Lynch
On Thu, December 6, 2007 9:49 am, Jason Pruim wrote:
>
> On Dec 6, 2007, at 10:29 AM, Daniel Brown wrote:
>
>> On Dec 5, 2007 8:58 PM, tedd <[EMAIL PROTECTED]> wrote:
>>> Hi gang:
>>>
>>> I'm entertaining how to determine what zip codes fall within a 50
>>> mile radius of another zip code.
>>>
>>> Anyone done this before?
>>>
>>> Also, does anyone have any sources for zip codes and lat/long
>>> databases?
>>
>>Tedd,
>>
>>I have all of this in a MySQL database already, with census
>> information, water table info, and more.  If you want to take a
>> look,
>> let me know and I'll give you a peek via phpMyAdmin to see if it'll
>> match your needs.
>>
>>For you, it's free.  All else must PAY  ;-P
>
> You know...
>
> in the mailing industry people pay $1,000 a year for that kind of
> info? Master Brown? :) ole Buddy, ole Pal :) any chance I could sneak
> a peak at it? Maybe I need to look into writing my own geo mapping
> software...

The free one is from an OLD US census, paid for by taxpayers, and
therefore Public Domain.

$1,000 ones (should) include new zips (lots) and up-to-date population
info etc.

YMMV

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Maps

2007-12-06 Thread Richard Lynch
Yes, you can do that, and look at Yahoo! maps as an alternative.

Same smell. :-)

On Wed, December 5, 2007 12:27 pm, Robert Fitzpatrick wrote:
> Well, I have two clients that both want mapping for their sales
> people.
> I have been looking at the Google API and Phoogle
> (www.systemsevendesigns.com/phoogle). I assume with these examples I
> will be able to produce what they need? Which is to select several
> addresses and produce a fastest route map with directions to those
> addresses from a start address. Not clear from my reading yet, but can
> someone with some experience tell me if this is possible with the
> Google
> API or some hints that might speed up my process of the best way to go
> for this...
>
> Thanks in advance!
>
> --
> Robert
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Maps

2007-12-06 Thread David Giragosian
On 12/6/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
>
> Yes, you can do that, and look at Yahoo! maps as an alternative.
>
> Same smell. :-)
>
> On Wed, December 5, 2007 12:27 pm, Robert Fitzpatrick wrote:
> > Well, I have two clients that both want mapping for their sales
> > people.
> > I have been looking at the Google API and Phoogle
> > (www.systemsevendesigns.com/phoogle). I assume with these examples I
> > will be able to produce what they need? Which is to select several
> > addresses and produce a fastest route map with directions to those
> > addresses from a start address. Not clear from my reading yet, but can
> > someone with some experience tell me if this is possible with the
> > Google
> > API or some hints that might speed up my process of the best way to go
> > for this...
> >
> > Thanks in advance!
> >
> > --
> > Robert
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/from/lynch
> Yeah, I get a buck. So?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Welcome back, Richard.

David


Re: [PHP] zip codes and lat/longs

2007-12-06 Thread Daniel Brown
On Dec 6, 2007 11:43 AM, Richard Lynch <[EMAIL PROTECTED]> wrote:
> The free one is from an OLD US census, paid for by taxpayers, and
> therefore Public Domain.
>
> $1,000 ones (should) include new zips (lots) and up-to-date population
> info etc.

Yeah, mine actually does.  It's from 2006 and 2007 data, actually.
 I was just whining to read myself whine.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] // ?>

2007-12-06 Thread Richard Lynch
On Tue, December 4, 2007 7:41 pm, Kevin Schmeichel wrote:
> Here's some unexpected behavior:
>
>  // ?> what?
> ?>
>
> This will output "what?" - I expected no output, as is the case if the
> inline comment was a /* */ comment.  Is this a bug?

The  are parsed first, and the // only applies to
everything up TO the ?> bit.

Don't do that. :-)


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] shared memory access - shmod_open

2007-12-06 Thread Richard Lynch
On Thu, December 6, 2007 2:44 am, Rolf_ wrote:
> I have a problem working with shmop_open() in a Solaris environment.
> The
> following cli-script works fine, except shmod_open returns a warning
> 'unable
> to attach or create shared memory segment':
>
>  $sem = "/tmp/" . rand() . ".sem";
> touch ($sem);
> echo "sem $sem \n";
>
> $sem_key = ftok($sem, 'w');
> echo "sem_key $sem_key \n";
>
> if ($sem_key == -1) { die ("ftok error"); }
>
> $shm_id = shmop_open($sem_key, "w", 0644, 1);
> echo "shm_id $shm_id\n";
> ?>
>
> I checked the $sem_key with the Solaris ipcs command. The file exists
> and
> the read/write rights are correct. I tried explictly to call
> shmop_open with
> the right key - the error message remains the same.
>
> Checking out different access mode like "r" does not succeed too. In
> the
> Xdebug output, php changes the value 0644 to 420, i.e.
> shmop_open(1258300033, 'w', 420, 1). Of course, I compiled php with
> --enable-shmop.
>
> Does anyone has an idea what I might also check?

Perhaps the 0644 needs to be expressed in some other way?

I know it works fine that way for chmod and friends, so I wouldn't
expect it, but...

Or maybe 420 *IS* the right value, and you're on a red herring.

Try Googling for the error message and Solaris if you haven't done
that yet.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread Richard Lynch
EVERY HTTP request is completely independent of the previous/following
ones, unless you specifically tie them together with YOUR code.

If you want to accumulate data from $_POST, start a session
http://php.net/session_start and cram the data you need to keep into
$_SESSION as you go.

On Wed, December 5, 2007 11:36 pm, Mike Smith wrote:
> I am trying to recursively send data to the same form.  Based on the
> data, I
> want to determine which "action" is to be processed.  It appears that
> the
> $_POST is not being cleared out or cached once it is sent to the
> server.
> Here is my code that I'm trying to test with.  It doesn't seem to
> consistently send me to the correct page each time.
>
> 
>  $process = $_POST['process'];
>
>  if ($process == "Pass")
>   {
>   echo "";
>   }
>  else
>   {
>   echo "";
>   }
> ?>
>
>  
>   
>
> tabindex="1">
>Pass
>   
>   
>
>
>
>Fail
>   
>  
>value="Reset" name="B2">
> 
>
> I want to use a single submit button that will send the "action" to
> the
> right page.
>
> What is the best practice for doing this?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] zip codes and lat/longs

2007-12-06 Thread Robert Cummings
Welcome back Richard :)

Cheers,
Rob.


On Thu, 2007-12-06 at 10:43 -0600, Richard Lynch wrote:
> On Thu, December 6, 2007 9:49 am, Jason Pruim wrote:
> >
> > On Dec 6, 2007, at 10:29 AM, Daniel Brown wrote:
> >
> >> On Dec 5, 2007 8:58 PM, tedd <[EMAIL PROTECTED]> wrote:
> >>> Hi gang:
> >>>
> >>> I'm entertaining how to determine what zip codes fall within a 50
> >>> mile radius of another zip code.
> >>>
> >>> Anyone done this before?
> >>>
> >>> Also, does anyone have any sources for zip codes and lat/long
> >>> databases?
> >>
> >>Tedd,
> >>
> >>I have all of this in a MySQL database already, with census
> >> information, water table info, and more.  If you want to take a
> >> look,
> >> let me know and I'll give you a peek via phpMyAdmin to see if it'll
> >> match your needs.
> >>
> >>For you, it's free.  All else must PAY  ;-P
> >
> > You know...
> >
> > in the mailing industry people pay $1,000 a year for that kind of
> > info? Master Brown? :) ole Buddy, ole Pal :) any chance I could sneak
> > a peak at it? Maybe I need to look into writing my own geo mapping
> > software...
> 
> The free one is from an OLD US census, paid for by taxpayers, and
> therefore Public Domain.
> 
> $1,000 ones (should) include new zips (lots) and up-to-date population
> info etc.
> 
> YMMV
> 
> -- 
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/from/lynch
> Yeah, I get a buck. So?
> 
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] References to a variable and scope

2007-12-06 Thread Richard Lynch
On Tue, December 4, 2007 2:58 pm, Cesar D. Rodas wrote:
> I know that PHP doesn't support pointers to a variable, instead of
> that
> there is references to a variable which are similar to pointers,
> right?
>
> BTW, what I want to do is to save a references to a variable and read
> the
> content when I need, similar to PDO "bindParam". I will try to explain
> better in the following pseudo php code.
>
> function foo($a) {
>$GLOBALS['references']['a'] = /*references to $a */
> }
>
> function bar() {
>   echo $GLOBALS['references']['a'];
> }
>
> $var="hello"
> foo($var);
> $var = "hi";
> bar(); /* it should print "hi" instead of "hello" */

If you are making things this complicated, you will probably regret it
someday...

That said, I think if you just did:
foo('var');
and changed the 'a' in foo/bar to $a
then you would get what you want...

It won't be a reference nor a pointer, but just a global variable,
disguised by using $GLOBALS instead of:
global $var;
as you should do for clarity.

YMMV

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] howto get .tar.gz content's filenames

2007-12-06 Thread Richard Lynch
On Mon, December 3, 2007 9:05 pm, Shelley Shyan wrote:
> It may not be a php question, but I want to get the filename lists
> that a .tar.gz file contains and give it to an array.
> How can I manage that?

I thought there was a 'tar' PHP extension, but don't see it now...

There is a 'gzip' you can use to unzip it...

If all else fails, punt to the OS:



-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] calculate a varchar

2007-12-06 Thread Richard Lynch
I won't say you CAN'T do it (you can with eval) but you'd be WAY
better off to use some kind of exchange rate field that you can change
frequently instead of cramming formulas into the field.

"If eval is the answer, you are probably doing something wrong."

You may also want to store everything as cents (or pence) and only
insert the decimal on display to avoid rounding errors.

On Mon, December 3, 2007 9:56 am, John Taylor-Johnston wrote:
> Is there a calculation function?
>
> I'm using an e-commerce shopping cart. I want to tweak the code. The
> author is using a varchar(100) field to store prices.
>
> Taking advantage of there being a varchar, instead of entering a
> price,
> I would like to enter a calculation.
>
> (24*2.2)+(24*2.2*.1) 24 is my unit price in British pounds. 2.2 is the
> exchange rate into Canadian dollars. etc.
>
> The exchange rate changes frequently. Instead of recalculating and
> entering a new price every few days, it would be useful to enter a
> calculation in any price field.
>
> I had a look at: http://ca3.php.net/manual-lookup.php?pattern=calc
> http://ca3.php.net/manual-lookup.php?pattern=calculate
> http://ca3.php.net/manual-lookup.php?pattern=calculation
> but I see no function, although I'm sure there is one.
>
> So how could I do this?
>
> $price = (24*2.2)+(24*2.2*.1);
>
> if $price is not an integer, verify if it is a calculation. If so,
> give
> me an integer and round it off to two decimal points:
>
> $price = 58.08;
>
> Do-able?
>
> John
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread tedd

At 10:30 PM -0700 12/5/07, Mike Smith wrote:

I'm trying to


Me too -- just as my friends.

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread tedd

At 10:36 PM -0700 12/5/07, Mike Smith wrote:

I am trying to recursively send data to the same form.

-snip-

What is the best practice for doing this?



I don't know what the "best" practice is, but this is the way I do it.

In the form I have a hidden field called step that controls flow via POST..

Based upon that value, I use a switch to direct the flow to different 
forms -- all the forms have the same submit button.


So, it looks like this (pseudo-code):

$step = isset($_POST['step']) ? $_POST['step'] : 1;



switch $step
  {
  case 1:
  // present the form for step 1
  

  case 2:
  // present the form for step 2
  

  case 3:
  // present the form for step 3
  }



That way, it's simple to recursively change a form to gather information.

If you want to keep/store data in each gather, then either save it to 
a dB or do sessions.


It works for me.

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



[PHP] how to recognize ENUM column in table?

2007-12-06 Thread Afan Pasalic

hi,
I use the code from
http://www.php.net/manual/en/function.mysql-fetch-field
(example #1)
I'm getting everything I need but can't recognize if the column is 
ENUM() type?


e.g. column "status" is ENUM('0','1') or ENUM('live','hidden','archive') 
or something like that. I want to recognize this column and then create 
a form with radio buttons

o 0   o 1 or
o live   o hidden   o archive

is it possible?

thanks.

-afan

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



[PHP] How Much Time to do First PHP BB Setup

2007-12-06 Thread Stephen

Hi

I am considering taking on a project, part of which is setting up PHP BB.

I have not done this before but have done Linux/PHP/MySQL web sites.

What would be a realistic time estimate for me to get this running, 
including going through the documentation and learning basic administration?


Thanks!
Stephen

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



Re: [PHP] How Much Time to do First PHP BB Setup

2007-12-06 Thread Daniel Brown
On Dec 6, 2007 2:16 PM, Stephen <[EMAIL PROTECTED]> wrote:
> Hi
>
> I am considering taking on a project, part of which is setting up PHP BB.
>
> I have not done this before but have done Linux/PHP/MySQL web sites.
>
> What would be a realistic time estimate for me to get this running,
> including going through the documentation and learning basic administration?
>
> Thanks!
> Stephen
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Stephen,

That is in no way whatsoever a PHP question.  Check out the forums
at the phpBB website (http://www.phpbb.com/).  Despite the name, it's
not at all associated with the PHP project.

On a side note, uploading, configuring, installing the databases,
et cetera, for a base installation should only take about three
minutes.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] How Much Time to do First PHP BB Setup

2007-12-06 Thread Børge Holen
On Thursday 06 December 2007 20:16:51 Stephen wrote:
> Hi
>
> I am considering taking on a project, part of which is setting up PHP BB.
>
> I have not done this before but have done Linux/PHP/MySQL web sites.
>
> What would be a realistic time estimate for me to get this running,
> including going through the documentation and learning basic
> administration?

You tried it before you ask, yes? It should be straight forward then, look at 
the clock.
See, the time there is quite individual, I got friends, with NO knowledge of 
php or LAMP at ALL, they DO know how to setup phpbb,
I've never done it, but I know (this have the potential to start a nice 
flamewar... the _knowing_ part I mean) php and LAMP.

Who would be using the least amount of time, and why?
I wouldn't know before trying it...
If I knew how, I bet that time would be somewhat off of what you would take, 
if you didn't know and/or never tried it.

>
> Thanks!
> Stephen



-- 
---
Børge Holen
http://www.arivene.net

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



Re: [PHP] how to recognize ENUM column in table?

2007-12-06 Thread Andrew Ballard
On Dec 6, 2007 1:38 PM, Afan Pasalic <[EMAIL PROTECTED]> wrote:
> hi,
> I use the code from
> http://www.php.net/manual/en/function.mysql-fetch-field
> (example #1)
> I'm getting everything I need but can't recognize if the column is
> ENUM() type?
>
> e.g. column "status" is ENUM('0','1') or ENUM('live','hidden','archive')
> or something like that. I want to recognize this column and then create
> a form with radio buttons
> o 0   o 1 or
> o live   o hidden   o archive
>
> is it possible?
>
> thanks.
>
> -afan

The only way I've seen to do this is to first execute the query
DESCRIBE `my_table` and then examine the value of the `Type` column
that is returned for the row that represents the column you are
examining in your regular query. You just have to strip the 'ENUM('
and ')' from the beginning and end and then split the remaining
string.

Andrew

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



Re: [PHP] how to recognize ENUM column in table?

2007-12-06 Thread Afan Pasalic

sounds like a solution!
:)

thanks andrew.

-afan




Andrew Ballard wrote:

On Dec 6, 2007 1:38 PM, Afan Pasalic <[EMAIL PROTECTED]> wrote:

hi,
I use the code from
http://www.php.net/manual/en/function.mysql-fetch-field
(example #1)
I'm getting everything I need but can't recognize if the column is
ENUM() type?

e.g. column "status" is ENUM('0','1') or ENUM('live','hidden','archive')
or something like that. I want to recognize this column and then create
a form with radio buttons
o 0   o 1 or
o live   o hidden   o archive

is it possible?

thanks.

-afan


The only way I've seen to do this is to first execute the query
DESCRIBE `my_table` and then examine the value of the `Type` column
that is returned for the row that represents the column you are
examining in your regular query. You just have to strip the 'ENUM('
and ')' from the beginning and end and then split the remaining
string.

Andrew


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



[PHP] Seeking overlap algorithm

2007-12-06 Thread tedd

Hi gang:

This post is related to the zip lat/long request I recently made and 
received such an overwhelming response -- many thanks to all.


In any event, let's say we have a end-user who is looking for 
services within his zip-code AND we have a dB of service providers 
who are willing to render service within a set distance (like 50 
miles) from their location.


Now, it's a simple matter to convert the user's zip code to lat/longs 
and then find out how many service providers there are within their 
area and then show that list to the end-user. That's not the problem.


The problem is, could you guarantee to a "preferred" service provider 
that they would receive top-listing 25 percent of the time? Keep in 
mind that preferred service providers will overlap. So, the question 
is how to accommodate for that overlap?


If anyone has an algorithm, I would be interested in hearing it.

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



[PHP] PHP Memory Leak

2007-12-06 Thread Sascha Braun
Hi Everybody,

I have a couple of foreach loops which are ending in a for loop,
which causes the apache to consume the complete memory of the
server system the php engine is running on.

The nesting level is at round about three and looking like that:

$num_new = 4;
if (is_array($array)) {
foreach ($array as $key => value) {
if ($value['element'] == 'test1') {
foreach ($value['data'] as $skey => $svalue) {
echo $svalue;
}
} elseif ($value['element'] == 'test2') {
foreach ($value['data'] as $skey => $svalue) {
echo $svalue;
}
}
if ($num_new > 0) {

// this part causes the memory leak

for ($i = 0; $i < $num_new; $i++) {
echo "sgasdgga";
}
}   
}
}

I dont know if the above code is causing the memory leak the source
is a little more complex, if nessessary I will provide some more code,

Thank you!

I hope for a solution

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



Re: [PHP] Seeking overlap algorithm

2007-12-06 Thread Nathan Nobbe
On Dec 6, 2007 4:59 PM, tedd <[EMAIL PROTECTED]> wrote:

> Hi gang:
>
> This post is related to the zip lat/long request I recently made and
> received such an overwhelming response -- many thanks to all.
>
> In any event, let's say we have a end-user who is looking for
> services within his zip-code AND we have a dB of service providers
> who are willing to render service within a set distance (like 50
> miles) from their location.
>
> Now, it's a simple matter to convert the user's zip code to lat/longs
> and then find out how many service providers there are within their
> area and then show that list to the end-user. That's not the problem.
>
> The problem is, could you guarantee to a "preferred" service provider
> that they would receive top-listing 25 percent of the time? Keep in
> mind that preferred service providers will overlap. So, the question
> is how to accommodate for that overlap?
>
> If anyone has an algorithm, I would be interested in hearing it.


i think that should be pretty easy.
the algorithm is dependent upon 2 values.  the number of listings you
consider
as top-listings for each result set and the number of customers that are
registered as preferred customers.
let me illustrate.
imagine you designate only the first entry of the resultant listings as a *
top-listing*.
in that case you can support a maximum of 4 preferred customers before you
can
no longer guarantee to each of the preferred customers their listing will be
a top-listing
25% of the time.  so, if you want more capacity you can increase the number
of
results that are designated as top-listing results.  suppose you increase
the number
to 2, now you have a capacity of 8 customers you can guarantee top-listing
status 25%
of the time.
what you would need to determine is what to do if ever you didnt want to
increment the
number of listings that are designated as top-listing customers and you were
already
at capacity for the number of customers the current capacity supports.
perhaps you
could start charging more at that point.

-nathan


Re: [PHP] PHP Memory Leak

2007-12-06 Thread Chris

Sascha Braun wrote:

Hi Everybody,

I have a couple of foreach loops which are ending in a for loop,
which causes the apache to consume the complete memory of the
server system the php engine is running on.

The nesting level is at round about three and looking like that:

$num_new = 4;
if (is_array($array)) {
foreach ($array as $key => value) {
if ($value['element'] == 'test1') {
foreach ($value['data'] as $skey => $svalue) {
echo $svalue;
}
} elseif ($value['element'] == 'test2') {
foreach ($value['data'] as $skey => $svalue) {
echo $svalue;
}
}
if ($num_new > 0) {

// this part causes the memory leak

for ($i = 0; $i < $num_new; $i++) {
echo "sgasdgga";
}
}   
}
}

I dont know if the above code is causing the memory leak the source
is a little more complex, if nessessary I will provide some more code,


If you don't know how are we supposed to know? :)

Add

memory_get_usage() calls all over the place and see what's going on.

eg:

error_log(__LINE__ . "\t" . memory_get_usage() . "\n", 3, 
'/path/to/log.file');


at various spots and go from there.

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] PHP Memory Leak

2007-12-06 Thread Casey





On Dec 6, 2007, at 3:15 PM, Sascha Braun <[EMAIL PROTECTED]>  
wrote:



Hi Everybody,

I have a couple of foreach loops which are ending in a for loop,
which causes the apache to consume the complete memory of the
server system the php engine is running on.

The nesting level is at round about three and looking like that:

$num_new = 4;
if (is_array($array)) {
   foreach ($array as $key => value)

Typo on above line?

{
   if ($value['element'] == 'test1') {
   foreach ($value['data'] as $skey => $svalue) {
   echo $svalue;
   }
   } elseif ($value['element'] == 'test2') {
   foreach ($value['data'] as $skey => $svalue) {
   echo $svalue;
   }
   }
   if ($num_new > 0) {

   // this part causes the memory leak

   for ($i = 0; $i < $num_new; $i++) {
   echo "sgasdgga";
   }
   }
   }
}

I dont know if the above code is causing the memory leak the source
is a little more complex, if nessessary I will provide some more code,

Thank you!

I hope for a solution

--
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] Another form handling posting question

2007-12-06 Thread Robert Cummings
On Thu, 2007-12-06 at 13:02 -0500, tedd wrote: 
> At 10:36 PM -0700 12/5/07, Mike Smith wrote:
> >I am trying to recursively send data to the same form.
> >
> >-snip-
> >
> >What is the best practice for doing this?
> >
> 
> I don't know what the "best" practice is, but this is the way I do it.
> 
> In the form I have a hidden field called step that controls flow via POST..
> 
> Based upon that value, I use a switch to direct the flow to different 
> forms -- all the forms have the same submit button.
> 
> So, it looks like this (pseudo-code):
> 
> $step = isset($_POST['step']) ? $_POST['step'] : 1;
> 
> 
> 
> switch $step
>{
>case 1:
>// present the form for step 1
>
> 
>case 2:
>// present the form for step 2
>
> 
>case 3:
>// present the form for step 3
>}
> 
> 
> 
> That way, it's simple to recursively change a form to gather information.
> 
> If you want to keep/store data in each gather, then either save it to 
> a dB or do sessions.
> 
> It works for me.

Not to critique your form logic itself, but IMHE it is much better to
name the submit button "continue" and not "submit". Some browsers, maybe
all (I can't remember), screw things up when you try to do form.submit()
in JavaScript if there is a field called submit.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread Daniel Brown
On Dec 6, 2007 9:10 PM, tedd <[EMAIL PROTECTED]> wrote:

> Also, I recently noticed that FF will add text to a Submit button if you 
> don't.

Actually, Tedd, even second-generation browsers (e.g. - Internet
Exploder 2.x, Netscape Navigator 2.x, et cetera) would add the text
"Submit Query" to a button if there was no ``value="Something"``
included in the tag.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] Seeking overlap algorithm

2007-12-06 Thread tedd

At 6:07 PM -0500 12/6/07, Nathan Nobbe wrote:

On Dec 6, 2007 4:59 PM, tedd <[EMAIL PROTECTED]> wrote:
 > The problem is, could you guarantee to a "preferred" service provider
 > that they would receive top-listing 25 percent of the time? Keep in
 > mind that preferred service providers will overlap. So, the question
 > is how to accommodate for that overlap?
 >
 > If anyone has an algorithm, I would be interested in hearing it.


i think that should be pretty easy. the algorithm is dependent upon 
2 values.  the number of listings you consider as top-listings for 
each result set and the number of customers that are registered as 
preferred customers.


let me illustrate. imagine you designate only the first entry of the 
resultant listings as a *
top-listing*. in that case you can support a maximum of 4 preferred 
customers before you
can no longer guarantee to each of the preferred customers their 
listing will be
a top-listing 25% of the time.  so, if you want more capacity you 
can increase the number

of results that are designated as top-listing results.

suppose you increase the number to 2, now you have a capacity of 8 
customers you can guarantee top-listing status 25% of the time.


what you would need to determine is what to do if ever you didnt 
want to increment the number of listings that are designated as 
top-listing customers and you were already at capacity for the 
number of customers the current capacity supports.


Yes, that was pretty easy, but that was not the answer to the 
question -- my error for not explaining it better.


Let me rephrase the question by providing an example.

Let's say we have a customer base that is spread-out at random over a 
geographic area. Each customer has designated a 50 mile radius from 
their location as being within their zone -- the map would look like 
a bomb saturation map, if you know what I mean.


Now, many of those areas overlap so that if a end-user is within that 
overlap he can see all the service providers that can provide 
service. It's a simple matter to pull those providers out of a 
database depending upon distance and show them to him. After all, 
that's the way it works, isn't it? The end-user is provided all the 
service providers who are within their service range.


However, if you are also considering that some of these service 
providers should be shown as "preferred" (i.e., at the top 25 percent 
of the time) then you might find yourself in a position of over 
selling the top position because there may be too many "preferred" 
service providers in certain areas.


Now, what I need is a way to analyze the distribution of the current 
service providers to see if a given location is open to being sold as 
a "preferred" position -- do you see what I mean?


Another example, let's say we have four "preferred" service providers 
at the same location. Obviously, we could not sell another 
"preferred" position within 100 miles.


Another example, let's say we have four "preferred" service providers 
100 miles apart, clearly we can sell more "preferred" positions. But, 
the number of positions available depends upon the distribution of 
the original four. If they were located in a straight line, then we 
could sell two positions between each one. But, if they were 
distributed in a square, we could only sell one. Do you see?


I know what solution I will be using unless someone comes up with 
something different. I just want to tap this knowledgeable group 
before I spin my wheels trying to solve a problem, that may be 
already solved.


Thanks, for your time.

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread tedd

At 9:02 PM -0500 12/6/07, Robert Cummings wrote:

On Thu, 2007-12-06 at 13:02 -0500, tedd wrote:

 >
 > 




Not to critique your form logic itself, but IMHE it is much better to
name the submit button "continue" and not "submit". Some browsers, maybe
all (I can't remember), screw things up when you try to do form.submit()
in JavaScript if there is a field called submit.

Cheers,
Rob.


Rob

As always, you are right. I wasn't thinking about js.

Also, I recently noticed that FF will add text to a Submit button if you don't.

There are lot's of things to remember here.

Thanks,

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread Daniel Brown
On Dec 6, 2007 9:49 PM, tedd <[EMAIL PROTECTED]> wrote:
> >On Dec 6, 2007 9:10 PM, tedd <[EMAIL PROTECTED]> wrote:
> >
> >>  Also, I recently noticed that FF will add text to a Submit button
> >>if you don't.
> >
> > Actually, Tedd, even second-generation browsers (e.g. - Internet
> >Exploder 2.x, Netscape Navigator 2.x, et cetera) would add the text
> >"Submit Query" to a button if there was no ``value="Something"``
> >included in the tag.
>
> Duh!
>
> That's like telling everyone to use the shower-head to water-pic your
> teeth as Vana White did -- like obvious!
>
> Oh well, I never said I was smart -- I just said I recently saw it.
> But, in my defense, I have always done it right so I never saw it
> until I ran someone one else's code that did it wrong.
>
> My technical side is like Swiss cheese -- you never know what holes I
> don't know and can be surprised at what I do.


Keep your replies on-list, old man!  ;-P

I know others enjoy your wit as much as I do!

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread Robert Cummings
On Thu, 2007-12-06 at 21:52 -0500, Daniel Brown wrote:
> On Dec 6, 2007 9:49 PM, tedd <[EMAIL PROTECTED]> wrote:
> > >On Dec 6, 2007 9:10 PM, tedd <[EMAIL PROTECTED]> wrote:
> > >
> > >>  Also, I recently noticed that FF will add text to a Submit button
> > >>if you don't.
> > >
> > > Actually, Tedd, even second-generation browsers (e.g. - Internet
> > >Exploder 2.x, Netscape Navigator 2.x, et cetera) would add the text
> > >"Submit Query" to a button if there was no ``value="Something"``
> > >included in the tag.
> >
> > Duh!
> >
> > That's like telling everyone to use the shower-head to water-pic your
> > teeth as Vana White did -- like obvious!

Am I getting old if I remember that clip on TV? :B

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] Another form handling posting question

2007-12-06 Thread Daniel Brown
On Dec 6, 2007 10:31 PM, Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Thu, 2007-12-06 at 21:52 -0500, Daniel Brown wrote:
> > > Duh!
> > >
> > > That's like telling everyone to use the shower-head to water-pic your
> > > teeth as Vana White did -- like obvious!
>
> Am I getting old if I remember that clip on TV? :B

Yes

 but at least you're in good company.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] How to handle rows of checkboxes upon form submit?

2007-12-06 Thread Casey
On Dec 6, 2007 10:12 PM, Rob Gould <[EMAIL PROTECTED]> wrote:
> Let's say I have a PHP script which lists a series of objects for sale at a 
> yard sale, each with a checkbox to the left of the name of the item.
>
> If I wanted to have a submit button, and run through the list of items that 
> were checked and act on them, how would I do that?
>
> To gain some knowledge, I went into phpMyAdmin and looked at their 
> checkboxes, and I see their code:
>
>  name="selected_fld[]">
>  name="selected_fld[]">
>  name="selected_fld[]">
>
>
> So it looks like they do something with name="select_fld[]", which must be 
> part of the secret to making this work.
>
> Any advice is greatly appreciated.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Use this code:


 
 
 
 Submit

', print_r($_POST, true), '';
?>

This will print out the postdata, along with the "secrets" to how this works.

-Casey

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



Re: [PHP] How to handle rows of checkboxes upon form submit?

2007-12-06 Thread Casey
On Dec 6, 2007 10:25 PM, Casey <[EMAIL PROTECTED]> wrote:
>
> On Dec 6, 2007 10:12 PM, Rob Gould <[EMAIL PROTECTED]> wrote:
> > Let's say I have a PHP script which lists a series of objects for sale at a 
> > yard sale, each with a checkbox to the left of the name of the item.
> >
> > If I wanted to have a submit button, and run through the list of items that 
> > were checked and act on them, how would I do that?
> >
> > To gain some knowledge, I went into phpMyAdmin and looked at their 
> > checkboxes, and I see their code:
> >
> >  > name="selected_fld[]">
> >  > name="selected_fld[]">
> >  > name="selected_fld[]">
> >
> >
> > So it looks like they do something with name="select_fld[]", which must be 
> > part of the secret to making this work.
> >
> > Any advice is greatly appreciated.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> Use this code:
> 
> 
>   name="selected_fld[]" />
>   name="selected_fld[]" />
>   name="selected_fld[]" />
>  Submit
> 
>   } else echo '', print_r($_POST, true), '';
> ?>
>
> This will print out the postdata, along with the "secrets" to how this works.
>
> -Casey
>

Sorry, parse error :]



 
 
 
 Submit

', print_r($_POST, true), '';
?>

This basically says what Stephen said.
-Casey

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



Re: [PHP] How to handle rows of checkboxes upon form submit?

2007-12-06 Thread Stephen Johnson
You will be passing the checkboxes as arrays ...

So you will need to access them that way on the next page

Your post field would look something like  (off the top of my head, so don't
quote me): 

 

Array
(
[selected_fid] =>
[0] => apples
[1] => oranges
[2] => bananas
) 


This assumes that the user selected all the results.  If for instances they
did not (say they checked apples and bananas), then your post array would
look like :
Array
(
[selected_fid] =>
[0] => apples
[1] => bananas
) 


The array will automatically increment starting at zero.  However, you can
prefill the array with specific information, in case you need to know which
boxes where checked and which were not...

 

There is no reason to do this with hardcode values, but if you were
accessing information from a database, and dynamically creating a series of
checkboxes, then it would be more useful to preload the array with the id
from the database rather then let it auto increment.

Hope you find this useful.


I would suggest for your reading enjoyment :

http://php.net/array

http://us.php.net/manual/en/reserved.variables.php  // specifically the
section on $_POST



--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




> From: Rob Gould <[EMAIL PROTECTED]>
> Date: Thu, 06 Dec 2007 22:12:22 -0800
> To: 
> Subject: [PHP] How to handle rows of checkboxes upon form submit?
> 
> Let's say I have a PHP script which lists a series of objects for sale at a
> yard sale, each with a checkbox to the left of the name of the item.
> 
> If I wanted to have a submit button, and run through the list of items that
> were checked and act on them, how would I do that?
> 
> To gain some knowledge, I went into phpMyAdmin and looked at their checkboxes,
> and I see their code:
> 
>  name="selected_fld[]">
>  name="selected_fld[]">
>  name="selected_fld[]">
> 
> 
> So it looks like they do something with name="select_fld[]", which must be
> part of the secret to making this work.
> 
> Any advice is greatly appreciated.
> 
> -- 
> 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



[PHP] How to handle rows of checkboxes upon form submit?

2007-12-06 Thread Rob Gould
Let's say I have a PHP script which lists a series of objects for sale at a 
yard sale, each with a checkbox to the left of the name of the item.

If I wanted to have a submit button, and run through the list of items that 
were checked and act on them, how would I do that?

To gain some knowledge, I went into phpMyAdmin and looked at their checkboxes, 
and I see their code:






So it looks like they do something with name="select_fld[]", which must be part 
of the secret to making this work.

Any advice is greatly appreciated.

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



[PHP] convert hex message to ascii msg, How?

2007-12-06 Thread Shelley Shyan
Hi all,

How could I convert a hex msg to ascii msg?
Is there a php function or sth?

Thanks.

Regards,
Shelley