WEBVTT

0:00:16.180 --> 0:00:21.293
<v A>Programming Throwdown Episode Number Four: MATLAB and Octave. Take it away, Jason!

0:00:21.293 --> 0:00:30.810
<v B>Man, Episode Number Four! It's pretty epic. It's a milestone for—yeah, yeah. It's eight weeks. Yeah, there we go.

0:00:31.380 --> 0:00:33.932
<v A>Eight weeks. We have soon, we'll be at

0:00:33.932 --> 0:00:43.960
<v B>140. Yeah, that's right. We have what is it? Like over 150 downloads, so quite a few of you have been listening, and so we appreciate that. Yeah, got a

0:00:44.327 --> 0:00:47.382
<v A>number of reviews on iTunes—five stars! Thank you all for doing

0:00:47.550 --> 0:00:58.671
<v B>That. Yeah, that's good times, good times. So I think there was something in the news about Amazon with their EC2, their cloud server went down. Did you see that one? Yeah.

0:00:58.671 --> 0:01:07.750
<v A>It was all over the news all day. Saw a bunch of that—their web services went down. I guess it was all of them: their S3, EC2, all of them. Oh.

0:01:08.104 --> 0:01:10.214
<v B>Really? I thought it was just EC2.

0:01:10.619 --> 0:02:00.180
<v A>Maybe. Okay, I'm not really sure about that, but yeah, I saw that Amazon's stuff went down, and that it's interesting how many popular websites now are actually running on top of Amazon's web service. I guess that's a praise of how good it really is, but things like Quora, which is a question and answer site, was down. I know Heroku, which was bought—who's about by? Oh well, it's a company that's a platform as a service, and they host like Ruby apps and stuff, and I know they were down. I think Dropbox was even having problems. Pretty much, you know, a large portion of the popular websites we go to and use every day use Amazon Web Services as a back end because they've done such a good job making it so cheap and reliable, and then it goes down, and then it's like, 'Oh, the world comes to a halt.' Yeah.

0:02:00.383 --> 0:02:11.217
<v B>I mean, this is similar to what was that one company started with an E that they did email surveys, and they got hacked, and as a result your email and your name got leaked out. Oh.

0:02:11.217 --> 0:02:13.005
<v A>Yeah, a couple weeks ago. Yeah, I

0:02:13.832 --> 0:02:31.112
<v B>got an email from TripAdvisor saying that my email got leaked out, and then I got one from the university that I was a student at, and then I got—and it's also the same exact email every time. I got another one from, I think American Airlines, and all of them used this one service that got that.

0:02:31.720 --> 0:02:59.412
<v A>had an exploit. Yeah, so it's common. It's surprising because a lot of people let their what's it called? I guess white labeling, right? Where you make a product but then somebody else can basically put their own label on it or, right, their own front end or hide it. It's not obvious to people that you're using their back end. And so yeah, it's kind of interesting that when Amazon went down, all these websites that are completely unrelated to Amazon went down as well, and the e-company was Epsilon. Oh, that's

0:02:59.817 --> 0:03:01.335
<v B>right, Epsilon. That's it.

0:03:03.276 --> 0:03:26.429
<v A>So yeah, hopefully they'll come back. I guess maybe they're up by now, but um yeah, it was, you know, down for a couple hours, whatever, which is a pretty big deal with their increase in popularity. I guess they've been down once before, and when that happened, it was a while ago. They weren't quite as popular, and they came out and were really apologetic and said, 'You know, we're not going to settle and making our product better until'

0:03:26.766 --> 0:04:12.632
<v B>it's perfect, right? I mean, the interesting thing about Amazon Cloud is just how accessible they've made it. I mean, there's that library, that Python library Pi Cloud where you can take Python code and run it on the Amazon Cloud with like virtually no effort. It just literally takes your function calls and tries to guesstimate—I think you might have to provide it like what actual data you think that function is going to use—but it handles, you know, sending it to the cloud, you know, and you can pull the cloud and say, 'Are you done yet? Are you done yet?' And then as soon as it's done, it'll let you know. And so you can you can be using the Cloud right now from Python and many other languages with just a trivial amount of work. And that's very interesting. It really puts a lot of power in our hands.

0:04:12.852 --> 0:04:26.993
<v A>Yeah, and it's obviously lucrative for Amazon. I saw some article—we don't have this in our news—but they were talking about that. Oh, you're pointing out to me that Dropbox runs on top of Amazon Storage, and how much a year? I was in the millions that Dropbox. Yeah, it

0:04:26.993 --> 0:04:28.647
<v B>was about four million a month. Oh.

0:04:29.035 --> 0:04:46.028
<v A>A month? Yeah. Oh, wow. I thought it was like per year. So yeah, they're paying a lot of money to Amazon for others because it's so accessible, it's so easy to use, and it's at a fair enough cost, you know. It's cheap. Yep. So what have you been spending a large portion of your last day or two doing? So

0:04:46.028 --> 0:04:55.022
<v B>I've been I've been pretty into Portal 2. Um it was a lot of fun to play. I won't give any spoilers.

0:04:55.022 --> 0:04:55.832
<v A>Okay, I was

0:04:55.832 --> 0:06:01.375
<v B>gonna ask? No, no, I won't spoil anything. Although I will say that the story is amazing. There are a lot of twists which assuming that no one has spoiled it for you, you will find very enjoyable, especially if you've played the first one because it requires sort of a lot of knowledge from the first to fully appreciate the storyline. But yeah, so Portal 2 is kind of interesting. So they preloaded all of the data for the game onto your machine when you pre-purchase the game. So in my case, I pre-purchased it about a month ago, and it actually loaded all of the content at that time. And Half-Life 2 did this as well, but one thing that Portal did that's unique is they encrypted all of the data. So you know when I got up in the morning the day Portal 2 was released—I guess three or four days ago—I actually took about an hour and it went through and decrypted all of the data that it had downloaded, and then also as part of decrypting, you know, downloaded the executable and started

0:06:01.965 --> 0:06:10.504
<v A>running? Interesting. So what encouraged you? This is digitally available, right? Whatever. So what encouraged you to pre-buy it? Give them your money?

0:06:11.230 --> 0:06:22.924
<v B>early? So in this case they gave a deal. So for okay, yeah. So if you pre-purchased, you could get 10 off and you also got a free copy of Portal One that you could gift to somebody else considering

0:06:23.110 --> 0:06:25.590
<v A>You probably already had Portal One if you're that interested in.

0:06:25.590 --> 0:07:10.160
<v B>Portal Two. Yeah, exactly. So yeah, Portal Two actually another interesting thing where originally they—you know, there was rumors that they were going to release the game on Friday, on you know a couple of Fridays ago. And then they decided or they on Friday they announced that if you bought the Potato Pack, which is a set, a collection of indie games, for each for these little sort of achievements or little aspects of these different indie games that you accomplished, you know, and one of them it was every time you beat a level you would earn a potato, and once a certain number of potatoes had been accumulated by the entire community on Steam, the Portal Two game would become unlocked.

0:07:10.377 --> 0:07:11.153
<v A>Interesting. Yeah, so.

0:07:11.541 --> 0:07:36.128
<v B>This is kind of a double-edged sword. A lot of people felt like, you know, we waited so long for this game and now you're making us buy these games that we don't even want to play so that we can get to Portal Two. But a lot of other people thought it was kind of fun and a little ingenious of them to, you know, make some extra money and also, you know, provide some entertainment and give, you know, give a little love to the people who make indie games.

0:07:36.263 --> 0:08:14.502
<v A>So yeah, interesting. Now one thing I was thinking about when I saw that we were gonna be talking about Portal Two was the fact that I don't—I guess it was a couple months ago, I could have been longer now when they originally had their release date and people were getting all excited, and then Valve came out and said, you know, oh is it Valve? I don't know. Whoever. Yeah, okay. They came out and said that um yeah, it's going to be delayed. Sorry, making software is harder than we thought or is hard. Yeah. And so I thought that was kind of interesting that they said, 'Yeah, this is hard. It's going to take longer. You're going to make it awesome. We're not going to release any sooner.' And that's interesting as a programmer and I'm

0:08:14.502 --> 0:08:17.725
<v B>Like, yay, that's true. Making software is hard.

0:08:17.944 --> 0:08:37.140
<v A>That sounded very enthusiastic. So yeah, I mean it's really hard to do software estimation, you know, saying how long is this function going to take to write? How long is this level going to take to make? How long is it going to take to test this feature? That—it's hard to estimate that especially if you're doing something, you know, new or never been done before. Yeah.

