Re: [PHP] Programmers and developers needed

2012-09-13 Thread Per Jessen
agbo onyador wrote:

 Hello there! We are looking for programmers and developers to create a
 world wide system. Your comments are welcome.

Who is we ?



-- 
Per Jessen, Zürich (12.2°C)


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



Re: [PHP] Got HTML5 History API + caching LICKED, I think, grin

2012-03-18 Thread Per Jessen
rene7705 wrote:

 In response to critiques about my download size, I've removed scenejs
 and the artwork for my own site-logos from the zip. The size is now
 38mb, down from 54mb.

I think it took about a minute at about 470kb/sec. 

 I'm also using 7-zip now, I hope it opens better on non-windows OSes.

It worked fine with unzip on linux.



-- 
Per Jessen, Zürich (11.9°C)


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



Re: [PHP] Got HTML5 History API + caching LICKED, I think, grin

2012-03-18 Thread Per Jessen
rene7705 wrote:

 On Sun, Mar 18, 2012 at 10:58 AM, Per Jessen p...@computer.org wrote:
 
 rene7705 wrote:

  In response to critiques about my download size, I've removed
  scenejs and the artwork for my own site-logos from the zip. The
  size is now 38mb, down from 54mb.

 I think it took about a minute at about 470kb/sec.

 
 I get much better datarates, around 1.5 to 2mb/s... But then again,
 the server is in europe, and so am I.

I'm in Europe too, but your server is about 20 hops away.  470kb/s is
pretty good on my 6Mbit downstream though. 



-- 
Per Jessen, Zürich (8.2°C)


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



Re: [PHP] utf8_decode() not working, conflicts with urlencode()

2011-08-30 Thread Per Jessen
Merlin Morgenstern wrote:

 Hi there,
 
 I am having some trouble with utf8_decode(). Somehow the function
 returns output=input
 
 e.g.:
 $input = '%20%C3%9Cbersetzung%20franz';
 $output = utf8_decode($input);
 echo $input.'br'.$output;
 
 My goal is to decode the utf8, trim the input and encode with
 urlencode();
 
 This is the string which I would like to get: %C3%9Cbersetzung+franz
 
 Trim does not work and if I place urlencode() directly on the input it
 will encode the % sign to %25 and produce therfore a mixture of
 encodings.

It seems to me that you're probably missing a urldecode() on $input
before you attempt to decode the utf8 chars ?



-- 
Per Jessen, Zürich (17.9°C)


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



Re: [PHP] NOMAIL option for the list?

2011-05-18 Thread Per Jessen
Michelle Konzack wrote:

 Hello Daniel Brown,
 
 Am 2011-05-17 13:15:50, hacktest Du folgendes herunter:
 On Tue, May 17, 2011 at 13:11, Michelle Konzack
 linux4miche...@tamay-dogan.net wrote:
  Is this not longer subscriber only?
 Actually, it never has been.  It's subscription to receive, but
 open to the public for one-off postings.
 
 Hmmm, when I tried to post to the List without subscribtion, any  of 
 my post where rejected and I had to subscribe...
 
 Unfortunately the messages are all coming into my CellPhone and  I 
 have to /dev/null it on my server.
 
 Ist there a way to set my account to NOMAIL option?

Michelle, the list is ezmlm-driven, it should be possible to subscribe
an alias to the list, which means that that address will be allowed to
post, but will not receive any postings. 

Try this address:

php-general-allow-subscribe-youralias=example@lists.php.net



-- 
Per Jessen, Zürich (14.7°C)


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



Re: [PHP] Re: NOMAIL option for the list?

2011-05-18 Thread Per Jessen
Michelle Konzack wrote:

 Hello Daniel Brown,
 
 Am 2011-05-17 15:07:58, hacktest Du folgendes herunter:
 On Tue, May 17, 2011 at 15:00, Michelle Konzack
 linux4miche...@tamay-dogan.net wrote:
  Ist there a way to set my account to NOMAIL option?
 To stop receiving emails you mean?  As in unsubscribing?
 
 I mean, STOP receiving mail without UNSUBSCRIBING.
 
 Which is a standardd function of newer majordomo and mailman.

ezmlm uses the expression 'alias' for this functionality.  See my
posting from yesterday. 


-- 
Per Jessen, Zürich (16.9°C)


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



Re: [PHP] Session question

2011-05-17 Thread Per Jessen
Paul Halliday wrote:

 Is it OK to have session_start as an include?
 

Yes.



-- 
Per Jessen, Zürich (18.1°C)


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



Re: [PHP] Running PHP5 in a PHP4 environment

2011-05-13 Thread Per Jessen
Paul M Foster wrote:

 I recently installed some code written for a PHP 5 environment on a
 server which I thought was running PHP 5. It was a form which should
 have painted at least something to the browser window. But instead, I
 got a complete blank page. Come to find out that the server was
 actually running PHP 4.
 
 I've seen PHP do this before-- trying to run PHP 5 in a PHP 4
 environment causes it to do every step up to the point where it sees
 future code it doesn't understand. Then it just stops, no errors, no
 panics, no nothing.
 
 Is this expected behavior, or am I missing something? It seems like if
 the PHP interpreter hit some future code it didn't understand, it
 would issue a syntax warning or something similar. Is there some way I
 can squeeze some identifiable error code out of PHP 4 to indicate it's
 hit PHP 5 code it doesn't understand?

Check the apache error logs, that is where you will usually find
something.


-- 
Per Jessen, Zürich (14.2°C)


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



Re: [PHP] Javascript detection

2011-04-28 Thread Per Jessen
tedd wrote:

 As Yogi Berra once said; It's always hard to predict things
 especially when it deals with the future.
 

He was quoting Niels Bohr:

http://www.quotationspage.com/quote/26159.html



-- 
Per Jessen, Zürich (10.2°C)


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



Re: [PHP] XML... Useful or another layer of complexity?

2011-04-03 Thread Per Jessen
Jason Pruim wrote:

 So the subject says it all... And yes I know this isn't related to PHP
 but it's the weekend and I trust the opinions on this list more then
 any other list I have seen. I've been doing alot of reading on XML and
 honestly it looks pretty cool... BUT the question is... Is it truly
 useful or is it just another layer that we have to write?

I started looking at XML about 8-9 years ago and at first dismissed it
as just another way to gobble up CPU-cycles.  Later on, I began to
appreciate some of the really cool stuff you can achieve with XSLT, and
today I would not want to be without XML. 


-- 
Per Jessen, Zürich (16.6°C)


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



Re: [PHP] Bilingual strtotime()

2011-02-07 Thread Per Jessen
Alexis wrote:

 So basically, the answer is no :)
 Looks like I'll simply do a replace of the French named months with
 English ones.
 
 Would have thought the length of time that PHP has been around and
 with people around the world, speaking more than just one language,
 that language support would have progressed further than it appears to
 have. Apparently not.

That's not really fair - IMO, developers of multi-lingual applications
usually keep data in a language/locale-neutral format and only
transform to language/locale-specific when the data is being presented. 
strtotime() is an unusual function in that it attempts the reverse -
transform arbitrary text into data. 



-- 
Per Jessen, Zürich (5.2°C)


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



Re: [PHP] Bilingual strtotime()

2011-02-06 Thread Per Jessen
Alexis wrote:

 On 05/02/11 13:23, Per Jessen wrote:
 Alexis wrote:

 Hi,

 Living in Canada, and being a bilingual country, I have data I am
 processing which includes dates in both English and French.

 I was wondering if there was a way to use the strtotime() function
 when the months are in one or the other of the above two languages?

 Sure, strftime() is locale-sensitive. Set the locale().



 
 Thanks
 
 But what if the locale is in two possible languages, all mixed
 together?

You have to decide then:

1) display in language#1
2) display in language#2
3) display in both. 




-- 
Per Jessen, Zürich (4.6°C)


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



Re: [PHP] Bilingual strtotime()

2011-02-06 Thread Per Jessen
Alexis wrote:

 I was wondering if there was a way to use the strtotime() function
 when the months are in one or the other of the above two languages?

Ah, I misread this earlier - strtotime(), not strftime().  You're
talking about transforming from text to a locale()-neutral format.  I
don't think strtotime() is locale-sensitive - according to the manual:

The function [strtotime] expects to be given a string containing an
English date format



-- 
Per Jessen, Zürich (4.6°C)


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



Re: [PHP] Bilingual strtotime()

2011-02-05 Thread Per Jessen
Alexis wrote:

 Hi,
 
 Living in Canada, and being a bilingual country, I have data I am
 processing which includes dates in both English and French.
 
 I was wondering if there was a way to use the strtotime() function
 when the months are in one or the other of the above two languages?

Sure, strftime() is locale-sensitive. Set the locale().



-- 
Per Jessen, Zürich (4.4°C)


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



Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Per Jessen
sono...@fannullone.us wrote:

 I'd like to make a suggestion for a change, or possibly an addition,
 to the PHP language.
 
 I'm learning PHP and have been very excited with what it can do in
 relation to HTML.  But when I got to the part about arrays, I was
 disappointed to see that they are designated with a $ the same as
 other variables.  I was learning Perl before I switched, and it uses
 the @ sign to designate an array.  That makes it a lot simpler to see
 at a glance what is an array and what isn't - at least for beginners
 like me.
 
 Has there been any talk of adopting the @ sign for arrays in PHP?  Or
 is that symbol used for something else that I haven't read about yet?
 
 What is the proper channel for making suggestions like this?

The php-development mailing list.  What you're suggesting is a pretty
fundamental change, don't be disappointed if it is not met with
universal approval.


