<?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 Aditya Wibisana on Medium]]></title>
        <description><![CDATA[Stories by Aditya Wibisana on Medium]]></description>
        <link>https://medium.com/@aditya.wibisana?source=rss-5340f43bf4f8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cY5R7f3IMayu88EJ2_dHmg.jpeg</url>
            <title>Stories by Aditya Wibisana on Medium</title>
            <link>https://medium.com/@aditya.wibisana?source=rss-5340f43bf4f8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:30:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aditya.wibisana/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[ADB Wifi using Android Studio — Windows Powershell]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@aditya.wibisana/adb-wifi-using-android-studio-windows-powershell-3b1c8c3b3245?source=rss-5340f43bf4f8------2"><img src="https://cdn-images-1.medium.com/max/730/1*vAIyrfL-opvZHaX2jIskWw.png" width="730"></a></p><p class="medium-feed-snippet">I don&#x2019;t know why &#x201C;Pair new devices over Wi-Fi&#x201D; doesn&#x2019;t work seamlessly on Android Studio. At least on my Windows machine. But, using this&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@aditya.wibisana/adb-wifi-using-android-studio-windows-powershell-3b1c8c3b3245?source=rss-5340f43bf4f8------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@aditya.wibisana/adb-wifi-using-android-studio-windows-powershell-3b1c8c3b3245?source=rss-5340f43bf4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b1c8c3b3245</guid>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Aditya Wibisana]]></dc:creator>
            <pubDate>Fri, 25 Sep 2026 06:53:53 GMT</pubDate>
            <atom:updated>2026-10-01T04:13:12.162Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[QuickNote: Some React Best Practices]]></title>
            <link>https://medium.com/@aditya.wibisana/quicknote-some-react-best-practices-7aa42c6d0241?source=rss-5340f43bf4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/7aa42c6d0241</guid>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Aditya Wibisana]]></dc:creator>
            <pubDate>Thu, 05 Sep 2024 10:06:01 GMT</pubDate>
            <atom:updated>2024-09-05T10:06:01.424Z</atom:updated>
            <content:encoded><![CDATA[<p>This is my quick note that I’ve taken from <a href="https://www.youtube.com/watch?v=5r25Y9Vg2P4&amp;t=72s">https://www.youtube.com/watch?v=5r25Y9Vg2P4</a>. So, this “quick” note won’t be complete. At all. So, please visit the complete version from that site. It will also support the original creator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*97nKERSjT4J2xfnzR5E4NA.png" /></figure><h3>1. Don’t Add Layout Styles to Reusable Component</h3><p>This is an example on how to use Style wrapper. Notice that we pass children as its content, and we <strong>don’t </strong>set any margin to our wrapper. With this approach, by passing “className”, we can then override the default value, so that we only change what’s needed.</p><pre>import { twMerge } from &#39;tailwind-merge&#39; // used to merge Tailwind CSS classes<br><br>type H1Props = {<br>  children: React.ReactNode; // children will be wrapped inside our component<br>  className?: string;<br>};<br><br>// this is also called &quot;children pattern&quot;, where we pass children<br>export default function H1({ className, children } : H1Props) {<br>  const baseClassName = &quot;text-3xl lg:text-6xl font-bold tracking-tight&quot;;<br>  const mergedClassName = className == null <br>        ? baseClassName<br>        : twMerge(baseClassName, className)    <br>  return (&lt;div&gt;<br>    &lt;h1 className={mergedClassName}&gt;<br>      {children}<br>    &lt;/h1&gt;<br>  &lt;/div&gt;<br>  );<br>}</pre><p>Tips:</p><p>For type script to only accept value as predefined, use this:</p><pre>type ButtonProps = {<br>  buttonType: &quot;primary&quot; | &quot;secondary&quot; // it only accept &quot;primary&quot; or &quot;secondary&quot;<br>  onClick: () =&gt; void;<br>}</pre><h3>2. Use Component as Simple and as Reusable as Possible</h3><p>More explanation: <a href="https://youtu.be/5r25Y9Vg2P4?t=2227">https://youtu.be/5r25Y9Vg2P4?t=2227</a></p><h3>3. useMemo</h3><p>Example:</p><pre>import React, { useMemo } from &#39;react&#39;;<br><br>type Item = {<br>  id: number;<br>  value: string;<br>};<br><br>const items: Item[] = [<br>  { id: 1, value: &quot;Apple&quot; },<br>  { id: 2, value: &quot;Banana&quot; },<br>  { id: 3, value: &quot;Cherry&quot; },<br>];<br><br>function ExampleComponent() {<br>  const [filter, setFilter] = useState(&quot;&quot;);<br><br>  // useMemo: Memoize the filteredItems so it only recalculates when &#39;filter&#39; changes<br>  const filteredItems = useMemo(() =&gt; {<br>    console.log(&quot;Filtering items...&quot;);<br>    return items.filter(item =&gt; item.value.toLowerCase().includes(filter.toLowerCase()));<br>  }, [filter]);<br><br>  return (<br>    &lt;div&gt;<br>      &lt;input<br>        type=&quot;text&quot;<br>        placeholder=&quot;Filter items&quot;<br>        value={filter}<br>        onChange={(e) =&gt; setFilter(e.target.value)}<br>      /&gt;<br>      &lt;ul&gt;<br>        {filteredItems.map(item =&gt; (<br>          &lt;li key={item.id}&gt;{item.value}&lt;/li&gt;<br>        ))}<br>      &lt;/ul&gt;<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default ExampleComponent;</pre><p>Key takeaways:</p><ul><li>filteredItems is memoized using useMemo.</li><li>It only recalculates the filtered list of items when the filter value changes.</li><li>If filter doesn&#39;t change, the memoized result is returned, preventing unnecessary recalculations.</li></ul><h3>4. useCallback</h3><p>It’s similar with useMemo. The difference is that:</p><p>useMemo: Memoizes the <strong>result</strong> of a function (i.e., a computed value).</p><p>useCallback: Memoizes the <strong>function itself</strong>.</p><p>Example:</p><pre>import React, { useState, useCallback } from &#39;react&#39;;<br><br>function ParentComponent() {<br>  const [count, setCount] = useState(0);<br><br>  // useCallback: Memoize the function to avoid re-creating it on every render<br>  const handleClick = useCallback(() =&gt; {<br>    console.log(&quot;Button clicked!&quot;);<br>  }, []);<br><br>  return (<br>    &lt;div&gt;<br>      &lt;p&gt;Count: {count}&lt;/p&gt;<br>      &lt;button onClick={() =&gt; setCount(count + 1)}&gt;Increment Count&lt;/button&gt;<br>      &lt;ChildButton onClick={handleClick} /&gt;<br>    &lt;/div&gt;<br>  );<br>}<br><br>type ChildButtonProps = {<br>  onClick: () =&gt; void;<br>};<br><br>const ChildButton = React.memo(({ onClick }: ChildButtonProps) =&gt; {<br>  console.log(&quot;Rendering Button&quot;);<br>  return &lt;button onClick={onClick}&gt;Log Message&lt;/button&gt;;<br>});<br><br>export default ParentComponent;</pre><p>Key takeaways:</p><p><strong>useCallback Usage</strong>:</p><ul><li>The handleClick function is memoized using useCallback.</li><li>Since handleClick doesn&#39;t depend on any state or props, it will always remain the same between renders.</li></ul><p><strong>React.memo</strong>:</p><ul><li>The ChildButton component is wrapped in React.memo, which prevents it from re-rendering unless its props change.</li><li>Because useCallback ensures that handleClick doesn&#39;t change, ChildButton won&#39;t re-render unnecessarily.</li></ul><p><strong>Button Functionality</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jRYMfrxKFwxjPmK9fS47tA.jpeg" /></figure><ul><li>The parent component also has a button to increment a count state. When this button is clicked, the count state updates, causing the ParentComponent to re-render.</li><li>However, since handleClick is memoized, the ChildButton doesn&#39;t re-render even when the parent component does.</li></ul><h3>5. Use caching</h3><p>The idea is using “useQuery” library. However, when using NextJS framework, I think this will be done automatically.</p><p>That’s it. A lot of stuff is there on the original video. So, do not hesitant to visit it! Thanks for visiting!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7aa42c6d0241" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quick Note from video: All 29 Next.js Mistakes Beginners Make]]></title>
            <link>https://medium.com/@aditya.wibisana/quick-note-from-video-all-29-next-js-mistakes-beginners-make-9118c255a884?source=rss-5340f43bf4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9118c255a884</guid>
            <dc:creator><![CDATA[Aditya Wibisana]]></dc:creator>
            <pubDate>Wed, 04 Sep 2024 10:02:08 GMT</pubDate>
            <atom:updated>2024-09-04T10:02:08.109Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a personal quick note from <a href="https://www.youtube.com/watch?v=5QP0mvrJkiY">https://www.youtube.com/watch?v=5QP0mvrJkiY</a>. You definitely won’t get full picture what I am trying to write, so please visit the original link to get full understanding. This will also support the original creator.</p><p>A lot of things are covering Server Component vs Client Component. And it’s recommended to use Server Component as many as possible. Reasons:</p><ol><li>Faster Initial Load: Server will send direct HTML content</li><li>Reduced JavaScript Bundle Size: it won’t include client-JS code)</li><li>Better Search Engine Optimization (SEO): Content can be easily crawled, because it is a direct HTML content</li><li>Direct Data Fetching: Can access DB directly (without API)</li></ol><p>Key takeaways from the video:</p><ol><li>By default, NextJS is Server Component.</li><li>It will become Client Component when there is “use client” on the beginning of the file. Source: <a href="https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=822s">https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=822s</a></li><li>When “use client” is used, and it <strong>imports any</strong> Server Component, the server component will <strong>become Client Component</strong>. Source: <a href="https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=645s">https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=645s</a></li><li>Below will not change Server Component to Client Component. Source: <a href="https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=748s">https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=748s</a></li></ol><pre>&lt;ClientComponent&gt;<br>  &lt;ServerComponent /&gt; // this is still server component <br>&lt;/ClientComponent&gt;</pre><p>5. Any imported library, is actuall a Client Component, and we wouldn’t know about that. To make it clear, wrap it inside our own component.</p><pre>&quot;use client&quot; // our needed mark<br><br>import Carousel from &quot;react-amazing-carousel&quot;; // library that we want to add<br><br>export default Carousel // and just export it. Ensure when import, we point to this file, instead of the original library</pre><p>6. All state management (React) is not possible to be added in Server Component. Editor will show error / warning.</p><p>7. Scope of the Client Component: State Management (useState, redux), Context API</p><p>8. Scope of the Server Component: Server Action, Route Handlers (API)</p><p>9. “use server” will only work on Server’s Action (but not in Server Component). To mark something as “use server”, we can use <a href="https://www.npmjs.com/package/server-only">https://www.npmjs.com/package/server-only</a></p><p>10. To prevent leaking data, we must ensure it is Server Component. And then ensure to call using .env.</p><p>11. If we want the .env to be exposed (which is uncommon scenario), then the env should be starts with “NEXT_PUBLIC). Example: NEXT_PUBLIC_API_KEY. Source: <a href="https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=822s">https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=822s</a></p><p>12. When adding console.log to Server Component, we definitely cannot see the log in browser.</p><p>13. Never use ‘Window’ object or any Client Component on Server Component. There will be potential error problem about “content mismatched”</p><p>14. Use <em>SuppressHeaderWarning</em> if there is a problem in hydration (as emergency / last resort).</p><p>15. It’s perfectly fine to call same fetch call, because NextJS will have caching by default.</p><p>16. Prevent Waterfall effect. This is because of not using Promise.allSettled. Also, component inside component must ensure that it will not have this same problem. Source: <a href="https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=2925s">https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=2925s</a></p><p>17. Not using form action. Solution: Create “actions” folder. And pass formData to the parameter. This will prevent a LOT of code to be done in UI component. Source: <a href="https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=3192s">https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=3192s</a> .</p><pre>&lt;form action={addProduct}&gt;<br>  &lt;button type=”submit”/&gt;<br>&lt;/form&gt;<br><br>// on the action file<br>&quot;use server&quot; // because this is Server action where it will put data to the backend<br>export async function addProduct(fromData: FormData) {<br>  // to get title, for example:<br>  const title = formData.get(&quot;title&quot;) as String<br>  ...<br>}</pre><p>18. Need to “revalidatePath”, to show the reflected changes of data (when needed). Source: <a href="https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=3578s">https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=3578s</a>.</p><p>19. Server Actions can be used in Client Component. For example, in Client Component:</p><pre>import { addProduct } from “@actions/actions”; <br>// this is Server Action, NOT Server Component. <br>// And it is perectly fine to do thois</pre><p>20. Not using loading.tsx file. A simple, but useful way to know something is in the process. Just add <strong>Suspense</strong> modifier. Source: <a href="https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=4835s">https://www.youtube.com/watch?v=5QP0mvrJkiY&amp;t=4835s</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9118c255a884" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Common mistakes of (Junior) React Developer and Some Code Tips]]></title>
            <link>https://medium.com/@aditya.wibisana/common-mistakes-of-junior-react-developer-and-some-code-tips-ef058612b80e?source=rss-5340f43bf4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef058612b80e</guid>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Aditya Wibisana]]></dc:creator>
            <pubDate>Wed, 04 Sep 2024 05:37:16 GMT</pubDate>
            <atom:updated>2024-09-04T09:11:07.930Z</atom:updated>
            <content:encoded><![CDATA[<p>All of my content here is taken from <a href="https://www.youtube.com/watch?v=-yIsQPp31L0">https://www.youtube.com/watch?v=-yIsQPp31L0</a>. And this is my personal <strong>quick</strong> note from that. Of course, this “quick” note won’t be clear. For more detailed information, please have a visit on that channel. And do a subscribe, because it will support the original content creator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BiVc7B4nWig9_eH5d5-Big.png" /></figure><h3>1. Information can be derived from state / props.</h3><p>Source: <a href="https://youtu.be/-yIsQPp31L0?t=686">https://youtu.be/-yIsQPp31L0?t=686</a></p><p>Supposed that you have item, and it’s price. Every time quantity changed, total price would change. And instead of having multiple useState and useEffect like this:</p><pre>import { useEffect, useState } from &quot;react&quot;;<br><br>const PRICE_PER_ITEM = 5;<br><br>export default function Cart() {<br>  const [quantity, setQuantity] = useState(0);<br>  const [totalPrice, setTotalPrice] = useState(0);<br><br>  const handleAddItem = () =&gt; {<br>    setQuantity(quantity + 1);<br>  }<br><br>  useEffect(() =&gt; {<br>    setTotalPrice(quantity * PRICE_PER_ITEM);   <br>  }, [quantity]);<br>  <br>  ...<br><br>}</pre><p>It’s much better to just use:</p><pre>import { useEffect, useState } from &quot;react&quot;;<br><br>const PRICE_PER_ITEM = 5;<br><br>export default function Cart() {<br>  const [quantity, setQuantity] = useState(0);<br>  const totalPrice = quantity * PRICE_PER_ITEM<br><br>  const handleAddItem = () =&gt; {<br>    setQuantity(quantity + 1);<br>  }  <br>  ...<br>}</pre><p>This will just work, because when using setQuantity, element will be re-rendered, and all of the code inside will be re-executed.</p><h3>2. Updating object state instead of multiple smaller one</h3><p>Source: <a href="https://youtu.be/-yIsQPp31L0?t=480">https://youtu.be/-yIsQPp31L0?t=480</a></p><p>Imagine that you have form with multiple values. Instead of having a lot of states like:</p><pre>const [firstName, seFirstName] = useState(&quot;&quot;)<br>const [lastName, setLastName] = useState(&quot;&quot;)<br>const [email, setEmail] = useState(&quot;&quot;)<br>...</pre><p>And maintaining every single state, we can do better by:</p><pre>const [form, setForm] = useState({<br>  firstName: &quot;&quot;,<br>  lastName: &quot;&quot;,<br>  email: &quot;&quot;<br>})</pre><p>This way, we will only maintain one state. And to change our state:</p><pre>const handleChange = (e) =&gt; {<br>  setForm({<br>    …form,<br>    [e.target.name]: e.target.value<br>  });<br>};</pre><p>This will work, as long as the <strong><em>input name </em></strong>matches the <strong>property</strong> of the object.</p><h3>3. Using dummyjson.com</h3><p>Have a visit on <a href="https://dummyjson.com/">https://dummyjson.com/</a>. It will return anything that you want. No need to sign up or register, just use!</p><h3>4. Use loading state for uninitialized object</h3><p>Source: <a href="https://youtu.be/-yIsQPp31L0?t=1303">https://youtu.be/-yIsQPp31L0?t=1303</a></p><p>Example:</p><pre>type Post = {<br>  title: String;<br>  body: String;<br>}<br><br>export default function Article() {<br>  const [post, setPost] = useState&lt;Post | null&gt;(null); // initial state when value is not there yet<br>  const [loading, setLoading] = useState(true);<br>  // this will first do heavy loading<br>  useEffect(() =&gt; {<br>    fetch(&quot;https://dummyjson.com/posts/1&quot;)<br>      .then((res) =&gt; res.json())<br>      .then((data) =&gt; {<br>        setPost(data);<br>        setLoading(false);  <br>      });  <br>  }, <br>  [] // this will only be executed during component reload, first time<br>  );<br>  return (<br>  &lt;article&gt;<br>    {<br>      loading <br>        ? &quot;Loading...&quot; // when loading, it will display this<br>        : &lt;&gt;<br>            &lt;h1&gt;{post?.title}&lt;/h1&gt; // notice conditional using ?:   <br>            &lt;p&gt;{post?.body}&lt;/p&gt;<br>          &lt;/&gt;<br>    }<br>  &lt;article&gt;<br>  );<br>}</pre><h3>5. Afraid to Use Custom Hook</h3><p>Source: <a href="https://youtu.be/-yIsQPp31L0?t=1640">https://youtu.be/-yIsQPp31L0?t=1640</a></p><p>Custom hook is a way to do DRY (Don’t Repeat Yourself). Below is the base example of a custom hook, where it will show current windows width.</p><pre>const useWindowSize = () =&gt; { // variable must be started with &quot;use&quot; keyword<br>  const [windowSize, setWindowSize] = useState(0);<br>  <br>  useEffect(() =&gt; {<br>    const handleWindowSizeChange = () =&gt; {<br>      setWindowSize(window.innerWidth); // &#39;window&#39; is browser&#39;s object<br>    }<br>    windows.addEventListener(&quot;resize&quot;, handleWindowSizeChange);<br>    <br>    // this will be executed AFTER component UNMOUNT. <br>    // This is a Normal lifecycle of &quot;useEffect&quot; function, in case we want to do cleanup<br>    return () =&gt; {<br>      window.removeEventListener(&quot;resize&quot;, handleWindowSizeChange);<br>    };  <br>  }, <br>  [] // This will only be executed once the component is mounted<br>  );<br>  return windowSize; // because we want this hook to return this value<br>}</pre><p>And to use:</p><pre>export function AwesomeComponent() {<br>  const windowSize = useWindowSize(); // just call from here.<br>  return &lt;div&gt;My awesome component&lt;/div&gt;;<br>}</pre><h3>6. Cancel Previous Action (Prevent Multiple Reloading When User Click Same Item at the Same Time)</h3><p>Source: <a href="https://youtu.be/-yIsQPp31L0?t=2660">https://youtu.be/-yIsQPp31L0?t=2660</a></p><p>Use AbortController to cancel previous fetch action. Example:</p><pre>type PostBodyProps {<br>  id: number;<br>}<br><br>export function PostBody({id } : PostBodyProps) {<br>  const [text, setText] = useState(&quot;&quot;);<br>  useEffect(() =&gt; {<br>      const controller = new AbortController();<br>      fetch(`https://dummyjson.com/posts/${id}`, {<br>        signal: controller.signal, // &quot;fetch&quot; has second parameter for the signal<br>      })<br>        .then((res) =&gt; res.json())<br>        .then((data) =&gt; setText(data.body));<br>      return () =&gt; controller.abort(); // &quot;useEffect&quot; clean up lifecycle<br>    }, <br>    [id] // ensure that the rerender is done EVERY TIME id is changed. <br>  );<br>  return &lt;div&gt; <br>  {<br>      text.length === 0 <br>        ? &quot;Loading...&quot; // when text is not there yet, show this<br>        : text <br>  }<br>  &lt;/div&gt;<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef058612b80e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Voiceping Library]]></title>
            <link>https://medium.com/@aditya.wibisana/voiceping-library-764754f17087?source=rss-5340f43bf4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/764754f17087</guid>
            <category><![CDATA[voiceping]]></category>
            <category><![CDATA[android-libraries]]></category>
            <category><![CDATA[push-to-talk-app]]></category>
            <category><![CDATA[mobile-application]]></category>
            <dc:creator><![CDATA[Aditya Wibisana]]></dc:creator>
            <pubDate>Fri, 24 Nov 2023 08:22:03 GMT</pubDate>
            <atom:updated>2023-11-24T08:22:03.234Z</atom:updated>
            <content:encoded><![CDATA[<p>Voiceping library is finally available in alpha version. Have a look at <a href="https://github.com/adityawibisana/voiceping-intent">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l5DC-gJNGoeO-GwtV3OM9Q.png" /><figcaption>Voiceping library</figcaption></figure><p>The library’s use case is as follows:</p><ol><li>You need to have the PTT feature on your app, but you are in a hurry and have no time to develop a PTT app. You want your users to stay in your app’s UI.</li><li>You want to showcase to anyone that you can build PTT app within seconds :)</li><li>You don’t like Voiceping UI (ouch!)</li></ol><p>Here’s how to get started:</p><ol><li>Add Jitpack to your settings.gradle.kts</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c7745c5e2c9271a7b78b18cf9551d15b/href">https://medium.com/media/c7745c5e2c9271a7b78b18cf9551d15b/href</a></iframe><p>2. Import the library</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/712bb21d1d688db9e28b2c2ebb91c066/href">https://medium.com/media/712bb21d1d688db9e28b2c2ebb91c066/href</a></iframe><p>3. And finally, on your Application / Activity:</p><pre>Voiceping.initialize(context = this)</pre><p>That’s it!</p><p>The library is using modern <a href="https://developer.android.com/kotlin/flow/stateflow-and-sharedflow">StateFlow</a> to get Voiceping’s status. There are 3 status :</p><ol><li>User: The current user that you are using. Code:Voiceping.state.user</li><li>Channel: The current channel that you are in. Code: Voiceping.state.currentChannel</li><li>Processor: Current Voiceping state, which is either idle, playing, or in PTT mode. Code: Voiceping.state.processor</li></ol><p>And here are the things that you can do:</p><ol><li><strong>Start PTT</strong>. This will start PTT to the current channel. Code: Voiceping.action.startPTT()</li><li><strong>Stop PTT</strong>. Code: Voiceping.action.stopPTT()</li><li><strong>Search / navigate</strong> to the channel. Code: Voiceping.action.searchChannel(channelName).</li><li>Go to <strong>next channel</strong>. Code: Voiceping.action.goToNextChannel()</li><li>Go to <strong>previous channel</strong>. Code: Voiceping.action.goToPrevChannel()</li><li><strong>Login</strong>. Code: Voiceping.action.login(username, password)</li><li><strong>Stop</strong> Voiceping. Code: Voiceping.action.logout()</li></ol><p>Feel free to share any suggestions, comments, or feedback you may have. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=764754f17087" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Coding Diary #1]]></title>
            <link>https://medium.com/@aditya.wibisana/code-detective-story-1-664c2ba4d705?source=rss-5340f43bf4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/664c2ba4d705</guid>
            <dc:creator><![CDATA[Aditya Wibisana]]></dc:creator>
            <pubDate>Fri, 13 Oct 2023 06:15:20 GMT</pubDate>
            <atom:updated>2023-10-13T06:33:54.201Z</atom:updated>
            <content:encoded><![CDATA[<p>Let me start with our app’s feature: You hold volume button, and then our app will send voice message directly to the target, as long as you still hold the volume button. Once you release the volume button, it will stop sending voice message. Something like walkie talkie. Similar to Zello.</p><figure><img alt="User use Voiceping, a Walkie Talkie application" src="https://cdn-images-1.medium.com/max/1024/1*6bccFYjcYDfk9lSdynXW9Q.jpeg" /></figure><p>The feature is straightforward. But there is a complaint from the client: It will never stop sending voice message, despite client is clearly already released the volume down.</p><p>It’s confusing. I don’t think I made any breaking changes. Let’s check the log. Luckily, we’ve implemented a feature that allows us to send logs by inputting a specific text code. This way, we can analyze what’s happening.</p><p>As we already know, reading log is stressful, time consuming. Except when:</p><ol><li>Time is specified</li><li>There is a video showing the issue.</li></ol><p>Luckily, those 2 are already there. So, time to analyze. The analyzing explanation can be seen <a href="https://youtu.be/Yvg99D66yQ4">here</a>. In short: there was a hardware button malfunction. It is expected there is a release event (so that voice message is stopped), but turns out it’s not there on the log. Hardware problem.</p><p>I am relieved to know that the bug is not from our side. It’s indeed a hardware problem. Important things:</p><ol><li>Log. It really saves us a lot of time.</li><li>Video demonstration, with the correct time.</li></ol><p>So, yes, there it is. I hope we can learn something from this. Thank youfor reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=664c2ba4d705" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Starting Your Android Service]]></title>
            <link>https://medium.com/@aditya.wibisana/starting-your-android-service-properly-7f6917665ede?source=rss-5340f43bf4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f6917665ede</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Aditya Wibisana]]></dc:creator>
            <pubDate>Tue, 06 Jun 2023 11:18:01 GMT</pubDate>
            <atom:updated>2023-08-14T10:02:14.632Z</atom:updated>
            <content:encoded><![CDATA[<p>We created a PTT (Push To Talk) application called “Voiceping,” similar to Zello. It basically records audio via the microphone as long as the user presses a button. Therefore, our app must allow the use of the microphone even when the user’s screen is off.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mPYJ7Ya_9McJYtc84Zji0A.jpeg" /><figcaption>A walkie talkie. But in Android, will allows you to be connected, as long as you have internet!</figcaption></figure><p>The problem arises with Android 12. Sometimes our app fails to start recording, and the error message states:</p><blockquote>startRecording() called on an uninitialized AudioRecord.</blockquote><p>This issue appears, despite we have done the following:</p><ol><li>Calling startForegroundService</li><li>Declaring on manifest: android:foregroundServiceType=”microphone”</li></ol><p>After some investigation, we discovered that there was some “spaghetti code” in our app, which caused the foreground service to be called multiple times. Yes, this was a stupid bug on our part. However, it taught us a valuable lesson. Even though you start your service correctly by calling startForegroundService while your UI is in the foreground, if you later <em>call startForegroundService while your app is in the background</em>, you’re doomed. Android will prevent you from using the microphone.</p><p>We have fixed that problem. However, another issue has emerged: Our app’s service loses its permission again. I made sure that there are no incorrect calls to our service. I checked all the “startService” and “startForegroundService” calls, thinking that there might be a bad call or something. But nothing. It turns out that there is this one line of code:</p><pre>bindService(intent, mConnection, Context.BIND_AUTO_CREATE)</pre><p>That code is out of my radar. I never know that the code will start our service. Starting service is great. However we need to start <em>foreground service. </em>And that what the code does: start our service in background mode.</p><p>To fix that, I’ve changed the code to:</p><pre>bindService(intent, mConnection, 0)</pre><p>Notice the last parameter. It’s basically says: “Do not run the service when service is not available”. We need to run the service in <em>foreground</em>, and the correct way to do that is seen on the first code in this story.</p><p>Okay, thank you for reading this far. Let me know your experience regarding starting foreground services on Android!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f6917665ede" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Sails Policies to Manage Errors]]></title>
            <link>https://medium.com/@aditya.wibisana/managing-error-using-sails-policies-368d1713a82f?source=rss-5340f43bf4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/368d1713a82f</guid>
            <category><![CDATA[sailsjs]]></category>
            <dc:creator><![CDATA[Aditya Wibisana]]></dc:creator>
            <pubDate>Tue, 02 Aug 2022 09:33:53 GMT</pubDate>
            <atom:updated>2022-09-09T14:38:05.760Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.voicepingapp.com/">Voiceping</a> uses <a href="https://sailsjs.com/">Sails</a>, and we’re happy with it. We will show you on how to manage error by using <a href="https://sailsjs.com/documentation/concepts/policies">Policies</a>.</p><p>Case Study: We have 2 APIs, 1 for login, 1 for register. Both require “username”. If “username” is missing, error will be returned. This is how we normally write on our UserController.js :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c9119442d09998b3ae448c833a2dbbe/href">https://medium.com/media/4c9119442d09998b3ae448c833a2dbbe/href</a></iframe><p>Notice the problem. Code for handling error is written twice. We can refactor it. Let’s move our error handling to UserService.js :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/698242e1b95f335c6f382fa928a60131/href">https://medium.com/media/698242e1b95f335c6f382fa928a60131/href</a></iframe><p>Our UserController.js will now:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/347df26a0b38e6e2daaba47d8ec5ea4f/href">https://medium.com/media/347df26a0b38e6e2daaba47d8ec5ea4f/href</a></iframe><p>Looks better, right ? We can still improve it. The aim is to make Controller cleaner. The final code for UserController.js will be like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4805f7ddf5e89cb3472e17031ea43a4/href">https://medium.com/media/c4805f7ddf5e89cb3472e17031ea43a4/href</a></iframe><p>The controller is now focusing on what matters. No more error handling. We will use Policies to achieve this. Add this code, on policies.js :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/23c51bba4a13fd4c5d29cd63b947b145/href">https://medium.com/media/23c51bba4a13fd4c5d29cd63b947b145/href</a></iframe><p>Notice that we add policies called requiredParam.js . This policy requires a single string parameter. Our requiredParam.js will be like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/14215b1dc5c950584e3f5f765d61c2c2/href">https://medium.com/media/14215b1dc5c950584e3f5f765d61c2c2/href</a></iframe><p>That’s it. Our controller is cleaner. Our policy is also reusable. I hope this makes you love Sails more. If you have any questions, feel free to add to the comment below. Have a good-coding-day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=368d1713a82f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debugging node.js app on WSL (that works on mine)]]></title>
            <link>https://medium.com/@aditya.wibisana/debugging-node-js-app-on-wsl-that-works-on-mine-4743652e801a?source=rss-5340f43bf4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/4743652e801a</guid>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[visual-studio-code]]></category>
            <category><![CDATA[windows-10]]></category>
            <dc:creator><![CDATA[Aditya Wibisana]]></dc:creator>
            <pubDate>Sun, 21 Apr 2019 05:59:23 GMT</pubDate>
            <atom:updated>2019-04-21T13:54:45.171Z</atom:updated>
            <content:encoded><![CDATA[<h3>Debugging Node.js app on WSL for Node v8 and Node v4 (that works on mine)</h3><p>Straightforward: I notice that specific <a href="https://code.visualstudio.com/">VSCode</a> version fails to work on specific Node version. I will not go deeper on the reason, but I would rather show the version and launch.json file that works on mine.</p><h3>Node v8</h3><ul><li>VSCode version: <strong>1.30.1</strong></li><li>Node.js version: <strong>v8.15.1 (npm v6.4.1)</strong></li><li>Windows version: <strong>10 Version 1803 (OS build 17134.706)</strong></li><li>WSL Distro: Ubuntu 18.04</li><li>launch.json file:</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f25278e8b91570298bfa640cccb7579/href">https://medium.com/media/0f25278e8b91570298bfa640cccb7579/href</a></iframe><p>By default, VSCode will auto update app to the latest version. I notice that version 1.33 does not run well (it stopped for a moment on the breakpoints, but then continue without me doing anything). So, to prevent VSCode to do an automatic update, you must <a href="https://code.visualstudio.com/docs/getstarted/settings">override this default behavior</a>. Here are the values that you should override:</p><pre>&quot;update.mode&quot;: &quot;none&quot;,<br>&quot;update.showReleaseNotes&quot;: false,<br>&quot;update.enableWindowsBackgroundUpdates&quot;: false,<br>&quot;update.channel&quot;: &quot;none&quot;</pre><p>After all has been set, you just need to place the breakpoints as usual, and then go to Debug &gt; Start Debugging. It should stop on your desired breakpoints.</p><h3>Node v4</h3><p>For Node 4, all versions are the same with above. The only different is the <a href="https://gist.github.com/adityawibisana/de371c706cf32e0f222183c26bde64e8">launch.json </a>file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c6ca4d59bce647f7a5407f4faaa998d5/href">https://medium.com/media/c6ca4d59bce647f7a5407f4faaa998d5/href</a></iframe><p>After that, type:</p><pre>node debug app.js</pre><p>And then press the F5 button. Happy code on WSL + VSCode. Wish you luck!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4743652e801a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I am not using Linux on My Laptop]]></title>
            <link>https://medium.com/@aditya.wibisana/why-i-am-not-using-linux-on-my-laptop-2775edc6125e?source=rss-5340f43bf4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/2775edc6125e</guid>
            <dc:creator><![CDATA[Aditya Wibisana]]></dc:creator>
            <pubDate>Wed, 28 Nov 2018 02:09:29 GMT</pubDate>
            <atom:updated>2018-12-11T03:00:20.863Z</atom:updated>
            <content:encoded><![CDATA[<p>Previously, I <strong>had a chance</strong> (read: <em>forced</em>) to fully use Ubuntu on my development machine. The reason is because of additional role on my job: <strong><em>back end</em></strong> development.</p><p>I have tried Ubuntu 18.04 on my laptop. Comparing with Windows 10 (that I usually use), these are the reasons that kept me to <strong><em>not</em></strong> using Ubuntu:</p><ol><li><strong>Heat</strong>. I feel that the temperature on the keyboard part is increasing. This means it will shorten my laptop age.</li><li><strong>Slow</strong>. Because of (1), most laptop will <a href="https://en.wikipedia.org/wiki/Underclocking">underclock</a> its CPU to reduce the hot temperature. Lower CPU clock means lower performance.</li><li><strong>Not supported mouse driver. </strong>I am using gaming mouse which has 8 additional buttons, and those buttons are no longer usable. In addition, the mouse movement is not as smooth as on Windows machine.</li><li><strong>Slow Bluetooth start up time. </strong>My laptop boot time is ~3 secs, but I have to wait for ~15 secs to make my Bluetooth keyboard ready.</li><li><strong>Blurry font. </strong>Font seems to be blurry, not too sharp.</li><li><strong>Missing </strong><a href="https://www.sourcetreeapp.com/"><strong>SourceTree</strong></a>. My lovely Git client GUI, which is very easy to use for Git stuff.</li></ol><p>However, Ubuntu 18.04 is having things that I like, which are:</p><ol><li><strong>Better UI. </strong>It is beautiful and refreshing. Kudos to the UI/UX guys on Ubuntu for this part.</li><li><strong>No “Watermark to activate Windows”</strong>. We don’t have to pay for some $ to remove this watermark. Ubuntu is completely free.</li><li><strong>Better search Integration.</strong> Press ‘Windows button’, type anything. It can search for app that has been installed or not yet installed on your machine. Really handy.</li><li><strong>No registry.</strong> Everything is done on a plain config file, and you’re done with it.</li><li><strong>Very easy to do SSH</strong>. If you’re a back end developer, this goes without saying.</li></ol><p>I know this post will trigger some Linux users by saying:</p><blockquote>You’re not a good Linux user. You can search all of them to fix all of your issues.</blockquote><ol><li>Yeah, I am just a casual Laptop user. Not Linux expert.</li><li>I know that if I am spending my time to search, I will be able to fix (some of) those issues. But, this search will takes a very long time. I can use this time to:</li></ol><p>Do cycling:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UZ34GJiCHTFMrXPJNnnUiw@2x.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xUhdz6NMOqAowfCWSh9gOg@2x.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*bzWKy62KnVdSsHmrgTemQA@2x.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*ANRmfgwd7SG4R2PkhHhotQ@2x.jpeg" /></figure><p>Play with my son:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BF2Xkf0Iym0TLP-b0KLnOg@2x.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KsLHRjf_bR5s3Y7j_7HMiQ@2x.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7wei7a7kkQAM1OEurZzsUg@2x.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QwKPMoK5n_-ThsYq42DPHQ@2x.jpeg" /></figure><p>Write a <a href="http://aditya-wibisana.blogspot.com/">blog post</a>, watch YouTube tutorial to improve more useful skill, such as <a href="https://sailsjs.com/">Sails</a>, <a href="https://developer.android.com/">Android</a>, <a href="https://www.youtube.com/watch?v=LO1mTELoj6o">life development</a>, or even just <a href="https://www.youtube.com/channel/UCFaV5im11vfhDs1BaaF9a0A">watch my favorite Clash Royale player beat his opponents</a>. Anything. You name it.</p><p>Thanks for reading, and have a nice day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2775edc6125e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>