15 December 2014

Strawberry Chipotle Jam with Liquid Pectin

Oh hey, remember when this used to be a food blog and not a blog about Hackbright?

Right.

So one of my friends gifted us a jar of strawberry chipotle jam for Christmas a few years ago and it was fantastic. I've been making a variation of it ever since, but it's been been awhile. For whatever reason, it's always been easier for me to get liquid pectin and all of the recipes I've seen call for powdered pectin. Here's my converted recipe because I originally started this blog as a way for me to catalog things that I thought I'd want to come back to and I'm kicking myself for not writing this down earlier.

Everything is better with a highly enthusiastic child in the background

Strawberry Chipotle Jam with Liquid pectin

1 c (or 1/2 lb) strawberries, chopped
1 chipotle pepper, minced
1 c (or 100 g) granulated sugar
4 t lemon juice
3 T liquid pectin

1. Combine strawberries, chipotle, sugar and lemon juice. Bring to a rolling boil for 1 full minute.
2. Stir in pectin and bring back to a rolling boil for at least 1 minute
3. Make sure that the jam is sheeting and remove from heat
4. Let the jam cool a bit and then pour into a pint-size mason jar.

I like to consider this "nano-batching" because it just makes a jar and then you don't need to worry about the canning aspect of jam making. Be sure to refrigerate the leftover pectin.

09 December 2014

Cook Roulette

Oh hey, I have a blog.

I spent 5 weeks busting my butt trying to make an app. I succeeded in that. Hooray!

Cook Roulette is a random meal generator. I'd go into details, except that I spent an extreme amount of time on my github readme document, so I'll just direct you there.

My log in page is my favorite page because CRONUTS.
Also, it's live. Go to https://cookroulette.herokuapp.com. Once you click on the meal generation page, you can check the Yummly button to use its API and get a recipe suggestion based on the randomly generated ingredients.

It was so insanely easy to deploy that I want to make other random apps just because I can. I'm thinking about working on two different projects. I'd like to use Django in one, but I'm not really certain what I want it to be. The other one is a game that I'd like to make (mostly for my friends and me) written in JavaScript (gasp. I know) using Firebase as the database. Firebase is really really cool.

My biggest project, however, is getting a job. I have a couple interviews lined up, so fingers crossed that those go well. A lot of people are trying to be strategic about when they apply to places, but honestly, I'm going to believe that I'm a competent software engineer and I'm qualified to apply for junior development roles right now. Perhaps I should be more cautious about when to apply to places, but if I wait until I'm comfortable, I'll never apply anywhere because comfortable is not typically my state of mind.


29 October 2014

Hackbright Day 22: Machine Learning

Wow it's after midnight, but I've been incredibly productive, so that's a good thing. It's almost project time and I'm flailing around trying to make sure that I get everything in order for next week. I really want to do a machine learning project. I spent the evening scraping content from one of my favorite blogs that uses really nice css selectors so that I can use a python library called BeautifulSoup to grab the ingredients from recipes and try to do some sort of clustering on them to see what's the what.

And also, shell scripting? Still incredibly useful:

cat list_of_pages_to_scrape | awk '{print("grep "$1" toc.php?sort=date")}' | bash | sed 's/"/ /g' | sed 's/</ /g' | awk '{print($3)}' | awk '{print("curl -O -A, --user-agent PPPPPMozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36PPPPP  http://www.myfavoritefoodblog.com"$1)}'   | sed 's/PPPPP/"/g' | bash

28 October 2014

Hackbright Day 21: Where we continue on in our movie ratings app

I totally forgot that I was supposed to blog today because I was busy playing around with a potential project idea.

We talked about SQLAlchemy today and continued to work on our movie ratings app. It's a pretty fun project because we had to start things from scratch, or at least, a lot more scratch than previous assignments. It's hard to remember all the moving parts, but we have our other assignments to refer to.

And this is like the lamest post ever because I'm way more interested in playing with my project. That is probably a good indication.



27 October 2014

Hackbright Day 20: ugh projects.

Once upon a time, I had a project in mind and it was a very good project. And then I had a side project that I was just going to play with, but then a few people pointed out that I seemed way more interested in the side project than the main project. Fleshing this out more and one instructor thinks that this might be really cool and two of them think that it's probably impossible. Le sigh. I went back to square one with project ideas this weekend and came up with a bunch of things. It turns out that a lot of the stuff that I'm interested in programming are really really hard problems.

Of course they are. This is how I decided to get a physics degree and why I kept pushing to get my Ph D. I have a stupid habit of doing things because they're "hard" or for the sake of  some ideal that makes my life a living hell until it's over. And now I'm not sure what I want to do. I do know what I don't want to do and that is anything that is front end heavy. I have some really talented friends and there are women in my cohort who are amazingly talented designers. I am not of this group, although I appreciate their skills. I want to solve complex and interesting problems using some combination of math and programming. And I don't want to do it in Javascript.

Friday was mainly a study hall day, although we did get two really good tech talks on object-oriented programming in JavaScript and bootstrap. I'm really glad we got both of those presentations because they reinforced the idea that I don't like front end, but there are tools available that will allow me to minimize my front end work. We also talked about dates and times and datetime in python during the morning lecture and how to effectively organize your code during the afternoon. They were both really informative, but they were definitely overshadowed by the stress of project discussions. I spent a lot of time talking with two of the instructors about my project ideas and ways of doing it. I overheard one of the instructors say to another student ,"please take a seat in the project discussion chair" because right after I got out of that chair and put it away, someone else grabbed it and proceeded to have a similar discussion. And this post is really disjointed because it was a disjointed day. Saturday was good because I participated in a hackathon and that will be a separate post.

24 October 2014

Hackbright Day 19: Magical SQL Python Gnomes (but not GNOME as in RIP GNOME 2)

Today we talked about SQLAlchemy, which is a SQL handler for Python. It's called SQLAlchemy because it's basically magical if you don't know how SQL works and it's still pretty spectacular if you do. It basically takes ugly SQL calls and turns them into things that look way more like python syntax. SQLAlchemy is called an object-relational mapping (or ORM as people call it) program. In SQL, we have databases that contain tables. These tables have columns that contain different kinds of information for a given record (or row). What SQLAlchemy does, is translate the python we input so that SQL can handle it. It does this by essentially mapping a table to a class, a column to an attribute of a class, and a record (or row) to an instance of the class. It's really nice, the syntax is mostly familiar (although the OR and AND statements are a bit weird), but it seems pretty useful. The other cool thing about SQLAlchemy is that you can use whatever SQL "engine" that you want. We're using SQLite with it, but I'll probably look into things like PostgreSQL for my project.

