Re: [PHP] Calculating dates

2008-02-29 Thread Jim Lucas

Ron Piggott wrote:

Is there an easy way to calculate the number of days between two dates?

Example: 2008-02-27 - 2007-12-03 = 86 days

The dates will be in the format above -MM-DD

Ron



This should do the trick

http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Calculating dates

2008-02-29 Thread Ron Piggott
Is there an easy way to calculate the number of days between two dates?

Example: 2008-02-27 - 2007-12-03 = 86 days

The dates will be in the format above -MM-DD

Ron

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



Re: [PHP] Making sure an include file works

2008-02-29 Thread Richard S. Crawford
On Friday 29 February 2008 11:58:16 Daniel Brown wrote:
>     Get a new host that knows how to administer a web server.  PHP 4.3
> was released 27 December, 2002, with the latest from the 4.3 branch
> (4.3.11) being released 31 March, 2005.  The CHANGELOG should give you
> an idea of how *horrible* this is: http://www.php.net/ChangeLog-4.php

Ah, if only I could.  The choice of host was made by my boss, and he loves 
them.

-- 
Slainte,
Richard S. Crawford
Editor-in-chief, Daikaijuzine (http://www.daikaijuzine.com)
Personal website: http://www.mossroot.com

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



[PHP] PHP on Windows

2008-02-29 Thread Erik SJMN
I'm completely new to php and I'm trying to setup an online trouble ticket
system.  After the user logs in and submits the ticket, they're supposed to
receive an email confirmation with the ticket number.  I have my Exchange
server setup on another server in the same domain that I'm trying to use to
send these emails - this server requires SMTP authentication.  So I've
installed the PEAR Mail package, as it was my understanding that this would
allow me to do the authentication for the SMTP server - I installed it in
the C:\PHP5\PEAR directory.  Do I need this mail package for the
authentication?  In any case, where do I setup the authentication variables
to send this email?  I tried adding the authentication vars to the
smtp.phpfile in the  C:\PHP5\PEAR\Mail directory, but still not
authenticating.  I'm
completely lost, any help is greatly appreciated.

; PHP 5.2.5 installed on Windows Server 2003 with IIS 6
; Mail-1.1.14 mail pkg with Net_SMTP-1.2.11 pkg

--Erik


Re: [PHP] php and google

2008-02-29 Thread Robert Cummings

On Sat, 2008-03-01 at 01:50 +, Nathan Rixham wrote:
> I think that I may be correct in saying that google blog search uses / 
> is made in PHP [which I never realised]
> 
> try googling for site:blogsearch.google.com you should get back a page 
> with an all revealing PHPSESSID
> 
> am I speculating?

You are speculating that the search is done by a PHP script when all
that can really be ascertained is that the results are presented by a
PHP script. It's akin to presenting results in a PHP page retrieved via
Lucene or htdig.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] php and google

2008-02-29 Thread Nathan Rixham
I think that I may be correct in saying that google blog search uses / 
is made in PHP [which I never realised]


try googling for site:blogsearch.google.com you should get back a page 
with an all revealing PHPSESSID


am I speculating?

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



Re: [PHP] Get country from Phone number

2008-02-29 Thread Jim Lucas

Dani Castaños wrote:

Hi all!

I'm looking for some piece of code or class which giving a phone number 
it returns me from wich country is this phone.

Do you know where I can find something like this?

Thank you in advanced!



As a little project, I took the link provided by "the other" Rob and make this 
little search tool.


It only looks at the beginning numbers.  It does no number validation.  I don't 
validate the length of the number.  ie: I would have to know the min/max lenth 
of each phone number for that given country/region, and I didn't search for that 
information.


Let me know what you'll think.

http://www.cmsws.com/examples/php/areacodes/countrycodes.php

--
Jim Lucas

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

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] imagettftext and utf-8 (swedish characters)

2008-02-29 Thread David Sveningsson

Jochem Maas skrev:

Jochem Maas schreef:
have you tried a test script (file encoded as UTF8) where you 
hardcode the
title string and see if that also outputs 'squares' ... at least that 
way
you can be sure whether the problem is in some kind of encoding mush 
that occurs
during the title's roundtrip of server -> browser -> server OR 
whether the problem is

actually to do with imagetfftext.


I tried in on my local machine (php5.2.5) and I can output swedish 
characters

no problem (I hope the below test script comes through with borking the
UTF-8 chars)

//$font   = "/Applications/OpenOffice.org 
2.3.app/Contents/share/fonts/truetype/Georgia.ttf";

$font   = "/Library/Fonts/Georgia.ttf";

$title_size = 18;

imagefilledrectangle($im, 0, 0, 800, 600, $black);

imagettftext( $im, $title_size, 0, 20, 40, $white, $font, $title );

header("Content-Type: image/png");
imagepng($im);
exit();

It does sadly not work:

*Warning*: imagettftext() [function.imagettftext 
]: any2eucjp(): invalid code 
in input string in 
*/home/ext/workspace/code/trunk/Projects/Slideshow/frontend/public/foo.php* 
on line *30


*If I suppress the warning I get an image with squares and random 
letters. Is something wrong with my php installation?


linux-2.6.24-gentoo
PHP 5.2.5-p20080206-pl3-gentoo
Apache/2.2.8

'./configure' '--prefix=/usr/lib64/php5' '--host=x86_64-pc-linux-gnu' 
'--mandir=/usr/lib64/php5/man' '--infodir=/usr/lib64/php5/info' 
'--sysconfdir=/etc' '--cache-file=./config.cache' '--with-libdir=lib64' 
'--enable-maintainer-zts' '--disable-cli' '--with-apxs2=/usr/sbin/apxs2' 
'--with-config-file-path=/etc/php/apache2-php5' 
'--with-config-file-scan-dir=/etc/php/apache2-php5/ext-active' 
'--without-pear' '--enable-bcmath' '--with-bz2' '--enable-calendar' 
'--with-curl' '--with-curlwrappers' '--disable-dbase' '--enable-exif' 
'--without-fbsql' '--without-fdftk' '--enable-ftp' '--with-gettext' 
'--with-gmp' '--with-kerberos=/usr' '--enable-mbstring' '--with-mcrypt' 
'--with-mhash' '--without-msql' '--without-mssql' '--with-ncurses' 
'--with-openssl' '--with-openssl-dir=/usr' '--enable-pcntl' 
'--without-pgsql' '--with-pspell' '--without-recode' '--disable-shmop' 
'--with-snmp' '--enable-soap' '--enable-sockets' '--without-sybase' 
'--without-sybase-ct' '--enable-sysvmsg' '--enable-sysvsem' 
'--enable-sysvshm' '--with-tidy' '--disable-wddx' '--with-xmlrpc' 
'--with-xsl' '--enable-zip' '--with-zlib' '--disable-debug' 
'--enable-dba' '--with-cdb' '--with-db4' '--with-flatfile' '--with-gdbm' 
'--with-inifile' '--without-qdbm' '--with-freetype-dir=/usr' 
'--with-t1lib=/usr' '--enable-gd-jis-conv' '--with-jpeg-dir=/usr' 
'--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-gd' '--with-imap' 
'--with-imap-ssl' '--with-ldap' '--without-ldap-sasl' 
'--with-mysql=/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' 
'--without-mysqli' '--with-unixODBC=/usr' '--without-adabas' 
'--without-birdstep' '--without-dbmaker' '--without-empress' 
'--without-esoob' '--without-ibm-db2' '--without-iodbc' 
'--without-sapdb' '--without-solid' '--without-pdo-dblib' 
'--with-pdo-mysql=/usr' '--with-pdo-odbc=unixODBC,/usr' 
'--without-pdo-pgsql' '--with-pdo-sqlite=/usr' '--without-readline' 
'--with-libedit' '--without-mm' '--with-sqlite=/usr' '--enable-sqlite-utf8'


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



Re: [PHP] Re: imagettftext and utf-8 (swedish characters)

2008-02-29 Thread David Sveningsson

Jochem Maas skrev:
I guess I skimmed somewhat too ... but I based my assumption on the 
following from the

OPs post:

/index.php/slides/upload:

$title = htmlentities($_POST['title'], ENT_COMPAT, 'UTF-8');
$image = 
'/index.php/slides/preview?title='.urlencode($title).'&content='.urlencode($_POST['content']); 



so the script handle the form submission looks to be generating a url
used as the src of an img.

Yes, the script generates an url to the script that renders the image. 
$image is later used in an img-tag. Maybe there is another way to solve 
this but this was the only thing I could think of.


I have noted that if I use numerical html entities for åäö (Å for 
instance) I can see the characters correctly. I guess that would mean 
the string passed is *not* correct utf-8.


Here is the current source:

$title = htmlentities( stripslashes($_POST['title']), ENT_NOQUOTES, 
"utf-8" );
$content = htmlentities( stripslashes($_POST['content']), ENT_NOQUOTES, 
"utf-8" );
$image = 
'/index.php/slides/preview?title='.urlencode($title).'&content='.urlencode($content)."&align=$align";


...

$title = html_entity_decode(get('title'), ENT_NOQUOTES, 'UTF-8');

$im  = imagecreatetruecolor(800, 600);
$black  = imagecolorallocate($im, 0, 0, 0);
$white  = imagecolorallocate($im, 255, 255, 255);
//$font = "/usr/share/fonts/corefonts/arial.ttf";
$font = "/usr/share/fonts/ttf-bitstream-vera/Vera.ttf";

$title_size = 42;

imagefilledrectangle($im, 0, 0, 800, 600, $black);

$this->_string_centered($im, 70, $title_size, $font, $white, $title);

header("Content-Type: image/png");
imagepng($im);


Thus, it leads me back to my previous guess that the font he chose
(georgia.ttf) doesn't have Swedish characters in the set.  With that,
I'm not sure, though, because I don't have the Georgia font pack on
here, so it'll have to stay as a guess for now.


Georgia.tff should cover swedish characters - atleast it does on my
system (MPB) ... my little test script in my other post on this thread
works for me ... I have no idea if one should/could expect variations
of supported characters in a TTF font file depending on the system your
on (my guess would be you could rely on all systems that have said TTF 
file
to support the same chars - I assume that although it may be compiled 
diffferently
for different platforms the source font definition is going to be the 
same)


All fonts I have tried works in other applications with utf-8. (I run 
lamp on my own workstation at the moment).


If anyone want to see the site or complete source I could send the url 
off-list.



//*David Sveningsson [eXt]*

Freelance coder | Game Development Student
http://sidvind.com

Thou shalt make thy program's purpose and structure clear to thy fellow 
man by using the One True Brace Style, even if thou likest it not, for 
thy creativity is better used in solving problems than in creating 
beautiful new impediments to understanding.


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



Re: [PHP] Re: imagettftext and utf-8 (swedish characters)

2008-02-29 Thread David Sveningsson

Frank Arensmeier skrev:

29 feb 2008 kl. 03.41 skrev David Sveningsson:


Nathan Rixham skrev:
before going any further, your HTML page is in UTF-8 yes? with the 
appropriate content-type line.


Yes, apache uses only utf-8 as charset and the html content-type meta 
tag is set to utf-8 too. Also, the html form validates at 
validator.w3.org



