<?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 Yoga Puniatmaja on Medium]]></title>
        <description><![CDATA[Stories by Yoga Puniatmaja on Medium]]></description>
        <link>https://medium.com/@yoga_puniatmaja?source=rss-f0896ecf9d24------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Xu2OCKNHkwCq_LYW8uBIxQ.jpeg</url>
            <title>Stories by Yoga Puniatmaja on Medium</title>
            <link>https://medium.com/@yoga_puniatmaja?source=rss-f0896ecf9d24------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 00:39:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yoga_puniatmaja/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[Key Lessons to Kickstart Your Programming Career]]></title>
            <link>https://medium.com/@yoga_puniatmaja/key-lessons-to-kickstart-your-programming-career-441966cc4d18?source=rss-f0896ecf9d24------2</link>
            <guid isPermaLink="false">https://medium.com/p/441966cc4d18</guid>
            <category><![CDATA[programming-journey]]></category>
            <category><![CDATA[php-basic]]></category>
            <category><![CDATA[codingexperience]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[beginner-programmers]]></category>
            <dc:creator><![CDATA[Yoga Puniatmaja]]></dc:creator>
            <pubDate>Mon, 19 Aug 2024 15:23:59 GMT</pubDate>
            <atom:updated>2024-08-19T15:23:59.305Z</atom:updated>
            <content:encoded><![CDATA[<p>Find something that interests you.</p><figure><img alt="generated using designer.microsoft.com" src="https://cdn-images-1.medium.com/max/1024/1*xbMUY4I2imhrY5srtK7yTA.jpeg" /><figcaption>generated using designer.microsoft.com</figcaption></figure><p>When in early moment i don’t understand what is programing, it’s new world for me, I just jumped into it, with thought, i can become a professional in the computer.</p><h4>Meet Java</h4><p>I don’t understand what is programming, the first thing I learn was html, I thought programming was that easy, I just write and happy, I feel like I’m smart because understand what it is.</p><p>After a few classes later, teacher brought java into the class, and I think.</p><blockquote>“What i learn before?”</blockquote><p>I don’t understand what it’s, event “if” statement i don’t understand at that time, to hard for me to understand why from the start new file for deliver one line <em>“hello world” </em>it takes a lot of lines to be written,<em> </em>i only write line by line, copying from book without understand what it’s.</p><p>Until graduate, i don’t understand how to using java. at that time i thought java it’s not interesting.</p><pre>public class HelloWorld {<br>    public static void main(String[] args) {<br>        System.out.println(&quot;Hello, World!&quot;);<br>    }<br>}</pre><h4><strong>Meet PHP</strong></h4><p>In one subject class i meet PHP, not like java, PHP just need one line code to deliver one line <em>“hello world”</em>, it’s simple, just need one line. I can running PHP and have result into browser, maybe that why i don’t understand java because I don’t have result instantly.<br>Instantly make me interested, combine with html to change static web into dynamic, it’s look cool.</p><p>After that moment, I‘m constantly exploring more and more.</p><pre>&lt;?php echo &quot;Hello, World!&quot;;</pre><h4>What You Need to Understand at the Beginning?</h4><h4><strong>Variables</strong></h4><p>Learn how to store and manipulate data.<br>first step is simple, knowing what is variable. simply variable is place for store data like string, integer or array object, but at that time i don’t understand at all. why write “$var”, i don’t know where they come, my teacher just explain to me the variable is for store some data<br>at that time.</p><p>In my place internet is not free and expensive for school children, event i am in computer school, the internet not good enough, just need pay more for get good internet, it makes it harder to find information, i am learn a lot from book. yes from book, copy manually.</p><p>But right now is more easily to got accurate information and fast.</p><pre>&lt;?php<br>$greeting = &quot;Hello, World!&quot;;<br>$number = 42;<br>$floatNumber = 3.14;<br>$isTrue = true;<br><br>echo $greeting; // Outputs: Hello, World!<br>echo $number; // Outputs: 42<br>echo $floatNumber; // Outputs: 3.14<br>echo $isTrue; // Outputs: 1 (true is represented as 1 in PHP)<br>?&gt;</pre><p>in PHP no need declaration variable like java, just use “$” all type data is can be stored.</p><h4>Control Structures</h4><p>loops (for, while), conditionals (if, else), and switch statements.<br>loops usually use variable array to scan all data in array, conditionals statement usually use for validation one data or more, and switch statement little bit same like “if else” this use for conditional branching based on the value of a variable.</p><pre>&lt;?php<br><br>////// ------<br>////// ------<br>////// ------<br><br>$age = 20;<br>if ($age &gt;= 18) {<br>    echo &quot;You are an adult.&quot;;<br>} elseif ($age &gt;= 13) {<br>    echo &quot;You are a teenager.&quot;;<br>} else {<br>    echo &quot;You are a child.&quot;;<br>}<br><br>////// ------<br>////// ------<br>////// ------<br><br>$day = &quot;Monday&quot;;<br>switch ($day) {<br>    case &quot;Monday&quot;:<br>        echo &quot;Start of the work week.&quot;;<br>        break;<br>    case &quot;Friday&quot;:<br>        echo &quot;Almost the weekend!&quot;;<br>        break;<br>    case &quot;Saturday&quot;:<br>    case &quot;Sunday&quot;:<br>        echo &quot;It&#39;s the weekend!&quot;;<br>        break;<br>    default:<br>        echo &quot;Just another day.&quot;;<br>}<br><br>////// ------<br>////// ------<br>////// ------<br><br>$count = 1;<br>while ($count &lt;= 5) {<br>    echo &quot;Count is: $count\n&quot;;<br>    $count++;<br>}<br><br>////// ------<br>////// ------<br>////// ------<br><br>for ($i = 1; $i &lt;= 5; $i++) {<br>    echo &quot;Iteration: $i\n&quot;;<br>}<br>?&gt;</pre><h4>Functions</h4><p>Study how to write and use functions to organize code and reuse functionality.<br>function is step for make logic what you want get, like provide a list data for showing in your page.</p><pre>&lt;?php<br>function greet($name) {<br>    echo &quot;Hello, &quot; . $name . &quot;!&quot;;<br>}<br><br>greet(&quot;Alice&quot;); // Outputs: Hello, Alice!<br>greet(&quot;Bob&quot;); // Outputs: Hello, Bob!<br>?&gt;</pre><h4><strong>Conclusion</strong></h4><p>No matter what languages do you use, all languages ​​are almost the same in how to use them, the important is what language is make you interest, that will make up your motivation to understand more and more, <br>you need explore more to know what you like to use. right now I’m using java for work as mobile programing, from not understanding it, to now using it for work, next time i will share how i can use java.</p><p>Thankyou for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=441966cc4d18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10+ Utils help Me as Programer Life More easly]]></title>
            <link>https://medium.com/@yoga_puniatmaja/10-utils-help-me-as-programer-life-more-easly-34de0e4dc8b6?source=rss-f0896ecf9d24------2</link>
            <guid isPermaLink="false">https://medium.com/p/34de0e4dc8b6</guid>
            <category><![CDATA[programming-tips]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Yoga Puniatmaja]]></dc:creator>
            <pubDate>Mon, 22 Jul 2024 12:35:11 GMT</pubDate>
            <atom:updated>2024-07-22T12:38:23.560Z</atom:updated>
            <content:encoded><![CDATA[<h3>10+ Utils Help Me as Programer Life More Easly</h3><p>Every time you repeate your code place into utils.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-QneFldAGH5yWJAIAS73Rw.png" /><figcaption>Generated using : midjourney</figcaption></figure><p>when I write code, this often come to my mind</p><blockquote>“ hem.. I already write this before, but where?”</blockquote><p>and then I try write again and after a hour I remember where it is, and that make waste time.</p><p>That make me thinking</p><blockquote>“why I am write this again..!”</blockquote><p>where that time can be used to think about other things, i used for write what already I am thinking before</p><p>and I said</p><blockquote>“I am can’t write this same code again and again!”</blockquote><p>I decide make file and I named Utils, I place code that will be used repeatedly.</p><p>I copy the code and I ceated a function with a name that I found easy to call whenever I needed it</p><p>I do this every time I encounter the same thing, which makes me write code over and over again, one by one it makes a lot of code, and now I easy do the same thing quickly.</p><p>I will share with you what I do to make that simple stuf…</p><ol><li><strong>Deep Clone Function</strong></li></ol><p>This function is use easly copy object, why I need this?<br>Well usualy when I have array with nested object and i need modify data where i don’t want to change the main data i use this.</p><pre>function deepClone(obj) {<br>  return JSON.parse(JSON.stringify(obj));<br>}<br><br>// Example usage:<br>const original = { a: 1, b: { c: 2 } };<br>const copy = deepClone(original);<br>console.log(copy); // { a: 1, b: { c: 2 } }</pre><p>When you not clone data and just simple use main data in new variable, that will change main data while you change data in new variable.</p><p><strong>2. Capitalize Function</strong></p><p>This function convert string to String Capitalizes.</p><pre> function capitalize(str) {<br>  if (typeof str !== &#39;string&#39;) return &#39;&#39;;<br>  return str.charAt(0).toUpperCase() + str.slice(1);<br>}<br><br>console.log(capitalize(&#39;hello world&#39;)); // &#39;Hello world&#39;</pre><p>I usualy use this function for simple format title to make title Capitalizes at the first letter.</p><p><strong>3. Price Formatter</strong></p><p>Function for make hole program price format consistenly.</p><pre>function formatPrice(value) {<br>  return new Intl.NumberFormat(&#39;id-ID&#39;, { style: &#39;currency&#39;, currency: &#39;IDR&#39; }).format(value);<br>}<br><br>console.log(formatRupiah(100000)); // Rp100.000,00<br>console.log(formatRupiah(100500.50)); // Rp100.500,50</pre><p>When need print price, I will call this function to make format price,<br>when anytime need change currency type, simplely I just need change one of piece this code.</p><p><strong>4. Unique Array Function</strong></p><p>Removes duplicate values from an array.</p><pre>function uniqueArray(arr) {<br>    return [...new Set(arr)];<br>}<br><br>// Example usage:<br>const arrayWithDuplicates = [1, 2, 2, 3, 4, 4, 5];<br>const uniqueArrayResult = uniqueArray(arrayWithDuplicates);<br>console.log(uniqueArrayResult); // [1, 2, 3, 4, 5]</pre><p><strong>5. Format Date Function</strong></p><p>Formats a JavaScript Date object into a readable string.</p><pre>function formatDate(date, format) {<br>    const map = {<br>        &#39;MM&#39;: (&#39;0&#39; + (date.getMonth() + 1)).slice(-2),<br>        &#39;DD&#39;: (&#39;0&#39; + date.getDate()).slice(-2),<br>        &#39;YYYY&#39;: date.getFullYear(),<br>        &#39;HH&#39;: (&#39;0&#39; + date.getHours()).slice(-2),<br>        &#39;mm&#39;: (&#39;0&#39; + date.getMinutes()).slice(-2),<br>        &#39;ss&#39;: (&#39;0&#39; + date.getSeconds()).slice(-2),<br>    };<br><br>    return format.replace(/MM|DD|YYYY|HH|mm|ss/gi, matched =&gt; map[matched]);<br>}<br><br>// Example usage:<br>const now = new Date();<br>const formattedDate = formatDate(now, &#39;YYYY-MM-DD HH:mm:ss&#39;);<br>console.log(formattedDate); // e.g., &#39;2024-07-18 14:35:45&#39;</pre><p>This can also be used to perform other, more specific formats, for example</p><p>format date only</p><pre>function getDate(date){<br>  const formattedDate = formatDate(now, &#39;YYYY-MM-DD&#39;);<br>  return formattedDate;<br>}<br><br>// Example usage:<br>const now = new Date();<br>const date= getDate(now);<br>console.log(date); // e.g., &#39;2024-07-18&#39;</pre><p>format time only</p><pre>function getTime(date){<br>  const formattedDate = formatDate(now, &#39;HH:mm:ss&#39;);<br>  return formattedDate;<br>}<br><br>// Example usage:<br>const now = new Date();<br>const time= getTime(now);<br>console.log(time); // e.g., &#39;14:35:45&#39;</pre><p>You can customize what you need to do</p><p><strong>6. Check if Object is Empty Functio</strong>n</p><pre>function isEmptyObject(obj) {<br>    return Object.keys(obj).length === 0 &amp;&amp; obj.constructor === Object;<br>}<br><br>// Example usage:<br>const emptyObj = {};<br>const isEmpty = isEmptyObject(emptyObj);<br>console.log(isEmpty); // true</pre><p>when you write validation in condition directly, the code will belong, that make hard to read.</p><p><strong>7. Get Day Difference Function</strong></p><pre>function getDayDifference(date1, date2) {<br>    const oneDay = 24 * 60 * 60 * 1000; // milliseconds in one day<br>    const diffInTime = new Date(date2) - new Date(date1);<br>    return Math.round(diffInTime / oneDay);<br>}<br><br>// Example usage:<br>const daysDiff = getDayDifference(&#39;2024-01-01&#39;, &#39;2024-07-18&#39;);<br>console.log(daysDiff); // 199 Day</pre><p>This function Calculates the number of days between two dates.</p><p><strong>8. Truncate Text Function</strong></p><pre>function truncateText(text, maxLength) {<br>    if (text.length &gt; maxLength) {<br>        return text.substring(0, maxLength) + &#39;...&#39;;<br>    }<br>    return text;<br>}<br><br>// Example usage:<br>const longText = &#39;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&#39;;<br>const truncatedText = truncateText(longText, 20);<br>console.log(truncatedText); // &#39;Lorem ipsum dolor si...&#39;</pre><p>Truncates a string to a specified length and appends ellipsis if necessary.</p><p><strong>9. Sort Array of Objects by Key Function</strong></p><pre>function sortByKey(array, key) {<br>    return array.sort((a, b) =&gt; {<br>        const x = a[key];<br>        const y = b[key];<br>        return (x &lt; y) ? -1 : (x &gt; y) ? 1 : 0;<br>    });<br>}<br><br>// Example usage:<br>const books = [<br>    { title: &#39;Harry Potter&#39;, author: &#39;J.K. Rowling&#39;, year: 1997 },<br>    { title: &#39;To Kill a Mockingbird&#39;, author: &#39;Harper Lee&#39;, year: 1960 },<br>    { title: &#39;The Great Gatsby&#39;, author: &#39;F. Scott Fitzgerald&#39;, year: 1925 }<br>];<br>const sortedBooks = sortByKey(books, &#39;year&#39;);<br>console.log(sortedBooks);<br>/*<br>[<br>    { title: &#39;The Great Gatsby&#39;, author: &#39;F. Scott Fitzgerald&#39;, year: 1925 },<br>    { title: &#39;To Kill a Mockingbird&#39;, author: &#39;Harper Lee&#39;, year: 1960 },<br>    { title: &#39;Harry Potter&#39;, author: &#39;J.K. Rowling&#39;, year: 1997 }<br>]<br>*/</pre><p>Sorts an array of objects by a specified key.</p><p><strong>10. Find Maximum Value in Array Function</strong></p><pre>function findMax(array) {<br>    return Math.max(...array);<br>}<br><br>// Example usage:<br>const numbers = [1, 5, 2, 9, 3];<br>const maxNumber = findMax(numbers);<br>console.log(maxNumber); // 9</pre><p>Finding for the greatest value in array. for this function, i rearly use it.</p><p><strong>11. Count Words in String Function</strong></p><pre>function countWords(str) {<br>    return str.split(/\s+/).filter(word =&gt; word.length &gt; 0).length;<br>}<br><br>// Example usage:<br>const sentence = &#39;Hello, how are you today?&#39;;<br>const wordCount = countWords(sentence);<br>console.log(wordCount); // 5</pre><p>Count Words is used for check how long your string.</p><p><strong>12. Check Email Validity Function</strong></p><pre>function isValidEmail(email) {<br>    const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;<br>    return regex.test(email);<br>}<br><br>// Example usage:<br>const emailAddress = &#39;test@example.com&#39;;<br>const validEmail = isValidEmail(emailAddress);<br>console.log(validEmail); // true</pre><p>This function used to check email is valid or not.</p><p><strong>13. Trim Whitespace from Start and End Function</strong></p><pre>function trimWhitespace(str) {<br>    return str.trim();<br>}<br><br>// Example usage:<br>const text = &#39;   hello world   &#39;;<br>const trimmedText = trimWhitespace(text);<br>console.log(trimmedText); // &#39;hello world&#39;</pre><p>This function removes leading and trailing whitespace from a string.</p><p>Now any time I create new project, I take this file into new project.<br>Hopefully this simple writes useful for you who have read it.</p><p><em>Thank you for reading this post!! 💜</em></p><p><em>Leave </em><strong><em>👏</em></strong><em> or ✍️ if you like it.</em></p><p><em>Thank you!!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34de0e4dc8b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>