<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>DM</title>
    <description>My name is Dwayne Maye and welcome to my blog.  As a long time LAMP developer, graphics designer and web consultant I have a solid the belief that the message, design and functionality are all equally important.
</description>
    <link>http://syrwebdev.com/</link>
    <atom:link href="http://syrwebdev.com/feed.xml" rel="self" type="application/rss+xml" />
    <pubDate>Thu, 12 Mar 2015 11:42:48 -0400</pubDate>
    <lastBuildDate>Thu, 12 Mar 2015 11:42:48 -0400</lastBuildDate>
    <generator>Jekyll v2.4.0</generator>
    
      <item>
        <title>CNY Software Developers MEAN.js Meetup Notes</title>
        <description>&lt;article&gt;
    &lt;section&gt;
        &lt;p&gt;
            &lt;strong&gt;Github Examples: &lt;/strong&gt;
            &lt;a href=&quot;https://github.com/immersegfx/cnysoftdev-meanjs-meetup&quot;&gt;
                https://github.com/immersegfx/cnysoftdev-meanjs-meetup
            &lt;/a&gt;
        &lt;/p&gt;
    &lt;/section&gt;
&lt;/article&gt;
&lt;hr/&gt;
&lt;iframe src=&quot;https://docs.google.com/presentation/d/1oNllxjQfwk7FTq38WFzMEDmJlqV2kjRSwHzmZoW6-nM/embed?start=false&amp;loop=false&amp;delayms=3000&quot;
        frameborder=&quot;0&quot; width=&quot;740&quot; height=&quot;500&quot; allowfullscreen=&quot;true&quot; mozallowfullscreen=&quot;true&quot;
        webkitallowfullscreen=&quot;true&quot;&gt;&lt;/iframe&gt;</description>
        <pubDate>Wed, 11 Mar 2015 00:00:00 -0400</pubDate>
        <link>http://syrwebdev.com/meanjs/2015/03/11/cny-developers-mean-js-meetup.html</link>
        <guid isPermaLink="true">http://syrwebdev.com/meanjs/2015/03/11/cny-developers-mean-js-meetup.html</guid>
        
        <category>MEANjs</category>
        
        <category>NodeJS</category>
        
        <category>Express</category>
        
        <category>AngularJS</category>
        
        <category>Meetup</category>
        
        
        <category>meanjs</category>
        
      </item>
    
      <item>
        <title>Adding LESS.js support to your MEAN.js app</title>
        <description>&lt;article&gt;
    &lt;p&gt;
        Working on a recent project using MEAN.js I wanted to add support for managing my styles with &lt;strong&gt;LESS.js&lt;/strong&gt;.  After
        building the application using the &lt;strong&gt;yeoman&lt;/strong&gt; generator I was a little surprised that it didn&#39;t make
        use of if by default.  Though adding it to the grunt configuration is easy and only takes a minute.
    &lt;/p&gt;
    &lt;section&gt;
        &lt;h3&gt;Installing dependencies&lt;/h3&gt;

        &lt;p&gt;
            First you will need to install the &lt;strong&gt;less&lt;/strong&gt; and &lt;strong&gt;grunt-contib-less&lt;/strong&gt; packages
            using &lt;strong&gt;npm&lt;/strong&gt;.
        &lt;/p&gt;
        &lt;code&gt;$ npm install --save less grunt-contrib-less&lt;/code&gt;
    &lt;/section&gt;

    &lt;section&gt;
        &lt;h3&gt;Optionally add a folder for .less sources&lt;/h3&gt;

        &lt;p&gt;
            Personally I like to keep source files like less and scss out of my public folder. This is not really a
            requirement though I find it easier to organize things like this.
        &lt;/p&gt;
        &lt;code&gt;$ mkdir -p assets/less&lt;/code&gt;
    &lt;/section&gt;

    &lt;section&gt;
        &lt;h3&gt;Configuring Grunt&lt;/h3&gt;
        &lt;h4&gt;Adding the watcher&lt;/h4&gt;

        &lt;p&gt;
            Next you will need to tell &lt;strong&gt;Grunt&lt;/strong&gt; how to handle .less files and update the file watchers.
            Open up &lt;strong&gt;gruntfile.js&lt;/strong&gt; in the root of your MEAN.js app and in the &lt;code&gt;initConfig.watch&lt;/code&gt;
            options, add a new option for less files under the clientCSS option. I named mine &lt;code&gt;clientLESS&lt;/code&gt;
            but you can enter any you like so long as it is unique.
        &lt;/p&gt;
        &lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;grunt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;initConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;pkg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;grunt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;readJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;package.json&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;watch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;
                &lt;span class=&quot;nx&quot;&gt;clientCSS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{...}&lt;/span&gt;
                &lt;span class=&quot;nx&quot;&gt;clientLESS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                    &lt;span class=&quot;nx&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;assets/less/*.less&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;public/modules/**/*.less&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
                    &lt;span class=&quot;nx&quot;&gt;tasks&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;less&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
        &lt;p&gt;
            &lt;strong&gt;Note:&lt;/strong&gt; If you decided not to create an assets folder then you can remove the first option in
            files.
        &lt;/p&gt;
        &lt;h4&gt;Configuring less&lt;/h4&gt;

        &lt;p&gt;
            Now tell the &lt;strong&gt;less&lt;/strong&gt; configuration where to find source files and what to do with them. I
            chose to consolidate all the styles into the application core.css. Since this is an &lt;strong&gt;AngularJS&lt;/strong&gt;
            application it is best to have all the needed styles available right away.  I added the following below the
            &lt;code&gt;csslint&lt;/code&gt; configuration.
        &lt;/p&gt;
        &lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;less&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;development&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;paths&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[{&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;assets/less/*.less&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;public/modules/**/*.less&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;dest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;public/modules/core/css/core.css&amp;#39;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}]&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;production&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;paths&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[{&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;assets/less/*.less&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;public/modules/**/*.less&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;dest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;public/modules/core/css/core.css&amp;#39;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}]&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

        &lt;p&gt;
            Having a development and production environment specification are required and things will fail like this
            without them.
        &lt;/p&gt;

        &lt;p&gt;
            &lt;code&gt;Warning: Object #&amp;lt;Object&amp;gt; has no method &#39;indexOf&#39; Used --force, continuing.&lt;/code&gt;
        &lt;/p&gt;

        &lt;p&gt;
            For now they are the same but once the application is ready to deploy the production settings
            could be updated to run additional optimizations on your styles.
        &lt;/p&gt;
    &lt;/section&gt;
    &lt;section&gt;
        &lt;h3&gt;Updating the lint task to run less&lt;/h3&gt;
        &lt;p&gt;
            Last you need to add less to the &lt;strong&gt;lint&lt;/strong&gt; &lt;code&gt;grunt.registerTask&lt;/code&gt; before the &lt;strong&gt;
            csslint&lt;/strong&gt; task.  It should look like this:
        &lt;/p&gt;
        &lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;grunt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;registerTask&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;lint&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;jshint&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;less&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;csslint&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    &lt;/section&gt;

    &lt;section&gt;
        &lt;h3&gt;Conclusion&lt;/h3&gt;
        &lt;p&gt;
            Setting this up was fairly straight forward, but I did use &lt;strong&gt;yeoman&lt;/strong&gt; to generate the site.  If
            you started by checking out source from github or some other path things may not match.  Though there should
            be enough here to get it setup.
        &lt;/p&gt;
        &lt;p&gt;
            An additional concern that popped into mind is upgrading.  I have not had to migrate to a new version yet and
            can not guarantee that these changes to the gruntfile will not be overwritten at that time.  Perhaps a better
            solution of including an external configuration should be looked at, or adding it as an option
            to the yeoman generator.
        &lt;/p&gt;
    &lt;/section&gt;
&lt;/article&gt;
</description>
        <pubDate>Wed, 11 Feb 2015 00:00:00 -0500</pubDate>
        <link>http://syrwebdev.com/mean.js/2015/02/11/adding-less.css-support-to-a-mean.js-app.html</link>
        <guid isPermaLink="true">http://syrwebdev.com/mean.js/2015/02/11/adding-less.css-support-to-a-mean.js-app.html</guid>
        
        <category>Javascript</category>
        
        <category>MEAN.js</category>
        
        <category>LESS</category>
        
        <category>Grunt</category>
        
        <category>NodeJS</category>
        
        <category>yeoman</category>
        
        
        <category>mean.js</category>
        
      </item>
    
      <item>
        <title>Experimenting with PHP 5.5 Generators</title>
        <description>&lt;p&gt;One of the new features introduced in PHP 5.5 is the &lt;strong&gt;generator syntax&lt;/strong&gt;.  The docs on php.net define it as:&lt;/p&gt;

&lt;blockquote&gt;
A generator function looks just like a normal function, except that instead of returning a value, a 
generator yields as many values as it needs to.
&lt;/blockquote&gt;

&lt;p&gt;As an example the following 2 functions would return the same results. &lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$people&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;firstName&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Jon&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;lastName&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Doe&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;firstName&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Jane&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;lastName&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Doe&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;firstName&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Travis&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;lastName&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Doe&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;arrayNames&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$people&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$names&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$people&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$names&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;implode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$names&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;yieldNames&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$people&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$people&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;implode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arrayNames&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$people&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PHP_EOL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;yieldNames&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$people&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PHP_EOL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2 id=&quot;so-yea-less-code&quot;&gt;So yea, less code?&lt;/h2&gt;

&lt;p&gt;There you have it.  You can now write less code in all your iterations, and have all the free time in the world to tackle
 the important things in like like knitting…  But wait.  There has to be more to it then that.  &lt;/p&gt;

&lt;h3 id=&quot;there-is-and-its-memory-usage&quot;&gt;There is and it’s Memory Usage&lt;/h3&gt;

&lt;p&gt;Among the benefits of using generators the one that stood out to me the most what the promise of decreased memory usage. 
Reducing the memory footprint helps free resources to serve more requests and squeeze the most out of your hardware.  For 
the purpose of this experiment I would like to put that to the test.  &lt;/p&gt;

&lt;h2 id=&quot;testing-it-out&quot;&gt;Testing it out&lt;/h2&gt;

&lt;p&gt;To check the difference in memory usage I wrote a simple test.  First I went to &lt;a href=&quot;http://www.json-generator.com/&quot;&gt;http://www.json-generator.com/&lt;/a&gt; 
and generated some sample json data.  Then I wrote a quick script that would allow me to test out the two approaches and 
see how much a difference there is.  Here is the gist of it:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/immersegfx/61a93a282ec441381385.js&quot;&gt; &lt;/script&gt;

&lt;h3 id=&quot;results&quot;&gt;Results&lt;/h3&gt;

&lt;p&gt;The sample json data I used contained around 100 records and I ran the test 5 times each running PHP 5.5.9 on Ubuntu 14.04. 
&lt;strong&gt;Note:&lt;/strong&gt; I didn’t include the individual results because they all were the same.&lt;/p&gt;

&lt;h4 id=&quot;array-test-result&quot;&gt;Array test result&lt;/h4&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;$ php TestYield.php array
Running [array] test
Start Memory Usage: 1087592
After test function: 1112744 Diff: 24.56 kb
................................................................
.....................................
After loop: 1113416 Diff: 25.22 kb&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h4 id=&quot;yield-test-result&quot;&gt;Yield test result&lt;/h4&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;$ php TestYield.php yield
Running [yield] test
Start Memory Usage: 1087592
After test function: 1088800 Diff: 1.18 kb
.................................................................
....................................
After loop: 1088984 Diff: 1.36 kb&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2 id=&quot;observations&quot;&gt;Observations&lt;/h2&gt;

&lt;h3 id=&quot;dumping-values&quot;&gt;Dumping values&lt;/h3&gt;
&lt;p&gt;One thing I noticed in testing this out is that running &lt;code&gt;var_dump&lt;/code&gt; or &lt;code&gt;print_r&lt;/code&gt; on the yieldNames
function returns an empty &lt;strong&gt;Generator Object&lt;/strong&gt;.  This may be cumbersome at some point when debugging as so far the only
means I have found to dump the content is to loop over the results.&lt;/p&gt;

&lt;h3 id=&quot;using-return&quot;&gt;Using return&lt;/h3&gt;
&lt;p&gt;Returning any value from a generator will result in a compile error.  The recommendation from php.net is:&lt;/p&gt;
&lt;blockquote&gt;
A generator cannot return a value: doing so will result in a compile error. An empty return statement is 
valid syntax within a generator and it will terminate the generator. 
&lt;/blockquote&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;It does indeed appear that using PHP 5.5 generators has an impact on memory usage.  This test shows that using generators
consumes about 4% of the memory array does.  Now I’m sure YMMV and there could be other things that effect
these results but as an example it does look promising.  Once PHP 5.5 usage is more universal I would expect libraries like 
Zend Framework would benefit greatly from these optimizations.&lt;/p&gt;
</description>
        <pubDate>Thu, 22 Jan 2015 00:00:00 -0500</pubDate>
        <link>http://syrwebdev.com/php/2015/01/22/experimenting-with-php5.5-generators.html</link>
        <guid isPermaLink="true">http://syrwebdev.com/php/2015/01/22/experimenting-with-php5.5-generators.html</guid>
        
        <category>PHP</category>
        
        <category>PHP Optimizations</category>
        
        <category>PHP 5.5</category>
        
        <category>Generators</category>
        
        
        <category>php</category>
        
      </item>
    
      <item>
        <title>Check for required PHP extensions with Composer</title>
        <description>&lt;section&gt;
Thanks to creation the Composer PHP Dependency manager, using and managing 3rd party libraries has become a breeze.  Gone
 are the days of committing dependencies and manually keeping things up to date.  Additionally using Composer removes the 
 possibility of someone making changes to a 3rd party library and committing it...  Don&#39;t do it!
&lt;/section&gt;

&lt;section&gt;
Recently I began adding Composer to some of my legacy projects and refactoring dependencies like PHPMailer over to 
Swiftmailer.  Also thanks to PHP 5.4 and its built in web server reformatting things to make development easier.  Throughout a 
projects lifecycle I may work on multiple different systems.  Maybe my laptop when working on-site or my own using Windows 
or Linux.  The awesomeness of being able to run &lt;code&gt;php composer.phar install&lt;/code&gt; after updating my sources just makes
me smile.  
&lt;/section&gt;

&lt;p&gt;That brings me to today and preparing to deploy a new Linode instance.  After provisioning my new server, grabbing the 
sources and running the Composer install I sat back, put my feet up on the desk and thought life is just grand.&lt;/p&gt;

&lt;h2 id=&quot;houston-we-have-a-problem&quot;&gt;Houston we have a problem&lt;/h2&gt;

&lt;p&gt;Roughly 30 minutes later I get a notification from NewRelic informing me that my error rate is at 10%, Doh!  So back to 
the server logs to see what’s up and find.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;PHP Fatal error:  Class &amp;#39;Imagick&amp;#39; not found&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Well that explains things.  Just need to install the PHP Imagick module and we are back in business.  But how can I make
sure this doesn’t happen again?  I could configure a build system using Phing or Ant, or just write a bash build script
to automate it in the future.  Both would work abet be overkill for the scope of the project.  That’s when I turned 
to composer and found information on &lt;a href=&quot;https://getcomposer.org/doc/02-libraries.md#platform-packages&quot;&gt;Platform packages&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;composer-platform-packages&quot;&gt;Composer Platform Packages&lt;/h2&gt;

&lt;blockquote&gt;
Composer has platform packages, which are virtual packages for things that are installed on the system but are not 
actually installable by Composer. This includes PHP itself, PHP extensions and some system libraries. 
&lt;/blockquote&gt;

&lt;p&gt;Woo hoo! That’s exactly what I was looking for. To validate the availability of PHP extensions, all that is needed is to 
preface its name with &lt;strong&gt;&lt;em&gt;ext-&lt;/em&gt;&lt;/strong&gt; and add it to the &lt;strong&gt;&lt;em&gt;requre&lt;/em&gt;&lt;/strong&gt; section of the &lt;code&gt;package.json&lt;/code&gt; file.  &lt;/p&gt;

&lt;h3 id=&quot;example&quot;&gt;Example&lt;/h3&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;quot;name&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;composer/example&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;quot;require&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;quot;php&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;gt;=5.4.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;quot;swiftmailer/swiftmailer&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;5.3.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;quot;ext-imagick&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;*&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Notice the specified version is set to &lt;strong&gt;*&lt;/strong&gt;.  The Composer docs state that:&lt;/p&gt;
&lt;blockquote&gt;
Versioning can be quite inconsistent here, so it&#39;s often a good idea to just set the constraint to *. 
&lt;/blockquote&gt;

&lt;h2 id=&quot;testing-it-out&quot;&gt;Testing it out&lt;/h2&gt;

&lt;p&gt;Now to test I locally removed the imagick extension and ran composer again which returned:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested PHP extension ext-imagick * is missing from your system.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;With that in place now I can track these dependencies in the future.  It would be nice to have it handle the installation
 of the missing extensions but at least knowing makes things a whole lot easier.  &lt;/p&gt;
</description>
        <pubDate>Wed, 07 Jan 2015 00:00:00 -0500</pubDate>
        <link>http://syrwebdev.com/composer/2015/01/07/using-composer-to-require-php-modules.html</link>
        <guid isPermaLink="true">http://syrwebdev.com/composer/2015/01/07/using-composer-to-require-php-modules.html</guid>
        
        <category>PHP</category>
        
        <category>Composer</category>
        
        
        <category>composer</category>
        
      </item>
    
      <item>
        <title>Setting up a NodeJs development environment on Ubuntu 14</title>
        <description>&lt;p&gt;If you are like me the first thing that comes to mind when installing a new application is to fire up apt and download it
from the repository.  I mean why not get all the benefits of simple updates and configuration.  Well quickly I noticed there
were issues running &lt;code&gt;npm&lt;/code&gt; and permissions.  Npm will warn you when running &lt;code&gt;sudo npm install -g&lt;/code&gt; and 
in my experience ignoring warnings is not the best way to get started with something. &lt;/p&gt;

&lt;h3 id=&quot;nodejs-setup-without-sudo&quot;&gt;NodeJs setup without sudo&lt;/h3&gt;

&lt;p&gt;After a bit a research I found a link to a Github Gist with instructions on how to configure your dev without having to worry 
about sudo.  &lt;a href=&quot;https://gist.github.com/isaacs/579814#file-node-and-npm-in-30-seconds-sh&quot;&gt;https://gist.github.com/isaacs/579814#file-node-and-npm-in-30-seconds-sh&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I chose the first option which worked like a charm but it is worth a read as there may be one better suited for your needs.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/isaacs/579814.js?file=node-and-npm-in-30-seconds.sh&quot;&gt; &lt;/script&gt;

&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;And that’s all there is so far.  Hope this can help save someone a little time and as I find more tips I will come 
back and update things.&lt;/p&gt;
</description>
        <pubDate>Tue, 18 Nov 2014 00:00:00 -0500</pubDate>
        <link>http://syrwebdev.com/information/2014/11/18/getting-a-nodejs-enviroment-setup-on-ubuntu-14.html</link>
        <guid isPermaLink="true">http://syrwebdev.com/information/2014/11/18/getting-a-nodejs-enviroment-setup-on-ubuntu-14.html</guid>
        
        <category>NodeJs</category>
        
        <category>Npm</category>
        
        
        <category>information</category>
        
      </item>
    
      <item>
        <title>Why I decided on Jekyll and GitHub pages</title>
        <description>&lt;p&gt;Over the years I have tried various platforms to store my ideas.  Wordpress, trac, redmine, blogger and a few others in 
between and although they are all great platforms often little issues that made the process cumbersome.  &lt;/p&gt;

&lt;p&gt;With that in mind I started searching again with a few new requirements:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;I don’t want to host the software or worry about keeping it up to date with security patches.&lt;/li&gt;
  &lt;li&gt;Styling and updating needs to be fast and easy.  Without the need to learn a complicated theme format and variables. &lt;/li&gt;
  &lt;li&gt;Support local development that is simple to setup and sync between the various computers I use.  &lt;/li&gt;
  &lt;li&gt;Syntax highlighting for code samples with support for a good set of languages.  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And after a bit of research it appears that I have found my candidate. &lt;/p&gt;

&lt;h3 id=&quot;setting-up-jekyll-and-github-pages&quot;&gt;Setting up Jekyll and GitHub pages&lt;/h3&gt;

&lt;p&gt;There are a ton of different online resources covering the setup and install process so I won’t go to much into 
detail on that front.  Instead I here are links to the pages and tutorials that I followed to get started. &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://jekyllrb.com/&quot;&gt;jekyllrb.com&lt;/a&gt; - The Jekyll website&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://pages.github.com/&quot;&gt;pages.github.com&lt;/a&gt; - General instructions on how to get your initial GitHub pages 
repository setup.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://jekyllbootstrap.com/&quot;&gt;jekyllbootstrap.com&lt;/a&gt; - All the tools needed to get a working scaffold very quickly. 
Also provides rake tasks to help with common tasks. &lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Wed, 01 Oct 2014 00:00:00 -0400</pubDate>
        <link>http://syrwebdev.com/information/2014/10/01/why-I-picked-jekyll-and-github-pages.html</link>
        <guid isPermaLink="true">http://syrwebdev.com/information/2014/10/01/why-I-picked-jekyll-and-github-pages.html</guid>
        
        <category>GitHub</category>
        
        <category>Jekyll</category>
        
        
        <category>information</category>
        
      </item>
    
  </channel>
</rss>
