Friday, January 31, 2014

Syntax, My Dear

     It is a lovely Friday here in Texas and I am back at it! I'm here at the coffee shop getting ye 'ol caffeine going. I have been true to my lowering the caffeine amount, but I sure do miss it. So, I'm happy to have my cup 'o Joe today. So, now that I've got that and Freaks by Hawk in Paris playing, I'm ready to plug in and plug away!


                                       HTML5


     After acing the test for all the HTML that I've learned over the course of the last few days, I moved on to a social networking profile for King Kong.  That's not something you say every day.   To start they want me to make ME a profile. This:https://lh5.googleusercontent.com/-gq0oYM8KXyA/UupJccVf9NI/AAAAAAAB-tg/_F3b13eH30Q/w852-h608/but-first-coffee_0.jpg
was the picture that I went for my profile pic. I think that works just fine. I'm actually really picking up this HTML stuff really well! I think I'm starting to get how to learn how to learn programming more easily. Pretty sure my synapses are starting to realign themselves so that I remember text better. 
     I finished the social profile! I am now the social profile maker of awesome!

Olé! Now, onward to the JavaScript!



                                    JavaScript                  






     And we're meeting the Logical Operators again! There are three Logical Operators in JavaScript and they are: 'and' (&&), 'or'(||), and 'not'(!) I've already dealt with these, but now they're being again. Starting with: 


var iLoveJavaScript = true;

var iLoveLearning = true;

if(iLoveJavaScript && iLoveLearning) {

  // if iLoveJavaScript AND iLoveLearning:
  console.log("Awesome! Let's keep learning!");
} else if(!(iLoveJavaScript || iLoveLearning)) {
  // if NOT iLoveJavaScript OR iLoveLearning:
  console.log("Let's see if we can change your mind.");
} else {
  console.log("You only like one but not the other? We'll work on it.");

}
Which works out well, because; I do love learning.  
     And now to work on a Choose Your Own Adventure game involving a troll. I'm making a game, on the internet, about a troll. Irony thy name is Choose Your Own Adventure.
     So, it would seem that yet again the people writing out the lessons forgot to tell me something important... Let me explain; here's what they told me to do: do a variable that includes a prompt. Make the prompt have a <.toLowerCase> or a <toUpperCase> at the end and then create some switch statements. This is what I made:

var user = prompt("What is your quest?","Answer here.").toUpperCase();


switch(user){

    case "Bacon.":
        console.log("That's not a quest!");
        break;
    case "To seek the Holy Grail":
        console.log("Right. Off you go.");
        break;
    case"To be bored and alive":
        console.log("That's not a quest, that's what a teenager says.");
        break;
    default:
        console.log("That... isn't in the records, but whatever. Go away.");
}

     Now, at first, I didn't know why I was only getting the default switch statement. Turns out, you need to uppercase your cases like this:

  case "BACON.":
        console.log("That's not a quest!");

        break;
so that they will be the same. They didn't tell me that. Deductive reasoning alone got me through that lesson after some loss of time. Seriously, I think someone that didn't really know what they were doing made this entire series and was overseen by someone who just glanced around to make sure things ran. There should be some kind of beta testing or something for anything like this. But, I digress. Onward to the rest of the studies! 

     So, after battling my way through that, I am now moving on to Arrays and Objects. Which, I know I've gone over before, but it's never a bad thing to brush up on things already studied at this stage. You can put arrays inside other arrays? Array-ception! 

     So, you can nest other arrays in Dimensional arrays: var array=[["Hello", "Hi"],[23,46]];