-- 
Per Jessen, Zürich (5.9°C)


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



Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Per Jessen
Ashley Sheridan wrote:

 On Wed, 2011-01-12 at 12:23 -0800, sono...@fannullone.us wrote:
 
 Thanks for all the responses to my suggestion.  I realize this would
 be a major change, so that's why I also mentioned it as an addition
 to the language.
 
 I'm sure it's just what you're used to, but still being new to all
 this, it just makes sense (to me anyway) to have different symbols
 for different variable types: $scalar @array
 #hash
 
 Since the @ sign is already reserved, maybe there's another symbol
 that would work better?  I don't know.  These are just ideas that I
 came up with while reading and I thought I'd throw it out there to
 see what others thought.
 
 I like the idea of a naming convention, so that's what I'll do in my
 scripts.  I also appreciate the heads up on is_string(), is_array(),
 and var_dump().
 
 Thanks again,
 Marc
 
 
 If you check out the manual pages for those functions as well, you'll
 see other related functions. I must say, of any language I've used,
 the php.net documentation is by far the best, giving plenty of
 information and user comments too. It's a resource I still can't do
 without, and I reckon even the old hands on this list would say the
 same.

Yes, I wouldn't want to be without my local php.net mirror.  Other
languages that can easily match the quality of the documentation -
assembler, C and C++, to name a few. 


-- 
Per Jessen, Zürich (7.9°C)


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



Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Per Jessen
Donovan Brooke wrote:

 however, from my experience, there is often this kind of problem in
 any language, and that is where naming conventions come in very handy.
 
 I don't know if the PHP community has any standard convention.. 

One popular naming convention:

http://en.wikipedia.org/wiki/Hungarian_notation



-- 
Per Jessen, Zürich (7.8°C)


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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-11 Thread Per Jessen
tedd wrote:

 At that time, I registered almost 30 names.
 Fortunately, all of my names passed and I was
 permitted to keep them. Unfortunately, all
 browser manufactures (except Safari) negated some
 of the work done by the IDNS WG and as a result
 PUNYCODE is shown instead of the actual
 characters intended.

Only for characters that are not part of a national alphabet, I believe?

This one works fine:  http://rugbrød.ch/

Besides, many domain registrars also limit the available characters to
those that are part of a national alphabet. 


-- 
Per Jessen, Zürich (0.0°C)


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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-11 Thread Per Jessen
tedd wrote:

 At 11:54 AM +0100 1/11/11, Per Jessen wrote:
tedd wrote:

  At that time, I registered almost 30 names.
  Fortunately, all of my names passed and I was
  permitted to keep them. Unfortunately, all
  browser manufactures (except Safari) negated some
  of the work done by the IDNS WG and as a result
  PUNYCODE is shown instead of the actual
  characters intended.

Only for characters that are not part of a national alphabet, I
believe?

This one works fine:  http://rugbrød.ch/
 
 Not for me. It translates to:
 
 xn--rugbrd-fya.ch

Probably a browser issue.  The above works fine with e.g. FF3.6 amd
Konqueror 3.5.

Besides, many domain registrars also limit the available characters to
those that are part of a national alphabet.


 
 National alphabet? Never heard of it -- what Nation?

Perhaps not the correct expression, but most non-English languages have
their own alphabets, and despite some countries sharing a language,
what they allow for domain name registration isn't always the same
(ref. Michelle Konzacks earlier posting).
For instance, while 'ï' is used in Dutch, English, and French (I
believe), it is not used in Danish, so it is not allowed in Danish
domain names.  

Here is the list of characters accepted by the German registrar: 

http://www.denic.de/de/domains/internationalized-domain-names/idn-liste.html

The Swiss registrar:

https://www.nic.ch/reg/wcmPage.action?res=/reg/guest/faqs/idn.jspplainlid=de

Austrian registrar:

http://www.nic.at/fileadmin/www.nic.at/documents/idn/idn_at_tld_de.txt

Danish registrar:

https://www.dk-hostmaster.dk/selvbetjening/koeb-dk-domaenenavn/tegnsaet-for-domaenenavne/
(quite limited: a-z, 0-9, hyphen, æ, ø, å, ö, ä, ü, é)

 Are the Greek letters Sigma, Delta, Pi part of this National
 alphabet?  

No, only the Greek alphabet which probably is used in Greece and Cyprus
only. 

 In addition, many registrars are clueless about IDNS, Char Sets, and
 what is legal and not. 

Not in my experience.  The various national/European registrars usually
have very strict regulations, and any domain registrar offering his or
her services to the public had better understand them. 


-- 
Per Jessen, Zürich (0.0°C)


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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-11 Thread Per Jessen
Michelle Konzack wrote:

 Hello Ashley Sheridan,
 
 Am 2011-01-08 17:09:27, hacktest Du folgendes herunter:
 Also, each label is checked to ensure it doesn't run over 63
 characters, and the whole thing isn't over 253 characters. Lastly,
 each label is checked to ensure it doesn't completely consist of
 digits.
 
 Do you know, that there are MANY domains with numbers only?
 

Here is a list of 197 such Swiss domains:

http://public.jessen.ch/files/ch-domains-only-numeric.txt



-- 
Per Jessen, Zürich (0.0°C)


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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-09 Thread Per Jessen
Tamara Temple wrote:

 On Jan 8, 2011, at 2:22 PM, Al wrote:
 


 On 1/8/2011 3:55 AM, WalkinRaven wrote:
 PHP 5.3 PCRE

 Regular Express to match domain names format according to RFC 1034
 - DOMAIN
 NAMES - CONCEPTS AND FACILITIES

 /^
 (
 [a-z] |
 [a-z] (?:[a-z]|[0-9]) |
 [a-z] (?:[a-z]|[0-9]|\-){1,61} (?:[a-z]|[0-9]) ) # One label

 (?:\.(?1))*+ # More labels
 \.? # Root domain name
 $/iDx

 This rule matches only label and label. but not
 label.label...

 I don't know what wrong with it.

 Thank you.



 Look at filter_var()

 Validates value as URL (according to »
 http://www.faqs.org/rfcs/rfc2396) ,

 
 
 I'm wondering what mods to make for this now that unicode chars are
 allowed in domain names

You're talking about IDNs ?  The actual domain name is still US-ASCII,
only when you decode punycode do you get UTF8 characters.


-- 
Per Jessen, Zürich (10.1°C)


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



Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Per Jessen
a...@ashleysheridan.co.uk wrote:

 Sorry for top-post, on phone.
 
 What about mobile phone numbers (cell phones you call them in the US)
 do they conform to the same format? 

AFAIK, they too vary from country to country.  Swiss mobile numbers are
07[6789] NNN, the latter usually written as NNN NN NN, but also
often in a way that will help remembering the number.  
Danish mobile#s are the same as land line numbers, no area code, just
. 



-- 
Per Jessen, Zürich (2.8°C)


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



Re: [PHP] Re: Regex for telephone numbers

2010-12-31 Thread Per Jessen
Al wrote:

 
 
 On 12/29/2010 7:12 PM, Ethan Rosenberg wrote:
 Dear List -

 Thank you for all your help in the past.

 Here is another one

 I would like to have a regex which would validate that a telephone
 number is in the format xxx-xxx-.

 Thanks.

 Ethan

 MySQL 5.1 PHP 5 Linux [Debian (sid)]

 
 Regex is over-kill.

You've just used one any way:

 $phoneNum = preg_replace(%\D%, '', $phoneNum);//Remove everything except 
 digits 
 
 $phoneNum = ltrim($phoneNum,'1');//Remove leading 1s
 
 if(strlen($phoneValue) != 10)
  {
 throw new Exception(Phone number must be 10 digits, without leading a
 1. Check your entry carefull);
  }

One regex and two function calls when one regex would have sufficed?


-- 
Per Jessen, Zürich (2.6°C)


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



Re: [PHP] Centralizled Authentication

2010-12-02 Thread Per Jessen
AmirBehzad Eslami wrote:

 Dear list,
 
 We have dozen of applications, mostly written in PHP and Python.
 They're distributed on different servers, but i'm trying to integrate
 them somehow.
 
 Each application has its own users.
 Is there a way to store all username/passwords into a single
 datasource and give each user, her proper permissions?
 
 Since i'm just a php-programmer, i *thought* of a MySQL database to
 hold these data, and then use a SOAP-Server to handle the
 authentication across those applications.
 
 Once a user provides her username/password, a SOAP Request will be
 made to a PHP-Driven Authentication Server, which handles the job to
 check the permissions and user's identity.
 
 It sounds slow, isn't it? Is there a better solution?
 How do you make authentication across a network of applications?

Central directory service accessed with LDAP.  Typical examples include
Microsofts Active Directory, Novells eDirectory and openLDAP. 



-- 
Per Jessen, Zürich (-1.4°C)


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



Re: [PHP] Centralizled Authentication

2010-12-02 Thread Per Jessen
AmirBehzad Eslami wrote:

 Suppose you're running phpBB with another php-driven application.
 phpBB has a user table where the username/password/email/.. of each
 user is stored at mysql. Once a user logs-in to the website, the Last
 Login timestamp updates on the users table at mysql.
 
 How do I use LDAP in this type of application?
 
 1) Move entire records of Users and their attributes (e.g.
 last_login_time) to LDAP server?
 In this mehtod, after each successfull login request, I also need to
 update the related record on LDAP.
 2)  Should I use LDAP to store only the username and passwords?
 In this method, I need to update the record on MySQL database, but I
 should keep the MySQL and LDAP syncronized, since a user may want to
 change her password. 

LDAP is only the access method, you can store the information whichever
way you want.  mysql is probably not a bad idea.



-- 
Per Jessen, Zürich (-0.9°C)


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



Re: [PHP] Disk IO performance

