<?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 Sumit Kumar Sharan on Medium]]></title>
        <description><![CDATA[Stories by Sumit Kumar Sharan on Medium]]></description>
        <link>https://medium.com/@sharansumitkumar?source=rss-53e7a17f5389------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*vqpjcaZVYYeN0-SE</url>
            <title>Stories by Sumit Kumar Sharan on Medium</title>
            <link>https://medium.com/@sharansumitkumar?source=rss-53e7a17f5389------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 13:33:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sharansumitkumar/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[How to create rust binary]]></title>
            <link>https://sharansumitkumar.medium.com/how-to-create-rust-binary-d6f2e29bd2e6?source=rss-53e7a17f5389------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6f2e29bd2e6</guid>
            <dc:creator><![CDATA[Sumit Kumar Sharan]]></dc:creator>
            <pubDate>Sat, 15 Aug 2026 11:26:31 GMT</pubDate>
            <atom:updated>2026-08-15T11:26:31.006Z</atom:updated>
            <content:encoded><![CDATA[<p>I created the Linux x86_64 build on your Apple Silicon Mac using Rust’s Linux target, Zig as the cross-linker, and cargo-zigbuild.</p><p>From the server project directory:</p><pre>cd /Users/amitsharan/rustProject/quiz/quiznaire_server</pre><p>Install the Linux Rust target:</p><pre>rustup target add x86_64-unknown-linux-gnu</pre><p>Install Zig if needed:</p><pre>brew install zig</pre><p>Install cargo-zigbuild:</p><pre>cargo install cargo-zigbuild --locked</pre><p>Build the Linux release binaries:</p><pre>cargo zigbuild \<br>  --release \<br>  --target x86_64-unknown-linux-gnu \<br>  --locked</pre><p>The binaries are generated in:</p><pre>target/x86_64-unknown-linux-gnu/release/</pre><p>Specifically:</p><pre>quiznaire-server<br>quiznaire-migrate<br>quiznaire-create-admin</pre><p>I then packaged them without macOS extended attributes:</p><pre>mkdir -p dist</pre><pre>COPYFILE_DISABLE=1 tar --no-xattrs \<br>  -C target/x86_64-unknown-linux-gnu/release \<br>  -czf dist/quiznaire-server-0.1.0-x86_64-linux.tar.gz \<br>  quiznaire-server \<br>  quiznaire-migrate \<br>  quiznaire-create-admin</pre><p>Verify the resulting binaries and archive:</p><pre>file target/x86_64-unknown-linux-gnu/release/quiznaire-server</pre><pre>tar -tzf dist/quiznaire-server-0.1.0-x86_64-linux.tar.gz<br>shasum -a 256 dist/quiznaire-server-0.1.0-x86_64-linux.tar.gz</pre><p>For future releases, the short sequence is:</p><pre>cd /Users/amitsharan/rustProject/quiz/quiznaire_server</pre><pre>cargo zigbuild --release \<br>  --target x86_64-unknown-linux-gnu \<br>  --locked<br>COPYFILE_DISABLE=1 tar --no-xattrs \<br>  -C target/x86_64-unknown-linux-gnu/release \<br>  -czf dist/quiznaire-server-0.1.0-x86_64-linux.tar.gz \<br>  quiznaire-server quiznaire-migrate quiznaire-create-admin</pre><p>The .env and TLS certificate files are not included in the archive. They must be placed separately on the Linux server.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6f2e29bd2e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Sync Two Directories Between Two Different Devices Using rsync]]></title>
            <link>https://sharansumitkumar.medium.com/how-to-sync-two-directories-between-two-different-devices-using-rsync-f6ba7b27a694?source=rss-53e7a17f5389------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6ba7b27a694</guid>
            <category><![CDATA[rsync]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[rsync-command]]></category>
            <dc:creator><![CDATA[Sumit Kumar Sharan]]></dc:creator>
            <pubDate>Thu, 16 Jul 2026 16:07:31 GMT</pubDate>
            <atom:updated>2026-07-19T09:32:13.897Z</atom:updated>
            <content:encoded><![CDATA[<p>If you regularly work across multiple computers, you’ve probably needed to keep a project folder synchronized between them. Instead of copying files manually or using cloud storage, rsync is one of the fastest and most efficient tools available.</p><p>Recently, I used the following command to synchronize my Flutter SDK from one machine to another over a local network:</p><pre>rsync -avz --delete \<br>  --exclude=&#39;.git/&#39; \<br>  --exclude=&#39;bin/cache/&#39; \<br>  --exclude=&#39;.dart_tool/&#39; \<br>  --exclude=&#39;**/build/&#39; \<br>  /Users/amitsharan/development/flutter/ \<br>  sumit@192.168.1.9:/apps/flutter/</pre><p>Let’s break down what every part of this command does.</p><h3>What is rsync?</h3><p>rsync (Remote Sync) is a command-line utility that efficiently transfers and synchronizes files between two locations.</p><p>Unlike a normal copy operation, rsync only transfers the differences between the source and destination, making it incredibly fast for repeated synchronizations.</p><p>It works both:</p><ul><li>Between two directories on the same computer</li><li>Between two different computers over SSH</li></ul><h3>Understanding the Command</h3><h3>-a — Archive Mode</h3><pre>-a</pre><p>Archive mode preserves:</p><ul><li>File permissions</li><li>Ownership</li><li>Symbolic links</li><li>Timestamps</li><li>Directory structure</li></ul><p>This is the recommended mode for backups and synchronization.</p><h3>-v — Verbose Output</h3><pre>-v</pre><p>Displays every file being processed so you can monitor the synchronization.</p><h3>-z — Compress Data</h3><pre>-z</pre><p>Compresses file data during transfer.</p><p>This is especially useful when syncing over slower networks because it reduces bandwidth usage.</p><h3>-n — Dry Run</h3><pre>-n</pre><p>One of the safest options.</p><p>It <strong>does not copy or delete anything</strong>.</p><p>Instead, it simply shows what <strong>would happen</strong> if the command were executed.</p><p>Always use -n first before removing it for a real synchronization.</p><h3>--delete</h3><pre>--delete</pre><p>Deletes files from the destination that no longer exist in the source.</p><p>Without this option:</p><pre>Source:<br>A<br>B</pre><pre>Destination:<br>A<br>B<br>C</pre><p>After syncing:</p><pre>Destination:<br>A<br>B<br>C</pre><p>With --delete:</p><pre>Destination:<br>A<br>B</pre><p>This keeps both directories as exact mirrors.</p><p><strong>Use with caution</strong>, since deleted files on the destination cannot be recovered unless you have backups.</p><h3>Excluding Unnecessary Files</h3><h3>Ignore Git Metadata</h3><pre>--exclude=&#39;.git/&#39;</pre><p>Skips the Git repository history.</p><p>There’s usually no need to transfer Git metadata if you’re only interested in the project files.</p><h3>Ignore Flutter Cache</h3><pre>--exclude=&#39;bin/cache/&#39;</pre><p>Flutter’s cache can be several gigabytes.</p><p>It can easily be regenerated by running:</p><pre>flutter doctor</pre><p>or</p><pre>flutter precache</pre><p>Skipping it saves a lot of transfer time.</p><h3>Ignore Dart Build Cache</h3><pre>--exclude=&#39;.dart_tool/&#39;</pre><p>This directory contains generated files and package metadata.</p><p>It is automatically recreated whenever you run Flutter or Dart commands.</p><h3>Ignore Build Outputs</h3><pre>--exclude=&#39;**/build/&#39;</pre><p>Every Flutter project contains generated build folders.</p><p>These can be recreated at any time using:</p><pre>flutter build</pre><p>or</p><pre>flutter run</pre><p>There’s no need to transfer them.</p><h3>Source Directory</h3><pre>/Users/amitsharan/development/flutter/</pre><p>This is the directory being synchronized.</p><p>Notice the trailing slash (/).</p><p>A trailing slash means:</p><blockquote><em>Copy the </em><strong><em>contents</em></strong><em> of the directory.</em></blockquote><p>Without the trailing slash:</p><pre>flutter</pre><p>the entire folder itself would be copied.</p><p>This small detail changes the behavior significantly.</p><h3>Destination</h3><pre>sumit@192.168.1.9:/apps/flutter/</pre><p>This tells rsync to copy files over SSH.</p><p>It consists of:</p><ul><li><strong>sumit</strong> → Remote username</li><li><strong>192.168.1.9</strong> → Remote device IP address</li><li><strong>/apps/flutter/</strong> → Destination directory</li></ul><p>If SSH is configured correctly, rsync automatically uses it for secure file transfer.</p><h3>Running the Actual Sync</h3><p>Once you’ve verified the dry run looks correct, remove the -n option:</p><pre>rsync -avz --delete \<br>  --exclude=&#39;.git/&#39; \<br>  --exclude=&#39;bin/cache/&#39; \<br>  --exclude=&#39;.dart_tool/&#39; \<br>  --exclude=&#39;**/build/&#39; \<br>  /Users/amitsharan/development/flutter/ \<br>  sumit@192.168.1.9:/apps/flutter/</pre><p>This performs the actual synchronization.</p><h3>Why rsync is Better Than Copying Files</h3><p>rsync offers several advantages over a simple copy operation:</p><ul><li>Only changed files are transferred.</li><li>Preserves permissions and timestamps.</li><li>Supports compression during transfer.</li><li>Can delete obsolete files to maintain an exact mirror.</li><li>Works securely over SSH.</li><li>Ideal for backups, deployments, and keeping development environments synchronized.</li></ul><h3>Final Thoughts</h3><p>rsync is one of those tools every developer should have in their toolkit. Whether you&#39;re synchronizing source code, backing up a server, or keeping a Flutter SDK consistent across multiple machines, it provides a fast, reliable, and efficient workflow.</p><p>A simple habit can save you from accidental data loss:</p><blockquote><strong><em>Always run with </em></strong><strong><em>-n (dry run) first.</em></strong><em> Once you&#39;ve confirmed the changes, remove the flag to perform the actual synchronization.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6ba7b27a694" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Turn Any Old Linux PC Into a Network Storage Server Using SMB (And Access It From macOS, Windows…]]></title>
            <link>https://sharansumitkumar.medium.com/turn-any-old-linux-pc-into-a-network-storage-server-using-smb-and-access-it-from-macos-windows-20aad193f97b?source=rss-53e7a17f5389------2</link>
            <guid isPermaLink="false">https://medium.com/p/20aad193f97b</guid>
            <category><![CDATA[connection]]></category>
            <category><![CDATA[samba]]></category>
            <category><![CDATA[smb]]></category>
            <category><![CDATA[storage]]></category>
            <dc:creator><![CDATA[Sumit Kumar Sharan]]></dc:creator>
            <pubDate>Wed, 24 Jun 2026 12:51:38 GMT</pubDate>
            <atom:updated>2026-06-24T12:51:38.350Z</atom:updated>
            <content:encoded><![CDATA[<h3>Turn Any Old Linux PC Into a Network Storage Server Using SMB (And Access It From macOS, Windows, or Linux)</h3><h3>Why Buy a NAS When You Already Have a Spare Computer?</h3><p>Many of us have an old laptop, mini PC, Raspberry Pi, or Linux machine sitting unused.</p><p>Instead of letting it collect dust, you can transform it into a personal network storage server that every device in your home can access.</p><p>That’s exactly what I recently did:</p><ul><li>Linux machine → Storage Server</li><li>MacBook → Client</li><li>Connection → SMB (Server Message Block)</li></ul><p>The result?</p><p>✅ Access Linux files directly from Finder on macOS<br>✅ Transfer files over Wi-Fi or Ethernet<br>✅ No USB drives required<br>✅ Centralized storage for multiple devices<br>✅ Works with Windows, Linux, macOS, Android, and even Smart TVs</p><p>In this guide, we’ll start from the absolute basics and then explore some advanced concepts for experienced users.</p><h3>What Is SMB?</h3><p>SMB (Server Message Block) is a network file-sharing protocol.</p><p>Think of it like this:</p><p>Instead of physically plugging a hard drive into your Mac, SMB allows another computer on the network to appear as if it’s a local drive.</p><h3>Without SMB</h3><pre>Linux PC<br>   |<br> USB Drive<br>   |<br>Mac</pre><h3>With SMB</h3><pre>Linux PC (Storage Server)<br>        |<br>      Network<br>        |<br>Mac / Windows / Linux</pre><p>The storage remains connected to Linux, but every device can access it.</p><h3>Real-World Example</h3><p>Suppose you have:</p><h3>Linux Machine</h3><pre>Hostname: antix<br>IP Address: 192.168.1.12<br>Storage Folder:<br>/home/summy/storage</pre><h3>MacBook</h3><pre>IP Address: 192.168.1.100</pre><p>We want the MacBook to access:</p><pre>/home/summy/storage</pre><p>directly over the network.</p><h3>Step 1: Install Samba on Linux</h3><p>Samba is the open-source implementation of SMB.</p><p>On Debian, Ubuntu, antiX, MX Linux, and similar systems:</p><pre>sudo apt update<br>sudo apt install samba</pre><p>Verify installation:</p><pre>smbd --version</pre><p>Example:</p><pre>Version 4.22.0</pre><h3>Step 2: Create a Storage Folder</h3><p>Create a directory that will be shared.</p><pre>mkdir -p ~/storage</pre><p>Example:</p><pre>/home/summy/storage</pre><p>You can place:</p><ul><li>Movies</li><li>Photos</li><li>Documents</li><li>Backups</li><li>Project files</li></ul><p>inside this folder.</p><h3>Step 3: Configure Samba</h3><p>Open Samba configuration:</p><pre>sudo nano /etc/samba/smb.conf</pre><p>Add this section at the end:</p><pre>[Storage]<br>path = /home/summy/storage<br>browseable = yes<br>read only = no<br>guest ok = yes<br>create mask = 0777<br>directory mask = 0777</pre><p>Save the file.</p><h3>What Do These Settings Mean?</h3><h3>path</h3><p>Actual folder to share.</p><pre>path = /home/summy/storage</pre><h3>browseable</h3><p>Makes the share visible on the network.</p><pre>browseable = yes</pre><h3>read only</h3><p>Allows writing files.</p><pre>read only = no</pre><h3>guest ok</h3><p>Allows access without a password.</p><pre>guest ok = yes</pre><p>Useful for trusted home networks.</p><h3>Step 4: Restart Samba</h3><pre>sudo service smbd restart</pre><p>or</p><pre>sudo systemctl restart smbd</pre><p>depending on your Linux distribution.</p><p>Check status:</p><pre>sudo service smbd status</pre><p>or</p><pre>sudo systemctl status smbd</pre><h3>Step 5: Find Linux IP Address</h3><p>Run:</p><pre>ip addr</pre><p>or</p><pre>hostname -I</pre><p>Example output:</p><pre>192.168.1.12</pre><p>This is the address other devices will use.</p><h3>Step 6: Test SMB Server Locally</h3><p>Check if Samba is serving shares:</p><pre>smbclient -L localhost -N</pre><p>Expected output:</p><pre>Sharename       Type<br>---------------------<br>Storage         Disk</pre><p>If you see your share listed, Samba is working.</p><h3>Step 7: Connect From macOS</h3><p>On macOS:</p><p>Open Finder</p><p>Press:</p><pre>⌘ + K</pre><p>Enter:</p><pre>smb://192.168.1.12</pre><p>Click:</p><pre>Connect</pre><p>Choose:</p><pre>Guest</pre><p>or</p><pre>Registered User</pre><p>depending on your configuration.</p><p>The shared folder appears in Finder like a network drive.</p><h3>Step 8: Transfer Files</h3><p>Now simply drag and drop files.</p><p>Example:</p><pre>MacBook<br>  ↓<br>SMB Network<br>  ↓<br>Linux Storage</pre><p>or</p><pre>Linux Storage<br>  ↓<br>SMB Network<br>  ↓<br>MacBook</pre><p>No USB cable required.</p><h3>Using Ethernet vs Wi-Fi</h3><p>This is where performance matters.</p><h3>Wi-Fi</h3><p>Pros:</p><ul><li>Convenient</li><li>No cables</li></ul><p>Cons:</p><ul><li>Variable speed</li><li>Network interference</li></ul><p>Typical speeds:</p><pre>50–600 MBps</pre><p>depending on hardware.</p><h3>Gigabit Ethernet</h3><p>Pros:</p><ul><li>Stable</li><li>Faster</li><li>Lower latency</li></ul><p>Typical throughput:</p><pre>100–115 MB/s</pre><p>real-world transfer speed.</p><p>For large backups and media libraries, Ethernet is highly recommended.</p><h3>Checking If SMB Is Running</h3><p>Verify Samba processes:</p><pre>ps aux | grep smbd</pre><p>Check listening ports:</p><pre>sudo ss -tulpn | grep smbd</pre><p>Expected SMB ports:</p><pre>445<br>139</pre><p>You can also test from another machine:</p><pre>nc -zv 192.168.1.12 445</pre><p>If successful:</p><pre>Connection succeeded</pre><h3>Making the Share Secure</h3><p>Guest access is great for testing, but not ideal long term.</p><p>Create a Samba password:</p><pre>sudo smbpasswd -a summy</pre><p>Then update:</p><pre>guest ok = no<br>valid users = summy</pre><p>Restart Samba:</p><pre>sudo service smbd restart</pre><p>Now authentication is required.</p><h3>Mounting SMB Permanently on Linux</h3><p>Instead of browsing manually every time:</p><pre>sudo apt install cifs-utils</pre><p>Create mount point:</p><pre>sudo mkdir /mnt/storage</pre><p>Mount:</p><pre>sudo mount -t cifs \<br>//192.168.1.12/Storage \<br>/mnt/storage \<br>-o username=summy</pre><p>Now the network share behaves like a local directory.</p><h3>SMB vs External Hard Drive</h3><p>Feature :- USB Drive | SMB Storage</p><p>Multiple devices:- ❌ | ✅</p><p>Remote access:- ❌ | ✅</p><p>Expandable:- Limited | Easy</p><p>Cable swapping:- Required | Not Required</p><p>Centralized storage:- ❌ | ✅</p><h3>SMB vs NFS</h3><p>Many Linux users ask:</p><blockquote><em>Why not use NFS?</em></blockquote><h3>SMB</h3><p>Best for:</p><ul><li>Windows</li><li>macOS</li><li>Mixed environments</li></ul><h3>NFS</h3><p>Best for:</p><ul><li>Linux-only environments</li><li>Lower overhead</li><li>Better Unix permissions</li></ul><p>For a home network containing Mac, Windows, Linux, phones, and TVs, SMB is usually the simplest choice.</p><h3>Common Problems and Fixes</h3><h3>“Connection Refused”</h3><p>Check Samba:</p><pre>sudo service smbd status</pre><h3>“Host Unreachable”</h3><p>Verify IP:</p><pre>ping 192.168.1.12</pre><h3>macOS Keeps Asking for Password</h3><p>Try:</p><pre>Guest Login</pre><p>or remove old credentials from:</p><pre>Keychain Access</pre><h3>Slow Transfer Speeds</h3><p>Check:</p><ul><li>Wi-Fi signal</li><li>Ethernet cable quality</li><li>Router speed</li><li>Disk health</li><li>SMB version</li></ul><h3>Advanced Tips for Power Users</h3><h3>Dedicated Storage Disk</h3><p>Mount a separate SSD:</p><pre>/mnt/storage</pre><p>and share that path instead of your home directory.</p><h3>Static IP</h3><p>Reserve an IP in your router:</p><pre>192.168.1.12</pre><p>This prevents the server address from changing.</p><h3>Jumbo Frames</h3><p>For large file transfers on Gigabit networks:</p><pre>MTU 9000</pre><p>can reduce CPU overhead.</p><h3>RAID Storage</h3><p>Combine multiple drives using:</p><pre>RAID1<br>RAID5<br>RAID10</pre><p>for redundancy and capacity.</p><h3>Time Machine Backups</h3><p>macOS can even use SMB shares as backup destinations when configured correctly.</p><h3>Final Thoughts</h3><p>A dedicated NAS device is nice, but for many people it’s unnecessary.</p><p>A spare Linux machine with Samba can become:</p><ul><li>Personal cloud storage</li><li>Backup server</li><li>Media server</li><li>File synchronization hub</li><li>Development file server</li></ul><p>With just a few commands, an old computer can provide terabytes of network-accessible storage to every device in your home.</p><p>If you have an unused Linux machine lying around, this is one of the most practical projects you can build in under 30 minutes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20aad193f97b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Turn Wi-Fi On and Off from the Terminal in antiX Linux]]></title>
            <link>https://sharansumitkumar.medium.com/how-to-turn-wi-fi-on-and-off-from-the-terminal-in-antix-linux-4be42c114b9c?source=rss-53e7a17f5389------2</link>
            <guid isPermaLink="false">https://medium.com/p/4be42c114b9c</guid>
            <category><![CDATA[antix-linux]]></category>
            <dc:creator><![CDATA[Sumit Kumar Sharan]]></dc:creator>
            <pubDate>Wed, 24 Jun 2026 12:19:22 GMT</pubDate>
            <atom:updated>2026-06-24T12:34:42.818Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kRsOOE4UWp0bXGenQ-ubiQ.png" /></figure><p>If you’re using antiX Linux, Wi-Fi is typically managed by <strong>Connman</strong> rather than NetworkManager. This makes it easy to control your wireless connection directly from the terminal.</p><h3>Check Wi-Fi Status</h3><p>To view the current state of your Wi-Fi adapter:</p><pre>connmanctl technologies</pre><p>Look for the Wi-Fi section:</p><pre>Type = wifi<br>Powered = True</pre><p>If Powered is True, Wi-Fi is enabled. If it is False, Wi-Fi is disabled.</p><h3>Turn Wi-Fi Off</h3><p>Disable the wireless adapter:</p><pre>sudo connmanctl disable wifi</pre><p>Verify the change:</p><pre>connmanctl technologies</pre><p>Expected output:</p><pre>Type = wifi<br>Powered = False</pre><h3>Turn Wi-Fi On</h3><p>Enable the wireless adapter:</p><pre>sudo connmanctl enable wifi</pre><p>Verify:</p><pre>connmanctl technologies</pre><p>Expected output:</p><pre>Type = wifi<br>Powered = True</pre><h3>Disconnect from the Current Wi-Fi Network</h3><p>First, list available and connected networks:</p><pre>connmanctl services</pre><p>Example output:</p><pre>*AO MyHomeWiFi wifi_7077815c7849_xxxxxxxxx_managed_psk</pre><p>Disconnect from the network:</p><pre>connmanctl disconnect wifi_7077815c7849_xxxxxxxxx_managed_psk</pre><h3>Reconnect to a Saved Wi-Fi Network</h3><p>Use the service identifier shown by connmanctl services:</p><pre>connmanctl connect wifi_7077815c7849_xxxxxxxxx_managed_psk</pre><p>If the network has been saved previously, Connman will reconnect automatically without asking for the password.</p><h3>Restart Wi-Fi with a Single Command</h3><p>A quick way to refresh the wireless connection:</p><pre>sudo connmanctl disable wifi &amp;&amp; sleep 2 &amp;&amp; sudo connmanctl enable wifi</pre><p>This is useful when troubleshooting connectivity issues or forcing a rescan of nearby networks.</p><h3>Alternative Method: Control the Interface Directly</h3><p>If you need lower-level control, you can bring the Wi-Fi interface down and back up using standard Linux networking commands.</p><p>Find the interface name:</p><pre>ip link</pre><p>Typical output:</p><pre>wlan0</pre><p>Disable the interface:</p><pre>sudo ip link set wlan0 down</pre><p>Enable the interface:</p><pre>sudo ip link set wlan0 up</pre><p>This method works regardless of which network manager is installed.</p><h3>Conclusion</h3><p>For antiX users, Connman provides a simple and reliable way to manage Wi-Fi entirely from the terminal. Whether you need to disable Wi-Fi, reconnect to a network, or troubleshoot connectivity problems, a few commands are all it takes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4be42c114b9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Replace the Gradle Wrapper Version Across All Android Projects at Once]]></title>
            <link>https://sharansumitkumar.medium.com/how-to-replace-the-gradle-wrapper-version-across-all-android-projects-at-once-eb9352f5af85?source=rss-53e7a17f5389------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb9352f5af85</guid>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Sumit Kumar Sharan]]></dc:creator>
            <pubDate>Wed, 03 Jun 2026 09:13:55 GMT</pubDate>
            <atom:updated>2026-06-03T09:58:20.077Z</atom:updated>
            <content:encoded><![CDATA[<p>If you manage multiple Android or Flutter projects, updating the Gradle wrapper manually in every project can become repetitive and time-consuming.</p><p>Here’s a quick macOS/Linux shell script that automatically finds every project using a specific Gradle version and replaces it with a newer one.</p><h3>Problem</h3><p>Suppose all your projects currently use:</p><pre>gradle-9.5.1-bin.zip</pre><p>And you want to upgrade everything to:</p><pre>gradle-9.6.0-bin.zip</pre><p>Normally, you would need to edit every:</p><pre>gradle/wrapper/gradle-wrapper.properties</pre><p>file manually.</p><p>Instead, you can automate the entire process with a single command.</p><h3>The Script</h3><pre># Replace Gradle wrapper version across all projects</pre><pre>grep -rl &quot;gradle-9.5.1-bin.zip&quot; /path/to/projects/ 2&gt;/dev/null | while read f; do<br>  sed -i &#39;&#39; &#39;s|gradle-9\.5\.1-bin\.zip|gradle-9.6.0-rc-1-bin.zip|g&#39; &quot;$f&quot;<br>done</pre><pre>echo &quot;Done. Verifying:&quot;</pre><pre>grep -rl &quot;gradle-9.6.0-bin.zip&quot; /path/to/projects/ 2&gt;/dev/null</pre><h3>What This Script Does</h3><h3>1. Search All Projects</h3><pre>grep -rl &quot;gradle-9.5.1-bin.zip&quot; /path/to/projects/</pre><p>This recursively searches all files inside your project directory and finds files containing:</p><pre>gradle-9.5.1-bin.zip</pre><p>The flags mean:</p><ul><li>-r → recursive search</li><li>-l → print only matching file names</li></ul><h3>2. Replace the Old Gradle Version</h3><pre>sed -i &#39;&#39; &#39;s|old|new|g&#39;</pre><p>This updates the matching Gradle version in-place.</p><p>Example replacement:</p><pre>gradle-9.5.1-bin.zip<br>↓<br>gradle-9.6.0-bin.zip</pre><p>The g flag ensures all matches in the file are replaced.</p><h3>3. Verify the Update</h3><pre>grep -rl &quot;gradle-9.6.0-bin.zip&quot;</pre><p>This confirms which files were successfully updated.</p><h3>Why This Is Useful</h3><p>This approach is especially helpful if you:</p><ul><li>Maintain many Android projects</li><li>Work with multiple Flutter apps</li><li>Use monorepos</li><li>Frequently test newer Gradle releases</li><li>Need to standardize Gradle versions across teams</li></ul><h3>Important Notes</h3><h3>macOS vs Linux</h3><p>The script above uses macOS-compatible sed syntax:</p><pre>sed -i &#39;&#39;</pre><p>If you’re using Linux, use:</p><pre>sed -i</pre><p>instead.</p><h3>Safer Alternative (Preview Before Replacing)</h3><p>If you want to preview affected files first:</p><pre>grep -rl &quot;gradle-9.5.1-bin.zip&quot; path/to/projects/</pre><p>Then run the replacement afterward.</p><h3>Bonus Tip</h3><p>You can generalize this into a reusable shell function:</p><pre>update_gradle() {<br>  OLD=$1<br>  NEW=$2<br>  ROOT=$3</pre><pre>  grep -rl &quot;$OLD&quot; &quot;$ROOT&quot; 2&gt;/dev/null | while read f; do<br>    sed -i &#39;&#39; &quot;s|$OLD|$NEW|g&quot; &quot;$f&quot;<br>  done</pre><pre>  echo &quot;Updated $OLD → $NEW&quot;<br>}</pre><p>Usage:</p><pre>update_gradle &quot;gradle-9.5.1-bin.zip&quot; &quot;gradle-9.6.0-bin.zip&quot; ~/StudioProjects</pre><h3>Final Thoughts</h3><p>When managing lots of Android or Flutter projects, small automation scripts like this save a surprising amount of time.</p><p>Instead of opening dozens of gradle-wrapper.properties files manually, you can update everything in seconds with a single command.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb9352f5af85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to fix x86_64-linux-android-ar Not found Error]]></title>
            <link>https://sharansumitkumar.medium.com/how-to-fix-x86-64-linux-android-ar-not-found-error-f5d0d85a4650?source=rss-53e7a17f5389------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5d0d85a4650</guid>
            <dc:creator><![CDATA[Sumit Kumar Sharan]]></dc:creator>
            <pubDate>Thu, 26 Feb 2026 18:28:25 GMT</pubDate>
            <atom:updated>2026-02-26T18:28:25.799Z</atom:updated>
            <content:encoded><![CDATA[<p>NDK_BIN=~/Library/Android/sdk/ndk/&lt;version&gt;/toolchains/llvm/prebuilt/darwin-x86_64/bin</p><p>ln -sf $NDK_BIN/llvm-ar $NDK_BIN/x86_64-linux-android-ar<br>ln -sf $NDK_BIN/llvm-ar $NDK_BIN/aarch64-linux-android-ar<br>ln -sf $NDK_BIN/llvm-ar $NDK_BIN/arm-linux-androideabi-ar<br>ln -sf $NDK_BIN/llvm-ar $NDK_BIN/i686-linux-android-ar</p><p>export ANDROID_NDK_HOME=$HOME/Library/Android/sdk/ndk/&lt;version&gt;<br>export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin:$PATH</p><p>which x86_64-linux-android-ar<br># should print the NDK bin path, not “not found”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5d0d85a4650" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Practical Guide to Using OpenSearch on Linux, Windows, and macOS]]></title>
            <link>https://sharansumitkumar.medium.com/a-practical-guide-to-using-opensearch-on-linux-windows-and-macos-662a11d5e996?source=rss-53e7a17f5389------2</link>
            <guid isPermaLink="false">https://medium.com/p/662a11d5e996</guid>
            <category><![CDATA[opensearch-serverless]]></category>
            <category><![CDATA[opensearch-dashboard]]></category>
            <category><![CDATA[opensearch]]></category>
            <dc:creator><![CDATA[Sumit Kumar Sharan]]></dc:creator>
            <pubDate>Sat, 24 Jan 2026 15:23:24 GMT</pubDate>
            <atom:updated>2026-01-24T15:23:24.720Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*olOxaQW0l89ZS4i6g0xIhQ.png" /></figure><p>Search is no longer just about finding text. Today we use search engines to power <strong>e-commerce</strong>, <strong>location discovery</strong>, <strong>log analytics</strong>, <strong>recommendation systems</strong>, and even <strong>AI-driven search experiences</strong>.</p><p>OpenSearch is a powerful, open-source, community-driven search and analytics engine that grew out of Elasticsearch 7.10 — and it has rapidly become a solid, production-grade choice.</p><p>This guide walks you through:</p><ul><li>Installing OpenSearch on <strong>Linux, macOS, and Windows</strong></li><li>Understanding core concepts</li><li>Indexing and searching data</li><li>Performance tuning and relevance</li><li>Advanced features like analyzers, scoring, and security</li></ul><p>If you’re building serious search — this article is for you.</p><h3>What Is OpenSearch?</h3><p>OpenSearch is:</p><ul><li><strong>Distributed</strong> (scales horizontally)</li><li><strong>Near real-time</strong></li><li><strong>Schema-flexible</strong></li><li><strong>REST-based</strong></li><li>Built on <strong>Apache Lucene</strong></li></ul><p>It supports:</p><ul><li>Full-text search</li><li>Filters &amp; aggregations</li><li>Geo search</li><li>Vector (k-NN) search</li><li>Log &amp; metrics analytics</li></ul><h3>Core Concepts (Read This Once — Saves You Weeks)|</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U2FaMMAig7y2QyMa_DE7dw.png" /></figure><h3>Installation</h3><p>OpenSearch runs on <strong>Java 21+</strong> (bundled in official packages).</p><p>1️⃣ Linux (Debian / Ubuntu)</p><p>Install</p><pre>curl -fsSL https://artifacts.opensearch.org/publickeys/opensearch.pgp \<br> | sudo gpg --dearmor -o /usr/share/keyrings/opensearch-keyring.gpg<br><br>echo &quot;deb [signed-by=/usr/share/keyrings/opensearch-keyring.gpg] \<br>https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main&quot; \<br>| sudo tee /etc/apt/sources.list.d/opensearch.list<br><br>sudo apt update<br>sudo apt install opensearch</pre><h4>Start</h4><pre>sudo systemctl start opensearch<br>sudo systemctl enable opensearch</pre><p>Verify</p><pre>curl https://localhost:9200 -ku &#39;admin:admin&#39;</pre><p>2️⃣ macOS (Homebrew)</p><p>Install</p><pre>brew tap opensearch-project/opensearch<br>brew install opensearch</pre><p>Start</p><pre>brew services start opensearch<br># or<br>opensearch</pre><p>3️⃣ Windows</p><h3>Steps</h3><ol><li>Download ZIP from official OpenSearch releases</li><li>Extract</li><li>Run:</li></ol><pre>.\bin\opensearch.bat</pre><p>⚠️ Tip: Increase heap memory in config/jvm.options.</p><h3>OpenSearch Dashboard (Optional but Recommended)</h3><h4>Think of it as Kibana for OpenSearch.</h4><ul><li>URL: <a href="http://localhost:5601/">http://localhost:5601</a></li><li>Comes with visual query builders, dashboards, and index tools</li></ul><h3><strong>Creating Your First Index</strong></h3><pre>PUT products<br>{<br>  &quot;settings&quot;: {<br>    &quot;number_of_shards&quot;: 3,<br>    &quot;number_of_replicas&quot;: 1<br>  }<br>}</pre><h3><strong>Indexing Documents</strong></h3><pre>POST products/_doc/1<br>{<br>  &quot;name&quot;: &quot;Organic Apples&quot;,<br>  &quot;price&quot;: 120,<br>  &quot;category&quot;: &quot;fruits&quot;,<br>  &quot;available&quot;: true<br>}</pre><p>Bulk indexing (⚡ important for performance):</p><pre>POST _bulk<br>{&quot;index&quot;:{&quot;_index&quot;:&quot;products&quot;,&quot;_id&quot;:1}}<br>{&quot;name&quot;:&quot;Banana&quot;,&quot;price&quot;:40}<br>{&quot;index&quot;:{&quot;_index&quot;:&quot;products&quot;,&quot;_id&quot;:2}}<br>{&quot;name&quot;:&quot;Apple&quot;,&quot;price&quot;:120}</pre><h3><strong>Basic Search</strong></h3><pre>GET products/_search<br>{<br>  &quot;query&quot;: {<br>    &quot;match&quot;: {<br>      &quot;name&quot;: &quot;apple&quot;<br>    }<br>  }<br>}</pre><h3><strong>Filters vs Queries (Very Important)</strong></h3><p>Filter (fast, cached, no scoring)</p><pre>&quot;filter&quot;: {<br>  &quot;term&quot;: { &quot;available&quot;: true }<br>}</pre><p>Query (scoring applied)</p><pre>&quot;match&quot;: {<br>  &quot;name&quot;: &quot;apple&quot;<br>}</pre><p><strong>👉 Rule of thumb</strong></p><ul><li>Use filters for status, category, price range</li><li>Use queries for user intent text</li></ul><h3>Mapping &amp; Analyzers (Search Quality Starts Here)</h3><p><strong>Custom Mapping</strong></p><pre>PUT products<br>{<br>  &quot;mappings&quot;: {<br>    &quot;properties&quot;: {<br>      &quot;name&quot;: {<br>        &quot;type&quot;: &quot;text&quot;,<br>        &quot;analyzer&quot;: &quot;standard&quot;,<br>        &quot;fields&quot;: {<br>          &quot;keyword&quot;: { &quot;type&quot;: &quot;keyword&quot; }<br>        }<br>      }<br>    }<br>  }<br>}</pre><p><strong>Why this matters</strong></p><ul><li>text → searchable</li><li>keyword → sortable, aggregatable</li></ul><h3>Sorting &amp; Pagination</h3><pre>{<br>  &quot;from&quot;: 0,<br>  &quot;size&quot;: 10,<br>  &quot;sort&quot;: [<br>    { &quot;price&quot;: &quot;asc&quot; }<br>  ]<br>}</pre><p>⚠️ Avoid deep pagination → use <strong>search_after</strong> in production.</p><h3>OpenSearch Pagination for Beginners</h3><p>Why <strong><em>from + size</em></strong> Breaks &amp; How <strong><em>search_after</em></strong> Fixes It</p><p>If you’re new to <strong>OpenSearch</strong> (or Elasticsearch), pagination looks simple at first:</p><pre>{<br>  &quot;from&quot;: 0,<br>  &quot;size&quot;: 10<br>}</pre><p>Then you see this warning:</p><blockquote>⚠️ Avoid deep pagination → use search_after in production</blockquote><p>And suddenly things feel… scary.</p><p><strong>The beginner problem: “Why not just use page numbers?”</strong></p><p>Most of us come from SQL or REST APIs where pagination means:</p><ul><li>Page 1 → from = 0</li><li>Page 2 → from = 10</li><li>Page 500 → from = 4990</li></ul><p>So why does OpenSearch complain?</p><p>When you run this:</p><pre>{<br> &quot;from&quot;: 10000,<br> &quot;size&quot;: 10<br>}</pre><p>OpenSearch must:</p><ol><li>Find <strong>10,010 documents</strong></li><li>Sort all of them</li><li>Throw away the first <strong>10,000</strong></li><li>Return only 10</li></ol><p>This costs:</p><ul><li>CPU</li><li>Memory</li><li>Time</li></ul><p>As data grows, requests become <strong>slower and slower</strong> — until things break.</p><p>That’s why OpenSearch says:</p><blockquote><em>“Please don’t do deep pagination.”</em></blockquote><h3>The idea behind search_after (in plain English)</h3><p>Instead of saying:</p><blockquote><em>“Give me page 500”</em></blockquote><p>You say:</p><blockquote><em>“Give me the next results </em><strong><em>after this exact document</em></strong><em>”</em></blockquote><p>This is called <strong>cursor-based pagination</strong>.</p><p>You don’t jump pages.<br> You <strong>walk forward</strong>, step by step.</p><h3>The golden rule of search_after</h3><p>When using search_after:</p><ul><li>You <strong>must</strong> sort</li><li>Sorting must be <strong>stable</strong></li><li>Always add a <strong>tie-breaker</strong> (usually _id)</li></ul><h3>❌ Bad sort</h3><pre>&quot;sort&quot;: [{ &quot;price&quot;: &quot;asc&quot; }]</pre><h3>✅ Good sort</h3><pre>&quot;sort&quot;: [<br>  { &quot;price&quot;: &quot;asc&quot; },<br>  { &quot;_id&quot;: &quot;asc&quot; }<br>]</pre><p>Why?<br> Because many documents can have the same price.<br> _id guarantees uniqueness.</p><h3>Step 1: Fetch the first page</h3><pre>POST products/_search<br>{<br>  &quot;size&quot;: 10,<br>  &quot;sort&quot;: [<br>    { &quot;price&quot;: &quot;asc&quot; },<br>    { &quot;_id&quot;: &quot;asc&quot; }<br>  ],<br>  &quot;query&quot;: {<br>    &quot;match_all&quot;: {}<br>  }<br>}</pre><h3>Example response (simplified)</h3><pre>{<br>  &quot;hits&quot;: {<br>    &quot;hits&quot;: [<br>      {<br>        &quot;_id&quot;: &quot;A12&quot;,<br>        &quot;_source&quot;: { &quot;price&quot;: 100 },<br>        &quot;sort&quot;: [100, &quot;A12&quot;]<br>      },<br>      ...<br>      {<br>        &quot;_id&quot;: &quot;B87&quot;,<br>        &quot;_source&quot;: { &quot;price&quot;: 150 },<br>        &quot;sort&quot;: [150, &quot;B87&quot;]<br>      }<br>    ]<br>  }<br>}</pre><p>👉 <strong>Important:</strong><br> Save the sort value from the <strong>last document</strong>:</p><pre>[150, &quot;B87&quot;]</pre><p>This is your <strong>cursor</strong>.</p><h3>Step 2: Fetch the next page</h3><pre>POST products/_search<br>{<br>  &quot;size&quot;: 10,<br>  &quot;sort&quot;: [<br>    { &quot;price&quot;: &quot;asc&quot; },<br>    { &quot;_id&quot;: &quot;asc&quot; }<br>  ],<br>  &quot;search_after&quot;: [150, &quot;B87&quot;],<br>  &quot;query&quot;: {<br>    &quot;match_all&quot;: {}<br>  }<br>}</pre><p>This means:</p><blockquote><em>“Start AFTER price=150 and id=B87”</em></blockquote><p>No wasted work.</p><p>No skipping thousands of records.</p><h3>Step 3: Keep going</h3><p>Each response gives you a new sort value.</p><ul><li>Save it</li><li>Send it back as search_after</li><li>Repeat</li></ul><p>Perfect for:</p><ul><li>Infinite scroll</li><li>Feeds</li><li>Large datasets</li><li>APIs</li></ul><h3>Using filters with search_after</h3><pre>POST products/_search<br>{<br>  &quot;size&quot;: 20,<br>  &quot;query&quot;: {<br>    &quot;bool&quot;: {<br>      &quot;filter&quot;: [<br>        { &quot;term&quot;: { &quot;category&quot;: &quot;fruits&quot; } },<br>        { &quot;range&quot;: { &quot;price&quot;: { &quot;gte&quot;: 50 } } }<br>      ]<br>    }<br>  },<br>  &quot;sort&quot;: [<br>    { &quot;price&quot;: &quot;asc&quot; },<br>    { &quot;_id&quot;: &quot;asc&quot; }<br>  ],<br>  &quot;search_after&quot;: [120, &quot;X92&quot;]<br>}</pre><p>Filters work exactly the same.</p><h3>Important limitations (don’t skip this)</h3><h3>🚫 No random page jumping</h3><p>You <strong>cannot</strong> jump to page 300 directly.</p><p>This is not a bug.<br> This is the trade-off for performance.</p><p>If you need random access:</p><ul><li>Cache pages</li><li>Precompute offsets</li><li>Or rethink the U</li></ul><h3>What if data changes while paginating?</h3><p>If documents are:</p><ul><li>Added</li><li>Deleted</li><li>Updated</li></ul><p>Your results may slightly shift.</p><p>For <strong>guaranteed consistency</strong>, OpenSearch provides <strong>Point-In-Time (PIT)</strong>.</p><h3>Production-safe pagination: search_after + PIT</h3><p><strong>Create a PIT</strong></p><pre>POST /products/_pit?keep_alive=1m</pre><p>Response:</p><pre>{<br>  &quot;pit_id&quot;: &quot;9ToAwMD...&quot;<br>}</pre><p><strong>Use PIT with pagination</strong></p><pre>POST /_search<br>{<br>  &quot;size&quot;: 10,<br>  &quot;pit&quot;: {<br>    &quot;id&quot;: &quot;9ToAwMD...&quot;,<br>    &quot;keep_alive&quot;: &quot;1m&quot;<br>  },<br>  &quot;sort&quot;: [<br>    { &quot;price&quot;: &quot;asc&quot; },<br>    { &quot;_id&quot;: &quot;asc&quot; }<br>  ],<br>  &quot;search_after&quot;: [150, &quot;B87&quot;]<br>}</pre><p>Now your pagination is:</p><ul><li>Fast</li><li>Stable</li><li>Safe for production</li></ul><h3>Why PIT?</h3><p><strong>Without PIT: what can go wrong?</strong></p><p>Imagine products sorted by price:</p><pre>100<br>120<br>150   ← last item on page 1<br>200</pre><p>You fetch page 1.</p><p>Now, before page 2:</p><ul><li>A new product with price <strong>110</strong> is inserted</li></ul><p>The list becomes:</p><pre>100<br>110   ← new item<br>120<br>150<br>200</pre><p>Now when you fetch page 2 using search_after:</p><ul><li>You may <strong>see duplicates</strong></li><li>Or <strong>miss some items</strong></li></ul><p>That’s bad for:</p><ul><li>Pagination</li><li>Audits</li><li>User trust</li></ul><p><strong>With PIT: the data is frozen</strong></p><p>When you create a PIT:</p><ul><li>OpenSearch captures a <strong>snapshot reference</strong></li><li>All searches using that PIT see <strong>the same data</strong></li><li>New updates are invisible until PIT expires</li></ul><p>👉 This makes pagination <strong>predictable and safe</strong></p><h3>What PIT actually is (internally, simplified)</h3><p>Under the hood:</p><ul><li>OpenSearch pins <strong>Lucene segments</strong></li><li>Prevents them from being merged away</li><li>Gives you a stable view</li></ul><p>You <strong>don’t copy data</strong><br> You just <strong>hold references</strong></p><p>That’s why PIT is:</p><ul><li>Fast</li><li>Memory-efficient</li><li>Temporary</li></ul><h3>How long does a PIT live?</h3><p>PIT exists for a <strong>short time</strong>, e.g.:</p><pre>keep_alive=1m<br>keep_alive=5m</pre><p>Each request can <strong>extend its life</strong>.</p><p>If it expires:</p><ul><li>OpenSearch forgets the snapshot</li><li>You must create a new PIT</li></ul><h3>Basic PIT lifecycle (super simple)</h3><p>1️⃣ Create PIT<br> 2️⃣ Use PIT for all paginated searches<br> 3️⃣ Let PIT expire (or close it)</p><h3>Create a PIT</h3><pre>POST /products/_pit?keep_alive=1m</pre><p>Response:</p><pre>{<br>  &quot;pit_id&quot;: &quot;9ToAwMD...&quot;<br>}</pre><p>This pit_id is your <strong>frozen window into the data</strong>.</p><h3>Use PIT with search_after</h3><pre>POST /_search<br>{<br>  &quot;size&quot;: 10,<br>  &quot;pit&quot;: {<br>    &quot;id&quot;: &quot;9ToAwMD...&quot;,<br>    &quot;keep_alive&quot;: &quot;1m&quot;<br>  },<br>  &quot;sort&quot;: [<br>    { &quot;price&quot;: &quot;asc&quot; },<br>    { &quot;_id&quot;: &quot;asc&quot; }<br>  ],<br>  &quot;search_after&quot;: [150, &quot;B87&quot;]<br>}</pre><p>Every page request:</p><ul><li>Uses the same PIT</li><li>Sees the same data order</li><li>Remains consistent</li></ul><h3>When SHOULD you use PIT?</h3><p>Use PIT if:</p><ul><li>You paginate large datasets</li><li>You use search_after</li><li>Data changes frequently</li><li>You care about correctness</li></ul><p>Examples:</p><ul><li>E-commerce listings</li><li>Transaction logs</li><li>Admin dashboards</li><li>Reports</li><li>Feeds</li></ul><h3>When you DON’T need PIT</h3><p>You can skip PIT if:</p><ul><li>Data barely changes</li><li>You only fetch one page</li><li>Results don’t have to be perfect</li></ul><p>Example:</p><ul><li>Simple search pages</li><li>Static catalogs</li></ul><h3>Important warning (production tip)</h3><p>⚠️ PIT keeps segments alive.<br> Too many long-running PITs can increase disk usage.</p><p>Best practices:</p><ul><li>Short keep_alive</li><li>Close PITs you don’t need</li><li>One PIT per user/session</li></ul><blockquote><strong><em>Point-In-Time (PIT) = “Give me a temporary, frozen view of my data so pagination stays correct.”</em></strong></blockquote><h3>Why “Jump to Page N” is fundamentally expensive</h3><p>Page numbers assume this:</p><pre>Page 1 → skip 0<br>Page 2 → skip 10<br>Page 1000 → skip 9990</pre><p>In OpenSearch:</p><ul><li>Skipping means <strong>fetch + sort + discard</strong></li><li>Page N = O(N) cost</li><li>Page 10,000 = 💥</li></ul><p>That’s why:</p><ul><li>from + size is capped (index.max_result_window)</li><li>search_after refuses random jumps</li></ul><p>So… <strong>what do real systems do instead?</strong></p><h3>When should you use what?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MPLBPAeW4PJYulbpvKpvIw.png" /></figure><h3>Design Patterns That Replace “Jump to Page N”</h3><p>You don’t fix this with a better query.<br> You fix it with <strong>design</strong>.</p><p>Below are <strong>battle-tested patterns</strong> used by real products.</p><h3>✅ Pattern 1: Cursor bookmarks (Best general solution)</h3><h3>UX idea</h3><p>Instead of:</p><pre>Go to page 500</pre><p>You expose:</p><ul><li>Next</li><li>Previous</li><li>Remember position</li></ul><h3>How it works</h3><ul><li>Each page returns a <strong>cursor token</strong></li><li>Cursor = encoded search_after values (+ optional PIT)</li><li>Client stores cursors for visited pages</li></ul><h3>Example API</h3><pre>GET /products?limit=20&amp;cursor=eyJwcmljZSI6MTUwLCJpZCI6IkI4NyJ9</pre><p>Cursor decodes to:</p><pre>[150, &quot;B87&quot;]</pre><h3>Why this works</h3><ul><li>O(1) performance</li><li>Infinite scroll friendly</li><li>Used by Twitter, GitHub, Stripe</li></ul><p>🚫 No random jumps<br> ✅ Blazing fast and safe</p><h3>✅ Pattern 2: Filter instead of page number (Most underrated)</h3><h3>UX idea</h3><p>Users <em>think</em> they want page 500<br> They actually want <strong>“older”, “cheaper”, “earlier”</strong></p><p>Replace page numbers with:</p><ul><li>Price range</li><li>Date range</li><li>Alphabet range</li></ul><h3>Example</h3><p>Instead of:</p><pre>Page 300</pre><p>Offer:</p><pre>Price between 1000 – 1200</pre><h3>Query</h3><pre>{<br>  &quot;query&quot;: {<br>    &quot;range&quot;: {<br>      &quot;price&quot;: {<br>        &quot;gte&quot;: 1000,<br>        &quot;lt&quot;: 1200<br>      }<br>    }<br>  },<br>  &quot;sort&quot;: [<br>    { &quot;price&quot;: &quot;asc&quot; },<br>    { &quot;_id&quot;: &quot;asc&quot; }<br>  ]<br>}</pre><p>This is:</p><ul><li>Faster</li><li>User-intent driven</li><li>Search-native</li></ul><h3>✅ Pattern 3: Time-based anchors (Logs, feeds, history)</h3><p>Best for:</p><ul><li>Transactions</li><li>Logs</li><li>Activity feeds</li></ul><h3>UX</h3><pre>Jump to: January 2024</pre><h3>Query</h3><pre>{<br>  &quot;query&quot;: {<br>    &quot;range&quot;: {<br>      &quot;created_at&quot;: {<br>        &quot;lte&quot;: &quot;2024-01-01&quot;<br>      }<br>    }<br>  },<br>  &quot;sort&quot;: [<br>    { &quot;created_at&quot;: &quot;desc&quot; },<br>    { &quot;_id&quot;: &quot;asc&quot; }<br>  ]<br>}</pre><p>You jump by <strong>time</strong>, not by index.</p><h3>✅ Pattern 4: Cached checkpoints (True page numbers, limited)</h3><p>This is how <strong>Google-scale systems fake page numbers</strong>.</p><h3>Idea</h3><ul><li>Precompute checkpoints every K pages</li><li>Store last document’s sort key</li></ul><p>Example table:</p><pre>page 1   → null<br>page 100 → [150, &quot;B87&quot;]<br>page 200 → [310, &quot;C22&quot;]</pre><h3>Jump logic</h3><ul><li>Jump to nearest checkpoint</li><li>Use search_after from there</li><li>Walk forward a few pages</li></ul><h3>Trade-offs</h3><p>✅ Page numbers<br> ❌ Storage + complexity<br> ❌ Only approximate</p><p>Used for:</p><ul><li>Admin tools</li><li>Internal dashboards</li></ul><h3>🚫 Pattern 5: Offset pagination (Don’t do this)</h3><pre>{<br>  &quot;from&quot;: 90000,<br>  &quot;size&quot;: 10<br>}</pre><p>This:</p><ul><li>Burns CPU</li><li>Breaks under load</li><li>Will hit hard limits</li></ul><p>Only acceptable for:</p><ul><li>Small datasets (&lt;10k)</li><li>Internal testing</li></ul><h3>How big products handle this (truth bomb)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*woDQ4BeFghhqQM0IRlGFag.png" /></figure><p>No serious system offers <strong>unlimited page jumps</strong> on huge datasets.</p><h3>Decision table (use this)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cYJm2P2tSL6RKrzNpnEhrQ.png" /></figure><h3>The mindset shift (most important)</h3><blockquote><strong><em>Search engines are not databases.<br> Page numbers are a UI illusion, not a data primitive.</em></strong></blockquote><p>Once you design around <strong>intent instead of index</strong>, everything scales.</p><p><strong>Final takeaway</strong></p><blockquote><strong><em>search_after is not complicated.</em></strong><em><br> It just replaces page numbers with a cursor — and your system becomes fast and scalable.</em></blockquote><p>Once you understand this, OpenSearch pagination stops being scary.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=662a11d5e996" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to install Xcode in macos]]></title>
            <link>https://sharansumitkumar.medium.com/how-to-install-xcode-in-macos-0204611d006f?source=rss-53e7a17f5389------2</link>
            <guid isPermaLink="false">https://medium.com/p/0204611d006f</guid>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Sumit Kumar Sharan]]></dc:creator>
            <pubDate>Fri, 05 Dec 2025 15:18:17 GMT</pubDate>
            <atom:updated>2025-12-05T15:18:17.444Z</atom:updated>
            <content:encoded><![CDATA[<p>[!] Xcode — develop for iOS and macOS (Xcode 26.1.1)</p><p>! iOS 26.1 Simulator not installed; this may be necessary for iOS and macOS development.</p><p>To download and install the platform, open Xcode, select Xcode &gt; Settings &gt; Components,</p><p>and click the GET button for the required platform.</p><p>For more information, please visit:</p><p><a href="https://developer.apple.com/documentation/xcode/installing-additional-simulator-runtimes">https://developer.apple.com/documentation/xcode/installing-additional-simulator-runtimes</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0204611d006f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Find TiKV Data Path and Host SurrealDB in Production]]></title>
            <link>https://sharansumitkumar.medium.com/how-to-find-tikv-data-path-and-host-surrealdb-in-production-ac180dacaf78?source=rss-53e7a17f5389------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac180dacaf78</guid>
            <category><![CDATA[surrealdb]]></category>
            <category><![CDATA[tikv]]></category>
            <dc:creator><![CDATA[Sumit Kumar Sharan]]></dc:creator>
            <pubDate>Tue, 21 Oct 2025 07:58:27 GMT</pubDate>
            <atom:updated>2025-10-21T07:58:27.602Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>SurrealDB</strong> supports multiple storage backends — and one of the most powerful is <strong>TiKV</strong>, a distributed, transactional key-value store built in Rust.</p><p>If you’re just starting out, you might launch TiKV using tiup playground. But once you’re ready for production, you’ll want to know:</p><ol><li><strong>Where does TiKV actually store data?</strong></li></ol><p><strong>2. How can I host it properly in a production environment?</strong></p><p>Let’s go through both — starting with the basics.</p><h3>⚙️ Step 1: Start TiKV Locally Using TiUP Playground</h3><p>When testing SurrealDB with TiKV, you can spin up a minimal cluster using TiUP:</p><pre>tiup playground --tag surrealdb --mode tikv-slim --pd 1 --kv 1</pre><p>Here’s tag meaning:</p><p>-<strong>-tag surrealdb </strong>Assigns a name to your cluster for easy cleanup.</p><p><strong>--mode tikv-slim</strong> Starts only PD (Placement Driver) and TiKV — no TiDB</p><p><strong>--pd 1 --kv 1</strong> Runs 1 PD node and 1 TiKV node locally</p><p>This is perfect for <strong>development</strong> or <strong>integration testing</strong> with SurrealDB.</p><h3>🔍 Step 2: Find the TiKV Data Storage Path</h3><p>When you start the playground, TiUP spawns a tikv-server process.<br> To find where your data is stored, run:</p><pre>ps aux | grep tikv-server</pre><p>You’ll see something like this:</p><pre>/Users/yourname/.tiup/components/tikv/v8.0.0/tikv-server \<br>  --pd-endpoints=127.0.0.1:2379 \<br>  --data-dir=/Users/yourname/.tiup/data/surrealdb/tikv-0/data \<br>  --addr=0.0.0.0:20160 \<br>  ...</pre><p>✅ Look for --data-dir</p><p>That’s your <strong>TiKV data directory</strong> — for example:</p><pre>/Users/yourname/.tiup/data/surrealdb/tikv-0/data</pre><p>You can navigate there directly:</p><pre>cd /Users/yourname/.tiup/data/surrealdb/tikv-0/data</pre><p>It contains TiKV’s RocksDB files, snapshots, and metadata.</p><h3>🧹 Step 3: Clean Up When Done</h3><p>When finished testing:</p><ul><li>Stop the cluster (keeps data):</li></ul><pre>tiup stop --tag surrealdb</pre><ul><li>Or clean everything (removes data):</li></ul><pre>tiup clean --tag surrealdb</pre><h3>🏗️ Step 4: Hosting TiKV in Production</h3><p>For production, <strong>you should not use </strong><strong>tiup playground</strong> — it’s meant for local experiments.<br> Instead, run TiKV as <strong>a standalone or distributed service</strong> using the TiUP cluster management</p><h4>🔸 1. Install TiUP and TiKV Components</h4><p>If you haven’t already:</p><pre>curl --proto &#39;=https&#39; --tlsv1.2 -sSf https://tiup.io/install.sh | sh<br>tiup update --self &amp;&amp; tiup update tikv pd</pre><h4>🔸 2. Create a Production Cluster Topology File</h4><p>Create a YAML file named topology.yaml describing your cluster:</p><pre>global:<br>  user: &quot;tikv&quot;<br>  ssh_port: 22<br>  deploy_dir: &quot;/data/tikv-deploy&quot;<br>  data_dir: &quot;/data/tikv-data&quot;<br><br>pd_servers:<br>  - host: 10.0.0.1<br>  - host: 10.0.0.2<br>  - host: 10.0.0.3<br><br>tikv_servers:<br>  - host: 10.0.0.4<br>  - host: 10.0.0.5<br>  - host: 10.0.0.6</pre><p>This configuration sets up <strong>3 PD nodes</strong> and <strong>3 TiKV nodes</strong> across multiple servers — a typical production setup.</p><h4>🔸 3. Deploy and Start the Cluster</h4><p>Run:</p><pre>tiup cluster deploy surrealdb-prod v8.0.0 ./topology.yaml --user root</pre><p>Then start it:</p><pre>tiup cluster start surrealdb-prod</pre><p>You can view cluster status anytime:</p><pre>tiup cluster display surrealdb-prod</pre><h4>🔸 4. Connect SurrealDB to TiKV</h4><p>Once your TiKV cluster is running, SurrealDB can connect to it using the tikv:// URL scheme:</p><pre>surreal start --log debug tikv://10.0.0.4:20160</pre><p>Make sure SurrealDB is compiled with TiKV support (enabled by default in official builds).</p><h4>🧠 Optional: Systemd Service Setup (Manual Deployment)</h4><p>If you prefer manual control instead of TiUP, you can create a <strong>systemd service</strong> for TiKV on Linux:</p><pre>sudo nano /etc/systemd/system/tikv.service</pre><p>Add:</p><pre>[Unit]<br>Description=TiKV Server<br>After=network.target<br><br>[Service]<br>ExecStart=/usr/local/bin/tikv-server \<br>  --pd-endpoints=10.0.0.1:2379,10.0.0.2:2379,10.0.0.3:2379 \<br>  --data-dir=/data/tikv \<br>  --addr=0.0.0.0:20160<br>Restart=always<br>LimitNOFILE=1000000<br><br>[Install]<br>WantedBy=multi-user.target</pre><p>Then enable and start it:</p><pre>sudo systemctl enable tikv<br>sudo systemctl start tikv</pre><h4>📦 Recommended Directory Structure</h4><p>For production environments, follow this layout:</p><pre>/data/<br>  ├── pd/<br>  ├── tikv/<br>  ├── surrealdb/<br>  └── logs/</pre><p>Keep SSD-backed storage for /data/tikv for best performance.</p><h4>🔐 Security &amp; Maintenance Tips</h4><pre>Area           Recommendation                                                        <br>----------     --------------------------------------------------------------------- <br>Networking     Bind TiKV to internal IPs only (`--addr=10.x.x.x:20160`)              <br>Backups        Use `tikv-ctl` or snapshotting tools                                  <br>Monitoring     Enable Prometheus + Grafana (TiUP supports built-in monitoring stack) <br>Versioning     Always match PD and TiKV versions                                     <br>SurrealDB      Run with persistent TiKV backend for transactional safety             </pre><h4>🧩 Quick Reference Commands</h4><pre>Action                      Command                                                                 |                   |<br>-------------------------   ----------------------------------------------------------------------- | ----------------- |<br>Start TiUP cluster          `tiup playground --tag surrealdb --mode tikv-slim --pd 1 --kv 1`        |                   |<br>Find TiKV data dir          `ps aux                                                                 | grep tikv-server` |<br>Stop local cluster          `tiup stop --tag surrealdb`                                             |                   |<br>Clean up                    `tiup clean --tag surrealdb`                                            |                   |<br>Deploy production cluster   `tiup cluster deploy surrealdb-prod v8.0.0 ./topology.yaml --user root` |                   |<br>Start production cluster    `tiup cluster start surrealdb-prod`                                     |                   |</pre><h4>🧭 Conclusion</h4><p>Finding TiKV’s data path is simple once you know where to look — <br> just check the --data-dir flag in the running process.</p><p>For production, move away from playground mode and deploy with tiup cluster or systemd-managed nodes.<br> Combine it with <strong>SurrealDB</strong> for a distributed, high-performance, transactional graph + document + key-value database stack — all in Rust. 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac180dacaf78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Surreal Query]]></title>
            <link>https://sharansumitkumar.medium.com/surreal-query-095a89ddde56?source=rss-53e7a17f5389------2</link>
            <guid isPermaLink="false">https://medium.com/p/095a89ddde56</guid>
            <category><![CDATA[surrealism]]></category>
            <category><![CDATA[surrealdb]]></category>
            <dc:creator><![CDATA[Sumit Kumar Sharan]]></dc:creator>
            <pubDate>Thu, 16 Oct 2025 13:36:03 GMT</pubDate>
            <atom:updated>2025-10-16T13:36:03.480Z</atom:updated>
            <content:encoded><![CDATA[<ol><li>How To Relate one node with multiple nodes, or vice-versa</li></ol><pre><br>Relate Teacher:ii6rm3a82f8zhkid7xk2 -&gt; teaches-&gt; [ Course:u5qrkw1b4ldwfykvvpfy, Course:jf1tscolq4tpvqz4lb00] ;</pre><p>2. How to update edge in surrealql</p><pre><br>update teaches set in = Teacher:l3jeyxqneptsre1dpsbi where id = Teacher:jf1tscolq4tpvqz4lb00;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=095a89ddde56" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>