0:08:37.140 --> 0:09:34.979
<v B>I mean really at this level programming is almost an art. And, you know, in general, you just cannot put a time on—on, you know, art. It's just there's a level of creativity and often it's—there's just no such thing as perfect. You know, you can, if you have a function and it needs to add two numbers or whatever, then there is obviously a perfect answer to that. But often things come down to that, but yeah, it depends what world you're living in. But, you know, often these come down to design choices, and design is something that's never perfect. It always comes down to your interpretation. And different designs are fit different forms, you know, more optimally or sub-optimally. So, you know, yeah, again designing software and implementing software at a high level is very unpredictable. Yeah, that's true. Yeah, that's true, but

0:09:35.417 --> 0:09:43.855
<v A>Yeah, everybody always thinks we can do it. We are able to predict and figure it out and make a number even though the numbers are tend to mostly be really wrong. Yeah.

0:09:44.378 --> 0:09:45.627
<v B>Yeah, definitely, unless it's very

0:09:45.627 --> 0:09:57.878
<v A>similar to something you've done before and then in which case it's important as much as we all hate uh the infamous m word metrics they're terrible they can be useful because as you build up enough of a backlog of history of

0:09:59.430 --> 0:10:29.687
<v A>what something was how long it took you what you thought it would take you you can begin to learn a lot and do that kind of introspection and say how long how have i estimated in the past and begin to improve your estimates and get better at them and uh or compare with other people and say you know what are you using what numbers are you taking but i guess a lot of companies treat it as proprietary but you know if your company uses that or does that you know if they fuss you about metrics sometimes there's a good reason not all the time but sometimes it is helpful to make estimations better yeah

0:10:30.615 --> 0:11:06.439
<v B>I mean, you'll notice that a lot of the people who are in charge of, you know, cost and estimation are senior. And that's just because that's not something that you can really learn in school. It's something that you have to kind of just do a lot of software and get down to you make estimations that are wrong and find out, you know, what along what dimensions did you did you spend a lot of time? And then what are the areas in which there's a lot of variability? And so a lot of the senior engineers will kind of have a good understanding, just an intuition on how long something will take.

0:11:06.439 --> 0:11:16.397
<v A>Although we do like to complain that they make the estimates, but then they don't have to do the work. It's always a dangerous situation if somebody else gets to make the estimates. Yeah, exactly. People having to

0:11:18.203 --> 0:11:23.805
<v A>do the work yeah so on games did you hear the uh rumors there was flying all around about the wii too yeah

0:11:24.329 --> 0:11:38.335
<v B>Yeah, that looks pretty cool. I like how the Wii is sort of coming out of the gate early with the Wii Two considering that the Wii doesn't have a lot of the HD graphics capabilities of the other consoles.

0:11:38.689 --> 0:11:41.777
<v A>So you heard any of what are the good rumors you've heard so far?

0:11:42.638 --> 0:11:45.912
<v B>Well, I've heard that it'll launch early 2012. All right. That's just—that's

0:11:45.912 --> 0:11:47.616
<v A>Not that far from now. No.

0:11:47.616 --> 0:11:53.370
<v B>It's pretty soon. You know, the Wii, I believe you looked it up, right? The Wii was the last one of the three. Yeah.

0:11:53.370 --> 0:11:57.741
<v A>It was right around the same time, I think, as a PlayStation 3. Yeah, but pretty close. Yeah.

0:11:57.994 --> 0:12:02.719
<v B>But I haven't heard anything about a new Xbox or a PlayStation 4. So no. No. Why is?

0:12:02.905 --> 0:12:05.149
<v A>It gonna be Xbox 720? Now is that the?

0:12:05.149 --> 0:12:06.854
<v B>Yeah, that's right. The Tony Hawk

0:12:06.854 --> 0:13:10.152
<v A>Version Oh or the 1080, the Sean White version. Yeah, that's right. Um yeah, so I heard that they were talking about maybe having touchscreen controllers on the Wii because it was a big deal that you know the Wii one kind of forsook going the route of blingy eye candy and instead went the route of having new intuitive controls and having the ability to get up and dance around your TV and look completely stupid. But people loved it, and um when they did it kind of helped them capture a whole new audience of people that weren't into gaming before. Is the idea, and um that that's pretty interesting that they did that. So I'd be it'd be cool if they kind of continued that path and say we're gonna everybody else now kind of has motion controllers, right? And Xbox even has the Kinect, which has no controller to do the motion. That's kind of cool, and everybody's kind of catching up. So now it'd be interesting to see if they're able to actually leapfrog everybody again and say, 'Yeah, we are totally going to do this new amazing thing nobody else was even thinking about.' That would be pretty cool.

0:13:10.472 --> 0:14:30.359
<v B>Yeah, one thing that Nintendo did which it didn't catch on just because of the price point and the way that gaming works in the U.S., but it was pretty popular in Japan, and it was it was actually awesome technology. The GameCube had a thing where you could plug in GameBoy Advances into the GameCube as many as there were players, and um you would actually play on the GameBoy Advance. Um and so there would be one screen, so the GameCube would be on your TV just like, you know, regular console, and that screen would be shared by everyone. But your GameBoy Advance controller, you know, has its own screen since that's a portable console itself, and that screen would be private information that only you could see. So uh for example, there was a game called Four Swords Legends of Zelda: Four Swords, and it was a multiplayer Legend of Zelda, and you could actually hurt the other players so that you could take their rubies. So as part of the game, not only were you trying to get through the dungeon like a traditional Zelda dungeon crawler, but you're trying to get through with the most points, and uh that might mean sabotaging the other players. And so they use the, you know, screens built into the controllers to, uh, you know, give you private information and allow for these competitive games and these this sort of treacherous games, I think I remember.

0:14:30.359 --> 0:14:37.682
<v A>There being. I don't think I ever played it that way, but I remember seeing pictures of people in football games being able to select the plays on their GameBoy Advance.

0:14:37.800 --> 0:14:54.034
<v B>Yeah, that's right. And so the problem at the time was that you know you had to either buy four GameBoy Advances and a GameCube or have three friends with GameBoy Advances who all wanted to play that game. Um and so you know that was the challenge that's what kind of.

0:14:54.034 --> 0:14:57.880
<v A>Killed that? You mean nerds had to actually get together in the same place and socialize.

0:14:57.880 --> 0:15:08.120
<v B>Yeah, it was pretty much impossible. Yeah. So that was the end of that, but I'm hoping with these touchscreen controllers that they will um sort of bring back some of that. That's a good call. That's.

0:15:08.580 --> 0:15:22.722
<v A>Interesting. That's interesting. Yeah, I also heard rumors that uh they were going to do 3D support, which is interesting because Nintendo 3DS, now I'll get it right, um is have you seen one of these yet? Have you used one?

0:15:22.722 --> 0:15:25.962
<v B>I haven't used one, but I I saw pictures of it. Looks pretty awesome. Have.

0:15:25.962 --> 0:15:38.736
<v A>You actually like stood in front of one? No. Oh, I saw one in the store. I couldn't use it. It's really cool. No 3D glasses—you stand in front of it and yeah things pop out of the screen. It's pretty cool. I don't know how it be long term, but it's pretty awesome.

0:15:38.736 --> 0:15:49.350
<v B>So if I remember right, it uses several layers of LCD, right? And each one can be clear or a certain color. And so the layers give a parallax that creates the 3D illusion. Yeah, I.

0:15:49.350 --> 0:16:29.530
<v A>Think that's right. Something like that. Yeah, and it's adjustable with a slider. Oh, really? Yes, you can kind of adjust how much 3D it is. And I heard some people talking about some of the games actually really useful because it helps you give that extra depth perception you need to be able to avoid a wall coming up or fly under something or walk around something. No, it's kind of cool. So but Nintendo with the 3DS their whole thing is, right? Oh, we're better. No 3D glasses needed. You know, we're going to do this, you know, so that everybody can use it, not have to wear silly looking 3D glasses. So it'd be interesting if they decide to go with 3D glasses to kind of go back on themselves, although it's not uncommon for companies to do that. Apple does that all the time. It would be a terrible idea to do this and then their very next product does.

0:16:29.631 --> 0:16:42.034
<v B>exactly that thing yeah exactly so there's going to be a starfox 3d on the 3ds remember starfox yes oh man i think uh might have to go and buy one just right now oh no that would be

0:16:43.334 --> 0:16:53.070
<v A>Kind of crazy, yeah. But I heard it was going to be called a Stream as well, but I remember—I don't remember what the we had a different code name before that. I actually kind of liked better. It was oh.

0:16:53.442 --> 0:16:54.454
<v B>What was it? I liked?

0:16:54.471 --> 0:17:01.860
<v A>It better than what we was, I remember. And then we came out and everybody's like making jokes about we, but now that—um no, I.

0:17:02.200 --> 0:17:02.993
<v B>Kind of like it, we.

0:17:03.128 --> 0:17:05.254
<v A>Is kind of fun. We like—I don't know. I kind of like saying.

