Showing posts with label Sinatra. Show all posts
Showing posts with label Sinatra. Show all posts

Friday, September 12, 2014

MakerSquare Day 12: "Think in trees" (3/4)

At least, that's what our afternoon instructor said. I think he mostly meant that we should "think in trees" as it relates to the DOM--the document object model--which is representation of HTML, where everything is a node and all the nodes are connected in a family-tree-like structure. It's helpful to think in trees so you remember what's a parent node and what's a child node, which is helpful when you style things in CSS* or get things with jQuery**.

But I prefer to take him in the more philosophical sense of "think in trees"; as in, think in improving incrementally, like a tree growing. Or think in a tree's branches, so that all your ideas can spin off into other ideas. (Or, if you're using git, think in branches so that you always have some earlier version to go back to.) Or think in trees because sometimes--always and inevitably--you'll have to prune back your code to improve it.

Which is what I spent a fair amount of the morning doing. Today we started the third part of our Songify project, involving multiple tables in a database. It wasn't easy, particularly because the first change that I made involved me going back and changing a bunch of my old code. Which makes it a weird morning: not very productive in terms of code, but very educational in terms of re-viewing my code.

Today wasn't all sitting through: I did play two games of ping pong and did a lunch-time yoga. I'd be in really OK shape by the end of this program if I wasn't constantly eating.

* Cascading Style Sheets: a way to apply lots of formatting and structure to HTML.
** jQuery: a Javascript library specifically for working with online materials.

Thursday, September 11, 2014

MakerSquare Day 11: If you don't ask, you don't get (3/3)

Today's theme is basically the title.

And it all started with cereal.

See, in classic tech-company style, MakerSquare has a little kitchen with some snacks stocked by the company, including my favorite, Honey Nut Cheerios. (Consider this a plug, and, if you work for General Mills, feel free to send me cereal.) There's milk too, but, gasp!, it's regular cow's milk, which I am allergic to or intolerant to or scared of. (Whichever you prefer.)

So today, after looking at the cereal for two days, I sent an email to someone in the organization asking if we could get soy milk. And instead of telling me I'm a prima donna (which is true), she said, "sure!"

Which goes to show the truth of that old saw: If you don't ask, you don't get.

And that brings me to the structure of MakerSquare, which is very student-centered and student-led in a way. For instance, today, we spent some part of the morning talking about mentorship and about being clear about what you want from your mentor. Then, in the afternoon, we talked about CSS by all coding up a little web page together, with the students offering suggestions on what they'd want to see and then everyone--including the instructor as the final arbiter--figuring out how to write the HTML and CSS to get that.

The rest of my notes for today are all super specific CSS comments, so I'll leave you with the note that I am still terrible at ping pong, but that our master ping pong player just gave me a little lesson.

(Yes, this is tagged "Sinatra" and "Songify" because we spent time doing that, though I didn't have much to say.)

Wednesday, September 10, 2014

MakerSquare Day 10: "Hacky" means something different here (3/2)

From listening to lots of Marc Maron's podcast over the last few years, I've gotten into the habit of referring to jokes as "hacky" when they are too easy, too lazy, too unoriginal. Making a joke about how dumb blondes are--how strict Germans are--how anything any group of people are--all of that could qualify as hacky. (In case you're wondering, from my very limited experience, cruise-ship comedy is often hacky.)

But here, in programming world (which you could image as "Programming World," with a big fun banner over the gate and rides like "It's a Small Loop After All" and the "Hall of Control Flows"), "hacky" means something different. It means something like "ugly" and "ad hoc." In comedy, something is hacky because it's old. In programming, something might be hacky because it's a new, ugly fix to a problem.

And today's problems to fix all revolved around HTML and CSS. Because today we got a big heap of info on website design. All about classes and IDs and how to use the Google Chrome Developer Tools to break websites.

(So, if I send you a picture of the New York Times website with your name in a headline title, well, then either I've been playing around--or they've finally caught up with you for what you did. You know. Don't make me say it.)

Today was also the day when we asked, if you had 100 cats in a row, and either gave a cat a hat or took away the hat you gave every time you stopped at that cat, and if you stopped at every cat the first time through--and then every other cat the second time through--and then every third cat the third time through...

Surprise: the answer is squares of numbers. I did it by hand from 1 to 9 and then my old high school math class kicked in. Of course (my math theory teacher Mr. T. would say), any cat you visit an even number of times won't have a hat; and the only cats you'll visit an odd number of times are those squares. (Like that cat at 36 gets visited at 1 and 36; 2 and 18; 3 and 12; 4 and 9; and... 6. Give that kitty a hat.)

Another big take away from today: the Space Jam website is still up.

Tuesday, September 9, 2014

MakerSquare Day 9: He did it his way (3/1)

Huh, I just realized that I stopped giving each day a theme. Which seems fine now because, really, how do you boil a day down to a theme?

Take today for instance: we started a new project we're calling Songify, a music/playlist manager. So we started by creating a song instance; then we created a database for those songs, along with all the methods that you would need.

(And here I'll talk about one of my strength/weaknesses: I like to do things the best way. I know, it probably sounds like I'm preparing for a job interview, but it's a true problem, and here's the example for the day: I wanted to write a method that could search by album or by artist and return all the songs that matched that category. Off the top of my head, there's a simple way to do that with some basic control flow: ask the user if they want option A or B and give two fully-written methods for each of those options. BUT! Since those options are almost identical, wouldn't it be great if you could somehow provide the switch INSIDE the meat of the method? And that's how I ended up looking around online for a while--even going so far as to post my question to Reddit.)

This program will eventually become a web application of some sort, which I know because we spent the afternoon looking at how Ruby and HTML can interact. The answer is Sinatra, which is a ... well, it's not a "framework" in the technical sense, but that's what most people call it. Curiously, whereas most work in class is hands-on coding, individually or in small groups, this was an all-class discussion and example. Which might sound relaxing, but since it was pretty new, it was pretty intense.

Luckily, I'd spent part of my lunch hour doing a little yoga with some other students, as well as playing ping pong, so I was up for the challenge.

Special bonus note: After class, I went to playtest a video game, which was very interesting--both the game and the process.

And apologies for the title of this blog post, today was full of Frank Sinatra puns and references.