Wednesday, May 29, 2019

Day 053: BTDT Tip Calculator & Bill Splitter - using parseFloat, toFixed & building it in order to make it work!

Yesterday, I took take a short break from the bootcamp for a day to let the information sink in a bit (see active and diffuse learning). So what better time than to do my next BUILD THE DAMN THING project. It is a handy tip calculator & bill splitter that I probably spent way more time on that I should have.

See the Pen Tip Calculator/Bill Splitter by 4nn (@4nn) on CodePen.

Some Things I Learned

I guess I already knew these things, but it was more so putting it into practice and getting to experience the joys of parsing strings to numbers to strings to numbers so the formula would work.

I initially thought this would be quick and easy since I banged out the formula in the console in less than 5 mins.

parseInt(), parseFloat(), .toFixed()

Of course the console just deals with the parameters as numbers. It is a different story when you are pulling values from the DOM, which would output those numbers into a string. You can't really do math with strings!

So I became intimately familiar with the parse functions to get those strings into numbers. (Good to know when I tackle the building a calculator project)

parseInt() parses the value into an integer. I used this in the beginning since I was testing with whole numbers.
parseFloat() parses the value into the floating point number (with all the decimals and such).

Once that was all set, I later used the .toFixed() method to get the numbers into 2 decimal places.

Voila! The math actually worked with the DOM in codepen!

So I go about to add in the conditionals and error messages and such, but the conditionals did not work because it was essentially asking if the preTipBill === NaN. Why did it keep coming up as NaN even though the math worked out previously? Enter frustrationland!

