Wednesday, October 21, 2015

Day 151: FCC, Basic Front End Web Dev Projects, Pomodoro Clock

All right, so my macbook is no longer functioning, and I can't get it repaired until I get back to America in about two weeks.  Also, my internet speed has been very slow over here in Asia, and it was causing me difficulties with working on front end development, because CodePen was not updating correctly.

So, I bought a PC over here in Asia to use for the next two weeks, because I'm being very productive, and I don't want to waste the next 10 days.  Since the new PC isn't as high performance as the macbook is (when it's working), I'm stopping work on the front end web dev projects (I was working on the pomodoro clock) and I'm going to spend the next two weeks of my time in Asia working on the next section, which is the Intermediate Algorithm Scripting.  If I finish the Intermediate Algorithm Scripting section in the next 10 days, while I'm still in Asia, then perhaps I'll try doing the front end projects with this PC, and if the computer or the wifi are too slow to work on those projects, perhaps I'll just jump to the Upper Intermediate Algorithm Scripting.

Here's my solution for the second problem in that problem set, which required us to take two arrays and return a third array with any items not found in both of the original arrays:

function diff(arr1, arr2) {
  var newArr = [];
  for (var i = 0; i< arr1.length; i++) {
    for (var j = 0; j < arr2.length; j++) {
      if  (arr1[i] === arr2[j]) {
        arr1.splice(i, 1);
        arr2.splice(j, 1);
        i--;
        console.log(arr1) 
      }
    }
  }
  
  for (var i = 0; i< arr2.length; i++) {
    for (var j = 0; j < arr1.length; j++) {
      if  (arr2[i] === arr1[j]) {
        arr2.splice(i, 1);
        arr1.splice(j, 1);
        i--;      
      }
    }
  }
  
  newArr = arr1.concat(arr2);
  /*newArr.filter();*/
  return newArr;
}



diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);

The i-- was the key part of that code, the problem was that whenever I spliced out an item, the item in front of it would then move back in index numbers (taking the place of the item removed), and so the code would skip any item after a match on the condition.  By adding i--, the code would adjust the i value down one every time the condition was matched, to compensate for the change in index values in the array caused by the removal of one item.  That's neat!

But then...I realized I didn't need the second part of the code, the first part was good enough to catch every duplicate (I thought the second part might be needed if the second array was bigger than the first, but I was wrong).

So, the final code came out to:

function diff(arr1, arr2) {
  var newArr = [];
  for (var i = 0; i< arr1.length; i++) {
    for (var j = 0; j < arr2.length; j++) {
      if  (arr1[i] === arr2[j]) {
        arr1.splice(i, 1);
        arr2.splice(j, 1);
        i--;
        console.log(arr1) 
      }
    }
  }
    
  newArr = arr1.concat(arr2);
  return newArr;
}


diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);

Now I'm moving on to the third problem.  There are a total of 21 problems to complete in the Intermediate Algorithm Scripting section.

WHOA!  The next problem requires us to write code that converts a number to a Roman Numeral!  I'm excited, what a fantastic problem to work on!  So sweet!  All right, time to work my brain...

So, I'm thinking the way to begin my approach to the problem is to make a converter that works for the number 0 through 9, and then work my way up from there.  Let's try that.

O.k., that approach is far too tedious, let me read the actual RULES of Roman Numerals, and start devising a system of some sort...

This problem is quite a challenge.  At this point, I've seen several solutions for it, but I've yet to devise my own.  I'm tired, it's late and it's time for bed, so I'll wake up tomorrow, have a good breakfast, hydrate, and start hacking away at this problem with a fresh mind.  Today was a good day. 

SUMMARY OF CODING SKILLS

Total Treehouse Points: 5,385

Treehouse Points by Subject Matter (Miscellaneous not included): 
HTML:                                663 
CSS:                                1,599 
Design:                            1,193 
Development Tools:            747 
JavaScript:                      1,120

Treehouse Ranking (%): "You have more total points than 94% of all students."

Treehouse Badge(s) Earned Today:



Treehouse Courses Completed:
How to Make a Website
HTML
CSS Foundations
CSS Layout Techniques
Aesthetic Foundations
Design Foundations
Adobe Photoshop Foundations
Adobe Illustrator Foundations (66% complete, switched focus from web design to web dev)
Git Basics
Introduction to Programming
JavaScript Basics

Codecademy (& other) Courses Completed:
HTML and CSS (Codecademy) 

Books Read or in Progress:

Completed: "Head First HTML and CSS," by E. Robson & E. Freeman (768 pgs.)
In Progress: "Head First JavaScript," by Eric Freeman and Elisabeth Robson (on pg. 56)
Completed: "A Smarter Way to Learn JavaScript," by Mark Myers (293 pgs., 89 chapters with 20 questions/problems per chapter, for a total of 1,780 coding questions/problems answered)

My Progress on The Odin Project:
1.  Introduction to Web Development                                            100% Complete
2.  Web Development 101                                                               33% Complete 
Note: Switched to FCC for the great online community and better updates/support.

My Progress on Free Code Camp (FCC): 
1. Get Started with Free Code Camp                                                      Complete
2. HTML5 and CSS                                                                                  Complete
3. Responsive Design with Bootstrap                                                       Complete
4. Gear up for Success                                                                            Complete
5. jQuery                                                                                               Complete
6. Basic JavaScript                                                                                 Complete
7. Object Oriented and Functional Programming                                     Complete
8. Basic Algorithm Scripting                                                                    Complete
9. Basic Front End Development Projects                                                 On 4 of 5
10. Intermediate Algorithm Scripting                                                     On 3 of 21
11. 
Intermediate Front End Development Projects
12. Claim Your Front End Development Certificate
13. Upper Intermediate Algorithm Scripting
14. Automated Testing and Debugging
15. Advanced Algorithm Scripting
16. AngularJS
17. Git
18. Node.js and Express.js
19. MongoDB
20. Full Stack JavaScript Projects

21. Claim Your Full Stack Development Certificate

After the FCC work above (estimated to take 800 hours), there are 800 more hours of coding projects on behalf of non-profits, which, in addition to contributing to the common good, provide us an opportunity to expand our networks and build a robust portfolio.


Hours Spent Coding Today: 6
Total Hours Coding: 697

No comments:

Post a Comment