plus: first debugging step:
function preview(){
$title = html_entity_decode($_GET['title'], ENT_COMPAT, 'UTF-8');
print_r($title); #verify in view source / web browser that data is 
correct before it's sent to imagettftext


I see the characters correctly, and page info in firefox says the 
encoding is utf-8.




From the man page:
"If a character is used in the string which is not supported by the 
font, a hollow rectangle will replace the character."...
If you are 100% sure that the var $title contains a valid UTF-8 
encoded text sting (simply output the string to the browser and set 
the page encoding to UTF-8), then the only thing that is left that 
might screw up the text-to-image output is the font you are using. As 
you might know, you can only use TrueType fonts.


I am quite sure that the font supports the characters. I tried a couple 
of fonts that I use in other programs with utf-8. I am, however, not 
100% sure that $title is correct utf-8, but I think it is.


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



Re: [PHP] What design patterns do you usually use?

2008-02-29 Thread Ray Hauge

Zoltán Németh wrote:

2008. 02. 29, péntek keltezéssel 14.28-kor tedd ezt írta:

At 4:36 PM +0100 2/29/08, Zoltán Németh wrote:

sure, all information belonging to an object is usually in a record of a
db.
but, you mean include('user_functions.php') automatically loads that
data? based on what? a global $user_id variable? if so, I would consider
that poor design...
Whoa there, you don't know what it's doing -- so 
saying poor design is probably not a good call.



 > And thus, two lines instead of three.

 But in fairness, the user_functions.php would
 establish a connection to the database and the
 function "set_user_name($user, 'tedd')" would
 simply use 'tedd' with respect to whatever
 "$user" is.

hmm that means you use only one user's info in the script. that's very
limiting.

Again, you don't know what's being called.

No reason to be insulting. What I am calling 
could be a pointer or an id to a record -- BOTH 
-- of which are no more limited than calling a 
class. What do you think languages are doing when 
they call segments of memory for data or function 
-- you think they pass ton's of variables or just 
a pointer? So, there's nothing limited here about 
what I'm doing. Think about it.



hey, no insult intended here... sorry if seemed so.
but, my point was exactly what you stated above. you say 'you don't know
what's being called' - that's the main problem I found with non-oop code
organization. with clearly defined classes every developer knows what he
calls without further explanation.


sure you can duplicate with procedural code anything my tons of classes
do... but above a certain project size it can easily become a
maintenance nightmare and an integration nightmare if there are more
than one developers. classes enforce some strict rules to everyone in
the team, so teamwork is much more efficient and the resulting codebase
is cleaner. I know from experience, as this project with the 400K lines
is a rewrite of the previous procedural version, which was developed and
maintained by a dozen of developers over the years, and it became such a
mess that none of us wants to touch it anymore...
Again -- the difference here is organizational 
style. Everything you can do in your classes I 
can do in my functions. Plus, you can have just 
the same amount of screw-ups as I can when you 
introduce more than one programmer and his style 
into the mix.


I don't like the tone here -- it appears that 
because I'm not agreeing with you that my code is 
limited or of poor design -- because let me 
assure you it's not!


So, let's just drop this -- you have your way and I have mine.


again, sorry for the tone if it was wrong - might be because I'm not a
native english speaker, or maybe because this is one of the craziest
fridays ever, I don't know. for sure, I didn't mean it.

and yes, let's drop this, I see I can't convince you.
anyway, I'm not an oop zealot, I just find it so useful and I tried to
explain my view of it - with absolutely no offense intended - so, happy
coding for you with your style and me with mine :)

greets,
Zoltán Németh


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com





Aww man, I was getting curious to see how nested this conversation would 
get.  Think of the children! :)


PS. Happy Friday!!!

PPS. I'm hopped up on caffeine so ignore any stupid remarks.

--
Ray Hauge
www.primateapplications.com

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



RE: [PHP] Sessions

2008-02-29 Thread Warren Vail
There used to be a PHP setup parameter that controlled the expiration of the
session cookie on the browser, and I have on occasion set that up to live
well beyond closing the browser (which opened a couple more of Pandora's
boxes, when I had multiple browsers pointing to the site, but you should be
able to retain things for quite some time).

The user can override all this by clearing cache on the browser which is as
it should be, but one thing to remember is that most browsers cache cookies
and such by domain name and there are parameters that can give them a "life
of their own" so to speak.  I had users who shut down their browsers and
returned the next day to have their session data remain.

Warren Vail

> -Original Message-
> From: Daniel Brown [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 29, 2008 12:24 PM
> To: Warren Vail
> Cc: VamVan; php-general@lists.php.net
> Subject: Re: [PHP] Sessions
> 
> On Thu, Feb 28, 2008 at 8:29 PM, Warren Vail <[EMAIL PROTECTED]> wrote:
> > Actually garbage cleanup can be controlled by writing your session
> handler
> >  functions.  You can almost guarantee that noone else will step on your
> >  session (with the possible session of the user who hopes to benefit
> from
> >  this, by using a unique session id name, its in the manual under
> something
> >  like set session handlers.
> 
> I'll add to what Warren says about this with the following:
> 
> Write your session data to a folder in your own account, not to
> the server's /tmp folder.  A lot of sysops will remove session data
> from /tmp on shared hosting servers on a regular (e.g. - monthly)
> basis, which has a small chance that it will affect your end users
> once each month.
> 
> However, Ray also brings up the valid point that regular cookies
> are much more persistent than session cookies.  By default, any
> $_SESSION data sent to the client should expire when the session (and
> PHPSESSID) expires - which is when the session (browser instance) is
> closed.
> 
> --
> 
> 
> Daniel P. Brown
> Senior Unix Geek
> 
> 
> --
> 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] What design patterns do you usually use?

2008-02-29 Thread Zoltán Németh
2008. 02. 29, péntek keltezéssel 14.28-kor tedd ezt írta:
> At 4:36 PM +0100 2/29/08, Zoltán Németh wrote:
> >sure, all information belonging to an object is usually in a record of a
> >db.
> >but, you mean include('user_functions.php') automatically loads that
> >data? based on what? a global $user_id variable? if so, I would consider
> >that poor design...
> 
> Whoa there, you don't know what it's doing -- so 
> saying poor design is probably not a good call.
> 
> >  > And thus, two lines instead of three.
> >>
> >>  But in fairness, the user_functions.php would
> >>  establish a connection to the database and the
> >>  function "set_user_name($user, 'tedd')" would
> >>  simply use 'tedd' with respect to whatever
> >>  "$user" is.
> >
> >hmm that means you use only one user's info in the script. that's very
> >limiting.
> 
> Again, you don't know what's being called.
> 
> No reason to be insulting. What I am calling 
> could be a pointer or an id to a record -- BOTH 
> -- of which are no more limited than calling a 
> class. What do you think languages are doing when 
> they call segments of memory for data or function 
> -- you think they pass ton's of variables or just 
> a pointer? So, there's nothing limited here about 
> what I'm doing. Think about it.


hey, no insult intended here... sorry if seemed so.
but, my point was exactly what you stated above. you say 'you don't know
what's being called' - that's the main problem I found with non-oop code
organization. with clearly defined classes every developer knows what he
calls without further explanation.

> 
> >sure you can duplicate with procedural code anything my tons of classes
> >do... but above a certain project size it can easily become a
> >maintenance nightmare and an integration nightmare if there are more
> >than one developers. classes enforce some strict rules to everyone in
> >the team, so teamwork is much more efficient and the resulting codebase
> >is cleaner. I know from experience, as this project with the 400K lines
> >is a rewrite of the previous procedural version, which was developed and
> >maintained by a dozen of developers over the years, and it became such a
> >mess that none of us wants to touch it anymore...
> 
> Again -- the difference here is organizational 
> style. Everything you can do in your classes I 
> can do in my functions. Plus, you can have just 
> the same amount of screw-ups as I can when you 
> introduce more than one programmer and his style 
> into the mix.
> 
> I don't like the tone here -- it appears that 
> because I'm not agreeing with you that my code is 
> limited or of poor design -- because let me 
> assure you it's not!
> 
> So, let's just drop this -- you have your way and I have mine.

again, sorry for the tone if it was wrong - might be because I'm not a
native english speaker, or maybe because this is one of the craziest
fridays ever, I don't know. for sure, I didn't mean it.

and yes, let's drop this, I see I can't convince you.
anyway, I'm not an oop zealot, I just find it so useful and I tried to
explain my view of it - with absolutely no offense intended - so, happy
coding for you with your style and me with mine :)

greets,
Zoltán Németh

> 
> 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] Weird Results from Curl

2008-02-29 Thread Wolf

 Ray Hauge <[EMAIL PROTECTED]> wrote: 
> Wolf wrote:
> >  Ray Hauge <[EMAIL PROTECTED]> wrote: 
> >> Wolf wrote:
> >>> I'm curling a site to process some data, all well and good but the 
> >>> results are baffling...
> >>>
> >>> $result = curl_exec($ch);
> >>> curl_close($ch);
> >>> echo "".gettype ($result);
> >>>
> >>> Of course that's not all the code, but the results contain:
> >>> -
> >>> 0 11
> >>> 0 1
> >>> 1 1
> >>> 1 11
> >>> 5 An Error Has Occurred During Processing.
> >>> Error: An Error occured .
> >>> A message has been sent to the System Administrator with the details of 
> >>> the problem you have encountered. 1
> >>> 
> >>>
> >>> What I can't seem to figure out is what the result type actually is and 
> >>> how to pull just the first piece (0,1,etc) out of the "0 11" that gets 
> >>> returned.
> >>>
> >>> I have tried to do a strlen conversion, that failed.  I've tried bool 
> >>> converting but it doesn't come across right either.
> >>>
> >>> Any ideas?
> >>>
> >>> Thanks!
> >>> Wolf
> >>>
> >> It sounds like the error message is being returned from the remote server.
> >>
> >> Is gettype() outputting the numbers, or is that part of the output from 
> >> curl?  gettype should be returning a string, so I wouldn't think that 
> >> gettype would be returning the numbers.
> >>
> >> Are you using the CURLOPT_RETURNTRANSFER option?  If so, then $result 
> >> would have the text of the site on success, and false on error.
> > 
> > OK, I probably wasn't clear...
> > 
> > The results from the server (0 11, 1 11, 0 1, 1 1, 5 Error 1, etc) are 
> > what I expect them to be, however I can't pull them out.
> > 
> > *grumble*
> > 
> > I forgot that I commented out the CURLOPT_RETURNTRANSFER line!  UGH!
> > 
> > Thanks!
> > 
> > Wolf
> 
> CURLOPT_RETURNTRANSFER has gotten me a few times.  The default of just 
> outputting the information directly to the browser always seemed a bit 
> odd to me.  Maybe that's just because I've only used it for scraping and 
> reading data.

Yeah, the interesting thing though was I was getting the information that I 
needed really out of the result stack, but the format was completely hosed.  
Probably because it was essentially trying to read the stream instead of the 
data.

*GRUMBLE* 

TGIF!!!

Wolf

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



Re: [PHP] Weird Results from Curl

2008-02-29 Thread Ray Hauge

Wolf wrote:
 Ray Hauge <[EMAIL PROTECTED]> wrote: 

Wolf wrote:

I'm curling a site to process some data, all well and good but the results are 
baffling...

$result = curl_exec($ch);
curl_close($ch);
echo "".gettype ($result);

Of course that's not all the code, but the results contain:
-
0 11
0 1
1 1
1 11
5 An Error Has Occurred During Processing.
Error: An Error occured .
A message has been sent to the System Administrator with the details of the 
problem you have encountered. 1


What I can't seem to figure out is what the result type actually is and how to pull just 
the first piece (0,1,etc) out of the "0 11" that gets returned.

I have tried to do a strlen conversion, that failed.  I've tried bool 
converting but it doesn't come across right either.

Any ideas?

Thanks!
Wolf


It sounds like the error message is being returned from the remote server.

Is gettype() outputting the numbers, or is that part of the output from 
curl?  gettype should be returning a string, so I wouldn't think that 
gettype would be returning the numbers.


Are you using the CURLOPT_RETURNTRANSFER option?  If so, then $result 
would have the text of the site on success, and false on error.


OK, I probably wasn't clear...

The results from the server (0 11, 1 11, 0 1, 1 1, 5 Error 1, etc) are what 
I expect them to be, however I can't pull them out.

*grumble*

I forgot that I commented out the CURLOPT_RETURNTRANSFER line!  UGH!

Thanks!

Wolf


CURLOPT_RETURNTRANSFER has gotten me a few times.  The default of just 
outputting the information directly to the browser always seemed a bit 
odd to me.  Maybe that's just because I've only used it for scraping and 
reading data.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Weird Results from Curl

2008-02-29 Thread Wolf

 Ray Hauge <[EMAIL PROTECTED]> wrote: 
> Wolf wrote:
> > I'm curling a site to process some data, all well and good but the results 
> > are baffling...
> > 
> > $result = curl_exec($ch);
> > curl_close($ch);
> > echo "".gettype ($result);
> > 
> > Of course that's not all the code, but the results contain:
> > -
> > 0 11
> > 0 1
> > 1 1
> > 1 11
> > 5 An Error Has Occurred During Processing.
> > Error: An Error occured .
> > A message has been sent to the System Administrator with the details of the 
> > problem you have encountered. 1
> > 
> > 
> > What I can't seem to figure out is what the result type actually is and how 
> > to pull just the first piece (0,1,etc) out of the "0 11" that gets returned.
> > 
> > I have tried to do a strlen conversion, that failed.  I've tried bool 
> > converting but it doesn't come across right either.
> > 
> > Any ideas?
> > 
> > Thanks!
> > Wolf
> > 
> 
> It sounds like the error message is being returned from the remote server.
> 
> Is gettype() outputting the numbers, or is that part of the output from 
> curl?  gettype should be returning a string, so I wouldn't think that 
> gettype would be returning the numbers.
> 
> Are you using the CURLOPT_RETURNTRANSFER option?  If so, then $result 
> would have the text of the site on success, and false on error.