Speaking of projects, we talked about project selection today. As of a week ago, I had a project that I was dead set on, but then I started working on other things on the side and found out that i was way more interested in that than the one I was originally going to work on. I'm still not sure what I'm going to do, but I'm looking into the new, exciting project right now because I think it will be a better way for me to display skills in areas that I'm interested in, rather than work on a project that I think should exist, but isn't the type of coding that I'm interested in (oh my god. back end. god help me if I have to do a ton of front end coding in my career).

We talked a bit about other projects that people have done during the 5 weeks leading up to career day, and one thing that came up was called Flattest Route, which works with the Google Maps API to determine which is the least hill-climby route you can take to get from point A to point B. As an example, here's my walk from the bus stop to the house we're staying in. The route is color coded to indicate the steepness. Green is easy, yellow is moderate, blue is difficult, red is very difficult, and black is basically mountain climbing.

Sometimes I wonder if i should get crampons to walk up this hill.

The other super awesome thing that happened was that I got to meet up with a friend from high school at lunch. We're going to be on a hackathon team this weekend to try to best display asteroid data for fun and not profit. Hopefully we'll be able to hack something together that looks awesome and is super informative.

Not these gnomes either

23 October 2014

Hackbright Day 18: Study hall, with pictures!

Today was a "study hall" day. We ended up talking about how to use flask as the server to a web app that then rendered HTML pages. These HTML pages (along with their CSS) were manipulated by jQuery and AJAX calls to display things we wanted. In order to demonstrate this linkage in the clearest way possible, we added a random number button to the web app we worked on yesterday, just to show an example of how everything works together.

This is my super awesome graphical interpretation of what we did in lecture all morning.

Later on, I met up with one of my mentors and we started talking about how I could structure my project. And then I mentioned my pet project and now I'm starting to wonder if that's what I should actually pursue. I need to do a little bit of legwork to see if it's possible, but that project might be closer aligned with my technical interests than the other project idea I have.

In the afternoon, we had another lecture on cookies and sessions. Browsers store cookies. Sessions are server side. Sessions need cookies to store information from the browser. I think? I need to look into it a lot more. After I finished up the last part of the assignment from yesterday, I lost all will to work, so I updated my LinkedIn page a little bit. It turns out that I'm not very interesting and almost all of my "endorsements" are for things that are probably not relevant to the jobs I'm looking for, so it was probably just a good way for me to feel productive without having to think too hard.

22 October 2014

Hackbright Day 17: Wherein I fundamentally misunderstand jQuery

Today was challenging, and I'm going to blame my inability to quickly digest syntax and the fact that I haven't been sleeping for more than like 5 hours per night. I'm usually fine on little-to-no sleep, but now that I'm old, I need to sleep for like 6 or 7 hours at least every once in awhile. Lame.

We talked about jQuery and AJAX today. jQuery (and I'm probably stylizing the name wrong, but whatevs, I wasn't even going to post tonight) is a javascript library that lets you do things in a much more succinct way than "vanilla" javascript. It seems like it's used in conjunction with AJAX to modify the HTML + CSS on the fly, make get and post requests (I'm still fuzzy on post syntax), and generally interact with different parts of your webapp. The fact that this is about as specific as I can get with jQuery and AJAX means that I definitely failed in absorbing the lecture this morning.

And now I need to PTFO.

And here's a picture of two motorized wheelchairs outfitted to be electric horses. Because San Francisco.

21 October 2014

Hackbright Day 16: Sessions + More Flask

When I transferred high schools way back in 2001, I joined all the extra curricular activities that I could in order to meet people and make friends. Some of them turned out to be life-changing (Hi, Ms. Maciolek!) and some of them turned out to be a huge waste of time (that would be you, softball). One of the things that sort of fell in between those extremes was the literary journal *thing* that I did one year. One of the first orders of business was to pick a name for it. My suggestion was "Sessions". They ended up going with "Harbinger". Speaking to the incredible content of my character, I basically lost interest once my name wasn't chosen.

Fast forward 13 years, and now I finally get to talk about sessions.

Sessions, in this context, are about storing information on the server side of a web app. In Flask, the session is a dictionary that you fill with information like, for instance, the user name. For websites where you might buy something, everything you'd add to a shopping cart would be in the session dictionary.

Our assignment today was to make a webapp. The skeleton for the app was already in place, but we needed to add things to it to make it functional. We ended up using Flask, the python framework for web apps, SQL, html + css, and jinja (which is a way to inject a little bit of python into the html). It was a lot of fun, actually, and we were able to make a functional app with a log in page and an account page.

I had a meeting with my advisor today and at his suggestion, I'm going to try to work on a project on my own to create an app, mostly to practice all these new skills that we've been talking about in class.

apt-get install ROBOJULIACHILD 
So my intent is to create a recipe-generating bot that is based on a few different recipe "structures" and will then randomly select things that would go with it. I've sort of sketched out an idea of how to implement it. The working name is cook roulette, but robojuliachild is my favorite. My biggest thought is to make the recipe structure a class and then have the different kinds of recipes (e.g., quiche, risotto, etc.). This works because I'm probably not going to make anything that's too fancy, but doing this with classes makes it modular so I could come back to this easily. What's also nice about this is that I can get more experience with classes without having to go back to that horrible game exercise. (I should definitely probably revisit that at some point.) I'm thinking that it would be interesting to add baking recipes to this because you could calculate the required ingredient amounts based on the ph of different ingredients.

We also talked about how the internet works and now I think I want to run my own server to deploy my own apps. And then I brought up cookie clicker because I'm totally a winner like that.


20 October 2014

Hackbright Day 15: Pro Set. That's way super fun.

Friday was uneventful and eventful. We reviewed all 17,000 new languages we learned this week. It was also install day, where everyone was told what to install to run everything we do in lab on their laptops. I figured out that I somehow totally fucked up my install of Chrubuntu and damaged the Chrome OS in the process. It's not a huge deal because my plan is to actually just reinstall Chrome OS and un-partition the teeny-tiny hard drive. Apparently there's something called Crouton that will let you run Ubuntu on top of the Chrome OS. I've come to the conclusion that getting that Chromebook was a mistake. Not a huge one, but typing on it makes my right hand hurt and it's hard to look at. 

