<?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 Turkhan Badalov on Medium]]></title>
        <description><![CDATA[Stories by Turkhan Badalov on Medium]]></description>
        <link>https://medium.com/@badalov.turkhan?source=rss-88472b1207d8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lOsRf5RnyKMwUqU38BSWBw.jpeg</url>
            <title>Stories by Turkhan Badalov on Medium</title>
            <link>https://medium.com/@badalov.turkhan?source=rss-88472b1207d8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 13:11:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@badalov.turkhan/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[Yet another MacBook disenchantment]]></title>
            <link>https://medium.com/@badalov.turkhan/yet-another-macbook-disenchantment-fdb51ad1b977?source=rss-88472b1207d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/fdb51ad1b977</guid>
            <category><![CDATA[criticism]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[macbook]]></category>
            <dc:creator><![CDATA[Turkhan Badalov]]></dc:creator>
            <pubDate>Fri, 06 Oct 2023 19:20:09 GMT</pubDate>
            <atom:updated>2023-10-06T19:20:09.286Z</atom:updated>
            <content:encoded><![CDATA[<p>I am a full-time software engineer with solid experience of using Linux/Windows at home or work (depending on the policies of a company). Recently I changed my job where it is required to use a MacBook laptop provided by the company. Since then I have been constantly reminded as to how even the simplest things could be over engineered to kill any desire to use the laptop and its OS, altogether, thanks to Apple. Perhaps they took Einstein’s phrase “Make it as simple as possible but not simpler” too extreme and yet managed to fall into the “simpler” category. Here, I list all of the issues I had with the MacBook Pro 2021 after using it for the first time.</p><h3>1. There is no USB port while there is an SD Card slot</h3><p>The natural question to ask: Couldn’t they really find a place to put at least a single USB port? What makes it funnier is a discussion with one of my apple-obsessed colleagues:</p><blockquote>Me: Apparently, MacBook doesn’t have a USB port either?<br>Him: Why would you need it? It is deprecated.<br>Me: Wait what? USB 2.0 might be deprecated but USB 3.0 is at its blossom. Now, I can’t charge my phone. It shouldn’t be that difficult. It is a simple request.<br>Him: Oh, for that you have to buy an iPhone.</blockquote><p>Thanks, buddy. The idea of buying an iPhone just to be able to charge your own mobile device is enough to realize how quickly it escalates to “you have to buy an AirPods now”. As the old saying goes “You wanted a banana but what you got was a gorilla holding the banana and the entire jungle”. And no, USB is not deprecated for at least as long as Mac supports the SD card slot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*d548tkM2-0rwZauFOGLXsA.jpeg" /><figcaption>Hidden cost that the users pay for the “simpler” solution</figcaption></figure><h3>2. Gigantic touchpad … and its anti edge-crossing feature</h3><p>Seriously, not only they could not find a room for a USB port but they also made the touchpad so big as it takes almost half of the laptop. A bit more and you could run the NHL championship on it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x58EKkP_DN8iEFgf9TAUjQ.jpeg" /><figcaption>It is so bad that even AI understood what to generate. The picture is a courtesy of Bing Image Creator.</figcaption></figure><p>By default, to use the touchpad for dragging items, you have to click on the item and hold the button while moving the item around. You can enable dragging by double tap. But then the cursor remains in moving state even after you lift the finger which is explained as</p><blockquote><em>The item can still be dragged for a fraction of a second (so you can reposition your finger if it’s at the edge of the trackpad. Source: </em><a href="https://support.apple.com/en-az/guide/mac-help/unac899/mac">Change Pointer Control settings for accessibility on Mac</a></blockquote><p>I am not sure which part of it is more frustrating: is it that now I have to wait a fraction of a second each time I move an item before I can continue working or is it the fact that Apple expects you to ever reach the edge of that infinitely large hockey area just below your keyboard? I mean you have to try really hard to reach the edges and it has never been a problem to switch fingers at least on decent laptops with way smaller touchpads.</p><p>True, there are 3 options to choose the dragging style from but none of them allows to simply double-tap an item, move it, stop dragging once the finger is released.</p><h3>3. Astronauts learn to walk twice. Mac users learn to type twice</h3><p>From the first sight it looks like a normal keyboard until you start typing on it. The letters seem to be magically substituted under the tips of your fingers. I understand that sometimes keyboards have a unique feeling to them that slightly differs from one laptop to another but I have never experienced such an explicit feeling as if I am just learning how to type. Some languages benefit from such characters like the colon on the key 6 or the question mark on the key 7. None of them works on Mac — they are moved on to other keys.</p><h3>4. Printing a list of files in the user directory should not be difficult, huh?</h3><p>Now, feeling doomed that I am forever stuck with Mac, I stumble upon another paranoia of Apple that they call a security feature: typing ls command in the user directory says</p><blockquote>ls: Operation not permitted</blockquote><p>I don’t see how this makes my life any easier except making me even more mad. It turns out to be able to perform one of the most basic tasks on a computer, to list files, you have to change “Full Disk Access”. Moreover, you have to find and add the terminal to the list from the Open dialog manually.</p><h3>5. Modern version of the “chicken and egg” problem: Email or Apple ID?</h3><p>So the company I work at requires us to use only Outlook to log into email. However, to download Outlook you have to have an AppleID. Which in its turn needs an email to sign up. But to receive a confirmation code for my email I need Outlook. Oh, we have been here before, haven’t we? See the cycle? So I had to create a personal Apple ID first just to download Outlook. It is like Apple is already making me suffer enough but with the right combinations of policies it might lead to horrible experience. Setting up an email has never been so difficult before. Thanks, Apple!</p><h3>6. Drag the app to install</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*-A_QLlf9fL0qLDTOs59DSg.png" /></figure><p>Can’t it do it automatically? In my eyes, it is equivalent to asking a user to do a quick dance each time before the computer does what it is told to do. Interestingly, many Apple users say the same thing: “Oh, you just don’t understand how it works. It is an option, you could copy it into any directory”. Definitely Stockholm syndrome in its glory. Let me ask a question, how often do you really install apps to a different directory? Perhaps only minority of users would do that but even then Apple gives an option for that! While it totally removes an option of having a USB port which is used way more often than installing an app to a different directory. Such a thoughtful design.</p><h3>Conclusion</h3><p>That was the list of things that annoy me the most when using Mac. While some of Apple users might be used to those details or others haven’t really noticed them as OS X was their first OS and remains to be so, for me personally it is a deal-breaker, especially a missing USB port. The reason why I wrote this post is mainly to put these points into one place and send to people when they ask me why I don’t like Apple products, although mainly I cover MacBook here. In addition, the problem with Outlook and AppleId seemed to be a special case worth of sharing. At the end of the day, you use whatever makes you productive! Except me, who I believe, is stuck with Mac at least for some unknown near future.</p><p>P.S. The title of the article was inspired from another and recommended-to-read article by Nikita Prokopov: “<a href="https://tonsky.me/blog/disenchantment/">Software disenchantment</a>”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fdb51ad1b977" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple trick to use and manage Toolbar with Fragments in Android]]></title>
            <link>https://medium.com/@badalov.turkhan/simple-trick-to-use-and-manage-toolbar-with-fragments-in-android-60107ae7e07a?source=rss-88472b1207d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/60107ae7e07a</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[fragments]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Turkhan Badalov]]></dc:creator>
            <pubDate>Fri, 12 Aug 2016 22:43:04 GMT</pubDate>
            <atom:updated>2016-08-12T22:43:04.153Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a96_mMnYBJmdCCP_gAbdDg.png" /></figure><p>Hi, guys! I have been recently searching about using Toolbar with Fragments, because I needed to set and then modify toolbar in Fragment after splash screen ends and new fragment appears. But the result I got was nothing like:</p><pre>((ActionBarActivity)getActivity()).setSupportActionBar(mToolbar);</pre><p>and with new AppCompatActivity:</p><pre>((AppCompatActivity)getActivity()).setSupportActionBar(mToolbar);</pre><p>using this directly in the Fragment code. But it didn’t help me. So I’ve found better solution that might help you to realize this feature. But before we go you need to know that this method uses only one toolbar along whole lifecycle of application. But no one prevents us to modify toolbar on each screen ;)</p><p>The idea is very simple like a piece of cake. We’ll use additional fragment with <a href="https://developer.android.com/reference/android/app/Fragment.html#setRetainInstance%28boolean%29">setRetainInstance(true)</a> called in onCreate method of fragment. The real purpose of this method is to change fragment’s behavior avoiding it to be recreated that means it saves all variables we initialized in the class which extends Fragment at any configuration changes. So why don’t we create toolbar once and pass it into retained fragment and then use it again at any part of code? That sounds great. All we need to do is just create seperate public class, let’s call it RetainFragment:</p><pre>public class RetainFragment extends Fragment {</pre><pre>private Object mObject;</pre><pre>/**</pre><pre>* Empty constructor as per the Fragment documentation</pre><pre>*/</pre><pre>public RetainFragment() {}</pre><pre>@Override</pre><pre>public void onCreate(Bundle savedInstanceState) {</pre><pre>super.onCreate(savedInstanceState);</pre><pre>// Make sure this Fragment is retained over a configuration change</pre><pre>setRetainInstance(true);</pre><pre>}</pre><pre>/**</pre><pre>* Store a single object in this Fragment.</pre><pre>*</pre><pre>* @param object The object to store</pre><pre>*/</pre><pre>public void setObject(Object object) {</pre><pre>mObject = object;</pre><pre>}</pre><pre>/**</pre><pre>* Get the stored object.</pre><pre>*</pre><pre>* @return The stored object</pre><pre>*/</pre><pre>public Object getObject() {</pre><pre>return mObject;</pre><pre>}</pre><pre>}</pre><p>After we can write somewhere in our project public static function that returns us already created instance of RetainFragment or in other case creates it if it has not done yet. This is our public static method:</p><pre>public static RetainFragment findOrCreateRetainFragment(FragmentManager fm) {</pre><pre>// Check to see if we have retained the worker fragment.</pre><pre>RetainFragment mRetainFragment = (RetainFragment)fm.findFragmentByTag(&amp;quot;Retain&amp;quot;);</pre><pre>// If not retained (or first time running), we need to create and add it.</pre><pre>if (mRetainFragment == null) {</pre><pre>mRetainFragment = new RetainFragment();</pre><pre>fm.beginTransaction().add(mRetainFragment, &amp;quot;Retain&amp;quot;).commitAllowingStateLoss();</pre><pre>}</pre><pre>return mRetainFragment;</pre><pre>}</pre><p>The most part of code is done. Now we only have to call method findOrCreateRetainFragment(FragmentManager fm) anywhere we need this fragment. But we completely forgot about toolbar. How to pass it into RetainFragment? Simply, just in onCreate method of your MainActivity call findOrCreateRetainFragment, and then using setObject() method of the instance send your toolbar as the argument. That’s all. Whenever you need your toolbar you again call first findOrCreateRetainFragment() and then getObject() using explicit casting. That’s example code, where CommonData is some public class with defined static method findOrCreateRetainFragment into it:</p><pre>Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar);</pre><pre>setSupportActionBar(toolbar);</pre><pre>getSupportActionBar().setDisplayShowTitleEnabled(false);</pre><pre>RetainFragment rf = CommonData.findOrCreateRetainFragment(getSupportFragmentManager());</pre><pre>rf.setObject(getSupportActionBar());</pre><p>Using toolbar somewhere in different class:</p><pre>RetainFragment rf = CommonData.findOrCreateRetainFragment(getFragmentManager());</pre><pre>((ActionBar)rf.getObject()).setLogo(R.drawable.myapp_ico);</pre><p>That’s all.Hope you found this article useful for you. Note, that you can use this “trick” not only with toolbar, of course. Just use it anytime you need to save some instance, and even array of completely different objects. Of course, it’s not professional to use this technique at all places of your code instead of creating appropriate constructors of classes to pass objects as arguments. So, think twice before using it. If you have any ideas about this problem, write comments — it will be interesting to read other solutions. And, of course, ask questions if you have any.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60107ae7e07a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A little cheat if your HDD has bad sectors and you don’t want to buy the new one]]></title>
            <link>https://medium.com/@badalov.turkhan/a-little-cheat-if-your-hdd-has-bad-sectors-and-you-dont-want-to-buy-the-new-one-6a39ce323307?source=rss-88472b1207d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a39ce323307</guid>
            <category><![CDATA[partitioning]]></category>
            <category><![CDATA[hdd]]></category>
            <category><![CDATA[bad-sectors]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Turkhan Badalov]]></dc:creator>
            <pubDate>Mon, 01 Aug 2016 21:57:29 GMT</pubDate>
            <atom:updated>2016-08-01T22:06:08.528Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*gmgzmhO53dIL7KJ-04x6XA.png" /></figure><p>Hello, reader. This article is not about how to save your HDD or repair it. Instead, if you want to use the old one with bad sectors and don’t want to buy a new one then this article is for you.</p><p>Before I start you need to know there is one catch: your bad sectors must be arranged continuously as it is possible and optionally either at the beginnings of HDD(where partitions start, i.e. 2048), somewhere in the middle or at the end. Maybe somebody has already got the idea — we’ll partition HDD using custom sectors not touching bad sectors. For example, you have bad sectors at 159996, 159997, 159998, 159999 from 900000000(and many zeros)+ available sectors. So we can just skip beginning and start our partitions from 160000 (but I recommend to skip another one thousand).</p><p>Let’s implement it. We’ll do this by tool called <strong>fdisk</strong> on Linux. You can just follow steps below and get your result.</p><p>First, we need to find our disk. Switch to super user in bash and simply write:</p><pre># fdisk -l</pre><p>That will show us the list of all available disks. Find your disk, let’s take it is /dev/sda.</p><p>Then we write:</p><pre># fdisk /dev/sda</pre><p>We set our HDD as an argument for fdisk. Then in the menu of fdisk we just delete all partitions by pressing “d+Enter” combination several times until all partitions are deleted.</p><p>Here start the most interesting part: creation of a new partition.</p><ol><li>Press “n” button in the menu of fdisk and then choose the type of partition (primary or extended). We choose primary by entering “p”.</li><li>Then enter the number of partition. You can just put Enter to set default number that increases continuously starting from 1.</li><li>And finally choose <em>First sector </em>from wich our partition will start. As we said above we enter 160000. Press Enter.</li><li>Set the end sector. Instead you can just enter the size of partition like: +200G, for 200GiB size of partition. Press Enter.</li><li>That’s done! Now your partitions will not intersect with bad sectors.</li></ol><p>Example:</p><pre>Command (m for help): n<br>Partition type<br>   p   primary (3 primary, 0 extended, 1 free)<br>   e   extended (container for logical partitions)<br>Select (default e): p</pre><pre>Selected partition 4<br>First sector (2048-999999999, default 2048): 160000<br>Last sector, +sectors or +size{K,M,G,T,P} (2523136-7679999, default 7679999): +200G</pre><pre>Created a new partition 4 of type &#39;Linux&#39; and of size 200 GiB.</pre><p>Then you can change the type of partition by pressing t and choosing from the list available types, like 86 — NTFS, b — FAT32 and so on. Press w to write all changes and exit the program. Or you can quite without saving pressing ‘q’. For more options press ‘m’ to show help menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*x_2CMe_sahwLoLc4T-koBA.gif" /></figure><p>That’s all I wanted to show you in this article. Note that it is not the best idea to use such HDD for further use. But it somehow helps to avoid errors and hdd slowdowns trying to access bad sectors. Hope, you’ll find this article interesting and useful. Feel free to leave comments and ask questions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a39ce323307" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>