php-general Digest 14 Jul 2008 16:32:27 -0000 Issue 5568

2008-07-14 Thread php-general-digest-help

php-general Digest 14 Jul 2008 16:32:27 - Issue 5568

Topics (messages 276740 through 276752):

Re: Freelance PHP development in India
276740 by: Wolf
276743 by: Irimia, Suleapa
276746 by: Ryan S
276748 by: Denis L. Menezes
276751 by: Gabriel Sosa
276752 by: Robert Cummings

need advice on a free DB hosting site
276741 by: willyam pax
276744 by: Irimia, Suleapa
276745 by: Per Jessen
276747 by: Eric Butera

Re: IPv6 validation
276742 by: Lester Caine

Re: case and accent - insensitive regular expression?
276749 by: Giulio Mastrosanti
276750 by: Andrew Ballard

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---



Denis L. Menezes wrote:

Dear friends.

I am looking for freelance web developers in India.

Can contact me?

Thanks
Denis


Why just in India?  There are a number of us available via the world.

Wolf

---End Message---
---BeginMessage---

Wolf wrote:



Denis L. Menezes wrote:

Dear friends.

I am looking for freelance web developers in India.

Can contact me?

Thanks
Denis


Why just in India?  There are a number of us available via the world.

Wolf





Cause they are cheaper?


__
//Just my 2 cents


smime.p7s
Description: S/MIME Cryptographic Signature
---End Message---
---BeginMessage---




snip
 Dear friends.
 
 I am looking for freelance web developers in India.
 
 Can contact me?
 

Why just in India?  There are a number of us available via the world.

Wolf
/snip

I'm guessing because he wants a REAL cheap solution... 
what you (probably) charge for 5-7hrs work would probably be the same that 
someone in india charges for a day or two or the whole project.

HTH

Cheers!
R



  
---End Message---
---BeginMessage---

Dear Ryan, Wolf.

Apologies for asking from India only. No offence meant.

