Hacker School Day 6: On which I felt lost and found

It’s week two, day two (day six overall), and I feel behind. There hasn’t been enough time to do as much as I want, and I felt overwhelmed and a bit lost today. I also feel I haven’t been living up to the goals I had set myself (such as blogging daily). I started two other posts last week, but finished neither of them. I set myself up a huge chunk of tasks to finish over the weekend, but ended up doing life bits like laundry and a touch of leftover work instead.

I came to school early today (7:30am), which felt great. I’m still here now (9:40pm), and I still feel great (albeit tired). Obviously this is not sustainable, nor do I intend to maintain this pace, but I wanted to reset a bit today. I wanted to play catch-up, or at least not fall further behind. I am afraid to acknowledge that in the 14 hours I have spent here today, I have barely maintained pace. I suppose that means my goals are too big.

I had the opportunity to speak with an alum today who helped me see the beauty in focus (or rather the danger of spreading myself too thin). If I delve deep into one language, I’ll get down to the good parts and learn about how best to structure complex pieces of code and solve tough problems; whereas if I try to learn two or more languages, I’ll stay in the shallow waters with both. In light of that, I’m concerned with the amount of time I’m spending on studying this SICP stuff, but I think the mindset I’ll gain from it is worth a significant chunk of time. I’m also delighted at how hard it is. A large part of me wants to give up and consider myself stupid for being unable to maintain pace with the others in the class, but I refuse to give in to that familiar voice and course of action. It’s fine if I feel like the dumbest there. It’s even fine if I AM the dumbest there (though I refuse to believe that such a thing exists–degree of dumbness is not a linear spectrum… more like a sphere within which we all float). In response to the fear that wells up when I find my head swimming in terms I can’t quite grasp, today I admitted my struggles and accepted an offer of help.

In accepting help on math and logic (things I generally consider strengths of mine), I felt somewhat like a belly-up beached whale, flopping helplessly and shamefully, resigned to the help of another for my survival. That’s okay. It helped that I was beyond tired and hungry, so my brain was functioning at about one third capacity, rendering me even more willing, lowering my usual self-standards to the point of asking for a refresher on logarithms. Again, that’s okay. It felt good to let myself not understand. I am usually the one explaining things, so this was a huge role-reversal for me. Again, it was uncomfortable but healthy.

After another stab at some SICP problems (with no measurable result or success), I put down my pencil and opened this window. ‘Twas time to blog the day.

For tomorrow: I want to understand window.requestAnimationFrame and why I’m using it. It’s doing great things, but I would rather control my elements individually with many setInterval() calls. Therefore, my goals for tomorrow are: picking apart that mysterious function (and/or replacing it altogether), implementing a sprite png for my character, seeking advice on how to structure the pile of spaghetti that is my game, determining when my character hits a block, … and that is more than enough.

That’s all for now, folks!

P.S. While I’ve nothing directly technical to report (and I’m too tired to write it clearly even if I did), I learned about Proof by Induction today. I hate it, but it’s darn useful. Here’s the example A used to help me understand: if I can get on a rung of a ladder, and if being on one rung implies the ability to get to the next rung, then I can get to every rung after that initial (base case) rung. I think! Please comment if I’m wrong. I’ve tried to restate this about 20 times today and keep confusing the assumption/condition and the result/proven statements. Aye!

Hacker School Day 3: on which I realized that every day now is the best day of my life

Today I boldly decided to challenge myself to work through SICP, the classic text for learning the foundations of computer programming. There is a group of fellow students that are working through it together, so I seized the opportunity and joined the club despite my mild terror at the density of the book and the pressure of a book club. Luckily a few other folks joined late with me today, so the group postponed discussion of the first exercises until tomorrow. I was/am tickled at the familiar challenge of a formidable book that will surely cause my brow to furrow.

The morning was quickly consumed by checkins, the SICP meeting, and some preliminary SICP reading. At noon I joined a gaggle of javascripters seeking wisdom from the uber-cool M, who let us throw all kinds of questions her way while she patiently (and humorously) demonstrated the intricate puzzles of javascript prototypal inheritance. Don’t ask me what that phrase means because I have too many disjointed thoughts on the matter to tell you anything lucid. I might assign myself a mini project of explaining (perhaps illustrating) what I think I learned there today. It was like a brain race, dizzying and exhilarating, magically shedding light into dark corners only to reveal more unexplored pathways.

After the javascript party, I set my fried brain upon some SICP exercises until a fellow student was ready to pair program in Ruby. We worked on simplifying her slick Roman Numeral converter, and I was impressed with some of my own knowledge and experience. When we hit a terrific road block and posted a help request on our in-house irc client, one of the facilitators sprung to our aid. As Z helped us rewrite our broken nested hash reference, I felt a chunk of understanding finally click into place after years of vague reliance on shadowy comprehension and unpredictable results. For the technically-inclined, a brief explanation: (please don’t judge that it’s taken so long for me to grasp this simple concept in a sturdy way)
When accessing nested elements of a hash/dictionary/associative array in a for each loop (or .each do block in Ruby), the “value” of your new (key, value) pair IS the first nested hash, whereas I thought it was the first element of that nested hash. An example will explain far better than words:

