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.