It is because I am from India and I can personally meet and discuss with the 
programmers. Cost is also an issue. Mine is a startup and the finances are 
low. :-(


Apologies.
Denis


- Original Message - 
From: Ryan S [EMAIL PROTECTED]

To: Wolf [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: PHP General [EMAIL PROTECTED]
Sent: Monday, July 14, 2008 8:34 PM
Subject: Re: [PHP] Freelance PHP development in India







snip

Dear friends.

I am looking for freelance web developers in India.

Can contact me?



Why just in India?  There are a number of us available via the world.

Wolf
/snip

I'm guessing because he wants a REAL cheap solution...
what you (probably) charge for 5-7hrs work would probably be the same that 
someone in india charges for a day or two or the whole project.


HTH

Cheers!
R





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



---End Message---
---BeginMessage---
why not argentina?



On Mon, Jul 14, 2008 at 10:31 AM, Denis L. Menezes [EMAIL PROTECTED]
wrote:

 Dear Ryan, Wolf.

 Apologies for asking from India only. No offence meant.

 It is because I am from India and I can personally meet and discuss with
 the programmers. Cost is also an issue. Mine is a startup and the finances
 are low. :-(

 Apologies.
 Denis


 - Original Message - From: Ryan S [EMAIL PROTECTED]
 To: Wolf [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Cc: PHP General [EMAIL PROTECTED]
 Sent: Monday, July 14, 2008 8:34 PM
 Subject: Re: [PHP] Freelance PHP development in India







 snip

 Dear friends.

 I am looking for freelance web developers in India.

 Can contact me?


 Why just in India?  There are a number of us available via the world.

 Wolf
 /snip

 I'm guessing because he wants a REAL cheap solution...
 what you (probably) charge for 5-7hrs work would probably be the same that
 someone in india charges for a day or two or the whole project.

 HTH

 Cheers!
 R





 --
 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




-- 
Los sabios buscan la sabiduría; los necios creen haberla encontrado.
Gabriel Sosa
---End Message---
---BeginMessage---
On Mon, 2008-07-14 at 11:01 +0300, Irimia, Suleapa wrote:
 Wolf wrote:
  
  
  Denis L. Menezes wrote:
  Dear friends.
 
  I am looking for freelance web developers in India.
 
  Can contact me?
 
  Thanks
  Denis
 
  Why just in India?  There are a number of us available via the world.
  
  Wolf

 
 Cause they are cheaper?

 //Just my 2 cents

Is that 2 cents per hour?

;)

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

---End Message---
---BeginMessage---
hi
hello everyone im stil new here i just want
some advice...now im working on a database install 

Re: [PHP] IPv6 validation

2008-07-14 Thread Lester Caine

Per Jessen wrote:

Kevin Waterson wrote:


This one time, at band camp, Per Jessen [EMAIL PROTECTED] wrote:


No, it's a simple matter of need.  People also run apache 1.x, mysql
3.x etc.  There are still Linux 2.2 and 2.4 systems out there too.

4 years its been, thats incompetence.

Kevin


Kevin, I don't know how old you are nor how long you have been in IT,
but your opinions suggest you might be fairly inexperienced. 
Like I said, remaining back-level with software or an OS it's a matter

of need or choice.  Sometime both are heavily influenced by time and
money.  Not upgrading something to PHP5 due to lack of manpower is not
incompetent at all, it's reality. 


Seconded.
I never deployed PHP4 having 'come on board' just as PHP5 was reaching RC 
stage so I started with that in the field, but I STILL have to watch that the 
code that I'm writing in other projects is PHP4 compatible. Most of what I'm 
doing now was originally working on Builder5/6 code - and code written in the 
mid 90's is STILL in use in the field. No time to 'upgrade' and no incentive 
since the customers are more than happy.

So 4 years is nothing in IT terms :)
I'm was a heavy lobbyist for getting PHP4 killed off, but THAT is more to do 
with getting PHP6 out the door. Something that is going to be much more useful 
even for an 'only English speaking' user. The number of time I cut and past 
overseas addresses only to find the address label is unusable! :( Ascii is 
fine for internal coding, but for real world data ..


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



Re: [PHP] Freelance PHP development in India

2008-07-14 Thread Irimia, Suleapa

Wolf wrote:



Denis L. Menezes wrote:

Dear friends.

I am looking for freelance web developers in India.

Can contact me?

Thanks
Denis


Why just in India?  There are a number of us available via the world.

Wolf





Cause they are cheaper?


__
//Just my 2 cents


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PHP] need advice on a free DB hosting site

2008-07-14 Thread Irimia, Suleapa

willyam pax wrote:

hi
hello everyone im stil new here i just want
some advice...now im working on a database install script in phpjust a
simple one...
i just need to test it online thats why i need advice on a database hosting
site that is free..
that also i can activate it with a username and password, can create
database or just select it.. 






Google may help you with this, but anyway ...

http://www.insanegb.com/ipanel/order - PHP, MySQL, 250mb space, 5gb 
bandwidth


http://www.5gbfree.com/

//Irimia


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PHP] need advice on a free DB hosting site

2008-07-14 Thread Per Jessen
willyam pax wrote:

 hi
 hello everyone im stil new here i just want
 some advice...now im working on a database install script in
 phpjust a simple one...
 i just need to test it online thats why i need advice on a database
 hosting site that is free..

How about installing a database on your own PC?  That's free.


/Per Jessen, Zürich


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



Re: [PHP] Freelance PHP development in India

2008-07-14 Thread Ryan S




snip
 Dear friends.
 
 I am looking for freelance web developers in India.
 
 Can contact me?
 

Why just in India?  There are a number of us available via the world.

Wolf
/snip

I'm guessing because he wants a REAL cheap solution... 
what you (probably) charge for 5-7hrs work would probably be the same that 
someone in india charges for a day or two or the whole project.

HTH

Cheers!
R



  

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



Re: [PHP] need advice on a free DB hosting site

2008-07-14 Thread Eric Butera
On Mon, Jul 14, 2008 at 4:47 AM, Per Jessen [EMAIL PROTECTED] wrote:
 willyam pax wrote:

 hi
 hello everyone im stil new here i just want
 some advice...now im working on a database install script in
 phpjust a simple one...
 i just need to test it online thats why i need advice on a database
 hosting site that is free..

 How about installing a database on your own PC?  That's free.


 /Per Jessen, Zürich


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



This is true.  If you don't want to install a bunch of stuff on your
computer you can even download a vmware image with a server and just
use that.

http://www.vmware.com/appliances/directory/cat/53


Re: [PHP] Freelance PHP development in India

2008-07-14 Thread Denis L. Menezes

Dear Ryan, Wolf.

Apologies for asking from India only. No offence meant.

It is because I am from India and I can personally meet and discuss with the 
programmers. Cost is also an issue. Mine is a startup and the finances are 
low. :-(


Apologies.
Denis


- Original Message - 
From: Ryan S [EMAIL PROTECTED]

To: Wolf [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: PHP General php-general@lists.php.net
Sent: Monday, July 14, 2008 8:34 PM
Subject: Re: [PHP] Freelance PHP development in India







snip

Dear friends.

I am looking for freelance web developers in India.

Can contact me?



Why just in India?  There are a number of us available via the world.

Wolf
/snip

I'm guessing because he wants a REAL cheap solution...
what you (probably) charge for 5-7hrs work would probably be the same that 
someone in india charges for a day or two or the whole project.


HTH

Cheers!
R





--
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] case and accent - insensitive regular expression?

2008-07-14 Thread Giulio Mastrosanti




First of all thank you all for your answers, and thank you for your time

and yes Tedd, my question was quite ambiguous in that point.

Andrew is right, i don't want to change in any way the list of keys I  
show in the result, I just want to find the way to higlight the  
matching words, regardless of their accent variations.


So I think his Andrew's suggestion could be a good solution, and I'll  
try it ASAP...


let me se if i correctly understood:

$search = preg_quote($word); -- quotes chars that could be intrepreted  
like regex special chars


$search = str_replace('e', '[eèéêë]', $search);  --  trasforms i.e.  
cafe in caf[eèéêë], so matches all the accented variations


return preg_replace('/\b' ...  -- replaces all the occurences adding  
the tags, you use \b as word boundary, right?


it seems a fine soultion to the problem!

the only thing i must add is, befor calling highlight_search_terms, to  
'normalize' the word string ( the word used for the search) to  
transform it removing the accentated versions of the chars:


$word = preg_replace('[èé]{1}','e',$word);
$word = preg_replace('[à]{1}','a',$word);

that because also the search string could contain an accented char,  
and this way I avoid to perform str_replace in the  
highlight_search_terms function for every combination of accented chars


well, i think I'm on the good way now, unfortunately I have some other  
urgent work and can't try it immediately, but I'll let you know:)


thank you!

 Giulio




I may be mistaken (and if I am, then just ignore this as ignorant
rambling), but I don't think he's wanting to replace the accented
characters in the original string. I think he's just wanting the
pattern to find all variations of the same string and highlight them
without changing them. For example, his last paragraph would look  
like

this:

[quote]
now my problem is to find a way ( I imagine with some kind of regular
expression ) to achieve in php a search and replace
accent-insensitive, so that i can find the word 'span
class=keysearchcafe/span' in a string also if it is 'span
class=keysearchcafé/span', or 'span
class=keysearchCAFÉ/span', or 'span
class=keysearchCAFE/span',  and vice-versa.
[/quote]

The best I can think of right now is something like this:

?php

function highlight_search_terms($word, $string) {
$search = preg_quote($word);

$search = str_replace('a', '[aàáâãäå]', $search);
$search = str_replace('e', '[eèéêë]', $search);
/* repeat for each possible accented character */

return preg_replace('/\b' . $search . '\b/i', 'span
class=keysearch$0/span', $string);

}

$string = now my problem is to find a way ( I imagine with some kind
of regular expression ) to achieve in php a search and replace
accent-insensitive, so that i can find the word 'cafe' in a string
also if it is 'café', or 'CAFÉ', or 'CAFE',  and vice-versa.;


echo highlight_search_terms('cafe', $string);

?

Andrew


Andrew:

You may be right -- it's ambiguous now that I review it again. He  
does say search and replace but I'm not sure if that's what he  
really wants. It looks more like search with one string and  
highlight all like-strings.


Cheers,

tedd


--




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



Re: [PHP] case and accent - insensitive regular expression?

2008-07-14 Thread Andrew Ballard
On Mon, Jul 14, 2008 at 11:06 AM, Giulio Mastrosanti
[EMAIL PROTECTED] wrote:


 First of all thank you all for your answers, and thank you for your time

 and yes Tedd, my question was quite ambiguous in that point.

 Andrew is right, i don't want to change in any way the list of keys I show
 in the result, I just want to find the way to higlight the matching words,
 regardless of their accent variations.

 So I think his Andrew's suggestion could be a good solution, and I'll try it
 ASAP...

 let me se if i correctly understood:

 $search = preg_quote($word); -- quotes chars that could be intrepreted like
 regex special chars

 $search = str_replace('e', '[eטיךכ]', $search);  --  trasforms i.e. cafe in
 caf[eטיךכ], so matches all the accented variations

 return preg_replace('/\b' ...  -- replaces all the occurences adding the
 tags, you use \b as word boundary, right?

Yes, yes, and yes. :-)


 it seems a fine soultion to the problem!

 the only thing i must add is, befor calling highlight_search_terms, to
 'normalize' the word string ( the word used for the search) to transform it
 removing the accentated versions of the chars:

 $word = preg_replace('[טי]{1}','e',$word);
 $word = preg_replace('[א]{1}','a',$word);

 that because also the search string could contain an accented char, and this
 way I avoid to perform str_replace in the highlight_search_terms function
 for every combination of accented chars

I was intrigued by your example, so I played around with it some more
this morning. My own quick web search yielded a lot of results for
highlighting search terms, but none that I found did what you're
after. (I admit I didn't look very deep.) I was up to something like
this before your reply came in. It's still by no means complete. It
even handles simple English plurals (words ending in 's' or 'es'), but
not variations that require changing the word base (like 'daisy' to
'daisies').

?php
function highlight_search_terms($phrase, $string) {
$non_letter_chars = '/[^\pL]/iu';
$words = preg_split($non_letter_chars, $phrase);

$search_words = array();
foreach ($words as $word) {
if (strlen($word)  2  !preg_match($non_letter_chars, $word)) {
$search_words[] = $word;
}
}

$search_words = array_unique($search_words);

foreach ($search_words as $word) {
$search = preg_quote($word);

/* repeat for each possible accented character */
$search = preg_replace('/(ae|æ|ǽ)/iu', '(ae|æ|ǽ)', $search);
$search = preg_replace('/(oe|œ)/iu', '(oe|œ)', $search);
$search = preg_replace('/[aàáâãäåǻāăą](?!e)/iu',
'[aàáâãäåǻāăą]', $search);
$search = preg_replace('/[cçćĉċč]/iu', '[cçćĉċč]', $search);
$search = preg_replace('/[dďđ]/iu', '[dďđ]', $search);
$search = preg_replace('/(?![ao])[eèéêëēĕėęě]/iu',
'[eèéêëēĕėęě]', $search);
$search = preg_replace('/[gĝğġģ]/iu', '[gĝğġģ]', $search);
$search = preg_replace('/[hĥħ]/iu', '[hĥħ]', $search);
$search = preg_replace('/[iìíîïĩīĭįı]/iu', '[iìíîïĩīĭįı]', $search);
$search = preg_replace('/[jĵ]/iu', '[jĵ]', $search);
$search = preg_replace('/[kķĸ]/iu', '[kķĸ]', $search);
$search = preg_replace('/[lĺļľŀł]/iu', '[lĺļľŀł]', $search);
$search = preg_replace('/[nñńņňʼnŋ]/iu', '[nñńņňʼnŋ]', $search);
$search = preg_replace('/[oòóôõöōŏőǿơ](?!e)/iu',
'[oòóôõöōŏőǿơ]', $search);
$search = preg_replace('/[rŕŗř]/iu', '[rŕŗř]', $search);
$search = preg_replace('/[sśŝşš]/iu', '[sśŝşš]', $search);
$search = preg_replace('/[tţťŧ]/iu', '[tţťŧ]', $search);
$search = preg_replace('/[uùúûüũūŭůűųǔǖǘǚǜ]/iu',
'[uùúûüũūŭůűųǔǖǘǚǜ]', $search);
$search = preg_replace('/[wŵ]/iu', '[wŵ]', $search);
$search = preg_replace('/[yýÿŷ]/iu', '[yýÿŷ]', $search);
$search = preg_replace('/[zźżž]/iu', '[zźżž]', $search);


$string = preg_replace('/\b' . $search . '(e?s)?\b/iu', 'span
class=keysearch$0/span', $string);
}

return $string;

}
?

I still can't help feeling there must be some better way, though.


 well, i think I'm on the good way now, unfortunately I have some other
 urgent work and can't try it immediately, but I'll let you know:)

 thank you!

 Giulio


Andrew


Re: [PHP] Freelance PHP development in India

2008-07-14 Thread Gabriel Sosa
why not argentina?



On Mon, Jul 14, 2008 at 10:31 AM, Denis L. Menezes [EMAIL PROTECTED]
wrote:

 Dear Ryan, Wolf.

 Apologies for asking from India only. No offence meant.

 It is because I am from India and I can personally meet and discuss with
 the programmers. Cost is also an issue. Mine is a startup and the finances
 are low. :-(

 Apologies.
 Denis


 - Original Message - From: Ryan S [EMAIL PROTECTED]
 To: Wolf [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Cc: PHP General php-general@lists.php.net
 Sent: Monday, July 14, 2008 8:34 PM
 Subject: Re: [PHP] Freelance PHP development in India







 snip

 Dear friends.

 I am looking for freelance web developers in India.

 Can contact me?


 Why just in India?  There are a number of us available via the world.

 Wolf
 /snip

 I'm guessing because he wants a REAL cheap solution...
 what you (probably) charge for 5-7hrs work would probably be the same that
 someone in india charges for a day or two or the whole project.

 HTH

 Cheers!
 R





 --
 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




-- 
Los sabios buscan la sabiduría; los necios creen haberla encontrado.
Gabriel Sosa


Re: [PHP] Freelance PHP development in India

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 11:01 +0300, Irimia, Suleapa wrote:
 Wolf wrote:
  
  
  Denis L. Menezes wrote:
  Dear friends.
 
  I am looking for freelance web developers in India.
 
  Can contact me?
 
  Thanks
  Denis
 
  Why just in India?  There are a number of us available via the world.
  
  Wolf

 
 Cause they are cheaper?

 //Just my 2 cents

Is that 2 cents per hour?

;)

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


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



Re: [PHP] case and accent - insensitive regular expression?

2008-07-14 Thread Giulio Mastrosanti




Brilliant !!!

so you replace every occurence of every accent variation with all the  
accent variations...


OK, that's it!

only some more doubts ( regex are still an headhache for me... )

preg_replace('/[iìíîïĩīĭįı]/iu',...  -- what's the meaning of  
iu after the match string?


preg_replace('/[aàáâãäåǻāăą](?!e)/iu',... whats (?!e)  for?  
-- every occurence of aàáâãäåǻāăą NOT followed by e?


Many thanks again for your effort,

I'm definitely on the good way

  Giulio




I was intrigued by your example, so I played around with it some more
this morning. My own quick web search yielded a lot of results for
highlighting search terms, but none that I found did what you're
after. (I admit I didn't look very deep.) I was up to something like
this before your reply came in. It's still by no means complete. It
even handles simple English plurals (words ending in 's' or 'es'), but
not variations that require changing the word base (like 'daisy' to
'daisies').

?php
function highlight_search_terms($phrase, $string) {
   $non_letter_chars = '/[^\pL]/iu';
   $words = preg_split($non_letter_chars, $phrase);

   $search_words = array();
   foreach ($words as $word) {
   if (strlen($word)  2  !preg_match($non_letter_chars,  
$word)) {

   $search_words[] = $word;
   }
   }

   $search_words = array_unique($search_words);

   foreach ($search_words as $word) {
   $search = preg_quote($word);

   /* repeat for each possible accented character */
   $search = preg_replace('/(ae|æ|ǽ)/iu', '(ae|æ|ǽ)',  
$search);

   $search = preg_replace('/(oe|œ)/iu', '(oe|œ)', $search);
   $search = preg_replace('/[aàáâãäåǻāăą](?!e)/iu',
'[aàáâãäåǻāăą]', $search);
   $search = preg_replace('/[cçćĉċč]/iu', '[cçćĉċč]',  
$search);

   $search = preg_replace('/[dďđ]/iu', '[dďđ]', $search);
   $search = preg_replace('/(?![ao])[eèéêëēĕėęě]/iu',
'[eèéêëēĕėęě]', $search);
   $search = preg_replace('/[gĝğġģ]/iu', '[gĝğġģ]',  
$search);

   $search = preg_replace('/[hĥħ]/iu', '[hĥħ]', $search);
   $search = preg_replace('/[iìíîïĩīĭįı]/iu',  
'[iìíîïĩīĭįı]', $search);

   $search = preg_replace('/[jĵ]/iu', '[jĵ]', $search);
   $search = preg_replace('/[kķĸ]/iu', '[kķĸ]', $search);
   $search = preg_replace('/[lĺļľŀł]/iu', '[lĺļľŀł]',  
$search);
   $search = preg_replace('/[nñńņňʼnŋ]/iu',  
'[nñńņňʼnŋ]', $search);

   $search = preg_replace('/[oòóôõöōŏőǿơ](?!e)/iu',
'[oòóôõöōŏőǿơ]', $search);
   $search = preg_replace('/[rŕŗř]/iu', '[rŕŗř]', $search);
   $search = preg_replace('/[sśŝşš]/iu', '[sśŝşš]',  
$search);

   $search = preg_replace('/[tţťŧ]/iu', '[tţťŧ]', $search);
   $search = preg_replace('/[uùúûüũūŭůűųǔǖǘǚǜ]/iu',
'[uùúûüũūŭůűųǔǖǘǚǜ]', $search);
   $search = preg_replace('/[wŵ]/iu', '[wŵ]', $search);
   $search = preg_replace('/[yýÿŷ]/iu', '[yýÿŷ]', $search);
   $search = preg_replace('/[zźżž]/iu', '[zźżž]', $search);


   $string = preg_replace('/\b' . $search . '(e?s)?\b/iu', 'span
class=keysearch$0/span', $string);
   }

   return $string;

}
?

I still can't help feeling there must be some better way, though.



well, i think I'm on the good way now, unfortunately I have some  
other

urgent work and can't try it immediately, but I'll let you know:)

thank you!

   Giulio



Andrew






[PHP] Math Weirdness

2008-07-14 Thread Jay Blanchard
I am totally buffaloed by a set of very simple calculations that I am
doing;

/* calculate total balance with payments and adjustments */
$totalBalance = $acct['BALANCE'] + $adjBalance;
echo number_format($totalBalance, 2, '.', '').\t;

/* calculate total charges */
$totalCharges = $intlLDCharges + $longDistance + $smsCharges +
$daCharges + $totalData + $roaming;
echo number_format($totalCharges, 2, '.', '').\t;

/* 
 * calculate difference between total balance and total charges
 * if the amount matches the ending balance then all is OK
 * if not calculate the difference
 */  
$totBalDiff = $totalBalance - $totalCharges;
if($totBalDiff === $endingBal){
echo OK\t;
} else {
/* what is the difference between the ending balance and
the charges? */
$totChargeDiff = $endingBal - $totalCharges;
echo number_format($totChargeDiff, 2, '.', '').\t;
}

Each number represented by a variable in all of these calculations has
been rounded to 2 decimal points at the point they are generated. For
the most part this works just hunky-dory but I have a handful of calcs
(out of 300k plus records) that look like this

$endingBal  0.10
$totalBalance   0.30
$totalCharges   0.20
$totalChargeDiff-0.10

The balance minus the charges does equal the ending balance as it should
but it is saying that it doesn't and that there a 20 cent swing (-0.10
is 20 cents different than 0.10).

I must be missing something. When I echo out raw data I do not see
negative signs. Does anyone have any insight as to what might be
happening here? 

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



Re: [PHP] Math Weirdness

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 12:39 -0500, Jay Blanchard wrote:
 /* calculate total balance with payments and adjustments */
 $totalBalance = $acct['BALANCE'] + $adjBalance;
 echo number_format($totalBalance, 2, '.', '').\t;
 
 /* calculate total charges */
 $totalCharges = $intlLDCharges + $longDistance + $smsCharges +
 $daCharges + $totalData + $roaming;
 echo number_format($totalCharges, 2, '.', '').\t;
 
 /* 
  * calculate difference between total balance and total
 charges
  * if the amount matches the ending balance then all is OK
  * if not calculate the difference
  */  
 $totBalDiff = $totalBalance - $totalCharges;
 if($totBalDiff === $endingBal){
 echo OK\t;
 } else {
 /* what is the difference between the ending balance
 and
 the charges? */
 $totChargeDiff = $endingBal - $totalCharges;
 echo number_format($totChargeDiff, 2, '.', '').\t;
 }

What makes you think the problem is in this code? How about doing the
following right before the block of code you've provided so that we can
actually check the data with what you're using:

?php

echo '$acct[BALANCE]: '.$acct[BALANCE].\n;
echo '$adjBalance: '.$adjBalance.\n;
echo '$intlLDCharges: '.$intlLDCharges.\n;
echo '$longDistance: '.$longDistance.\n;
echo '$smsCharges: '.$smsCharges.\n;
echo '$roaming: '.$roaming.\n;
echo '$daCharges: '.$daCharges.\n;
echo '$totalData: '.$totalData.\n;
echo '$endingBal: '.$endingBal.\n;

?

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


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



Re: [PHP] case and accent - insensitive regular expression?

2008-07-14 Thread Andrew Ballard
On Mon, Jul 14, 2008 at 1:35 PM, Giulio Mastrosanti
[EMAIL PROTECTED] wrote:


 Brilliant !!!

 so you replace every occurence of every accent variation with all the accent
 variations...

 OK, that's it!

 only some more doubts ( regex are still an headhache for me... )

 preg_replace('/[iìíîïĩīĭįı]/iu',...  -- what's the meaning of iu after the
 match string?

This page explains them both.
http://us.php.net/manual/en/reference.pcre.pattern.modifiers.php

 preg_replace('/[aàáâãäåǻāăą](?!e)/iu',... whats (?!e)  for? -- every
 occurence of aàáâãäåǻāăą NOT followed by e?

Yes. It matches any character based on the latin 'a' that is not
followed by an 'e'. It keeps the pattern from matching the 'a' when it
immediately precedes an 'e' for the character 'ae' for words like
these:
http://en.wikipedia.org/wiki/List_of_words_that_may_be_spelled_with_a_ligature
(However, that may cause problems with words that have other variants
of 'ae' in them. I'll leave that to you to resolve.)
http://us.php.net/manual/en/regexp.reference.php



 Many thanks again for your effort,

 I'm definitely on the good way

  Giulio



 I was intrigued by your example, so I played around with it some more
 this morning. My own quick web search yielded a lot of results for
 highlighting search terms, but none that I found did what you're
 after. (I admit I didn't look very deep.) I was up to something like
 this before your reply came in. It's still by no means complete. It
 even handles simple English plurals (words ending in 's' or 'es'), but
 not variations that require changing the word base (like 'daisy' to
 'daisies').

 ?php
 function highlight_search_terms($phrase, $string) {
   $non_letter_chars = '/[^\pL]/iu';
   $words = preg_split($non_letter_chars, $phrase);

   $search_words = array();
   foreach ($words as $word) {
   if (strlen($word)  2  !preg_match($non_letter_chars, $word)) {
   $search_words[] = $word;
   }
   }

   $search_words = array_unique($search_words);

   foreach ($search_words as $word) {
   $search = preg_quote($word);

   /* repeat for each possible accented character */
   $search = preg_replace('/(ae|æ|ǽ)/iu', '(ae|æ|ǽ)', $search);
   $search = preg_replace('/(oe|œ)/iu', '(oe|œ)', $search);
   $search = preg_replace('/[aàáâãäåǻāăą](?!e)/iu',
 '[aàáâãäåǻāăą]', $search);
   $search = preg_replace('/[cçćĉċč]/iu', '[cçćĉċč]', $search);
   $search = preg_replace('/[dďđ]/iu', '[dďđ]', $search);
   $search = preg_replace('/(?![ao])[eèéêëēĕėęě]/iu',
 '[eèéêëēĕėęě]', $search);
   $search = preg_replace('/[gĝğġģ]/iu', '[gĝğġģ]', $search);
   $search = preg_replace('/[hĥħ]/iu', '[hĥħ]', $search);
   $search = preg_replace('/[iìíîïĩīĭįı]/iu', '[iìíîïĩīĭįı]', $search);
   $search = preg_replace('/[jĵ]/iu', '[jĵ]', $search);
   $search = preg_replace('/[kķĸ]/iu', '[kķĸ]', $search);
   $search = preg_replace('/[lĺļľŀł]/iu', '[lĺļľŀł]', $search);
   $search = preg_replace('/[nñńņňʼnŋ]/iu', '[nñńņňʼnŋ]', $search);
   $search = preg_replace('/[oòóôõöōŏőǿơ](?!e)/iu',
 '[oòóôõöōŏőǿơ]', $search);
   $search = preg_replace('/[rŕŗř]/iu', '[rŕŗř]', $search);
   $search = preg_replace('/[sśŝşš]/iu', '[sśŝşš]', $search);
   $search = preg_replace('/[tţťŧ]/iu', '[tţťŧ]', $search);
   $search = preg_replace('/[uùúûüũūŭůűųǔǖǘǚǜ]/iu',
 '[uùúûüũūŭůűųǔǖǘǚǜ]', $search);
   $search = preg_replace('/[wŵ]/iu', '[wŵ]', $search);
   $search = preg_replace('/[yýÿŷ]/iu', '[yýÿŷ]', $search);
   $search = preg_replace('/[zźżž]/iu', '[zźżž]', $search);


   $string = preg_replace('/\b' . $search . '(e?s)?\b/iu', 'span
 class=keysearch$0/span', $string);
   }

   return $string;

 }
 ?

 I still can't help feeling there must be some better way, though.


 well, i think I'm on the good way now, unfortunately I have some other
 urgent work and can't try it immediately, but I'll let you know:)

 thank you!

   Giulio


 Andrew






RE: [PHP] Math Weirdness

2008-07-14 Thread Jay Blanchard
[snip]
What makes you think the problem is in this code? How about doing the
following right before the block of code you've provided so that we can
actually check the data with what you're using:

?php

echo '$acct[BALANCE]: '.$acct[BALANCE].\n;
echo '$adjBalance: '.$adjBalance.\n;
echo '$intlLDCharges: '.$intlLDCharges.\n;
echo '$longDistance: '.$longDistance.\n;
echo '$smsCharges: '.$smsCharges.\n;
echo '$roaming: '.$roaming.\n;
echo '$daCharges: '.$daCharges.\n;
echo '$totalData: '.$totalData.\n;
echo '$endingBal: '.$endingBal.\n;

?
[/snip]

$adjBalance: 0
$intlLDCharges: 0.2
$longDistance: 0
$smsCharges: 0
$roaming: 0
$daCharges: 0
$totalData: 0
$endingBal: 0.1

I had done this looking for special characters or negative signs.

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



[PHP] mkdir permission errors

2008-07-14 Thread Wei, Alice J.
Hi, Guys:

   I have a very strange incident here that may seem very stupid. Since the 
power went out last night, I have restarted my server. However, now the 
permission is never working right. I have set the permission of my htdocs 
folder iof my Apache server to 0755, and then started executing the following.

  $id=$_REQUEST['id'];
  $filename = /usr/local/apache/htdocs/test;

if (file_exists($filename)) {

 mkdir(/usr/local/apache/htdocs/test/$id, 0777) or die (pCannot create 
directory/p);
chmod(/usr/local/apache/htdocs/test/$id, 0777);
 mkdir(/usr/local/apache/htdocs/test/$id/contours, 0755) or die 
(pCannot create directory/p);
 chmod (/usr/local/apache/htdocs/test/$id/contours,0777);
 mkdir (/usr/local/apache/htdocs//$id/beamdata, 0777) or die (pCannot 
create directory/p);
  mkdir(/usr/local/apache/htdocs//$id/schemadata, 0777) or die 
(pCannot create directory/p);
  mkdir(/usr/local/apache/htdocs/$id/plandata, 0777) or die (pCannot 
create directory/p);

}

else {

  mkdir(/usr/local/apache/htdocs/test, 0777) or die (pCannot create 
directory http://192.168.10.63/TPU/p);
}

However, the error always bumped me with Cannot create directory 
http://192.168.10.63/test.
I went into my error logs, and it continuously give me this:

[Mon Jul 14 14:51:07 2008] [error] [client 192.168.10.63] PHP Warning:  mkdir() 
[a href='function.mkdir'function.mkdir/a]: Permission denied in 
/usr/local/apache/htdocs/file_linux.php on line 23

Can anyone please give me a hint on what could be wrong here? I have set my 
parent directory to 0755 already.

Thanks in advance.
==
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
[EMAIL PROTECTED]

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



Re: [PHP] Math Weirdness

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 12:39 -0500, Jay Blanchard wrote:
 I am totally buffaloed by a set of very simple calculations that I am
 doing;
 
 /* calculate total balance with payments and adjustments */
   $totalBalance = $acct['BALANCE'] + $adjBalance;
   echo number_format($totalBalance, 2, '.', '').\t;
   
   /* calculate total charges */
   $totalCharges = $intlLDCharges + $longDistance + $smsCharges +
 $daCharges + $totalData + $roaming;
   echo number_format($totalCharges, 2, '.', '').\t;
   
   /* 
* calculate difference between total balance and total charges
* if the amount matches the ending balance then all is OK
* if not calculate the difference
*/  
   $totBalDiff = $totalBalance - $totalCharges;
   if($totBalDiff === $endingBal){
   echo OK\t;
   } else {
   /* what is the difference between the ending balance and
 the charges? */
   $totChargeDiff = $endingBal - $totalCharges;
   echo number_format($totChargeDiff, 2, '.', '').\t;
   }
 
 Each number represented by a variable in all of these calculations has
 been rounded to 2 decimal points at the point they are generated. For
 the most part this works just hunky-dory but I have a handful of calcs
 (out of 300k plus records) that look like this
 
 $endingBal0.10
 $totalBalance 0.30
 $totalCharges 0.20
 $totalChargeDiff  -0.10
 
 The balance minus the charges does equal the ending balance as it should
 but it is saying that it doesn't and that there a 20 cent swing (-0.10
 is 20 cents different than 0.10).
 
 I must be missing something. When I echo out raw data I do not see
 negative signs. Does anyone have any insight as to what might be
 happening here?   

From whence do you conjure $endingBal?

Most likely this is just a floating point imprecision problem. In
otherwords, you need a small delta of error when doing the following
comparison:

if( $totBalDiff === $endingBal )

Remember, floating point numbers do not always store perfectly. So you
want something like:

if( abs( $totalBalDiff - $endingBal )  .01 )

Also that last echo:

echo number_format($totChargeDiff, 2, '.', '')

Was calculated with:

$totChargeDiff = $endingBal - $totalCharges;

Whereas the initial conditional checks:

$totBalDiff === $endingBal

And $totBalDiff was calculated as:

$totBalDiff = $totalBalance - $totalCharges;

So again... from whence do you conjure $endingBal? :)

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


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



Re: [PHP] mkdir permission errors

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 15:01 -0400, Wei, Alice J. wrote:
 Hi, Guys:
 
I have a very strange incident here that may seem very stupid. Since the 
 power went out last night, I have restarted my server. However, now the 
 permission is never working right. I have set the permission of my htdocs 
 folder iof my Apache server to 0755, and then started executing the following.
 
   $id=$_REQUEST['id'];
   $filename = /usr/local/apache/htdocs/test;
 
 if (file_exists($filename)) {
 
  mkdir(/usr/local/apache/htdocs/test/$id, 0777) or die (pCannot 
 create directory/p);
 chmod(/usr/local/apache/htdocs/test/$id, 0777);
  mkdir(/usr/local/apache/htdocs/test/$id/contours, 0755) or die 
 (pCannot create directory/p);
  chmod (/usr/local/apache/htdocs/test/$id/contours,0777);
  mkdir (/usr/local/apache/htdocs//$id/beamdata, 0777) or die 
 (pCannot create directory/p);
   mkdir(/usr/local/apache/htdocs//$id/schemadata, 0777) or die 
 (pCannot create directory/p);
   mkdir(/usr/local/apache/htdocs/$id/plandata, 0777) or die (pCannot 
 create directory/p);
 
 }
 
 else {
 
   mkdir(/usr/local/apache/htdocs/test, 0777) or die (pCannot create 
 directory http://192.168.10.63/TPU/p);
 }
 
 However, the error always bumped me with Cannot create directory 
 http://192.168.10.63/test.
 I went into my error logs, and it continuously give me this:
 
 [Mon Jul 14 14:51:07 2008] [error] [client 192.168.10.63] PHP Warning:  
 mkdir() [a href='function.mkdir'function.mkdir/a]: Permission denied in 
 /usr/local/apache/htdocs/file_linux.php on line 23
 
 Can anyone please give me a hint on what could be wrong here? I have set my 
 parent directory to 0755 already.

Under what user does apache run?

What are the ownerships on the parent directory?

Can you create the directory if you log in as the apache user (su
apacheuser)?

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


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



RE: [PHP] Math Weirdness

2008-07-14 Thread Jay Blanchard
[snip]
So again... from whence do you conjure $endingBal? :)
[/snip]

$endingBal is conjured from the database tracking the account balance.
For any 24 hour period the beginning and ending balance for subsequent
days is the same unless adjustments or payments have been made to the
account in that period.

2:35 AM balance becomes the ending balance for the previous day and
becomes the beginning balance for the day we are beginning. 

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



Re: [PHP] Freelance PHP development in India

2008-07-14 Thread tedd

At 12:20 PM +0800 7/14/08, Denis L. Menezes wrote:

Dear friends.

I am looking for freelance web developers in India.

Can contact me?

Thanks
Denis


Good luck.

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] mkdir permission errors

2008-07-14 Thread Wei, Alice J.
Hi,

   The apache  is running currently on root as the user.
   The parent directory, test, is set to 0755.
   I have no problems making new directories directly from the terminal prompt, 
and it does not give me user execution errors like the one in the following.
   I am getting confused with why I can create directories now no longer 
through the PHP but only through the command prompt manually.

Does this give you information on what my problem might be?

Alice
==
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
[EMAIL PROTECTED]

From: Robert Cummings [EMAIL PROTECTED]
Sent: Monday, July 14, 2008 3:07 PM
To: Wei, Alice J.
Cc: php-general@lists.php.net
Subject: Re: [PHP] mkdir permission errors

On Mon, 2008-07-14 at 15:01 -0400, Wei, Alice J. wrote:
 Hi, Guys:

I have a very strange incident here that may seem very stupid. Since the 
 power went out last night, I have restarted my server. However, now the 
 permission is never working right. I have set the permission of my htdocs 
 folder iof my Apache server to 0755, and then started executing the following.

   $id=$_REQUEST['id'];
   $filename = /usr/local/apache/htdocs/test;

 if (file_exists($filename)) {

  mkdir(/usr/local/apache/htdocs/test/$id, 0777) or die (pCannot 
 create directory/p);
 chmod(/usr/local/apache/htdocs/test/$id, 0777);
  mkdir(/usr/local/apache/htdocs/test/$id/contours, 0755) or die 
 (pCannot create directory/p);
  chmod (/usr/local/apache/htdocs/test/$id/contours,0777);
  mkdir (/usr/local/apache/htdocs//$id/beamdata, 0777) or die 
 (pCannot create directory/p);
   mkdir(/usr/local/apache/htdocs//$id/schemadata, 0777) or die 
 (pCannot create directory/p);
   mkdir(/usr/local/apache/htdocs/$id/plandata, 0777) or die (pCannot 
 create directory/p);

 }

 else {

   mkdir(/usr/local/apache/htdocs/test, 0777) or die (pCannot create 
 directory http://192.168.10.63/TPU/p);
 }

 However, the error always bumped me with Cannot create directory 
 http://192.168.10.63/test.
 I went into my error logs, and it continuously give me this:

 [Mon Jul 14 14:51:07 2008] [error] [client 192.168.10.63] PHP Warning:  
 mkdir() [a href='function.mkdir'function.mkdir/a]: Permission denied in 
 /usr/local/apache/htdocs/file_linux.php on line 23

 Can anyone please give me a hint on what could be wrong here? I have set my 
 parent directory to 0755 already.

Under what user does apache run?

What are the ownerships on the parent directory?

Can you create the directory if you log in as the apache user (su
apacheuser)?

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


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



RE: [PHP] Math Weirdness

2008-07-14 Thread Alex Chamberlain
 

 

 I am totally buffaloed by a set of very simple calculations that I am 

 doing;

 

 /* calculate total balance with payments and adjustments */

 $totalBalance = $acct['BALANCE'] + $adjBalance;

 echo number_format($totalBalance, 2, '.', '').\t;

 

 /* calculate total charges */

 $totalCharges = $intlLDCharges + $longDistance + $smsCharges + 

 $daCharges + $totalData + $roaming;

 echo number_format($totalCharges, 2, '.', '').\t;

 

 /*

  * calculate difference between total balance and total charges

  * if the amount matches the ending balance then all is OK

  * if not calculate the difference

  */

 $totBalDiff = $totalBalance - $totalCharges;

 if($totBalDiff === $endingBal){

   echo OK\t;

 } else {

   /* what is the difference between the ending balance and the 

 charges? */

   $totChargeDiff = $endingBal - $totalCharges;

   echo number_format($totChargeDiff, 2, '.', '').\t;

 }

 

 Each number represented by a variable in all of these calculations has 

 been rounded to 2 decimal points at the point they are generated. For 

 the most part this works just hunky-dory but I have a handful of calcs 

 (out of 300k plus records) that look like this

 

 $endingBal0.10

 $totalBalance   0.30

 $totalCharges   0.20

 $totalChargeDiff  -0.10

 

 The balance minus the charges does equal the ending balance as it 

 should but it is saying that it doesn't and that there a 20 cent swing 

 (-0.10 is 20 cents different than 0.10).

 

 I must be missing something. When I echo out raw data I do not see 

 negative signs. Does anyone have any insight as to what might be 

 happening here?

 

I don't quite understand your problem, but I use integers for any monetary
workings as you can guarantee it is accurate (obviously, you work in pence
or cents rather than GBP or USD).

 

Alex



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



RE: [PHP] mkdir permission errors

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 15:11 -0400, Wei, Alice J. wrote:
 Hi,
 
The apache  is running currently on root as the user.
The parent directory, test, is set to 0755.
I have no problems making new directories directly from the terminal 
 prompt, and it does not give me user execution errors like the one in the 
 following.
I am getting confused with why I can create directories now no longer 
 through the PHP but only through the command prompt manually.
 
 Does this give you information on what my problem might be?

Can you post the following command's output to the list or me personally
if you think it's sensitive:

ps awxu | grep 'apache|httpd'

If apache is running as root as you say then it shouldn't have any
problems doing anything (that's a very dangerous way to run apache btw).
So either apache isn't running as root (maybe you think invoking the
daemon causes it to run as root -- it doesn't), or PHP itself is causing
the access denied problem (safe mode? base dir?).

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


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



RE: [PHP] mkdir permission errors

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 15:11 -0400, Wei, Alice J. wrote:
 Hi,
 
The apache  is running currently on root as the user.
The parent directory, test, is set to 0755.

These are permissions btw, and not ownerships. Ownerships denote user
and group owners of the directory... specifically the entities to which
the 75 permissions are assigned shown above.

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


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



RE: [PHP] mkdir permission errors

2008-07-14 Thread Wei, Alice J.
Hi, Rob:

  This is the output:

 root 31232  0.0  0.0   4120   672 pts/1R+   15:22   0:00 grep 
apache|httpd

Does this help?

Alice
==
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
[EMAIL PROTECTED]

From: Robert Cummings [EMAIL PROTECTED]
Sent: Monday, July 14, 2008 3:21 PM
To: Wei, Alice J.
Cc: php-general@lists.php.net
Subject: RE: [PHP] mkdir permission errors

On Mon, 2008-07-14 at 15:11 -0400, Wei, Alice J. wrote:
 Hi,

The apache  is running currently on root as the user.
The parent directory, test, is set to 0755.
I have no problems making new directories directly from the terminal 
 prompt, and it does not give me user execution errors like the one in the 
 following.
I am getting confused with why I can create directories now no longer 
 through the PHP but only through the command prompt manually.

 Does this give you information on what my problem might be?

Can you post the following command's output to the list or me personally
if you think it's sensitive:

ps awxu | grep 'apache|httpd'

If apache is running as root as you say then it shouldn't have any
problems doing anything (that's a very dangerous way to run apache btw).
So either apache isn't running as root (maybe you think invoking the
daemon causes it to run as root -- it doesn't), or PHP itself is causing
the access denied problem (safe mode? base dir?).

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


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



RE: [PHP] Math Weirdness

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 14:12 -0500, Jay Blanchard wrote:
 [snip]
 So again... from whence do you conjure $endingBal? :)
 [/snip]
 
 $endingBal is conjured from the database tracking the account balance.
 For any 24 hour period the beginning and ending balance for subsequent
 days is the same unless adjustments or payments have been made to the
 account in that period.
 
 2:35 AM balance becomes the ending balance for the previous day and
 becomes the beginning balance for the day we are beginning.

Isn't it possible then that your data is out of synch between the
current balance and the previous day's ending balance?

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


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



RE: [PHP] Math Weirdness

2008-07-14 Thread Jay Blanchard
[snip]
Isn't it possible then that your data is out of synch between the
current balance and the previous day's ending balance?
[/snip]

No, the values are there and correct (it is done with a snapshot). The
correct numbers are being used in the math (as shown). When I do
this(as you suggested);

if(abs($totBalDiff - $endingBal)  .01){
echo OK\t;
} else {
/* what is the difference between the ending balance and
the charges? */
$totChargeDiff = $endingBal - $totalCharges;
echo number_format($totChargeDiff, 2, '.', '').\t;
}

You can see the abs value difference is extremely small and it causes
things to work as expected. 0.1 should be equal to 0.1

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



RE: [PHP] Math Weirdness

2008-07-14 Thread Wolf
 Robert Cummings [EMAIL PROTECTED] wrote: 
 On Mon, 2008-07-14 at 14:12 -0500, Jay Blanchard wrote:
  [snip]
  So again... from whence do you conjure $endingBal? :)
  [/snip]
  
  $endingBal is conjured from the database tracking the account balance.
  For any 24 hour period the beginning and ending balance for subsequent
  days is the same unless adjustments or payments have been made to the
  account in that period.
  
  2:35 AM balance becomes the ending balance for the previous day and
  becomes the beginning balance for the day we are beginning.
 
 Isn't it possible then that your data is out of synch between the
 current balance and the previous day's ending balance?
 
 Cheers,
 Rob. 


See!!!  I told you he was skimming the profits!  Better check his desk for the 
other set of books! ;)

I'd suggest the int approach.

Wolf

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



RE: [PHP] mkdir permission errors

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 15:23 -0400, Wei, Alice J. wrote:
 Hi, Rob:
 
   This is the output:
 
  root 31232  0.0  0.0   4120   672 pts/1R+   15:22   0:00 grep 
 apache|httpd
 
 Does this help?

Sorry... my bad, can you do the following:

ps awxu | grep -E 'apache|httpd'

I have grep aliased on my system so the -E flag is automatically
added :)

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


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



RE: [PHP] Math Weirdness

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 15:33 -0400, Wolf wrote:
  Robert Cummings [EMAIL PROTECTED] wrote: 
  On Mon, 2008-07-14 at 14:12 -0500, Jay Blanchard wrote:
   [snip]
   So again... from whence do you conjure $endingBal? :)
   [/snip]
   
   $endingBal is conjured from the database tracking the account balance.
   For any 24 hour period the beginning and ending balance for subsequent
   days is the same unless adjustments or payments have been made to the
   account in that period.
   
   2:35 AM balance becomes the ending balance for the previous day and
   becomes the beginning balance for the day we are beginning.
  
  Isn't it possible then that your data is out of synch between the
  current balance and the previous day's ending balance?
  
  Cheers,
  Rob. 
 
 
 See!!!  I told you he was skimming the profits!  Better check his desk for 
 the other set of books! ;)
 
 I'd suggest the int approach.

Yeah, I prefer to work with pennies too when doing that stuff. But
floats work much better when skimming... harder to track ;) Remind me
not to buy weed from Jay.

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


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



RE: [PHP] mkdir permission errors

2008-07-14 Thread Wei, Alice J.
Hi, Rob:

  Here is the updated version from the correct command:

[EMAIL PROTECTED] htdocs]# ps awxu | grep -E 'apache|httpd'
root 30957  0.0  0.5  27576 11016 ?Ss   14:27   0:00 /usr/sbin/httpd
apache   30959  0.0  0.3  27708  7452 ?S14:27   0:00 /usr/sbin/httpd
apache   30960  0.0  0.3  27576  6800 ?S14:27   0:00 /usr/sbin/httpd
apache   30961  0.0  0.3  27576  6800 ?S14:27   0:00 /usr/sbin/httpd
apache   30962  0.0  0.3  27576  6788 ?S14:27   0:00 /usr/sbin/httpd
apache   30963  0.0  0.3  27576  6788 ?S14:27   0:00 /usr/sbin/httpd
apache   30964  0.0  0.3  27576  6788 ?S14:27   0:00 /usr/sbin/httpd
apache   30965  0.0  0.3  27576  6788 ?S14:27   0:00 /usr/sbin/httpd
apache   30966  0.0  0.3  27576  6788 ?S14:27   0:00 /usr/sbin/httpd
root 31299  0.0  0.0   4120   676 pts/1R+   15:36   0:00 grep -E 
apache|httpd
[EMAIL PROTECTED] htdocs]#

Does this suggest anything?

Alice
==
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
[EMAIL PROTECTED]

From: Robert Cummings [EMAIL PROTECTED]
Sent: Monday, July 14, 2008 3:35 PM
To: Wei, Alice J.
Cc: php-general@lists.php.net
Subject: RE: [PHP] mkdir permission errors

On Mon, 2008-07-14 at 15:23 -0400, Wei, Alice J. wrote:
 Hi, Rob:

   This is the output:

  root 31232  0.0  0.0   4120   672 pts/1R+   15:22   0:00 grep 
 apache|httpd

 Does this help?

Sorry... my bad, can you do the following:

ps awxu | grep -E 'apache|httpd'

I have grep aliased on my system so the -E flag is automatically
added :)

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


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



RE: [PHP] Math Weirdness

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 14:29 -0500, Jay Blanchard wrote:
 [snip]
 Isn't it possible then that your data is out of synch between the
 current balance and the previous day's ending balance?
 [/snip]
 
 No, the values are there and correct (it is done with a snapshot). The
 correct numbers are being used in the math (as shown). When I do
 this(as you suggested);
 
 if(abs($totBalDiff - $endingBal)  .01){
   echo OK\t;
   } else {
   /* what is the difference between the ending balance and
 the charges? */
   $totChargeDiff = $endingBal - $totalCharges;
   echo number_format($totChargeDiff, 2, '.', '').\t;
   }
 
 You can see the abs value difference is extremely small and it causes
 things to work as expected. 0.1 should be equal to 0.1

So does that mean your problem is solved?

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


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



RE: [PHP] mkdir permission errors

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 15:37 -0400, Wei, Alice J. wrote:
 Hi, Rob:
 
   Here is the updated version from the correct command:
 
 [EMAIL PROTECTED] htdocs]# ps awxu | grep -E 'apache|httpd'
 root 30957  0.0  0.5  27576 11016 ?Ss   14:27   0:00 
 /usr/sbin/httpd
 apache   30959  0.0  0.3  27708  7452 ?S14:27   0:00 
 /usr/sbin/httpd
 apache   30960  0.0  0.3  27576  6800 ?S14:27   0:00 
 /usr/sbin/httpd
 apache   30961  0.0  0.3  27576  6800 ?S14:27   0:00 
 /usr/sbin/httpd
 apache   30962  0.0  0.3  27576  6788 ?S14:27   0:00 
 /usr/sbin/httpd
 apache   30963  0.0  0.3  27576  6788 ?S14:27   0:00 
 /usr/sbin/httpd
 apache   30964  0.0  0.3  27576  6788 ?S14:27   0:00 
 /usr/sbin/httpd
 apache   30965  0.0  0.3  27576  6788 ?S14:27   0:00 
 /usr/sbin/httpd
 apache   30966  0.0  0.3  27576  6788 ?S14:27   0:00 
 /usr/sbin/httpd
 root 31299  0.0  0.0   4120   676 pts/1R+   15:36   0:00 grep -E 
 apache|httpd
 [EMAIL PROTECTED] htdocs]#
 
 Does this suggest anything?

Yep, apache is not running as root. It is running as user apache. Now go
to the parent directory and input the following command:

chown apache:apache directoryName

That will change the ownership/group to apache. And then apache can
write to it.

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


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



Re: [PHP] Math Weirdness

2008-07-14 Thread tedd

At 12:39 PM -0500 7/14/08, Jay Blanchard wrote:

Each number represented by a variable in all of these calculations has
been rounded to 2 decimal points at the point they are generated. For
the most part this works just hunky-dory but I have a handful of calcs
(out of 300k plus records) that look like this

$endingBal  0.10
$totalBalance   0.30
$totalCharges   0.20
$totalChargeDiff-0.10

The balance minus the charges does equal the ending balance as it should
but it is saying that it doesn't and that there a 20 cent swing (-0.10
is 20 cents different than 0.10).

I must be missing something. When I echo out raw data I do not see
negative signs. Does anyone have any insight as to what might be
happening here?


Sounds like rounding errors.

Please note that the php rounding function (like all rounding 
functions) is not accurate. You can write one that is more accurate 
-- like I did -- but, to see any real difference you have to be 
dealing with millions of calculations.


Round-off errors normally don't enter into things unless your doing 
multiplication and division operations. At that point, what you get 
back from the operation is an approximation and not the actual 
number. The difference between the sums of all the approximations the 
the sums of all the calculations you do manually IS going to be 
different. The difference depends upon how accurate the machines' 
operations are and in what order the calculations are performed, 
which is probably the reason for the differences you see here using 
php to do both, but in different order.


My $0.019995

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] Math Weirdness

2008-07-14 Thread Daniel Brown
On Mon, Jul 14, 2008 at 1:39 PM, Jay Blanchard [EMAIL PROTECTED] wrote:
 I am totally buffaloed by a set of very simple calculations that I am
 doing;

$totChargeDiff = $endingBal - $totalCharges;
echo number_format($totChargeDiff, 2, '.', '').\t;

You're performing math to get the result for $totChargeDiff by
subtracting $totalCharges from $endingBal.  That will give you -0.10
in this case, because 0.10 - 0.20 = -0.10.  You want the difference,
not the result.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



RE: [PHP] mkdir permission errors

2008-07-14 Thread Wei, Alice J.
Hi, Rob:

  I did follow the instruction of putting in chown apache:apache htdocs. Now 
when I run the ls -la command, I get this:

[EMAIL PROTECTED] apache]# ls -la
total 68
drwxr-xr-x 15 root   root4096 2008-06-24 09:36 .
drwxr-xr-x 13 root   root4096 2008-07-14 08:53 ..
drwxr-xr-x  2 root   root4096 2008-06-24 09:36 bin
drwxr-xr-x  2 root   root4096 2008-06-24 09:36 build
drwxr-xr-x  2 root   root4096 2008-07-14 08:57 cgi-bin
drwxr-xr-x  4 root   root4096 2008-06-25 17:39 conf
drwxr-xr-x  3 root   root4096 2008-06-24 09:36 error
drwxr-xr-x  2 apache apache  4096 2008-07-14 15:43 htdocs
drwxr-xr-x  3 root   root4096 2008-06-24 09:36 icons
drwxr-xr-x  2 root   root4096 2008-06-24 09:36 include
drwxr-xr-x  4 root   root4096 2008-06-24 09:36 lib
drwxr-xr-x  2 root   root4096 2008-06-27 14:17 logs
drwxr-xr-x  4 root   root4096 2008-06-24 09:36 man
drwxr-xr-x 14 root   root   12288 2008-06-10 15:18 manual
drwxr-xr-x  2 root   root4096 2008-06-24 09:44 modules

However, this does not change any of the errors I have been getting by 
executing my PHP code. I still get

Warning: chmod() [function.chmod]: Permission denied in 
/usr/local/apache/htdocs/file_linux.php on line 27

Is this what I should be having in my ownership of the files?

Thanks for your help.

Alice
==
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
[EMAIL PROTECTED]

From: Robert Cummings [EMAIL PROTECTED]
Sent: Monday, July 14, 2008 3:42 PM
To: Wei, Alice J.
Cc: php-general@lists.php.net
Subject: RE: [PHP] mkdir permission errors

On Mon, 2008-07-14 at 15:37 -0400, Wei, Alice J. wrote:
 Hi, Rob:

   Here is the updated version from the correct command:

 [EMAIL PROTECTED] htdocs]# ps awxu | grep -E 'apache|httpd'
 root 30957  0.0  0.5  27576 11016 ?Ss   14:27   0:00 
 /usr/sbin/httpd
 apache   30959  0.0  0.3  27708  7452 ?S14:27   0:00 
 /usr/sbin/httpd
 apache   30960  0.0  0.3  27576  6800 ?S14:27   0:00 
 /usr/sbin/httpd
 apache   30961  0.0  0.3  27576  6800 ?S14:27   0:00 
 /usr/sbin/httpd
 apache   30962  0.0  0.3  27576  6788 ?S14:27   0:00 
 /usr/sbin/httpd
 apache   30963  0.0  0.3  27576  6788 ?S14:27   0:00 
 /usr/sbin/httpd
 apache   30964  0.0  0.3  27576  6788 ?S14:27   0:00 
 /usr/sbin/httpd
 apache   30965  0.0  0.3  27576  6788 ?S14:27   0:00 
 /usr/sbin/httpd
 apache   30966  0.0  0.3  27576  6788 ?S14:27   0:00 
 /usr/sbin/httpd
 root 31299  0.0  0.0   4120   676 pts/1R+   15:36   0:00 grep -E 
 apache|httpd
 [EMAIL PROTECTED] htdocs]#

 Does this suggest anything?

