<?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 Pablo Pallocchi on Medium]]></title>
        <description><![CDATA[Stories by Pablo Pallocchi on Medium]]></description>
        <link>https://medium.com/@pablopallocchi?source=rss-7876b40cb54d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2QcJlk0-5RVJUqLtempcDg.jpeg</url>
            <title>Stories by Pablo Pallocchi on Medium</title>
            <link>https://medium.com/@pablopallocchi?source=rss-7876b40cb54d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 22:19:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pablopallocchi/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[From Programmer to Founder]]></title>
            <link>https://medium.com/@pablopallocchi/from-programmer-to-founder-521658ef0ee2?source=rss-7876b40cb54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/521658ef0ee2</guid>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[programmer]]></category>
            <category><![CDATA[founders]]></category>
            <dc:creator><![CDATA[Pablo Pallocchi]]></dc:creator>
            <pubDate>Wed, 02 Oct 2024 03:15:30 GMT</pubDate>
            <atom:updated>2024-10-02T03:20:02.793Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fTDrTkozcZAet2I5-ahL4g.jpeg" /></figure><p>I’ve tried to start my own company and launch a product many times, but I only succeeded after learning these six lessons the hard way. Now, I want to share them with anyone who wants to become a founder of a tech startup.</p><ol><li>Avoid new technologies</li><li>Scalability is not important (yet)</li><li>Pay with money, not equity</li><li>Your team is the key</li><li>Start from the customer, not the idea</li><li>Don’t give a f*ck to hype</li></ol><p>Read the <a href="https://pallocchi.dev/posts/from-programmer-to-founder/?utm_campaign=adoption&amp;utm_source=medium&amp;utm_medium=post">full article</a> on my blog <a href="https://pallocchi.dev/?utm_campaign=adoption&amp;utm_source=medium&amp;utm_medium=post">pallocchi.dev</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=521658ef0ee2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automatically Save Email Attachments to Google Drive Using Google Apps Script]]></title>
            <link>https://medium.com/@pablopallocchi/automatically-save-email-attachments-to-google-drive-using-google-apps-script-7a751a5d3ac9?source=rss-7876b40cb54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a751a5d3ac9</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[google-apps-script]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[gmail]]></category>
            <category><![CDATA[google-workspace]]></category>
            <dc:creator><![CDATA[Pablo Pallocchi]]></dc:creator>
            <pubDate>Wed, 09 Aug 2023 01:13:03 GMT</pubDate>
            <atom:updated>2024-10-02T03:03:14.182Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Lf1argtkWh9i12hj" /><figcaption>Photo by <a href="https://unsplash.com/@hostreviews?utm_source=medium&amp;utm_medium=referral">Stephen Phillips - Hostreviews.co.uk</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>My new blog </strong><a href="https://pallocchi.dev/?utm_campaign=adoption&amp;utm_source=medium&amp;utm_medium=post"><strong>pallocchi.dev</strong></a><strong> is now available! 🥳</strong></p><h3>Introduction</h3><p>Email communication remains a crucial aspect of work and collaboration. Google Workspace, formerly known as G Suite, offers a suite of tools that streamline productivity, and in this post, we’ll explore how to automate the process of saving email attachments from a Google Group, or any other Inbox, to a specific folder in Google Drive.</p><h3>Problem</h3><p>Imagine you’re managing a Google Group, where important attachments are regularly sent. Manually saving these attachments to your Google Drive can be time-consuming and prone to errors. Is there a way to automate this process and ensure that you don’t miss any crucial documents?</p><h3>Solution</h3><p>The solution lies in leveraging the power of Google Apps Script, a versatile scripting language that integrates seamlessly with Google Workspace services. By creating a custom script, you can automate the process of extracting attachments from emails received in your Google Group and saving them to a specific folder in Google Drive.</p><p>Here’s how you can achieve this:</p><ol><li><strong>Creating the Script</strong>: Begin by creating a Google Apps Script project within your Google Drive. This project will contain the code that automates the attachment-saving process.</li><li><strong>Retrieving Email Attachments</strong>: Utilize GmailApp, a built-in service in Google Apps Script, to search for emails in your Google Group that contain attachments. Loop through these emails, extract the attachments, and prepare them for saving.</li><li><strong>Accessing Google Drive</strong>: To save the attachments, use DriveApp, another service in Google Apps Script. You can identify the destination folder in Google Drive by its unique folder ID.</li><li><strong>Automating Execution</strong>: Set up a time-based trigger for your script. This trigger will periodically run the script, ensuring that new attachments are automatically saved to Google Drive.</li></ol><h3>Create the Script</h3><p>Below is a sample Google Apps Script that automatically saves attachments from emails received in your Google Group to a specified folder in Google Drive. Please note that you’ll need to customize some parts of the script, such as the folder ID and the search query, to fit your specific use case.</p><ol><li>Open Google Drive.</li><li>Create a new Google Apps Script project by clicking on “New” &gt; “More” &gt; “Google Apps Script.”</li><li>Replace the default code with the script provided below.</li><li>Save the script and give it a name.</li><li>Run the script manually the first time to grant permissions for accessing Gmail and Drive.</li><li>Set up a trigger to run the script periodically (e.g., every hour).</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/25063300a6043913bacfaefdf8e5e0f2/href">https://medium.com/media/25063300a6043913bacfaefdf8e5e0f2/href</a></iframe><p><strong>Important Notes:</strong></p><ol><li>Make sure to replace &quot;PUT_YOUR_FOLDER_ID_HERE&quot; with the actual ID of the destination folder in your Google Drive. To get the folder ID, open the folder in Google Drive, and the ID can be found in the URL after &quot;folders/&quot;.</li><li>Modify the searchQuery variable to match the criteria for emails you want to process. The example query looks for emails from a specific email address (your-email@example.com) with attachments, but you can adjust it based on your requirements.</li></ol><p>Remember that running the script will save attachments from the matching emails in the specified folder in Google Drive. Ensure that you have the necessary permissions to access the Google Group and the destination folder in Drive.</p><h3>Automating Execution with Triggers</h3><p>Once you’ve created your Google Apps Script, the next step is to ensure that the script runs automatically at specified intervals. This is achieved through triggers, which schedule the execution of your script according to your desired timeframe.</p><p>Here’s how you can set up a trigger for your script:</p><ol><li><strong>Open Script Editor</strong>: In your Google Apps Script project, click on the menu “Extensions” &gt; “Apps Script.” This will open the Script Editor.</li><li><strong>Create a Trigger</strong>: In the Script Editor, click on the clock icon (Triggers) located on the left sidebar. This will open the triggers panel.</li><li><strong>Add New Trigger</strong>: Click on the “+ Add Trigger” button in the bottom right corner. This will open the trigger configuration window.</li><li><strong>Configure Trigger</strong>: In the trigger configuration window, you’ll need to specify the following details:</li><li><strong>Choose which function to run</strong>: Select the function you want to trigger. In our case, it’s the function responsible for saving attachments (saveNewAttachmentsToDrive).</li><li><strong>Choose which deployment should run</strong>: Select “Head.”</li><li><strong>Select event source</strong>: Choose “Time-driven.”</li><li><strong>Select type of time based trigger</strong>: Select your preferred interval (e.g., every hour, every day, every week).</li><li><strong>Save Trigger</strong>: Once you’ve configured the trigger settings, click the “Save” button. The trigger will now be active and will automatically execute your script at the specified intervals.</li><li><strong>Review and Manage Triggers</strong>: You can view and manage your triggers at any time by returning to the triggers panel in the Script Editor. Here, you can edit, delete, or adjust the schedule of your triggers as neede</li></ol><h3>Conclusion</h3><p>Automating tasks using Google Apps Script can significantly enhance productivity by eliminating manual, repetitive processes. In this post, we explored how to use Google Apps Script to automatically save email attachments from a Google Group to a designated folder in Google Drive. By implementing this solution, you can ensure that important documents are organized and accessible while minimizing the time and effort spent on manual tasks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a751a5d3ac9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Theranos: What Should We Learn from the Biggest Fraud of Silicon Valley]]></title>
            <link>https://medium.com/@pablopallocchi/theranos-what-we-should-learn-from-the-biggest-fraud-of-silicon-valley-23e288134418?source=rss-7876b40cb54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/23e288134418</guid>
            <category><![CDATA[theranos]]></category>
            <category><![CDATA[enterpreneurship]]></category>
            <category><![CDATA[silicon-valley]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Pablo Pallocchi]]></dc:creator>
            <pubDate>Tue, 07 Jun 2022 01:56:02 GMT</pubDate>
            <atom:updated>2024-10-02T03:02:57.351Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xD4eqdMDGcd_N3_lAxlscg.jpeg" /><figcaption>“The Dropout”, the series of Hulu inspired by Theranos.</figcaption></figure><p><strong>My new blog </strong><a href="https://pallocchi.dev/?utm_campaign=adoption&amp;utm_source=medium&amp;utm_medium=post"><strong>pallocchi.dev</strong></a><strong> is now available! 🥳</strong></p><p>I’ve been curious about the <a href="https://es.wikipedia.org/wiki/Theranos">Theranos</a> case for years. I still remember the day I saw <a href="https://es.wikipedia.org/wiki/Elizabeth_Holmes">Elisabeth Holmes</a> in <a href="https://www.forbes.com/sites/matthewherper/2014/07/02/bloody-amazing/?sh=633243197226">Forbes</a> with an great speech but no facts, and I wondered “How is this possible?”, because you know, if engineers cannot understand how the things work, they cannot sleep either. Well, years later we discovered that it actually wasn’t. Now, after watching <a href="https://www.imdb.com/title/tt10166622/">The Dropout</a>, I’ve been more interested than ever in this case and these are my thoughts.</p><h3>The Story</h3><p>Elizabeth Holmes founded Theranos when she was only 19 years old. She had a vision: with only a drop of blood, with no pain, run hundred of tests in a small and cheap device, that you could have at home. With that amazing idea she started the company, and during the next 15 years they raised more than $700 million dollars. Theranos was valued at $10 billion dollars (like 10 unicorns). The money was real. The product, fake.</p><h3>The Lessons</h3><p>Now I’m gonna breaking down this incredible case and I’ll analyze each part of the story to see if Elizabeth is just and exception, a monster that we can blame and that’s all, or if the problem is deepper, and these kind of practices could be found anywhere, at anytime.</p><h4>“Fake it till you make it”</h4><p>Have you ever heard it in any of the companies that you has worked? How many times? I cannot answer the second one because I’ve lost count, and this is how the Theranos scam begins. They started to raise money from investors without a working product, they just faked it. Have you ever had to present a demo to the stakeholders, with some mocked parts of your product (if not the whole product) to meet a deadline? Does it sound familiar to you?. If so, did they know it?. I think in many cases, the answer is no. What you probably do in that case, is to make it work for the next time, but in the case of Theranos the complexity of the problem to solve was so high that they spent years without success.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*xkUhWUUscAqkI5SYmMKB7A.jpeg" /></figure><h4>The Amazing Team</h4><p>It’s a well known thing that investors and venture capitalists value more the person or the team that is in charge of executing the idea, than the idea itself or even a working product. So this is the first bug of the system: the chances of success in the VC world are probably higher for a great seller than for a great engineer or scientist. Elizabeth Holmes, with no experience nor studies, promised to change the blood tests forever. However, experienced VCs of Silicon Valley bought it because her great speech and carisma.</p><p>But she is not probably the only one. Last years we saw a lot of startups rasing money with a promise that they finally couldn’t fulfill, and now most of them are having down-rounds. This happens because of multiple factors, but how are we sure that some of those founders are not just scammers?. What’s the thin edge between a visionary and an impostor? There is no clear answer, in fact, there is a lot of subjectivity in this point. 90% of startups won’t survive, and if investors would found an answer, that scary number could be different.</p><h4>The Wrapper</h4><p>As for most of the companies, it was really hard for Theranos to meet its deadlines. They sold something they didn’t had (are you surprised about that? really?) and the customers started to push them to have a working product, or the contracts would be canceled. With no customers, investors are unhappy. If investors are unhappy, there is no money. Thus, this was the genesis of the next scam in the Theranos story: since they couldn’t make it work, they started to use a third party product. They bought some machines of Siemens, and they implemented this devices in their partners as if they were developed by Theranos. Now, thinking for a moment just in tech companies, how many business do you know that they are actually just a wrapper of a third party service? I could enumerate some “inventors” or entrepreneurs that what they are doing is to use the technology of big companies like Google, and they only have a custom and tiny front-end and a cool speech to sell it. And most of them are charging their customers for services that they could get for free. Are they also scammers? and this is getting worse when they claim to be inventors of some open-source technology that they just found out there.</p><h4>You Don’t Play with Health, Elizabeth</h4><p>And here it is what I think destroyed Theranos. Is questionable but tolerable that a dating app fakes profiles, wasting your time swiping bots just to make you feel you have a lot of options, or a fintech with a tons of bugs says that your balance is zero when you have your savings there, or that amazing software which you think it uses artificial intelligence to give you better insights of something is in fact using plain SQL in an old-fashion database. As a lot of companies, you can also play with it,<strong> but you cannot tell the people they have cancer when they don’t</strong>, and this is what Theranos did. But the irony of this story, my dear friends, is that she was found guilty of defrauding investors, but not patients.</p><h3>Conclusion</h3><p>Elizabeth Holmes (CEO) and <a href="https://es.wikipedia.org/wiki/Ramesh_Balwani">Ramesh Balwani</a> (COO) are wating for the sentence, and they can spend 20 years in jail. I’m wondering if this case was exposed just because it was a HealthTech. What would be their destiny if they had decided to found a FinTech? or maybe a Blockchain startup?. Who knows. But when the system is telling you that you should always say “yes” and learn how to do it later, it seems like she, in a way, followed the steps by the book. Finally, I think we all are responsible of having a healthier and sustentable ecosystem. Regarding her future, after she paid her penalty, I can see Elizabeth as a Personal Branding gurú, because doing that, she’s a genius.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23e288134418" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running Postman Tests with CI/CD]]></title>
            <link>https://medium.com/@pablopallocchi/running-postman-tests-with-ci-cd-a5b4f9a88303?source=rss-7876b40cb54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5b4f9a88303</guid>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[postman]]></category>
            <category><![CDATA[integration-testing]]></category>
            <dc:creator><![CDATA[Pablo Pallocchi]]></dc:creator>
            <pubDate>Tue, 01 Mar 2022 20:50:41 GMT</pubDate>
            <atom:updated>2024-10-02T03:02:43.161Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>My new blog </strong><a href="https://pallocchi.dev/?utm_campaign=adoption&amp;utm_source=medium&amp;utm_medium=post"><strong>pallocchi.dev</strong></a><strong> is now available! 🥳</strong></p><p>Looking for a framework to perform integration tests, I’ve found that our friends of Postman implemented a really cool way to test your API calls. In any Postman collection, there is a <strong>Tests</strong> section where you can declare all the assertions you want to do on the response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K341HvUZVDB06GOAcp-DuA.png" /></figure><p>In the official <a href="https://www.postman.com/postman/workspace/test-examples-in-postman/request/1559645-a7c53fad-a2e5-4071-affd-5f6228efbad4">example</a> above, they are testing an scenario where they fetch all items, then create a new item, and finally verify if the item was created as expected. That’s great, but how can we run these tests from a command line, so we can add it as a step of our CI/CD pipeline? here it comes another great tool of the Postman team: <a href="https://www.npmjs.com/package/newman"><strong>Newman</strong></a>.</p><pre>newman run examples/sample-collection.json</pre><p>That’s it, that way we can run any Postman collection (previously exported as a JSON file). It seems we’ve found a nice solution for our requirement, but the real world is not that simple. Probably the API you want to test depends on a database, or even worse, on external APIs. We need to figure out how we can handle those scenarios.</p><h3>Docker to the Rescue!</h3><p>Thanks to Docker and Docker Compose we can run our API and its dependencies all together. I’m not writing this post to explain how docker compose works (there are a lot of great articles out there), so to simplify the example I’m assuming our API do not have any dependencies. Only the API and the Newman services would be needed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/85b79d84157c800206c53f07f473804f/href">https://medium.com/media/85b79d84157c800206c53f07f473804f/href</a></iframe><p>Let me explain the configuration above:</p><ul><li><strong>cicd-postman-tests-api </strong>is the API service itself. To reduce the amount of boiler plate code which is not interesting for this tutorial, I’m using the <a href="https://hub.docker.com/r/vad1mo/hello-world-rest">hello-world-rest</a> image which contains a really simple API to interact with.</li><li><strong>cicd-postman-tests-newman </strong>is the service to run the tests, which is using the official newman image from the Postman team. Since we have to wait until the API is ready to handle requests, we go with <a href="https://github.com/docker/compose/issues/374#issuecomment-310266246">this</a> approach and use a script as a wrapper to wait for it. Note that it’s not enough to use the docker compose option<strong> depends-on</strong>, since this feature ignores the start up time of your service.</li></ul><p>Here it’s the Newman wrapper script:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac495873ec3a30c25e71fbb3044c575d/href">https://medium.com/media/ac495873ec3a30c25e71fbb3044c575d/href</a></iframe><p>We try to connect to the service running on port 5050, and wait 5 seconds before trying again. Finally, when the connection was successful, we execute the tests of our collection using the Newman binary.</p><p>Done! Now we can run the tests as simple as this:</p><pre>docker-compose up --exit-code-from cicd-postman-tests-newman</pre><p>We use the <strong>— exit-code-from </strong>option to specify that after the <strong>cicd-postman-tests-newman </strong>container stops, all the other containers must be stopped too, and the exit code of the command will be the one returned from the newman container. This way, we force the CI/CD pipeline to break whenever the a test fails.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zUj1klmegjuCe-W2jGKs7g.png" /></figure><p>But wait, what happen if my API has dependencies? well, you can simply add those dependencies (databases, mock servers, etc) as <strong>services</strong> in the <strong>docker-compose.yml</strong>, that’s the main reason why we introduce Docker to the stack. You can tune the wrapper script so it waits for those services too.</p><h3>Conclusion</h3><p>Thanks to Postman, Newman and Docker we can build and maintain integration tests that can be executed both in CI/CD pipelines and local environments, allowing the developers to test the full service on their own controlled space, in a faster and easier way.</p><h3>Source Code</h3><p><a href="https://github.com/pallocchi/tutorials/tree/main/cicd-postman-tests">tutorials/cicd-postman-tests at main · pallocchi/tutorials</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5b4f9a88303" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How we’ve reworked our listings at OLX]]></title>
            <link>https://medium.com/@pablopallocchi/how-weve-reworked-our-listings-at-olx-b6a6c05be8b5?source=rss-7876b40cb54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6a6c05be8b5</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[information-retrieval]]></category>
            <category><![CDATA[classifieds]]></category>
            <category><![CDATA[listings]]></category>
            <dc:creator><![CDATA[Pablo Pallocchi]]></dc:creator>
            <pubDate>Fri, 28 Jun 2019 04:09:59 GMT</pubDate>
            <atom:updated>2024-10-02T03:02:24.661Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oW6G4BFCUKBfKgyCWee_9w.png" /></figure><p><strong>My new blog </strong><a href="https://pallocchi.dev/?utm_campaign=adoption&amp;utm_source=medium&amp;utm_medium=post"><strong>pallocchi.dev</strong></a><strong> is now available! 🥳</strong></p><p>When we started as the <em>Personalisation and Relevance</em> team at OLX, we faced the big challenge of migrating all the endpoints related with listings (<em>Home Feed</em>, <em>Search</em> and <em>Related items</em>) from a monolithic application (PHP) to a microservices architecture (mainly Java), to take the ownership and start to improve our listings. More than 2 years later, we’ve released our platform in many countries, handling ~800K requests per minute and this is what we did.</p><h3>Analysis</h3><p>First, we talked with all the stakeholders to understand what we had and what we needed. In summary, the solution should be:</p><ol><li>Easy to release new algorithms to retrieve ads from any datasource.</li><li>Easy to A/B test those algorithms from backend side.</li><li>Fault tolerant so no algorithm is critical and is easily replaced by another.</li></ol><p>We were reading papers published by other companies (such Pinterest, E-Bay and Amazon) to understand what the big players are doing, discussing a lot and after so many drafts, we came to our own solution that fits our needs.</p><h3>Overview</h3><p>The platform is mainly composed of three parts:</p><ol><li><strong>Indexing</strong>: have our own search engine where ads are indexed.</li><li><strong>Retrieval</strong>: code the algorithms to get and rank the ads from a datasource.</li><li><strong>Blending</strong>: combine the retrieval algorithms in different ways.</li></ol><h3>Indexing</h3><p>A service is in charge of consuming events from <strong>Kafka</strong> that are published by the posting flow of the core every time a new ad is posted in the platform, and <strong>index</strong> those ads into a <strong>Solr </strong>with the data we need to perform the searches.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZnooulZG5YtQrH0EkXEWA.png" /></figure><h3>Retrieval</h3><p>Another service is where we code the retrieval algorithms (mainly Solr queries) which <strong>retrieve and rank</strong> the ads based on a specific criteria. All of them have the same API, receiving specific parameters and returning a ranked list of ads (only the ids and the scores).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eS2iu5lPxmfxQFE1jFeQIQ.png" /></figure><p>We named this algorithms as <em>spells</em>, so basically a <em>spell </em>is a piece of code that do the work needed to retrieve ads from a datasource, and rank them using a specific criteria which is what identifies the <em>spell</em>. So, different <em>spells</em> rank the ads in a different way (and could use a different datasource as well).</p><p>Even though we have only one service to do the retrieval part, it could be split in many services, for example, if multiple datasources are used or the ranking part is too complex or different to be placed in the same component. Actually we could have <em>spells</em> implemented in different programming languages, as long as they have the same API.</p><h3>Blending</h3><p>A third service is needed in order to <strong>combine</strong> all the results returned by the spells in a one single result-set which is the final listing to return to the user.</p><h4>Layout</h4><p>First component of the <em>blending</em> part is to provide a way to configure which <em>spells</em> must be combined and how their results are presented to the user. The first and simple approach is to have fixed positions (or slots) where we define which <em>spell</em> fills each one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BHq_9QgLOx4S57mluQcJGQ.png" /></figure><p>We started with 3 different <em>spells</em>, the first one returning <strong><em>featured</em></strong> ads which users pay to have a boost and are showed at the top positions of each page, the second finding <strong><em>recommendations</em></strong> based on the recent activity of the user, and the last one retrieving items that were posted in locations <strong><em>close</em></strong> to the user position.</p><h4>Blender</h4><p>Then the <em>blender</em> itself, that gets from the <em>layout</em> which <em>spells</em> have to be executed, pull the results for each one in parallel, and combine them based on the configuration defined in the <em>layout</em>. The <em>blender</em> doesn’t care about what each <em>spell</em> actually does, so all the parameters received from the client are forwarded to the <em>spells</em> in the same way when the pulling is performed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z2UMfz0i-jEuIIyBBiUKMw.png" /></figure><p>Fault tolerance is required in this process, since some spells could fail or just don’t return results for a specific request, Blender needs to handle this exceptions. One thing that <em>blender</em> does is having a <em>fallback</em>, which is basically another <em>spell</em> (usually simpler and reliable) where it can get results in case of failures or empty results of the original one. Another one is using circuit breakers, so when a <em>spell</em> was continuously failing, is removed from the <em>blending</em> until is recovered.</p><h4><strong>User Pool</strong></h4><p>After blender generates the final result-set, we save those results for the user so pagination is done on this structure instead of doing the retrieval and <em>blending</em> every time the user request a new page. Basically we generate the full listing (all the pages the user could look for) when the first page is requested, and after that we get the results directly from the user pool in the following pages, until the client request the first page again or the user pool expires (typically after 1 hour).</p><p>Behind the scenes, user pools are <a href="https://redis.io/topics/data-types">Sorted Sets</a> in <strong>Redis</strong>, where we only put the ad ids and scores. Since this is implemented in memory and we have one pool for each user, is critical setting an expiration so memory is not wasted.</p><h4><strong>Hydration</strong></h4><p>Finally, since we were using only the ad ids at this point, we need to get the full data of each ad from another service to retrieve to the frontends (PWA, Android and iOS apps) so they can do the presentation part. These ads are persisted in a <strong>MySQL</strong> database by the core, so a cache layer was added (<strong>Redis</strong>) in order to have faster access to this data.</p><h3>Embebed A/B Testing tool</h3><p>From the beginning we thought the platform to easy deliver and measure new features to our users. That’s why our <em>blender</em> component is fully A/B testable, so we can try different <em>spells</em> or <em>blending</em> strategies without changing the API, being transparent to our frontends.</p><p>We split users based on their ids, and assign them a <em>layout</em>, measuring which configuration performs better</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NYEXCdfHjq4nOaUnv0WGjQ.png" /></figure><p>We have tested and combined more than 30 <em>spells</em> in our listings, and actually one of them, which is one of the most successful in terms of conversion, was developed by another team who made it for a different platform and market, but was easily integrated with our platform thanks to this architecture.</p><h3>Conclusion</h3><p>Still adding new <em>spells</em> and improving the <em>blending</em> strategies, we made an architecture which allowed us to validate hypotheses and deliver value to our users really fast, working together with people around the globe to accomplish the same objective: show the users what they want to see.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6a6c05be8b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Offline Full-Text Search in Android & iOS]]></title>
            <link>https://medium.com/android-news/offline-full-text-search-in-android-ios-b4dd5bed3acd?source=rss-7876b40cb54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4dd5bed3acd</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[sqlite]]></category>
            <category><![CDATA[full-text-search]]></category>
            <category><![CDATA[offline-first]]></category>
            <dc:creator><![CDATA[Pablo Pallocchi]]></dc:creator>
            <pubDate>Sat, 22 Sep 2018 05:38:30 GMT</pubDate>
            <atom:updated>2024-10-02T03:02:01.771Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OmsOwHyjcF7t97Q8" /><figcaption>Photo by <a href="https://unsplash.com/@aaronburden?utm_source=medium&amp;utm_medium=referral">Aaron Burden</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>My new blog </strong><a href="https://pallocchi.dev/?utm_campaign=adoption&amp;utm_source=medium&amp;utm_medium=post"><strong>pallocchi.dev</strong></a><strong> is now available! 🥳</strong></p><p>Sometimes your app uses data that doesn’t change very often, so you could keep a copy in the local storage, turning your app in an offline-first solution, faster and always available for your beloved users. Alright, that sounds good, but obviously you want to do something with that data. Suppose you want to let the user search in thousands of documents, somebody could say “ok, forget about the offline-first approach and move the data to an Elasticsearch” but it isn’t me, because the great news are that SQLite supports a native full-text search (FTS) and it’s available both for Android and iOS. Let’s do it.</p><h3>Why full-text search?</h3><p>Every time you run a query like this:</p><pre><strong>SELECT</strong> * <strong>FROM</strong> movies <strong>WHERE</strong> title <strong>LIKE</strong> &#39;%pulp%&#39;</pre><p>the database engine has to scan the whole table, because there is no way to know which movie contains that string in its title without check every single row, and it’s worse if we need to find in multiple fields at the same time.</p><p>A full-text search approach has two steps: indexing and searching. During the indexing all the documents are scanned, generating a list of search terms (index). Then, when we run the query, that index is used to perform the search.</p><h3>Implementing FTS in SQLite using FTS5 module</h3><p>Fortunately we can implement a full-text search in a mobile application without setting up and maintaining an expensive search engine in server side, just using the <a href="https://www.sqlite.org/fts5.html">FTS5 module from SQLite</a>, which could be good enough for our needs.</p><p>Let’s create an app to find movies in a local database. The first thing is creating the table for our movies, but it won’t be a common table, it has to be a FTS table:</p><pre><strong>CREATE VIRTUAL TABLE</strong> movies<br><strong>USING</strong> FTS5(title, overview, year UNINDEXED);</pre><p>We’ve just created our FTS table! now we can perform a fast search over title and overview on thousands of movies, and using just a single query. Notice the <strong>unindexed</strong> option: this means year<em> </em>is not part of the index, so we won’t be able to search on that field (and makes sense).</p><p>Inserting data is as simple as in any other table. For this post I’ve created a SQL script with 3.000 movies. But, to give you an example, this is how a single insert looks like:</p><pre><strong>INSERT</strong> <strong>INTO</strong> movies (&#39;title&#39;, &#39;overview&#39;, &#39;poster&#39;, &#39;year&#39;) <br><strong>VALUES</strong> (&#39;Pulp Fiction&#39;, &#39;A burger-loving hit man...&#39;, &#39;1994&#39;);</pre><p>Now let’s run a query to find all movies matching the term “pulp”:</p><pre><strong>SELECT</strong> * <strong>FROM</strong> movies <strong>WHERE</strong> movies <strong>MATCH</strong> &#39;pulp&#39;;</pre><p>Notice you don’t have to specify each field in the <strong>where </strong>clause, since all the indexed fields (title<em> </em>and overview) are evaluated with the <strong>match </strong>operation.</p><p>Now in our case we want to create an autocomplete, so we need to show all the movies matching with the user input as soon as it changes. In this scenario, if the user types “pul”, we should find all the movies containing a term <strong>starting</strong> like that. So our query changes a bit:</p><pre><strong>SELECT</strong> * <strong>FROM</strong> movies <strong>WHERE</strong> movies <strong>MATCH</strong> &#39;pul*&#39;;</pre><p>At this point, our application is able to perform a full-text search, finding all movies matching with an user input. But if you run the last query, you’ll realize the movies are not ordered in terms of best-matching result. Here comes the last and very important step: <strong>ranking</strong>.</p><h3>Rank the results</h3><p>Now we need to rank the results found in our SQLite database. To do that, we need a ranking function, and one of the most used functions in our context is <a href="https://en.wikipedia.org/wiki/Okapi_BM25"><strong>Okapi BM25</strong></a>. In previous versions of the FTS module (FTS3/FTS4), you have to implement this function by your own, and do the ranking in the application side. But now with FTS5 this is part of the module, and is as simple as this:</p><pre><strong>SELECT</strong> * <strong>FROM</strong> movies <strong>WHERE</strong> movies <strong>MATCH</strong> &#39;pul*&#39; <strong>ORDER BY</strong> rank;</pre><p>so under the covers SQLite creates this hidden column called rank, containing the score, for each movie, which was calculated using Okapi BM25.</p><h4>Weights for fields</h4><p>We assumed that all the fields had the same weights, so it was the same if the term searched by the user was present in the title or the overview. But in most cases, and this is not the exception, we want to prioritize certain fields. So let’s improve our autocomplete, and give the title field a weight of 10:1 over overview<em>.</em></p><pre><strong>SELECT</strong> * <strong>FROM</strong> movies <strong>WHERE</strong> movies <strong>MATCH</strong> &#39;pul*&#39;<br><strong>AND</strong> rank <strong>MATCH</strong> &#39;bm25(10.0, 1.0)&#39; <strong>ORDER</strong> <strong>BY</strong> rank</pre><p>What happened here? if you don’t specify a ranking function when you order by rank, SQLite uses the <strong>bm25() </strong>function under the covers, without any parameters (all fields have the same weight), but as we want to change it, we have to explicitly use the function, defining the weights we want in the same order we declared the fields during table creation.</p><h3>FTS5 in action</h3><p>Finally, this is how FTS5 works. Notice when I typed “Jedi”, all the Star Wars movies were returned (because that term is present in the overview), but the first result was <em>“Return of the Jedi”</em> since the title has a higher weight.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*Z8iIKeild8XbI-QTLlkM4A.gif" /><figcaption>FTS5 in action (iOS)</figcaption></figure><h3>FTS4 alternative for older devices</h3><p>As I mentioned before, the previous approach was implemented using the FTS5 module, but depending on the target that your Android / iOS application has, you might not be able to use it, but with a bit more work you can implement full-text search using FTS4 instead.</p><h4>Which module should I use?</h4><p>Based on the <a href="https://www.sqlite.org/fts5.html">official documentation</a>, FTS5 was released with <strong>SQLite 3.9.0</strong>, so it should be included in all devices running:</p><ul><li>iOS ≥ 10.0</li><li>Android ≥ API 24</li></ul><p>Looking at the iOS adoption chart, at this moment, the 95% of the users are running iOS 10 or iOS 11, so maybe doesn’t make sense to implement the FTS4 approach just for a 5%. It’s up to you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DlFN6isvlPn7w4FEw2nwjg.png" /></figure><p>But since in the Android world just a 30% have an API ≥ 24, you should consider using FTS4 instead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zBPlrRKBWAKAbXDeIC-f7Q.png" /></figure><h4>Working with FTS4</h4><p>First, the syntax to create a FTS table changes a bit:</p><pre><strong>CREATE VIRTUAL TABLE</strong> movies<br><strong>USING</strong> FTS4(title, overview, year, year=NONINDEXED);</pre><p>as you can see, you have to use FTS4 keyword instead, and the unindexed fields are declared as <strong>nonindexed</strong>.</p><p>It was easy, right? now the big change comes when we want to perform the search. As I mentioned before, FTS4 doesn’t support ordering by a ranking function, so you have to implement by your own. The good thing is FTS4 has a function which you can include as a part of your select, and it returns a set of values that can be used by our Okapi BM25 implementation. This function is called <a href="https://www.sqlite.org/fts3.html#matchinfo"><strong>matchinfo</strong></a> and is used as follows:</p><pre><strong>SELECT</strong> *, MATCHINFO(movies, &#39;pcnalx&#39;) <strong>FROM</strong> movies <br><strong>WHERE</strong> movies <strong>MATCH</strong> &#39;pul*&#39;;</pre><p>This function receives the table name as the first parameter, and a set of characters, each one representing a calculated field, as the second one. The values we need in order to use the Okapi BM25 function is represented by pcnalx. Now, let’s see how to rank the results in the application using those values.</p><h4>Rank the results in Swift</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7d5d79308284e83c6cb0d9dae0d3da7/href">https://medium.com/media/f7d5d79308284e83c6cb0d9dae0d3da7/href</a></iframe><h4>Rank the results in Kotlin</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e30dedf3a718bfa9fa75338193ac6e1b/href">https://medium.com/media/e30dedf3a718bfa9fa75338193ac6e1b/href</a></iframe><h3>Conclusion</h3><p>The FTS module of SQLite could be a great way to implement a full-text search both in iOS or Android, without any external dependency nor server running backwards. I’ve already implemented this approach in one of my applications that I have in the stores, and since it’s working really good I wrote this post to share with all of you. You can find the working example which I made for this post in my Github repo. Happy coding!</p><h3>Source code</h3><p><a href="https://github.com/pallocchi/movies/tree/fts5">branch for FTS5 implementation</a> (iOS)</p><p><a href="https://github.com/pallocchi/movies/tree/fts4">branch for FTS4 implementation</a> (iOS &amp; Android)</p><p><a href="https://github.com/pallocchi/movies/tree/fts5">pallocchi/movies</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4dd5bed3acd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-news/offline-full-text-search-in-android-ios-b4dd5bed3acd">Offline Full-Text Search in Android &amp; iOS</a> was originally published in <a href="https://medium.com/android-news">AndroidPub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fastest Microservices in Java]]></title>
            <link>https://medium.com/@pablopallocchi/fastest-microservices-in-java-509a34f2ee7c?source=rss-7876b40cb54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/509a34f2ee7c</guid>
            <category><![CDATA[dropwizard]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[spark]]></category>
            <dc:creator><![CDATA[Pablo Pallocchi]]></dc:creator>
            <pubDate>Thu, 09 Nov 2017 03:59:42 GMT</pubDate>
            <atom:updated>2018-12-05T23:50:43.313Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2wRxtTRX4yaOCc-h2SOM2g.jpeg" /></figure><p>I’ve been working with <a href="http://www.dropwizard.io/">Dropwizard</a> for 2 years, and 2 months ago I’ve started to wonder what framework is the fastest to build a microservice from scratch, so, I’ ve been testing <a href="https://projects.spring.io/spring-boot/">Spring Boot</a>, <a href="http://www.dropwizard.io/">Dropwizard</a> and <a href="http://sparkjava.com/">Spark</a> to answer my own question and today I’m going to share my results with you.</p><h3>The environment</h3><p>First, I created a docker container to run the application, with 1GB of RAM and 1 CPU. The endpoint to test was very simple, just a service to retrieve 100 movies stored in memory and serialized to Json format with Jackson serializer. I used jMeter to do the load test, running it during 5 minutes.</p><h3>The results: Startup time</h3><p>The time the application takes to start is a good way to know how much work it’s doing behind the scenes. <strong>Spring boot</strong> takes<strong> 9 seconds</strong> to be up and running. <strong>Dropwizard</strong> is faster with its <strong>3 seconds</strong> of startup, but nothing compares with the <strong>0.7 seconds</strong> that <strong>Spark</strong> needs to do the same job. That’s really fast!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fe.infogram.com%2F5c69402f-16a3-4dad-b24a-4023251ee1e4%3Fsrc%3Dembed&amp;url=https%3A%2F%2Finfogram.com%2Fstartup-1gj725dzk1qjp1l&amp;image=https%3A%2F%2Finfogram-thumbs-1024.s3.amazonaws.com%2F0318b9f1-f128-4670-85fb-8c1232388d30.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=infogram" width="550" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/b14b2a5acb641481bfa3c5d49ccea08b/href">https://medium.com/media/b14b2a5acb641481bfa3c5d49ccea08b/href</a></iframe><h3>The results: Response time</h3><p>Ok, sweet, Spark is the fastest in terms of startup, but what about the response time? what’s better? ok, that little piece of framework just did it again: it’s 3 times faster than Spring Boot!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fe.infogram.com%2F29e1db6a-0448-4ee1-a35e-a55acc0b9b69%3Fsrc%3Dembed&amp;url=https%3A%2F%2Finfogram.com%2Fresponsetime-1gk8pdq0zw7g2q0&amp;image=https%3A%2F%2Finfogram-thumbs-1024.s3.amazonaws.com%2F0e3ec152-f462-4583-985d-42ecc068fad0.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=infogram" width="550" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/c08c86eedaee05464d4ba569764fb7eb/href">https://medium.com/media/c08c86eedaee05464d4ba569764fb7eb/href</a></iframe><p>Also Spark seems to have the most stable response time across the time.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fe.infogram.com%2F7c8ce554-cd44-4160-87d8-2f65371763e4%3Fsrc%3Dembed&amp;url=https%3A%2F%2Finfogram.com%2Fresponsetimes-1gl8m3785r8jp36&amp;image=https%3A%2F%2Finfogram-thumbs-1024.s3.amazonaws.com%2F55c79d82-7ed0-469e-b632-e18cdb156e95.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=infogram" width="550" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/752e9114041016dddc207de433070d1a/href">https://medium.com/media/752e9114041016dddc207de433070d1a/href</a></iframe><h3>The results: Throughput</h3><p>Because Spark has a lower response time, you could suppose its throughput is higher, and you are right…</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fe.infogram.com%2F2309189b-f5f3-453d-859e-6d8c5558f906%3Fsrc%3Dembed&amp;url=https%3A%2F%2Finfogram.com%2Fthroughput-1gew2vnwlle8mnj&amp;image=https%3A%2F%2Finfogram-thumbs-1024.s3.amazonaws.com%2F4c15d2e7-b93f-4a64-9f9b-23298d6c2b38.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=infogram" width="550" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/14ce9940df186e0d518788ba0757a4de/href">https://medium.com/media/14ce9940df186e0d518788ba0757a4de/href</a></iframe><h3>Conclusion</h3><p>Based on all of these results, I think Spark is the best choice if you want to start a new microservice from scratch and you really care about the speed, because it’s a really super small framework with the basic features you need to build a simple but powerful API.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=509a34f2ee7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Underwood: keep Hystrix commands simple]]></title>
            <link>https://medium.com/@pablopallocchi/underwood-simple-and-clean-way-to-use-netflix-hystrix-2622c33194d8?source=rss-7876b40cb54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2622c33194d8</guid>
            <category><![CDATA[hystrix]]></category>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[java8]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Pablo Pallocchi]]></dc:creator>
            <pubDate>Thu, 09 Mar 2017 03:38:31 GMT</pubDate>
            <atom:updated>2017-08-04T20:55:42.489Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vbPNdoXzs0lhOR5JY8X1uw.png" /></figure><p>Hi guys! If you didn’t use <a href="https://github.com/Netflix/Hystrix">Hystrix</a> yet, and you have a Java application that consumes remote services or a microservice architecture, you should start to use it. Why? I think that they have a clear explanation in their repo:</p><blockquote>Hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable.</blockquote><p>Basically you can isolate failure points of your application, such as a call to a remote API, and make a more stable application, controlling the timeouts or what to do / retrieve when it fails.</p><p>Hystrix implements the <a href="https://en.wikipedia.org/wiki/Command_pattern">command pattern</a>, so if you want to encapsulate a block of code, you have to create a class extending <em>HystrixCommand</em> and then implement the <em>run()</em> method and the <em>getFallback()</em> if you want:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/12b662efcfb583efe245a3071b9fb388/href">https://medium.com/media/12b662efcfb583efe245a3071b9fb388/href</a></iframe><p>Then you can execute that:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc9bc57280b043ad5403632c300d1d78/href">https://medium.com/media/fc9bc57280b043ad5403632c300d1d78/href</a></iframe><p>I’ve been using Hystrix for a year, but my application integrates a lot of external services and in that way I’m creating too many classes and it is not so cool. So I decided to create a library that allows me to use lambdas with Hystrix, keeping my code clear. I’ve called that: <a href="https://github.com/ppallocchi/underwood"><strong>Underwood</strong></a>.</p><p>The previous example can be written with Underwood as the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f11ada9fcb7e997e0e4839a6297dc991/href">https://medium.com/media/f11ada9fcb7e997e0e4839a6297dc991/href</a></iframe><p>It’s very clean, it’s not?</p><p>You can find more examples in <a href="https://github.com/ppallocchi/underwood">the github repo</a>. And of course, you are welcome to collaborate with Underwood! We’re just getting started…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2622c33194d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Splash Screen in Android: The Right Way]]></title>
            <link>https://medium.com/android-news/launch-screen-in-android-the-right-way-aca7e8c31f52?source=rss-7876b40cb54d------2</link>
            <guid isPermaLink="false">https://medium.com/p/aca7e8c31f52</guid>
            <category><![CDATA[splash-screen]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[launch-screen]]></category>
            <category><![CDATA[material-design]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Pablo Pallocchi]]></dc:creator>
            <pubDate>Mon, 06 Mar 2017 03:39:52 GMT</pubDate>
            <atom:updated>2024-10-02T03:01:32.599Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*umj1-3O5pOqTVA_xePG25Q.jpeg" /></figure><p><strong>My new blog </strong><a href="https://pallocchi.dev/?utm_campaign=adoption&amp;utm_source=medium&amp;utm_medium=post"><strong>pallocchi.dev</strong></a><strong> is now available! 🥳</strong></p><p>After a research, I’ve found a lot of tutorials about splash (or launch) screen implementations on Android, but developers usually add a <strong>Runnable</strong> with a fixed time as delay to solve it. That solution was not an option for me, because I don’t want to force my app users to wait when there is nothing to load actually. Let me show you a great solution with minimal modifications that shows the splash screen while the app is loading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*rZBg44Kf7Y_D89QA_Cee2A.gif" /><figcaption>This is what I’ve done in that way</figcaption></figure><h3>Let’s code</h3><p>First, we have to design the splash screen layout as a <strong>drawable</strong>. I’ve used my app logo as the center bitmap, and the primary color as background.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9764e709f65200b3ad3a59ad07fbe820/href">https://medium.com/media/9764e709f65200b3ad3a59ad07fbe820/href</a></iframe><p>Now, we need to define a <strong>theme </strong>with the <strong>windowBackground</strong> value as the previous drawable.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/72b429a7223ebdad315bcd239d42e545/href">https://medium.com/media/72b429a7223ebdad315bcd239d42e545/href</a></iframe><p>Then, the theme must be assigned to the <strong>Main </strong>activity.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e77751b3ebb123379629f156e431d9c8/href">https://medium.com/media/e77751b3ebb123379629f156e431d9c8/href</a></iframe><p>Finally, we have to replace the splash theme with the original of the Main activity.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6a7c663e366be1d327f9342077724749/href">https://medium.com/media/6a7c663e366be1d327f9342077724749/href</a></iframe><h3>Conclusion</h3><p>With this approach, the splash screen is showed during the app initialization when it’s useful. Also, there is no need to create an extra activity to launch the splash, preventing delays associated with the activity creation. Keep the splash drawable as simple as possible, and you’ll love how fast it works.</p><p>That’s all folks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aca7e8c31f52" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-news/launch-screen-in-android-the-right-way-aca7e8c31f52">Splash Screen in Android: The Right Way</a> was originally published in <a href="https://medium.com/android-news">AndroidPub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>