2010-11-28 Thread Per Jessen
Larry Garfield wrote:

 There are many things that everybody knows about optimizing PHP
 code.  One of them is that one of the most expensive parts of the
 process is loading code off of disk and compiling it, which is why
 opcode caches are such a bit performance boost.  The corollary to
 that, of course, is that more files = more IO and therefore more of a
 performance hit. 
[snip]
 So... does anyone have any actual, hard data here?  I don't mean I
 think or in my experience.  I am looking for hard benchmarks,
 profiling, or writeups of how OS (Linux specifically if it matters)
 file caching works in 2010, not in 1998.

The principle hasn't changed since the 50s - read the file into memory,
and keep it there (and keep reading it from there) as long as it isn't
written to.  The implementation has changed many times over, but it's
not something we as regular application programmers ought to be much
converned with.  Leave it to the smart operating system.



-- 
Per Jessen, Zürich (1.6°C)


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



Re: [PHP] Re: Check for existence of mail address

2010-10-26 Thread Per Jessen
Gary wrote:

 Jonathan Tapicer wrote:
 You can use this class:

http://www.webdigi.co.uk/blog/wp-content/uploads/2009/01/smtpvalidateclassphp.txt

 It may not work for some SMTPs.

 It uses the concepts explained here:

http://www.webdigi.co.uk/blog/2009/how-to-check-if-an-email-address-exists-without-sending-an-email/
 
 Please stop top-posting.
 
 The above idea is sound - it will work - but uses *others'* systems to
 solve *your* problem, which is rude IMO.  

There is no other way.   The SMTP protocol provides VRFY for exactly
this purpose, but it is disabled on most servers. 
The closest approximation of email address exists is MX will accept
mail for it. 



-- 
Per Jessen, Zürich (5.4°C)


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



Re: [PHP] Reminder On Mailing List Rules

2010-10-21 Thread Per Jessen
sueandant wrote:

 Hi
 
 I'm not familiatr with the term top-post; could you please explain?

http://lmgtfy.com/?q=top-post



-- 
Per Jessen, Zürich (3.7°C)


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



Re: [PHP] PHP and HBCI?

2010-10-08 Thread Per Jessen
Stephan Ebelt wrote:

 
 common is probably XML via HTTPS transport (at least my bank seems to
 do it that way). I have no C code whatsoever.
 
 Can PHP call arbitrary C functions? Then it might be possible to use
 AqHBCI/AqBanking somehow?

You (or someone) would need to write a PHP wrapper for the C functions,
but otherwise yes.



-- 
Per Jessen, Zürich (17.9°C)


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



Re: [PHP] What other languages do you use?

2010-10-08 Thread Per Jessen
Nathan Rixham wrote:

 As per the subject, not what other languages have you used, but what
 other languages do you currently use?

French, German, English and Danish.  



-- 
Per Jessen, Zürich (14.9°C)


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



Re: [PHP] What other languages do you use?

2010-10-08 Thread Per Jessen
Per Jessen wrote:

 Nathan Rixham wrote:
 
 As per the subject, not what other languages have you used, but what
 other languages do you currently use?
 
 French, German, English and Danish.
 

Wrt programming languages (and variations thereof), in order of usage, I
use C, PHP, C++, assembler, shell-script, XSLT with some occasional
HTML and Javascript thrown in for good measure :-).

 

-- 
Per Jessen, Zürich (15.1°C)


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



Re: [PHP] What other languages do you use?

2010-10-08 Thread Per Jessen
Nathan Rixham wrote:

 Per Jessen wrote:
 Nathan Rixham wrote:
 
 As per the subject, not what other languages have you used, but what
 other languages do you currently use?
 
 French, German, English and Danish.
 
 
 Forhåbentlig ikke alle zur en même temps
 

Ork jo, das ist doch ikke ein Problem. 



-- 
Per Jessen, Zürich (12.9°C)


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



Re: [PHP] What other languages do you use?

2010-10-08 Thread Per Jessen
Per Jessen wrote:

 Nathan Rixham wrote:
 
 Per Jessen wrote:
 Nathan Rixham wrote:
 
 As per the subject, not what other languages have you used, but
 what other languages do you currently use?
 
 French, German, English and Danish.
 
 
 Forhåbentlig ikke alle zur en même temps
 
 
 Ork jo, das ist doch ikke ein Problem.
 

Blimey, how did I manage to leave out two  obviously il-y-a une
probleme, after all. 



-- 
Per Jessen, Zürich (12.9°C)


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



Re: [PHP] Re: daemon

2010-10-07 Thread Per Jessen
Colin Guthrie wrote:

 Yeah that's what I do too. Of course systemd will change everything
 initscript related, but I don't expect it to hit production servers
 for a while.

Could easily be years - the init-sequence is only interesting at
boot-time, and server runs for years (wel, mine certainly do).


/Per

-- 
Per Jessen, Zürich (12.9°C)


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



Re: [PHP] PHPExcel with large files (27,000+ rows)

2010-10-04 Thread Per Jessen
chris h wrote:

 I'm currently working on a project that requires the parsing of excel
 files.  Basically the user uploads an excel file, and then a script
 needs to save a row in a Postgres database for each row in the excel
 file.  The issue we are having is that when we task PHPExcel with
 parsing an excel file with, say 27k rows, it explodes with a memory
 error.  I've read up on the  PHPExcel forums and we've tried cell
 caching as well as ReadDataOnly, they do not seem to be sufficient.
 
 Does anyone here know of a way to do this? Surely there is a way to
 parse a large excel file with PHP.  

If your excel file is or can be transformed to XML, I would just use
XSLT.  No PHP needed. 



-- 
Per Jessen, Zürich (19.1°C)


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



Re: [PHP] Re: Friday's Post

2010-10-02 Thread Per Jessen
Peter Lind wrote:

 On 1 October 2010 20:21, Per Jessen p...@computer.org wrote:
 Peter Lind wrote:

 C# has by now exceeded Java by quite a bit -

 I've been away from the Java scene since 2002 (when I worked for
 BEA deploying J2EE on Linux/390), but assuming you're talking
 about deployed lines of code or some other real-life measurement, I
 find it hard to believe that C# should have exceeded Java.
 
 Language functionality. I'd much rather use C# than Java as I can do
 more in C# and easier than with Java. For instance, C# 4 has  support
 for late binding to dynamic types. Does Java have an equivalent? Is
 it planned?

I don't know, but Java obviously supports late binding. 



-- 
Per Jessen, Zürich (14.1°C)


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



Re: [PHP] Re: Friday's Post

2010-10-01 Thread Per Jessen
Peter Lind wrote:

 C# has by now exceeded Java by quite a bit - 

I've been away from the Java scene since 2002 (when I worked for BEA
deploying J2EE on Linux/390), but assuming you're talking
about deployed lines of code or some other real-life measurement, I
find it hard to believe that C# should have exceeded Java. 

 and is, unlike Java, very actively maintained and has fairly frequent
 releases with lots of new functionality (4.0 was released this year
 and has functionality that definitely makes me consider taking it on).

Almost every newer programming language in the world has gone further
than Fortran, C, Cobol and PL/I, but they're all very much alive and
kicking.  And will each individually probably be able to muster
more deployed lines of code than any other language. 



-- 
Per Jessen, Zürich (12.1°C)


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



Re: [PHP] PHP DNS resolving in chroot-ed environment

2010-09-27 Thread Per Jessen
Georgi Hristozov wrote:

 Hello,
 
 I'm running a Gentoo-hardened box with PHP 5.2.14-pl0-gentoo (Suhosin
 included) and Apache 2.2.16. mod_php is running in a chroot, using
 mpm_peruser. Everything works OK, except the PHP DNS resolving, which
 I need to access HTTP resources. It fails with both the curl and http
 extensions.
 
 With some stracing of the Apache child processes I found that PHP is
 trying to access the following files: hosts, nsswitch.conf,
 resolv.conf and the libnss libraries. 

Just being pedantic: not actually PHP, but the resolver. 

 I've copied them to the chroot, but the resolving still fails. strace
 showed failed accesses to /dev/urandom and /dev/log, but mounting /dev
 in the chroot didn't help.

What does your strace show when you have mounted /dev in your chroot
(with -o bind) ?



-- 
Per Jessen, Zürich (10.1°C)


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



Re: [PHP] php cli question

2010-09-14 Thread Per Jessen
J Ravi Menon wrote:

 Few questions:
 
 1) Does opcode cache really matter in such cli-based daemons? As
 'SomeClass' is instantiated at every loop, I am assuming it is only
 compiled once as it has already been 'seen'.

Yup.

 2) What about garbage collection? In a standard apache-mod-php setup,
 we rely on the end of a request-cycle to free up resources - close
 file descriptiors, free up memory etc..
 I am assuming in the aforesaid standalone daemon case, we would
 have to do this manually?  

Yes.

 Note: I have written pre-forker deamons in php directly and
 successfully deployed them in the past, but never looked at in depth
 to understand all the nuances. Anecdotally, I have
 done 'unset()' at some critical places were large arrays were used,
 and I think it helped. AFAIK, unlike Java, there is no 'garbage
 collector' thread that does all the magic?

Correct.



-- 
Per Jessen, Zürich (12.9°C)


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



Re: [PHP] php cli question

2010-09-14 Thread Per Jessen
J Ravi Menon wrote:

 On Tue, Sep 14, 2010 at 12:43 AM, Per Jessen p...@computer.org wrote:
 J Ravi Menon wrote:

 Few questions:

 1) Does opcode cache really matter in such cli-based daemons? As
 'SomeClass' is instantiated at every loop, I am assuming it is only
 compiled once as it has already been 'seen'.

 Yup.
 
 Just to clarify, you mean we don't need the op-code cache here right?