OK, I probably wasn't clear...

The results from the server (0 11, 1 11, 0 1, 1 1, 5 Error 1, etc) are what 
I expect them to be, however I can't pull them out.

*grumble*

I forgot that I commented out the CURLOPT_RETURNTRANSFER line!  UGH!

Thanks!

Wolf

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



Re: [PHP] Weird Results from Curl

2008-02-29 Thread Ray Hauge

Wolf wrote:

I'm curling a site to process some data, all well and good but the results are 
baffling...

$result = curl_exec($ch);
curl_close($ch);
echo "".gettype ($result);

Of course that's not all the code, but the results contain:
-
0 11
0 1
1 1
1 11
5 An Error Has Occurred During Processing.
Error: An Error occured .
A message has been sent to the System Administrator with the details of the 
problem you have encountered. 1


What I can't seem to figure out is what the result type actually is and how to pull just 
the first piece (0,1,etc) out of the "0 11" that gets returned.

I have tried to do a strlen conversion, that failed.  I've tried bool 
converting but it doesn't come across right either.

Any ideas?

Thanks!
Wolf



It sounds like the error message is being returned from the remote server.

Is gettype() outputting the numbers, or is that part of the output from 
curl?  gettype should be returning a string, so I wouldn't think that 
gettype would be returning the numbers.


Are you using the CURLOPT_RETURNTRANSFER option?  If so, then $result 
would have the text of the site on success, and false on error.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] string effect

2008-02-29 Thread Greg Donald
On 2/29/08, Alain Roger <[EMAIL PROTECTED]> wrote:
>  Text is cut off based on (numbers of words, number of characters,..) ?
>  what is the algorithm for such thing ?


Mr. Heyes more or less prompted me to go dig for my other, slightly
heavier version, that doesn't chop words up:


function breakUpLongLines( $text, $maxLength=96 )
{
  $counter = 0;
  $newText = '';
  $array = array();
  $textLength = strlen( $text );

  for( $i = 0; $i <= $textLength; $i++ )
  {
$array[] = substr( $text, $i, 1 );
  }

  $textLength = count( $array );

  for( $x = 0; $x < $textLength; $x++ )
  {
if( preg_match( "/[[:space:]]/", $array[ $x ] ) )
{
  $counter = 0;
}
else
{
  $counter++;
}

$newText .= $array[ $x ];

if( $counter >= $maxLength )
{
  $newText .= ' ';
  $counter = 0;
}
  }

  return $newText;
}


-- 
Greg Donald
http://destiney.com/

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



[PHP] Weird Results from Curl

2008-02-29 Thread Wolf
I'm curling a site to process some data, all well and good but the results are 
baffling...

$result = curl_exec($ch);
curl_close($ch);
echo "".gettype ($result);

Of course that's not all the code, but the results contain:
-
0 11
0 1
1 1
1 11
5 An Error Has Occurred During Processing.
Error: An Error occured .
A message has been sent to the System Administrator with the details of the 
problem you have encountered. 1


What I can't seem to figure out is what the result type actually is and how to 
pull just the first piece (0,1,etc) out of the "0 11" that gets returned.

I have tried to do a strlen conversion, that failed.  I've tried bool 
converting but it doesn't come across right either.

Any ideas?

Thanks!
Wolf

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



Re: [PHP] php with modified version of sqlite

2008-02-29 Thread Greg Donald
On 2/29/08, Jean-Christophe Roux <[EMAIL PROTECTED]> wrote:
> Hello,
>
>  I am running php 5.1.6 on a Centos 5.0 box (installed with yum). My php app 
> uses pdo_sqlite. The issue is that I am going to have to use a special 
> version of sqlite with some custom functions. How do I control which version 
> of sqlite, php is calling?
>  Thanks for any advice

PHP can use whatever version of SQLite you compile it against.  I do
believe SQLite version 3 is the current popular version.


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] string effect

2008-02-29 Thread Greg Donald
On 2/29/08, Alain Roger <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  since a long time now, i see that some paragraphs of text are cut off and
>  the additional text is replaced by 3 dots.
>  e.g:
>
>  "this is the original long text but without any sense and also stupid"
>
>  effect desired :
>  "this is the original long text..."
>
>  this is usually used for title articles or some long paragraphs.
>  What is the basic rule ?
>  Text is cut off based on (numbers of words, number of characters,..) ?
>  what is the algorithm for such thing ?
>
>  thanks a lot,


function truncate( $string, $length=384, $ending='...' )
{
  if( strlen( $string ) > $length )
$string = substr( $string, 0, $length ) . $ending ;

  return $string;
}



-- 
Greg Donald
http://destiney.com/

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



[PHP] Posting Summary for Week Ending 29 February, 2008: php-general@lists.php.net

2008-02-29 Thread PostTrack [Dan Brown]

Posting Summary for PHP-General List
Week Ending: Friday, 29 February, 2008

Messages| Bytes  | Sender
++--
860 (100%)  1227516 (100%)  EVERYONE
123(14.3%) 128043  (10.4%) Daniel Brown 
74 (8.6%)  142628  (11.6%) Robert Cummings 
63 (7.3%)  64583   (5.3%)  tedd 
38 (4.4%)  51447   (4.2%)  Nathan Rixham 
36 (4.2%)  52945   (4.3%)  Jochem Maas 
32 (3.7%)  53405   (4.4%)  Nathan Nobbe 
28 (3.3%)  34831   (2.8%)  Shawn McKenzie 
26 (3%)40935   (3.3%)  Jason Pruim 
22 (2.6%)  43708   (3.6%)  Zoltán Németh 
21 (2.4%)  31586   (2.6%)  Ray Hauge 
19 (2.2%)  4   (0.9%)  Greg Donald 
18 (2.1%)  19727   (1.6%)  Aschwin Wesselius 
18 (2.1%)  42126   (3.4%)  Andrés Robinet 
17 (2%)33806   (2.8%)  Eric Butera 
16 (1.9%)  20586   (1.7%)  Stut 
16 (1.9%)  20969   (1.7%)  Wolf 
13 (1.5%)  9666(0.8%)  Per Jessen 
12 (1.4%)  17956   (1.5%)  Bastien Koert 
12 (1.4%)  19911   (1.6%)  Matty Sarro 
11 (1.3%)  13830   (1.1%)  Thiago Pojda 
11 (1.3%)  22324   (1.8%)  Andrew Ballard 
11 (1.3%)  18892   (1.5%)  Jim Lucas 
11 (1.3%)  5938(0.5%)  Richard Heyes 
10 (1.2%)  14201   (1.2%)  Casey 
8  (0.9%)  5691(0.5%)  Shelley 
8  (0.9%)  9056(0.7%)  David Giragosian 
8  (0.9%)  10618   (0.9%)  TG 
7  (0.8%)  7679(0.6%)  Paul Scott 
6  (0.7%)  8179(0.7%)  Adriano Manocchia 
6  (0.7%)  11234   (0.9%)  Dotan Cohen 
6  (0.7%)  10640   (0.9%)  Larry Garfield 
6  (0.7%)  6033(0.5%)  Manuel Barros Reyes 
6  (0.7%)  8675(0.7%)  David Sveningsson 
6  (0.7%)  16061   (1.3%)  Keikonium 
6  (0.7%)  9599(0.8%)  Bojan Tesanovic 
5  (0.6%)  8661(0.7%)  Stephen Johnson 
5  (0.6%)  4140(0.3%)  Dan Joseph 
4  (0.5%)  2859(0.2%)  Chris 
4  (0.5%)  2803(0.2%)  hE 
4  (0.5%)  1487(0.1%)  skylark 
4  (0.5%)  5544(0.5%)  Emiliano Boragina 
3  (0.3%)  3868(0.3%)  Richard S dot  Crawford 

3  (0.3%)  14688   (1.2%)  pmenier 
3  (0.3%)  5608(0.5%)  chetan rane 
3  (0.3%)  3556(0.3%)  Alain Roger 
3  (0.3%)  1674(0.1%)  Jay Blanchard 
3  (0.3%)  5517(0.4%)  Warren Vail 
3  (0.3%)  4089(0.3%)  jeffry s 
2  (0.2%)  2207(0.2%)  Robin Vickery 
2  (0.2%)  2469(0.2%)  Richard Lynch 
2  (0.2%)  3980(0.3%)  Kista Tucker 
2  (0.2%)  1666(0.1%)  Aleksandar Vojnovic 
2  (0.2%)  3422(0.3%)  Stuart Dallas 
2  (0.2%)  2915(0.2%)  Holografix 
2  (0.2%)  1189(0.1%)  Brian Dunning 
2  (0.2%)  981 (0.1%)  Christoph Boget 
2  (0.2%)  3534(0.3%)  Børge Holen 
2  (0.2%)  1858(0.2%)  Verdon Vaillancourt 
2  (0.2%)  918 (0.1%)  K T Ligesh 
2  (0.2%)  1054(0.1%)  Ryan A 
2  (0.2%)  3431(0.3%)  Brady Mitchell 
2  (0.2%)  1241(0.1%)  Dani Castaños 
2  (0.2%)  2517(0.2%)  Colin Guthrie 
2  (0.2%)  4060(0.3%)  Gabriel Kuri 
2  (0.2%)  1285(0.1%)  Rick Pasotto 
1  (0.1%)  2941(0.2%)  Satyam 
1  (0.1%)  2101(0.2%)  Ravi Menon 
1  (0.1%)  1104(0.1%)  M dot  Sokolewicz 
1  (0.1%)  1799(0.1%)  Jack Bates 
1  (0.1%)  772 (0.1%)  Philip Olson 
1  (0.1%)  629 (0.1%)  Jean-Christophe Roux 
1  (0.1%)  1322(0.1%)  Frank Arensmeier 
1  (0.1%)  633 (0.1%)  Dare Williams 
1  (0.1%)  650 (0.1%)  Wolf 
1  (0.1%)  1558(0.1%)  Mr Webber 
1  (0.1%)  642 (0.1%)  Wolf 
1  (0.1%)  688 (0.1%)  VamVan 
1  (0.1%)  945 (0.1%)  Wolf 
 

[PHP] php with modified version of sqlite

2008-02-29 Thread Jean-Christophe Roux
Hello,

I am running php 5.1.6 on a Centos 5.0 box (installed with yum). My php app 
uses pdo_sqlite. The issue is that I am going to have to use a special version 
of sqlite with some custom functions. How do I control which version of sqlite, 
php is calling?
Thanks for any advice




  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


Re: [PHP] What design patterns do you usually use?

2008-02-29 Thread Jochem Maas

tedd schreef:

At 4:36 PM +0100 2/29/08, Zoltán Németh wrote:


...



I don't like the tone here -- it appears that because I'm not agreeing 
with you that my code is limited or of poor design -- because let me 
assure you it's not!


So, let's just drop this -- you have your way and I have mine.



from somewhere high, make it go splosh! ;-)



Cheers,

tedd



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



[PHP] string effect

2008-02-29 Thread Alain Roger
Hi,

since a long time now, i see that some paragraphs of text are cut off and
the additional text is replaced by 3 dots.
e.g:

"this is the original long text but without any sense and also stupid"

effect desired :
"this is the original long text..."

this is usually used for title articles or some long paragraphs.
What is the basic rule ?
Text is cut off based on (numbers of words, number of characters,..) ?
what is the algorithm for such thing ?

thanks a lot,

-- 
Alain

Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008


Re: [PHP] dont print echo

2008-02-29 Thread Jim Lucas

Daniel Brown wrote:

On Thu, Feb 28, 2008 at 11:08 PM, Emiliano Boragina
<[EMAIL PROTECTED]> wrote:

 When I try the php the echo "no picture =("; is there. How can I do to don't
 appears the message before I upload de picture.


Here's your code, re-written.