Yep, apache is not running as root. It is running as user apache. Now go
to the parent directory and input the following command:

chown apache:apache directoryName

That will change the ownership/group to apache. And then apache can
write to it.

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


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



Re: [PHP] Math Weirdness

2008-07-14 Thread Daniel Brown
On Mon, Jul 14, 2008 at 3:51 PM, Daniel Brown [EMAIL PROTECTED] wrote:

You're performing math to get the result for $totChargeDiff by
 subtracting $totalCharges from $endingBal.  That will give you -0.10
 in this case, because 0.10 - 0.20 = -0.10.  You want the difference,
 not the result.

Oh, and the code, by the way:

?php
//  your code to this point

/* what is the difference between the ending balance and the charges? */
$totChargeDiff = ($totalCharges  $endingBal) ?
($endingBal + $totalCharges) : ($endingBal - $totalCharges);
echo number_format($totChargeDiff, 2, '.', '').\t;

//  and continue with your code here
?


-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



[PHP] Re: Saving loading time at counting rows

2008-07-14 Thread tedd

At 6:13 PM +0200 7/13/08, Joep Roebroek wrote:

I think, I will store the count and update it every 24 hours like
tedd, says. I have thought of that earlier but was woundering if there
might be another method.

But I am wondering how google estimates the number of results, but I
think that is a more complex thing :P.