That is correct.

 2) What about garbage collection? In a standard apache-mod-php
 setup, we rely on the end of a request-cycle to free up resources -
 close file descriptiors, free up memory etc..
 I am assuming in the aforesaid standalone daemon case, we would
 have to do this manually?

 Yes.
 
 So 'unset($some_big_array)'  or 'unset($some_big_object)' etc.. is the
 right way to go for non-resource based items? i.e. it needs to be
 explicitly done?

It's not quite like C - if you reassign something, the previous contents
are automagically freed.  I use unset() if I know it could be a while
(hours) before it'll likely be reassigned, but it won't be used in the
meantime. 



-- 
Per Jessen, Zürich (14.6°C)


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



Re: [PHP] 1984 (Big Brother)

2010-09-12 Thread Per Jessen
tedd wrote:

 Hi gang:
 
 I have a client who wants his employees' access to their online
 business database restricted to only times when he is logged on.
 (Don't ask why)
 
 In other words, when the boss is not logged on, then his employees
 cannot access the business database in any fashion whatsoever
 including checking to see if the boss is logged on, or not. No access
 whatsoever!
 
 Normally, I would just set up a field in the database and have that
 set to yes or no as to if the employees could access the
 database, or not. But in this case, the boss does not want even that
 type of access to the database permitted. Repeat -- No access
 whatsoever!
 
 I was thinking of the boss' script writing to a file that
 accomplished the yes or no thing, but if the boss did not log off
 properly then the file would remain in the yes state allowing
 employees undesired access. That would not be acceptable.
 
 So, what methods would you suggest?

I would ask the boss to confirm his presence maybe once an hour and only
allow employees access when the last such confirmation is less than an
hour old. 



-- 
Per Jessen, Zürich (21.4°C)


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



Re: [PHP] Standalone WebServer for PHP

2010-09-11 Thread Per Jessen
Steve Staples wrote:

 Ok, here it goes...
 
 I am building an app, that requires a web interface.  I am using PHP
 becuase I am familiar with it.   Most of the app's i've been looking
 at, use Python, Cherry.py and stuff, but what I was wondering, is is
 there a way to create a php CLI app, that creates it's own web
 server even if apache is installed.

Yep, that's no big deal.  A webserver is just some code that listens for
requests on port XX, processes the requests and sends back suitably
formatted responses. 



-- 
Per Jessen, Zürich (12.2°C)


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



Re: [PHP] SSI not working on PHP files with Apache

2010-09-02 Thread Per Jessen
Michael Alaimo wrote:

 Does special configuration have to take place with PHP to let apache
 process server side include files that are HTML documents?
 

PHP doesn't care, but you will need to configure apache to do both SSI
and PHP processing. 



-- 
Per Jessen, Zürich (17.8°C)


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



Re: [PHP] Secure Communication?

2010-08-30 Thread Per Jessen
tedd wrote:

 And then there is the security involved in what happens *if* your
 server is hacked and all your private data is seen by a third
 party. What does all that entail  -- and -- how you might be able
 protect yourself should be paramount in every developer's mind.

IMHO, not in a normal context. A developer needs to be able to trust
that the server is as secure as the organisation expects. 

 In addition, access to the database can happen if the user-name and
 password are kept in a file, or code, that is exposed to the hacker
 after hacking. Everything is exposed.

If somebody gains unauthorized access to your system, assume the worst.

 Now, how likely is it that a server might be hacked -- again, I don't
 know. 

If it's not secured, 100%. 

 So, if you want to secure your data on a server, it means that you
 should take steps to do that and not rely upon the host to do that
 for you. Like I said, it would be nice to have a server guru wade in 
 on this to clarify things.

There isn't really a lot to clarify.  To reduce the risk of a server
being compromised:

impose physical access controls. 
limit the open services, and run a firewall. 
make sure your open services are secure (latest patches etc). 

To reduce the impact should it get compromised anyway:

run your server in a DMZ.
run SElinux or AppArmor for access control. 
do not store important passwords on the server.


If all of that isn't really within your reach because you don't have
your own server - get your own server and secure it.  A leased server
is available for e.g. EUR50/month and that money is better spent than
you spending hour after hour trying to secure your application to run
on an insecure server. 


-- 
Per Jessen, Zürich (10.4°C)


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



Re: [PHP] Questions about $_SERVER

2010-08-29 Thread Per Jessen
Jason Pruim wrote:

 My understanding of how shared hosting works would make this near
 impossible... Basically Apache grabs a header that is sent at the
 initial connection which includes the destination hostname and from
 there it translates it to the proper directory on the shared host.

 All the IP's though are based off of the parent site's server...
 
 Now with dedicated hosting where you have the entire machine you can
 do what you are looking at because the IP address will always
 translate back to your website.

AFAICT, Tedd was not asking about the server, he's asking about the
client. 


-- 
Per Jessen, Zürich (17.2°C)


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



Re: [PHP] Secure Communication?

2010-08-29 Thread Per Jessen
tedd wrote:

 Hi gangl:
 
 I realize that the problem stated herein has been solved by others,
 so I'm not claiming I've done anything new -- it's only new to me. It
 was a learning experience for *me* and my solution may help others.
 
 In any event, I've finished creating a method for establishing what I
 think is secure communication between two servers. 

First thought - you're reinventing the wheel.  When I connect to a
server via https, I have secure communication. 



-- 
Per Jessen, Zürich (16.5°C)


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



Re: [PHP] Secure Communication?

2010-08-29 Thread Per Jessen
Jim Lucas wrote:

 Per Jessen wrote:
 tedd wrote:
 
 Hi gangl:

 I realize that the problem stated herein has been solved by others,
 so I'm not claiming I've done anything new -- it's only new to me.
 It was a learning experience for *me* and my solution may help
 others.

 In any event, I've finished creating a method for establishing what
 I think is secure communication between two servers.
 
 First thought - you're reinventing the wheel.  When I connect to a
 server via https, I have secure communication.
 
 
 First, it isn't the connection that he is trying to secure.  He admits
 to using HTTPS in his connections already. 

I didn't bother reading far enough I guess.

 What I think he is trying to prevent (correct me if I'm wrong) is
 access to the data on the opposite server.  He wants to make sure that
 the access to this data is only able to be done by the remote server. 

If that is the objective, it's perhaps best solved by using TLS with a
client certificate/key.  Well, that's what I would do. 


-- 
Per Jessen, Zürich (15.6°C)


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



Re: [PHP] Secure Communication?

2010-08-29 Thread Per Jessen
tedd wrote:

 Like in this example, I use HTTPS in all the steps yet one responder
 said use HTTPS. That means: 1) He didn't understand what I was
 saying; 2) He didn't read what I wrote, which probably the reason for
 #1.

You said secure communication, which (in this context) is quite
clearly HTTP + TLS. I didn't bother reading the rest because I had
already had trouble understanding your previous questions.

 Also, as per another responders statement, using a SSL does not
 necessarily mean that the server is more secure. 

Yes, it has no bearing on the security of the server, but using TLS
means the communication is.  If you then also use client-side
certificates, you're really quite safe.


-- 
Per Jessen, Zürich (15.4°C)


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



Re: [PHP] Questions about $_SERVER

2010-08-28 Thread Per Jessen
tedd wrote:

 Hi gang:
 
 The server global:
 
 $_SERVER['SERVER_ADDR']
 
 Provides the IP of the server where the current script is executing.
 
 And, the server global:
 
 $_SERVER['REMOTE_ADDR']
 
 Provides the IP of the server executing the script.

Yes, aka the client address. 

 As such, you can enter the IP of either into a browser and see that
 specific domain.

Huh?  If my server is 192.168.29.104 and my client is 192.168.29.114, I
might get the default website on the server address, and nothing on the
client (assuming it is not running a webserver).

 However, that doesn't work when you are dealing with shared hosting.
 Doing that will show you to the parent domain, but not the child
 domain (i.e., alias).
 
 So, how can I identify the exact location of the 'server_addr' and of
 the 'remote_addr' on shared hosting? Is that possible?

$_SERVER['SERVER_NAME'] will tell you the name of the virtual host - I
don't know if that is what you're after.



-- 
Per Jessen, Zürich (12.2°C)


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



Re: [PHP] Re: Web application architecture (subdomain vs. sub directory)

2010-08-27 Thread Per Jessen
Tim Martens wrote:

 Based on advice here and elsewhere, I think we're tending toward a an
 no framework MVC approach and sub-directory model to get started. As
 Per so elegantly stated The subdirectory approach is easily rewritten
 to an internal subdomain
 structure. So if we need to pivot to a subdomain model we can do so.

Just to clarify - I meant rewritten as in Apache URL rewriting. 



-- 
Per Jessen, Zürich (20.4°C)


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



Re: [PHP] Web application architecture (subdomain vs. sub directory)

2010-08-26 Thread Per Jessen
Tim Martens wrote:

 Thanks for all your answers. To clarify my question, I'm looking for
 advice regarding how best to set up users for a web app, e.g.,
 username.myapp.com vs myapp.com/username and the pros and cons of
each.

Using username.myapp.com means defining that name in your DNS and having
a separate virtual host definition in your apache config. 

Using myapp.com/username means having one virtual host, and no extra DNS
records. 

One is not necessarily better or worse than the other - to me it's
mostly about presentation and I would go for the myapp.com/username
option.  This (in my mind) puts username a level lower than myapp,
whereas username.myapp.com does the opposite. 


-- 
Per Jessen, Zürich (17.7°C)


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



Re: [PHP] Web application architecture (subdomain vs. sub directory)

2010-08-26 Thread Per Jessen
Shreyas Agasthya wrote:

 I am not sure who the end-users are for your website but if you are
 concerned about scalability, I would definitely go for a sub-domain
 approach. Assuming you approach a CDN like Akamai and you want to
 offload the traffic to come from the cloud, it's lot easier for you to
 integrate with them and to maintain.
 
 The subdirectory approach, whereas, is very cumbersome and  takes more
 work at your end to paraphrase the whole set-up should the needs
 change going forward.

