Podcast Lookup

Query Languages

Programming Throwdown

  • October 28, 2012
  • 1 h 28 min
  • Episode 20
Episode page
About this episodeThis show covers Query Languages, programming languages designed at accessing data from databases. Tools of the biweek: Pixen and Downcast…

This show covers Query Languages, programming languages designed at accessing data from databases. Tools of the biweek: Pixen and Downcast

★ Support this podcast on Patreon ★

Transcript

From the publisher

This transcript comes from the podcast’s own feed, shown as the publisher wrote it.

Query Languages

00:00—
  1. A

    Hosting provided by HostTornado. They offer website hosting packages, dedicated servers, and VPS solutions. HostT.net.

  2. B

    Programming Throwdown, Episode 20: Query Languages. Take it away, Jason. Hey, everybody. So,

  3. A

    I have a decidedly lack of knowledge in economics, right? I mean, when it comes to, like, real economics, like the equations that go behind it. Macroeconomics? Microeconomics? I think this would be called microeconomics. So, it's like the strategy behind why people do things. Like a little bit of game theory, like on the border there, right?

  4. B

    By the way, by the fact that you said that, I think you just contradicted your first statement. Really? I think that you've already shown, like, you were able to determine, like, what parts. And talk about game theory. Oh, I don't know anything about this. All right.

  5. A

    Go ahead. Well, let's see where the story is going. Okay. Basically, I, you know, they were talking about at work; they were talking about probability distribution functions and how, like, the distribution can change, and now priors and all these things that, like, I had no experience with. Yeah. Okay. So, but statistics in terms of economics, which is, you know, the study of rational people making decisions, right? Which is ultimately. Yeah, exactly. Which is ultimately what, you know, everyone's talking about. And I really felt like I was lacking. So, I looked up probability distribution function, probability mass function into book search, Google book search. And one of the first results was Economics for Dummies. Anyways. And so, I was like, well, and I read the few pages that it gives you of quota or whatever before you had to hit the paywall? Yeah, exactly. And I was like, oh, this is, you know, it's a Dummies book, but it actually is, you know, exactly what I want. It has covers everything. And being an Economics Dummy, I seem like the perfect, you know, audience for this book. But then I was like, you know, I want to read the book, but I need it, like, immediately. And so, I was going to order it on Amazon, things like that. But I really needed it, like, right now. I needed it basically in an hour. And I was at home. So, I decided to. Oh, you're

  6. B

    really wanting to show off to your friends at work, huh?

  7. A

    I must learn this overnight. I legitimately. I'm going to go to a bookstore.

  8. B

    And look for this. Sorry, go ahead.

  9. A

    So, I went on, you know, our good friends in Sweden who sail the pirate ship. The story's getting worse. I did buy the book, everybody. So, the book is on order, but in the meantime. And then I thought, you know, so I looked for a Dummies book or whatever. And the first was 547 Dummies books. And it was like, 7 gig. And I was like, I got to get this, right? I mean, like, anytime you see like a giant corpus or something. I'm facepalming. Just for people who can't see. People who can't see. Patrick is just completely buried in this shit. I am not condoning this behavior at all, Jason. No, do not do this. You have a friend who did this. You did not start the story correctly. That's right. You knew of this horrible, immoral friend. My mate Dave. Don't use names. So, among the books, these are real books that are printed. I think Addison-Wesley publishes them for Dummies. There is Pimping for Dummies, a real book. No, I'm not kidding. A real book: Pimping for Dummies. But there's also like France for Dummies, you know, et cetera. There's tons of these Dummies books: Electronics for Dummies, Quantum Mechanics for Dummies, Pregnancy for Dummies. Like, that one's probably not necessary, you know. Pregnancy for Dummies should be an empty book, right? But I found one that really resonated.

  10. B

    Yeah, so I'm pretty sure this is not true. I mean, this is a fake book: Pimping for Dummies. This is not real.

  11. A

    Oh, well, they did it in the style of the Dummies. So, somebody must have injected—somebody faked it or whatever. Somebody injected. I can actually send you this PDF. No.

  12. B

    I don't want to be a part of this. No, don't do that. I'm stating now for the record, but the record show.

  13. A

    The record clearly states Patrick does not want the Pimping. All right, I'm going to look for it on Amazon. If it's not Amazon, it's not real. Okay, someone must have injected this book. But basically, I found there's Hacking for Dummies. Oh, nice. Which is apparently related to Pimping for Dummies. A little bit of everything for Dummies. Oh, the little bit of everything is pretty awesome. It's actually chapters taken from other Dummies books. And seriously, like, click on that. The first chapter is, like, DOS commands, and the second one is dating.

  14. B

    Or something. Check this out. Do you have a one? Okay.

  15. A

    Anyways, I'll keep going. Look inside. So, the one that—here, let's take a look. Let's keep talking. Okay. So, the one that really resonated for me amongst all 500 of them was Negotiating for Dummies. For some reason, I really—I guess it's because we had actually been talking about negotiating just coincidentally. I mean, some friends the day before. And so, I started flipping through this book, and I honestly had very low expectations. I mean, first of all, I didn't really expect to get a whole like Economics for Dummies. Like, for you to be interested in economics, you have to be a little bit of a geek, right? So, the Dummies is sort of like a paradox. But in the case of Negotiating for Dummies, I really thought there would be just really dumb, low-level, like, you know, Luddite negotiating for Luddites, right? But it actually was phenomenal. It starts off; the very first section is, you know, for you to be able to negotiate, you have to have, like, a sense of direction in your life and you have to sort of like know where you're going. And that kind of made sense. It's like if you're just getting sort of carried along by life and you don't really have—like, you don't have like a direction or something you want to go to, then it's hard for you to really negotiate anything.

  16. B

    So, it didn't start with anchoring or 'don't be the first one to say your goal.' So, yeah,

  17. A

    it is exactly right. It didn't start with any of that. It started with, like, evaluate your life. And that kind of threw me for a loop. Is this another fake book? No, this is totally true. Then it got into Pimp—no, I'm kidding. But then, no, it got into it. And so, it explained cases where, so, for example, the, you know, don't make the first move, right? It said, oh, you know, a lot of people know this, but they accidentally make the first move anyways. And they gave an example. Like, let's say you interviewed for a job or you're applying for a job. They'll say, 'You know, put your current pay at your current job.' Just leave it blank. Yeah, you don't have to put that. Just put nothing. But then they'll ask you—but you just say, 'Oh, no, thank you.' Yeah, you just say, 'Look, that information is private.' You know, because by saying what you made your current job, you're effectively making the first move. Like, they can guess at like a percentage increase of your current salary. But not to be off track, that's already somewhat—not

  18. B

    making a first move is hard. Because, like, if you go to a car dealership, you've made the first move. You showed up at the car dealership. You've already tipped your hand that you're interested in buying that car. As much as you want to feign disinterest—I might buy this car or I might not. You spent your time and money you're not working to go to this place and talk to this person. You've tipped your hand. Or interviewing for a job. If you've bothered to fill out an application form where they had these things, you're already showing that you're somewhat interested. So you've already tipped your hand at some point. But I guess the point is don't tip it more than you have to. Like, be careful about your information.

  19. A

    And you might, you know, you might be willing to work at a place but only for salary X, right? And then they have no way of knowing that. There's that part of it too, right? So if you give your current pay—let's say you give your current pay—they figure like 99.99% of people would take double their pay. So, like, that's already information that they know that they wouldn't have known if you didn't put that pay, right? So this is really interesting. They also covered two things which I thought were really important. One is set limits before you start anything. So before you start negotiating, set a lower and an upper bound, if appropriate. So, you know, clearly you don't want to set an upper bound on your pay. It doesn't make any sense, right? But, you know, set a lower bound, right? Or an upper bound on the price of a car, et cetera. Sometimes you need to send a lower and upper bound. Or it could be multidimensional negotiation. You should set bounds on all dimensions and then stick to those the whole way through and remind yourself why you set those. You know, don't let yourself get caught up in the context of the negotiation that like, you slip on your bounds, right? The other thing is based on the gravity of the decision: at every step take a certain amount of time. Like, regardless of any external pressure. So, for example, if you're buying a car.

  20. B

    Yeah, they don't like that, by the way.

  21. A

    No, no. So these are things that the people you're negotiating with will hate you for. But these really matter. So if you're buying a car, a car might be—let's say like maybe a year of your salary, right? Or like six months of your salary or some X amount, right? Like, so at least take three days or two days every time there's, you know, some shift in the negotiation. Take three days and think about it. Yeah, that seems long. I mean,

  22. B

    Basically, so, like, when I bought my last car, what happened was we negotiated. We got to a good price or whatever. I said, I'm going to go have dinner.

  23. A

    Yeah, yeah. I did not like that answer. Like, no, I'm

  24. B

    going to put you in it now. Like, the car's going to sell. Like, all this stuff, right? And I'm like, maybe it will. I'm like, I'm going to go buy dinner and eat dinner. And I'm going to come back. And he's like, no, no, no. And I'm like, fine. Like, whatever you say. Like, I'm not. And then he tried to lower the price, right? Like, oh, it was great. Like, I'm writing this down.

  25. A

    I'm like, okay, this is a lower price. Yeah, yeah.

  26. B

    You know, and then, but then I did. I went to dinner and ate about it. Talk about it. Think about it. Clear your head. Be away from the high pressure, and then go back. You know, and then just.

  27. A

    Just a real-world example. So, obviously, this was before I read the books. It was years ago. But when I went to buy my wife's engagement ring, you know, I looked at a bunch of different, which is

  28. B

    three years salary. No, it's like three months or something, right?

  29. A

    Anyways. Oh, yeah, yeah, you're right. Yeah, if my wife is listening, several years of salary. So, so. Well, infinite. If you're making no money because you're in school, it's very easy. Oh, that's true. Good point. Right? So, you know, I looked at a bunch of rings and I said, you know, I did the right thing, which is to think, you know, spend a couple of days and think about it. And over the course of a couple of days, I realized that I wasn't making a good purchase. Like, I had buyer's remorse, but without buying, right? And so then I went back in sort of with a clear head all over again. And I ended up saving, I think it was like $2,000 or $3,000. It was like significant, you know? So. Yeah, yeah. It's pretty when you're buying a million-dollar ring. So. Hi,

  30. B

    Lindsay. So.

  31. A

    Patrick, you don't see me sliding money over to Patrick right now. I'm putting twenties in his pocket consistently. So. But, yeah, the book was Negotiating for Dummies. I wouldn't say it's the best negotiating book because it's the only one I've read. So. But in general, think about negotiating, knowing how to negotiate. Very

  32. B

    Important. That's good advice. So did you learn about economics?

  33. A

    No, of course. I was reading about negotiation. No.

  34. B

    I did. There are a lot of good economics books. It used to be I have like a—I like learning new things. So I'm constantly changing what I'm interested in. So I was interested in economics for a while. So I did do some amount of online coursework type stuff. You know, I took Microeconomics in college. Yeah. And read some books. There's like Freakonomics was popular.

  35. A

    Oh, yeah. I remember that. That's

  36. B

    kind of like short stories. It's really easy to read. It won't teach you about all of economics. Yeah. But some of the kind of that rational thinking, how that doesn't always lead you where you think.

  37. A

    Yeah. There's other

  38. B

    books as well. So there's a lot of good books out there about that.

  39. A

    Yeah. So, I mean, to answer the question, I, you know, had to study like Bayesian probabilities and things like that. You keep saying statistical things though. Yeah. But I think that there's a high correlation, right? Yeah. I mean, there's a lot of overlap.

  40. B

    I guess when you say economics, I think more of like even Microeconomics, right? The supply and demand and,

  41. A

    you

  42. B

    know, pricing

  43. A

    and elasticity or inelasticity. So, yeah. Right.

  44. B

    I mean, those are like, I don't mean like the statistics are important as well. And I'm sure economists have to be very strong mathematicians for the most part, you know? But I just tend to think more of those, or like you said, behavioral aspects.

  45. A

    versus, you know, it sounds

  46. B

    like you approach it for much more of a quantitative.

  47. A

    Yeah, exactly. Yeah. So I needed it for like, for like some very specific things, like with respect to like, you know, equations I was using at work and things like that. And so I think that like, you know, Statistics for Dummies probably would have been even better, but I don't think that exists. No, no, no. Not down to your choice. It just, economics is interesting. But yeah, yeah. So, I mean, I am interested in the other. Actually, one thing which I happen to skim across was a Dutch book. Have you heard of this? Or is this like one of the things? Like the language? No. So a Dutch book is when you can set up a set of bets in such a way where you make money regardless of the outcome. So, for example, let's say like you're willing to pay me $3 to 1, 3 to 1 odds if Obama wins the election. And I find someone else who's willing to pay $3 to 1 if...

  48. B

    Mitt Romney?

  49. A

    Mitt Romney. I didn't know what you were doing. Okay. You forgot the name. Mitt Romney wins the election. It shows how much I'm interested in politics, right? But so if I have two people who are each willing to pay $3 to 1 odds... This is a bookie.

  50. B

    This is, I mean, the whole goal of like a Las Vegas casino in a way. Well, no, no,

  51. A

    no. Not so much a Las Vegas casino, but a sports book.

  52. B

    Or like a bookie. It's the whole idea, right? Like he

  53. A

    tries... Well, sometimes he'll front the money, but a lot of times... I don't know. I don't know that much about it. Never having gone to one.

  54. B

    Yeah. I mean, I think the idea is they try to pair up people, right? Like they try to... Essentially, we're betting against each other, but they get a cut. Gotcha. For kind of like matching us or whatever, but...

  55. A

    But yeah, if you do have this Dutch book, so you have these two people, as I mentioned, you can... It's in your interest to bet infinite money to both people, right? Because... Yes. Like let's say you bet $1,000. You're going to lose, right? Because there's two choices, and you're betting $1,000 on both choices. So you're betting $2,000 total. One of those $1,000 you'll lose, and you'll get nothing. The other $1,000 you'll win, and you'll get $3,000. So you'll go from having $2,000 to $3,000 in your pocket.

  56. B

    I guess as long as if you don't have the whole problem of not being able to pay one guy before you get your other

  57. A

    rewards. No, assume that you have the $2,000 up front, and you're just...

  58. B

    It'll be infinite money, and then you owe infinite money.

  59. A

    Yeah.

  60. B

    So... You get infinite knees broken, because you can't pay your infinite money. And then it doesn't matter that you have infinite new money, because you're laying dead on a street.

  61. A

    Maybe you're one of those like carrion beetles, which have like a million legs or whatever. And by the time they break them all, you already have your double infinite money. Oh,

  62. B

    Okay. But this sounds like arbitrage. Yeah.

  63. A

    I mean, that's the whole idea of arbitrage, right? A Dutch book is a situation where you can do betting arbitrage and come out ahead with 100% chance of success.

  64. B

    This is the whole race to do high-frequency trading and underground. New ways of running the cables and fiber optics and microwave towers to communicate between exchanges. Yeah. It's essentially exactly what you said. I know the price in one place, and I know that price is different in another place. And I know in two seconds those prices are going to line back up. But in the meantime, in those two seconds, I can buy a whole bunch from one and sell to the other. And essentially, as much stuff as I can transfer between the two before they catch up, I make money.

  65. A

    Yeah, exactly. But I, in that

  66. B

    process, actually make them catch up. And so I make them catch up faster than they would have before. Right? Exactly. Because somebody else would have been arbitraging them before, and they're slower, and I'm faster. Yeah. So I get that money instead of them. Totally.

  67. A

    Totally. And then we can... Did you hear about this guy? I was a real-world sidetrack. Okay, sorry. He worked for Goldman Sachs. He was doing exactly this. So they work on this... Actually, they do this high-frequency trading, but it's a lot of, like, heuristics. They use decision trees and machine learning and stuff to figure out, like, what to buy and sell and everything. He took his algorithms, and he tried to, like, spin off his own company, you know, using these algorithms he developed at Goldman Sachs. I think we talked about this, dude. Oh, yeah, we did. On the show. He went to jail and everything.

  68. B

    Yeah, yeah. Wow. So that guy... So we should probably insert what episode number that was, but I don't remember what it was.

  69. A

    Yeah. Keep going. If you're watching all the episodes back to back to back, then you've just heard this conversation. But anyways, for us, it's been years. But... For years. But, yeah. So, yeah, so the economics thing was interesting. The negotiation was very interesting. And in general, Dummies books are better than I thought. I mean, you know, they have such a negative connotation, right? Dummies. Yeah, yeah. It's like... I guess there's some people who like the idea of being a dummy. Yeah, so that was episode two. Oh, wow. Python. It has been a really long time.

  70. B

    Former Goldman Sachs employee jailed eight years for stealing code.

  71. A

    Yeah. That was... That's been... Is that two years ago or one year ago? Oh, I don't know. Here, here. Anyways.

  72. B

    This was March 18th, and I didn't write the year.

  73. A

    It was before years.

  74. B

    Eleven. Wow. No. It's

  75. A

    like five billion years.

  76. B

    So that was a year and six months ago.

  77. A

    Gotcha, gotcha. Cool. But yeah, so Dummies books, pretty cool. Especially Negotiating for Dummies. Economics, pretty cool. Economics, good stuff. Arbitrage, pretty cool. Yeah. Go in jail, not cool. No, don't go to jail. Don't go to jail. Not hot, either.

  78. B

    Okay. On to our news of the week. The first article is one I put... So this is a research paper that I thought was pretty cool. Mostly just because of the cool video, I'm not going to lie. It's the equivalent of a cat video, but for programmers, I guess. Nice. And this was somebody... The title was The Floating Point Game of Life, the first headline I saw. But I guess the actual article was something like Continuous Conway's Game of Life or some much more impressive sounding research paper. Just to give you a little bit of hype, a little moment, hype to

  79. A

    say, both of us looked at this article independently and we immediately wanted to talk about it. I mean, it's amazing, right? I was first. Yeah. So I arbitraged it. Yeah. I win! There's like a Dutch book where we're both trying to find articles. We were trying

  80. B

    to find other people to bet

  81. A

    against that? We would have this in this... No, okay.

  82. B

    So what this was is in Conway's Game of Life, now, if you don't recall it by name, is a square grid of squares and each square

  83. A

    can either

  84. B

    be occupied or unoccupied. Right? So alive or dead, essentially. And by a simple set of rules about how many neighbors a cell—that neighbor a cell up, down, left, right. Up, left, down, left. So nine connectivity or

  85. A

    whatever it's called? Eight diagonal neighbors or whatever. Right.

  86. B

    So depending on how many of those cells are occupied means that the cell will either become dead from overcrowding, will stay alive if it's in the middle numbers, or if the cell is already dead and there's enough, it will become alive.

  87. A

    Right.

  88. B

    And so just this simple set of rules—and I forget the exact numbers for each—but having this simple set of rules, you can kind of start with a few, three or four little squares that are alive. And they can just go on for, you know, like very, very long amounts of time of having this behavior: things growing and exploding and colliding into each other. I mean, we've all, I think, seen these before at one point or another. And so... the gliders, right? There's

  89. A

    like gliders. There's blinkers. It takes advantage of the fact that like when you set a cell on, it's not really on in the current state. Because you have a, you basically have like a current state and a future state.

  90. B

    And the future state is independent of each cell; each cell is independent of one another. Right? Except in their reliance on the previous state.

  91. A

    Right. And then, so you calculate the future state for all the cells, and then you flip. The future state becomes the current state. Right? And because of that whole process, because of that two-stage process, you end up, yeah, with these gliders that are just sort of like... Well, there's all sorts of

  92. B

    people made like adding machines. Yeah. People have made like self-replicating ones.

  93. A

    I think someone proved it was Turing complete or something. I don't know.

  94. B

    I don't know. Or you probably designed a Turing complete machine in it is my guess. Right? So there's, you know, it's really a lot of research goes on in there. And it's a cellular automata. Yeah. That's the name. So the cells. So somebody came up with a research paper where instead of treating it as a discrete square-based grid for these things—I think time is still discrete just like we described, but space is continuous. So each cell, each thing that's alive or dead, is an infinitesimally small point. And then it has a neighborhood, which is some radius of circle around it. Right? And then essentially created a computer to approximate that by using anti-aliasing and, you know, floating point numbers and, you know, various things to try to come up with that. And so there's a video that we posted the article, which is seemed very technical and complete and only

  95. A

    semi-interesting because I'm not that much into research. But the YouTube video is really cool. You guys got to see. And even the song on the YouTube video is

  96. B

    awesome. Jason was rocking out to the

  97. A

    song. I was totally jammed out. I listened to it without the music on. So I didn't even know it had music. I was doing the Numa Numa dance. It was pretty epic. Hands were waving. I don't even know what that was. What did it say? That's that Maya. Eee. Maya. Ah. And it's that guy. He's like, 'Okay.' I still don't know what it

  98. B

    is. And for those of you not watching, Jason attempted to dance. It was pretty

  99. A

    embarrassing. It was pretty bad. Yeah. There's a lot of empty chairs in this room. So

  100. B

    Yeah, pretty interesting. You should check it out. But people found the equivalent of gliders. But instead of only like I think four directions of the traditional gliders, this glider can go in any direction.

  101. A

    Yeah, totally. There's

  102. B

    like pairs of gliders that orbit around each other, and like these weird, like snake support pillars.

  103. A

    Things. Yeah, that was crazy. Yeah, that's interesting. You should check it out. Yeah, it's totally awesome. I think it's a phenomenal idea. It's one of these, like I can't believe I didn't think of it kind of things. It's like such an awesome idea. And to think that we went, the Game of Life has been around for what, 50 years? A long time. Yeah. We recently had the 50-year anniversary. Oh no, it was 1970. So actually it is close to 50 years. You're not quite 50.

  104. B

    You're a little early.

  105. A

    Yeah, a little early. But yeah, totally awesome. So.

  106. B

    Oh, here's, here's in Minecraft, somebody built Conway's Game of Life. Do people do everything in Minecraft? No, I have to watch this

  107. A

    video. Did you see that the Game of Life was actually in the search? Did you see that? No, no, no. Or was it just me? Do the search again.

  108. B

    Okay, hang on, hang on. I'm watching the video. Oh yeah, yeah. Here, we see you made an amazing thing.

  109. A

    Oh, it is. Wow, somebody made Conway's Game of Life in Minecraft. But no, when you had the search results, that's exactly what you expected.

  110. B

    to look like. When you

  111. A

    Had the search results, it actually looked like there was Game of Life going. Oh, in like the background or something? In the background. But I might have just been looking that up. Oh, yeah. Yeah, yeah. Yeah, that's pretty cool. So, my article is not as cool, unfortunately. I kind of, you know, I wish I could do, you know, crazy continuous integration, ream and some Game of Life thing with floating point. But I think it's still pretty cool. So, Twitter bought a company called Clutch.io. And Clutch.io does A-B testing for mobile. And I'll get into A-B testing in a minute. But Twitter was fortuitous, or we are fortuitous, or something. I don't know where you're going. It is fortuitous. Yes, that Twitter open sourced the Clutch.io library for everyone to use. So, what is A-B testing? Patrick. What is A-B testing? Thank you.

  112. B

    Jason, tell me. I've heard this term before, and I just can't figure out what it means. Could you help me? A-B testing for dummies. Let me look.

  113. A

    So, A-B testing comes from alpha-beta testing. And alpha-beta is a type of distribution. First two letters of

  114. B

    the Greek alphabet?

  115. A

    That's true, too. But alpha-beta is a type

  116. B

    of... Ab-improving muscle training for

  117. A

    dummies. Alpha-beta is a type of probability distribution. And it might be that if you read Economics for Dummies, it would go into what alpha-beta filters are. But anyways, so alpha-beta testing, super important if really, I mean, you're in any type of industry. And the idea is you have your alpha, which is sort of your control group. Then you have beta, which is some new feature. So, for example, you might have... Let's say your website is cars that you're trying to sell or something like that. So, you might have an alpha group, which has your website as it exists now. Then you might have a beta group where you randomly throw in high-priced cars. So, it's like, oh, I search for Volvo. I search for whatever. But I'm going to randomly throw in something which kind of matches the search result, but also, like, more expensive. And the idea is, like, maybe you make a commission off expensive cars, right? So, even, like, you know, so your alpha version, like I said, gives the users exactly what they want. The beta version gives them what they want, but also throws in some of these expensive cars. Then you can look at the results of both of these independently. And you can see, oh, you know, when people got to the beta version of the website, they did spend more money and they bought more expensive cars, but they never came back or something like that. And so, it's like, well, long-term, this is going to hurt my business, so I need to stick with my alpha version. Even though it says alpha, beta, in reality, you can split many different ways. So, you could have, you know, eight changes, and now you have two to the eight different versions of your website. There's a 256 different versions of your website. And you can, you know, sort of isolate which version is the best, like which features helped, which features hurt. So, this sounds easy. It's actually really hard. I mean, one of the things that makes it hard is being consistent. So, you have to find some way to know, okay, Patrick visits my site. He's getting the B version of the site. A week later, when he comes back, he needs to get the same B version. Like, if every time you refresh the page, you get either one version or the other, that's going to be really confusing, and it's going to pollute, you know, your experiment. So, A-B testing frameworks for the web, or in this case for mobile, sort of deal with that, and they hash users in such a way where they, you know, they keep it consistent. They give good reporting and all that good stuff. So, if you do any development, you want to be using an A-B testing. And if you're doing mobile, you should check out this one open source by Twitter.

  118. B

    That's cool. Yeah. I mean, it's a lot of people doing, especially e-commerce, like if you sell something, right, A-B testing is really important. Yeah, definitely. Is it the red buy button or the green buy button better? Yeah, exactly. You know, you could guess, but in reality, it's better to try to test.

  119. A

    Yeah, totally. Actually, I heard from a friend of mine who works at a startup who was telling me of another startup that makes Facebook games. And they had this one Facebook game that was like a fish. It was like an aquarium, and like you pay real money to like get food for your aquarium or whatever. And they weren't doing alpha beta testing. They added this feature where basically you could buy something that you couldn't buy before. So, there was something before that you could only get through experience in the game, right? It was like maybe like your fish could grow up or something. And all of a sudden, they added this thing where you could pay like a dollar and have adult fish immediately. I don't know. I'm making this up, but you get the idea. Like they added some monetization strategy that wasn't there. And everybody left. Like it compromised everything. And I think for some reason, it's like people felt like having an adult fish was like a rite of passage almost. And by making it to where you could pay like essentially trivial amount of money for something that took hundreds of hours of real like effort to do before. It like ruined the entire game. And actually, the company literally went out of business.

  120. B

    People say that about the new Diablo because you can play the game and get a really good artifact, a sword or whatever. I don't remember the name. And then sell it on the internal auction house and make money. That like it becomes like almost like a job. Like you want to play because you want to, you know, get this thing so you can make more money by selling it. And some people have said that's ruined. Other people have said it's great. You can make money. And then but it is true. I think it's hard to do A-B testing though with something like that because when you're rolling it out to like things that are natural. It's actually shared or social or community driven. If you A-B test, I don't know that that works. Yeah, that's actually so you could A-B test like the sign-up page or something. But like the actual thing like if I give you free fish and I don't get free fish like or, you know, Sally doesn't get free fish. Like that's confusing.

  121. A

    So this is like a—this is a phenomenally interesting topic actually. So I know that the way I have—so I know the way that they do this right now is actually through country. So I have another friend who works at a social startup. I have like a lot of social startup friends. This one, they actually test everything in Canada. So they do—for them to do—the way they do A/B testing is they do the B stuff in Canada. And of course there's skew there because Canadians probably have different—yeah. Well, this is

  122. B

    How like restaurants do. Like if you ever—I don't know if you've ever been to a restaurant when they're testing a new product or something. And they'll just like serve you a special product just there. Only that store has that feature. And then, you know, they see how people like it or not. Right? That's a little different than A/B testing because A/B is supposed to be kind of like completely independent. Like I'm picking random people across my whole entire population. That's true. And I'm giving them some feature and seeing if they react differently.

  123. A

    Yeah. I mean ideally—because you get all these other bugs. Like if

  124. B

    you do it in Canada, like oh, I'm randomly selecting everybody in Canada. Oh, okay. But you're introducing all sorts of biases. Yeah, totally.

  125. A

    I mean something that would be amazing would be if you like took your users—you know, let's say you're making some social app or whatever. Looked at the social structure. Like look at the structure of the relationships between those users and broke them up into like connected components to do A/B testing. That would be pretty awesome. I mean—so you can't be perfect because it will be like ultimately they'll always be these two people who are friends and are on different versions, right? Unless you literally have two disjoint communities. But like chances are you won't, right? Because people refer their friends and things like that. But maybe you could find these like pockets where, you know, there's very few connections out and you could A/B test. Like that could be the B pocket, you know.

  126. B

    Yeah, I think A/B testing I think is typically or maybe even fundamentally supposed to be small changes. Like minor things, not like large like features or something like the color of a button or the placement of something on the page or, you know, small stuff like that. So we've talked multiple—switching topics—talked

  127. A

    multiple times about just stating the obvious. That's

  128. B

    my new thing: State Obvious.

  129. A

    Things. All right, cool. So it's currently in the evening. You got that for

  130. B

    dummies? The 'State Obvious Things for Dummies'? Talking for Dummies? So Coursera is one of the online education platforms. And I actually happened to be involved in this. Oh, that sounds bad. I knew

  131. A

    that this had

  132. B

    happened before the news broke. So basically the inventor of the Scala language, which Scala we haven't talked about before, but is a functional programming language built on top of the Java Virtual Machine. And he is offering a functional programming class for free on Coursera. So I signed up for this class, you know, hoping dreams that I would have time to watch the videos and do the exercises. And pretty much like every other class I've taken online for free, I just have no motivation to actually do it. I get busy. But I got this email one day saying that basically they had detected cheating in this online course. Wow. And that so this is a couple of interesting things. One, it's a fully optional and free online course with no college credit, just like some email saying you complete this course is the only output. Why do you need to cheat?

  133. A

    Just be like me. Just don't do anything. It doesn't really like I don't Must be resume padding or something, right? I don't like it doesn't have a lot of value for a

  134. B

    resume at this point. Like maybe one day it will, I guess. But then just don't take it now. Like I don't you know, and there's no association. Like it's just your email, right? So you could just change use a different email next time or whatever. Like I don't think it's a super big deal. But people were still cheating. They had basically posted solutions to some of the programming problems online. And this is kind of confusing slash also disheartening. And so they said that, oh, we've tried to identify the people who did this. You know, we're going to, you know, basically block them. We're going to kind of like give zeros to the people or I forget exactly the action they were going to take. But people like submitted assignments that were exact copies of the online known ones. And then like, oh, they're going to have the TAs basically looking online for, you know, solutions to pop up. Because arguably most people just find this by Google searching. Like, oh, folks are permanent class. Oh, here's a form. Oh, look, here's the answers. How nice. But it does bring up an interesting thing that like again, this is a free class. Like no but people still like feel compelled to cheat and like try to get around doing real work, which is kind of sad. Did the article go into why people cheat? Well, no. I mean, nobody knows, right? Like you can't you can make guesses or psychologists or whatever. But I mean, the other thing is like if my question is just like I guess maybe different. Maybe because the stakes are higher. I don't know. But like if you go to university. So nobody ever talks about like cheating at university. Sometimes they do talk

  135. A

    about cheating at university level. There was somebody in my lab. So many PhD students, they are also TAs, right, for classes. That's sort of what pays the bills while you're in grad school. Or he actually wrote a program to do like semantic analysis of your code, like to generate the tree, the call tree and all that. And he somehow was able to write a program to detect copies. And then he just ran it on all N squared pairs of, you know, students' assignments and found out groups of them like, you know, these nine people all have exactly the same answer. And so I think it's possible. So, okay, so I'm not saying it's not possible to detect the cheating.

  136. B

    I'm just saying like there's a lot of high stakes. Like if people are cheating in online free classes with like basically low stakes and now the stakes are higher. You've paid money to take this class. It is going on your resume. Are you going to graduate in time? Like the bar to like fail is so much higher. So arguably maybe people don't want to cheat because if you get caught cheating, like it's much more damaging. But it's an interesting question. And there have been cases like recently of kids cheating in high school, like taking SAT tests for each other. Oh, really? Yeah. And people doing electronic cheating. Oh, I could have put this article in here. I was reading this article the other day about somebody cheating in chess and just like, oh.

  137. A

    Did we talk about that last time? I don't

  138. B

    remember. I don't think so. Yeah. Yeah. So like there was a kid basically using like a PDA. So they have some specific model of PDA, which I'm not very familiar with chess competitively. Whatever competitive chess associate has like a specific model of PDA that runs a specific app that's allowed. Oh. And it's to keep notes. So it's very traditional when you play chess that you keep notes about all the moves of the game. So you can analyze it later or like analyze, you know, famous chess masters games. Like these kinds of things. And so they said, well, we'll just let these people use this app on this specific, you know, PDA, not like an iPhone or something general. And that app's developer has promised like, oh, it locks everything out. It's the only app they can be running. We don't allow multitasking. We turn off all the Wi-Fi, everything, right? Like it's all turned off. But there's now the ability for even these small devices to run, you know, very high quality chess engines, right? So they don't know exactly what happened. But all of a sudden this kid who was really bad started doing really good. And like somebody came over and noticed him doing something fishy with his device. But they didn't confiscate it. They didn't look at it. They didn't like just kind of let it go. So they don't have any like clue about kind of what to do. But it kind of brought into this like, oh, people cheating at chess, you know. But like brings in this general like electronic cheating. Like other people have been found with like little tiny like speakers in their ears, like really hidden ones down in their ears. Getting told chess moves with somebody else basically doing it on a laptop, right?

  139. A

    And like playing

  140. B

    the opponent's moves and then letting the, you know, computer. Like all these things, like all these, you know, high tech cheating now is going to be a real problem. Like how to detect it, to deal with it, to stop it. That's really interesting. So, yeah, I don't know. So, I mean, like you said, one thing is like you can compare. So, they do this for research paper or not research but like.

  141. A

    Oh, yeah, Turnitin, right?

  142. B

    Yeah, there's like various services where basically you upload or all your students upload their research papers. Right. But not like PhD

  143. A

    research papers. For people who don't know, Turnitin.com is a website. Like many TAs and teachers use it. Basically, it's this huge repository of, you know, research papers. I think it just scans like tons of things like Minds, Google Scholar and like all these things. And basically it looks for, so then when you submit an assignment, it looks for plagiarism. So, it looks for plagiarism between you and other research papers. Right.

  144. B

    And also you from like, like it has repositories of books and articles and web pages and like all this stuff. And so, it'll show like, oh, this whole section is matched. And, you know, whether or not like it's annotated or footnoted or quoted or whatever. So, basically give you a score of how likely it is this person cheated or how much they cheated. Right. But then for like code, it's actually fairly straightforward. So, for words, it's pretty hard. Like you'd have to restate it. But if you're going to take time to restate a whole paper and like change all the words around so it still makes good English sense but, you know, is different enough, like you might as well just write the research paper from scratch. It's kind of a lot of work because you have to understand the material, which is arguably the point anyways. But for a programming assignment, you can just, for instance, like rename all the variables. Yeah. And then it would be very hard to detect that in this. So, you say like, you know, you knew this person who wrote like analyze the tree. So, we're going to have to go to stuff like that. But then people are going to know that's the case. So, then they'll have a—they'll add an extra function or something.

  145. A

    They'll add a

  146. B

    program that—yeah, add an extra function or add a program that permutes, you know, like alters the function calling or, you know, adds extra extraneous ones that don't matter. Right. And then it'll just be this cat and mouse game.

  147. A

    Yeah, totally. It always ends up like an arms race. Like all this stuff, like spam, finding spam, you know, botnets, like stopping down botnets. It always ends up like some arms race where like you figure out a way to filter it and then they figure out a way to get around the filter and then it keeps going. Yeah. This will be another one of those. Yeah. So, actually, I saw an interesting TED Talk on cheating. This was a while ago, like three or four years ago. But one of the cool things was everybody has sort of like an internal—I don't know what to call it. But like basically—so, the example he gave was in one case if you cheated, there was a way for you to cheat but there wasn't a large gain. In the other case, there was a way for you to cheat and the gain was larger. And it turns out like a lot more people cheated. Oh, and the thing I didn't explain: in both cases, it was trivial to cheat and you knew you weren't going to get caught. So, you know, a robot, you know, just a naive—like, you know, math model of this would just say there's no chance of getting caught. There's no implications. I should cheat regardless of, you know, of the gain. But the reality is people have this like internal inertia against cheating or like an internal karma system. But if the reward is big enough, they'll cheat. And I thought that was really interesting.

  148. B

    It would have been more interesting if they had actually cheated when the stakes were less. Like somehow being worried that when the stakes are higher that the penalty would be somehow implicitly higher.

  149. A

    Oh, yeah. But the way the experiment was structured, it was obvious that there was no penalty. Yeah, like completely obvious. But, yeah, that's interesting too. Because what you described seems rational. Like, okay.

  150. B

    So, like if there's no chance of getting caught, right, and people will cheat. But if the stakes aren't that big, like what does it matter? Like, I'm just not going to cheat. Yeah, I guess that's true.

  151. A

    I mean, it's interesting. But not to

  152. B

    bash on your

  153. A

    video. No, no, I just, it's interesting. It's sort of like cheating has like a weight to it. It's sort of like if there's not a lot of gain, then I don't want like the bad karma of cheating. It's basically, that's what I took away from it. But the same guy had this interesting thing where if you're given three choices and all three are of roughly like the same quality, or maybe you don't even know their quality. But, or no, sorry, I got it wrong. You have two choices. They're both of the same quality. Now you introduce a third choice that is Pareto dominated, which means it's worse in every way, to one of the two choices. People will pick the choice that's better than that third choice. So, for example, if I have like, like, if there's like girls trying, because, you know, we do programming throwdown. There's constantly girls asking us for our numbers. Face bombing again. So if me and Patrick are at a bar.

  154. B

    Dude, I just made all these nice things to you, right?

  155. A

    Now you're totally going to lose it all. So if me and Patrick are at a bar, and let's say like just if two of us were at a bar, we'd have an equal chance of getting picked up. If you introduce a slightly like uglier—I'm not condoning this conversation. I don't even know if I want to let you go forward. No, no, just like finish. If you introduce like a slightly uglier, like slightly, like, I don't know, more disheveled version of Patrick, the chances of girls picking Patrick over me goes up dramatically, and even though Patrick hasn't changed.

  156. B

    Yes. Oh, yeah, yeah. I've heard.

  157. A

    It. And so, and he actually, this is.

  158. B

    It's because it gives you, it gives you an anchor. You say, 'Oh, at least I know this choice is better than that choice.'

  159. A

    Yeah. And it has something to do with like the brain cannot like evaluate things like high-dimensional spaces, but like it can see that like this thing is better than that. It's ranking.

  160. B

    At least you can rank those. Like it's very difficult to rank an apple versus an orange, right? But if I put in another apple that's, you know, like decayed, it's like, 'Oh, at least I could take the good-looking apple.'

  161. A

    Yeah.

  162. B

    Exactly. It looks better than the decayed apple. Yeah. But I have no idea how to compare the apple and the orange, right? The same thing with houses. You just assume.

  163. A

    There's a really

  164. B

    big problem with houses. Oh. This is the whole comparable thing when you buy a house. Sorry, we're getting off track here. No, no. But yeah. So like when you go to buy a house, it's very difficult to compare houses in different neighborhoods. So people tend to really quickly focus on one neighborhood and try to rank houses because then they can somehow rationalize the price.

  165. A

    Even though that

  166. B

    price has no—it's just whatever you'll pay for it, right? Like whenever the seller is willing to sell it to you. But it's very difficult for people to keep the search very large and open because it's very difficult to compare something that's a far commute but very cheap and a very close commute but very expensive. Yeah, exactly. Like that comparison is very difficult.

  167. A

    If you have to factor in, like, oh, if I live here the schools are bad, I'll have to pay for private school and like factor in like 20 or 30 different variables at each house, and like you can't—your brain just cannot do that. And so, yeah, what will end up happening is you'll look at two houses. One will be better than the other in some obvious way, like completely dominate the other one. And then your brain will make the mental leap as to say that house is better than average because it's better than this one. Something like that.

  168. B

    Yeah. Yeah, yeah. All right. This is wild. We got to move on. We are very talkative tonight.

  169. A

    Tool of the buy week. Tool of the buy week. My tool of the buy week is Pixen. I don't know if I—I think I mentioned this earlier how I was getting into doing art as a hobby like pixel art, or maybe I just told you in private. But yeah, so I've been doing pixel art. I got one of those Wacom tablets and it's been pretty fun. Nice. Just drawing different things. And I've been using Pixen, and it's really a pretty cool tool. It's only on Mac, which is a total bummer. I think there's a Windows-like equivalent software that you can find. So this open source software doesn't run on Linux? This is not open source. I know. Wait, that's—Dagger in the heart. Yeah.

  170. B

    I'm normally the one who's the horrible.

  171. A

    Person for not—I'm a terrible person. But—wait, I got to.

  172. B

    Go change my now to something open source.

  173. A

    Let's capitalize. Let's capitalize. Go, go. So, yeah, people won't know which one of us is better unless you find an open-source software because there's just too many dimensions otherwise.

  174. B

    No one's presenting closed source as well, so now they can compare us.

  175. A

    But there's too many other things now. Oh! So, yeah, so Pixen does a lot of cool drawing. It will do like dithering and things like that. It'll let you look at the same object at multiple zoom levels simultaneously. Like it'll open like 10 windows where the object is zoomed in, zoomed out, regular. So—and for doing Pixen art, that's really important. Really cool app. Highly recommended if you have an app. Nice. My app is Downcast. Okay. Which is a fun play.

  176. B

    Of play on words. So we are a podcast, and this is a podcast app. So if you're not on iOS, you can stop listening for the next few minutes. But I happen to use an iPhone, and they updated to the new iOS, iOS 6. And they moved—podcast used to be part of like where all the music and stuff was too. It was just like kind of like a separate tab or separate screen. But now they moved it out into a separate app.

  177. A

    Oh. And that.

  178. B

    App is horrible. Oh. Horrible. Oh, that's the built-in app. Like it basically—like I almost—like I listen to a lot of podcasts. Like every day on my community, I listen to podcasts.

  179. A

    How can you get a podcast app wrong? I mean, what can you—

  180. B

    Well, so like just all the like functionality that it used to have, like I can't even begin to describe it. Like I need to—I've like so blocked it from my memory. I don't even remember what was so bad about it that I didn't like. And this wasn't like, oh, I read online and like people are outraged. No, I'm outraged. No, this was like literally like I didn't know it was coming. I went to the normal app to pull up my podcast, and it's like, 'Oh, your podcasts are now in this other app.' And I'm like, okay. So, you know, you have to go download that app if you don't have it. But I already did have it from earlier playing with it when it was an optional feature. And it looks like I actually deleted it. So I don't think I even have it. So I can recall. Well, so it's like, 'Oh, yeah, you know, you need to go delete it or you need to go download it if you don't have it.' And so I download it. And then it just like, 'Oh, no, I remember.' Like, so one thing was if you start playing a podcast, right? So I'm playing a podcast I've downloaded to the phone over a USB cable or on Wi-Fi while I'm at the house. And so like I'm driving in the car, right? And all of a sudden, so that episode finishes and it starts playing the next episode. I'm like, 'Oh, I didn't know I had that one downloaded.' Like, I guess I did. No. Guess what was streaming over the Internet the whole time I was driving to work? The next episode. Guess what my battery was like when I

  181. A

    got to work? Really?

  182. B

    Low. Oh, man. So that was a nice feature. And I'm sure I probably could have figured out how to disable it. And thankfully I don't have. So I'm not still on the unlimited plan because it's too long. So it doesn't really matter to me. And even then like the podcast wasn't huge. So it wouldn't have been a big deal. But the fact that like killed my battery just because of streaming. Yeah, yeah. And I mean, I guess it's a nice feature. But I really would like confirmation that that was what was going to happen. And just managing the subscriptions in it, like I just really didn't like it.

  183. A

    I was having trouble

  184. B

    figuring out what things I had downloaded to the phone that I

  185. A

    could just use. It downloaded the whole next episode. Like it didn't try to stream.

  186. B

    It didn't download it. It streamed it like over time. But that's actually worse. Like I would have rather to just download the whole thing at once.

  187. A

    Oh, yeah. You're right.

  188. B

    So now it's like, like keeps hitting it. Like I don't know which penalty is worse. I don't. But I didn't end up having it downloaded when I got to work. Like I only still had wherever I was in the stream.

  189. A

    Because if you had downloaded it all at home, then you would use Wi-Fi. Yeah. So that

  190. B

    wouldn't have been a big deal if I had like downloaded the Wi-Fi. It's versus I'm in the car and it's just on 3G. Exactly. Yeah, yeah. So anyways, Downcast is another app, which does basically the same thing. But worry

  191. A

    about it. Only it seems much nicer.

  192. B

    Nice. And maybe it's just because I got that one experience burned me so bad. I don't know. But looking later on the internet, it seems like a lot of people really don't like this app as well, this podcast app by Apple. So if you're looking for one, I recommend Podcasts. We're on there. Nice. A nice bonus feature is that when I look for, when I do a search for podcasts, I'm doing it right now to make sure this is still true. And I search Programming.

  193. A

    Okay. The very first result.

  194. B

    Here we go. Check it. I'm searching Programming.

  195. A

    Searching for Podcasts. Oh.

  196. B

    Whoa. Number one. Holy crap. Number one. It's amazing. So number two is Music for Programming. We're

  197. A

    number one. That's totally. Music for Programming. You guys have nothing on us.

  198. B

    So better than the iTunes Store, which ranks Programming, Programming, because it says Programming twice. Guys, if you listen to Programming, Programming people, I'm sorry. I don't know anything about you. No. I've never listened to your podcast. No, not at all.

  199. A

    But you get ranked ahead of us. And I think

  200. B

    it's because you just have Programming twice in a row. Yeah. So Programming Throwdown is number one when I search. I have no idea what ranking is you're using. It could be completely random. I don't care. It's amazing.

  201. A

    Programming Throwdown, which we'll, for now, forevermore, call Programming, Programming, Programming.

  202. B

    No, we shouldn't be mean. Those guys might be really nice. No, I'm sure they have

  203. A

    A great. Actually, the last

  204. B

    episode they uploaded

  205. A

    was in 2007. Oh, all the more reason for us to be ahead of them. So maybe,

  206. B

    it's just freshness. Although Music for Programming has an even more recent episode than us. Oh, wow. But anyways, we're ranked really well in this

  207. A

    app, which is just

  208. B

    a nice side benefit. But this one has things like it'll do the geofencing. So when I get home, it'll automatically refresh my podcast list and start downloading

  209. A

    anything new. Oh,

  210. B

    dude. Like once I get home.

  211. A

    That's a brilliant. I've never heard of any app doing this. Really? It's such a good idea, right? Okay.

  212. B

    Yeah. I guess I don't know. Oh, wait. No. So like the reminders from Apple does this. Why would it be Geo,

  213. A

    though? Why wouldn't it just wait for Wi-Fi or something?

  214. B

    Well, so for instance, like if I'm on the road, like I don't have access to charging. But once I'm home, like it's actually fairly easy for me to charge. And you can set

  215. A

    where it is. Like,

  216. B

    I can set home. I can set work. So at work, I have Wi-Fi as well. So I could do it at work.

  217. A

    But I just don't want to

  218. B

    do it in my car. And you can set it like leaving an area, which I don't exactly. But like arriving at an area. Wow. Between certain times, like it can check daily how many episodes to keep. You know, what to do with new episodes if you already have old episodes. It just seems very highly. You can set it to sleep after a certain amount of time. You can create playlists of podcasts. You can tell it like I do want you to stream ones I don't have downloaded or never do that. Anyway, it's much more configurable.

  219. A

    But the good side note is we're number one. Amazing. Amazing. That's all thanks to you guys, really. I mean, assuming that they're using, you know, voting and like stars. We're going to find out it's completely random and we're going to be completely deflated. But until then. Until then, it's all thanks to you guys out there, you know, giving us good feedback, making the show better. I mean, we take the feedback really seriously. Read all the email. We read all the feedback on iTunes.

  220. B

    Yeah, we're not always good about replying, but we do.

  221. A

    Read it all. We're getting better, though. I actually have the podcast throwdown at Gmail on my phone now. Oh,

  222. B

    Nice. So we

  223. A

    have 65 ratings now. Yeah, amazing. That's pretty good.

  224. B

    Yeah. And I think this is only in the United States. Like, I think it shows you localized results. Yeah, it says US. US. So I don't know, like, if people are

  225. A

    in other countries and want

  226. B

    to look, but like, I know we had an email from a listener in Germany. Yep. Yeah. So I think we had one from Brazil a couple weeks ago. Yep. So we've got listeners all over the place. Although you're saying beta earlier. People know we're in the US, right? Because it's Beta. Beta, yeah. Yeah. Is

  227. A

    Alpha still alpha?

  228. B

    Yeah. I think so. I don't know.

  229. A

    You know, what was?

  230. B

    That one word? But thank you all to interrupt your thinking of our listeners.

  231. A

    Thank you, guys. Back to London, I noticed that I say process, and the guys in London say process. That was the big one that, you know, because we're all nerds. We're clearly saying process a lot more than Beta. I guess because we are computer science nerds and not math nerds. Maybe. All right. Anyway,

  232. B

    65 reviews. That's pretty good. Like, there's a lot of well-known podcasts that have only 65.

  233. A

    Reviews or 50 reviews.

  234. B

    Yeah, totally. Totally. They have the same as this. No, I mean, but like,

  235. A

    We're doing pretty good. This is good, man. Yeah, I mean. We haven't

  236. B

    Checked our download

  237. A

    Count recently, I don't think. Have you? I haven't checked recently, but I can do that. But a lot of our, you know, more recent episodes have been based on user feedback. Like, someone suggested that we do that. Oh, that's true, yeah. Yeah, someone keeps suggesting we do like Ruby or JavaScript or query languages, et cetera, so databases. So, appreciate you guys' feedback.

  238. B

    Yep. And on that note about databases, we're on to the topic of the week, query languages.

  239. A

    Yes. Query. Query or query?

  240. B

    Oh man, I'm going to think about how I'm saying it. You ruined it.

  241. A

    For me. Query. Query. Query. Query eye for the straight guy.

  242. B

    Dude, I you're going to make me like have to edit you.

  243. A

    Out of the whole podcast. It's going to be Patrick only this time. Yeah. We're going to have to change the clean rating. Oh, I was going to mention that actually,

  244. B

    Because I was listening to another podcast, and they were talking about this. So, a little behind the scenes. What do they call it? Inside baseball.

  245. A

    Okay.

  246. B

    So, we do the whole show in one take. Yeah, totally. Like, we I like so I edit the show.

  247. A

    And we do one exception when our internet went out. But every other show, we've done it in one take. Yes, okay, yes, that's true. We've had one where

  248. B

    our internet went out. But every other time, we do it straight through once. And I hardly ever delete anything. Like, I think just once or twice. Like, I've deleted a section where one of us like coughed or something. But yeah, for the most part, we slap on the beginning part, the end part, listen to make sure good, and that's it.

  249. A

    So, it's like,

  250. B

    We do like this is totally raw. We don't edit to make it like us sound better. We're this terrible in real life. Like, we don't have

  251. A

    to be edited to sound worse. We could come to your school and talk, and we'd be this bad. That's like, we could.

  252. B

    do this in front of, like, oh, we'll talk about that in a minute. Yeah. All

  253. A

    Right. Hidden fun stuff. So, query languages. Stay till the end, everybody. So,

  254. B

    this is cut to the bone, the

  255. A

    meat of the situation.

  256. B

    What is the one everybody knows about?

  257. A

    SQL. SQL. That's right. It's so, people know about it so well, they've turned the acronym into like a word. Like, they've tried saying SQL.

  258. B

    So, on that, in C++, when I write C-O-U-T, how do you say that? C-O-U-T. Okay.

  259. A

    That's why I say it as well. But some people say COUT. Those people, I know people who say COUT. I don't want to generalize. Like, I don't want to sound. Okay. What about? What about P-R-I-N-T-F? Print F. Okay. This is the same as me.

  260. B

    This is. So, so,

  261. A

    so, the people I know who say COUT, it's because they, the people I know who say COUT, it's because they didn't grow up thinking of out as a word. Like, they know it's a word now, but like English isn't their first language. And so, they just look at the whole thing phonetically, whereas we're trained, because we knew English from the beginning, we're trained to see the out in the C-O.

  262. B

    But I kind of—like, no, like, people who—that's not true. Like, so I don't mean to generalize. Yeah. And I have nothing wrong if you say these aren't actual real words.

  263. A

    So, you know, like people were English-speaking since birth, you say COUT? Yeah.

  264. B

    And they're very defensive of it. Yeah. Really? Yeah. Like, and CIN instead of CN.

  265. A

    But I mean, clearly, you know, so just to refresh your little memory, COUT is when you want to stream things out to the console. In C. So, it's actually short for Console Out. That's why it's COUT. Oh, I didn't know that. I actually thought it was just C because it's a programming language.

  266. B

    This is C out as in C++. Well, but also it's a pair because it's always C out and C in. Like. Yeah. You know, so you see those right next to you. Right. So, I mean, the C part is common. Yeah. Console makes it. You just blew my

  267. A

    mind, dude. So, you can go back to that guy who says COUT and you can be like, listen, buddy. Yeah, that's what I'm going to do. I can beat up, dude, to your director.

  268. B

    Okay. Anyways, back on the topic: SQL. And now we pronounce it SQL.

  269. A

    Yeah. So, SQL is used to query databases primarily. So, you know, the canonical SQL is SELECT star FROM and then the database name. So, if I have an SQL database, which means a database that can be queried in SQL. Actually, I guess there are some other. Yeah.

  270. B

    So, I mean, we should talk about that. But SQL is as a language, right? So, first, as a caveat—we love caveats here. Totally. We don't condone this behavior, you know, whatever. We like caveats. It's like caviar, but cheaper.

  271. A

    There's like four facepalms.

  272. B

    So, the language of SQL or query languages in general can be distinct from their data that's underneath. Right? So, sometimes a translation is done from you can write a query in SQL, but a translation is done to some native query when it's executed or whatever. But SQL is just kind of like—it is very much like a programming language in that it can get compiled. It can get optimized. It can get not in the same way, but in a way. And it is distinct from the data that's underneath.

  273. A

    Yeah. So, for example, I did some work in C# a long time ago. So, this might not even be true anymore. But C# uses, we used T-SQL, like the Microsoft Transact-SQL. And there was this thing called a stored procedure. And what this was is you wrote this SQL code, but then it compiled it down into something that was like at a very low level, like in some low-level T-SQL instructions that could be executed really quickly. So, for example, if you wanted to get all the users in the database, you know, in pagination of 10 at a time. So, like the whole, you know, sending that command over the wire, you know, the text, and then like receiving it, you know, in the database and then processing it, that could take time. So, this stored procedure was a way of doing all that compilation beforehand. Yeah. Yeah.

  274. B

    Oh, and I actually didn't get good to my caveat before, but that we're not really talking about the backend system so much. We will. Right. And how they relate. But so, like the whole database administration is a very ripe field. And we are not, like, I don't know much about that at all. Me neither. So, querying the SQL, the query part, I mean, I'm not great at, but I understand the querying part. But the actual, like, administration and schema creation. So, schema being, we've talked before about things that define what the data is stored like. And so, this is another, you know, the schema kind of says, how are we storing the data? Right. And then query is written against the schema. So, you query the data that's stored in the way that the schema specifies.

  275. A

    Yeah. So, we're

  276. B

    not going to talk a lot about that stuff.

  277. A

    Yeah. We won't get into B-trees or, like, how databases work. I mean, that stuff gets really ugly. So, yeah.

  278. B

    But, yeah. So, like, the queries are written against the language. And I think it's an interesting point. So, kind of like when people go through learning about programming and not necessarily like at college, but like in an early stage. A lot of times your first thing is, like, you write very code that just kind of runs. It doesn't store anything. And then you need to store something. Like, oh, I want to remember something. Or somebody chooses something and I want to remember that. Or I want to write some output. So, you typically write to a file on disk or whatever. And you just learn to read and write files. But then when you move up from that and you want to have multiple users and store lots of data, right? So, you begin to look like, how am I going to do that? Well, you can write, like, structured data, like XML and write that to the disk. But I think the first kind of thing people encounter these databases is, like, the first thing that people interact with that's not on their computer. Right. So, you can. And we'll talk about it later. There are ways to run databases that are on your computer. But to be honest, if you're doing that, you don't need to know if it's on your computer or not. It doesn't matter. But at least in my case, and I think in many cases, the first time you're doing something between computers, multiple systems being involved, is talking to a database.

  279. A

    Yeah, definitely. Because

  280. B

    a database can run wherever. And it can be serving 100 people at once.

  281. A

    And invariably, you see people hit this wall. Like, they start off with just one text file with all their data. And then that becomes really slow. Like, you either have to read the whole file into memory or something. So, then you do something like, oh, you know, each row in the file will mean something. So, I can go straight to a specific row. Or maybe I'll have a file for each user. And I'll let the, like, directory structure work. But then what really kills you and where you really understand, oh, I need to get a database in SQL, is when you run into needing secondary keys. So, in other words, let's say I have, like, a... Well,

  282. B

    so, say what a key is.

  283. A

    Oh, yeah. So, you know, data in a database is stored in some type of aggregate structure. So, in the case of, like, MySQL, which is a database, they store things in tables, right? And so, a key would be the element that you almost, that you typically want to use to look up a row in a database. So, it's usually unique. So, for example, if I have a database of people's names and how much money they've spent on my company, I could use someone's name as the key. But there might be two John Smiths, right? And so, that wouldn't work because they would collide. So, I might just have, every time a new user shows up, I give them a new number. So, the first user gets one. The second user ever to the system gets two, so on and so forth. And that becomes my key. So, as long as, like, Patrick's in the system, I sort of keep around that, oh, Patrick is 21543. And I can go and say, get me the payments for 21453. Get me the, you know, expenditures. Get me, like, what emails I've sent them. And you use this key to sort of get all that data. That's the primary key. But then you'll end up running into situations where you need, like, get me everybody who's bought this product. So, I need to go through all the data. And I need to look at, like, a column that isn't the key. So, I need to go through all the users, all the primary keys, look up their information, pull out the secondary key, or pull out this other column, see if it's equal. And then, you know, that would involve going through the entire database, right? So, if you have secondary keys, you could think of that as sort of little mini databases. It doesn't have all the data. It just has sort of pointers to the main database. So, for example, the primary key might be the user ID. And so, I have this map, which maps, like, 2, 4, 5, whatever, to Patrick. But then, I'll have this secondary key that maps, like, bought economics for dummies to Patrick and Jason and these other five people, right? And so, whenever you update one row, like, if a new person, if Jim buys economics for dummies, now you have to update the row connected to that primary key where your real data is. And you have to update that secondary key. You have to add Jim to the list of the people who bought that. And

  284. B

    If you have to do that, that's annoying. That's terrible.

  285. A

    Yeah. And so, doing all that is a nightmare. So, that's what, yeah, exactly. The database will do all that good stuff for you. And you just write SQL. SQL. And so, you almost got there, but not quite. Oh, okay. But

  286. B

    introduced the relational part of a database. So, SQL is a relational database. And we've heard a lot of things. We're going to talk about a little bit about what a relational database is and moving away from that. But that wasn't originally. Originally, the case, it wasn't relational. Oh, really? Yeah. So, before relational databases, they just weren't. They

  287. A

    just weren't just flat.

  288. B

    So, then we introduced relational databases, which, do you want to talk about what the feature of that is? No, you go for

  289. A

    it. All right. My throat's sore. Aw.

  290. B

    So, yeah. So, we introduced the concept of a relational database. And this is what we know today. And it seems like, in hindsight, like, oh, this seems intuitive or whatever. But Jason introduced the notion of a key. So, a key can uniquely identify a row in your table, right? So, you think of rows and columns. So, rows being different entities and columns, you know, attributes of that entity. Or there's various ways of talking about it. And we're not experts. We're probably not using the right words. But that's okay. So, relational says, oh, okay, I have that key. So, Jason talked about, let's call it an identifier, an ID. So, my user ID is whatever that number you said. And so, that can identify a table that lists my name. But why do I also have to have the table that says what I bought there? Because I might have bought multiple things. And how do I—that gets confusing now because the database runs most efficiently if, you know, there is a key that identifies everything. Like, uniquely identifies each row so that, you know, it's very fast and efficient to look it up when you provide that key. Because it knows exactly the one place where it is. Yep, yep. And so, multiple things could be combined to form a key. But in the case where I bought multiple things, you might have to use, like, a date. But I don't—it's not really convenient for me to look up things that Patrick has bought by date. So, I have his unique identifier. I can look up his name. Oh, that's Patrick. Okay. Now, I look at the things he bought. Well, I can list one thing there. But when he buys a new one, do I just overwrite this? And this is the problem before relational databases. This becomes inefficient.

  291. A

    You end up with, like, a column that has to store, like, a list of things in it. Right. Or multiple

  292. B

    rows. And then that's inefficient because it's essentially collisions in your map.

  293. A

    Right.

  294. B

    If you think about it, right? So, the relational database was introduced. And that was, this table relates to this other table. So, now I have the unique identifier that points to the entry that is names and addresses. Right? Because people only, let's assume, for simplicity's sake initially, only have one name and address. But then I have another one that is things that that user has bought. Right? And then that's, you know, some other. So, it uses the same key, User ID. But then maybe it has, like, User ID and something else. Like, just another ID, like, purchase ID or whatever. Right? Something else. And then I can link those things together. And what's called a—so that's a relationship. So, I define the relationship. You know, like, oh, this thing relates to this thing. And this, wait, oh, that's too many things. And I'm probably doing a terrible job of describing this. But that's

  295. A

    okay. No, no, it's good. So,

  296. B

    They relate. And then the other concept that you get to immediately once you do that is joining data from one table to another.

  297. A

    Right.

  298. B

    So, you have the secondary keys, like Jason talked. You have the primary keys. You have what's called a foreign key. So, like, this key also references this other table. So, it's a foreign key to that table.

  299. A

    Oh, I see. You also have another thing that we haven't touched on now is you have indexes, indices.

  300. B

    Right, which is how you do these efficient lookups.

  301. A

    Yeah, yeah, which is all sort of things you do behind the scenes. But in SQL, you can actually, if you're writing SQL to select from a particular column, if that column is indexed, it'll go much faster. Yes. And then it'll actually be used to sort of optimize your database if it's used often enough.

  302. B

    So, anyway, so it gets into joins. And so, this is the thing that gets into the meat of, you know, SQL programming is doing these joins and then also subqueries. So, I want to run some query, get some results, you know, and then I want to essentially query that query. Right? So I restrict the data set to some set, and then I want to query that restricted set for further information.

  303. A

    Yeah, one kind of interesting thing about SQL is SQL reads from tables, but it returns a table. So, for example, if you say select user ID and name from the user's table, what you will get out of that select is a table. And as Patrick said, that table sits somewhere in memory or in some kind of, like, cache on disk or something. But, like, you can then run, like, these nested SELECT statements where it's, like, take this table that I just selected and select something else from it. Yeah, so it's a pretty brilliant language. And then

  304. B

    When you're doing join between multiple tables, you're essentially building up a new table that has added information in it. So, you're adding to the columns, essentially, of this returned table.

  305. A

    Yep.

  306. B

    And then that gets into, now we get into, like, everybody, you know, has these complex queries that they build to do these really specific things. That seem kind of like, oh, this is so frustrating. Why is it not working? Why is my query not returning what I need? But if you had to do, like, what Jason was describing in the beginning, you'd be far worse off.

  307. A

    Yeah, totally. Yeah, definitely. So, you know, there's so much crazy magic behind databases. And it's just... It's a research topic, actually. Yeah.

  308. B

    Like, optimizing and how to run the back end, the database engine—the thing that is storing these data and executing these queries and optimizing them. And...

  309. A

    Yeah. And I mean, you know, no matter how little data you think you have, I mean, if you have hundreds of thousands or millions of records, you've got to be using a database. I mean, if you want to have any kind of reasonable turnaround time, you know, it doesn't take a lot of data for you to get to the point where it's like, oh, I have to use a database. And then you're running into using SQL or something like that. So,

  310. B

    We hear that term today, big data. Yeah. So, I mean, from your example, like, big is relative, I guess. Yeah. You start with, like, small data. It's just in a file. And it's bigger data. Like, you know, I want to have a larger data set. And SQL really can handle that. But then you get to, like, big data, which is the buzzword recently. But that's even, like, so if your data just grows and grows and grows, eventually it takes longer and longer and longer to run these queries over all the columns and look for things. Then you can't index everything because the indexes would get too big. And so, you have to go through every row looking for, you know, things that match that query. And that's when we begin to introduce other things that are used. Oh, so, like, you know, for running these and, like, we talk about Hadoop's, like, MapReduce. Yeah. And, you know, oh, we want to do these things because that data is too big. The traditional SQL databases can't handle it. It would just, like, it would just be really, really hard. Yeah. And a lot, but a lot of time is spent. Like, SQL did scale way further than probably people thought it would. Yeah, totally. So, you know, so millions of people querying it per second, you know, millions of queries per second. I guess that's a good amount, like, queries per second, I think that's a typical, you know, parameter that they measure by. So, like, you know, just, like, how many people are querying at the same time? And that's another thing that's an advantage of not having a file is that you and I can share this data out in the cloud.

  311. A

    Yeah, no one's locked the file or anything.

  312. B

    Yeah, we can. And then we'll talk about it later. But, you know, then what happens when we want to write, not just read? Like, how do you handle that? Well, if you have only one file, it becomes problematic. But if we share a database, it handles that for us.

  313. A

    Yeah, totally, totally. And, you know, the other thing is you might want to instrument your program. So, in other words, while your server is running, giving data to your users, providing data, you might want to write another program that sort of looks at the server every now and then and says, 'Hey, what's going on?' Right? So, you know, SQL is a lot of these databases have, like, web interfaces where you can write SQL in. Like, for example, mySQL database has phpMyAdmin, which is this PHP server that you run on the same machine as the database. And then actually it doesn't even have to be on the same machine. But you run this PHP server. You go to this website that the server is running on. And you can actually look at your data as it's changing. So, if this was on a file system, like, you'd have to, like, lock the file. Users wouldn't be able to do anything. And then you look at some data. And then you unlock it. It's just not practical, right?

  314. B

    So, SQL is not the only thing that people use. There are other things as well, many of them.

  315. A

    Yeah. So, what?

  316. B

    is another one?

  317. A

    Another one is Sparkle. So, this is for semantic webs. So, this is a little bit different. The idea here is if you have a semantic web of information. So, the idea is you have a set of entities. And then you have information on the connection between the entities. So, for example, let's say you had all of Facebook's data. And so, each node was, like, a person. And then the connections between them also information. Like, these two people are in a relationship or married or friends or not friends. They used to be friends and now they're not friends. That could mean something, right? So, whenever you have, like, this what's called semantic web, but you have, like, information that's sort of stored in this way, Sparkle is sort of a query language that's really good for dealing with this. So, there's plenty of other types of query languages. And there's other

  318. B

    things that are different. Like, each kind of database engine tends to have, like, a slightly different version of SQL.

  319. A

    Yeah, that's true. Certain commands that you think are part of the language but aren't and are custom.

  320. B

    And how to do these, you know, the management stuff can be very different.

  321. A

    Yeah, even, like, sometimes getting the current time. Like, you might want to do just programmatic things which aren't really related to your database. Like, you might want to say, for example, get me all the users in the past month. Well, you have to know what 30 days or what a month from today was. Or you need to

  322. B

    know what today is.

  323. A

    Yeah. You need to know what,

  324. B

    the concept of a day.

  325. A

    Is. So, a lot of those functions, like, either the names are a little different. They've tried to standardize it and it's a lot better now than it was, you know, a decade ago. But, yeah, there's still all sorts of nuances there.

  326. B

    So, breezing through some of the rest of our traditional structure of grammar language, because I kind of covered it. Like, we talked about interfacing for multiple systems. Transactional, I alluded to this and didn't exactly talk about it. But if Jason and I are both trying to write data, or Jason's trying to write and I'm trying to read, you know, like, how is that handled, you know? And

  327. A

    that's a very complicated thing. Yeah, I'm sorry to interrupt, but it's being able to roll back. So, the idea is, like, if me and Patrick both, let's say there's one product left on Amazon's shelf. Like, there's Amazon selling Economics for Dummies and there's only one left. And we both go to buy it at the same time. So, it starts processing both of our transactions and then it charges Patrick's credit card. And, like, I'm halfway through the transaction. And then he buys the book. So, the problem

  328. B

    is multiple queries need to be bundled together in this transaction. Right? So, it's not just one query that each of us are running and it's just a race condition and one of us will get to it first. I mean, that is a problem. But even the worst problem is we need to do multiple queries. Right? Because I need to query your credit card. Then I need to write that I charged your credit card and tell something else to go charge your credit card. Then I need to go to the product once I've done that and deduct the amount by one or vice versa. But whatever, right? Like, I need to do this set of steps. And we both need to execute that set of steps. But we need some way of, like you said, rolling back so that if one of us can't fully complete it, then, you know, we undo everything that happened. Like, all the other rights that happened during that need to get undone. Yeah.

  329. A

    Exactly. Because you need

  330. B

    to go back to, like, none of them worked. Yeah. It's all or nothing. And that's what a transaction is. Totally. Yeah. And it's very needed. Very needed. And it has to, like, you have to know it's right.

  331. A

    Yeah. I mean, imagine how terrible this would be. I mean, like, you would end up with your credit card would get charged, right, as something came out of stock. You know what I mean? Like, this could be just a complete disaster if it wasn't implemented right.

  332. B

    And we didn't talk about it yet, but the ACID transactions. Oh, yeah. So, you know, this is a whole thing that is very popular to be talked about. And especially what we're going to talk about now about the NoSQL movement. And about, so SQL, when you try to go too far in one parameter, try to apply it to every use case, which is kind of what happened. And it was the tool, right? Yeah. And, you know, I'd say maybe early to mid-2000s, right? Like, that was the tool. Everything's database. Even before, people were using database. But around that time, we started to run into problems where people were kind of using it. And maybe it wasn't the best tool. And part of that is that a lot of these servers strive for ACID compliance, which is atomicity, which we talked about, like, being able to execute, you know, like, one instance in time, like, all those things. And it all works and nothing works.

  333. A

    I think I'm

  334. B

    getting it right. Consistency, right? So that things return the same for all of us. We don't get mixed results. And then that gets a problem, like, when you have sharding and stuff. Like, one server can't handle everybody, so I have to split it up. Yeah. You know, isolation and durability. Durability has to do, I think, with, like, surviving across reboots, right? So, like, if you get randomly rebooted, like, you know that you'll come back at the same time. Isolation. I'm not sure on that one. I'm not good.

  335. A

    Actually, I don't know either isolation. Oh, here you go. There's a little article on it. It ensures that the concurrent execution of transactions. Oh, I see. So isolation means that if there's, like, let's say there's, I'm trying to buy a book and Patrick's trying to buy a book. And let's say there really are two in stock. Let's not worry about the crazy corner case. The idea is if I buy and Patrick buys or he buys first or we both buy at the same time, the end result should be the same. Like, it shouldn't be such that I buy the book. I mean, you can imagine this going wrong, right? Let's say there's two books. And let's say there's two in stock. And the code says take the number in stock and then subtract one and then set that to the new number. Well, if we both hit it at the same time, we'll both see two. We'll both subtract one. And then we'll both store one in the database. And it really should have been zero. Yeah.

  336. B

    Yeah. So this ACID thing is very useful.

  337. A

    And many systems really need this. Yeah.

  338. B

    But if you can do without one of these, you can begin to design something that's slightly different. It's not exactly the same as what you were used to. Yeah. But, like, consistency is a big one. So consistency is, like we talked about, if you have multiple things running, I can write to one. And consistency says if I write to instance zero, instance three, when Jason tries to read from it right after I write, also reflects the same thing. Right. But that's pretty hard to do. Yeah.

  339. A

    And it doesn't always have a future. Like, look at Twitter, for example. Right.

  340. B

    So you get the notion of eventual consistency. Yeah. So it doesn't matter in Twitter if Jason tweets. I don't mean to overstep. No, no. It's good. Jason tweets, right? It doesn't matter if I go to check and I don't see Jason's tweet. Yeah. It's the same millisecond he tweets. But I do want to see it within five seconds. Yeah. But five seconds is a lot longer than zero. Yeah. Totally. So if I get to eventual consistency, or maybe you don't even need consistency. If it's a game or something, maybe if you don't get it right away, it doesn't really matter. It's not a big deal. Totally. Possibly. So if you can begin to start to violate some of these rules, or you can do without transactions, or without the durability that, you know, like again, like if I'm running a game server, maybe some parts of it, like all the people currently in the world, I don't need that to be durable. If it crashes and comes back out, everybody just starts back at their home base.

  341. A

    Or if you're running like a chess server where you're hosting a bunch of chess games, and the server dies, and as a result of the server dying, all the people playing their games are lost. The reality is they'll just start new games, right? It's not going to be the end of the world. They'll

  342. B

    be upset. But you would want to make, but you might have different needs. So like the player's rank, that might want to be durable.

  343. A

    Right. And you might want

  344. B

    to use an SQL database for that. But then for just hosting the games, maybe it's really expensive to do all of those transactions against a database. So you might want to use something else. And these are the kinds of things that people began to deal with. And out came some of these things. Out came NoSQL. Yeah. So the NoSQL movement is kind of a, what do you call it, like a misnomer? Like it's

  345. A

    not exactly. Yeah, totally. It has nothing to do. So you still do. It's like counterculture.

  346. B

    Yeah. It's one of those terms that doesn't make a whole lot of sense. But what it's getting at is that in NoSQL, instead of having these relationships defined and doing these expensive joins and indices, it's really geared to doing point lookup. So I just need to look up some bit of data. Like I want to look up this specific information about JSON. And I want to just store, kind of going back to what we talked about, like a whole complex thing, maybe some JSON or maybe some XML. You know, something that's very structured. And I want to store all of that in one place. And I just want to pull it, look it up, and then I'll do some sort of analysis. And so, oh, I guess I'm skipping ahead. But running queries on that kind of thing is something slightly different. So if you're running on, let's say, Hadoop, you're going to run across, let's say you're going to run across analysis, everything, every

  347. A

    row in the database. Let's say you have, so there's like an object store database. And what this does is this stores like an entire, as Patrick said, entire JSON or XML string. And you can think of it as sort of key-value pairs. So there still is a primary key somewhere, like there's a user ID or something like that. And then the value is just this huge chunk of data. And the idea here is, you know, with SQL, it's really hard to do consistency across machines. I mean, you have to like take all your transactions, broadcast them. It's the N-squared problem, right? Like if you have five machines, every transaction, you know, that hits a machine then has to get spread to all the other five machines, right? So a different way of doing it would be, oh, let's have each of the machines just store a different amount of data. Like each of the machines store some part of the database. And then I can query all five of them, which, you know, that part is more expensive. But the idea is I could have like a thousand machines or 10,000 machines. They all are just storing bits and pieces of this database. And even though it's more expensive to do this whole query, you know, asking 10,000 machines to do something is always going to be way faster than having five, right? Well, you hope it's way faster. Well, I mean, yeah. I mean, in terms of this database stuff, yeah.

  348. B

    But I mean, especially like we're talking about for the point where you need to read every row. Right. And then you're going to do something, some manipulation of everything. SQL is not exactly meant like it. I mean, it can do that, I guess. I wouldn't say it's not meant for it. I mean, but that's not really the purpose. Right. So if I can store it somehow else or if I'm making updates and I only need to just update one specific thing, you know, and then when I read it, it's going to be in this manner. Or when I read it, I'm going to go pull the very specific row I need and it's got everything I need to it. Yeah. Then in some ways it's overkill to use SQL and you're sacrificing stuff by doing that.

  349. A

    Yeah, totally. Totally.

  350. B

    And so there are languages written with this in mind. So you have a NoSQL database or, you know, even like you're running in Hadoop and something and then there are languages written to help you write those queries so you don't have to necessarily write Java code that has to run at each stage of the pipeline. You can write this query and it'll generate the Java code for you. Yeah.

  351. A

    And I mean, a lot of these people, they're not dummies. They know that a lot of the people who work with databases are used to SQL. And so they made theirs, you know, in sort of the form of SQL. So one is HiveQL and that's part of the Apache Hive project. And so the idea is it'll go through a Hadoop database or rather not a Hadoop. Hadoop is sort of like a clustering platform. It'll go over a Hive database. And that's

  352. B

    like the file system, like the data storage layer. Yeah,

  353. A

    exactly. It'll go through a Hive database and it will, you know, do. So you could say things like select all of the documents where there is a, you know, in the JSON, there's a name key and that name key is equal to Patrick or something like that. And so it feels a lot like SQL, but it's querying a completely different data structure on the back end.

  354. B

    It is not really. I mean, those aren't really meant for real-time though. Like you're not serving something on a website, but that's something like batch processing. I wonder about some report or analysis.

  355. A

    And it's actually somewhat common for people to do a little bit of both. Like I've heard of cases where people have an SQL database up front, which has a lot of the indices and the support for like pulling individual records. But then they end up piping it out to some like Hadoop-based system or some cluster for doing like the heavy lifting. Like look at everybody and calculate the average amount spent and all these other statistics, standard deviation, things like that. Yeah, because you

  356. B

    don't want to make your users suffer when you're trying to run some report.

  357. A

    Yeah, exactly. That would be bad. Yeah, it used to be where you had two copies of your database. You had the one, you know, that was latent that was for doing your analysis. But, you know, as Patrick mentioned, SQL is not really designed for that. It's designed for serving. So if you're going to have two copies, it makes more sense for your second copy to be NoSQL. Yeah.

  358. B

    And so there are other tools related to all of this. So we talked about SQLite before. It's a tool of the week. So this is one that's an SQL database that runs locally and does write to a file on the back end that tries to make it more efficient up front. And there's MySQL, PostgreSQL. What is it? Oracle's? Oracle bought MySQL, but they have another SQL as well.

  359. A

    Yeah, Oracle also has BerkeleyDB. Okay. They own that. Microsoft has some kind

  360. B

    of like SQLite.

  361. A

    SQL Server. Yeah, yeah.

  362. B

    So there's, I mean, there's all sorts of tools. And there's tools for optimizing, running stuff in memory, making, you know, caching of queries.

  363. A

    Yeah. This kind of thing. Yeah, SQLite is a good one to sort of start with because you can always just delete the file and your database is gone. You don't have, like, some service running in the background or, like, you don't have to know SQL. And it's also easy to switch over

  364. B

    from executing it against your local one to a remote one.

  365. A

    Yeah. Totally. So you're not wasting a lot of time.

  366. B

    Yeah. And in some places, you know, pretty much everywhere on the web uses a database in some manner. But I mean, like even things like WordPress, right? All the articles that when you display on the back end—now there's some optimization that goes on, I'm sure. But all of those articles, that text is stored as some blob of text in a row in a database somewhere. And when you go to the web page, in theory, it's querying that database and getting the stories by date and showing them to you on the front page. When you go to the next page, it's saying, get me the next three articles and showing you those.

  367. A

    And in fact, like Wikipedia—you know, DBpedia, is that what it's called? Oh, no, MediaWiki, sorry. MediaWiki, which is what Wikipedia is based on, is that software uses SQL. And you can actually download the SQL file for all of Wikipedia. It's like this gigantic 30-gig SQL file. That's what you did for Trivipedia. Yeah, and so for people who don't know, SQL—you know, you can select things from the database, which we talked about. You can also insert, update, and delete items from the database. So you can actually, you can think of like storing things in SQL code. Like if you had SQL code that, you know, created a database and then inserted Patrick, you know, user ID blah blah blah Patrick, and then inserted all the things Patrick bought. That source code really has data in it, and that is the data. So a lot of these programs, like MySQL, when you go to, like, dump the database or backup the database, you get a gigantic block of code, which is really just instructions for recreating the database from scratch. And so Wikipedia does this frequently. And you can download like the biggest source file you'll ever see in your life, like a 30-gigabyte source file, which has all of the data in it. I'll pass. Yeah.

  368. B

    All right. Well, I think that's pretty much it. Oh, okay. So we alluded to

  369. A

    it earlier. Oh, yeah. But I

  370. B

    think you have grand plans for our next recording.

  371. A

    which we have.

  372. B

    to figure out the date. But we'll post it on our Google Plus page.

  373. A

    Yeah. Keep on the Google Plus page. We want to do a Q&A episode. We'll see how it works. I don't know if yet we haven't sort of fleshed out the details, if it'll be a Google Hangout. I think

  374. B

    that'll be good. We have to figure out how to record it. Right. So I don't want to have to just like read the like re-say what people are saying. So we have to figure this out. It'll be a good experiment for us to learn. Totally. Maybe we can just record the Hangout.

  375. A

    I think you can record a Hangout. We'll

  376. B

    see. We'll look into it and we'll figure out the exact format. Maybe we'll have a Skype number and people can Skype in.

  377. A

    We'll have to do it somewhere crazy. So we'll be somewhere crazy. Well, we'll be somewhere. We'll be somewhere. I don't know if

  378. B

    It'll be crazy. Everywhere's crazy. Okay. It's us, you know.

  379. A

    So we'll do the show over Hangouts. You'll see our goofy faces. If we record the Hangout, I guess we could just post the Hangout as well in addition to the MP3.

  380. B

    Sure. We'll figure out something. But anyways, we're going to have you guys call in. Yeah. We'll see. If not, we'll just talk about news, I guess. Yeah, yeah. Until people call in general.

  381. A

    We'll have 90 minutes of news if you don't call in.

  382. B

    Might be a short episode.

  383. A

    But yeah, it will be a Q&A. Definitely post if certain days are good for you or times are good. We're curious to see what people's interest level is. So yeah, definitely post on the Plus page and let us know what you think.

  384. B

    All right. Thank you all. All right. See you later. The intro music is Axo by Binar.

  385. A

    Pilot. Programming Throwdown is distributed under a Creative Commons Attribution Sharealike 2.0 license. You're free to share, copy, distribute, transmit the work, to remix, adapt the work. But you must provide an attribution to Patrick and I and share alike in kind.