< Return to Video

RailsConf 2014 - Saving the World (Literally) with Ruby on Rails by Sean Marcia

  • 0:17 - 0:19
    SEAN MARCIA:Hi. My name is Sean Marcia.
  • 0:19 - 0:21
    I am gonna be talking about saving the world
  • 0:21 - 0:24
    with Ruby on Rails. And that's me on the Twitters.
  • 0:24 - 0:25
    At seanmarcia. In case you're wondering,
  • 0:25 - 0:27
    I'm an early adopter. That's how I was
  • 0:27 - 0:29
    able to get my own name.
  • 0:29 - 0:34
    I thought was funny.
  • 0:34 - 0:36
    So I, I work at George Mason University as
  • 0:36 - 0:38
    a software developer, and I'd like to thank
    them
  • 0:38 - 0:40
    for giving me this opportunity to be here
    and
  • 0:40 - 0:43
    do this kind of cool stuff. Thank all of
  • 0:43 - 0:46
    you and thanks to my Ruby group for letting
  • 0:46 - 0:48
    me practice this talk on them last week.
  • 0:48 - 0:51
    So today I'm gonna be talking about the, the
  • 0:51 - 0:54
    history of the project. Then I'm gonna talk
    about
  • 0:54 - 0:56
    the technology we use. And then I'm gonna
    hopefully
  • 0:56 - 0:58
    tell you how you guys can all get involved.
  • 0:58 - 1:00
    So, but really, I'm just gonna tell you a
  • 1:00 - 1:04
    story about bees. And my personal story with
    bees
  • 1:04 - 1:06
    began when I was about six years old, and
  • 1:06 - 1:10
    for reference, that's me at six. Yeah. Looks
    like
  • 1:10 - 1:12
    an orange on a toothpick.
  • 1:12 - 1:15
    But, but when I was six, my, my good
  • 1:15 - 1:17
    friend and I, we were, we were out, we
  • 1:17 - 1:20
    were wandering around, and we found a wild
    beehive.
  • 1:20 - 1:21
    And, if you know six year old boys, you
  • 1:21 - 1:23
    can probably guess what we did next. We started
  • 1:23 - 1:25
    throwing rocks at it.
  • 1:25 - 1:27
    And, you know, my good friend, he just took
  • 1:27 - 1:29
    off running, and I didn't know why, and it
  • 1:29 - 1:30
    wasn't fun to throw rocks at the beehive without
  • 1:30 - 1:32
    him. And it turns out that the bees stung
  • 1:32 - 1:35
    him twenty, thirty times. And they didn't
    sting me,
  • 1:35 - 1:37
    so. I kind of feel I have this karmic
  • 1:37 - 1:40
    debt to the bees for leaving me alone.
  • 1:40 - 1:42
    And so, you know let's jump forward to today.
  • 1:42 - 1:45
    And like I said, I'm a software developer
    at
  • 1:45 - 1:48
    George Mason University. I was wandering across
    campus one
  • 1:48 - 1:50
    day and I saw this guy was giving a
  • 1:50 - 1:53
    talk. This is Herman Pria, and he was giving
  • 1:53 - 1:56
    a talk about Amazonian stingerless bees, and
    the honey
  • 1:56 - 1:57
    they collect.
  • 1:57 - 1:59
    And, you know, as a developer, I'm really
    in
  • 1:59 - 2:01
    it for the swag, and since he was giving
  • 2:01 - 2:04
    honey samples of these bees, that's why I
    went.
  • 2:04 - 2:05
    And so, I was listening to his talk, and
  • 2:05 - 2:07
    actually he told me what kind of animal that
  • 2:07 - 2:09
    is and I don't remember right now. But I'll
  • 2:09 - 2:12
    find out, because it's something interesting.
  • 2:12 - 2:14
    But, so I was listening to his talk, and
  • 2:14 - 2:16
    after the talk I went to, to talk to
  • 2:16 - 2:20
    Herman and, turns out he's doing all this
    really
  • 2:20 - 2:22
    interesting stuff about bees. And you know,
    bees are
  • 2:22 - 2:25
    fascinating. If you don't know anything about
    them, like,
  • 2:25 - 2:27
    you know, there's 4,000 different varieties
    of bees in
  • 2:27 - 2:30
    North America. If you guys didn't know that.
  • 2:30 - 2:35
    They're responsible for 90% of the wild, wild
    plants,
  • 2:35 - 2:40
    and they're crazy hard workers. You know,
    one bee,
  • 2:40 - 2:43
    in its lifetime, is gonna gather 1/12th of
    a
  • 2:43 - 2:45
    teaspoon of honey. And that's all it's gonna
    do.
  • 2:45 - 2:48
    But it's gonna visit like, 50,000 flowers
    to do
  • 2:48 - 2:49
    that.
  • 2:49 - 2:53
    60-70% of all our food is because of bees.
  • 2:53 - 2:56
    Like, from the pollination they do, or they
    pollinate
  • 2:56 - 2:58
    the food that our food eats.
  • 2:58 - 3:01
    But, the really crappy thing is, the bees
    are
  • 3:01 - 3:06
    dying. And they're disappearing. And we don't
    know why.
  • 3:06 - 3:09
    And this is actually starting to become big
    news
  • 3:09 - 3:11
    and people are starting to cover it. Just
    last
  • 3:11 - 3:14
    fall, Time Magazine ran an article about,
    you know,
  • 3:14 - 3:16
    a world without bees and what the consequences
    are
  • 3:16 - 3:20
    if we don't start doing something, and, which
    directly
  • 3:20 - 3:25
    leads to what Herman is doing. He's researching
    this
  • 3:25 - 3:27
    thing called Colony Collapse Disorder.
  • 3:27 - 3:29
    And if you're not familiar with Colony Collapse
    Disorder,
  • 3:29 - 3:32
    basically what it is, is like, beehives and
    bee
  • 3:32 - 3:34
    colonies will suddenly just collapse and disappear.
    And for
  • 3:34 - 3:38
    no rhyme or reason. And it's, it's serious.
    Like,
  • 3:38 - 3:40
    for managed beehives, like that's beehives
    where there's like
  • 3:40 - 3:44
    a beekeeper watching them, about 35% of them
    have
  • 3:44 - 3:46
    just died out and vanished.
  • 3:46 - 3:49
    For wild bees, it's much, much worse. In some
  • 3:49 - 3:51
    areas of the country, 90% of the wild bees
  • 3:51 - 3:56
    are just gone. Like, Virginia, where I'm from,
    it's
  • 3:56 - 3:58
    about two-thirds. And it, like it's not just
    our
  • 3:58 - 4:01
    problem either. Like, it's happening in Europe.
    Like, they're
  • 4:01 - 4:04
    predicting in England, by 2018, all the bees
    are
  • 4:04 - 4:09
    gonna be gone. And that's, that's really serious.
  • 4:09 - 4:15
    Asia, same, same situation. India, India,
    it's particularly scary,
  • 4:15 - 4:17
    because in India, 90% of the pollination of
    honey
  • 4:17 - 4:21
    comes from a wild bee that they can't domesticate,
  • 4:21 - 4:22
    and as, like, as we know, it hits these
  • 4:22 - 4:26
    wild bees harder. So if those bees get hit,
  • 4:26 - 4:28
    India's gonna be devastated.
  • 4:28 - 4:30
    And so, you know, some of the, some of
  • 4:30 - 4:34
    the theories about what's causing Colony Collapse
    Disorder, maybe
  • 4:34 - 4:37
    it's pesticides. Maybe it's these two variety
    of mites
  • 4:37 - 4:40
    that the bees for some reason can't, can't
    clean
  • 4:40 - 4:44
    from themselves. Could be disease. Genetic
    factors. Like, we
  • 4:44 - 4:46
    just don't know. And it could be a combination
  • 4:46 - 4:47
    of any of these.
  • 4:47 - 4:49
    I have one of my own theories up there
  • 4:49 - 4:52
    that, unfortunately, isn't gaining any traction
    in the beekeeping
  • 4:52 - 4:55
    community. But, I'll let you guys try and
    figure
  • 4:55 - 4:58
    out which one it is.
  • 4:58 - 5:00
    And so, hearing all this from Herman, it's
    like,
  • 5:00 - 5:04
    hey, what can I do to help? And, and,
  • 5:04 - 5:06
    you know, Herman didn't, doesn't have any
    technical skills,
  • 5:06 - 5:07
    and, and so, but he told me, hey, I
  • 5:07 - 5:10
    already have some beehives at George Mason,
    and it
  • 5:10 - 5:12
    turns out they're up on top of a parking
  • 5:12 - 5:14
    garage, like.
  • 5:14 - 5:16
    And so up, five stories up, you can see
  • 5:16 - 5:20
    the top of another building nearby, and Herman
    said,
  • 5:20 - 5:22
    you know, he would love insight into these
    things.
  • 5:22 - 5:26
    Like, the hive temperature, because bees keep
    the temperature
  • 5:26 - 5:28
    in the hive constant, year round. Doesn't
    matter if
  • 5:28 - 5:31
    it's the middle of summer or middle of winter.
  • 5:31 - 5:33
    And, actually just in the last, last couple
    of
  • 5:33 - 5:35
    years, they found out that, you know, when
    they
  • 5:35 - 5:37
    pull these combs out of the beehive, and there's
  • 5:37 - 5:40
    the little holes in them, they always assume
    that
  • 5:40 - 5:41
    the bees hadn't gotten around to filling them
    with
  • 5:41 - 5:42
    honey.
  • 5:42 - 5:44
    But what they've learned is there's a special
    drone
  • 5:44 - 5:46
    bee that breaks its wings off and crawls into
  • 5:46 - 5:49
    those holes and just vibrates all day long
    to
  • 5:49 - 5:54
    generate heat. I guess that's a life.
  • 5:54 - 5:57
    But, so, and he also wanted hive weight, just
  • 5:57 - 5:59
    sort of to see the weight of the hive
  • 5:59 - 6:01
    changing over time. And then he wanted the
    outside
  • 6:02 - 6:04
    humidity and temperature just kind of as control,
    cause,
  • 6:04 - 6:07
    like, perhaps there'd be a week of really
    bad
  • 6:07 - 6:09
    weather, and so, like, that's why the weight
    wouldn't
  • 6:09 - 6:12
    go up. They'd be eating their stores.
  • 6:12 - 6:18
    And so, I was like, OK, so it, again,
  • 6:18 - 6:21
    looking at, at the situation, well, you know,
    the,
  • 6:21 - 6:22
    immediately, you know, we see there's some
    issues with
  • 6:22 - 6:25
    this. You know, like, it's open to the elements.
  • 6:25 - 6:28
    We don't have any power. Our budget was really
  • 6:28 - 6:30
    small. And we needed something that was really
    easy
  • 6:30 - 6:33
    to repair and maintain because most of the
    people
  • 6:33 - 6:34
    aren't very technical.
  • 6:34 - 6:36
    And so the first thing we handled was the
  • 6:36 - 6:39
    no power, like this was the low-hanging fruit,
    and
  • 6:39 - 6:44
    we did that simply by, by some solar panels,
  • 6:44 - 6:47
    a deep cell battery, and we had some off-grid
  • 6:47 - 6:50
    power. And we found that our solar panels
    and
  • 6:50 - 6:52
    battery could power our system for about seven
    to
  • 6:52 - 6:55
    nine days, when there wasn't any sun. And
    so
  • 6:55 - 6:56
    as long as we had sun at least once
  • 6:56 - 7:00
    a week, we were, we were good to go.
  • 7:00 - 7:01
    So the next thing was we had a limited
  • 7:01 - 7:04
    budget. And I, I think we started with less
  • 7:04 - 7:07
    than $200 or about $200, and this is how
  • 7:07 - 7:09
    things broke down, and, and why, you know,
    we
  • 7:09 - 7:11
    used Raspberry Pis cause we got the first
    three
  • 7:11 - 7:13
    free. Got a bunch of Raspberry Pi devices.
    You
  • 7:14 - 7:16
    know, some SD cards, cables, like, who doesn't
    have
  • 7:16 - 7:18
    a bunch of cables in their closet.
  • 7:18 - 7:21
    And you see the solar setup there was about
  • 7:21 - 7:23
    $140. That was about the bulk of our initial
  • 7:23 - 7:26
    costs. And you know, what I brought to the
  • 7:26 - 7:29
    table was this MacGiver-like ability to figure
    out solutions
  • 7:29 - 7:33
    to problems. And, you know, like in the, an
  • 7:33 - 7:36
    example of that is, when we built out, when
  • 7:36 - 7:38
    we put in our first temperature probe, we
    needed
  • 7:38 - 7:41
    to protect that probe somehow. And so, which
    led
  • 7:41 - 7:43
    me to, you know, to quickly come up with
  • 7:43 - 7:44
    a solution.
  • 7:44 - 7:47
    I ran to Student Health services, asked them
    if
  • 7:47 - 7:50
    I could get some condoms from them to cover
  • 7:50 - 7:53
    the probe, and they didn't even flinch. They
    handed
  • 7:53 - 7:54
    over a bunch of condoms.
  • 7:54 - 7:56
    But it really made me realize that these,
    these
  • 7:56 - 7:59
    people in Campus Health Services have seen
    everything, because
  • 7:59 - 8:01
    when I walked in there, I was kind of
  • 8:01 - 8:02
    dirty, cause I was outside working, and I
    was
  • 8:02 - 8:07
    carrying duct tape and rope. And, and they
    didn't
  • 8:07 - 8:10
    even flinch. They just handed over a handful
    of
  • 8:10 - 8:11
    condoms, so.
  • 8:11 - 8:16
    So, like, this wasn't perfect. But we had
    a
  • 8:16 - 8:17
    start. And I plugged in Twitter so we could
  • 8:17 - 8:19
    get, you know, social media going, and some
    Tweets
  • 8:19 - 8:23
    from the beehive. And so our, our initial
    results
  • 8:23 - 8:28
    were, we had a Tweeting beehive. In the picture
  • 8:28 - 8:30
    you can't really see, and it's Tweeting hey,
    it's
  • 8:30 - 8:32
    78 degrees in the hive. And the little picture
  • 8:32 - 8:34
    of the bee yard.
  • 8:34 - 8:37
    And, and we're going. And one of the interesting
  • 8:37 - 8:42
    things is once you're out on social media,
    people,
  • 8:42 - 8:43
    I guess, they assume you know a lot about
  • 8:43 - 8:46
    bees and they start contacting you. And one
    of
  • 8:46 - 8:48
    the people to contact us, send us a direct
  • 8:48 - 8:49
    message, was just like, hey, how do I get
  • 8:49 - 8:52
    my dog to stop eating bees?
  • 8:52 - 8:54
    You'd think eating the bees would probably
    be enough
  • 8:54 - 8:58
    of a lesson. But, but you know, I, I,
  • 8:58 - 9:00
    I Googled, and it turns out lots of dogs
  • 9:00 - 9:04
    like to eat bees, and you know, little dogs,
  • 9:04 - 9:10
    medium-sized dogs. And even big dogs.
  • 9:10 - 9:14
    So, so before I go any further, who's, who's
  • 9:14 - 9:15
    familiar with this acronym?
  • 9:15 - 9:19
    OK. Some of the people here. This is something
  • 9:19 - 9:23
    started by Bryan Liles. Maybe five, six years
    ago.
  • 9:23 - 9:27
    It means test all the fudging time. I always
  • 9:27 - 9:30
    get stuck up on the f. But you know,
  • 9:30 - 9:33
    no, no offense to Bryan, but he's wrong.
  • 9:33 - 9:37
    Really, what it should mean is try awesome
    things,
  • 9:37 - 9:41
    forget testing. Because, if you, because if
    you forget
  • 9:41 - 9:44
    testing, you can get results like this. It's
    currently
  • 9:44 - 9:48
    501 degrees in the hive.
  • 9:48 - 9:51
    And you think, oh, why is that valuable? Well,
  • 9:51 - 9:54
    it turns out that people, people find stuff
    like
  • 9:54 - 9:57
    this amusing. And suddenly, and, and you can't
    read
  • 9:57 - 10:01
    this, but suddenly we're getting reTweeted.
    City of Fairfax
  • 10:01 - 10:03
    is Tweeting us. And people are asking us,
    are
  • 10:03 - 10:05
    we raising fire bees? It, it, is the hive
  • 10:05 - 10:08
    on fire? Are things OK?
  • 10:08 - 10:12
    And, and, it's kind of amazing. Like, all
    these
  • 10:12 - 10:15
    Tweeting and reTweets and people getting in
    on the
  • 10:15 - 10:20
    joke suddenly, suddenly was our on Gundam
    style, just
  • 10:20 - 10:23
    making, make everyone aware what we're doing.
    And it
  • 10:23 - 10:25
    really made things happen fast. And it brought
    us
  • 10:25 - 10:29
    into the attention of the SweetVirginia foundation.
  • 10:29 - 10:32
    And what they are is they're a non-profit
    that
  • 10:32 - 10:36
    teaches honey, honey bee education to, to
    students and
  • 10:36 - 10:38
    adults. And, and they wanted to help. They
    didn't
  • 10:38 - 10:41
    know we were raising bees at George Mason.
    And
  • 10:41 - 10:44
    so they, they said, well, what can we do?
  • 10:44 - 10:46
    We can offer you space. And Herman wanted
    to,
  • 10:46 - 10:50
    to, to have a class of researchers, and we
  • 10:50 - 10:53
    didn't have the equipment which was, you know,
    one
  • 10:53 - 10:56
    of the biggest issues.
  • 10:56 - 10:59
    And so, so what we did, is we started
  • 10:59 - 11:02
    a crowd funding campaign, because it's gonna
    be about
  • 11:02 - 11:04
    a thousand dollars per student. And we, we
    raised
  • 11:04 - 11:07
    twelve thousand dollars, which was amazing,
    so we could
  • 11:07 - 11:10
    have a class of twelve. And the, actually
    there
  • 11:10 - 11:11
    was a waiting list of over a hundred students
  • 11:11 - 11:14
    trying to take part in this research.
  • 11:14 - 11:17
    But, so we had twelve, and then this, this
  • 11:17 - 11:22
    kickstarter campaign, sorry, Indiegogo campaign,
    also was like, another
  • 11:22 - 11:26
    big social media raising awareness for us,
    and so
  • 11:26 - 11:29
    suddenly, suddenly again, you know, people
    are becoming aware,
  • 11:29 - 11:34
    and bees just become crazy popular at, at
    George
  • 11:34 - 11:35
    Mason University.
  • 11:35 - 11:38
    And so the, the, one of the Fraternities is
  • 11:38 - 11:44
    starting a Bee Global campaign. The magazine,
    the alumni
  • 11:44 - 11:47
    magazine is all about bees. And this is the
  • 11:47 - 11:51
    president of George Mason with Herman, there,
    and, the
  • 11:51 - 11:53
    really amazing thing about the, you know,
    the president
  • 11:53 - 11:59
    getting involved is suddenly we have a budget.
  • 11:59 - 12:01
    And so now, now, which leads us into the
  • 12:01 - 12:04
    technology and the interesting stuff.
  • 12:04 - 12:07
    So, for anyone working with Raspberry Pi or
    is
  • 12:07 - 12:10
    unfamiliar with the Raspberry Pi, that's what
    this is.
  • 12:10 - 12:14
    It's a credit-card sized computer. Like, this
    is an
  • 12:14 - 12:17
    entire computer. And so I invite you to come
  • 12:17 - 12:19
    up after and look at it and play with
  • 12:19 - 12:20
    it. And if you want to come later, one
  • 12:20 - 12:23
    of the evenings, I'm probably gonna be hacking
    on
  • 12:23 - 12:24
    it and playing with it, and so I invite
  • 12:24 - 12:26
    you to seek me out later.
  • 12:26 - 12:28
    But if you are gonna work with Raspberry Pis,
  • 12:28 - 12:31
    some advice I'd give you is to, is to
  • 12:31 - 12:34
    backup your card often. Like, take an image
    of
  • 12:34 - 12:36
    it and don't, don't go the traditional dev-ops
    route,
  • 12:36 - 12:38
    where you know you're gonna install everything
    on there.
  • 12:38 - 12:40
    Cause if you've ever had to wait for, like,
  • 12:40 - 12:44
    Nokogiri to compile on your computer, Nokogiri
    compiling on
  • 12:44 - 12:48
    a Raspberry Pi is about sixty times as long.
  • 12:48 - 12:49
    So it's better just to have an image and
  • 12:49 - 12:52
    then, you know, copy that image. And, and
    buy
  • 12:52 - 12:55
    a couple, because they're cheap. They're $30
    computers that
  • 12:55 - 12:57
    are full computers.
  • 12:57 - 13:00
    So Raspberry Pis have these GPIO pins on them,
  • 13:00 - 13:03
    which is general purpose input output, and
    it's the
  • 13:03 - 13:05
    same kind of thing you have, if you've ever
  • 13:05 - 13:07
    opened up a desktop computer and look, looked
    at
  • 13:07 - 13:10
    how your hard drive plugs into the motherboard.
  • 13:10 - 13:11
    It's the same kind of thing. And there's these
  • 13:11 - 13:15
    pins, and to reference, this is with one of
  • 13:15 - 13:18
    the sensors plugged into one of my Pis. You
  • 13:18 - 13:21
    plug it in and you may see some tutorials
  • 13:21 - 13:23
    online if you're gonna do some of the stuff
  • 13:23 - 13:26
    that says, that says solder the wires right
    to
  • 13:26 - 13:29
    your Pi. Don't do that. Because if your, if
  • 13:29 - 13:31
    your Pi breaks or you don't know, it's easy
  • 13:31 - 13:34
    just to swap it out, take the Pi, throw
  • 13:34 - 13:36
    it away and plug it into the new one.
  • 13:36 - 13:38
    Or, I guess maybe not throw it away, cause
  • 13:38 - 13:40
    it might not be broke.
  • 13:40 - 13:41
    And so if you're gonna be working with Pis,
  • 13:41 - 13:43
    these are the three gems I'd recommend checking
    out.
  • 13:44 - 13:48
    There's the gpio gem, you know. pi_piper and
    wiringpi-ruby.
  • 13:48 - 13:50
    You know, I'm not gonna suggest which is best
  • 13:50 - 13:52
    of the three, cause they're all amazing and
    it's,
  • 13:52 - 13:55
    I guess it's my own, Sophie's choice.
  • 13:55 - 13:57
    But, so, as to saving the world with Ruby
  • 13:57 - 14:02
    and Rails, I lied. I'm actually using Ruby
    and
  • 14:02 - 14:05
    Sinatra. So I guess if you want to get
  • 14:05 - 14:11
    up and leave now, feel free.
  • 14:11 - 14:13
    So I, I went with the dashing gem. Originally
  • 14:13 - 14:16
    I was using, for creating a dashboard, I was
  • 14:16 - 14:18
    using the dashing Rails, but I, I realized,
    I
  • 14:18 - 14:22
    don't need all the, the complexity that Rails
    brings
  • 14:22 - 14:24
    to the table. Especially since we wanted the
    solution
  • 14:24 - 14:27
    that was simple for other beekeepers elsewhere
    to look
  • 14:27 - 14:29
    at and to use. And, you know, we don't
  • 14:29 - 14:32
    want to have to explain controllers and spitting
    out
  • 14:32 - 14:33
    JSON and all these kind of, all this kind
  • 14:33 - 14:36
    of stuff that they just, they don't need.
  • 14:36 - 14:38
    And so, and so using, working with dashing
    is
  • 14:38 - 14:41
    as simple as gem install dashing, and then
    dashing
  • 14:41 - 14:44
    new. Much like using Rails. And if you are
  • 14:44 - 14:46
    interesting in more about dashing, I suggest
    going to
  • 14:46 - 14:49
    RubyNation where Carl, Derante and Chris Mar?
    are giving
  • 14:49 - 14:53
    a talk on it, cause their talk is phenomenal.
  • 14:53 - 14:55
    But after doing this, you have a dashboard
    that
  • 14:55 - 14:57
    you can't see too well. But you can see
  • 14:57 - 14:59
    there's, we're using the green and the gold
    cause
  • 14:59 - 15:02
    that's George Mason's colors. But we have
    our internal
  • 15:02 - 15:07
    temperature, external temperature, internal
    humidity and outside humidity.
  • 15:07 - 15:10
    And if the numbers seem low for the temperature,
  • 15:10 - 15:14
    that's cause we're using Celsius. We're, I
    guess, cause,
  • 15:14 - 15:17
    we're not all on the imperial system. And
    that's
  • 15:17 - 15:21
    the weight in kilograms. And, and what this
    is,
  • 15:21 - 15:26
    is it's a, it's, it's being wirelessly served.
    So
  • 15:26 - 15:29
    you walk up to the beehive, open up your
  • 15:29 - 15:32
    laptop, connect to the beehive, and then navigate
    to
  • 15:32 - 15:34
    beehive dot local and then this pops up and
  • 15:34 - 15:39
    you can see the current statistics in the
    hive.
  • 15:39 - 15:40
    And how did we do this? And we did
  • 15:40 - 15:45
    this simply with a series of chron jobs. And,
  • 15:45 - 15:48
    if you're unfamiliar with how chron works,
    you, you,
  • 15:48 - 15:50
    the first one is running at zero and twelve
  • 15:50 - 15:53
    hours, so midnight, noon. Second one's running
    at midnight,
  • 15:53 - 15:57
    six AM, noon, six PM, and, and so forth.
  • 15:57 - 16:01
    And, and that's it. Like, three, three simple
    scripts
  • 16:01 - 16:04
    and it's gathering all our information.
  • 16:04 - 16:05
    And this is an example of one of our
  • 16:05 - 16:10
    scripts. So making a little, little, an instance
    of
  • 16:10 - 16:14
    our sensor, defining a couple of directories
    and, if
  • 16:14 - 16:17
    you see, directories are in the public, the
    public
  • 16:17 - 16:19
    folder, and the reason, again is just to sort
  • 16:19 - 16:21
    of keep it simple. If one of the researchers
  • 16:21 - 16:24
    wants to, to get access to the CSE file
  • 16:24 - 16:26
    when they're logged onto beehive dot local,
    they just
  • 16:26 - 16:29
    type in inhumid dot csv and it downloads to
  • 16:29 - 16:33
    their computer or their tablet or whatever
    they're using.
  • 16:33 - 16:35
    and it's as simple as just writing the humidity
  • 16:35 - 16:39
    and the temperature into two different CSV
    files and
  • 16:39 - 16:44
    that's it. And same thing for the outside.
    And
  • 16:44 - 16:45
    so you're probably thinking well, it's hard
    to get
  • 16:45 - 16:48
    it up on the dashboard. And, but, it's not.
  • 16:48 - 16:51
    Dashing makes this simple. Every thousand
    seconds I'm, I'm
  • 16:51 - 16:55
    opening up the, the CSV file and then sending
  • 16:55 - 16:56
    it to the dashboard.
  • 16:56 - 17:01
    And it's as simple as that. It's, you know.
  • 17:01 - 17:03
    Nothing too complicated.
  • 17:03 - 17:05
    And this is the, the Python code, but I'm
  • 17:05 - 17:08
    not gonna explain. It was, came with the scale,
  • 17:08 - 17:11
    so I didn't bother redoing it in Ruby. But
  • 17:11 - 17:14
    now that our scale's having issues I'm going
    to
  • 17:14 - 17:18
    work on a new solution with a RubyGem.
  • 17:18 - 17:19
    And the other thing we used is we used
  • 17:19 - 17:22
    Passenger. Just as for our server. We used
    a
  • 17:22 - 17:25
    couple LInux packagages for our, basically
    creating our wireless
  • 17:25 - 17:32
    access point. And the, a wireless, and DHCP
    server.
  • 17:32 - 17:33
    And that was it.
  • 17:33 - 17:35
    This is simple. And I think it's so simple
  • 17:35 - 17:38
    that anyone here can do it. Anyone who's been
  • 17:38 - 17:40
    doing Ruby on Rails for at least, least a
  • 17:40 - 17:44
    week, maybe two, like there's nothing to it.
    And
  • 17:44 - 17:46
    I want you all here to go out and
  • 17:46 - 17:51
    do stuff like this.
  • 17:51 - 17:54
    Because I think we're all amazing, and we,
    we
  • 17:54 - 17:59
    sometimes, we sometimes get this sense in
    our head
  • 17:59 - 18:01
    that, you know, we, we have all these problems
  • 18:01 - 18:04
    and we're living in this kind of ivory tower
  • 18:04 - 18:08
    that isn't really representative of, you know,
    the rest
  • 18:08 - 18:11
    of the, rest of the country. Like, we're kind
  • 18:11 - 18:12
    of the silk on valet mindset. It's like oh,
  • 18:12 - 18:14
    I gotta get my queuing speed down from point
  • 18:14 - 18:17
    six milliseconds to point five eight milliseconds,
    or I
  • 18:17 - 18:19
    have to, I have to get my tests to
  • 18:19 - 18:22
    run faster. Make DHH happy.
  • 18:22 - 18:25
    Or, you know, we have all these issues, but
  • 18:25 - 18:27
    you know the vast majority of people, like
    I
  • 18:27 - 18:30
    work in the, in a university, and I see
  • 18:30 - 18:33
    every day people emailing spreadsheets back
    and forth. They
  • 18:33 - 18:36
    email text files back and forth. And like
    all
  • 18:36 - 18:40
    these solutions that are just horrible. And
    really educators
  • 18:40 - 18:42
    they need our help. And they need us to
  • 18:42 - 18:45
    get involved in projects like this.
  • 18:45 - 18:47
    And it's super easy to get involved in these
  • 18:47 - 18:50
    kind of things. Like, I, I'm involved in three
  • 18:50 - 18:52
    projects right now and all of them I got
  • 18:52 - 18:54
    involved with just by going to see a Professor
  • 18:54 - 18:58
    talk and then after his talk or her talk
  • 18:58 - 19:01
    I, you know, I just asked them questions.
  • 19:01 - 19:03
    Cause, you know, professors, professors have
    bigger egos than
  • 19:03 - 19:06
    we do, as, as developers. They love to talk
  • 19:06 - 19:09
    about themselves. They do. And they love to
    talk
  • 19:09 - 19:11
    about their research. Like even more than
    we like
  • 19:11 - 19:12
    to talk about our code.
  • 19:12 - 19:15
    And so I know, I know you're thinking Sean
  • 19:15 - 19:20
    you dirty Canadian socialist, you know, like.
    Why, why
  • 19:20 - 19:23
    should I do this, you know? I don't want
  • 19:23 - 19:25
    to give my time for free. And I guess
  • 19:25 - 19:28
    like the simplest reason is, is I run a
  • 19:28 - 19:30
    Ruby meetup group, and one of the first questions
  • 19:30 - 19:33
    I'm, I'm generally asked my new people is,
    you
  • 19:33 - 19:36
    know, how can I get involved in opensource?
    Like,
  • 19:36 - 19:41
    like, cause, it, opensource seems like this,
    this goal
  • 19:41 - 19:43
    that you want. But you just don't know how
  • 19:43 - 19:48
    to get to, if you're new.
  • 19:48 - 19:50
    And And, you know, doing projects that like,
    projects
  • 19:50 - 19:52
    like this, it really is a, is an easy
  • 19:52 - 19:57
    gateway into opensource, and to, and to, you
    know,
  • 19:57 - 20:01
    getting opensource credentials on your, on
    your resume and
  • 20:01 - 20:04
    on your github. Because, you know, like it
    or
  • 20:04 - 20:06
    not, when we do apply for jobs, they do
  • 20:06 - 20:11
    look at what we do in the opensource community.
  • 20:11 - 20:17
    And can't really see this, but this is one
  • 20:17 - 20:19
    of the, the extra benefits of, of doing a
  • 20:19 - 20:25
    project like this, is, is all the puns. And
  • 20:25 - 20:27
    it's like, you know, you can't really see
    these
  • 20:27 - 20:29
    but I gave this talk last week and every
  • 20:29 - 20:32
    one of these are bee puns, like, hey, buzz
  • 20:32 - 20:34
    off pal! You know. Sean has a tendency to
  • 20:34 - 20:37
    wax on, and, what's the buzz about, and ooh
  • 20:37 - 20:41
    it's gonna be sweet. It's the bee's knees!
  • 20:41 - 20:43
    And so, so if this is the kind of
  • 20:43 - 20:46
    thing that interests you and, and you might
    want
  • 20:46 - 20:49
    to go out and get involved in, I'd really
  • 20:49 - 20:52
    like you to check out Ruby for Good, and
  • 20:52 - 20:54
    it's a conference we're gonna be putting on
    in
  • 20:54 - 20:58
    the Washington, DC area. The first to third
    of
  • 20:58 - 20:59
    August. We're gonna be staying in the Dorms
    at
  • 20:59 - 21:03
    the University. We're gonna hack on opensource
    social good
  • 21:03 - 21:05
    projects.
  • 21:05 - 21:08
    It's gonna be 72 people. We're aiming for
    $200
  • 21:08 - 21:12
    or less, and that's all inclusive of your
    lodging,
  • 21:12 - 21:14
    your food, everything. You just have to get
    their.
  • 21:14 - 21:16
    You're welcome to come a day early for no
  • 21:16 - 21:18
    extra cost and we're gonna probably do something
    fun
  • 21:18 - 21:21
    the day before. Maybe go do a nighttime tour
  • 21:21 - 21:24
    of the DC monuments or something. Not quite
    sure.
  • 21:24 - 21:26
    And, and also maybe to make it more appealing
  • 21:26 - 21:28
    for your work, we're gonna hold, we're gonna
    have
  • 21:28 - 21:30
    some training sessions on the second day.
    We have
  • 21:30 - 21:32
    one of the guys from the RSpec core team
  • 21:32 - 21:35
    coming out, gonna give a workshop on RSpec.
    We
  • 21:35 - 21:38
    have a guy giving a workshop on Angular. And
  • 21:38 - 21:40
    another one of the JSON API committers doing
    a
  • 21:40 - 21:43
    workshop on creating APIs.
  • 21:43 - 21:48
    And that's my talk in a nutshell. Thank you
  • 21:48 - 21:49
    so much for your time and are there any
  • 21:49 - 22:00
    questions?
Title:
RailsConf 2014 - Saving the World (Literally) with Ruby on Rails by Sean Marcia
Description:

more » « less
Duration:
26:45

English subtitles

Revisions