Jekyll2023-08-14T18:37:28+00:00https://alex.bumbacea.ro/feed.xmlAlexandru BumbaceaWhy not?Setup of Mongo ODM in PHP 7 - performance considered2016-12-11T16:37:38+00:002016-12-11T16:37:38+00:00https://alex.bumbacea.ro/php/2016/12/11/setup-of-mongo-odm-in-php-7-performance-considered<p>In a previous topic I have described our journey in optimising a symfony app ( <a href="https://alex.bumbacea.ro/2016/11/26/the-journey-of-a-symfony-api-from-150ms-to-20ms/" target="_blank">the-journey-of-a-symfony-api-from-150ms-to-20ms</a> ). Some of you have asked about specific configs, so here we go:</p>
<p>Install mongo-odm and the adapter:</p>
<pre>php composer.phar require alcaeus/mongo-php-adapter
php composer.phar require doctrine/mongodb-odm-bundle</pre>
<p>Now let's configure it:</p>
<pre>doctrine_mongodb:
connections:
default:
server: mongodb://%mongo_server%
options:
connect: true
connectTimeoutMS: 300 # as stated in the original post: timeouts are very important
default_database: %database_name%
document_managers:
default:
# this is also important to reduce disk usage, you could also use other backends for caching this
metadata_cache_driver: apc
retry_connect: 1
retry_query: 1
auto_mapping: true</pre>
<p>To have the best control I recommend to allow slave readonly only from code. For this you can simply use:</p>
<pre>$this->mongo->getManager()->getClassMetadata(MyDocumentType::class)->slaveOkay = true</pre>In a previous topic I have described our journey in optimising a symfony app ( the-journey-of-a-symfony-api-from-150ms-to-20ms ). Some of you have asked about specific configs, so here we go: Install mongo-odm and the adapter: php composer.phar require alcaeus/mongo-php-adapter php composer.phar require doctrine/mongodb-odm-bundle Now let's configure it: doctrine_mongodb: connections: default: server: mongodb://%mongo_server% options: connect: true connectTimeoutMS: 300 # as stated in the original post: timeouts are very important default_database: %database_name% document_managers: default: # this is also important to reduce disk usage, you could also use other backends for caching this metadata_cache_driver: apc retry_connect: 1 retry_query: 1 auto_mapping: true To have the best control I recommend to allow slave readonly only from code. For this you can simply use: $this->mongo->getManager()->getClassMetadata(MyDocumentType::class)->slaveOkay = trueInstall doctrine mongo bundle on php7 enviroments2016-12-10T09:55:08+00:002016-12-10T09:55:08+00:00https://alex.bumbacea.ro/2016/12/10/install-doctrine-mongo-bundle-on-php7-enviroments<p>I have recently made a new symfony project on php7 and I had a lot of problems installing mongo doctrine.</p>
<p>What I have tried:</p>
<ul>
<li>Directly mention packages in composer.json and run composer update</li>
<li>Putting all new packages "@stable" version</li>
</ul>
<p>None of the above worked, but I have found a very specific way that it worked and the order of the steps is very important:</p>
<pre>php composer.phar require alcaeus/mongo-php-adapter
php composer.phar require doctrine/mongodb-odm-bundle</pre>I have recently made a new symfony project on php7 and I had a lot of problems installing mongo doctrine. What I have tried: Directly mention packages in composer.json and run composer update Putting all new packages "@stable" version None of the above worked, but I have found a very specific way that it worked and the order of the steps is very important: php composer.phar require alcaeus/mongo-php-adapter php composer.phar require doctrine/mongodb-odm-bundleThe journey of a Symfony API from 150ms to 20ms2016-11-26T15:19:09+00:002016-11-26T15:19:09+00:00https://alex.bumbacea.ro/2016/11/26/the-journey-of-a-symfony-api-from-150ms-to-20ms<p>I have been involved in the development of an app based on symfony 2.8 which also used solr, Mongo and redis.</p>
<p>The problem at hand: response times were slow (see table below). With some bold objectives we went down the road.<br />
[jtrt_tables id='205']</p>
<h3>Start</h3>
<p>Best practices says to enable caching, but before going there let's try to see what can we optimize, as caching may make some things harder to discover.</p>
<p>At this point you should make sure that you have the proper measuring tools (APM and load testing). For this we have used <a href="http://jmeter.apache.org/">jmeter</a> and <a href="https://newrelic.com/">free new relic</a>. Get some numbers before starting the process and have patience (some results will start be seen after days).</p>
<h3>Use your DB engine properly</h3>
<p>What i mean is for mysql/mongo for example put in place proper indexes and analyse the queries your run.<br />
Think about that a query that you runs every few hours could lock your tables/collections for a few seconds and this could increase your response time. Our particular case was in regards to missing indexes in mongo.</p>
<p>Another bottleneck were the Solr query. We have made some tweaks to both schema and config of the solr it self and boom.... from calls that took 2-3 seconds... we don't have any above 500ms (the 99% at 3000 was mostly generated by solr calls)</p>
<h3>Use the latest versions</h3>
<p>Or at least somewhere around :). For example our upgrade from</p>
<p>php5.6 to php70 has helped us with a boost of 25% (and some headaches dues to required upgrade of Mongo driver and doctrine missing native support for the new driver).</p>
<p style="padding-left: 30px;"><strong>Update 2016.12.1:</strong> Someone asked about the upgrade of doctrine+mongo to PHP 7. As many may have observed already, the old driver is deprecated and doctrine-mongo-odm is not compatible with the new driver. But someone made a cool transition package (https://github.com/alcaeus/mongo-php-adapter) that worked great for us.<br />
Another problem encountered during the upgrade of ODM was related to the field annotation, that we had to migrate from @MongoDB\String @MongoDB\Int to @MongoDB\Field(type="string")</p>
<p>upgrade Mongo from 2.4 to 3.2 - well... someone used a very old version of Mongo when the cluster was made. This was a bit tricky as we had to take the whole app down for about 1 hour as we couldn't migrate from 2.4 to 3.2 without taking a full backup and restoring it on a new cluster.</p>
<h3>Bundles</h3>
<p>If you don't need it, remove it! If you need it in development, load it just in dev/test env.</p>
<p>Some examples of bundles disabled on our app were:</p>
<ul>
<li>SecurityBundle - our API is read-only and it's nothing that needs to be protected (or at least you could declare a dedicated firewall for the public API sections)</li>
<li>SwiftMailerBundle</li>
<li>SensioFrameworkExtraBundle</li>
<li>TwigBundle</li>
<li>AsseticBundle</li>
</ul>
<h3>Configs</h3>
<p>Make sure all configs are in production mode. Some examples would be:</p>
<ul>
<li>make as little as possible IO (also consider logs in the process)</li>
<li>Doctrine makes a lot of cache files for metadata. Put it in APC/APCU.
<pre>doctrine_mongodb:
connections:
default:
server: mongodb://%mongo_servers%
options:
connect: true
connectTimeoutMS: 300
default_database: %database_name%
document_managers:
default:
<strong>metadata_cache_driver: apc</strong>
retry_connect: 1
retry_query: 1
auto_mapping: true</pre>
</li>
<li>persistent connections where possible (we had some problems with redis after doing this, because we were using 2 databases for different purposes and switching dbs... was a nightmare)</li>
<li>Make sure you read from slaves. (we were killing the Mongo master because of this)
<ul>
<li>Here we need to control when to read from slave... so we haven't allowed it by default, but we enabled it on demand:
<pre>$container->get('doctrine_mongodb')->getManager()->getClassMetadata('<Entity Name>')->slaveOkay = true</pre>
</li>
</ul>
</li>
<li>Try to consider what the timeout of the clients are and use them in your app. If you know your client is ignoring your response, why bother completing the entire request (example: timeout -300ms, but a internal http call takes 3000ms. This would keep you busy for nothing )</li>
</ul>
<h3>Queue it!</h3>
<p>If you don't need something now, just put in a queue and continue with serving requests. Write operations (to db or disk) are usually heavier than putting it on a queue and handling it on a separate server.</p>
<p>We use RabbitMQ with this bundle: <a href="https://github.com/php-amqplib/RabbitMqBundle">https://github.com/php-amqplib/RabbitMqBundle</a></p>
<h3>Twig</h3>
<p>It's an API and we chose to have twig enabled only in dev environment (so that we can have the profiler work). :)</p>
<p>Try to use php directly, but if you can't live without it, at least install php twig extension (brings some boost in performance)</p>
<h3>Container / DI</h3>
<p>Here we also did a little comparison with other bare frameworks like slilex. We choose to stay with symfony as the performance penalty was minor compared with the advantages:</p>
<ul>
<li>yml configs were actually cached as php code at deploy</li>
<li>yml errors were caught during deploy phase (at cache warmup) and faulty containers can not be released live</li>
<li>Personally I started to use a lot ContainerPass'es and also "tags"</li>
<li>We already knew how to define and use services in symfony and brining a new framework make lead to some beginner mistakes.</li>
</ul>
<h3>Cache</h3>
<p>This was one of the final steps we added. A few tricks to be considered here:</p>
<ul>
<li>Make sure your connection to the cache server is persistent</li>
<li>Consider with what TTL you should cache (depending on change freq). If you have a large data set and freq updates on various events, you can set a high TTL and make the update process to also flush the cache</li>
<li>you can try multi level caches if you need it (apc + memcache), but it will also generate some headaches</li>
<li>To avoid complicated logic inside your methods you could use a cool caching bundle: https://github.com/eMAGTechLabs/cachebundle</li>
<li>You might have a lot of cache evictions due to large cache.
<ul>
<li>Try to reduce the size of caches (is it really required that often?)</li>
<li>Add additional capacity to the caching server.</li>
</ul>
</li>
</ul>
<h3>Nginx / FPM config</h3>
<p>Here we did some changes after we discovered that under high load we had increased response time, but our servers were free (CPU and memory). We have increase the number of worker/child processes for both nginx and php-fpm and this allowed us higher load.</p>I have been involved in the development of an app based on symfony 2.8 which also used solr, Mongo and redis. The problem at hand: response times were slow (see table below). With some bold objectives we went down the road. [jtrt_tables id='205'] Start Best practices says to enable caching, but before going there let's try to see what can we optimize, as caching may make some things harder to discover. At this point you should make sure that you have the proper measuring tools (APM and load testing). For this we have used jmeter and free new relic. Get some numbers before starting the process and have patience (some results will start be seen after days). Use your DB engine properly What i mean is for mysql/mongo for example put in place proper indexes and analyse the queries your run. Think about that a query that you runs every few hours could lock your tables/collections for a few seconds and this could increase your response time. Our particular case was in regards to missing indexes in mongo. Another bottleneck were the Solr query. We have made some tweaks to both schema and config of the solr it self and boom.... from calls that took 2-3 seconds... we don't have any above 500ms (the 99% at 3000 was mostly generated by solr calls) Use the latest versions Or at least somewhere around :). For example our upgrade from php5.6 to php70 has helped us with a boost of 25% (and some headaches dues to required upgrade of Mongo driver and doctrine missing native support for the new driver). Update 2016.12.1: Someone asked about the upgrade of doctrine+mongo to PHP 7. As many may have observed already, the old driver is deprecated and doctrine-mongo-odm is not compatible with the new driver. But someone made a cool transition package (https://github.com/alcaeus/mongo-php-adapter) that worked great for us. Another problem encountered during the upgrade of ODM was related to the field annotation, that we had to migrate from @MongoDB\String @MongoDB\Int to @MongoDB\Field(type="string") upgrade Mongo from 2.4 to 3.2 - well... someone used a very old version of Mongo when the cluster was made. This was a bit tricky as we had to take the whole app down for about 1 hour as we couldn't migrate from 2.4 to 3.2 without taking a full backup and restoring it on a new cluster. Bundles If you don't need it, remove it! If you need it in development, load it just in dev/test env. Some examples of bundles disabled on our app were: SecurityBundle - our API is read-only and it's nothing that needs to be protected (or at least you could declare a dedicated firewall for the public API sections) SwiftMailerBundle SensioFrameworkExtraBundle TwigBundle AsseticBundle Configs Make sure all configs are in production mode. Some examples would be: make as little as possible IO (also consider logs in the process) Doctrine makes a lot of cache files for metadata. Put it in APC/APCU. doctrine_mongodb: connections: default: server: mongodb://%mongo_servers% options: connect: true connectTimeoutMS: 300 default_database: %database_name% document_managers: default: metadata_cache_driver: apc retry_connect: 1 retry_query: 1 auto_mapping: true persistent connections where possible (we had some problems with redis after doing this, because we were using 2 databases for different purposes and switching dbs... was a nightmare) Make sure you read from slaves. (we were killing the Mongo master because of this) Here we need to control when to read from slave... so we haven't allowed it by default, but we enabled it on demand: $container->get('doctrine_mongodb')->getManager()->getClassMetadata('<Entity Name>')->slaveOkay = true Try to consider what the timeout of the clients are and use them in your app. If you know your client is ignoring your response, why bother completing the entire request (example: timeout -300ms, but a internal http call takes 3000ms. This would keep you busy for nothing ) Queue it! If you don't need something now, just put in a queue and continue with serving requests. Write operations (to db or disk) are usually heavier than putting it on a queue and handling it on a separate server. We use RabbitMQ with this bundle: https://github.com/php-amqplib/RabbitMqBundle Twig It's an API and we chose to have twig enabled only in dev environment (so that we can have the profiler work). :) Try to use php directly, but if you can't live without it, at least install php twig extension (brings some boost in performance) Container / DI Here we also did a little comparison with other bare frameworks like slilex. We choose to stay with symfony as the performance penalty was minor compared with the advantages: yml configs were actually cached as php code at deploy yml errors were caught during deploy phase (at cache warmup) and faulty containers can not be released live Personally I started to use a lot ContainerPass'es and also "tags" We already knew how to define and use services in symfony and brining a new framework make lead to some beginner mistakes. Cache This was one of the final steps we added. A few tricks to be considered here: Make sure your connection to the cache server is persistent Consider with what TTL you should cache (depending on change freq). If you have a large data set and freq updates on various events, you can set a high TTL and make the update process to also flush the cache you can try multi level caches if you need it (apc + memcache), but it will also generate some headaches To avoid complicated logic inside your methods you could use a cool caching bundle: https://github.com/eMAGTechLabs/cachebundle You might have a lot of cache evictions due to large cache. Try to reduce the size of caches (is it really required that often?) Add additional capacity to the caching server. Nginx / FPM config Here we did some changes after we discovered that under high load we had increased response time, but our servers were free (CPU and memory). We have increase the number of worker/child processes for both nginx and php-fpm and this allowed us higher load.PHP 72016-06-06T05:26:56+00:002016-06-06T05:26:56+00:00https://alex.bumbacea.ro/php/tehnic/web/www/2016/06/06/php-7<p>I have recently upgraded one of work project to PHP 7. What a bliss... Just by upgrading we have managed to reduce response time for Symfony based API from 100ms to 75ms (25% boost). (Note: responsibility of the decreased timing might also be from some updated libraries and drivers)<br />
I have also managed to upgrade the present blog to the new PHP version and a similar improvement was observed.</p>
<p>Other major improvements from my perspective:</p>
<ul>
<li>Strong type return methods (this can help increase the code quality and will help resolve some bugs in some early stages). I was a bit disappointed that overloading is still not available.</li>
<li>Syntax errors are now catchable</li>
</ul>I have recently upgraded one of work project to PHP 7. What a bliss... Just by upgrading we have managed to reduce response time for Symfony based API from 100ms to 75ms (25% boost). (Note: responsibility of the decreased timing might also be from some updated libraries and drivers) I have also managed to upgrade the present blog to the new PHP version and a similar improvement was observed. Other major improvements from my perspective: Strong type return methods (this can help increase the code quality and will help resolve some bugs in some early stages). I was a bit disappointed that overloading is still not available. Syntax errors are now catchableCache Bundle for Symfony2016-05-10T05:27:19+00:002016-05-10T05:27:19+00:00https://alex.bumbacea.ro/php/2016/05/10/cache-bundle-for-symfony<p>Have you ever felt that your classes are burdened with caching logic instead of proper logic? I know you did, and so did I. In an effort to improve readability and quality of the code, me and my colleagues at eMAG have developed internally a library that will remove all the extra logic for caching from method body.</p>
<p>And after some time we have decided to open source it, so that others can also use it and help develop it.</p>
<p>The library is available on github: <a href="https://github.com/eMAGTechLabs/cachebundle">https://github.com/eMAGTechLabs/cachebundle</a> . Also there is available also a small use guide.</p>
<p> </p>Have you ever felt that your classes are burdened with caching logic instead of proper logic? I know you did, and so did I. In an effort to improve readability and quality of the code, me and my colleagues at eMAG have developed internally a library that will remove all the extra logic for caching from method body. And after some time we have decided to open source it, so that others can also use it and help develop it. The library is available on github: https://github.com/eMAGTechLabs/cachebundle . Also there is available also a small use guide. wakup tool v22012-10-21T14:51:01+00:002012-10-21T14:51:01+00:00https://alex.bumbacea.ro/php/programming/web/2012/10/21/wakup-tool-v2<p>Today i've worked hard to make some changes to "wakeup tool" and so it came v2.</p>
<p>Changes that worth mentioning:</p>
<ul>
<li>New layout based on bootstrap. It's responsive now :)</li>
<li>Grouped hosts by type (Linux, Windows, Webserver). Each with it's own verification procedure</li>
<li>Changed WOL mechanism in order to remove dependencies on some installed binaries.</li>
<li>Changed autodiscovery mechanism. Now it will check if host alive trough checking ports 3389,22,80. Again removed dependencies on external binaries.</li>
<li>Changed log in mechanism to sfDoctrineGuard in order to allow future features that require permissions. If you require integration with Active Directory have a look <a href="http://www.symfony-project.org/plugins/sfDoctrineGuardPlugin/4_0_1?tab=plugin_readme">here</a>.</li>
</ul>
<p>You can have a look yourself at: <a href="https://github.com/alexbumbacea/wakeup">https://github.com/alexbumbacea/wakeup</a></p>Today i've worked hard to make some changes to "wakeup tool" and so it came v2. Changes that worth mentioning: New layout based on bootstrap. It's responsive now :) Grouped hosts by type (Linux, Windows, Webserver). Each with it's own verification procedure Changed WOL mechanism in order to remove dependencies on some installed binaries. Changed autodiscovery mechanism. Now it will check if host alive trough checking ports 3389,22,80. Again removed dependencies on external binaries. Changed log in mechanism to sfDoctrineGuard in order to allow future features that require permissions. If you require integration with Active Directory have a look here. You can have a look yourself at: https://github.com/alexbumbacea/wakeupWhy Scala is not so cool2012-10-10T16:39:01+00:002012-10-10T16:39:01+00:00https://alex.bumbacea.ro/2012/10/10/why-scala-is-not-cool<p>A friend of mine is currently attending a Scala course on courseraand she showed me one of her issues searching for an advice. Unfortunately for her after 5 minutes i was leaving the desk as i was unable to come up with any idea.</p>
<p>Based on this experience i tried to have a look at Scala docummentation, so i've started with <a href="http://www.scala-lang.org/node/25">introduction</a> and first thing i've seen was that is Java based. Considering my previous experience with a programming language writen over Java, Coldfusion(a huge resource consumer), this wasn't the best "nice to meet you" conversation. Basically Scala is compiling your code into Java binary compatible file.</p>
<blockquote><p>Scala programs run on the Java VM, are byte code compatible with Java</p></blockquote>
<p>A plus was the fact that major companies were already using Scala.</p>
<blockquote><p>For example, at <a href="http://twitter.com/">Twitter</a>, the social networking service, Robey Pointer moved their core message queue from Ruby to Scala. This change was driven by the company's need to reliably scale their operation to meet fast growing Tweet rates, already reaching <a href="http://blog.metaroll.com/2009/01/22/almost-5000-tweets-per-minute-during-obamas-inauguration/">5000 per minute during the Obama Inauguration</a>. Robeys thinking behind the <a href="http://blog.twitter.com/2009/01/building-on-open-source.html">Twitter Kestrel project</a> is explained in the developers <a href="http://robey.livejournal.com/53832.html">live journal</a>. His concise <a href="http://github.com/robey/kestrel/tree/master">1500 lines of Scala code</a> can be seen as he has generously made them available as an open source project.</p></blockquote>
<p>So far introduction hasn't brought very much confidence in continuing, so i asked my friend to give me some key points that would represent the an advantage of using it in a real case. First and only point(due to lack of time) mentioned was a better stack management while using recursive functions. At this point i said that all recursive methods can be implemented also iterative in order to avoid stack problems while using large volumes of data. On the other hand this may raise complexity of the code.</p>
<p>This conversation being over i've came back to <a href="http://www.scala-lang.org/">Scala site</a> searching for some code examples. Look what i found:</p>
<blockquote><p>Any method which takes a single parameter can be used as an infix operator in Scala. Here is the definition of class<code>MyBool</code> which defines three methods <code>and</code>, <code>or</code>, and <code>negate</code>.</p>
<pre>class MyBool(x: Boolean) {
def and(that: MyBool): MyBool = if (x) that else this
def or(that: MyBool): MyBool = if (x) this else that
def negate: MyBool = new MyBool(!x)
}</pre>
<pre>def not(x: MyBool) = x negate; // semicolon required here
def xor(x: MyBool, y: MyBool) = (x or y) and not(x and y)</pre>
</blockquote>
<p>Why a programming language requires such a feature? Why don't they like <code>obj.method(param)</code> ?</p>A friend of mine is currently attending a Scala course on courseraand she showed me one of her issues searching for an advice. Unfortunately for her after 5 minutes i was leaving the desk as i was unable to come up with any idea. Based on this experience i tried to have a look at Scala docummentation, so i've started with introduction and first thing i've seen was that is Java based. Considering my previous experience with a programming language writen over Java, Coldfusion(a huge resource consumer), this wasn't the best "nice to meet you" conversation. Basically Scala is compiling your code into Java binary compatible file. Scala programs run on the Java VM, are byte code compatible with Java A plus was the fact that major companies were already using Scala. For example, at Twitter, the social networking service, Robey Pointer moved their core message queue from Ruby to Scala. This change was driven by the company's need to reliably scale their operation to meet fast growing Tweet rates, already reaching 5000 per minute during the Obama Inauguration. Robeys thinking behind the Twitter Kestrel project is explained in the developers live journal. His concise 1500 lines of Scala code can be seen as he has generously made them available as an open source project. So far introduction hasn't brought very much confidence in continuing, so i asked my friend to give me some key points that would represent the an advantage of using it in a real case. First and only point(due to lack of time) mentioned was a better stack management while using recursive functions. At this point i said that all recursive methods can be implemented also iterative in order to avoid stack problems while using large volumes of data. On the other hand this may raise complexity of the code. This conversation being over i've came back to Scala site searching for some code examples. Look what i found: Any method which takes a single parameter can be used as an infix operator in Scala. Here is the definition of classMyBool which defines three methods and, or, and negate. class MyBool(x: Boolean) { def and(that: MyBool): MyBool = if (x) that else this def or(that: MyBool): MyBool = if (x) this else that def negate: MyBool = new MyBool(!x) } def not(x: MyBool) = x negate; // semicolon required here def xor(x: MyBool, y: MyBool) = (x or y) and not(x and y) Why a programming language requires such a feature? Why don't they like obj.method(param) ?Adobe WebUp #92012-09-20T18:12:27+00:002012-09-20T18:12:27+00:00https://alex.bumbacea.ro/adobe%20webup/javascript/2012/09/20/adobe-webup-9<p>This time, it was quite short (19:45 - 21:10) with only 2 presentation, both directly related to some cool js libraries.<br />
<img class="alignright size-thumbnail wp-image-38" title="piatra" src="/assets/piatra.png?w=150&h=150" alt="" width="150" height="150" /><br />
First presentation was kept by a student(Andrei Oprea), that is an intern at Adobe RO. He presented an online version of tool that resembles with PowerPoint - <a href="http://piatra.jit.su/">http://piatra.jit.su/</a>.<br />
This tool is based on a node.js server with front-end developed using less, jQuery, bootstrap and <a href="http://requirejs.org/"><strong>require.js</strong></a>. About jQuery, less and bootstrap i heard also before, but require.js was the new stuff.</p>
<p><strong>What's require.js?</strong> It's a dependency management library, that can help you a lot in terms of concurrency issues at load(we all had this problem at least once).</p>
<p><!--more--></p>
<p>The tool presented is able to generate, as final result, a zip file containing all required files in order to run it on compatible browser( the content and the libraries required + a tiny bash script that will start a python web server ). For the moment it's not able to edit previously created presentation, but i understood that the maintainer want's to integrate this with git or something similar so you'll be able to save presentation and restore it at a later point for further changes.</p>
<p>The second session was about same require.js library (kept by Alexandru Topliceanu), but this time the software got naked, we've seen some code. We were presented a custom built MVC based on jQuery, underscorejs ( _ ), bootstrap ( only for graphic part - as presenter said "I'm not a good designer" ) and Backbone.js.</p>
<p>So it seems that today's event celebrity was require.js. A lot of cool features were presented, some of them worth mentioning:</p>
<ul>
<li>dependency management - allows to load required components and only after that run the code</li>
<li>helpers for loading various types of data/code and compile them : coffescript, less, json</li>
<li>it offers possibility to compile the entire js code into one single minifed file that will contain the entire code to be run in the correct order. A nice example give by the presenters was the ability to compile coffescript code.</li>
</ul>
<div>You can read more about require.js <a href="http://requirejs.org/">here</a>.</div>
<p>Also we got some preview of what's going to happend in Adobe WebUp #10, there will be a presentation about ruby and Sinatra.</p>This time, it was quite short (19:45 - 21:10) with only 2 presentation, both directly related to some cool js libraries. First presentation was kept by a student(Andrei Oprea), that is an intern at Adobe RO. He presented an online version of tool that resembles with PowerPoint - http://piatra.jit.su/. This tool is based on a node.js server with front-end developed using less, jQuery, bootstrap and require.js. About jQuery, less and bootstrap i heard also before, but require.js was the new stuff. What's require.js? It's a dependency management library, that can help you a lot in terms of concurrency issues at load(we all had this problem at least once). The tool presented is able to generate, as final result, a zip file containing all required files in order to run it on compatible browser( the content and the libraries required + a tiny bash script that will start a python web server ). For the moment it's not able to edit previously created presentation, but i understood that the maintainer want's to integrate this with git or something similar so you'll be able to save presentation and restore it at a later point for further changes. The second session was about same require.js library (kept by Alexandru Topliceanu), but this time the software got naked, we've seen some code. We were presented a custom built MVC based on jQuery, underscorejs ( _ ), bootstrap ( only for graphic part - as presenter said "I'm not a good designer" ) and Backbone.js. So it seems that today's event celebrity was require.js. A lot of cool features were presented, some of them worth mentioning: dependency management - allows to load required components and only after that run the code helpers for loading various types of data/code and compile them : coffescript, less, json it offers possibility to compile the entire js code into one single minifed file that will contain the entire code to be run in the correct order. A nice example give by the presenters was the ability to compile coffescript code. You can read more about require.js here. Also we got some preview of what's going to happend in Adobe WebUp #10, there will be a presentation about ruby and Sinatra.wakeup tool2012-08-28T18:53:30+00:002012-08-28T18:53:30+00:00https://alex.bumbacea.ro/php/programming/web/2012/08/28/wakeup-tool<p>Today was the first expose to public of the wakeup tool. It's available on github here <a href="https://github.com/alexbumbacea/wakeup/">https://github.com/alexbumbacea/wakeup/</a></p>
<p>The tool is designed for companies that want to reduce the amount of power consumer by the computers while employees are not using them, but also offer possibility during VPN connections to access the machines.</p>
<p>It requires wake-on-lan to be enabled from bios and, for the auto-discovery functionality, it requires that computer would have Windows Shares enabled( it uses netbios scans ). Also computer may be added manually to the list.</p>
<p>Currently documentation and interface are still in work, but the core functionality is working.</p>Today was the first expose to public of the wakeup tool. It's available on github here https://github.com/alexbumbacea/wakeup/ The tool is designed for companies that want to reduce the amount of power consumer by the computers while employees are not using them, but also offer possibility during VPN connections to access the machines. It requires wake-on-lan to be enabled from bios and, for the auto-discovery functionality, it requires that computer would have Windows Shares enabled( it uses netbios scans ). Also computer may be added manually to the list. Currently documentation and interface are still in work, but the core functionality is working.Discover PHP 5.42012-08-20T16:43:30+00:002012-08-20T16:43:30+00:00https://alex.bumbacea.ro/php/programming/2012/08/20/discover-php-5-4<p>Finally i had the time to have a look at PHP 5.4, as i heard it had built in web server ( a cool feature for a windows user).</p>
<p>To shortly describe my requirements: a on demand webserver for Windows systems that would understand php, would allow easy configuration, a rewrite mechanism and preferably would not require any install process. All the criteria above were successfully implemented in php 5.4 as explained <a title="PHP Built In Webserver" href="http://php.net/manual/en/features.commandline.webserver.php">here</a>.<!--more--></p>
<p>I was able to run some quite basic projects on it, but when it came to running a complex framework that took advantage of the mod_rewrite available in Apache, i have observed that it requires to rewrite all your rewrite rules (i haven't found any better formula to express this ) in a php file called router.php. Not complicated as most of the advance frameworks(Zend,Symfony) require only 1 or 2 generic rules to be defined, but still it's an extra file that should be maintained in case you want to use this structure on your developer environment.<br />
For those who find suitable for their needs i'll share a bat script that can make the start of this webserver more barable:</p>
<pre class="prettyprint linenums">@ECHO OFF
ECHO Project selector
ECHO A: D:workspacealex-cv
ECHO B: D:workspaceinfoip
ECHO C: D:workspaceSymfony_Standard_2.0.17
ECHO D: D:workspacewakeup
ECHO X: D:workspace
REM #############################################################
REM ## for /C you can add as many variants as you want #
REM ## like /C ABCDEFGHI based on to order of the letter #
REM ## you'll get an error level that you can use bellow #
REM #############################################################
CHOICE /C ABCX /N /M "Decide project"
IF ERRORLEVEL 1 SET PROJECT=D:workspacealex-cv
IF ERRORLEVEL 2 SET PROJECT=D:workspaceSymfony_Standard_2.0.17web
IF ERRORLEVEL 3 SET PROJECT=D:workspacewakeupweb REM https://github.com/alexbumbacea/wakeup
IF ERRORLEVEL 4 SET PROJECT=D:workspace
ECHO You chose to start project %PROJECT%
php -S 127.0.0.1:80 -t %PROJECT%</pre>
<p>Another cool thing is that they now accept a syntax for defining arrays more similar to javascript:</p>
<pre class="prettyprint linenums">$a = ['alex', 'blog', 'review'];
$a = [ 'key' => 'value', 'key2' => 'value2']</pre>
<p>Beside the above mentioned features there is also some other stuff that worth mentioning:</p>
<ul>
<li>Traits - not a day by day thing for me, but still allows greater modularity</li>
<li>Function array de-referencing - usefull, but it makes the code more un-readable - <em>(new Class())->function();</em></li>
<li>Upload progress in session - very nice</li>
</ul>
<p>Anyway since most of the hosting accounts that i work with are 5.3, i will not be able to use this new features. :(</p>Finally i had the time to have a look at PHP 5.4, as i heard it had built in web server ( a cool feature for a windows user). To shortly describe my requirements: a on demand webserver for Windows systems that would understand php, would allow easy configuration, a rewrite mechanism and preferably would not require any install process. All the criteria above were successfully implemented in php 5.4 as explained here. I was able to run some quite basic projects on it, but when it came to running a complex framework that took advantage of the mod_rewrite available in Apache, i have observed that it requires to rewrite all your rewrite rules (i haven't found any better formula to express this ) in a php file called router.php. Not complicated as most of the advance frameworks(Zend,Symfony) require only 1 or 2 generic rules to be defined, but still it's an extra file that should be maintained in case you want to use this structure on your developer environment. For those who find suitable for their needs i'll share a bat script that can make the start of this webserver more barable: @ECHO OFF ECHO Project selector ECHO A: D:workspacealex-cv ECHO B: D:workspaceinfoip ECHO C: D:workspaceSymfony_Standard_2.0.17 ECHO D: D:workspacewakeup ECHO X: D:workspace REM ############################################################# REM ## for /C you can add as many variants as you want # REM ## like /C ABCDEFGHI based on to order of the letter # REM ## you'll get an error level that you can use bellow # REM ############################################################# CHOICE /C ABCX /N /M "Decide project" IF ERRORLEVEL 1 SET PROJECT=D:workspacealex-cv IF ERRORLEVEL 2 SET PROJECT=D:workspaceSymfony_Standard_2.0.17web IF ERRORLEVEL 3 SET PROJECT=D:workspacewakeupweb REM https://github.com/alexbumbacea/wakeup IF ERRORLEVEL 4 SET PROJECT=D:workspace ECHO You chose to start project %PROJECT% php -S 127.0.0.1:80 -t %PROJECT% Another cool thing is that they now accept a syntax for defining arrays more similar to javascript: $a = ['alex', 'blog', 'review']; $a = [ 'key' => 'value', 'key2' => 'value2'] Beside the above mentioned features there is also some other stuff that worth mentioning: Traits - not a day by day thing for me, but still allows greater modularity Function array de-referencing - usefull, but it makes the code more un-readable - (new Class())->function(); Upload progress in session - very nice Anyway since most of the hosting accounts that i work with are 5.3, i will not be able to use this new features. :(