First, the op should use is_uploaded_file() to check and make sure that it is a 
file that was infact uploaded.

http://us3.php.net/manual/en/function.is-uploaded-file.php

Secondly, the op should use move_uploaded_file() instead instead of copy.
http://us3.php.net/manual/en/function.move-uploaded-file.php

They were created for a reason


if(copy($_FILES['file']['tmp_name'] , $folder . '/' .
$_FILES['file']['name']))
echo "Picture upload!";
} else {
echo "no picture =(";
}
} else {
// Handle your "incorrect file type" errors here.
die("Incorrect file type.");
}
}
?>


   
   





--
Jim Lucas

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

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Making sure an include file works

2008-02-29 Thread Daniel Brown
On Fri, Feb 29, 2008 at 3:42 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:
>  have you considered installing a local copy of php (and suitable webserver)
>  so you can test it there?

Always good advice.  At the very least, a remote dev box on which
to work the code.  However, it's not going to be the Holy Grail (as I
know Jochem's already aware, but I'll point out for newbies), because
it's more work than is generally justifiable to mirror an entire
server's environment for a single project.  For example, why would you
want to limit yourself to such antiquated technology on your
development box (losing a lot of functionality, and re-creating
security vulnerabilities and system problems) just to match to a bad
web host?

More common, you may install Apache 2.0.48 with PHP as an ASPX2
module with the GD library, which has distinct differences from an
Apache 1.3.37 with PHP as CGI with bundled GD.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] dont print echo

2008-02-29 Thread Daniel Brown
On Fri, Feb 29, 2008 at 3:30 PM, Jim Lucas <[EMAIL PROTECTED]> wrote:
>  First, the op should use is_uploaded_file() to check and make sure that it 
> is a
>  file that was infact uploaded.
> http://us3.php.net/manual/en/function.is-uploaded-file.php
>
>  Secondly, the op should use move_uploaded_file() instead instead of copy.
> http://us3.php.net/manual/en/function.move-uploaded-file.php
>
>  They were created for a reason

You're right.  I meant to change those in the psuedocode I sent
back, too, but forgot.

>  > These fields are hidden.  You can only have one submit button per form,
>  > and we're only dealing with the image uploads with this question.
>
>  At least in "HTML 4 Specification" you can have more then one submit button.

Again, you're right.  It should have said, "should only have"

Thanks for keeping things in check, Jim.  I'm a bundle of mistakes
this afternoon, and you're my error_reporting(E_ALL);.  ;-P

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Making sure an include file works

2008-02-29 Thread Jochem Maas

Richard S. Crawford schreef:

Thanks to everyone for the suggestions.  Unfortunately, I'm up against a
couple of major hurdles:

1.  My host does not allow command line access and has disabled shell
execution of PHP;

2.  Error reporting has been turned off and I can't seem to turn that on
with ini_set or error_reporting (which is fun when I have minor syntax
errors to fix); and


which ini setting? if you want to see your errors in the browser you need
 display_errors set to On. error_reporting only sets the level of reporting.



3.  My host is also stuck in PHP 4.3, so the check_syntax function isn't
available to me either (although I understand that this function has been
deprecated in the most recent builds of PHP).


make your host your ex-host.


At this point, I'll just use file_exists and is_readable for some basic
checking, and hope that the included files have no syntax errors.


it seems madness that you don't seem to test code before incorporating it
into a production system. at the very least anything you put on a website should
parse properly.

have you considered installing a local copy of php (and suitable webserver)
so you can test it there?



On Fri, Feb 29, 2008 at 11:25 AM, Daniel Brown <[EMAIL PROTECTED]> wrote:


On Thu, Feb 28, 2008 at 9:58 PM, Richard S. Crawford
<[EMAIL PROTECTED]> wrote:

I'm trying to figure out a way to make sure an included PHP file has no

syntax

 errors before actually including it as a part of project. Is this even
 possible?  I'm running into brick walls.

   As far as I know, the only way to do that is via the CLI (or
accessing the include file directly in the browser).

   Make sure that error_reporting is enabled and that it's set to
report E_ALL if you want to really be sure your code is clean (i.e. -
reporting unused, undefined, and uninstantiated variables, et cetera).

   Then, if done from a *nix command line, just type:
   php -l /path/to/include/file.php

--


Daniel P. Brown
Senior Unix Geek


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

2008-02-29 Thread Daniel Brown
On Thu, Feb 28, 2008 at 8:29 PM, Warren Vail <[EMAIL PROTECTED]> wrote:
> Actually garbage cleanup can be controlled by writing your session handler
>  functions.  You can almost guarantee that noone else will step on your
>  session (with the possible session of the user who hopes to benefit from
>  this, by using a unique session id name, its in the manual under something
>  like set session handlers.

I'll add to what Warren says about this with the following:

Write your session data to a folder in your own account, not to
the server's /tmp folder.  A lot of sysops will remove session data
from /tmp on shared hosting servers on a regular (e.g. - monthly)
basis, which has a small chance that it will affect your end users
once each month.

However, Ray also brings up the valid point that regular cookies
are much more persistent than session cookies.  By default, any
$_SESSION data sent to the client should expire when the session (and
PHPSESSID) expires - which is when the session (browser instance) is
closed.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Cannot even come up with the beginning of a regex

2008-02-29 Thread Dotan Cohen
I finally solved the problem, after ditching the /b argument in
preg_replace It seems that Hebrew letters are not part of a word, so
far as /b is concerned. Here is the code for converting Hebrew final
letters in the middle of a word to normal letters, if anyone ever
needs it:

$text="עברית מבולגנת";

function hebrewNotWordEndSwitch ($from, $to, $text) {
   $text=preg_replace('/'.$from.'([א-ת])/u','$2'.$to.'$1',$text);
   return $text;
}

do {
   $text_before=$text;
   $text=hebrewNotWordEndSwitch("ך","כ",$text);
   $text=hebrewNotWordEndSwitch("ם","מ",$text);
   $text=hebrewNotWordEndSwitch("ן","נ",$text);
   $text=hebrewNotWordEndSwitch("ף","פ",$text);
   $text=hebrewNotWordEndSwitch("ץ","צ",$text);
}   while ( $text_before!=$text );

print $text; // עברית מסודרת!

The do-while is necessary for multiple instances of letters, such as
"אנני" which would start off as "אןןי". Note that there's still the
problem of acronyms with gershiim but that's not a difficult one to
solve.

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


Re: [PHP] Making sure an include file works

2008-02-29 Thread Daniel Brown
On Fri, Feb 29, 2008 at 2:32 PM, Richard S. Crawford
<[EMAIL PROTECTED]> wrote:
> Thanks to everyone for the suggestions.  Unfortunately, I'm up against a
> couple of major hurdles:

Not to be a smartass with my responses here

> 1.  My host does not allow command line access and has disabled shell 
> execution of PHP;

Get a new host that will allow commands and offers access to
people who know how to correctly use it.

> 2.  Error reporting has been turned off and I can't seem to turn that on
> with ini_set or error_reporting (which is fun when I have minor syntax
> errors to fix); and

Get a new host that understands that - while they may want to hide
their own errors - disabling error_reporting for all customer websites
by default is asinine.

> 3.  My host is also stuck in PHP 4.3, so the check_syntax function isn't
> available to me either (although I understand that this function has been
> deprecated in the most recent builds of PHP).

Get a new host that knows how to administer a web server.  PHP 4.3
was released 27 December, 2002, with the latest from the 4.3 branch
(4.3.11) being released 31 March, 2005.  The CHANGELOG should give you
an idea of how *horrible* this is: http://www.php.net/ChangeLog-4.php

All of PHP4 reached its EOL the last day of 2007, but at the very
least, try to find a host that uses a version of PHP newer than three
to five years old.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Making sure an include file works

2008-02-29 Thread Richard Heyes

1.  My host does not allow command line access and has disabled shell
execution of PHP;

2.  Error reporting has been turned off and I can't seem to turn that on
with ini_set or error_reporting (which is fun when I have minor syntax
errors to fix); and

3.  My host is also stuck in PHP 4.3, so the check_syntax function isn't
available to me either (although I understand that this function has been
deprecated in the most recent builds of PHP).


To be quite honest, your host sounds like it sucks donkey dick. Get 
another if you can.



At this point, I'll just use file_exists and is_readable for some basic
checking, and hope that the included files have no syntax errors.


Hoping something works leads you down the path of severely broken code.

--
Richard Heyes
Employ me:
http://www.phpguru.org/cv

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



Re: [PHP] dont print echo

2008-02-29 Thread Daniel Brown
On Thu, Feb 28, 2008 at 11:08 PM, Emiliano Boragina
<[EMAIL PROTECTED]> wrote:
>  When I try the php the echo "no picture =("; is there. How can I do to don't
>  appears the message before I upload de picture.

Here's your code, re-written.




   
   


-- 


Daniel P. Brown
Senior Unix Geek


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



[PHP] Re: dont print echo

2008-02-29 Thread Shawn McKenzie
Emiliano Boragina wrote:
> Hi list…
> 
> All this in the same php:
> 
>  
> 
>  
>  $folder = 'pictures;
> 
>  $load = copy($_FILES['file']['tmp_name'] , $folder . '/' . $_FILES
> ['file']['name']);
> 
>  if ( $load ) {
> 
>echo "Picture upload!";
> 
>  } else {
> 
>echo "no picture =(";
> 
>  }
> 
> ?>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  
> 
> When I try the php the echo "no picture =("; is there. How can I do to don’t
> appears the message before I upload de picture.
> 
> Thanks.
> 
>  
> 
>  
> 
> +  _
>// Emiliano Boragina _
> 
>// Diseño & Comunicación //
> +  _
> 
>// [EMAIL PROTECTED]  /
>// 15 40 58 60 02 ///
> +  _
> 
>  
> 
> 
if(!empty($_POST['file'])) {
//your php
}

-Shawn

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



Re: [PHP] Making sure an include file works

2008-02-29 Thread Richard S. Crawford
Thanks to everyone for the suggestions.  Unfortunately, I'm up against a
couple of major hurdles:

1.  My host does not allow command line access and has disabled shell
execution of PHP;

2.  Error reporting has been turned off and I can't seem to turn that on
with ini_set or error_reporting (which is fun when I have minor syntax
errors to fix); and

3.  My host is also stuck in PHP 4.3, so the check_syntax function isn't
available to me either (although I understand that this function has been
deprecated in the most recent builds of PHP).

At this point, I'll just use file_exists and is_readable for some basic
checking, and hope that the included files have no syntax errors.

On Fri, Feb 29, 2008 at 11:25 AM, Daniel Brown <[EMAIL PROTECTED]> wrote:

> On Thu, Feb 28, 2008 at 9:58 PM, Richard S. Crawford
> <[EMAIL PROTECTED]> wrote:
> > I'm trying to figure out a way to make sure an included PHP file has no
> syntax
> >  errors before actually including it as a part of project. Is this even
> >  possible?  I'm running into brick walls.
>
>As far as I know, the only way to do that is via the CLI (or
> accessing the include file directly in the browser).
>
>Make sure that error_reporting is enabled and that it's set to
> report E_ALL if you want to really be sure your code is clean (i.e. -
> reporting unused, undefined, and uninstantiated variables, et cetera).
>
>Then, if done from a *nix command line, just type:
>php -l /path/to/include/file.php
>
> --
> 
>
> Daniel P. Brown
> Senior Unix Geek
> 
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Richard S. Crawford ([EMAIL PROTECTED])
http://www.mossroot.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)
Support me in Write-a-thon 2007:
http://www.firstgiving.com/richardscrawford


RES: [PHP] Making sure an include file works

2008-02-29 Thread Thiago Pojda
De: Daniel Brown [mailto:[EMAIL PROTECTED] 

On Thu, Feb 28, 2008 at 9:58 PM, Richard S. Crawford 
<[EMAIL PROTECTED]> wrote:
> I'm trying to figure out a way to make sure an included PHP file has 
> no syntax  errors before actually including it as a part of project. 
> Is this even  possible?  I'm running into brick walls.

As far as I know, the only way to do that is via the CLI 
(or accessing the include file directly in the browser).

Make sure that error_reporting is enabled and that it's set 
to report E_ALL if you want to really be sure your code is 
clean (i.e. - reporting unused, undefined, and uninstantiated 
variables, et cetera).

Then, if done from a *nix command line, just type:
php -l /path/to/include/file.php

--


--**--

Just being curious and lazy. The description of php -l in php.net says it
executes the script to check it's syntax.

Ok, but... It _executes_ the script as if I ran it directly? or just
_checks_ it's syntax?

There's a big difference in there.


--
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] What design patterns do you usually use?

2008-02-29 Thread tedd

At 4:36 PM +0100 2/29/08, Zoltán Németh wrote:

sure, all information belonging to an object is usually in a record of a
db.
but, you mean include('user_functions.php') automatically loads that
data? based on what? a global $user_id variable? if so, I would consider
that poor design...


Whoa there, you don't know what it's doing -- so 
saying poor design is probably not a good call.



 > And thus, two lines instead of three.


 But in fairness, the user_functions.php would
 establish a connection to the database and the
 function "set_user_name($user, 'tedd')" would
 simply use 'tedd' with respect to whatever
 "$user" is.


hmm that means you use only one user's info in the script. that's very
limiting.


Again, you don't know what's being called.

No reason to be insulting. What I am calling 
could be a pointer or an id to a record -- BOTH 
-- of which are no more limited than calling a 
class. What do you think languages are doing when 
they call segments of memory for data or function 
-- you think they pass ton's of variables or just 
a pointer? So, there's nothing limited here about 
what I'm doing. Think about it.



sure you can duplicate with procedural code anything my tons of classes
do... but above a certain project size it can easily become a
maintenance nightmare and an integration nightmare if there are more
than one developers. classes enforce some strict rules to everyone in
the team, so teamwork is much more efficient and the resulting codebase
is cleaner. I know from experience, as this project with the 400K lines
is a rewrite of the previous procedural version, which was developed and
maintained by a dozen of developers over the years, and it became such a
mess that none of us wants to touch it anymore...


Again -- the difference here is organizational 
style. Everything you can do in your classes I 
can do in my functions. Plus, you can have just 
the same amount of screw-ups as I can when you 
introduce more than one programmer and his style 
into the mix.


I don't like the tone here -- it appears that 
because I'm not agreeing with you that my code is 
limited or of poor design -- because let me 
assure you it's not!


So, let's just drop this -- you have your way and I have mine.

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] echo returnArray()['a']; // workaround