The subdirectory approach is easily rewritten to an internal subdomain
structure. 



-- 
Per Jessen, Zürich (17.7°C)


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



Re: [PHP] Web application architecture (subdomain vs. sub directory)

2010-08-26 Thread Per Jessen
Peter Lind wrote:

 On 26 August 2010 08:08, Per Jessen p...@computer.org wrote:
 Tim Martens wrote:

 Thanks for all your answers. To clarify my question, I'm looking for
 advice regarding how best to set up users for a web app, e.g.,
 username.myapp.com vs myapp.com/username and the pros and cons of
 each.

 Using username.myapp.com means defining that name in your DNS and
 having a separate virtual host definition in your apache config.

 
 While offtopic and nothing to do with PHP I think this should be
 corrected: you can set a *.yourdomain rule which matches all
 subdomains not explicitly set. So no, you do not need to define every
 single name as a DNS record.

Good point. Not sure I would personally want to use wildcards, but it's
perfectly valid. 



-- 
Per Jessen, Zürich (17.7°C)


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



Re: [PHP] How verify whether browser arrived via IPv6, IPv4, domain or number

2010-08-18 Thread Per Jessen
Leith Bade wrote:

 I want to take $_SERVER['SERVER_NAME'] and figure out whether the user
 arrived by typing an IPv6-only, IPv4-only or dual IPv4/IPv6 DNS
 address.
 
 It should also handle the case where the user enters a numeric address
 in one of the formats the sockets inet_addr() function can handle.
 Such as IPv4/IPv6 dotted decimal, octal, hex, DWORD, etc.
 
 So far I have thought up this:
 
1. Use gethostbyname($_SERVER['SERVER_NAME']) to get an address
2. Check this address to see if it is IPv4/IPv6
 
 Will this always work?

gethostbyname() does not return any IPv6 addresses.  You need
getaddrinfo(), but that is AFAIK not yet implemented for php.

 Also what is the best way in php to check if an address is IPv4 or
 IPv6?

preg_match() ?



-- 
Per Jessen, Zürich (16.2°C)


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



Re: [PHP] the state of the PHP community

2010-07-30 Thread Per Jessen
Nathan Rixham wrote:

 What other languages and web techs do you currently use other than
 PHP? - if you include html or css please include version, if js then
 preferred libs, and whether client or server side.

C, C++, assembler, xhtml, css2, xslt1, javascript(client), shell-script.

 What's your previous language/tech trail?

REXX, PL/I, Smalltalk.

 Are you considering any new languages or techs, and if so which?

Not really. 

 Is PHP your hobby/interest, primary development language, just
 learning or?

It's just one of many things I need to run my business.

 How many years have you been using PHP regularly?

7-8.

 How many years have you been working with web technologies?

7-8.

 Did you come from a non-web programming background?

Yes.

 Is your primary role web developer or designer?

Nope.

 In your developer life, are you an employer, and employee, contractor,
 freelancer, part of a team of equal standing members?

An employer.

 Do you tend to work on jobs for geo-local clients, clients in the same
 country, or do you work internationally 'on the web'?

I only work for me.

 How do you get your projects? do they come to you, word of mouth, do
 you hunt and bid for projects, code call, visit clients, target
 clients individually you think you can help, or?

See above.

 Do you network with other PHP'ers in real life - meetups etc, do you
 tend to shy away, or do you find you circulate in other web related
 but non PHP focussed communities?

No and no. 

 Are you a member or any other web tech communities, opensource
 efforts, or standardization bodies - again, if so which?

ACM, IEEE, openSUSE.



-- 
Per Jessen, Zürich (16.4°C)


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



RE: [PHP] the state of the PHP community

2010-07-30 Thread Per Jessen
Bob McConnell wrote:

 In chronological order -
 
 Languages: [snip]  C++ (Still don't
 understand the purpose of objects or classes).

Two words - encapsulation and abstraction.


-- 
Per Jessen, Zürich (17.1°C)


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



Re: [PHP] the state of the PHP community

2010-07-30 Thread Per Jessen
Nathan Rixham wrote:

 (shared) hosts and in developer+projects - but I also worry that it
 doesn't change with the times quick enough, + the core doesn't have
 the same hacker + iterative development focus anymore, contrast other
 languages which get major functionality added at minor revisions, and
 minor revisions every few days/weeks and there certainly is something
 to worry about.
 
 This said, perhaps the worry is primarily on a personal basis with
 developers loosing time invested in PHP were they to move off to other
 languages.
 
 Real worries in the PHP core for me, are the huge ignorance and lack
 of native support for HTTP (which is somewhat ironic), lack of support
 for NoSQL + RDF tooling, and also support + implementations of the new
 sets of webapps APIs.

None of that is very 'core' to me - it's the stuff for libraries.  When
there's a sufficient need, it'll appear.

 Overall, the general sentiment of 'if it can be done in userland, let
 it be done there' isn't always the best approach (although I
 understand the arguments to the contrary) - ultimately though, PHP
 does feel 'stale' comparatively.

If you look at PHP as a language with a set of libraries, the language
itself is as 'stale' as maybe C or Java or assembler - the language
shouldn't change all that often, nor should the core libraries, but
everything else is free to do whatever. 


-- 
Per Jessen, Zürich (17.0°C)


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



RE: RE: [PHP] the state of the PHP community

2010-07-30 Thread Per Jessen
Bob McConnell wrote:

 From: Per Jessen
 
 Bob McConnell wrote:
 
 In chronological order -
 
 Languages: [snip]  C++ (Still don't
 understand the purpose of objects or classes).
 
 Two words - encapsulation and abstraction.
 
 Both of which are euphemisms that simply mean obfuscation. 

Certainly not.  All structured languages have abstraction and
encapsulation.  The minute you write a function or procedure, you are
abstracting and encapsulating.  C++ (Smalltalk, Eiffel et al) are just
very focused on those to concepts. 

 I learned very early in my professional career to eschew obfuscation,
 so they don't impress me at all. In addition, I really don't do
 abstraction well. I have trouble when I have to deal with more than
 two levels of indirection. Having written and debugged a _lot_ of
 real-time applications and device drivers, in both assembler and C, I
 am much more comfortable with the concrete, like managing I/O
 registers, interrupt controllers and circular buffers. 

I used to write system software for StorageTek (HSC, VTCS,
Librarystation), been there, done that.  It doesn't mean I can't
appreciate the qualities in encapsulation and abstraction. 



-- 
Per Jessen, Zürich (20.6°C)


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



Re: [PHP] socket multithreading problem

2010-07-29 Thread Per Jessen
Ümit CAN wrote:

 I use PHP socket programming  and I wish  multithreading operation of
 the socket .

Don't use PHP, use C - it'll save you a lot of trouble in this context.



-- 
Per Jessen, Zürich (15.4°C)


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



Re: [PHP] exec output to mySQL, How?

2010-07-21 Thread Per Jessen
Tom Sparks wrote:

 How do I take the output from a command line program and update a
 MYSQL database with it?

command line program | mysql -u user -p -Ddatabase



-- 
Per Jessen, Zürich (22.6°C)


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



Re: [PHP] exec output to mySQL, How?

2010-07-21 Thread Per Jessen
Nilesh Govindarajan wrote:

 On Wed, Jul 21, 2010 at 12:29 PM, Per Jessen p...@computer.org wrote:
 Tom Sparks wrote:

 How do I take the output from a command line program and update a
 MYSQL database with it?

 command line program | mysql -u user -p -Ddatabase

 
 I don't think this is what he needs? Otherwise why would he post on a
 PHP list lol.

Who knows, but I answered his question.  Besides, he doesn't need PHP to
do mysql updates with output from a command line program. 



-- 
Per Jessen, Zürich (23.3°C)


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



Re: [PHP] Image Replication

2010-07-20 Thread Per Jessen
Dan Joseph wrote:

 Hi,
 
 I'm wondering how you all are doing image replication between servers.
  I've got some things in mind, but I'd like to see how others have
 done it.
 
 We have a PHP application that accepts an image upload, then we want
 it to show up on the other 2 web servers.  We have 3 in a load
 balanced cluster. Linux servers.
 
 How did you go about it?

rsync triggered by inotify.


-- 
Per Jessen, Zürich (27.8°C)


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



Re: [PHP] php -l - does it find *anything*?

2010-07-06 Thread Per Jessen
Gary . wrote:

 Yeah. There are static checkers out there, even some FOSS ones. I
 guess I'm just a bit frustrated that (as you say) the man page says
 that -l checks syntax but doesn't really detail what kind of things
 that covers. 

It really is _only_ the syntax. Same goes for e.g. the C lint - 

int main()
{
   char *p;

   p=0;
   *p=0;
}

this is 100% syntactically correct, but will core dump if you run it. 


-- 
Per Jessen, Zürich (24.2°C)


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



Re: [PHP] HTML in emails

2010-07-06 Thread Per Jessen
Paul M Foster wrote:

 Here is the real problem with HTML email. Any straight text message
 will swell to many times its size when you HTML-ize it. Okay, so now
 you're sending the message around the internet to perhaps hundreds or
 thousands of users, using up many times the bandwidth that the actual
 message really needs. It's like installing a 100w light bulb when a
 60w will do. There's simply no reason to suck CPU cycles all over the
 internet just to make your message prettier.

In principle, I agree - in practice, CPU cycles are getting cheaper by
the minute, and being wasted all the time. Not using HTML is highly
unlikely to have a measurable impact on anybodys CPU cycles. 

