Re: [PHP] nested objects
Actually it is academic intro to OO programing, the overkill html was just helping me understand the concept. Now I can put it to good use :-). - Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]> To: "Victor Matherly" <[EMAIL PROTECTED]> Cc: php-general@lists.php.net Sent: Friday, December 7, 2007 10:20:47 PM (GMT-0500) America/New_York Subject: Re: [PHP] nested objects Victor Matherly wrote: > > Hello list, > > I want to create a new object and nest the objects variable in an array of > another object. > I think I am going about it the correct way I think you are trying to swat a fly with a nuclear missle. in practice abstracting an HTML table into a big collection of objects is total overkill (although it might make an interesting accademic introduction into OO coding) ... > > class htmlTableCell { > var $cell_width; > var $cell_height; > var $cell_colspan; > var $cell_rowspan; > var $css_class; > var $cell_content; > var $cell_name; > > > function __construct($content = " "){ > > $this->cell_content = $content; > > > }// end construct > > function setContent($content){ > $this->cell_content = $content; > > }//end setContent function > > function setName($name){ > $this->cell_name = $name; > > }//end setContent function > > > function getContent(){ > return $this->cell_content; > > }//end setContent function > > } //end TableCell class > > > > > > > ?> > > > > > > > Victor J. Matherly > Technical Services > Wave Communications, Inc > http://www.wave-communications.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] nested objects
Victor Matherly wrote: > > Hello list, > > I want to create a new object and nest the objects variable in an array of > another object. > I think I am going about it the correct way I think you are trying to swat a fly with a nuclear missle. in practice abstracting an HTML table into a big collection of objects is total overkill (although it might make an interesting accademic introduction into OO coding) ... > > class htmlTableCell { > var $cell_width; > var $cell_height; > var $cell_colspan; > var $cell_rowspan; > var $css_class; > var $cell_content; > var $cell_name; > > > function __construct($content = " "){ > > $this->cell_content = $content; > > > }// end construct > > function setContent($content){ > $this->cell_content = $content; > > }//end setContent function > > function setName($name){ > $this->cell_name = $name; > > }//end setContent function > > > function getContent(){ > return $this->cell_content; > > }//end setContent function > > } //end TableCell class > > > > > > > ?> > > > > > > > Victor J. Matherly > Technical Services > Wave Communications, Inc > http://www.wave-communications.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Seeking overlap algorithm
On Dec 7, 2007 10:12 AM, Ford, Mike <[EMAIL PROTECTED]> wrote: > On 07 December 2007 02:14, tedd wrote: > > > > 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? > > A simplistic but effective way would be: > > (1) Locate all "preferred" providers within 50 miles of the potential new > one (presumably a maximum of four!). > > (2) For each of these, find how many suppliers are within their 50-mile > catchment radius. > > If any of the answers at step 2 is four, you lose; if none of them is, you > win. > > I can't think of any obvious ways to optimize this, but then I never did > properly "get" the travelling salesman or 4-colour problem! im ashamed to admit i blew off a couple of linear algebra classes and a calc-based stats class in college. had i paid attention, this might still be a trivial problem =/ ..., bah! -nathan
[PHP] Trading Notice
Hi from Fleming . Hope your Friday is cool and happy holidays. Something big for HxPn.pk over next few weeks. Check otc boards. Keep an eye out for it and get in early. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] nested objects
No problem, Just ask your doubts, we're here to help and get help :-) On 07/12/2007, Victor Matherly <[EMAIL PROTECTED]> wrote: > > Thanks that fixed it. That was so simple no wonder I was banging my head > on the wall :-). > > > > > - Original Message - > From: "Cesar D. Rodas" <[EMAIL PROTECTED]> > To: "Victor Matherly" <[EMAIL PROTECTED]> > Sent: Friday, December 7, 2007 2:37:23 PM (GMT-0500) America/New_York > Subject: Re: [PHP] nested objects > > Hello > > I hope this help you! > > > On 07/12/2007, Victor Matherly < [EMAIL PROTECTED] > > wrote: > > > > Hello list, > > I want to create a new object and nest the objects variable in an array of > another object. I think I am going about it the correct way but the variable > is not being stored or retrieved correctly from the main function. I can't > figure out what I am doing wrong. Can anyone help? Here is an example of > what I am trying to do: > > > > > > $html = " \n"; > > $row = new htmlTableRow(); > > $cell1 = new htmlTableCell(); > $cell1->setContent("test1"); > $cell1->setName("Left test"); > $row->AddCell($cell1); > > $cell2 = new htmlTableCell(); > $cell2->setContent("test2"); > $cell2->setName("right test"); > $row->AddCell($cell2); > > > > $html .= $row->buildRow(); > > > $html .= "\n"; > > print << > > > $html > > > > > > > HERE; > > > > class htmlTableRow { > > var $class; > var $cell_arr; > var $the_row; > > function htmlTableRow(){ > $this->cell_arr = array(); > > }//end construct > > function AddCell($cell) { > $this->cell_arr = $cell; > > $this->cell_arr[] = $cell; > > > > } > > function buildRow(){ > $temp = "\n"; > > foreach($this->cell_arr as $rowdata){ > > $temp .= "\t" . $rowdata->cell_content . "\n"; > > }//end foreach > $temp .= "\n"; > return $temp; > }//end build row funtion > > }// end htmlTableRow class > > > > class htmlTableCell { > var $cell_width; > var $cell_height; > var $cell_colspan; > var $cell_rowspan; > var $css_class; > var $cell_content; > var $cell_name; > > > function __construct($content = " "){ > > $this->cell_content = $content; > > > }// end construct > > function setContent($content){ > $this->cell_content = $content; > > }//end setContent function > > function setName($name){ > $this->cell_name = $name; > > }//end setContent function > > > function getContent(){ > return $this->cell_content; > > }//end setContent function > > } //end TableCell class > > > > > > > ?> > > Best regards > > > > Victor J. Matherly > Technical Services > Wave Communications, Inc > http://www.wave-communications.com > > -- > PHP General Mailing List ( http://www.php.net/ ) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > > > Cesar D. Rodas > http://www.cesarodas.com > http://www.thyphp.com > http://www.phpajax.org > Phone: +595-961-974165 > -- Best Regards Cesar D. Rodas http://www.cesarodas.com http://www.thyphp.com http://www.phpajax.org Phone: +595-961-974165
Re: [PHP] nested objects
Thanks that fixed it. That was so simple no wonder I was banging my head on the wall :-). - Original Message - From: "Cesar D. Rodas" <[EMAIL PROTECTED]> To: "Victor Matherly" <[EMAIL PROTECTED]> Sent: Friday, December 7, 2007 2:37:23 PM (GMT-0500) America/New_York Subject: Re: [PHP] nested objects Hello I hope this help you! On 07/12/2007, Victor Matherly < [EMAIL PROTECTED] > wrote: Hello list, I want to create a new object and nest the objects variable in an array of another object. I think I am going about it the correct way but the variable is not being stored or retrieved correctly from the main function. I can't figure out what I am doing wrong. Can anyone help? Here is an example of what I am trying to do: \n"; $row = new htmlTableRow(); $cell1 = new htmlTableCell(); $cell1->setContent("test1"); $cell1->setName("Left test"); $row->AddCell($cell1); $cell2 = new htmlTableCell(); $cell2->setContent("test2"); $cell2->setName("right test"); $row->AddCell($cell2); $html .= $row->buildRow(); $html .= "\n"; print << $html HERE; class htmlTableRow { var $class; var $cell_arr; var $the_row; function htmlTableRow(){ $this->cell_arr = array(); }//end construct function AddCell($cell) { $this->cell_arr = $cell; $this->cell_arr[] = $cell; } function buildRow(){ $temp = "\n"; foreach($this->cell_arr as $rowdata){ $temp .= "\t" . $rowdata->cell_content . "\n"; }//end foreach $temp .= "\n"; return $temp; }//end build row funtion }// end htmlTableRow class class htmlTableCell { var $cell_width; var $cell_height; var $cell_colspan; var $cell_rowspan; var $css_class; var $cell_content; var $cell_name; function __construct($content = " "){ $this->cell_content = $content; }// end construct function setContent($content){ $this->cell_content = $content; }//end setContent function function setName($name){ $this->cell_name = $name; }//end setContent function function getContent(){ return $this->cell_content; }//end setContent function } //end TableCell class ?> Best regards Victor J. Matherly Technical Services Wave Communications, Inc http://www.wave-communications.com -- PHP General Mailing List ( http://www.php.net/ ) To unsubscribe, visit: http://www.php.net/unsub.php -- Cesar D. Rodas http://www.cesarodas.com http://www.thyphp.com http://www.phpajax.org Phone: +595-961-974165 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] nested objects
Hello I hope this help you! On 07/12/2007, Victor Matherly <[EMAIL PROTECTED] > wrote: > > > > Hello list, > > I want to create a new object and nest the objects variable in an array of > another object. I think I am going about it the correct way but the > variable is not being stored or retrieved correctly from the main function. > I can't figure out what I am doing wrong. Can anyone help? Here is an > example of what I am trying to do: > > > > > > $html = " \n"; > >$row = new htmlTableRow(); > >$cell1 = new htmlTableCell(); >$cell1->setContent("test1"); >$cell1->setName("Left test"); >$row->AddCell($cell1); > >$cell2 = new htmlTableCell(); >$cell2->setContent("test2"); >$cell2->setName("right test"); >$row->AddCell($cell2); > > > > $html .= $row->buildRow(); > > > $html .= "\n"; > > print << > > > $html > > > > > > > HERE; > > > > class htmlTableRow { > > var $class; > var $cell_arr; > var $the_row; > > function htmlTableRow(){ > $this->cell_arr = array(); > > }//end construct > > function AddCell($cell) { > $this->cell_arr = $cell; $this->cell_arr[] = $cell; } > > function buildRow(){ > $temp = "\n"; > > foreach($this->cell_arr as $rowdata){ > > $temp .= "\t" . $rowdata->cell_content . "\n"; > > }//end foreach > $temp .= "\n"; > return $temp; > }//end build row funtion > > }// end htmlTableRow class > > > > class htmlTableCell { > var $cell_width; > var $cell_height; > var $cell_colspan; > var $cell_rowspan; > var $css_class; > var $cell_content; > var $cell_name; > > > function __construct($content = " "){ > > $this->cell_content = $content; > > > }// end construct > > function setContent($content){ > $this->cell_content = $content; > > }//end setContent function > > function setName($name){ > $this->cell_name = $name; > > }//end setContent function > > > function getContent(){ > return $this->cell_content; > > }//end setContent function > > } //end TableCell class > > > > > > > ?> Best regards Victor J. Matherly > Technical Services > Wave Communications, Inc > http://www.wave-communications.com > > -- > PHP General Mailing List ( http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Cesar D. Rodas http://www.cesarodas.com http://www.thyphp.com http://www.phpajax.org Phone: +595-961-974165
[PHP] nested objects
Hello list, I want to create a new object and nest the objects variable in an array of another object. I think I am going about it the correct way but the variable is not being stored or retrieved correctly from the main function. I can't figure out what I am doing wrong. Can anyone help? Here is an example of what I am trying to do: \n"; $row = new htmlTableRow(); $cell1 = new htmlTableCell(); $cell1->setContent("test1"); $cell1->setName("Left test"); $row->AddCell($cell1); $cell2 = new htmlTableCell(); $cell2->setContent("test2"); $cell2->setName("right test"); $row->AddCell($cell2); $html .= $row->buildRow(); $html .= "\n"; print << $html HERE; class htmlTableRow { var $class; var $cell_arr; var $the_row; function htmlTableRow(){ $this->cell_arr = array(); }//end construct function AddCell($cell) { $this->cell_arr = $cell; } function buildRow(){ $temp = "\n"; foreach($this->cell_arr as $rowdata){ $temp .= "\t" . $rowdata->cell_content . "\n"; }//end foreach $temp .= "\n"; return $temp; }//end build row funtion }// end htmlTableRow class class htmlTableCell { var $cell_width; var $cell_height; var $cell_colspan; var $cell_rowspan; var $css_class; var $cell_content; var $cell_name; function __construct($content = " "){ $this->cell_content = $content; }// end construct function setContent($content){ $this->cell_content = $content; }//end setContent function function setName($name){ $this->cell_name = $name; }//end setContent function function getContent(){ return $this->cell_content; }//end setContent function } //end TableCell class ?> Victor J. Matherly Technical Services Wave Communications, Inc http://www.wave-communications.com -- 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?
Jim Lucas wrote: Afan Pasalic wrote: Jim Lucas wrote: Afan Pasalic 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 Try something like this. my table structure was CREATE TABLE `cmsws_com`.`examples` ( `col1` ENUM( '0', '1' ) NOT NULL , `col2` ENUM( 'one', 'two', 'three' ) NOT NULL ) ENGINE = MYISAM 0) { while ($row = mysql_fetch_assoc($result)) { print_r($row); } } My results were Array ( [Field] => col1 [Type] => enum('0','1') [Null] => NO [Key] => [Default] => [Extra] => ) Array ( [Field] => col2 [Type] => enum('one','two','three') [Null] => NO [Key] => [Default] => [Extra] => ) Hope this fits the bill Thanks Jim. But, I was actually looking for column type is like ENUM, with some differences. And it's SET type. -afan I must be missing something else you haven't mentioned, AFAIK this gives you the information that you are asking for. The output shows that it is telling you Type = enum(...) Isn't that what you are asking for? If it were a set type column, then it would say Type = set(...) What are the differences that you speak of / request? Oh.I'm sorry Jim. Yes, you are right. This was my first email. After this one I asked other one where was looking for column type close to ENUM() and the answer was SET() and I was thinking you replied to that one. My bad. I apologize. -afan -- 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?
Afan Pasalic wrote: > Jim Lucas wrote: >> Afan Pasalic 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 >>> >> >> Try something like this. >> >> >> my table structure was >> >> CREATE TABLE `cmsws_com`.`examples` ( >> `col1` ENUM( '0', '1' ) NOT NULL , >> `col2` ENUM( 'one', 'two', 'three' ) NOT NULL >> ) ENGINE = MYISAM >> >> >> > >> # setup your db connection and stuff... >> >> $result = mysql_query("SHOW COLUMNS FROM examples"); >> if (!$result) { >> echo 'Could not run query: ' . mysql_error(); >> exit; >> } >> if (mysql_num_rows($result) > 0) { >> while ($row = mysql_fetch_assoc($result)) { >> print_r($row); >> } >> } >> >> >> My results were >> >> Array >> ( >> [Field] => col1 >> [Type] => enum('0','1') >> [Null] => NO >> [Key] => >> [Default] => >> [Extra] => >> ) >> Array >> ( >> [Field] => col2 >> [Type] => enum('one','two','three') >> [Null] => NO >> [Key] => >> [Default] => >> [Extra] => >> ) >> >> >> Hope this fits the bill >> >> > > Thanks Jim. > But, I was actually looking for column type is like ENUM, with some > differences. And it's SET type. > > -afan > I must be missing something else you haven't mentioned, AFAIK this gives you the information that you are asking for. The output shows that it is telling you Type = enum(...) Isn't that what you are asking for? If it were a set type column, then it would say Type = set(...) What are the differences that you speak of / request? -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Seeking overlap algorithm
On 07 December 2007 02:14, tedd wrote: > 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? A simplistic but effective way would be: (1) Locate all "preferred" providers within 50 miles of the potential new one (presumably a maximum of four!). (2) For each of these, find how many suppliers are within their 50-mile catchment radius. If any of the answers at step 2 is four, you lose; if none of them is, you win. I can't think of any obvious ways to optimize this, but then I never did properly "get" the travelling salesman or 4-colour problem! Cheers! Mike - Mike Ford, Electronic Information Services Adviser, JG125, The Headingley Library, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 812 4730 Fax: +44 113 812 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert hex message to ascii msg, How?
At 3:51 PM +0800 12/7/07, Shelley Shyan wrote: Hi all, How could I convert a hex msg to ascii msg? Is there a php function or sth? Shelley: You mean like a stream of HEX to be translated to ASCII, like: 41 41 52 50 to A A R P (I'm am member) 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
At 9:52 PM -0500 12/6/07, Daniel Brown wrote: On Dec 6, 2007 9:49 PM, tedd <[EMAIL PROTECTED]> wrote: > 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! Yeah, but you're assuming that I wanted to display my ignorance openly. 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] Re: How to create multipart e-mail bodies?
sorry one more It also worked if i did the following.. Content-Type: multipart/alternative; boundary="-=Part233475926a47beb07.46978329" Delivered-To: [EMAIL PROTECTED] ---=Part233475926a47beb07.46978329 Content-Type:text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit ... Sándor Tamás (HostWare Kft . ) wrote: Hi, I don't know if it is a PHP question, but I give it a try. I've been trying this subject for a while, but with less success. Now I can create mail bodies like this: Content-Type: multipart/alternative; boundary="-=Part233475926a47beb07.46978329" ---=Part233475926a47beb07.46978329 Content-Type:text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline Hi there! ---=Part233475926a47beb07.46978329 Content-Type:text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline Hi there! This will be fun! ---=Part233475926a47beb07.46978329-- But my mail client can't show any part of it. When I take a look at the source code, I can see that it recognise the boundaries, but somehow for some reason it doesn't show it. Any idea? Thanks, SanTa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to create multipart e-mail bodies?
I had the same problem last week and it turned out to be extra line breaks, try.. Content-Type: multipart/alternative; boundary="-=Part233475926a47beb07.46978329" ---=Part233475926a47beb07.46978329 Content-Type:text/plain; charset=utf-8 . Nathan Sándor Tamás (HostWare Kft . ) wrote: Hi, I don't know if it is a PHP question, but I give it a try. I've been trying this subject for a while, but with less success. Now I can create mail bodies like this: Content-Type: multipart/alternative; boundary="-=Part233475926a47beb07.46978329" ---=Part233475926a47beb07.46978329 Content-Type:text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline Hi there! ---=Part233475926a47beb07.46978329 Content-Type:text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline Hi there! This will be fun! ---=Part233475926a47beb07.46978329-- But my mail client can't show any part of it. When I take a look at the source code, I can see that it recognise the boundaries, but somehow for some reason it doesn't show it. Any idea? Thanks, SanTa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Seeking overlap algorithm
On Dec 6, 2007 9:14 PM, tedd <[EMAIL PROTECTED]> wrote: > 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. i see the problem more clearly now. unfortunately, i dont know the solution off the top of my head :( if i think of something in the near future ill toss it on the list. -nathan
Re: [PHP] shared memory access - shmod_open
Richard Lynch wrote: > 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. > The problem is that 0644 == 420, because 0644 is parsed as "644 base 8" (the zero prefix forces the number to octal...) So 420 (decimal) is actually the correct value. RTFM for chmod, which gives you a big hint about this... -- 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?
Jim Lucas wrote: Afan Pasalic 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 Try something like this. my table structure was CREATE TABLE `cmsws_com`.`examples` ( `col1` ENUM( '0', '1' ) NOT NULL , `col2` ENUM( 'one', 'two', 'three' ) NOT NULL ) ENGINE = MYISAM 0) { while ($row = mysql_fetch_assoc($result)) { print_r($row); } } My results were Array ( [Field] => col1 [Type] => enum('0','1') [Null] => NO [Key] => [Default] => [Extra] => ) Array ( [Field] => col2 [Type] => enum('one','two','three') [Null] => NO [Key] => [Default] => [Extra] => ) Hope this fits the bill Thanks Jim. But, I was actually looking for column type is like ENUM, with some differences. And it's SET type. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to create multipart e-mail bodies?
Thanks, but unfortunately my ISP does not implemented PEAR, and uses PHP 4.3.10. You can view the source code on http://pear.php.net and use that. Your ISP doesn't have to "support" PEAR. -- 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
[PHP] proc_open fclose streams..
Hi Guys, Hoping somebody out there may have come across this one, possible functionality request depending on responses. $descriptor = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w") ); $process = proc_open('mysql', $descriptor, $pipes); fwrite($pipes[0], 'show databases;'); echo stream_get_contents($pipes[1]); //won't work, crash, time out.. nothing returns as we need to.. fwrite($pipes[0], 'show databases;'); fclose($pipes[0]); // note the fclose echo stream_get_contents($pipes[1]); I don't want to fclose pipes[0] though, as i want to keep it open and keep writing to it, alternating with reading from pipes[1] and [2].. so a replacement for fclose, or an fflush on stdout that works? The problem appears to be that nothing is returned to php until the stdin pipe is closed, even if I write hundreds of commands to it. I'm on php 5.1.6/5.2.4 on various linux installs recap: spawn process, keep open for the duration of script execution, read and write multiple times to same process, then close - even better latch on to an already running process by id - any ideas methods etc? Cheers, Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to create multipart e-mail bodies?
I don't know if it is a PHP question, but I give it a try. I've been trying this subject for a while, but with less success. Now I can create mail bodies like this: http://www.phpguru.org/downloads/html.mime.mail/ -- 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] How to create multipart e-mail bodies?
Well, the implementation problem could be fixed by "copying" PEAR into your source folder. That should work even with PHP4 but without the nice class architecture. I just can recommend - PEAR is state of the art, and it works perfectly. But think about switching to PHP5. My hosting provider serves both, controlled via htaccess. :-) Rob - Ursprüngliche Nachricht - Von: "Sándor Tamás (HostWare Kft.)" <[EMAIL PROTECTED]> Datum: Freitag, Dezember 7, 2007 12:19 pm Betreff: Re: [PHP] How to create multipart e-mail bodies? An: [EMAIL PROTECTED] Cc: php-general@lists.php.net > Thanks, but unfortunately my ISP does not implemented PEAR, and > uses PHP > 4.3.10. > > - Original Message - > From: <[EMAIL PROTECTED]> > To: ""Sándor Tamás (HostWare Kft.)"" <[EMAIL PROTECTED]> > Cc: > Sent: Friday, December 07, 2007 12:07 PM > Subject: Re: [PHP] How to create multipart e-mail bodies? > > > Hi! > > You should take a look at... > > http://pear.php.net/package/Mail > http://pear.php.net/package/Mail_Mime > > http://pear.php.net/manual/en/package.mail.mail-mime.php > !!! http://pear.php.net/manual/en/package.mail.mail- > mime.example.php !!! > > This should give you a perfect intro... > > My 2 cents. > > Rob > > - Ursprüngliche Nachricht - > Von: "Sándor Tamás (HostWare Kft.)" <[EMAIL PROTECTED]> > Datum: Freitag, Dezember 7, 2007 12:04 pm > Betreff: [PHP] How to create multipart e-mail bodies? > An: php-general@lists.php.net > > > Hi, > > > > I don't know if it is a PHP question, but I give it a try. > > > > I've been trying this subject for a while, but with less success. > > Now I can create mail bodies like this: > > > > Content-Type: multipart/alternative; > >boundary="-=Part233475926a47beb07.46978329" > > > > > > ---=Part233475926a47beb07.46978329 > > Content-Type:text/plain; charset=utf-8 > > Content-Transfer-Encoding: 8bit > > Content-Disposition: inline > > > > Hi there! > > > > ---=Part233475926a47beb07.46978329 > > Content-Type:text/html; charset=utf-8 > > Content-Transfer-Encoding: 8bit > > Content-Disposition: inline > > > > Hi there! > > This will be fun! > > > > > > ---=Part233475926a47beb07.46978329-- > > > > > > But my mail client can't show any part of it. When I take a look at > > the > > source code, I can see that it recognise the boundaries, but > > somehow for > > some reason it doesn't show it. > > > > Any idea? > > > > Thanks, > > SanTa > > > > -- > > 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 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] shared memory access - shmod_open
Yes, thank you. I checked this thread before writing here. But following the hints there does not help either. Rolf. Daniel Brown-5 wrote: > > 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 > > > -- View this message in context: http://www.nabble.com/shared-memory-access---shmod_open-tf4954760.html#a14211184 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] shared memory access - shmod_open
Thank you for your reply. shmop_open($sem_key, "w", 420, 1) creates the same error message: --- [07-Dec-2007 12:34:23] PHP Warning: shmop_open(): unable to attach or create shared memory segment in ... [07-Dec-2007 12:34:23] PHP Stack trace: [07-Dec-2007 12:34:23] PHP 1. {main}() ...test.php:0 [07-Dec-2007 12:34:23] PHP 2. shmop_open(1996497860, 'w', 420, 1) ... test.php:13 Now PHP (or whatever) doesn't change the value 420. I already googled for the message, but could not find any hints. Regards, Rolf. Richard Lynch wrote: > > 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 > > > -- View this message in context: http://www.nabble.com/shared-memory-access---shmod_open-tf4954760.html#a14211151 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] How to create multipart e-mail bodies?
Thanks, but unfortunately my ISP does not implemented PEAR, and uses PHP 4.3.10. - Original Message - From: <[EMAIL PROTECTED]> To: ""Sándor Tamás (HostWare Kft.)"" <[EMAIL PROTECTED]> Cc: Sent: Friday, December 07, 2007 12:07 PM Subject: Re: [PHP] How to create multipart e-mail bodies? Hi! You should take a look at... http://pear.php.net/package/Mail http://pear.php.net/package/Mail_Mime http://pear.php.net/manual/en/package.mail.mail-mime.php !!! http://pear.php.net/manual/en/package.mail.mail-mime.example.php !!! This should give you a perfect intro... My 2 cents. Rob - Ursprüngliche Nachricht - Von: "Sándor Tamás (HostWare Kft.)" <[EMAIL PROTECTED]> Datum: Freitag, Dezember 7, 2007 12:04 pm Betreff: [PHP] How to create multipart e-mail bodies? An: php-general@lists.php.net Hi, I don't know if it is a PHP question, but I give it a try. I've been trying this subject for a while, but with less success. Now I can create mail bodies like this: Content-Type: multipart/alternative; boundary="-=Part233475926a47beb07.46978329" ---=Part233475926a47beb07.46978329 Content-Type:text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline Hi there! ---=Part233475926a47beb07.46978329 Content-Type:text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline Hi there! This will be fun! ---=Part233475926a47beb07.46978329-- But my mail client can't show any part of it. When I take a look at the source code, I can see that it recognise the boundaries, but somehow for some reason it doesn't show it. Any idea? Thanks, SanTa -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to create multipart e-mail bodies?
2007. 12. 7, péntek keltezéssel 12.00-kor Sándor Tamás (HostWare Kft.) ezt írta: > Hi, > > I don't know if it is a PHP question, but I give it a try. > > I've been trying this subject for a while, but with less success. > Now I can create mail bodies like this: > > Content-Type: multipart/alternative; > boundary="-=Part233475926a47beb07.46978329" > > > ---=Part233475926a47beb07.46978329 > Content-Type:text/plain; charset=utf-8 > Content-Transfer-Encoding: 8bit > Content-Disposition: inline > > Hi there! > > ---=Part233475926a47beb07.46978329 > Content-Type:text/html; charset=utf-8 > Content-Transfer-Encoding: 8bit > Content-Disposition: inline > > Hi there! > This will be fun! > > > ---=Part233475926a47beb07.46978329-- > > > But my mail client can't show any part of it. When I take a look at the > source code, I can see that it recognise the boundaries, but somehow for > some reason it doesn't show it. > > Any idea? I suggest checking out phpmailer. http://phpmailer.codeworxtech.com/ If you don't want to use it, you can view its source and see how it does the job and code your own mailer based on that. greets Zoltán Németh > > Thanks, > SanTa > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to create multipart e-mail bodies?
Sándor Tamás (HostWare Kft.) wrote: > But my mail client can't show any part of it. When I take a look at > the source code, I can see that it recognise the boundaries, but > somehow for some reason it doesn't show it. Does your email header also include this: MIME-Version: 1.0 /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert hex message to ascii msg, How?
How could I convert a hex msg to ascii msg? Is there a php function or sth? Try posting a small example. -- 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] How to create multipart e-mail bodies?
Hi! You should take a look at... http://pear.php.net/package/Mail http://pear.php.net/package/Mail_Mime http://pear.php.net/manual/en/package.mail.mail-mime.php !!! http://pear.php.net/manual/en/package.mail.mail-mime.example.php !!! This should give you a perfect intro... My 2 cents. Rob - Ursprüngliche Nachricht - Von: "Sándor Tamás (HostWare Kft.)" <[EMAIL PROTECTED]> Datum: Freitag, Dezember 7, 2007 12:04 pm Betreff: [PHP] How to create multipart e-mail bodies? An: php-general@lists.php.net > Hi, > > I don't know if it is a PHP question, but I give it a try. > > I've been trying this subject for a while, but with less success. > Now I can create mail bodies like this: > > Content-Type: multipart/alternative; >boundary="-=Part233475926a47beb07.46978329" > > > ---=Part233475926a47beb07.46978329 > Content-Type:text/plain; charset=utf-8 > Content-Transfer-Encoding: 8bit > Content-Disposition: inline > > Hi there! > > ---=Part233475926a47beb07.46978329 > Content-Type:text/html; charset=utf-8 > Content-Transfer-Encoding: 8bit > Content-Disposition: inline > > Hi there! > This will be fun! > > > ---=Part233475926a47beb07.46978329-- > > > But my mail client can't show any part of it. When I take a look at > the > source code, I can see that it recognise the boundaries, but > somehow for > some reason it doesn't show it. > > Any idea? > > Thanks, > SanTa > > -- > 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 create multipart e-mail bodies?
Hi, I don't know if it is a PHP question, but I give it a try. I've been trying this subject for a while, but with less success. Now I can create mail bodies like this: Content-Type: multipart/alternative; boundary="-=Part233475926a47beb07.46978329" ---=Part233475926a47beb07.46978329 Content-Type:text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline Hi there! ---=Part233475926a47beb07.46978329 Content-Type:text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline Hi there! This will be fun! ---=Part233475926a47beb07.46978329-- But my mail client can't show any part of it. When I take a look at the source code, I can see that it recognise the boundaries, but somehow for some reason it doesn't show it. Any idea? Thanks, SanTa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to handle rows of checkboxes upon form submit?
foreach($_POST['selected_fld'] as $key => $val){ echo 'KEY:' $key . ' - VALUE:' . $val . ''; } Rob Gould 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: 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
Re: [PHP] PHP Memory Leak
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; } } I would do a in_array here.. if (in_array($value['element'], array('test1', 'test2') ) ) { foreach ($value['data'] as $skey => $svalue) { echo $svalue; } } if ($num_new > 0) { where are you lowering this number? From what I can tell, it is always going to be 4 // this part causes the memory leak for ($i = 0; $i < $num_new; $i++) { you have a $i - 0 (a minus sign) not equals 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! np I hope for a solution How about that? -- Jim Lucas "Perseverance is not a long race; it is many short races one after the other" Walter Elliot "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 -- 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?
Afan Pasalic 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 Try something like this. my table structure was CREATE TABLE `cmsws_com`.`examples` ( `col1` ENUM( '0', '1' ) NOT NULL , `col2` ENUM( 'one', 'two', 'three' ) NOT NULL ) ENGINE = MYISAM 0) { while ($row = mysql_fetch_assoc($result)) { print_r($row); } } My results were Array ( [Field] => col1 [Type] => enum('0','1') [Null] => NO [Key] => [Default] => [Extra] => ) Array ( [Field] => col2 [Type] => enum('one','two','three') [Null] => NO [Key] => [Default] => [Extra] => ) Hope this fits the bill -- Jim Lucas "Perseverance is not a long race; it is many short races one after the other" Walter Elliot "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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php