2008-02-29 Thread Shawn McKenzie
Nathan Rixham wrote:
> Nathan Nobbe wrote:
>> On Thu, Feb 28, 2008 at 6:14 PM, Nathan Rixham <[EMAIL PROTECTED]> wrote:
>>
>>> if I show you guys how to do this:
>>>
>>> echo sillyFunc()['a'] . PHP_EOL;
>>>
>>> using a few brackets and things do you promise not to laugh?
>>> *it's a bit weird*
>>
>>
>> id like to see it.
>>
>> -nathan
>>
> 
> don't say I didn't warn ya fellow nathan!
> 
> #!/usr/bin/php
>  function sillyFunc() {
> return array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e'=>'some
> string');
> }
> 
> echo !${~${''}='sillyFunc'}=&${''}().${~${''}}['e'] . PHP_EOL;
> 
> --- output ---
> some string
> 
> 
> To make things a little weirder yet here's the var's lol:
> 
> print_r(get_defined_vars());
> 
> [] => sillyFunc
> [¹] => Array
> (
> [a] => 1
> [b] => 2
> [c] => 3
> [d] => 4
> [e] => some string
> )
> 
> 
> to reference the var holding "string sillyFunc" (any of):
> echo ${''}; echo ${NULL}; echo ${FALSE};
> 
> to reference our array [¹] (yeah it is called ¹)
> print_r(${~${''}});
> 
> 
> here's a quick simplification + alternatives.
> 
> echo (!$array = sillyFunc()),$array['e'];
> echo (!$array = sillyFunc()).$array['e'];
> 
> and a useful ternary one:
> echo is_array($array = sillyFunc()) ? $array['e'] : '';
> 
> 
> told you it was a bit weird [took me a couple hours to figure out]!
> 
> nath :)

ROFLMAO, ha ha ha ha ha ha ha ha hoo ha ha ha ha ha hooo haaa!

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



Re: [PHP] Making sure an include file works

2008-02-29 Thread Daniel Brown
On Thu, Feb 28, 2008 at 9:58 PM, Richard S. Crawford
<[EMAIL PROTECTED]> wrote:
> I'm trying to figure out a way to make sure an included PHP file has no syntax
>  errors before actually including it as a part of project. Is this even
>  possible?  I'm running into brick walls.

As far as I know, the only way to do that is via the CLI (or
accessing the include file directly in the browser).

Make sure that error_reporting is enabled and that it's set to
report E_ALL if you want to really be sure your code is clean (i.e. -
reporting unused, undefined, and uninstantiated variables, et cetera).

Then, if done from a *nix command line, just type:
php -l /path/to/include/file.php

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Re: imagettftext and utf-8 (swedish characters)

2008-02-29 Thread Daniel Brown
On Fri, Feb 29, 2008 at 1:31 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:
>  (my guess would be you could rely on all systems that have said TTF file
>  to support the same chars - I assume that although it may be compiled 
> diffferently
>  for different platforms the source font definition is going to be the same)

I'm just blindly assuming (yes, ASS-uming) that the TTFs must be
the same regardless, considering the portability across platforms.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Re: imagettftext and utf-8 (swedish characters)

2008-02-29 Thread Jochem Maas

Daniel Brown schreef:

On Fri, Feb 29, 2008 at 12:59 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:

 it does because he's passing the title as an argument to the image script:


I would say that's what I get for skimming, but look here:


I guess I skimmed somewhat too ... but I based my assumption on the following 
from the
OPs post:

/index.php/slides/upload:

$title = htmlentities($_POST['title'], ENT_COMPAT, 'UTF-8');
$image = 
'/index.php/slides/preview?title='.urlencode($title).'&content='.urlencode($_POST['content']);

so the script handle the form submission looks to be generating a url
used as the src of an img.

...



Thus, it leads me back to my previous guess that the font he chose
(georgia.ttf) doesn't have Swedish characters in the set.  With that,
I'm not sure, though, because I don't have the Georgia font pack on
here, so it'll have to stay as a guess for now.


Georgia.tff should cover swedish characters - atleast it does on my
system (MPB) ... my little test script in my other post on this thread
works for me ... I have no idea if one should/could expect variations
of supported characters in a TTF font file depending on the system your
on (my guess would be you could rely on all systems that have said TTF file
to support the same chars - I assume that although it may be compiled 
diffferently
for different platforms the source font definition is going to be the same)

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



Re: [PHP] Re: imagettftext and utf-8 (swedish characters)

2008-02-29 Thread Daniel Brown
On Fri, Feb 29, 2008 at 12:59 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:
>  it does because he's passing the title as an argument to the image script:

I would say that's what I get for skimming, but look here:

>  

The form accepts (expects) UTF-8 (though the OP may be better with
`latin1_swedish_ci`).

Page encoding would only come into play here if the data was
written as an HTML string.  Form elements generally don't give a damn
how the rest of the page is configured, because their job is only to
be a container to pass POST and GET data to the server (which, again,
couldn't care less what the previous page's encoding was prior to
receiving the new data).

The only places it will matter in this case, and in order, are:
1.) The FORM element (properly configured)
2.) The browser's capability to send data encoded in the
desired encoding (likely true with the OP)
3.) The server's ability to handle the encoding (again,
properly configured, according to David)

Thus, it leads me back to my previous guess that the font he chose
(georgia.ttf) doesn't have Swedish characters in the set.  With that,
I'm not sure, though, because I don't have the Georgia font pack on
here, so it'll have to stay as a guess for now.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] imagettftext and utf-8 (swedish characters)

2008-02-29 Thread Jochem Maas

Jochem Maas schreef:

David Sveningsson schreef:
Hi, I've ran into some problems when outputing text to an image using 
imagettftext. I cannot get swedish characters to work, I just get a 
square. I've tried different fonts which I know has those characters 
(bitstream vera, arial, times new roman, etc). What am I doing wrong?


I know I must pass utf-8 encoded text and I belive I do but I don't 
know how to check it.


HTML form code:
(html document uses utf-8 as charset and apache is set to use utf-8 too)

accept-charset="utf-8">




/index.php/slides/upload:

$title = htmlentities($_POST['title'], ENT_COMPAT, 'UTF-8');
$image = 
'/index.php/slides/preview?title='.urlencode($title).'&content='.urlencode($_POST['content']); 



/index.php/slides/preview:

  function preview(){
$title = html_entity_decode($_GET['title'], ENT_COMPAT, 'UTF-8');
//$title = $_GET['title'];

///@note Hardcoded resolution
$im  = imagecreatetruecolor(800, 600);
$black  = imagecolorallocate($im, 0, 0, 0);
$white  = imagecolorallocate($im, 255, 255, 255);
$font = "/usr/share/fonts/corefonts/georgia.ttf";

$title_size = 32;

imagefilledrectangle($im, 0, 0, 800, 600, $black);

imagettftext( $im, $title_size, 0, 50, 50, $white, $font, $title );
header("Content-Type: image/png");
imagepng($im);
exit();
  }


have you tried a test script (file encoded as UTF8) where you hardcode the
title string and see if that also outputs 'squares' ... at least that way
you can be sure whether the problem is in some kind of encoding mush 
that occurs
during the title's roundtrip of server -> browser -> server OR whether 
the problem is

actually to do with imagetfftext.


I tried in on my local machine (php5.2.5) and I can output swedish characters
no problem (I hope the below test script comes through with borking the
UTF-8 chars)










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



Re: [PHP] simple command help

2008-02-29 Thread Daniel Brown
On Fri, Feb 29, 2008 at 5:22 AM, Shelley <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>  What's the command to use if I want to remove all the directories and
>  files except 'a.gz' under a directory?

There isn't a "command" in PHP to do this.  You'd have to write a
script to handle that processing.

If you're looking for general Unix/Linux commands, you're in the
wrong place, but here's one possible way to do it:

sudo chattr +i /path/to/a.gz
rm -fR /path
sudo chattr -i /path/to/a.gz

If you have sudo access (or straight root access, in which case
you can su - to root and skip the 'sudo' part of the command), that
will set the file attribute to immutable, which means no one -
including root or the system itself - can modify or delete that file
unless they have the CAP_LINUX_IMMUTABLE capability (such as root) and
issue the 'chattr -i filename' command.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Re: imagettftext and utf-8 (swedish characters)

2008-02-29 Thread Jochem Maas

Daniel Brown schreef:

On Thu, Feb 28, 2008 at 9:17 PM, Nathan Rixham <[EMAIL PROTECTED]> wrote:

 before going any further, your HTML page is in UTF-8 yes? with the
 appropriate content-type line.


That wouldn't matter, Nate.  It's an image (and already rendered
as a static graphical object).  Page encoding won't make a difference
here.


it does because he's passing the title as an argument to the image script:



okay, so foodledoodle is not proper swedish, but if you say it in a high
voice it sounds a bit like it :-P





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



Re: [PHP] imagettftext and utf-8 (swedish characters)

2008-02-29 Thread Jochem Maas

David Sveningsson schreef:
Hi, I've ran into some problems when outputing text to an image using 
imagettftext. I cannot get swedish characters to work, I just get a 
square. I've tried different fonts which I know has those characters 
(bitstream vera, arial, times new roman, etc). What am I doing wrong?


I know I must pass utf-8 encoded text and I belive I do but I don't know 
how to check it.


HTML form code:
(html document uses utf-8 as charset and apache is set to use utf-8 too)

accept-charset="utf-8">




/index.php/slides/upload:

$title = htmlentities($_POST['title'], ENT_COMPAT, 'UTF-8');
$image = 
'/index.php/slides/preview?title='.urlencode($title).'&content='.urlencode($_POST['content']); 



/index.php/slides/preview:

  function preview(){
$title = html_entity_decode($_GET['title'], ENT_COMPAT, 'UTF-8');
//$title = $_GET['title'];

///@note Hardcoded resolution
$im  = imagecreatetruecolor(800, 600);
$black  = imagecolorallocate($im, 0, 0, 0);
$white  = imagecolorallocate($im, 255, 255, 255);
$font = "/usr/share/fonts/corefonts/georgia.ttf";

$title_size = 32;

imagefilledrectangle($im, 0, 0, 800, 600, $black);

imagettftext( $im, $title_size, 0, 50, 50, $white, $font, $title );

header("Content-Type: image/png");

imagepng($im);
exit();
  }


