Re: [fw-general] Re: [zf-contributors] ZF tools and SVN going offline briefly
On 03/17/2011 11:23 AM, Martin Roest wrote: Hi, matt...@zend.comwrote: We've migrated to the new data center, and public DNS has been updated. At this time, if you still cannot access the tools, likely you simply need to wait for your DNS to update. Subversion is reachable but now I get this: iSmartie-2 ~/zyzou/shared/library/Zend$ svn up svn: Repository UUID '1589e24e-76c8-4bf2-8f94-c092ebc2bf4e' doesn't match expected UUID '44c647ce-9c0f-0410-b52a-842ac1e357ba' Is this just me or did someone forget to correct the svn UUID after migration. Regards, same here svn up . svn: UUID du dépôt source '1589e24e-76c8-4bf2-8f94-c092ebc2bf4e' différent de celui attendu '44c647ce-9c0f-0410-b52a-842ac1e357ba' -- Bruno Friedmann Ioda-Net Sàrl www.ioda-net.ch openSUSE Member Ambassador GPG KEY : D5C9B751C4653227 irc: tigerfoot -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] Re: [zf-contributors] Re: [fw-general] Re: [zf-contributors] ZF tools and SVN going offline briefly
On 03/17/2011 03:15 PM, Matthew Weier O'Phinney wrote: For those who have NOT updated their repo to the new UUID, can you please try pulling now? If you still have issues, please contact me. For those who updated their repos already, my apologies... -- Matthew Weier O'Phinney matt...@zend.com wrote (on Thursday, 17 March 2011, 08:41 AM -0500): -- Martin Roest mar...@ibuildings.nl wrote (on Thursday, 17 March 2011, 11:23 AM +0100): matt...@zend.comwrote: We've migrated to the new data center, and public DNS has been updated. At this time, if you still cannot access the tools, likely you simply need to wait for your DNS to update. Subversion is reachable but now I get this: iSmartie-2 ~/zyzou/shared/library/Zend$ svn up svn: Repository UUID '1589e24e-76c8-4bf2-8f94-c092ebc2bf4e' doesn't match expected UUID '44c647ce-9c0f-0410-b52a-842ac1e357ba' Is this just me or did someone forget to correct the svn UUID after migration. I ran into this yesterday at the end of the day as well, and I'm looking into it. The reason for the different UUID is two-fold: * We used svnsync to sync the repository to the new servers * The new server, in order to make use of svnsync, was updated to a newer version of subversion (jumped from 1.4.6 to 1.6.15). It's possible we can copy the UUID over directly and have it still work, but I want to verify this before going further. You *may* be able to do an svn switch in order to update the repo, but I've not tested it. I'll get back with more information soon. -- Matthew Weier O'Phinney Project Lead| matt...@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: zf-contribut...@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: zf-contributors-unsubscr...@lists.zend.com Thanks Matthew it works as expected now svn up . Utests/Zend/Config/_files/config.yaml Utests/Zend/Config/YamlTest.php Ulibrary/Zend/Config/Yaml.php Ulibrary/Zend/Gdata/Gbase/ItemQuery.php Ulibrary/Zend/Gdata/Gbase/Query.php Ulibrary/Zend/Gdata/Gbase/SnippetQuery.php Ulibrary/Zend/Gdata/Calendar.php Ulibrary/Zend/Gdata/Calendar/EventQuery.php Ulibrary/Zend/Gdata/Docs.php Ulibrary/Zend/Gdata/Spreadsheets.php Ulibrary/Zend/Gdata/Docs/Query.php Ulibrary/Zend/Gdata/Spreadsheets/ListQuery.php Ulibrary/Zend/Gdata/Spreadsheets/DocumentQuery.php Ulibrary/Zend/Gdata/Spreadsheets/CellQuery.php Ulibrary/Zend/Gdata/Photos.php Ulibrary/Zend/Gdata/Books.php Ulibrary/Zend/Gdata/Gbase.php Udocumentation/manual/ja/ref/coding_standard.xml Récupération de la référence externe dans 'externals/dojo' Référence externe actualisée à la révision 24054. Actualisé à la révision 23808. -- Bruno Friedmann Ioda-Net Sàrl www.ioda-net.ch openSUSE Member Ambassador GPG KEY : D5C9B751C4653227 irc: tigerfoot -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] Serving XHTML with the correct mime-type
On 05/15/2010 02:54 AM, Andrew Ballard wrote: On Fri, May 14, 2010 at 4:57 PM, Hector Virgen djvir...@gmail.com wrote: What problem are you having with nbsp;? I didn't realize it's not valid XHTML. Should it be #160; instead? -- Hector That was my understanding. Being based on XML, I understood that the only entities defined in XHTML were those defined in XML -- lt;, gt; quot; and apos;. The few times (a while ago) that I tried to parse XHTML documents with various parsers, they would not work unless they used #160;/#xA0; for non-breaking spaces rather than nbsp;. That is consistent with the error I saw in Firefox. I have read documents on the web how you can define your own entities in an XML document to add nbsp;, but I've also read that you cannot extend the XHTML doctype. Andrew Andrew I don't really understand the trouble with nbsp; I'm using it on website ( ZF + XHTML1.1 STRICT ) and they validate at 100%. Perharps this is due the header used ? Check it at http://it.ioda-net.ch/ I'm working with ZF-1.10 with layout. Bootstrap containing protected function _initDoctype() { $this-bootstrap('view'); $view = $this-getResource('view'); $view-doctype('XHTML11'); } Extract from the layout : ?php echo '?xml version=\'1.0\' encoding=\'utf-8\' ?', PHP_EOL; echo $this-doctype(), PHP_EOL; ? html xmlns=http://www.w3.org/1999/xhtml; xml:lang=?php echo $this-lang; ? head base href=http://?php echo (( isset($_SERVER['SERVER_NAME']) )? $_SERVER['SERVER_NAME'] : 'localhost' ) . $this-baseUrl(); ?/ / ?php echo $this-headMeta() -setHttpEquiv('Content-Type', 'application/xhtml+xml; charset=utf-8') -setHttpEquiv('Content-Style-Type', 'text/css') -setHttpEquiv('lang', $this-lang ) -setHttpEquiv('imagetoolbar', 'no') ... They work great with IE7+ Opera9.5+ FF3.5+ Safari 4+ And it's validate against w3c validator ... -- Bruno Friedmann
Re: [fw-general] Getting PDf file stats and info using Zend_pdf
undertruck wrote: Hi, I want to retrieve following information from a PDF file using Zend_pdf module. I was wondering if it's possible at all. I didn't see any such references in api documentation. 0. Total no of pages with individual page sizes 1. PDF print size and bounding box dimensions 2. Colorspace (RGB/CMYK) used in PDF 3. To confirm that font is either embedded or outlined 4. Total no of objects and their list along with their types 5. For all the image objects : a) height and width in pixels b) DPI stored in header c) colorspace d) bit depth e) x and y position in PDF f) Is image grayscaled ? 6. List of all ICC profiles like dot gains 7. Save pages in jpg (highest resolution image object should visible as its original size) 8. Save pages as thumbnails 9. If crop box is present, get its x-y location in PDF and size I've tried (though not extensively) fpdf, tcpdf, imagemagick (convert and identify tools) but none of them give me complete information. For some reasons, I couldn't use Imagick PHP class on my host. So Zend_pdf seems the last option and I don't see anything useful regarding 'reading' PDFs. pdflib is also not an option as I'm looking for free solutions. Any help on this would be appreciated. Thanks. Not sure of all option you list but seems to be a job for pdftk http://www.accesspdf.com/pdftk/ -- Bruno Friedmann
Re: [fw-general] Survey: Development environment for PHP/ZFW
howard chen wrote: Please feel free to answer: 1. What OS you are using during development? Windows? Mac? Linux? openSUSE Linux 11.1 (32bits due to multimédia and proprietary software : Zend studio, Adobe AIR 2. Do you edit source code on localhost or remote? i.e. is your testing environment reside on localhost or remote? dev = localhost 3. What tool or IDE you are using? Ultraedit? Apanta? Eclipse PDT? Zend Studio vim (of course) 4. Which versioning system your are using? svn? git? SVN with apache2 ldap 5. Do you use PHPUnit or other testing tools? PHPUNIT selenium p.s. have a good day. Always, with lot's of fun :-)
Re: [fw-general] Zend include_path problem on PC
jarret gabel wrote: i tried all sorts of include_paths in both the bootstrap and in my php.ini file in my WAMP setup... including a direct link to c:\wamp\www\index.php and c:\wamp\frameworks\Amf\Server.php My file structure is c:\wamp\www and Zend is in c:\wamp\frameworks c:\wamp\www\index.php my index.php file looks like this: ?php error_reporting(E_ALL|E_STRICT); ini_set(display_errors, on); ini_set(include_path, ;../frameworks); require_once 'Zend/Amf/Server.php'; require_once 'Tutorials.php'; $server = new Zend_Amf_Server(); $server-setClass(Tutorials); echo($server-handle()); ? i've tried ini_set(include_path, file:///c:/wamp/frameworks) and a bunch of different incarnations the error looks like this: Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error: Unknown: Failed opening required 'C:/wamp/www/index.php' (include_path='.;C:\php5\pear') in Unknown on line 0 thanks for your help! really what phpscriptor said adjusted to your file hierarchy should work ... set_include_path( dirname(__FILE__) . '../framewoks' - here you should also add library or Zend/library don't know how you unzip the framework . PATH_SEPARATOR . dirname(__FILE__) . '/app/models' . PATH_SEPARATOR . dirname(__FILE__) . '/app/forms' . PATH_SEPARATOR . get_include_path() ); But normally your index.php should reside on the public(or html) directory of your zfapp. -- Bruno Friedmann
Re: [fw-general] Zend include_path problem on PC
I'followed your thread and I can't understand why you can't change directly inside the php.ini the include_path line ; Windows: \path1;\path2 include_path = .;c:\php5\pear;c:\wanp\frameworks Just be sure that also the user account under which wamp is running have access to this directory perharps this user can't read them and this would explain lot's of things :-) check this with the explorer - tab share security ( If wamp respect window's mentality health uuhh ) system account should have a r-x minimal rights. Hope this do the tricks. jarret gabel wrote: thanks for the advice... but for some really annoying reason, i can't get the include path in the error to say anything except include_path=C:\php5\pear so annoying :) any suggestions? i tried that code you suggested but its still messed up :( Bruno Friedmann-2 wrote: jarret gabel wrote: i tried all sorts of include_paths in both the bootstrap and in my php.ini file in my WAMP setup... including a direct link to c:\wamp\www\index.php and c:\wamp\frameworks\Amf\Server.php My file structure is c:\wamp\www and Zend is in c:\wamp\frameworks c:\wamp\www\index.php my index.php file looks like this: ?php error_reporting(E_ALL|E_STRICT); ini_set(display_errors, on); ini_set(include_path, ;../frameworks); require_once 'Zend/Amf/Server.php'; require_once 'Tutorials.php'; $server = new Zend_Amf_Server(); $server-setClass(Tutorials); echo($server-handle()); ? i've tried ini_set(include_path, file:///c:/wamp/frameworks) and a bunch of different incarnations the error looks like this: Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error: Unknown: Failed opening required 'C:/wamp/www/index.php' (include_path='.;C:\php5\pear') in Unknown on line 0 thanks for your help! really what phpscriptor said adjusted to your file hierarchy should work ... set_include_path( dirname(__FILE__) . '../framewoks' - here you should also add library or Zend/library don't know how you unzip the framework . PATH_SEPARATOR . dirname(__FILE__) . '/app/models' . PATH_SEPARATOR . dirname(__FILE__) . '/app/forms' . PATH_SEPARATOR . get_include_path() ); But normally your index.php should reside on the public(or html) directory of your zfapp. -- Bruno Friedmann
Re: [fw-general] Zend Auth: Advanced Usage By Example
Sorry Jason in Postgresql something refer to a db, schema, table, column name so a 0=0 - column doesn't exist but yes a select false = '0' is true. But here what I've use as code which work in similar conditions $db = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter = new Zend_Auth_Adapter_DbTable($db, 'users', 'login', 'password', 'MD5(?) AND active = TRUE'); $dbAdapter-setCredential( $values['userpassword'] ) -setIdentity( $values['userlogin'] ); $result = $this-_auth-authenticate($dbAdapter); In dele454 code it's seem you missed the place for hashed password in the marked place for the password so a $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'Members','Email', 'Password', '? AND IsActive != 0'); would do the trick. Jason Webster wrote: Not really... SELECT 0 = 0 // true SELECT FALSE = 0 // true SELECT FALSE = 0 // true Bruno Friedmann wrote: Hi Just a word : be carefull with 0/1 TRUE/FALSE and the type of your column and the database used. I suspect if you write you $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'Members', 'Email', 'Password', 'AND IsActive != 0'); AND IsActive != 0 this would work ... :-) As another advice to be more SQL linguistic I would inverse the and ' AND IsActive != '0') dele454 wrote: Am trying to implement a similar scenario where if the column IsActive is set to '0' the authentication should fail. A typical scenario is when a user just signed up and still needs to active acct before allowed to gain access. I followed the instruction in the Ref Guide but it isnt working. If the user supplies email+password before acct is activated - login is granted. The only code i didnt implement from the advanced useage example is the MD5(?) because i have something similar implemented already. Except if it does something else - i cant loggin with any credentials if i include it though $db= Zend_Registry::get('db'); $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'Members', 'Email', 'Password', 'AND IsActive != 0'); $config = Zend_Registry::get('config'); $password = $logins['password']; $salt = $^##@; $password = md5($salt.$logins['password']); $authAdapter-setIdentity($logins['email']); $authAdapter-setCredential($password); return $authAdapter; Please help is needed thanks :) - dee -- Bruno Friedmann Ioda-Net Sàrl 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 www.ioda-net.ch Centre de Formation et de Coaching En Ligne www.cfcel.com
Re: [fw-general] Zend Auth: Advanced Usage By Example
Hi Just a word : be carefull with 0/1 TRUE/FALSE and the type of your column and the database used. I suspect if you write you $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'Members', 'Email', 'Password', 'AND IsActive != 0'); AND IsActive != 0 this would work ... :-) As another advice to be more SQL linguistic I would inverse the and ' AND IsActive != '0') dele454 wrote: Am trying to implement a similar scenario where if the column IsActive is set to '0' the authentication should fail. A typical scenario is when a user just signed up and still needs to active acct before allowed to gain access. I followed the instruction in the Ref Guide but it isnt working. If the user supplies email+password before acct is activated - login is granted. The only code i didnt implement from the advanced useage example is the MD5(?) because i have something similar implemented already. Except if it does something else - i cant loggin with any credentials if i include it though $db= Zend_Registry::get('db'); $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'Members', 'Email', 'Password', 'AND IsActive != 0'); $config = Zend_Registry::get('config'); $password = $logins['password']; $salt = $^##@; $password = md5($salt.$logins['password']); $authAdapter-setIdentity($logins['email']); $authAdapter-setCredential($password); return $authAdapter; Please help is needed thanks :) - dee -- Bruno Friedmann Ioda-Net Sàrl 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 www.ioda-net.ch Centre de Formation et de Coaching En Ligne www.cfcel.com
Re: [fw-general] How to store attachment files into a location in server
Anees wrote: Hi i am developing a module that sores all emails coming to an account into a database and i have succeeded in that using Zend_Mail_Storage_Pop3 calss and also i am getting the information about the attachments that sending with mail i can display it, download it.. (using header() function ) But i need to store the file into a location in server how i can do this? please help Regards, Anees If you store email in db why not the attachement in a (blob clob) binary columns. So you never get worried about what attachment get with which mail. Ok you need a good db for sure. But atferward they are made for this. -- Bruno Friedmann
Re: [fw-general] PHP bug with chaining function calls that generate exceptions on x86_64
Colin Guthrie wrote: Hi, Just wanted to share this bug with you guys as I discovered it while using Zend Framework code. http://bugs.php.net/bug.php?id=46568 It only affects x86_64, but it's fairly easy to trigger this in Zend Framework as it makes quite extensive use of exceptions, often in a chained function call scenario. HTH's some people from scratching the old noodle too much. Col I've just update by comment the bug on php. Seems to affect you I've not found a new opensuse 11.1 which should have also a 4.3.2 gcc version. On other system it isn't reproductible. -- Bruno Friedmann
Re: [fw-general] Zend PDT 2.0 all-in-one available (BETA)
Hi Karol, like previous version, it's only 32bits. Normally it has it's own java32 bits engine include. So you should take care of any path or env vars that would alter the embedded java engine to start. take a look at all your env java env | grep JAV It would be a great enhancement to have a native 64bits of it. Especially now that eclipse ganymed work nicely. Karol Grecki wrote: Does it work on 64bit Linux? I run the executable but it just quits after a second without any message whatsoever. Karol rcastley wrote: A bit off-list but those Zend guys have packaged an all-in-one build of the latest PDT 2.0 and Eclipse 3.4. http://downloads.zend.com/pdt/all-in-one/ http://downloads.zend.com/pdt/all-in-one/ -- Bruno Friedmann
Re: [fw-general] without htaccess?
Hoena wrote: Is there any way to use ZF URL rewriting without the use of htaccess files if the web server does not support it? The question begins from digitaluscms forum http://forum.digitaluscms.com/comments.php?DiscussionID=132page=1#Item_0 Really all answers given in the linked forum are the good ones. You can also do a search on nabble about htaccess. -- Bruno Friedmann
Re: [fw-general] ZF performances / profiling the culprit
Benjamin Eberlei wrote: hello, you might want to install pecl-xdebug extension to PHP and enable profiling. You can then use Webgrind or KCachegrind to show you which functions and classes use the most processing power in your appliaction. Have you installed APC or eAccelerator? Yes APC is install and heavily use :-) I've ( due to ZendStudio ) the zend_debugger installed and also the xdebug. Did you have a quick way to generate a trace I can use with KCachegrind ? It would help me to confirm or infirm what the ZendStudio Profiler give me. On Thursday 23 October 2008 22:04:40 Bruno Friedmann wrote: Follow at the end Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Tuesday, 21 October 2008, 09:45 PM +0200): Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Tuesday, 21 October 2008, 06:56 AM +0200): Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Monday, 20 October 2008, 07:00 AM +0200): Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Sunday, 19 October 2008, 07:30 PM +0200): With the help of ZendStudio, I'm trying to understand why on one application I've got 25/30 req/s and on the second one I've only a 5/5.50 req (1.6.2) or a 7/8.2rqs ( 1.7.0 notice the little change ) ( a simple html file is giving a 385rqs and a 404 error page give around a 280/320rqs ) The profile result give me a 59% time consume by Layout ( which I doesn't have on the speed app ) and another 12.5% to Translate ( ok I'm using tmx which is not the most speedy thing ) You can save me a little time and effort here by attaching the layout script you use, as well as a count of the number of times calls are made to translate items. With that information, I can add some information to our performance and profiling test suite. Quickly I'm calling the index controlleur / index view with layout. html/index.php - ZFApplication ( which is the real bootstrap ) - app/Module/Default - /Controller/indexController - Action indexAction - Scripts/index/index.phtml Layout contain |-- common | | |-- footer.phtml | |-- header.phtml | |-- help.phtml | | `-- menu.phtml `-- main.phtml For the index view there's a test if ( !Zend_Auth::getInstance()- hasIdentity() ): // Render login form or logged echo $this- action(null, 'login'); // If we are anonymous -- For translation I've a global function __($str) which translate strings. For the whole projet there's a 945 call to it. For the index call profiled it's about 24 calls. The above may very well be the culprit, but I'll write a test just to see. Can you give the contents of your layout files? I'm curious to see how you're pulling in content -- if you're using partial(), action(), or simply render(). I've already identified a bottleneck in partial() that I'll be working on. Additionally, I typically recommend against action() because I know already that internally it's expensive; it's cheaper to create a helper that pulls from the model directly. If what you say is correct, I'm in trouble :-) You will see why in the source attached ... So I'm waiting your confirmation, and eventually other recommandations. There's some refactoring/rewritting in the air tonight :-) The only reason to use partial() instead of render() is when you absolutely need a clean variable scope for the rendered view script. In your case, I'd recommend simply substituting render() for each time you use partial(); this will definitely improve speed. Ok this remark make sense ... I think it should find it's place as remark in docs. I see you're using action() to pull in a login form. Since you won't be worried about pre-populated values or validation, it may make more sense here to either instantiate the form object directly and display it, or create a view helper that does this. To be honest, I'm actually in a process to limits the number of view helper to a quantic's number. I feel I'm on the wrong way. Too strict perhaps in the logic approach There a login controller in which the login form logic reside so I'm calling it because layout permit this, leaving all login to it's own controller/model/form/view system. Makes sense. Just remember that this is an expensive operation. You may want to consider a view helper that calls the action() helper, but caches the results. See if the above changes help your performance. If not, the next thing I'd suggest trying to move to gettext for your translations to see if that speeds things up. If so, you may be able to develop using TMX, and write a build script that converts to gettext later. I will give them a try on Thursday and Friday and keep you inform of the result. In your Guru's opinion, shall I try the svn version of 1.7 or could I stay with the PR release ? I'd go with trunk
Re: [fw-general] ZF performances / profiling the culprit
Forget all what I've said in previous message. There was an error not shown and the mvc complete dispatch was broke so the result are faster. Accept my apologize to Component writer's. Bruno Friedmann wrote: Follow at the end Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Tuesday, 21 October 2008, 09:45 PM +0200): Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Tuesday, 21 October 2008, 06:56 AM +0200): Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Monday, 20 October 2008, 07:00 AM +0200): Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Sunday, 19 October 2008, 07:30 PM +0200): With the help of ZendStudio, I'm trying to understand why on one application I've got 25/30 req/s and on the second one I've only a 5/5.50 req (1.6.2) or a 7/8.2rqs ( 1.7.0 notice the little change ) ( a simple html file is giving a 385rqs and a 404 error page give around a 280/320rqs ) The profile result give me a 59% time consume by Layout ( which I doesn't have on the speed app ) and another 12.5% to Translate ( ok I'm using tmx which is not the most speedy thing ) You can save me a little time and effort here by attaching the layout script you use, as well as a count of the number of times calls are made to translate items. With that information, I can add some information to our performance and profiling test suite. Quickly I'm calling the index controlleur / index view with layout. html/index.php - ZFApplication ( which is the real bootstrap ) - app/Module/Default - /Controller/indexController - Action indexAction - Scripts/index/index.phtml Layout contain |-- common | |-- footer.phtml | |-- header.phtml | |-- help.phtml | `-- menu.phtml `-- main.phtml For the index view there's a test if ( !Zend_Auth::getInstance()- hasIdentity() ): // Render login form or logged echo $this- action(null, 'login'); // If we are anonymous -- For translation I've a global function __($str) which translate strings. For the whole projet there's a 945 call to it. For the index call profiled it's about 24 calls. The above may very well be the culprit, but I'll write a test just to see. Can you give the contents of your layout files? I'm curious to see how you're pulling in content -- if you're using partial(), action(), or simply render(). I've already identified a bottleneck in partial() that I'll be working on. Additionally, I typically recommend against action() because I know already that internally it's expensive; it's cheaper to create a helper that pulls from the model directly. If what you say is correct, I'm in trouble :-) You will see why in the source attached ... So I'm waiting your confirmation, and eventually other recommandations. There's some refactoring/rewritting in the air tonight :-) The only reason to use partial() instead of render() is when you absolutely need a clean variable scope for the rendered view script. In your case, I'd recommend simply substituting render() for each time you use partial(); this will definitely improve speed. Ok this remark make sense ... I think it should find it's place as remark in docs. I see you're using action() to pull in a login form. Since you won't be worried about pre-populated values or validation, it may make more sense here to either instantiate the form object directly and display it, or create a view helper that does this. To be honest, I'm actually in a process to limits the number of view helper to a quantic's number. I feel I'm on the wrong way. Too strict perhaps in the logic approach There a login controller in which the login form logic reside so I'm calling it because layout permit this, leaving all login to it's own controller/model/form/view system. Makes sense. Just remember that this is an expensive operation. You may want to consider a view helper that calls the action() helper, but caches the results. See if the above changes help your performance. If not, the next thing I'd suggest trying to move to gettext for your translations to see if that speeds things up. If so, you may be able to develop using TMX, and write a build script that converts to gettext later. I will give them a try on Thursday and Friday and keep you inform of the result. In your Guru's opinion, shall I try the svn version of 1.7 or could I stay with the PR release ? I'd go with trunk; there are changes going in daily improving the release, and we'll be doing at least one bug hunting event before the release. (1.7 will be branched from trunk prior to the first RC) Ok I've upgrade the 1.7 to svn checkout. I've transform all my main.phtml layout to not use this-partial / action or render In the tested page I also kill the $this-action('login'); With the same condition I
Re: [fw-general] ZF performances / profiling the culprit
Follow at the end Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Tuesday, 21 October 2008, 09:45 PM +0200): Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Tuesday, 21 October 2008, 06:56 AM +0200): Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Monday, 20 October 2008, 07:00 AM +0200): Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Sunday, 19 October 2008, 07:30 PM +0200): With the help of ZendStudio, I'm trying to understand why on one application I've got 25/30 req/s and on the second one I've only a 5/5.50 req (1.6.2) or a 7/8.2rqs ( 1.7.0 notice the little change ) ( a simple html file is giving a 385rqs and a 404 error page give around a 280/320rqs ) The profile result give me a 59% time consume by Layout ( which I doesn't have on the speed app ) and another 12.5% to Translate ( ok I'm using tmx which is not the most speedy thing ) You can save me a little time and effort here by attaching the layout script you use, as well as a count of the number of times calls are made to translate items. With that information, I can add some information to our performance and profiling test suite. Quickly I'm calling the index controlleur / index view with layout. html/index.php - ZFApplication ( which is the real bootstrap ) - app/Module/Default - /Controller/indexController - Action indexAction - Scripts/index/index.phtml Layout contain |-- common | |-- footer.phtml | |-- header.phtml | |-- help.phtml | `-- menu.phtml `-- main.phtml For the index view there's a test if ( !Zend_Auth::getInstance()- hasIdentity() ): // Render login form or logged echo $this- action(null, 'login'); // If we are anonymous -- For translation I've a global function __($str) which translate strings. For the whole projet there's a 945 call to it. For the index call profiled it's about 24 calls. The above may very well be the culprit, but I'll write a test just to see. Can you give the contents of your layout files? I'm curious to see how you're pulling in content -- if you're using partial(), action(), or simply render(). I've already identified a bottleneck in partial() that I'll be working on. Additionally, I typically recommend against action() because I know already that internally it's expensive; it's cheaper to create a helper that pulls from the model directly. If what you say is correct, I'm in trouble :-) You will see why in the source attached ... So I'm waiting your confirmation, and eventually other recommandations. There's some refactoring/rewritting in the air tonight :-) The only reason to use partial() instead of render() is when you absolutely need a clean variable scope for the rendered view script. In your case, I'd recommend simply substituting render() for each time you use partial(); this will definitely improve speed. Ok this remark make sense ... I think it should find it's place as remark in docs. I see you're using action() to pull in a login form. Since you won't be worried about pre-populated values or validation, it may make more sense here to either instantiate the form object directly and display it, or create a view helper that does this. To be honest, I'm actually in a process to limits the number of view helper to a quantic's number. I feel I'm on the wrong way. Too strict perhaps in the logic approach There a login controller in which the login form logic reside so I'm calling it because layout permit this, leaving all login to it's own controller/model/form/view system. Makes sense. Just remember that this is an expensive operation. You may want to consider a view helper that calls the action() helper, but caches the results. See if the above changes help your performance. If not, the next thing I'd suggest trying to move to gettext for your translations to see if that speeds things up. If so, you may be able to develop using TMX, and write a build script that converts to gettext later. I will give them a try on Thursday and Friday and keep you inform of the result. In your Guru's opinion, shall I try the svn version of 1.7 or could I stay with the PR release ? I'd go with trunk; there are changes going in daily improving the release, and we'll be doing at least one bug hunting event before the release. (1.7 will be branched from trunk prior to the first RC) Ok I've upgrade the 1.7 to svn checkout. I've transform all my main.phtml layout to not use this-partial / action or render In the tested page I also kill the $this-action('login'); With the same condition I obtain a 8 rqs and a when only this-action login a 6.5 rqs This disappoint me a bit ... The server could respond a 434 rqs for a phpinfo :-) I know this absolutely not the same ... The old version ( php4 without oo pdo ) answer
Re: [fw-general] ZF performances / profiling the culprit
Thomas Weidner wrote: - Original Message - From: Matthew Weier O'Phinney [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Tuesday, October 21, 2008 3:00 PM Subject: Re: [fw-general] ZF performances / profiling the culprit See if the above changes help your performance. If not, the next thing I'd suggest trying to move to gettext for your translations to see if that speeds things up. If so, you may be able to develop using TMX, and write a build script that converts to gettext later. Sure but tmx have some nice feature ( human and xml ) and doesn't need compilation. and extraction. There is one eminent thing to remember... Performance problems will only occur when no caching is used. After the first load into cache, ALL adapters have the same performance !!! The only difference is the first loading time. Thanks about That Thomas, tmx work correctly only from 1.7 with cache ( locale and translate ) before 1.7 inside cache only the first call to translate are in ( If first user call is en then there's only en string retrieved , if fr is first call, all user get the french ) Now with the 1.7 all is working as expected. -- Bruno Friedmann Ioda-Net Sàrl 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 www.ioda-net.ch Centre de Formation et de Coaching En Ligne www.cfcel.com
Re: [fw-general] ZF performances / profiling the culprit
Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Tuesday, 21 October 2008, 06:56 AM +0200): Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Monday, 20 October 2008, 07:00 AM +0200): Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Sunday, 19 October 2008, 07:30 PM +0200): With the help of ZendStudio, I'm trying to understand why on one application I've got 25/30 req/s and on the second one I've only a 5/5.50 req (1.6.2) or a 7/8.2rqs ( 1.7.0 notice the little change ) ( a simple html file is giving a 385rqs and a 404 error page give around a 280/320rqs ) The profile result give me a 59% time consume by Layout ( which I doesn't have on the speed app ) and another 12.5% to Translate ( ok I'm using tmx which is not the most speedy thing ) You can save me a little time and effort here by attaching the layout script you use, as well as a count of the number of times calls are made to translate items. With that information, I can add some information to our performance and profiling test suite. Quickly I'm calling the index controlleur / index view with layout. html/index.php - ZFApplication ( which is the real bootstrap ) - app/Module/Default - /Controller/indexController - Action indexAction - Scripts/index/index.phtml Layout contain |-- common | |-- footer.phtml | |-- header.phtml | |-- help.phtml | `-- menu.phtml `-- main.phtml For the index view there's a test if ( !Zend_Auth::getInstance()- hasIdentity() ): // Render login form or logged echo $this- action(null, 'login'); // If we are anonymous -- For translation I've a global function __($str) which translate strings. For the whole projet there's a 945 call to it. For the index call profiled it's about 24 calls. The above may very well be the culprit, but I'll write a test just to see. Can you give the contents of your layout files? I'm curious to see how you're pulling in content -- if you're using partial(), action(), or simply render(). I've already identified a bottleneck in partial() that I'll be working on. Additionally, I typically recommend against action() because I know already that internally it's expensive; it's cheaper to create a helper that pulls from the model directly. If what you say is correct, I'm in trouble :-) You will see why in the source attached ... So I'm waiting your confirmation, and eventually other recommandations. There's some refactoring/rewritting in the air tonight :-) The only reason to use partial() instead of render() is when you absolutely need a clean variable scope for the rendered view script. In your case, I'd recommend simply substituting render() for each time you use partial(); this will definitely improve speed. Ok this remark make sense ... I think it should find it's place as remark in docs. I see you're using action() to pull in a login form. Since you won't be worried about pre-populated values or validation, it may make more sense here to either instantiate the form object directly and display it, or create a view helper that does this. To be honest, I'm actually in a process to limits the number of view helper to a quantic's number. I feel I'm on the wrong way. Too strict perhaps in the logic approach There a login controller in which the login form logic reside so I'm calling it because layout permit this, leaving all login to it's own controller/model/form/view system. See if the above changes help your performance. If not, the next thing I'd suggest trying to move to gettext for your translations to see if that speeds things up. If so, you may be able to develop using TMX, and write a build script that converts to gettext later. I will give them a try on Thursday and Friday and keep you inform of the result. In your Guru's opinion, shall I try the svn version of 1.7 or could I stay with the PR release ? Thanks all for you great advise, help each of us making php/ZF better and better, also in developer mind and how to approach realize great things with. -- Bruno Friedmann Ioda-Net Sàrl 2830 Vellerat - Switzerland
Re: [fw-general] ZF performances / profiling the culprit
Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Monday, 20 October 2008, 07:00 AM +0200): Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Sunday, 19 October 2008, 07:30 PM +0200): With the help of ZendStudio, I'm trying to understand why on one application I've got 25/30 req/s and on the second one I've only a 5/5.50 req (1.6.2) or a 7/8.2rqs ( 1.7.0 notice the little change ) ( a simple html file is giving a 385rqs and a 404 error page give around a 280/320rqs ) The profile result give me a 59% time consume by Layout ( which I doesn't have on the speed app ) and another 12.5% to Translate ( ok I'm using tmx which is not the most speedy thing ) You can save me a little time and effort here by attaching the layout script you use, as well as a count of the number of times calls are made to translate items. With that information, I can add some information to our performance and profiling test suite. Quickly I'm calling the index controlleur / index view with layout. html/index.php - ZFApplication ( which is the real bootstrap ) - app/Module/Default - /Controller/indexController - Action indexAction - Scripts/index/index.phtml Layout contain |-- common | |-- footer.phtml | |-- header.phtml | |-- help.phtml | `-- menu.phtml `-- main.phtml For the index view there's a test if ( !Zend_Auth::getInstance()-hasIdentity() ): // Render login form or logged echo $this-action(null, 'login'); // If we are anonymous -- For translation I've a global function __($str) which translate strings. For the whole projet there's a 945 call to it. For the index call profiled it's about 24 calls. The above may very well be the culprit, but I'll write a test just to see. Can you give the contents of your layout files? I'm curious to see how you're pulling in content -- if you're using partial(), action(), or simply render(). I've already identified a bottleneck in partial() that I'll be working on. Additionally, I typically recommend against action() because I know already that internally it's expensive; it's cheaper to create a helper that pulls from the model directly. If what you say is correct, I'm in trouble :-) You will see why in the source attached ... So I'm waiting your confirmation, and eventually other recommandations. There's some refactoring/rewritting in the air tonight :-) -- Bruno Friedmann Ioda-Net Sàrl 2830 Vellerat - Switzerland layouts.tar.gz Description: GNU Zip compressed data
[fw-general] ZF-170PR tests results
Hi All ZF I've made some tests with the 1.7.0PR Mainly I'm trying to run all tests against it ( Exclude Services and some Database I've not access ). I'm joining all tests which cause trouble. With one special mention to DB ( but I believe the error was cause due to refactoring/rewriting of tests ). Hope this could help a bit our main contributors to give us a nice killing version . -- Bruno Friedmann Ioda-Net Sàrl 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 www.ioda-net.ch 170_Measure_failure.log.gz Description: GNU Zip compressed data 170_Log_failure.log.gz Description: GNU Zip compressed data 170_Layout_failure.log.gz Description: GNU Zip compressed data 170_Infocard_failure.log.gz Description: GNU Zip compressed data 170_Dojo_failure.log.gz Description: GNU Zip compressed data 170_Db_TestSetup_failure.log.gz Description: GNU Zip compressed data 170_Date_Fail.log.gz Description: GNU Zip compressed data 170_Controller_failure.log.gz Description: GNU Zip compressed data 170_Captcha_failure.log.gz Description: GNU Zip compressed data 170_Auth_Fail.log.gz Description: GNU Zip compressed data
Re: [fw-general] Is Zend_Form really this difficult?
Steven Szymczak wrote: The resources you provided, as well as those in the Zend Devzone, are helping me get my head around this. Thanks for that. The problem I'm having now is trying to figure out how to wrap two inputs (username and password), as well as their Label decorators, in a div block. I can get both inputs, and the password Label, but the Username label always ends up outside the block. Trying to add an opening div after the dl element only results in dl being overwritten. I'm not an expert in Form so I do my best with the css. dl.zend_form{ margin: 0.5em 0.25em; line-height: 1.5em; vertical-align: middle; } .zend_form dt dd{ margin: 6px 12px; line-height: 1.5em; } .zend_form dt{ clear: both; float:left; margin-right: 6px; padding-left: 8px; width: 225px; background-color: transparent;} as the zend_form dl is inside a fixed div or fieldset it's ok. Also I've made a lot about label and input type ... But that's the way I've start Jani Hartikainen wrote: I'd suggest you try using CSS to style the default markup to your liking. That is the easiest way out. I've also written an article about customizing zend_form markup with a set of decorators, you can see it here: http://codeutopia.net/blog/2008/08/07/zend_form-decorator-tips/ I think there's also something about them on Zend Developer Zone. Hope this helps. -- Bruno Friedmann
Re: [fw-general] ZF performances / profiling the culprit
Bruno Friedmann wrote: Hi All. With the help of ZendStudio, I'm trying to understand why on one application I've got 25/30 req/s and on the second one I've only a 5/5.50 req (1.6.2) or a 7/8.2rqs ( 1.7.0 notice the little change ) ( a simple html file is giving a 385rqs and a 404 error page give around a 280/320rqs ) The profile result give me a 59% time consume by Layout ( which I doesn't have on the speed app ) and another 12.5% to Translate ( ok I'm using tmx which is not the most speedy thing ) In the attach file you will find the export html and xml format. Perharps some Guru's can help me to confirm or not what I'm thinking. And give the opportunities to ZF maintainers give their attention to the struggle component of our prefered PhP Framework. My big Apologizes for the attach. I'm pretty sure It's too big for a majority of you. Next time I will post it on my server. Time to take some break week-end hours :-) -- Bruno Friedmann
Re: [fw-general] ZF performances / profiling the culprit
Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Sunday, 19 October 2008, 07:30 PM +0200): With the help of ZendStudio, I'm trying to understand why on one application I've got 25/30 req/s and on the second one I've only a 5/5.50 req (1.6.2) or a 7/8.2rqs ( 1.7.0 notice the little change ) ( a simple html file is giving a 385rqs and a 404 error page give around a 280/320rqs ) The profile result give me a 59% time consume by Layout ( which I doesn't have on the speed app ) and another 12.5% to Translate ( ok I'm using tmx which is not the most speedy thing ) You can save me a little time and effort here by attaching the layout script you use, as well as a count of the number of times calls are made to translate items. With that information, I can add some information to our performance and profiling test suite. Quickly I'm calling the index controlleur / index view with layout. html/index.php - ZFApplication ( which is the real bootstrap ) - app/Module/Default - /Controller/indexController - Action indexAction - Scripts/index/index.phtml Layout contain |-- common | |-- footer.phtml | |-- header.phtml | |-- help.phtml | `-- menu.phtml `-- main.phtml For the index view there's a test if ( !Zend_Auth::getInstance()-hasIdentity() ): // Render login form or logged echo $this-action(null, 'login'); // If we are anonymous -- For translation I've a global function __($str) which translate strings. For the whole projet there's a 945 call to it. For the index call profiled it's about 24 calls. I hope this is what you need. Don't Hesitate to ask if you need something. -- Bruno Friedmann Ioda-Net Sàrl 2830 Vellerat - Switzerland
[fw-general] AllTests.php : 1.6.1 issue with Db
During tests launch I encounter a trouble with the DB test. I've Mysql, PgSql activated and for the two I received a limit for user : too much connexion I've seen that mysql and pgsql ( on my setup ) have a max_connexion set to 254. And during the tests I've got 254 connexions when I issue a show processlist. This doesn't happen with the 1.5.x version of ZF. Could someone give them a try ... I'm running the test with same parameters against the 1.6.0 version ... But it just would take some times :-) -- Bruno Friedmann
Re: [fw-general] [Paginator] several paginators per page + other issues
Hi Olivier, Olivier Ricordeau wrote: Hi list, First, I'm wondering if it's possible to have several paginators in the same page (I want to display them in the same page, but in different tabs). I'm asking this question because the example paginator control scripts use $this-previous (for instance), so I was thinking that several paginators per page could lead to conflicts. If the answer is no, is there a known workaround? I've recently implement paginator ( in simple use only 1 element by page ). I have put it in top and bottom inside my view and I've not found any trouble with them. in the view ?php echo $this-paginationControl($this-paginator, 'Jumping', 'paginator.phtml'); ? paginator.phtml is like the template found in docs. Second question: For this one I've no idea ... yet :-) I have a strange behaviour with the view variables. In my controller's init() method I declare a few view variables (ex: $this-view-trans = new Translator()) and I can't manage to access them in the paginator control script. I've tried to make a var_dump($this) and $this has the type MyView (which is fine, MyView is a custom class that inherits from Zend_View). But I get an error if I write $this-trans-some_method(), telling me Call to a member function some_method() on a non-object NB: Yes, I do a $paginator-setView($this-view) in my controller. Cheers, Olivier -- Bruno Friedmann Ioda-Net Sàrl 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 www.ioda-net.ch Centre de Formation et de Coaching En Ligne www.cfcel.com
[fw-general] HowTo Zend_Test_PHPUnit_ControllerTestCase + Zend_Session
I'm facing a problem how to do this. I've a application bootstrap which relies on Zend_Session. And I want to test controllers with the new (not so) Zend_Test_PHPUnit_ControllerTestCase. It's the first time I've to do this so excuse me for the newb questions. I've follow the documentation and also the Mathew post blog and wiki. On a simple Hello world example tests are working nicely. (not too difficult, but just here to prove the env is correctly setup) So when I launch my test on the complicate bootstrap I've received this error : PHPUnit 3.2.21 by Sebastian Bergmann. IndexControllerTest E Time: 0 seconds There were 1 errors: 1) testIndexAction(IndexControllerTest) Zend_Session_Exception: Session must be started before any output has been sent to the browser; output started in /usr/share/php5/PEAR/PHPUnit/Util/Printer.php/139 /ioda/data/web-include/ZF/library.160/Zend/Session/Namespace.php:116 /home/bruno/workspace/socketfinder/sf/ZfApplication.php:155 /home/bruno/workspace/socketfinder/sf/ZfApplication.php:118 /home/bruno/workspace/socketfinder/sf/ZfApplication.php:98 /home/bruno/workspace/socketfinder/sf/tests/Sf/controllers/IndexControllerTest.php:22 I'm pretty sure I would have to do some sort of ouput_buffering but google was not my friend today. It only give me what phpunit session conference I've missed. Any path to a solution or any advice are welcome. -- Bruno Friedmann
Re: [fw-general] Setting value on Zend_Form_Element_Select
Chris Tankersley wrote: I have a select element inside of a form object where I call -setValue() on the form's initialization to select a default value. When I do a $form-populate($data) in my controller the value for this select element is not being set correctly and always defaults to the default value from initialization. My other select elements in the form work fine except for this one. FORM $protClass = new Zend_Form_Element_Select('protClass'); $protClass-setLable('Protection Class:') -setRequired(true) -setValue(9) -setMultiOptions($protClassRange); CONTROLLER $form-populate($rate-toArray()); // this has protClass at the correct value Dear Chris, in my case there's no need to setValue when populate .. it's done auto. -- Bruno Friedmann
Re: [fw-general] Image Captcha + Load Time
But that should not be the only tricks ... I've 2 debugger loaded :-) with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans with Zend Debugger v5.2.14, Copyright (c) 1999-2008, by Zend Technologies And also a lot's of extensions ( like pdflib, mapserver, clam loaded ) But I have also apc With ZF 1.6.0 It take between 1.97 (apc cache empty) to 1.64 seconds to generated my form with captcha image inside. Opensuse linux 32bits Centrino 2.4Ghz 4Go Ram sata II 7200rpm hardrive (with encryption) apache 2.2.4 and php 5.2.6. Matthew Lurz wrote: Yes. I'm sorry if I wasn't clear on this. Matthew Weier O'Phinney-3 wrote: -- Matthew Lurz [EMAIL PROTECTED] wrote (on Wednesday, 10 September 2008, 12:30 PM -0700): To say that I am embarrassed would be an understatement. So sorry to have wasted your time Matthew. I thought Xdebug had been disabled when I initially noticed the hit. Apparently not. I just asked my boss for the RETARD stamp for my forehead in hopes that this would provide a modicum of consolation and comic relief to you. And now it's in the historical record. So I take it to mean that the debugger was the issue? :) How long have I been doing this? Is it time to consider a less challenging profession? I think I could still flip a burger but who the hell knows. Anyhow, thanks for your patience. Matthew Weier O'Phinney-3 wrote: -- Matthew Lurz [EMAIL PROTECTED] wrote (on Wednesday, 10 September 2008, 09:17 AM -0700): I recently noticed that a form using Zend_Captcha_Image was taking 15-20 seconds to load. I reviewed my code but couldn't find the source of the issue though it was obviously related to the Captcha element. So, I setup a form in a test environment that does nothing more than load an image Captcha. The trace is 189,253 lines and the page takes over 12 seconds to load. This wasn't always the case. Did I miss something or is this a bug? A couple of things: first off, GD and imagick typically suffer a pretty large performance hit when you have a debugger enabled in your PHP profile. Try benching with no debugger enabled (disable it in your php.ini and restart the web server). Second, what OS are you on, and what version of PHP? -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- Bruno Friedmann Ioda-Net Sàrl 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 www.ioda-net.ch Centre de Formation et de Coaching En Ligne www.cfcel.com
Re: [fw-general] Setting value on Zend_Form_Element_Select
Ok sorry. I'm doing what you want in several forms but index are always called by string. Have you try a setValue('9') if I imagine you have a id='9' value='Something in the list' Hope this help a bit more ... Chris Tankersley wrote: In my case I want the default to be the last value added instead of the first which is why I manually do a setValue in the init. Chris On Thu, Sep 11, 2008 at 10:19 AM, Bruno Friedmann [EMAIL PROTECTED] wrote: Chris Tankersley wrote: I have a select element inside of a form object where I call -setValue() on the form's initialization to select a default value. When I do a $form-populate($data) in my controller the value for this select element is not being set correctly and always defaults to the default value from initialization. My other select elements in the form work fine except for this one. FORM $protClass = new Zend_Form_Element_Select('protClass'); $protClass-setLable('Protection Class:') -setRequired(true) -setValue(9) -setMultiOptions($protClassRange); CONTROLLER $form-populate($rate-toArray()); // this has protClass at the correct value Dear Chris, in my case there's no need to setValue when populate .. it's done auto. -- Bruno Friedmann -- Bruno Friedmann Ioda-Net Sàrl 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 www.ioda-net.ch Centre de Formation et de Coaching En Ligne www.cfcel.com
Re: [fw-general] HowTo Zend_Test_PHPUnit_ControllerTestCase + Zend_Session
Bruno Friedmann wrote: I'm facing a problem how to do this. I've a application bootstrap which relies on Zend_Session. And I want to test controllers with the new (not so) Zend_Test_PHPUnit_ControllerTestCase. It's the first time I've to do this so excuse me for the newb questions. I've follow the documentation and also the Mathew post blog and wiki. On a simple Hello world example tests are working nicely. (not too difficult, but just here to prove the env is correctly setup) So when I launch my test on the complicate bootstrap I've received this error : PHPUnit 3.2.21 by Sebastian Bergmann. IndexControllerTest E Time: 0 seconds There were 1 errors: 1) testIndexAction(IndexControllerTest) Zend_Session_Exception: Session must be started before any output has been sent to the browser; output started in /usr/share/php5/PEAR/PHPUnit/Util/Printer.php/139 /ioda/data/web-include/ZF/library.160/Zend/Session/Namespace.php:116 /home/bruno/workspace/socketfinder/sf/ZfApplication.php:155 /home/bruno/workspace/socketfinder/sf/ZfApplication.php:118 /home/bruno/workspace/socketfinder/sf/ZfApplication.php:98 /home/bruno/workspace/socketfinder/sf/tests/Sf/controllers/IndexControllerTest.php:22 I'm pretty sure I would have to do some sort of ouput_buffering but google was not my friend today. It only give me what phpunit session conference I've missed. Any path to a solution or any advice are welcome. Ok a little step futher I've found that we can change this. Zend_Session::$_unitTestEnabled = true; but I've always a error ... testIndexAction(IndexControllerTest) Undefined variable: _SESSION /ioda/data/web-include/ZF/library.160/Zend/Session.php:522 /ioda/data/web-include/ZF/library.160/Zend/Session.php:448 /ioda/data/web-include/ZF/library.160/Zend/Session/Namespace.php:116 /home/bruno/workspace/socketfinder/sf/ZfApplication.php:156 -- Bruno Friedmann
Re: [fw-general] Setting value on Zend_Form_Element_Select
here's how one of the select is declared in form $element = new Zend_Form_Element_Select('patientid'); $element-addMultiOptions($this-patients_array) -setRequired(true) -setLabel('label_db_patient_select') -setAttrib('size', 1) -setAttrib('maxlength', 1) -addFilter($filterTags) -addFilter($filterTrim) -addValidator($validatorNotEmpty, true) -addValidator($validatorNum, true) ; $this-addElement($element); When I get data from db I just do a populate. $this-_form-populate($rowset-current()-toArray()); So you can see I never use the setValue. In your case I think you should try without it and for a new record after initializing the form do a $this-_form-getElement('whatever')-setValue(9); After I've no idea ... Chris Tankersley wrote: Actually, the setValue in the init is working fine. What I'm having a problem with is after I populate the form with data the select isn't changing to the populated value. Chris On Thu, Sep 11, 2008 at 10:50 AM, Bruno Friedmann [EMAIL PROTECTED] wrote: Ok sorry. I'm doing what you want in several forms but index are always called by string. Have you try a setValue('9') if I imagine you have a id='9' value='Something in the list' Hope this help a bit more ... Chris Tankersley wrote: In my case I want the default to be the last value added instead of the first which is why I manually do a setValue in the init. Chris On Thu, Sep 11, 2008 at 10:19 AM, Bruno Friedmann [EMAIL PROTECTED] wrote: Chris Tankersley wrote: I have a select element inside of a form object where I call -setValue() on the form's initialization to select a default value. When I do a $form-populate($data) in my controller the value for this select element is not being set correctly and always defaults to the default value from initialization. My other select elements in the form work fine except for this one. FORM $protClass = new Zend_Form_Element_Select('protClass'); $protClass-setLable('Protection Class:') -setRequired(true) -setValue(9) -setMultiOptions($protClassRange); CONTROLLER $form-populate($rate-toArray()); // this has protClass at the correct value Dear Chris, in my case there's no need to setValue when populate .. it's done auto. -- -- Bruno Friedmann
Re: [fw-general] Zend Framework 1.6.0 release
Rob Allen wrote: Did I miss the mail about this? I just wanted to say thanks to everyone that's worked so hard to get this release done. Lots of work has gone into the this release as there's a ton of new code in there, many bug fixes, the documentation has again improved and the translators have ensured that the many localised versions have been updated too. Wil has also managed to keep on top of what's happening and ensure that everything has come together for the release. Personally, I'm particularly pleased with the improved controller unit testing harness and it's great to see an official file upload component for Zend_Form. The Dojo integration looks interesting and I'm looking forward to Matthew teaching us how to use it at ZendCon! Another fantastic piece of organisation for this release is that the plans for 1.6.1 are already in place. Everyone knows that pushing out a big release means that some things don't quite make it or aren't quite as complete as they could be. By planning for 1.6.1 in advance, I've noticed that there's been a little less stress which is always good as the code quality has therefore gone up. There's a error in downloading the docs ... http://framework.zend.com/download/documentation?version=1.6.0 An error occurred with this request: Action documentation does not exist and was not trapped in __call(). But a great thanks to all who made this release available -- Bruno Friedmann
Re: [fw-general] Zend Framework 1.6.0 release
Thomas Weidner wrote: The 1.6.0 is official still not released. There is open work in the back which have to be made. Docu is one of it. So please be patient until the official announement has been made. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com Sorry Thomas, I'm just following the official link on the page framework.zend.com ... Don't know this one is a sandbox :-) Also having official rss feed in Zend_Eclipse saying http://devzone.zend.com/article/3812-Zend-Framework-1.6-Now-Available :-) -- Bruno Friedmann
Re: [fw-general] FYI: new php framework benchmarks
Wil Sinclair wrote: I agree with you entirely. One of the goals that we hope to accomplish with our performance audit is authoring a 'performance guide' as an appendix to the manual. We could add a section about performance testing that focuses PHP developers on how to properly test performance, what the numbers mean, and if they should be worrying about it in the first place. Maybe you could help us out with some of the content. :) ,Wil Another aspect should be used in perfs measurement. The learning curve, the quality of the docs ( speed to find explanation and good concrete samples of codes with their tests attached to them :-) Quality and constancy of the code. Tests coverage. I'm really enjoy about the review about perfs audit. Will keep my email, I'm really interested to help a bit with this part. -Original Message- From: Karol Grecki [mailto:[EMAIL PROTECTED] Sent: Monday, September 01, 2008 4:19 PM To: fw-general@lists.zend.com Subject: Re: [fw-general] FYI: new php framework benchmarks Matthew Weier O'Phinney-3 wrote: Also, please remember that these are done without any caching -- opcode or content. They are meant as baseline comparisons only -- what is the base performance of each given framework. Just for those who aren't regulars on the list, we are planning a performance audit of ZF for 1.7.0, so hopefully the decreases seen over time will turn around for you. IMO tests done without opcode caching are useless. Anyway, this only shows that some frameworks are better optimized to display hello world than others. Now all hello world developers can rejoice and switch to solar, we should be happy for them. Sarcasm aside, I'm sure most people here will agree that there's more to a framework than baseline performance and those benchmarks just give people the wrong ideas. There will be plenty of chances to improve ZF performance, but so far focus seemed to be on adding features. Just keep up the good work. Karol -- View this message in context: http://www.nabble.com/FYI%3A-new-php- framework-benchmarks-tp19257910p19262039.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Bruno Friedmann Ioda-Net Sàrl 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 www.ioda-net.ch Centre de Formation et de Coaching En Ligne www.cfcel.com
Re: [fw-general] Zend_Form_Captcha session word disappear after an Ajax call to other controller. bug ?
Matthew Weier O'Phinney wrote: -- Behzad [EMAIL PROTECTED] wrote (on Sunday, 31 August 2008, 01:23 AM +0330): and This is still true when using CSRF hash element under Ajax. Is there any solution to these problems? Ralph just notified me that there is a flag that can be passed to setExpirationHops() that counts on usage only. I will be updating the Hash and Captcha elements to utilize this flag for the 1.6.1 release. Outch 1.6.1 ... We should have this in RC4 ou 1.6.0 final. Without that I'm describing in the other mail : Could we imagine that captcha doesn't expire before it use by it's own composent a form-isValid or a new call to it. There's timeout, gc and so to master the situation. It's a bit bizarre for a comportment. How we would work if component A invalidate their session values when we call component B ? Really we need a solution to make this functional otherwise all ajax functionalities inside forms would never work. Why waiting a complete release cycle. In addition to the setExpirationHops() I really think it shouldn't disappear without it's own call. Who knowns in advance how much time a user would call this or this ajax function. ? On 8/30/08, Matthew Weier O'Phinney [EMAIL PROTECTED] wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Saturday, 30 August 2008, 07:19 PM +0200): Hi all, running actually the 1.6.0 RC3 I've found something very annoying Is it a bug I've not the competencies to tell that. I've a form with a Zend_Form_Captcha_Image which work at the first call. After the Firt call which initialize the form ... cat sess_HCX6b22TxA1CAJS5JUTLv0 SFS|a:2:{s:4:lang;s:2:fr;s:6:locale;O:11:Zend_Locale:1:{s:10:*_locale;s:5:fr_CH;}}MVC|a:3:{s:6:action;s:8:showedit;s:10:controller;s:5:users;s:6:module;s:7:default;}__ZF|a:1:{s:50:Zend_Form_Captcha_b1254ab372b888c729d44b66658a015c;a:2:{s:4:ENGH;i:1;s:3:ENT;i:1220116330;}}Zend_Form_Captcha_b1254ab372b888c729d44b66658a015c|a:1:{s:4:word;s:8:3a8yf9m5;} I can see the captcha word, and if the user send directly the form everything work fine ( isValid ) But after the form is displayed on the user browser, is this one call help ( to know how to fill the form for example ) Help is a little ajax call to a basic controller which display a view selected by a module param in a hidden div. And if I cat the session just after the ajax call was treated cat sess_HCX6b22TxA1CAJS5JUTLv0 SFS|a:2:{s:4:lang;s:2:fr;s:6:locale;O:11:Zend_Locale:1:{s:10:*_locale;s:5:fr_CH;}}MVC|a:3:{s:6:action;s:5:index;s:10:controller;s:4:help;s:6:module;s:7:default;}__ZF|a:1:{s:50:Zend_Form_Captcha_b1254ab372b888c729d44b66658a015c;a:1:{s:3:ENT;i:1220116330;}} I can see that the captcha word has disappear I don't remember if this was the case ( but I don't think so ) in RC2. Could some one have a check on this ? Any help would be greatly appreciate. The captcha expires after one session hop -- so the ajax call is basically invalidating the captcha. (This was true of RC2, too, btw.) -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- Kind regards, -behzad -- Bruno Friedmann Ioda-Net Sàrl 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 www.ioda-net.ch Centre de Formation et de Coaching En Ligne www.cfcel.com
Re: [fw-general] Zend_Form_Captcha session word disappear after an Ajax call to other controller. bug ?
Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Sunday, 31 August 2008, 02:56 PM +0200): Matthew Weier O'Phinney wrote: -- Behzad [EMAIL PROTECTED] wrote (on Sunday, 31 August 2008, 01:23 AM +0330): and This is still true when using CSRF hash element under Ajax. Is there any solution to these problems? Ralph just notified me that there is a flag that can be passed to setExpirationHops() that counts on usage only. I will be updating the Hash and Captcha elements to utilize this flag for the 1.6.1 release. Outch 1.6.1 ... We should have this in RC4 ou 1.6.0 final. We're not going to delay 1.6.0 for this; it's not functionality utilized in the majority of applications (unlike, say Zend_Config, or a major issue in the router). 1.6.1 will be following very closely -- likely 7-10 days after 1.6.0 drops. Ok I can understand that, I wouldn't have finish my app during the next 12 days :-) Without that I'm describing in the other mail : Could we imagine that captcha doesn't expire before it use by it's own composent a form-isValid or a new call to it. There's timeout, gc and so to master the situation. Again, we know a solution at this time, and you can actually utilize it now by grabbing the session namespace object from the element and manually calling setExpirationHops yourself and setting the third argument ($hopCountOnUsageOnly) to boolean true. In the case of the captcha form element: $element-getCaptcha()-getSession()-setExpirationHops(1, null, true); ok I include this in my Zend_Form but it doesn't change anything ( each time a call is made the line with the word in session disappear .. ) Here's what I've got... After the display of captcha cat sess_P38Ka0qMrujjw9pFnNoHP0 __ZF|a:4:{s:50:Zend_Form_Captcha_7e2873ea800e0859059ad7526fd1a409;a:2:{s:3:ENT;i:1220192712;s:4:ENNH;i:10;}s:50:Zend_Form_Captcha_2c5be86d4685da9996807c9acb99876d;a:1:{s:3:ENT;i:1220192712;}s:50:Zend_Form_Captcha_f630a468820cbc8ee207306ed2512280;a:3:{s:4:ENGH;i:1;s:3:ENT;i:1220192881;s:4:ENNH;i:10;}s:50:Zend_Form_Captcha_6a6b876b9c97136af5139e000dedc5ea;a:2:{s:4:ENGH;i:1;s:3:ENT;i:1220192881;}}Zend_Form_Captcha_6a6b876b9c97136af5139e000dedc5ea|a:1:{s:4:word;s:8:da79j9wo;} After an ajax call cat sess_P38Ka0qMrujjw9pFnNoHP0 __ZF|a:4:{s:50:Zend_Form_Captcha_7e2873ea800e0859059ad7526fd1a409;a:1:{s:4:ENNH;i:10;}s:50:Zend_Form_Captcha_2c5be86d4685da9996807c9acb99876d;a:0:{}s:50:Zend_Form_Captcha_f630a468820cbc8ee207306ed2512280;a:2:{s:3:ENT;i:1220192881;s:4:ENNH;i:10;}s:50:Zend_Form_Captcha_6a6b876b9c97136af5139e000dedc5ea;a:1:{s:3:ENT;i:1220192881;} Really I don't read this fluently :-) The Hash form element unfortunately cannot benefit from this currently as the expiration hops are set during render(); we'll need to modify it to allow this functionality. In the meantime, you can create a custom decorator that resets the expiration hops and renders the final hash input: class My_Form_Decorator_Hash extends Zend_Form_Decorator_Abstract { public function render($content) { if (null === ($element = $this-getElement())) { return $content; } if (null === ($view = $element-getView())) { return $content; } $element-getSession-setExpirationHops(1, null, true); return $view-formHidden( $element-getFullyQualifiedName(), $element-getValue() ); } } (untested) It's a bit bizarre for a comportment. How we would work if component A invalidate their session values when we call component B ? Really we need a solution to make this functional otherwise all ajax functionalities inside forms would never work. Why waiting a complete release cycle. In addition to the setExpirationHops() I really think it shouldn't disappear without it's own call. Who knowns in advance how much time a user would call this or this ajax function. ? On 8/30/08, Matthew Weier O'Phinney [EMAIL PROTECTED] wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Saturday, 30 August 2008, 07:19 PM +0200): Hi all, running actually the 1.6.0 RC3 I've found something very annoying Is it a bug I've not the competencies to tell that. I've a form with a Zend_Form_Captcha_Image which work at the first call. After the Firt call which initialize the form ... cat sess_HCX6b22TxA1CAJS5JUTLv0 SFS|a:2:{s:4:lang;s:2:fr;s:6:locale;O:11:Zend_Locale:1:{s:10:*_locale;s:5:fr_CH;}}MVC|a:3:{s:6:action;s:8:showedit;s:10:controller;s:5:users;s:6:module;s:7:default;}__ZF|a:1:{s:50:Zend_Form_Captcha_b1254ab372b888c729d44b66658a015c;a:2:{s:4:ENGH;i:1;s:3:ENT;i:1220116330;}}Zend_Form_Captcha_b1254ab372b888c729d44b66658a015c|a:1:{s:4:word;s:8:3a8yf9m5;} I can see the captcha word, and if the user send directly the form everything work fine ( isValid ) But after the form is displayed on the user
Re: [fw-general] Zend_Form Label with script
Matthew Weier O'Phinney wrote: -- Bruno Friedmann [EMAIL PROTECTED] wrote (on Tuesday, 26 August 2008, 09:50 AM +0200): Hi All, I have to ask for this because not found anything in archives nor Google or Yahoo. I need to have a label ( for a select element in Zend_Form ) this label must contain a link like this a href=# onclick=javascript: alert('thing');More/a $mylink = 'a href=# onclick=javascript: alert('thing');More/a'; $element = new Zend_Form_Element_Select('partnerid'); $element-addMultiOptions($this-partners_array) -setRequired(true) -setLabel( 'this is normal text' . $mylink ) -setAttrib('size', 1) -setAttrib('maxlength', 1) -setAttrib('onclick', 'javascript: ShowPartnerDetails(); return false;') -addFilter($filterTags) -addFilter($filterTrim) -addValidator($validatorNotEmpty, true) -addValidator($validatorNum, true) -setValue(1) ; $this-addElement($element); Of course like this it's render with htmlentities ( did I mention I hate it :-) I couldn't be able to find how to make this or which method options I've to call. Has someone a way ? After you've setup the element, grab the label decorator: $decorator = $element-getDecorator('Label'); and then tell it not to escape: $decorator-setOption('escape', false); Alternately, you can do this at configuration time when setting up the decorator -- add an additional 'escape' option to pass to it. And that's all there is to it. I knew that's the anwser would be simple ... :-) Thanks, in one or two month with lot's forms builded I will understand all subtle details of Zend_Form Many thanks for this ... -- Bruno Friedmann
[fw-general] Zend_Validate regex way to soluce ?
Hi All, I need to allow many special thing to be allowed in a username login field. (Historical database, so it would nearly impossible to change all this username) I need all Alpha numeric word present in french,english,german language so there a lot's of à é ö ü etc ... Plus username could contain _ - . and space isAlnum doesn't work ( I'm not surprise about that ) so I think I need to work with the regex filter Is there some expert around with regex which can give me the working regex [tests-case-good] Clément Hans Höln Ioda-Net Marius_Glad Micky.128 [test-case-bad] Some!thing Real[Name] Zut^Truc I will really thank peoples who can help me on this case. -- Bruno Friedmann
Re: [fw-general] Zend_Validate regex way to soluce ?
Matthias Coy wrote: Hi there, I don't know about Zend_Validate, but preg_match works with unicode-characters. So please read http://www.regular-expressions.info/unicode.html for more info, especially the part Unicode Character Properties. S.th. like [\p{L}\.\-_ ]+ could work (untested). Thanks for the link. I've read it before. My trouble is the following a 1 ?php 2 echo ( (@preg_match('/\pL/u', 'a')) ? Supported : Non supported); 3 die(PHP_EOL); return Supported on my computers So something like Clément is working well ( with filter-Alnum ) But with the regexp everything is accepted ... and that's not what I want. Did I really need to extend Alnum to add myself the 3-4 extended characters allowed ? Regards Matthias Coy Original-Nachricht Datum: Fri, 15 Aug 2008 16:42:35 +0200 Von: Bruno Friedmann [EMAIL PROTECTED] An: fw-general fw-general@lists.zend.com Betreff: [fw-general] Zend_Validate regex way to soluce ? Hi All, I need to allow many special thing to be allowed in a username login field. (Historical database, so it would nearly impossible to change all this username) I need all Alpha numeric word present in french,english,german language so there a lot's of à é ö ü etc ... Plus username could contain _ - . and space isAlnum doesn't work ( I'm not surprise about that ) so I think I need to work with the regex filter Is there some expert around with regex which can give me the working regex [tests-case-good] Clément Hans Höln Ioda-Net Marius_Glad Micky.128 [test-case-bad] Some!thing Real[Name] Zut^Truc I will really thank peoples who can help me on this case. -- Bruno Friedmann -- Bruno Friedmann Ioda-Net Sàrl - www.ioda-net.ch 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com
Re: [fw-general] Zend_Validate regex way to soluce ?
Thank you Matthias, I've try this and I just surprise about in the script it work as expected ... (no doubt about :-) But when use with Zend_Form (My description of Form are in .ini file ) like this user.elements.userlogin.options.validators.regex.validator = regex user.elements.userlogin.options.validators.regex.options.pattern = /^[\p{L}\.\-_ 0-9]+$/ui or user.elements.userlogin.options.validators.regex.options.pattern = /^[\p{L}\.\-_ 0-9]+$/ It just accept anything ! :-((( Just annoying ... PS : I hate regex power :-) Matthias Coy wrote: Hi, ok, I missed the ^ and $. So here is a working example: ?php header('Content-Type: text/html; charset=UTF-8',true); $input = array (Clément, Marius_Glad, Micky.128, Some!thing, Real[Name], Zut^Truc); foreach($input as $entry) { echo $entry; echo br /; if (preg_match('/^[\p{L}\.\-_ 0-9]+$/', trim($entry))) { echo \tSupported; } else { echo \tNot Supported; } echo br /; echo br /; } ? Original-Nachricht Datum: Fri, 15 Aug 2008 17:22:52 +0200 Von: Bruno Friedmann [EMAIL PROTECTED] An: Matthias Coy [EMAIL PROTECTED] CC: fw-general fw-general@lists.zend.com Betreff: Re: [fw-general] Zend_Validate regex way to soluce ? Matthias Coy wrote: Hi there, I don't know about Zend_Validate, but preg_match works with unicode-characters. So please read http://www.regular-expressions.info/unicode.html for more info, especially the part Unicode Character Properties. S.th. like [\p{L}\.\-_ ]+ could work (untested). Thanks for the link. I've read it before. My trouble is the following a 1 ?php 2 echo ( (@preg_match('/\pL/u', 'a')) ? Supported : Non supported); 3 die(PHP_EOL); return Supported on my computers So something like Clément is working well ( with filter-Alnum ) But with the regexp everything is accepted ... and that's not what I want. Did I really need to extend Alnum to add myself the 3-4 extended characters allowed ? Regards Matthias Coy Original-Nachricht Datum: Fri, 15 Aug 2008 16:42:35 +0200 Von: Bruno Friedmann [EMAIL PROTECTED] An: fw-general fw-general@lists.zend.com Betreff: [fw-general] Zend_Validate regex way to soluce ? Hi All, I need to allow many special thing to be allowed in a username login field. (Historical database, so it would nearly impossible to change all this username) I need all Alpha numeric word present in french,english,german language so there a lot's of à é ö ü etc ... Plus username could contain _ - . and space isAlnum doesn't work ( I'm not surprise about that ) so I think I need to work with the regex filter Is there some expert around with regex which can give me the working regex [tests-case-good] Clément Hans Höln Ioda-Net Marius_Glad Micky.128 [test-case-bad] Some!thing Real[Name] Zut^Truc I will really thank peoples who can help me on this case. -- Bruno Friedmann
Re: [fw-general] Zend_Validate regex way to soluce ? Bug inside ....
Ok so there's a bug somewhere in Zend_Form. Your function work perfectly here against the pattern. But if you try it by the .ini form contruction it doesn't complain. (like I've describe at the begining) But now we are sure where the trouble is :-)) ( Perharps a stupid htmlEntities somewhere or other implicit conversion ( I hate this ) ) I've put Matthew also in copy Perharps we need to add a Jira Issue about that. Many many thanks Matthias. It's not easy to keep confident when hit by strange behaviour. Matthias Coy wrote: Again me :) Final solution: ?php require_once Zend/Loader.php; Zend_Loader::registerAutoload(); $pattern = /^[\p{L}\.\-_ 0-9]+$/; $form = new Zend_Form; $form-setMethod(post); $regex = new Zend_Form_Element_Text('regex'); $regex-setLabel(Try here:); $regex-addValidator(new Zend_Validate_Regex($pattern)); if ($_POST['regex'] != ) { $regex-setValue($_POST['regex']); } else { $regex-setValue(Clément); } $form-addElement($regex); $view = new Zend_View(); $view-setEncoding('UTF-8'); header('Content-Type: text/html; charset=UTF-8',true); $form-setView($view); echo $form; try { if ($_POST) { echo ' . $_POST['regex'] . ' against ' . $pattern . 'br /; if (!$form-isValid($_POST)) { echo Not Supported; } else { echo Supported; } } } catch (Exception $e) { echo 'Caught exception: ', $e-getMessage(), \n; } ? worked for me. Regards Matthias Original-Nachricht Datum: Fri, 15 Aug 2008 20:59:53 +0200 Von: Matthias Coy [EMAIL PROTECTED] An: Matthias Coy [EMAIL PROTECTED], [EMAIL PROTECTED] CC: fw-general@lists.zend.com Betreff: Re: [fw-general] Zend_Validate regex way to soluce ? ok, worked faster than I expected. But I only have a windows machine and with this code, preg_match gives back a internal error. I think this is related to my machine, so could you please test that on your side? Should work out of the box, if 'Zend/Loader.php' is in your path: ?php require_once Zend/Loader.php; Zend_Loader::registerAutoload(); $form = new Zend_Form; $form-setMethod(post); $regex = new Zend_Form_Element_Text('regex'); $regex-setLabel(Try here:); $regex-addValidator(new Zend_Validate_Regex(^[\p{L}\.\-_ 0-9]+$)); $form-addElement($regex); $form-setView(new Zend_View()); echo $form; try { if ($_POST) { if (!$form-isValid($_POST)) { echo Not Supported; } else { echo Supported; } } } catch (Exception $e) { echo 'Caught exception: ', $e-getMessage(), \n; } ? Regards Matthias Original-Nachricht Datum: Fri, 15 Aug 2008 20:47:11 +0200 Von: Matthias Coy [EMAIL PROTECTED] An: Bruno Friedmann [EMAIL PROTECTED] CC: fw-general@lists.zend.com Betreff: Re: [fw-general] Zend_Validate regex way to soluce ? ok, I don't have a running Zend-Framework here, but I've downloaded the code and the Zend_Validate_Regex is using preg_match, so that SHOULD work ... why it doesn't in your case, that's out of my knowledge. I will try to set up a running minimal ZF to create a use case, but I have also some work to do :) Regards Matthias Original-Nachricht Datum: Fri, 15 Aug 2008 20:11:13 +0200 Von: Bruno Friedmann [EMAIL PROTECTED] An: CC: fw-general@lists.zend.com Betreff: Re: [fw-general] Zend_Validate regex way to soluce ? Thank you Matthias, I've try this and I just surprise about in the script it work as expected ... (no doubt about :-) But when use with Zend_Form (My description of Form are in .ini file ) like this user.elements.userlogin.options.validators.regex.validator = regex user.elements.userlogin.options.validators.regex.options.pattern = /^[\p{L}\.\-_ 0-9]+$/ui or user.elements.userlogin.options.validators.regex.options.pattern = /^[\p{L}\.\-_ 0-9]+$/ It just accept anything ! :-((( Just annoying ... PS : I hate regex power :-) Matthias Coy wrote: Hi, ok, I missed the ^ and $. So here is a working example: ?php header('Content-Type: text/html; charset=UTF-8',true); $input = array (Clément, Marius_Glad, Micky.128, Some!thing, Real[Name], Zut^Truc); foreach($input as $entry) { echo $entry; echo br /; if (preg_match('/^[\p{L}\.\-_ 0-9]+$/', trim($entry))) { echo \tSupported; } else { echo \tNot Supported; } echo br /; echo br /; } ? Original-Nachricht Datum: Fri, 15 Aug 2008 17:22:52 +0200 Von: Bruno Friedmann [EMAIL PROTECTED] An: Matthias Coy [EMAIL PROTECTED] CC: fw-general fw-general@lists.zend.com Betreff: Re: [fw-general] Zend_Validate regex way to soluce ? Matthias Coy wrote: Hi there, I don't know about Zend_Validate, but preg_match works with unicode-characters. So please read http://www.regular-expressions.info/unicode.html for more info, especially the part Unicode Character Properties. S.th. like [\p{L}\.\-_ ]+ could
[fw-general] Zend_Date + Zend_Locale bug ( missing translation localisation ? )
Hi all While working on date I've found a strange result ( ZF is 1.6.0RC1 but same result with 1.5.3 ) $date['en'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'en'); $date['en_US'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'en_US'); $date['en_GB'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'en_GB'); $date['fr'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'fr'); $date['fr_FR'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'fr_FR'); $date['fr_CH'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'fr_CH'); $date['de'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'de'); $date['de_DE'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'de_DE'); $date['de_CH'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'de_CH'); $date['it'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'it'); $date['it_IT'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'it_IT'); $date['it_CH'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'it_CH'); echo divpre; foreach ($date as $key = $value){ print $key .\t = \t .$value-getDate($key) .\n; } echo /pre/div; result en = Aug 10, 2008 1:00:00 AM en_US= Aug 10, 2008 1:00:00 AM en_GB= 10 Aug 2008 01:00:00 fr = 10 août 2008 01:00:00 fr_FR= 10 août 2008 01:00:00 fr_CH= 10 août 2008 01:00:00 de = 10.08.2008 01:00:00 de_DE= 10.08.2008 01:00:00 de_CH= 10.08.2008 01:00:00 it = 10/ago/2008 01:00:00 it_IT= 10/ago/2008 01:00:00 it_CH= 10-ago-2008 01:00:00 As you can see, there's a trouble with all the DE and associated languages. (I've check all files de.xml and so are present in the library directory and readble and have right content. Could someone confirm and / or explain me what I'm doing wrong. Also if someone could give me the instruction to have only the date without the time.. I've try what is explain here. http://framework.zend.com/manual/en/zend.date.constants.html Table 9.15. Date and Time Formats (format varies by locale) -- Bruno Friedmann
Re: [fw-general] Zend_Date + Zend_Locale bug ( missing translation localisation ? )
Thomas Weidner wrote: Hy Bruno, why do you think this is a problem ? Each locale defines the dateformats in a different way. OK I have learn that. But my real concern is why I don't get the translation for DE, de_DE, de_CH ? And you defined to return the default date/time format from this locale. Btw: Using DATE_FULL as input where no input is given is quite useless. It will be ignored. ;-) I have misunderstood the documentation I'm thinking that if I don't give it automatically use time(); And when you want to have a fixed outputformat you should define it. That's exactly why I ask a localized format ;-) Otherwise the old php date would be sufficient no ? Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: Bruno Friedmann [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Sunday, August 10, 2008 11:15 AM Subject: [fw-general] Zend_Date + Zend_Locale bug ( missing translation localisation ? ) Hi all While working on date I've found a strange result ( ZF is 1.6.0RC1 but same result with 1.5.3 ) $date['en'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'en'); $date['en_US'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'en_US'); $date['en_GB'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'en_GB'); $date['fr'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'fr'); $date['fr_FR'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'fr_FR'); $date['fr_CH'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'fr_CH'); $date['de'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'de'); $date['de_DE'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'de_DE'); $date['de_CH'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'de_CH'); $date['it'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'it'); $date['it_IT'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'it_IT'); $date['it_CH'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'it_CH'); echo divpre; foreach ($date as $key = $value){ print $key .\t = \t .$value-getDate($key) .\n; } echo /pre/div; result en = Aug 10, 2008 1:00:00 AM en_US = Aug 10, 2008 1:00:00 AM en_GB = 10 Aug 2008 01:00:00 fr = 10 août 2008 01:00:00 fr_FR = 10 août 2008 01:00:00 fr_CH = 10 août 2008 01:00:00 de = 10.08.2008 01:00:00 de_DE = 10.08.2008 01:00:00 de_CH = 10.08.2008 01:00:00 it = 10/ago/2008 01:00:00 it_IT = 10/ago/2008 01:00:00 it_CH = 10-ago-2008 01:00:00 As you can see, there's a trouble with all the DE and associated languages. (I've check all files de.xml and so are present in the library directory and readble and have right content. Could someone confirm and / or explain me what I'm doing wrong. Also if someone could give me the instruction to have only the date without the time.. I've try what is explain here. http://framework.zend.com/manual/en/zend.date.constants.html Table 9.15. Date and Time Formats (format varies by locale) -- Bruno Friedmann Ioda-Net Sàrl - www.ioda-net.ch 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com
Re: [fw-general] Zend_Date + Zend_Locale bug ( missing translation localisation ? )
Sorry to bother you Master of Local Date. How should I call Zend_Date to have the following result for the actual time Donnerstag, 10. August 2008 That not indicate in doc not in api ( no sample given) Addition substract etc are present, but no sample code. Thomas Weidner wrote: Hy Bruno, Each locale defines the dateformats in a different way. OK I have learn that. But my real concern is why I don't get the translation for DE, de_DE, de_CH ? You did not ask for an output in a localized format. And you defined to return the default date/time format from this locale. Btw: Using DATE_FULL as input where no input is given is quite useless. It will be ignored. ;-) have misunderstood the documentation I'm thinking that if I don't give it automatically use time(); It uses time(), but why did you define DATE_FULL as input.. when you ask for the actual time as input it is useless to define another inputformat because time() will be caught as timestamp. And when you want to have a fixed outputformat you should define it. That's exactly why I ask a localized format ;-) Otherwise the old php date would be sufficient no ? No, you did not ask for a localized format. You just asked for the date returned as object without time. Look at the API doc of the methods you used. Using __toString in an inplicit way does not mean that the date is localized. This depends on the default format of the used locale. And german does not include a localized month in the default format. There is no error. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com -- Bruno Friedmann Ioda-Net Sàrl - www.ioda-net.ch 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com
[fw-general] The how-to / what to do upgrading 1.5.2 to 1.6.0
Hi all, I'm just downloaded the 1.6 RC1 release to give it a try. I've just one trouble : no projects are running now. The worst there's no errors just a blank page. (All demo previously used have the same symptom ) I could imagine there's some changes, but there's no documentation about what a dev need to adapt inside projects to have them running. Or did I miss it ( there's could be a improvement like a update.txt file at the root of library ) ? PS : In documentation there chapter missing in the index ( 18 doesn't have title GDATA, 23 is not write and so ... ) -- Bruno Friedmann
Re: [fw-general] The how-to / what to do upgrading 1.5.2 to 1.6.0
till wrote: On Thu, Jul 24, 2008 at 4:31 AM, Bruno Friedmann [EMAIL PROTECTED] wrote: Hi all, I'm just downloaded the 1.6 RC1 release to give it a try. I've just one trouble : no projects are running now. The worst there's no errors just a blank page. (All demo previously used have the same symptom ) I could imagine there's some changes, but there's no documentation about what a dev need to adapt inside projects to have them running. Or did I miss it ( there's could be a improvement like a update.txt file at the root of library ) ? PS : In documentation there chapter missing in the index ( 18 doesn't have title GDATA, 23 is not write and so ... ) You probably want to enable: log_errors = On error_log = /path/to/a/writable/log/file Or maybe it is already enabled and you just need to check it out. To find out, do a phpinfo() and look for the above options. Till wouah ... As I've declare error_reporting(E_ALL E_STRICT); ini_set('display_startup_errors', 1); ini_set('display_errors', 1); in my bootstrap I has forgotten to see my php_error.log ... What I've found sound strange to me ... sorry never see this before ... :-) [error] [client 127.0.0.1] ALERT - Include filename ('zend.view:///home/bruno/workspace/socketfinder/sf/application/modules/default/views/scripts/index/index.phtml') is an URL that is not allowed (attacker '127.0.0.1', file '/ioda/data/web-include/ZF/library/Zend/View.php', line 105) -- Bruno Friedmann Ioda-Net Sàrl - www.ioda-net.ch 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com
Re: [fw-general] The how-to / what to do upgrading 1.5.2 to 1.6.0
Bruno Friedmann wrote: till wrote: On Thu, Jul 24, 2008 at 4:31 AM, Bruno Friedmann [EMAIL PROTECTED] wrote: Hi all, I'm just downloaded the 1.6 RC1 release to give it a try. I've just one trouble : no projects are running now. The worst there's no errors just a blank page. (All demo previously used have the same symptom ) I could imagine there's some changes, but there's no documentation about what a dev need to adapt inside projects to have them running. Or did I miss it ( there's could be a improvement like a update.txt file at the root of library ) ? PS : In documentation there chapter missing in the index ( 18 doesn't have title GDATA, 23 is not write and so ... ) You probably want to enable: log_errors = On error_log = /path/to/a/writable/log/file Or maybe it is already enabled and you just need to check it out. To find out, do a phpinfo() and look for the above options. Till wouah ... As I've declare error_reporting(E_ALL E_STRICT); ini_set('display_startup_errors', 1); ini_set('display_errors', 1); in my bootstrap I has forgotten to see my php_error.log ... What I've found sound strange to me ... sorry never see this before ... :-) [error] [client 127.0.0.1] ALERT - Include filename ('zend.view:///home/bruno/workspace/socketfinder/sf/application/modules/default/views/scripts/index/index.phtml') is an URL that is not allowed (attacker '127.0.0.1', file '/ioda/data/web-include/ZF/library/Zend/View.php', line 105) Ok found this is when suoshin module is loaded ... What strange is that with 1.5.2 ZF there's no trouble ... Can someone confirm ... -- Bruno Friedmann Ioda-Net Sàrl - www.ioda-net.ch 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com
Re: [fw-general] The how-to / what to do upgrading 1.5.2 to 1.6.0
It is related, I try to find where and how I can insert an issue But don't find it in jira. It's a big blocker if it goes release without mention !! Vincent de Lau wrote: The new Zend_View stream wrapper might have something to do with this, although I'm not sure it is included in 1.6RC1. See http://www.nabble.com/Zend_View-and-the-View-Stream-Wrapper-tc17607130ef15440.html#a17607130 Vincent de Lau [EMAIL PROTECTED] -Original Message- From: Bruno Friedmann [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2008 11:18 AM To: fw-general@lists.zend.com Subject: Re: [fw-general] The how-to / what to do upgrading 1.5.2 to 1.6.0 Bruno Friedmann wrote: till wrote: On Thu, Jul 24, 2008 at 4:31 AM, Bruno Friedmann [EMAIL PROTECTED] wrote: Hi all, I'm just downloaded the 1.6 RC1 release to give it a try. I've just one trouble : no projects are running now. The worst there's no errors just a blank page. (All demo previously used have the same symptom ) I could imagine there's some changes, but there's no documentation about what a dev need to adapt inside projects to have them running. Or did I miss it ( there's could be a improvement like a update.txt file at the root of library ) ? PS : In documentation there chapter missing in the index ( 18 doesn't have title GDATA, 23 is not write and so ... ) You probably want to enable: log_errors = On error_log = /path/to/a/writable/log/file Or maybe it is already enabled and you just need to check it out. To find out, do a phpinfo() and look for the above options. Till wouah ... As I've declare error_reporting(E_ALL E_STRICT); ini_set('display_startup_errors', 1); ini_set('display_errors', 1); in my bootstrap I has forgotten to see my php_error.log ... What I've found sound strange to me ... sorry never see this before ... :-) [error] [client 127.0.0.1] ALERT - Include filename ('zend.view:///home/bruno/workspace/socketfinder/sf/application/modules /default/views/scripts/index/index.phtml') is an URL that is not allowed (attacker '127.0.0.1', file '/ioda/data/web- include/ZF/library/Zend/View.php', line 105) Ok found this is when suoshin module is loaded ... What strange is that with 1.5.2 ZF there's no trouble ... Can someone confirm ... -- -- Bruno Friedmann
Re: [fw-general] Memory leak in Zend_Date?
Lars Strojny wrote: Hi Matthew, Am Samstag, den 12.07.2008, 19:11 -0400 schrieb Matthew Weier O'Phinney: [...] Lars -- can you provide some benchmarks that show the memory differences between Zend_Date and DateTime? I'm curious to see if we might be able to isolate the performance issues, if any, and improve the situation. You can find the results attached. The benchmark suite can be found at http://lars.schokokeks.org/php/time-bench.phps cu, Lars Here You will find some tests made with the Lars benchmark code. I join also my phpinfo as I 've a quiet big number of large module (clamav,mapserver/phpmapscrip/pdflib) Computer is a Dell Precision M4300 with the cpu running at 2.4Ghz (Core2Duo centrino) with 4GB ram and a 7200 rpms hdd. Hope this help you to find some numbers. -- Bruno Friedmann Ioda-Net Sàrl - www.ioda-net.ch 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com phpinfo.txt.bz2 Description: application/bzip Instanciating Zend_Date - Average memory usage: 38.976000 - Overall memory usage: 38976.00 - Average time consumed (mS): 0.000665 - Overall time consumed: (mS): 0.664856 Instanciating DateTime - Average memory usage: 0.08 - Overall memory usage: 80.00 - Average time consumed (mS): 0.05 - Overall time consumed: (mS): 0.005224 Returning a formatted date with DateTime - Average memory usage: 0.00 - Overall memory usage: 0.00 - Average time consumed (mS): 0.02 - Overall time consumed: (mS): 0.001551 Returning a formatting date with with Zend_Date - Average memory usage: 6.704000 - Overall memory usage: 6704.00 - Average time consumed (mS): 0.000314 - Overall time consumed: (mS): 0.313712
Re: [fw-general] Implementing SSL with Zend Framework
The other simple way if you have apache is telling the virtual host Virtualhost *:80 servername machin redirect / https://machin /Virtualhost Et voilà ! Every resquest on http is carefully redirected on https. Isaak Malik wrote: The SSL forcing can easily be created with the following code: ?php if ( !isset($_SERVER['HTTPS']) ) header('Location: https://www.yourdomain.com'); ? If you include this code at the beginning of your page this will force a SSL connection for that page. On Sat, Mar 22, 2008 at 6:44 AM, photo312 [EMAIL PROTECTED] wrote: You are correct. What I meant is - is there any functionality to force https over http or make only certain models or actions work only over SSL connections? Karl Katzke wrote: SSL is a function of your web *server*, such as apache or IIS, not of Zend Framework. On Sat, Mar 22, 2008 at 12:29 AM, photo312 [EMAIL PROTECTED] wrote: I would like to implement SSL with Zend Framework. Is there some built in code to handle this properly? -- View this message in context: http://www.nabble.com/Implementing-SSL-with-Zend-Framework-tp16216607s16154p16216607.html Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Implementing-SSL-with-Zend-Framework-tp16216607s16154p16216688.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Bruno Friedmann [EMAIL PROTECTED] Ioda-Net Sàrl - www.ioda-net.ch 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com
[fw-general] Insert/update blob(bytea) field with DB
Hi All ZFer's After some tries I need some feedback about how to successfully update a bytea field in a pdo:pgsql database. Fetching the row with the $db-fetchRow work great. Now I trying to use a the $dbt-update() method $dbt is an object from Zend_Db_Table. Here the beginning public function setCroquis($data) { try{ // Update the croquis $where = $this-_db-quoteInto(croquis_id = ?, $data[croquis_id]); //$data[croquis] = pg_escape_bytea($data[croquis]); $n = $this-_db-update($this-_name, $data, $where); without the pg_escape_bytea I received an error about encoding blabla .. normal it try to insert string which is not the reality. With the pg_escape_bytea, the update is successful, but every \ get double so the png data is no more valid. \\211PNG\\015\\012... in place of \211PNG\015\ If anyone has some advise, I really thank you about that. -- Bruno Friedmann [EMAIL PROTECTED]
[fw-general] fetching a lob column from db ?
Hi all, actually working with ZF1.5 PR I'm facing about a simple trouble : I need to capture the content of a binary field from a postgresql db. with pdo there no trouble if you use the good param for column Working code with pdo croquis is a bytea field $str_dsn = 'pgsql:host=127.0.0.1;port=5432;dbname=sample'; try { $dbh = new PDO($str_dsn, $user='sample', $pass='sosimple'); } catch (PDOException $e) { print Error No connexion !: . $e-getMessage() . br /; die(); } try{ $cpt=1; $stmt = $dbh-prepare(SELECT no_point,croquis from \Vue_PFP\ WHERE no_point=? limit 1); if ($stmt-execute(array('16220197'))) { $stmt-bindColumn(1, $no_point, PDO::PARAM_STR, 256); $stmt-bindColumn(2, $croquis, PDO::PARAM_LOB); $stmt-fetch(PDO::FETCH_BOUND); fpassthru($croquis); $cpt++; } $dbh = null; } catch (PDOException $e) { print Error!: . $e-getMessage() . br /; die(); } Now I want the same in ZF but only obtain a ressource id ... $this-_pt_num = '16065420'; // First we check we have always the db object from registry if ( (Zend_Registry::isRegistered('db')) ( Zend_Registry::get('db') instanceof Zend_Db_Adapter_Abstract) ) { $this-_db = Zend_Registry::get('db'); }else{ throw new Zend_Exception('db object does not implement Zend_Db_Adapter_Abstract'); } try{ $select = $this-_db-select() -from($this-_tbl,array('croquis')) -where('croquis_id = ?',$this-_pt_num); $stmt = $select-query(); //$stmt-setFetchMode(Zend_Db::FETCH_LOB); --- $row = $stmt-fetchAll(); $this-_croquis = $row-croquis; } catch (Zend_Db_Adapter_Exception $e) { // perhaps a failed login credential, or perhaps the RDBMS is not running echo ZDBE somthing goes very wrong .$e; } catch (Zend_Exception $e) { // perhaps factory() failed to load the specified Adapter class echo ZE somthing goes very wrong .$e; } array(1) { [0]= object(stdClass)#37 (1) { [croquis]= resource(122) of type (stream) } } How can I do this one ??? Thanks for the help -- Bruno Friedmann [EMAIL PROTECTED] Ioda-Net Sàrl - www.ioda-net.ch 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com
Re: [fw-general] fetching a lob column from db ?
Bruno Friedmann wrote: Hi all, actually working with ZF1.5 PR I'm facing about a simple trouble : I need to capture the content of a binary field from a postgresql db. with pdo there no trouble if you use the good param for column Working code with pdo croquis is a bytea field $str_dsn = 'pgsql:host=127.0.0.1;port=5432;dbname=sample'; try { $dbh = new PDO($str_dsn, $user='sample', $pass='sosimple'); } catch (PDOException $e) { print Error No connexion !: . $e-getMessage() . br /; die(); } try{ $cpt=1; $stmt = $dbh-prepare(SELECT no_point,croquis from \Vue_PFP\ WHERE no_point=? limit 1); if ($stmt-execute(array('16220197'))) { $stmt-bindColumn(1, $no_point, PDO::PARAM_STR, 256); $stmt-bindColumn(2, $croquis, PDO::PARAM_LOB); $stmt-fetch(PDO::FETCH_BOUND); fpassthru($croquis); $cpt++; } $dbh = null; } catch (PDOException $e) { print Error!: . $e-getMessage() . br /; die(); } Now I want the same in ZF but only obtain a ressource id ... $this-_pt_num = '16065420'; // First we check we have always the db object from registry if ( (Zend_Registry::isRegistered('db')) ( Zend_Registry::get('db') instanceof Zend_Db_Adapter_Abstract) ) { $this-_db = Zend_Registry::get('db'); }else{ throw new Zend_Exception('db object does not implement Zend_Db_Adapter_Abstract'); } try{ $select = $this-_db-select() -from($this-_tbl,array('croquis')) -where('croquis_id = ?',$this-_pt_num); $stmt = $select-query(); //$stmt-setFetchMode(Zend_Db::FETCH_LOB); --- $row = $stmt-fetchAll(); $this-_croquis = $row-croquis; } catch (Zend_Db_Adapter_Exception $e) { // perhaps a failed login credential, or perhaps the RDBMS is not running echo ZDBE somthing goes very wrong .$e; } catch (Zend_Exception $e) { // perhaps factory() failed to load the specified Adapter class echo ZE somthing goes very wrong .$e; } array(1) { [0]= object(stdClass)#37 (1) { [croquis]= resource(122) of type (stream) } } How can I do this one ??? Thanks for the help ok awser to myself ... this one work as espected ... try{ $this-_db-setFetchMode(Zend_Db::FETCH_OBJ); $sql = $this-_db-quoteInto(SELECT * FROM .$this-_tbl. WHERE croquis_id = ?, $this-_pt_num); $row_croquis = $this-_db-fetchRow($sql); $this-_db-closeConnection(); } catch (Zend_Db_Exception $e) { // perhaps a failed login credential, or perhaps the RDBMS is not running throw $e; } catch (Zend_Exception $e) { // perhaps factory() failed to load the specified Adapter class throw Exception Factory Error : .$e; } fpassthru ($row_croquis-croquis); ;-) -- Bruno Friedmann [EMAIL PROTECTED] Ioda-Net Sàrl - www.ioda-net.ch 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com
Re: [fw-general] 1.0.4?!?!
+1 for me too. With a great and long applause ;-) Andries Seutens wrote: Hi Will, I'd like to encourage to do another mini-release like you suggest. +1 Best, Andriesss -- Bruno Friedmann
Re: [fw-general] Zend_Filter::isEmail, re. issue ZF-42
Hi Simon and others, Really happy to see something moving about isEmail For you isHostname I suggest to check tld available real tld are // TLD source http://data.iana.org/TLD/tlds-alpha-by-domain.txt $a_tlds = @file('tlds-alpha-by-domains.txt'); ok this impose local file ( which can be updated by cron jobs or admin ) And in my case I check the hostname with checkdnsrr to see if there one record or more. (I've a special case for windows os with a system call to dig and/or nslookup) But as always this impose network connection, but for the dns is took only 2 to 4 seconds fi there's not a plenty of resolver inside the web server. Checking about the domain part (without the tld) wouldn't be easy, because differents rules applies to each tld authority. For example in Switzerland your domain should be 26 max length, but now they accept IDN domain (think to müller ) and the domain max length is 64. ... I'm not really agree with your asynchrone checking. Because how to says to a anonymous user behind is browser that's the email he entered is some kind of wrong. Before the massive usage of greylisting, i've used a network method to directly speak with the mailers founds in DNS. To see if I've a mail to this user would be accepted. And it works very nice ! And 100% email are true. But I've no time to adapt it to greylisting error message. Hope to see your work next release :-)) Happy new year. Simon R Jones wrote: Hi there, I've been taking a brief look at Zend_Filter::isEmail over the Xmas hol to see if I can tackle it and have a suggested starting point, which I've copied below. I was going to add this to the Issue Tracker, but I've had some problems accessing it this morning. This issue also seems to have been reported by Andris Paikens. The method below splits up the email address and uses the existing test Zend_Filter::isHostname to match the domain (which I think may need checking against the RFC). The local part of the email is then matched first against dot-atom characters, which should cover 99% of all email addresses. The RFC also states emails can also be in the quoted form or an obsolete form. Previous email checkers I've reviewed seem to create regexes to match all 3 possible formats, but since 99% of all email addresses will be covered by the standard dot-atom I think it's better to first check for that. Which I also think will be faster. You'll see from the code below if the dot-atom characters aren't matched further checks could be made against the quoted format and obselete ones - though I haven't done those yet. The current code below will work for most common emails, so with some testing could arguably be implemented now to provide some email testing functionality. -- public static function isEmail($value) { // Split email address up if (preg_match('/^([EMAIL PROTECTED])@([EMAIL PROTECTED])$/', $value, $matches)) { $localPart = $matches[1]; $domain= $matches[2]; // Match domain part (allow hostnames and IP addresses) $domainResult = self::isHostname($domain, 3); // First try to match the local part on dot-atom characters // since this is the most common format $localResult = false; // Dot-atom characters // ALPHA / DIGIT / and !, #, $, %, , ', *, +, // -, /, =, ?, ^, _, `, {, |, }, ~, . // Dot character . must be surrounded by other non-dot characters $dotAtom = '[a-zA-Z0-9\x21\x23\x24\x25\x26\x27\x2a\x2b\x2d\x2f\x3d'; $dotAtom .= '\x3f\x5e\x5f\x60\x7b\x7c\x7d\x7e\x2e]'; // TODO: speed test strpos instead of preg_match for dot in start and end of string if ( (preg_match('/^' . $dotAtom . '+$/', $localPart)) (!preg_match('/^\x2e/', $localPart)) (!preg_match('/\x2e$/', $localPart)) ) { $localResult = true; } // If not matched, try quoted string format if (!$localResult) { // TODO } // if not matched, try obsolete format if (!$localResult) { // TODO } if ($localResult $domainResult) { return true; } } return $false; } -- There was also some mention of this method checking the network to see if the email address actually is valid. I am not sure if that is actually required, though I don't beleive this is the best place for that kind of check. An email address tester should simply check the format, a separate network tool would be required to actually test for a valid email. Network checking would also impose a time delay so is probably best used asynchronously in a separate cron script. best wishes, Simon -- Bruno Friedmann [EMAIL PROTECTED] Ioda-Net Sàrl c/o RFV, H. Vauclair SA Rue de l'Avenir 12 2800
Re: [fw-general] Zend_Filter::isEmail, re. issue ZF-42
Simon R Jones wrote: Hi Bruno, Thanks for the links on isHostname format validity - I'll check them out. On checking the actual validity of an email address, I agree it would be great to give instant feedback to a user that the actual entered email address is invalid. However, I believe for most apps this would slow down the validation process too much (could easily be seconds). Forcing this to be within isEmail would be a bad thing in my opinion. I think this is more an application design issue, and any functionality to actually check a real email should be in some kind of network library (or another method in Zend_Filter). Then developers have the choice of using isEmail to check the syntax and also a network tool to check for the real email. Some developers may wish to do this when the user enters their email, some may wish to leave this task to an automated script to eliminate bad emails. Also, wouldn't the most reliable way to determine if an email is valid via the network be first get the MX domain which is used for that email address, and then open a connection to the domain on port 25 and send some sample commands, i.e. # dig MX yourdomain.com - returns mail.yourdomain.com as the answer to this DNS query # telnet mail.yourdomain.com 25 # HELO mydomain.com # MAIL FROM:[EMAIL PROTECTED] # RCPT TO:[EMAIL PROTECTED] This would usually return a status of 250 if the email address is valid. best wishes, Si Yes the modular approach is the best one ... Syntax check, Network check. For what you explain at the end is the most difficult part. Think about greylisting ( receiver mailer send a error first and a delay for coming back usually 180 sec ) Or what about mailer that's just couldn't be reache at the time we check ... It's not a trouble for a real mailer it will retry some time later, but our script it is ... :-)) I vote + for the syntax check first, and have reflexion next time ( release 0.9 ? :-))) -- Bruno Friedmann [EMAIL PROTECTED]
[fw-general] Any idea how-to have PDO::ATTR_PERSISTENT = true
Hello all, I'm looking a way to pass PDO::ATTR_PERSISTENT = true in the Zend_Db factory ... Any ideas how to put it in a config.ini way or anything else. $param = Zend::registry('config')-db-config-asArray(); //-$param [] = array( PDO::ATTR_PERSISTENT = true); $db = Zend_Db::factory(Zend::registry('config')-db-adapter, $param); Zend_Db_Table::setDefaultAdapter($db); Thanks for the trip if it existe. -- Bruno Friedmann [EMAIL PROTECTED] Ioda-Net Sàrl c/o RFV, H. Vauclair SA Rue de l'Avenir 12 2800 Delémont - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 www.ioda-net.ch Solutions informatiques et internet, coaching et relooking www.cfcel.com Centre de formation et de coaching en ligne