<?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 Giuseppe Giacoppo on Medium]]></title>
        <description><![CDATA[Stories by Giuseppe Giacoppo on Medium]]></description>
        <link>https://medium.com/@giuseppegiacoppo?source=rss-2f74518fcbb2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*GKY6woFvwxwyXCFNgIfs_A.jpeg</url>
            <title>Stories by Giuseppe Giacoppo on Medium</title>
            <link>https://medium.com/@giuseppegiacoppo?source=rss-2f74518fcbb2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 09:07:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@giuseppegiacoppo/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[Android Tips | Advanced Shapes for your Drawables]]></title>
            <link>https://levelup.gitconnected.com/android-tips-advanced-shapes-for-your-drawables-5a7186e68fd?source=rss-2f74518fcbb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a7186e68fd</guid>
            <category><![CDATA[android-ui]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[material-design]]></category>
            <category><![CDATA[user-interface]]></category>
            <dc:creator><![CDATA[Giuseppe Giacoppo]]></dc:creator>
            <pubDate>Wed, 30 Mar 2022 22:42:26 GMT</pubDate>
            <atom:updated>2022-04-01T13:25:02.590Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HM3TTsV7sa1Rjqb8" /><figcaption><a href="https://material.io/design/shape/about-shape.html">https://material.io/design/shape/about-shape.html</a></figcaption></figure><p>Material Design is a very popular design system and it is well-known in the Android world.</p><blockquote>Material Design is inspired by the physical world and its textures, including how they reflect light and cast shadows. Material surfaces reimagine the mediums of paper and ink.</blockquote><p>After its first release in 2014, it was constantly updated with modern and fresh guidelines. To help Android developers to build appealing UI, Google Engineers released a very popular set of components called <a href="https://github.com/material-components/material-components-android">Material Components for Android</a></p><h3>Shapes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yb6hzVzcwuXSVpkn" /><figcaption><a href="https://material.io/design/shape/about-shape.html#shaping-material">https://material.io/design/shape/about-shape.html#shaping-material</a></figcaption></figure><p>A common design pattern is to include the content in a container. It can be a Card or any other layout with a colored background.<br>Android applications often use the popular CardView component for this purpose, and others have bitmaps, 9-patches, vectors and many more types of graphic elements.</p><blockquote>In the physical world, objects can be stacked or attached to one another, but cannot pass through each other. They cast shadows and reflect light. (<a href="https://material.io/design/environment/surfaces.html#material-environment">source</a>)</blockquote><p>All these solutions work great until you start working with elevation and z-translations because Android is not able to automatically draw the shadow that follows your custom shape. <br>For this reason I’d like to show you new classes that can help you create your unique shapes and let the system generate the shadow accordingly.</p><h3><em>MaterialShapeDrawable and </em>ShapeAppearanceModel 🎉</h3><p>MaterialShapeDrawable is a specific Drawable that handles shadows, elevation, scale and color for a generated path.</p><p>The path is defined in the ShapeAppearanceModel, which allows you to define the appearance of all the corners and edges of your shape.</p><p>The edge’s path is drawn by the EdgeTreatment class</p><h3>Let’s create a shape 💻</h3><p>In this example we will create a shape that represents a ticket:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*D87nkVSLNFHe_qLT6Ttiwg.png" /></figure><p>First of all you need to configure your project. Just add the material components dependency</p><pre>dependencies {<br>    // ...<br>    implementation &#39;com.google.android.material:material:&lt;version&gt;&#39;<br>    // ...<br>  }</pre><p>Now it’s time to create a new class which will draw the typical ticket shape.<br>For doing this we will extend the EdgeTreatment class and draw an inner arc</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6639808c0e5892eaa1bd8d49e3121b00/href">https://medium.com/media/6639808c0e5892eaa1bd8d49e3121b00/href</a></iframe><p>As you can see the shapePath object has methods for drawing lines and curves. Once we have the EdgeTreatment, we can create the ShapeAppearanceModel customizing left and right edges</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7dcbb68faa444f9822dda86809e92ee5/href">https://medium.com/media/7dcbb68faa444f9822dda86809e92ee5/href</a></iframe><p>You can now apply this drawable programmatically. An additional step which I suggest is to make it available also for xml layouts</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f1991289c2d6c7ad2e9ad67c99689d10/href">https://medium.com/media/f1991289c2d6c7ad2e9ad67c99689d10/href</a></iframe><p>Now you can just set it in this way</p><pre><strong>...<br>android:background=&quot;@drawable/bg_ticket&quot;<br>...</strong></pre><p>Done! Your drawable is ready to be used along your application</p><p>Here more examples of what you could do</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Tv_Szb3cw1jlnwvSP5_rw.png" /></figure><p>See you in the next article and thanks for reading! 🙌</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a7186e68fd" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/android-tips-advanced-shapes-for-your-drawables-5a7186e68fd">Android Tips 💡| Advanced Shapes for your Drawables</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack Certificate Pinning of Android apps in 3 steps]]></title>
            <link>https://giuseppegiacoppo.medium.com/how-to-hack-android-certificate-pinning-in-3-steps-cfcb2b643555?source=rss-2f74518fcbb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfcb2b643555</guid>
            <category><![CDATA[certificate-pinning]]></category>
            <category><![CDATA[man-in-the-middle]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Giuseppe Giacoppo]]></dc:creator>
            <pubDate>Wed, 16 Mar 2022 17:16:41 GMT</pubDate>
            <atom:updated>2022-03-17T10:02:12.279Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*34Rlp3gZedJx6XBmS7D0SA.png" /><figcaption><a href="https://en.wikipedia.org/wiki/Man-in-the-middle_attack">https://en.wikipedia.org/wiki/Man-in-the-middle_attack</a></figcaption></figure><p>When you need to enforce your mobile application security, one of the most common technique is Certificate Pinning.</p><p>If you don’t know what it is, it’s a way to prevent Man-In-The-Middle attack, performing additional checks to the certificates involved in client-server communication.<br>It’s based on the concept that if you know the fingerprint of the server, no-one can intercept your request and act as the server.</p><p>A common Android HTTP library OkHttp let’s you configure certificate pinning in a few lines of code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c299c142000318ed8f7bb3eef41abcae/href">https://medium.com/media/c299c142000318ed8f7bb3eef41abcae/href</a></iframe><p>Doing this, any call to github.com API will fail if the fingerprint doesn’t match.<br>This is not the only library that allows you to do it, but what it’s important is the <strong>domain </strong>and the related certificate <strong>hash</strong>.</p><h3>Is it a good practice? 💡</h3><p>There are discording opinions about it. While so many cybersecurity companies still suggest to implement it in your application, even producing security reports mentioning the lack of certificate pinning, there are many entities and CA that discourage this practice. If you are curious about it I suggest this article: <a href="https://www.digicert.com/blog/certificate-pinning-what-is-certificate-pinning">https://www.digicert.com/blog/certificate-pinning-what-is-certificate-pinning</a></p><h3>Hack Certificate Pinning in 3+1 steps</h3><p>If you want to hack your application, you’ll need only a few tools:</p><ul><li>Android build-tools (If you’re an Android Developer you already have them, 100% sure)</li><li><a href="https://ibotpeaches.github.io/Apktool/">ApkTool</a></li><li>Patience (if your app is not so small)</li></ul><h3><strong>Procedure</strong></h3><ol><li><strong>Decompile your apk</strong></li></ol><p>First step is to decompile your apk using apktool</p><pre>$ apktool d app-release.apk</pre><p>You’ll obtain a directory containing your src and res decompiled. Sources won’t be in java/kotlin but in smali language. Now comes the boring part: finding the source code containing certificate pinning code. You can help yourself looking for strings like “sha1/*” or “sha256/*”</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/99738adecafa69886a0356eba39d4425/href">https://medium.com/media/99738adecafa69886a0356eba39d4425/href</a></iframe><p><strong>2. Remove pinning for the desired domain</strong></p><p>Here you have many solutions, but remember from where we started: we linked a specific fingerprint to a specific domain.</p><p>This means you can just edit the domain with another one (let’s say *.fakedomain) or replace the fingerprint with your proxy certificate.</p><p>I don’t suggest to remove the pinning because I’m not confortable on working in smali language, but you’re free to do it</p><p><strong>3. Build and sign your modified sources</strong></p><p>Just execute the build command from apktool</p><pre>$ apktool b -o app-release-apktool.apk app-release<br>$ zipalign -v -p 4 app-release-apktool.apk app-release-zipalign.apk<br>$ apksigner sign --ks keystore.jks --out app-release-apksigner.apk app-release-zipalign.apk</pre><pre>#optional <br>$ apksigner verify app-release-apksigner.apk</pre><p><strong>3+1. Intercept</strong></p><p>There are plenty of proxy and tools for MITM. I can suggest you:<br><a href="https://www.charlesproxy.com/">https://www.charlesproxy.com/</a><br><a href="https://frida.re/">https://frida.re/</a></p><p>This is probably the most difficult part because it changes depending on the tool you will use and the Android version used for compiling the sources. I won’t go into details but both Charles and Frida-tools have their own configurations and guides for it.</p><h3>Considerations</h3><p>As you can see, almost anyone can remove your certificate pinning in less than 10 minutes. Are we still sure it is a good practice? Tell me in the comments 🙌</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfcb2b643555" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Everything you need to know about Associate Android Developer Certification]]></title>
            <link>https://giuseppegiacoppo.medium.com/everything-you-need-to-know-about-associate-android-developer-certification-26986c53da67?source=rss-2f74518fcbb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/26986c53da67</guid>
            <category><![CDATA[android-developers]]></category>
            <category><![CDATA[android-certification]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Giuseppe Giacoppo]]></dc:creator>
            <pubDate>Mon, 07 Mar 2022 21:10:43 GMT</pubDate>
            <atom:updated>2022-03-12T05:13:44.989Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b6lOFqeqYKuSZV_xg-ej8A.jpeg" /><figcaption>My face during the exam</figcaption></figure><p>Recently I had the opportunity of taking the Associate Android Developer Certification Exam. It was one of the strangest exam I ever had.</p><h3>The exam</h3><p>The exam, as explained on the <a href="https://developers.google.com/certification/associate-android-developer">official page</a>, is designed to test the skills of an entry-level Android developer. All the details about the exam topics are into the official page and there are many articles about the contents, so I’ll try to share feedbacks you won’t find online.</p><h3>Don’t worry about the test! You’ll pass! ✅</h3><p>Even if I work as Android developer since so many years, I was worried about libraries I don’t daily use or components that were popular in the past and never met again.</p><p>So I started looking for feedbacks, tips or any other useful information.<br>I‘ve also read the study guide provided by Google, even looked again at components I use every day and I know by heart.<br>Then I started the exam and all the worries went away. I did all the tasks in 3 hours even if I had 8 hours in total.</p><p>This doesn’t mean you can pass the exam without having a knowledge of Android, but if you ever developed an app, I’m pretty sure you’ll do it.</p><p>Even if the exam was easier than expected, this doesn’t mean that everything went smoothly..</p><h3>Worry about the tasks! Some of them are incomprehensible! ❌</h3><p>I don’t know if the Google developers didn’t have time to double-check the project and the tasks, if they wanted to test your open-mindedness or something else, but trust me: this is the most difficult part of the entire exam.</p><p>Basically you’ll receive a list of tasks and screenshots of the final result. You need to fix or complete the source code and be sure the result matches with the screenshots. Also, there are some constraints: for example, you can’t add dependencies or change method signatures / constructors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*NwzQSoEs7J9K0PuAzxGRZg.jpeg" /></figure><p>Well… it‘s not so simple to follow those rules!</p><ul><li>There are tasks that ask you to show specific informations in a specific Activities, but the related screenshots contain different informations</li><li>You can’t change method signatures and constructors, but there are tasks where you <strong>MUST </strong>use some objects that are not in the class</li><li>There are classes, methods, resources or even commented code that are not mentioned in the tasks and it’s really hard to understand if you need to use them or not</li></ul><h3><strong>Should you take it? Not sure..</strong></h3><p>I think it depends on your contry and clients around you. This is clearly a certification for entry-level developers and I don’t think anyone will hire you only because of the certification, maybe only if you’re a student and you want to apply for your first work experience.</p><p>I hope Google will consider in the future to offer Professional/Expert level of this certification, where they can test you on your architecture knowledge and some other advanced topics!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26986c53da67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android Nightmares |  Base classes]]></title>
            <link>https://levelup.gitconnected.com/android-nightmares-base-classes-ccf55dbd0604?source=rss-2f74518fcbb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccf55dbd0604</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[delegation]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Giuseppe Giacoppo]]></dc:creator>
            <pubDate>Sat, 19 Feb 2022 12:22:34 GMT</pubDate>
            <atom:updated>2022-02-20T13:20:22.967Z</atom:updated>
            <content:encoded><![CDATA[<h3>Android Nightmares 😱 | Base classes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*XRqYBs3Fw6xShVZNCKyT4w.jpeg" /><figcaption>Don’t be that guy</figcaption></figure><p>When I started working as Android Developer there weren’t Fragments, RecyclerViews, ViewModels, and Coroutines. Everything changed in these ten years, everything except one thing: <strong>Base classes🥶</strong>.</p><p>If you never met a BaseActivity, BaseFragment or BaseViewModel consider yourself lucky🌟.</p><blockquote>These classes are the wrong consequence of a correct principle in software development:<strong> Don’t Repeat Yourself</strong></blockquote><blockquote><strong>“Don’t repeat yourself</strong>” (<strong>DRY</strong>) is a principle of software development aimed at reducing repetition of software patterns,replacing it with abstractions or using data normalization to avoid redundancy. (<a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself">Source</a>)</blockquote><p>A common scenario is when you need to trace analytics along your application, or maybe register a BroadcastReceiver on each activity.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/82872f5f02a35a60931c6d0408ea14b7/href">https://medium.com/media/82872f5f02a35a60931c6d0408ea14b7/href</a></iframe><p>It seems ok, now every Activity that extends BaseActivity will trace and logout without any new line of code.<br>But what if you need an Activity that automatically logs out without tracing logs? And what if you need an Activity that trace logs without an auto logout?</p><blockquote>No, the answer is not <strong>Feature Flags🙄</strong></blockquote><p>Kotlin (even Java, with some additional line of codes) and Android Lifecycle components can save you from this nightmare with <a href="https://kotlinlang.org/docs/delegation.html#overriding-a-member-of-an-interface-implemented-by-delegation"><strong>Delegation</strong></a></p><blockquote>D<strong>elegation pattern</strong> is an object-oriented design pattern that allows object composition to achieve the same code reuse as inheritance. (<a href="https://en.wikipedia.org/wiki/Delegation_pattern">Source</a>)</blockquote><p>You can implement an interface and delegate the actual code to another class. Also, thanks to Lifecycle components, we can bind our logic to lifecycle.</p><p>You only need</p><ul><li>Interface &amp; Implementation for each feature (Single Responsibility principle 💓)</li><li>Your Activity/Fragment that implements the interface, delegates to Impl and attaches the lifecycle.</li></ul><p>Final result:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/161b77b4d27ecae0870738a273ddadf2/href">https://medium.com/media/161b77b4d27ecae0870738a273ddadf2/href</a></iframe><p>Your delegates will look like these:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1886c5606398af84da1de1452d841c9d/href">https://medium.com/media/1886c5606398af84da1de1452d841c9d/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f30f9b0e12ed2f401cdcf30eb9d57f31/href">https://medium.com/media/f30f9b0e12ed2f401cdcf30eb9d57f31/href</a></iframe><p>Have you ever used Delegation before? Tell me in the comments your worse experience with Base classes!😎</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccf55dbd0604" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/android-nightmares-base-classes-ccf55dbd0604">Android Nightmares😱 |  Base classes</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rewriting Firebase RemoteConfig]]></title>
            <link>https://levelup.gitconnected.com/rewriting-firebase-remoteconfig-b831e86247c8?source=rss-2f74518fcbb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/b831e86247c8</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[remote-configuration]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[firebase-remote-config]]></category>
            <dc:creator><![CDATA[Giuseppe Giacoppo]]></dc:creator>
            <pubDate>Tue, 23 Feb 2021 22:08:31 GMT</pubDate>
            <atom:updated>2021-02-25T16:05:30.747Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*Z6LOwQ86SYO6Or0_aEkf-A.png" /><figcaption>How Remote Config works — Giuseppe Giacoppo</figcaption></figure><p>TLTR; I developed a Kotlin library which aims to be more flexible than Firebase RemoteConfig 😎</p><p>You can find it here: <a href="https://github.com/GiuseppeGiacoppo/RemoteConfig">https://github.com/GiuseppeGiacoppo/RemoteConfig</a></p><p>It’s for any Kotlin project, not only Android 🎉</p><p>If you’re an Android developer, sooner or later you’ll face one of the most common problems of this world:</p><blockquote>How to change something in your production application without releasing a new version?</blockquote><p>I’m not referring to something big as deploying a new feature or changing an entire process, but there are many common problems:</p><ul><li>Force users to upgrade the application. Sometimes you solve a bug and you need to stop a specific version of the app</li><li>Change some parts in business logic. You would like to disable or enable some feature, change the base url of your API service, etc.</li><li>Make the user interface configurable from remote. It can be a label, a message or your color palette</li></ul><p>Firebase has a very useful tool called RemoteConfig. Once you configure your project on their platform and include the proper library, it allows you to fetch a key-value data structure and use these values along your application.</p><blockquote>Cool, right? Yes, but..</blockquote><p>But there’s a problem: you are forced to use a single key-value structure😒 There’s no way to have complex objects like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48a4fc032d6b374c97f0a624d656d5e8/href">https://medium.com/media/48a4fc032d6b374c97f0a624d656d5e8/href</a></iframe><p>And you can’t have multiple configurations with different fetch logic:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/551b11d1a3d062417707355d14b4d5f5/href">https://medium.com/media/551b11d1a3d062417707355d14b4d5f5/href</a></iframe><p>For these reasons I decided to rewrite RemoteConfig 🙌</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*Q64YwJlgpNCElAF-pZ336g.png" /><figcaption>My version of RemoteConfig — Giuseppe Giacoppo</figcaption></figure><p>First of all I defined what the library should do. For each configuration (also called <em>RemoteResource</em>):</p><ul><li>Let the user set a default configuration</li><li>Let the user fetch the configuration from remote</li><li>Let the user activate the configuration manually</li></ul><p>Last bullet point could look a limitation, but instead it is a good thing to have. It will allow users to activate immediately last fetched config, and then fetch in background new configs that won’t affect the running application until you’ll activate them manually</p><p>Another important step is to define:</p><ul><li>A class that can match the configuration struture</li><li>Where the remote configuration is located (also called <em>ResourceRemoteRepository</em>)</li><li>Where the downloaded configuration can be saved <em>(ResourceLocalRepository</em>)</li></ul><p>For these reasons, library needs to be initialized in a more extensive way compared to FirebaseRemoteConfig, but Kotlin allows to do it in a pretty clean way:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a9369bca6d7fa549432acd8c9c4830dd/href">https://medium.com/media/a9369bca6d7fa549432acd8c9c4830dd/href</a></iframe><p>With few lines of code:</p><ul><li>RemoteResource of MessagesConfig class is registered in the RemoteConfig library. It defines where the configuration can be stored and where the configuration can be fetched</li><li>MessagesConfig instance can be easily injected and available in your application (KTX are a game changer)</li></ul><blockquote>That’s it!</blockquote><p>There are other cool features you can find in the readme. You can have multiple configurations that match the same class, you can even extend your own remote repository and provide your configuration as YAML, raw file or any other format!</p><p>Feel free to try it and let me know in the comments what do you think about it!</p><p>The library is open source and available on Github at this link: <a href="https://github.com/GiuseppeGiacoppo/RemoteConfig">https://github.com/GiuseppeGiacoppo/RemoteConfig</a></p><p>If you arrived here, I’ll tell you a secret: I’m working on an Android extension, so you can store the config files following Android guidelines (Java File API are not the best in this environment) 👌</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b831e86247c8" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/rewriting-firebase-remoteconfig-b831e86247c8">Rewriting Firebase RemoteConfig</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[COVID-19: The Italian case]]></title>
            <link>https://giuseppegiacoppo.medium.com/covid-19-the-italian-case-eb4601a9d5a3?source=rss-2f74518fcbb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb4601a9d5a3</guid>
            <category><![CDATA[covid19]]></category>
            <category><![CDATA[coronavirus]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[covid]]></category>
            <category><![CDATA[pandas]]></category>
            <dc:creator><![CDATA[Giuseppe Giacoppo]]></dc:creator>
            <pubDate>Sun, 15 Mar 2020 22:00:57 GMT</pubDate>
            <atom:updated>2020-03-16T09:21:28.368Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0OAUGC0wtuMoDG6Pb3n7Kw.png" /></figure><p>While China is finally defeating the new coronavirus disease (COVID-19), Italy is right now (March 15, 2020) the country with more cases of COVID-19 every day: 3000/day circa.</p><p>Thousands of doctors and scientists are studying this new virus and working hard to find a cure, and even if symptoms are similar to the seasonal flu (Fever 87.9%, Dry cough 67.7%), there are several consequences that forced China first, Italy now and other countries in next weeks to take hard decisions in order to stop, or at least contain, the effects of this massive infection.</p><h3>The speed of transmission</h3><p>The first, immediate, characteristic of this virus is the speed of transmission. The spread started in northern part of the country, and due to his speed of transmission, more than 10.000 people got infected in less than 30 days.</p><p>This spread is so quick that more than 50% of infected people live in the regions where the contagious started: Lombardia and Veneto.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*vhCpO6K_Ao5SqXjUtOYMlA.png" /></figure><p>Also, the speed of transmission is so high, that even inside those regions only few cities have more infected citizens than the rest of the region.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*OTQJDiRLjBkVkeomyAn5PA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*byw9NfaIJcUgvAxwb_Y6eA.png" /><figcaption>COVID-19 cases divided by most affected cities</figcaption></figure><p>On March 8th, the Italian Government decided to shut down the entire country, pushing companies to allow their employees to work from home and limiting the social interactions, allowing people to go out only for primary needs, like health reasons or food. But what is the reason of keeping people away from each others? <strong><em>The asymptomatic people.</em></strong></p><p>The average period of incubation is 5–7 days, some people show symptoms after 10 days and some others don’t show them at all. This means that the virus can spread without stops, because only a proper test will detect its presence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*_JFSKaLuS67xdrL3kiEhSA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*5AvwzELOHFHT0YWzA73Akg.png" /><figcaption>Relations between tests and COVID-19 cases.</figcaption></figure><p>As people may expect, an increase in tests will result in an increase of cases. This is obvious, because of asymptomatic people, but what is the relation?</p><p>Performing a data analysis, the result is a non-linear relationship. This means that when we increment the tests by a certain amount, we discover <strong>more cases</strong> than expected. The virus, right now, is present in more people that we can even think of.</p><p>If so many people don’t show symptoms, this could lead to the conclusion that it’s not so dangerous as we imagine. So, why this virus is gaining so much attention?</p><h3>The healthcare crisis</h3><p>Most of people affected by COVID-19 care only about one thing: Will I die?</p><p>The answer is: it depends, but most probably you’ll survive. The mortality rate changes day by day, because we don’t have a big number of cases yet, but the actual fatalities per COVID-19 case is in the range 2–5%</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*gA-JZeb74MnuRIgN2UD0tw.png" /></figure><p>This value is relatively high because there’s no cure or vaccine yet, and we hope to have access to a cure in 12–18 months. In the meantime, the Italian public healthcare is under a huge pressure, due to the fact that about 40% of people affected by this coronavirus need hospital assistance, and 10% intensive therapy. This most depends on the age of the person affected, and right now this is the main problem of Italy. <strong>There aren’t enough beds for everyone.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*AKhioipsHus56WAWBgQk9w.png" /></figure><p>Lombardia region has announced that most hospitals don’t have available beds anymore, and people need to be moved to different cities or even regions. And this is not only a COVID-19 affected people problem, but a global Italian problem.</p><p>How’s that possible, if intensive therapy patients are the 10% and it’s not increasing? Because of this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OGL70ah1gTaNFZ4rRfEzdw.png" /></figure><p>The ratio is stable, 10%, but this means that there are new patients <strong>every day</strong>, that sum up to the already counted ones.</p><p>Every region is having an increasing request of beds in intensive therapy, that requires an incredible amount of special machines of mechanical ventilation.</p><p>In Lombardia, every day about <strong>40 new beds </strong>are occupied by new patients</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Lh9JM25k7-_3cxqclAywlw.png" /><figcaption>Lombardia: New intensive therapy patients every day</figcaption></figure><p>Entire hospitals sectors are already reserved for coronavirus patients, and this means that other people with other diseases could not find any hospitality for them.</p><blockquote><strong>This is the real reason of social distancing</strong>.</blockquote><p>Keeping people away from each others will slow down the spread, which will decrease the number of affected people, which will decrease the number of hospitalized and intensive therapy patients.</p><p>After a period of hesitation, other countries like <strong>France, Germany, Spain </strong>are adopting the same strategy, because at the moment this is the only one we could possibly pursue.</p><p><strong>Source code</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7526c32ca7e1fae9b1af53b536c36106/href">https://medium.com/media/7526c32ca7e1fae9b1af53b536c36106/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1844c6c2c44fd33047b3a787eee4bad3/href">https://medium.com/media/1844c6c2c44fd33047b3a787eee4bad3/href</a></iframe><p><strong>References</strong></p><ul><li><a href="https://github.com/pcm-dpc/COVID-19">pcm-dpc/COVID-19</a></li><li><a href="https://www.who.int/">World Health Organization (WHO)</a></li><li><a href="http://www.salute.gov.it/portale/home.html">Ministero della Salute</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb4601a9d5a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduzione alle Convolutional Neural Networks]]></title>
            <link>https://giuseppegiacoppo.medium.com/introduzione-alle-convolutional-neural-networks-602932527e56?source=rss-2f74518fcbb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/602932527e56</guid>
            <category><![CDATA[keras]]></category>
            <category><![CDATA[cnn]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[convolutional-network]]></category>
            <dc:creator><![CDATA[Giuseppe Giacoppo]]></dc:creator>
            <pubDate>Sat, 02 Mar 2019 19:17:30 GMT</pubDate>
            <atom:updated>2019-03-02T21:04:32.630Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ss_ypoAqZMI7WIIYH-Vb6A.png" /><figcaption><a href="http://terencebroad.com/nnvis.html">Credits</a></figcaption></figure><blockquote>L’Hello World del mondo Deep Learning in Keras</blockquote><p>Le Convolutional Neural Networks (<strong>CNN</strong>) sono una famiglia di reti neurali largamente impiegate nell’ambito di computer vision e, più generalmente, con dati che hanno relazioni spaziali.</p><p>Se dovessimo rappresentarle graficamente, quello che ne verrebbe fuori è un grafo con una serie di passi dove, partendo da un input complesso, vengono estratte man mano informazioni, chiamate <strong>features</strong>, sempre più semplici e facilmente riconoscibili dal computer.</p><p>Le CNN seguono quindi un’architettura a livelli, tipicamente non ciclica. I livelli più importanti sono i<strong> layer di convoluzione</strong>, da cui prende il nome.</p><h3>Layer comuni</h3><p><strong>Convoluzione</strong></p><p>La convoluzione è un’operazione matematica che ricorda il funzionamento di uno scanner. Il risultato è funzione della traslazione di una funzione sull’altra, al variare del tempo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*pbWHCrCkAwaEx_V5bjuDpg.gif" /><figcaption><a href="https://it.wikipedia.org/wiki/Convoluzione">https://it.wikipedia.org/wiki/Convoluzione</a></figcaption></figure><p>Poichè tipicamente le CNN ricevono in input dei dati bidimensionali, come ad esempio le immagini, avremo una o più matrici in input ed una chiamata <strong>kernel </strong>che verrà traslata al fine di calcolarne il risultato, chiamato <strong>feature map</strong>. Il passo di traslazione prende il nome di <strong>stride.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*bT9P_1KAOzUh0GwzjjtuAQ.gif" /><figcaption>Kernel (3x3) con stride 1</figcaption></figure><p><strong>Sottocampionamento</strong></p><p>A seguito di un layer di convoluzione, è comune trovare un layer di sottocampionamento che riduca le dimensioni delle matrici in output. Le operazioni sono più comuni sono:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*447m-VS3x86o92jHfq_zAQ.png" /><figcaption>Esempio di MaxPooling</figcaption></figure><ul><li><strong>MaxPooling</strong>: ogni cella della matrice risultante contiene il valore massimo della sottomatrice di partenza.</li><li><strong>AveragePooling</strong>: il valore di ciascuna cella è la media dei valori della sottomatrice di partenza.</li></ul><p><strong>Full connected</strong></p><p>I layer full connected possono essere visti come dei vettori di neuroni. L’output di ciascun neurone è inviato a tutti i neuroni del layer successivo, con diversi valori di peso.</p><h3>La mia prima Convolutional Neural Networks: come iniziare?</h3><p>Iniziamo con alcuni cenni storici: i primi studi su reti di tipo convoluzionale risalgono agli anni ’50, tuttavia è solo dagli anni ’80 che si iniziarono a diffondere, grazie anche alla prima architettura <a href="https://en.wikipedia.org/wiki/Neocognitron">Neocognitron</a> ispirata alla corteccia visiva dei mammiferi.</p><p>Al giorno d’oggi la letteratura scientifica è ricca di proposte di architetture di CNN, ognuna con i suoi pro e contro.</p><p>In questo articolo vedremo come realizzare alcune delle architetture classiche di CNN, realizzabili da chiunque con poche righe di codice. In particolare:</p><ul><li>LeNet-5</li><li>AlexNet</li></ul><h3>Iniziamo</h3><p>Per iniziare abbiamo bisogno di pochi tools:</p><ul><li><a href="https://www.python.org/"><strong>Python</strong></a></li><li><a href="https://keras.io/"><strong>Keras</strong></a> è un framework ad alto livello, scritto in Python, che lavora on-top di engine quali TensorFlow, Theano, CNTK offrendo un livello di astrazione maggiore, semplificando la creazione dei nostri modelli di rete neurale, il training e la valutazione finale.</li></ul><h3>LeNet-5</h3><p>L’architettura <a href="http://yann.lecun.com/exdb/publis/pdf/lecun-01a.pdf">LeNet-5</a> risale al 1998 ed è stata creata per il riconoscimento di cifre negli indirizzi postali e successivamente da banche per la lettura dei numeri sugli assegni.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*-syi6NTyA1sRhs6AYBME_g.png" /><figcaption>Architettura LeNet-5 (<a href="http://yann.lecun.com/exdb/publis/pdf/lecun-01a.pdf">LeCun, 1998</a>)</figcaption></figure><p>Il modello è caratterizzato da 7 livelli:</p><ul><li>Layer convoluzionale: immagine single channel 32x32; output: 6 feature maps 28x28</li><li>Layer di sottocampionamento: output: 6@14x14</li><li>Layer convoluzionale: output: 16@10x10</li><li>Layer di sottocampionamento: output: 16@5x5</li><li>Layer full connect: output: 120</li><li>Layer full connect: output: 84</li><li>Layer di output: output: 10</li></ul><p>Creiamo il modello in <strong>Keras</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/86b82103c4fba23747319757ea2d7682/href">https://medium.com/media/86b82103c4fba23747319757ea2d7682/href</a></iframe><h3>AlexNet</h3><p>L’architettura <a href="https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf">AlexNet</a> risale al 2012, vincitrice della <a href="https://en.wikipedia.org/wiki/ImageNet#ImageNet_Challenge">ImageNet Challenge</a> con un distacco di oltre 10% sulle altre reti in gara. La rete è stata allenata con oltre 1.2 milioni di immagini HD, caratterizzata da 60 milioni di parametri e oltre 600.000 neuroni, per un totale di circa 1000 possibili classificazioni.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*pKGABnMAJkXxthhV0Oko4w.jpeg" /><figcaption>Architettura AlexNet (<a href="https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf">Krizhevsky, 2012</a>)</figcaption></figure><p>Il modello prevede 5 livelli convoluzionali, alcuni seguiti da layer MaxPooling e 3 FC:</p><ul><li>Layer convoluzionale: input: immagine RGB 224x224; output: 48@55x55</li><li>Layer MaxPooling: output: 48@27x27</li><li>Layer convoluzionale: output: 128@27x27</li><li>Layer MaxPooling: output 128@13x13;</li><li>Layer convoluzionale: output: 192@13x13</li><li>Layer convoluzionale: output: 192@13x13</li><li>Layer convoluzionale: output: 128@13x13</li><li>Layer MaxPooling</li><li>Layer FC: output: 2048</li><li>Layer FC: output: 2048</li><li>Layer di output: output: 1000</li></ul><p>Creiamo il modello semplificato in Keras. La versione ufficiale prevede infatti due reti in parallelo per l’allenamento in ambiente multi-GPU.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/299218e14fde25150f544247578b1040/href">https://medium.com/media/299218e14fde25150f544247578b1040/href</a></iframe><h3>Allenamento e valutazione</h3><p>Utilizziamo l’architettura LeNet-5 sul dataset <a href="https://en.wikipedia.org/wiki/MNIST_database">MNIST</a>. Modificheremo l’input della rete in modo tale da accettare in input immagini di dimensione 28x28px, invece di 32x32px.</p><p>Ci serviremo anche delle librerie PyPlot e NumPy per preparare il dataset ed effettuare il plot dei risultati di allenamento.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b97d09d887f53cfe76f938d4e8a2ee0e/href">https://medium.com/media/b97d09d887f53cfe76f938d4e8a2ee0e/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*L62cwn_hzXRgTO9Dg8pjEQ.png" /></figure><p>Dopo qualche decina di secondi il nostro modello sarà allenato ed avremo una percentuale di accuratezza sul dataset di validazione di oltre il 98%.</p><p>Valutando il modello con immagini di test, i risultati saranno:</p><p><strong>loss: 0.051<br>accuracy: 0.9833</strong></p><h3>Conclusioni</h3><p>In questo articolo abbiamo visto come muovere i primi passi nel mondo delle Convolutional Neural Network.</p><p>Le reti trattate possono considerarsi l’Hello Word dell’Image Classification, e permettono di ottenere ottimi livelli di accuratezza con datasets standard, come ad esempio <a href="https://en.wikipedia.org/wiki/MNIST_database">MNIST</a>, anche senza alterare l’architettura iniziale.</p><p>Vi invito a migliorare le reti proposte, aggiungendo più o meno layers (hint: layers di Dropout) e modificare i valori di kernel, filter size e strides in base al vostro dataset.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=602932527e56" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>