have you tried a test script (file encoded as UTF8) where you hardcode the
title string and see if that also outputs 'squares' ... at least that way
you can be sure whether the problem is in some kind of encoding mush that occurs
during the title's roundtrip of server -> browser -> server OR whether the 
problem is
actually to do with imagetfftext.






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



Re: [PHP] imagettftext and utf-8 (swedish characters)

2008-02-29 Thread Daniel Brown
On Thu, Feb 28, 2008 at 8:45 PM, David Sveningsson <[EMAIL PROTECTED]> wrote:
> Hi, I've ran into some problems when outputing text to an image using
>  imagettftext. I cannot get swedish characters to work, I just get a
>  square. I've tried different fonts which I know has those characters
>  (bitstream vera, arial, times new roman, etc). What am I doing wrong?

Most likely, it's because the font doesn't have an entry for those
characters.  Try to find a TTF font that does have those entities and
your problems will most likely be solved that easily.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Re: imagettftext and utf-8 (swedish characters)

2008-02-29 Thread Daniel Brown
On Thu, Feb 28, 2008 at 9:17 PM, Nathan Rixham <[EMAIL PROTECTED]> wrote:
>  before going any further, your HTML page is in UTF-8 yes? with the
>  appropriate content-type line.

That wouldn't matter, Nate.  It's an image (and already rendered
as a static graphical object).  Page encoding won't make a difference
here.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] auto-wrap on posts

2008-02-29 Thread Daniel Brown
On Fri, Feb 29, 2008 at 8:43 AM, Ray Hauge <[EMAIL PROTECTED]> wrote:
>  Yeah, it is a gmail thing.  They archive the message you send, so if you
>  were using the gmail client, you'd see your response.  The FAQs say that
>  it'll send your message through IMAP/POP if someone replies to your
>  message, but gmail doesn't do nested threads, so I think it doesn't know
>  all the time when you were replied to.

You're 100% correct, Ray.

I use Gmail's web interface (to which I believe Ray is referring
as "the gmail client"), and when I send a message to a list, single
person, or anything, the message will show up in my sent box, but not
my inbox.  This is completely expected behavior for any client.
However, as soon as I receive a response, my initiating message will
display as the first message in the thread, as well as in the sent
box.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Get country from Phone number

2008-02-29 Thread Daniel Brown
On Fri, Feb 29, 2008 at 5:02 AM, Dani Castaños
<[EMAIL PROTECTED]> wrote:
> Hi all!
>
>  I'm looking for some piece of code or class which giving a phone number
>  it returns me from wich country is this phone.
>  Do you know where I can find something like this?

Most likely you'll need a database, because you'll have to store
all area codes, as well.  It's not enough to go by Country Code unless
you just want the continent to which the number terminates.

For example, I live in Pennsylvania (USA), and my country code is
1, my area code is 570 (and my exchange is 362, but that's getting
municipal).  If I want to call Enterprise Network Consulting in
Whitehorse, Yukon, Canada, the country code is still 1, the area code
is 867 (and the local exchange is 668).  Both numbers are 11-digits in
length, including the country code, yet terminate in different
countries entirely, and are over 3,500 miles (>5600 kilometers) apart.

So unless you wanted to split by continental region (e.g. - North
America), then you'll need a database.  Aside from that, the
programming itself would be a piece of cake.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] output buffering in CLI script.

2008-02-29 Thread Jochem Maas

Greg Donald schreef:

On 2/28/08, Casey <[EMAIL PROTECTED]> wrote:

 #!/usr/bin/php


Or the entirely more portable version:

#!/usr/bin/env php


thanks for the tip :-)





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



RE: [PHP] Get country from Phone number

2008-02-29 Thread Robert Cummings

On Fri, 2008-02-29 at 05:17 -0500, Andrés Robinet wrote:
> > -Original Message-
> > From: Dani Castaños [mailto:[EMAIL PROTECTED]
> > Sent: Friday, February 29, 2008 5:03 AM
> > To: PHP LIST
> > Subject: [PHP] Get country from Phone number
> > 
> > Hi all!
> > 
> > I'm looking for some piece of code or class which giving a phone number
> > it returns me from wich country is this phone.
> > Do you know where I can find something like this?
> > 
> > Thank you in advanced!
> > 
> > --
> 
> Seems like you'll have a hard time if you want to include all the 
> possibilities:
> http://www.kropla.com/dialcode.htm
> But probably Rob (Cummings) will come up with a "solve-it-all" regex that will
> save your day.

Regex is powerful, but I have my doubts it'll work in this case. If the
phone numbers are in standardized international format then it should be
a bit easier. Then you'll need a mapping of country codes to country.
Finally you'll need to be able to match variables length country codes
to the lookup map. I'm not sure, but it may be possible to determine the
largest possible country code and then use that as a first substring
attempt lookups into the mapping array. Then loop through the mapping
array and find the first country that has a prefix of the country code.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Text Color

2008-02-29 Thread Jason Pruim


On Feb 29, 2008, at 10:44 AM, Daniel Brown wrote:

On Fri, Feb 29, 2008 at 10:29 AM, Andrew Ballard  
<[EMAIL PROTECTED]> wrote:
On Fri, Feb 29, 2008 at 10:21 AM, Jason Pruim <[EMAIL PROTECTED]>  
wrote:


   .red {
   color: red;
   }



Let's just get all purist and go back to the class="highlight" so we
don't find ourselves a year later with a stylesheet that includes

.red {
   color: green;
}


   Andrew makes a good point, Jason.  Despite the fact that it's just
a reference, it's easier to make a general reference to "highlight"
that can later be changed to weird colors like shale, aquamarine,
coffee, and taupe, than to have a style called "red" and have a future
designer look at the source and say, "damn, that Jason Pruim guy
doesn't know his .red from a #804000 in the ground.


So I typed quickly on a friday without thinking it completely  
through :P I've been doing more programming rather then designing  
lately...




:-) OK, so it's Friday.


   Indeed it is.  ;-P

   TFGIF and Happy Leap Day!


Yes it is!! I could not be more ready for the weekend :)





--


Daniel P. Brown
Senior Unix Geek


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




--

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

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



Re: [PHP] output buffering in CLI script.

2008-02-29 Thread Greg Donald
On 2/28/08, Casey <[EMAIL PROTECTED]> wrote:
>  #!/usr/bin/php

Or the entirely more portable version:

#!/usr/bin/env php
http://destiney.com/

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



Re: [PHP] Text Color

2008-02-29 Thread Daniel Brown
On Fri, Feb 29, 2008 at 10:29 AM, Andrew Ballard <[EMAIL PROTECTED]> wrote:
> On Fri, Feb 29, 2008 at 10:21 AM, Jason Pruim <[EMAIL PROTECTED]> wrote:
>  >  
>  > .red {
>  > color: red;
>  > }
>  >  
>
>  Let's just get all purist and go back to the class="highlight" so we
>  don't find ourselves a year later with a stylesheet that includes
>
>  .red {
> color: green;
>  }

Andrew makes a good point, Jason.  Despite the fact that it's just
a reference, it's easier to make a general reference to "highlight"
that can later be changed to weird colors like shale, aquamarine,
coffee, and taupe, than to have a style called "red" and have a future
designer look at the source and say, "damn, that Jason Pruim guy
doesn't know his .red from a #804000 in the ground.

>  :-) OK, so it's Friday.

Indeed it is.  ;-P

TFGIF and Happy Leap Day!

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] What design patterns do you usually use?

2008-02-29 Thread Zoltán Németh
2008. 02. 29, péntek keltezéssel 10.12-kor tedd ezt írta:
> At 8:52 AM +0100 2/29/08, Zoltán Németh wrote:
> >it's not just that, it's also a different way of thinking about your
> >data. for example say you have a 'user' - you always have one of that ;)
> >in procedural code you would store the properties of the user in an
> >array or whatever, and have an include file with functions to manipulate
> >the user. so why not group those two together in a class?
> >
> >
> >
> >procedural code:
> >include('user_functions.php');
> >$user = load_user_data($userid);
> >$user = set_user_name($user, 'tedd');
> >
> >oop code:
> >include('user.class.php');
> >$user = new User($userid);
> >$user->setName('tedd');
> >
> >
> >
> >see, same number of lines, so no added complexity. however the second
> >one has some advantages:
> >- you don't have to pass around the data since it is grouped together
> >with the method you call
> >- you don't have to worry about some ignorant developer calling
> >set_user_name with, say, a product array - User->setName will always be
> >called on a user object
> >- the second one looks soo better ;) (ok, you said, new paint :) )
> 
> I can understand your oop code very well -- but 
> your procedural code example is lacking.
> 
> First, if I were to have information tied to a 
> user, then I would use MySQL and establish a 
> record with all the fields I needed for that 
> user. My code simply would be:

> include('user_functions.php');
> $user = set_user_name($user, 'tedd');
> 

sure, all information belonging to an object is usually in a record of a
db.
but, you mean include('user_functions.php') automatically loads that
data? based on what? a global $user_id variable? if so, I would consider
that poor design...

> And thus, two lines instead of three.
> 
> But in fairness, the user_functions.php would 
> establish a connection to the database and the 
> function "set_user_name($user, 'tedd')" would 
> simply use 'tedd' with respect to whatever 
> "$user" is.

hmm that means you use only one user's info in the script. that's very
limiting.

> 
> The number of lines of code really doesn't apply 
> with respect to organization value -- after all, 
> the best organization is to document your code 
> which certainly adds lines of "code". Sure, one 
> can argue that remarks are not code, but code 
> without them would be different, so in my mind 
> it's all code.
> 
> I don't think that you can show me an oop example 
> that I can't duplicate procedurally and that's my 
> point. Oop provides a different organization 
> method.

sure you can duplicate with procedural code anything my tons of classes
do... but above a certain project size it can easily become a
maintenance nightmare and an integration nightmare if there are more
than one developers. classes enforce some strict rules to everyone in
the team, so teamwork is much more efficient and the resulting codebase
is cleaner. I know from experience, as this project with the 400K lines
is a rewrite of the previous procedural version, which was developed and
maintained by a dozen of developers over the years, and it became such a
mess that none of us wants to touch it anymore...

greets,
Zoltán Németh

> 
> 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] Text Color

2008-02-29 Thread Andrew Ballard
On Fri, Feb 29, 2008 at 10:21 AM, Jason Pruim <[EMAIL PROTECTED]> wrote:
>
>  On Feb 29, 2008, at 10:07 AM, Richard Heyes wrote:
>
>  >>> echo
>  >>> "".$myrow["char_name"]."".$myrow["char_level"]."".
>  >>> $class["class"]."".$myrow["kara"]."".
>  >>> $myrow["karateam"]."".$myrow["karasub"];
>  >>Either CSS styling or the dreaded HTML "  >> />".$myrow['char_name']."" tags.
>  >
>  > But you should use CSS:
>  >
>  > echo '' ...
>
>  But if you're going to use CSS.. it would be better for managing it to
>  do it as a style sheet:
>
>  
> .red {
> color: red;
> }
>  
>
>  echo '';
>
>  Just my opinion :)

Let's just get all purist and go back to the class="highlight" so we
don't find ourselves a year later with a stylesheet that includes

.red {
color: green;
}

:-) OK, so it's Friday.

Andrew

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



Re: [PHP] Text Color

2008-02-29 Thread Jason Pruim


On Feb 29, 2008, at 10:07 AM, Richard Heyes wrote:


echo
"".$myrow["char_name"]."".$myrow["char_level"]."". 
$class["class"]."".$myrow["kara"]."". 
$myrow["karateam"]."".$myrow["karasub"];

   Either CSS styling or the dreaded HTML "".$myrow['char_name']."" tags.


But you should use CSS:

echo '' ...


But if you're going to use CSS.. it would be better for managing it to  
do it as a style sheet:



.red {
color: red;
}


echo '';

Just my opinion :)





--
Richard Heyes
Employ me:
http://www.phpguru.org/cv

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




--

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

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



Re: [PHP] What design patterns do you usually use?

2008-02-29 Thread tedd

At 8:52 AM +0100 2/29/08, Zoltán Németh wrote:

