Mary Dickson Diaz

Code, Life, Learning

Month: October 2015

(cute and) fuzzy searching

fuzzy cat

hello? is it me you’re looking for?

Hey folks, what a ride that was! I finished my class last week and I’m working on a wrap-up post (plus wrapping up a few loose ends for class). I am officially on the market (that’s a link to my LinkedIn page) if you hear of any great web developer opportunities out there. I’m attending a talk tonight called “How to Land an Awesome Tech Job in Seattle” where hopefully someone will offer me an awesome tech job in Seattle (that’s how it works, right?)

In the meantime, my lightning talk on fuzzy searching is up!

I had entirely too much fun putting together this powerpoint and learning about edit-distance and Dice’s coefficient. Fuzzy searching is for when an exact match isn’t found, but you want to view similar results / possible matches. I haven’t used it in an app yet but I have one just waiting to be deployed. One of my colleagues implemented fuzzy search for her final project, so I got to sit down with her and look at these options to see what might work best for her needs. Very cool.

(update: pee esss I found this great primer on Levenshtein, after my talk unfortunately, but helps explain some of the confusing things about edit distance)

In related news, I gave an impromptu lightning talk on markov chains at a Code Fellows event yesterday. I wasn’t expecting to talk, but it was great experience and practice on the fly!

Wish me luck as I attempt to #escapetheroom this afternoon… !

the elephant on your desktop

(No, not that elephant.)

This elephant:

At some point in the last few weeks, I added this card to my Trello task-tracker:

All new Rails apps in postgres

And then I did nothing about it until I was trying to do something else and couldn’t get a program to load because of, oh yeah, postgres. Time to deal with that, I guess!

There are three popular options for running a Structured Query Language (SQL)based database on Rails: MySQL (owned by Oracle), sqlite3 (comes built-in with new Rails apps), and PostgresQL… the one with the elephant that’s OK to run on Heroku.

I’ve been using the Rails built-in database mostly, switching over to Postgres for production on Heroku, but it’s a best practice to use the same database for your testing, development and production environments. I can’t really speak to the differences between the three except that my perception is that MySQL is widely hated and Postgres always takes some flailing around on my part to get it to start.

$ rake db:create
$ rake db:migrate
$ rake db:reset
$ rake db:hello_is_anyone_listening

So I was excited to take on a project refactor this week built on Mongo DB, a no-SQL database. Rather than using Active Record and data migrations (hello, hello, is this thing on), Mongo stores database table information directly in the model records where they’re easy to add, delete, or change.

Hooray no migrations! Hooray another tool in my toolchest!

That bit of learning curve did not last long as we realized that what we want to build requires relational associations that a SQL-less database isn’t optimized to handle. I felt a bit sad about not getting to play with a new toy until I ran into this:

Screen Shot 2015-10-19 at 9.34.06 PM

I’ve run into this “master-slave” business before in software and my response was a big “wtf” followed by an “I’m not using this.” And so far, I haven’t had to, since there have thus far been alternatives.

So over to Postgres we go! Commere you big lovable elephant. Give mama a slobber. I shall add to my box of tricks “converted an app from a no-SQL database to Postgres” and all shall be well.

  • Here is a great (long) article by a programmer I admire titled Why you should never use Mongo DB.  This is the type of technical writing to which I aspire.
  • A cloud data storage option I am really excited about: The Art Guys Heads in a Cloud Data Storage Memory Services (I miss you, Houston!)
  • Ok FINE here is A Young Woman’s Etiquette Guide to Coding but I have to say I am annoyed to the point of dismissal that Black Girls Code (a great organization) is listed here with the byline “powered by American Express.” Probably the author meant to say “powerful black girls and women.” Yes, that’s more like it. That downer aside, some good information here.

burning the candle at both ends

Before I forget… Honkoween is coming! I made this silly little bot for Josh when he asked me “can you make me a bot that tweets a link to this video once a day through Halloween?”

HONK

Who else has wishes, while I’m granting them?

I’m doing something a bit out of character for me and *going to things* this week. Yes, on top of the 7th inning stretch of class, wherein we cram in “all the other stuff you should probably know” (I see you, binary trees).

It’s exhausting but also exhilarating to revisit some of the parts of coding that most excite me. Last night I attended an event at Seattle Public Library about open data and civic action, with speakers from various government agencies and hackathons talking about some of the resources available for making public data available to be used in interesting and productive ways (while still preserving aspects of privacy). The data.seattle.gov page is a well tended well of information just waiting for a rabbit to fall down it.

I’ve been meaning to get involved with Open Seattle for a while, and this was a good kick in the pants to do so. Particularly since they are closely affiliated with a company I’d love to work for, to do this sort of partnering with government agencies to wrangle their information full-time.

Tonight I learned about a tool algorithmia that allows you to access a multitude of algorithms and fun web tricks via API access (another thing we’re focusing on in class this week). The workshop was really well-explained, demo-ed, and paced, which I appreciated as well. It provides an easy gateway into website scraping, which is something else I’ve been wanting to try out.

Tomorrow night is Pass It On at Code Fellows, an event focused on how to encourage and facilitate more women in tech roles. I’ll already be there, so all I have to do is not leave (my favorite kind of event!).

After next week, I’ll have ample time to explore (and start looking for jobs) so I’m leaving this here as bread crumbs for myself. There’s a world of tools available to build with. Now I just need some interesting questions.

try angular

this is what angular feels like, a bit