We also got to see working examples of javascript webapps. One of the TAs has made some games, the best of which is called Pro Set. Similar to set in that i t's a concentration/matching game, it's also a lot more difficult, hence the "Pro" part.

Since I was basically set with install day (and also because I'm pretty sure that my install is the easiest what with apt-get install life), I was pretty much by myself in lab. I talked with one of the TAs for a really long time about Hackbright and life in general. It was good. I don't have a Hackbright alum mentor, so this was a nice way to absorb information and good vibes from someone who graduated the program and found success.

Friday night was also board game night. Colby came down to Hackbright, and we all played a game of friendly taboo, a concentration game called Ricochet Robots, and then some crazy taboo/charade game. It was really fun to interact with people in a non-work setting. It's something I feel like I don't do enough. 


On Saturday we FINALLY found a place to live after Nov 1. Thank jebus crust. We'll be in Alameda until the end of February. Hopefully by then, everyone will be employed and then we can focus on where we'll be living more permanently. 

On Sunday morning, I went to a Ladies Tech Brunch at some superfancy high rise apartment in the Financial District. It was nice, but there were a lot of people, and it was definitely good for networking that I just wasn't in the right frame of mind to pursue. I did meet a couple people that I'd like to keep in touch with, though, and I think it encouraged me to go to a PyLadies SF meetup when I can. After that, another HBer and I went to La Boheme Cafe in the Mission to meet up with a bunch of HBers + a HB instructor who were mostly just co-working. I love how accessible and friendly everyone, especially the instructors, are. Hackbright is shaping up into a good decision.

And my 10 second review of La Boheme Cafe:
I'm way too lazy to edit this. Pretend it's cropped.

  • great space to work
  • good, strong coffee
  • pretty good food, and they use zataar spice on their pitas so you know they must know something
  • will definitely return

17 October 2014

Hackbright Day 14: An Ode to GeoCities, erm... I mean JavaScript

We learned about javascript today. Yes, that javascript that let you have the greatest websites the 90s could produce:

click on the link for awesome. dooooooooooo it.
This website is still active and more fabulous than you could possibly imagine.


If you've been keeping track, that makes the new language count up to 4 this week: sql, html, css, and javascript. Not to mention that we just started with flask too.

Things to note about javascript
{
it was written in 10 days;
it has some weird quirks, like === is strictly equal and 19=="19", which is not strictly equal;
it uses curly braces and semi-colons; similar to C; 
I may have had horrible flashbacks to CSE 231 again when they showed us how for loops work;
you need to use parentheses around the conditional statements in your if statements;
the javascript "equivalent" of a python dictionary is called an object; 
     objects behave an awful lot like python classes;
}
I think that I'll end up using it in combination with probably flask, possibly django and whatever horrible amount of CSS and HTML I'll need to put together my project.

And if you're feeling nostalgic about the before times filled with the flashing, spastic wonder that was geocities, One Terabyte of Kilobyte Age is an amazing repository .

15 October 2014

Hackbright Day 13: Exactly the types of things you would think you'd do on a day 13

Today was a day with no cake, but lots of HTML and CSS.

I much prefer cake.

We saw how HTML and CSS worked together in the morning lecture, got a series of 12 drills to complete of varying difficulty, and then had another small lecture in the afternoon about CSS and then had another lecture on SQL, whereupon we were shown "Little Bobby Tables". This is a very pro-XKCD environment, which is a very good thing.

One of the instructors showed us this AND IT IS SO TRUE.

After spending today on things that are typically deemed "front end", I've decided that I much prefer back end engineering. I can't even describe how much I was craving an equation. I would have even taken list slicing! I found the HTML/CSS to be tedious, and it was even less interesting today than yesterday because at least yesterday we were doing things through Python with Flask. Fortunately, my partner was patient through my complaints. I think I probably owe her a six pack after all my griping.

A few days ago, I gave a short tech talk on cat, head, tail, and grep. I didn't have slides because it was supposed to be a 5-10 minute talk, so I just got up with a terminal and went at it. It was probably super not clear for most everyone, so I took screen shots of me playing around in the terminal and now I'm working on a page that has the pictures and explanations because I hate myself. JKLOL. Mostly it's because I need to practice HTML and CSS.


Hackbright Day 12: Flask, HTML, and Mentor Night (and also cake)

Today we used the SQL databases we had created in order to get a better understanding of Flask and HTML. I am probably the only person my age who doesn't know HTML. My fleeting experience has been trying to make this blog look less crappy, and clearly I gave up. Flask is a web framework in python. This means that it helps python programmers set up web applications. Plainly, Flask allows for a much easier time building websites. We used our SQL databases from yesterday within jinja (or maybe it was HTML??) pages and then created a locally-hosted website. It was sort of functional and we didn't finish it.

Two more people in Hackbright had birthdays, so we also had a break for cake:



And then there was pie!



I did not take part in either of these and my blood sugar/hemoglobin A1C level thank me.

Later that evening, we were matched with our mentors. We each have three, and I was lucky enough to meet all of mine. They all seem really cool. One of them used to work for Google and the other two work on iOS development. We're supposed to meet with each mentor for an hour a week, so I'm definitely looking forward to talking with each of them and getting a feel for what it's like out there and how to get a job.

13 October 2014

Hackbright Day 11: The TL;DR version => I am brain dead and we talked about SQL

Today we talked about SQL. I've had some experience with SQL and it was mostly me being super confused about it because I had no idea what was going on, but I could poke around with my queries to get the data I wanted. And then I stopped thinking about SQL because I used the output for my plots and tables, without needing to look at the query syntax again. While a similar usage was brought up in class today, it was advised that we use SQL in much better ways than I have in the past. I completely agree that people should actually use SQL instead of faking it the way I did. Oops.

So we learned how to create a table within a database, insert into the database, and then manipulate how the data from the table was displayed. This was accomplished by using the commands select, where, group by, and distinct. We also learned how to join tables. And if I ever get super untired I will come back to this and write all of it down. In the meantime, if you're interested in SQL, you should try SQL Zoo. SQL Zoo contains interactive tutorials on how to use all of those aforementioned SQL commands and then some. I started going through the tutorials awhile ago, but was reacquainted with them today. 


I gave a short tech talk on cat, head, tail, and grep. It was probably not at all clear about what I was trying to get across. I think everyone got confused when I piped everything to some other command and then played with the output. The good thing is that I'm not going to be threatened with getting kicked out of Hackbright for a bad presentation because, as I keep having to tell myself, Hackbright is not grad school.


I had my weekly one-on-one with my advisor, who is super amazingly awesome. He helped to allay my fears that the market is saturated for junior developers and that having zero real jobs would mean that everyone ends up dead in a ditch. AND HE LOVES EMACS TOO. I really enjoy the high level of concern that Hackbright has for our well being. In fact, when I tweeted that I was having hand pain, one of the instructors ended up seeing it and showed me how to stretch out my hand so that I didn't hurt it more and to stop using my thumb on the trackpad, which is apparently a really direct way to injure yourself.

And I am super tired. We had cake today because it was one of the instructors' birthdays (coincidentally my advisor). We had cupcakes on Friday because it was one of the other instructors' birthdays then (the one with the stretches, actually). I very much enjoy the fact that Hackbright is a pro-cake institution. 

12 October 2014

San Francisco Things: Brooks Park

There's a little park called Brooks Park near our Airbnb. I've never explored it because it's usually dark by the time I get home and it's up a super steep hill and I have the "opportunity" to climb many hills every. single. day. Colby finally convinced me to go and see it because it was "cool".

When you finally climb to the top, there's this crazy ridiculously amazing view of the ocean and San Francisco:

Admittedly, the sun is out of control in that picture.

And I have more pictures and stories, but my hand hurts from using a trackpad incorrectly, I think. Thus, this will have to wait for another day to be complete.

Hackbright Day 10: The first of what I can assume is many demo days

On Friday we all sat down for lecture and there were no instructors. One of the TAs brought up her laptop to stall and then finally one of the lecturers (who wasn't supposed to deliver the morning lecture) came in and gave a last minute lecture on classes and inheritance. It was really interesting, kind of complex, and made me think about classes in an entirely different way. I honestly have no idea what "style" of programming I've done over the years, but it's certainly hasn't been object oriented (with the exception of that one horrible semester in CSE 231 where a combination of my boyfriend and my friend were the only reason I passed that C++ course). 

We then went back to catch up on what we'd been working on that week, namely the twitter bots and the games. My game never came together. I asked one of the instructors for some pointers, but really he gave me a pep talk, which is what I think I needed even more than programming help. I love that after kicking myself for two days over this stupid game, someone was paying enough attention to recognize my despair. This is the complete opposite of grad school in a very good way.


Ugh, but seriously, I hate this game.
I think that i might actually start the game exercise from scratch again and try to write something that is actually achievable by the game engine and in a way where I learn about classes and inheritance and not just how complicated TripleTown is.

In the afternoon, we had a quick lecture on hashes and essentially on how dictionaries work and then it was back to working on our twitter bot (the game was dead to me at that point) and then we went back to the lecture area for demo time. There are a lot of really excellent twitter bots and games. And maybe later I'll post the links because I am the laziest. I am super impressed with all of my classmates. Everyone put in a ton of effort and everyone made something unique and hilarious for both the games and the twitter bots.

And I signed up to give a 5-10 minute talk on cat/head/tail and grep on Monday afternoon. This may or may not end up being a disaster. And I'm going to have at least one more post (and perhaps a couple more) tonight. You've been warned.

EDITED TO ADD!!!

Heather posted about week 2 of Hackbright as well and has an awesome twitter list of the twitter bots that she graciously allowed me to link to. Thanks, Heather!!

10 October 2014

Hackbright Day 9: while True: head.Desk()

So it turns out that I don't play many games. When given the opportunity to create a game of my own using a pre-made game engine, my impulse was to try to recreate Triple Town. At least, a very pared down version.

It turns out that with this particular game engine and my understanding of it, this is pretty much impossible. I feel super bad for my partner on this one because she's stuck with a non-functional game. We were doing this exercise to learn about classes, but instead, all I did was fight with the engine. It was pretty much all of the fail that one could imagine.

And when your code starts looking like this, it's time to go to bed.

09 October 2014

Hackbright Day 8: my mind Blue mist round my soul Feel so suicidal Even hate my rock and roll Wanna die yeah wanna die If I ain’t dead already Ooh girl you

So I went and watched a movie with Colby tonight, so I am super spent. Here's a brief recap.

We spent the first half of the day working on our Markov chain text generator. The next step for us was to put it on twitter. We decided to mash up the Beatles with Jane Austen's Pride and Prejudice. It turns out that mixing up two corpuses (corpi?) is difficult if the writing styles don't overlap, especially if your Markov chains are long. On the other hand, having longer Markov chains tend to create text that makes more sense.

The way we dealt with it was that we first read in the text from Pride and Prejudice, created a dictionary that used tuples as keys and then created a random string. We then used the last word of the Pride and Prejudice random string and used that to be the first element of the key tuple for the Beatles. We created a separate dictionary for the Beatles lyrics and then created a random chain using the seed from the last word of the PP random string. We then figured out where the two random strings met, and then grabbed 70 characters plus and minus around the midpoint. We then evaluated the first part of the string to determine where the first word really started (in case the string we grabbed was only part of the word) and then we made sure that the last word was similarly not cut off. Finally, we worked with the twitter API and didn't actually publish our twitter auth keys to github this time. *HURRAH*.

The twitter account is @heyjaneausten (so like, Hey Jude.. or something).

We talked about classes in the afternoon and I am way too not awake to talk about them right now. And then we used classes to create a game. A very not good game that we'll have all day tomorrow to work on.

08 October 2014

Hackbright Day 7: Markov Chains and Mary Had a Little Lamb

Today started out with a review of the previous day's exercise 6, where we were given a colon separated values list of restaurants and ratings and we were told to use a dictionary to store the information and then present it in two ways: alphabetical and then by rating. Sorting alphabetically is easy, because we used the restaurant name as the key and a sort on the dictionary will sort on the key names.

The sort on the rating is a bit more complicated. My initial thought was to make the ratings the key and the restaurant names the values, but that doesn't work because you can't have duplicate keys. We ended up doing this in two ways: first, we created a list of tuples out of the dictionary and then sorted on the second element (which was the rating) and then printed from the list of tuples. The other way that we approached this was to create a list of the keys (or restaurant names in this case) and then use that list to create a list of tuples that contained the restaurant ratings and names and then used list sorting to order them by rating. While both approaches seem the same, the subtle difference is how we sorted them. In the first example, we needed to use a special argument in the sort command called a key. A key is a function and we used that function to return the second element of the tuple, upon which the list was sorted. In the second case, the list of tuples was constructed such that the tuples contained the (rating, name,) instead of the same order that was in the dictionary.

One of the biggest things that I learned from this exercise is that there are many ways to approach a problem. We also were warned against trusting anyone who uses the program to provide sane input. One of the instructors called this "defensive coding".

If we ever have a boy, it's totally going to be named Little Bobby Tables








In the afternoon, we discussed Markov chains. There are a lot of wonderful explanations of Markov chains. Markov chains are used in weather prediction, Google page rank, and in predictive typing, among other applications. However, the best use of Markov chains clearly is for humor. In fact, Chris once used a Markov chain text generator on his tweets. It's pretty hilarious. Also hilarious? Kim Kierkegaardashian, a mash up of tweets from Kim Kardashian and the philosophy of Soren Kieregaard, the only existentialist author I could ever stand to read for long periods of time. (College was a moody time, OKAY?!)

Here is my take on Markov chains:

Markov chains are constructed by the probability of an event occurring at a given state. If you have a state and then event a happens, then you can go to event a and then look at the probabilities associated with that event of what might happen next. I realize that this is a very terrible explanation, so let's look at an example.

Mary had a little lamb,
little lamb, little lamb
Mary had a little lamb,
whose fleece was white as snow

Every time you see the word Mary, it's followed by the word had. Similarly, every time you see the word little, it's followed by lamb. When you look at the word lamb, however, it's followed by little, little, Mary, and whose.

Thus, if you start with the word lamb, there's a 50% chance that the next word will be little, a 25% chance that the next word will be Mary, and a 25% chance that the next word will be whose.

The Markov chain text generator that we worked on this afternoon basically worked by looking at an entire piece of text and then determining the possible set of next words for a given word.

We then started with a seed word (or a few words, but we'll get to that in a minute), randomly choosing the next word from the list of possible next words that we generated from analyzing the text. At this point, we have: seed + new word. It then evaluates the new word to figure out the likely next word, and so on.

Markov chains are pretty good at generating text, but they work better if you evaluate more than just one word at a time. This set of words is referred to as an n-gram, where n refers to the number of words that you string together. So in the example I gave, instead of looking at just "Mary", we could look at Mary had or little lamb instead of just little. This is actually a pretty terrible example, but let's explore it for a little lamb. I mean bit. little bit.

The way you would approach this using a bi-gram (or an n-gram with 2 words), is by first evaluating Mary had, which always is followed by a.
seed = Mary had
new = a

then we need to evaluate the next set of two, which would be:

had a, which is always followed by little.

So now we have:
Mary had
a
little

And then we evaluate a little, and so on. The way that we attacked this in python was to create a dictionary, where the key was a tuple that had n-elements, where n was the number of words that made up each n-gram. The corresponding values were lists that contained the possible outcomes. Let's look at the first four entries in a dictionary for a bi-gram of Mary had a little lamb:

{
('Mary','had',) : ['a'],
('had','a',) : ['little'],
('a', 'little',) : ['lamb']:
('little', 'lamb',) : ['little', 'little', 'Mary', 'whose'],
...
}

So after we figured out that, we worked on trying to get the random text to end of an ending punctuation mark (i.e., a period, question mark, or exclamation point) and then trying to truncate the phrase to less than 140 characters. This is because the next step is to make the tweets appear on twitter. We'll be working on that tomorrow morning. I'll share the link to the twitter profile and describe how the twitter API works tomorrow if we can get it up and tweeting.

Wow. This is insanely long. I'm sort of surprised that I'm still faithfully blogging after every class, but so far, it's been the easiest way for me to synthesize what I've been working on. Here's hoping that I can continue on for at least the next 4 weeks. Also, for everyone who was sitting through my Debbie Downer-isms at lunch today, thank you for letting me vent. It's oddly comforting to know that other people feel the same way.

06 October 2014

Hackbright[1][0]: Dictionaries and Shell

Today was dictionary day. Dictionaries are what Python calls hashes and what other languages, perhaps more informatively refer to as associative arrays. Dictionary handling is similar to that of lists, but they differ form lists in one key (hahaha see what i did there?!) way. Dictionaries are constructed as a key (or keys) with an associated value. In a list, the "key" is the index. Dictionaries do not preserve order the way that a list does, but you can make a dictionary out of anything that is immutable.

This is a valid dictionary:
beverages = {'tea' : 'earl grey', 'coffee' : 'sumatran', 'beer' : 'hefeweizen', 'juice' : 'grapefruit'}

instead of having to somehow assign the key (in the beverages dictionary, those would be tea, coffee, beer, and juice) to a list and then index it to match the values (corresponding would be earl grey, sumatran, hefeweizen, grapefruit), you can directly search for 'tea' or 'coffee'. This is because in python, each of these words has an associated hash that is always the same. Searching through dictionaries is also faster than searching through lists. They're pretty neat and would have saved me so much time trying to cross reference between the different derived abundances for all of the different stars that I measured as part of my thesis.

We did two exercises today, which consisted of using dictionaries and their keys to display and then to take a chunk of text and figure out how often each word showed up. Pairing went well today, which was nice, and meant that we actually finished the assignments today. In the afternoon, we talked more about shell scripting, which continues to be my most favorite thing. We have to sign up for 5 minute tech talks, and I'm wondering if I should talk about that or if I should find something else so I can actually learn something new (as opposed to relying on shell scripting yet again). We also got divided up into groups and paired with and advisor. Once a week, we have one-on-one chats with our advisor and today was my day. I really appreciate how often Hackbright checks in on us. It felt like I spent a lot of grad school floating away on my own. Speaking of which, I need to really need to get over this grad school PTSD.

And in super unrelated news, no matter what happens in Hackbright, I have reached the pinnacle of success (and no, I'm not talking about my Ph.D):

I made it on Buzzfeed!



My friend sent me an instagram message telling me that one of my pictures was posted. And then I understood why I recently got a bunch of random followers. To be fair, we had mostly packed away our kitchen and I needed coffee. I decided that melting one of Ramona's sippy cups wasn't in anyone's best interest, so a mason jar was the best receptacle I had on hand to contain the coffee. When the coffee brewer didn't fit over the jar well, chopsticks were clearly the answer.


Hackbright Day 5 and Hardly Strictly Bluegrass


Friday was the first Friday of Hackbright and the last day of our first week. (You still following?) Fridays are generally more relaxed, so we started the day out with a skit from the performers of Hackbright Theatre on the differences between tuples and lists. Very entertaining! We also talked about sets. Tuples are immutable and good as data structures. So basically, they're like the array-like things in IDL. That aha moment stuck with me, but I decided to keep it to myself because I'm guessing that there is no one else in that room who ever used IDL because OMG NO ONE USES IDL WHY DIDN'T I LEARN A USEFUL LANGUAGE IN GRAD SCHOOL???????

We're going to revisit this later.
We then did a skill exercise to see how quickly we could get through something. It was actually pretty easy because it did not go over my nemesis (that would be list slicing). What I've found is that if I've seen something in Fortran/Supermongo/bash/IDL/somethingelseuseless, I'm mostly okay with the concept. I just need a refresher. My Fortran-honed instincts tell me to build everything from scratch, though, so it's kind of a huge roadblock for me. In addition, my HOLYCRAPPANIC-o-meter goes off if I don't immediately understand something (AHH. LIST SLICING). I'm going to thank grad school for that.
In the afternoon, we had a brief lecture from one of the founders of Hackbright. He's usually an intstructor, I think, but this was the first lecture that he led. He told us about how google figures out where you are from your laptop. Google street view vans used to drive around and record your wifi names. They would then remember where that was located and then could tell if you were connected to it. However, moving across the country, but keeping the same wireless network name doesn't update automatically... until! they started using phones that hooked to wifi but also had GPS enabled to determine your exact location. So every time your phone asks if you want to enable wifi for better precision and you connect, Google is thanking you.
The rest of the afternoon was spent working on the skill exercise and then completing all the other items we didn't finish from earlier in the week. I should probably look at the "extra" stuff that we could have done if we had time (but no, LIST SLIIIIIIICCCCCCCCIIIIIIINNNNNNGGG). One of the instructors was kind enough to give another lecture on list slicing, which was great and helped me better understand it.
Finally, around the built-in break time, all these bottles of champagne were brought out and a butter knife was brandished. Hackbright was congratulating us on finishing up the first week of classes and the lead instructor was about to attempt to saber the champange bottle with a butter knife. It turns out that you can't really saber a champagne bottle like that, but you CAN do it with a spatula. All of the rest of the bottles were opened in the usual way. Surprisingly, no one wanted to drink out of the spatula-opened bottle.

It turns out that glass shards do not provide the mouthfeel that most people seek in a good champange.



It was a good week. It was frustrating at times, but mostly I felt like I learned what I needed to. I really need to do some soul searching and become better at pair programming. I probably also need to unclench a lot. It's hard to do, though, because this feels like the highest stakes schooling I've ever done and it's in the shortest amount of time.

And here's where all the Hackbright stuff ends. So keep on reading if you're super interested in random things that I did this weekend. ;)

The summer of 2005 was pretty rough. It was the summer between my tumultuous freshman year of college and the (unbeknownst to me at the time) equally tumultous sophomore year of college. I applied to a bunch of internships for the summer, but was rejected, mostly because those internships typically went to students who were a year or two further in school. My undergrad advisor got me into the summer program at MSU, and so I spent the summer splitting my time between East Lansing where I worked M-F and Harper Woods, so I could go home and fight with my awesome boyfriend. I remember so very, very little of that summer. Partly because I blocked it out and partly because it was 9 years ago. (HOLY CRAP I AM THE OLDEST WHO EVER OLDED IN EVER!)

I did form some friendships, though, and "maintained" those friends through facebook. Here's to never cleaning out my friends list! I actually met up with one of the people from the program last summer when I went to Boston to work on my thesis. Interestingly enough, she knows the person who let us crash at her place in the first night we were in the Bay Area. BUT! I was introduced to that person by one of my best friends in Austin who went to undergrad while the pad-crashing-allower was in grad school. (Wow, talking about people without names is difficult.) What I'm trying to say is that astronomy is an incredibly small community and everyone knows everyone else. You don't play 6 degrees of Kevin Bacon in astronomy because everyone is Kevin Bacon. But i'm getting off track.
There was another person who I maintained a facebook friendship with from that long-ago MSU internship. She moved to San Francisco with her fiance a few months ago and is doing a different coding bootcamp. We met up at The Hardly Strictly Bluegrass Fest in Golden Gate Park on Saturday, and it was great! I got to meet her fiance, she got to meet Colby and we reminisced about the very few things we could remember from the summer of '05 and talked about San Francisco, tech, and life in general. It was awesome getting to see her again and I hope that we can hang out more frequently than every 9 years in the future.
Right, so let's talk about Hardly Strictly. It's a nominally a bluegrass festival, but the first act we saw was Deltron 3030 and the 3030 Orchestra, who were very much not bluegrass. I think it's a rap superband, but I could be totally mistaken. A typical fan was frat boy with dreads with a joint in one hand and a bag of Franzia in the other. We left after a couple songs because the area was in the sun and Colby melts in the sun because he's pretty much as pale as you can get before you get rickets.
We then headed towards the Rooster Stage, where we stayed for most of the rest of the night. It was great, and mostly alt-country. The whole reason why I wanted to go was to see Robert Earl Keen. Every time I'd hear a country-sounding song on KLRU that i liked, it was him. My homesickness for Austin was briefly alleviated to the tune of Gringo Honeymoon, Merry Christmas from the Family, and (of course) the Road Goes on Forever. The MC called him the "Poet Laureate of the Rooster Stage" and everyone was super into it. The crowd at the Rooster Stage was generally a lot older and a lot less trashed. I posted a bunch of pictures on Instagram and twitter from the festival. All in all, it was a great day and I'm glad that we decided to brave the crowds and the terrible public transit situation.

03 October 2014

Hackbright Day 4 and the Eventbrite Girl Geek Dinner

Today was the fourth day of class. We talked about list slicing in the lecture in the morning. I still have a lot of questions about it, but they're still mostly answerable by playing around with toy scripts or even in the python interpreter. The exercise today was basically writing list functions from scratch using only slice operators. I find list slicing to be incredibly frustrating. I think part of it is that it's different than what I'm used to in Fortran and also that it's not something that i immediately caught on to. My partner and I never finished the exercise, but I will definitely be working on it tomorrow.  Today was also picture day, which is never a good day for me. They mollified all of us by giving us Hackbright branded graph paper notepads. I guess it made it better. Or something.

In the afternoon, we talked about lists, iteration, and memory allocation. Apparently, if you don't pay attention to your variable assignment, you can have memory leaks by having things that are no longer connected to anything that is being kept track of in the code, but are connected to other unconnected areas in allocated memory. This makes python think that this shouldn't be cleaned up during garbage collection. This is not something I'm super concerned about right now, but it's another good thing to tuck in the back of my mind for when I'm working on my project and it runs crazy slow. I was totally having flashbacks to the pointers lectures in CSE 231, but I gritted my teeth and made sure I understood it this time around.

After classes, a subset of us headed to Eventbrite for the Girl Geek Dinner. It was pretty awesome. The food was great, there was a lot of alcohol (that I didn't touch because my tolerance is about nil at this point), and I actually tried to network a bit. Eventbrite seems like a great place to be and the company culture is awesome and caring of both their employees and customers and forward thinking. And they also hire Hackbright grads and they're looking for data scientists. I should probably start looking into data science Coursera programs right about now. We also got some fancy GGD swag, in the form of a really nice, sturdy tote bag, a pen, and a GGD branded moleskine. Two notebooks in one day? IS THIS REAL LIFE?

And I realize that this post is a bit thin and I have no pictures of code, but it's sort of late and I spent a lot of time playing around with chremacs and some horrible python-for-chromebooks to attempt to do the homework. I really just need to get my shit together and install Chrubuntu.

02 October 2014

Hackbright Day 3: Where I get distracted before talking about HB


From What Should We Call Grad School

Someone from UT posted that on facebook. I thought it was apt for how I'm feeling right now about Hackbright. I need to do the homework. I want to continue on in the exercises that we do in class to improve them and to play around with the extra stuff. I really should finish the pre-work. All of this in addition to the personal things that need to be taken care of, including but not limited to: finding a new place for three people to live by November 1, finding a school for when Ramona finally arrives,
figuring out how to safely install ChrUbuntu on my Chromebook, finding Colby a job. As much as grad school was terrible and stressful, it never felt like I was putting anything on the line. This entire move has been stressful and risky, but it's been exhilarating all the same.

Today was day three of Hackbright. I thought that I was going to be early, but when I sat down on the BART, I realized how crazy short my dress was so I stopped into Walgreens to buy a pair of tights. Unlike in Austin, some of the Walgreens out here are experiences in an of themselves. You might even call them a piazza. Totally reminded me of this  scene from You've Got Mail:



ANYWAY. Back to Hackbright. We had lecture in the morning and we talked a bit about functions from the previous night's homework. My solution was different than what was discussed in class, but I think it still worked in the right way. We then went on to pair program. I think I was clearer in my descriptions of what I was doing while I was "driving" (aka typing), so that's good. I think I also need to just sit on my hands while I "navigate" (aka watching my partner type) because I'm like a 2.5 year old who can't sit still unless Dinosaur Train is on.

There were two exercises today and they involved functions and calls to functions. We essentially wrote a variation on a Polish Notation calculator. First: I love infix notation. Second: I now know how dictionaries (so basically the same thing as hashes in Perl and wow, I totally never understood them until now. Sorry, Chris!) work and how you can call a function from a dictionary entry.


My partner and I moved through the exercises fairly quickly, so we also did a "week one" project where we were given a set of files that had random names and we needed to create directories that were named a, b, ..., z and place the files in the directory that corresponded to their first letter. Partly because I miss doing terrible, wonderful things with the command line and partly because I just wanted to see how I would approach the problem on my own, I shell scripted the assignment first. We then used python to for reals solve it. I asked one of the instructors if this task was something that was supposed to happen in python in real world applications or if we could do something like this using shell scripting since it seems like that was more efficient. He indicated that it was fine either way. The one question I still have is how can you access a shell script that you wrote yourself from within a python script? I've tried system.call("/home/user/iheartawk.scr") to no avail.

And now I should probably go to bed or do the homework. The homework is actually to rewrite a code so that it's more understandable. At first I didn't understand why the code was hard to read, but then I realized that years of reading my advisor's decades old F77 code has made me actually pretty okay at reading other people's code. It's like I have a skill or something.

01 October 2014

Hackbright: Day 2. An exploration in my pair programming partner's patience.


We spent the morning talking about the blockly maze exercise we did yesterday, along with algorithms in general. It turns out that the "left hand rule" of maze solving basically says, if you can turn left, turn left, otherwise, if you can go forward, go forward, and worst case scenario, go right. This has a real-world application of being a way to find items in file systems that are structured like "trees". It makes me think I should mess around and try to write my own locate script to see if I can make it work.

After that, we paired off to today's exercise, in which we created a guessing game. Pair programming is something that I am very much not good at. I speak quickly, I get excited by ideas (and have the subsequent unintelligible verbal diarrhea), and I'm not used to thinking out loud in such a way that it is decipherable to anyone but myself. To anyone reading this with whom I have pair programmed or will pair program with in the future: my deepest and sincerest apologies.

The guessing game was pretty straightforward, where it was a game where the user guessed a random number between 1 and 100 and then would be told if their guess was right, too high or too low. Then, we added features to alert the user when their guess was out of range or if they entered a string. Determining whether or not the input was out of range was easy. Trying to figure out if it was actually a string was much more difficult.

We prompted the user for input using the command:
guess = raw_input("Guess a number between 1-100")
Due to the way that python works, the raw_input function converts anything that is entered into a string, so if the user inputs a number, for instance, "67", we need to convert that number from a string to an integer. This is easy enough to do:
guess = int(guess)
BUT, if the user entered something that wasn't a number, e.g., "poop", then doing guess = int(guess) is going to puke on you. The way that we solved for this was to write a function that compared the input to a string of all the arabic numerals to see if the input contained only numbers (and thus was able to successfully run guess = int(guess)). The function was actually pretty nifty:

And I just realized that I emailed my pair programming partner and myself the wrong file. I am the awesome.

Finally, we added the functionality to play another round and to also keep track of the high score. I want to play around with it a bit more to see if I can make it look better and perhaps function faster. And now I should probably go to sleep or pack since we're moving again during the day.


EDITED TO ADD:

I totally forgot that we talked about git. git is way better than cvs and apparently I was doing horrible, terrible, no good things in cvs before, so it's good that I'm now committed (HA, GIT it??????) to git. Tabula rasa, amirite? (I understand that that's not at all what is meant by that.)

30 September 2014

San Francisco Eats

Having been in San Francisco for less than a week, I am clearly an expert in the food scene. We tried to cook at the place that we're staying, but it's hard because all of my cooking stuff is packed away in the car or in Michigan. We even decided to leave our spices in the car, so when I decided I was going to make tacos tonight, I realized that it wasn't going to happen. We've been eating out a bunch, probably more than we should, but here's a list of some of the places that we've eaten at that I've enjoyed.

We went to La Oaxaqueña in the Mission District tonight for dinner. Colby got a "spicy pork" taco (he's super awesome at details), I got a sundried tomato + goat cheese pupusa and we split a tlayuda. I had never heard of a tlayuda until we went there. It's essentially a Mexican pizza-like dish, with a crispy tortilla as a base, covered in refried beans, cheese, salsa, lettuce, and (in our case) chipotle chicken. Colby said that the taco was the best thing he's had since we've been to SF. The tlayuda was similarly delicious and I am completely angry that I didn't know those existed until now. We almost didn't go there because they sometimes cook with grasshoppers and I was terrified of cross contamination, but I'm glad that we went. Only later did we find out that it's a "hipster hotspot" and "super sketchy". 
This also satisfied my avocado craving
Truly Mediterranean is in the Mission District. It serves schwarma and falafel on lavash. Colby got the lamb and I got the chicken kabob and it was wonderful. While we were waiting, one of the cooks gave us a sample of falafel. Those were incredibly delicious and definitely worth a trip back.
This is the only picture I have of that
Pakwan is also in the Mission and it serves Pakistani and Indian food. it was a little strange in that you have to buy the rice separately, but we ended up just splitting a huge piece of naan instead. I got the saag with chicken and Colby got chicken tikka masala because that's the only thing he ever gets. They were both really good and Colby would have probably enjoyed his meal more with rice.
Nothing look as delicious as blurry spinach, AMIRITE?!

Sugar Cafe and Coffee Bar is in Union Square, right next to Hackbright. My hackathon team (I swear I'm going to post about it soon!) met there to discuss ideas. I had a super delicious latte and a tuna salad that was also very good (and super low carb, might I add). I am 90000% sure that I'll be making a return trip because I rely on coffee the way python uses white space. Or something.

latte + chromebook = instagram picture
prettiest tuna salad ever
Hopefully I'll get out the DSLR and take real pictures of actual food I'm eating again. Or better yet, I'll get back to writing about the food I'm making at home when I finally have a home in which to make food again.



29 September 2014

Hackbright Day 1

Today was the first day of Hackbright and like everyone else who is blogging their way though it, I felt the need to recap.

My first accomplishment of the day was making it to the office on time and without getting lost. GO ME!! We had breakfast provided, which was nice, and then settled in with a getting-to-know-you type of game, where I didn't really get to know anyone. I just know that most people either don't like Jason Mraz or are willing to admit their fondness for his music, but not too many people consider it their guilty pleasure. We then heard from some of the instructors about what the program was like, two alumni about their experiences, and then learned about pair programming via a skit and then a short talk.

3 Things I Didn't Know About Pair Programming:

  1. You're supposed to switch after every 2-3 LINES of code, or at least every 5 minutes
  2. You're supposed to talk your way through it
  3. You're not supposed to just put one person at the keyboard with the other person "navigating"

Thing I Didn't Know About Pair Programming, But Largely Suspected:

  1. I'm not particularly good at it.

It's okay, though. I have plenty of time to get better and I think that having other people who think differently than me is helpful. I hope. And I hope that I didn't make the first day useless for my pair programming partner.

We then went to lunch, came back for our first pair programming exercise in blockly, heard a lecture on the command line, and then had our second pair programming exercise, this time about the command line. This was a tutorial by Zed Shaw, as part of an appendix of Learn Python the Hard Way. This is the first time I had ever used "pushd" and "popd". Those are not useful commands. AT ALL. It's okay, though, because I asked one of the TAs about it and she also said that she's never used them.

My biggest complaint of the day is that they're not using emacs, but rather a text editor called sublime. In fact, emacs wasn't even installed on the computer in the lab. Maybe I'm just a crusty old astronomer (I did do extensive parts of my thesis using supermongo, after all), but gahh.

And now it's time to talk about impostor syndrome. My interview process was different than most of the other students. They kept telling everyone, "don't worry, we chose you because you're awesome and we know you", but I'm terrified that they don't actually know me and that my alternative path to Hackbright was based on networking and not actually because I'm going to do well. Everyone seems really motivated and capable and I'm back in my first year of grad school wondering how the hell I even got in. People talk about coursera classes they've taken and different things they've done and I've spent the past month procrastinating on finishing up the pre-work and moving across the country. Everyone said I needed a mental break after my thesis so I didn't implode, and they were totally, completely right. But I wonder if I took that break at the expense of being prepared. I guess we'll see.

Also, I participated in a Hackathon last weekend, but I think I'll wait to recap that for a later post.

25 September 2014

San Francisco Things: Clarion Alley

The first apartment that we're staying in backs up onto Clarion Alley in the Mission District. It's actually incredibly spacious for San Francisco standards, and I kind of wish we could stay here for the duration. Clarion Alley is known for the colorful murals that cover its buildings. The Clarion Alley Mural Project has been around for over 20 years and the murals are updated and changed frequently. We walked down the alley and took some pictures while we were out and about today.

The stairs in the second picture actually lead up to the apartment we're staying in right now. I guess it's the only apartment that's painted as part of the CAMP.









There were a lot of memorial works up.

Imma go out on a limb here and say that this artist is not a fan of gentrification.

That's actually on the sidewalk. On the other side of the alley there were giant piles of human shit. Lovely.

That might be my favorite one, it's incredibly intricate.

Another interesting piece

And now I should probably finish up my pre-work since tonight and tomorrow are my last days where I can really do anything about it.