<?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 Tim Hoang on Medium]]></title>
        <description><![CDATA[Stories by Tim Hoang on Medium]]></description>
        <link>https://medium.com/@sanohoang?source=rss-25564a342227------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*b9yzoHxcxf4M27Bh5b8BAw.jpeg</url>
            <title>Stories by Tim Hoang on Medium</title>
            <link>https://medium.com/@sanohoang?source=rss-25564a342227------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:52:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sanohoang/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[Imposter?]]></title>
            <link>https://medium.com/@sanohoang/imposter-fccf5c54084e?source=rss-25564a342227------2</link>
            <guid isPermaLink="false">https://medium.com/p/fccf5c54084e</guid>
            <category><![CDATA[prisma]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[flask]]></category>
            <dc:creator><![CDATA[Tim Hoang]]></dc:creator>
            <pubDate>Wed, 24 May 2023 03:17:39 GMT</pubDate>
            <atom:updated>2023-05-24T03:17:39.015Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*c6f0ln4gYM1B9PjG-srcBA.jpeg" /><figcaption>I made it but I don’t know how………</figcaption></figure><p>What do we do once we learn something? Refine those skills or pick up something new? There are no right or wrong answers to that question however, understanding your flaws will give you the answer you need.</p><p>These last few weeks have been a rollercoaster of good and bad. As I tackle my last challenge in my course, my full-stack capstone, I start to question my decisions. Instead of using what I learned these past 9 weeks: React, Python, Flask; I thought of this “brilliant” idea of using something completely new, Next.js and Prisma.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*lkodekqvEqlJ9fMvhPMSaQ.png" /></figure><p>The thought process was keen, since I was about to start looking for jobs, I figured it would be good to put myself in the position as if I were about to start a new job; learning new things. It was also to put down as a new skill learned.</p><p>So what is the issue? Using Next.js and Prisma is not only a different structure, it is a completely different paradigm. Where Python/Flask creates backend routes to query the database in an app.py file, Next.js/Prisma allow you to shorthand the code in an API folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4--Z6PY4kx_l9hp-ILnKRQ.png" /><figcaption>for Python/Flask, in your server folder, you have a file app.py where you write your backend routes</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*kCTb1vj0rXjqaryZr8XoJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*9CWHNLAgz0gr2myrFVtrjA.png" /><figcaption>With Prisma and Next, you have a lib directory with a file prisma.js that allows you to set a variable for PrismaClient that you can import throughout your app. You only need one prisma.js file. You can then create your routes in your pages/api directory like the second picture.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*D61SM5U3yhEji1skWjCVlw.png" /><figcaption>If you look at the URL here, it will show your query set above.</figcaption></figure><p><a href="https://nextjs.org/">Next.js</a> is a framework for React. Per <a href="https://www.freecodecamp.org/news/next-vs-react/">freecodecamp</a>, “everything we can do in React, we can also do in Next.js — with some additional features like routing, API calls, authentication, and more”. You no longer have to import Routes from React/Router, instead, you create directories as the endpoints in the pages directory or app directory depending on which version of Next.js you use. Next.js also uses server-side rendering whereas React uses client-side rendering.</p><p>Client-side is what we see on the screen or the user interface. It is the front-end of the code we write. Server-side is just the opposite, back-end code, something we can’t see. Server-side allows for much quicker load times, pre-rendering the content in advance before loading in the browser.</p><p><a href="https://www.prisma.io/">Prisma</a> is the next-generation Node.js and Typescript ORM. Per the <a href="https://www.prisma.io/">Prisma</a> web, “Prisma makes it easy for developers to reason about their database queries by providing a clean and type-safe API for submitting database queries which returns <em>plain old JavaScript objects”</em>. The schema setup is a lot nicer and cleaner to look at vs Python/Flask. It also uses Prisma studio to display the tables you created, which makes it simple to work with.</p><pre>// This is an example of Prisma<br>generator client {<br>  provider = &quot;prisma-client-js&quot;<br>}<br><br>datasource db {<br>  provider = &quot;postgresql&quot;<br>  url = env(&quot;DATABASE_URL&quot;) // uses connection pooling<br>  directUrl = env(&quot;DATABASE_URL_NON_POOLING&quot;) // uses a direct connection<br>  shadowDatabaseUrl = env(&quot;DATABASE_URL_NON_POOLING&quot;) // used for migrations<br>}<br><br>model User {<br>  id         Int @id @default(autoincrement())<br>  username   String  @unique<br>  age        Int? // the ? is to make it nullable<br>  bio        String?<br>  createdAt  DateTime  @default(now()) @map(name: &#39;created_at&#39;)<br>  updatedAt  DateTime  @updatedAt  @map(name: &#39;updated_at&#39;)</pre><pre># This is an example of Flask<br>from flask_sqlalchemy import SQLAlchemy<br><br>db = SQLAlchemy()<br><br>db.init_app(app)<br><br>class User(db.Model)<br>    __tablename__ = &#39;users&#39;<br><br>    id = db.Column(db.Integer, primary_key=True)<br>    username = db.Column(db.String, Nullable=False, unique=True)<br>    age = db.Column(db.String)<br>    bio = db.Column(db.String)<br>    created_at = db.Column(db.DateTime, server_default=db.func.now())<br>    updated_at db.Column(db.DateTime, onupdate=db.func.now())</pre><p>Although Next.js and Prisma have amazing features and allow for much cleaner code, it is definitely hard to learn and adjust given the short time frame. I feel like had I stuck with what I learned, I could have possibly got a lot more done but as it stands, I do not regret my decision to learn something new.</p><p>As my journey with Flatiron ends, I start to realize that there is still so much for me to learn and understand. The feeling of not knowing has already become second nature to me. The days I feel imposter syndrome means I just have to keep looking for answers and learn. This is but one chapter in my life.</p><h3>Sources</h3><ul><li><a href="https://newsroom.lmu.edu/wp-content/uploads/2023/02/Nepo-Entrepreneurs-Can-Trigger-Impostor-Syndrome.-3-Steps-to-Counter-It.jpg">imposter pic</a></li><li><a href="https://www.freecodecamp.org/news/next-vs-react/">freecodecamp</a></li><li><a href="https://nextjs.org/">next.js</a>w</li><li><a href="https://www.prisma.io/">prisma.io</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fccf5c54084e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Algorithm?]]></title>
            <link>https://medium.com/@sanohoang/why-algorithm-947f32d873cf?source=rss-25564a342227------2</link>
            <guid isPermaLink="false">https://medium.com/p/947f32d873cf</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[logic]]></category>
            <dc:creator><![CDATA[Tim Hoang]]></dc:creator>
            <pubDate>Sun, 07 May 2023 22:02:07 GMT</pubDate>
            <atom:updated>2023-05-11T19:07:29.507Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*WE6ngWbhi8D9YSBiXWOClQ.jpeg" /></figure><p>What is an algorithm? An algorithm is a finite set of instructions carried out in a specific order to perform a particular task. Per <a href="https://www.simplilearn.com/tutorials/data-structure-tutorial/what-is-an-algorithm#why_do_you_need_an_algorithm">simplilearn</a>, it is not the entire program or code; it is simple logic to a problem represented as an informal description in the form of a flowchart or pseudocode. It’s used to find the best possible way to solve a problem and typically the most efficient way.</p><p>Being able to understand and implement algorithm in your code will not only increase your skills but also further your growth in your everyday work… but where do we begin? There are multiple sites that can help you start, <a href="https://leetcode.com/">leetcode</a>, <a href="https://projecteuler.net/archives">ProjectEuler</a>, <a href="https://www.hackerrank.com/interview/interview-preparation-kit">hackerrank</a>, etc.; each one having problems that become increasingly harder as you progress. No matter your skill level, I would recommend attempting an “easy” problem first to set a base on where you stand.</p><p>This is the first challenge from <a href="https://projecteuler.net/problem=1">ProjectEuler</a>.</p><p><em>Below I am using Python for the challenges.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tf5AEKHq8Ulf4lznFIUtGA.png" /></figure><p>Let’s break this down:</p><p>We need to find the sum of all the multiples of 3 or 5 below 1000</p><ul><li><em>example:</em> <strong>[3, 5, 6, 9]</strong><em>(multiples of 3 and 5)</em> == <strong>sum of 23</strong> <em>(add the numbers together to get 23)</em></li></ul><ol><li>Find all the natural numbers below 1000</li><li>Check each number to see if it is a multiple of 3 or 5</li><li>Accumulate the number if it is a multiple</li></ol><p>With my time coding, I have found breaking challenges down helps alleviate some of the intimidation that we may feel initially. It also helps to understand what the goal is and the steps to get there.</p><p>So how do we start? We know that we need the numbers below 1000, so that tells me that we need a <a href="https://www.w3schools.com/python/ref_func_range.asp#:~:text=The%20range()%20function%20returns,stops%20before%20a%20specified%20number.">range</a>(). The range() function returns a sequence of numbers to which you set. It can take up to 3 arguments: the first being where to start, default is 0; second, where we need to stop without including it; third, how we want to step (if we put 2, it will increment by 2s otherwise default with 1).</p><pre>range(1000)</pre><p>To check each number, we will need to use a loop, in this case a “for” loop. By looping through our range, we can set a set a condition to check if the number is a multiple of 3 or 5 and print those numbers.</p><pre>for n in range(1000):<br>    if n % 3 == 0 or n % 5 == 0:<br>        print(n)</pre><p>In the loop above, n will be the number that is divisible by 3 or 5. The “%” is used as a remainder operator. We are using this to divide the number and making sure the remainder is equal to 0. Printing (n) will show all the numbers that met that condition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*6RMnqnmxwomVKLG2OZ2PGQ.png" /><figcaption>The output of printing (n) would look something like this but up to 999.</figcaption></figure><p>Now to accumulate those numbers, we need to set a variable equal to 0 and increase that variable by each corresponding number. We will need to refactor our code.</p><pre>total = 0<br>for n in range(1000):<br>    if n % 3 == 0 or n % 5 == 0:<br>        total += n<br><br>print(total)</pre><p>Now when the loop runs, each number that meets the condition will be added to the total. Printing (total) outputs 233,168 which is the sum of all the numbers in that sequence, thus completing your first challenge. Let’s take a look at a harder challenge from <a href="https://leetcode.com/problems/house-robber/description/">leetcode</a> with an acceptance rate of 49.5%.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TA0UKJD1BQ7ZllhHXdmKBA.png" /></figure><p>Following the same process as before, let’s break this down:</p><p>We need to retrieve the most money without hitting adjacent houses.</p><ul><li><em>(Think of the List as the street, each index as a house, and number as the value)</em></li></ul><ol><li>Start with the first house</li><li>Check if the List is 1 house long, if only 1 house, return that amount</li><li>If 2, return the highest of the two</li><li>Check the amount if we include the current house and 2 houses down</li><li>Compare the amount to the skipped house</li><li>Return the highest accumulated possibility</li></ol><p>We show two examples above, both give us a variable <em>nums</em>. <em>Nums</em> in both is equal to a List of numbers. Just like before, since we need to check each index, it is safe to assume we will be using a “for” loop with a range() but since we are working with a List, we want the first value so we will give it a start of 1 and end with the length of the List using our len() helper method.</p><pre># idx will be our index that we check<br>for idx in range(1, len(nums)):</pre><p>Since we need to get an accumulated value, we will need to set a variable. The variable in this situation will be set to a [List] that has one index with the value of 0. We will then append the first index of <em>nums </em>to our variable List so we can compare the two.</p><pre>def rob(nums):<br>    riches = [0]<br>    riches.append(nums[0])</pre><p>If <em>nums</em> only had one index, we would return that since there are constraints in our challenge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*VLWyESeJXMBtl6j6yCwlQg.png" /><figcaption>The first means that the <em>nums</em> L<em>ist</em> needs to be greater than/equal to 1 and less than/equal to 100. The second means each index of <em>nums</em> needs to be greater than/equal to 0 and less than/equal to 400.</figcaption></figure><p>Going back to our loop, with the variable that we just set, <em>[riches]</em>, since it has the first index of <em>[nums]</em> appended to it, we can write some logic to add the next index of <em>[nums]</em>, <strong>2</strong>, to our first index of <em>[riches]</em>, <strong>0</strong>. This will be our setup to skip houses and check if the accumulated value is greater than the prior. If it is, we can append that value to our <em>[riches]</em>.</p><pre>def rob(nums):<br>    riches = [0]<br>    riches.append(nums[0])<br>    for idx in range(1, len(nums)):<br>        with_current = nums[idx] + riches[idx - 1]<br>        not_with_current = riches[idx]<br>        riches.append(max(with_current, not_with_current)</pre><p><em>with_current = nums[idx] + riches[idx — 1]</em></p><ul><li>We are setting a variable that is equal to the sum of the current house in <em>[nums]</em> and two houses prior.</li></ul><p><em>not_with_current = riches[idx]</em></p><ul><li>This variable will be equal to the current index of <em>[riches]:</em> the highest accumulated value in <em>[nums]</em>.</li></ul><p><em>riches.append(max(with_current, not_with_current)</em></p><ul><li>Using the max() helper method, we are comparing then appending the higher to our <em>[riches]</em>.</li></ul><p>Now that we have our method written out, we need to make sure we return what we want to see: the highest accumulated value of <em>[nums]</em>. <em>[riches]</em> has been appending all of the higher values, so grabbing the last will suffice the solution.</p><pre>def rob(nums):<br>    riches = [0]<br>    riches.append(nums[0])<br>    for idx in range(1, len(nums)):<br>        with_current = nums[idx] + riches[idx - 1]<br>        not_with_current = riches[idx]<br>        riches.append(max(with_current, not_with_current))<br>    return riches[-1]</pre><p><em>With a [List], to grab the last index, we can use -1.</em></p><p>Now if we run our method with both the examples above, it should return the same output given.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H-n59_o7PVs93h-qvYNzYA.png" /><figcaption>example 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zo9SJFr-Tjzo7ZSkr0M7FA.png" /><figcaption>example 2</figcaption></figure><p>These are just two of many algorithm challenges but you can see how much harder it can become. Understanding algorithm helps one think out of the box and find the best possible way to find a solution. The greatest thing about this, is that there are multiple ways to complete these challenges; different algorithms for the same challenge, some better than others.</p><h3>Sources</h3><ul><li><a href="https://www.simplilearn.com/tutorials/data-structure-tutorial/what-is-an-algorithm#why_do_you_need_an_algorithm">What is an Algorithm?</a></li><li><a href="https://leetcode.com/">Leetcode</a></li><li><a href="https://projecteuler.net/archives">ProjectEuler</a></li><li><a href="https://www.hackerrank.com/interview/interview-preparation-kit">HackerRank</a></li><li><a href="https://www.w3schools.com/python/ref_func_range.asp#:~:text=The%20range()%20function%20returns,stops%20before%20a%20specified%20number.">Range()</a></li><li><a href="https://www.nag.com/sites/default/files/styles/video/public/2020-08/ai-icons.jpeg?itok=NzVnk5sT">Title image</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=947f32d873cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use the Debugger]]></title>
            <link>https://medium.com/@sanohoang/use-the-debugger-4c2e00757bad?source=rss-25564a342227------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c2e00757bad</guid>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[ipdb]]></category>
            <dc:creator><![CDATA[Tim Hoang]]></dc:creator>
            <pubDate>Sun, 16 Apr 2023 03:24:18 GMT</pubDate>
            <atom:updated>2023-04-16T03:42:45.030Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*71Om3RkBzSUdKT8D" /></figure><p>As I continue my journey as a developer, I start to realize that what I do on a daily right now may not translate to the real world. What will my challenges be when I become employed? Will my tasks be test driven or will I have to find a way to run and test my code without breaking the project?</p><p>In a perfect world, things would work the same as what I learn now but unfortunately it doesn’t. Luckily, most, if not all modern technology, have built-in tools to help debug what code you write. <a href="https://www.techtarget.com/searchsoftwarequality/definition/debugging#:~:text=A%20debugger%20is%20a%20software,of%20code%20were%20not%20executed.">Debugging</a> your code means to identify coding errors at various stages of the operating system or application development. VS Code, a source-code editor, has great debugging support.</p><p>From the <a href="https://code.visualstudio.com/docs/editor/debugging">visualstudio</a> webpage, “VS Code has built-in debugging support for the <a href="https://nodejs.org/">Node.js</a> runtime and can debug JavaScript, TypeScript, or any other language that gets transpiled to JavaScript.” You can also download extensions for other languages like Python, Ruby, C++, etc, however, with my time learning Python, I did not.</p><p>I have been learning Python these last couple of weeks and I cannot express how much debugging has helped. At first, I rarely used it because all of our deliverables were test-driven but as we started to move along, I realized that was no longer apparent. With Python, you can use pdb, the Python Debugger, or ipdb, the IPython-enabled Python Debugger.</p><ul><li><a href="https://docs.python.org/3/library/pdb.html#:~:text=The%20module%20pdb%20defines%20an,context%20of%20any%20stack%20frame.">pdb</a> is a built-in interactive debug tool of the Python library. It allows the developer to enter a shell at breakpoints, set by them, to inspect and test the functionality of the code.</li><li><a href="https://medium.com/r?url=https%3A%2F%2Fskillshats.com%2Fblogs%2Fdebugging-made-easy-with-ipdb-the-python-debugger%2F%23%3A%7E%3Atext%3Dipdb%2520is%2520the%2520IPython%252Denabled%2Cmagic%2520functions%252C%2520and%2520much%2520more.">ipdb</a>, per skillshats, “is a third-party interactive debugger that extends the basic functionality of the pdb debugger with IPython support. This means that ipdb has all the features of pdb with added benefits such as tab completion, color support, magic functions, and much more.”.</li></ul><p>I used the latter.</p><p><em>Assuming you are familiar with Python and have already installed into your local environment, follow below to install ipdb and get a brief explanation on how to use it. If not, make sure to look up installing pyenv, python and pipenv first.</em></p><p>To start, in your terminal, run the command in your local environment to install ipdb.</p><pre>pip install ipdb</pre><p>Once installed, open your python application and run these commands to install the necessary packages from your Pipfile.</p><pre>pipenv install<br>pipenv shell</pre><p>Adding this statement to your app, either at the top of your app/module or where you want your breakpoint to be, will allow you to step into your debugger at that specific point of your code.</p><pre>import ipdb // &lt;- this is the statement //<br><br>def testing_the_debugger():<br>    before_the debugger = &quot;You will see this!&quot;<br>    print(before_the_debugger)<br>    print(&quot;We will hit a pause due to the ipdb!!&quot;)<br>    ipdb.set_trace()<br>    print(&quot;You won&#39;t see this unless we remove the ipdb.)<br><br>testing_the_debugger()</pre><pre>def testing_the_debugger():<br>    before_the debugger = &quot;You will see this!&quot;<br>    print(before_the_debugger)<br>    print(&quot;We will hit a pause due to the ipdb!!&quot;)<br>    import ipdb; ipdb.set_trace()     // &lt;-statement @ the breakpoint //<br>    print(&quot;You won&#39;t see this unless we remove the ipdb.)<br><br>testing_the_debugger()</pre><p>Wherever you choose your breakpoint to be, will be where you will need to add <em>ipdb.set_trace().</em></p><p>To run the debugger, in your terminal, you will need to run python *your file or file directory*. Let say the example above was in a “<strong>lib”</strong> folder in the file named <strong>the_debugger.py</strong>, you would run python lib/the_debugger.py if outside the lib directory or python the_debugger.py if you were in the lib directory. Once ran, you should see something like this:</p><pre>&gt; python lib/the_debugger.py<br>You will see this!<br>We will hit a pause due to the ipdb!!<br>&gt; /lib/the_debugger.py(6)testing_the_debugger()<br>     5    import ipdb; ipdb.set_trace()<br>---&gt; 6    print(&quot;You won&#39;t see this unless we remove the ipdb.)<br>     7    <br><br>ipdb&gt;</pre><p><em>The terminal shows you that you are in the ipdb shell with the last line. In the shell, you can run your code/s to make sure it works. The shell will return an error if there is something wrong, like a syntax error. To exit the shell, you type exit or CTL + D on your keyboard.</em></p><p>Although this might not seem like much, this lets you inspect all the code before the ipdb. So if something was not working properly, you will receive errors on your terminal. When you start to build more in-depth apps with multiple modules, being able to test each module individually will make finding errors less stressful and time consuming. You can also take debugging up a notch by building a separate module with the sole purpose of … well you guessed it, debugging.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SkNYBpvZRWc-Mmv0WyDXUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nhC6UDP2FUyLHvtt64owZQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r3r9ChEshFiW2R_5mNMF-A.png" /><figcaption>In this example, these are all modules of the same app.</figcaption></figure><p>Instead of running ipdb on the individual modules, you can import your other modules to the debug module, create your variables there, and run the ipdb on your whole app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pSbOne3pZQ5ovZDTncdMLw.png" /><figcaption>This is the same app as the above example. Here you see that lib is the directory that holds startup.py, venture_capitalist.py and funding_round.py. With the statement on line one, you are importing everything in lib to the debug.py with the *. Lines 5–13 are all variables of the modules and line 19 is our breakpoint, in this case it works with the whole app.</figcaption></figure><p>As you start to read more on ipdb, you will find that there are also commands that you can use for a specific purpose. Here are a few examples. For a full list, check out <a href="https://skillshats.com/blogs/debugging-made-easy-with-ipdb-the-python-debugger/#:~:text=ipdb%20is%20the%20IPython%2Denabled,magic%20functions%2C%20and%20much%20more.">skillhats</a>.</p><ul><li>h(elp): Prints a list of available commands or help about a specific command.</li><li>w(here): Prints a stack trace, with the most recent frame at the bottom.</li><li>s(tep): Execute the current line and stop at the first possible occasion.</li><li>n(ext): Continue execution until the next line in the current function is reached.</li></ul><p>Although I feel like I should have taken advantage of this earlier in my journey, I am hoping this will find you and help you succeed in yours.</p><p><strong><em>Sources</em></strong></p><ul><li><a href="https://www.techtarget.com/searchsoftwarequality/definition/debugging#:~:text=A%20debugger%20is%20a%20software,of%20code%20were%20not%20executed">https://www.techtarget.com/searchsoftwarequality/definition/debugging#:~:text=A%20debugger%20is%20a%20software,of%20code%20were%20not%20executed</a>.</li><li><a href="https://code.visualstudio.com/docs/editor/debugging">https://code.visualstudio.com/docs/editor/debugging</a></li><li><a href="https://nodejs.org/en">https://nodejs.org/en</a></li><li><a href="https://docs.python.org/3/library/pdb.html#:~:text=The%20module%20pdb%20defines%20an,context%20of%20any%20stack%20frame">https://docs.python.org/3/library/pdb.html#:~:text=The%20module%20pdb%20defines%20an,context%20of%20any%20stack%20frame</a>.</li><li><a href="https://skillshats.com/blogs/debugging-made-easy-with-ipdb-the-python-debugger/#:~:text=ipdb%20is%20the%20IPython%2Denabled,magic%20functions%2C%20and%20much%20more">https://skillshats.com/blogs/debugging-made-easy-with-ipdb-the-python-debugger/#:~:text=ipdb%20is%20the%20IPython%2Denabled,magic%20functions%2C%20and%20much%20more</a>.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c2e00757bad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React to learning]]></title>
            <link>https://medium.com/@sanohoang/react-to-learning-79b4ed53ed69?source=rss-25564a342227------2</link>
            <guid isPermaLink="false">https://medium.com/p/79b4ed53ed69</guid>
            <category><![CDATA[hooks]]></category>
            <category><![CDATA[components]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[props]]></category>
            <dc:creator><![CDATA[Tim Hoang]]></dc:creator>
            <pubDate>Mon, 27 Mar 2023 22:12:59 GMT</pubDate>
            <atom:updated>2023-03-29T20:17:54.833Z</atom:updated>
            <content:encoded><![CDATA[<p>As I continue my journey to becoming a developer, I start to realize that no matter what I do or how fast I learn, I will never be up to date with the world. There is always something changing or something new that is being created. Coding, as it is, is an ever-changing concept that will never be static.</p><p>As Javascript, HTML and CSS start to feel familiar, I am thrown a curveball with React. React, a front-end library or “framework” for Javascript and although young, is the preferred tech by many developers today due to being able to break down UI development into components that are easier managed, maintained and reused. What this means is that it allows for quicker rendering and easier processes to debug and fix.</p><p>React uses a virtual DOM whereas Javascript uses real DOM. It allows the developer to update an app without hindering performance or memory through mirroring the real DOM and updating any changes made to the code.</p><p>One of the great things about React as mentioned, is that you break down your development into <a href="https://medium.com/@jeffreyarbelaez/a-quick-guide-to-components-febd7c0231c2">components</a>. You can think of each component as a “global function” that you will import into your main or parent component. When creating a component, you want to name it the same as your function you just wrote + .js. React will read .js and understand that this is a component, it wouldn’t work otherwise. You also need to export that component so you can import and use it in other components. In Javascript, where you would use “document.createElement” to create a &lt;div&gt;&lt;/div&gt;, you just return that in your component with React.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*74RFrKXZ7_hdlUIYhV9ykw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*_vzjvYW43hmXNbsIOflwOw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DJoYScDgH8lWRHgdwmwc9g.png" /><figcaption>On the first picture, the left hand column, you will see each of the components, App.js, Article.js, Comment.js. Index.js in this case is rendering App.js which contains both Article and Comment.</figcaption></figure><p>The hierarchy of React is that you have a parent component, usually the App component, that will render the app’s global UI. Under that parent component, you have children components that you pass data to through the use of props. You can keep adding on by giving the children components their own children.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gkh-iBU4mmClEVKTb46GZA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ilw3DQbPmXOI9KEpWUUvlw.png" /><figcaption>When you open up the ReactDevTools, you will see the structure and what is passed down as props, in our case “posts” is the prop. App is shown as a parent of Header, About and ArticleList and ArticleList a parent to Article.</figcaption></figure><p>Props are a type of object used to pass down stored data and used when you are looking to make your data flow dynamic. For sibling components to have access to the same data, it must be defined and passed down from the common ancestry component or the parent component of the two, aka Inverse Data Flow. But once that prop is passed, it can then be passed down again to another child component if needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LFSUmd3RjpQoFl37FuY8Ng.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rU1wkp1lyhM3FbAfrIKaMw.png" /><figcaption>Here on line 2, we are grabbing the blogData from the blog.js. As you see in blogData, there is a property “posts” that we are passing down to ArticleList. Without de-structuring, we have to use assign our prop “posts” equal to “blogData.posts” so that our component knows which data to access.</figcaption></figure><p>In this example, the prop is passed down just as a “prop” so when you are referring to the data, you would use prop.(property).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*AouzkDHM0oCTYdA7-JEH-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*48OXG5ywlHMgRBgaLdYF6Q.png" /><figcaption>Continuing with the same example above, posts is passed down so that we can access that data to “map” through so we can get data from each post of blogData. As you can see, we are then passing down the data again to Article but instead of using “post” now as the prop, we are de-structuring it in the Article component as a parameter inside {} so instead of typing out post.title or post.date, we can just pass in title and data.</figcaption></figure><p>Or you can use it this way, which is what I prefer, and de-structure (extract the value of an array or property of an object) the prop with “{}” in the argument or parameter.</p><p>As I attempt to understand React, I start to feel like I am at the bottom of a mountain trying to climb to the top as there are so many things to learn about it. Things like the {<a href="https://medium.com/@nickgastis1/setting-state-in-react-ebc6b24cb19">useState</a>} or {useEffect} Hooks and “.filter” or “.map” methods are also used on a daily. The “.filter”, as its name suggest, allows you to return a new array that passes the test provided by the function. The “.map” will map through an array and return the list of items it contains.</p><p>The {<a href="https://medium.com/@nickgastis1/setting-state-in-react-ebc6b24cb19">useState</a>} and {useEffect} Hooks are different. These must be imported from React to be used in a component. The {useState} Hook returns an array with 2 values: [the current state/ initial value, and the setter function to update the state]. The setter function is used to trigger a re-render of the component by updating the initial state value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*vA97YRM85VJtBGivY-xzFg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*eRfFjKOJcdoBTjD6sk4h2w.png" /><figcaption>{useState} is being imported on line 1 and line 5 is an example, foods is the variable that we set the initial state of “spicyFoods” to and setFoods is the hook to update that state. Lines 16–19 will update our initial state by keeping the array of spicyFoods, shown on the right side, and adding a new object of “newFood”.</figcaption></figure><p>When you use the {useEffect} Hook, you are telling React that you want the component to do something every time it renders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*AjYr3qqIrme-pSD_WZtA3w.png" /><figcaption>Like {useState}, we also import {useEffect} to use in our component.</figcaption></figure><p>In this example, we are fetching the data on render. The empty [] is passed as a second argument to stop the hook from re-rendering, otherwise you would have an infinite loop. Depending on what the hook is used for, you may have one or multiple mutable state or property.</p><p>These are just a few basic examples of what React is and what it can do. The crazy thing is as soon as you think you are getting comfortable, there is more for you to learn. Just how React is a framework for vanilla Javascript, there is a newer framework that works on React but we can save that for <a href="https://nextjs.org/">Next</a> time! ….</p><p><strong>Links</strong></p><ul><li><a href="https://medium.com/@jeffreyarbelaez/a-quick-guide-to-components-febd7c0231c2">A Quick Guide to Components</a></li><li><a href="https://nextjs.org/">Next.js by Vercel - The React Framework</a></li></ul><p><a href="https://medium.com/@nickgastis1/setting-state-in-react-ebc6b24cb19">https://medium.com/@nickgastis1/setting-state-in-react-ebc6b24cb19</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79b4ed53ed69" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding Feels]]></title>
            <link>https://medium.com/@sanohoang/coding-feels-896a2ac05409?source=rss-25564a342227------2</link>
            <guid isPermaLink="false">https://medium.com/p/896a2ac05409</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[feelings]]></category>
            <dc:creator><![CDATA[Tim Hoang]]></dc:creator>
            <pubDate>Mon, 06 Mar 2023 01:39:16 GMT</pubDate>
            <atom:updated>2023-03-06T01:39:16.351Z</atom:updated>
            <content:encoded><![CDATA[<p>What is necessary to start your career in tech or software development? Is it interest? Curiosity? Experience? Do you need to know what Javascript or HTML is? While having interest and curiosity is the first step, it is essential that you discipline and dedicate your time for it.</p><p>With no prior experience or history with coding, I started my choice by enrolling with Flatiron bootcamp. This is where the roller coaster of feelings come in. At some points, I feel I am on top of the world; at others, I show imposter syndrome. What does this mean exactly? When learning a new concept such as JavaScript or HTML, you will always feel as a blank sheet of paper, “new”. But that’s not such a bad thing.</p><p>What the instructors at Flatiron do, is they will help start your journey onto a vast ocean of knowledge. As a blank sheet of paper, you are allowing yourself to be written on with the fundamentals of coding as if you were starting a new HTML. HTML, HyperText Markup Language, is the standard language for creating a web page. The basic HTML consist of the DOC type, language, head, and body. Typically the head contains a title and the body contains a header and a footer but this is the frame work of a web page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*_33jl0BGkKjxTFK_irRwsQ.png" /></figure><p>Javascript, a scripting language that is used to manipulate web page, is then used to give functionality. For example, you can add animated pictures for visuals or add a “click” event that responds to the mouse click to serve a specific purpose like favoriting a comment. In the example below, the form was given multiple “events” that you could like, delete or even submit your own quote on the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QKOihNmFtZxvq8iIZqWUVg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*KpMwkYmQKn0nwCpE6m7cVQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*ADxs5H6TsaoQfkEeWEBgQg.png" /></figure><p><a href="https://youtu.be/Xl9cwySnWeM">https://youtu.be/Xl9cwySnWeM</a></p><p>One of the positive notes on using Javascript, is that it will usually try to help you if there are any errors by highlighting what it thinks the issue is in red. But like the instructors of Flatiron, it is only there to help guide us. It is up to us to put in the effort to fix the issue and make it work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*6iQmvQXmE0HQJpyNEQPsRQ.png" /></figure><p>Although there have been number a different emotions present and days I feel completely lost, there is just a distinctive sense of pleasure when a simple code I write, can change the page completely.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=896a2ac05409" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>