If you have the associative array (sorry, I come from a php background… also I’ve met many cats of varying sizes):

cat_weights = {
  'plump' => {'oreo' = 15, 'adina' = 11, 'monty' = 19},
  'healthy' => {'leela' = 8, 'rosie' = 9},
  'skinnypants' => {'bosch' = 7, 'ziggy' = 5, 'curie' = 6}
}

and you’re doing a do block on each of the elements of cat_weights, as such:

cat_weights.each do |size, names|
  ...
end

and you want to access adina’s weight at some point, I initially thought you’d access it within the do block with size[‘adina’]. This is wrong! Size refers to the three strings: ‘plump’, ‘healthy’, and ‘skinnypants’, NOT hashes. The VALUES of those keys are hashes, hence you would access adina’s weight with names[‘adina’], since names is the pointer for the hash full of cat names and weights (the subhash to fatness levels, aka size). BAM! Now I finally know how to predictably access nested elements in a hash. Yessss!

After an hour or more of Ruby, I attended a Git lesson and learned about merging branches. After that I worked furiously on a small SICP exercise and became ensnarled in simple logic that I failed to wield correctly. At long last, I attacked the problem differently and got a working solution. For the logically inclined: given three numbers, how do you get the sum of the squares of the largest two using only combinations of logical functions and the multiplier? I’m either dumb or it’s harder than it seems. Regardless, getting a working solution felt so great simply because it didn’t come on my first or second try.

At the tail end of the day, wobbly with hunger, I sought to push my solution to github but forgot the proper command to link up my new local master to my new remote empty repo. I sought the help of T who gladly advised me and showed me a bunch of cool tidbits for working in Scheme. In posting my code and using a new IDE (Dr Racket for Scheme), I found myself in exactly the situation that Z had taught us about earlier at the Git session: Dr Racket had created a temp file that I did not want in my commit but had already staged! Fear not: I scrunched my face and pulled from my brain the command I’d learned earlier in the day (to remove specific files from my staging area: git reset HEAD filename). Brilliant! I also created a .gitignore file–another task I had learned at the Git session. So fun to put knowledge to use IMMEDIATELY. That’s what I’m doing all day long now. This is my version of heaven.

Hacker School Day 1

Welcome to Hacker School!

Amazing first day. Simply wonderful: a room jam-packed with interesting, intelligent, FRIENDLY people from all over, here to learn by doing for three months.

Technical Tidbits I learned today:

  • Learned a little about homebrew (package manager for OSX)
  • ‘bash’ is actually a language of its own; some handy commands that I already knew: pwd: print working directory (where you at), cd: change directory (go somewhere else), chown: change ownership of a file, mkdir: make a directory (folder), mv oldfilename newfilename: move a file by renaming it, rm: remove a file, ls: list (contents of a directory), ls -a: list all (even hidden files), | (pipe character): take output from one command and feed it into the next, touch filename: make file called filename
  • new bash commands I learned: open . : (shows the file in finder), grep: find everything that contains search term, cat: concatenate,
  • Also got a git overview and pushed some code up. I now have a better understanding of what a branch is and what the master is and what the origin is.
  • JavaScript:
  • found out that mozilla has some decent documentation, but was warned not to follow it too freely as some features there are only supported by firefox.
  • use chrome’s dev tools to explore built-in browser js objects like document and window.
  • .addEventListener(‘event’,’callbackfunction’,false) Can’t remember why we set false as third param… not sure if it prevents default or prevents propagation or what.
  • event: keydown returns an object chock full of stuff. I was able to fetch from this object the keyCode and translate it to its respective letter. (haven’t tackled modifier keys, numbers or any weird stuff yet)

Personal Reminders:

  • D said to be grateful for such a unique opportunity. I am! I really feel soooo lucky and thankful to be a part of this program.
  • Do things that make you uncomfortable (such as asking for help and pair programming)
  • Keep records of what you’ve done and want to do to help yourself stay on track

Overall, I feel somewhat exhausted, overwhelmed and DELIGHTED. Just tickled that I’m going to spend the next three months learning, doing, exploring, and working with wonderful people. This is clearly the beginning of a new phase in my life. Hallelujah!!

Quick trip to Santa Fe

I’m in Santa Fe for the weekend, which is the closest thing to a “home” city that I like to have. While I live in Brooklyn, grew up in Chapel Hill, NC, and was born in California, only Santa Fe still holds a large enough familiar population to take me in its arms whenever I feel like returning. Fitting that I should think the word “familiar,” as I have no blood relations in the Fe, and all real blood relations are scattered nationwide, yet Santa Fe is indeed still my home, where I have non-blood family, and the general population suites my preferred way to live: befriend strangers and trust everyone.