Besides, HTML is not just about making the message prettier.  A number
of times I have experienced that important system notifications (from
our systems to customers') were simply ignored, apparently due to being
plain text.  We decided to jazz them up a bit, and it worked. 



-- 
Per Jessen, Zürich (25.6°C)


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



Re: [PHP] HTML in emails

2010-07-04 Thread Per Jessen
Al wrote:

 I know this is a bit off-topic; but close enough.
 
 I'm starting to update the email feature of one of my DB applications
 and noticed that it appears most of the fancy emails I receive are
 using just plain old, simple html pages, with a note about not being
 able to see, go here with a link.
 
 It use to be that we specified content-type text/html, etc. and sent
 both the plain ASCII and the html with boundaries and so forth.

Yes, multipart/alternative that was. 

 Seems like, from my preliminary Google searching, I should not waste
 time with the standard's way and just go straight to sending simple
 html pages since all modern browsers handle it well. 
 And, it appears to be the way web is going.
 
 What are you folks doing?

We follow the standard and send both text and html. 



-- 
Per Jessen, Zürich (24.5°C)


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



Re: [PHP] HTML in emails

2010-07-04 Thread Per Jessen
Rick Pasotto wrote:

 On Sun, Jul 04, 2010 at 06:31:38PM +0200, Per Jessen wrote:
 
 We follow the standard and send both text and html.
 
 The text portion is the *only* portion I read.
 

Cool, that is the whole point. 


-- 
Per Jessen, Zürich (24.3°C)


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



Re: [PHP] protecting email addresses on a web site

2010-06-15 Thread Per Jessen
David Mehler wrote:

 Hello,
 I've got a site that is needing to have two email addresses on it, one
 for general contact and information and the other for webmaster for
 site problems. I do not want these addresses to become harvested by
 spammers yet i want to make it possible for people to email if needed.
 I can not use javascript for this solution.

I wouldn't bother - you won't escape the spammers anyway. :-(



-- 
Per Jessen, Zürich (15.9°C)


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



Re: [PHP] protecting email addresses on a web site

2010-06-15 Thread Per Jessen
Ashley Sheridan wrote:

  Unfortunately, you can't get away with just a contact form these
  days if you're a business, as it's a legal requirement in some
  countries to have a contact details available, and not just a
  contact form.
 
 Do you have specifics? I've never heard of such a requirement.
 
 Notwithstanding Ash's assertion, I would suggest a contact form. The
 email address is effectively hidden, and you can apply CAPTCHA to the
 form to cut down on bot spam. It also introduces some discipline on
 the user, and potentially allows you to categorize inquiries (making
 it easier to pass them on to the proper person). You can also have a
 pick list on the form which details which person you'd like the form
 to be sent to.
 
 In general, on contact forms or about us pages, I include some
 physical address and possibly a phone number. This might satisfy
 Ash's requirement for contact details.
 
 Paul
 
 
 
 It's not my requirement, it's been a legal requirement in the UK for 3
 years now.

It's a pretty common EU requirement for anything business related. 



-- 
Per Jessen, Zürich (16.0°C)


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



Re: [PHP] getaddrinfo() - what is the equivalent php function?

2010-05-27 Thread Per Jessen
Per Jessen wrote:

 AFAICT, gethostbyname() only works for ipv4 addresses, so that one is
 out - dns_get_record seems to be really for dns only, i.e. it does not
 look at /etc/hosts.  Is there a hph function that essentially just
 calls getaddrinfo() ?
 

Wow, lots of answers to that one. 

Let me rephrase it then - what is the PHP interface to the system
resolver when support for IPv6 is required?  
Again, gethostbyname() only works for IPv4 and dns_get_record is not a
resolver interface, but a DNS interface. (AFAICT). 
 

-- 
Per Jessen, Zürich (14.9°C)


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



[PHP] getaddrinfo() - what is the equivalent php function?

2010-05-26 Thread Per Jessen
AFAICT, gethostbyname() only works for ipv4 addresses, so that one is
out - dns_get_record seems to be really for dns only, i.e. it does not
look at /etc/hosts.  Is there a hph function that essentially just
calls getaddrinfo() ?



-- 
Per Jessen, Zürich (19.1°C)


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



Re: [PHP] Really impressive work

2010-05-06 Thread Per Jessen
tedd wrote:

 Now, I realize that this company did not take 15 factorial pictures
 of this single piece of jewelry to present all these different
 combinations but instead placed smaller images of each of the stones
 at specific coordinates on the larger image of the jewelry.
 
 I imagine that each piece of jewelry must have the coordinates of
 each setting in a database so that they can on-the-fly assemble the
 finished product as per user's direction.
 
 For example, let's take the image of the basket pendant showing three
 stones. Each of the stone locations would have a specific pixel
 placement (i.e., x,y). As such, the database would have a field for
 the image and three location fields for stones 1, 2, and 3.
 
 Now, we also have smaller images of 12 different stones (in heads)
 that are all the same size. Thus, as the user picks the stones and
 positions they want and the image is assembled on the fly.
 
 Is that the way you see this? 

Yes - each picture is basically a base + a number of overlays. Quickly
done with e.g. libgd or some such. 



-- 
Per Jessen, Zürich (8.9°C)


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



Re: [PHP] What is wrong with this code?

2010-04-28 Thread Per Jessen
Gary . wrote:

 class Pg_Error
 {
 private static $errors =
 array(INTEGRITY_CONST_UNIQUE = 'uniqueness constraint
 violated');
 ...
 public static function getMessage($ec)
 {
 $text = '';
 if (array_key_exists($ec, Pg_Error::$errors))
 {
 $text = Pg_Error::$errors[$ec];
 }
 
 return $text;
 }
 ...
 }
 
 ?
 
 Calling it, the array_key_exists call always returns false:
 $this-assertEquals('uniqueness constraint violated',
 Pg_Error::getMessage(Pg_Error::INTEGRITY_CONST_UNIQUE));
 and I can't see what I've done wrong :(

Might this be better:

public static function getMessage($ec)
{
$text = '';
if (array_key_exists($ec, $errors))
{
$text = $errors[$ec];
}

return $text;
}



-- 
Per Jessen, Zürich (11.2°C)


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



Re: [PHP] getting content exceprts from the database

2010-04-26 Thread Per Jessen
Ashley Sheridan wrote:

 Here's the rub though. As the content is in HTML form, I can't just
 grab the first 100 characters and display them as that could leave an
 open tag  without a closing one, potentially breaking the page. I
 could use strip_tags on the 100-character excerpt, but what if the
 excerpt itself broke a tag in half (i.e. acronym title=something
 could become acron )
 
 The only solutions I can see are:
 
 
   * retrieve the entire article, perform a strip_tags and then
   take the excerpt
   * use a regex inside of mysql to pull out only the text
 

- parse the HTML and extract the text elements.

If the HTML is well-formed, this is relatively easily done with XSL, if
not, you might need to use Beautiful Soup or similar.



-- 
Per Jessen, Zürich (16.1°C)


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



Re: [PHP] Re: replying to list (I give up)

2010-04-25 Thread Per Jessen
Michiel Sikma wrote:

 On 24 April 2010 16:14, Per Jessen p...@computer.org wrote:
 
 Ashley Sheridan wrote:

 
  Is there an actual WoW client for Linux or you run in Wine like
  environment?
 
  Thanks,
  Tommy
 
 
  I run it under Wine. Wine has come a long way since my first
  encounters with it a few years back and run a surprising amount of
  Windows-based software.

 Doesn't WoW need DirectX and all that?  I have some old Windows games
 (Diablo, Alpha Centauri, Railroad Tycoon, Wolfenstein) I'd love to
 play under Wine, but so far I've not managed to make them work.


 The best way to run old games is via DOSBox. http://www.dosbox.com/ 

Yes, I do use that too, but will it also run Windows games?? 



-- 
Per Jessen, Zürich (13.1°C)


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



RE: [PHP] Re: replying to list (I give up)

2010-04-24 Thread Per Jessen
Ashley Sheridan wrote:

 
 Is there an actual WoW client for Linux or you run in Wine like
 environment?
 
 Thanks,
 Tommy
 
 
 I run it under Wine. Wine has come a long way since my first
 encounters with it a few years back and run a surprising amount of
 Windows-based software. 

Doesn't WoW need DirectX and all that?  I have some old Windows games
(Diablo, Alpha Centauri, Railroad Tycoon, Wolfenstein) I'd love to play
under Wine, but so far I've not managed to make them work. 


-- 
Per Jessen, Zürich (19.7°C)


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



Re: [PHP] Hello everybody - php newbie from switzerland

2010-04-22 Thread Per Jessen
Dan Joseph wrote:

 On Wed, Apr 21, 2010 at 8:38 PM, David McGlone da...@dmcentral.net
 wrote:
 

 Are we gonna have to have a discussion on the use of threading? LOL



 We just might.  Personally, I use it to sow holes in the toe of my
 socks.
 

My newsreader supports threading. 


-- 
Per Jessen, Zürich (7.4°C)


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



Re: [PHP] replying to list

2010-04-21 Thread Per Jessen
David McGlone wrote:

 I use Evolution, Kmail, and occasionally lookout and all of them are
 decent e-mail clients. Also, of all the mailing lists I am on, this is
 the only one that, when replying it goes to the OP and not the list.

http://www.unicom.com/pw/reply-to-harmful.html

I haven't checked, but I think all the lists I am on behave like this
one. 


-- 
Per Jessen, Zürich (14.8°C)


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



Re: [PHP] replying to list (I give up)

2010-04-21 Thread Per Jessen
David McGlone wrote:

 I give up. trying to reply to messages on this list is tedious. I
 can't pinpoint whether it's because the list is set up to make replies
 go to the OP or the OP has his reply-to in his mail client set, or
 most people are hitting the reply-to button instead of simply reply.

Did you try Reply-All ?  That usually does it for me.

 It just doesn't make sense to me, why be on the mailing list if it
 hinders having a group discussion without having to jump through
 hurdles. It also defeats the purpose of being on a group list if
 replying sends the reply to the OP.

Reply-All. 



-- 
Per Jessen, Zürich (16.2°C)


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



Re: [PHP] replying to list (I give up)

2010-04-21 Thread Per Jessen
David McGlone wrote:

 Also, I do not want this discussion to turn into a flame war or
 anything of such. I am simply just trying to have a discussion and
 learn why and how there is different behavior here, but not anywhere
 else. 

David, the PHP list behaves like hundreds or thousands of others in this
respect.  Of course there are also lists that work the other way, but
the PHP list is far from alone. 



-- 
Per Jessen, Zürich (17.0°C)


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



Re: [PHP] replying to list (I give up)

2010-04-21 Thread Per Jessen
David McGlone wrote:

 On Wed, 2010-04-21 at 17:07 +0200, Per Jessen wrote:
 David McGlone wrote:
 
  Also, I do not want this discussion to turn into a flame war or
  anything of such. I am simply just trying to have a discussion and
  learn why and how there is different behavior here, but not
  anywhere else.
 
 David, the PHP list behaves like hundreds or thousands of others in
 this
 respect.  Of course there are also lists that work the other way, but
 the PHP list is far from alone.
 
 It could be just me, but it seems to me this behavior is mostly PHP
 list specific. 

Some examples of other lists that behave the same:

ntp-general
linux-kernel
spamassassin-general
rrdtool-users
opensuse-*
nasm-users
isdn4linux
asterisk-users
postfix-users
dovecot-general



-- 
Per Jessen, Zürich (17.5°C)


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



Re: [PHP] How to do i18n better?

2010-04-20 Thread Per Jessen
Ashley Sheridan wrote:

 That's the check I did on the last site i worked on (vicestyle.com)
 The user agent string is checked for a language and the site uses
 that. If none is found (bearing in mind that there's no hard and fast
 rule about what can go into a UA string) then it defaults to English.

The language preference is not set in the UA string, it is set in the
Accept-Language header along with the priority. 

 Links within the site itself allow the user to change their language
 afterwards, and you could store that in a cookie to it remembers their
 choice.

The standard in Apache is 'prefer-language'.



-- 
Per Jessen, Zürich (12.4°C)


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



Re: [PHP] How to do i18n better?

2010-04-20 Thread Per Jessen
Ashley Sheridan wrote:

 On Tue, 2010-04-20 at 20:27 +0200, Per Jessen wrote:
 
 Ashley Sheridan wrote:
 
  That's the check I did on the last site i worked on (vicestyle.com)
  The user agent string is checked for a language and the site uses
  that. If none is found (bearing in mind that there's no hard and
  fast rule about what can go into a UA string) then it defaults to
  English.
 
 The language preference is not set in the UA string, it is set in the
 Accept-Language header along with the priority.
 
 [snip] 
 
 
 I wasn't aware of that one, but I know most browsers send a language
 with part of the UA string
 
 Thanks,
 Ash

Accept-Language, the 'prefer-language' cookie, the various apache config
options etc. are all part of the Apache content-negotiation
setup/framework.  On our website(s), I rely entirely on
Accept-Language. In the very rare case where it isn't set, I set a
default based on the IP-address of the client.  


-- 
Per Jessen, Zürich (8.4°C)


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



Re: [PHP] How to enable mail function with postfix supported.

2010-04-20 Thread Per Jessen
ttplayer wrote:

 Hello,
  The PHP mail function works well with sendmail installed, however,
  when I install the postfix instead of sendmail , the PHP mail
  function can't work normally. Why? How can I do with the problem?

Start by describing the problem in detail.  Postfix comes with its own
sendmail equivalent, yuo should not have any problem using postfix. I
certainly don't.


-- 
Per Jessen, Zürich (8.2°C)


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



Re: [PHP] How to do i18n better?

2010-04-19 Thread Per Jessen
Andre Polykanine wrote:

 etc. I know that PHP does support somehow exporting the strings into a
 .pod file. Maybe it would be better to do that? If so, how can I do
 it?
 Could you suggest me maybe a better solution than we currently have?

For mostly dynamic messages or pages, I would take a look at the
gettext() mechanism:

http://php.net/manual/en/book.gettext.php



-- 
Per Jessen, Zürich (14.9°C)


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



Re: [PHP] Re: optimizing PHP for microseconds

2010-03-29 Thread Per Jessen
Bastien Helders wrote:

 I have a question as a relatively novice PHP developper.
 
 Let's say you have this Intranet web application, that deals with the
 generation of file bundles that could become quite large (let say in
 the 800 MB) after some kind of selection process. It should be
 available to many users on this Intranet, but shouldn't require any
 installation. Would it be a case where optimizing for microseconds
 would be recommended? Or would PHP not be the language of choice?

Not enough data.  However, given that it will undoubtedly take seconds
to assemble one such bundle, microseconds are probably not important. 
Depends on how many of those bundles you expect to be able to produce
per minute/hour/day as well as what is supposed to happen with them
after they've been assembled. 



-- 
Per Jessen, Zürich (10.8°C)


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



Re: [PHP] Allowing multiple, simultaneous, non-blocking queries.

2010-03-28 Thread Per Jessen
Richard Quadling wrote:

 Hi.
 
 As I understand things, one of the main issues in the When will PHP
 grow up thread was the ability to issue multiple queries in parallel
 via some sort of threading mechanism.
 
 Due to the complete overhaul required of the core and extensions to
 support userland threading, the general consensus was a big fat No!.

Maybe a Thanks, but no thanks.

 As I understand things, it is possible, in userland, to use multiple,
 non-blocking sockets for file I/O (something I don't seem to be able
 to achieve on Windows http://bugs.php.net/bug.php?id=47918).
 
 Can this process be leveraged to allow for non-blocking queries?
 
 Being able to throw out multiple non-blocking queries would allow for
 the queries in parallel issue.
 
 My understanding is that at the base level, all queries are running on
 a socket in some way, so isn't this facility nearly already there in
 some way?

AFAICT (i.e. without having tried it), myqlnd enables you to do
asynchronous queries on mysql - the docuementation is a little lacking.  
Personally speaking, that would be my first avenue of attack. 


-- 
Per Jessen, Zürich (8.2°C)


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



Re: [PHP] RE: optimizing PHP for microseconds

2010-03-26 Thread Per Jessen
Daevid Vincent wrote:

 Was that someone me? I do that. And if you don't, then you're the kind
 of person I would not hire (not saying that to sound mean). 

If you do, I'd would be careful about hiring you.  To me, optimizing for
microseconds in PHP means loss of focus.

 I use single quotes instead of double where applicable. I use --
 instead of ++. I use $boolean = !$boolean to alternate (instead of
 mod() or other incrementing solutions). I use LIMIT 1 on select,
 update, delete where appropriate. I use the session to cache the user
 and even query results. 

Most of that is just sound practice, not optimizing, imho.  Optimizing
is what you do later.  

 I come from the video game world where gaining a frame or two of
 animation per second matters. It makes your game feel less choppy and
 more fluid and therefore more fun to play.

Well, if you were writing PHP video games, I can totally appreciate
optimizing for microseconds. 



-- 
Per Jessen, Zürich (11.4°C)


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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-26 Thread Per Jessen
Peter Lind wrote:

 Anyway, I don't think either of us will change point of view much at
 this point - so we should probably just give the mailing list a rest
 by now. Thanks for the posts, it's been interesting to read :)

Most of it. +1


-- 
Per Jessen, Zürich (11.6°C)


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



RE: [PHP] Will PHP ever grow up and have threading?

2010-03-25 Thread Per Jessen
Daevid Vincent wrote:

 Well, since I was the one that started this shit-storm, I'll chime in
 for a minute... ;-)
 
 If you added threading to the bag of tricks it already has, you're
 getting into areas that make it more difficult to pick up for
 beginners (and that's not to mention the technical elements involved
 in actually adding threading to PHP) Currently the only other 'easy'
 language I know for  beginners is ColdFusion, and that's just
 horrible. You wouldn't want to be responsible for sending the newbies
 down that path would you?! :p 
 
 I'm sorry. I didn't realize PHP was designed for beginers.
 

There is something about the entire environment that makes coding PHP
for a webpage attractive to beginners.  The runtime is your
web-browser, you don't need to compile anything, you just edit, and hit
F5. Combine that with weak typing and an easy syntax, and you've got
something that is easy to pick up. 

Contrast that with perhaps Java and j2ee, a language and a framework
often used in large, long term projects with long life expectancies -
not really a beginners sandbox.

 You all think to shallow and narrow minded. You keep thinking in terms
 of using PHP as simply a web language. You need to think in terms of
 using it like Perl, Python, Ruby, Java, C/++, etc. Computers do a lot
 more than just spit out web pages these days. I know most of you seem
 to only think in terms of the cloud and other stupid technologies
 like that, but there's a great big world of computing that doesn't.
 There's no reason that PHP shouldn't be a viable language to use in
 those arenas either.

PHP is perfectly viable for those areas today.  I wouldn't personally
use it for anything non-web unless it is less than 1000 lines.  My
experience has taught me not to (not just PHP, any script language).

 Spot on again. I have maybe 12 YEARS of PHP expertise, knowledge,
 libraries, tools, code snippets, etc that are battle tested and
 hardened and improved constantly. Now I'd have to toss all that out
 just to write some things in a language that has threading --
 something that is a given in most EVERY other language.

Actually, most don't have it built-in, it usually comes in separate
libraries and is an operating-system feature, not a language feature.
Two notable exceptions I can think of are Ada and PL/1. 


-- 
Per Jessen, Zürich (11.4°C)


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



Re: [PHP] Re: Will PHP ever grow up and have threading?

2010-03-25 Thread Per Jessen
Tommy Pham wrote:

 I think you're missing my point.  Given your current hardware,
 software, product list, etc... how long does it take to run your
 queries in series?  If you were able to run them in parallel and
 deliver faster response time to the users, would you implement PHP
 thread, if it's available?

I mentioned it yesterday, but perhaps you overlooked it - the mysqlnd
driver supports asynchronous queries.  If you really have an issue with
the elapse time of sequential, but independent database queries,
executing them asynchronously is the obvious solution.  (apart from
tuning the database, but I'm assuming you've already been there).


-- 
Per Jessen, Zürich (11.9°C)


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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-25 Thread Per Jessen
Tommy Pham wrote:

 As such, let's dissect what you mentioned:
 
 1) PHP with internal thread support
 2) PHP with external C/C++ thread support

That's not quite what I mentioned, but I'll accept it for the sake of
argument. 

 * Performance - having external thread support, now you have to call
 an extension (more memory usage and CPU cycles). 

Tommy, you are already using millions of more cycles by running PHP
instead of C.  It's a reasonable trade-off of course, but using more
cycles is not a valid counter-argument. 

 If you happen to have a C/C++ guru who can then code that thread
 support into PHP extension, wouldn't it still perform better at the
 core vs as an extension because it's not talking to a 'middle man'? 

It's another trade-off Tommy - you run two separate processes, talking
to each other over TCP (for instance) to gain 1) performance and 2)
flexibility/scalability.  You gain performance by having processes that
can be independently scheduled by the OS, and you gain flexibility by
being able to move a process to another box (for scalability). You pay
for that with a few thousand cycles.  When you decide to use a database
(e.g. mysql) you also make a trade-off - well-managed data, a
structured query-language and some overhead vs. doing it all in your
own code. 

 * Portability - if you're currently running PHP on Windows, but manage
 to convince management to switch to *BSD/Linux, then you'd have to
 rewrite that external thread support. 