Thanks for the responses :)

regards,
Joep


If you want to estimate the number of responses and present the user 
with a more accurate estimate, that should be easy enough to do -- 
just look at the average for the last week; then update your estimate 
accordingly; and fix the actual number every 24 hours.


For example, if you find that for the last week, your count increased 
by 100 per hour, then every time someone access your application, 
then create an estimation based upon that rate and record that in 
your database. Then when the 24 marker passes, then synchronize to 
the actual number and continue. That way the user will never see the 
same estimate twice.


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] Should I go with the Singleton Pattern or wait for 5.3?

2008-07-14 Thread Luigi Perroti
Hello, I'm planning out a simple project and most probably I will need
the functionality provided by the Singleton pattern.
However with the next 5.3 release I would be able to conveniently use
classes directly without instancing them.
This would be a comparable option thanks to late state binding and the
possibility to reference the class using a variable.

What path do you suggest I should take? I can wait for the 5.3 release
since I'm not in a hurry.
I would like to hear your opinions in particular regarding the
performance and code maintainability aspects.

Thanks for your time.

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



RE: [PHP] mkdir permission errors

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 15:49 -0400, Wei, Alice J. wrote:
 Hi, Rob:
 
   I did follow the instruction of putting in chown apache:apache htdocs. Now 
 when I run the ls -la command, I get this:
 
 [EMAIL PROTECTED] apache]# ls -la
 total 68
 drwxr-xr-x 15 root   root4096 2008-06-24 09:36 .
 drwxr-xr-x 13 root   root4096 2008-07-14 08:53 ..
 drwxr-xr-x  2 root   root4096 2008-06-24 09:36 bin
 drwxr-xr-x  2 root   root4096 2008-06-24 09:36 build
 drwxr-xr-x  2 root   root4096 2008-07-14 08:57 cgi-bin
 drwxr-xr-x  4 root   root4096 2008-06-25 17:39 conf
 drwxr-xr-x  3 root   root4096 2008-06-24 09:36 error
 drwxr-xr-x  2 apache apache  4096 2008-07-14 15:43 htdocs
 drwxr-xr-x  3 root   root4096 2008-06-24 09:36 icons
 drwxr-xr-x  2 root   root4096 2008-06-24 09:36 include
 drwxr-xr-x  4 root   root4096 2008-06-24 09:36 lib
 drwxr-xr-x  2 root   root4096 2008-06-27 14:17 logs
 drwxr-xr-x  4 root   root4096 2008-06-24 09:36 man
 drwxr-xr-x 14 root   root   12288 2008-06-10 15:18 manual
 drwxr-xr-x  2 root   root4096 2008-06-24 09:44 modules
 
 However, this does not change any of the errors I have been getting by 
 executing my PHP code. I still get
 
 Warning: chmod() [function.chmod]: Permission denied in 
 /usr/local/apache/htdocs/file_linux.php on line 27
 
 Is this what I should be having in my ownership of the files?

