Congratulations!

[Valid RSS] This is a valid RSS feed.

Recommendations

This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

Source: http://www.strangebuzz.com/feed/rss2

  1. <?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://www.strangebuzz.com/feed/rss2/xslt" ?><rss version="2.0"
  2.  xmlns:dc="http://purl.org/dc/elements/1.1/"
  3.  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  4.  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  5.  xmlns:atom="http://www.w3.org/2005/Atom">
  6. <channel>
  7.  <title>Strangebuzz...?</title>
  8.  <link>http://www.strangebuzz.com/</link>
  9.  <atom:link href="http://www.strangebuzz.com/feed/rss2" rel="self" type="application/rss+xml"/>
  10.  <description>The blog of COil: PHP, PEAR, symfony1, Symfony2 &amp; iWeb2.0+</description>
  11.  <language>en</language>
  12.  <pubDate>Fri, 28 Oct 2016 20:22:04 +0200</pubDate>
  13.  <copyright></copyright>
  14.  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  15.  <generator>Dotclear</generator>
  16.  
  17.    
  18.  <item>
  19.    <title>Twig C extension benchmark</title>
  20.    <link>http://www.strangebuzz.com/post/2013/02/21/Twig-C-extension-benchmark</link>
  21.    <guid isPermaLink="false">urn:md5:1e84839d49ecde41093d3f9fea8e56a6</guid>
  22.    <pubDate>Thu, 21 Feb 2013 05:55:00 +0100</pubDate>
  23.    <dc:creator>COil</dc:creator>
  24.        <category>symfony</category>
  25.        <category>benchmark</category><category>performance</category><category>php</category><category>symfony</category><category>Symfony2</category><category>template</category><category>Twig</category>    
  26.    <description>    &lt;p&gt;Hi Symfonians,
  27. &lt;br /&gt;
  28. &lt;br /&gt;
  29. Long time since my last post&amp;nbsp;! But it's mainly because I actually have a lot of work with Symfony2 projects. One of my current task is to optimize the performances of a Symfony2.0.x project. I was curious to test the Twig C extension to check if there was a real improvement before using it in our production environment. Here we go:
  30. &lt;br /&gt;
  31. &lt;br /&gt;
  32. I will not describe the installation as it is very easy, just follow the &lt;a href=&quot;http://twig.sensiolabs.org/doc/installation.html#installing-the-c-extension&quot; hreflang=&quot;en&quot; title=&quot;Twig C extension installation documentation&quot;&gt;official documentation&lt;/a&gt;. When the extension is correctly installed you have a new Twig entry in your &lt;strong&gt;phpinfo()&lt;/strong&gt;:
  33. &lt;br /&gt;
  34. &lt;br /&gt;&lt;/p&gt;
  35. &lt;div align=&quot;center&quot;&gt;
  36.    &lt;img src=&quot;http://gallery.coilblog.com/var/albums/Strangebuzz/twig-php-info.png?m=1361452559&quot; /&gt;
  37. &lt;/div&gt;
  38.  
  39.  
  40. &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  41.  
  42. &lt;h3&gt;The benchmark&lt;/h3&gt;
  43.  
  44. &lt;p&gt;&lt;br /&gt;
  45. To test the extension, I choose the most complex page of the site (complex at the Twig level):
  46. &lt;br /&gt;&lt;/p&gt;
  47. &lt;ul&gt;
  48. &lt;li&gt;Renders a tree of about 500 checkboxes&lt;/li&gt;
  49. &lt;li&gt;Recursive include calls are made inside the templates&lt;/li&gt;
  50. &lt;li&gt;Widget rendering does not use the Symfony2 form helpers&lt;/li&gt;
  51. &lt;/ul&gt;
  52. &lt;p&gt;&lt;br /&gt;
  53. The main template:&lt;/p&gt;
  54. &lt;script src=&quot;https://gist.github.com/COil/5004469.js&quot;&gt;&lt;/script&gt;
  55.  
  56.  
  57. &lt;p&gt;(Called 6 times with different data)
  58. &lt;br /&gt;
  59. &lt;br /&gt;
  60. The recursive Twig template &lt;strong&gt;_group_tree.html.twig&lt;/strong&gt;:
  61. &lt;br /&gt;&lt;/p&gt;
  62. &lt;script src=&quot;https://gist.github.com/COil/5004477.js&quot;&gt;&lt;/script&gt;
  63.  
  64.  
  65. &lt;p&gt;&lt;strong&gt;PS&lt;/strong&gt;: Note here that we didn't used here a native Symfony2 form, because the rendering (bind + renderering) was taking about 5 seconds...
  66. &lt;br /&gt;
  67. &lt;br /&gt;&lt;/p&gt;
  68.  
  69. &lt;h4&gt;Test conditions:&lt;/h4&gt;
  70. &lt;ul&gt;
  71. &lt;li&gt;Symfony 2.0.22, of course the production environment is used for the test.&lt;/li&gt;
  72. &lt;li&gt;PHP 5.3.2-1ubuntu4.18 with Suhosin-Patch (cli) (built: Sep 12 2012 19:12:47)&lt;/li&gt;
  73. &lt;li&gt;php app/check.php, no warning or error, APC is enabled with an APC autoloader.&lt;/li&gt;
  74. &lt;/ul&gt;
  75. &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  76.  
  77. &lt;h4&gt;Results without the extension:&lt;/h4&gt;
  78. &lt;ul&gt;
  79. &lt;li&gt;1000 iterations&lt;/li&gt;
  80. &lt;li&gt;Apache was restarted and Symfony2 cache was cleared between each test&lt;/li&gt;
  81. &lt;/ul&gt;
  82. &lt;p&gt;&lt;em&gt;The following results are the second &lt;strong&gt;run&lt;/strong&gt; because the 1st run has to rebuild the Symfony cache.&lt;/em&gt;
  83. &lt;br /&gt;
  84. &lt;br /&gt;&lt;/p&gt;
  85. &lt;pre&gt;
  86. [10:39:54] [email protected]:~/Webdev$ ab -n 1000 http://dev.project.com/search
  87. This is ApacheBench, Version 2.3 &amp;lt;$Revision: 655654 $&amp;gt;
  88. Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
  89. Licensed to The Apache Software Foundation, http://www.apache.org/
  90.  
  91. Benchmarking dev.project.com (be patient)
  92. Completed 100 requests
  93. Completed 200 requests
  94. Completed 300 requests
  95. Completed 400 requests
  96. Completed 500 requests
  97. Completed 600 requests
  98. Completed 700 requests
  99. Completed 800 requests
  100. Completed 900 requests
  101. Completed 1000 requests
  102. Finished 1000 requests
  103.  
  104. Server Software:        Apache/2.2.14
  105. Server Hostname:        dev.project.com
  106. Server Port:            80
  107.  
  108. Document Path:          /search
  109. Document Length:        197192 bytes
  110.  
  111. Concurrency Level:      1
  112. Time taken for tests:   99.232 seconds
  113. Complete requests:      1000
  114. Failed requests:        0
  115. Write errors:           0
  116. Total transferred:      197742000 bytes
  117. HTML transferred:       197192000 bytes
  118. Requests per second:    10.08 [#/sec] (mean)
  119. Time per request:       99.232 [ms] (mean)
  120. Time per request:       99.232 [ms] (mean, across all concurrent requests)
  121. Transfer rate:          1946.03 [Kbytes/sec] received
  122.  
  123. Connection Times (ms)
  124.      min  mean[+/-sd] median   max
  125. Connect:        0    0   0.0      0       0
  126. Processing:    95   99   4.4     98     190
  127. Waiting:       92   96   4.2     95     187
  128. Total:         95   99   4.4     98     190
  129.  
  130. Percentage of the requests served within a certain time (ms)
  131.  50%     98
  132.  66%    101
  133.  75%    102
  134.  80%    102
  135.  90%    103
  136.  95%    104
  137.  98%    108
  138.  99%    110
  139. 100%    190 (longest request)
  140. &lt;/pre&gt;
  141.  
  142. &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  143.  
  144. &lt;h4&gt;Results with the extension enabled:&lt;/h4&gt;
  145.  
  146. &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  147. &lt;pre&gt;
  148. [10:36:34] [email protected]:~/Webdev$ ab -n 1000 http://dev.project.com/search
  149. This is ApacheBench, Version 2.3 &amp;lt;$Revision: 655654 $&amp;gt;
  150. Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
  151. Licensed to The Apache Software Foundation, http://www.apache.org/
  152.  
  153. Benchmarking dev.project.com (be patient)
  154. Completed 100 requests
  155. Completed 200 requests
  156. Completed 300 requests
  157. Completed 400 requests
  158. Completed 500 requests
  159. Completed 600 requests
  160. Completed 700 requests
  161. Completed 800 requests
  162. Completed 900 requests
  163. Completed 1000 requests
  164. Finished 1000 requests
  165.  
  166. Server Software:        Apache/2.2.14
  167. Server Hostname:        dev.project.com
  168. Server Port:            80
  169.  
  170. Document Path:          /search
  171. Document Length:        197192 bytes
  172.  
  173. Concurrency Level:      1
  174. Time taken for tests:   84.887 seconds
  175. Complete requests:      1000
  176. Failed requests:        0
  177. Write errors:           0
  178. Total transferred:      197742000 bytes
  179. HTML transferred:       197192000 bytes
  180. Requests per second:    11.78 [#/sec] (mean)
  181. Time per request:       84.887 [ms] (mean)
  182. Time per request:       84.887 [ms] (mean, across all concurrent requests)
  183. Transfer rate:          2274.87 [Kbytes/sec] received
  184.  
  185. Connection Times (ms)
  186.      min  mean[+/-sd] median   max
  187. Connect:        0    0   0.0      0       0
  188. Processing:    81   85   2.9     84     127
  189. Waiting:       78   82   2.7     81     124
  190. Total:         81   85   2.9     84     127
  191.  
  192. Percentage of the requests served within a certain time (ms)
  193.  50%     84
  194.  66%     86
  195.  75%     87
  196.  80%     87
  197.  90%     88
  198.  95%     89
  199.  98%     91
  200.  99%     94
  201. 100%    127 (longest request)
  202. &lt;/pre&gt;
  203.  
  204. &lt;p&gt;&lt;br /&gt;
  205. (I have run the tests several times to check that the results are reliable)
  206. &lt;br /&gt;
  207. &lt;br /&gt;&lt;/p&gt;
  208.  
  209. &lt;h3&gt;Conclusion&lt;/h3&gt;
  210.  
  211. &lt;p&gt;&lt;br /&gt;
  212. As you can see, it is quiet interesting as the global gain is about &lt;strong&gt;14,5%&lt;/strong&gt;.
  213. I have tested on several smaller templates but the gain was insignificant and less than &lt;strong&gt;1%&lt;/strong&gt;. (which seems logical)
  214. &lt;br /&gt;
  215. &lt;br /&gt;
  216. So the extension can really be helpful on complex templates with a lot of parameters, the more complex the Twig templates are the more gain you will have. (up to 15%)
  217. &lt;br /&gt;
  218. &lt;br /&gt;
  219. See you. COil &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;
  220. &lt;br /&gt;
  221. &lt;br /&gt;
  222. &lt;br /&gt;
  223. About the extension:
  224. &lt;br /&gt;&lt;/p&gt;
  225. &lt;ul&gt;
  226. &lt;li&gt;&lt;a href=&quot;http://derickrethans.nl/twig-extension.html&quot;&gt;http://derickrethans.nl/twig-extension.html&lt;/a&gt;&lt;/li&gt;
  227. &lt;li&gt;&lt;a href=&quot;http://twig.sensiolabs.org/doc/installation.html#installing-the-c-extension&quot;&gt;http://twig.sensiolabs.org/doc/installation.html#installing-the-c-extension&lt;/a&gt;&lt;/li&gt;
  228. &lt;/ul&gt;
  229. &lt;p&gt;&lt;br /&gt;
  230. For other Symfony2 performance tricks check out the following resources:
  231. &lt;br /&gt;&lt;/p&gt;
  232. &lt;ul&gt;
  233. &lt;li&gt;&lt;a href=&quot;http://slides.seld.be/?file=2011-10-20+High+Performance+Websites+with+Symfony2.html&quot;&gt;http://slides.seld.be/?file=2011-10-20+High+Performance+Websites+with+Symfony2.html&lt;/a&gt;&lt;/li&gt;
  234. &lt;/ul&gt;
  235. &lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
  236.    
  237.    
  238.    
  239.      </item>
  240.    
  241.  <item>
  242.    <title>[Snippet] Bash script to generate Symfony2 doctrine files</title>
  243.    <link>http://www.strangebuzz.com/post/2012/05/22/%5BSnippet%5D-Bash-script-to-generate-Symfony2-doctrine-files</link>
  244.    <guid isPermaLink="false">urn:md5:a552a61e78d7ea2b646b2faa4cabd12f</guid>
  245.    <pubDate>Fri, 25 May 2012 13:07:00 +0200</pubDate>
  246.    <dc:creator>COil</dc:creator>
  247.        <category>symfony</category>
  248.        <category>bash</category><category>snippets</category><category>symfony</category><category>Symfony2</category><category>unix</category>    
  249.    <description>    &lt;p&gt;Hi Symfonians&amp;nbsp;! &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;
  250. &lt;br /&gt;
  251. &lt;br /&gt;
  252. Here is a very basic bash script to help generate files for a given entity of your database, useful when you don't want to reverse engineer all the tables: (replace &lt;code&gt;MyBundle&lt;/code&gt; and &lt;code&gt;MyNamespace&lt;/code&gt; by your own values)
  253. &lt;br /&gt;
  254. &lt;br /&gt;
  255. &lt;code&gt;./build_entities.sh Product&lt;/code&gt;
  256. &lt;br /&gt;
  257. &lt;br /&gt;&lt;/p&gt;
  258. &lt;script src=&quot;https://gist.github.com/2730653.js?file=gistfile1.sh&quot;&gt;&lt;/script&gt;
  259.  
  260.  
  261. &lt;p&gt;&lt;br /&gt;
  262. &lt;strong&gt;PS&lt;/strong&gt;: Note that the filter allow to generate more that one entity. (ex: &quot;Product&quot;, &quot;ProductFoo&quot;...)
  263. &lt;br /&gt;&lt;/p&gt;</description>
  264.    
  265.    
  266.    
  267.      </item>
  268.    
  269.  <item>
  270.    <title>[Symfony2] Request class mini-cheatsheet</title>
  271.    <link>http://www.strangebuzz.com/post/2012/03/01/%5BSymfony2%5D-Request-class-mini-cheatsheet</link>
  272.    <guid isPermaLink="false">urn:md5:19890e644681648289f6bafad541b3ac</guid>
  273.    <pubDate>Sat, 03 Mar 2012 22:03:00 +0100</pubDate>
  274.    <dc:creator>COil</dc:creator>
  275.        <category>symfony</category>
  276.        <category>cheatsheet</category><category>snippets</category><category>symfony</category><category>Symfony2</category>    
  277.    <description>    &lt;p&gt;Hi symfonians ! &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;^^&quot; class=&quot;smiley&quot; /&gt;
  278. &lt;br /&gt;
  279. &lt;br /&gt;
  280. Considering the following URL:
  281. &lt;br /&gt;
  282. &lt;br /&gt;&lt;/p&gt;
  283. &lt;pre&gt;
  284. http://dev.col.com/app_dev.php/my-route?bar=1&amp;amp;foo=bar
  285. &lt;/pre&gt;
  286.  
  287. &lt;p&gt;&lt;br /&gt;
  288. Here are the results of the different main public methods of the &lt;code&gt;Symfony\Component\HttpFoundation\Request&lt;/code&gt; class about the URL and server analysis: (calls are made inside a basic controller class)
  289. &lt;br /&gt;
  290. &lt;br /&gt;&lt;/p&gt;
  291. &lt;pre&gt;
  292. $r = $this-&amp;gt;getRequest();
  293. $r-&amp;gt;getClientIp() 127.0.0.1
  294. $r-&amp;gt;getScriptName() /app_dev.php
  295. $r-&amp;gt;getPathInfo() /my-route
  296. $r-&amp;gt;getBasePath() ''
  297. $r-&amp;gt;getBaseUrl() /app_dev.php
  298. $r-&amp;gt;getScheme() http
  299. $r-&amp;gt;getPort() 80
  300. $r-&amp;gt;getHttpHost() dev.col.com
  301. $r-&amp;gt;getRequestUri() /app_dev.php/my-route?bar=1&amp;amp;foo=bar
  302. $r-&amp;gt;getUri() http://dev.col.com/app_dev.php/my-route?bar=1&amp;amp;foo=bar
  303. $r-&amp;gt;getUriForPath(&amp;quot;/other-path&amp;quot;) http://dev.col.com/app_dev.php/other-path
  304. $r-&amp;gt;getQueryString() bar=1&amp;amp;foo=bar
  305. $r-&amp;gt;isSecure() false
  306. $r-&amp;gt;getHost() dev.col.com
  307. $r-&amp;gt;getMethod() GET
  308. $r-&amp;gt;isXmlHttpRequest() false
  309. &lt;/pre&gt;
  310.  
  311. &lt;p&gt;&lt;br /&gt;
  312. I have submitted a small &lt;a href=&quot;https://github.com/symfony/symfony/pull/4312&quot;&gt;PR&lt;/a&gt; to the git main Symfony2 repository to have a new function that I need in one of my sf2 projects. If your are interested in this PR, feel free to add a comment &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt; :
  313. &lt;br /&gt;
  314. &lt;br /&gt;&lt;/p&gt;
  315. &lt;pre&gt;
  316. $r-&amp;gt;getBaseServerUrl() http://dev.col.com
  317. &lt;/pre&gt;
  318.  
  319. &lt;p&gt;&lt;br /&gt;
  320. It was to avoid the following Twig code:
  321. &lt;br /&gt;
  322. &lt;br /&gt;&lt;/p&gt;
  323. &lt;script src=&quot;https://gist.github.com/1779871.js?file=gistfile1.twig&quot;&gt;&lt;/script&gt;
  324.  
  325.  
  326. &lt;p&gt;&lt;br /&gt;
  327. See you. COil &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;
  328. &lt;br /&gt;
  329. &lt;br /&gt;
  330. &lt;strong&gt;PS&lt;/strong&gt;: Note that the &lt;strong&gt;&lt;q&gt;getBasePath()&lt;/q&gt;&lt;/strong&gt; function returns an empty string as the root of the virtual host is set to the &lt;q&gt;/web&lt;/q&gt; folder of the application, for an URL like &lt;q&gt;http://dev.col.com/web/app_dev.php/my-route?bar=1&amp;amp;foo=bar&lt;/q&gt; it would return &lt;q&gt;/web&lt;/q&gt;.
  331. &lt;br /&gt;
  332. &lt;br /&gt;
  333. &lt;strong&gt;PS2&lt;/strong&gt;: If you want real Symfony cheatsheet, check the blog of &lt;a href=&quot;http://andreiabohner.wordpress.com/tag/cheat-sheet/&quot;&gt;Andréia Bohner&lt;/a&gt;.
  334. &lt;br /&gt;
  335. &lt;br /&gt;
  336. &lt;strong&gt;PS3&lt;/strong&gt;:  &lt;a href=&quot;http://sf2.memosdedev.com/recuperer-la-base-url-du-site-dans-twig.html#comment-57&quot;&gt;My PR was useful !! &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description>
  337.    
  338.    
  339.    
  340.      </item>
  341.    
  342.  <item>
  343.    <title>Simple bash script to update Symfony2</title>
  344.    <link>http://www.strangebuzz.com/post/2012/02/09/Simple-bash-script-to-update-Symfony2</link>
  345.    <guid isPermaLink="false">urn:md5:99dd2ee51dccf55156c149fa3765142d</guid>
  346.    <pubDate>Thu, 09 Feb 2012 18:16:00 +0100</pubDate>
  347.    <dc:creator>COil</dc:creator>
  348.        <category>symfony</category>
  349.        <category>bash</category><category>snippets</category><category>symfony</category><category>Symfony2</category><category>unix</category>    
  350.    <description>    &lt;p&gt;As you noticed there are &lt;a href=&quot;http://symfony.com/blog/category/releases&quot;&gt;frequent maintenance releases of Symfony2&lt;/a&gt;, the &lt;a href=&quot;http://symfony.com/blog/symfony-2-0-10-released&quot;&gt;2.0.10 version is already out&lt;/a&gt;. To avoid doings thing manually I use this simple bash script to make the update: (It works with a Symfony2 standard edition). To use it, just launch the script at the root of your project: (be careful as it will delete your vendor directory)
  351. &lt;br /&gt;&lt;/p&gt;
  352.  
  353. &lt;blockquote&gt;&lt;p&gt;./update_symfony 2.0.10&lt;/p&gt;&lt;/blockquote&gt;
  354.  
  355. &lt;h5&gt;The bash script:&lt;/h5&gt;
  356. &lt;script src=&quot;https://gist.github.com/1780897.js?file=gistfile1.sh&quot;&gt;&lt;/script&gt;
  357.  
  358.  
  359. &lt;p&gt;&lt;br /&gt;
  360. See you. &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;
  361. &lt;br /&gt;
  362. &lt;br /&gt;
  363. Other related posts;&lt;/p&gt;
  364. &lt;ul&gt;
  365. &lt;li&gt;&lt;a href=&quot;http://symfony.com/doc/current/cookbook/workflow/new_project_git.html#managing-vendor-libraries-with-bin-vendors-and-deps&quot; title=&quot;http://symfony.com/doc/current/cookbook/workflow/new_project_git.html#managing-vendor-libraries-with-bin-vendors-and-deps&quot;&gt;http://symfony.com/doc/current/cook...&lt;/a&gt;&lt;/li&gt;
  366. &lt;li&gt;&lt;a href=&quot;http://geekos.fr/11/2011/mettre-a-jour-symfony-2/&quot; title=&quot;http://geekos.fr/11/2011/mettre-a-jour-symfony-2/&quot;&gt;http://geekos.fr/11/2011/mettre-a-j...&lt;/a&gt;&lt;/li&gt;
  367. &lt;li&gt;&lt;a href=&quot;http://www.ajado.com/blog/how-to-upgrade-from-one-symfony2-distribution-to-another/&quot; title=&quot;http://www.ajado.com/blog/how-to-upgrade-from-one-symfony2-distribution-to-another/&quot;&gt;http://www.ajado.com/blog/how-to-up...&lt;/a&gt;&lt;/li&gt;
  368. &lt;/ul&gt;</description>
  369.    
  370.    
  371.    
  372.      </item>
  373.    
  374.  <item>
  375.    <title>Load fixtures with Symfony2 and YAML files</title>
  376.    <link>http://www.strangebuzz.com/post/2012/01/28/Load-fixtures-with-Symfony2</link>
  377.    <guid isPermaLink="false">urn:md5:8ab8d6813d11d5e44cb25eb56841d49a</guid>
  378.    <pubDate>Sat, 28 Jan 2012 14:06:00 +0100</pubDate>
  379.    <dc:creator>COil</dc:creator>
  380.        <category>symfony</category>
  381.        <category>doctrine2</category><category>fixtures</category><category>symfony</category><category>Symfony2</category><category>tutorial</category>    
  382.    <description>    &lt;p&gt;Hi Symfonians&amp;nbsp;! &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;
  383. &lt;br /&gt;
  384. &lt;br /&gt;
  385. I am actually spending a lot of time on testing Symfony2. When building an application, one of the first thing you will have to do is to insert initial data, also called fixtures, so you can use and test your application. There is a &lt;a href=&quot;http://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html&quot;&gt;documentation&lt;/a&gt; on the Symfony website about this subject, it uses the &lt;a href=&quot;https://github.com/doctrine/DoctrineFixturesBundle&quot;&gt;DoctrineFixturesBundle&lt;/a&gt;.
  386. &lt;br /&gt;
  387. &lt;br /&gt;
  388. It works very well, but I wanted to use YAML files &quot;a la symfony1&quot;. So I ended up with this simple solution:
  389. &lt;br /&gt;
  390. &lt;br /&gt;&lt;/p&gt;
  391.  
  392. &lt;h4&gt;The base Loader class:&lt;/h4&gt;
  393.  
  394. &lt;p&gt;First, I create a base Loader class that others entities loaders will extend:
  395. &lt;br /&gt;
  396. &lt;br /&gt;&lt;/p&gt;
  397. &lt;script src=&quot;https://gist.github.com/1694230.js?file=gistfile1.aw&quot;&gt;&lt;/script&gt;
  398.  
  399.  
  400. &lt;p&gt;&lt;br /&gt;
  401. The &lt;strong&gt;getModelFixtures()&lt;/strong&gt; function will load the YAML file corresponding to the current entity, the &lt;strong&gt;getModelFile()&lt;/strong&gt; function will have to be implemented by sub-loaders. The class implements the &lt;strong&gt;ContainerAwareInterface&lt;/strong&gt; so we can access the DIC in the loaders.
  402. &lt;br /&gt;
  403. &lt;br /&gt;&lt;/p&gt;
  404.  
  405. &lt;h4&gt;The &lt;strong&gt;Category&lt;/strong&gt; loader:&lt;/h4&gt;
  406.  
  407. &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  408.  
  409. &lt;h5&gt;The YAML file:&lt;/h5&gt;
  410.  
  411. &lt;p&gt;Both jobs and categories YAML files are almost equal to &lt;a href=&quot;http://www.symfony-project.org/jobeet/1_4/Doctrine/en/03&quot;&gt;the Jobeet1 tutorial&lt;/a&gt; ones.
  412. &lt;br /&gt;
  413. &lt;br /&gt;&lt;/p&gt;
  414. &lt;script src=&quot;https://gist.github.com/1694262.js?file=gistfile1.yml&quot;&gt;&lt;/script&gt;
  415.  
  416.  
  417. &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  418.  
  419. &lt;h5&gt;The loader class:&lt;/h5&gt;
  420. &lt;script src=&quot;https://gist.github.com/1694282.js?file=gistfile1.aw&quot;&gt;&lt;/script&gt;
  421.  
  422.  
  423. &lt;p&gt;The &lt;strong&gt;getModelFixtures()&lt;/strong&gt; function retrieves the fixtures for the &lt;strong&gt;Category&lt;/strong&gt; entity and then you just have to iterate over the array. At each iteration we add a reference to the entity so it can be used in other loaders. (as a foreign key)
  424. &lt;br /&gt;
  425. &lt;br /&gt;&lt;/p&gt;
  426.  
  427. &lt;h4&gt;The &lt;strong&gt;Job&lt;/strong&gt; loader:&lt;/h4&gt;
  428.  
  429. &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  430.  
  431. &lt;h5&gt;The YAML file:&lt;/h5&gt;
  432. &lt;script src=&quot;https://gist.github.com/1694298.js?file=gistfile1.txt&quot;&gt;&lt;/script&gt;
  433.  
  434.  
  435. &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  436.  
  437. &lt;h5&gt;The loader class:&lt;/h5&gt;
  438. &lt;script src=&quot;https://gist.github.com/1694305.js?file=gistfile1.aw&quot;&gt;&lt;/script&gt;
  439.  
  440.  
  441. &lt;p&gt;&lt;br /&gt;
  442. Same here, but:&lt;/p&gt;
  443. &lt;ul&gt;
  444. &lt;li&gt;For each iteration we retrieve the proper category reference we already built in the &lt;strong&gt;Category&lt;/strong&gt; loader (line 30).&lt;/li&gt;
  445. &lt;li&gt;In Jobeet1 there was a loop directly in the YAML file in order to add lot of job rows, now we can do this loop in our loader: &lt;strong&gt;duplicateLastJob()&lt;/strong&gt;.&lt;/li&gt;
  446. &lt;li&gt;There is also a special case where we force a value for the &lt;strong&gt;expiresAt&lt;/strong&gt; date field that would be overridden by the &lt;strong&gt;Job&lt;/strong&gt; object life-cycle callbacks otherwise.&lt;/li&gt;
  447. &lt;/ul&gt;
  448. &lt;p&gt;I think this a good approach as you have the ease of writing YAML without loosing the possibility to handle complex or edge cases with PHP. You can find the code on &lt;a href=&quot;https://github.com/COil/Jobeet2Bundle/tree/master/DataFixtures&quot;&gt;github&lt;/a&gt;.
  449. &lt;br /&gt;
  450. &lt;br /&gt;
  451. See you&amp;nbsp;! COil &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;
  452. &lt;br /&gt;
  453. &lt;br /&gt;
  454. &lt;strong&gt;PS&lt;/strong&gt;: This tutorial was tested with Symfony Standard Edition 2.0.9.
  455. &lt;br /&gt;
  456. &lt;strong&gt;PS2&lt;/strong&gt;: If you have a blog post about fixtures, let me know so I can add it below.
  457. &lt;br /&gt;
  458. &lt;br /&gt;
  459. Other posts about fixtures:&lt;/p&gt;
  460. &lt;ul&gt;
  461. &lt;li&gt;&lt;a href=&quot;http://www.dobervich.com/2011/03/15/symfony2-blog-application-tutorial-part-iv-displaying-data-using-doctrine2/&quot; title=&quot;http://www.dobervich.com/2011/03/15/symfony2-blog-application-tutorial-part-iv-displaying-data-using-doctrine2/&quot;&gt;http://www.dobervich.com/2011/03/15...&lt;/a&gt; (EN)&lt;/li&gt;
  462. &lt;li&gt;&lt;a href=&quot;http://dotheweb.posterous.com/using-faker-to-populate-a-database-its-easier&quot; title=&quot;http://dotheweb.posterous.com/using-faker-to-populate-a-database-its-easier&quot;&gt;http://dotheweb.posterous.com/using...&lt;/a&gt; (EN)&lt;/li&gt;
  463. &lt;li&gt;&lt;a href=&quot;http://www.informathic.com/post/2010/12/12/Symfony2-Fixtures-Doctrine2&quot; title=&quot;http://www.informathic.com/post/2010/12/12/Symfony2-Fixtures-Doctrine2&quot;&gt;http://www.informathic.com/post/201...&lt;/a&gt; (FR)&lt;/li&gt;
  464. &lt;li&gt;&lt;a href=&quot;http://tcuvelier.developpez.com/tutoriels/php/symfony2/doctrine2/data-fixtures/&quot; title=&quot;http://tcuvelier.developpez.com/tutoriels/php/symfony2/doctrine2/data-fixtures/&quot;&gt;http://tcuvelier.developpez.com/tut...&lt;/a&gt; (FR)&lt;/li&gt;
  465. &lt;li&gt;&lt;a href=&quot;http://keiruaprod.fr/symblog-fr/docs/doctrine-2-et-les-articles.html&quot; title=&quot;http://keiruaprod.fr/symblog-fr/docs/doctrine-2-et-les-articles.html&quot;&gt;http://keiruaprod.fr/symblog-fr/doc...&lt;/a&gt; (FR)&lt;/li&gt;
  466. &lt;li&gt;&lt;a href=&quot;http://iabsis.com/FR/article/21-5/Creez-votre-set-de-donnees-initial-fixtures&quot; title=&quot;http://iabsis.com/FR/article/21-5/Creez-votre-set-de-donnees-initial-fixtures&quot;&gt;http://iabsis.com/FR/article/21-5/C...&lt;/a&gt; (FR)&lt;/li&gt;
  467. &lt;/ul&gt;</description>
  468.    
  469.    
  470.    
  471.      </item>
  472.    
  473.  <item>
  474.    <title>Extending the Symfony2 session</title>
  475.    <link>http://www.strangebuzz.com/post/2012/01/06/Extending-the-Symfony2-session</link>
  476.    <guid isPermaLink="false">urn:md5:3c433804b64995eaaa5a22d6b14a48ba</guid>
  477.    <pubDate>Fri, 06 Jan 2012 21:16:00 +0100</pubDate>
  478.    <dc:creator>COil</dc:creator>
  479.        <category>symfony</category>
  480.        <category>session</category><category>snippets</category><category>symfony</category><category>Symfony2</category>    
  481.    <description>    &lt;p&gt;Hi symfonians ! &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;
  482. &lt;br /&gt;
  483. &lt;br /&gt;
  484. If you are used to symfony1, you probably noticed that you don't have a &lt;q&gt;myUser&lt;/q&gt; class to handle the user session. It's generally useful so you don't have to handle directly with session attributes and you can also have shortcuts. Well it's quiet easy to have such a class in Symfony2:
  485. &lt;br /&gt;
  486. Declare your own session class as the framework level in your &lt;code&gt;app/config.yml&lt;/code&gt; config file:
  487. &lt;br /&gt;
  488. &lt;br /&gt;&lt;/p&gt;
  489. &lt;script src=&quot;https://gist.github.com/1572300.js&quot;&gt; &lt;/script&gt;
  490.  
  491.  
  492. &lt;p&gt;&lt;br /&gt;
  493. And now create your own &lt;strong&gt;mySession&lt;/strong&gt; class which extends the default Symfony2 session class:
  494. &lt;br /&gt;
  495. &lt;br /&gt;&lt;/p&gt;
  496. &lt;script src=&quot;https://gist.github.com/1572339.js?file=gistfile1.aw&quot;&gt;&lt;/script&gt;
  497.  
  498.  
  499. &lt;p&gt;&lt;br /&gt;
  500. And your done. &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;
  501. &lt;br /&gt;
  502. &lt;br /&gt;
  503. PS: The class can be stored in another location, I'm not sure which is the best ?
  504. &lt;br /&gt;
  505. PS2: The service could also be loaded at the Bundle level.&lt;/p&gt;</description>
  506.    
  507.    
  508.    
  509.      </item>
  510.    
  511.  <item>
  512.    <title>The new Google applications Look and Feel is ugly ?</title>
  513.    <link>http://www.strangebuzz.com/post/2011/12/11/The-new-Google-applications-Look-and-Feel-is-ugly</link>
  514.    <guid isPermaLink="false">urn:md5:ebd85ae827b29663cf067f756b9c1b3f</guid>
  515.    <pubDate>Sun, 11 Dec 2011 21:14:00 +0100</pubDate>
  516.    <dc:creator>COil</dc:creator>
  517.        <category>General</category>
  518.        <category>google</category><category>look-and-feel</category><category>webdesign</category>    
  519.    <description>    &lt;p&gt;That's what I said when I discovered the new GMail look. I felt so uncomfortable with it that I switched back to the old interface. But now that the new interface is the default, I had to look why it looked so ugly, there must be a reason !! &lt;img src=&quot;/themes/blue-fashion/smilies/142.gif&quot; alt=&quot;:x&quot; class=&quot;smiley&quot; /&gt;
  520. &lt;br /&gt;
  521. &lt;br /&gt;
  522. Indeed, there was a good reason, the parameter &quot;Display density&quot; was set to &quot;Comfortable&quot; (&quot;Normal&quot; in French) which has the consequence to have far less emails displayed on the screen than before. I think this parameter did not exist in the past (Anyone can confirm ?), but the standard value for this parameter on the old interface was &quot;Compact&quot; (&quot;Elevé&quot; in French). When you are used to the &quot;Compact&quot; layout it's quiet hard to use the &quot;Comfortable&quot; one, it should be named &quot;Uncomfortable&quot;. &lt;img src=&quot;/themes/blue-fashion/smilies/104.gif&quot; alt=&quot;:p&quot; class=&quot;smiley&quot; /&gt; To conclude I would say that one have to search a little before making early conclusions. So, my apologies mister Google, your new look &amp;amp; feel is not ugly. &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;
  523. &lt;br /&gt;
  524. &lt;br /&gt;&lt;/p&gt;
  525. &lt;div style=&quot;text-align:center;&quot;&gt;
  526.  &lt;a href=&quot;http://www.google.fr&quot;&gt;&lt;img src=&quot;http://gallery.coilblog.com/var/resizes/Blog/gmail.jpg&quot; alt=&quot;Google mail&quot; title=&quot;Google mail&quot; /&gt;&lt;/a&gt;
  527. &lt;/div&gt;
  528.  
  529.  
  530. &lt;p&gt;&lt;br /&gt;
  531. PS: Up to now, the old interface is still available is the parameters.&lt;/p&gt;</description>
  532.    
  533.    
  534.    
  535.      </item>
  536.    
  537.  <item>
  538.    <title>symfony1 sfToolsPlugin 1-0-0 released</title>
  539.    <link>http://www.strangebuzz.com/post/2011/10/22/symfony1-sfToolsPlugin-1-0-0-released</link>
  540.    <guid isPermaLink="false">urn:md5:b4b1a977729fb57bfc979165f7c05893</guid>
  541.    <pubDate>Sat, 22 Oct 2011 02:34:00 +0200</pubDate>
  542.    <dc:creator>COil</dc:creator>
  543.        <category>symfony</category>
  544.        <category>debug</category><category>svn</category><category>symfony</category><category>tools</category>    
  545.    <description>    &lt;p&gt;Hi symfonians ! &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;
  546. &lt;br /&gt;
  547. &lt;br /&gt;
  548. Today I released a new plugin; the &lt;a href=&quot;http://www.symfony-project.org/plugins/sfToolsPlugin&quot;&gt;sfToolsPlugin&lt;/a&gt; , it's probably the smallest one I released as it only has one class and 3 main functions. In fact it contains a class I use to copy in every project I am working on. Sometimes with different names... Bored with this, even it's more a &lt;a href=&quot;http://snippets.symfony-project.org/snippet/258&quot;&gt;snippet&lt;/a&gt; than a plugin, I made the symfony1 plugin so I can call it the same way in every project I am working on and install it as a SVN external.
  549. &lt;br /&gt;
  550. &lt;br /&gt;
  551. As the name of this plugin is very generic, feel free to send me your &lt;a href=&quot;http://www.symfony-project.org/plugins/sfToolsPlugin/1_0_0?tab=plugin_contribute&quot;&gt;contribution requests&lt;/a&gt; for something you feel like it could be in it. &lt;img src=&quot;/themes/blue-fashion/smilies/wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;
  552. &lt;br /&gt;&lt;/p&gt;
  553. &lt;ul&gt;
  554. &lt;li&gt;&lt;a href=&quot;http://www.symfony-project.org/plugins/sfToolsPlugin/i_use_it&quot;&gt;I like and use the sfToolsPlugin&lt;/a&gt; &lt;img src=&quot;/themes/blue-fashion/smilies/133.gif&quot; alt=&quot;:S&quot; class=&quot;smiley&quot; /&gt;&lt;/li&gt;
  555. &lt;/ul&gt;
  556. &lt;p&gt;&lt;br /&gt;&lt;/p&gt;
  557. &lt;div style=&quot;text-align:center;&quot;&gt;
  558.  &lt;img src=&quot;http://gallery.coilblog.com/var/resizes/Strangebuzz/swiss%20knife.jpg?m=1320503259&quot; alt=&quot;sfToolsPlugin&quot; /&gt;
  559. &lt;/div&gt;
  560. </description>
  561.    
  562.    
  563.    
  564.      </item>
  565.    
  566.  <item>
  567.    <title>Blog updated and ready to rock !</title>
  568.    <link>http://www.strangebuzz.com/post/2011/10/19/blog-updated-and-ready-to-rock-%21</link>
  569.    <guid isPermaLink="false">urn:md5:18c85dcf9a223584124c0ad34e949bb6</guid>
  570.    <pubDate>Wed, 19 Oct 2011 13:55:00 +0200</pubDate>
  571.    <dc:creator>COil</dc:creator>
  572.        <category>Ubuntu</category>
  573.        <category>dotclear</category><category>gallery</category><category>hosting</category><category>ovh</category><category>rps</category><category>ubuntu</category><category>unix</category><category>vm</category><category>vps</category>    
  574.    <description>    &lt;p&gt;Not related to symfony but I finally managed to migrate my dedicated server to a new one:
  575. &lt;br /&gt;&lt;/p&gt;
  576. &lt;ul&gt;
  577. &lt;li&gt;The server was switched from a &lt;a href=&quot;http://fr.wikipedia.org/wiki/Real_Private_Server&quot;&gt;RPS&lt;/a&gt; (Real Private Server) from &lt;a href=&quot;http://www.ovh.com&quot;&gt;OVH&lt;/a&gt; (which is no more sold) to a &lt;a href=&quot;http://www.ovh.com/fr/vps/&quot;&gt;VPS1&lt;/a&gt; (always from OVH)&lt;/li&gt;
  578. &lt;li&gt;I started with a fresh new &lt;a href=&quot;http://www.ubuntu.com/&quot;&gt;Ubuntu 10.04 LTS&lt;/a&gt; distribution instead of the old 8.04 (11.04 was not available when I installed it)&lt;/li&gt;
  579. &lt;li&gt;The blog was migrated form &lt;a href=&quot;http://www.dotclear.org&quot;&gt;Dotclear1&lt;/a&gt; to &lt;a href=&quot;http://fr.dotclear.org/documentation/2.0/admin/install&quot;&gt;Dotclear2&lt;/a&gt; (I also had to convert the theme to the new Dotclear2 format)&lt;/li&gt;
  580. &lt;li&gt;The photo gallery was migrated from &lt;a href=&quot;http://codex.gallery2.org&quot;&gt;gallery2&lt;/a&gt; to &lt;a href=&quot;http://codex.gallery2.org/Gallery3:About&quot;&gt;gallery3&lt;/a&gt;&lt;/li&gt;
  581. &lt;/ul&gt;
  582. &lt;p&gt;&lt;br /&gt;
  583. Always nice to start with a new full fresh server installation, because obviously as you gained experience, you can set-up things in a better way you did it 3 years ago. But sometimes you end with setting the same things as it just work well and do the job. &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;
  584. &lt;br /&gt;
  585. I am really happy with the VPS, it's really fast even it's the least powerful offer of OVH of this kind ! I have 50go which is 40go more than I actually need. It's also Symfony2 ready. &lt;img src=&quot;/themes/blue-fashion/smilies/wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;
  586. &lt;br /&gt;
  587. &lt;br /&gt;&lt;/p&gt;
  588. &lt;div style=&quot;text-align:center;&quot;&gt;
  589.  &lt;img src=&quot;http://t2.gstatic.com/images?q=tbn:ANd9GcR-9KXuHHB784D6S7vwmsXzJ4fULXsbrXFWlNsjWJGoB-XMOwef7LAj45zW&quot; alt=&quot;Ubuntu&quot; /&gt;
  590. &lt;/div&gt;
  591. </description>
  592.    
  593.    
  594.    
  595.      </item>
  596.    
  597.  <item>
  598.    <title>symfony1 sfTCPDFPlugin 1-6-3 released</title>
  599.    <link>http://www.strangebuzz.com/post/2011/10/05/symfony1-sfTCPDFPlugin-1-6-3-released</link>
  600.    <guid isPermaLink="false">urn:md5:e17df056a0c8f8809aea95456b13c44b</guid>
  601.    <pubDate>Wed, 05 Oct 2011 03:35:00 +0200</pubDate>
  602.    <dc:creator>COil</dc:creator>
  603.        <category>symfony</category>
  604.        <category>pdf</category><category>plugin</category><category>symfony</category><category>symfony1</category><category>tcpdf</category>    
  605.    <description>    &lt;p&gt;Last week I also released the &lt;strong&gt;1.6.3&lt;/strong&gt; version of the &lt;a href=&quot;http://www.symfony-project.org/plugins/sfTCPDFPlugin&quot;&gt;sfTCPDFPlugin&lt;/a&gt;. It is just of small update to check that it works without problem with the last &lt;a href=&quot;http://www.tcpdf.org&quot;&gt;TCPDF&lt;/a&gt; library which is actually at &lt;a href=&quot;http://sourceforge.net/projects/tcpdf/files/&quot;&gt;version 5_9_120 (2011-09-22)&lt;/a&gt;. (Note that the release strategy of this library is very fast with a lot of minor versions). You can check the CHANGELOG &lt;a href=&quot;http://www.symfony-project.org/plugins/sfTCPDFPlugin/1_6_3?tab=plugin_changelog&quot;&gt;here&lt;/a&gt;.
  606. &lt;br /&gt;
  607. &lt;br /&gt;&lt;/p&gt;
  608. &lt;div style=&quot;text-align:center;&quot;&gt;
  609.  &lt;img src=&quot;http://www.symfony-project.org/uploads/plugins/1de1bb472881038d0dd085d6185a5456a07d9de7.png&quot; alt=&quot;sfTCPDFPlugin&quot; /&gt;
  610. &lt;/div&gt;
  611.  
  612.  
  613. &lt;p&gt;&lt;br /&gt;
  614. &lt;strong&gt;PS&lt;/strong&gt;: There is now more than &lt;strong&gt;100 registered users&lt;/strong&gt; for this plugin ! &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;
  615. &lt;br /&gt;
  616. &lt;br /&gt;
  617. See you. COil  &lt;img src=&quot;/themes/blue-fashion/smilies/rofl.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
  618.    
  619.    
  620.    
  621.      </item>
  622.    
  623. </channel>
  624. </rss>

If you would like to create a banner that links to this page (i.e. this validation result), do the following:

  1. Download the "valid RSS" banner.

  2. Upload the image to your own server. (This step is important. Please do not link directly to the image on this server.)

  3. Add this HTML to your page (change the image src attribute if necessary):

If you would like to create a text link instead, here is the URL you can use:

http://www.feedvalidator.org/check.cgi?url=http%3A//www.strangebuzz.com/feed/rss2

Copyright © 2002-9 Sam Ruby, Mark Pilgrim, Joseph Walton, and Phil Ringnalda