Which all have the same  amount of elements as nests (number of[]'s) how many dimensions the array has is governed by how many nests it has. So, in this case, it's a two dimensional array.
And Jagged Arrays: var array=[["burp","Pizza"],["questions",42,"life"],[13]];
Which don't have the same amount of elements in their respective nests, but can still be used in the same manner. 
     Well, a lot has been done today! Good thing for the coffee!  I just have to remember syntax! Syntax,syntax,syntax!! From what I've heard, that's just something any programmer has to be aware of. So, keeping that in mind, I'll see y'all Monday!

--Martin



     

Wednesday, January 29, 2014

A La Casa

     Well, I'm back! I'm a la casa today. Decided to stay home. I might make a French press. That actually sounds really nice. We're starting on Control Flow with JavaScript and starting on font size and color with HTML. Right now, I've got a Naked Blue Machine drink, The Piano Guys playing, and I'm ready to plug in and plug away!


HTML5




     The design behind changing the font size is pretty simple; I just have to remember where the dashes and colons go. I like how they measure by pixels. That makes it easier to understand the size compared to millimeters or something similar. The
colors are pretty cool! I control the color spectrum! Mwahaha!
     I suppose by the time I'm done this lesson I'm going to know a lot more font names than before. Background-color, font-size, font-family, so many fonts and colors!
     I just have to remember to put the quotation marks. Got a little bogged down on a lesson when I forgot about that.

Onward to JavaScript!!

JavaScript

     So, Control Flow. Pretty much a fancy way to say you want a result for something. Usually for a specific set of somethings. Using "if/else else if" I'm figuring out if a number isNaN. Turns out isNaN is a thing. isNaN stands for: is not a number. Now to use it correctly. While that sounds easy, it can sometimes be hard to remember that isNaN is a negative statement. So, I have to think the reverse of what usually happens with variables and such.
     Loops are fun and everything, but remembering that I want to print the results to the console means that I need to call the loop inside the curly brackets.
     Well, I think I'm done for the day. The lessons ended in switch statements, and we'll continue with that next time.
     Now, that I have some HTML skills, I can put my name in the middle!! That's...something, right? See y'all!

--Martin

Monday, January 27, 2014

Ye Olde Dragon Slayer

     Well, it's official. Tea cannot compare to coffee. I need my latté, man! On a happier note, I'm making good headway with the HTML5 stuff. The JavaScript is coming along nicely as well, I believe. I went with a different approach to the music. I'm listening to Georgian Orthodox chanting. I have no idea what they're saying, but it sounds nice. And this way I don't hear the chatter of the coffee shop. The wifi (once again) went out over the weekend. It's back, but I decided to come here for the more stable wifi. I don't want it going out while I'm working on stuff. So, now that I've got the chanting going, some Earl gray tea(the best thing after coffee) it's time to plug in and plug away!

     The HTML5 portion of my work was on ordered and un-ordered lists. Not anything groundbreaking, but I can see how it would be useful.
  1. It makes for effective understanding.
  2. It gets your point across.
  3. They're easy and fun to use.
  I think I'm going to start writing my posts in HTML so that I can be learning as I learn. Nifty and useful all at once! That's how I like it! So, now that I've had that revelation, it's onward to the JavaScript!

JavaScript

      The great dragon slaying game! Not too great of a dragon it would seem. The dragon's total health is four points. I suppose they don't want you to be there forever. Heh. console.log("You missed the dragon. We'll sing the song of your people at your funeral."); I thought that was a nice touch. I like it when they let you print what you want.
     I don't know why, but I seem to be dyslexic today. I keep spelling things like console incorrectly like conoles, or something similar. Yeesh. The folly of man would seem to be spelling things incorrectly. Not exactly something to have while trying to program which, as everyone knows, relies heavily on spelling correctly.
     Yay! I slew the dragon!
That's a of HTML around the image. It would seem it takes a lot to put the image there.








Anyhoo, I'm done for today! A lot was done, a lot was learned, a lot of knowledge now known. Onward to the next one! On Wednesday. See y'all then!
--Martin

Friday, January 24, 2014

Google Is Dead/Branching Out

     Well, Google went down today. That was fun. For a minute there, I was going to have to use spotify or some similar service to play music, but music is working, G+ is still being cray cray. No coffee for me today, I might make a tea at some point. I'm trying to stop depending on caffeine. This sudden halt to most of Google's services has made me realize that I depend on Google too much.  I need to branch out my dependencies so that when a service goes down, I won't go with it. I've got a Creedence Clearwater Revival radio going and missing my coffee already. I'm here at the house getting stuff done and ready to plug in and plug away!

     I've started some HTML5 lessons alongside my JavaScript lessons
I know that .js, HTML, and CSS go hand in hand in hand. So, I did this lesson series. It's pretty short and easy. HTML is short and easy for the basic stuff I need it for. Though, I do have some HTML5 game ideas floating around. 
But, that's enough HTML for now.


     It seems that the dev channel on my Chromebook didn't like Code Academy. I switched to the beta channel and I no longer have cursor issues. So, until the next dev update, I'm staying on beta. I'm still working on <while> loops and such. Not much more to go, so let's get this going!

     ReferenceError: Invalid left-hand side in assignment What? ugh... I keep getting this. Darn Reference errors... Well I figured it out. I was doing a for loop wrong, but not wrong enough to get a red thingie on the left of the editor. The <do/while> loops are pretty nifty. The name of the variable that I'm working with is called getToDaChoppa. Can't say they don't have a sense of humor.

     Hey, look at that! I passed the lesson review first time around! That doesn't happen too often. Looks like these studies are actually helping me out here. This is a good note to end the week on. I'll be starting on a dragon-slaying minigame next time. See y'all next time!
--Martin




Wednesday, January 22, 2014

Stupid Cursor/ While Loops

     I'm back at the coffee shop! I spent some time being diverted by Google Now on ChromeOS, but I'm at it now. I have my latté, I have 2 Cellos and Escala playing (I'm in a cello mood today) So, now I'm going to plug in and plug away!

     Today, I'm working on a program that is aiming to find a certain word in a wall of text. It seems similar to Python with <page.find> sort of thing. Not sure what this comment:</*jshint multistr:true */> means yet, but I'm sure I'll figure it out soon enough. The backslash seems like a nicely useful addition to my knowledge center. It lets you break a line without it being considered a statement of any sort. It lets the text wrap around as it were. Found this out about the weird comment:"You can ignore the /*jshint... line for now. All that does is tell the console to stop worrying about our use of backslash characters for wrapping long lines of text." Seems Like something that will be used a lot in later lessons.  This program is using <for> loops and arrays to start the lesson. I like where this is going. <if/else> statements that include an array are proving themselves to be a foe to my memory bank. I keep forgetting how to do it, but I'll get it down soon enough. Never fear, reader person! Memory will win! At some point! And now they mention the <push> feature before they've even told me about it. Time to Google away! So, I think I figured it out. 
     Now, this is just crazy... they had me do this:
/*jshint multistr:true */

var text = "blah blah blah blah blah\
blah Martin blah blah blah blah Martin\
blah blah blah blah blah Martin blah blah\
blah blah blah";

var myName = "Martin";

var hits = [];
for (var i = 0; i<text.length; i++){
    if(text[i]==="M"){
        for(var j=i; j<(i+myName.length); j++){
            if (text[j] === myName [j-i]){
            hits.push(text[j]);
            }
        }
    }
}
if(hits.length===0){
    console.log("Your name wasn't found!");
}else{
    console.log(hits);
}


But then someone posts something that means this:
/*jshint multistr:true */

var text = "blah blah blah blah blah\
blah Martin blah blah blah blah Martin\
blah blah blah blah blah Martin blah blah\
blah blah blah";

var myName = "Martin";

var myName = text.match(/Martin/gi);
console.log(myName);

     Does the same exact thing?? What?? I feel like they're taxing the long way around so that I can learn the most stuff. At least, I hope that's what they're going for.
     
     "Get in the habit of typing exactly as much as you need to, and no more!" I just came across that in the lesson. That is precisely what I'm going for! Clean, simple, and minimalistic code is what I'm going for. Am I incorrect in thinking what I'm striving to attain is a good thing? While it is subjective, as is anything, I feel like I am not incorrect. 

     For some reason my cursor is being quite hinky about moving when I tell it to while writing my code, but it's fine on here. That's no bueno. I hope it doesn't get too bad.

     Thank goodness for the forums! The people on there explain things much better than the instructor does almost every time! Aaaaaand I'm looping. Pretty sure I'm doing exactly what they said not to do. Oh well. Now to fix it. The first problem was that I forgot to put <var> before my variable. Wow. I made a variable and forgot to set it as a variable? What a rookie mistake!! The second thing was that I had <variable === false> for some reason it needed <variable=false> was the correct way to do it, though I'm not sure why that changed things. It seems that when you have <===> you're saying it's equal to something, but when you have <=> it means it is something. So, now that I know that, I'll know not to do what I did. 

     This is me:
var plip= 0;
var thoughts= "I have thoughts...";
var ploop= function(thought1,thought2){
    while(plip<30){
        plip++;
        console.log(thoughts + thought1 + thought2);
    }
};
ploop("Why,"," stupid cursor??");

Yup. At least 30 times! That damn cursor just didn't want to work. Ah well. Here's to hoping it works better next time... So, I learned about <while> , I learned that I'm going to need better earphones; these aren't staying in the port on my computer every time, which is no good when you're in a public place. I also learned that cursors can be really stupid. And, in the end, I learned that I'm probably going to love <while> loops. See y'all Friday! Today is Wednesday, right? Yes. Yes it is. Ok. Back to hectic life! Cya!
--Martin