My husband probably noticed my annoyance after some time which was his cue to help (of which I didn't ask for his help, but recognize that I need to get better at knowing when to ask). So he identified that I was doing too many things at a time before calling the if statement. I was assigning the DOM values to the variable and then reassigning the variables to parseFloat().toFixed() and then setting the condition statement. It looked something like this:

 let preTipBill = document.getElementById("preTipBill").value;
 preTipBill = parseFloat(preTipBill).toFixed(2);
 let tipPercent = document.getElementById("tipPercent").value;
 let splitBetween = document.getElementById("splitBetween").value;
 splitBetween = parseFloat(splitBetween).toFixed(0);

 if (preTipBill === "" || tipPercent === "" || preTipBill.length === 0 || tipPercent.length === 0) {
  ...
 }

Of course that mess was then checking the if conditionals to preTipBill === NaN which is not what I want especially when trying to reassign blank splitBetween values to 1 if the user opts not to split the bill. Anyways, once he pointed that out, I got it right away. Like, RIGHT AWAY. Rookie mistake!

  let preTipBill = document.getElementById("preTipBill").value;
  let tipPercent = document.getElementById("tipPercent").value;
  let splitBetween = document.getElementById("splitBetween").value;

  if (preTipBill === "" || tipPercent === "" || preTipBill.length === 0 || tipPercent.length === 0) {
    document.getElementById("output").innerHTML = "Please input all required amounts!";
  } else {

    preTipBill = parseFloat(preTipBill).toFixed(2);
    splitBetween = parseFloat(splitBetween).toFixed(0);

I needed to reassign the values LATER, preferably once the condition is met. Just moving the reassignments fixed the whole thing. Sheesh!

In working through all the projects in the Angela Yu Web Dev Bootcamp, the location of the reassignments were sort of laid out for you when working through the projects and it made a ton of sense at the time, of course. But it really isn't until you've been frustrated and 😬 over it for an hour that it really sinks in. The ORDER of your code matters! I found this to be a very valuable lesson.

On a side note: it's my mom's birthday this Saturday and I'll definitely be pulling out this little calculator at the end of the meal!

Here's the User Story
  • user inputs total initial bill
  • user inputs desired tip amount
  • user gets error message if initial bill and tip amounts are missing
  • display the tip subtotal
  • display the total amount
  • user can opt to split the bill, input number of people to split it with
  • display the per person initial bill
  • display the per person tip and total
  • if user does not split bill, only display the tip & final total
  • have button calculate and clear all

Tuesday, May 28, 2019

Day 052: Personal Bootcamp Debrief

So it's Tuesday now and the long weekend has come and gone. How did my personal bootcamp go?

It was really tiring, but a GREAT experience. I didn't want to spend too much time blogging about it while it was going one since I wanted to dedicate most of the time during the weekend to coding and learning to code. I posted some thoughts on instagram during the weekend.

Day 1:

Day 3:

The plan is to do something like this once a month and maybe drag some folks from my accountability group into it as well, if they want to jump in for a day or so.

As for how far I got through the material (Angela Yu's Web Dev Bootcamp), I was at 23% of the course having just finished the Bootstrap section when I started the weekend. I ended the weekend at completing 66% of the course and am into the first few videos on JSON and API.

Sort of Daily Breakdown

I was mentally wiped out the first day since it was pretty much a continuous 8+ hours of learning and coding.

The second day was much better because I took a long break in the middle so it was like 2 medium sized coding sessions vs one big long one on the first day. It was also mostly working on a project that day (building a Simon Says game) so that added variety. I also kind of stayed up until 2am in the morning that evening watching more of the videos after finishing the project because I felt like I was on a roll.

The last day was a bit shorter (since I got in those hours in the AM ), so it was not bad in terms of total hours required for the daytime. I did do the minimum number of hours on the last day so I can enjoy the long weekend and let my brain rest for a little. In all, I did clock in bout 25.5 hours of learning and coding in the past 3 days.

What I Learned

I feel like I learned SO much! The three big things: being more comfortable with the DOM, being introduced to NodeJS, and finally learning the CLI/Git/Version Control. The next bits would be to get through the API section (which is also very cool!), moving on to databases, RESTful API, and authentication and security. I would like to finish the course by the end of this coming weekend, but we will see how that goes since it depends on how much time it takes to get through the projects.

Hi NodeJS. I am so excited to meet you!
I must say, I really enjoyed the projects in this bootcamp. When she introduces you to a concept, there is a bit of code-along happening. Then there's the pausing before each mini challenge so you can work through the concepts on your own before you unpause and she goes over it. For the big projects (what she calls "boss level challenges), she lays down the to-do's for each step and you tackle them one by one. At the end, she goes over the whole project. I opted to not review her solutions unless I feel really stuck (and am happy, but annoyed with myself to say that I peeked only once during the Simon Says challenge).

You know I already had that problem before where the initial look at the code makes me wonder how in the world I can ever get to that point. But those step-by-step to-do requests really help remind me that this is what programming is all about. They are all little steps to get to the final product. And when your app works and you look back at the code, everything actually makes sense!

What's Next? 

I know I haven't finished Angela's course yet, but I am already looking ahead. Here are my next to-do's:
I added another intro-to style course to the list, Andrei Neagoie's ZTM because he has sections that cover React & Redux which I feel is something important that is missing from Angela's course. His projects also seem really interesting too. Colt Steele's Web Dev Bootcamp course also ranked high, but he is missing React & Redux so I did not really consider it. I might consider Colt's Modern React Bootcamp course in the future though.

For Andrei's ZTM course, I will skip the parts that I am comfortable with (HTML, CSS, JS basics), use the parts I am not yet comfortable with as review on 2x speed, and delve into the projects for the experience. I am also interested in his more intermediate course, the Complete Junior to Senior Web Developer Roadmap (2019) and figured I ought to see if I like his teaching style before jumping into another 30+ hour course. Use the coupon code LEVELUPZTM to buy his course fo $10.99 without having to wait for a sale.

The focus of the list is projects, projects, PROJECTS! Which is why Wes Bos' JS30 is on the list as well as the Odin Project. I was actually slowly going through TOP Web Dev 101 as bedtime reading, so I am about 33% done with it already. It follows along nicely with Angela Yu's bootcamp contents this past weekend. In TOP, I am skipping the parts related to Ruby or Rails, but might revisit that in the future. TOP just seems to have some really great projects and the curriculum is constantly being updated (contrary to what they say on the internets).

In the middle of all this, I do intend to do the challenges and projects on FCC as well. I would like to get the full stack FCC certification eventually! FCC is kind of where it all started, so of course it is always on the list. I do admit that the website alone was not enough for me to understand the material (sometimes the wording of the challenges confused me) hence my branching out to Codecademy, Lynda, and Udemy which has been working well in helping me learn.

Okay, this post was a lot longer than intended, but it is really good to create a roadmap for myself to tackle in the next few months. This also helps to know what I am doing for my next Personal Bootcamp!


Saturday, May 25, 2019

Day 048: Personal Bootcamp Weekend

Memorial Day is on Monday. So you know what that means? A long weekend!

I wanted to quickly post that I am currently attempting a self imposed bootcamp over the next 3 days. The goal is to get in at least 8 hours of learning and coding each day as if I was attending a real bootcamp.

Of course I want to move along with my learning and ability and one of the obvious reasons why bootcamps work for some people in a short amount of time is due to the sheer number of hours they spend working on the material. I want to create a similar experience for myself (sadly, by myself for now) at a much lower cost. Hopefully, this is something I can do for most weekends and all upcoming long weekends (if the day job permits).

To facilitate this first Personal Bootcamp Weekend, I am using the Complete Web Development Bootcamp w/ Angela Yu (of note that there is a Memorial Day sale going on right now for $11.99; if you don't see a sale price on Udemy, just wait a few days for some kind of holiday. They always have sales). I finished up until the Bootstrap section last night and am starting my long weekend bootcamp right at the JS section. That works for me!

My favorite person right now!
The plan is to try to go as far as possible starting at JS in the next few days. Other tasks will be finishing up the Intro to JS @ codecademy and working on my tip calculator/bill splitter and the day counter app. If I can fit it in, I will also be building a Tabata timer as well. I will also probably use a KhanAcademy course as a break from the intensity occasionally.

Let's ROCK this!


Thursday, May 23, 2019

Day 046: BUILD THE DAMN THING - A Simple MadLibs

I'm pleased to present my first project from (mostly) scratch: a simple and silly madLibs app!

See the Pen Simple Madlibs by 4nn (@4nn) on CodePen.

It's "mostly" from scratch because I had to look up the DOM syntax and later encountered some issues with the HTML5 form inputs, namely using <input type="button"> vs <button>. I need more practice in understanding the DOM. While I understand that part of being a good coder is getting good at asking the right questions to look up stuff, but I can't wait until the day I actually know the syntax well enough to not need to reference documentation!

Here's the user story for the app:

  • Allow user to input various words
  • Generate random madLibs sentence
  • Allow user to clear the madLibs sentence
  • Allow user to clear input values
  • If any input is empty, prompt user input 
  • Pretty up UI with some bootstrap practice

In all I spent about 2 hours on it including the Bootstrap bits. I am not including the time I spent at the end of April trying to create this. This was right after I finished up the Practical JS course and was attempting to create the madLibs in the console first (like the course) and then move it to the DOM. I set up my workspace in VSCode and got to work on the JS file. Unfortunately, I ended up just confusing myself and making it more complicating than it should be and got frustrated and gave up. You know the old adage of putting the cart before the horse? Yep. 

But after watching all those videos during crunch time at work, I got a bit more confident to give it another go. Since it was simple enough, I figured starting it in Codepen was enough and it was! 

I have to admit, even getting to the point where I knew I had to start building stuff scared me. I couldn't put into words why I felt the fear of starting the project, but in retrospect I think it's the sentiment of "I can't fail if I don't start!"

Once I decided to restart the project, it took a whole day to get over the fear. I was procrastinating by doing chores or watching more videos. Once I realized what I was doing, I took to repeating to myself to:

BUILD THE DAMN THING! 

JUST BUILD THE DAMN THING!

And then I did and it wasn't terrible! Sure, I needed to reference some materials and some parts didn't work at first, but it in the end, it was resolved and it works more or less as I envisioned it. It even took less time than I thought it would (I had estimated 6 hours lol). I also reminded myself to take it one step at a time and that helped a lot. 

Knowing how I am, I am probably going to keep having the same fear as my ideas for projects get more complex. But I just have to BUILD THE DAMN THING and just keep chugging along. 

The next projects to work on is a tip calculator, day counter (so I can correctly get my #100dayofcode number), a Tabata timer, and an actual calculator. Baby steps! 


Monday, May 20, 2019

Day 043: Accountability Group

A few weeks ago I created a "Daily Standup" group (a la Scrum) which was intended to be more like an accountability group of sorts. I invited random folks from FreeCodeCamp and Newbie Coder Warehouse (the first noob coder group I joined on FB) and got a decent amount of interest for the little group at the time.

The coding accountability group in slack. 
Currently there are 29 people (including yours truly) in the group. I do not believe anyone actually works as a developer right now as we are all currently learning the ropes and aspiring to become developers in the future. There is a variety of skill levels in various stages of learning and I appreciate the diversity.

About 10ish members are actually active and post at least a few times a week. Personally, I haven't missed a day since creating the group. I helps keep me motivated even though it was REALLY difficult to do much during work crunch time.

During those days, I will admit as much if the best thing I can do is put in 15 minutes of watching videos. It was also strangely reassuring to hear from others sheepishly admitting to taking it easy or taking a break too. That's OK by me! You don't want to get burnt out. There is a sense of camaraderie where we're are all in this together.

Some folks in the group also joined the coding challenge @ Lighthouse Labs and it has actually been great to work through the challenges together (or at the very least, checking in that each of us finished the daily challenge).

If you're thinking about starting an accountability group, I say go for it. If you don't know anyone personally who would join your group, I recommend starting an accountability group on Slack (or even Discord, Facebook, or even via email would work). Slack really is the perfect tool for this. A side benefit is simply getting used to using Slack since it is the tool of choice for many tech companies and teams. The extra bonus for me personally is learning how to manage/admin a group on Slack. It's pretty neat to see the digest emails it sends you as an admin!

Or if you don't want to start your own and would like to join the Daily Standup group feel free to email me at 4nnCanCode@gmail.com. It has a pretty low requirement of just posting to the daily checkin channel when you're working on a project or are learning something is all that you need to do to make use of it.

P.S. Today is my last crazy work day for the season! Just one more late night tonight and I am done (until the next crunch time in the winter). I put in a request to take this Friday off so I will have a 4 day weekend (with Memorial Day included, woo!). I am pumped to have a few full days of coding to look forward to soon. I have a lot of catching up to do and really want to get started on building something!


Saturday, May 18, 2019

Day 041: Making it Rain (Khan Academy)

Crunch time at work is nearly coming to an end (one more day on Monday), HOORAY!

On average, I worked about 65ish hours per workweek for the past 2.5 weeks. The weekends were not any better since I spent much of the time catching up to sleep or trying to de-compress from the workweek (and also doing some work on the weekends as well, bleh). Not only were the hours long, but the work is really freaking stressful and it involves a lot of literal running around, making snap decisions and solving things.

I have been so exhausted by the end of the day that it has been quite challenging dedicate much time to learning or even retaining any information when I do get to put in more than an hour/day. I admit to coming really short on some days (like 15 mins of tutorial videos before bed and passing out with my laptop by my side, oops). I do get some snatches of reviewing/reading materials on JS here and there during bits of down time at work, but I am not sure how meaningful that is when one is constantly interrupted.

Given how tired I am and how little time I have at the end of the day, the best I could manage was passively consuming videos here and there. Most of the actual coding I did was with the Khan Academy Intro to JS: Drawing & Animation challenges that they have in the course.

The course was such fun and the challenges were really cute! Really a breath of fresh air full of colors and movement at the end of a long, stressful day. Their most complex challenge in the course (and my favorite) so far has been the Make it Rain project. It starts you off simply enough and becomes a bit more complicated in each step. I probably spent about 3-4 hours spread over a few days working on it during quiet times at work or right before bed at home. By the end of the exercise, I was very surprised with all the code written that actually worked and refactored a few times. And the best part was that it all made sense to me!

Make it rain!
I remember looking at someone else's spin-off at the start of the project thinking about how it was impossible to do with my tired brain and limited time and that I should save it until after crunch time at work to be able to make sense of it. I know many people have said this before, but this was the challenge that demonstrated it to me: as a whole, it can seem monumental but when broken down into small parts, it's possible to do!

I initially shied away from KA because the content was geared more towards children and teenagers and I thought it may be too childish for me. Because after all, coding is serious business! *scoffs*


It's great for anyone, particularly those who may be struggling with some of the basic concepts. I honestly think they might have the best approach to introducing brand spanking new learners to JS. I especially like their explanation on object oriented design and object inheritance, the best I've seen yet (I actually understood it! Do also view the videos as well). The instructors teach without making assumptions about you and seem so happy and enthusiastic about it (since they're teaching to kids after all). It doesn't make you feel too bad if you may not get it 100%. I am actually planning on doing a few more of their other courses as fun little breaks here and there from the "serious" learning.


Sunday, May 12, 2019

Day 035: Passively Consuming More Online Courses

Not much to report due to work obligations taking up a chunk of time (average so far have been 13 hour work days for the past week and half, 6 more days to go, /sigh) so much of my learning time have been passively watching the Lynda courses before bed.

It's not what I prefer because it is not active learning, but it is the best I can do at this time. I try to do what I can during down time at work, but the nature of my work is full of interruptions so at best, I can just review notes here and there.

For my to-do list from the last post, I did manage to finish off 2 courses on Lynda.com and I am working my way through the KA course (which has a split of videos and exercises, so I have been going through them a bit slower), and I added a few more bits and bobs to the list.

Note: all the Lynda.com links require a paid account (I get free access from my work). However, I have heard that some public libraries allow access to Lynda if you are a member, so check your local library to see if they offer the access!
  • Lynda.com JS for Web Designers w/ Joe Chellman: has a great quick intro to the DOM as well as using the Google Maps API in one of the exercises. It's a relatively short course, but pretty good for the continued exposure and the intro to DOM if you haven't been introduced to it yet. 
  • Lynda.com Learning the JS Language w/ Joe Chellman: this is more of a refresher for me. I am finding the nested loops to be the most challenging for me right now and I enjoy seeing how different instructors go about explaining the concepts in different ways to really drill it in my head. 
  • Khan Academy Intro to JS: Drawing & Animation: this is just a fun JS tutorial refresher. It's aimed at teaching kids so there is a lot of whimsy to it (and much appreciated when my brain is fried after a long day at work). This particular course uses the Processing.js library to teach the concepts of JS with drawings and animations so it was a fresh take on the basics and is admittedly my real first use of a specific JS library. I am almost done with this course. 
Here are the addons: 
  • Lynda.com Coding for Visual Learners: Learning JavaScript from Scratch w/ Engin Arslan: After finishing the other 2 Lynda courses, I started on this one. However, I feel like it covers much of the same content as the KA Drawing & Animation course (although he uses P5.js instead of Processing.JS), so I am putting this on hold for now and maybe revisit on 2x speed as a refresher in the future. 
  • Lynda.com Learning ECMAScript 6 w/ Eve Porcello: I just started this one. I haven't gotten too far, so not much to comment on right now. Since I am moving on to the ES6 section on FCC, I figure this is good to watch to get more familiarity with Modern JS.
  • Lynda.com JavaScript: Functions w/ Ray Villalobos: Haven't started this one yet, but it is short enough to go on the list and would be a good refresher, I think. 
  • Lynda.com JavaScript: Events w/ Ray Villalobos: Haven't started this either. It is also another short course and I won't mind getting a closer look at events. I also heard Ray Villalobos is an excellent instructor so I am eager to check out his courses. 
I think all of the above will keep me occupied until I am done with having to work like a Japanese salaryman. Once crunch time at work is over with, I slowly start going through a recently purchased Udemy course, the Complete Web Development Bootcamp w/ Angela Yu. There was the Mother's Day sale going on at Udemy for $11.99 so it was hard to pass up such a highly rated and widely recommend course.

Have to support other Asian women, yanno!
Whilst I am still a bit shaky on some of the JS fundamentals, I am getting impatient to start moving on with the material and I shouldn't just languish in the JS basics forever. It is only convenient to do so now because of the work situation.

But once work is not an issue anymore, the goal is to follow along with Angela's course. It has 42 hours of course time and basically covers everything in the FCC curriculum.

If I have unlimited free access to the Lynda courses, why did I decided to shell out the cash for a Udemy course? While the Lynda courses are great, they're a bit all over the place and lack the consistency of having a single instructor and a focused curriculum. True, they have something called "Learning Paths" but I found I do have an adjustment period to each new instructor and they vary in the projects and challenges each course offers. I also want something that more closely follows the path in FCC so I decided to go with Angela's bootcamp. Honestly, I spend more than the cost of a Udemy course on lunch at work so that bit of money on buying a structured program is worth it to me.

I've just gotten through the intro section and I have found her to be a very pleasant and engaging instructor so far. I'll probably 2x speed through the HTML/CSS sections only watching those parts and then slow down and start coding when the Bootstrap sections start.

I do intend to go through her course at least 2x and may consider other well known and highly regarded Udemy bootcamp courses if I feel like I need more exposure to the basic web dev stacks, but I am hoping her course will be enough. I still haven't gone through a second iteration of Practical JS yet and I still want to soonish. I think it will be interesting to see how much better I will be able to follow along with him now that I understand JS a bit better.

I thought I was more of a read-along/screenshots type of learner. But since I was kind of forced into the video habit due to work, but I am finding a great deal of enjoyment out of them. And yes, I do believe the repeated exposure has really helped me understand the concepts even though I have not been able to psychically code much.


Wednesday, May 1, 2019

Day 024: Javascript Resources

I am still spending at least an hour coding/learning to code each day (the average so far has been ~1.5 hours/day of focused learning). It has been slow going and I feel like it's taking a long time, but I want to be deliberate in absorbing all the information and keep getting more exposure to it.

The list below are all the resources that have been referred to me by various sources and people on learning JS and I figured here's as good as any to list it for reference later. I will probably slowly go through one of these resources in the next 2 weeks.

Today is the start of my busy season at the day job where I'll be working anywhere from 12-15 hours a day (yeah, 7am-10pm is not out of the realm of possibility) for the next 2.5 weeks. Study time will be really limited to the bits of slow time at work because I am pretty much wiped out once I get home. I am probably not going to be able to do much focused learning and have a few video/courses lined up to watch when I am able to. It's not the best kind of learning (I need to be more hands on), but it's the best I can do unless I want to forgo sleep. 😑

That said, I am focusing on more videos for the convenience vs projects for now to keep the exposure up. Here's the plans in the meantime:
Of note is that I finished Practical Javascript on WatchandCode.com last week. I highly recommend it for anyone just starting out. I intend to go over the tutorials another 2-3x again for more practice, so you can add that to the list above.

Lastly, on a whim, I signed up for a 21 day coding challenge with Lighthouse Labs. The grand prize is a trip to Boston, MA! Woo! But only for Canadian residents. Since I am already in Boston, I think I'm A-OK with not winning anything, 😊 but am joining for the learning experience and to work through problems with my accountability group.