If portability is a concern, I'd make sure my threaded backend would run
on all the platforms I could envision.  Portability is merely one of
many factors that affect choice of programming language. 

 * Managability - should your need to upgrade PHP for either bug fix,
 new features you'd want to implement to add more functionality to your
 site, will that then break your custom external solution?  How much
 more manageable is it if it's done under 1 language versus 2+?

I said it yesterday already - having a single implementation language IS
a positive, but it may not always be possible due to requirements. 



-- 
Per Jessen, Zürich (12.3°C)


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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-25 Thread Per Jessen
Tommy Pham wrote:

  I don't
 use Linux nor an expert in it but implementing custom thread solution
 like that means understanding about SELinux vs AppArmor vs Grsecurity
 or am I wrong? 

Yes, you are wrong.  The Posix thread model implemented in the pthread
library in Linux is easy to pick up for anyone who has studied computer
science - where he or she will already have been introduced to mutexes,
semaphores, the Dining Philosophers, race conditions, deadlocks and
such. 



-- 
Per Jessen, Zürich (12.6°C)


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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-25 Thread Per Jessen
Tommy Pham wrote:

 As some of you mention that implementing threads will make the DB work
 harder than the standard serial operations queries, let me ask you
 these then:
 
 * How often does your DB server(s)/cluster utilizes 100% CPU (SMP/MC),
 memory, and disk IO?