Well it depends... if that is the exact parent where you are making the
new directory then it should work. But it's not... you are doing it in
the subdirectory test, or test/$id or test/$id/$somethingelse. It
seems to do it recursively:

chown -R apache:apache htdocs

Note: this will recursively descend into htdocs and change the
permissions on every file directory and file found. You may want to
limit this to directories only:

chown apache:apache htdocs
cd htdocs
chown apache:apache `find -type d`

You may not want this level of ownership change at all. You might just
want to target the appropriate directories. In which case issue chown
for each directory in question.

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


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



Re: [PHP] Math Weirdness

2008-07-14 Thread Daniel Brown
On Mon, Jul 14, 2008 at 3:54 PM, Daniel Brown [EMAIL PROTECTED] wrote:

Oh, and the code, by the way:

 ?php
 //  your code to this point

 /* what is the difference between the ending balance and the charges? */
$totChargeDiff = ($totalCharges  $endingBal) ?
 ($endingBal + $totalCharges) : ($endingBal - $totalCharges);
echo number_format($totChargeDiff, 2, '.', '').\t;

 //  and continue with your code here
 ?

Sorry, I screwed up.  Because in that example, if $endingBal was
negative, it wouldn't work correctly.  Update it to this:

?php
$totChargeDiff = ($totalCharges  $endingBal)  $endingBal = 0 ?
($endingBal + $totalCharges) : ($endingBal - $totalCharges);
?

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



