Wednesday, January 15, 2014
Are you Human?
Well, I'm back and hoping there'll be less stupidity today which will be difficult since I forgot my wallet like a genius, so water is my drink today. One of my g+ peoples shared some music that I thought I'd check out. So, I'm listening to Tomahawk. Never heard of them, but it seems kinda nifty. Now it's time to plug in and plug away!
Blackjack. That's a fun game. Now I'm going to be writing code to make the game. Good news: I like the fact that they want you to think about how to figure it out by yourself. Bad news: I don't like the fact that once you uncover the "hint" that tells you what you need to do, it turns out there's only one way that they will take as a pass. It should be that if it works, that's a pass. If you don't tell me how to get it done, I should be able to have a certain amount of freedom as to how it gets done, but no. Only one way. Oh well. I just wish there wording had been a little bit more transparent.
Well, that was easier than I thought it was going to be. I didn't like how they finished it, but it works. So, whatever.
Now I've moved on to a "review primitives" section. Pro: I remember most of it. Con: all they have you do is print a sentence to the console to pass the section. This is going to take some personal initiative. After playing with some of the lessons, they are now actually having me do some stuff. So, I don't have to come up with my own stuff. I kinda liked it. Ah well, back to the grindstone.
I really like using <Math.random()> and such. It's so easy and yet so useful! A handy dandy little random number generator.
OK, this was a little strange; I just did a lesson and they had a var that they didn't use, but they wanted me to answer. I'll show you:
// Write your full name
var myName = ("Mookie Chess");
// And your age
var myAge = 24;
// Are you a human? Be honest.
var iAmHuman = "no";
console.log("My name is " + myName + " and I am " + myAge + " years old.");
Am I human? Alone a strange question, but then to not use it? It's times like these when I over-analyze things. I just want to know! But hey, now I have a post title.
So, a Boolean is only true or false? Well, OK then. Good thing I looked it up, or I would have been stuck. These guys really don't inform you of everything, but then I suppose that's a good thing. Use some personal initiative to get through sort of thing.
Hey, another badge!
We made it through! Olé!
Well, hopefully I won't be so slow to Google some definitions next time! See you humans on Friday!
--Martin
Monday, January 13, 2014
Capitalizing On Skills With A Side Of Stupid
(sorry for the late post. As you'll see there was a loooot of stupid...)
Well, I made it back for yet another week! Today's post is brought to us by some Blind Melon and a latté whipped up by the friendly barista. I was going to just work with no music, but then the place got swamped and everyone was talking and noise happened, but now I can plug in and plug away!
I've been doing these classes for about a year, but this is my first REAL attempt at actually taking time every day to do at LEAST an hour's worth of studying in and I'm starting to see some of the skills that get picked up along the way. For instance, today I was working on some classwork and I got a syntax error. It used to be that I would be at a loss as to what the reason was, but now I'm starting to learn what to check before giving up hope when I get a syntax error, and today I took the time to check that all of my variables and such were in the correct place and that I had the correct capitalization. Turns out one of them needed to be moved AND capitalized. Good thing I'm a student and not a pro, because; that would have been embarrassing. I've also noticed I'm better at algebra too. Turns out I was right in thinking that there was a lot in common between the two.
Right now I'm working on a section that (once again) is using math involving a startup. Such as paying employees, rent and such. I'm also dealing with multiple parameters which are easy, it's just difficult to always get the correct ones in the correct places, but copy pasta!
I really don't like it when I don't pass the lesson and they won't tell we why. They're just like: fail. Try again. At least tell me what's wrong. The weirdest is when I get NaN, but they say I passed the lesson. No. I'm not going to NaN my way through this. Whoever wrote this lesson definitely didn't think of everything.
Switch statements are awesome, but I had forgotten that you have to add a return at the end after the <}> and now I feel stupid. Duh, of course there should be a return.
I just finished the function which tells you the total costs for a startup based on salary, number of workers and city. Kinda sounds cool when I write it out.
Speaking of not thinking of everything, look at this:
var calculateTotalCosts = function(salary,numWorkers,city)
{
fixedCosts = 5000;
variableCosts = salary*numWorkers;
switch(city)
{
case "BEJ":
rent = 25000;
break;
case "NYC":
rent = 30000;
break;
default:
rent = 10000;
break;
}
return rent + variableCosts + fixedCosts;
};
console.log(calculateTotalCosts(50000,9,"BEJ"));
console.log(calculateTotalCosts(50000,9,"NYC"));
console.log(calculateTotalCosts(50000,9,"MUM"));
That is a perfectly working code and exactly how they TELL you it should be. They actually give you the code with everything except the console.log parts.
Turns out they want you to change it to an if/else situation. WHAT?? why... omgosh this si so stupid.... gr... just going to peddle through this crap and hope they don't do something so mind boggingly stupid again....
Aaaaand they signed me out. None of my work from today is saved. Wow... Well, at least I know how to get through this crap.
Jeeze that was annoying. Ah well. All part of the experience, I hope.
See y'all Wednesday!
--Martin
Friday, January 10, 2014
Badge Happy
Stupid! That's what it is! When a lesson has a specific way that it wants you to do a line of code, and then DOESN'T tell you!
Let me show you:
var x =
var y =
//The ternary operator in action
result = x > y ? "good job" : 20;
//Rewrite the ternary code using if else statements
Let me show you:
var x =
var y =
//The ternary operator in action
result = x > y ? "good job" : 20;
//Rewrite the ternary code using if else statements
First I tried to use return, but that gave me some error messages, but then I tried this and it worked, but I didn't pass the lesson:
if (x>y){
console.log("good job");
}else{
console.log(20);
}
See the 'result' in the ternary operator? Turns out you need that instead of anything else, because; they feel like it.
That's stupid. I understand using result, but they could have told me that....
And Now I'm doing a dice game and using math.
var die1 = Math.floor(Math.random()*6 + 1);
Math.Whoever created the math section in .js is hilarious!
Today's post is brought to us by a nice latté and some Electric Light Orchestra. Time to plug in atd plug away!
I just got ridiculously happy, because; I finished a lesson with no errors and passed at the very first try! WHOO!!
One of the really cool things that I like about having a forum, is that I can see how other people wrote their answers, and how they are different from mine.
For instance, this is mine:
// here we need to check if there are doubles. If so, score should be
// double the sum of the two dice
if(die1+die2%2===0){
score=(2*(die1+die2));
}else{
score=(die1+die2);
}
}
and this is someone else's:
// here we need to check if there are doubles. If so, score should be
// double the sum of the two dice
if(die1===die2){
score=(die1+die2)*2;
}
else{
score=die1+die2;
}
}
Personally speaking, I like what they did with the <if (die1===die2)> better than my <if (die1+die2%2===0)> their's is so much more simple! I should have thought of that...
Simplicity is what I'm trying to go for every time I write code. So, I'm now upset that I didn't do a better job at it. Oh well, next time I'll know.
Hopefully, they won't split each test into something like this: // Define a function named calculateTotalCosts
// declare a variable fixedCosts the value of 5000
// have the function return fixedCosts
I can do that easily. why not have the text three things in the same page?
Ah well. See y'all Monday!
--Martin
Wednesday, January 8, 2014
What The What!
Ever since the beginning of this course, I've been working with if/else statements and conditionals. It would seem that thing are about to take the next step. Now I'm starting on switch statements. Olé? I'm actually pretty happy with my rate of studying. I just have to keep on plugging in and plugging away. Ok, so I'm working away with the switch statements(Which are awesome BTW) and now they're saying there's another way to do it called Ternary operators. According to el Goog, 'ternary' is an adjective meaning composed of three parts, or in mathematics, means using three as a base. Now to find out if that is what it means in programming. They say they are an ugly name. That's kind of dumb. I like the sound of the name. Ternary. Sounds like it's about a bird or something. But I digress, back to the code shtuff. The Offspring is my soundtrack today. I'd never heard of them, but my friend suggested them, and I am really liking them. My drink is some black coffee. Don't want to have the same type of thing all the time, right?
What the what! I know <if/else> stuff; now ternary operators can do that in one line?
Why did I learn <if/else> ? It better be because sometimes it's better to use one over the other.
Here's what I mean:
var x = 7;
var y = 4;
if (x > y) {
result = "good job";
}
else {
result = 20;
}
//Below is the above code written using the ternary operator
result = x > y ? "good job" : 20;
What the what! I know <if/else> stuff; now ternary operators can do that in one line?
Why did I learn <if/else> ? It better be because sometimes it's better to use one over the other.
Here's what I mean:
var x = 7;
var y = 4;
if (x > y) {
result = "good job";
}
else {
result = 20;
}
//Below is the above code written using the ternary operator
result = x > y ? "good job" : 20;
See what I mean?
If I find out there's something after this that's even simpler, I'm going to be upset with these dudes.
Fist pump! I'm getting these down easy!
Maybe that's why they started with <if/else>? I hope that they had a plan when they did this.
So, the good news is that I can read the code they have set up for me and see what it means, the bad news is that now when I read anything and see punctuation commonly used in .js (<>?/+===) for instance, I start reading in 'code mode' when it's not code, and I get confused for a sec. That will probably go away after a bit. I hope?
That's all for me folks. I got a lot done today! See Y'all friday!
--Martin
So, the good news is that I can read the code they have set up for me and see what it means, the bad news is that now when I read anything and see punctuation commonly used in .js (<>?/+===) for instance, I start reading in 'code mode' when it's not code, and I get confused for a sec. That will probably go away after a bit. I hope?
That's all for me folks. I got a lot done today! See Y'all friday!
--Martin
Monday, January 6, 2014
Staying Frosty!
So, the weather decided to be redonkulous today. In Texas, 33 degrees Fahrenheit is crazy cold even when there's no wind, but I got out of the house and game to my coffee shop to get my coffee on and some code done!
I thought I'd start with some links that I found and/or were shared with me on G+:
link one:
http://www.christopherbiscardi.com/2014/01/06/flattening-nested-arrays-in-javascript/
I'm not COMPLETELY sure how this will be applied to me, but I've got some stuff that I'm working on that I think could be aided by this.
Also this:
http://www.javaworld.com/article/2078724/mobile-java/10-steps-to-becoming-the-developer-everyone-wants.html
The bullet points were enough for me, but read the definitions if you're crazy like that.
So, now down to business. I'm playing a Chris Cornell album called Carry On. I love the songs on here. A few covers, but they're decent.
Today's lesson starts off with MOAR conditionals.
var legalDrivingAge = 18;
var canIDrive =
// write if else statement here. Return true or false
I thought I'd start with some links that I found and/or were shared with me on G+:
link one:
http://www.christopherbiscardi.com/2014/01/06/flattening-nested-arrays-in-javascript/
I'm not COMPLETELY sure how this will be applied to me, but I've got some stuff that I'm working on that I think could be aided by this.
Also this:
http://www.javaworld.com/article/2078724/mobile-java/10-steps-to-becoming-the-developer-everyone-wants.html
The bullet points were enough for me, but read the definitions if you're crazy like that.
So, now down to business. I'm playing a Chris Cornell album called Carry On. I love the songs on here. A few covers, but they're decent.
Today's lesson starts off with MOAR conditionals.
var legalDrivingAge = 18;
var canIDrive =
// write if else statement here. Return true or false
Have to make it return true or false if they can drive. This'll be easy. The next one will probably be crazy insane. That's how they do it.
Turns out this was the crazy insane one. T`hose tricky bastards.
Also, what the hell does
"Expected an identifier and instead saw ';'
missing semi colon."
Mean?? That's contradictory!
Side note:
doing my studies at a coffee shop is interesting in that I will occasionally glance around whilst sipping my latté (could actually afford one today! XD) and I'll be like; woah. those people weren't here a second ago. wait, it's been an hour?? haha!!
// Define the function under this line
var canIdrive=function(myAge,legalDrivingAge){
if(myAge>=legalDrivingAge){
return true;
}else{
return false;
}
};
// Declare legalDrivingAge under myAge
var myAge = prompt("How old are you?");
var legalDrivingAge=18;
//Create an if else statement using the function as a condition
if (myAge>=legalDrivingAge===true) {
console.log("You can legally drive!");
}else {
console.log("You'll have to wait a few more years!");
}
see that first 'var'?
yeah it just took me twenty minutes and a few WTFs to figure out that I missed that in my code...
Yup. Every coder person does that. well that was forever!
see y'all wednesday!
Friday, January 3, 2014
Plug In And Plug Away
Conditionals!
Apparently I need to brush up on my terminology, because; I've been using these for a while, but I didn't know their name. Oops.
Once again, I'm at my favorite coffee shop trying to get some classwork done. I'm a little early because my boss said no work today. So, I headed over here after a decent sleep. Now to get an hour or to in. I try not to work for too long. I start going crazy. So, a walk or something will probably happen in the middle of this.
I finished the taxiFare section and am now in an overview of everything I've done up to this point. Mainly they just want me to check out their blog. So, I'm going to plug in my headphones, get some of Them Crooked Vultures going, drink my iced tea because I'm too broke to buy coffee, plug in and plug away!
Coding notes:
Seriously, <else if> rocks, but I know how it works. I think that they think I wasn't paying attention to anything they said.
I've been waiting for <&&> to make a show. And now, TADA! <&&> everywhere!
var checkNameGender = function (yourName,gender) {
//All the code below was used in exercise 1.6
if (gender.length > 0 && yourName.length > 0) {
if (gender === 'male' || gender === 'female') {
return true;
} else {
return false;
}
} else {
return false;
}
};
checkNameGender("Mookie","male");
And there's my last lesson. I actually went through that really easily. Finish on success, right?
I've always liked the idea of having Mookie for a nickname. Now I can amuse myself by telling the code to call me Mookie. =-)
Apparently I need to brush up on my terminology, because; I've been using these for a while, but I didn't know their name. Oops.
Once again, I'm at my favorite coffee shop trying to get some classwork done. I'm a little early because my boss said no work today. So, I headed over here after a decent sleep. Now to get an hour or to in. I try not to work for too long. I start going crazy. So, a walk or something will probably happen in the middle of this.
I finished the taxiFare section and am now in an overview of everything I've done up to this point. Mainly they just want me to check out their blog. So, I'm going to plug in my headphones, get some of Them Crooked Vultures going, drink my iced tea because I'm too broke to buy coffee, plug in and plug away!
Coding notes:
Seriously, <else if> rocks, but I know how it works. I think that they think I wasn't paying attention to anything they said.
I've been waiting for <&&> to make a show. And now, TADA! <&&> everywhere!
var checkNameGender = function (yourName,gender) {
//All the code below was used in exercise 1.6
if (gender.length > 0 && yourName.length > 0) {
if (gender === 'male' || gender === 'female') {
return true;
} else {
return false;
}
} else {
return false;
}
};
checkNameGender("Mookie","male");
And there's my last lesson. I actually went through that really easily. Finish on success, right?
I've always liked the idea of having Mookie for a nickname. Now I can amuse myself by telling the code to call me Mookie. =-)
Thursday, January 2, 2014
First!
January 2, 2014.
I've been trying to learn to code for a while now, and I haven't made as much headway as I would like; so I'm going to use this blog as a narcissistic way to keep myself on track. I'm trying to learn .js and get some knowledge under my belt. I am an absolute n00b. I'm just now getting comfortable with variables and functions. Right now I'm using code academy, Udacity and random stack overflow places that answer my urgent Google searches. My current hardware is a Chromebook Pixel. Boom. Yup, on a Pixel. All my classes are online so, right now I don't need any hardware-specific. When I need something like BlueJay (or whatever it's called) I'll just use Crouton! Linux FTW!
I'm going to start with a M-W-F schedule and we'll see where it goes from there. Expect screenshots, strange comics, and anecdotes with a hint of Southern in there.
A little about my person.
I am twenty four, I live with my parents in the boondocks of Texas. Or, as the Australians would put it, waaay past the black stump! I work in general construction right now, but obviously want a better job. I'm aiming at front-end web development and once I have that down(ish) I want to go forward with android app development. hopefully by this time next year, I'll be in a better place.
So, to start, I'm going to go jam some Pink Floyd and get some class work done.
Here's what I worked on today:
// add a parameter called hourOfDay to the function
var taxiFare = function (milesTraveled,hourOfDay) {
var baseFare = 2.50;
var costPerMile = 2.00;
var nightSurcharge = 0.50; // 8pm to 6am, every night
var cost = baseFare + (costPerMile * milesTraveled);
// add the nightSurcharge to the cost starting at
// 8pm (20) or if it is before 6am (6)
if (hourOfDay>=20||hourOfDay<6)
{
return nightSurcharge+ baseFare + (costPerMile * milesTraveled);
}else{
return cost;
}
};
console.log(taxiFare(12,13));
It's not exactly elegant, but I got it to work!
the idea was to get taxiFare to print out the bill and have the option to put in time of day. That if(hourOfDay) bit had we stuck for a while! But, I'm through it. =-)
--Martin
Here's what I worked on today:
// add a parameter called hourOfDay to the function
var taxiFare = function (milesTraveled,hourOfDay) {
var baseFare = 2.50;
var costPerMile = 2.00;
var nightSurcharge = 0.50; // 8pm to 6am, every night
var cost = baseFare + (costPerMile * milesTraveled);
// add the nightSurcharge to the cost starting at
// 8pm (20) or if it is before 6am (6)
if (hourOfDay>=20||hourOfDay<6)
{
return nightSurcharge+ baseFare + (costPerMile * milesTraveled);
}else{
return cost;
}
};
console.log(taxiFare(12,13));
It's not exactly elegant, but I got it to work!
the idea was to get taxiFare to print out the bill and have the option to put in time of day. That if(hourOfDay) bit had we stuck for a while! But, I'm through it. =-)
--Martin
Subscribe to:
Posts (Atom)