0:17:05.339 --> 0:17:09.777
<v B>It, yeah. And the whole we would like to play, you know, advertising campaign and the Me's, you.

0:17:09.777 --> 0:17:10.924
<v A>Make your Me's. Yep.

0:17:11.346 --> 0:17:18.029
<v B>Yep. I kind of liked it, but it was called the Revolution. That was the Nintendo Revolution, right? Before it was. Yeah, that's.

0:17:18.029 --> 0:17:18.855
<v A>Right. That's right. Yeah.

0:17:20.594 --> 0:17:22.300
<v A>I guess maybe not now in hindsight. It kind of.

0:17:24.036 --> 0:17:29.892
<v A>Seems stupid. Oh well. The time—time has passed and my opinion has changed.

0:17:30.870 --> 0:17:48.020
<v B>So going from really high tech to somewhat low tech. Um, another story here is about this Lego assembly line. Is that where they make Legos? No, this is actually somebody taking Lego and building an assembly line out of Lego.

0:17:48.336 --> 0:17:53.044
<v A>What? Wait, wait. So they assemble Legos with Legos? That's right? Is that right?

0:17:53.753 --> 0:17:54.529
<v B>Okay, okay.

0:17:55.322 --> 0:18:00.807
<v A>I gotta keep checking this. It's like it's like Meta. Okay, hang on, keep going. All right, keep.

0:18:00.807 --> 0:18:16.129
<v B>Going? Yeah, I think this counts as you know the first like reproductive organ that's ever been made out of Lego because uh now he's able to if he can produce itself, then we have a complete species here of Lego. Uh oh.

0:18:17.294 --> 0:18:20.365
<v A>I for one welcome our Lego overlords. That's right.

0:18:21.074 --> 0:18:37.915
<v B>So yeah, you guys should definitely visit the blog and have a video link out. Yeah, this has a killer video. You know, it just sounds like the big dog robot walking in because all these different Mindstorms big dogs. Awesome. Yeah, all these different Mindstorms parts, um axes. So can it rebuild?

0:18:37.915 --> 0:18:42.032
<v A>Itself? No, or it just read it just built other.

0:18:42.032 --> 0:19:02.991
<v B>Things. Yeah, right now it just um it's pretty simplistic. It only has four robot arms, but it can I think it can build. It builds these little cars, and that's kind of cool. Yeah, it can build like a block. You can take Legos and build like essentially a bigger Lego, like a macro Lego block by stacking several of these together. Yeah, I.

0:19:03.177 --> 0:20:06.137
<v A>got interested recently in, I guess called the repro-wrap, which is the idea of a replicating machine that can replicate itself. So it prints it prints parts and it prints parts for itself so it can make new itself, right? And then that drives down costs because if you can do it perfectly, you can end up making them really cheap because then you end up having lots and lots of things that can make more of those things, and you know, and it becomes really awesome. And it's really clever because they have parts that at this point in time they're not able to print, so like circuit boards, metal rods, screws—things like there are things that are economically prohibitive to print. But um and then they call those things vitamins, which is things your body needs but can't make. So I thought it's kind of clever. It's really interesting. Maybe I'll have to talk about that sometime. But yeah, this sounds like not quite the same thing because it can't make its own self out of Legos, which would be even cooler. But maybe it's a step in that direction, maybe something to inspire and make its own bootstrapping Lego factory, and then one day giant Lego robots will appear outside of our house and knock-knock.

0:20:06.846 --> 0:20:10.862
<v B>Knock. We've come to take over. Give us your children. Uh that.

0:20:11.622 --> 0:20:13.107
<v A>Would be good, but.

0:20:13.697 --> 0:20:25.037
<v B>Yeah, you know it's really interesting how with Lego Mindstorms you can do just about anything. You know, it's uh I believe Lego Mindstorms it's its own language, right? Have you?

0:20:25.037 --> 0:20:57.623
<v A>Yeah, no, I haven't. But I know that they have um in typical over-the-top nerd fashion, I think people do a lot with it, but I think originally it came out and I remember it being a visual language so you actually had like little parts that you would drop on for an if statement or a loop, you know? And you could drop those little blocks down, and then it would go to the little brain, the controller brick, or I'm not sure what their term is for it, and and it would control the other Legos. But now I think they even have the ability and then they had a language you could write in, but I think people even have where you can write in.

0:20:57.825 --> 0:21:08.153
<v B>C. Now yeah, according to Wikipedia, you can write in Java and C. Now nice for Mindstorms. Yeah, and so this is really interesting that if you listen to our first podcast, then you'll have

0:21:08.575 --> 0:21:16.354
<v A>the language C under your belt, you'll know what you're doing, and then you can go program a LEGO factory to replicate itself. Yeah, if you do.

0:21:16.793 --> 0:21:23.391
<v B>That definitely let us know we will have you on the show if you can build a self-replicating LEGO factory. That would be epic, especially

0:21:23.492 --> 0:21:25.939
<v A>if you learn about C from us. Oh yeah, that

0:21:25.939 --> 0:21:27.188
<v B>would be even better. Yeah.

0:21:27.188 --> 0:21:34.157
<v A>Yeah, or tell your friends and maybe they'll learn about C and then go do this. Yeah, and maybe a year or two or three or four. So

0:21:35.136 --> 0:22:48.492
<v B>Yeah, I mean a lot of these robotics problems are problems that actually you'll encounter, like you guys who are in Computer Science at university or at high school. You know something like path planning. You know when you do path planning, you might look at just a little, you know, circle in a maze trying to get through this maze, and you might not be thinking about real applications. You might think, well, when in real life am I ever going to be in a maze? And it was at one time—oh yeah, a minute time. Oh man, that was rough. I really wish we had a laptop there to run for our lives, but I should have studied better that A* algorithm. Yeah, that's right. But you know, robotics the way the robot arm moves is actually path planning. So you have the robot arm sort of the positions that it wants to be in as sort of the goal, the exit of the maze, and where it is now as the start of the maze. And sometimes, you know, it has to move to the right so that it can swing to the left without hitting a wall with a different joint. Yeah, exactly, kind of like an octopus arm. You know? So there's an example of where you know algorithms that you see in Computer Science school that you think, 'You know who's ever going to use this?' And then you find out later in life, oh, everyone uses this.' You

0:22:48.914 --> 0:22:51.445
<v A>know. Plus let's admit it: robots are awesome. Yep, robots.

0:22:52.947 --> 0:22:57.300
<v B>Make anything cooler. I think every Comp Sci class should have a LEGO Mindstorms.

0:22:57.672 --> 0:22:58.515
<v A>And lasers.

0:22:58.785 --> 0:23:05.957
<v B>That's right. Well, no, well, I was gonna give a Portal two spoiler. No, stop.

0:23:06.143 --> 0:23:11.040
<v A>Stop. We'll just stop with robots and lasers and portals.

0:23:12.910 --> 0:23:17.314
<v A>Okay, I haven't played it, so if I give out any spoilers, it's completely...

0:23:17.314 --> 0:23:18.159
<v B>Accidental. That's right.

0:23:19.677 --> 0:23:41.091
<v A>So what is your tool of the week? So on robots and building things and you know atoms as opposed to bits, my tool of the week is we got going a little bit different with the Texas Instruments MSP430. Don't you love it when companies name things cleverly? Yeah, I was gonna say—I mean, now I...

0:23:42.846 --> 0:23:45.023
<v B>Know exactly what that is. Yeah, I'm so glad.

0:23:45.597 --> 0:25:44.042
<v A>That's just the mind meld that's going on here between TI and us. So this is kind of interesting. I've used before another product that's kind of in the same vein as this called the Arduino. And the Arduino is an ATmega chip with a bootloader and a little board that comes with it, and for—I think it's like 20—an awesome interface. And they made it all open hardware, and it's pretty cool. And you can use it to do all sorts of interesting things, and there's a great community that was built up around. And I really liked Arduino people used to do a lot of things but kind of similar to the LEGO Mindstorms where people use stuff for more than it's intended to and kind of do a lot of work instead of picking the right tool for the job or learning the next thing, they use what they have and do really creative. But if all you have is a hammer, everything becomes a nail, right? So people use Arduino to do a lot of things that are really clever and cool, but it could probably be done easily, more easily, or cheaper because one of the things is even the Arduino is cheap at twenty dollars or so depending on what version you get. It's not saying you want to leave in a project or leave in something or you know because it's twenty dollars—I mean, that's kind of, you know, I don't want to just go wasting twenty dollars all the time. And so the Texas Instruments response to that is to try to build up a community around some of their products, and they do, you know, they're like, you know, dominant in the DSP market for industry. And so they say, how do we get to these consumers? Because these consumers, these people in college, they will eventually work in companies, and they'll be able to do stuff like, you know, themselves. And plus these, you know, chips a lot of times are very cheap for them to make, so they can sell a kit for it, you know, more power to them. It's awesome. And so this MSP430 thing that they have now, the LaunchPad—oh, I guess it does actually be my totally. We have the MSP430 LaunchPad is kind of an Arduino competitor that sells for four dollars and thirty cents shipped to your door, you know everything included. That's awesome.

