Monday, February 10, 2014

Caret of Knowledge/Whoo Hexadecimal Color!

     Hello, all! I'm back again! Do I seem awake? That's because I am! French press FTW! So, Google music was being weird, I first played Foo Fighters radio on Pandora. I'm still in a Foo Fighters sort of jam, I suppose, but then I didn't want to make an account, so I'm on Grooveshark. Today I had an adventure in the world of ChromeOS! I downloaded about five text editors, but most of them just weren't my thing. I was down to Caret, and Tailor. I like Tailor better, but it's missing some key features like being able to save my work, but beside that and not being able to preview my work, I actually liked it. Yet, that was not to be, so I'm on Caret. Which is awesome. You can do HTML and CSS at the same time. Which I didn't think I'd be able to do on ChromeOS so, that saved me some bookoos (how DO you spell that word?) of money. Now I'm less poor than I could have been, it's time to plug in and plug away!


HTML/CSS





      Ah... Good 'ol coding! There's nothing quite like it! Well, the colors are coming out! the hexadecimal colors to be exact. I knew that this was gong to happen, I just thought it was going to a long time ago. But now that these colors have come out, I'll be coloring all the things!

     One of the things I was doing with Caret earlier was HTML. I had HTML and CSS running together. I save it to the computer and then open it and and it open up into the browser. You get a live preview of what you're working on. And that is so cool! I just have to figure out how to get .js into the mix. I assume that's coming down the road really fast. Also, I need to get Crouton going correctly so I can do some Linux stuff. Like Github. Anyhoo... back to the HTML/CSS. I am now on a review of the CSS that I've already done. It's pretty easy to remember the names of things in CSS because a lot of the names are the same.
     Now, if y'all remember, I said there would be more .js today, and there is! So, once I finish the review we'll head over there. Aaaaand yup. Nothing to write home about!


JavaScript





      We're still on <this>, folks. And I don't mind. This thing has a lot of different uses. I love it! Over the weekend, I did not get a chance to do any classwork(family birthdays, social protocols, yada yada yada) and this was the first weekend where I actually was excited to get back to my studies! I'm having so much fun doing this! Ok. The lesson that I'm working on had this:
var square = new Object();
square.sideLength = 6;
square.calcPerimeter = function() {
 return this.sideLength * 4; };
 // help us define an area method here

 var p = square.calcPerimeter();
 var a = square.calcArea();
The instructions said to create a <calcArea>  function that gave the area, and to use the square.calcPerimeter as a guide. All I had to do was:
var calcArea = new Object();
square.calcArea = function(){
    return this.sideLength * this.sideLength;
};
Which, in hindsight was easy, but what to return was an issue,  because I had the wrong idea about area. I got it in the end. They've got me working on constructors now. They're like an Object, but more global. Here's an example:
function Person(name,age, gender) {
  this.name = name;
  this.age = age;
  this.species = "Homo Sapiens";
  this.gender=gender;
}

var sally = new Person("Sally Bowles",39, "f'male");
var holden = new Person("Holden Caulfield",16,"f'male");
console.log("sally's species is " + sally.species + " and their age is " + sally.age + "and their gender is " + sally.gender);
console.log("holden's species is " + holden.species + " and their age is " + holden.age + " and their gender is " + holden.gender);
Notice that I just write out everything on one line. This way, if I were to be working on something that would need a lot of the same thing with changes applied to the individual, this would work a lot better than the regular Objects. So, we have constructors. But, Objects are still useful in a smaller case-use.Well, that'll about do it for me, folks! I've had a blast getting into things. See y'all on Wednesday!

--Martin