<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nebojša Kamber on Medium]]></title>
        <description><![CDATA[Stories by Nebojša Kamber on Medium]]></description>
        <link>https://medium.com/@nebkam?source=rss-4eac5a1135ff------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*d6vXQPiwtIeniiLeHp3IjQ.jpeg</url>
            <title>Stories by Nebojša Kamber on Medium</title>
            <link>https://medium.com/@nebkam?source=rss-4eac5a1135ff------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 20:28:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nebkam/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Symfony: Passing more than one Security attribute to AccessDecisionManager::decide() is deprecated]]></title>
            <link>https://nebkam.medium.com/symfony-passing-more-than-one-security-attribute-to-accessdecisionmanager-decide-is-deprecated-934b7f5b14d8?source=rss-4eac5a1135ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/934b7f5b14d8</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[symfony]]></category>
            <category><![CDATA[annotations]]></category>
            <dc:creator><![CDATA[Nebojša Kamber]]></dc:creator>
            <pubDate>Thu, 09 Jan 2020 23:18:00 GMT</pubDate>
            <atom:updated>2020-02-13T07:54:29.542Z</atom:updated>
            <content:encoded><![CDATA[<p>Since Symfony 5 is out in the wild <a href="https://symfony.com/blog/symfony-5-0-0-released">for a while</a> now, I wanted to update to Symfony 4.4 and prepare for the upgrade.</p><p>I guess you all know about the Symfony’s <a href="https://symfony.com/doc/current/setup/upgrade_major.html">future compatibility promise</a> — if your codebase works on 4.4 without deprecation notices, chances are it will work on 5.0 too</p><p>Then I ran into this cryptic deprecation notice:</p><blockquote><em>Passing more than one Security attribute to Symfony\Component\Security\Core\Authorization\AccessDecisionManager::decide() is deprecated since Symfony 4.4. Use multiple decide() calls or the expression language (e.g. “has_role(…) or has_role(…)”) instead</em></blockquote><p>I say “cryptic” because I haven’t used AccessDecisionManager::decide, like, never.<br>I&#39;ve traced this to this @IsGranted annotation, that was using multiple roles.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4a79310aa2574aba278dcb020ae92e7/href">https://medium.com/media/c4a79310aa2574aba278dcb020ae92e7/href</a></iframe><p>Then I changed it to @Security annotation, according to the <a href="https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/security.html#security">docs</a> and the suggestion in the deprecation notice to this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c68bd7ad82d8b4a112cbea54ec135bb1/href">https://medium.com/media/c68bd7ad82d8b4a112cbea54ec135bb1/href</a></iframe><p><strong>And here comes the funny part…</strong></p><p>Even though the difference in syntax between @IsGranted and @Security looked so subtle (using or instead of an array), the new, human readable version, is actually an <a href="https://symfony.com/doc/current/components/expression_language/syntax.html#logical-operators">Expression</a>.<br>And to parse it, I needed a Symfony <a href="https://symfony.com/doc/current/components/expression_language.html">ExpressionLanguage Component</a>, as noted by an informative exception that broke my tests:</p><blockquote><em>To use the @Security tag, you need to use the Security component 2.4 or newer and install the ExpressionLanguage component.</em></blockquote><p>N̶o̶t̶e̶ ̶t̶o̶ ̶s̶e̶l̶f̶:̶ ̶M̶a̶k̶e̶ ̶a̶ ̶P̶R̶ ̶t̶o̶ ̶t̶h̶e̶ ̶o̶f̶f̶i̶c̶i̶a̶l̶ ̶d̶o̶c̶s̶,̶ ̶s̶i̶n̶c̶e̶ ̶t̶h̶e̶r̶e̶ ̶w̶a̶s̶ ̶n̶o̶ ̶s̶i̶g̶n̶ ̶o̶f̶ ̶t̶h̶a̶t̶ ̶c̶o̶m̶p̶o̶n̶e̶n̶t̶ ̶b̶e̶i̶n̶g̶ ̶n̶e̶e̶d̶e̶d̶.̶ <br><a href="https://github.com/sensiolabs/SensioFrameworkExtraBundle/pull/666#event-2937987055">Done that</a>, but seems Symfony prefers to inform you about dependencies through exceptions, not documentation.</p><p>Thankfully, that’s quickly fixed:<br>composer require symfony/expression-language</p><p>And that’s it! <br>Changed annotations in all the places where multiple roles were used and no more deprecation notices :)</p><p><em>Originally published at </em><a href="https://nebojsa.dev/symfony-passing-more-than-one-security-attribute-to-accessdecisionmanagerdecide-is-deprecated/"><em>Nebojša.dev</em></a><em> on January 9, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=934b7f5b14d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Symfony Serializer to consume REST APIs in OOP way]]></title>
            <link>https://medium.com/infostud/using-symfony-serializer-to-consume-rest-apis-in-oop-way-9c5de319ef7b?source=rss-4eac5a1135ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c5de319ef7b</guid>
            <category><![CDATA[symfony]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Nebojša Kamber]]></dc:creator>
            <pubDate>Fri, 01 Nov 2019 07:34:08 GMT</pubDate>
            <atom:updated>2020-02-13T07:43:18.446Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>How to leverage the power of Symfony Serializer to elegantly talk to REST APIs</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8eRVmkDE0vt21z2ohlTulw.jpeg" /></figure><h3>How It Started</h3><p>Lately, I needed to upgrade to ZohoCRM API v2.<br>- <em>“Cool, their new API has a PHP SDK, that’s going to be implemented easy!”<br></em>Boy, was I wrong.<br>Those who haven’t tried this before — be warned — you will wander in the woods of abstract documentation, back and forth between their developer portal, Github source of their PHP SDK, trying to find some examples.<br>I lost two days banging my head on it and in the end decided to write a small API client as a wrapper for their REST API instead.</p><h3>The Usual</h3><p>My usual routine when writing an API client would start with fetching a response with Guzzle, json_decode-ing a response, a series of if/else/switch-es and manual mapping of associative arrays to my entities. <br>And, for POST-ing and PUT-ing data back, I&#39;d have a similar, ugly block of code that would dump my entity into an associative array.<br>I&#39;ve always looked at those pieces of my code as especially fragile and error prone. Let me give you a hint:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba11830012906a94fd41727a875aa942/href">https://medium.com/media/ba11830012906a94fd41727a875aa942/href</a></iframe><h3>What’s Wrong With This?</h3><ul><li>IDEs can’t really help you when working with associative arrays, since there’s <strong>no type information</strong> and it’s not really the OOP way</li><li>mapping logic from API response and back to API request payload is <strong>duplicated</strong> ( Project::fromApiResponse and Project::toApiRequestpayload methods)</li></ul><blockquote><em>That got me thinking — There must be a better way of doing this..</em></blockquote><h3>With Symfony Serializer</h3><p>As you might have guessed, <a href="https://symfony.com/doc/current/components/serializer.html">Symfony Serializer</a> is a standalone component that can be installed via Composer. But, in order to use most of it’s magic, I suggest installing the whole pack, that includes some additional dependencies:</p><p>composer require symfony/serializer-pack</p><p>So, I rewrote my code to something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f0c30041841ad30ce40aae29652c25db/href">https://medium.com/media/f0c30041841ad30ce40aae29652c25db/href</a></iframe><h3>What’s Different?</h3><ul><li>API responses and request payloads nicely fit in <strong>objects</strong> (Project and ProjectCollection), not associative arrays.</li><li>Object properties are <strong>type hinted</strong> to their types in JSON, so there’s no doubt what’s their type and no incidental type-juggling.<br>If the type on the property doesn’t match the type in JSON, Serializer will throw an <strong>exception</strong>.</li><li>Have you noticed I didn’t have to tell the Serializer to map to the Project class? <br>He <strong>auto-mapped</strong> ProjectCollection::result to an array of Project instances, by reading the ProjectCollection::setResult() type hint.<br><em>(under the hood, it’s using </em><a href="https://github.com/phpDocumentor/ReflectionDocBlock"><em>DocBlock parser</em></a><em> for that - thanks </em><a href="https://gist.github.com/parijke"><em>Paul Rijke</em></a><em> for pointing that out)</em></li><li>Mapping is done by @SerializedName annotation and it&#39;s <strong>not duplicated</strong></li><li>On the downside, this method requires a <strong>separate class</strong> for every type of embedded object.</li></ul><h3>To Wrap Up</h3><blockquote><em>Now I felt that my API client code was more maintainable.<br>Exceptions were thrown early on, mapping was explicit and deduplicated. <br>Even though I ended up with more files and lines of code, I felt it was worth it.<br>Oh, and a bonus — wrapping it in objects, instead of associative arrays, made it easier for me to test them.</em></blockquote><p><em>Originally published at </em><a href="https://nebojsa.dev/using-symfony-serializer-to-consume-rest-apis-in-oop-way/"><em>Nebojša.dev</em></a><em> on November 1, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c5de319ef7b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infostud/using-symfony-serializer-to-consume-rest-apis-in-oop-way-9c5de319ef7b">Using Symfony Serializer to consume REST APIs in OOP way</a> was originally published in <a href="https://medium.com/infostud">Infostud grupa</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Symfony: Deprecated @Route and @Method Annotations]]></title>
            <link>https://nebkam.medium.com/symfony-deprecated-route-and-method-annotations-4d5e1d34556a?source=rss-4eac5a1135ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d5e1d34556a</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[routing]]></category>
            <category><![CDATA[symfony-framework]]></category>
            <category><![CDATA[annotations]]></category>
            <category><![CDATA[symfony4]]></category>
            <dc:creator><![CDATA[Nebojša Kamber]]></dc:creator>
            <pubDate>Tue, 03 Jul 2018 21:57:46 GMT</pubDate>
            <atom:updated>2020-01-20T07:49:14.398Z</atom:updated>
            <content:encoded><![CDATA[<p>Doing a composer update on my pet project got me a bunch of deprecation notices:</p><blockquote>The “Sensio\Bundle\FrameworkExtraBundle\Configuration\Route” annotation is deprecated since version 5.2. Use “Symfony\Component\Routing\Annotation\Route” instead.</blockquote><p>OK, that sounds familiar..<br> I’ve always had a dilemma when auto-importing @Route in PHPStorm,which of the two should I choose.<br> Guess I went with the wrong one :(<br> Correcting was easy, yet boring:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b50bc96e224563836750e94056a3a1ef/href">https://medium.com/media/b50bc96e224563836750e94056a3a1ef/href</a></iframe><p>The other depreecation looked similar:</p><blockquote>The “Sensio\Bundle\FrameworkExtraBundle\Configuration\Method” annotation is deprecated since version 5.2. Use “Symfony\Component\Routing\Annotation\Route” instead.</blockquote><p>OK, what? @Method is deprecated, use @Route ? Go home, Symfony, you are drunk :D<br> Well.. turns out the message is sane. The new way of specifying the HTTP method is in the @Route annotation, under methods key.<br> So, I&#39;ve corrected:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac77f3b28908ce0ec4f60566c2b160dc/href">https://medium.com/media/ac77f3b28908ce0ec4f60566c2b160dc/href</a></iframe><p>To this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cccf482866361104b5d8820de00ed31c/href">https://medium.com/media/cccf482866361104b5d8820de00ed31c/href</a></iframe><p>After updating all the annotations, I was left was a cryptic deprecation notice:</p><blockquote>Enabling the “sensio_framework_extra.router.annotations” configuration is deprecated since version 5.2. Set it to false and use the “Symfony\Component\Routing\Annotation\Route” annotation from Symfony itself.</blockquote><p>I say “cryptic” because I did not enable that configuration myself. It was enabled by default. And there’s a <a href="https://github.com/symfony/recipes/pull/430">pull request</a> to make it disabled by default.<br> Until that pull request gets merged, the fix that worked for me was to create a config/packages/framework_extra.yaml and disable those annotations explicitly:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1197c234fa242491188ead2daa980c3b/href">https://medium.com/media/1197c234fa242491188ead2daa980c3b/href</a></iframe><p>EDIT: If you’re using Symfony <strong>3.4</strong>, you can put these settings in app/config/config.yml instead. Thanks <a href="https://stackoverflow.com/users/2540699/strabek">Strabek</a>!</p><p>EDIT 2: the <a href="https://github.com/symfony/recipes/pull/430">pull request</a> <strong>did get merged</strong> as a Flex recipe, so installing sensio/framework-bundle from a Symfony app with Flex, this config should be <strong>autogenerated</strong> :)</p><p>Yay! No more deprecation notices :)</p><p><em>Originally published at </em><a href="https://nebojsa.dev/symfony-deprecated-route-and-method-annotations/"><em>Nebojša.dev</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d5e1d34556a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Symfony: Inject Doctrine Repositories in Controllers]]></title>
            <link>https://nebkam.medium.com/symfony-inject-doctrine-repositories-in-controllers-4ce62906bcf8?source=rss-4eac5a1135ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ce62906bcf8</guid>
            <category><![CDATA[symfony-5]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[symfony]]></category>
            <category><![CDATA[symfony-6]]></category>
            <category><![CDATA[doctrine]]></category>
            <dc:creator><![CDATA[Nebojša Kamber]]></dc:creator>
            <pubDate>Sun, 13 May 2018 22:22:13 GMT</pubDate>
            <atom:updated>2023-03-22T12:25:35.247Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve come across a cool pattern since Symfony 4 — injecting repositories instead of EntityManager</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/086cc7715bba04ce322bdeab51845b5a/href">https://medium.com/media/086cc7715bba04ce322bdeab51845b5a/href</a></iframe><p>In the latter, we keep the scope limited only to the repository we need, not holding on to the whole EntityManager.<br>This is possible because <em>all</em> <em>your repositories are </em><strong><em>automatically</em></strong><em> registered as services</em> and hence can be autowired.</p><p>EDIT #2: For this approach to work, make sure your repositories extend ServiceEntityRepository (not EntityRepository).</p><p>Previous Symfony versions allowed you to register repositories as services <strong>manually</strong> and event that was tedious, because it required a custom factory etc.</p><p>Since EntityManager is mostly used for persisting and deleting entities, you can add a few helper methods to your repository (if you’re using <a href="https://symfony.com/bundles/SymfonyMakerBundle/current/index.html">Symfony Maker Bundle</a>, chances are these methods were autogenerated for you):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce4b17195ee5cf7b6e1c6acad1153d54/href">https://medium.com/media/ce4b17195ee5cf7b6e1c6acad1153d54/href</a></iframe><p>Then, you can shorten your create/delete controllers as well:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/14dfb7d173aee2f5ab63243d15f85a00/href">https://medium.com/media/14dfb7d173aee2f5ab63243d15f85a00/href</a></iframe><p>EDIT: first version of the post did not utilize the DI for fetching the EntityManager and did an unfair comparison. This is corrected and the actual difference between these two approaches is probably <em>trivial</em> now.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ce62906bcf8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplicity vs Power: Symfony Forms]]></title>
            <link>https://nebkam.medium.com/simplicity-vs-power-symfony-forms-2d5c26e36d35?source=rss-4eac5a1135ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d5c26e36d35</guid>
            <dc:creator><![CDATA[Nebojša Kamber]]></dc:creator>
            <pubDate>Mon, 04 Apr 2016 20:52:40 GMT</pubDate>
            <atom:updated>2020-01-20T07:35:50.904Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Disclaimer: This article covers using Symfony Framework without the Doctrine ORM</blockquote><p>As a follow-up on a <a href="https://twitter.com/webmozart/status/715174726923063297">conversation</a> on Twitter, I decided to compile our dev team’s experience in using Symfony Forms for almost three years in production.</p><p>Coming from a CodeIgniter background, we’ve found Symfony’s <a href="http://symfony.com/doc/current/components/form/introduction.html">Form</a> and <a href="http://symfony.com/doc/current/components/security/introduction.html">Security</a> component to be the most powerful and most complex parts of the framework.</p><h4>Domain &amp; Type — Duplication</h4><p>Splitting the form generation/handling into two parts was one of the biggest changes for us. We followed the Symfony guidelines and avoided polluting our controllers with $this-&gt;createFormBuilder() but since we don’t use Doctrine entities, every form required us to make a dedicated domain object and a dedicated type object.</p><p>This led to us to duplicate a lot of form-related stuff. Symfony has very powerful <a href="https://symfony.com/doc/current/book/validation.html">validation</a> and it’s a pity it has to be split across form domains and their corresponding types.<br> For example, you can @Assert\Choice for a specific field, but you still have to repeat those choices when adding a ChoiceType; you can @Assert\Type(“integer”) a field, but you still have to mark it as an IntegerType.<br> Now, I understand, splitting the form <em>information</em> from form <em>representation</em> is a good thing in theory, but in reality, it was more of a chore than a boost.</p><p><strong>Our specific business case required us to build a lot of forms (133), so duplication hit us hard.</strong><br> Following the official cookbook <a href="http://symfony.com/doc/current/cookbook/form/inherit_data_option.html">article</a> to reduce duplication didn’t work for us, so we ended up not using inherit_data. Eventually, using the plain OO inheritance proved better.</p><h4>Form Modifiers</h4><p>If you have to implement multi-step AJAX forms or have some kind of dependent AJAX filters in your form, chances are you’ll get an <a href="http://symfony.com/doc/current/cookbook/form/dynamic_form_modification.html">advice</a> to use them.</p><p>Don’t.<br> We’ve found them so complicated (sometimes even <a href="https://github.com/symfony/symfony/issues/11902">impossible</a>) to setup, test and debug that, if we had another opportunity, would skip using Symfony Forms in AJAX-heavy scenarios altogether.</p><h4>Debugging Form Validation</h4><p>Now, this may be because of the first issue — when validation is split between the domain and the type, it’s hard to find out which one caused it.<br> Or, this could be because of the modular nature of form building (every type inside a form type can have it’s own child type and so on), so it’s not so easy to <em>flatten</em> those errors and find out where and why it occurred.</p><p>Either way, every time a form isValid returns false, we know we’re in for a serious head-scratching.</p><h4>To Conclude..</h4><p>I didn’t mean for this to be a rant on Symfony Form component’s complexity.<br> It is a very sophisticated and thoroughly tested library we’d use on a project any day. It has helped us numerous times and we’re always discovering new ways in optimizing using it (it has changed a lot since we’ve started using it in Symfony 2.2).<br> The point I’m trying to get across is, while powerful, this library has a steep learning curve, a lot of <em>gotchas</em> and one needs really to master it in order to use it effectively, beyond the simplest use cases.</p><p><em>Originally published at </em><a href="https://nebojsa.dev/simplicity-vs-power-symfony-forms/"><em>Nebojša.dev</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d5c26e36d35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handling MongoDB Dates in PHP (New Driver)]]></title>
            <link>https://nebkam.medium.com/handling-mongodb-dates-in-php-new-driver-e0f65e7496e0?source=rss-4eac5a1135ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0f65e7496e0</guid>
            <dc:creator><![CDATA[Nebojša Kamber]]></dc:creator>
            <pubDate>Fri, 29 Jan 2016 12:22:38 GMT</pubDate>
            <atom:updated>2020-01-20T07:34:04.986Z</atom:updated>
            <content:encoded><![CDATA[<p>In case you’re enthusiastic like me and wanted to use the <a href="https://github.com/mongodb/mongo-php-driver">new MongoDB driver for PHP</a> ASAP, you’ve might have stumbled upon differences in date handling.</p><p>Untill now, when you’ve wanted to properly <strong>insert</strong> dates, you’d construct new <a href="http://php.net/manual/en/class.mongodate.php">MongoDate</a> and insert it as such. Well, there is no such class any more in the new driver, and to insert a date properly, you need to use new MongoDB\BSON\<a href="http://php.net/manual/en/class.mongodb-bson-utcdatetime.php">UTCDatetime</a>. Notice the difference in constructor arguments, though — the new UTCDateTime accepts Unix timestamp in milliseconds, not seconds like MongoDate did.</p><p>Of course, you have the use the new class when <strong>querying</strong> as well:</p><pre>$docs = $collection-&gt;find([<br> &#39;ts&#39; =&gt; [<br>  &#39;$gt&#39; =&gt;new MongoDB\BSON\UTCDatetime($unix_timestamp * 1000)<br>  ]<br> ]);</pre><p>And when you fetch your objects, you can use <a href="http://php.net/manual/en/mongodb-bson-utcdatetime.todatetime.php">toDateTime</a> to get native PHP’s <a href="http://php.net/manual/en/class.datetime.php">DateTime</a> and format it as you’d like.</p><p><em>Originally published at </em><a href="https://nebojsa.dev/mongodb-dates-php-new-driver/"><em>Nebojša.dev</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0f65e7496e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Two App Challenges in a Month]]></title>
            <link>https://nebkam.medium.com/two-app-challenges-in-a-month-1d68e811439f?source=rss-4eac5a1135ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d68e811439f</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Nebojša Kamber]]></dc:creator>
            <pubDate>Tue, 24 Nov 2015 07:51:32 GMT</pubDate>
            <atom:updated>2015-11-24T07:51:32.931Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<p>Who said developers can’t have hobbies?</p><h4>My Background</h4><p>I’ve started my career freelancing on web projects from scratch and have moved to enterprise 5 years ago. For the past few years I’ve been working as a PHP developer for the <a href="http://www.polovniautomobili.com/">top car portal</a> in Serbia from their offices in Subotica.</p><p>And as much as I’ve come to love working in the enterprise, sometimes I miss the <em>hype</em> of starting a new project, the <em>intensity</em> of brainstorms, the <em>tranquility</em> of having just a business case and a clean slate, clear mind and an empty editor.</p><p>I’ve tried having pet projects, I really did. My /var/www is a safe haven for potential startup sites or new open source libraries; my Google Keep is a scrapbook for business models’ ideas and potential target audiences…</p><p>What I lacked was — motivation.</p><p>I would have an idea, brainstorm it with my wife and a couple of friends, start building a proof of concept and... The hype was gone. Raising doubts, undermined my will in less than a few days. After that, I’d usually rm -rf the whole thing..</p><p>Let’s face it, I was a lousy Product Owner for my own ideas.</p><h4>Challenge #1</h4><p>Then came the <a href="http://eulife.appchallenge.net/">EU Life App Challenge</a> invitation email. I didn’t build anything native before, but it got me interested. And they accepted web apps! And there was less than 15 days left. Game On!</p><p>I’ve teamed up with a colleague, <a href="https://medium.com/u/f3f7520746e1">Branko Sedlar</a>, who wanted to try coding something different from PHP, too. And after an intense week or so, working late after our day jobs, our small Angular app, <a href="http://funstats.eu/#/">Fun Stats</a>, won the <a href="http://www.appchallenge.net/devtalk-nebojsa-branko-serbia/">4th prize</a>!</p><p>We were thrilled! We tried out all the new technologies we’ve wanted, we made something useful, and got some pocket money from it. Not only did we have a pet project, but our pet had won the pet pageant, too :)</p><p><em>As you can imagine, we were hooked on that feeling instantly.<br></em>A couple of days later, we entered the <a href="http://myscript.devpost.com/">MyScript App Challenge</a>.</p><h4>Challenge #2</h4><p>It had a 10-day deadline, with a challenge to create a unique app using a sponsored handwriting API. The promo video scared us, since it covered most of the ideas that first came to mind regarding handwriting (driving helper app, field workers’ assistant app, kids handwriting game…)</p><p>My wife, professor by vocation, came up with the spelling idea. Half an hour of exploring later, I learned that app stores were full of spelling apps, but none of them seemed to have handwriting as an input. That struck us by surprise and we saw our chance.</p><p>So, teamed up with <a href="https://medium.com/u/f3f7520746e1">Branko Sedlar</a> again, we made <a href="http://www.spellscript.xyz/">Spell Script</a>, a quick mashup of text-to-speech API and a handwriting API, in five languages. Branko even fulfilled his childhood dream of coding on Ruby on Rails.<br>After the first proof of concept, we found out that it could get very addictive.<br>We’ve spread the word through social networks and had <a href="http://www.spellscript.xyz/hi-scores">players</a> from 30+ countries in under a week!<br>That won us the <a href="http://myscript.com/news/app-challenge-winners/">Public Choice award</a>. We couldn’t believe it!</p><h4>Taking a Break</h4><p>Aside from these two challenges, in the past two months I’ve been working 8–4 on my regular day job, attended two 5-day IT conferences and when they announced us as winners for the second time…<br>I felt relieved. I finally got some sleep, hung out with a couple of friends and took a day off.</p><p>These past month has been very exciting and I’ll definitely try to participate in more challenges like these. Though, I will try to invest more time in them and, you know, <em>have a life</em> during the contest, instead of going on hyper-drive for 10 days straight.</p><p><em>See you soon in some upcoming hackathon submissions!</em></p><p>PS I’d love to hear your stories about pet projects, procrastination and similar. This is my first Medium post, so feel free to comment</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d68e811439f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>