0:25:44.042 --> 0:25:48.025
<v A>So I can't recall when I bought mine, but I think...

0:25:48.025 --> 0:25:55.973
<v B>It even had a USB connector in it. So pretty much you have one of these. Yeah, so I have—I have one of these. I've not done too much with it.

0:25:55.973 --> 0:27:41.408
<v A>But it is pretty cool. Oh, it says 430 plus shipping maybe that's changed inside, but I don't—I don't think shipping is very much. It's pretty small, but it's a pretty nice kit, and it's interesting because at only four dollars and thirty cents, a little easier to leave that in a project now. And it's not exactly the same as Arduino, but it's kind of similar. And you know we do a lot of open source tools for the or free things for the tool of the week, but this is something that's really cheap and really cool because I remember being in, you know, high school and being interested in electronics and you know making things out of magazines, and not a lot of that today at that level. But there's a lot of stuff on internet today that we didn't have when we were growing up. And so something like this when you're, you know, younger, you know your parents don't necessarily mind giving you five dollars for for something or whatever, and then you know use their permission and then maybe they'll let you—that they can put in their credit card information for you so that that you can get one of these. But that's pretty cool for four dollars and thirty cents. A lot of stuff you can learn with this, you know writing code in C, actually it might do C++, but they give you their a version of their Code Composer, which is their product that you use for like the higher end DSPs that that you know people use that there are jobs and stuff. And um they provide that, and you're able to use it to write C code to do stuff like, you know, play with instead of just making a loop that prints hello world—that's kind of cool. But yeah, I don't know there's something different about writing instead of print hello or turn le toggle LED, like it's just cool. It's just nice to see something in the real world other than your screen, you know doing awesome things, hooking up a servo and making watching it move or you know affecting things. It's it's fun. It's I don't know, I'm kind of into Harvard. I know you're a little bit more high level software than I am, but...

0:27:41.594 --> 0:28:00.747
<v B>Yeah, I wish. You know it's something I want to get more into, but I just—I'm kind of ignorant on it right now. But I am really interested how does it? So I might show the ignorance here, but let's say you have a servo that you want to communicate with. Yeah, do you have to buy a TI servo or I mean is there a library or how does this?

0:28:00.747 --> 0:28:24.726
<v A>Work? So on MSP430, there probably is example code out there if not it's not that hard. But no. So what happens is servos are controlled by something called Pulse Width Modulation, which is a programming show. So maybe this is out of context, but oh well, we're going to learn something new today. Yeah. So Pulse Width Modulation, which is given a set and I'm going to flub this up for any electrical engineers listening, so tune out now please resume this in about...

0:28:25.030 --> 0:28:31.442
<v B>Three to four minutes. This is like an anti-spoiler. It's like we know we're not going to spoil anything good on electrical engineering. Yes.

0:28:32.269 --> 0:30:28.403
<v A>So the idea is you've got a set rate. So let's say you know every one Hertz you're going to have a cycle once per second. Just to make it easy, it would never be that long because that would be too much delay between um signals. But so you have one-second cycle rate. So the servo will say for instance center position, it will be a 50 on, 50 off. So if 50 of the pulse width, so that time of one second, if for 500 milliseconds the pulse is high and the rest is low, it's going to be centered in the center position of the servo because the servo goes from a plus degrees to a minus degrees. It normally doesn't do continuous rotation. If you make the signal less than 50, you normally have it centered in your window. So it's a little hump in the middle. So if you have it for 250 milliseconds, that depending on the servo could be full over left and if you have it for 750 milliseconds, that could be full over right. And so varying that width of the pulse allows you to control the position of the servo. And then the servo holds its position once it's there by itself. It knows if you keep sending that pulse, it knows how to stay there. And if somebody tries to go move it or push against it, they'll try to move back to the right place. So it's a closed loop thing in itself. And that pulse width is a way of communicating to it. So in that way you can buy any Pulse Width Modulated servo and it'll work. Now there are newer servos which communicate for instance like an I²C or something, which is another protocol. So it wouldn't have to be specific, but you just kind of got to know. And other people are out there doing this stuff, and you can buy servos really cheap online. Like we're talking like a dollar, two dollars, three dollars, four dollars, five dollars. You know, I see a lot of servos for five dollars. They're not great servos, but you can make a move and do little things. And yeah, so a lot of times you can find sample code to do it. I don't know if the MSP430 has, but a lot of the DSP chips have a library set up to do Pulse Width Modulation where you basically just say my cycle length is this time and my current pulse width should be this, and then it handles all the rest of it for you.

0:30:28.403 --> 0:30:31.440
<v B>Oh, so it's got its own like while true kind of thing going on?

0:30:31.778 --> 0:30:35.085
<v A>There, and it's in hardware so that you don't have to weigh CPU cycles sitting there because

0:30:35.085 --> 0:30:35.727
<v B>If it was

0:30:36.040 --> 0:30:45.080
<v A>using a CPU, you kind of spent a lot of time trying to sit there managing, making sure it's right. This way you can kind of tell the hardware go do this and then it just sits there and does it for you.

0:30:45.080 --> 0:31:00.297
<v B>Cool, that's awesome. Yeah, I want to make, I want to just get started making really simple things like something that would like unscrew a bottle, you know, bottle cap or something like that and get started. So maybe I'll pick up one of these.

0:31:00.297 --> 0:31:05.106
<v A>Launch Pads. Yeah, so um Launch Pad is my tool of the bi-week and yours nice. So,

0:31:05.477 --> 0:32:52.043
<v B>My tool of the bi-week is along a similar lines, along the lines of getting into hardware. And uh so the tool is SketchUp, Google SketchUp, which SketchUp by itself is just a 3D modeling tool, but um it doesn't do texturing, and it's not focused on texturing as most tools are, and on authoring, you know, 3D content for, you know, video games or for movies. SketchUp is about drafting, and it's about sort of designing something out at a high level. So that's why if you see SketchUp, you know, models, they'll often look very flat. And um that's because what you're seeing is what the focus is really on the geometry of the model and not so much on how it actually looks. There's you're not going to find a ray tracer. You're not going to find like lighting and mirrors and all these fancy things that you might in, uh, in RenderMan, which makes, you know, Shrek in those movies. But if you want to just rapidly prototype, it has an extremely slick user interface, and uh it knows that because it's a design tool that the geometry is not going to be very complex. You're not going to try to model someone's face in SketchUp. You know, so it uh it lets you like mess with the different vertices and different geometry at a low level knowing that that you're not going to be dealing with millions of these objects, and um because of that it gives you a lot of flexibility. So SketchUp actually integrates with something called Thingamatic, which is uh done by MakerBot, and you can uh buy this Thingamatic kit, and it'll actually work in tandem with SketchUp to produce 3D, I guess lithographs? Is that the right

0:32:52.043 --> 0:32:54.203
<v A>word. Uh printed. Yeah, basically 3D like.

0:32:54.777 --> 0:32:58.236
<v B>Real 3D models. So so it extrudes.

0:32:59.760 --> 0:33:01.088
<v A>Little bits of plastic. Yeah.

0:33:01.358 --> 0:33:22.519
<v B>So you can in SketchUp, you can make a model of uh, you know, a sphere or try and like grow your, you know, make a design, a model of your hand or or a model of a little spaceship, and uh you can export your SketchUp model to MakerBot, and it will actually construct it in 3D out of a plastic resin. Yeah.

0:33:23.194 --> 0:33:46.566
<v A>so i i wasn't paying attention that this was your tool of the week so when earlier i was talking about uh the the rep wrap that this is kind of the same idea rep wrap is similar to the maker provides the not the open source version of the maker bot but an earlier version of the maker bot something that um how do you spell it rep wrap r-e-p-r-a-p okay and so this

0:33:48.186 --> 0:35:12.139
<v A>is one that is, you know, with kind of the intention of bootstrapping itself that I was talking about does kind of something similar to the MakerBot, though where it prints things out of what I guess it's rods of plastic. Plastic string goes into a little extruder and it puts little dots at a single layer. Then it moves the platform down or moves the extruder up and then places another set of little dots, and slowly, you know, layer by layer it builds up, so kind of like an inkjet printer, but instead of, you know, the paper moving out the head moves around and then the platform and head separate and then it prints again, slowly building up the structure. Nice. So interesting. I don't know if you've seen this before, but you know the Thing-O-Matic is a 3D printer, and then the Thingiverse, which is thingiverse.com, is a collection of 3D models, a lot of which have been done in Google SketchUp. Yep. And people put these things up here, open-source, you know, repository of them, and then they have it so you can print it with your MakerBot or with your RepRap, or sometimes with a laser cutter, um, and make these things that other people have made and make them yourself. So the idea that, you know, one day in the future I want a coffee mug, I don't have a coffee mug. You just go over to your printer and you go to, you know, amazon.com or maybe you go to one of these Thingiverse free ones and you download a free coffee mug, and then it just prints it on your printer, and then five minutes later you come and there's your coffee mug ready to use.

