<?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 Artem Asoyan on Medium]]></title>
        <description><![CDATA[Stories by Artem Asoyan on Medium]]></description>
        <link>https://medium.com/@artemasoyan?source=rss-90aa05a7ef7c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xwu4H_OmJU_SYD1WdyPDQw.jpeg</url>
            <title>Stories by Artem Asoyan on Medium</title>
            <link>https://medium.com/@artemasoyan?source=rss-90aa05a7ef7c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 01:40:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@artemasoyan/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[When bugs stop being just a queue]]></title>
            <link>https://artemasoyan.medium.com/when-bugs-stop-being-just-a-queue-547e1d305257?source=rss-90aa05a7ef7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/547e1d305257</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[engineering-management]]></category>
            <dc:creator><![CDATA[Artem Asoyan]]></dc:creator>
            <pubDate>Thu, 28 May 2026 19:31:23 GMT</pubDate>
            <atom:updated>2026-05-28T19:31:23.242Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>For a long time, I treated bugs as a list of work: close the ticket, investigate the support request, handle the incident, fix the flaky test everyone has learned to rerun.</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KyXAsVhYTPBNiWRcBgOKbQ.png" /></figure><p>Mobile development doesn’t work without that mode.</p><p>But the queue has a trap: tasks move on, while the same symptoms keep coming back.</p><p>Take an old checkout flow. First, a bug appears on one app version. Then support reports a similar case. Then a small delivery change unexpectedly affects payment. A UI test around that flow is green one day and red the next. Code review slows down because part of the behavior is hidden behind flags, and nobody wants to accidentally open the wrong path before release.</p><p>In the tracker, these are different cards.</p><p>In the product, they may point to the same uncomfortable area.</p><p>When the product is small, you can still hold those connections in your head. Like being in a boat near the shore: if you hit the bottom, you roughly know where it happened.</p><p>In a large product, the shore is far away. There are many app versions, many teams, and logic split between the client, backend, flags, and experiments. A single bug no longer explains itself.</p><p>If the same flow keeps bringing bugs, support requests, long reviews, manual checks, and regressions after small changes, it is no longer just a queue.</p><p>It is an area worth looking at separately.</p><p>Not to blame a module or a team.</p><p>But to understand where the product regularly burns engineering time: in checks, support, cautious changes, regressions, and local fixes.</p><p>I like thinking about this as a map, but without the magic.</p><p>You put different traces next to each other: bugs, support requests, flaky tests, long reviews, painful releases, repeated regressions. Then you look for places where they start forming the same contour.</p><p>That contour doesn’t tell you: “do this next”.</p><p>But it helps change the question.</p><p>Not only: what are we fixing today?</p><p>But also: which part of the system should we improve so we stop fixing the same thing through different tickets?</p><p>In the next post, I want to unpack which signals are worth putting next to each other for such a map.</p><p>Have you had a flow that looked like a set of random bugs for months, until it became clear that the real work was not fixing the tickets, but improving the area around them?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=547e1d305257" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Crash-free ≠ successful]]></title>
            <link>https://artemasoyan.medium.com/crash-free-successful-80114d393a51?source=rss-90aa05a7ef7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/80114d393a51</guid>
            <category><![CDATA[crashlytics]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Artem Asoyan]]></dc:creator>
            <pubDate>Sat, 23 May 2026 18:38:40 GMT</pubDate>
            <atom:updated>2026-05-23T18:38:40.532Z</atom:updated>
            <content:encoded><![CDATA[<p>In mobile interviews, I often discuss one question: what happens to a feature after rollout?</p><p>Not the ticket in the tracker.<br>The feature itself.</p><p>How does the team know it didn’t just reach users, but actually works?</p><p>A feature can be broken without crashing the app once.</p><p>The hardest kind of mobile release is the quiet one. Pre-release checks didn’t show anything critical, Crashlytics is quiet, alerts are silent.</p><p>Then a day later you see it: users are entering the flow, but not reaching the result.</p><p>Somewhere an early return fired, a condition filtered out part of the audience, and the path just stopped. The app is alive. Formally, there is no incident.</p><p>But for those users, the feature doesn’t work.</p><p>In mobile development, “doesn’t crash” and “works” are two different system states.</p><p>Especially when the issue lives in one segment: an older app version, a specific OS, remote config, or staged rollout. The funnel drops a little, support gets a few isolated complaints, and formally everything still looks calm.</p><p>This is usually where teams don’t have much time left. I’ve lived in that mode many times: the backlog doesn’t end, the release has already moved on, and you can’t manually watch every user flow.</p><p>I’m not suggesting a post-release watchtower for every button. But I am interested in where the team draws the line between “the task is closed” and “the user got the result”.</p><p>A screen-open event is useful, but it rarely answers the main question by itself. You need a result signal: order created, card linked, subscription activated. And nearby signals too: errors, retries, conversion drop by app version or segment.</p><p>This is not one role’s responsibility. QA, product, engineering, and analytics all see different parts of the picture. A good answer usually comes from several signals.</p><p>In interviews, I don’t expect a perfect answer or the name of the “right” dashboard. I’m interested in where a person looks after rollout: what already means “it works in prod” for them, and what only means “it didn’t crash”.</p><p>Have you had a release where there were no crashes or alerts, but part of the users still didn’t reach the result? How did you notice it?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80114d393a51" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI and the moment the phone stopped being just a phone]]></title>
            <link>https://artemasoyan.medium.com/ai-and-the-moment-the-phone-stopped-being-just-a-phone-79f2820c657f?source=rss-90aa05a7ef7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/79f2820c657f</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Artem Asoyan]]></dc:creator>
            <pubDate>Sat, 16 May 2026 13:58:49 GMT</pubDate>
            <atom:updated>2026-05-16T13:58:49.305Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_A-VZKViTD3Zvo_Bj5Vz9Q.png" /><figcaption>double it or give it to the next person</figcaption></figure><p>AI and the moment the phone stopped being just a phone</p><p>When the phone stopped being just a phone, it didn’t look like a revolution.</p><p>At first, it simply made calls.<br>Then came SMS, alarms, contacts, Snake, a camera with a few pixels, and mobile internet that made you afraid to check the bill.</p><p>Feature phones were simple. Familiar. Reliable.</p><p>There was a certain romance to them: a battery that lasted a week, and the feeling that the device did exactly what it was built to do.</p><p>Then the smartphone arrived.</p><p>At first, it was easy to see it as a phone with extra features: a screen without buttons, apps, a camera, email, maps.</p><p>But pretty quickly it became clear: this was no longer just a phone.</p><p>It became an access point to work, banking, taxis, navigation, shopping, music, documents, and communication.</p><p>Of course, AI is not a smartphone.</p><p>But in both cases, the first impression is similar: it looks like the tool is changing. Later, you realize that expectations are changing.</p><p>I think AI is going through a similar shift in perception.</p><p>For now, it is convenient to think of it as an accelerator: write a text, suggest code, generate tests, summarize a meeting, find a bug.</p><p>That is useful.<br>But it may not be the most important part.</p><p>The bigger shift is not only about speed.</p><p>AI is gradually changing the shape of work itself. Many professions are becoming less about a sequence of actions: write, check, approve, assemble, send.</p><p>They are becoming more like a loop for managing outcomes: define the task, provide context, generate options, test assumptions, identify risks, make decisions, maintain quality, and stay accountable.</p><p>This is especially visible in mobile platform work.</p><p>A team’s speed rarely depends only on how fast code is written. A lot of value lives around the code: architecture, tooling, quality, observability, developer experience, releases, compatibility, and long-term maintainability.</p><p>AI can help draft an RFC, prepare for a design review, outline a migration plan, compare API contract options, or highlight release risks.</p><p>But it does not know the team’s context the way a person does.<br>It does not feel the cost of architectural debt.<br>It is not responsible for the consequences of a decision six months later.</p><p>So this is not a story about AI replacing engineers.</p><p>It is more about the boundary of work shifting. Manual execution becomes cheaper. Engineering judgment, taste for quality, the ability to ask the right questions, and ownership of the final result become more visible.</p><p>The smartphone did not simply add apps to the phone.<br>It changed what people expected a device to do.</p><p>AI may do something similar to work.</p><p>In a few years, it may feel strange if a product does not understand context.<br>If an interface does not help us make decisions.<br>If every task starts from a blank page.<br>If people manually assemble things that a system could have at least prepared.</p><p>A platform shift does not begin when a new technology appears.</p><p>It begins when old workflows suddenly start to feel too manual.</p><p>And maybe the most interesting question right now is not whether we use AI.</p><p>It is whether we are still building “a phone for calls” while a new working environment is already starting to take shape around us.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79f2820c657f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Run Local LLM (AI) in Android Studio]]></title>
            <link>https://artemasoyan.medium.com/how-to-run-local-llm-ai-in-android-studio-6bb142ee64ec?source=rss-90aa05a7ef7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6bb142ee64ec</guid>
            <dc:creator><![CDATA[Artem Asoyan]]></dc:creator>
            <pubDate>Sun, 27 Apr 2025 21:44:30 GMT</pubDate>
            <atom:updated>2025-04-27T21:44:30.017Z</atom:updated>
            <content:encoded><![CDATA[<h4>Complete Guide to Local LLM for Android Studio</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wseHJGV0H180yE_a" /></figure><h3>Hi! If you are a mobile developer and follow AI trends, you probably wondered how to integrate language models (LLM) into your apps directly from Android Studio. In this article, I will tell you how you can do it quickly and easily, without relying on external APIs and cloud solutions .</h3><p>I will share a step-by-step guide on how to run a local LLM on your computer and integrate it into Android Studio. We will figure out how to choose a model, prepare the environment, and how to use it.</p><h4>🛠️ Step-by-step guide</h4><p><strong>Selecting and loading a model</strong></p><ul><li>Hardware requirements</li><li>Where to find models and what to look for</li><li>Installing and configuring the necessary tools and libraries</li><li>Which models are best suited for local launch?</li></ul><p><strong>Setting up the environment</strong></p><ul><li>Setting up and running the server to run the model locally</li></ul><p><strong>Integration with Android Studio</strong></p><ul><li>Installing the Continue plugin (and its problems)</li><li>Launch and test your work directly from Android Studio</li></ul><h4>🔍 What else did I try and conclusions</h4><ul><li>Other options to launch LLM on Android (ChatGPT, Cursor)</li><li>What’s next?</li><li>Ready to launch your own AI right on your desktop? Let’s go! 🚀</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*tgeYa8aF3XJdX8Cg.png" /></figure><ul><li><strong>Hardware requirements</strong></li><li>Apple Silicon M-Chip with 16+ RAM (preferably 32)</li><li>Windows PC with NVIDIA/AMD graphics card (the more powerful the better)</li><li><strong>Selecting and loading a model</strong></li><li>There is a great resource for models — <a href="https://huggingface.co/models">https://huggingface.co/models</a> , but it is quite difficult to figure out and understand what we need right away, you will also have to figure out how to launch them through the console and read guides, scripts, etc. I would like to avoid this, especially when we are at the stage of familiarization with different models. For familiarization — you can watch :)</li><li>Since we are lazy, we will use the <a href="https://lmstudio.ai/">LM Studio</a> program . Supports macOS, Windows, Linux. What we need. Download and install.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h99aclZTC1LzIFVv.png" /></figure><ul><li>After launching, select Power User mod and click on Discovery (magnifying glass icon)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iEGQmhcEJjSGOepd.png" /></figure><p>The search will show a large number of models to choose from.<br>Also pay attention to the GGUF and MLX checkboxes.<br>For Apple Silicon (M1/M2/M3/M4) it is preferable to use <strong>MLX</strong> , as they should work better, but there is not always an MLX model for the desired model (this is not a problem if the model is small).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GzUdkS0S8gsU79LB.png" /></figure><p>Also, when loading a model, you can choose its “cut-down”. Try with the smallest one, if everything is ok and the hardware allows it, try a fatter model, etc.</p><p>Quantized models are compressed versions of neural networks that take up less space and require fewer resources to run (e.g. on low-end hardware).</p><p>Usually they are slightly worse than the original in quality: the stronger the compression (the lower the number of bits, for example, 2, 4, 8), the worse the model works. At the same time, 8-bit models are practically indistinguishable from the original, and 4-bit ones give a good balance between quality and size.</p><p>It is important to remember that the number of parameters affects quality even more than the degree of quantization. That is, a model with a large number of parameters but a lower bit rate (e.g. quantized 13B) will often perform better than a model with a smaller number of parameters, even if it is not compressed at all (e.g. original 7B).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ekOz72-6XZHSMMbW.png" /></figure><p>In this example I will use the Llama 3.1 8B Instruct 4bit model.<br>(If you have weak hardware, you can try the deepseek-coder-6.7b-instruct model)</p><p>Select and download.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LOfDUXqLsCZOncff.png" /></figure><p>While we wait for the download…</p><p>Next, go to the Developer tab and select Select a model to Load. Select our module and load it into memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oq4_4oN5lxvAjFaf.png" /></figure><p><strong>Setting up the environment</strong></p><ul><li>When our model is loaded, we need to do the following in order:<br>1. Enable the CORS checkbox (opens the possibility for plugins and the web)<br>2. Select Server Port 11434 <strong>(this is important, more on that below in the plugin settings)</strong><br>3. Start the server using the checkbox.</li></ul><p>If everything is OK, then the model should be <strong>READY</strong> and we will see logs in the console. Now your model is available at <a href="http://127.0.0.1:11434.">http://127.0.0.1:11434.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LqfEbK715zWU8kEZ.png" /></figure><p><strong>Integration with Android Studio</strong></p><ul><li>At the moment, Android Studio has many different plugins and most of them are under active development, so their stability and documentation leave much to be desired.</li><li>Here are some definitely working plugins that support full offline:<br>1. <a href="https://www.continue.dev/">Continue</a><br>2. <a href="https://www.jetbrains.com/ru-ru/junie/">Juine</a></li><li>Unfortunately, for Junie even for the offline version you need to register and start a trial, they also have <a href="https://youtrack.jetbrains.com/articles/SUPPORT-A-558/AI-Assistant-is-not-available-and-asks-to-change-Region-setting">a bug where it is impossible to start even a trial from the studio.</a> I tried VPN and proxy on a laptop, on a router. Changed countries and regions. Didn’t work. Plus the need to register and start <strong>a trial for the offline</strong> version is a bit confusing. Therefore, the choice fell on Continue.</li><li>Installing the <a href="https://www.continue.dev/">Continue plugin</a></li><li>Follow <a href="https://plugins.jetbrains.com/plugin/22707-continue">the link</a> and install the plugin in Android Studio (my version at the time of writing is Android Studio Meerkat | 2024.3.1 Patch 1). You should see a tab. Click on it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DiqfC3T30KGBOy_-.png" /></figure><ul><li>There is a high probability that you will see a Connection Error / Error error in the window of this plugin. (because <strong>Java runtime that has no support for JCEF, </strong><a href="https://issuetracker.google.com/issues/159933628?pli=1"><strong>issue</strong></a> )</li><li>To solve this problem we need to choose a runtime with JCEF support:</li><li>You need to be careful here, because you can break Android Studio :)</li><li><em>Find Action</em></li><li><em>Choose Boot Runtime for IDE</em></li><li><em>Here choose any runtime with JCEF (I chose the one on the screenshot)</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K3x4wjIXnJsapcsU.png" /></figure><ul><li>If Android Studio is broken, try several different versions with JCEF. If it is completely broken, we need to delete the <strong>studio.jdk</strong> file in the Android Studio directory. Where to find the directories — <a href="https://www.jetbrains.com/help/idea/directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html#config-directory">here</a> . I started everything on the first try.</li><li>Next, select Local Assistant in the plugin menu. (should be selected by default if you haven’t logged in)</li><li>Click on Add chat Models and then select LM Studio and Autodetect and click Connect.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ogCTMMqOhLFzC0GV.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/0*dIVvAjkLAJSytPTQ.png" /></figure><ul><li>Android Studio should open config.yaml. Note the apiBase path — it contains /v1/.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/0*GCDvGq_YhXkwqqi5.png" /></figure><p>In the config we can configure our model for different <a href="https://docs.continue.dev/customize/model-roles/">roles</a> . Now the request from Android Studio is redirected to the local server. Let’s check — everything is ok.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*HN9u7QXuQiFdKmtI.png" /></figure><ul><li>More details about the roles:<br>Click on the cube icon (Models). A set of dropdown menus with a choice of models for each option is called up. Here we can configure the behavior for each model.<br>In the screenshot, chat (communication), edit (editing in code), apply (application from chat) and autocomplete (smart autocompletion) are enabled. If the features are not needed, disable them (you can comment them in config.yaml). You can also use a large model for chat and a faster one for autocomplete, but then 2 models will hang in memory, so proceed from your hardware and needs.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RTDXvpxu-oUvWxW5.png" /></figure><p>Also in the same menu in Tools you can configure the behavior for each operation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/0*sbZSub-hNP5BHP9f.png" /></figure><p>The plugin from Continue also has bugs. For example, they have a hardcode for Ollama on the port in the plugin and it listens to exactly 11434 from the studio. I saw similar issues, so in order not to wait for fixes, it was important to choose it.</p><h3>🔍 What else have you tried?</h3><p><strong>Paid ChatGPT</strong> :<br>You can use it via a native app with apply code features, but it doesn’t work well with AS, sometimes it doesn’t apply the code or crashes when switching tabs. Potentially ChatGPT (OpenAPI), you can use it with the current setup in the Continue plugin, just switch to the online model.</p><p><strong>Paid Cursor:</strong><br>There are several models under the hood, but the best one is the same claude-3.7. Switching to gpt-mini/o4-mini and similar ones doesn’t make much sense. It’s also quite awkward to work in their IDE. Yes, they support extensions for working with Gradle, Kotlin. But they can’t normally use and launch Cursor from their environment. I encountered the fact that I had 2 Gradle and Java running — one from Cursor, the other from AS. And they ate up almost all the memory. Well, there is nothing more convenient than AS for mobile development :). Alternatively, you can give it limited access to a project module or a set of files and ask it to perform a certain task — the agent will do it itself. I often had it that it did something wrong, then something else, then broke it, etc. It is especially difficult if there are more than 10 files.</p><p><strong>What’s next?</strong></p><ul><li>Test and find a suitable model for your hardware (I have M1 64GB).<br>I am currently testing these. The smartest is claude-3.7-sonnet. There is no MLX for it now, but there are even <a href="https://github.com/lmstudio-ai/lmstudio-bug-tracker/issues/258">cases</a> where MLX works slower.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hiZhTmDCtVDX2plw.png" /></figure><ul><li>Approximate load on my hardware while processing a request to claude-3.7-sonnet (tool in the asitop terminal)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ysPI7RauJh1pBhe0.png" /></figure><ul><li>There is also a PC with a video card, you can potentially run the model on it and share it on the local network. (LM Studio supports this in 1 click). Then almost all the RAM on the laptop will be available. You can go even further and share it on your network through your VPN.</li><li>Try Copilot, Junie (: when the bugs are fixed :-)</li></ul><p>✅ <strong>Conclusions</strong></p><p>Running LLM for Android Studio locally is not only convenient, but also significantly expands your capabilities as a developer. Of course, at the moment the solutions are still a bit “raw”, but the potential is huge, and now you can feel the real advantages of AI right on your hardware.</p><p>🔥 <strong>Let’s discuss!</strong></p><p>Tell us how you managed to integrate the local LLM? Which models seemed the most convenient? (Ideally, if you write the hardware and what suited you and the size of the project).</p><p>Share your thoughts and ask questions in the comments :-)</p><p><strong>Was it interesting and do you have any questions? (</strong>my <a href="https://www.linkedin.com/in/artemasoyan/"><em>linkedin</em></a><em>)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6bb142ee64ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Removing Google Photo as a Single Source of Photo]]></title>
            <link>https://artemasoyan.medium.com/removing-google-photo-as-a-single-source-of-photo-fcf51fd57ac3?source=rss-90aa05a7ef7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcf51fd57ac3</guid>
            <category><![CDATA[casaos]]></category>
            <category><![CDATA[photos]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[immich]]></category>
            <dc:creator><![CDATA[Artem Asoyan]]></dc:creator>
            <pubDate>Sat, 12 Apr 2025 15:11:58 GMT</pubDate>
            <atom:updated>2025-04-12T15:21:33.670Z</atom:updated>
            <content:encoded><![CDATA[<p>​In an era where data privacy and control are paramount, relying solely on cloud services like Google Photos for managing personal memories raises concerns. By using NAS (<strong>an old laptop</strong>), you can create a self-hosted photo management system that ensures your data remains under your control. This guide explores setting up such a system using <strong>CasaOS</strong>, <strong>Syncthing</strong>, and <strong>Immich</strong>.</p><p><a href="https://casaos.zimaspace.com/"><strong>CasaOS</strong></a><strong>: Simplifying Home Server Management</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vx8YMvqG0wV5fC_DH_Q68g.png" /></figure><p>CasaOS is an open-source personal cloud system designed to streamline the deployment and management of applications on home servers. Its user-friendly interface allows for easy installation and management of various applications through Docker containers. This makes it an excellent choice for transforming an old laptop into a personal cloud server. ​</p><p><a href="https://syncthing.net/"><strong>Syncthing</strong></a><strong>: Continuous File Synchronization</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q4ehT1doDC5lr6hc1sabwQ.png" /></figure><p>Syncthing is a continuous file synchronization program that securely synchronizes files between devices without relying on third-party servers. It’s particularly useful for backing up photos from mobile devices to your home server. By installing Syncthing on both your smartphone and the repurposed laptop, you can set up automatic synchronization of your photos. This ensures that every photo taken on your mobile device is backed up to your server in real-time.</p><p><a href="https://immich.app/"><strong>Immich</strong></a><strong>: Self-Hosted Photo and Video Management</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B-34AZDLnVwpPNKiSKEeBw.png" /></figure><p>Immich is a high-performance, self-hosted solution for backing up and managing photos and videos. It offers<strong> features similar to Google Photos</strong>, including automatic backups, efficient retrieval, and a user-friendly interface. By deploying Immich on your server, you gain full control over your media, ensuring privacy and eliminating reliance on external cloud services.</p><h3>Before getting started, ensure you have the following:</h3><p>An old laptop or desktop computer with at least:</p><p>2–4 CPU cores (more is better if you handle a very large photo library)</p><p>4–6 GB RAM minimum (depending on library size, more may be required)</p><p>Sufficient storage (an HDD or SSD with room for your entire photo collection and extra backup space)</p><p>A reliable Internet connection (for initial downloads and for updates, though local backup may work offline)</p><p>A USB drive to create a bootable installer (if you’re installing a fresh OS)</p><p>Basic familiarity with Linux command line (most steps use terminal commands)</p><p>A smartphone (Android or iOS) with the Syncthing app available in your app store</p><h3>Step 1: Preparing Your Server</h3><ol><li><strong>Back Up Existing Data:</strong><br> Make sure any valuable data on your old laptop is backed up elsewhere, as you may reformat or repurpose the drive.</li><li><strong>Decide on the Operating System Strategy:</strong><br> You have two common choices:</li></ol><ul><li><strong>Install a dedicated home server OS with CasaOS:</strong> CasaOS is designed to be simple, lightweight, and user friendly for home server management.</li><li><strong>Install a standard Linux distribution (e.g., Ubuntu Server) and then install CasaOS on top as a Docker app.</strong></li></ul><ol><li><strong>Download the Installation Media:</strong><br> Visit <a href="https://casaos.io/">CasaOS official website</a> to download the appropriate installation image or follow the installation instructions available in their documentation.</li><li><strong>Create a Bootable USB Stick (if needed):</strong><br> Use tools like <a href="https://rufus.ie/">Rufus</a> (for Windows) or the built‑in Startup Disk Creator (on Ubuntu) to make a bootable USB drive with the CasaOS image.</li></ol><h3>Step 2: Installing CasaOS</h3><p><em>CasaOS</em> provides an intuitive web-based interface for deploying Docker containers (your apps) and managing your server. Follow these steps:</p><ol><li><strong>Boot Your Laptop from USB:</strong><br> Insert the bootable USB drive and boot your laptop into the USB installer. You may have to enter the BIOS/UEFI to change the boot order.</li><li><strong>Follow the On‑Screen Installation Prompts:</strong><br> The CasaOS installer is designed for simplicity. Set up basic system settings, such as locale, network configuration, and disk partitioning if required.</li><li><strong>Complete Installation and Reboot:</strong><br> Once installation is complete, remove the USB and let the laptop boot into CasaOS.</li><li><strong>Access CasaOS Interface:</strong><br> Find the laptop’s IP address (for example, by checking your router’s DHCP leases or using a monitor with the OS) and open a web browser on your mobile or another computer. Then navigate to:</li></ol><h3>Step 3: Deploying Syncthing for Continuous File Synchronization</h3><p><em>Syncthing</em> is an open‑source, continuous file synchronization tool that will keep your photos from your mobile device in sync with a designated folder on your laptop.</p><p><strong>Deploy Syncthing via CasaOS:</strong></p><ul><li>In the CasaOS dashboard, navigate to the “App Store” or “Docker Apps” section.</li><li>Search for “Syncthing” and click “Install.”</li><li>Follow the prompts to configure basic settings such as port mapping (the default port is 8384 for the Web GUI) and volume mapping.</li></ul><p><strong>Set Up Volume Mapping:</strong></p><ul><li>Map a directory on your laptop (for example: /home/casaos/syncthing/photos) to the Syncthing container so that all synced photos are stored here.</li><li>If you want to keep your library organized, use a dedicated folder structure.</li></ul><p><strong>Configure Syncthing Security and Sharing:</strong></p><ul><li>After installation, access the Syncthing Web GUI by navigating to http://&lt;your-laptop-IP&gt;:8384.</li><li>Set a strong GUI password in “Actions &gt; Settings.”</li><li>Note the device ID (displayed in the Syncthing interface) which you will need for pairing with your smartphone.</li></ul><p><strong>Pair Mobile Devices:</strong></p><ul><li>Install the Syncthing app on your smartphone (available for both Android and iOS).</li><li>Open the app and add your laptop as a remote device by entering its device ID.</li><li>Configure the folder on your mobile (DCIM, Pictures, Screenshots) to sync with the folder you mapped on the laptop. Choose “Send Only” on your phone if you want uploads to remain one‑way from phone to server, on server — <strong>receive only</strong></li><li>Also choose <strong>Ignore Delete </strong>option for EACH folder on the additional settings on server. Photos that you will remove from mobile cleints will remain on the server.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*bf8GxquAojjVOXAqax9qkw.png" /></figure><ul><li>Add igonore templates for other files in phot pholders, you can take my settings</li></ul><pre>// Ignore everything by default<br>!DCIM/**<br>!Pictures/**<br>!Movies/**<br>!Download/**<br>!*.jpg<br>!*.jpeg<br>!*.png<br>!*.gif<br>!*.webp<br>!*.heic<br>!*.mp4<br>!*.mov<br>!*.mkv<br>!*.avi<br>// Everything else ignored<br>.thumbnails/*<br>*</pre><h3>Step 4: Installing and Configuring Immich</h3><p><em>Immich</em> is a self‑hosted photo management solution that rivals Google Photos by offering features such as auto‑backup, beautiful web interfaces, AI‑powered search, and much more.</p><ol><li><strong>Deploy Immich via CasaOS or Docker:</strong></li></ol><ul><li>In the CasaOS app store, search for “Immich” (if available) or use CasaOS’s terminal/command line to deploy via Docker.</li><li>Alternatively, create a new container using Docker Compose. For example, create a file named docker-compose.yml with content similar to the following (adjust volume paths to match your Syncthing folder):</li></ul><pre>version: &quot;3.8&quot;<br>services:<br>  immich:<br>    image: ghcr.io/immich-app/immich-server:v1.131.3  <br>    container_name: immich<br>    restart: unless-stopped<br>    ports:<br>      - &quot;2283:2283&quot;      # Web interface port; adjust if needed<br>    volumes:<br>      - /home/casaos/immich/data:/usr/src/app/upload    # Map the folder for photo uploads<br>    environment:<br>      DB_HOSTNAME: &lt;your-db-host&gt;           # See note below if using external DB<br>      DB_USERNAME: &lt;username&gt;<br>      DB_PASSWORD: &lt;password&gt;<br>      TZ: &quot;Your/Timezone&quot;</pre><p><strong>Configure Immich:</strong></p><ul><li>Open your browser and navigate to http://&lt;your-laptop-IP&gt;:2283.</li><li>Create an admin account following the on‑screen instructions.</li><li>Choose Sything folders as a External Photos — <a href="https://immich.app/docs/guides/external-library/">https://immich.app/docs/guides/external-library/</a></li><li>Additionally you can do read-only settings to Immich app for those folders to be sure that they a safe</li><li>First time Immich needs to scan entire library and create miniatures for each photo. Also machine-learning will help you with face recognition.</li></ul><p><strong>Install Immich Mobile App:</strong></p><ul><li>Immich has mobile apps that can show you your organized photo library.</li><li>If available in your region’s app store, download the Immich app and point it to your server (enter http://&lt;your-laptop-IP&gt;:2283</li><li><a href="https://immich.app/docs/guides/remote-access/">If you want external access </a>you need to setup WireGuard or Tailscale proxy (first if you have static public IP, second if you don’t)</li></ul><h3>Step 5: Migrating Away from Google Photos</h3><p>To complete the transition away from Google Photos:</p><ol><li><strong>Export Your Google Photos Library (Optional):</strong></li></ol><ul><li>Visit <a href="https://takeout.google.com/">Google Takeout</a> and select only Google Photos.</li><li>Create an export to download your existing photo library. Save the ZIP files safely on an external drive or computer.</li><li>For transfering them from other hdd you can use <strong>rsync</strong></li></ul><ol><li><strong>Verify Your New Backup:</strong></li></ol><ul><li>Ensure that all new photos taken on your mobile device are being uploaded to the Syncthing folder.</li><li>Check in the Immich web interface that new photos are being detected, organized, and available for viewing.</li></ul><h3>Benefits</h3><ul><li><strong>Data Privacy and Ownership:</strong><br> Your photos are stored on hardware you control. No third parties have access to your personal memories.</li><li><strong>Cost Efficiency:</strong><br> Use an old laptop and free open‑source software instead of paying for cloud storage subscriptions.</li><li><strong>Customization:</strong><br> Tailor your system — for example, by setting up scheduled backups, custom folder structures, or even integrating additional apps such as <strong>Nextcloud </strong>for documents.</li></ul><h3>Regular Maintenance</h3><ul><li><strong>Security Updates:</strong><br> Regularly check for updates in CasaOS, Syncthing, and Immich to patch vulnerabilities.</li><li><strong>Backups:</strong><br> Maintain at least one external backup of your photo directory to prevent data loss due to hardware failure. <a href="https://www.backblaze.com/blog/the-3-2-1-backup-strategy/">(3–2–1)</a></li><li><strong>Monitor System Health:</strong><br> Use CasaOS’s monitoring tools to keep an eye on disk space and system performance.</li></ul><h3>Final Considerations</h3><ul><li><strong>Learning Curve:</strong><br> Self‑hosting requires some technical know‑how, so consider setting aside time for initial setup and occasional troubleshooting.</li><li><strong>Access Outside the Home:</strong><br> Consider setting up a reverse proxy (with HTTPS certificates from Let’s Encrypt) so you can securely access Immich from remote locations if needed.</li><li><strong>Integration with Other Services:</strong><br> Once stable, you may extend the system to include automated backups of other data or even further integrate with smart home systems for a holistic self‑hosting experience.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcf51fd57ac3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kotlin for Honklers: Code More, Solve Less. 10 Tips. April Fools’ Edition]]></title>
            <link>https://artemasoyan.medium.com/kotlin-for-honklers-code-more-solve-less-10-tips-april-fools-edition-361c410e8a46?source=rss-90aa05a7ef7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/361c410e8a46</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[april-fools]]></category>
            <category><![CDATA[coroutine]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Artem Asoyan]]></dc:creator>
            <pubDate>Tue, 01 Apr 2025 11:35:14 GMT</pubDate>
            <atom:updated>2025-04-01T11:47:19.854Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kotlin for Honklers 🤡: Code More, Solve Less. 10 Tips. April Fools’ Edition😂🔥</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*pgvqUtOvYHihihgFjnxmYQ.png" /></figure><h3>Tip 1: Forget Readability — Obfuscate Everything🤡</h3><p>Are you still writing Kotlin in a way that people can understand? Amateur mistake! Real honklers know that the best code is the one nobody — not even you — can read. 😈</p><h3>How to do it right:</h3><ul><li>Replace all variable names with x, y, z, and w. Who needs meaning when you have chaos?</li><li>Abuse <strong>operator overloading</strong> to turn every function into an unreadable mess</li></ul><pre>operator fun Int.invoke(a: Int) = this + a<br>val x = 4(5) // Surprise! x is now 9. 😵‍💫</pre><ul><li>Nest lambda expressions inside each other like a Russian doll.🎎</li></ul><pre>val result = { a: Int -&gt; { b: Int -&gt; { c: Int -&gt; a + b * c } } }(2)(3)(4)</pre><p>Will it work? Who knows! Will it terrify your colleagues? Absolutely. 💀</p><h3>Tip 2: Ignore All Best Practices 🚨</h3><p>Kotlin has powerful features designed to make your life easier. The trick is to use <strong>none</strong> of them properly. 😜</p><h3>How to do it wrong:</h3><ul><li><strong>Never use </strong><strong>val!</strong> Just var everything. Your code will be unpredictable and exciting. 🎲</li><li><strong>Mix Nullability with Reckless Abandon</strong> ☠️</li></ul><pre>fun yolo(): String? = null<br>val risky: String = yolo()!! // Boom 💥</pre><ul><li><strong>Sealed classes? Never heard of </strong>’em. Who needs structure when you can have a mess? 🌀</li><li><strong>when statements? Replace them with infinite </strong><strong>if-else chains.</strong> 💩</li></ul><pre>if (x == 1) {<br>    doSomething()<br>} else if (x == 2) {<br>    doSomethingElse()<br>} else if (x == 3) {<br>    panic()<br>} else {<br>    error(&quot;what even is x?&quot;)<br>}</pre><h3>Tip 3: Use Coroutines Irresponsibly 🏎️💨</h3><p>Coroutines are great for asynchronous programming, but true honklers know they can also be used for <strong>chaos</strong>. 😵</p><h3>Ways to misuse coroutines:</h3><ul><li><strong>Launch coroutines absolutely everywhere</strong></li></ul><pre>repeat(1000) { GlobalScope.launch { println(&quot;Oops.&quot;) } }</pre><p>Your device just turned into a heater. Congratulations. 🔥📱</p><ul><li><strong>Ignore Coroutine Scope Hierarchy</strong></li></ul><pre>fun fetchData() {<br>    GlobalScope.launch {<br>        // Perform network request<br>    }<br>}</pre><p>Who cares about structured concurrency? Let your coroutines run wild and free, outliving their parents and causing memory leaks galore! 🧟‍♂️</p><ul><li><strong>Mishandle Exception Propagation</strong></li></ul><pre>suspend fun riskyOperation() {<br>    try {<br>        // Some dangerous code<br>    } catch (e: Exception) {<br>        // Swallow the exception silently<br>    }<br>}</pre><p>Fire and forget! Who needs results anyway? Let those coroutines dangle. 🎈</p><ul><li><strong>Overuse GlobalScope</strong></li></ul><pre>fun startTasks() {<br>    GlobalScope.launch {<br>        // Task 1<br>    }<br>    GlobalScope.launch {<br>        // Task 2<br>    }<br>}</pre><p>Tie your coroutines to the global scope so they can outlive everything. Who needs lifecycle awareness? Not you! 🐺</p><ul><li><strong>Neglect Thread Safety</strong></li></ul><pre>var counter = 0<br>fun increment() {<br>    GlobalScope.launch {<br>        counter++<br>    }<br>}</pre><p>Shared mutable state accessed from multiple coroutines without synchronization? What could possibly go wrong? 🧨</p><h3>Tip 4: Use Reflection for Everything 🪞</h3><p>Why write normal, boring code when you can use <strong>reflection</strong> to access private properties, call functions dynamically, and create unmaintainable nightmares? 😈</p><pre>val field = SomeClass::class.java.getDeclaredField(&quot;secret&quot;).apply { isAccessible = true }<br>field.set(instance, &quot;Oops&quot;)</pre><p>Bonus: It’s 100x (probably) slower than just writing normal code! 🏎️💨</p><h3>Tip 5: Abuse Extension Functions 🛠️</h3><p>Who needs class structure when you can randomly add functions everywhere?</p><pre>fun Int.scream() = println(&quot;AHHHHHH! $this&quot;)<br>42.scream()</pre><p>Perfect for maximum confusion. 🤡</p><h3>Tip 6: Overuse Companion Objects 🏢</h3><p>Make everything static. Who needs instances?</p><pre>class Config {<br>    companion object {<br>        var setting = &quot;MY_STATE&quot;<br>    }<br>}<br>println(Config.setting)</pre><p>Great! Now every object in your app is fighting over global state. 💥</p><h3>Tip 7: Write One-Liner Everything ☝️</h3><p>Your function should be one line. Always. No matter what. <strong>Readability is for cowards.</strong></p><pre>fun parseJson(json: String) = Gson().fromJson(json, Any::class.java) ?: throw IllegalStateException(&quot;Oops&quot;)</pre><p>No need for error handling if you never expect failure. 😆</p><h3>Tip 8: Use !! Everywhere 💣</h3><p>Kotlin protects you from nulls? Ha! <strong>Fight back.</strong></p><pre>fun risky(): String? = null<br>val result = risky()!!</pre><p>Boom. Guaranteed crashes. 🚀</p><h3>Tip 9: Inline Everything 🚀</h3><p>More inline = more speed, right? Who cares about binary size?</p><pre>inline fun tooMuchInlining() = println(&quot;I&#39;m everywhere!&quot;)</pre><p>Your app is now 50MB bigger, but hey, it runs <em>slightly</em> faster. Maybe. 🤷</p><h3>Tip 10: Randomly Mix Java and Kotlin 🌀</h3><p>Java interop is great! So why not use both… everywhere?</p><pre>public class JavaMess {<br>    public static String getMess() {<br>        return null;<br>    }<br>}</pre><pre>val mess: String = JavaMess.getMess()!! // BOOM 💥</pre><p>Surprise runtime crashes! Just like old times. 😆</p><h3>Final Thoughts 🎭</h3><p>Now that you’ve mastered the art of writing incomprehensible Kotlin, go forth and confuse! 😆 Remember: the best code is the one that <strong>only you</strong> (and sometimes not even you) can decipher.🕵️ (JOB SECURE!!!111)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=361c410e8a46" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Top 7 Android Memory Leaks and How to Avoid Them in 2025]]></title>
            <link>https://artemasoyan.medium.com/top-7-android-memory-leaks-and-how-to-avoid-them-in-2025-b77e15a7b62e?source=rss-90aa05a7ef7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b77e15a7b62e</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[memory-leak]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Artem Asoyan]]></dc:creator>
            <pubDate>Mon, 24 Mar 2025 19:01:02 GMT</pubDate>
            <atom:updated>2025-03-24T19:12:45.338Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Memory leaks</strong> — the silent killers of Android app performance. Even in 2025, with Jetpack Compose dominating UI development and fancy new tools, these bugs still haunt developers. Let’s break down the <strong>7 most common culprits</strong> and arm you with battle-tested solutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*INSOkROMFCs9KJYekCEEBg.png" /></figure><h3>Static Contexts: The Classic Trap 🧲</h3><p>Static references to Activity or Context are like undead ghosts – they never die, blocking garbage collection. Common in singletons or global utils.</p><p>Always inject the <strong>application context</strong> (never activity!)</p><pre>object AuthManager {<br>    private lateinit var appContext: Context<br>    <br>    // Initialize in your Application class<br>    fun init(application: Application) {<br>        appContext = application<br>    }<br>    <br>    fun getUser(): User? {<br>        // Use appContext here<br>    }<br>}<br><br>// Try to fix using DI like<br><br>@Module<br>@InstallIn(SingletonComponent::class)<br>class AppModule {<br>    @Provides<br>    fun provideContext(@ApplicationContext context: Context): Context = context<br>}</pre><h3>Inner Classes &amp; Lambdas: The Silent Retainers 🤫</h3><p>Non-static inner classes (like handlers) or Compose lambdas secretly hold parent references. Your Activity stays in memory after rotation? This is why.</p><pre>// For legacy code<br>// Static inner class + WeakReference<br>class MyActivity : AppCompatActivity() {<br>    private class SafeHandler(<br>        activity: MyActivity<br>    ) : Handler(Looper.getMainLooper()) {<br>        private val activityRef = WeakReference(activity)<br>        <br>        override fun handleMessage(msg: Message) {<br>            activityRef.get()?.updateUI()<br>        }<br>    }<br>}<br><br>// For compose code<br>@Composable<br>fun LeakProofButton(onClick: () -&gt; Unit) {<br>    // Captures latest onClick reference<br>    val currentOnClick by rememberUpdatedState(onClick)<br>    <br>    Button(onClick = { currentOnClick() }) {<br>        Text(&quot;I&#39;m Safe!&quot;)<br>    }<br>}</pre><h3>Zombie Threads &amp; Coroutines 🧟</h3><p>Background tasks surviving after Activity/Fragment destruction. Common with RxJava disposables or GlobalScope.</p><p><strong>Coroutines:</strong> Bind to lifecycle with lifecycleScope</p><pre>class MyFragment : Fragment() {<br>    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {<br>        lifecycleScope.launch {<br>            // Auto-cancels when fragment dies<br>            fetchData()<br>        }<br>    }<br>}</pre><h3>Forgotten Listeners: The Phantom Observers 👻</h3><p>Unregistered LiveData observers, broadcast receivers, or click listeners linger like bad smells.</p><pre><br>@Composable<br>fun SensorObserver() {<br>    val sensorManager = remember { getSystemService(SENSOR_SERVICE) as SensorManager }<br>    <br>    DisposableEffect(Unit) {<br>        val listener = SensorEventListener { /* ... */ }<br>        sensorManager.registerListener(listener, ...)<br>        <br>        onDispose {<br>            sensorManager.unregisterListener(listener) // Clean exit!<br>        }<br>    }<br>}</pre><h3>Singleton Spaghetti 🍝</h3><p>Singletons accidentally holding UI references. Seen this error?<br>MySingleton → MyActivity → MySingleton (circular reference!)</p><ul><li><strong>Only store app-level data</strong> (user sessions, configs)</li><li><strong>Inject context via DI</strong> (Hilt/Dagger/Koin)</li></ul><pre>@Singleton<br>class AnalyticsService @Inject constructor(<br>    @ApplicationContext private val context: Context<br>) { ... }</pre><h3>View Vampires: UI Components That Won’t Die 🧛</h3><p>Custom Views or ComposeViews holding Activity references after detachment.</p><pre>override fun onDetachedFromWindow() {<br>    super.onDetachedFromWindow()<br>    myView.setOnClickListener(null) // Cut the ties!<br>}<br><br>// Compose <br>ComposeView(context).apply {<br>    setViewCompositionStrategy(<br>        ViewCompositionStrategy.DisposeOnDetachedFromWindow<br>    )<br>    setContent { /* ... */ }<br>}</pre><h3>Bitmap Blunders &amp; State Monsters 🖼️</h3><p>Unreleased bitmaps or massive Compose states causing OutOfMemoryError.</p><pre>AsyncImage(<br>    model = &quot;https://example.com/huge_image.jpg&quot;,<br>    contentDescription = null,<br>    modifier = Modifier.fillMaxWidth()<br>)<br><br>val heavyList by remember { mutableStateOf(List(10_000) { ... }) } // 😱<br><br>// Better: Use lazy lists or derivedStateOf<br>val visibleItems by remember {<br>    derivedStateOf { heavyList.filter { it.isVisible } }<br>}</pre><h3>🛠️ Your Anti-Leak Toolkit for 2025</h3><ol><li><strong>LeakCanary 2.14+</strong> — Now with Compose support!</li><li><strong>Android Studio Memory Profiler</strong> — Track heap dumps</li><li><strong>Compose Recomposition Debugger</strong> — Find state villains</li></ol><p><strong>🔗 Reading links</strong></p><ul><li><a href="https://developer.android.com/topic/performance/memory">Android Memory Management Docs</a></li><li><a href="https://square.github.io/leakcanary/">LeakCanary for Compose</a></li><li><a href="https://developer.android.com/jetpack/compose/state">Compose State Best Practices</a></li></ul><p>Got a leaky Compose app? Share your horror story in the comments! 👇</p><p>💌Folow me for more</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b77e15a7b62e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kotlin for Seniors: Code Less, Solve More. 3 tips. Part 3.]]></title>
            <link>https://artemasoyan.medium.com/kotlin-for-seniors-code-less-solve-more-3-tips-part-3-35424e49e152?source=rss-90aa05a7ef7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/35424e49e152</guid>
            <category><![CDATA[kotlin-beginners]]></category>
            <category><![CDATA[seniors]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Artem Asoyan]]></dc:creator>
            <pubDate>Fri, 21 Mar 2025 11:37:31 GMT</pubDate>
            <atom:updated>2025-03-21T11:37:31.528Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a9zZuXLxxMX42zfx" /></figure><h3>Leverage apply for Clean Object Initialization</h3><p>The <strong>apply</strong> scope function is a great way to initialize objects with less boilerplate. It lets you configure an object within a block, returning the object itself. This keeps your code concise and improves readability.</p><pre>data class User(var name: String = &quot;&quot;, var age: Int = 0)<br><br>fun main() {<br>    // Using apply to initialize a User object<br>    val user = User().apply {<br>        name = &quot;Alice&quot;<br>        age = 30<br>    }<br>    println(user)  // Output: User(name=Alice, age=30)<br>}</pre><p>In this snippet, <strong>apply</strong> helps set up the user’s properties without repeating the object name, making the code less cluttered.</p><h3>Use asSequence for Lazy Collection Operations</h3><p>When working with large collections, you can optimize performance by using <strong>asSequence</strong>. This converts your collection into a lazy sequence, deferring computation until needed. It’s particularly useful when you chain multiple operations like filter, map, or flatMap.</p><pre>fun main() {<br>    val numbers = (1..1_000_000).toList()<br><br>    // Without asSequence, intermediate lists are created<br>    val evenSquares = numbers<br>        .filter { it % 2 == 0 }<br>        .map { it * it }<br><br>    println(evenSquares.take(5))  // Eager evaluation<br><br>    // Using asSequence for lazy evaluation<br>    val lazyEvenSquares = numbers.asSequence()<br>        .filter { it % 2 == 0 }<br>        .map { it * it }<br><br>    println(lazyEvenSquares.take(5).toList())  // Lazy evaluation: computations run only as needed<br>}</pre><p>By converting the collection to a sequence, operations are processed in a lazy manner, reducing overhead and potentially improving performance in data-intensive scenarios.</p><h3>Embrace Contracts for Better Compile-Time Verification</h3><p>Kotlin contracts let you define specific behaviors for functions, enabling the compiler to make smarter inferences about code paths. This can be particularly useful for writing functions that perform validations or assertions, ensuring your assumptions hold true at compile time.</p><pre>import kotlin.contracts.*<br><br>@OptIn(ExperimentalContracts::class)<br>fun requireNonEmpty(input: String?) {<br>    contract {<br>        returns() implies (input != null &amp;&amp; input.isNotEmpty())<br>    }<br>    require(input != null &amp;&amp; input.isNotEmpty()) { &quot;Input must not be null or empty&quot; }<br>}<br><br>fun main() {<br>    val name: String? = &quot;Kotlin&quot;<br>    // After calling requireNonEmpty, the compiler knows &#39;name&#39; is non-null and non-empty<br>    requireNonEmpty(name)<br>    println(&quot;Hello, ${name.uppercase()}!&quot;)  // Safe to call uppercase()<br>}</pre><p>the contract inside requireNonEmpty assures the compiler that the input is both non-null and non-empty once the function returns, helping to avoid unnecessary null checks later in your code.</p><p>💌 Folow me for more</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35424e49e152" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10 Kotlin Coroutine Mistakes Seniors Should Avoid ]]></title>
            <link>https://artemasoyan.medium.com/10-kotlin-coroutine-mistakes-seniors-should-avoid-66c891a4c40f?source=rss-90aa05a7ef7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/66c891a4c40f</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[seniors]]></category>
            <category><![CDATA[kotlin-beginners]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Artem Asoyan]]></dc:creator>
            <pubDate>Tue, 18 Mar 2025 16:23:17 GMT</pubDate>
            <atom:updated>2025-03-18T16:23:17.537Z</atom:updated>
            <content:encoded><![CDATA[<p>Kotlin coroutines make asynchronous programming elegant and concise. However, even experienced developers can fall into some tricky pitfalls! Let’s explore <strong>10 common coroutine mistakes</strong> and how to avoid them. ⚠️</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*IYr0inqrG3HRZCOm5v7X1A.jpeg" /></figure><h3>1. Blocking the Main Thread 🛑</h3><p>Coroutines are designed for <strong>non-blocking</strong> operations, but using Thread.sleep() or runBlocking on the main thread can freeze your app.</p><p>❌ <strong>Bad Example:</strong></p><pre>fun main() {<br>    Thread.sleep(5000) // Blocks the main thread<br>}</pre><p>✅ <strong>Solution:</strong> Use delay() instead!</p><pre>import kotlinx.coroutines.*<br><br>fun main() = runBlocking {<br>    delay(5000) // Non-blocking delay<br>}</pre><h3>2. Using GlobalScope Everywhere 🌍</h3><p>GlobalScope creates coroutines that live as long as the application, making them hard to cancel.</p><p>❌ <strong>Bad Example:</strong></p><pre>fun fetchData() {<br>    GlobalScope.launch {<br>        // Runs forever if not cancelled properly!<br>    }<br>}</pre><p>✅ <strong>Solution:</strong> Use structured concurrency (CoroutineScope).</p><pre>class MyRepository(val scope: CoroutineScope) {<br>    fun fetchData() {<br>        scope.launch {<br>            // Scoped properly<br>        }<br>    }<br>}</pre><h3>3. Not Handling Exceptions Properly ⚡</h3><p>Coroutines use structured exception handling, and uncaught exceptions can crash your app!</p><p>❌ <strong>Bad Example:</strong></p><pre>fun main() = runBlocking {<br>    launch {<br>        throw RuntimeException(&quot;Oops!&quot;)<br>    }<br>}</pre><p>✅ <strong>Solution:</strong> Use CoroutineExceptionHandler.</p><pre>fun main() = runBlocking {<br>    val handler = CoroutineExceptionHandler { _, exception -&gt;<br>        println(&quot;Caught exception: $exception&quot;)<br>    }<br>    launch(handler) {<br>        throw RuntimeException(&quot;Oops!&quot;)<br>    }<br>}</pre><h3>4. Ignoring CoroutineScope Lifecycle 🏗️</h3><p>Launching coroutines in inappropriate scopes can lead to memory leaks.</p><p>❌ <strong>Bad Example:</strong></p><pre>class MyActivity {<br>    fun fetchData() {<br>        CoroutineScope(Dispatchers.IO).launch {<br>            // This coroutine may keep running even if Activity is destroyed!<br>        }<br>    }<br>}</pre><p>✅ <strong>Solution:</strong> Tie coroutines to lifecycleScope (Android) or viewModelScope.</p><pre>class MyActivity : AppCompatActivity() {<br>    fun fetchData() {<br>        lifecycleScope.launch {<br>            // Automatically cancelled when activity is destroyed<br>        }<br>    }<br>}</pre><h3>5. Using launch Instead of async for Result Handling ⚠️</h3><p>Use async when you need to return a result.</p><p>❌ <strong>Bad Example:</strong></p><pre>fun main() = runBlocking {<br>    val result = launch { computeValue() } // Won&#39;t return a value<br>    println(result) // result is Job, not the computed value!<br>}</pre><p>✅ <strong>Solution:</strong> Use async with await().</p><pre>fun main() = runBlocking {<br>    val result = async { computeValue() }<br>    println(result.await())<br>}</pre><h3>6. Misusing Dispatchers ⚙️</h3><p>Using the wrong dispatcher can degrade performance.</p><p>❌ <strong>Bad Example:</strong></p><pre>fun fetchData() = runBlocking {<br>    launch(Dispatchers.Main) {<br>        val data = loadData() // Heavy operation on the main thread!<br>    }<br>}</pre><p>✅ <strong>Solution:</strong> Move heavy operations to Dispatchers.IO.</p><pre>fun fetchData() = runBlocking {<br>    launch(Dispatchers.IO) {<br>        val data = loadData() // Runs in the background<br>    }<br>}</pre><h3>7. Forgetting to Cancel Coroutines ❌</h3><p>Not cancelling unnecessary coroutines can lead to resource leaks.</p><p>❌ <strong>Bad Example:</strong></p><pre>fun fetchData() {<br>    val job = CoroutineScope(Dispatchers.IO).launch {<br>        while (true) {<br>            println(&quot;Fetching data...&quot;)<br>        }<br>    }<br>    // Never cancelled!<br>}</pre><p>✅ <strong>Solution:</strong> Cancel when no longer needed.</p><pre>val job = CoroutineScope(Dispatchers.IO).launch {<br>    while (isActive) {<br>        println(&quot;Fetching data...&quot;)<br>    }<br>}</pre><pre>fun stopFetching() {<br>    job.cancel()<br>}</pre><h3>8. Using launch for Parallel Computation 🏎️</h3><p>For parallel computations, async is better than launch.</p><p>❌ <strong>Bad Example:</strong></p><pre>fun main() = runBlocking {<br>    launch { expensiveTask1() }<br>    launch { expensiveTask2() }<br>}</pre><p>✅ <strong>Solution:</strong> Use async for parallel execution.</p><pre>fun main() = runBlocking {<br>    val task1 = async { expensiveTask1() }<br>    val task2 = async { expensiveTask2() }<br>    println(task1.await() + task2.await())<br>}</pre><h3>9. Using Too Many Coroutines 🌪️</h3><p>Creating too many coroutines can overload the system.</p><p>❌ <strong>Bad Example:</strong></p><pre>fun main() = runBlocking {<br>    repeat(100000) {<br>        launch {<br>            println(&quot;Coroutine $it running&quot;)<br>        }<br>    }<br>}</pre><p>✅ <strong>Solution:</strong> Use coroutine pools or Semaphore to limit concurrency.</p><pre>fun main() = runBlocking {<br>    val semaphore = Semaphore(10) // Limit concurrent coroutines<br>    repeat(1000) {<br>        launch {<br>            semaphore.withPermit {<br>                println(&quot;Coroutine $it running&quot;)<br>            }<br>        }<br>    }<br>}</pre><h3>10. Not Testing Coroutines Properly ✅</h3><p>Coroutines require special testing setups.</p><p>❌ <strong>Bad Example:</strong></p><pre>@Test<br>fun testCoroutine() {<br>    runBlocking {<br>        mySuspendFunction() // Will run forever if not controlled<br>    }<br>}</pre><p>✅ <strong>Solution:</strong> Use TestCoroutineDispatcher.</p><pre>@ExperimentalCoroutinesApi<br>class MyTest {<br>    private val testDispatcher = TestCoroutineDispatcher()</pre><pre>    @Test<br>    fun testCoroutine() = runBlockingTest(testDispatcher) {<br>        mySuspendFunction()<br>    }<br>}</pre><p>Which mistake have you encountered the most? Let me know in the comments! 💬</p><p>💌 folow me for more</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66c891a4c40f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kotlin for Seniors: 3 Powerful Features You Should Know! ]]></title>
            <link>https://artemasoyan.medium.com/kotlin-for-seniors-3-powerful-features-you-should-know-b1642b23cb66?source=rss-90aa05a7ef7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1642b23cb66</guid>
            <category><![CDATA[kotlin-beginners]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[seniors]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Artem Asoyan]]></dc:creator>
            <pubDate>Sun, 16 Mar 2025 19:18:05 GMT</pubDate>
            <atom:updated>2025-03-16T19:18:05.573Z</atom:updated>
            <content:encoded><![CDATA[<p>Kotlin is packed with powerful features that make development smooth, expressive, and concise. Today, let’s dive into three cool Kotlin features that can make your code more elegant and readable: DSLs with infix functions, the invoke operator, and delegation with by.</p><p>Let&#39;s go! 🏎️</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYMXbKC-6pp7vpzhA5NalQ.png" /></figure><h3>Domain-Specific Languages (DSLs) with Infix Functions 📜</h3><p>One of Kotlin’s most powerful capabilities is creating <strong>DSLs (Domain-Specific Languages)</strong>. DSLs allow you to write more readable, declarative code that feels natural. Kotlin’s <strong>infix functions</strong> make DSLs even cleaner!</p><pre>class HtmlBuilder {<br>    private val content = StringBuilder()<br>    <br>    infix fun add(text: String) {<br>        content.append(text).append(&quot;\n&quot;)<br>    }<br>    <br>    override fun toString(): String = content.toString()<br>}<br><br>fun html(init: HtmlBuilder.() -&gt; Unit): HtmlBuilder {<br>    val builder = HtmlBuilder()<br>    builder.init()<br>    return builder<br>}<br><br>fun main() {<br>    val myHtml = html {<br>        add &quot;&lt;h1&gt;Hello, Kotlin DSL!&lt;/h1&gt;&quot;<br>        add &quot;&lt;p&gt;This is a paragraph.&lt;/p&gt;&quot;<br>    }<br>    println(myHtml)<br>}</pre><p>👆 Here, the add function is <strong>infix</strong>, making the DSL look clean and readable.</p><h3>The invoke Operator 🔥</h3><p>In Kotlin, functions are first-class citizens, but did you know you can make objects <strong>callable</strong> like functions? Enter the invoke operator!</p><pre>class Greeter(val greeting: String) {<br>    operator fun invoke(name: String) = &quot;$greeting, $name!&quot;<br>}<br><br>fun main() {<br>    val sayHello = Greeter(&quot;Hello&quot;)<br>    println(sayHello(&quot;Kotlin&quot;)) // Outputs: Hello, Kotlin!<br>}</pre><p>This trick is especially useful in DSLs and higher-order functions. It lets you <strong>call instances as if they were functions</strong>!</p><h3>Delegation with by 🔄</h3><p>Delegation propeties:</p><pre>import kotlin.properties.Delegates<br><br>class User {<br>    var name: String by Delegates.observable(&quot;Unknown&quot;) { _, old, new -&gt;<br>        println(&quot;Name changed from $old to $new&quot;)<br>    }<br>}<br><br>fun main() {<br>    val user = User()<br>    user.name = &quot;Artem&quot; // Prints: Name changed from Unknown to Artem<br>    user.name = &quot;Alex&quot;   // Prints: Name changed from Artem to Alex<br>}</pre><p>Class delegation</p><pre>interface Logger {<br>    fun log(message: String)<br>}<br><br>class ConsoleLogger : Logger {<br>    override fun log(message: String) = println(&quot;Logging: $message&quot;)<br>}<br><br>class App(logger: Logger) : Logger by logger<br><br>fun main() {<br>    val app = App(ConsoleLogger())<br>    app.log(&quot;Hello, Delegation!&quot;)<br>}</pre><p>💡 Here, App doesn’t need to implement log()—it delegates it to ConsoleLogger!</p><h3>Wrapping Up 🎁</h3><p>Kotlin is full of expressive and powerful features that can make your code more concise and elegant.</p><p>Which feature is your favorite? Let me know in the comments! 👇</p><p>💌folow me for more :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1642b23cb66" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>