Re: [PHP] How to PHP get bit depth of a given PNG image file?
On 06/15/2011 10:11 PM, Nam Gi VU wrote: Hi everyone, In PHP code, given an .png image path, I need to detect the bit-depth of that image. How can I do that? I've tried to use getImageSize() and read the bits as below sample code but it always returns '8' for 24-bits/32-bits image. Reading the manual, it says: channels will be 3 for RGB pictures and 4 for CMYK pictures. bits is the number of bits for each color. So, to get the total bit depth, I think you need to multiply by the number of colors, which is in the channels element. Cheers, Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to PHP get bit depth of a given PNG image file?
Thank you Mattias, I'll look at `channels` again. Regards, Nam On Thu, Jun 16, 2011 at 1:06 PM, Mattias Thorslund matt...@thorslund.uswrote: On 06/15/2011 10:11 PM, Nam Gi VU wrote: Hi everyone, In PHP code, given an .png image path, I need to detect the bit-depth of that image. How can I do that? I've tried to use getImageSize() and read the bits as below sample code but it always returns '8' for 24-bits/32-bits image. Reading the manual, it says: channels will be 3 for RGB pictures and 4 for CMYK pictures. bits is the number of bits for each color. So, to get the total bit depth, I think you need to multiply by the number of colors, which is in the channels element. Cheers, Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to PHP get bit depth of a given PNG image file?
I think the documentation is a bit unclear about the fact that colors and channels are the same thing here. The line about bits should probably say bits is the number of bits for each *channel*. Mattias On 06/15/2011 11:11 PM, Nam Gi VU wrote: Thank you Mattias, I'll look at `channels` again. Regards, Nam On Thu, Jun 16, 2011 at 1:06 PM, Mattias Thorslundmatt...@thorslund.uswrote: On 06/15/2011 10:11 PM, Nam Gi VU wrote: Hi everyone, In PHP code, given an .png image path, I need to detect the bit-depth of that image. How can I do that? I've tried to use getImageSize() and read the bits as below sample code but it always returns '8' for 24-bits/32-bits image. Reading the manual, it says: channels will be 3 for RGB pictures and 4 for CMYK pictures. bits is the number of bits for each color. So, to get the total bit depth, I think you need to multiply by the number of colors, which is in the channels element. Cheers, Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Doctrine madness!
Hi gang, If anyone out there has some experience w/ Doctrine now would be a great time to share it! So I'm writing a batch importer and noticed memory usage climbing during script execution. In the debugging effort I've isolated it down to a Doctrine issue. Here's what's going on, I instantiate a model object for the product table from my application $newRecord = new Product(); at this point memory usage goes up noticeably. I don't really care though because I figure I can delete it, but look at this madness I have going (which *fails* to free up the memory) $newRecord-clearRelated(); $newRecord-free(); unset($newRecord); gc_collect_cycles(); after all of this memory consumption is still dramatically higher than prior to the first call creating the object above. This I've verified through memory_get_usage(). here's the output from the memory_get_usage() calls int(166461440) // before new Product() int(169345024) // directly after new Product() int(169345024) // after madness trying to free memory used by new Product() I've also tried an explicit call to the destructor of $newRecord, but that results in a fatal attempting to call an unknown method. Any help would be greatly appreciated as google hasn't been able to point me to the answer thus far. thx, -nathan
Re: [PHP] Convert a PDF to a PNG?
I have heard back from Rackspace and ImageMagick is not going to happen for the time being, but they say Ghostscript is installed. Is it possible to do this completely with GS without ImageMagick? The PDFs are text only. On Jun 15, 2011, at 2:28 AM, Richard Quadling wrote: I use PDF2PNG as this provides the cleanest output mechanism I've found. But I didn't try GS which, theoretically, should be perfect. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
Outside the box a bit, but is there perhaps a web-service that does this, something like http://www.thumbalizr.com/ but for PDF files. As long as you had curl or something you would be GTG at that point. -Sean- On Thu, Jun 16, 2011 at 1:48 PM, Brian Dunning br...@briandunning.com wrote: I have heard back from Rackspace and ImageMagick is not going to happen for the time being, but they say Ghostscript is installed. Is it possible to do this completely with GS without ImageMagick? The PDFs are text only. On Jun 15, 2011, at 2:28 AM, Richard Quadling wrote: I use PDF2PNG as this provides the cleanest output mechanism I've found. But I didn't try GS which, theoretically, should be perfect. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Doctrine madness!
On Thu, Jun 16, 2011 at 12:51 PM, Nathan Nobbe quickshif...@gmail.com wrote: Hi gang, If anyone out there has some experience w/ Doctrine now would be a great time to share it! So I'm writing a batch importer and noticed memory usage climbing during script execution. In the debugging effort I've isolated it down to a Doctrine issue. Here's what's going on, I instantiate a model object for the product table from my application $newRecord = new Product(); at this point memory usage goes up noticeably. I don't really care though because I figure I can delete it, but look at this madness I have going (which *fails* to free up the memory) $newRecord-clearRelated(); $newRecord-free(); unset($newRecord); gc_collect_cycles(); after all of this memory consumption is still dramatically higher than prior to the first call creating the object above. This I've verified through memory_get_usage(). here's the output from the memory_get_usage() calls int(166461440) // before new Product() int(169345024) // directly after new Product() int(169345024) // after madness trying to free memory used by new Product() I've also tried an explicit call to the destructor of $newRecord, but that results in a fatal attempting to call an unknown method. Any help would be greatly appreciated as google hasn't been able to point me to the answer thus far. thx, -nathan This might help http://php.net/manual/en/features.gc.collecting-cycles.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Doctrine madness!
On Thu, Jun 16, 2011 at 1:58 PM, Eric Butera eric.but...@gmail.com wrote: On Thu, Jun 16, 2011 at 12:51 PM, Nathan Nobbe quickshif...@gmail.com wrote: Hi gang, If anyone out there has some experience w/ Doctrine now would be a great time to share it! So I'm writing a batch importer and noticed memory usage climbing during script execution. In the debugging effort I've isolated it down to a Doctrine issue. Here's what's going on, I instantiate a model object for the product table from my application $newRecord = new Product(); at this point memory usage goes up noticeably. I don't really care though because I figure I can delete it, but look at this madness I have going (which *fails* to free up the memory) $newRecord-clearRelated(); $newRecord-free(); unset($newRecord); gc_collect_cycles(); after all of this memory consumption is still dramatically higher than prior to the first call creating the object above. This I've verified through memory_get_usage(). here's the output from the memory_get_usage() calls int(166461440) // before new Product() int(169345024) // directly after new Product() int(169345024) // after madness trying to free memory used by new Product() I've also tried an explicit call to the destructor of $newRecord, but that results in a fatal attempting to call an unknown method. Any help would be greatly appreciated as google hasn't been able to point me to the answer thus far. thx, -nathan This might help http://php.net/manual/en/features.gc.collecting-cycles.php Thanks for the reply Eric. Sadly this is of no avail. For php 5.2 doctrine has a free() method on several of its classes which breaks the circular references, allowing the garbage collector to clean things up in that environment. Allegedly this isn't needed in 5.3 due to the link you've shared, however, I'm using the free() call on the $newRecord variable just for grins in a 5.3 environment. I'm also calling gc_collect_cycles() to try and force a gc, however that seems to have no effect. Guess what the folks on doctrine irc channel have suggested .. upgrading to version 2 or a hacky workaround (basically working on smaller units and letting the script complete for these smaller chunks of input data). Rather disappointing if you ask me. At this point I'm about as disappointed in php as I am doctine, one would think there's a way to reclaim this memory, but I can't find a way short of terminating the script :( -nathan
Re: [PHP] Convert a PDF to a PNG?
There's an interesting discussion on this page. http://www.linuxquestions.org/questions/linux-software-2/pdf-to-png-converter-57142/ Cheers, Curtis Sean Kenny wrote: Outside the box a bit, but is there perhaps a web-service that does this, something like http://www.thumbalizr.com/ but for PDF files. As long as you had curl or something you would be GTG at that point. -Sean- On Thu, Jun 16, 2011 at 1:48 PM, Brian Dunning br...@briandunning.com wrote: I have heard back from Rackspace and ImageMagick is not going to happen for the time being, but they say Ghostscript is installed. Is it possible to do this completely with GS without ImageMagick? The PDFs are text only. On Jun 15, 2011, at 2:28 AM, Richard Quadling wrote: I use PDF2PNG as this provides the cleanest output mechanism I've found. But I didn't try GS which, theoretically, should be perfect. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Doctrine madness!
-Original Message- From: Nathan Nobbe [mailto:quickshif...@gmail.com] Sent: Thursday, June 16, 2011 9:51 AM To: php-general@lists.php.net Subject: [PHP] Doctrine madness! Hi gang, If anyone out there has some experience w/ Doctrine now would be a great time to share it! Yeah, I've used Doctrine as part of Symfony. Both suck balls and are a perfect example of why you should NEVER use frameworks. Lesson learned the hard way. Re-write with your own MySQL wrappers and for the love of God and all that is holy do NOT make it an ORM wrapper. KTHXBYE. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 5.3.7RC1 Released for Testing
The first release candidates of 5.3.7 was just released for testing and can be downloaded here: http://downloads.php.net/johannes/php-5.3.7RC1.tar.bz2 (md5sum: 295a457505049cc75d723560715be5d6) http://downloads.php.net/johannes/php-5.3.7RC1.tar.gz (md5sum: 4fd555292ea0a1bc3acd1d3ad4c98c27) The Windows binaries are available at: http://windows.php.net/qa/ This is the first step in the release process of this versions and the goal is to have an additional RC within two weeks. PHP 5.3.7 is focused on improving the stability and security. To ensure that the release is solid, please test this RC against your code base and report any problems that you encounter. To find out what was changed since the last release please refer to the NEWS file found within the archive or on http://svn.php.net/viewvc/php/php-src/tags/php_5_3_4RC1/NEWS?revision=HEADview=markup PLEASE NOTE: The PHP Bug tracker is currently not available. In case you find a critical issue don't hesitate to send me a note. If the issue can't wait till bugs.php.net is operational again you can also inform mailto:intern...@lists.php.net. In case your report is security related please contact mailto:secur...@php.net. Windows users please mind that we don't provide VS6 builds anymore since PHP 5.3.6. When using the openssl extension please mind a known regression which might lead to a performance degression. This regression will be fixed with RC2 and the final release. Johannes Schlüter PHP 5.3 Release Master -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DEV] PHP 5.3.7RC1 Released for Testing
Hello ! Le 16 juin 2011 à 23:42, Johannes Schlüter a écrit : To find out what was changed since the last release please refer to the NEWS file found within the archive or on http://svn.php.net/viewvc/php/php-src/tags/php_5_3_4RC1/NEWS?revision=HEADview=markup Valid NEWS file for 5.3.7RC1 is http://svn.php.net/viewvc/php/php-src/tags/php_5_3_7RC1/NEWS?revision=HEADview=markup. The previous link is about 5.3.4RC1. Best regards, Fred. -- Frédéric Hardy : Architecte d'application/Admin. système/Ergonome CV : http://blog.mageekbox.net/public/cv.frederic.hardy.pdf Blog : http://blog.mageekbox.net Twitter : http://twitter.com/mageekguy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DEV] PHP 5.3.7RC1 Released for Testing
On Thu, 2011-06-16 at 23:42 +0200, Johannes Schlüter wrote: To find out what was changed since the last release please refer to the NEWS file found within the archive or on http://svn.php.net/viewvc/php/php-src/tags/php_5_3_4RC1/NEWS?revision=HEADview=markup This should - obviously - have been http://svn.php.net/viewvc/php/php-src/tags/php_5_3_7RC1/NEWS?revision=HEADview=markup johannes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Doctrine madness!
On Thu, Jun 16, 2011 at 5:37 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Nathan Nobbe [mailto:quickshif...@gmail.com] Sent: Thursday, June 16, 2011 9:51 AM To: php-general@lists.php.net Subject: [PHP] Doctrine madness! Hi gang, If anyone out there has some experience w/ Doctrine now would be a great time to share it! Yeah, I've used Doctrine as part of Symfony. Both suck balls and are a perfect example of why you should NEVER use frameworks. Lesson learned the hard way. Re-write with your own MySQL wrappers and for the love of God and all that is holy do NOT make it an ORM wrapper. KTHXBYE. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I do believe that was the most eloquent and enlightened email that has ever graced my inbox. Thank you for taking the time to edify us with that pithy reply. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Doctrine madness!
On Thu, Jun 16, 2011 at 3:58 PM, Eric Butera eric.but...@gmail.com wrote: On Thu, Jun 16, 2011 at 5:37 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Nathan Nobbe [mailto:quickshif...@gmail.com] Sent: Thursday, June 16, 2011 9:51 AM To: php-general@lists.php.net Subject: [PHP] Doctrine madness! Hi gang, If anyone out there has some experience w/ Doctrine now would be a great time to share it! Yeah, I've used Doctrine as part of Symfony. Both suck balls and are a perfect example of why you should NEVER use frameworks. Lesson learned the hard way. Re-write with your own MySQL wrappers and for the love of God and all that is holy do NOT make it an ORM wrapper. some of the functionality doctrine has is amazing and it is a big time saver for sure. sf is also one of the smoothest frameworks ive used in php. i think this goes to show you that frameworks don't to *everything* perfectly, nor can they. what i find more painful is the fact that 130+ ppl on the doctrine irc channel can't offer anything but a shoddy workaround that they assume i'm too dumb to have already thought of myself. when in reality, it's like 'no, your crappy library has a bug in it, could you please address that...' what is even more disheartening is that through php itself, i have no way of deciphering which variable is holding this memory or any way to go about freeing it, even with the magic circular reference handling of 5.3. that bodes badly for php, plain and simple. what it really amounts to is php is good at doing 1 thing and 1 thing only, generating web pages. for anything else, including command line scripts that run for more than 30 seconds, choose an actual programming language or be prepared to deal w/ hacky, disgusting workarounds. -nathan
[PHP] Best way to create an image with flowing text?
Hey all - I need to create PNG images with transparent backgrounds that contain text. The text will come from four fields in a database, and needs to be centered, and text wrapped. The fields are going to be of varying lengths, so each block of text (which will be shown in a different font size) will flow onto an unknown number of lines, and I want to start the next line right below, wherever it is. Unfortunately I have come up against some restrictions. - I will not be able to use ImageMagick. - I have Ghostscript, but only version 7.07. - The server is Red Hat 4.x with PHP 5.2 and installing new software is unlikely. Can anyone suggest a tool to make this easiest? :-( - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Doctrine madness!
-Original Message- From: Eric Butera [mailto:eric.but...@gmail.com] Sent: Thursday, June 16, 2011 2:58 PM To: Daevid Vincent Cc: php-general@lists.php.net Subject: Re: [PHP] Doctrine madness! On Thu, Jun 16, 2011 at 5:37 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Nathan Nobbe [mailto:quickshif...@gmail.com] Sent: Thursday, June 16, 2011 9:51 AM To: php-general@lists.php.net Subject: [PHP] Doctrine madness! Hi gang, If anyone out there has some experience w/ Doctrine now would be a great time to share it! Yeah, I've used Doctrine as part of Symfony. Both suck balls and are a perfect example of why you should NEVER use frameworks. Lesson learned the hard way. Re-write with your own MySQL wrappers and for the love of God and all that is holy do NOT make it an ORM wrapper. KTHXBYE. I do believe that was the most eloquent and enlightened email that has ever graced my inbox. Thank you for taking the time to edify us with that pithy reply. Glad I could be of service. There was no point in elaborating more on either Doctrine or Symfony any further. Sometimes, like that guy that fell down the canyon, you have to cut your own arm off with a swiss army knife to save your life. In this case, get rid of Doctrine or any other ORM, despite the painful operation, and save your project from a slow and agonizing death. ORM's and ActiveRecord style wrappers, while sounding sexy -- like the babe on the other end of a 1-900 number -- usually turn out to be fat and bloated. All that magic comes at a price. This is why Ruby on Rails has started to fall out of favor with ANY big shop and you are hearing less and less about it. It's cute and seems magnificent at first, but quickly starts to show its limitations and short-comings when you REALLY try to use it. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] implementing dot-net DES encryption by php
Hi I have a big problem.I've tried for 2 days but I haven't been able to solve the problem yet. I need to implement dot-net DES encryption in php site. I tired several solutions and the following code is the best that I've seen. But it doesn't work perfect either. Header(Content-disposition: attachment; filename=test.txt); Header(Content-type: text/plain); $key = alidfsdf; $iv = asghasdr; $buffer = 0736f6a24766866a60e5a300e6f067aef5c2428a7c5ba59b1c2af2ec9289aaad6d7fd8345910fac94b99311d0487a02080665ed5a5f48b9a35093eed16eb8c38\nsdfgh; $td = mcrypt_module_open('tripledes', '', 'cbc', ''); $key .= substr($key, 0, mcrypt_enc_get_key_size($td)); $block = mcrypt_get_block_size('tripledes', 'cbc'); $len = strlen($buffer); $padding = $block - ($len % $block); $buffer .= str_repeat(chr($padding),$padding); if (mcrypt_generic_init($td, $key, $iv) != -1){ $Result = mcrypt_generic($td, $buffer); mcrypt_generic_deinit($td); mcrypt_module_close($td); } echo $Result; this is the output of this php program: …زPy³fضt5OWہاKھہj³¬Lء³[;´n‡طê^uH ×Lں¸g‚اw~2ڈC cصôIْ7”ûG„pکج:®1ّس qغY‰zMْکل%`وً؛ءufˆ نT™INâè#!û½à©آ¼’ط2ظص•£ٌ8% Output from c# application is here(using PaddingMode.PKCS7 and other default settings): …زPy³fضt5OWہاKھہj³¬Lء³[;´n‡طê^uH ×Lں¸g‚اw~2ڈC cصôIْ7”ûG„pکج:®1ّس qغY‰zMْکل%`وً؛ءufˆ نT™INâè#!û½à©آ¼’ط2ظj¹¸n(V¯ë 2ث ¼ However they are like each other. But As you can see, the 16 last characters are different. I think there is a problem in $buffer .= str_repeat(*chr($padding)* ,$padding); Please help me. I'm going to deliver it tomorrow. Thanks for any help.
RE: [PHP] Doctrine madness!
On Jun 16, 2011 5:31 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Eric Butera [mailto:eric.but...@gmail.com] Sent: Thursday, June 16, 2011 2:58 PM To: Daevid Vincent Cc: php-general@lists.php.net Subject: Re: [PHP] Doctrine madness! On Thu, Jun 16, 2011 at 5:37 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Nathan Nobbe [mailto:quickshif...@gmail.com] Sent: Thursday, June 16, 2011 9:51 AM To: php-general@lists.php.net Subject: [PHP] Doctrine madness! Hi gang, If anyone out there has some experience w/ Doctrine now would be a great time to share it! Yeah, I've used Doctrine as part of Symfony. Both suck balls and are a perfect example of why you should NEVER use frameworks. Lesson learned the hard way. Re-write with your own MySQL wrappers and for the love of God and all that is holy do NOT make it an ORM wrapper. KTHXBYE. I do believe that was the most eloquent and enlightened email that has ever graced my inbox. Thank you for taking the time to edify us with that pithy reply. Glad I could be of service. There was no point in elaborating more on either Doctrine or Symfony any further. You've been even less helpful than the broken community surrounding doctrine. Thanks for your effort daevid, I know you tried hard ;) -nathan
Re: [PHP] Doctrine madness!
On Thu, Jun 16, 2011 at 7:32 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Eric Butera [mailto:eric.but...@gmail.com] Sent: Thursday, June 16, 2011 2:58 PM To: Daevid Vincent Cc: php-general@lists.php.net Subject: Re: [PHP] Doctrine madness! On Thu, Jun 16, 2011 at 5:37 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Nathan Nobbe [mailto:quickshif...@gmail.com] Sent: Thursday, June 16, 2011 9:51 AM To: php-general@lists.php.net Subject: [PHP] Doctrine madness! Hi gang, If anyone out there has some experience w/ Doctrine now would be a great time to share it! Yeah, I've used Doctrine as part of Symfony. Both suck balls and are a perfect example of why you should NEVER use frameworks. Lesson learned the hard way. Re-write with your own MySQL wrappers and for the love of God and all that is holy do NOT make it an ORM wrapper. KTHXBYE. I do believe that was the most eloquent and enlightened email that has ever graced my inbox. Thank you for taking the time to edify us with that pithy reply. Glad I could be of service. There was no point in elaborating more on either Doctrine or Symfony any further. Sometimes, like that guy that fell down the canyon, you have to cut your own arm off with a swiss army knife to save your life. In this case, get rid of Doctrine or any other ORM, despite the painful operation, and save your project from a slow and agonizing death. ORM's and ActiveRecord style wrappers, while sounding sexy -- like the babe on the other end of a 1-900 number -- usually turn out to be fat and bloated. All that magic comes at a price. This is why Ruby on Rails has started to fall out of favor with ANY big shop and you are hearing less and less about it. It's cute and seems magnificent at first, but quickly starts to show its limitations and short-comings when you REALLY try to use it. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I'm sorry but this is absolute rubbish. I used to write my queries by hand, but over time you start to realize that perhaps, maybe writing out thousands of identical lines of code over hundreds of projects might not be an efficient usage of time. If you have performant requirements, that is one thing and can easily be overcome with slight deviations on a case by case basis. Most of the time, contrary to your position, things just need to work and be completed quickly. What is the more common question from clients: why is this so slow, or, client asks why is this not finished yet? I do like the half-hearted diatribe against ROR, which I will assume is a wildcard, allow any language/framework combination to stand-in. The real take-away message here is that you're trying to paint everything with the brush that you see the world in, while the reality is that not everyone has your requirements. Personally, I don't enjoy trying to mess around with ill-conceived, backwards-compatible adhering designs from 12 years ago. I understand that growth is organic and deal with it on a daily basis in my own projects. Hence, I use a framework and other tooling that allows me to complete jobs in a tidy and orderly fashion. If I need something a little more cutting-edge I can always drop down lower on the stack to bypass PHP with other techniques like caching or bypassing the framework altogether. To say that all frameworks are a complete waste of time and will only (absolutely) end in failure is quite a disservice to anyone who reads this list. I've seen too many people over the years try and rally against common sense practices like using prepared statements for perhaps a marginal gain of performance on one page while their load averages are 0,0,0. One archived post could be the cause of 50 hacked websites. This is not the position people - or, mentors, if you will - should be taking. Same with other tools that allow developers to crank out projects orders faster. This post isn't meant to be some vitriol inspired rant, but rather a sincere wake-up. Imagine the intended audience of php-general and ask yourself if you're doing harm. An example: when I say harm, every other framework I have seen from php (ok, ok, ZF makes you call escape), ruby, python, and node all escape variables in templates/views by default. PHP is the only one that lets you echo out XSS out of the box. Of course, with diligence and time we can all overcome these things, but that does not mean someone with the ambition to bang together a quick website for a relative understands the real perils they're getting into - I certainly did not. Now I wonder how calamity did not destroy everything in my beginnings. Times have changed since then and our sites are under constant scrutiny from bots utilizing things like search engines to find easy holes. I'd much rather have by default an easy to use, extensible,
RE: [PHP] Doctrine madness!
-Original Message- From: Nathan Nobbe [mailto:quickshif...@gmail.com] Sent: Thursday, June 16, 2011 5:39 PM To: Daevid Vincent Cc: php-general@lists.php.net Subject: RE: [PHP] Doctrine madness! On Jun 16, 2011 5:31 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Eric Butera [mailto:eric.but...@gmail.com] Sent: Thursday, June 16, 2011 2:58 PM To: Daevid Vincent Cc: php-general@lists.php.net Subject: Re: [PHP] Doctrine madness! On Thu, Jun 16, 2011 at 5:37 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Nathan Nobbe [mailto:quickshif...@gmail.com] Sent: Thursday, June 16, 2011 9:51 AM To: php-general@lists.php.net Subject: [PHP] Doctrine madness! Hi gang, If anyone out there has some experience w/ Doctrine now would be a great time to share it! Yeah, I've used Doctrine as part of Symfony. Both suck balls and are a perfect example of why you should NEVER use frameworks. Lesson learned the hard way. Re-write with your own MySQL wrappers and for the love of God and all that is holy do NOT make it an ORM wrapper. KTHXBYE. I do believe that was the most eloquent and enlightened email that has ever graced my inbox. Thank you for taking the time to edify us with that pithy reply. Glad I could be of service. There was no point in elaborating more on either Doctrine or Symfony any further. You've been even less helpful than the broken community surrounding doctrine. Thanks for your effort daevid, I know you tried hard ;) -nathan You asked if anyone had experience with Doctrine and to share the experience. I did just that *wink*. I never claimed to have a solution to your Doctrine problem, other than the fact that Doctrine is in itself the problem. You are in a recursive loop. :) Think of me as the return;. You're welcome. In all my 25+ years of coding experience with any language and especially PHP, I've learned the hard way that the one-size-fits-all approach of a generic framework and the bloat of an ORM just doesn't work. It looks wonderful, trust me, I've fallen prey to its sultry gaze myself. Hell, I've even written tools that started to look like ORMs and Frameworks, and then there comes a point when you realize their cost is too high. You're better off (IMHO) making some very efficient wrapper functions for sql_query(), sql_save() [does insert/update intelligently], sql_delete(), etc. and not get all fancy with making a SQL class/object and all that crap either. OOP is great for many things, but it's not the answer to everything and developers need to know when to use the right tool for the job. It has also been my experience that a SQL wrapper is best as a procedural system since it's called so frequently and often. Doing some silly: $con = new DBConnection(); $con-query('select * from foo'); $myresults = $con-getResults(); $con-close(); Or whatever is a waste. $myresults = sql_query('select * from foo'); Is far more efficient and easier to read. Let the function open a connection, and do all the work. The ORM dealios complicate things, as now you have some stupid YAML file to maintain, and you have to make objects that relate to other objects (1:M, M:M, etc.) and after a while, you start to think, shit, I could have done this with like 3 SQL statements. The ORM's fatal flaw is it's one-size-fits-all Achilles heel. Example: We used to have this crontab job that would update news stories from RSS feeds we harvested around the web. It was taking HOURS to complete. Mostly because for each story, we had to create a new Doctrine object thingy and all the related table objects and then update the instance object, then -save() or whatever. Do that over a hundred-thousand objects and stuff starts to slow down. We converted it to use straight SQL calls and it ran in under 10 minutes. YES. From HOURS to minutes. An order of magnitude faster. Just trying to save you (and anyone else) the time and trouble. I don’t dislike ORM and frameworks because I have some axe to grind, like I used to write a framework and it cheated on me and so I'm all jaded... No. I dislike them from experience over years of practical real-world implementations. I have tried them. I *WANT* to like them, I really do. I was very excited when Zend Framework came out... and then... I used it, and realized it was like the others. Bloat. Slow. Confusing. Cumbersome. The last thing I'll leave you with is that, when you start to rely upon one of these ORM/PHP frameworks, you're not only stuck with it -- warts and all -- but you have to TRAIN other people to use it as well! If you find a bug, you either have to maintain it forever in your own branch, or hope the developers of the framework fix it. When you hire new people, you always have to add some caveat to the job request, Zend Framework, Doctrine,
Re: [PHP] Doctrine madness!
On Jun 16, 2011 6:53 PM, Eric Butera eric.but...@gmail.com wrote: On Thu, Jun 16, 2011 at 7:32 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Eric Butera [mailto:eric.but...@gmail.com] Sent: Thursday, June 16, 2011 2:58 PM To: Daevid Vincent Cc: php-general@lists.php.net Subject: Re: [PHP] Doctrine madness! On Thu, Jun 16, 2011 at 5:37 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Nathan Nobbe [mailto:quickshif...@gmail.com] Sent: Thursday, June 16, 2011 9:51 AM To: php-general@lists.php.net Subject: [PHP] Doctrine madness! Hi gang, If anyone out there has some experience w/ Doctrine now would be a great time to share it! Yeah, I've used Doctrine as part of Symfony. Both suck balls and are a perfect example of why you should NEVER use frameworks. Lesson learned the hard way. Re-write with your own MySQL wrappers and for the love of God and all that is holy do NOT make it an ORM wrapper. KTHXBYE. I do believe that was the most eloquent and enlightened email that has ever graced my inbox. Thank you for taking the time to edify us with that pithy reply. Glad I could be of service. There was no point in elaborating more on either Doctrine or Symfony any further. Sometimes, like that guy that fell down the canyon, you have to cut your own arm off with a swiss army knife to save your life. In this case, get rid of Doctrine or any other ORM, despite the painful operation, and save your project from a slow and agonizing death. ORM's and ActiveRecord style wrappers, while sounding sexy -- like the babe on the other end of a 1-900 number -- usually turn out to be fat and bloated. All that magic comes at a price. This is why Ruby on Rails has started to fall out of favor with ANY big shop and you are hearing less and less about it. It's cute and seems magnificent at first, but quickly starts to show its limitations and short-comings when you REALLY try to use it. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I'm sorry but this is absolute rubbish. I used to write my queries by hand, but over time you start to realize that perhaps, maybe writing out thousands of identical lines of code over hundreds of projects might not be an efficient usage of time. If you have performant requirements, that is one thing and can easily be overcome with slight deviations on a case by case basis. Most of the time, contrary to your position, things just need to work and be completed quickly. What is the more common question from clients: why is this so slow, or, client asks why is this not finished yet? I do like the half-hearted diatribe against ROR, which I will assume is a wildcard, allow any language/framework combination to stand-in. The real take-away message here is that you're trying to paint everything with the brush that you see the world in, while the reality is that not everyone has your requirements. Personally, I don't enjoy trying to mess around with ill-conceived, backwards-compatible adhering designs from 12 years ago. I understand that growth is organic and deal with it on a daily basis in my own projects. Hence, I use a framework and other tooling that allows me to complete jobs in a tidy and orderly fashion. If I need something a little more cutting-edge I can always drop down lower on the stack to bypass PHP with other techniques like caching or bypassing the framework altogether. To say that all frameworks are a complete waste of time and will only (absolutely) end in failure is quite a disservice to anyone who reads this list. I've seen too many people over the years try and rally against common sense practices like using prepared statements for perhaps a marginal gain of performance on one page while their load averages are 0,0,0. One archived post could be the cause of 50 hacked websites. This is not the position people - or, mentors, if you will - should be taking. Same with other tools that allow developers to crank out projects orders faster. This post isn't meant to be some vitriol inspired rant, but rather a sincere wake-up. Imagine the intended audience of php-general and ask yourself if you're doing harm. An example: when I say harm, every other framework I have seen from php (ok, ok, ZF makes you call escape), ruby, python, and node all escape variables in templates/views by default. PHP is the only one that lets you echo out XSS out of the box. Of course, with diligence and time we can all overcome these things, but that does not mean someone with the ambition to bang together a quick website for a relative understands the real perils they're getting into - I certainly did not. Now I wonder how calamity did not destroy everything in my beginnings. Times have changed since then and our sites are under constant
RE: [PHP] Doctrine madness!
-Original Message- From: Eric Butera [mailto:eric.but...@gmail.com] Sent: Thursday, June 16, 2011 5:53 PM To: Daevid Vincent Cc: php-general@lists.php.net Subject: Re: [PHP] Doctrine madness! On Thu, Jun 16, 2011 at 7:32 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Eric Butera [mailto:eric.but...@gmail.com] Sent: Thursday, June 16, 2011 2:58 PM To: Daevid Vincent Cc: php-general@lists.php.net Subject: Re: [PHP] Doctrine madness! On Thu, Jun 16, 2011 at 5:37 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Nathan Nobbe [mailto:quickshif...@gmail.com] Sent: Thursday, June 16, 2011 9:51 AM To: php-general@lists.php.net Subject: [PHP] Doctrine madness! Hi gang, If anyone out there has some experience w/ Doctrine now would be a great time to share it! Yeah, I've used Doctrine as part of Symfony. Both suck balls and are a perfect example of why you should NEVER use frameworks. Lesson learned the hard way. Re-write with your own MySQL wrappers and for the love of God and all that is holy do NOT make it an ORM wrapper. KTHXBYE. I do believe that was the most eloquent and enlightened email that has ever graced my inbox. Thank you for taking the time to edify us with that pithy reply. Glad I could be of service. There was no point in elaborating more on either Doctrine or Symfony any further. Sometimes, like that guy that fell down the canyon, you have to cut your own arm off with a swiss army knife to save your life. In this case, get rid of Doctrine or any other ORM, despite the painful operation, and save your project from a slow and agonizing death. ORM's and ActiveRecord style wrappers, while sounding sexy -- like the babe on the other end of a 1-900 number -- usually turn out to be fat and bloated. All that magic comes at a price. This is why Ruby on Rails has started to fall out of favor with ANY big shop and you are hearing less and less about it. It's cute and seems magnificent at first, but quickly starts to show its limitations and short-comings when you REALLY try to use it. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I'm sorry but this is absolute rubbish. I used to write my queries by hand, but over time you start to realize that perhaps, maybe writing out thousands of identical lines of code over hundreds of projects might not be an efficient usage of time. I never said to do that. I said to write your own wrappers and your own framework for YOUR needs. A one-size-fits all solution is never going to be as clean or efficient as your own code. See previous rant and I'm sure there are archives of my other rants on the failure that is ORM Frameworks. What is the more common question from clients: why is this so slow, or, client asks why is this not finished yet? ...until the project gains traction and starts to get users and then it will be, why is this so slow?! I do like the half-hearted diatribe against ROR, which I will assume is a wildcard, allow any language/framework combination to stand-in. Yes, frameworks as a whole suck. However, I will concede the one framework I do enjoy and find much more useful is jQuery, if for no other reason than it handles all the minutia and BS of browser incompatibilities and parsing the DOM in JS. It's fairly lightweight and works very well for the most part. Even having said that, I really only use jQuery on a need-to-use basis and not for everything JS related. But once you have to include it in a page for some necessary reason, you might as well continue to use it in the page since you've already downloaded it to the client and it makes the code easier to read vs. jumping in and out of raw JS and jQueryScript(tm) The real take-away message here is that you're trying to paint everything with the brush that you see the world in, while the reality is that not everyone has your requirements. Personally, I don't enjoy If it's a project bigger than your own personal website, then eventually you WILL have my requirements. trying to mess around with ill-conceived, backwards-compatible adhering designs from 12 years ago. I understand that growth is organic and deal with it on a daily basis in my own projects. Hence, I use a framework and other tooling that allows me to complete jobs in a tidy and orderly fashion. Name me some LARGE popular sites that use frameworks? Again, if you want to make your little companies website or personal page, go for it. Frameworks are great for prototypes and simple stuff. Anything more and you're going to hate life after a year or two using it. Fact. If I need something a little more cutting-edge I can always drop down lower on the stack to bypass PHP with other techniques like caching or bypassing the framework altogether. To
Re: [PHP] Doctrine madness!
On Thu, Jun 16, 2011 at 9:50 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Eric Butera [mailto:eric.but...@gmail.com] Sent: Thursday, June 16, 2011 5:53 PM To: Daevid Vincent Cc: php-general@lists.php.net Subject: Re: [PHP] Doctrine madness! On Thu, Jun 16, 2011 at 7:32 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Eric Butera [mailto:eric.but...@gmail.com] Sent: Thursday, June 16, 2011 2:58 PM To: Daevid Vincent Cc: php-general@lists.php.net Subject: Re: [PHP] Doctrine madness! On Thu, Jun 16, 2011 at 5:37 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Nathan Nobbe [mailto:quickshif...@gmail.com] Sent: Thursday, June 16, 2011 9:51 AM To: php-general@lists.php.net Subject: [PHP] Doctrine madness! Hi gang, If anyone out there has some experience w/ Doctrine now would be a great time to share it! Yeah, I've used Doctrine as part of Symfony. Both suck balls and are a perfect example of why you should NEVER use frameworks. Lesson learned the hard way. Re-write with your own MySQL wrappers and for the love of God and all that is holy do NOT make it an ORM wrapper. KTHXBYE. I do believe that was the most eloquent and enlightened email that has ever graced my inbox. Thank you for taking the time to edify us with that pithy reply. Glad I could be of service. There was no point in elaborating more on either Doctrine or Symfony any further. Sometimes, like that guy that fell down the canyon, you have to cut your own arm off with a swiss army knife to save your life. In this case, get rid of Doctrine or any other ORM, despite the painful operation, and save your project from a slow and agonizing death. ORM's and ActiveRecord style wrappers, while sounding sexy -- like the babe on the other end of a 1-900 number -- usually turn out to be fat and bloated. All that magic comes at a price. This is why Ruby on Rails has started to fall out of favor with ANY big shop and you are hearing less and less about it. It's cute and seems magnificent at first, but quickly starts to show its limitations and short-comings when you REALLY try to use it. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I'm sorry but this is absolute rubbish. I used to write my queries by hand, but over time you start to realize that perhaps, maybe writing out thousands of identical lines of code over hundreds of projects might not be an efficient usage of time. I never said to do that. I said to write your own wrappers and your own framework for YOUR needs. A one-size-fits all solution is never going to be as clean or efficient as your own code. See previous rant and I'm sure there are archives of my other rants on the failure that is ORM Frameworks. What is the more common question from clients: why is this so slow, or, client asks why is this not finished yet? ...until the project gains traction and starts to get users and then it will be, why is this so slow?! I do like the half-hearted diatribe against ROR, which I will assume is a wildcard, allow any language/framework combination to stand-in. Yes, frameworks as a whole suck. However, I will concede the one framework I do enjoy and find much more useful is jQuery, if for no other reason than it handles all the minutia and BS of browser incompatibilities and parsing the DOM in JS. It's fairly lightweight and works very well for the most part. Even having said that, I really only use jQuery on a need-to-use basis and not for everything JS related. But once you have to include it in a page for some necessary reason, you might as well continue to use it in the page since you've already downloaded it to the client and it makes the code easier to read vs. jumping in and out of raw JS and jQueryScript(tm) The real take-away message here is that you're trying to paint everything with the brush that you see the world in, while the reality is that not everyone has your requirements. Personally, I don't enjoy If it's a project bigger than your own personal website, then eventually you WILL have my requirements. trying to mess around with ill-conceived, backwards-compatible adhering designs from 12 years ago. I understand that growth is organic and deal with it on a daily basis in my own projects. Hence, I use a framework and other tooling that allows me to complete jobs in a tidy and orderly fashion. Name me some LARGE popular sites that use frameworks? Again, if you want to make your little companies website or personal page, go for it. Frameworks are great for prototypes and simple stuff. Anything more and you're going to hate life after a year or two using it. Fact. If I need something a little more cutting-edge I can always drop down lower on the stack to
RE: [PHP] Doctrine madness! huh?
out XSS out of the box. Of course, with diligence and time we can all overcome these things, but that does not mean someone with the ambition to bang together a quick website for a relative understands the real perils they're getting into - I certainly did not. I'm sure Anonymous or any other hacker worth worrying about isn't looking to deface your grandmother's website. ;-) Yes, ;-) indeed. When you resort to personal attacks on supposed wealth and my poor grandmother the argument is over. In case you don't understand, you lost for name calling with no sustenance in your Huh? Name calling? What are you talking about. You made a reference to bang together a quick website for a relative and how the frameworks give you more security and some other stuff. My jest, which clearly you took way too personally or something, was only trying to say that for a 'personal website', your fears of attack by hackers (Anonymous being the biggest out there), is pretty slim to none. And even if you did get hacked (most likely by some automated script kiddie bot), who cares -- including you -- because it's just a silly personal home-page with pictures of relatives and other stupid stuff nobody but a very very very small circle of people give a crap about, and therefore not worth a true hacker's time. I didn't imply wealth or lack thereof, nor did I call anyone names. Apologies for the misunderstanding. Jeesh. d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Doctrine madness!
On Thu, Jun 16, 2011 at 08:53:18PM -0400, Eric Butera wrote: On Thu, Jun 16, 2011 at 7:32 PM, Daevid Vincent dae...@daevid.com wrote: [snip] I'm sorry but this is absolute rubbish. I used to write my queries by hand, but over time you start to realize that perhaps, maybe writing out thousands of identical lines of code over hundreds of projects might not be an efficient usage of time. If you have performant requirements, that is one thing and can easily be overcome with slight deviations on a case by case basis. Most of the time, contrary to your position, things just need to work and be completed quickly. What is the more common question from clients: why is this so slow, or, client asks why is this not finished yet? I generally side with Daevid on this, though my position isn't as extreme. However, I have to take exception to the either/or question from clients. As far as I'm concerned, clients need to learn that coding takes as long as it takes. I'd much rather spend the extra time and never have the customer ask why the code is so slow. The theoretical alternative, having the customer satisfied with the delivery time, but complain about latency, isn't what I'd consider acceptable. Looking at some of the code that comprises most ORM and other frameworks (but particularly ORM frameworks) the bloat is amazing. Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Doctrine madness!
On Thu, Jun 16, 2011 at 06:50:00PM -0700, Daevid Vincent wrote: [snip] Name me some LARGE popular sites that use frameworks? I generally agree with your position, but I'm not sure about this one. I'm too lazy/busy to do extensive research, but I believe that Joomla and Drupal are used pretty extensively in the big website category. Of course, if you ever want to do anything outside the Drupal/Joomla box, you're looking at a helluva lot of work and time. I've been there (briefly). Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php