Friday, February 21, 2014

Groovy, Man!/ Friends In Address Books

     Here I am at the coffee shop once again. I've got GrooveShark going. Click the link for the playlist that I'm playing. I've been on this one for a while, and I still like it! Always a solid electronic song going on. I've had a latté, I may get a regular coffee at some point to keep my eyes open. Friday being its usual self, I'd rather get this over quickly, but I need to put some time in. So, time to plug in and plug away!


HTML/CSS





      I'm sorting my friends! It feels a bit like circles in g+. They're even using Google colors. Anyhoo, it's the CSS I'm looking at. they pretty much don't care to teach you how to make a circle border. It's just there. Seriously. Don't just throw things at me, tell me what they are! Good thing ye olde Personal Initiative is still around.
div {
display: inline-block;
margin-left: 5px;
height:100px;
width:100px;
border-radius:100%;
border:2px solid black;
}
And that's how to do a circle border.
Now they teach me something cool. You can have an <id> and a <class> in the same tag. That is definitely nifty! Lots of uses for that. And I finished. That was quick. Looks like we're about to get into this:

I'll continue with that in the next post.












JavaScript




      Isn't it funny how normal it can become that a single letter being incorrectly capitalized eventually is not so stupid any more? It's perfectly logical that the computer would have a binary (heh. I made a play on words) track. It's either right, or it's wrong. There is no such thing as close. That's totally normal for me now! How strange... The Address Book of happening is still happening. I was trying to get it to print out a return on a search and it just wasn't working. It wasn't until I hunkered down and really scrutinized the code that I discovered my error. A lower-case 'l'. How thoughtless of me. I shall endeavour a better attempt at correct grammar today. After smashing my way Neanderthal-style through the lesson I moved on to adding more people in an easier method.
Starting off with this function:

var add = function(firstName,lastName,email,phoneNumber){
    contacts[contacts.length] = {
    firstName: firstName,
    lastName: lastName,
    phoneNumber: phoneNumber,
    email: email
};
It allows for any additions to be done with one line of code like this:

add("Mookie","Chess","example@example.com", 9003006000);

It doesn't print anything, it just adds that person to the address book. In order to see if actually worked, we use this:

list();

If you recall, that was part of the earlier code.
Turns out, it actually has a use.
And project Address Book is complete!










Olé!
Now it is time to bid you adieu. See y'all on Monday!

--Martin