0:35:12.645 --> 0:36:17.327
<v B>Yeah, I think this is a really exciting time for us, you know, computer nerds. Because, you know, for example, I wanted to make a PDA that was completely open-source, and it was—it was a really big pain. You know, I had to get the circuit board, I had to get an LCD display, I had to make those two talk to each other. I had to write my own driver for the LCD display. You know, I had to get a version of Linux blah blah blah so on and so forth. But then once I had done all that, you know, software engineering work, I ended up using Lego. I had to build a case for my PDA, and not knowing anything about hardware or woodworking or anything at the time, I used Lego and made this giant PDA that barely fits in my pocket, um, but plays Dwarf Fortress out of Lego, Lego, and gumsticks board and LCD. So now the technology has come so far that for, you know, it's still—it's still a little expensive. The Thing-O-Matic is 1300, and the other one is, uh, the RepRap is what around 800. Yeah.

0:36:17.513 --> 0:36:23.240
<v A>I mean, it just depends on what level of kit you get, but I think yeah all up once you pay for everything it's going to be about that.

0:36:23.240 --> 0:37:01.489
<v B>But yeah, for for uh for about a, you know, 1500 you could have something which constructs the shell of whatever you want. The electrical component you can get that for four dollars as Patrick showed, and the different servos and motors and sensors that make up, you know, that part of that of your design. But we're in a position where we can you can prototype just about anything as a hobbyist. I mean if you need—if you need it to be stainless steel and you do arc welding, well, you might still be out of luck, but um but you know you could do just about anything nowadays, and I think that's really exciting. Yeah.

0:37:02.080 --> 0:37:55.725
<v A>And and I've tried my hand at things like SketchUp and others and found I'm pretty terrible at it. Yeah, me too, but what's cool is some of the people doing this printing are writing computer programs to make the files to print. So I saw one guy the other day ran Conway—Conway's Game of Life and let it play out over a whole bunch of iterations and then kind of kept a history of everywhere where it went and printed out a 3D model of like a representation of a run of Game of Life, and um that was kind of cool. Or you know procedurally generating a 3D model and then printing that out, so you know like a fractal generator or um like what is it? Sarah and Pinsky's gasket right in 3D and then printing that out. So if you're really nerdy but are terrible at drawing stuff and making stuff on SketchUp, then you can write programs to make the models that then your printer can print.

0:37:56.012 --> 0:38:26.033
<v B>Yeah, and Patrick made another good point earlier which is, you know, both SketchUp and MakerBot and probably the RepRap too have a library of existing models. In fact, SketchUp has a massive, massive database, and you can get everything from buildings—famous buildings, you know, completely modeled in SketchUp all the way down to like, you know, a model of a hand. You can get different like I don't know tools. You get those scissors that, you know, you can download just the model instead of having to make it.

0:38:27.214 --> 0:38:29.374
<v A>yourself? Yeah, can I print a house to live?

0:38:30.893 --> 0:38:39.162
<v B>In maybe. I don't think you could print a duplicate of your house though because your house has the printer in it and you would have to print so if

0:38:39.162 --> 0:38:42.469
<v A>I made a model of my house? I think this was an XKCD.

0:38:42.857 --> 0:38:49.962
<v B>Comic that's right. Uh-oh, the model would have to be in the model which have to be in the model. No, uh-oh, so don't model.

0:38:50.839 --> 0:38:55.530
<v A>Perfectly every detail of your house? That's right. And then try to print it.

0:38:55.716 --> 0:38:56.864
<v B>Yeah, that would fail.

0:38:56.864 --> 0:38:58.028
<v A>Or model it. Yeah.

0:38:58.163 --> 0:39:52.028
<v B>Bad idea. Yeah, so I'm going to give a shameless plug here to Endless Forms, which is close enough to what we were talking about, but endlessforms.com is a website that's run from a couple of colleagues of mine out of Cornell, and this is an evolutionary computation program for generating three-dimensional art. So, I don't really know how to describe this, but basically you start on there and it just has these random geometries of different circles and patterns, and you can kind of see what they look—excuse me, what they look like in 3D. And then you kind of you have you pick from this population, like, oh, I like okay, okay. So I'm here now and I see one that says Mushroom. So what do I do? So what you're looking at when you go on Endless Forms are these are the top-rated forms that other people have made, so they've evolved them or they've that's

0:39:52.315 --> 0:39:54.036
<v A>Right. So you click on Start Anew.

0:39:54.407 --> 0:40:00.482
<v B>It's going to give you a set of individuals. You pick some parents and you can mate them and see what their baby would

0:40:00.820 --> 0:40:04.718
<v A>look like? Interesting. Oh, okay. So these are just giving me a bunch of random.

0:40:04.718 --> 0:40:44.307
<v B>ones, right? And so the hope is that in the same way as you know the fast line catches the prey and natural evolution survival of the fittest propagates, in the same way, you know, that the shapes that you find the most pleasing or the most amiable for this session will start to propagate, and you'll end up, you know, with your own species of 3D shapes. So these guys are going to be at the Gecko Conference this year showing off their forms. Um so if you have some time, go to endlessforms.com and generate some cool things, and they will add them to the display section at the conference. Interesting.

0:40:45.083 --> 0:40:52.626
<v A>Yeah, although it's kind of kind of interesting all the popular ones are ones that resemble real-life objects. Yeah.

0:40:53.200 --> 0:40:54.972
<v B>It is. It's sort of as opposed

0:40:54.972 --> 0:41:01.401
<v A>to things that are you know you would have thought people would have been interested in—things that are like, oh, that's clever but new, or

0:41:02.144 --> 0:41:10.480
<v B>different. Yeah. Yeah, it's surprising that, you know, I think people are at this point since it's so early people are just happy that it can generate things that look like other things. Well,

0:41:12.167 --> 0:41:27.034
<v B>cool. That's cool. All right. And you know, you could in theory if they give you the model, which I think they do, you can import that into SketchUp and then export that into the Thingamatic format and then print it on a 3D printer.

0:41:27.034 --> 0:41:33.565
<v A>That's cool. Yeah, good. You better be careful because if you print something sentient, we could all be in trouble.

0:41:33.565 --> 0:41:39.032
<v B>Yeah, that bad news. Bad news. Or if you print a Klein bottle, it might just be stuck in an

0:41:39.488 --> 0:41:41.420
<v A>infinite loop. Oh no, that would be terrible.

0:41:42.998 --> 0:41:51.705
<v A>Yeah, all right. So, I think that ties this up for our tools of the week. Cool. So, I think we're going to be talking about MATLAB slash

0:41:51.705 --> 0:41:54.355
<v B>Octave. Uh, this week. So why don't

0:41:54.355 --> 0:42:02.580
<v A>we start off talking about MATLAB since that's the first of our pair here? What is MAT what does MATLAB stand for?

0:42:03.197 --> 0:42:55.240
<v B>Yeah. So MATLAB stands for Matrix Laboratory, and so MATLAB is an interpreted language, and it's meant to be sort of a laboratory or a playground for nerds like us to sort of go in and do matrix operations. So a lot of linear algebra, a lot of, you know, analysis of data which is quite often stored in matrices. If you've ever used Excel, you know an Excel has a grid of cells, and a matrix also is a 2D grid of cells. So if you've ever used Excel, you've worked with something sort of analogous to a matrix, and it turns out that matrix matrices are just very popular and almost ubiquitous in mathematics, and so this is sort of a place where you can go in and try different functions and do analysis at a high

0:42:55.594 --> 0:43:00.302
<v A>level. So MATLAB refers both to the language and to the product.

0:43:01.855 --> 0:43:19.000
<v B>That's right. So you know the scripting language that comes with MATLAB shares its name, and so often it can be a little bit confusing because you could say I'm talking about MATLAB, but you're talking about this, the code, or you could say I'm talking about MATLAB, the product.

0:43:19.371 --> 0:43:22.037
<v A>Oh, okay. So people use this? It's

0:43:24.788 --> 0:43:57.060
<v B>pretty popular. Yeah. So MATLAB is hugely popular, especially in the you know, especially in the market of people who are sort of analyzing data—so linear control systems guys who are doing, you know, servos, as Patrick was talking about earlier, and trying to create systems, robotics, tend to use a lot of MATLAB. People who are analyzing data, trying to generate statistics and regression and things like that, are definitely using MATLAB.

