<?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 Matei Șuică on Medium]]></title>
        <description><![CDATA[Stories by Matei Șuică on Medium]]></description>
        <link>https://medium.com/@mateisuica?source=rss-57f84f32a50c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*y8fqHoSDfy8VKNlt.JPG</url>
            <title>Stories by Matei Șuică on Medium</title>
            <link>https://medium.com/@mateisuica?source=rss-57f84f32a50c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 07:14:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mateisuica/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[The secret 3 rules to new year resolutions]]></title>
            <link>https://medium.com/@mateisuica/the-secret-3-rules-to-new-year-resolutions-e0a5ee9ecc9a?source=rss-57f84f32a50c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0a5ee9ecc9a</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[goals]]></category>
            <category><![CDATA[resolutions]]></category>
            <dc:creator><![CDATA[Matei Șuică]]></dc:creator>
            <pubDate>Wed, 17 Jan 2018 12:02:07 GMT</pubDate>
            <atom:updated>2018-01-17T12:02:07.374Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a short one because it’s actually the simplest thing to do. I think it’s funny how many resolutions are broken every year. I’ve managed to keep my resolutions every year since 1 January 2015. That’s 3 years in the row! Here’s how I do it. The main 3 rules are the following:</p><h4>It starts on the 1st of January.</h4><p>It does not matter if you spend your New Year’s Eve on an island, in China or on the moon. A promise is a promise and the resolution starts on day 1. 1st of January is an arbitrary day but it’s important to respect it.</p><h3>A mistake does not break the resolution.</h3><p>For example, if you want a meat-free year and you accidentally take a bite from a pie that contained meat before you realise it, that doesn’t break the resolution. As long as it’s a mistake and you don’t continue breaking the rules, that’s ok. There’s no reason to give up. Sure, you have to be extra careful but let’s not go crazy about it. One honest mistake does not ruin 365 hard-worked days.</p><h3>No cheating. No exceptions</h3><p>While a mistake or two can be ok, cheating is totally not ok. There is no exception, no one-time, no cheating at all. You start on the 1st of January and end on the 31st of December and there’s not a single moment that year when you break the promise. If you do it once, you will surely do it again and the resolution is broken.</p><p>Now, this is all you need to know and do. But there are also some other tips you could make use of:</p><ol><li><strong>Do it alone and do it silently</strong>. If anyone asks you or some explenation is needed, sure, tell them about the resolution. Otherwise, don’t post it on Facebook, don’t talk to everyone about it. This seems like a good way to fail.</li><li><strong>Commit to it</strong>. Place some bets if needed. Peer pressure is something very powerful.</li><li><strong>Do count</strong>. This is usually not recommended but I found it very motivating once your number is big enough to be proud. I wouldn’t reset my “days since I quit smoking” for nothing in the world.</li><li><strong>Remind yourself why </strong>your doing it, every single day. It helps you keep focus on why your goal is important.</li></ol><p>Once your challenge is done, you need to decide if you want to go further with it. Some decisions are easy: after the first year without cigarettes most people would decide to continue. Some aren’t: after a year without alcohol, you might want to have a glass of wine from time to time.</p><p>You choose, but you’ll always know that if you need to, you can do it again!</p><h4>This year’s resolution?</h4><p>For me, it’s filling the Apple Watch rings every day. This means standing up, moving and exercising for at least 30 minutes. It’s not much but it should help me reach the other goal (not resolution) of stabilising my weight to 65kg (starting from 72,5 on the 3rd of January).</p><p>Up until now, it’s going great. Here’s my Activity result (note that there’s still half a day left on the 17th so I can still fill the rings) and my weight chart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ItgqcyzZPxDdBDVy5cLXrg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0XhfC8Pc1tq0bDdY6VZO6A.jpeg" /></figure><p>What’s yours?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0a5ee9ecc9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Weird Kotlin syntax]]></title>
            <link>https://medium.com/@mateisuica/weird-kotlin-syntax-aa968b01a863?source=rss-57f84f32a50c------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa968b01a863</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Matei Șuică]]></dc:creator>
            <pubDate>Fri, 06 Oct 2017 06:12:37 GMT</pubDate>
            <atom:updated>2017-10-06T06:12:37.372Z</atom:updated>
            <content:encoded><![CDATA[<h4>Starting a new Activity</h4><p>I started learning Kotlin by starting a new app using exclusively Kotlin and Android Studio 3.0 Beta, like a real man (developer). The first “wtf?” was after I finished the first screen. How the hell do I get to the next Activity? In Java I would:</p><pre>Intent intent = new Intent(<strong>this</strong>, <strong>NextActivity.class</strong>)<br>startActivity(intent)</pre><p>Great, I can translate that to Kotlin, except for the NextActivity.class … Now hold tight. That’s:</p><pre><strong>val </strong>intent = Intent(<strong>this</strong>, <strong>NextActivity</strong>::<strong>class</strong>.<em>java</em>)<br>startActivity(intent)</pre><p>OMG that looks like C++ in the good days or the C# namespace operator. Or the Ruby top level constants. It does <strong>not </strong>look like something that would reference a Java class. Oh well, it is what it is.</p><h4>Getting the outer scope object reference</h4><p>The what from who? If you need to get <strong>this</strong> from an inner closure, anonymous class implementation, inner class, whaterver. You know, like when you make a network and in the callback you want to do something with the Context…</p><p>Let’s say we’re in the MainActivity and we make a call (Java):</p><pre>networkService.fetchEvents(new Callback&lt;List&lt;Event&gt;() {</pre><pre><strong>void</strong> onSuccess(List&lt;Event&gt; events) {<br>   Toast.makeText(<strong>MainActivity.this</strong>, &quot;Events fetched&quot;, Toast.LENGHT_LONG).show();<br>   }<br>}</pre><p>How do you get <strong>this </strong>in a Kotlin lambda? Simple but weird, it’s:</p><pre><strong>fun </strong>onSuccess(events: List&lt;Event&gt;) {<br>    Toast.makeText(<strong>this</strong>@<strong>MainActivity</strong>, <strong>&quot;Events fetched&quot;</strong>, Toast.<em>LENGTH_LONG</em>).show();<br>}</pre><p>I just hope I don’t send an email everytime I type that… I’m not very used to typing @ in code. I heard that Objective-C loved @ but I skipped that weird language.</p><p>Since we’re at the obscure inner blocks topic, Kotlin, we should talk about it</p><h4>Lambdas in Kotlin</h4><p>I was left behind with this lambda stuff because Android used the antique Java version that did not have them so I used to anonymously implement interfaces. Like when you add a click listener and you implement the appropriate interface on the spot. That’s pretty clear sintax: it’s all in front of you (Java).</p><pre>tryAgain.setOnClickListener(<strong>new </strong>View.OnClickListener() {<br>    @Override<br>    <strong>public void </strong>onClick(View view) {<br>        checkLicense();<br>    }<br>});</pre><p>Great, now comes Kotlin. Because OnClickListener only has a methon, you could:</p><pre>tryAgain.setOnClickListener({<br>        checkLicense();<br>});</pre><p>What?! Where did everything go? Where’s my <strong>view parameter</strong>, what if I need it? Well..</p><pre>tryAgain.setOnClickListener({<br>    view -&gt; <br>        checkLicense();<br>        view.setVisibility(GONE)<br>});</pre><p>You can also rename <strong>view</strong> to whatever suites you or skip it if you don’t need it. Great, that’s shorter but what if the method should return something, like a boolean?</p><pre><strong>interface </strong>RandomInterface {<br>    <strong>fun </strong>doSomething(): Boolean<br>}</pre><pre>tryAgain.setRandomInterface({<br>        doRandomStuff();<br>        true<br>});</pre><p>Dafuq? No return? Neah… You could put it but if it’s at the end you can also not write it. Confusing? A lot!</p><p>Good but what if the interface has more than one method? Well then you need to implement it and instantiate it with a special object named … <strong>object. </strong>Really, this is a keyword in this language. It looks like you are passing an argument but actually you can’t change that, it’s <strong>object</strong> and nothing else</p><p>Let’s say we have (Java):</p><pre><strong>public interface </strong>FunctionToggler {<br>    <strong>void </strong>showFunction(<strong>boolean </strong>isVisible);<br>    <strong>boolean </strong>setDestination(<strong>int </strong>id);<br>}</pre><p>And we want to set this using (also in Java):</p><pre>void setFunctionToggler(boolean someParam, FunctionToggler functionToggler);</pre><p>Let’s see how Kotlin does this:</p><pre>someObject.setFunctionToggler(true, <strong>object</strong>: FunctionToggler() {<br>    override fun showFunction(isVisible: Boolean) {<br>         //..do stuff<br>    }<br>    overrider fun setDestination(id: Int): Boolean {<br>         //do other stuff<br>         return true<br>    }<br>}</pre><p>Totally different from the previous thing. Behind the scenes, this is still an implementation on the spot but it’s more verbose because the interface has more than one function. This is clear for me but the other one…? And what’s with this “object”?</p><p>Hope I’ve confused you enough to start digging into Kotlin’s syntax because I got to love it really quickly. I don’t care what magic it does, it’s easy to use and it makes my development speed 1.3x !*</p><p>*development speed measured by the number of “WTFs / minute”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa968b01a863" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android ProTip #1]]></title>
            <link>https://medium.com/@mateisuica/android-protip-1-df114301cd33?source=rss-57f84f32a50c------2</link>
            <guid isPermaLink="false">https://medium.com/p/df114301cd33</guid>
            <category><![CDATA[advice]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Matei Șuică]]></dc:creator>
            <pubDate>Tue, 03 Oct 2017 10:54:54 GMT</pubDate>
            <atom:updated>2017-10-03T10:54:54.777Z</atom:updated>
            <content:encoded><![CDATA[<p>Never name a variable “color” because when you’ll try to rename it, Android Studio will try to change the &lt;color&gt; attribute too. If you are paying enough attention, you might catch it in time. But if you are renaming 100 variables or occurrences, you’ll probably just pres “Do refactor” and see the world collide.</p><p>Also, this applies to “shape”, “string, “stroke” or whatever other xml keyword or tag you might think of. Try naming the variables better than this the first time. Then you can easily rename and improve later.</p><p>Since “learning by doing” is my motto I already got screwed because of this so I would advise you to avoid it. At least Android Studio 3.0 Beta does this but even if this gets fixed, as a developer I have to ask: “Why did I ever name a variable &lt;&lt;color&gt;&gt;? What Color? Who Color?”…</p><p>Just don’t.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df114301cd33" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Software developers lack discipline]]></title>
            <link>https://medium.com/@mateisuica/software-developers-lack-discipline-c29a3c1354d4?source=rss-57f84f32a50c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c29a3c1354d4</guid>
            <category><![CDATA[students]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[management]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Matei Șuică]]></dc:creator>
            <pubDate>Sun, 01 Oct 2017 22:27:31 GMT</pubDate>
            <atom:updated>2017-10-01T22:27:31.929Z</atom:updated>
            <content:encoded><![CDATA[<p>Here’s the thing: our country has great (and free) universities that train great Software developer. Even though the courses seem old or the technologies are not the latest, the theoretical base that our universities puts into our young generations is solid. We have data structures and algorithms classes, we study artificial intelligence, we analyse the complexity of our work and how to optimise it. Theoretically, it’s top quality. But somehow, I meet students in interviews and they disappoint me year after year. How’s that happening?</p><h4>The “focus vs sturcture” problem</h4><p>It seems that people have now more and more focus problems. Focus is directly linked to how tidy and well organized you are. Well structured things seem tidier and are easier to understand, follow, recall. In the case of students, I discovered that even though the knowledge is there, but they can’t focus well enough to find it. If I “dig into their knowledge box” or I guide them through how to find it, it’s there. And the problem is a chicken and egg problem: can’t focus because of the lack of structure, can’t build structure without focusing.</p><p>Have you ever walked into a messy room and couldn’t find one big object that was just in front of you because you were distracted by all the mess? Yes, that’s what’s happening now. But this lack of focus and structure is actually not the root cause.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*UZLj4yUiEPOE01ZJgqLrlw.jpeg" /></figure><h4>The discipline</h4><p>We start our lives having someone that tries to teach us discipline in some way. We have the parents, the teacher, the employers, God and so on. But discipline is part of ones character, it’s inside. Either it is there or it is not, you can’t simulate discipline from time to time.</p><p>Loosing focus so easily seems to be related to discipline. Making a mess out of your life is mostly to the lack of discipline. Breaking rules from time to time results in a catastrophe when the problems pile up. For example, when building and airplane, one screw can be missing but if the entire line of production would miss a piece, the plane will fall. That’s lack of discipline that could go very wrong, so we double check it with QA.</p><p>Software developer lack discipline big time! What does that mean?</p><p>Software developers are rock stars these days because there’s a lot of software to be done. The demand is far greater than the job market has to offer. We discovered the power of software and everyone has something to build. This means that developers can push it and they do. Here’s some harmful ways they do it.</p><h4>1. Office hours flexibility</h4><p>Most companies have a policy that the working hours are flexible in a way. But that doesn’t mean you should come whenever you like! Talk to the team about the schedule and stick with some agreed hour! It’s flexible because you have a say in it, it’s not flexible so you can decide by your self and screw the whole team or project.</p><h4>2. Breaks</h4><p>Breaks are part of the whole working thing. Breaks can make you productive and release physical or psychical stress. Breaks are good for you but don’t abuse! Taking a break longer then 10 minutes or more often than once an hour, might turn you intro being an A.H. People are paying you to focus on work and deliver.</p><h4>3. (Not) Continuous learning</h4><p>People tend to think that once the studies are over and they gratuated, the learning stops. Or at least they can pause learning for a while. The truth is that at today’s rate of change in the software industry, you need to learn every single day to try to keep up. You will still be left behind in some aspects but you might do a decent job. But you need to learn every day for at least an hour or so. When you lack the discipline of learning and you watch cat-videos instead, you sentence yourself to becoming a poor professional really fast.</p><h4>4. Physical condition</h4><p>I’ve seen this one so many times I am actually amazed it is still not tackled by employers in any way: people come to the office unfit for work. And this has 2 forms that are <strong>bad</strong> and <strong>very bad</strong>.</p><p>The first one is coming to work when you are feeling bad or you are ill. You are probably doing nobody any good, your work will be poor and you are just cheating everyone that you’ve worked instead of taking the day off. And you might also make other people sick.</p><p>The worst variant to this is coming to the office with a hangover (or sleep deprived, or both). This is very disrespectful and it shows off your lack of discipline: you don’t know when to stop drinking, how to get enough rest and what’s the limit between having fun and working.</p><p>I would <strong>instantly fire</strong> someone coming in with a hangover. You have been warned.</p><h4>5. Internet junk — notification trigger</h4><p>People get distracted really easy with notifications. Getting a link on a channel can make developers randomly browsing for minutes or hours, completely useless. Showing a little discipline would mean postponing opening links until a certain point in the day when you open them all, satisfy your curiosity, answer to the random person that sent the link and get back to work. Even more discipline would mean opening them after work. It’s a job, not an entertainment activity. Keep personal stuff at home and professional stuff in the office. But most of the people do none of the above and get distracted.</p><h4>6. Disrespecting the procedures</h4><p>This sound very corporate like but actually every team needs some rules in order to work well. It’s like a gear set, in order to get sync, every step needs to be aligned. This is achieved by rules and processes. You might call them whatever you like and change them as often as you like. But once there’s a set of rules, everyone must follow them and it is completely unacceptable to break the rules.</p><p>Please, let me repeat that: <strong>you can change</strong> the rule but <strong>you can never break</strong> the rule.</p><h4>7. Romance at work</h4><p>It’s human nature to fall in love. Nobody can stop you and nobody wants to. But any personal relationship between co-workers must be as discreet as possible. It is deeply harmful to transform a workplace in some kind of Tinder arena. Just don’t bring drama to the office. This will distract you and others from work, start gossiping, create sides and so on.</p><p>This list is far from exhaustive but it can offer a good start to developer that want to improve their level of professionalism. Try not to do the things listed above and you will be fine. Then, push harder and force yourself into learning more and becoming the best!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c29a3c1354d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kotlin for Android development — coming from Swift]]></title>
            <link>https://medium.com/@mateisuica/kotlin-for-android-development-coming-from-swift-32dfd2a9e22c?source=rss-57f84f32a50c------2</link>
            <guid isPermaLink="false">https://medium.com/p/32dfd2a9e22c</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Matei Șuică]]></dc:creator>
            <pubDate>Wed, 20 Sep 2017 04:11:52 GMT</pubDate>
            <atom:updated>2017-09-20T04:11:52.663Z</atom:updated>
            <content:encoded><![CDATA[<p>Yesterday I decided that since Kotlin is now a “<em>first class citizen</em>” language for the Android platform and I’m an Android developer that still has juice for at least 10 years (hoping for 40 though but not necessarily Android👵), I should definitely start learning.</p><p>A little background so you can try to see it from my perspective: I am a senior Android developer with Java background. I also slowly started learning Swift when it launched but since I’m not a full time iOS developer, I am still a beginner there. How is this relevant?</p><ol><li><strong>Swift and Kotlin are very similar</strong><a href="https://emojipedia.org/woman-with-bunny-ears/">👯</a><strong>!</strong> I actually think that almost all modern programming languages look alike. A lot of type safety with Optionals, some Extensions mechanism, do more with less code because of a lot of magic, either in the core libraries or in the compiler.</li><li><strong>Constructors confuse me</strong>🤦‍♂️. Primary constructor has some parameters but you can’t have class members that have the same name because of reasons. But if you need the parameters (I hope you need them, otherwise remove them), you can’t just call them in some function unless you reassigned them to member variables. Maybe I’m just confused. But there’s more! There’s an<strong> init { }</strong> block which seems to do stuff for the primary constructor because the constructor cannot contain any code. It’s part of the class definition!!! And there are “<em>secondary</em>” constructors too💥💥.</li><li>Couldn’t get to write a block where I get the unwrapped value of an optional🤦‍♂️🤦‍♂️🤦‍♂️: let’s say I have a <strong>User?</strong> object “<em>bob</em>”. Now, I know that “<em>bob</em>” is not null but for the sake of Kotlin I need to be sure. I can use “?” like this: <em>bob?.name</em>… But if I need to use “<em>bob</em>” in a huge code block that needs all of the User’s properties, how do I do it so I won’t need to spam my code with question marks? No clue, yet. In Swift, this is a <strong>if-let block</strong>, in Kotlin, maybe tomorrow I’ll find out. See the Gist below for better understanding of the problem:</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a716fe3889bb94e88415a4cce8445941/href">https://medium.com/media/a716fe3889bb94e88415a4cce8445941/href</a></iframe><p>I think learning Kotlin is pretty easy and all Android <strong>developers should adopt it</strong>. You can use it with Android Studio 3.0 which is in Beta but pretty stable. There are lots of apps that are already in production with Kotlin code (<a href="https://m.signalvnoise.com/how-we-made-basecamp-3s-android-app-100-kotlin-35e4e1c0ef12">Basecamp</a> is an example). There’s a lot of effort to make the tools fully support it even though I didn’t encounter any trouble yet.</p><p>The best thing about Kotlin in Android development is that you can start small, with Kotlin classes along with Java classes. (Just like Swift classes can work with Objective C!). This could help everyone in your team adopt it. Start with “<em>data classes</em>”. Those horrible Java beans that have no meaning in life but to make you maintain getters and setters.</p><p><em>data class User(name: String, surname: String, age: Int)</em></p><p>DONE. That one line of code is the whole thing.</p><p>Then add some utility classes: the type where you have a million null-checks that you need to do in order to make sure everything is fine. Write them in Kotlin and show the world that:</p><ol><li>it’s easier <a href="https://emojipedia.org/clapping-hands-sign/">👏</a></li><li>it’s more readable <a href="https://emojipedia.org/clapping-hands-sign/">👏</a></li><li>it’s more robust <a href="https://emojipedia.org/clapping-hands-sign/">👏</a></li></ol><p>The last step is to never create a new Java class again. At some point, your projects will become more and more Kotlin and less Java. You can track this by the total number of LOC 📉, total number of bugs 📉, total number of delivered features 📈 or any other metric that you like.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32dfd2a9e22c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[(Android) Article classifier in Python]]></title>
            <link>https://medium.com/@mateisuica/android-article-classifier-in-python-559e9a08e451?source=rss-57f84f32a50c------2</link>
            <guid isPermaLink="false">https://medium.com/p/559e9a08e451</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[scikit-learn]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Matei Șuică]]></dc:creator>
            <pubDate>Mon, 11 Sep 2017 19:21:08 GMT</pubDate>
            <atom:updated>2017-09-11T19:21:08.826Z</atom:updated>
            <content:encoded><![CDATA[<h4>For the soon to start newsletter</h4><h4>How did I get to this?</h4><p>Machine learning is the thing right now, up there with Augmented Reality, Virtual Reality and cryptocurencies. I can’t stay out of it! I wanted to make something small to get me going and hype my interest in the field. I can’t stand coding without purpose so I invented one: a tool that would make me check very fast if a link is an Android resource or (spam) not.</p><h4>The usecase</h4><p>You get a random link from whoever, you paste it in the Python script and then the script will answer 1, if it’s about Android or 0 otherwise. Pretty simple, right? Of course I might develop this into some other product with <strong>CoreML</strong> or <strong>Tensor Flow</strong> but for now, it’s an “<em>internal</em>” tool.</p><p>Note 1: know your tools. I will NOT tell you how to install <a href="https://www.python.org/">Python</a>, <a href="http://scikit-learn.org/stable/index.html">SKLearn</a> or <a href="https://www.crummy.com/software/BeautifulSoup/bs4/doc/">BeautifulSoup</a>. You handle that and come back when you did.</p><p>Note 2: I have almost zero knowledge about Neural Networks for now so I can’t explain the theory behind Multinomial <a href="https://en.wikipedia.org/wiki/Naive_Bayes_classifier">Naive Bayes</a>. The purpose was to help me understand what it does and see it’s power.</p><h4>How does it work?</h4><ol><li>You need a CSV file with links to resources about Android (or something else) and resources that are not about the same topic</li><li>Write a Python function that opens that CSV file and reads row by row the links and loads them</li><li>Request the webpage and use BeautifulSoup to easily extract the text and links.</li><li>Create a “<em>bag of word</em>s” for each resource (article) and then normalise it.</li></ol><p>5. Train the Naive Bayes classifier with the data</p><p>Let’s dig right into writing stuff, following the steps above:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8f72f26105c8d5f46525b642f14b6cc/href">https://medium.com/media/a8f72f26105c8d5f46525b642f14b6cc/href</a></iframe><p>Here are 10 links that I’ve classified for you. In order to get good accuracy for the classifier you should add some more links. Diversity is the key here. For each link, you will add 1 if it’s an Android tutorial or 0 otherwise.</p><p>Save these links in a CSV file, let’s call it “<em>data.csv</em>”.</p><p>Open a text editor line <a href="https://atom.io/">Atom</a> or <a href="https://www.sublimetext.com/">Sublime</a> (something that heard of Python for highlighting the syntax). Start a new file and save it in the same folder as your “<em>data.csv</em>”.</p><p>Here’s the function that will open “<em>data.csv</em>”, read it and save the links in a variable:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7857ad0ae154257de03552c45b601ddd/href">https://medium.com/media/7857ad0ae154257de03552c45b601ddd/href</a></iframe><p>Then, we need a function to actually load the content of each link:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/803dd5995a5a154b0d7c8454c0e3c93a/href">https://medium.com/media/803dd5995a5a154b0d7c8454c0e3c93a/href</a></iframe><p>The ‘<em>hdr</em>’ are headers that are sent to the webserver so it will think we are using a legitimate browser.</p><p>And then we need to parse the HTML and extract the text from it. We consider ‘<em>text</em>’ anything that is in <em>H1-H5 tags, &lt;p&gt; and &lt;a&gt;</em>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/19f5b3e3bc060f85dac955d07166b5b1/href">https://medium.com/media/19f5b3e3bc060f85dac955d07166b5b1/href</a></iframe><p>The ‘main’ function of this script will loop through the links we extracted from the CSV, load the webpage content and parse it. Then it will add everything to a ‘<em>final_data</em>’ array. This is where all the input data is.</p><p>We will also create a ‘<em>target</em>’ array that will contain the label of each link (zero or one):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4fc39738bac26f006e8d5874bc251ade/href">https://medium.com/media/4fc39738bac26f006e8d5874bc251ade/href</a></iframe><p>Now the ‘<strong><em>intelligent</em></strong>’ part of everything. First of all we need to put our input data in order. For each article we will create a ‘<a href="https://en.wikipedia.org/wiki/Bag-of-words_model"><em>bag of words</em></a>’, meaning that we will count each word appearance in the article. Then we will normalise this data: we divide the number of appearances to the number of total words. This way, longer articles won’t always be in advantage. Then we feed the “<em>learning monster</em>”.</p><p>This is very easily created with a <a href="http://scikit-learn.org/stable/modules/generated/sklearn.pipeline.Pipeline.html">SKLearn Pipeline</a>. It has all the components we need to create our “<em>bag of words</em>” and feed it directly to training in a couple of lines of code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ace0d34c6c470adff041ec208dc9b7b/href">https://medium.com/media/8ace0d34c6c470adff041ec208dc9b7b/href</a></iframe><p>Great! Now “<em>text_clf</em>” is ready to make some predictions. To do this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2aed193ab81e3a4da8c9b712fc323014/href">https://medium.com/media/2aed193ab81e3a4da8c9b712fc323014/href</a></iframe><p>My answer was ironically “<em>zero</em>”. So it means that <a href="http://www.mateisuica.com/"><strong>my personal website</strong></a> is not about Android. Might be, check it out! But this answer will depend on your training data set. The more classified links you provide to your algorithm, the better classification you will get.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=559e9a08e451" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Locale in a server call from Android]]></title>
            <link>https://medium.com/@mateisuica/using-locale-in-a-server-call-from-android-ac3c23822c90?source=rss-57f84f32a50c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac3c23822c90</guid>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[bugs]]></category>
            <dc:creator><![CDATA[Matei Șuică]]></dc:creator>
            <pubDate>Fri, 13 May 2016 13:46:14 GMT</pubDate>
            <atom:updated>2016-05-13T13:46:14.217Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve almost been bitten by the poisonous cocktail of copy/paste, Android Studio warnings and little knowledge in a particular area of the platform. The good news is that I’ve found the bug before it went into production. The bad news is that I’ve found it randomly with a tone of luck. Here’s how.</p><p>I usually develop on a tablet that is set up to English language, locale, region, time, etc. It all went fine for weeks and the App was reaching new and new levels of stability. It was rock solid! One day, I create a release build of the same App and I install it on another device because installing it on the same device would have meant different signatures, uninstall, install, etc. I didn’t want my development device to be disturbed with release version.</p><p>I start the App on the phone and I start testing the happy paths. Go there, do that, all good. But when I try to go in the new functionality area, nothing would work, why?! Is it the <strong>release build</strong> that is broken? I install the same App on the development tablet and it all works. What the… ?</p><p>Here’s what’s happened: the App was getting the location of the device and then it would do a GET request to the server, using that location. The link below is fake but you’ll get the idea.</p><pre><a href="http://www.gmsoftware.ro/cars?latitude=&lt;MY_LATITUDE&gt;">http://www.gmsoftware.ro/cars?latitude=&lt;MY_LATITUDE&gt;</a>&amp;longitude=&lt;LONGITUDE&gt;</pre><p>The &lt;&gt; variables were replaced with two floats, let’s say: <em>46.7740555 and 23.6340334</em>. The idea is great and the implementation seem to work, at least on the development device.</p><pre><a href="http://www.gmsoftware.ro/cars?latitude=%3CMY_LATITUDE%3E">http://www.gmsoftware.ro/cars?latitude=</a>46.7740555&amp;longitude=23.6340334</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*lHKL5oSr-SBI_MbWfsISJg.png" /></figure><p>But what’s wrong with the other one? Let’s debug. I’ve added a break point and checked out the link:</p><pre><a href="http://www.gmsoftware.ro/cars?latitude=%3CMY_LATITUDE%3E">http://www.gmsoftware.ro/cars?latitude=</a>46,7740555&amp;longitude=23,6340334</pre><p>What? Look closer! The decimal separator has changed from “.” to “,”. In the “Romanian (Romania)” (ro-RO) locale is “,” and that <strong>broke my request</strong>. Digging into the code I’ve found out how that happened. My code was creating the request URL dynamically using a String.format().</p><pre>String url = String.format(Locale.getDefault(), <a href="http://www.gmsoftware.ro/cars?latitude=%3CMY_LATITUDE%3E">http://www.gmsoftware.ro/cars?latitude=</a>%f&amp;longitude=%f, latitude, longitude);</pre><p>Having <em>Locale.getDefault()</em> change from device to device meant that the format of the request would change. This is very very bad! The fix was simple once the problem was found: use a defined locale that you know what it means and does. For me, I’ve used <strong>Locale.US</strong>. Whatever that Locale is, be careful to test it and never change it without testing again.</p><p>A small advice before launching apps: test it thoroughly on many devices with many configurations because when it goes live, the users won’t have mercy if it wastes their time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac3c23822c90" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[People that support you]]></title>
            <link>https://medium.com/@mateisuica/people-that-support-you-810fa5559ee3?source=rss-57f84f32a50c------2</link>
            <guid isPermaLink="false">https://medium.com/p/810fa5559ee3</guid>
            <category><![CDATA[decision-making]]></category>
            <category><![CDATA[change]]></category>
            <category><![CDATA[life]]></category>
            <dc:creator><![CDATA[Matei Șuică]]></dc:creator>
            <pubDate>Tue, 10 May 2016 08:21:13 GMT</pubDate>
            <atom:updated>2016-05-10T08:21:13.804Z</atom:updated>
            <content:encoded><![CDATA[<p>There are certain moments in your life that you need to make some decisions that greatly affect yourself. There are also moments when your decisions have an impact upon others. Either “others” means your loved ones or just people close to you, those are the moments when the people that support you come out of the crowd.</p><p>I’ve found out that taking risks and making life-changing decisions has helped me a lot in the last 5 years. Thinking behind, 5 years ago, I probably had a whole other line-up that I would call my friends, my girlfriend, my colleagues, my mentors, my connections, my partners etc. Even the “family” has changed, as some of my relatives faded out and others got closer to me. We’re still a family but the strength of the relationship changes. It is a little bit sad but people change and we need to sync our inner expectations with our outer manifestations.</p><p>The people that stayed in my life are the ones that have endured with me the result of my decisions. Maybe they haven’t agreed with me from time to time but they have never let me down for that reason. And they truly believe in me because I haven’t let them down either. I’ve fulfilled my promises and met their expectations of me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wT0py1lm6CbkqHivg2CdpA.jpeg" /></figure><p>The secret to getting the support of other great people is this: be happy with what you are! Show them that you really enjoy the things you do, the experiences you have, the outcome of your work. Be genuinely happy with your life. And if you feel you are not, change it! Disrupt your destiny. Get rid of something, because there’s surely something that’s keeping you unhappy. Make a change.</p><p>For me, the clock is ticking and another change is coming. I think I’m now addicted to constant change, I cannot stop anymore. Hope that my next post will have a sunny picture in it so you will know I’m not in Cluj anymore…</p><p>What’s your next move?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=810fa5559ee3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Entrepreneurship is like riding the motorcycle]]></title>
            <link>https://medium.com/@mateisuica/entrepreneurship-is-like-riding-the-motorcycle-b44aa192cc08?source=rss-57f84f32a50c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b44aa192cc08</guid>
            <category><![CDATA[motorcycle]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[risk-management]]></category>
            <dc:creator><![CDATA[Matei Șuică]]></dc:creator>
            <pubDate>Mon, 25 Apr 2016 06:33:25 GMT</pubDate>
            <atom:updated>2016-04-25T06:33:25.950Z</atom:updated>
            <content:encoded><![CDATA[<p>This morning I had a revelation while the idiotic Volkswagen Polo driver behind me was horning me wildly. I was on the motorcycle, the next person to enter the crossing and I was waiting for the right moment. It took almost one minute and 50 seconds I was horned by that guy.</p><p>I’ve been a motorcycle driver for 3 years now and an entrepreneur for 3 months. I am now starting to see some similarities between the two. Maybe it is too early but here’s what I’ve found.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RGTvTHw135fLlXxMfbqGTw.jpeg" /></figure><p>I’ve decided to ride the motorcycle because I love the thrill. It is undoubtedly one of the things that most people would like to do but it scares the bejesus out of them. It is not even that hard to learn. I was so scared before I started the driving school. I though I would get hurt while learning. I didn’t. After 3–4 sessions I was already comfortable with the new skill.</p><p>I won’t be hypocrite about it: I also wanted to be cool. It is a general perception that riders are cool, probably an image fueled by the Holywood film industry, music industry and so on. Long bearded, full of muscles, badass riders like Sons of Anarchy and the guys from ZZ Top: I wanted that! Or at least something like that.</p><p>There’s something else about riding the motorcycle: it teaches you how to take risks. On the motorcycle (or bike) you are very vulnerable. Everything else in the traffic is better protected than you are. You are right there with your life on the line and one wrong move can get you crippled or dead. It takes some risk tolerance but the good news is that you get used to it really fast.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zT2I1k-mxtPLfd_2ddphtQ.jpeg" /></figure><p>But in the end, there is something special about being on two wheels in traffic. You can always slalom and get faster to your goals. And it is very interesting how you only get to take one person with you. A person that you trust, a person that you care about. Regardless of the position you have, you are in the same deep sh*t as the other one and you get in the same place as she or him does. You must choose wisely your party!</p><p>Are you starting to see this? Something that most people are afraid to do but want to. Something that makes you a little cooler than the others even before you hit the top. Something that is risky as hell but it rewards you by reaching your goals faster? Making life or death decisions at every corner, having a single soul that is in the same deep sh*t as you are…</p><p>All there facts seem very familiar to me as I come across them in my entrepreneurial journey. But there’s one experience I had on the motorcycle that has yet to appear in my company: falling. I can’t wait for it to happen because that’s the moment when you realize who you’re dealing with. It is the crisis moment when trust and character come first; when every card is on the table, a moment of naked truth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*WtpbUf3AYGfcVfIvohbCKA.jpeg" /></figure><p>PS: there’s also a similarity in the communities, riders respect, salute and help each other. Is that what entrepreneurs also do, right?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b44aa192cc08" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Paying myself (first)]]></title>
            <link>https://medium.com/@mateisuica/paying-myself-first-6b9364aae77a?source=rss-57f84f32a50c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b9364aae77a</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Matei Șuică]]></dc:creator>
            <pubDate>Wed, 20 Apr 2016 18:47:57 GMT</pubDate>
            <atom:updated>2016-04-20T18:47:57.729Z</atom:updated>
            <content:encoded><![CDATA[<p>It is so cool to think entrepreneurial these days that I couldn’t help myself and I’ve started my own company to get into this game. Actually it’s half a company since I have a great co-founder that also has 50%. Now I feel special, I feel like working 16 hours a day, I feel like I don’t need money because I work out of passion and I cannot wait to go raise some money: A rounds, B rounds, OMG my <em>pitch </em>is great! I’ll be changing the world in no time. I know what <em>traction </em>is, I’m building <em>momentum</em>, I have my own <em>reality distortion field</em> but I have the <em>burn rate</em> under control.</p><p>Or maybe not. I’ve started a company but I’m not a lunatic: <strong>I still need money to live</strong>. And if my company cannot offer me a decent salary, maybe I should let others make money with my work and get paid as I was up until now. I got into the business because I feel that I can make things better than others or at least I want to try it. I think most companies these days forgot that <em>people are the company</em>. I see it stated as a <em>company core value</em> very often but I don’t see it in the eyes of those there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*Wz1grsfOQfLq5BZx4XuVJg.jpeg" /></figure><p>So this is my KPI: if I work the same amount but <strong>earn less</strong> =&gt; go back to being an <strong>employee</strong>. If the people I will hire will generally be <strong>unhappy</strong> or earn less than the industry average, the company <strong>should cease to exist</strong>. I ain’t building a <em>torture camp</em> here.</p><p>I’ll be the first experiment of myself. I’ll wear multiple hats in <a href="http://gmsoftware.ro/">GM Software</a> and I’ll try to do my best in every role. But here’s the trick I’ll try: the company will need to <strong>respect and reward</strong> me as it would with anyone else. I don’t accept “<em>I owe you</em>”s, delays in paychecks or wage cuts. And if the company fails because of this, it had no future anyway.</p><p>So starting May, I’ll pay myself a salary. I’ll start <strong>very low</strong> but hope to climb up the ladder. Isn’t that what every company promises? I’ve promised myself a raise at the annual appraisal but I’ll need to surpass my own expectations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b9364aae77a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>