<?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 Masuk Helal Anik on Medium]]></title>
        <description><![CDATA[Stories by Masuk Helal Anik on Medium]]></description>
        <link>https://medium.com/@aniksharif?source=rss-7ecf5183f994------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rwuvFZGrKb8kw_1OM7FjRg.jpeg</url>
            <title>Stories by Masuk Helal Anik on Medium</title>
            <link>https://medium.com/@aniksharif?source=rss-7ecf5183f994------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 13:49:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aniksharif/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[I Connected My TV to Claude: A Full Android TV Tune-Up Over ADB]]></title>
            <link>https://aniksharif.medium.com/i-connected-my-tv-to-claude-a-full-android-tv-tune-up-over-adb-072bfa44af5b?source=rss-7ecf5183f994------2</link>
            <guid isPermaLink="false">https://medium.com/p/072bfa44af5b</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[smart-tv]]></category>
            <category><![CDATA[android-tv]]></category>
            <dc:creator><![CDATA[Masuk Helal Anik]]></dc:creator>
            <pubDate>Tue, 27 Oct 2026 14:30:34 GMT</pubDate>
            <atom:updated>2026-10-27T14:30:34.463Z</atom:updated>
            <content:encoded><![CDATA[<h4>Everyone’s using AI to strip ads off their TVs. I asked it to find out why mine was slow, and why the sound kept cutting out.</h4><h3>Why I handed my TV to an AI</h3><p>Lately, people everywhere have been handing their smart TVs to Claude. You give it ADB access, and it strips out the ads, switches off the bloat and even builds a cleaner home screen. Sites like <a href="https://itsfoss.com/news/debloat-smart-tv/">It’s FOSS</a> and <a href="https://www.androidauthority.com/android-tv-vibe-hacking-remove-ads-bloatware-3725338/">Android Authority</a> have covered the trend, and I kept wondering what all the hype was about.</p><p>So I got curious and decided to try it on my own TV. Getting rid of ads wasn’t really the point for me, though. I wanted an answer to a question I’d never managed to answer myself: why does this TV feel slow, and why does the sound sometimes just stop?</p><p>The TV is a Walton 4K Android TV running Android 14, with 1.8 GB of RAM. I pointed Claude Code at it over Wi-Fi and asked it to find what was wrong and fix it.</p><p>By the end of one afternoon, it had:</p><ul><li>traced the sound dropouts to a specific crash, and removed the app behind it</li><li>freed 2.5 GB of storage</li><li>built me a home screen from scratch that uses 60% less memory and opens 22% faster</li><li>worked out whether my weak Wi-Fi was the router’s fault or the TV’s</li></ul><p>Here’s the full process, step by step, including where it got stuck.</p><h3>The setup: ADB over Wi-Fi, no cables, no root</h3><p>All you need is the TV, a computer on the same Wi-Fi, and Android’s debugging bridge (ADB), which Claude Code drives from the terminal.</p><ol><li>On the TV, open <strong>Settings → Device Preferences → About</strong> and press OK on <strong>Build</strong> seven times to unlock Developer options.</li><li>In <strong>Developer options</strong>, turn on <strong>USB debugging</strong> (on many TVs this also enables network debugging).</li><li>On the computer, ask Claude Code to connect to the TV. It found mine on its own: a quick scan of the network turned up one device with port 5555 open, and the TV also advertised itself over mDNS.</li><li>The first connection came back <strong>unauthorized</strong>. A prompt appears on the TV asking to allow this computer; tick <strong>Always allow</strong> and accept.</li></ol><p>One gotcha: after a restart, my TV switched network debugging off again. If the connection is refused after a reboot, check that toggle first.</p><h3>Step 1: A health check before touching anything</h3><p>The first thing Claude did was look, not change. It read memory, storage, CPU, temperatures, crash logs and Wi-Fi, then ranked the problems:</p><ul><li><strong>Low RAM (medium–high):</strong> 1.8 GB total, about 110 MB free, 400 MB in swap; Android had killed about 15 background apps.</li><li><strong>System freezes (medium):</strong> five “app not responding” errors within 40 seconds on 26 October, starting when the screen turned off.</li><li><strong>Weak Wi-Fi (medium):</strong> -73 dBm on 5 GHz; internet ping swinging from 30 to 137 ms.</li><li><strong>Load average of 60 (not a problem):</strong> caused by MediaTek TV drivers parked in a waiting state; the CPU was 89% idle.</li><li><strong>System partition 100% full (not a problem):</strong> it’s read-only by design; user storage was at 62%.</li></ul><p>The load-average line is the one I’d have got wrong on my own. A number like 60 looks alarming, but Claude checked which processes were behind it and showed they were idle hardware drivers, not real work.</p><h3>Step 2: How much is the home screen costing me?</h3><p>The Google TV home screen was the single biggest app on the TV, at 134 MB of memory, about 14% of everything in use. It also used 35% of a CPU core and triggered nearly 300 major page faults in a few seconds, meaning it kept reloading itself from storage. That explained the stuttering menus.</p><p>Claude’s estimate was honest: the launcher accounted for roughly 15–25% of the memory pressure and most of the home-screen lag, but not the freezes. The root problem was still 1.8 GB of RAM.</p><p>The quick wins took a few minutes:</p><ul><li><strong>Animations off.</strong> All three animation-scale settings set to 0.</li><li><strong>Video and audio previews off</strong> in the home-screen settings.</li><li><strong>Every channel row hidden:</strong> Netflix, Prime Video, Hoichoi, the browser and the “Apps Spotlight” promotion row.</li></ul><p>Claude did the last two by reading the settings screen’s layout and pressing the switches itself, checking each one’s state afterwards.</p><h3>Step 3: Finding what was killing the sound</h3><p>The sound dropouts turned out to be a crash, and the crash reports survived the restart even though the regular logs didn’t.</p><p>Android keeps native crash reports (“tombstones”) in a store that persists across reboots. Claude read them and found seven crashes within three seconds on the morning of 26 October:</p><ol><li>A sideloaded streaming app aborted with FD_SET: file descriptor 1091 &gt;= FD_SETSIZE 1024. It had opened over a thousand files and connections without closing them, and it was playing audio at the time.</li><li>Two more streaming apps, the video-protection service (Widevine) and the video-file reader crashed in the same window.</li><li>The audio service itself was killed: TimeCheck timeout for IAudioFlinger command 1, meaning it stopped responding for more than five seconds.</li></ol><p>When the audio service dies, the sound cuts out until it restarts and the volume can misbehave. That matched exactly what I’d been seeing.</p><p>While it was looking, Claude also flagged a phone app someone had sideloaded onto the TV. It started on boot, kept a background service running, used about 100 MB of RAM, carried several ad SDKs and had permission to install other apps.</p><p><strong>The cleanup.</strong> The TV only kept two days of app-usage history, so Claude couldn’t tell me which apps were unused. It listed the candidates with a reason for each, and I picked. Nine apps went, including the leaking one, two screen-mirroring apps (the TV has Chromecast built in), a duplicate browser and several file tools. Every uninstall waited for my go-ahead.</p><p>Storage dropped from 6.7 GB (62%) to 4.2 GB (39%).</p><h3>Step 4: Building my own home screen</h3><p>The third-party launcher I tried first (Projectivy) still used about 103 MB, so I asked Claude to write a lighter one. It built “Lite Home” in plain Java with no extra libraries, compiled it with the Android SDK tools already on my Mac (no Gradle, no Android Studio), signed it and installed it. The code compiles to 25 KB.</p><p><strong>The firmware fought back.</strong> After a restart, the Walton firmware re-enabled the Google launcher and launched it, overriding the setting that makes another app the default home screen. Disabling it didn’t stick. Claude’s fix was a tiny accessibility service that watches for the stock launcher’s window and immediately brings Lite Home back. It listens for just one event type from just one app, so it costs almost nothing. Claude tested it by re-enabling the Google launcher and opening it by hand; Lite Home replaced it at once.</p><p><strong>Designed by conversation.</strong> I never wrote a line of the UI. Each round was a sentence of feedback, a rebuild, a screenshot from the TV and a check:</p><ol><li>“The home page looks messy, make it beautiful and cleaner”: a dark page with a clock, favourites, input buttons and an app grid.</li><li>“All apps seem cut off on the left”: a selected tile grew past its container’s clip edge. One line fixed it.</li><li>“Use a nature photo” and “three parts”: the clock on top, open space for the photo, and inputs plus apps at the bottom. Six landscape photos (from Unsplash, via Picsum) fade every 10 minutes, with only one held in memory at a time.</li><li>“Inputs should be an expander”: one button that slides out TV, AV and HDMI 1–4 on the same line.</li><li>“More apps opens a full-screen grid” and “the button looks ugly”: a frosted-glass tile with a 3×3 app icon.</li><li>“Make all tiles glassy like Apple”: a top gloss, a bright rim, a lift and sheen on focus, slightly dimmed unselected tiles, and a real blur behind the All apps grid.</li><li>“Slimmer left margin, slightly smaller icons”: side margins halved and tiles 12% smaller.</li></ol><p>With the photos included, the app is 3.7 MB on disk and uses about 54 MB of RAM.</p><h3>Step 5: Is my Wi-Fi bad, or is it the TV?</h3><p>The router was fine; the TV’s 5 GHz reception was the weak link. Claude proved it with one simple experiment: put the laptop right next to the TV and compare what each one sees from the same router.</p><ul><li><strong>5 GHz signal:</strong> laptop -52 dBm, TV -71 dBm</li><li><strong>2.4 GHz signal:</strong> TV -46 dBm (laptop not measured)</li><li><strong>Ping to router:</strong> TV 2 ms, 0% loss (laptop not measured)</li></ul><p>A gap of 5–10 dB between a laptop and a TV is normal, since TVs have small antennas buried behind the panel. A 19 dB gap, roughly 80 times less signal, points at the TV.</p><p>Two more findings:</p><ul><li><strong>The local link was healthy.</strong> A 2 ms ping to the router with no loss means the earlier buffering came from the internet provider, not the Wi-Fi.</li><li><strong>The 2.4 GHz channel was crowded.</strong> A neighbour’s network on channel 6 reached the TV at -39 dBm, louder than my own router. Moving my router to channel 11, the quietest nearby, is the cheap fix.</li></ul><p>The TV had already moved itself to 2.4 GHz. That gives 130 Mbps, far more than the 25 Mbps a 4K stream needs. For full 5 GHz speed, a LAN cable or a small access point next to the TV is the answer.</p><h3>The results</h3><p>The home screen now uses 60% less memory and opens 22% faster, and the TV has 2.5 GB more free storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zuu-HxCNVSfkdm_jt2gvdQ.png" /></figure><ul><li><strong>Home screen memory:</strong> 134 MB → 54 MB</li><li><strong>Home screen cold start (average of 3 runs):</strong> 1.04 s → 0.81 s</li><li><strong>Storage used:</strong> 6.7 GB (62%) → 4.2 GB (39%)</li><li><strong>Background apps killed for memory:</strong> about 15 → 0</li><li><strong>Apps installed by the owner:</strong> 21 → 13</li></ul><p><em>How these were measured: memory is the launcher’s PSS from dumpsys meminfo. Start time is am start -W with each launcher force-stopped first, three runs each, side by side on the same day. The “after” figures were taken shortly after a restart, so free memory will drift down as the TV runs longer.</em></p><h3>What I learned</h3><p>The most useful thing Claude did was measure before acting and say plainly when a number didn’t support a claim.</p><ul><li><strong>It corrected itself.</strong> When the launcher swap saved less memory than it had predicted, it said so, and gave the restart and the app removals the credit instead.</li><li><strong>It asked before anything destructive.</strong> Every uninstall waited for a yes. When it couldn’t tell which apps were unused, it said why and let me choose.</li><li><strong>It separated “looks bad” from “is bad”.</strong> A load average of 60 and a 100%-full system partition were both harmless, and it explained why.</li><li><strong>It hit real limits.</strong> Twice, its command-approval check failed and blocked it for a while. It handed me a read-only script to run myself instead of stalling, and carried on from the output.</li></ul><p>The caveats are real too. This TV has 1.8 GB of RAM, and no software fixes that. The “before” speed was measured against the stock launcher on the same day, not recorded before any changes. And a launcher you build yourself is a launcher you maintain yourself.</p><h3>Try it yourself</h3><p>Start by asking the agent to diagnose, not clean: “Check my TV for issues and report back” got me further than any debloat prompt would have.</p><p>The commands that did most of the diagnostic work:</p><pre>adb connect &lt;tv-ip&gt;:5555<br>adb shell dumpsys meminfo                           # who is using memory<br>adb shell dumpsys dropbox --print SYSTEM_TOMBSTONE  # native crashes, kept across reboots<br>adb shell dumpsys dropbox --print system_app_anr    # &quot;app not responding&quot; reports<br>adb shell cmd wifi status                           # signal, band, link speed<br>adb shell cmd wifi list-scan-results                # every network the TV can see<br>adb shell settings put global window_animation_scale 0<br>adb shell am start -W -n &lt;package&gt;/&lt;activity&gt;       # cold-start time in ms</pre><p>Safety tips:</p><ul><li><strong>Disable before you uninstall</strong> system apps (pm disable-user); it&#39;s reversible with pm enable. I only uninstalled apps that I had installed myself.</li><li><strong>Install the new launcher before disabling the old one</strong>, or the Home button has nowhere to go.</li><li><strong>Turn network debugging off when you’re done.</strong> An open ADB port on your home network lets any device on it control the TV.</li><li><strong>Keep the undo commands.</strong> Mine: adb shell settings put secure enabled_accessibility_services null, then adb shell pm enable com.google.android.tvlauncher.</li></ul><h3>Sources</h3><ul><li><a href="https://itsfoss.com/news/debloat-smart-tv/">People Are Using AI to Get Rid of Smart TV Ads and Make Their TVs Faster</a>, It’s FOSS, 19 October 2026</li><li><a href="https://www.androidauthority.com/android-tv-vibe-hacking-remove-ads-bloatware-3725338/">Android TV vibe hacking: remove ads and bloatware</a>, Android Authority, 20 October 2026</li><li><a href="https://www.mac4ever.com/tv/197778-un-prompt-confie-a-claude-debride-les-android-tv-et-leur-donne-enfin-des-airs-d-apple-tv">Un prompt confié à Claude débride les Android TV</a>, Mac4Ever, 31 August 2026</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=072bfa44af5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s Encrypt SSL on Shared cPanel Hosting (Without Certbot) — With Auto Renewal]]></title>
            <link>https://aniksharif.medium.com/lets-encrypt-ssl-on-shared-cpanel-hosting-without-certbot-with-auto-renewal-d453c9d8d28d?source=rss-7ecf5183f994------2</link>
            <guid isPermaLink="false">https://medium.com/p/d453c9d8d28d</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[cpanel]]></category>
            <category><![CDATA[free-ssl-certificate]]></category>
            <category><![CDATA[lets-encrypt]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Masuk Helal Anik]]></dc:creator>
            <pubDate>Thu, 15 Jan 2026 22:14:34 GMT</pubDate>
            <atom:updated>2026-01-15T22:14:34.827Z</atom:updated>
            <content:encoded><![CDATA[<h3>Let’s Encrypt SSL on Shared cPanel Hosting (Without Certbot) — With Auto Renewal</h3><p>Recently, I stumbled on an issue. I faced this with shared cPanel hosting. I found out that free SSL is not an easy option to install here.</p><p>Now, you know you need HTTPS, the site will show <strong>not secure</strong>. You are short on bucks. You are looking for a free alternative. Boom! Let’s Encrypt is free. But then you found out the usual way doesn’t work. Because you will need <strong>Certbot,</strong> which isn’t an option here. Shared hosting doesn’t give you root access, system packages, or the ability to run server-level daemons.</p><p>So I was looking for a workaround. Then I found out about one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RyJBvzGC9n4lGOS-iKzYsA.png" /><figcaption>source: Generated by ChatGPT</figcaption></figure><p><strong>acme.sh,</strong> a lightweight ACME client that installs in your home directory, works in shared environments, and can renew automatically. Even better, it can often <strong>deploy directly into cPanel</strong> using a deploy hook, so you don’t have to paste certificates manually every 90 days.</p><p>This article guides you through a clean, production-ready setup: <strong>issue a Let’s Encrypt SSL certificate on shared cPanel hosting and renew it automatically</strong>, without using Certbot.</p><h3>Why Certbot usually doesn’t work on shared cPanel hosting</h3><p>Let’s quickly go through the reasons. Certbot is designed for servers where you control the OS and web server configuration. On shared hosting, you typically can’t:</p><ul><li>Install system packages</li><li>bind to privileged ports or modify system services</li><li>run root-level hooks or systemd timers</li><li>modify global webserver config</li></ul><p>Even when your host supports Let’s Encrypt, they often provide it through <strong>AutoSSL</strong> — and if AutoSSL isn’t available (or doesn’t cover your use case), you need an alternative.</p><h3>Why acme.sh is ideal for shared cPanel hosting</h3><p><strong>acme.sh</strong> is a shell-based ACME client. That matters because:</p><ul><li>It installs under ~/.acme.sh/ (no root required)</li><li>Can validate domains via <strong>webroot</strong> (HTTP challenge) or DNS</li><li>Comes with its own <strong>cron job</strong> for renewal</li><li>Supports a <strong>cPanel UAPI deploy hook</strong> on many hosts, enabling automatic installation into cPanel</li></ul><p>It’s primarily designed for cases where you have control over your account.</p><h3>What you need before starting</h3><p>✅ Your domain points to the correct hosting account<br>✅ You know your site’s <strong>Document Root</strong> (cPanel shows this)<br>✅ You have a shell environment via one of these:</p><h3>Option A: SSH access (optional)</h3><p>If your host allows SSH, then create ssh credentials. And connect normally</p><h3>Option B: cPanel Terminal (works even without SSH)</h3><p>In cPanel, go to <strong>Terminal</strong><br>This gives you a shell in the browser.</p><h3>Step 1 — Install acme.sh</h3><p>To install, run:</p><pre>curl https://get.acme.sh | sh</pre><p>Reload your shell so the command becomes available:</p><pre>source ~/.bashrc</pre><h3>Step 2 — Register an ACME account (Let’s Encrypt)</h3><p>Register your account email (use a real email if you want to get the expiry notices):</p><pre>~/.acme.sh/acme.sh --register-account -m you@example.com</pre><h3>Step 3 — Issue a certificate using the webroot method</h3><p>On shared hosting, the simplest validation method is <strong>webroot</strong>. acme.sh temporarily places challenge files into:</p><p>&lt;document-root&gt;/.well-known/acme-challenge/</p><p>Let’s Encrypt fetches those files over HTTP to prove domain ownership.</p><h3>Staging (recommended)</h3><p>Staging certificates are not trusted by browsers, it will only help you to validate the workflow without rate limits:</p><pre>~/.acme.sh/acme.sh --issue -d example.com -d www.example.com \<br>  -w /home/USERNAME/example.com/public --staging</pre><h3>Production (real certificate)</h3><p>Replace the values with your domain and document root. There is a rate limit, so do the staging run first. Otherwise, you will get blocked temporarily for exceeding the rate limit:</p><pre>~/.acme.sh/acme.sh --issue -d example.com -d www.example.com \<br>  -w /home/USERNAME/example.com/public --server letsencrypt</pre><h3>Step 4 — Deploy the certificate into cPanel automatically</h3><p>Check if your host supports cPanel UAPI access. If it does, then acme.sh can deploy your cert directly into cPanel.</p><p>Export your cPanel username:</p><pre>export cPanel_Username=USERNAME</pre><p>Then deploy:</p><pre>~/.acme.sh/acme.sh --deploy -d example.com \<br>  --deploy-hook cpanel_uapi</pre><p>When this works, your certificate is installed in cPanel directly.</p><h3>If UAPI deploy is blocked by your host</h3><p>Some providers disable API access. In that case, you can still issue and renew the certificate, but you’ll need to install it manually:</p><ol><li>cPanel → <strong>SSL/TLS</strong></li><li><strong>Manage SSL Sites</strong></li><li>Choose the domain</li><li>Paste the certificate + private key from ~/.acme.sh/</li></ol><p>The certificate files live under:</p><ul><li>~/.acme.sh/example.com_ecc/ (ECC) or</li><li>~/.acme.sh/example.com/ (RSA)</li></ul><h3>Step 5 — Enable auto-renewal</h3><p>acme.sh can install a renewal cron job:</p><pre>~/.acme.sh/acme.sh --install-cronjob</pre><p>Verify it exists by running:</p><pre>crontab -l | grep acme.sh</pre><p>You should see something like that:</p><pre>0 0 * * * &quot;/home/USERNAME/.acme.sh&quot;/acme.sh --cron --home &quot;/home/USERNAME/.acme.sh&quot; &gt; /dev/null</pre><p>This runs daily. When renewal is needed, acme.sh renews the cert and triggers deploy (if configured).</p><h3>If crontab isn’t available</h3><p>Use cPanel → <strong>Cron Jobs</strong> and add the same command there.</p><h3>Step 6 — Test your renewal pipeline safely</h3><p>Test renewal using staging command (so you don’t risk production rate limits):</p><pre>~/.acme.sh/acme.sh --renew -d example.com --force --staging</pre><p>If that succeeds, your renewal flow is fine.</p><h3>Step 7 — Confirm the config saved correctly (the “golden check”)</h3><p>acme.sh stores domain settings in a config file. This tells you whether your webroot and deploy hook are properly persisted for renewals or not.</p><p>For ECC certs:</p><pre>cat ~/.acme.sh/example.com_ecc/example.com.conf</pre><p>You want to check:</p><ul><li>Le_Webroot=... pointing to the correct document root</li><li>Le_DeployHook=cpanel_uapi, (or your deployment method)</li></ul><p>If those are present, renewals will not only generate a new certificate — they’ll also deploy it.</p><h3>Better practices (learned the hard way)</h3><h3>Avoid --force in normal operation</h3><p>Use --force while testing, not for routine issuance. Re-issuing unnecessarily increases the chance of temporaly block.</p><h3>Confirm the .well-known path is reachable</h3><p>Before issuing, you can verify the challenge directory is accessible by creating a test file:</p><pre>mkdir -p /home/USERNAME/example.com/public/.well-known/acme-challenge<br>echo test &gt; /home/USERNAME/example.com/public/.well-known/acme-challenge/test.txt</pre><p>Then check in the browser:</p><p><a href="http://example.com/.well-known/acme-challenge/test.txt">http://example.com/.well-known/acme-challenge/test.txt</a></p><p>If that doesn’t load or show anything else, Let’s Encrypt validation will fail.</p><h3>Keep staging for testing only</h3><p>Staging is for setup validation. For real HTTPS, switch to production.</p><h3>Prefer one key type consistently</h3><p>acme.sh often defaults to ECC (ec-256). That’s modern and efficient—stick with it unless you have a compatibility reason to use RSA.</p><h3>The result: SSL + auto-renewal on shared hosting (no Certbot)</h3><p>At the end of this setup, you get:</p><p>✅ A trusted Let’s Encrypt certificate for your domain<br>✅ Automatic renewal via cron<br>✅ Optional automatic deployment into cPanel via UAPI<br>✅ No need for root, Certbot, or server-level tooling</p><p><em>If you found this article helpful, please feel free to follow me on </em><a href="https://www.linkedin.com/in/masuk-helal/"><em>LinkedIn</em></a><em>. I’m constantly sharing new insights and ideas, and I’d love to connect with you and hear your thoughts as well. Thank you for reading!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d453c9d8d28d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AbortController: The JavaScript Feature I Wish I Knew Sooner]]></title>
            <link>https://aniksharif.medium.com/abortcontroller-the-javascript-feature-i-wish-i-knew-sooner-b298d16a6219?source=rss-7ecf5183f994------2</link>
            <guid isPermaLink="false">https://medium.com/p/b298d16a6219</guid>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[fetch]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[asynchronous-programming]]></category>
            <dc:creator><![CDATA[Masuk Helal Anik]]></dc:creator>
            <pubDate>Mon, 20 Jan 2025 05:54:57 GMT</pubDate>
            <atom:updated>2025-01-20T05:54:57.472Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, I came across a JavaScript feature called <strong>AbortController</strong>, and I realized how helpful it can be for managing asynchronous operations. Whether it’s canceling a fetch request, cleaning up event listeners, or stopping custom tasks, AbortController provides a structured way to handle these scenarios.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*aaQJtEPZKz5yfT3otI6lMg.jpeg" /><figcaption>source:<a href="https://stock.adobe.com/images/big-abort-button/172827176">https://stock.adobe.com/images/big-abort-button/172827176</a></figcaption></figure><p>Here’s what I learned about using it and some examples to show how it can be applied in both vanilla JavaScript and React.</p><h3>What is AbortController?</h3><p>AbortController is part of the DOM API and provides a way to control and cancel ongoing tasks. It works alongside an <strong>AbortSignal</strong>, communicating the cancellation request to the functions.</p><h3>Why Use AbortController?</h3><p>AbortController can help:</p><ul><li>Cancel network requests that are no longer needed.</li><li>Remove event listeners cleanly.</li><li>Improve performance by avoiding unnecessary operations.</li></ul><p>It’s a straightforward solution for some common problems in JavaScript development.</p><h3>Example: Canceling a Fetch Request</h3><p>Here’s a simple example of using AbortController to cancel a fetch request:</p><pre>const controller = new AbortController();<br>const signal = controller.signal;<br>fetch(&#39;https://jsonplaceholder.typicode.com/posts&#39;, { signal })<br>  .then((response) =&gt; response.json())<br>  .then((data) =&gt; console.log(&#39;Data:&#39;, data))<br>  .catch((err) =&gt; {<br>    if (err.name === &#39;AbortError&#39;) {<br>      console.log(&#39;Fetch aborted!&#39;);<br>    } else {<br>      console.error(&#39;Fetch error:&#39;, err);<br>    }<br>  });<br><br>// Cancel the request after 2 seconds<br>setTimeout(() =&gt; {<br>  controller.abort();<br>  console.log(&#39;Fetch aborted by the controller&#39;);<br>}, 2000);</pre><p>Here, the abort method cancels the fetch request, preventing unnecessary network usage.</p><h3>Example: Removing Multiple Event Listeners</h3><p>AbortController is also useful for managing multiple event listeners. You can attach several listeners with the same signal and remove them all at once:</p><pre>useEffect(() =&gt; {<br>  const controller = new AbortController();<br>  function handleResize() {<br>    console.log(&#39;Window resized&#39;);<br>  }<br>  function handleHashChange() {<br>    console.log(&#39;Hash changed&#39;);<br>  }<br>  function handleStorageChange() {<br>    console.log(&#39;Storage event occurred&#39;);<br>  }<br>  // Attach multiple listeners with the same signal<br>  window.addEventListener(&#39;resize&#39;, handleResize, {<br>    signal: controller.signal,<br>  });<br>  window.addEventListener(&#39;hashchange&#39;, handleHashChange, {<br>    signal: controller.signal,<br>  });<br>  window.addEventListener(&#39;storage&#39;, handleStorageChange, {<br>    signal: controller.signal,<br>  });<br>  return () =&gt; {<br>    // Calling `.abort()` removes ALL event listeners tied to `controller.signal`<br>    controller.abort();<br>    console.log(&#39;All event listeners removed&#39;);<br>  };<br>}, []);</pre><p>This approach ensures clean-up happens automatically when the component unmounts, making the code more maintainable and less prone to memory leaks.</p><h3>Using AbortController in React</h3><p>In React, AbortController can also help manage asynchronous operations like fetching data. Here’s an example:</p><pre>import { useEffect } from &#39;react&#39;;<br><br><br>function FetchComponent() {<br>  useEffect(() =&gt; {<br>    const controller = new AbortController();<br>    const signal = controller.signal;<br>    async function fetchData() {<br>      try {<br>        const response = await fetch(&#39;https://jsonplaceholder.typicode.com/posts&#39;, { signal });<br>        const data = await response.json();<br>        console.log(&#39;Fetched Data:&#39;, data);<br>      } catch (err) {<br>        if (err.name === &#39;AbortError&#39;) {<br>          console.log(&#39;Fetch canceled due to component unmounting&#39;);<br>        } else {<br>          console.error(&#39;Fetch error:&#39;, err);<br>        }<br>      }<br>    }<br>    fetchData();<br>    return () =&gt; {<br>      controller.abort();<br>      console.log(&#39;Cleanup: fetch request canceled&#39;);<br>    };<br>  }, []);<br>  return &lt;div&gt;Check the console for fetch status.&lt;/div&gt;;<br>}<br>export default FetchComponent;</pre><h3>Bonus: Canceling Multiple Tasks</h3><p>AbortController can control multiple tasks at once. For example, you can use it to cancel both a fetch request and a setTimeout:</p><pre>const controller = new AbortController();<br>const signal = controller.signal;<br>setTimeout(() =&gt; {<br>  console.log(&#39;This will not run&#39;);<br>}, 3000);<br>fetch(&#39;https://jsonplaceholder.typicode.com/posts&#39;, { signal })<br>  .then((res) =&gt; res.json())<br>  .then((data) =&gt; console.log(data))<br>  .catch(console.error);<br>controller.abort(); // Cancels both the fetch and the timeout</pre><p>With one callabort, all operations tied to the signal are canceled.</p><h3>Final Thoughts</h3><p>AbortController is a useful feature for managing asynchronous tasks in JavaScript. Whether you’re canceling fetch requests, cleaning up event listeners, or handling multiple tasks, it simplifies your code and ensures everything is cleaned up properly.</p><p>If you haven’t tried it yet, give it a go and see how it can make managing async operations easier!</p><p>Let me know your thoughts or how you’re using AbortController in your projects.</p><p>Let me know if you’d like any further adjustments!</p><p><em>If you found this article helpful, please feel free to follow me on </em><a href="https://www.linkedin.com/in/masuk-helal/"><em>LinkedIn</em></a><em>. I’m constantly sharing new insights and ideas, and I’d love to connect with you and hear your thoughts as well. Thank you for reading!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b298d16a6219" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Choosing the Right Data Response Format: JSON and Beyond]]></title>
            <link>https://aniksharif.medium.com/choosing-the-right-data-response-format-json-and-beyond-66d635f7c016?source=rss-7ecf5183f994------2</link>
            <guid isPermaLink="false">https://medium.com/p/66d635f7c016</guid>
            <category><![CDATA[engineering-productivity]]></category>
            <category><![CDATA[api-response]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[technology-trends]]></category>
            <dc:creator><![CDATA[Masuk Helal Anik]]></dc:creator>
            <pubDate>Fri, 06 Dec 2024 13:18:57 GMT</pubDate>
            <atom:updated>2025-01-20T05:51:05.092Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong><br> In a world driven by interconnected systems, data exchange between servers and clients is the backbone of modern applications. From powering mobile apps to orchestrating microservices, selecting the right data response format can improve your system’s efficiency.</p><p>This article explores the evolution of response formats like JSON, XML, YAML, and binary formats such as Protobuf, offering practical insights to help developers make informed choices.</p><p><strong>What Are Response Formats?</strong><br> At their core, response formats are structured methods to exchange data between a server and a client. They are the unsung heroes of seamless communication in:</p><ul><li>APIs like REST and gRPC.</li><li>File exchanges, such as CSV and XML data.</li><li>Distributed systems, where serialization formats like Protobuf play a key role.</li></ul><p>Each format caters to different requirements — some prioritize human readability, others focus on speed and compactness.</p><h3>A Closer Look at Popular Formats</h3><h4>1. JSON (JavaScript Object Notation)</h4><p>JSON reigns supreme for web and mobile applications. Its simplicity, lightweight structure, and compatibility across programming languages make it a favorite for RESTful APIs.</p><ul><li><strong>Key Features<br> . </strong>Human-readable, lightweight, and widely supported.<br> . Easy to parse in most programming languages.</li><li><strong>Use Cases</strong>:<br> . Web and mobile apps.<br> . Microservices communication.</li></ul><p><strong>Pro Tip</strong>: While JSON is easy to work with, its verbosity can be a bottleneck for high-performance systems.</p><h4>2. XML (eXtensible Markup Language)</h4><p>Once the go-to format, XML still holds its ground in legacy systems and enterprise environments.</p><ul><li><strong>Key Features</strong>:<br> . Hierarchical structure with user-defined tags.<br> . Supports schemas for data validation.</li><li><strong>Use Cases</strong>:<br> . Enterprise systems.<br> . Document-centric applications.</li></ul><p><strong>Pro Tip</strong>: If your application involves heavy validation, XML’s schema support can be a lifesaver.</p><h4>3. YAML (YAML Ain’t Markup Language)</h4><p>YAML is the darling of DevOps. Its clean, human-readable syntax is perfect for configuration files.</p><ul><li><strong>Key Features</strong>:<br> . Nested structures for complex data.<br> . Highly readable for humans.</li><li><strong>Use Cases</strong>:<br> . Configuring tools like Kubernetes and Docker Compose.<br> . Application settings.</li></ul><p><strong>Pro Tip</strong>: Avoid YAML for large datasets — its indentation-sensitive syntax can become a challenge.</p><h4>4. Binary Formats: Protobuf, Avro, and MessagePack</h4><p>Binary formats offer compactness and speed, making them ideal for high-performance systems.</p><ul><li><strong>Protobuf (Protocol Buffers)</strong>:<br> . Compact and schema-based, designed for gRPC.</li><li><strong>MessagePack</strong>:<br> . A binary format similar to JSON but more efficient.</li><li><strong>Apache Avro</strong>:<br> . Schema-based, widely used in big data platforms like Kafka.</li></ul><p><strong>Pro Tip</strong>: Use Protobuf or Avro when speed and bandwidth are critical, especially in distributed systems.</p><h4>5. HTML and CSV</h4><p>While not often the focus of “response format” discussions, these are worth noting:</p><ul><li><strong>HTML</strong>: Ideal for web pages and structured data presentations.</li><li><strong>CSV</strong>: Perfect for tabular data and easy import/export in spreadsheets.</li></ul><p><strong>Pro Tip</strong>: HTML shines in dynamic content, while CSV is unbeatable for tabular data exchange.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uzxDBHnK3AgWlm_PLpFsKw.png" /><figcaption>Comparison between various format</figcaption></figure><h3>Choosing the Right Format</h3><p>When deciding on a response format, consider the following:</p><ul><li><strong>Readability</strong>: JSON and YAML are excellent for human-friendly responses.</li><li><strong>Performance</strong>: Binary formats like Protobuf excel in speed and efficiency.</li><li><strong>Compatibility</strong>: XML remains unmatched for legacy systems.</li><li><strong>Use Case</strong>: HTML suits web pages; CSV works for tabular datasets.</li></ul><h3>Emerging Trends in Response Formats</h3><ul><li><strong>Rise of Binary Formats</strong>: As systems demand faster processing, Protobuf and Avro are gaining traction.</li><li><strong>JSON’s Continued Dominance</strong>: Despite alternatives, its versatility keeps it relevant.</li><li><strong>Hybrid Approaches</strong>: Formats that combine schema validation and compactness are shaping the future.</li></ul><p><strong>Conclusion</strong><br> There’s no one-size-fits-all solution in response formats. JSON remains the most versatile choice, but others excel in specific scenarios. By understanding the strengths and weaknesses of each, you can ensure your systems are both efficient and scalable.</p><p><strong>Call to Action</strong>: Choose the right format that aligns with your project’s goals — and keep evolving as technology advances.</p><p><em>If you found this article helpful, please feel free to follow me on </em><a href="https://www.linkedin.com/in/masuk-helal/"><em>LinkedIn</em></a><em>. I’m constantly sharing new insights and ideas, and I’d love to connect with you and hear your thoughts as well. Thank you for reading!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66d635f7c016" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I implemented OTP using python without Database]]></title>
            <link>https://aniksharif.medium.com/how-i-implemented-totp-using-python-without-database-1c71a69c8de0?source=rss-7ecf5183f994------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c71a69c8de0</guid>
            <category><![CDATA[2fa]]></category>
            <category><![CDATA[totp]]></category>
            <category><![CDATA[2fa-authentication]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Masuk Helal Anik]]></dc:creator>
            <pubDate>Sun, 26 Mar 2023 08:17:10 GMT</pubDate>
            <atom:updated>2025-01-20T05:50:24.137Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/848/0*kJ7fypMcjZGxlxMI.jpg" /></figure><p>Security is a primary concern for any online platform and thinking of a secure login system is one of the critical parts. One popular approach to achieving this is through the use of Two-factor authentication (2FA).</p><p>I happened to implement recently 2FA in our system. After some googling here and there I decided to implement 2FA by using a time-based one-time password (TOTP) algorithm that will be suitable for our case. We needed to do it without using a database so I planned up a database-less approach.</p><p>TOTP algorithms produce a unique, time-limited code that can be used as a second factor of authentication. Our system is in Django so I implemented it using python. In this article, I will walk through you how I implemented a TOTP algorithm in Python.</p><p>We will start by importing the necessary libraries for our implementation, which are hashlib, hmac, math and time.</p><pre>import hashlib<br>import hmac<br>import math<br>import time</pre><p>Next, we can define a function to generate the TOTP. The function will take a user object as an argument, which will contain the user’s email, secretphrase and username. We will use these values to generate a seed key for the TOTP. For note, the seed needs to be unique so I used these values you are free to use any type of value.</p><pre>def otp(user):<br><br>    seed = user.email+user.secretphrase+user.username<br><br>    # length of OTP in digits<br>    length = 6<br><br>    # timestep or time-window for which the token is valid<br>    step_in_seconds = 300<br><br>    # seed key<br>    key = seed.encode(encoding=&#39;utf-8&#39;)<br><br>    t = math.floor(time.time() // step_in_seconds)<br>    hmac_object = hmac.new(key, t.to_bytes(length=8, byteorder=&quot;big&quot;), hashlib.sha1)<br>    hmac_sha1 = hmac_object.hexdigest()<br><br>    # truncate to 6 digits<br>    offset = int(hmac_sha1[-1], 16)<br>    binary = int(hmac_sha1[(offset * 2):((offset * 2) + 8)], 16) &amp; 0x7fffffff<br>    totp = str(binary)[-length:]<br>    return totp</pre><p>Now the function will concatenate the user’s email,secretphrase and username to generate a unique seed for the TOTP. Alongside I have defined the length of the TOTP code (in this case, 6 digits) and the time window for which the code is valid (in this case, 5 minutes or 300 seconds).</p><p>Now convert the current time to an integer and divide it by the time window to get the current time step. Using this time step, along with the seed key, will generate an HMAC-SHA1 hash. Now truncate the hash to the needed number of digits (in this case, 6) and return the TOTP code.</p><p>Now send this TOTP code to your user by using mail, SMS or any other way. TOTP receiver will then have to submit the code within a time window (in this case, 5 minutes or 300 seconds).</p><p>Then again generate the TOTP with the same seed key using the otp function and compare it with the received one if it matches voila, the user got verified! If not, then the user failed to verify.</p><p>It’s important to note that the TOTP generated by the OTP function will change every 5 minutes (or whatever time window you have specified). Therefore, you will need to generate a new TOTP for each login attempt.</p><p>It’s time for a conclusion. It’s a simple yet effective way to implement 2FA for your platform. This approach can be used as a starting point for implementing OTP in your own projects. I did it in python but you can replicate it in any programming language. If you have any questions or feedback, please post a comment below.</p><p><em>If you found this article helpful, please feel free to follow me on </em><a href="https://www.linkedin.com/in/masuk-helal/"><em>LinkedIn</em></a><em>. I’m constantly sharing new insights and ideas, and I’d love to connect with you and hear your thoughts as well. Thank you for reading!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c71a69c8de0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing Multilingual Support in Next.js with Google Translate]]></title>
            <link>https://aniksharif.medium.com/creating-a-multilingual-react-component-in-next-js-with-google-translate-bf1899f331fe?source=rss-7ecf5183f994------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf1899f331fe</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[multilingual]]></category>
            <category><![CDATA[google-translate]]></category>
            <dc:creator><![CDATA[Masuk Helal Anik]]></dc:creator>
            <pubDate>Tue, 24 Jan 2023 18:27:54 GMT</pubDate>
            <atom:updated>2025-01-20T05:49:11.906Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="https://www.lingualinx.com/blog/localization-vs-translation" src="https://cdn-images-1.medium.com/max/1024/1*hyCVWoJ3HNcgNqKZyxsMCQ.jpeg" /><figcaption>source: <a href="https://www.lingualinx.com/blog/localization-vs-translation">https://www.lingualinx.com/blog/localization-vs-translation</a></figcaption></figure><p>In this tutorial, we will create a React component that uses the Google Translate script to provide on-page translations and allows users to select their preferred language using a dropdown menu. We will also save the selected language as a cookie, so the user doesn’t have to select their language every time they visit the page. I am assuming that you have a basic Next.js project set up and ready to go.</p><p>Step 1: Install the necessary libraries</p><p>To get started, we need to install the following libraries:</p><ul><li>rsuite: For the SelectPicker component. (You can use any type of picker)</li><li>cookies-next: For handling cookies</li></ul><p>You can install these libraries by running the following command in your project’s root folder:</p><pre>npm install rsuite cookies-next</pre><p>Step 2: Create the component</p><p>Create a new file named GoogleTranslate.js in your project&#39;s src folder. In this file, we will define our React component.</p><p>First, import the necessary modules:</p><pre>import { useEffect, useState } from &quot;react&quot;;<br>import { SelectPicker } from &quot;rsuite&quot;;<br>import { getCookie,hasCookie, setCookie } from &#39;cookies-next&#39;;</pre><p>Next, define an array of language options, each with a label and value:</p><pre>const languages = [<br>    {label: &#39;English&#39;, value:&#39;/auto/en&#39;},<br>    {label: `Русский`, value:&#39;/auto/ru&#39;},<br>{label: &#39;Polski&#39;, value:&#39;/auto/pl&#39;} ];</pre><p>Then, define the component, We start by defining the component’s state using the useState hook. We will need only one state, one for selecting the language</p><pre>const [selected, setSelected] = useState(null)</pre><p>Step 3: Loading the Google Translate Script</p><p>To load the Google Translate script, we will use the useEffect hook, we will pass an empty array as the first argument, so that this effect runs only once when the component is first rendered.</p><pre>   useEffect(() =&gt; {<br>        var addScript = document.createElement(&#39;script&#39;);<br>        addScript.setAttribute(&#39;src&#39;, &#39;//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit&#39;);<br>        document.body.appendChild(addScript);<br>        window.googleTranslateElementInit = googleTranslateElementInit;<br>    }, [])</pre><p>This will create a new script element, set its source to the Google Translate script, and append it to the body of the document. It also sets a global function named “googleTranslateElementInit” that is called by the script once it’s loaded.</p><p>Step 4: Determining the selected language</p><p>To determine the selected language, we will add another block to this useEffecthook, in this block we check whether the googtrans cookie is already set, if it is set it will set the selected state to the value of the googtrans cookie, otherwise it sets the selected state to /auto/en</p><pre>if(hasCookie(&#39;googtrans&#39;)){<br>setSelected(getCookie(&#39;googtrans&#39;))<br>}<br>else{<br>setSelected(&#39;/auto/en&#39;)<br>}</pre><p>Step 5: Initializing the Google Translate feature</p><p>The “googleTranslateElementInit” function is responsible for initializing the Google Translate feature on the page. It creates a new instance of the “TranslateElement” object and configures it with options for the page language, whether to automatically display the translation, the included languages, and the layout. It also sets the target element for the Google Translate feature to be the element with an id of “google_translate_element”</p><pre>const googleTranslateElementInit = () =&gt; {<br><br>    new window.google.translate.TranslateElement({<br>        pageLanguage: &#39;auto&#39;,<br>        autoDisplay: false,<br>        includedLanguages: &quot;ru,en,pl&quot;, // If you remove it, by default all google supported language will be included<br>        layout: google.translate.TranslateElement.InlineLayout.SIMPLE<br>    },<br>        &#39;google_translate_element&#39;);<br>}</pre><p>Step 6: Handling language change</p><p>The component also includes a callback function called “langChange” that is passed to the SelectPicker component as the “onSelect” prop. It triggers when the user selects a language from the options. It takes the selected value and sets it as the value of the googtrans cookie, it also set the selected state to the selected value, and finally, it reloads the page.</p><pre>const langChange=(e,m,evt)=&gt;{<br>evt.preventDefault()<br>if(hasCookie(&#39;googtrans&#39;)){<br>setCookie(&#39;googtrans&#39;,decodeURI(e))<br>setSelected(e)<br>}<br>else{<br>setCookie(&#39;googtrans&#39;,e)<br>setSelected(e)<br>}<br>window.location.reload()<br>}</pre><p>Step 7: Render the component</p><p>Finally, we render the “google_translate_element” div, which is where the Google Translate feature will be displayed, and the SelectPicker component, which allows users to select their preferred language.</p><pre> return (<br>        &lt;&gt;<br><br>            &lt;div id=&quot;google_translate_element&quot; style={{width:&#39;0px&#39;,height:&#39;0px&#39;,position:&#39;absolute&#39;,left:&#39;50%&#39;,zIndex:-99999}}&gt;&lt;/div&gt;<br>            &lt;SelectPicker <br>             data={languages} <br>             style={{ width: 100 }} <br>             placement=&quot;bottomEnd&quot;<br>             cleanable={false}<br>             value={selected}<br>             searchable={false}<br>             className={&#39;notranslate&#39;}<br>             menuClassName={&#39;notranslate&#39;}<br>             onSelect={(e,m,evt) =&gt; langChange(e,m,evt)}<br>             placeholder=&quot;Lang&quot;/&gt; <br>        &lt;/&gt;<br><br>    )</pre><p>We hide the “google_translate_element” div so that we can show our customized picker. We add a class name notranslate so that it won’t translate the dropdown menu.</p><p>Step 8: Exporting the component</p><p>Don’t forget to export the component at the end of the file so that it can be used in other parts of your application</p><pre>export default GoogleTranslate</pre><p>And that concludes this tutorial on creating a React component that uses the Google Translate script to provide on-page translations and allows the user to select their preferred language using a dropdown menu. We have covered all the necessary steps to set up and implement this component, including installing the necessary libraries, creating the component, loading the Google Translate script, determining the selected language, initializing the Google Translate feature, handling language changes, rendering the component, and exporting the component.</p><p>That’s it! Now you have a working multilanguage feature in your React/Next.js application, which uses the Google Translate script and allows users to select their preferred language and save it in a cookie. You can also customize this component as per your requirement.</p><p>It is important to note that this is just a base example and you may want to customize the appearance and functionality of the component to suit your needs. You can add additional features, such as a button to toggle the translation on and off or change the appearance of the dropdown menu to better match your website’s design.</p><p>If you have any questions or issues with implementing this component, feel free to ask.</p><p><em>Note: This tutorial uses Google Translate script, which is free and widely supported. However, it is important to note that Google’s terms of service prohibit the use of the Google Translate API for any application that is primarily for the translation of non-public content, such as software localization, document translation, and so on.</em></p><p>If you found this article helpful, please feel free to follow me on <a href="https://www.linkedin.com/in/masuk-helal/">LinkedIn</a>. I’m constantly sharing new insights and ideas, and I’d love to connect with you and hear your thoughts as well. Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf1899f331fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>