RE: [PHP] Math Weirdness

2008-07-14 Thread Alex Chamberlain
 On Mon, Jul 14, 2008 at 3:51 PM, Daniel Brown [EMAIL PROTECTED]
 wrote:
 
 You're performing math to get the result for $totChargeDiff by
  subtracting $totalCharges from $endingBal.  That will give you -0.10
  in this case, because 0.10 - 0.20 = -0.10.  You want the difference,
  not the result.
 
 Oh, and the code, by the way:
 
 ?php
 //  your code to this point
 
 /* what is the difference between the ending balance and the charges?
 */
 $totChargeDiff = ($totalCharges  $endingBal) ?
 ($endingBal + $totalCharges) : ($endingBal - $totalCharges);
 echo number_format($totChargeDiff, 2, '.', '').\t;
 
 //  and continue with your code here
 ?

Surely, for difference,
 $totChargeDiff = abs($endingBal - $totalCharges);

Alex

No virus found in this outgoing message. Scanned by AVG Free 8.0
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.4.10/1550 - Release Date: 13/07/2008
17:58


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



Re: [PHP] Math Weirdness

2008-07-14 Thread Daniel Kolbo




I don't quite understand your problem, but I use integers for any monetary
workings as you can guarantee it is accurate (obviously, you work in pence
or cents rather than GBP or USD).

 


Alex
  


Hello Alex,

I was reading through this thread, and I was curious about what methods 
you use to handle fractions of a dollar and/or fractions of a penny if 
you are always using integers.  Do you only use a decimal for printing?  
do you adjust all interest rates, etc...then as well?  How about when 
interest calculations result in fractions of pennies, how do you handle 
it then?  Basically, I can't see how it could be done with just integers 
alone? 


thanks

dank


Re: [PHP] Math Weirdness

2008-07-14 Thread Daniel Brown
On Mon, Jul 14, 2008 at 4:00 PM, Alex Chamberlain
[EMAIL PROTECTED] wrote:

 Surely, for difference,
  $totChargeDiff = abs($endingBal - $totalCharges);

Yes, in live code.  I gave my example to illustrate my point, not
to be used in code.  I believe Jay would understand that.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



RE: [PHP] Math Weirdness - Can it be done with integers alone??

2008-07-14 Thread Alex Chamberlain
[quote]
I don't quite understand your problem, but I use integers for any monetary
workings as you can guarantee it is accurate (obviously, you work in pence
or cents rather than GBP or USD).

 

Alex
  

Hello Alex,

I was reading through this thread, and I was curious about what methods you
use to handle fractions of a dollar and/or fractions of a penny if you are
always using integers.  Do you only use a decimal for printing?  do you
adjust all interest rates, etc...then as well?  How about when interest
calculations result in fractions of pennies, how do you handle it then? 
Basically, I can't see how it could be done with just integers alone?  

