Pages

Wednesday, February 22, 2017

Day 48

Current Challenge: No repeats please
Progress: This is just a short update on how things are going at the moment, to keep you in the loop. Well, frankly speaking, I'm deeply stuck on the "No Repeats Please" challenge.

The thing is, though I know that most folks use the "Heap algorithm", I think this may not be a very efficient way to solve the task, since you create an enormous amount of permutations, thereby using up a lot of memory space. However, the only thing actually required as output is a mere number.Thus, I assume it might be better to approach this problem by just thinking in terms of possible combinations. I don't know how to better explain it yet, but if I'll manage to solve it that way, it not only will be much more efficient but also less complicated to read (at least that's what I aim for). I'll definitively explain it in more detail once I cracked it either the one or the other way.

Thoughts: Unfortunately, I have to take a short break until Sunday, because I've to take care of a few things of personal interest, but I'll be back before you know it. See you around! :)

My plans for the next days:
  • Work through the remaining "Advanced Algorithm Scripting" challenges
  • Finish chapter 9 on Regular Expression (including exercises; 'Eloquent JavaScript')
  • Gradually upload my work on GitHub

Follow me on GitHub

Follow me on FreeCodeCamp

Follow my Pens on Codepen

Friday, February 17, 2017

Day 43

Current Challenge: No repeats please
Progress: Since my last update I was able to finish a few more "Advanced Algorithm Scripting" challenges. "Record Collection" was actually not that hard to crack. All it basically needed was proper 'if/else' structure. You can find my code on GitHub.

On the contrary, the  "Symmetric Difference" challenge was a bit tougher to get along. It took me some time to translate the logic into code but I eventually came up with a pretty neat and precise solution.

However, "Exact Change" was really challenging to get by. There were several problems literally popping out of nowhere and my browser hung up every now and then since I accidentally created an infinite loop somewhere in my code. That was really driving me mad!

System freezes
Codepen freezes

The trickiest part, tough, was to find a way to handle floating point numbers. I don't want to elaborate too much on it, but it can be frustrating at times. You just don't expect, say, 0.1 * 0.2 to be something like 0.020000000000000004 instead of just 0.02, but it has something to do with how a computer in general (not just JavaScript) processes numbers internally (binary instead of decimal representation). For a short introduction, I recommend you to watch the following video on YouTube. If you want to immerse yourself even more into the topic try Google. It's a well-known issue with lots of more or less detailed explanations.


Once you understand what's going on behind the curtain, there are several approaches you might want to use to circumvent the issue. Instead of floats, I decided to use integers for the internal computation of the function by simply multiplying all values with 100. To display a proper money format as output, you just have to divide each value by 100 again. It took me quite a while, but after some refactoring rounds, I managed to find a very clean approach to passing the provided tests. Check it out!

In turn, the "Inventory Update" was less troublesome again. You just have to stay focused because of the sometimes slightly confusing way of accessing multi-dimensional arrays.

To recap, the advanced algorithm challenges are definitively more difficult to get your head around so far but also more rewarding and satisfying once you found a viable solution at last.

If you have any questions or something in particular that troubles you, feel free to ask at any time by sending me a message or just leaving a comment below. :)

Thoughts: If I can maintain the current pace I might be able to obtain the Front End Certificate by the end of next month at the latest. That would be a first great milestone in my development. Wish me the best of luck!

My plans for the next days:
  • Work through the remaining "Advanced Algorithm Scripting" challenges
  • Finish chapter 9 on Regular Expression (including exercises; 'Eloquent JavaScript')
  • Gradually upload my work on GitHub

Follow me on GitHub

Follow me on FreeCodeCamp

Follow my Pens on Codepen

Monday, February 13, 2017

Day 39

Current Challenge: Record Collection
Confused Jackie ChanProgress: Short update on the algorithm front. I spent the whole morning trying to figure out the proper regular expression to match and validate those telephone numbers.

That admittedly was pretty confusing but I eventually nailed it! Overall, I thought it might be a good occasion this time to learn about RegExp more thoroughly (made it halfway through chapter 9 in 'Eloquent JavaScript'). I also almost always use MDN as a supplement (mainly via DevDocs, which is a really convenient tool for quickly looking up things).

The last couple of times I worked on algorithms using RegExp I just hacked it together somehow and was lucky that it worked, but this time you really have to understand what's going on since the final expression is rather elaborate compared to what I've done so far.
Thoughts: Also helped some campers on Gitter today, which does feel pretty good indeed! On the one hand you can give back to the community and on the other hand, you are able to repeat some challenges and see loads of different approaches. Therefore you not only support others but also tremendously benefit yourself.

Note: I'm probably going to transition my blog to its own server using Wordpress as a CMS, which I think is better suited to meet my needs. I really want this to become a great platform!

You will be the first to know when it's finished! ;)

My plans for the next days:
  • Finish chapter 9 on Regular Expression (including exercises; 'Eloquent JavaScript')
  • Work through the remaining "Advanced Algorithm Scripting" challenges
  • Gradually upload my work on GitHub

Follow me on GitHub

Follow me on FreeCodeCamp

Follow my Pens on Codepen

Saturday, February 11, 2017

Day 37

Current Challenge: Validate US Telephone Numbers
Progress: As of this morning, I've successfully finished the "Intermediate Algorithm Scripting" section on FreeCodeCamp, Yay! ;)


Minions celebrating