0:43:57.060 --> 0:44:09.827
<v A>Interesting. It's also really popular in school. I remember in university that everybody seemed to be using it. All the professors at some point just like all of a sudden all the professors assumed you knew MATLAB, and I

0:44:09.827 --> 0:44:45.940
<v B>Was like, no wait. What's MATLAB? What's that? Yeah, I got burned by that too. I went into image processing. It was a master's class, and yeah, he said that everyone will program their assignments in MATLAB, and I'd never seen MATLAB before. And yeah, there's everyone has to kind of go through those moments. You know, in our case it was MATLAB. Maybe some other people had the same situation with C++, but everyone goes to that moment where it's like, you know, you walk into either a job or a classroom and someone says everyone's doing everything in blah, MATLAB or lang whatever. And I would love if I

0:44:45.940 --> 0:44:48.201
<v A>walked in and somebody said we're going to do everything

0:44:48.201 --> 0:45:10.200
<v B>in Erlang? That would be pretty intense. Yeah, it would be a challenge, but one of the cool things about, you know, programming throwdown is that, you know, we're going to keep throwing down these languages and at the end you can get to the point where if you walk into a job interview and they say here we only use, you know, Haskell, you can step up to the plate and swing a home run by saying, 'Oh yeah, no problem.'

0:45:12.214 --> 0:45:39.906
<v A>That would be pretty cool. Yeah. So, I remember when the first time my professor said we got to use MATLAB, and I went online and like, all right, well let me download MATLAB. And then I was like, 'Oh wait, hang on, where's the download link?' And I went to MathWorks, the company that makes MATLAB, their website, and like, 'Where do I get this?' And then I finally found a link, and it said, 'Oh, student version.' I'm like, 'Oh yeah, let me get that one.' And it said $100. And I went, 'What a'

0:45:39.906 --> 0:45:40.986
<v B>$100 for

0:45:40.986 --> 0:45:59.329
<v A>what? What is this for my class? Oh man. And I quickly scrambled to find out that, you know, oh yeah, some the university has an agreement to have it on their computers and so I could go to the lab and use it there and avoid having to pay the $100. But I know a lot of people who had to buy to have it on their

0:46:00.595 --> 0:46:49.937
<v B>computer. Yeah, definitely. So this is pretty common. You know, not so much in programming languages, thankfully, but it's common in the workplace, in academia where you'll end up with vendor lock-in. Which is vendor lock-in? His idea where that sounds like a German word. Vendor lock-in? It's happiness at the discomfort of others. Oh no, that's Schadenfreude. But vendor lock-in is where, you know, you've started to use a product, say MATLAB, say let's say you've used a free version of MATLAB that, you know, at your university, all right? And so you become very acquainted with MATLAB and I write awesome programs. That's right. You write a ton of MATLAB. And then you and some guys get together and say, 'You know what? We're awesome at MATLAB. We're going to start a company and we're going to do linear systems consultation.' Boring. Yeah, worst

0:46:49.937 --> 0:46:56.822
<v A>company ever. So, just kidding. If that's your company, we love you. Okay, Programming Throwdown at Five

0:46:58.864 --> 0:47:19.587
<v B>Stars? So, so your company now has had in its history an ingranation of MATLAB and so you're sort of, you know, for you to switch to another toolset, let's say you want to switch to Java or something, you would have to rewrite everything. All of this, all of this code that's been built up over the years. I think I had

0:47:19.587 --> 0:47:20.582
<v A>that job when I was

0:47:21.038 --> 0:47:26.033
<v B>an intern converting MATLAB to C or Java? Now converting one yeah, one language to another? That was really

0:47:26.033 --> 0:47:27.040
<v A>old something new.

0:47:27.062 --> 0:47:41.000
<v B>Oh, rough. Yeah, so this is vendor lock-in. In other words, MATLAB sort of has you in a position where you have to keep continuing to use MATLAB and to pay MathWorks um to, you know, to stay successful as a

0:47:41.474 --> 0:47:46.131
<v A>business, the cost of changing is worse than the cost of continuing to

0:47:46.131 --> 0:47:47.228
<v B>pay MathWorks. Yeah.

0:47:47.397 --> 0:48:19.004
<v A>Exactly. So MATLAB is really powerful. I mean, where I work that they use it all the time. You know, just tons of people use MATLAB. It's really powerful. They really love it. They use it for doing prototyping stuff. Yeah, um we'll get to some of the slowness problems later and why that people like you and I continue to be employed. Yeah, if everybody else could just use MATLAB, but um so what is a person to do if they don't have a lot of money? If they don't want to be locked in? If they—I mean, are there alternatives? Yeah.

0:48:20.084 --> 0:48:46.080
<v B>So MATLAB, the language has actually been re-implemented by another group, and it goes under the term Octave, or specifically GNU Octave. And so Octave is an open source, completely free and open source implementation of the MATLAB language, and they advertise that you know any MATLAB program, any .m file, um you should be able to run on Octave.

0:48:46.577 --> 0:48:47.522
<v A>Interesting. Yeah, so

0:48:47.742 --> 0:49:00.020
<v B>the one thing that Octave, you know, they're starting to come up to speed on but not quite haven't quite fully flushed out yet is all of these toolkits that MATLAB has. Yeah, so

0:49:00.020 --> 0:49:01.343
<v A>I get one of those in

0:49:01.765 --> 0:49:16.180
<v B>my garage. Yeah, so this is uh this is this is sort of the bread and butter of MathWorks. You know, they actually generate most of their business from selling these custom toolkits, and if you remember when we talked about Python and Erlang, we talked about their standard libraries.

0:49:16.412 --> 0:49:17.914
<v A>Batteries included. I remember that's

0:49:17.914 --> 0:49:22.521
<v B>right? So what did Erlang is OTP, right? Yeah. Yeah, and then Python Telecom Platform.

0:49:22.521 --> 0:49:23.145
<v A>Yeah.

0:49:23.247 --> 0:49:45.387
<v B>And Python has a standard template or the standard Python library. But in the case of MATLAB, MATLAB relies on toolkits, and they actually sell each toolkit—or the majority of them—they sell, you know, one toolkit. So what is something that would be a toolkit? Yeah, so image processing, for example, might be a toolkit.

0:49:45.387 --> 0:49:50.550
<v A>Yeah, sometimes people do like to use images, use matrix to represent them. That's right. Yeah, yeah.

0:49:50.669 --> 0:50:19.407
<v B>So if you think an image is a 2D grid of pixels of different colors and a matrix, as we mentioned, is similar to Excel—it's a grid of values—so they both can kind of, so a matrix can easily represent an image. And MATLAB's Image Processing Toolkit comes with a bunch of functions that lets you do different things like histogramming and blurring of images, doing convolutions. So these

0:50:19.407 --> 0:50:23.069
<v A>are all things that you could write yourself though, right?

0:50:23.339 --> 0:50:42.795
<v B>So just like the standard library in Python and Erlang, all of these toolkits are implemented in MATLAB. Now I'm talking about the programming language. So you could easily write these toolkits yourself, but this just saves you the hassle of having to write this and then ensuring that the code is sound and things like.

0:50:42.795 --> 0:51:03.029
<v A>That's interesting. But so the difference though is—to reiterate, I guess what you're saying is Python is free and the library is free, right? Erlang can be had free, and the OTP is free. MATLAB is not free and does not include the toolkits which extend the functionality because you have to pay for those separately.

0:51:03.282 --> 0:51:34.804
<v B>As well. Right now Octave is working on—I think it's called Octave Forge, which is a repository of open-source toolkits, and they've tried to mirror as best as possible a lot of the MATLAB toolkits. So there is an Image Processing Toolkit for Octave, and actually when I did the image processing class, I used Octave and the Image Processing Toolkit for Octave, and my professor didn't even know that I was using Octave because he was still getting the .m files as my homework assignments and running them in MATLAB. You're a

0:51:34.804 --> 0:51:35.867
<v A>brave soul, sir.

0:51:35.867 --> 0:51:52.034
<v B>I know. I always wondered it was sort of a risk I took, you know, when I submitted the homework if there was a compatibility issue and I'd get a zero. But I can say a sample size of one, but you know, I did use Octave and trusted it, and it worked. So

0:51:52.776 --> 0:52:07.845
<v A>Good. Awesome. Awesome. So these toolboxes you said are written in MATLAB files—are they all written in MATLAB? Do they—are all these .m files? Are there other things that aren't written in MATLAB? Is MATLAB bootstrapped? Can you write a MATLAB interpreter?

0:52:07.845 --> 0:52:33.681
<v B>In MATLAB. MATLAB. So I think is that how it's done. That's interesting. I think you could do that, right? But the most of these MATLAB toolkits are written in C or C++. And there's something called a MEX file, and this is actually something that we didn't talk about too much in the past, but it merits some discussion, which is the idea of extending the language or binding. You know, C and C++ code to the language is

