[PHP] Re: open source content management systems?
[EMAIL PROTECTED] wrote: > hi all > > does anyone have any recommendations for good open source content > management systems for websites? - preferably, written in php... http://typo3.com/ /Per -- Per Jessen, Zurich http://timian.jessen.ch - an analog report formatter using XSLT. http://www.dansk.org - for alle danskere i udlandet! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 4.3.2 -- does connection_status() actually work?
Shouldn't the following work - or rather why doesn't it : ignore_user_abort(0); for( $i=100; $i; $i-- ) { if ( connection_status() ) exit(0); print " blurp."; flush(); sleep(1); } print "Done."; This is php4.3.2 on apache 2.0.45. /Per -- Per Jessen, Zurich http://timian.jessen.ch - an analog report formatter using XSLT. http://www.dansk.org - for alle danskere i udlandet! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 4.3.2 -- does connection_status() actually work?
Rasmus Lerdorf wrote: > What does it do? Using connection_status() in a script that doesn't > ignore user aborts is pretty useless. Regardless of whether I use ignore(0) or ignore(1), the script keeps going after the user has hit stop. The apache error-log is then full of: (32)Broken pipe: core_output_filter: writing data to the network > The script will abort on the print > and never get to the connection_status() line so your code doesn't > actually make any sense. OK, that's good to know too :-) > And, beyond that, all bets are off for > Apache-2.0.x. No real extensive testing has been done on that platform > which is why we don't suggest running it in production because stuff like > this is likely to be broken even if you got your code right. Fair enough - this isn't production as such - I thought it might be worth asking. What are the plans, if any, regarding apache 2.0.x and php? For my purposes, I would be perfectly happy if my php script would stop running once the client has disconnected. /Per -- Per Jessen, Zurich http://timian.jessen.ch - an analog report formatter using XSLT. http://www.dansk.org - for alle danskere i udlandet! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 4.3.2 -- does connection_status() actually work?
Jeff Harris wrote: > I'm just guessing here, because you didn't give us the desired result, > but how about: > if (connection_status() ) break; Yeah, that would do about the same. The expected result is for the script to stop running once the client disconnects. /Per -- Per Jessen, Zurich http://timian.jessen.ch - an analog report formatter using XSLT. http://www.dansk.org - for alle danskere i udlandet! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] what's the story with html_entity_decode?
According to the manual it appears to support UTF-8, but it complains loudly about not supporting MBCS when invoked? "Warning: cannot yet handle MBCS in html_entity_decode()! " Will html_entity_decode produce output in UTF-8 when e.g. invoked like this: $a="Zürich, \"klonk\" æ 'å' "; $b=html_entity_decode( $a, ENT_QUOTES, "UTF-8" ); It seems to default to ISO-8859-1? thanks /Per -- Per Jessen, Zurich http://timian.jessen.ch - an analog report formatter using XSLT. http://jessen.ch/dansk-listen - for alle danskere i udlandet! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Apache 2 and PHP
Radek Zajkowski wrote: > A few months back the official PHP website still warned againts PHP and > Apache 2. I am wondering about the current status of these two > technologies when used together. I am about to configure a web server and > was going to use Apache 1.3 with PHP4+ as opposed to Apache 2 with PHP4+. > What are your opinions, thoughts and experiences. I've been using apache 2.0 and php 4.x for quite some time now, and have really only seen very minor problems. I did run into some odd problem a while back, and asked about here - got the standard message about "don't expect php to work in apache 2.0". It was something to do with error-handling and timeout, IIRC. Why not go with Apache 2.0? If you should run into some showstopper, revert to 1.3 - it's not that much of an effort (provided you don't start using apache 2.0-only features). /Per -- Per Jessen, Zurich http://timian.jessen.ch - an analog report formatter using XSLT. http://www.dansklisten.org -- for alle danskere i udlandet. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] web shot script
Joey wrote: > Sorry for the delay. > > The purpose is to be able to see what is running on a site at any > given time. Apaches 'server-status' perhaps? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: anchor name on URL
Craige Leeder wrote: > Micah Gersten wrote: >> I'd rather all the engines follow the W3C standards so that you just >> have to make sure your web page is compliant. >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> > Though I always script to W3 Standards, I could care less if browsers > follow those standards, so long as we wind up closer and closer to a > general set of rules we can obide by. Uh, only as long as that general set of rules is well documented. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: anchor name on URL
Richard Heyes wrote: >> although the crapness of firefox 3 may change that a bit.. > > Keh? FF3 is great IMO. > FF2 and FF# are not 100% compatible which made some of our web interfaces look wrong in FF3. I haven't been able to find the problem yet: FF2: http://jessen.ch/images/sam-menu-ff2.jpeg FF3: http://jessen.ch/images/sam-menu-ff3.jpeg Notice how the fonts are really quite different, in FF3 they make the long orange menu line spill over the page margin. No FF3 around here for a while yet. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: anchor name on URL
Nathan Rixham wrote: > Per Jessen wrote: >> Nathan Rixham wrote: >> >>> i never understand this, if i was makign a browser I'd be "where's >>> the rfc's" then code it to implement those rfc's - why people choose >>> not to is beyond me? >> >> World domination is part of the reasoning ... >> >> >> /Per Jessen, Zürich >> > > well that bubble should have popped.. > > from some of my sites: > Browser % visits > Firefox 88.43% > Internet Explorer 9.99% > > Firefox 46.89% > Internet Explorer 37.66% > Opera 7.36% > Safari 5.39% > Chrome 2.17% > > Firefox 46.80% > Internet Explorer 42.45% > Safari 5.36% > Opera 3.07% > Mozilla 1.22% I have not looked at any of my own stats for quite a while, but yours are just too good to be true :-) /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: anchor name on URL
Nathan Rixham wrote: >>> Though I always script to W3 Standards, I could care less if >>> browsers follow those standards, so long as we wind up closer and >>> closer to a general set of rules we can obide by. >> >> Uh, only as long as that general set of rules is well documented. >> >> >> /Per Jessen, Zürich >> > > i never understand this, if i was makign a browser I'd be "where's the > rfc's" then code it to implement those rfc's - why people choose not > to is beyond me? World domination is part of the reasoning ... /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing XML
Ashley Sheridan wrote: > Do any of you have a copy of this extension, or failing that, a > suggestion of how I can parse XML files without having to install > anything on the remote server, as I do not have that level off access > to it. Parsing XML is best done with XSL - if that's out of the question, you're in for a difficult time. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing XML
Ashley Sheridan wrote: > On Fri, 2008-11-28 at 10:15 +0100, Per Jessen wrote: >> Ashley Sheridan wrote: >> >> > Do any of you have a copy of this extension, or failing that, a >> > suggestion of how I can parse XML files without having to install >> > anything on the remote server, as I do not have that level off >> > access to it. >> >> Parsing XML is best done with XSL - if that's out of the question, >> you're in for a difficult time. >> >> >> /Per Jessen, Zürich >> >> > XSL will only allow me to convert it into a different document format, > which is not what I want as I need to keep a local copy of information > in a database for searching and sorting purposes. Nathans class allows > me to have the entire document put into an array tree, which is fine > for what I need so far. That's cool, but XSL is still the more appropriate tool IMO. It does exactly what you need - it parses and validates the XML document, allows you to extract the bits you need and in virtually any format you need - which could be a text document with SQL statements for piping to mysql. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Happy Turkey Day
tedd wrote: > At 5:26 PM + 11/27/08, Ashley Sheridan wrote: >>For anyone who has no idea who Mr Bean is: >> > > I've always liked Mr Bean -- there's a bit of him in all of us. > > However, I saw a performance done by him about Americans that was a > bit over-the-top. The skit centered on how fat Americans were. Well, they are a bit over-the-top ... > I am sure if he ran that skit in a trailer for one of his movies in > the States, the attendance for his movie would drop -- a bit like > biting the fat-hand that feeds him. Just one of many. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing XML
Andrew Ballard wrote: >> XSL will only allow me to convert it into a different document >> format, which is not what I want as I need to keep a local copy of >> information in a database for searching and sorting purposes. Nathans >> class allows me to have the entire document put into an array tree, >> which is fine for what I need so far. >> >> >> Ash >> www.ashleysheridan.co.uk > > A bit over the top, but you could always use XSL to turn it into CSV. > LOL > > Andrew Not over the top at all if your database understands CSV. I think it is very odd that no-one else is advocating XSL in this case. Extracting information from an XML file is just another way of converting it, which is exactly what XSL is good at. I can't imagine how using a pile of custom PHP code is going to be more efficient than writing a simple XSL stylesheet according to recognised standards etc. Just my opinion of course. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing XML
Peter Ford wrote: > Per Jessen wrote: >> >> That's cool, but XSL is still the more appropriate tool IMO. It does >> exactly what you need - it parses and validates the XML document, >> allows you to extract the bits you need and in virtually any format >> you need - which could be a text document with SQL statements for >> piping to mysql. >> >> >> /Per Jessen, Zürich >> > > I'm with you on this, Per. > You could even use the XSL to construct a bunch of PHP which could be > eval'd or just read in as an include. > Or better yet, if you use the XSL classes, you can register PHP > functions and then call them within your XSL directly. That could > potentially handle the validation you required, and even do the > database inserts. Yep, that occured to me too. I think XSL can even do quite a bit of the validation too. > I'm looking into using something like that on a project I'm currently > working on: maybe I can come up with some examples in a couple of > days... Here's one easy example - we generate monthly reports for our customers based on the activities of the most recent month. The template is an OpenOffice document (well, several in different languages), which is merged with the activity data to produce the report in OOo format. The data is extracted and formatted as XML. The process looks roughly like this: OOo:template + XML:data -> apply XSL -> OOo document. (We then turn the final OOo document into a PDF which is emailed). Of course the same could be achieved using PHP, but instead of a neat XSL stylesheet, I would have a pile of custom PHP code. IMO, when you have a need to parse XML or otherwise extract data from XML, you need a really good reason to disregard XSL. The only really good reason I've heard so far was lack of XSL skills, which could be a real issue. The learning curve IS quite steep. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing XML
Ashley Sheridan wrote: > I still disagree, as using XSL is essentially converting the XML to > another format, Which is all you're doing when you're extracting parts of an XML document. > which is then being used by PHP. XSL is great for some tasks, but for > this, I think having a good PHP XMLDoc (or similar type of) class is > better. Ash, I'd really like to hear you argue why you think so. I can't help thinking it's a bit like saying "I know there is a compiler for C-code, but I prefer to convert to assembler by using PHP". I know it's not quite that bad, but I hope you get my point. > On a slightly aside note though, how would you apply the XSL to the > XML using PHP? Roughly like this: (this is from a project I'm currently working on). -- // create the xslt processor object if ( FALSE===($xp=new XSLTProcessor()) ) { print "unable to create xslt engine"; return FALSE; } // Load the XML source $xml=new DOMDocument; $xml->loadXML($list); // then load the XSL stylesheet $xsl=new DOMDocument; $xsl->load('getfilebypos.xsl'); // attach the stylesheet $xp->importStyleSheet($xsl); $pos=$_GET['pos']; $xp->setParameter('', array('pos' => $_GET['pos']) ); $file=$xp->transformToXML($xml); $file in this case is just a single filename, no XML. My input data has a list of filenames, the 'pos' argument from the URI identifies one I need to process. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing XML
Ashley Sheridan wrote: >> Roughly like this: (this is from a project I'm currently working >> on). >> >> -- >> // create the xslt processor object >> if ( FALSE===($xp=new XSLTProcessor()) ) { print "unable to create >> xslt engine"; return FALSE; } >> >> // Load the XML source >> $xml=new DOMDocument; >> $xml->loadXML($list); >> >> // then load the XSL stylesheet >> $xsl=new DOMDocument; >> $xsl->load('getfilebypos.xsl'); >> >> // attach the stylesheet >> $xp->importStyleSheet($xsl); >> >> $pos=$_GET['pos']; >> $xp->setParameter('', array('pos' => $_GET['pos']) ); >> >> $file=$xp->transformToXML($xml); >> >> >> $file in this case is just a single filename, no XML. My input data >> has a list of filenames, the 'pos' argument from the URI identifies >> one I need to process. >> >> >> /Per Jessen, Zürich >> >> > So here you're advocating loading the XML document into PHP to add an > element, then convert the XML into something else, for PHP to read > back in (not forgetting my original question said I need PHP to do > some operations on the XML.) No, not at all. 1) no element is added, 2) the document is not loaded 'into' PHP and 3) PHP 'reads back' output of about 30 bytes (a filename + path). None of the XSL+XML happens inside of PHP - it's done through the XSL extension which is essentially all calls to libxslt. > Do you see why I just wanted a way to extract the parts of the XML > document I needed? This example is actually making something > unnecessarily complex just because XSL is deemed to be the best way to > work with XML. Ash, my example above extracts a single element (specified by 'pos') from an XML-document - it's all done by a standards-compliant XSLT style-sheet, and very effectively so. The 8 lines of PHP code to invoke the XSL conversion are virtually 'standard' too. I'm having a hard time appreciating why that is better done by combining somebodyelses custom code with your own custom code. > I'm not saying that XSL is a bad thing, I've used it many times before > to convert various document formats, I just think that for what I > needed, XSL doesn't really suit the task at hand. I understand what you're saying, I just haven't heard a good argument yet. Gotta go watch Dr. House on the telly now. I'll be back tomorow morning. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Countries and Timezones
franzemmanuel wrote: > Hi everybody, > > For those who are interested in Countries and timezones. > > I needed to have the list of all the countries in the world and the > timezones by country without redundancy. > Couldn't you just have use the timezone info from mysql? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IE8 and HTML5
Benjamin Hawkes-Lewis wrote: > Everyone has their favorite unstandardized feature they'd love IE to > support. (Personally I'd be delighted by -ms-border-radius and > content:uri() support.) Nope, I don't have a single one. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Poll of sorts: Javascript Form validation or PHP
Terion Miller wrote: > I have a huge form to validate and wonder which is better javascript > validation or php, the page is a php page, I actually put js > validation on it but then it stopped working (stopped inserting into > the db) not sure if that had anything to do with it > What does everyone prefer? I don't think it's about the developer preference, it's about the user. Javascript enables lots of checking at data entry time, and can improve the overall user experience. If you're not particularly concerned with the user experience, don't bother with javascript. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Poll of sorts: Javascript Form validation or PHP
Nathan Rixham wrote: >>> Valid email addresses according to the Multipurpose Internet Mail >>> Extension (MIME) [2]: >>> [EMAIL PROTECTED] >>> Ã(c)@℞.com Uh, no, those aren't valid email address according to any standard. You cannot have 8bit characters to the left of the @ in the email address. The same really goes for the same on the right hand side of the @, but some people have difficulties distinguishing between the _actual_ email address and it may be rendered when the domain part is converted from punycode. The actual email address might be [EMAIL PROTECTED] which mail-agents with IDN support should display and accept like this: [EMAIL PROTECTED] /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Poll of sorts: Javascript Form validation or PHP
Per Jessen wrote: > address. The same really goes for the same on the right hand side of > the @, but some people have difficulties distinguishing between the > _actual_ email address and it may be rendered when the domain part is > converted from punycode. That should have read "and THE WAY it may be rendered when the domain part is converted from punycode". /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Poll of sorts: Javascript Form validation or PHP
Yeti wrote: > I think hotmail, or was it some other mail mogul, is allowing their > users to have those weird German umlauts and some accented characters. > > EXAMPLE: > [EMAIL PROTECTED] > Anyone who allows 8-bit characters on the left side of the @ is in for trouble. It won't work. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Poll of sorts: Javascript Form validation or PHP
tedd wrote: > At 5:10 PM +0100 12/7/08, Per Jessen wrote: >> You cannot have 8bit characters to the left of the @ in the email >> address. > > > I'm not sure that's correct. I am sure. In fact, the entire email header must not contain any 8-bit characters. I.e. it _can_, but it is a violation of the standard, and particularly in the email address it will cause problems, whereas it will most probably work in the Subject:. > I distinctly remember Paul Hoffman, the director of the Internet Mail > Consortium (http://www.imc.org/) saying that the left side of the @ > has always been open to whatever characters you want to use. I don't know him nor the IMC, but RFC2821 is fairly clear (as clear RFCs can be) on the matter. Still, I think this W3 webpage says it very clearly: http://www.w3.org/Mail/unencoded-8bits.html "W3C's mail servers are configured to reject messages with unencoded 8bit characters in the message email headers.". > The "xn--" is the prefix for PUNYCODE. Previous > algorithms (AMC, RACE, etc.) used other prefixes. > > After all is said and done, these were just ways to use 7 bit > characters (unfortunately, the default for the Internet) to > assemble/represent 8 bit characters. Absolutely. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Poll of sorts: Javascript Form validation or PHP
tedd wrote: > The php routine also passed [EMAIL PROTECTED], which is real -- but > it's interesting that most email (if not all) programs cannot show > the domain name correctly, which is [EMAIL PROTECTED] I have yet to find an > email program that can show IDNS correctly. Tedd, I've got a distinct feeling of deja-vu here, but Thunderbird displays all Swiss, German, French, Greek and Danish IDNs 100% correctly, probably many more too. The ones you're having a problem with are the ones that allow the entire UTF8 charset, IIRC. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file_exists and wildcard/regex
[EMAIL PROTECTED] wrote: > > I'm not sure how glob works in the guts, but I know it is dog-slow for > large numbers of files (or maybe just large numbers of results). > I'm not sure what the context of this was, but the speed of searching a directory with a large number of files, e.g. 100,000s, also depends a lot on the filesystem. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file_exists and wildcard/regex
Ashley Sheridan wrote: > If you're on a Linux system, you could look at ls and the regular > expressions it lets you use with it. You could exec out and get the > returned results. Also, as it's a system call, it should be very > speedy. 'ls' is just a plain binary (/bin/ls), not a system call. The regex functionality is part of the shell, usually bash. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach and destroying variables for memory saving
Tim | iHostNZ wrote: > Somewhere i also read that one can save a lot of memory by destroying > variables. Is that done with unset, setting it to null or something > similar? unset() > So, i take there is no garbage collection in php? I've never > actually looked at the c source code of php. Maybe its time to > actually do that. But it might be easier if someone can answer this > from the top of their head. There is no real need - most PHP code runs in apache with each request being separately initated and terminated. There's no underlying runtime manager as such. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Form email w/attachment
jeffery harris wrote: > I need to create a php form and mail it to a recipient (that I can > do). My question is how do I create an area for a file (.doc, or .pdf) > to be attached emailed along with other form data as well? > Take a look at an email you've received with an attachment. That's how you need to format your email-text. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Read/decode barcodes from an image
Adam Randall wrote: > I'm amazed that this either doesn't exist, or is hard to find. I > basically am looking for a way to read in an image into PHP, or shell > out to something on the Linux side, and determine, and see if it has a > barcode in it or not. If it does, I need to decode the barcode so that > I can identify the page as a separator page or not. > > Basically, what I'm doing is reading in a PDF or TIF which will > contain multiple pages (probably a lot of pages) and look for a page > containing a barcode. The barcode will identify the page as a > separator page which will be used to split the multipage document into > smaller single or multipage documents. > > Has anyone ever heard of anything that might help me in this process? I can't say for certain, but have a look at zebra: http://zebra.sourceforge.net/ Looks like the sort of thing you could use. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] utf8 php howto?
Daniel Kolbo wrote: > Hello, > > I have a text file encoded in utf-8. > i am using fopen/fgets/echo etc.. > > how do i display these utf8 characters from the file on the web? > header("Content-Type: text/html; charset=utf-8") readfile(your-utf8-file); /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] utf8 php howto?
c...@l-i-e.com wrote: > In some circumstances, with "mixed" charsets on a page, and with IE > in quirks mode, IE will try to "guess" the charset and get it (very) > wrong. A single page or response can only have one characterset, there is no mixing possible. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] filter function vs regular expression
Nathan Nobbe wrote: > to elaborate, in general, the filter extension should be faster than > corresponding preg_* calls from user space. why? b/c, they > essentially are compiled calls to pcre (in many cases) There is no or only the tiniest little difference - AFAICT preg_match and the filter extension both use the same regex caching mechanism. If the regex has not been compiled, the first call will compile it, subsequent calls will use the already compiled regex. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Replacing special characters with their HTML equivalents
James Colannino wrote: > Hey everyone. I have a question. I have a web scraper that grabs > information from web pages that often contain characters such as > vowels with umlots (I know I spelled that wrong.) > > The data is editable, so the characters show up unmodified in an > editable text box. However, when I try to import the data into a > MySQL database, the first occurrence of such a character, along with > the rest of the string, is truncated from the result. Your mysql table will have a characterset attribute - if what you're inserting doesn't match, it will complain. If converting with htmlentities() works for your purpose, that's one solution, otherwise I'd make the mysql table use UTF8 and then look into iconv to convert all scraped pages to UTF8. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
c...@l-i-e.com wrote: > > I often thought PHP would be a nice language for a MUD, if one could > get the performance out of it... Design your code such that you can just throw more hardware at it whenever you need more performance. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] =.='' what wrong ? just simple code, however error.
LKSunny wrote: > $credithold = 100; > for($i=1;$i<=1000;$i++){ > $credithold -= 0.1; > echo "$credithold"; > } > //i don't know why, when run this code, on 91.3 after expect is 91.2, > however..91.2001 > //who can help me ? and tell me why ? It's a floating point rounding error. If you don't need the accuracy, just round it to what you need. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
c...@l-i-e.com wrote: > >>> I often thought PHP would be a nice language for a MUD, if one could >>> get the performance out of it... >> >> Design your code such that you can just throw more hardware at it >> whenever you need more performance. > > That's easily said, but a MUD means all the users have to share a > significant portion of your data model. That's fine - there are many well-known schemes for distributing and updating such data. > Though I suspect the bandwidth issue would be the main bottleneck most > of the time... > I don't want to get into this in much detail, mainly because I've > spent all of 5 minutes seriously thinking about it, and may just need > more bake-time... > But it's not ALWAYS that easy to architect something to be > "shared-nothing" even with PHP. It's not easy in any language, but if your key concern is the performance of PHP (as a language), hardware is what you need. You can design your software to run on a single box with lots of CPU cores, or you can go for a distributed (and more easily scalable) approach. If you don't need/want straight scalability, go for the 32 cores all ticking at 3GHz. Once that is saturated, buy another one. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
Robert Cummings wrote: >> >> It's not easy in any language, but if your key concern is the >> performance of PHP (as a language), hardware is what you need. You >> can design your software to run on a single box with lots of CPU >> cores, or >> you can go for a distributed (and more easily scalable) approach. If >> you don't need/want straight scalability, go for the 32 cores all >> ticking at 3GHz. Once that is saturated, buy another one. > > If you go multi core then you need to go with a threaded approach... > which makes the development a bit complex for newbies to MUD > development. 'c...@l-i-e.com' doesn't seem like a newbie to me, but you're right, it would be a complex job for a newbie. Nevertheless, given todays machines where even laptops have multiple cores, I would certainly design any new performance-critical application for multi-threading. (Multi-threading in PHP is a challenge in itself, and I wouldn't choose PHP for such a job, but that's a different story). > I don't think I'd go distributed since people whine about > lag that takes a 1/4 second... distributed would inherently require > more time while messages are passed to and fro. That is perhaps a valid consideration, but isn't it easily dealt with by using gigabit ethernet or infiniband or something similar? The distributed vs. one big monolith discussion is also a matter of space, cooling, electricity etc. The big monolith is easier to deal with, but also carries a different pricetag. The many machines can be gradually expanded at a lower cost, but need much more in terms of infrastructure. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encryption/decryption of PHP data
Edward Diener wrote: > Phpster wrote: >> In reading the license I believe it refers to the gnupg itself, not >> the application it may be embedded in. You are completely free to use >> gnupg as you choose including modifying it to meet your needs. > > I always thought the GNU public license demanded that any non-free > modules, which use any software distributed with this license, make > their source code freely available to end users. If this is either not > the case or no longer the case, then I will be glad to use GnuPG. If you are distributing or selling your non-GPL software and you use GPL software with it, then yes, I believe you are required to make your source code available to the end-user too. Maybe have a quick look at http://gpl-violations.org/ /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
Luke Slater wrote: > Well the current system runs of a 20MB internet connection in London, > seeing as that's the UK that about 2MB. > > It runs fine, responses are snappy even dealing with loads of users. > > This, however, is written in C: does PHP have that much of an overhead > so that bandwidth is actually that much of an issue? > The implementation language does not affect your bandwidth requirements at all. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
Luke wrote: > The current system also uses some kind of strange text based database, > I was wondering if using MySQL for the database would slow it down too > much? > It depends on the type and mix of transactions, but based on the information available, I don't think MySQL will slow it down too much. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
Robert Cummings wrote: > 'c...@l-i-e.com' isn't the original poster, I was speaking generally... I thought he was the one to bring up his concern about PHP and performance - I could be wrong. >> That is perhaps a valid consideration, but isn't it easily dealt with >> by using gigabit ethernet or infiniband or something similar? > > We're talking about a text-based MUD here... it's unlikely the user > has the will to spring for such resources for this endeavour. I guess my ignorance or age (or both) is showing, I have no idea what a "text-based MUD" is. I thought we were talking some network gaming engine a la WoW and such. I still think my initial response was appropriate though - if PHP as a language is a performance concern, it's best solved by throwing more hardware at it. If that is not an option, don't use PHP. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encryption/decryption of PHP data
Edward Diener wrote: >> why not just use https protocol. all data between client and server >> will be encrypted. > > The data must be encrypted/decrypted going both ways between the > client and the server. Does using https automatically do that ? If it > does that would be great. > Yes, that is exactly what https does. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can a script tell if there's a MySQL problem?
Brian Dunning wrote: > I have one server that's pretty busy and runs into "Too many > connections" from MySQL from time to time, and needs to have MySQL > restarted to clear it up. You need to restart MySQL just because of too many connections?? > I've tried everything I can think of to have PHP take note of this > error but continue executing with other stuff, but no matter what I > try the PHP script stops whenever it encounters this and just displays > "Too many connections." Isn't that error returned by mysql_connect()? Just write your code to work without the database connection. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can a script tell if there's a MySQL problem?
Nathan Rixham wrote: > Bastien Koert wrote: >> 1. Make sure you are freeing up all resources as soon as you can -> >> mysql_close(); >> > > little thing I've done for some time that's stuck with; (php5+ only) > > on all of my database connection classes, I have the db close function > in the destructor just to make sure I guess it depends on the type of application - for a web-transaction running on a web-server, why bother? It'll clean up after itself anyway. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can a script tell if there's a MySQL problem?
Per Jessen wrote: > Nathan Rixham wrote: > >> Bastien Koert wrote: >>> 1. Make sure you are freeing up all resources as soon as you can -> >>> mysql_close(); >>> >> >> little thing I've done for some time that's stuck with; (php5+ only) >> >> on all of my database connection classes, I have the db close >> function in the destructor just to make sure > > I guess it depends on the type of application - for a web-transaction > running on a web-server, why bother? It'll clean up after itself > anyway. Actually, for reusable code intended for others to use, it might just be a safe precaution. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Create image from HTML
Daniel Brown wrote: > You can use xvfb (X Virtual Frame Buffer) on *NIX systems without > running X itself, a stripped down Mozilla navigate to and display the > page, and then snap a "screen" shot of the buffer. Not very > economical, but it would work. I did just that a while ago, it worked pretty well AFAIR. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opinions / Votes Needed
Tony Marston wrote: > If you really *need* to used a staticly typed language then don't use > PHP, and don't try to change PHP to match your needs. +1 /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opinions / Votes Needed
Nathan Rixham wrote: > Tony Marston wrote: >> >> If you really *need* to used a staticly typed language then don't use >> PHP, and don't try to change PHP to match your needs. > > why not? Because your desired functionality is already satisfied by other programming languages. PHP is an interpreted language with all the strengths and weaknesses that come with it. A need for static or compile-time typing is a need for a different language, honestly. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opinions / Votes Needed
Nathan Rixham wrote: > Per Jessen wrote: >> Nathan Rixham wrote: >> >>> Tony Marston wrote: >>>> If you really *need* to used a staticly typed language then don't >>>> use PHP, and don't try to change PHP to match your needs. >>> why not? >> >> Because your desired functionality is already satisfied by other >> programming languages. PHP is an interpreted language with all the >> strengths and weaknesses that come with it. A need for static or >> compile-time typing is a need for a different language, honestly. >> >> >> /Per Jessen, Zürich >> > > why so strongly against having *optional* static typing? > You can't have your cake and eat it. You can't/shouldn't have strong and loose typing in the same language. In my opinion. > IMHO if it was to classify all the languages (specifically server side > languages for web apps), PHP has 95% of the features i need, the rest > come no where near, so it's the obvious candidate to get this > remaining 5% that'd make it perfect and open it up to a whole set of > new users and markets. _If_ the remaining 5% will really "open it up to a whole set of new users and markets", all you have to do is sit back and wait. I'm not so sure though. One of the great things about PHP is that it is easy and approachable for beginners, also without formal computer science training. Write some code, bang it in a webserver, and bob's your uncle. If we make PHP more complex, we might well lose that. By all means create a PHP++, but leave PHP as it is. It has enough "feature"-bloat already. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opinions / Votes Needed
Nathan Rixham wrote: > point is.. > Java let's me easily do 70% of what I need to > PHP let's me easily do 95% of what I need to > I'm curious - can you list what the 25% are? > If we could get that 5% added then PHP would be perfect, not only that > but me and the rest of the team at work would be able to make our > multi-million pound enterprise projects in PHP instead of java; as > would so many others (that can't be a bad thing for PHP) But why? Why not use Java and J2EE and all that good stuff? I'm not much of a java fan myself, but you've got to give credit where credit is due. > Additionally, rather sure you'd see a mass influx of people moving to > php, and applications created for it - even down to design tools such > as reverse and forward engineering between uml and php. > > ack.. there's a tonne of amazing tools and frameworks for java, and > I'm sure that a vast majority of them are possible because of this > static typing (from orms to web service frameworks and all in between) > - am I so bad for wanting that for php and my fellow devs? No, you're not so bad :-) The point is - why not just use Java, when you really need the features? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opinions / Votes Needed
Nathan Rixham wrote: >> You can't have your cake and eat it. You can't/shouldn't have strong >> and loose typing in the same language. In my opinion. > > "Instead of providing programmers with a black or white choice between > static or dynamic typing, we should instead strive for softer type > systems. That is, static typing where possible, dynamic typing when > needed. Unfortunately there is a discontinuity between contemporary > statically typed and dynamically typed languages as well as a huge > technical and cultural gap between the respective language > communities." I'm not sure whether to take you seriously now - you're quoting from a Microsoft research paper? :-) >> By all means create a PHP++, but leave PHP as it is. It has >> enough "feature"-bloat already. > > you do have a good point, I've thought that myself often and indeed it > was brought up in the namespace discussions - however if it's optional > then why fork? Because it would be such a major change (as Tony has also pointed out) - ones PHP code would work with "php -normal", but would fail miserably with "php -strongtyping". In essence, with your optional strong typing enabled, you'd have a different language. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opinions / Votes Needed
Nathan Rixham wrote: >>> If we could get that 5% added then PHP would be perfect, not only >>> that but me and the rest of the team at work would be able to make >>> our multi-million pound enterprise projects in PHP instead of java; >>> as would so many others (that can't be a bad thing for PHP) >> >> But why? Why not use Java and J2EE and all that good stuff? I'm not >> much of a java fan myself, but you've got to give credit where credit >> is due. > > well I can give two examples: > Three other PHP Developers and myself spent the best part of a year > creating a large multi-site event management system in PHP; the whole > process was deeply frustrating primarily due to the lack of optional > static typing and there in the lack of a solid ORM; with this small > addition the whole process would have been a 6 month process if that, > and a far more pleasurable experience. I think that's at best an example of someone having chosen the wrong tool. I can easily appreciate the frustration. My own rule-of-thumb - scripts are for small things and rapid prototyping. Once when a script (regardless of language) grows towards 1000 lines, start thinking about writing it in C (or whatever else is appropriate). I know of too many situations where thousands of lines of script code have turned into maintenance nightmares. > Currently 7 other Java developers and myself are building a large > multisite transportation management and ticketing system in Java, this > is a 9 month project with a decent sized and very skilled team; > because of the lack of static typing (and thus the lack of development > tools and frameworks/orms for PHP) we've had to go with Java; TBH the > static typing is only needed on the domain model and the api layer, > the bulk of the business logic in between where the majority of the > work comes in, would be a great deal easier using a mix of procedural > code and dynamic typing. I'd argue that again the development time of > this project could be halfed if it was done in PHP AND if in PHP had > support for optional static typing coupled with a good ORM. First of all - development time is largely irrelevant, Nathan - I think the standard rule is that program lifetime = 25% development time + 75% maintenance time. Second - instead of discussing optional strong typing for PHP, I think you need to look at why your productivity in Java is only half of that of PHP. Your tools for Java development are far more sophisticated, you've got the strong typing you want - what's reducing your productivity? > Further the difference between precompilation and interpretation is v > noticable when it comes to rolling applications out, often in > development you want to run a hlaf built or broken application to see > what happens and check if parts x y and z are good + to test your > infrastructure; when you can't compile and do this testing becuase the > app isn't bug free or completed it's rather limiting. Sometimes unit > tests just don't cover what you need. I agree. You need a full blown test system. That is pretty much the norm in a corporate environment - I've certainly never worked anywhere that didn't have separate test systems. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opinions / Votes Needed
Nathan Rixham wrote: > Per Jessen wrote: >> Nathan Rixham wrote: >> >>>> You can't have your cake and eat it. You can't/shouldn't have >>>> strong >>>> and loose typing in the same language. In my opinion. >>> "Instead of providing programmers with a black or white choice >>> between static or dynamic typing, we should instead strive for >>> softer type systems. That is, static typing where possible, dynamic >>> typing when needed. Unfortunately there is a discontinuity between >>> contemporary statically typed and dynamically typed languages as >>> well as a huge technical and cultural gap between the respective >>> language communities." >> >> I'm not sure whether to take you seriously now - you're quoting from >> a Microsoft research paper? :-) > > lol well picked up - for all I'm a linux fan M$ aren't all bad and > hell they must have some very good programmers in the various teams, > seems a shame to invalidate thier hard work and research just because > they work for satan. Completely agree, I just thought I'd score an easy point ... /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opinions / Votes Needed
Eric Butera wrote: > On Sun, Jan 18, 2009 at 11:44 AM, Per Jessen wrote: >> I think that's at best an example of someone having chosen the wrong >> tool. I can easily appreciate the frustration. My own rule-of-thumb >> - scripts are for small things and rapid prototyping. Once when a >> script (regardless of language) grows towards 1000 lines, start >> thinking about >> writing it in C (or whatever else is appropriate). I know of too >> many situations where thousands of lines of script code have turned >> into maintenance nightmares. > > Sorry to deviate from the thread, but I wanted to talk about this > point for a second. Are you serious? Do you write php extensions for > every app and have tons of them on your server? Yes, I am serious, and no, I don't write php extensions etc. I don't write many web apps anyway. I do use PHP quite a bit for command line stuff, in fact for >95% of my scripts. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 64bit vs. 32bit
dbrooke wrote: > Hello, > I am interested in hearing opinions about if there > are reasons to stay with a 32bit php/apache if there > is 64bit options available. What are the pros/cons > in running in the different architectures? Unless you 1) have lots of RAM (e.g. 16Gb or more) that you need to utilize efficiently or 2) your processing is very CPU-bound, e.g. scientific or graphics code. you won't gain anything by moving to a 64bit OS/Apache. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirecting from unreachable page on website
Dušan Novaković wrote: > Hi, > > Is there some elegant solution how to redirect if someone try to open > some non existing page (e.g www.domain.com/nonexistingpage.php) to > main page www.domain.com on website? > See Apache "ErrorDocument" directive. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirecting from unreachable page on website
Richard Heyes wrote: >> ... > > Really, for URLs that don't exist you should be showing a 404, This > way the user doesn't falsely believe that the URL is a valid one and > keep using it. By using the ErrorDocument directive like Per > suggested, you can customise it to be distinct helpful Apache also comes with a good example of how to cobble that with content negotiation to present error documents in the users preferred language. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirecting from unreachable page on website
Morris wrote: > What if the file exists, but it's kinda file to update database, like > > // get request $_REQUEST > // execute sql statement to update database > // redirect to the other page, showing results? > > in this case 404 approach does not mean to do correctly, so what else > is suggested? I would use a 303 redirect, just like after processing a POST. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] process creation
bruce wrote: > A simple question (or so I thought). > > Does php allow an app to create/start a process/application that can > continue to run on its own, after the initiating program/app > terminates? Generally yes, but it's partially up to the spawned process to completely detach itself. > It appears that the spawning/forking functions might work, but the > child apps would be in a zombie status, and couldn't be killed by an > external program. I'm not sure, but I think there's something wrong if you can't kill them with a -9. > Basically, I'd like to create a bunch of test apps/processes, and then > to be able to kill them by a separate process if the apps take too > long to run.. Why not put a timer in each individual process? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: process creation
Török Alpár wrote: > as i said it's hate here, and i might be wrong but consider the > following : > > for($icount=0;$icount<11;$icount++) > { > $iPid = pcntl_fork(); > $iChildrenCount = 0; > if ($iPid == 0) > { > // child > echo ("child $icount\n"); > } > else > { > // parrent > } > } > > this is essential what you do in your example? If so, this code does > not start 10 children. It starts more. Thats right - with the code above, each new child will continue creating more processes. To get exactly 10 children running the same code: if ($iPid == 0) { // child echo ("child $icount\n"); // do childish stuff // then exit exit; } /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php error
mattias wrote: > ERR_DB_NO_DB_PASS >What will this meen? No database password has been set in config. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: process creation
Tom Sinclair wrote: >> Per Jessen wrote: >> >> for($icount=0;$icount<11;$icount++) > > Iterates 10 times?? > Hmm 10, 11 - no big difference is there? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] best practice wrt multi-lingual websites, gettext() etc.
I am writing a small(ish) site which will eventually need to be available in several different languages. This needs to more or less transparent to the user, so I am using Apaches content negotiation features, which is working very well. The issues arise once I start looking at PHP and Javascript code. I use JS for client side input (pre-)validation and increased usability, and error messages and such will obviously need to be language-sensitive. The same goes for the PHP code. With PHP, I've got gettext() for this sort of job, with javascript and some DHTML, I don't seem to have many options. One of my key concerns is - for the translation, I need to be able to wrap everything up and ship it off to a translator, perhaps via elance or similar. Does anyone have any best practice suggestions or comments in general? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.
Richard Lynch wrote: > I can't help with the bits you are asking about, but I can give this > advice: > > Don't rely solely on the Apache/browser content-negotiation, please. > Don't worry, the site already has a user-override option. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple queries in PHP
Ashley Sheridan wrote: > I've run into a bit of a problem. I put together a query using mysql > variables in the form set @m:= 0; with the select that uses it > directly after. For any wondering, the select was using it as an > incremental value which can't be hard coded, as the value will depend > on the ordering of the results of the query itself. > > The problem seems to be that while phpMyAdmin would execute this > double query perfectly well, php using mysql_query() was having > problems, as apparently it can't actually run multiple queries. I don't know about the PHP mysql_query(), but the MySQL C API works fine with multiple queries, it just has to be specifically enabled - the default is one query per call. However, it looks like the multiple query option is not supported by PHP: http://php.net/manual/en/mysqli.real-connect.php "For security reasons the MULTI_STATEMENT flag is not supported in PHP. If you want to execute multiple queries use the mysqli_multi_query() function." /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.
Phpster wrote: > Dunno if it's a best practice, but I store all the translations in the > db for easy manipulation and extraction to a file for others to > translate. That obviously involves both import and export utilities. Hi Bastien interesting - does this mean you're also coding for language-awareness yourself? I mean, you must have your own gettext() functionality? > A number of pup apps take the approach of storing the label > translations in variables inside language folders ( phpmyadmin has > this ). That is also not a bad approach but is slightly slower and I > can't help but feeling that serving up a static page created by code > is a better solution. That's part of what we're thinking of doing, but it's difficult to separate the language and code completely. Which is where gettext() comes in. Does anyone on this list use gettext() ? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.
Bastien Koert wrote: > No, as all of our users have to authorized to use the app, we store > the desired language in a field in the user record. However, we also > supply functionality via a drop down to allow the user to change the > language if desired. Okay, that's very similar to my approach. For first-time users (of which I will have a lot), the language is set by their browser's language setting. Most users won't be changing it. > I agree its difficult to separate the language and the code, but if > you create xslt / html files for each language then its a much simpler > matter, and far less resouce intensive, to direct the user to that > page in their desired language. I leave that to Apache and the 'prefer-language' environment variable - I guess my main issue is to do with e.g. error-messages from PHP code ("please complete this field correctly" etc) and from javascript ditto. I guess for error-messages, it's back to gettext(), which does make some sense. > Again, you and just use PHP and handle the labels and option (drop > downs, radios etc) variables in real time but I never see the point > in doing the same thing over and over again when its much cleaner (if > more management intensive) to direct the user to a static resource > and pass in an XML string with the data in it. Totally agree. > At work, we don't use gettext() since : > a) its an classic ASP shop ( :-( ), therefore no Linux and no PHP Ah. :-) > b) the db current doesn't support multi-byte charsets > The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.
Jan Kaštánek wrote: > Per Jessen: >> >> The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper. > > It supports. We use it. But only in MsgStr (translation), not in MsgId > (original strings). > Yeah, I found out too. (from the GNU gettext docu). /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New to PHP question
Don Collier wrote: > First, when I use the \n and run the script from the command line it > works great. When I run the same code in a browser it does not put > the newline in and the text runs together. I know that I can use > to do the same thing, but why is it this way? That's how HTML works. > The second question is closely related to the first. When formatting > text using printf the padding works great when running from the > command line but not at all when in a browser. Same answer. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New to PHP question
Don Collier wrote: > From what I am seeing in the responses if I plan on using php for > command line scripts things get written one way. If, on the other > hand, the php is written for a web page it gets written a slightly > different way inserting html where necessary for formatting. No, the scripts are written the same way, but you are using two different output media, so your output must be different. Like Stuart said - if you want your browser to output in text-mode, just set the right header-type. (text/plain). /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extract code from XML
Angelo Zanetti wrote: > Hi all, > > I have the following snippet of XML: > > Code: > > > > > > > > I need to get the Code for the item, IE get the value "AME" from the > XML. I am using PHP5 and the following code which I can extract the > value of the Item: "AMERICAN". > > PHP Code: > > $hotelElements = $xpath->query( 'HotelDetails/Hotel', > $searchHotelPriceReponseElement ); > > foreach( $hotelElements as $hotelElement ) { > > $item = $xpath->query( 'Item' , $hotelElement ); > > > > I know you can use an @ sign but I am not 100% sure. Yes, you use an '@' to retrieve attributes of an element. query( 'HotelDetails/Hotel/@Code' /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Extract code from XML
Angelo Zanetti wrote: > Thanks Per but I didn't send all the XML but you see that there is a > city code and an item code: > > > > > > > How would I get the Item code then? Based on your answer above? > Hi Angelo this should work: query( 'HotelDetails/Hotel/Item/@Code' ... /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail subject encoding problem
Thodoris wrote: > I am having a FreeBSD web server for development that is working like > a charm when sending mail using something like this: > > // Define the e-mail content > $email = "f...@foo,com"; > $subject = "H εργασία: (id: 1868) έκλεισε χωρίς σχόλια."; > $message = "Αυτό είναι ένα τέστ. Αυτό είναι ένα τέστ. Αυτό είναι ένα > τέστ."; // $subject = mb_encode_mimeheader($subject,'iso-8859-1','B'); > > The language in both subject and mail body is Greek. But when I am > uploading this to a Linux CentOS 5.2 server this mail is being sent > but the subject is rubbish. > All encodings are in UTF-8 (the php file, the encoding of the mail > client etc) so to solve this I have added the mb_encode_mimeheader > line. But for some reason you've specified ISO-8859-1 instead of UTF-8? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail subject encoding problem
Thodoris wrote: > >> But for some reason you've specified ISO-8859-1 instead of UTF-8? >> >> >> /Per Jessen, Zürich >> > > Yes I know that this is not reasonable but using UTF-8 fails. Fails _how_? Put up the resulting email somewhere for us to see. (the raw email text). If your source files are UTF-8, you need to specify UTF-8 when you mime-encode the headers for email. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Enclosing Tags? Do You Close Your PHP Declarations?
Nitsan Bin-Nun wrote: > I was just wondering whether people enclosing their PHP tags > declarations, I don't close these interpreter doesn't really needs them, > and for the second reason - if a space/tab/new line/etc will beneath > them it will cause > problems with output buffering and session handling. > > Do you close your PHP http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mutiple SQL request
Jônatas Zechim wrote: > Hi there, i've a system that do a query each 3s, does it impact on > mysql Server? I mean, can this slow my Server? Probably not - if the query and the database doesn't change in between, the results are cached. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Where does the sendmail() function come from?
A while back someone mentioned that I could use the sendmail() function like this: sendmail(envelope-from,envelope-to,mailtext) I'm now in the process of moving a site to a new webserver, and for some reason I haven't got a sendmail() any more. I can't find a reference to it in the manual, so where does it come from? thanks Per -- Per Jessen, Zürich (2.87°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where does the sendmail() function come from?
Richard Heyes wrote: >> A while back someone mentioned that I could use the sendmail() >> function like this: >> >> sendmail(envelope-from,envelope-to,mailtext) >> >> I'm now in the process of moving a site to a new webserver, and for >> some reason I haven't got a sendmail() any more. I can't find a >> reference to it in the manual, so where does it come from? > > Presumably it's either undocumented or user defined. > get_defined_functions() will help you in determining that. Thanks Richard - it was my _own_ function . think I shouldve stayed in bed today. /Per -- Per Jessen, Zürich (5.43°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Appending query result sets?
Skip Evans wrote: > Oh, yeah, that's fine. I knew I could od it with arrays, but > also looked to see if there was any way to just do an append, > and I also need to sort them as well, so maybe I better get > back to figuring out a join. Just add asort() to what Ashley suggested. The thing to keep in mind - what mysql_query() returns is NOT a result-set, but a handle or an oblique reference to one. The only way to access it is with mysql_fetch_*(). /Per -- Per Jessen, Zürich (-0.32°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP OOP
tedd wrote: > I lean toward C++ because I wrote in it for a few years AND C++ > appears to be the most common, widespread, and popular OOP language. I would agree, although I suspect Java is also a good candidate. > However, while I don't know PHP OOP, I am open to considering it > because of the proliferation of web based applications. Don't - compile-time type checking is essential to OOP. > My personal opinion is that's where all programming is headed anyway, > but that's just my opinion. Which you're certainly entitled to - I just can't quite see the Linux kernel or bind or an audio driver written as a web-app :-) /Per -- 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] PHP OOP
tedd wrote: > I lean toward C++ because I wrote in it for a few years AND C++ > appears to be the most common, widespread, and popular OOP language. I would agree, although I suspect Java is also a good candidate. > However, while I don't know PHP OOP, I am open to considering it > because of the proliferation of web based applications. Don't - compile-time type checking is essential to OOP. > My personal opinion is that's where all programming is headed anyway, > but that's just my opinion. Which you're certainly entitled to - I just can't quite see the Linux kernel or bind or an audio driver written as a web-app or in php :-) /Per -- 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] PHP OOP
Paul M Foster wrote: > PHP is *not* a good example for OO. There are a lot of OO principles > it doesn't follow. > > I would have suggested Smalltalk, the original OO language, except > that no one uses it any more, and other languages don't necessarily > fully implement OO as done in Smalltalk. You're right about using a > language which implements OO in a realistic way for today's > programmers. Depends exactly what Tedds class is meant to be - whether it's about programming or computer science. For the latter, Eiffel is also a good OO language. /Per -- Per Jessen, Zürich (1.9°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating A Unique List With Table Query
revDAVE wrote: > Newbie question > > Hi Folks, > > I would like to be able to query a table, and return only the unique > values from a particular field. For example: to get all contents from > the category field from the contacts table: > > Query = > > SELECT Category FROM contacts > > But this will produce many duplicates. > > Question : How do I filter the query to only produce unique values? SELECT DISTINCT Category FROM contacts -- 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] (Perl) Regular Expressions - oposite match or get the non-matches of a substring
German Geek wrote: > I consider myself quite good with Regular Expression, but i could > never find out how to match something like: > > "match this but not this and that" > > so i would like to match the first "match this" (or "another this") > but not "not this". > > Seems pretty straight forward but i haven't found a (good) solution > yet. Check out "look-around" (-behind, -ahead), here for instance: http://www.regular-expressions.info/refadv.html > Surprisingly i couldn't figure out how to say '/!(not) this/'. Seems !/this/ /Per -- Per Jessen, Zürich (0.4°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sprintf thousand separator.
chris smith wrote: > 2009/2/11 João Cândido de Souza Neto : >> Hello everybody. >> >> I´d just like to know if there´s any way of defining a thousand >> separator to a currency value using sprintf. > > Use number_format instead of sprintf, it's designed to do what you > want. > I wonder why number_format() isn't locale sensitive? /Per -- Per Jessen, Zürich (2.4°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can an elephant count for nothing?
Clancy wrote: > While PHP has a lot of nice features, it also has some traps which I > am forever falling into. One which I find particularly hard to > understand is how mixed mode comparisons work. For instance > > $string = 'elephant'; > If($string == 0) returns true; > If($string != 0) returns false; > If($string === 0) returns false; > > I know that in this case I should use 'If($string == '')', but I still > manage to forget. Can anyone explain clearly why comparing a string > with zero gives this apparently anomalous result? I'm not certain, but I suspect it's because the interpreter attempts to convert "elephant" to an integer first. /Per -- Per Jessen, Zürich (-0.6°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinions needed
Al wrote: > I'm scripting a light-weight, low volume signup registry for a running > club. Folks sign up to volunteer for events and the like. There will > generally be a handful of signup registries at any one time. A typical > registry will only contain 50 to 100 names. Each registry is only in > existence for a month or so. > > I really don't see the advantage of using a real DB [e.g., mySQL,] for > this. Don't need any special searching, etc. You might as well just go with MySQL. It'll make it a lot easier both to start with and in the long run. -- Per Jessen, Zürich (-1.0°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fork/spawnzombie question
bruce wrote: > Hi Nathan/Torok... > > Hey guys... got a bit of a question. > > I'm playing around with the php/for/pcntl_exec functions and I've got > a process that spawns off a bunch of child processes. Unfortunately, > I'm getting to where I have 100's of zombie child processes that I can > see from the linux/processTBL. > > I don't want to have my master loop do a waitpid() call, as it would > block on the wait for one of the child processes to exit. No, it wouldn't - just use WNOHANG: pcntl_waitpid( -1, $status, WNOHANG ); /Per Jessen -- 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] for the security minded web developer - secure way to login?
Michael A. Peters wrote: > German Geek wrote: > > > What do you think? > > I think just use a flippin' ssl server and be done with it. > That was my thought too. > You can use SSL for the login and only the login - I know that it > means either using a self signed cert or paying big bucks, for > anything with e-commerce you want to pay big bucks for a cert, there > is no other option. http://www.cacert.org/ /Per -- Per Jessen, Zürich (0.2°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++
Sancar Saran wrote: > Hello list. > > Recently we had some serious discussion on local boards. > > I prefer calling PHP as Web Framework of C and C++ > PHP is a scripting language with syntactical roots in C. /Per -- Per Jessen, Zürich (-3.5°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Full versus relative URLs
Paul M Foster wrote: > Here's a question related to my last post. When specifying a link in a > HTML file (like to the css or an image file), there are two ways of > doing it. One is to simply include the relative path to the file > (relative to the doc root), like: > > /graphics/my_portrait.gif > > Or you can include the full URL, like: > > http://example.com/graphics/my_portrait.gif > > My casual observation seems to indicate that the former will load > faster than the latter. But has anyone done any benchmarking on it? There is no difference - the browser will resolve relative URLs to absolute URLs before issuing the HTTP GET. /Per -- 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] E-Mail Attachment Filename Encoding Problem
Edmund Hertle wrote: > my problem is that I send an e-mail with an attachment (pdf file). I > get the filename out of a mysql table. While using echo or downloading > the file, the filename is showed as expected but as an attachment it > is not properly encoded: > Should be: PC-Beschaffung 2008 (nur für Lehre) > Will be: US-ASCII''PC-Beschaffung%202008%20(nur%20f%C3%BCr%20Lehre) > > I think I have to encode the file name and already tried utf8encode > but this didn't help. I think you need to mime-encode it - mb_encode_mimeheader(). I haven't tried it with attachments though. /Per -- Per Jessen, Zürich (0.7°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: for the security minded web developer - secure way to login?
Colin Guthrie wrote: > Yeah the cheap CA's are IMO actually a problem. > > I (personally) think we should have a new system for this scenario: > > http:// = totally insecure > https:// = secure and to a reasonable degree of trust (e.g. no $12.00 > certs!) > httpus:// = secure but no aspect of trust. Colin, I think you're mixing apples and oranges here - http(s) was never meant to provide any indication of "trust". Besides, how do you suggest we distinguish between CAs "with no trust" and CAs "with trust"? /Per -- Per Jessen, Zürich (1.1°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E-Mail Attachment Filename Encoding Problem
Carl-Fredrik Gustafsson wrote: > To me it looks like he only wants the spaces and special-chars in the > filename to be "readable" again. Yep, I think so too. Spaces are no problem, but 8-bit characters need to be encoded. /Per -- Per Jessen, Zürich (1.2°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Reverse IP lookup
Lewis Wright wrote: > This may be a little more accurate: > http://www.domaintools.com/reverse-ip/ > Yep, than one was a lot better than yougetsignal. /Per -- Per Jessen, Zürich (0.7°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Files redirect - using PHP and .htaccess
Martin Zvarík wrote: > AHA, from what I've just read, the .htaccess is server-side, so the > client won't know the real directory. > > Can somebody confirm? Unless you do an external redirect, confirmed. /Per -- Per Jessen, Zürich (0.6°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: for the security minded web developer - secure way to login?
Colin Guthrie wrote: > I appreciate that https doesn't provide "trust" by default, but > ultimately that's how Joe Bloggs public has been told to deal with it > "look for the padlock" etc. etc. to be sure that your session is > secure blah blah. Yeah. Which is probably because all of the intricacies are way beyond Joe Bloggs, so the issue was cut down to something about "trust". > Now with the HV certs the UI also has the company > name in the URL and this *is* going towards a trust infrastructure. I googled, but couldn't find anything - what are HV certificates? /Per -- Per Jessen, Zürich (0.6°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Free XML and WDL classes/scripts
Anton Heuschen wrote: > What are some good php classes/scripts to work with: > > Parsing XML data/files. xpath() or xslt. /Per -- Per Jessen, Zürich (-4.6°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php