it's not just that, it's also a different way of thinking about your
data. for example say you have a 'user' - you always have one of that ;)
in procedural code you would store the properties of the user in an
array or whatever, and have an include file with functions to manipulate
the user. so why not group those two together in a class?



procedural code:
include('user_functions.php');
$user = load_user_data($userid);
$user = set_user_name($user, 'tedd');

oop code:
include('user.class.php');
$user = new User($userid);
$user->setName('tedd');



see, same number of lines, so no added complexity. however the second
one has some advantages:
- you don't have to pass around the data since it is grouped together
with the method you call
- you don't have to worry about some ignorant developer calling
set_user_name with, say, a product array - User->setName will always be
called on a user object
- the second one looks soo better ;) (ok, you said, new paint :) )


I can understand your oop code very well -- but 
your procedural code example is lacking.


First, if I were to have information tied to a 
user, then I would use MySQL and establish a 
record with all the fields I needed for that 
user. My code simply would be:


include('user_functions.php');
$user = set_user_name($user, 'tedd');

And thus, two lines instead of three.

But in fairness, the user_functions.php would 
establish a connection to the database and the 
function "set_user_name($user, 'tedd')" would 
simply use 'tedd' with respect to whatever 
"$user" is.


The number of lines of code really doesn't apply 
with respect to organization value -- after all, 
the best organization is to document your code 
which certainly adds lines of "code". Sure, one 
can argue that remarks are not code, but code 
without them would be different, so in my mind 
it's all code.


I don't think that you can show me an oop example 
that I can't duplicate procedurally and that's my 
point. Oop provides a different organization 
method.


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] Text Color

2008-02-29 Thread Richard Heyes

 echo
 
"".$myrow["char_name"]."".$myrow["char_level"]."".$class["class"]."".$myrow["kara"]."".$myrow["karateam"]."".$myrow["karasub"];


Either CSS styling or the dreaded HTML "".$myrow['char_name']."" tags.



But you should use CSS:

echo '' ...

--
Richard Heyes
Employ me:
http://www.phpguru.org/cv

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



Re: [PHP] Text Color

2008-02-29 Thread Daniel Brown
On Thu, Feb 28, 2008 at 11:03 PM, Jeff <[EMAIL PROTECTED]> wrote:
> Please, can anyone tell me how to produce colored text? For instance if I
>  wanted to following code to be printed as red text what would I need to add
>  to they code? Thanks in advance.
>
>  echo
>  
> "".$myrow["char_name"]."".$myrow["char_level"]."".$class["class"]."".$myrow["kara"]."".$myrow["karateam"]."".$myrow["karasub"];

Either CSS styling or the dreaded HTML "".$myrow['char_name']."" tags.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Getting the name of a function

2008-02-29 Thread Daniel Brown
On Fri, Feb 29, 2008 at 7:44 AM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> Daniel Brown schreef:
> > On Thu, Feb 28, 2008 at 5:06 AM, Jochem Maas <[EMAIL PROTECTED]> wrote:
>  >>  huh? what about debug_backtrace() ... contains plenty of info, including
>  >>  function names of everything in the stack. of course something like 
> xdebug
>  >>  can take it to a whole new level.
>  >
>  > You're right.  Forgot about that function.  :-\
>
>  your forgiven, you've probably had a lot on your mind lately what with 
> choosing a
>  dress for the ceremony :-P

Oh, did I forget to mention that it's an open bar for everyone
*except* you, and that you'll be paying a mere seven-times the price
of normal drinks, with a 10 drink required minimum?  ;-P

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] auto-wrap on posts

2008-02-29 Thread Ray Hauge

Zoltán Németh wrote:

2008. 02. 28, csütörtök keltezéssel 10.38-kor Nathan Nobbe ezt írta:

On Thu, Feb 28, 2008 at 10:35 AM, David Giragosian <[EMAIL PROTECTED]>
wrote:


On 2/28/08, Nathan Nobbe <[EMAIL PROTECTED]> wrote:

take a look here on the marc archives.
http://marc.info/?l=php-general&m=120415418217911&w=2

there are several lines that have 1 word only in them, some of the words
(for reference) are access, good, patterns, nested.
when i wrote the post (looking in my gmail client) these words are not

on

their own line..
does the post look as it does on marc in your mail clients or are the

words

in sentences where they belong ?

thanks,

-nathan


Your emails come through to my gmail account as you first described,
Nathan, ie, sometimes with just one word on a line, and just like the
marc archives.


thanks, ill just have to be careful editing from gmail then..

Ray, if I start a thread, I'm fairly sure the list sends the email back to

me.


i dont get an email back until someone replies.


that must be a gmail thing, I get everything back

greets,
Zoltán Németh


-nathan





Yeah, it is a gmail thing.  They archive the message you send, so if you 
were using the gmail client, you'd see your response.  The FAQs say that 
it'll send your message through IMAP/POP if someone replies to your 
message, but gmail doesn't do nested threads, so I think it doesn't know 
all the time when you were replied to.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Getting the name of a function

2008-02-29 Thread Jochem Maas

Daniel Brown schreef:

On Thu, Feb 28, 2008 at 5:06 AM, Jochem Maas <[EMAIL PROTECTED]> wrote:

Daniel Brown schreef:

On Wed, Feb 27, 2008 at 1:56 PM, Richard S. Crawford

 > <[EMAIL PROTECTED]> wrote:
 > [snip!]
 >>  I know that I could pass the name of the function as a parameter to the
 >>  error() function (e.g. error("bad_function","This is dumb")) but I'd rather
 >>  keep it simpler than that.
 >>
 >>  Is there a way to do this?
 >
 > Not without a lower-level stack trace utility like xdebug, as far

 huh? what about debug_backtrace() ... contains plenty of info, including
 function names of everything in the stack. of course something like xdebug
 can take it to a whole new level.


You're right.  Forgot about that function.  :-\


your forgiven, you've probably had a lot on your mind lately what with choosing 
a
dress for the ceremony :-P





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



Re: [PHP] Re: imagettftext and utf-8 (swedish characters)

2008-02-29 Thread Frank Arensmeier

29 feb 2008 kl. 03.41 skrev David Sveningsson:


Nathan Rixham skrev:
before going any further, your HTML page is in UTF-8 yes? with the  
appropriate content-type line.


Yes, apache uses only utf-8 as charset and the html content-type  
meta tag is set to utf-8 too. Also, the html form validates at  
validator.w3.org