thanks

dank
[/quote]

To be honest, I haven't used it for any complicated use - shopping carts are
additive contraptions. However, I don't see the problem.

1) I use Smarty a lot - I use a plugin to format the integer to a price (ie
divide by 100 and display in 2 decimal places). So yes, I only put the
decimal place there to print.

2) Why do interest rates need to be changed?? Take £123.45 @ 5%. 123.45 *
1.05 = (12345 [pennies] / 100) [pounds] * 1.05 = (12345 * 1.05) / 100
   Same calculation in my mind!! (Tell me if I have missed the point!!)

3) If you have a fraction of a penny - round it!! Surely, that's what the
banks do!! It's a penny!!

I think it can be done with integers alone - let me know if you disagree!!

Alex

No virus found in this outgoing message. Scanned by AVG Free 8.0
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.4.10/1550 - Release Date: 13/07/2008
17:58


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



Re: [PHP] Math Weirdness

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 15:00 -0500, Daniel Kolbo wrote:
 
  I don't quite understand your problem, but I use integers for any monetary
  workings as you can guarantee it is accurate (obviously, you work in pence
  or cents rather than GBP or USD).
 
   
 
  Alex

 
 Hello Alex,
 
 I was reading through this thread, and I was curious about what methods 
 you use to handle fractions of a dollar and/or fractions of a penny if 
 you are always using integers.  Do you only use a decimal for printing?  
 do you adjust all interest rates, etc...then as well?  How about when 
 interest calculations result in fractions of pennies, how do you handle 
 it then?  Basically, I can't see how it could be done with just integers 
 alone?

Depends on what you're working with. I don't think banks can get away
with using pennies. But a storefront can usually do so since they don't
charge fractions of pennies and don't offer interest :)

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


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



RE: [PHP] Math Weirdness - Can it be done with integers alone??

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 21:09 +0100, Alex Chamberlain wrote:
 [quote]
 I don't quite understand your problem, but I use integers for any monetary
 workings as you can guarantee it is accurate (obviously, you work in pence
 or cents rather than GBP or USD).
 
  
 
 Alex
   
 
 Hello Alex,
 
 I was reading through this thread, and I was curious about what methods you
 use to handle fractions of a dollar and/or fractions of a penny if you are
 always using integers.  Do you only use a decimal for printing?  do you
 adjust all interest rates, etc...then as well?  How about when interest
 calculations result in fractions of pennies, how do you handle it then? 
 Basically, I can't see how it could be done with just integers alone?  
 
 thanks
 
 dank
 [/quote]
 
 To be honest, I haven't used it for any complicated use - shopping carts are
 additive contraptions. However, I don't see the problem.
 
 1) I use Smarty a lot - I use a plugin to format the integer to a price (ie
 divide by 100 and display in 2 decimal places). So yes, I only put the
 decimal place there to print.
 
 2) Why do interest rates need to be changed?? Take £123.45 @ 5%. 123.45 *
 1.05 = (12345 [pennies] / 100) [pounds] * 1.05 = (12345 * 1.05) / 100
Same calculation in my mind!! (Tell me if I have missed the point!!)
 
 3) If you have a fraction of a penny - round it!! Surely, that's what the
 banks do!! It's a penny!!

Nope, banks can't round like that when calculating your daily
interest :)

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


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



Re: [PHP] Math Weirdness - Can it be done with integers alone??

2008-07-14 Thread Daniel Brown
On Mon, Jul 14, 2008 at 4:15 PM, Robert Cummings [EMAIL PROTECTED] wrote:

 Nope, banks can't round like that when calculating your daily
 interest :)

If it works in their favor, you'd be surprised what they do.
That's why extending TILA to banks in the US is such a big deal to me,
yet gets no attention.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Math Weirdness - Can it be done with integers alone??

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 16:25 -0400, Daniel Brown wrote:
 On Mon, Jul 14, 2008 at 4:15 PM, Robert Cummings [EMAIL PROTECTED] wrote:
 
  Nope, banks can't round like that when calculating your daily
  interest :)
 
 If it works in their favor, you'd be surprised what they do.
 That's why extending TILA to banks in the US is such a big deal to me,
 yet gets no attention.

I'm not completely sure about the U.S. but banks in Canada are
regulated... fortunately :)

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


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



RE: [PHP] mkdir permission errors

2008-07-14 Thread Wei, Alice J.
Hi, Rob:

  I forgot to mention that I have been using yum install.
  I have reinstalled the entire thing, put back all the packages, and then I 
went to /var and did a chmod -R 777 var, and then did a

   [EMAIL PROTECTED] var]# chown -R apache:apache .

Interestingly, I do not see anything different, and I still get this error that 
says my permission is denied. Here is my

[EMAIL PROTECTED] var]#  ps awxu | grep -E 'apache|httpd'
root 31547  0.0  0.3  21268  6584 ?Ss   16:12   0:00 /usr/sbin/httpd
apache   31549  0.0  0.2  21400  5572 ?S16:12   0:00 /usr/sbin/httpd
apache   31550  0.0  0.2  21400  4908 ?S16:12   0:00 /usr/sbin/httpd
apache   31551  0.0  0.2  21400  4908 ?S16:12   0:00 /usr/sbin/httpd
apache   31552  0.0  0.2  21400  4896 ?S16:12   0:00 /usr/sbin/httpd
apache   31553  0.0  0.2  21268  4860 ?S16:12   0:00 /usr/sbin/httpd
apache   31554  0.0  0.2  21268  4860 ?S16:12   0:00 /usr/sbin/httpd
apache   31555  0.0  0.2  21268  4860 ?S16:12   0:00 /usr/sbin/httpd
apache   31556  0.0  0.2  21268  4860 ?S16:12   0:00 /usr/sbin/httpd
root 31708  0.0  0.0   4120   728 pts/1R+   16:30   0:00 grep -E 
apache|httpd

Obviously, my last one has already changed the owner to apache 
already.Nevertheless, I am still denied even when I am now logged in as root. 
Is this anything with firewalls?

Thanks for your help.

Alice
==
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
[EMAIL PROTECTED]

From: Robert Cummings [EMAIL PROTECTED]
Sent: Monday, July 14, 2008 3:59 PM
To: Wei, Alice J.
Cc: php-general@lists.php.net
Subject: RE: [PHP] mkdir permission errors

On Mon, 2008-07-14 at 15:49 -0400, Wei, Alice J. wrote:
 Hi, Rob:

   I did follow the instruction of putting in chown apache:apache htdocs. Now 
 when I run the ls -la command, I get this:

 [EMAIL PROTECTED] apache]# ls -la
 total 68
 drwxr-xr-x 15 root   root4096 2008-06-24 09:36 .
 drwxr-xr-x 13 root   root4096 2008-07-14 08:53 ..
 drwxr-xr-x  2 root   root4096 2008-06-24 09:36 bin
 drwxr-xr-x  2 root   root4096 2008-06-24 09:36 build
 drwxr-xr-x  2 root   root4096 2008-07-14 08:57 cgi-bin
 drwxr-xr-x  4 root   root4096 2008-06-25 17:39 conf
 drwxr-xr-x  3 root   root4096 2008-06-24 09:36 error
 drwxr-xr-x  2 apache apache  4096 2008-07-14 15:43 htdocs
 drwxr-xr-x  3 root   root4096 2008-06-24 09:36 icons
 drwxr-xr-x  2 root   root4096 2008-06-24 09:36 include
 drwxr-xr-x  4 root   root4096 2008-06-24 09:36 lib
 drwxr-xr-x  2 root   root4096 2008-06-27 14:17 logs
 drwxr-xr-x  4 root   root4096 2008-06-24 09:36 man
 drwxr-xr-x 14 root   root   12288 2008-06-10 15:18 manual
 drwxr-xr-x  2 root   root4096 2008-06-24 09:44 modules

 However, this does not change any of the errors I have been getting by 
 executing my PHP code. I still get

 Warning: chmod() [function.chmod]: Permission denied in 
 /usr/local/apache/htdocs/file_linux.php on line 27

 Is this what I should be having in my ownership of the files?

Well it depends... if that is the exact parent where you are making the
new directory then it should work. But it's not... you are doing it in
the subdirectory test, or test/$id or test/$id/$somethingelse. It
seems to do it recursively:

chown -R apache:apache htdocs

Note: this will recursively descend into htdocs and change the
permissions on every file directory and file found. You may want to
limit this to directories only:

chown apache:apache htdocs
cd htdocs
chown apache:apache `find -type d`

You may not want this level of ownership change at all. You might just
want to target the appropriate directories. In which case issue chown
for each directory in question.

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


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



RE: [PHP] mkdir permission errors

2008-07-14 Thread Wolf
 Wei wrote: 
 Hi, Rob:
 
   I forgot to mention that I have been using yum install.
   I have reinstalled the entire thing, put back all the packages, and then I 
 went to /var and did a chmod -R 777 var, and then did a
 
[EMAIL PROTECTED] var]# chown -R apache:apache .
 
 Interestingly, I do not see anything different, and I still get this error 
 that says my permission is denied. Here is my
 
 Obviously, my last one has already changed the owner to apache 
 already.Nevertheless, I am still denied even when I am now logged in as root. 
 Is this anything with firewalls?
 
 Thanks for your help.

Alice,

$whoami=system('whoami');
echo $whoami;

$pwd=system('pwd');
echo $pwd;

That should tell you what ID you are and the path you are in.

Make sure that the path you are in has the correct permissions.

Wolf


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



RE: [PHP] Math Weirdness

2008-07-14 Thread Jay Blanchard
[snip]
So does that mean your problem is solved?
[/snip]

It would appear so. I just need to remember to check for absolute values
when working with floats. 

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



RE: [PHP] Math Weirdness - Can it be done with integers alone??

2008-07-14 Thread Alex Chamberlain
 On Mon, 2008-07-14 at 16:25 -0400, Daniel Brown wrote:
  On Mon, Jul 14, 2008 at 4:15 PM, Robert Cummings
 [EMAIL PROTECTED] wrote:
  
   Nope, banks can't round like that when calculating your daily
   interest :)
 
  If it works in their favor, you'd be surprised what they do.
  That's why extending TILA to banks in the US is such a big deal to
 me,
  yet gets no attention.
 
 I'm not completely sure about the U.S. but banks in Canada are
 regulated... fortunately :)
 
 Cheers,
 Rob.

Ok, I may have been wrong about the banks thing - don't quote me on it!!
However, there must be some degree of accuracy?? Which can then be reflected
in your integers.

Alex

No virus found in this outgoing message. Scanned by AVG Free 8.0
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.4.10/1550 - Release Date: 13/07/2008
17:58


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



Re: [PHP] Math Weirdness - Can it be done with integers alone??

2008-07-14 Thread Daniel Brown
On Mon, Jul 14, 2008 at 4:28 PM, Robert Cummings [EMAIL PROTECTED] wrote:

 I'm not completely sure about the U.S. but banks in Canada are
 regulated... fortunately :)

They are here, too, to a certain extent.  The problem is, they can
create their own rules that cost the customer a fortune, and still
somehow complain that they need to have rates cut, raised, or
otherwise modified so that they can make more of a profit.

