Mary Dickson Diaz

Code, Life, Learning

Author: mary (page 4 of 11)

(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 🙂

evolution of forms of governance in a rails app

No, this isn’t a history lesson. It’s an observation about the governing political ideologies that a Rails app takes on over time. Witness:

At Birth: Libertarian 

A basic Rails app has some sort of landing page and usually a database with CRUD (create, read, update, destroy) functionality. Without authentication or authorization, any viewer can initiate any of those functions. Visitors have autonomy to navigate and manipulate the site according to individual judgement, which is why I consider this a libertarian state. An example is something like my Robot app, which, who knows what it will look like at any given point. You’ll all been very polite in not destroying all the robots (you’ve probably been tempted, though). In theory, you can edit other people’s robots and add or delete as many as you want. I still get to determine what data gets collected on the robots, which I suppose makes this a minarchy as opposed to anarchy (users can’t alter the database or page itself). Although, if the chief role of minarchism is to protect citizens against theft, this certainly won’t do that. Quite the opposite. I can’t protect your robots, people.

Soon-thereafter: Dictatorship 

It only takes one “poop” post for the app creator to realize that people on the internet can’t be trusted, and some sort of filters are needed. The most basic filter, where most beginning programmers will start, is Admin v. Everyone Else. Using a gem called “devise” (or something similar), Rails developers can add Users, which thus enables user roles. With users enabled and a minimal amount of programing, an app can be set such that an admin user can login and create, edit, and destroy content, and everyone else can read it. This is how my WordPress site is set up: there’s a login link, but it’s tiny and hidden down at the bottom of the page, because I’m the only one who’s ever logging in. Because I’m a benevolent dictator, you may leave a comment (which has to be approved by me if it’s your first one). This page is “marydickson.com,” so no one is really arguing against my authoritarianism, but maybe you want to invite some friends to create content with you. The “I-have-all-power/you-have-none” model isn’t going to cut it.

One last note on dictatorship: I’ve encountered a handful of webpages that require a log-in before you can see any content. I encountered one this week, in fact, clicking a twitter link enticing advertised as “Things I Wish Someone Had Told Me When I Was Learning How to Code.” Notice there is no link, because when I tried to click through I was redirected to a multiple-page application to apply to be an approved reader. That’s totally their prerogative, but I wasn’t up for that at 7am in bed lazy-clicking my way through twitter, and ps I’m unfollowing you.

“We’re Gonna Need a Bigger Boat”: Aristocracy

When multiple people get involved in the content creation, participation and/or maintenance of your app, you’ll probably need to have users enabled and the know-how to manipulate policies (in class we used the gem “pundit”). With these, you can set more sophisticated and personalized access for your Rails app visitors. Perhaps you have admin, “authors,” “moderators,” etc. On a smaller scale, I would like for my portfolio site to have comments enabled such that anyone can access and leave a comment, whether logged in or not, and where anonymous comments are held as “pending” until approved. Comment leavers should be able to edit or delete their own comments, but not other people’s. This is where I’m a bit stuck at the moment, with my default being to revert back to dictatorship until I figure it out.

Eventually: Direct Democracy? Something else?

On a more sophisticated app, you may have not only users, but user pages and *preferences* where users have the power to control their own settings about what other users (& maybe even admin!) can CRUD. This seems like it would put more power into the hands of the users, right? More towards a democracy? Ironically, there seems to be a correlation instead between more privacy settings and controls, and the value of the data being collected and ultimately owned by the app. Read this description and tell me it doesn’t perfectly describe a popular site we all hate to love:

Totalitarianism is a political system in which the state holds total control over the society and seeks to control all aspects of public and private life wherever possible.

I use that site, too, but they’ve basically said as much as the above^^.

An alternative is *diaspora, a social network where users explicitly retain ownership of their data (and which I haven’t heard much about since the sad death of creator Ilya Zhitomirskiy a few years back). Today the diaspora foundation operates according to three key philosophies: decentralization, freedom, and privacy.

This seems like a key question for any app creator to consider from the beginning: What principles and philosophies do you want to guide your app creation? What tools and skills do you need in order to integrate them?

a parking garage

don’t mind me, just uploading some pictures to circumvent aws…

parkingSketchparkingUML

I am really bad at drawing cars.

oh what’s this? more pictures that need to be uploaded and not on aws…

20150914_144849

this sketch had such potential…

(since this post is titled parking garage I’m just going to keep sticking photos here that need an html page bc too lazy/exhausted to upload to custom domain.)

Screen Shot 2015-10-06 at 10.48.08 PM Screen Shot 2015-10-06 at 10.49.13 PM

Screen Shot 2015-10-08 at 11.04.38 PM Screen Shot 2015-10-08 at 11.04.55 PM

deb-artvillagerstim-beermalcolm-comichotairballoonscb2fences

Digital DocentMary Dickson Fuzzy Searching YouTubeMary Dickson Markov Chains YouTubeScreen Shot 2016-02-23 at 3.16.09 PMScreen Shot 2016-02-29 at 8.57.06 PM

the unhappy path

20150909_163445

Mount Rainier as seen from Seward Park, 9/9/15

(Heads up: this post deals with a health issue of a personal nature, invoking a metaphor from my experience learning Behavior Driven Development (BDD) testing. I felt it was important to share my experience, not only with friends and family but with others, internet searchers, who might be facing something similar. If that makes you uncomfortable or seems too intimate based on our limited relationship, feel free to give this one a pass.)

In my class we’ve been studying behavior-driven development (BDD), a relative of test-driven development (TDD), which takes an approach of: let’s write tests first that describe how we want our app to behave, and then write the code to make those tests pass.

So for example, here’s a simple test excerpt for the main section of my in-progress portfolio page:

feature "CanAccessStaticPages" do
  scenario "on the index page" do
    visit "http://www.marydickson.info"
    page.must_have_content "Mary Dickson Diaz"
    page.wont_have_content "hookers and blow"
  end
end

You can program your tests to click on things and fill in information to test, say, posting a blog post, or a log-in/log-out function. “Or you could just go click on stuff and see if it’s working” –yes but writing the tests in advance, and keeping them updated, saves immense developer time and energy over time, over changes, and when coding on teams and to scale.

Continue reading

the struggle is real

Hey folks, happy Labor Day!

I survived week 1 of the Ruby on Rails bootcamp. We’ve had to do a lot of work and reflection in class about what we’re learning, which makes me less inclined to write about it here. Yet. Stay tuned. In the meantime, you can take a peek at my portfolio site, which is build in Ruby on Rails and uses foundation zurb for the layout elements. It’s served on Heroku and redirected to a custom domain (that I got on sale for $4 from namecheap). Eventually–and in theory–it could replace this WordPress site altogether!

Introducing: marydickson.info

Please, internet, behave yourself around the blog tool until I get user authentication in place (this week probably).

My first week was overall very positive with one small hitch in the form of some medical issues I’m dealing with (remember when I was all, “let’s get the doctor visits etc out of the way before class starts”? Yeah, I did not do that, nor would it have necessarily helped). This means that I haven’t been able to devote 100% to the material and assignments, but this long weekend was a good chance to catch up.

In reflecting on how my health needs might potentially conflict with a high-impact, time-intensive program, I’ve also come to peace with the fact that two months is essentially an arbitrary amount of time and this might take me longer. Which is not to say that I don’t intend to work hard, do my best, and take full advantage of the excellent resources available to me during that time. But if my body is telling me to go take a nap, coding will still be there when I wake up.

It also might not take me longer, which would be great. But I’m prepared for the possibility. As of this moment I’m a member of the Caught-Up Club.

I have to give a lightning talk next week. What should I talk about?!

« Older posts Newer posts »

© 2020 Mary Dickson Diaz

Theme by Anders NorenUp ↑