plus: first debugging step:
function preview(){
$title = html_entity_decode($_GET['title'], ENT_COMPAT, 'UTF-8');
print_r($title); #verify in view source / web browser that data is  
correct before it's sent to imagettftext


I see the characters correctly, and page info in firefox says the  
encoding is utf-8.




From the man page:
"If a character is used in the string which is not supported by the  
font, a hollow rectangle will replace the character."...
If you are 100% sure that the var $title contains a valid UTF-8  
encoded text sting (simply output the string to the browser and set  
the page encoding to UTF-8), then the only thing that is left that  
might screw up the text-to-image output is the font you are using. As  
you might know, you can only use TrueType fonts.


//frank

ps sorry for posting my reply off-list the first time... ds.

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



Re: [PHP] Get country from Phone number

2008-02-29 Thread Satyam
It is not as bad as it looks.  The only important columns are the first two, 
the last two are how you dial from within the country to place long distance 
international or national calls. In many countries, when there are several 
low cost international call providers, they use different prefixes, 
actually, it is quite absurd that they list all options for low cost 
carriers for, say, Venezuela, while they don't for the USA where there are 
as many or more.


The only tough part is that several countries, share the +1 prefix, the USA 
and Canada are the larger, but many Caribean countries, which originally got 
their service through the US phone system, are also mixed in.  So, in those 
cases, you have to check through the 'area codes'. A similar thing happens 
with the ex-Soviet republics, they all share the 7 prefix.


As for the rest, it is quite straighforward.

1 is North America
2 is Africa
3 and 4 Europe
5 rest of the Americas
6 Oceania
7 Russia and ex-soviet republics
8 FarEast
9 rest of Asia

Most prefixes are of varying lenghts.  The countries with the most phone 
lines get the shorter prefixes so the overall number is more or less the 
same for all.  Thus, Mexico and Brazil get two digit codes in the 5 range 
while smaller Nicaragua gets three.


Satyam


- Original Message - 
From: "Andrés Robinet" <[EMAIL PROTECTED]>
To: "'Dani Castaños'" <[EMAIL PROTECTED]>; "'PHP LIST'" 


Sent: Friday, February 29, 2008 11:17 AM
Subject: RE: [PHP] Get country from Phone number



-Original Message-
From: Dani Castaños [mailto:[EMAIL PROTECTED]
Sent: Friday, February 29, 2008 5:03 AM
To: PHP LIST
Subject: [PHP] Get country from Phone number

Hi all!

I'm looking for some piece of code or class which giving a phone number
it returns me from wich country is this phone.
Do you know where I can find something like this?

Thank you in advanced!

--


Seems like you'll have a hard time if you want to include all the 
possibilities:

http://www.kropla.com/dialcode.htm
But probably Rob (Cummings) will come up with a "solve-it-all" regex that 
will

save your day.

Regards,

Rob(inet)


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 
33308 |

TEL 954-607-4207 | FAX 954-337-2695 |
Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: 
bestplace |

Web: bestplace.biz | Web: seo-diy.com

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




--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.21.1/1303 - Release Date: 
28/02/2008 12:14





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



Re: [PHP] Get country from Phone number

2008-02-29 Thread Dani Castaños

Andrés Robinet escribió:

-Original Message-
From: Dani Castaños [mailto:[EMAIL PROTECTED]
Sent: Friday, February 29, 2008 5:03 AM
To: PHP LIST
Subject: [PHP] Get country from Phone number

Hi all!

I'm looking for some piece of code or class which giving a phone number
it returns me from wich country is this phone.
Do you know where I can find something like this?

Thank you in advanced!

--



Seems like you'll have a hard time if you want to include all the possibilities:
http://www.kropla.com/dialcode.htm
But probably Rob (Cummings) will come up with a "solve-it-all" regex that will
save your day.

Regards,

Rob(inet)
OoooH! I will be happy for ever is this could be solved by regexp... I 
will do my doctorate on REGEXP then... :-)


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



Re: [PHP] Traverse directory - Find empty directory

2008-02-29 Thread Holografix
Hi
Thank you for answering my question Jim.
I didn't notice the message get into the list because I get errors when 
posting and then I quit to post and try to solve the problem. Your solution 
is good and nice. I used scandir() instead of glob() with a recursive 
function.

Best regards
holo


"Jim Lucas" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Holografix wrote:
>> Hi
>>
>> I'm using Spl RecursiveDirectoryIterator to traverse a directory and have 
>> no problem with it but now I'm stuck. I only need to display directories 
>> with no files in it.
>>
>> Can someone help with this?
>>
>> My current code:
>>
>> set_time_limit(0);
>>
>> $files = new RecursiveIteratorIterator(new 
>> RecursiveDirectoryIterator('c:\dev'), 
>> RecursiveIteratorIterator::SELF_FIRST);
>> foreach($files as $file) {
>> if ($files->isDir()) {
>> echo $file . "";
>> }
>> }
>>
>> I have
>> c:\dev
>> c:\dev\php
>> c:\dev\php\file1.php
>> c:\dev\php\file2.php
>> c:\dev\php\test
>> c:\dev\php\test\db
>>
>> I would like to display 'test' because although there is a 'db'  folder, 
>> there are no files in c:\dev\php\test
>>
>>
>>
>> Bets regards,
>> holo
>
> This should do what you are looking to do.
>
> Someone else might find a better way of doing it, but this will work.
>
> 
> set_time_limit(0);
>
> $path = './';
>
> $files = new RecursiveIteratorIterator(new 
> RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
> foreach($files as $file) {
> if ($files->isDir()) {
> if ( ( $results = glob($file.'/*') ) !== false ) {
> $file_found = false;
> foreach ( $results AS $entry ) {
> if ( is_file($entry) ) {
> $file_found = true;
> break;
> }
> }
>
> if ( !$file_found )
> echo $file . " DOES NOT contain files\n";
>
> }
> }
> }
>
>
> -- 
> Jim Lucas
>
>"Some men are born to greatness, some achieve greatness,
>and some have greatness thrust upon them."
>
> Twelfth Night, Act II, Scene V
> by William Shakespeare 

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



Re: [PHP] simple command help

2008-02-29 Thread Richard Heyes
What's the command to use if I want to remove all the directories and 
files except 'a.gz' under a directory?


There isn't one. If you're using *nix, you could try this:

exec('find ! -name a.gz -maxdepth 1 -exec rm -rf {} \;');

Or something like that. If you're on Windows you'll need someone else... :-)

--
Richard Heyes
Employ me:
http://www.phpguru.org/cv

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



Re: [PHP] Re: Sometimes I wonder why I even started programming...

2008-02-29 Thread Zoltán Németh
2008. 02. 29, péntek keltezéssel 10.17-kor Colin Guthrie ezt írta:
> Zoltán Németh wrote:
> > I strongly recommend git. it has several great advantages above cvs or
> > svn. for example, it does not store whole copies of the whole tree if
> > you make a branch, but stores only the differences. it is much faster,
> > and losing a commit is really hard even if you screw things up seriously
> > (I know I've done that a couple of times when I was new to git, but I
> > could manage to restore everything)
> 
> Yeah git is definitely good, I don't deny that, but your comment about
> storing whole copies when you make a branch does not hold true for SVN,
> at least not with that statement... If you make a branch in SVN it is
> free. If you make changes on the branch then commit it and subsequently
> merge that branch back to the trunk/master/whatever *then* SVN will
> store your changes twice, whereas git is cleverererer.

yeah, sure, I wasn't exact.

> 
> I think both have their advantages. For me, until Git integration into
> Trac it's a non-starter as I use Trac heavily to track tickets/bugs,
> time and view the repo etc.

trac integration would be cool, maybe it will happen one day

> 
> The other thing about git particularly for web projects that store
> multiple revisions of binary data (images etc.) is that the git-clone
> could end up taking up much more space than the SVN equiv. Due to the
> fact that a git clone is essentially a full copy of the whole
> repository, rather than just a "checkout" (SVN checkouts store twice as
> much as the raw data but that's a constant).
> 
> I love both systems but for me, I find that web projects with graphics
> that have high churn are more suited to SVN but pure code projects
> (which can include web projects) where branching is done often then git
> wins hands down for features.

yes, it might be true. for us, we have a very large codebase with
minimal amount of binary data, and several branches, so we definitely go
for git

greets,
Zoltán Németh

> 
> My €0.02 :)
> 
> Col
> 

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



[PHP] Re: Sometimes I wonder why I even started programming...

2008-02-29 Thread Colin Guthrie
Colin Guthrie wrote:
> The other thing about git particularly for web projects that store
> multiple revisions of binary data (images etc.) is that the git-clone
> could end up taking up much more space than the SVN equiv. Due to the
> fact that a git clone is essentially a full copy of the whole
> repository, rather than just a "checkout" (SVN checkouts store twice as
> much as the raw data but that's a constant).

Just to clarify my last point, you *can* compact down a git repo and
reproduce deltas etc. but this doesn't change the fundamental
architectural difference (which to clarify I'm not saying is wrong, just
different to SVN :)).

Col

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



[PHP] simple command help

2008-02-29 Thread Shelley

Hi all,

What's the command to use if I want to remove all the directories and 
files except 'a.gz' under a directory?


Thanks in advance.

Regards,
Shelley

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



RE: [PHP] Get country from Phone number

2008-02-29 Thread Andrés Robinet
> -Original Message-
> From: Dani Castaños [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 29, 2008 5:03 AM
> To: PHP LIST
> Subject: [PHP] Get country from Phone number
> 
> Hi all!
> 
> I'm looking for some piece of code or class which giving a phone number
> it returns me from wich country is this phone.
> Do you know where I can find something like this?
> 
> Thank you in advanced!
> 
> --

Seems like you'll have a hard time if you want to include all the possibilities:
http://www.kropla.com/dialcode.htm
But probably Rob (Cummings) will come up with a "solve-it-all" regex that will
save your day.

Regards,

Rob(inet)


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

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



[PHP] Re: Sometimes I wonder why I even started programming...

2008-02-29 Thread Colin Guthrie
Zoltán Németh wrote:
> I strongly recommend git. it has several great advantages above cvs or
> svn. for example, it does not store whole copies of the whole tree if
> you make a branch, but stores only the differences. it is much faster,
> and losing a commit is really hard even if you screw things up seriously
> (I know I've done that a couple of times when I was new to git, but I
> could manage to restore everything)

Yeah git is definitely good, I don't deny that, but your comment about
storing whole copies when you make a branch does not hold true for SVN,
at least not with that statement... If you make a branch in SVN it is
free. If you make changes on the branch then commit it and subsequently
merge that branch back to the trunk/master/whatever *then* SVN will
store your changes twice, whereas git is cleverererer.

I think both have their advantages. For me, until Git integration into
Trac it's a non-starter as I use Trac heavily to track tickets/bugs,
time and view the repo etc.

The other thing about git particularly for web projects that store
multiple revisions of binary data (images etc.) is that the git-clone
could end up taking up much more space than the SVN equiv. Due to the
fact that a git clone is essentially a full copy of the whole
repository, rather than just a "checkout" (SVN checkouts store twice as
much as the raw data but that's a constant).

I love both systems but for me, I find that web projects with graphics
that have high churn are more suited to SVN but pure code projects
(which can include web projects) where branching is done often then git
wins hands down for features.

My €0.02 :)

Col

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



[PHP] Get country from Phone number

2008-02-29 Thread Dani Castaños

Hi all!

I'm looking for some piece of code or class which giving a phone number 
it returns me from wich country is this phone.

Do you know where I can find something like this?

Thank you in advanced!

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-29 Thread Zoltán Németh
2008. 02. 28, csütörtök keltezéssel 22.42-kor Robert Cummings ezt írta:
> On Thu, 2008-02-28 at 23:52 +, Nathan Rixham wrote:
> > Robert Cummings wrote:
> > > On Thu, 2008-02-28 at 20:43 +, Nathan Rixham wrote:
> > >> [snip]
> > >> Eric Butera wrote:
> > >>> I can hit tab and shift/tab too and it puts in spaces for me.
> > >> [snip]
> > >> Robert Cummings wrote:
> > >>  > Uhhhm, I hit the tab button also and it does the right thing (namely
> > >>  > inserts 4 spaces). Also, when I hit enter it auto tabs.
> > >> [snip]
> > >>
> > >> *kicks zend studio* [and nano and textpad and dreamweaver] :(
> > >>
> > >> what ide's editor's do you two use? zend's use of javaw is killing my 
> > >> win2k3 dev machine anyways.
> > > 
> > > I don't use an IDE. I use JOE. It's a terminal based editor. Works the
> > > same whether I'm local or remote. The nice thing about linux is how easy
> > > it is to make things work the way you want. My browser source viewer
> > > links to a PHP wrapper script that pops up a gnome-terminal with the
> > > specification to load the JOE editor on the page source. My default
> > > editor in linux is JOE. It just works. Plain, simple, 100% keyboard,
> > > keystroke macros, etc, etc. I love it. You probably won't :)
> > 
> > couldn't be further from the truth! sounds perfect - I spend most of my 
> > life in putty anyways, generally using nano to "type".
> 
> I did say probably... you may be the only one ;)
> 
> >   When
> > > working I click an icon on my taskbar, it opens three terminals in my
> > > favourite layout. I usually use one to edit HTML, one to edit whatever
> > > module I'm working on, and another for whatever else needs to be done
> > > (CVS commits, CVS updates, SSH, etc).
> > 
> > see I've only recently started using versioning software all the time, 
> > I'm currenly svn'ing, how does CVS weight up against it?
> 
> I need to look into SVN. I've been meaning to take a look at it for over
> a year now but the motivation isn't terribly strong since CVS does
> everything I need and I have a lot of stuff in CVS. The main problem
> with CVS I see is that it can be pig-assed slow when updating. Also it
> has deficiencies when handling directories. I imagine whenever I get
> around to taking a look at SVN I'll also have a poke at GIT.

I strongly recommend git. it has several great advantages above cvs or
svn. for example, it does not store whole copies of the whole tree if
you make a branch, but stores only the differences. it is much faster,
and losing a commit is really hard even if you screw things up seriously
(I know I've done that a couple of times when I was new to git, but I
could manage to restore everything)

greets,
Zoltán Németh

> 
> > I use a workspace to the right of
> > > my dev workspace in which I load my browser for checking layout and
> > > JavaScript etc. To the left I have a workspace where I keep a tails on
> > > my log files. I rarely tab through more than 3 windows in a workspace
> > > and I rarely use the mouse.
> > > 
> > > Cheers,
> > > Rob.
> > 
> > snap, keyboard for 99% of things, I seem to have my left hand glued 
> > around ctrl/shift/tab/z/x/c/v/q
> >
> > cheers for giving away some of your set up, I'm going to give joe a try!
> 
> No problem.
> 
> Cheers,
> Rob.
> -- 
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'
> 

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-29 Thread Zoltán Németh
2008. 02. 28, csütörtök keltezéssel 20.25-kor Nathan Rixham ezt írta:
> Robert Cummings wrote:
> > On Thu, 2008-02-28 at 19:37 +, Stut wrote:
> >> On 28 Feb 2008, at 19:17, Wolf wrote:
> >>> Jason Pruim wrote:
>  My editor automatically replaces like 4 spaces with a tab... Is  
>  there a reason not to use tabs instead of spaces? :)
> >>> I use spaces since when I indent with 4 spaces it is significantly  
> >>> easier to read the code then with 4 tabs...
> >>>
> >>>4 spaces are before this
> >>>   4 tabs are before this
> >>>
> >>> Pretty easy to follow code that does
> >>> {
> >>> {
> >>>  {
> >>>   {
> >>>   }
> >>>  }
> >>> }
> >>> }
> >>>
> >>> Versus the alternative, especially with the character wrapping in vi  
> >>> and other text editors.
> >>>
> >>> At least, that's IMO
> >>>
> >>> YMMV
> >> Except that if I inherit your code and I find it easier if it's  
> >> indented to 8 spaces you've taken that choice away from me. Tabs are  
> >> configurable on nearly all editors that exist in the world. If yours  
> >> doesn't let you change the tab width, get a new one. But if you don't  
> >> care about people who might end up working on your stuff, keep using  
> >> spaces. Just hope you never change your mind.
> > 
> > It's almost a standard across the industry to use spaces. But hey, if
> > you wanna take away my choice to use spaces whenever I work on your code
> > down the very long line, that's fine. I'm just gonna use my JOE editor
> > to fix them and purify any mixed tab/space indentation. If your editor
> > can't do that then you should get a better editor ;)
> > 
> > Cheers,
> > Rob.
> 
> I use tab's in all my code, and replace them with spaces when 
> posting/mailing for legibility.
> 
> couldn't imagine ever hitting space 4/8/12/16+ times to write a line of 
> code when i can just tab/shit+tab to indent.

I use spaces for indentation but never hit the space bar. my editor
converts my tab hits to the configured number of spaces, that's it.

greets,
Zoltán Németh

> 

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



Re: [PHP] auto-wrap on posts

2008-02-29 Thread Zoltán Németh
2008. 02. 28, csütörtök keltezéssel 10.38-kor Nathan Nobbe ezt írta:
> On Thu, Feb 28, 2008 at 10:35 AM, David Giragosian <[EMAIL PROTECTED]>
> wrote:
> 
> > On 2/28/08, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> > > take a look here on the marc archives.
> > > http://marc.info/?l=php-general&m=120415418217911&w=2
> > >
> > > there are several lines that have 1 word only in them, some of the words
> > > (for reference) are access, good, patterns, nested.
> > > when i wrote the post (looking in my gmail client) these words are not
> > on
> > > their own line..
> > > does the post look as it does on marc in your mail clients or are the
> > words
> > > in sentences where they belong ?
> > >
> > > thanks,
> > >
> > > -nathan
> > >
> >
> > Your emails come through to my gmail account as you first described,
> > Nathan, ie, sometimes with just one word on a line, and just like the
> > marc archives.
> 
> 
> thanks, ill just have to be careful editing from gmail then..
> 
> Ray, if I start a thread, I'm fairly sure the list sends the email back to
> > me.
> 
> 
> i dont get an email back until someone replies.

that must be a gmail thing, I get everything back

greets,
Zoltán Németh

> 
> -nathan


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