Posts

How to Solve a Problem 6: Smallest Common Multiple

 Recently, I came across this question on /r/learnprogramming Question: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? Well, how would you write a program to figure this out?  The answer is not that difficult, but it involves a lot of prime numbers.  The short version: we can "construct" the number by starting from 1 and work our way up to 20.  1 is obviously 1 2 is obviously 2 3 however, will be 6, as it needs to be divisible by 2 and 3 4 however, is NOT 24, but 12,  5 is 60 6 is 60 because 60 is already divisible by 6 7 is 420  8 is 840 (remember, factors) 9 is 2520 10 is still 2520.  Do you see a pattern?  Let's say you need to calculate smallestMultiple of X.  To get it, you need the PREVIOUS smallestMultiple. i.e. smallestMultiple(X-1). For simplicity, let's call it "prevSM" If that is divisible by

Let's Make Dice Wars, Part 3

Image
We have previously created the skeletons of the game in part 1, and completed the game in part 2. We now add some "chrome" to the game, to make it look better, prettier, and so on.  And there are a LOT of things we can do, but we may need to rewrite a part of the program to accommodate the changes. This is normal and a part of the learning process.  Let's try making some simple changes. I am not going to show you ALL the changes as you can easily figure out the exact syntax with the steps I described. You can see the source code at the end. This is what it will look like: Change the Button Colors When you think about it, War button should be red, and maybe the reset button should be blue... and maybe rename it "Peace" as a joke?  Well, that's easy enough, with Bootstrap. btn-danger is red, and btn-primary is blue, so we just swap that around.  Keep a "log" of previous battles To clarify, we are adding ANOTHER field called "battle log" whe

Let's Make Dice Wars, Part 2

Image
Previously, we have created a basic HTML page, with a simple dice rolling logic, and simple UI, with Bootstrap and jQuery, so we have the beginnings of a web-based version of Dice Wars.  In this part, we will complete the "game", where you roll the dice for two players, determine who won, adjust scores accordingly, and declare winner or loser after X points. There will also need to be a "reset" button so we can start again.  You will learn in this segment: Very simple Bootstrap grid layout, centering, and so on Simple DOM manipulation with jQuery on multiple DOM elements How to write JavaScript function with parameters so it can be reused How to write make one function call another function Create a properly working, if simple, game We will set the starting points to 5, and first player to hit 0 is the loser, and the other is the winner. Keep in mind later, we may want this to be variable so we can setup variants of the game.  Setup Two Players Right now, let's

Let's Make Dice Wars: Part 1

Image
Creating a project is not easy, but it is essential to demonstrate your worth as a developer. Mainly for grins, I'll start a simple project, and keep adding to it.  We'll create "dice wars", a pretty simple game. We'll start simple, but we'll embellish it until it looks really darn good. The rules for "dice wars" are available here .  I am best with JavaScript, so we'll start there. Please note that you need to have SOME fundamental knowledge of JavaScript to follow along at a normal speed. This is NOT a JavaScript tutorial, though it can be treated as a project sample.  You will learn in this segment: Very simple Bootstrap Very simple DOM manipulation with jQuery How to use the random number generator How to write a message to JavaScript console with console.log How to write JavaScript function, and how to call it from elsewhere How to click a button and make it run a function Initial Planning For the first step, w

Your Resume Sucks III: Fixing the Work Experience and Education

In part 1 we discussed how to fix the first 1/3rd of your resume so the hiring manager will want to read the rest.  Then in part 2, we discussed how to write a highlight or skills portion that highlights the skills you have learned from either school or on the job.  This is part 3, where we rewrite the experiences and education to make them more... suitable for a webdev position. While the advice is for a webdev position, the advice works for all resumes. If you are just starting out (just got out of bootcamp, just graduated) and you have mainly customer service jobs (fast food, delivery, cashier, store clerk, etc.) then you need to put your best face forward.  You Have Some Volunteer or Paid Experience If you have done websites for other people before, great! Show their URL, even if it's a blog! (However, if you just used a default theme, don't bother. That is just lame. I mean something you put some effort in, tweaked layout added extra menus, that sort of thing). URL to the

Your Resume Sucks II: How to Fix the skills

One thing that I've emphasized from Part 1 is that each resume is telling a story about you. It is self-promotion, selling you to the hiring manager. It is propaganda, trying to influence the reader regarding your suitability for a particular job.  Remember your English essay lessons? About every sentence must support the paragraph, and every paragraph must support the section, and every section must support the overall statement?  Same goes for your resume. EVERY word on the resume must support your summary... that you deserve the job, not in a begging way, but in a "of course I am good for it" way.  If you have a lot of relevant job history, you probably should use traditional / chronological resume where you just list all the jobs, since most of your careers you have been working toward this job you're applying for.  But if you have very little experience (new grad? bootcamp?) or you are shifting careers, then you need to do a little more planning. You need to do a

Your Resume Sucks (and How to Fix It): The first half page

I have been unemployed for many months, but after over a hundred resumes sent out, I have been dismissed left and right as unsuitable. Many of my resumes did not even generate a rejection notice.  They were so bad, they probably got filed as spam. I've even interviewed once or twice but did not pass the first round, even for pretty much entry-level positions.  So what was wrong? Apparently, my resumes really do suck. I used to just list what I did, cramming as many keywords in as possible. That does NOT work.   Modern hiring managers and/or screener sdon't read the resumes from beginning to end. They don't have the time. Instead, they use a program called ATS (applicant tracking system).  First, your resume goes through ATS (applicant tracking system), which uses AI and NLP to pull out keywords that supposedly match what the position is looking for and rates your resume, then dumps those that don't meet a certain minimum rating.  BONUS TIP: If you applied but never got