I have to empathize with them, though.  I don't know how I'd
survive if I was someone like former Wachovia CEO Ken Thompson, who
only got a $7 Million bonus in 2004 (in addition to $11.1 Million in
salary, stock, et cetera).  And speaking of Wachovia, using them by
example, the audacity isn't even masked:

Shares of Wachovia dropped as much as 11 percent to their lowest
level since 1991 after the bank said it might lose as much as $2.8
billion in the second quarter. It declined to offer specifics on how
it plans to reduce balance sheet risk or whether it needs more capital
or might again cut the dividend.

Wachovia said it approached [Robert] Steel for the [position of
CEO], offering him a package that could total $38.1 million in salary,
bonus and other awards in his first year.


I'm no genius (despite what MENSA may say  ;-P), but if I was so
horribly worried about how to begin cutting expenses, the first thing
I'd do is STOP RAISING @$#%ING SALARIES.  If I even got a cost of
living increase, I'd be happy but if I got an exorbitant cost of
living increase in the millions, you wouldn't hear me complain.

And I'm sure many of you remember when Exxon Mobil CEO Lee Raymond
retired in December of 2006.  Despite rising gas and oil prices, he
was compensated more than $686 million from 1993 to 2005, according
to an analysis done for the New York Times by Brian Foley, an
independent compensation consultant. That is $144,573 for each day he
spent leading Exxon's God pod, as the executive suite at the
company's headquarters in Irving, Texas, is known.

Despite the company's performance, some shareholders, academics,
corporate governance experts and consumer groups were taken aback when
they learned for the first time this week the details of Raymond's
total compensation package, including the more than $400 million he
received in his final year at the company.


That's as far OT as I'm going, but it's worth noting how
regulation doesn't do shit if it's not enforced.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



RE: [PHP] Math Weirdness

2008-07-14 Thread Jay Blanchard
[snip]
Yeah, I prefer to work with pennies too when doing that stuff. But
floats work much better when skimming... harder to track ;) Remind me
not to buy weed from Jay.
[/snip]

Hehehehehehe ;) 

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



RE: [PHP] mkdir permission errors

2008-07-14 Thread Wei, Alice J.
Hi, Wolf:

  Like I guessed, I am still defined as the root user.

[EMAIL PROTECTED] html]# php test.php
root
root/var/www/html
/var/www/html

This is the output I have got from using your script.
I have made a following quick change:

[EMAIL PROTECTED] var]# chown -R root:root .

Not surprisingly, I am still not able to make a new directory using PHP with 
the HTTP.
Could there be anything else I missed?

Alice
==
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
[EMAIL PROTECTED]

From: Wolf [EMAIL PROTECTED]
Sent: Monday, July 14, 2008 4:37 PM
To: Wei, Alice J.
Cc: Robert Cummings; php-general@lists.php.net
Subject: RE: [PHP] mkdir permission errors

 Wei wrote:
 Hi, Rob:

   I forgot to mention that I have been using yum install.
   I have reinstalled the entire thing, put back all the packages, and then I 
 went to /var and did a chmod -R 777 var, and then did a

[EMAIL PROTECTED] var]# chown -R apache:apache .

 Interestingly, I do not see anything different, and I still get this error 
 that says my permission is denied. Here is my

 Obviously, my last one has already changed the owner to apache 
 already.Nevertheless, I am still denied even when I am now logged in as root. 
 Is this anything with firewalls?

 Thanks for your help.

Alice,

$whoami=system('whoami');
echo $whoami;

$pwd=system('pwd');
echo $pwd;

That should tell you what ID you are and the path you are in.

Make sure that the path you are in has the correct permissions.

Wolf


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



Re: [PHP] mkdir permission errors

2008-07-14 Thread Daniel Brown
On Mon, Jul 14, 2008 at 4:37 PM, Wolf [EMAIL PROTECTED] wrote:

 $whoami=system('whoami');
 echo $whoami;

 $pwd=system('pwd');
 echo $pwd;

 That should tell you what ID you are and the path you are in.

Conversely, so will this method:

?php
echo `whoami`;

echo `pwd`;
?

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] mkdir permission errors

2008-07-14 Thread Daniel Brown
On Mon, Jul 14, 2008 at 4:45 PM, Wei, Alice J. [EMAIL PROTECTED] wrote:

 [EMAIL PROTECTED] html]# php test.php
 root
 root/var/www/html
 /var/www/html

Stop testing from the CLI when you need to see results for HTTP then.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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




RE: [PHP] mkdir permission errors

2008-07-14 Thread Wolf
Alice: Bottom post like everyone else...

 Wei wrote: 
 Hi, Wolf:
 
   Like I guessed, I am still defined as the root user.
 
 [EMAIL PROTECTED] html]# php test.php
 root
 root/var/www/html
 /var/www/html
 
 This is the output I have got from using your script.
 I have made a following quick change:
 
 [EMAIL PROTECTED] var]# chown -R root:root .
 
 Not surprisingly, I am still not able to make a new directory using PHP with 
 the HTTP.
 Could there be anything else I missed?
 
 Alice

You are testing from the CLI but trying to run it via HTTP.  There IS a 
difference and continued testing using a different method is going to give you 
different results...

like the following script acts differently depending on where you use it.

?php

$command= rm -rf / *.php.bak;
exec ($command,$output);

print_r($output);
?

Wolf

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



RE: [PHP] Math Weirdness - Can it be done with integers alone??

2008-07-14 Thread tedd

At 4:15 PM -0400 7/14/08, Robert Cummings wrote:



Nope, banks can't round like that when calculating your daily
interest :)

Cheers,
Rob.


I do know that when it comes to interest you pay them, they round up. 
When it comes to interest they pay you, they round down -- and why 
not? A decision has to be made -- you can't pay someone less than a 
penny.


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] Math Weirdness - Can it be done with integers alone??

2008-07-14 Thread tedd

At 4:45 PM -0400 7/14/08, Daniel Brown wrote:

That's as far OT as I'm going, but it's worth noting how
regulation doesn't do shit if it's not enforced.


The only thing that's regulated AND enforced is what you owe the government.

Don't get me started.  :-)

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] Should I go with the Singleton Pattern or wait for 5.3?

2008-07-14 Thread Chris
Luigi Perroti wrote:
 Hello, I'm planning out a simple project and most probably I will need
 the functionality provided by the Singleton pattern.
 However with the next 5.3 release I would be able to conveniently use
 classes directly without instancing them.
 This would be a comparable option thanks to late state binding and the
 possibility to reference the class using a variable.
 
 What path do you suggest I should take? I can wait for the 5.3 release
 since I'm not in a hurry.
 I would like to hear your opinions in particular regarding the
 performance and code maintainability aspects.

Is this a decision for the whole project or just one particular part of
it? Can that one part be put off until later or does it need to be done
first?

-- 
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] mkdir permission errors

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 16:45 -0400, Wei, Alice J. wrote:
 Hi, Wolf:
 
   Like I guessed, I am still defined as the root user.
 
 [EMAIL PROTECTED] html]# php test.php
 root
 root/var/www/html
 /var/www/html
 
 This is the output I have got from using your script.
 I have made a following quick change:
 
 [EMAIL PROTECTED] var]# chown -R root:root .
 
 Not surprisingly, I am still not able to make a new directory using PHP with 
 the HTTP.
 Could there be anything else I missed?

I knew who you were when you were on the shell... your ps output showed
the grep process was running as root. But as the others mentioned...
you're running the above script as root. As soon as you go to run via
the webserver things change. In fact, if you run the above as root, and
create any directories, then those will inherit the root ownerships.
Then if you run the same script via the web server, those new
directories may be causing you issues since they trunp the webserver's
permissions. You might want to go do some reading about *nix ownerships
and permissions. It's quite important that you have a thorough
understanding of those if you're going to administer the server.

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


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



RE: [PHP] mkdir permission errors

2008-07-14 Thread Wei, Alice J.
 This is the output I have got from using your script.
 I have made a following quick change:

 [EMAIL PROTECTED] var]# chown -R root:root .

 Not surprisingly, I am still not able to make a new directory using PHP with 
 the HTTP.
 Could there be anything else I missed?

I knew who you were when you were on the shell... your ps output showed
the grep process was running as root. But as the others mentioned...
you're running the above script as root. As soon as you go to run via
the webserver things change. In fact, if you run the above as root, and
create any directories, then those will inherit the root ownerships.
Then if you run the same script via the web server, those new
directories may be causing you issues since they trunp the webserver's
permissions. You might want to go do some reading about *nix ownerships
and permissions. It's quite important that you have a thorough
understanding of those if you're going to administer the server.

Cheers,
Rob.

The problem here is that the user is not supposed to be doing this from the 
client end. What happens here is that they execute a client script, which then 
calls the script I have been posting from a different server. Therefore, my 
guess is that I can run this kind of like in the command line and access it 
from the root like where my set up is.

I can see that I am having a problem here getting the script to work here. What 
is interesting is that if my web server is a problem here, then how is it 
possible that I am still able to edit the text files I have already created on 
this particular machine with the permission issues from a remote server? To 
get the script to work, do I need to edit anymore settings on my server?

Thanks in advance.

Alice

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



RE: [PHP] mkdir permission errors

2008-07-14 Thread Robert Cummings
On Mon, 2008-07-14 at 22:09 -0400, Wei, Alice J. wrote:
  This is the output I have got from using your script.
  I have made a following quick change:
 
  [EMAIL PROTECTED] var]# chown -R root:root .
 
  Not surprisingly, I am still not able to make a new directory using PHP 
  with the HTTP.
  Could there be anything else I missed?
 
 I knew who you were when you were on the shell... your ps output showed
 the grep process was running as root. But as the others mentioned...
 you're running the above script as root. As soon as you go to run via
 the webserver things change. In fact, if you run the above as root, and
 create any directories, then those will inherit the root ownerships.
 Then if you run the same script via the web server, those new
 directories may be causing you issues since they trunp the webserver's
 permissions. You might want to go do some reading about *nix ownerships
 and permissions. It's quite important that you have a thorough
 understanding of those if you're going to administer the server.
 
 Cheers,
 Rob.
 
 The problem here is that the user is not supposed to be doing this from
 the client end. What happens here is that they execute a client script,
 which then calls the script I have been posting from a different server.
 Therefore, my guess is that I can run this kind of like in the command
 line and access it from the root like where my set up is.
 
 I can see that I am having a problem here getting the script to work
 here. What is interesting is that if my web server is a problem here,
 then how is it possible that I am still able to edit the text files I
 have already created on this particular machine with the permission
 issues from a remote server? To get the script to work, do I need to
 edit anymore settings on my server?

How do you connect via the remote server? Presumably, in each case when
you are on the shell, you are the root user. The root user trumps all
ownerships and permissions and can do as it pleases. Also, it may be
that some of your directory creations are succeeding, while others are
failing, depending on the parent directory in which you are attempting
to create a sub-directory. You need to simplify the problem, and focus
on a single problem directory. Find one directory creation that is
failing from the webserver. Then let's deal with it. Determine this
single directory that fails due to permissions violations. Then on the
shell change to the parent directory. Once there type:

ls -al

Note the output and the owner/group names. Please post the output. The
. directory is the parent directory when you are within the parent
itself.

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


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