0:52:33.681 --> 0:52:34.778
<v A>that like handcuffs. Yeah, it's.

0:52:35.504 --> 0:53:44.370
<v B>Kind of it's a lot like going to prison. Sometimes it can feel like you're in prison when you're writing extensions. Oh, okay, all right. But no, for example, let's say you use the Zlib compression library and you want to do Zlib compression inside of MATLAB. So what you want to do is get at the Zlib C code from inside MATLAB. MATLAB, and that involves writing what's called a MEX file which sort of lets you call C functions using the MATLAB virtual machine. And so Python has the Python C API that lets you create PyD files which do the same thing. So you can write C code, and as long as you follow the Python API, you can get to those C functions and variables from the Python interpreter. Interesting. And the same way with Erlang—I don't know the specifics on that—but you can do the same thing there. And in MATLAB, you can do the same thing with MEX files. So the majority of these toolkits are written in C or C++ with just the MEX wrapper around them that's

0:53:44.927 --> 0:54:00.537
<v A>Pretty cool. Pretty cool. So MATLAB is an instance where they do write it in something else instead of writing it in itself, right? So you know, MATLAB says here that GNU Octave is written in C and C++ for

0:54:00.739 --> 0:54:07.759
<v B>Sure, right. Yeah. So most of MATLAB is written in other languages, in lower-level languages, but there are

0:54:08.535 --> 0:54:10.493
<v A>parts which are written in just MATLAB.

0:54:11.117 --> 0:54:14.948
<v B>Yeah. So so is MATLAB? Here's a question I'm going to put you on the hot seat. Oh.

0:54:14.948 --> 0:54:15.505
<v A>Here we go.

0:54:15.606 --> 0:54:20.753
<v B>Says MATLAB: A compiled or an interpreted or a semi-compiled language? Well, okay.

0:54:21.074 --> 0:54:45.920
<v A>So let's use what we've learned on the podcast so far. So it sounded like I heard that it did some sort of pre-looking at it, almost like the Python files, so it doesn't completely just interpreted. So I'm and I'm pretty sure it's not completely compiled, so I'm going to go with the hybrid between the two. Yeah, definitely you

0:54:46.319 --> 0:54:47.871
<v B>Got it. Oh, we need a buzzer sound, right?

0:54:50.892 --> 0:55:05.370
<v B>Ringer bing bing! What do I win? So you win. You win another question: Is MATLAB statically or dynamically typed? Oh, good question. Have we even talked about this? I don't think we have talked. This is a first. Maybe you should introduce typing.

0:55:05.370 --> 0:55:28.034
<v A>Okay. So oh, I don't know. Here we go. We'll try. So static versus dynamic typing. Well, let's try to give it short and sweet, okay? Because we could go on a long time about this, and there are all sorts of variations in between and all sorts of which one's better than the other. And as I think our stand is on this podcast, we're all about right tool for the right problem, you know, expanding your toolbox so you'll be able to solve the problem with

0:55:28.034 --> 0:55:29.232
<v B>the best tool possible.

0:55:29.417 --> 0:57:10.718
<v A>And I think dynamic and static typing fall into that um something that is appropriate for different situations. So dynamic typing—and you correct me if I'm wrong—basically means the first time that you have a variable, so I have the variable letter X, and I say X equals three. The compiler at it, or the thing that has to run the program if I don't tell it what X is, has to look and say, 'Oh, you're sticking the number three in X.' That must be—and then at runtime dynamically has to decide, 'Oh, that must be an integer,' um or if I said 3.1, it has to say that's a float or a double. And um then later being dynamic makes the thing that's running at the interpreter have to work a little harder. But then later it allows me to do things like—then I could set X equal to the string 'Hello World,' uh and it can change it for me and say, 'Oh, look, now X is a string.' And X doesn't even have to really be a string as long as if it knows what's stored there. And what currently is there versus static means—and this is something um that's common to like C and Java and C++—means you have to actually say what type of variable is when you declare it the first time you kind of use it. Um and so instead of just saying X equals three, I need to say 'int X equals three,' and telling the compiler, the interpreter, 'This variable shall be and shall remain an integer.' And that gives it some opportunity to do enhancements. But means that later on I can't decide, 'Oh, I want to reuse X in the same scope and make it a string now,' because I go, 'Whoa, whoa, whoa, whoa, whoa, whoa! You told me that was an int; you can't make it a string now, buddy.' That's

0:57:11.882 --> 0:58:15.383
<v B>Right. Yeah. So one of the things about dynamic typing is that it can create a lot of runtime errors because you can do things that you didn't expect, things that would be caught at compile time. So for example, going on to what Patrick was saying, if you say let's say later on in your code you have—you know Z equals X plus Y. If X is three and Y is four, then you know that's fine; it can do that addition. But if in between there you say X equals 'Hello World,' and then you try to add 'Hello World' and four, uh that's going to cause a runtime error. Now, you know, in a language with static typing, it knows before it even runs the code that X is a string or an integer, and so it knows that when you've done X plus Y, that combination is not valid. You can't add 'Hello World' and four; it doesn't make sense. So a dynamically typed language gives you more freedom but at the same time allows you to make a mistake at runtime which can crash your program. Oh, okay, interesting. So

0:58:15.383 --> 0:58:22.302
<v A>So back to the original question: MATLAB, having done a little bit of it, I think it's dynamic.

0:58:22.487 --> 0:58:25.508
<v B>Right. And MATLAB's definitely dynamically typed because

0:58:25.508 --> 0:58:40.004
<v A>I've definitely said, you know A equals X transpose and not had to tell it what it was. In fact, I don't even know what it was—some matrix. I don't even know what the type was. So it must

0:58:40.274 --> 0:58:48.220
<v B>be dynamic. Yeah, yeah, definitely MATLAB's dynamically typed, and that gets to a topic that's a little interesting on virtual machine latency. So

0:58:49.099 --> 0:58:49.994
<v A>That sounds bad. Yeah.

0:58:50.145 --> 0:59:50.187
<v B>This is this is where—this is sort of the Achilles' heel of MATLAB, as Patrick was alluding to. This is how we see in C++ and Java guys have jobs still. And you know let's look at dynamic typing for example. MATLAB does X plus Y. So let's just look at that function. It it has to know what X and Y are, and then based on that it has to call a different addition. So if X is an integer, if X is a matrix of integers and Y is a matrix of integers, it has a certain function that adds those two. If X is a matrix of floating point, X and Y are floating point matrices, it has a different function that operates on floating point. And so for every instruction that you execute in MATLAB, it has to do a lot of thinking as opposed to C where every instruction corresponds to one or at most a handful of machine code of assembly code instructions, and the compiler

0:59:50.187 --> 0:59:59.130
<v A>only has to do a lot of thinking still, but it knows a lot, and it only has to do it once, and then it generates an executable which can run many, many times.

0:59:59.249 --> 1:01:22.510
<v B>Right. Exactly. So you know in the case of C for example, let's look at C++. C++ has a function called find where you can give it the beginning and the end of an array and a value to look for, and it'll return if it found that value or not. Um calling the find function is about the same will take about the same time as looping through the array yourself and looking for the value. Okay? But in MATLAB, calling the find function is much, much faster than looping through the array and looking for the value. So if you're looking for five and you just call 'find my matrix, 5,' that will return instantly. But if you loop through your matrix—literally instantly it'll return in nanoseconds, but or let's say a short amount of a handful of microseconds. But um if you do, you know, if you have a gigantic array and you write a for loop in MATLAB that just loops through the array and checks for five, that will take on the order of seconds. So it will take—you know—a million times longer for you to loop through, and that's because you're executing a million times as many instructions, and each instruction has this VM virtual machine latency, has this overhead associated with it. So that's because

1:01:22.510 --> 1:01:35.453
<v A>each time when you do the find, you just have to look up the applicable function to call once. But when you're looping, it over every time it gets there, it has to try and figure out what it's doing because because it's dynamic; it could have changed.

1:01:35.689 --> 1:02:10.604
<v B>That's right. So that you know if you're doing it yourself, you loop through the array and you say, 'You know does the matrix at this index equal five?' And the matrix might have changed—like the variable might not be a matrix anymore. Um the matrix index might have changed, maybe that's not an int or maybe something weird has happened to that what it means to index the matrix. It has to you know look that up versus in C, the compiler has done all that, and it's just coming down to 'Is this address equal to five?' And that's a single instruction on the C.

1:02:10.604 --> 1:02:12.139
<v A>value stored at this address.