Assuming we're talking under heavy load - my database server is an
old(ish) HP Proliant ML570 - 4 x 3GHz Xeons with HT, dual U320 SCSI
busses, 48GB RAM :

CPU 100% - rarely, but it happens.
Memory 100% - all the time. 
Disk IO 100% - less than all the time, but it's very busy.

 * If you could implement threads and run those same queries in 2+
 threads, the total time saved from queries execution is 1/2 sec or
 more, which is pass along as the total response time reduced.  Is it
 worth it for you implement threads if you're a speed freak? 

Use mysqlnd - asynchronous mysql queries.

 (I remember a list member, not mentioning his name, does optimization
 of PHP coding for just microseconds.  Do you think how much more he'd
 benefit from this?)

Anyone who optimizes PHP for microseconds has lost touch with reality -
or at least forgotten that he or she is using an interpreted language.

 * If the requests are executed in parallel, the sooner the request
 fulfillment completes, the faster it is to move to the next request
 and complete it right?

Correct. 


-- 
Per Jessen, Zürich (12.7°C)


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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-25 Thread Per Jessen
Per Jessen wrote:

 CPU 100% - rarely, but it happens.
 Memory 100% - all the time.
 Disk IO 100% - less than all the time, but it's very busy.

FYI, it's actually quite difficult to drive a disk subsystem to
consistent 100% utilization over a period of time.  Oracle uses
asynchronous I/O and could probably drive a disk subsystem quite hard,
but AFAIK, mysql doesn't.


-- 
Per Jessen, Zürich (13.9°C)


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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-25 Thread Per Jessen
Tommy Pham wrote:

 On Thu, Mar 25, 2010 at 1:46 AM, Per Jessen p...@computer.org wrote:
 * If you could implement threads and run those same queries in 2+
 threads, the total time saved from queries execution is 1/2 sec or
 more, which is pass along as the total response time reduced.  Is it
 worth it for you implement threads if you're a speed freak?

 Use mysqlnd - asynchronous mysql queries.

 
 You're assuming that everyone in the PHP world uses MySQL 4.1 or
 newer.  What about those who don't? 

They don't get to use threading, nor asynchronous mysql queries. 

Come on, you're asking about a future feature in PHP 7.x , but would
like to support someone who is seriously backlevel on mysql??


-- 
Per Jessen, Zürich (16.9°C)


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



Re: [PHP] A cleaner way to do this?

2010-03-25 Thread Per Jessen
Paul Halliday wrote:

 
 Is there any way to clean this up a bit?
 

This is what I usually do:

if ( ($matches=preg_match(linepattern1,text,match))0 )
{
// do stuff speicifc to linepattern1
}
else
if ( ($matches=preg_match(linepattern2,text,match))0 )
{
// do stuff speicifc to linepattern2
}
else
if ( ($matches=preg_match(linepattern3,text,match))0 )
{
}
else
if ( ($matches=preg_match(linepattern4,text,match))0 )
{
}



-- 
Per Jessen, Zürich (15.9°C)


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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-25 Thread Per Jessen
Tommy Pham wrote:

 I'm presenting the argument for threading.  Per is presenting the work
 around using asynchronous queries via mysqlnd.  I did read that link a
 few days ago, Although the user can send multiple queries at once,
 multiple queries cannot be sent over a busy connection. If a query is
 sent while the connection is busy, it waits until the last query is
 finished and discards all its results.  Which sounds like threads -
 multiple connections to not run into that problem.

You must have read the wrong page.  This is NOT about multiple queries,
it's about _asynchronous_ queries. 


-- 
Per Jessen, Zürich (15.1°C)


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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-25 Thread Per Jessen
Peter Lind wrote:

 I'm not against threads in PHP per se ... I just haven't seen a very
 convincing reason for them yet, which is why I'm not very positive
 about the thing. 

Roughly the same here - I don't think threading belongs in PHP, but if
someone decides it's a good idea, I won't be arguing against someone
volunteering the effort. 

/Per

-- 
Per Jessen, Zürich (15.7°C)


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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-25 Thread Per Jessen
Tommy Pham wrote:

 Here's my analysis, let's say that you have 1000 requests / second on
 the web server.  Each request has multiqueries which take a total of 1
 second to complete.  In that one second, how many of those 1000 arrive
 at the same time (that one instant of micro/nano second)? 

On average, exactly one per millisecond. 


/Per

-- 
Per Jessen, Zürich (15.4°C)


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



Re: [PHP] Will PHP ever grow up and have threading?

2010-03-24 Thread Per Jessen
Tommy Pham wrote:

 The company started small.  As their business grows because they have
 products  services that do not exist in the marketplace, their
 hardware are already growing along side with it, (load balancers,
 clusters).  So then your solution is buy bigger/more boxes?  What if
 the their server room is filled and already using recent hardware.

Same answer - buy a bigger box (i.e. serverroom).  I would certainly
also start a redesign from the ground up, but to solve the immediate
problem, get more hardware. 

 Their current business needs doesn't need to move to a bigger
 building.  What then? Hire data center's services?  What if they want
 to protect their proprietary break through products and services?

Rent space and maybe hardware. That's what most businesses do. 

 What about unnecessary additional total cost of ownership (licenses,
 power consumption, etc...) for more/bigger boxes, even if they have
 available space, that could be avoided by just implementing threads?

If you believe threading is such a silver bullet, I really think you
need to reconsider.  This business has already invested in more
hardware to satisfy demand, so the application has some scalability -
presumably achieved by running multiple processes.  Threads have some
advantages over processes, but when your design doesn't take that into
account anyway, why do you need threads?

[snip]
 In summary, you're saying that PHP can not grow/evolve with 
 business right? 

Certainly not.  PHP is just a language, like most other programming
languages, it doesn't grow nor does it evolve a lot.  (the OOP paradigm
is an example of where PHP evolved). 
I'm saying that a back-of-a-fag-packet design won't grow nor evolve very
well, and its inevitable shortcomings will not be solved by bolting
on threading.

 If the company started small and want to use available open source
 solutions, then grow quickly because of their unique and quality
 products and services, and become enterprise level with-in a few
 years, what then?  Slow down business growth just so that IT can
 migrate everything to another language? Of all the enterprise
 applications I've seen, they used threads. 

Tommy, that's not about the language, that's a design issue.  Run PHP in
multiple processes, and you've got the parallelism you seem to seek. 

/Per

-- 
Per Jessen, Zürich (6.8°C)


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



  1   2   3   4   5   6   7   8   9   10   >