In the last two weeks of my Code Fellows Ruby on Rails bootcamp, we’re focusing on JavaScript, JQuery, and all their friends. This week we kick off with Angular. Angular is a JavaScript tool created by Google for fast, responsive websites. I completed the (free) Code School course “Shaping Up With Angular” and I’m about to embark on a quest to connect it to a persistent database. In my case it will be a Ruby on Rails app.

But first, let’s talk Angular!

MODULE

When you create a JavaScript file to hold some Angular, you initialize it like so:

var app = angular.module('gemStore', ['store-products']);

if you’re not well-versed in JavaScript, this is essentially saying: Declare a variable “app” and set it equal to an Angular module named “gemStore” that depends on another module named “store-products.” Once you’ve declared at least one module, you can get going filling it up with useful stuff like…

CONTROLLERS & DIRECTIVES

Controllers work similar to how they work in Rails. You can set up and assign a controller to a specific part of your webpage, and it can render and manipulate data in a variety of ways. In the tutorial, we set up controllers to manage information about the gems, the product tabs, product reviews, etc. If your code is getting repetitive and/or you want to isolate specific chunks of the page, you can create directives instead that will load a separate html page using naming-conventions (much like how Rails renders partials). Depending on what you’re trying to do, you may be able to include controller functions in a new directive and eliminate the need for a separate controller altogether. Neat!

SCOPE

Angular controllers are called on specific DOM elements , and operate within the scope of that element only. So for example, here’s some pseudocode:

<section id=gems ng-controller="gemController">
  <unordered list of gems>
    <gem 1>
    <gem 2>
    <gem 3>
  <end of list>
<end of section>

Outside this lovely, contained section, if you want information about gems you are entirely out of luck. Note how any of the list objects know about gems (and any child elements we might create under them, if we so choose)–basically anything that’s in the gem section family.

But not outside that family. They know about other stuff, maybe. Like maybe they know about…

DATA BINDING

If you’ve ever typed on a website and had text show up magically elsewhere, tracking as you type, that’s a two-way data-binding and Angular is a pro at it. Here, why don’t you go make some boxes to see how it works? Hmmmm… boxes. That’s not very try angular. Get it, triangular? I feel like this demo could be improved… perhaps a project for a rainy day…

DEPENDENCY INJECTION

Wow, that one sounds pretty grim, right? Coffee is my dependency injection these days. But we already saw this above — you remember in that top example how my app.js had an array of one element — it looked like this:

angular.module('gemStore', ['store-products']);

The app can’t run without the file where I’ve created a module named ‘store-products’, so injecting the dependency here tells my app where to look to import that info. Once it knows how to read ‘store-products’, it inherits any and all controllers and directives in that dependency JavaScript file, and the app can load as usual. Quickly, we hope!

Ok, off I go to attach this gemstore to a database… wish me luck and above-average retention as we dive into the last week of instruction (#justkeepswimming).

teachable moments

[This one from the drafts folder, folks. Reflections on the code bootcamp, week 3-ish out of 8. Written on the number 7 bus en route from class, most likely. My bus commute is at best two and at worst three hours every day. I had grand plans to maximize that time, but here it is week 6 and I’m still spending it mostly on phone games.]

learn-64058_1280

stop teaching me things, I’m trying to learn

As a middle school teacher, I became attuned to “teachable moments,” opportunities to impart knowledge related or unrelated to the topic at hand in response to what is happening in the classroom. Sometimes these situations relate to “real world” knowledge, questions about current events, observations about how people interact with each other. “This wasn’t on my lesson plan, but this is a teachable moment and I need to take advantage of it while it’s here.” Genuine connections, stuff kids will remember.

My instructor and TA are great at taking advantage of these in class. When someone couldn’t connect their laptop to the overhead, we got a lesson in how to clone a repo in github. Unexpected errors get dissected until they’re solved.  The answer to “who else has seen this error?” is usually not nil. Almost nothing is off the table, and I’m a better programmer for it.

It’s not always a picnic though. The structure of this class is a lot of stuff to get done in a short time frame. I’ve had multiple scenarios where I ask a question about how to implement something in my code, only to be steered towards doing it an entirely different way, often with huge structural implications. My impulse here is to respond with “Hell no, I’m almost done! That sounds like a great suggestion for another app. Let me just finish it my way and move on.” I’ve had to resist those feelings of impatience or frustration in order to leave myself open for what I’m thinking about as unsolicited learning. Those situations where I did *not* want a lesson, or not on some topic other than the one at play, but here is one anyway. It can be valuable if I stay open to it. Hell, I can even ignore it once received, as long as I get it.

It’s a blessing and a curse to be meta attuned to what’s happening with my own learning. And of course timing is everything. I may be open to one lesson at a given point and another one, I just want to go home and think about it and hash it out later. I’ve tried to convey this with as much respect and humility as possible while still being assertive– it’s my time, and I usually know what’s going to be productive for me and when the only solution to hitting a wall is to step away from it and come back later. That conversation looks something like this: “I see what you’re saying. This code could be definitely be refactored. I don’t know enough about this particular function and I’m not in the headspace to dig into it now, so I’d like to table this to research and work on later. I’m confident I have what I need to solve this now.”

It’s all a process.

badge of honor

The bad news: my achievement bot got banned! (a twitter ban on a benevolent bot is actually a badge of honor in twitterbot land, so I’m not too broken up about it)

The good news: I discovered this fact while updating my resume! I added some projects that I’m proud of and can talk about, which makes the idea of chatting with tech recruiters less horrifying.

I haven’t had time to blog which is a bummer for me, but not unexpected. In the meantime though, you can enjoy my lightning talk about Markov Chains, which I used to create Bookmerge.

Back in a jiffy 🙂

© 2017 Mary Dickson Diaz

Theme by Anders NorenUp ↑