Looking forward to solving the "Advanced" ones. Pretty excited how the difficulty level will rise.
Thoughts: Though I almost solved everything on my own so far, I'm trying to dedicate an hour each day to help others (mainly on Gitter). I mean it's not like I would decline help in general, but I mostly found everything I needed after a quick search on Google, Gitter or in particular the FCC forums. More often than not I didn't even need to search since I was able to figure it out myself (although it probably took me way longer than on average). I also tried to refactor a lot and find alternate approaches, whereby the Wiki section on the FCC forums turned out to be a great source of inspiration. As a result, I noticed how my way of coding actually got a lot cleaner and more readable from challenge to challenge. Additionally, I had the opportunity to implement some more advanced programming concepts like "closures" or "recursion", which until now I only read about (e.g. Eloquent JavaScript*).

*Note: I stopped reading after chapter 6 for now because I felt like I needed more practice, which I eventually got thanks to FCC. The book is well-written and very concise but I wouldn' recommend it to a total newbie since it can be a bit overwhelming at times (e.g. "Polymorphism" in chapter 6 was difficult to grasp and some exercises may be very challenging). A far better book for someone completely new to programming or JavaScript is Head First JavaScript Programming.
Anyway, once you've picked up the basics Eloquent JavaScript is absolutely worth reading. I heard YDKJS is supposed to be pretty awesome as well, but unfortunately, I haven't had the occasion yet to read it. But I'll put it on my bucket list for sure! Maybe I'm gonna write some reviews later once I finished those books.

My plans for the next days:
  • Work through all "Advanced Algorithm Scripting" challenges on FreeCodeCamp

Follow me on GitHub

Follow me on FreeCodeCamp

Follow my Pens on Codepen

Thursday, February 9, 2017

Day 35

Current Challenge: Finders Keepers
Progress: I put the "Weather App" on hold for the moment to not lose traction solving algorithms. It worked pretty well until I ran into the "Smallest Common Multiple" challenge. Boy, this was a bummer! 


Confused baby

I haven't been stuck like that ever before. Took me 2 days* to figure it out. I was confused by the sheer amount of different algorithms and techniques you can apply ...

My first approach was so inefficient, that the largest range my machine was able to compute was from 1-8 (i.e. 'smallestCommons([1, 8]')). That actually doesn't come as a surprise, if you go through the code to get a sense of what it does. It basically creates an array for each number in the range with all the multiples up to the greatest common multiple in it, to be able to compare all the multiples of each number and search for the least common multiple. As a result, the arrays got way too bloated for larger numbers (e.g. if you have a range of 1-13 that's actually (13! / 2) indices only for the array of multiples of two's). Well, guess I took the provided "helpful link" in the task's description too literal. ;) Fell free to have a look at it. I commented it out but it's still below my current solution on FCC.

Anyway, after quite some time and with the help of various sources I managed to solve the task. Admittedly, it's not entirely my own code. But since it became more and more frustrating, I decided to work with some snippets I found on StackOverflow and adapted them to fit my needs. The thing I grappled most with, was to get my head around recursive programming style. I read about it a while ago but didn't use it much so far, since there was no real need for it. I think it's important to get acquainted with recursion early on (well, not too early obviously), but one thing is really crucial: don't get obsessed with building an algorithm entirely from scratch. This can't be stressed enough, especially if you, like me, belong to the species who's deeply dissatisfied by not fully knowing. That's probably the flipside of curiosity. But as an aspiring web developer, I personally think our focus should be on implementation and not reinventing the wheel (I mean it's definitely fun to stretch your mind but it might distract you from actual coding because a lot of more or less complex math might be involved). If you have a different opinion on that, I'd love to hear it. Please leave a comment below!

My focus for the next days is to get through the rest of the intermediate algorithm challenges, as smoothly as possible. Depending on the difficulty level of the next few exercises I might take (or more precisely "have to take") a quick detour, though.

*Note: 1 day of programming actually means from around 8 am until noon (my daily programming routine).
Thoughts: I noticed that solving algorithms is quite a lot about math. With that said, I decided to also devote some time to brush up my somewhat rusty math skills on Khan Academy (at least half an hour a day). I'm impressed how sophisticated their platform has become.

Whew, that was quite an update but I had a lot on my mind I wanted to share. If you have any questions or suggestions, don't hesitate to leave a comment or to get in touch with me.


Simpsons comic guy in front of a computer

As I already mentioned before, you can expect an update coming at least once a week. So stay tuned! :)

Update: Unfortunately I haven't received a word from the learning community I told you about last time yet. Still hoping to get in on one of the upcoming cohorts.

Check it out, maybe it's something for you as well:

https://tropicalchancer.github.io/projectus/

My plans for the next days:
  • Work through the remaining "Intermediate Algorithm Scripting" challenges

Follow my Pens on Codepen
Follow me on FreeCodeCamp

Thursday, February 2, 2017

Day 28

Current Project: Local Weather App
Today's Progress: Continued with "Intermediate Algorithm Scripting" challenges on FCC and learned a bit about RegExp. If only I had known about it earlier, my life would have been easier!
Thoughts: Yes, I know I should have worked on my Weather App, but solving Algorithms is just more fun at the moment. Can't help it. I mean, eventually, I have to get it done anyway if I want to receive my Frontend Certificate. So, no worries! ;-)

Boy, almost forget to tell that I applied myself to a learning community today, of which every member probably has the same goal as me. Accelerate the learning experience through helping each other out. Looking forward to telling you more about it if I will be accepted!

Check it out, maybe it's something for you as well:

https://tropicalchancer.github.io/projectus/
My plans for the next days:
  • Work through all "Intermediate Algorithm Scripting" challenges
  • Fulfill the whole user story of the Weather App (2 points left)
  • Head First JavaScript Programming" - Continue with Chapter  9

Follow my Pens on Codepen
Follow me on FreeCodeCamp