Posts
Showing posts from April, 2017
What's For Lunch App!
- Get link
- X
- Other Apps
At the Copper State Comm. office, around 11:30 AM we start trying to figure out what we're going to have for lunch. Since it takes us so long to decide, the question gets asked earlier and earlier. Our record is 9:20 AM. On that particular day, we left for lunch around 1:30 PM because of our indecision. As my favorite saying from the movie robots goes "See a need, fill a need." Enter the "What's For Lunch? App!" This is a console application I coded that randomly selects a weeks worth of restaurants for us. Don't like the selection? Run the function listWeek() again for new options. The console app has the following features: Add locations Remove locations List locations Create a list of "Places to eat" for the week Save the list to a file Open a list from a file The code can be accessed (and used openly) at my GitHub repository, under My-Apps. GitHub: "What's For Lunch? App!" Enjoy! I certainly do!
Anticipa.....
- Get link
- X
- Other Apps
As the clock winds down towards the end of the challenge, more people have solved the reverse challenge using 5 characters. Nearly 20 hours worth of searching has not yielded the answer to me and after about 100 tries, the best I can do is finish with 32 characters total. That's 13 characters coded for those not keeping track. The challenge is actually asking for the first bit set in the given <int> k. So for example: The number 1073741824 in binary is :01000000000000000000000000000000. If you count, from the right, the first bit set is 31. Hence the answer, 31. 1 = 0001 = 1 2 = 0010 = 2 23 = 0001 0111 = 1 And so on. After scouring the interwebs and cplusplus.com/reference I found a little function called ffs() or Find First Set. This function finds the first bit 0-1 set (meaning turned on or 1) and returns the position. So my grand solution: return ffs ( k ); Easy, peasy, lemon squeezey. The shortest solution: int(* rightGuy )(int) = ffs ; WOW! After...
5 Character Function!
- Get link
- X
- Other Apps
I just finished my first "Author Challenge" on Code Fights. This was a "reverse challenge" where you are given the function signature (int function (int x)) and a list of sample tests. The challenge is to find out what the Author is looking for. What's the problem, what's the solution? Also, try and solve it in as little characters as possible. I figured it out in 92 characters and thought I was pretty smart. The solution was to find out how many times a number was divisible by 2 evenly, I think. Anything under 10 (0-9) needed to be returned. So my final code: int rightGuy (int k) { int counter = 0; if (k < 10) return k; while (k % 2 == 0) { k /= k / 2; counter++; } return counter; } There it is in all of it's beauty! 92 characters that resolved the problem. I got my 1000 gold coins, a badge, and some XP! Then I went...
So Much To Do!
- Get link
- X
- Other Apps
Do you ever feel like there is so much to do, that you end up doing nothing at all. Overwhelmed is what they call it, I believe. As I try to "put my name" out there into Cyber Space, I am humbled by how much I don't know and exhausted by how much I need to do. Twitter - Check Facebook - Check YouTube - Check Blog - Check GitHub - Check Website - Check Language Skills - Check Daily Coding - Check New Skill Development - Check Podcasts - Check New Software Familiarization - Check What's left? Oh yes, full-time job, family, and 1/2 time school. Not to mention dealing with the everyday things like taking care of the lawns and fixing up the house, doctors appointments, and other responsibilities. At times it seems like I have no time to myself and not enough time to really focus on any particular thing. Did I mention I run a D&D campaign twice a month. Every other Saturday from 3-10 PM. If you're following my blog, or if you're reading these c...
Hitting a brick wall on Code Fights!
- Get link
- X
- Other Apps
For the past two weeks I have been cruising through the Code Fights Arcade Mode Challenges. As I complete each challenge I get a small ego boost knowing that only 8-900 other C++ coders have solved the same problems. Most of the time I don't understand their code and it looks like they were trying to put as few lines as possible. I don't see this as "efficient" since I can't understand their logic, nor is their code readable. Sometimes I come across another solution that is close to mine and it helps me see what changes I can make to my code to make it more effective. For example, I will spot a more logical way to accomplish the same task, so I change mine. This normally shortens my code while keeping it readable. Sometimes, I realize that I have entire lines of code which don't matter so I can delete it with the same results. The current challenge I am working on is a doozy! Only 200 other C++ coders have solved it. I am given the following string: The ...
Video Programming Series
- Get link
- X
- Other Apps
I wanted to outline the video series that I am making on YouTube. If you follow my blog or if you're interested in coding, I think this will be a great way to get into a language and get some basic programming concepts. I wanted to take what I am learning in college and pass it along to others in a format that is easily accessible and hopefully, easy to understand. The video series is going to be broken up into 4 sections. Each section will build upon the concepts learned in the previous videos and culminate in a Section Project . After certain videos, I will include a second video going over common problems and examples, using the tools presented in the series. 1. Introduction (Code::Blocks, "Hello World!") 2. Output 3. Input and Variables 4. Expressions 5. Functions 6. Boolean Expressions 7. IF Statements A. Monthly Budget 8. Debugging 9. Loops (while, do-while, for) 10. Loop Design (counter, event, sentinel) 11. Files B. Calendar 12. Array Syntax 13...
Name Change?
- Get link
- X
- Other Apps
Why the name change? As I was driving to work this morning, I realized where I got the name Codeland. On the podcast I listen to code-newbie , every episode mentions a coder conference that they host called codeland. Ah! Well, not that camelCase is original, but it is more fitting to what I am focused on. For those "non-coders" out there, camelCase is a style of coding that differentiates variables from other labels. Let me show you some examples: data types = are entered in lowercase ( char, string, vector, int, float, double, etc. ) variableNames = can be both lowercase and camelCase. You could have a variable named count , which would of course be all lowercase. You could also have a variable named isValid which would represent a true or false (0 or 1). functionNames = are also camelCase, but rarely lowercase. Function names normally describe what the function does, such as calculateTaxBracket , or findMissingLetter , or isPassingClass . You can, of course, h...
Impostor's Syndrome
- Get link
- X
- Other Apps
https://en.wikipedia.org/wiki/Impostor_syndrome Impostor syndrome (also known as impostor phenomenon or fraud syndrome) is a concept describing high-achieving individuals who are marked by an inability to internalize their accomplishments and a persistent fear of being exposed as a "fraud". Despite external evidence of their competence, those exhibiting the syndrome remain convinced that they are frauds and do not deserve the success they have achieved. Proof of success is dismissed as luck, timing, or as a result of deceiving others into thinking they are more intelligent and competent than they believe themselves to be. I started listening to the code-newbie podcast where I was introduced to this concept of Impostor Syndrome. A frequent question asked to the guests is "How did you overcome impostor's syndrome?" All of them answered that after a few months in their respective positions, they realized that they were not impostors but were functionin...
Google Interview (Unordered Sets)
- Get link
- X
- Other Apps
I was just watching a YouTube video where two software engineers go over an interview problem they might present to a potential candidate. In the video, the candidate (the second engineer) is given a set of numbers and must find a pair that equals a specific sum. Two sets of numbers are presented: [1, 2, 3, 9 ] Sum = 8 [1, 2, 4, 4 ] Sum = 8 I immediately thought about a linear search with a double for loop. bool hasPair(const vector<int>&data, int sum) { for(int x = 0; x < data.size() - 1; x++) for(int y = 1; y < data.size() - 1; y++) if(data[x] + data[y] == sum) return true; } - or something like that The second engineer also presented the same solution and I thought, "Ya! I got it right." Whereas that solution would solve the problem, the double for loop takes too long and Google is looking for a faster solution. ...