1:02:12.173 --> 1:02:34.667
<v B>Equal to five, right? That's right. So yeah, so you know the VM, the Virtual Machine overhead in MATLAB is extremely, extremely high, and that's why a lot of things that are prototyped in MATLAB but are meant for like a production environment are then recoded in C or C++ or Java or some other language. It doesn't have this overhead, so.

1:02:35.393 --> 1:03:20.837
<v A>So from what you tell me, you know I'd be kind of bummed about MATLAB. Sounds kind of like a like why would I pay this MathWorks company money to have it or go to the effort of using GNU Octave instead of just using C or Python? But I've had a lot of people at work tell me how awesome MATLAB is, and then they tell me that they are using like you got to do a huge sparse matrix computation, and my eyes cringe thinking I'd have to go write code and see to be able to do that. Or they're doing some Fourier transform, and I don't even know it's so complicated. I had to look in my textbook to figure out what it was. So why are these guys saying that MATLAB is really powerful and they're able to do those operations fast?

1:03:21.664 --> 1:04:04.037
<v B>Yeah, so MATLAB is extremely optimized. So the way this works is let's say in MATLAB you want to add two matrices together. You don't have to use a for loop like you would in C and loop through all of these matrices and add all of the different values at each index together. You can just say, you know if you have matrices A and B, you could just say C equals A plus B. And what MATLAB does under the hood is it recognizes that they're matrices and it has a very optimized C version. So in other words, someone maybe that was their full-time job was just to write this function that adds and does arithmetic on matrices.

1:04:04.037 --> 1:04:06.248
<v A>So they might use SSE instructions? That's

1:04:06.417 --> 1:04:23.730
<v B>Right. So it'll check and see what the capabilities of your computer are. If your computer supports SSE instructions, which stands for what is it? SIMD extensions, Standard SIMD extensions. And maybe we'll talk about that when we talk about C++.

1:04:23.730 --> 1:04:25.182
<v A>That could be a whole

1:04:25.182 --> 1:05:04.973
<v B>topic itself, probably. Yeah, yeah, definitely. If your computer has any of these extensions, it'll try and use them. If your computer has a GPU, which is something maybe we'll talk about later, it can use the Graphics Processing Unit to do some of these matrix operations. And so MATLAB will sort of query your hardware and say, you know, based on your configuration I can add these two matrices even faster using X, Y, and Z versus, you know, if you're writing in C, you're probably just going to write the addition code in for loops, and that won't use any of these optimized hardware. I see, I see. So if you're

1:05:05.969 --> 1:05:25.898
<v A>using their functions and using them in a way? So Fourier transform, they've gone in and made that thing awesome, right? If I go code one mine'll work and probably beat by far the one that you write yourself. In MATLAB, but they've already taken time to go write one that's kick butt, and it'll sure kick the butt of my code.

1:05:26.269 --> 1:06:16.371
<v B>Right. I mean those guys make a living just figuring out how to do matrix arithmetic and Fourier transform and cosine transform and things like that. There's people that's their job, and so they're naturally they're going to do it and test it and optimize it much better than someone whose job is to do image processing and they're just having to do Fourier transform as a consequence of that. So they are you know highly specialized, and so someone using MATLAB, it's sort of on the positives of it is they have the expertise of the low-level architects that design MATLAB. They have that going behind them even though they don't necessarily know how that stuff works under the

1:06:16.877 --> 1:06:52.240
<v A>hood? So what about Octave? So MathWorks has a number of employees—I don't know how many, I'm sure a lot—and they sit here and do all this awesome stuff. And you said earlier something that I thought was interesting: Octave is a re-implementation of the MATLAB language or an implementation of it that it's not MathWorks one because they obviously can't use MathWorks code; that's protected, and they probably can't even look at it because then some of it might accidentally end up in there, and they could get in all sorts of trouble. Right? So they recreate all of that stuff. So how does Octave speed compare to MATLAB?

1:06:52.240 --> 1:08:21.960
<v B>So Octave, from my limited experience, Octave is a little slower than MATLAB. There was a time I did take some of my code and run it on MATLAB code that I developed an Octave. I noticed it was slightly faster. But a lot of the limitations that we've talked about—I mean, a lot of the especially you know people are novices like myself, and MATLAB the slowness or the speed will be a result of using too many lines of code and just hitting the Virtual Machine too often. So for example, you might want to do something that you think is very complex, like, you know, for example if you know you want to loop through the matrix and if the value is greater than 0.5, you want to do something. So you might think how am I going to do this without a for loop because there's logic here and you know have different branches? And MATLAB will actually do those things. There's single commands that can sort of return all the locations that are greater than 0.5 or greater than some threshold, and if you're clever in MATLAB, you can reduce the number of instructions you're giving it and still do really complicated things. And if you're doing that, your code's going to be very fast, whether you're using Octave or MATLAB. But yeah, overall MATLAB because they've spent so much time optimizing for different computers is going to be a little bit faster.

1:08:21.960 --> 1:08:43.032
<v A>Well, I think that's a pretty good overview of the two languages. Do you have any other comments? You know, we kind of talk about learning sometimes, but MATLAB, Octave—I mean, there's tons of stuff out there, lots of good stuff, a lot of books written, a lot of professors use this. There are a lot of tutorials on university websites, and yeah, that's a good point if you're

1:08:43.032 --> 1:09:10.352
<v B>In university, chances are one of your—you know, electrical engineering or computer engineering classes is going to have an intro on MATLAB. Often they won't teach it to you; you'll have to, you know, they'll leave it up to you to read, but at least they'll have the material there. And I know that at UCF and probably even at UF, that stuff's public, so you could even get on the UCF website and read how of their tutorial on MATLAB without being a student. Awesome.

1:09:11.044 --> 1:09:13.154
<v A>Well, you want to close it out there? Yeah.

1:09:13.964 --> 1:09:23.616
<v B>Unless you have anything to say about MATLAB? What what about applications like what kind of stuff did you use MATLAB on your Arduino? Probably not.

1:09:24.848 --> 1:10:21.362
<v A>Right. No, no. Yeah, so you know we talked a little bit about projects using Erlang last week. I know that might be a good segment, but then for MATLAB, it's a little hard to use. People don't—there are some GUIs and stuff written, but because of the nature of most people using MATLAB from MathWorks, that you know people don't want they can't give you a program to run necessarily without you having to buy your own license. Right? That's expensive. Propositions there are a lot of applications written, but yeah, I mean, I've used it in school especially and some at work for doing like you said, a lot of image processing. That was a use for it also doing some linear algebra type stuff, like optimizations and stuff there, and some controls stuff was there as well. So yeah, I used it for a number of those kind of projects. I never had to write anything that was a substantial line count or a big complicated project because it's just not really one time I tried to make a GUI, but it's just not—I didn't find it well suited for that.

1:10:21.548 --> 1:11:27.107
<v B>Right. Yeah, I've noticed the same thing that MATLAB doesn't really sort of play well with others in the sense that you know you can write as we talked about those MEX files, but the interface is very cumbersome. And MathWorks, you know, they're in the business of sort of writing extensions for MATLAB, and if they make it really easy for you to interface MATLAB with other aspects of your system, then they're sort of working against themselves. There, and to some extent, but with that said, MATLAB is a phenomenal tool for prototyping, for doing data analysis. One thing we didn't talk about, but MATLAB comes with a graph—graphing, you know, tool built in so you can actually go into MATLAB or Octave. You can download Octave right now, type in sine of x, and it'll actually display a graph of the sine wave on your computer. And so that is just all of this extra visualization tools that you don't get in many languages makes it great for doing a quick prototype before jumping into C or C++. Yeah, definitely.

1:11:27.276 --> 1:11:28.035
<v A>Yeah, all right.

1:11:29.639 --> 1:12:15.015
<v A>Well, if you haven't checked out our blog at programmingthrowdown.blogspot.com, make sure to check that out. Also, if you haven't left a review for us or given us a star rating, please go ahead and do that. If you love us, make sure to tell us. If you hate us—well, you can tell us that too. Rate us five stars because we're so hate in music. So yeah, go ahead and leave your and those of you who have, thank you a bunch. It's really encouraging, helps us keep our spirits up and wanting to keep doing this. And hopefully we'll continue to hear back from some of you about what you like or what you don't like, what you'd like to see in the future, what you'd prefer for us to stop doing, how much you love Jason or how much you love me—either one will work. And yeah, check it out. Yeah, if

1:12:15.285 --> 1:12:31.960
<v B>If you don't give us any love on iTunes, we might have to start lacrimology, which is a religion. This is off Wikipedia here, a religion that supposedly embraces pain and it's released through crying as a means to move to a higher state of being.

1:12:33.240 --> 1:12:40.733
<v A>This is okay with that. I think we're gonna be done until next time. All right, have a good one, guys.

1:12:40.851 --> 1:13:03.720
<v B>Keep on programming. The intro music is Axo by Binar 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 ShareAlike and Kind.