In a “city” that is technically the state capital, the bus driver knows several of his passengers by name, advises a wayward soul and makes an extra stop for her, reminds a gaggle of teens that we’ve arrived at the high school and they ought to get off, and postpones the next connecting bus for two middle-aged women who are running late. While casually waiting hours at one of various bus stops today, I chat with an elderly Hispanic man who tells me in broken English that he’s from El Paso, TX, but has lived in Hawaii, California, and Mexico, Santa Fe longest of all. He’s “no concern with hours”, and is, like me, patiently waiting for a bus that may or may not ever come.

I’m now at another bus stop, downtown, awaiting the lone bus to SJC, an enigma of the locals. Somehow last night, my taxi driver pegged my SJC accent, a Johnnie himself, as it turns out. There’s what appears to be an impromptu car show along this street, with hot rods like this: Continue reading

phpfog trickiness

For anyone’s future reference:

I just moved a site to phpfog from a normal web host. It’s a site I had hand-coded in php, from scratch–my first real piece of php work, so, granted, probably not the most elegant, cooperative app ever. Anyway, in moving it to phpfog, first I figured out how to set up and use git (pretty easy, as it turns out), then today I moved the files into my new phpfog directory on my computer and “pushed” ’em up. Violá! Site looks awesome… until you click a link… And then you see my redirect page, minus all css and images. Blech.

You see, I had set up an .htaccess file to make my links slick, which I forgot to download from my original server. So, okay, downloaded it, moved it, pushed it, reloaded the page, and … rats! Still no luck.

I then spent an hour and a half making small changes and trying to figure out why when I clicked any link I lost everything… I could tell something was not working with my redirects or path variables. After a hassle and a half more, having double-checked my reg-exs and such, I searched the phpfog documentation (cool app/site, but their documentation was not obviously organized to me… I felt like I was being put through loops), and found a link to this post on David Walsh’s Blog. While this did not really address my question, I clicked the “.htaccess” tag in his topics sidebar and found this post. On a whim, I decided to try his quick fix, and HURRAH!!! He had suggested a fix for hosting with Go Daddy, and while Go Daddy is it’s own scary monster, I figured it was worth a try. Thanks bunches, David Walsh: I literally would never in a million years have figured that out on my own. I don’t know much about .htaccess, and since creating that stuff over a year ago, I’ve forgotten everything I once knew. For anyone wondering, here’s the clever fix. Add this lil’ bit o’ code at the top of your .htaccess file, before you begin your rewrites:

#Fix Rewrite
Options -Multiviews

That’s all. Feelin’ pretty good about the innernettes.

Hurrah! Blog Created.

Alright. I finally have my own blog, hosted on my own site, organized and beautified thanks to WordPress while still being entirely under my control, on my domain, etc. It’s only taken me… 3 years(?) to do this. I must say, WordPress has improved dramatically since I last attempted to do anything with it (about a year ago). It might also help that my php skills have also improved tremendously (as in, they have gone from zero to moderately-skilled). Alright. This is enough of a post for tonight. Perhaps I’ll go figure out WordPress for iPhone so I can upload pics with ease. Very good evening!

sabbatical

As my lovely boyfriend says, I am currently on “sabbatical”. It is the first time in my life that I have not had to be somewhere at a certain time nearly every day of the week, and I absolutely love it. Do I sit around and watch television? NO. Instead, I have learned stuff, worked on various art and freelance projects, read two books, and taken time to breathe.

Today I sit here, in my delightful bedroom, enjoying the color of the light. Outside feels like a spring day in January (terrifying, truly, but still pleasant to the senses). It poured a while ago, then the sun came out for a few minutes, and now a darkness has descended. Inside I have Christmas lights and a small desk lamp that illuminate the room with a soft white light. Somehow the lighting, like the day itself, is both ominous and hopeful, terrifying but comfortable. I love it.

php function variables GOTCHA

Note:

When you are using tricky-slick variable variables with php ( ${$varName} ) and you’re trying to do it from within a function, make SURE the variable’s name who you’re trying to get is not OUTSIDE the function – if it is, you’ll spend 3 hours trying to figure out how that variable could possibly not be defined. teh heh. Wish I weren’t such a newbie!

php heredoc syntax GOTCHA

 

If you are using the heredoc syntax in php
[example:

echo <<< EOT formatted spaceEOT;

]

and you find yourself getting the following error:
parse error: syntax error, unexpected $end in (document.php) on line #
then chances are you have added a space or tab AFTER the last EOT;
I knew it was important to have no spaces and such BEFORE it on the same line, but turns out you can’t have spaces afterwards either! So watch out.