Programming Throwdown - Lua
Episode Date: May 29, 2012This show covers Lua, an interpreted language designed to be embedded into larger applications. News: Facbeook IPO, Javascript Arduino programming, Brain Controlled Robots. The tools of the b...iweek are JDBM/BerkeleyDB and Audacity. ★ Support this podcast on Patreon ★
Transcript
Discussion (0)
Hosting provided by Host Tornado.
They offer website hosting packages, dedicated servers, and VPS solutions.
HostT.net.
Programming Throwdown, Episode 15, Lua.
Take it away, Jason.
Hey, everybody.
So, yeah, if you're wondering why the uh cadence of the show slowed
down a little bit it's been a little bit more than two weeks people don't wonder anymore yeah
uh it's because patrick and i were on vacation um patrick was in sunny beautiful florida no this
was really hot oh really oh man already it's only may yeah but it
was like really humid in 90 something oh man you don't realize how quickly and we're gonna sound
really obnoxious jason just forewarning people because we're like oh sunny california and you
know but you really do get used to it really fast and florida has amazing weather but i went back
and i sweated the whole time yeah i remember when i went back to florida to visit my fam uh i remember my glasses
fogging up like when i got off the airplane and like i couldn't see anything and it was like just
so damp yes like it's so much more humid and hot oh yeah terrible now we said like whiny but that's okay i was in not humid uh alaska for a couple weeks and uh that was pretty
wild we uh we hiked all the way up to a glacier um a couple of guys got buried in the snow and
we had to have we had snow shovels we had to dig them out um we were walking on these like uh snow
shoes which are for people who don't know they're they look kind of like a beaver's tail they're like really like flat and wide and the idea is like you won't break through because you know the way it
works is the snow keeps piling on top but the sun especially during the day sort of like heats up
the snow and it creates kind of like a shell because it's like this water is heating and then
cooling a lot and so you have this shell this shell that's harder than the snow itself.
And underneath the shell, you have this soft snow.
And so the snowshoes allow you to sort of walk on this shell
without having to, like, trudge through the snow, right?
But if you do fall in, your snowshoes, like, break through.
Then, like, you sink in, like, and people are sinking in, like,
three, four feet in the snow. And then the snow the snow sort of like it's not like quicksand like you don't sink in it or anything but like you fall through the snow and then the snow like
comes around you kind of and like entraps you and especially since you have the snowshoes that are
like attached to your feet like you can't lift them up because there's just too much snow has like collapsed on you so um and this is somebody has to yes we did all this to go to a glacier and take a lot of
pictures but you know the the the adventure was the fun of it i think they have helicopters for
that yeah yeah we could have taken a helicopter instead we hiked it so uh our parents uh my in-laws came and uh they actually took the
helicopter so we met they meet you out there okay yeah yeah we met them there and then they took the
helicopter back and it was about i think it was like eight to ten miles um so it was quite a hike
um and we were pretty exhausted and you know at some, at some one point, the, the tour group leader was
like, you know, you've only done 50% cause we got to go back. So, um, those are the words you don't
want to hear. Yeah. But some cool things about it. One, we saw some black bears. That was pretty
cool. Um, we learned the difference between black bear, grizzly bear, and polar bear.
So, uh, black bears are the least threatening. Um, and they pretty much run away as soon as they see
you um grizzly bears and polar bears are like much more dangerous and brown bears
are also pretty dangerous um what else oh the uh the tour guides made this awesome stuff they took
like cocoa powder like like you'd used to make hot chocolate and tang and put it together and
they made hot chocolate tang and it tasted like you know those orange chocolates like it's like
a huge orange shaped chocolate oh yeah like slam it on the ground and it breaks into pieces you
know it tasted like that it was really good yeah sure so so yeah i was kind of hiking in the wilderness and but we're back with luo survived
yes we did it was pretty awesome i'll uh i have some pictures posted i'll share them with the
meme hub um page so that anyone who's following the page will get to see the pictures of the hike
or their programming throwdown page maybe too that's right the programming throwdown page
what do i say you said main hub you have too
many pages i have too many for real um i think i'm gonna add a third page now so it's gonna be
just ridiculous uh-oh spoiler alert all right so the news of the week is uh facebook so uh i jason
i think uses facebook some i have an account account, I think somewhere. All I know is Facebook keeps
emailing me and saying, you have like 30 something friend requests. And I'm just like, I don't care.
You should detect that. I haven't logged in in years. So I got one when it first came out.
It's like the OAuth, you know, like, like some things now will let you log in using your Facebook
ID. Like single sign on. Yeah. Yeah. Yeah. I'll do that,
but that's about all I use it for.
So actually I'm interested how many of Facebook's 900 million users are doing
that?
Like only interaction or is it 900 million is like registered.
And then I forget how many they claim are active,
but how many of their active users,
you know,
are logging onto facebook.com being served ads,
you know,
and you know, interfacing with the content, being served ads you know and you know interfacing
with the content how many are accessing it like on a mobile device where you don't get ads and
then how many are just using it like you for you know just logging into other websites authenticating
with stuff or just playing games yeah well i read an article that uh over a third of people just log on facebook to play zynga games so um yeah so farmville
nobody admits to playing that game but i know there has to be a ton of people playing that game
oh yeah totally there's got to be but you know i mean even just even if it's true and people aren't
you know the whole wall post on the wall share with your friends if that's kind of like gone
with the dodo,
it's still pretty useful technology, you know, just being able to identify people and their relationships. And a lot of applications need something like that to be, you know, even better.
But is it worth hundreds of billions of dollars? And that's the question that was asked at the end
of last week. That's right. So Facebook IPO, their initial public offering and jason and i are not business majors
we are not financial students oh yeah yeah let's put a disclaimer here you know we don't don't
take this as stock market advice or anything like that this should not be construed as trading
advice in any shape or form um but yeah so it was really weird we were watching it you know being in
the tech industry.
People at work were interested in this because it's a very, it hit mainstream, right?
So even the morning news was covering Facebook's IPO and it being local to this area, the Silicon
Valley that it was big news.
And so people were watching it and it was just one of the weirdest things I've seen
that people were just talking about it and then stuff just seemed to go terribly wrong.
So when it first opened, it turns out afterwards I was trying to read because when I – I think it was LinkedIn or Groupon had IPO'd.
I tried to watch it because I was curious what would happen.
And it didn't open with the market.
But this was expected and actually news reports said this was going to happen.
But Facebook was supposed to start trading when the NASDAQ opened.
They're going to trade on the NASDAQ or they are trading on the NASDAQ.
But it turned out the NASDAQ had technical difficulties that delayed the start of trading for like almost three hours or two hours, two and a half hours, something like that.
And so I read a little bit about it, trying to understand. And the best explanation I could kind of come across was that they, the IPO price, that very
first price that it's going to start at is calculated by how many people kind of say,
I'm going to buy shares at whatever price it opens at, right? So before the market opens,
they put in an order with their broker. I don't care. Buy it right away.
And those are matched, which is the whole purpose of the exchanges.
So the New York Stock Exchange, NASDAQ, the Chicago Board of Exchange,
these different markets, their whole point is matching somebody who wants to buy with somebody who wants to sell.
So I don't want to derail you.
You can table this, but I don't know the answer to this.
What's the difference between the New York Stock Exchange and NASDAQ?
Are they just two different people who do the same thing?
The technologies behind them are kind of different,
but essentially they're doing the same thing,
which is at the base level,
they're matching buyers and sellers for a given stock.
So you know that if you want to trade,
I'm trying to think of something
that's on the New York Stock Exchange.
I'm not good at this.
Like AT&T, let's say, is on New York Stock Exchange.
Then you need to go there to trade it.
Versus if you want to trade Facebook,
it's on NASDAQ.
So you need to go there to trade it.
And your broker hides this.
So your broker's job is to talk to somebody
whose job is to talk to somebody
whose job is to talk to somebody
whose job is to talk to the exchange.
And in the old days, that used to meant like some person on the floor waving a piece of paper and screaming you know i have an order for five shares and he knows it's from some guy
named jason gauchi but uh nobody else knows he's like i got five shares somebody else goes okay
i'll sell you five shares you know um but now that's all done by computers and it's done at
matching and at each level it goes through so like your broker the you know clearinghouse for your broker like these successive levels
away from you um they can match people who also are using so like if you use fidelity let's say
fidelity can match you against another fidelity customer um instead of having to go all the way
out to the exchange because then fidelity makes more money that way because they don't have to
pay the exchange for this service it's almost like sort of like you could you could relate it to like
electricity or water or something like yes you go to the nearest person who can give it you the
supply yeah right right so okay so all this is like the nasdaq when it was opening had all of
these orders because of course you know the people selling were in very small area, right? So Morgan
Stanley, and I think a couple other investment banks. So they were the only people who were
kind of giving sell orders to the NASDAQ. And then people across all other brokerages had buy orders.
And so what NASDAQ needed to do, again, this is Patrick's understanding of reading a couple
articles and trying to figure out what happened, is that they have to kind of figure out what that first price what it's going to open at is and so they have to go and
match so jason wants to buy a thousand morgan stanley wants to sell ten thousand so okay i need
to adjust the price to and fro do this and that there's limited you know they need to go through
and basically have a a queue of all of the buys and sells match them against each other and
determine what the final price at the end of all of that is and sells match them against each other and determine what the final
price at the end of all of that is but what happened so if i understand right so the price
of a stock so i guess so some people say i'm willing to buy but only for 30 and someone else
says i'm willing to buy for up to 40 right and the person is saying like i'm willing to sell
so obviously like the thing's going to try and match up the person who's willing to spend more
so so it decides oh the price of the stock should be 40 because this guy's willing to spend
40 but then if if the guy who's willing to spend 40 isn't buying all the shares that are up for
sale the guy who's spending 30 is buying half of them now the price is 35 something like that yeah
so it's whatever the last price of a trade took place. So yes. So normally when a stock's not moving, it's because Jason says, I'll sell for 30 and I go, I only want to buy for 25. And so there's a gap of $5 between us. So an order doesn't take place. And then it's not until somebody else comes along, like maybe Jason says, okay, I'll sell you for 25. Then that's the last trade. So that's the price of stock 25.
So basically there was all of these orders stacked up.
And sometimes you can say, I don't care.
Just buy me some.
I don't care what the price is.
Right.
And then what it'll do is it'll say, Jason's willing to sell at 30.
So I'll buy all of his at 30.
The next person's at 35.
I'll buy all theirs at 35.
You know, and then the person buying will get some at 30, some at 35, some at 40, whatever,
you know, as it goes up. And so all of this has to take place to figure out what the price is
going to be at open. And what my understanding was, is the way the NASDAQ software was written
is that they had kind of a unforeseen consequence where before the market opened, somebody modified
their order said, Oh, I don't want to buy 1000 thousand I want to buy 500 you know and they could do this because the order hadn't been executed yet the trade hadn't
taken place but when that happened when that queue had been filled up and you know millions and
millions and millions of these you know orders were in there that when they got to one of these
modifications they kind of had to go back to the start and go again because they had assumed, you know at you know
0.5 million that they had you know an order for this
But now the order was actually something different and so they would need to kind of
Unravel back to that point and kind of play it for it again
And so they had this loop
but then
Because they had to go through all of these modification orders and it was taking a long time because there were so many many many
Orders out there that when they came that caused a delay but then during the delay other people
freaked out and go what's going on cancel my order you know modify my order too and so every time
they would hit one of these i kind of had to start over again and so they just kind of ended up in
this vicious cycle of delaying for hours trying to get through this mess and so eventually i guess
they stopped that
and like changed it so that it would ignore the modification orders or something but it caused a
pretty big you know mess that this is a big brand name ipo facebook first day and then for like two
hours nothing happened yeah and i mean you know what the article is sort of alluding to is that
you know facebook before they went public they had you know i think it's goldman sachs i was trading these private shares so you could buy a piece of
and so basically those people didn't have like all of these things happen to them or whatever and
so they were able to sort of strategize and buy at the right time and get in on it sort of early
and things like that and those people were probably all leaving, you know, right when it IPA, they were all
selling.
Because, yeah, they bought in at like 20, right?
Yeah, exactly.
So that's the other thing is there's all these people trading beforehand.
There was these issues that, you know, if you were just you or I, you'd have no idea
what was going on.
I only figured this out much later when I was reading about, you know, reports about
what happened.
And then the other thing that happened is the stock started to drop once that problem was fixed.
And then it started to go back up. And you're like, whoa, it's going back up. Like, this is
great. It's going to happen. The IPO pop. And then it turns out that that was the Morgan Stanley,
the people doing the IPO. That was them like trying to pour all of their money into buying
the shares to try to get the price to go back up and get people excited about it. But that only lasted so long. And then it dipped again. And then,
you know, Monday, it dipped even more. And so now it's like on a slide downward,
which is kind of bad. But all that to say that it was very complicated. And it turns out,
if you didn't know what was going on, you probably were just going to get hurt.
Yeah, I mean, I think that, you know, people's, you know, it's one of these things like it's always been like personally, I always like to invest.
Like I've only invested a little bit, but I remember when I was in college, I had a little bit of money and I invested it in Apple.
I bought like I think I bought like one share or something like that because you're like a broke college student.
But it's like fun to invest in things that you believe in and sometimes you know if you believe in something uh it's sort of it's more than just
like trading based on the statistics like you're trading based on like kind of like an educated
insight and things like that it's like at the time i bought like one of the first i think i bought
like the second gen ipod and i was like this thing is great this music player is awesome so i'll buy
like one share or whatever.
And, you know, it'd be fun to sort of do this with Facebook and say, look, Facebook, they're providing awesome technology.
And, you know, it's a way to sort of bring people together, et cetera, et cetera.
But if you try to buy, at least right now, you're just going to end up getting caught up in so many people who are just playing this as a game and not, you know, as an and i think it's one of those things and you have to be honest with yourself if you're buying it for
a long term don't look at it if you find yourself looking at it and thinking about it you're not in
it for the long term yeah good point good point and so i i really don't know if like i mean i've
so many people have said oh i have this great strategy and we're constantly
like on the neuro evolution users group every week somebody's like oh i want to use this neuro
evolution program to do stock market trading and just i mean if i give you one piece of advice from
someone who's done a lot of ai in his life just don't bother you know i mean invest in companies
that like you either believe in or
you um you know you see they have a good future things like that and just just keep your money
in them for a really long time and just treat it as as as uh sort of you know and if it goes up and
down like what patrick's saying just ignore it and uh all of this like trying to like do all
this gamey stuff and things i mean there's just so much uh infrastructure in place to do all of this like trying to like do all the gamey stuff and things i mean there's just so much
uh infrastructure in place to do all of this like we went to one talk where this guy was doing
what was it like nanosecond trading or something like that and they had written their own operating
system to do this trading it's just insane so yeah this is just another case of that and if
you think i don't know like if you hear people saying they've got a system,
they're probably not very successful
and that's why they're trying to talk about it
and sell something.
Yeah, it's true.
If they were really successful at like this system,
they would just use the system
until they didn't need money anymore.
Yeah, yeah, exactly.
Now that's not completely true.
There's caveats to that.
But for the most part,
the people who are loudest about the stocks
are typically the worst traders. People who are really good at it tend to be quiet
and not say much yeah that's right and i mean it's it's um it's fun to fantasize about being
like some kind of crazy like white hat hacker ai like super genius who like makes some program that
you know makes a bunch of money but in reality there's just like massive massive hedge fund like based institutions that have like hundreds and hundreds
of like postdocs and professor ex-professors things like that in ai who like do this kind of stuff
and that's just like for them it's just like like owning a construction company or something they go
in they put on their hard hat and they they just hack the stock market all day.
So just one person, no matter what kind of talent or anything,
is just not going to stand up to something like that.
Yeah, there are always exceptions to the rules.
But it's like anything.
You have to look at the odds, right?
You always hear the kid who wants to be the NBA basketball player.
And I feel bad for them, but I try to, you know, point out that's statistically unlikely.
Yeah, that's right.
But you don't know. I'm really good.
I'm like, you're right. I don't know how good you are.
But I mean, unless you know you're the best in your state,
the best person you've ever played basketball against,
you're not making it to the NBA.
Yeah, and I mean, and again, that's a perfect example.
The people who make it to the NBA, by and large,
are people who played in like amateur athletic union by and large are people who played in like
amateur athletic union played in high school played in college and by the time they get ready
to enter the nba they have like this whole history and they have like a i don't want to say like an
entourage that's not the right word but but they have like connections they know the the the ins
and outs they like they know how the play is supposed to be run. They can go to the coach and they speak the same language.
There's all this infrastructure,
social and physical infrastructure in place already.
You couldn't take somebody who has just incredible natural talent
and expect them to make the NBA without going through these phases.
Well, our second news story,
not to dwell on finance stuff forever this
is a programming podcast uh totally uh twitter uh has changed they wanted to do better at
recommending who to follow what to do you know what things of interest um and so they're going
to start kind of i i guess it's going to be opt out but they want to start doing more tracking
of their users to figure out what they're doing, to figure out what they're interested in so they can provide better recommendations.
And of course, as always, people are upset.
You know, Twitter wants to track you.
They're invading your privacy. true. It comes down to the thing I want to bring up with this article is this problem, this walk
that these companies have to do to straddle making something that's useful to you and respecting your
privacy. Some things you can provide in a perfectly anonymous manner, but it is actually what they're
trying to do. I feel it will be better if they track me, but them tracking me means they have
information about me that I don't necessarily want them to have. And so how do I make that decision? How do they make that
decision? How does somebody who doesn't understand any of these things make that decision? It's very
complicated. And it's something more and more that I think Facebook, Google, Twitter, all these people
are having to address. How do they provide tailored, personalized, useful results to their users without invading their privacy too much.
Yeah, definitely. I mean, that's a huge, huge concern, right, for these companies.
Because, like, let's say Twitter makes this and there's a hole in it and somehow advertisers get access to, like, your interests at a very deep level.
And let's say they get access to your address even and things like that.
I mean this this sounds
really far-fetched but i actually went to uh and this is real i went to a uh uh what is the word
a conference where somebody was giving a talk and they actually using twitter posts or tweets i guess
they were able to determine someone's location of where they lived with like remarkable
accuracy. And they use the, so Carnegie Mellon comes up, has a Twitter like data set. So I don't
really know much about how it works. It's somehow anonymized, but basically it's like a, it's like
a slice of, of all of Twitter's data. And so researchers can use this information that's been scrubbed somehow
to uh you know do various experiments and things like that and the kind of things that people can
deduce is just shocking well i saw one that it was just by the dialect like the words you use
are regional so you can identify where somebody is in the country by just the words they choose
to use even in their 140 character tweets yeah
yeah that's a big part of it and they also do um it's it's kind of it's based on your connectivity
like people you're connected to because you think about this right like if if you know if they could
figure out for half of the people then they could just use the connectivity like who's friends with who who's following who
to figure out the other half you know so if one person says oh i went and saw the giants i walked
to the giants game today then you know it could use that phrase to figure out well they must be
really close if they walked and so everyone they're following you know is statistically
likely to also be in san francisco etc etc, et cetera. And they can, you know, build all these inferences and layer them on top of each other.
So, yeah, I mean, there's, the short of it is there's an incredible amount of thing,
of interesting things that they can deduce from your information.
And they can use that to sort of provide, like, really, like, targeted-based, you know,
whether it's advertising or whether it's giving you information,
whether it's assisting you with your searches
or there's tons of things that Twitter can do with this data.
But yeah, at some point it crosses the line of being creepy.
And that line is different for each person.
That's what makes it so difficult.
Or not even the creepy,
but just like you said,
the risk of somebody leaking out information
you didn't want leaked out.
Yeah, yeah. Both of those are just like you said the risk of somebody leaking out information you didn't want leaked out yeah yeah both of those are just really dangerous um like that was one of the big things with uh oh there was some social game i can't remember what it was called but it was basically
like a you you managed an aquarium and like there's different fish and your friends had fish
or something and they were doing pretty good it was like a startup and they had like a few million users and people were buying fish and
things like that then they did something which was kind of sketchy like i can't remember what it was
oh it's like somehow they'd figure out where you lived based on like your facebook posts and things
like that then they try and like put you in an aquarium with other people who live near you
and and the whole thing died like people got freaked out and every like a bunch of people
canceled their account and uh that startup went under like almost immediately wow yes it's like
a huge concern is is you know walking this line between oh this is really cool and this is totally
creepy well onto something completely different uh i read this
article that was i thought was really cool we've talked in the past about microcontrollers and
embedded programming and here's a guy um we have a link in the show notes but who is programming
controlling his arduino which is one of these uh small embedded microcontrollers uh with javascript
and i thought that was really cool how somebody had a passion.
They really want to write stuff in JavaScript.
And so they actually figured out how to use JavaScript
to do something you wouldn't expect.
Yeah, yeah, totally. That's pretty awesome.
That's a benefit between, you know, I mean, remember, like,
it wasn't too long ago where compilers were totally closed source,
locked down, and it's like
you would you would take your c or c++ code and you'd build it using gcc uh you know and then
you'd build it with the intel compiler and you'd build it with like this other compiler and all
these you know it'd be so much faster and things like that and it's just nice to see that like
the whole industry has really matured and all of these tools are just totally open and accessible.
And if you want to do something crazy like this, like recompile the JavaScript virtual machine for Arduino, you have the freedom to do it.
Yeah.
So, well, so I guess the way this actually worked is there's Node.js, which is C++ JavaScript interpreter that actually, guess powers Chrome is the same one
so V8 is that what it's called I believe?
That's right. Yeah and so in there
because of the C++ they could
basically create a crafted interface
between the JavaScript portion
and the C++ portion which had
access to the serial ports
so you could control
commands out the serial ports and then with
a little bit
of fiddling and magic wizardry we'll call it on the serial commands that got
sent across you could send across special ones that were interpreted on
the Arduino side to blink a light or read a sensor or whatever ah nice so
that's awesome it's pretty cool.
It's kind of crazy to see what lengths people will go to to use something that isn't necessarily the first closest tool for the job
that you would expect.
So people would normally say, like, oh, CRC++.
But here's a guy who took JavaScript,
maybe one of the least likely ones you would say,
and got that to work as well because that's what he liked.
Yeah, isn't that crazy how popular javascript is
becoming like it just blows my mind there's a there's there's node.js which is pretty awesome
then there's um oh there's i'm totally drawing blank oh oh the android um what is it called
i think it's called like mojave or something but basically the thing is you write uh javascript code and then it turns
your javascript code into either like uh or it has like it's a virtual machine written in java
to run your code on the android and it also has one written in objective c let me see if i can
find this okay um but yeah basically so people are writing native, like, phone code in JavaScript.
And then it's, like, then they're just compiling it or they're running it on all the phones.
So they don't have to, like, write their code in Java, write another copy for the iPhone,
write another copy for the Windows phone, et cetera, et cetera.
Oh, cool.
Yeah, yeah, JavaScript is becoming extremely popular.
I mean, it already was popular,
but it's just growing at an alarming rate.
Well, on a similar topic to controlling real-world things
through your computer,
I guess this is another dream of science fiction,
but I read an article about people controlling robots
with their brain.
And so this one was actually,
I think she had this a lady who
had a brain implant was able to get a robotic arm to bring her a cup of coffee and actually tip it
into her mouth so she could drink some um why use a very steaming hot beverage i guess just to show
how confident you were in your system but that seems dangerous to me but uh it is a amazing feat
and there's a lot of problems and they said that they
had to do it multiple times and like i think they said it worked like four out of the five times or
three out of the five times or something so there's time she was burned horribly oh no no i think she
just you know dropped it or tipped it over or whatever um but yeah so it's kind of cool this
brain computer interface is for paralyzed people and that's i mean that's just
amazing that what it might be able to do to help those people and then one day you know maybe even
the rest of us to be able to do that is like i said a dream of science fiction and young kids
everywhere yeah i mean everyone should watch this video it's amazing so how does that work is it is
it based off like i mean it's not literally like it's not hasn't
punctured her skin right yeah no no no this one has so what they do is they okay i think it's a
sensor maybe like the size of a grain of rice something really small and they bury it in a
certain portion of the brain so they kind of like drill a hole in your brain and put this long
needle with something on the end of it into this certain point and then there's a bunch of little probes on the end is what i understand and they measure the electrical
spikes in the area of your brain so neurons when they fire and talk to each other in your brain
when your brain has activity those emit emi signals electromagnetic signals um and so when or i guess just em signals um i didn't get extra
letters and the they're able to pick those up you know measure those um and see that your brain has
activity but at first it just kind of seems random because you have no idea what neurons you're next
to or what exactly they're for what they're doing but then you, kind of like a child learns, you learn that, oh, when I think of the
color green and smell the color coffee and try to move my left finger, you know, my left index
finger, like I noticed that the arm kind of does this wiggle motion. And so then over time, your
brain kind of learns to think in a certain way to be able to control it. And what it is, is just
these electrodes picking up the signals and detecting that
your brain is emitting a certain pattern.
And then they interpret that pattern as,
you know, move left or move right, move up, move down.
Ah, that's amazing.
But this one actually gets implanted in your brain,
the one they're using.
Yeah, because we've seen one where,
we were looking into one a while ago.
Right, that goes on the outside.
Yeah, yeah, but that one had
mixed results but it looks like this one is much more fidelity yes because it is the skull blocks
a lot of that uh electromagnetic signal yeah that makes sense makes sense so cool so yeah the next
article we have is why airplane bathrooms have ashtrays and i assume it's not just because the airplane was built before smoking was
banned no so that's the shocking thing and even new airplanes that are built now have ashtrays
with no smoking symbols on them wait they have the ashtrays themselves have no smoking symbol
yeah you should see that you should see some of the pictures this article there's literally an
ashtray with a with a big no smoking on it.
And so you think to yourself, well, this is like some kind of like corporate, you know, bureaucracy kind of thing.
Like somebody didn't do their paperwork or something and now all the airplanes have to have, you know.
But no, it's actually a result of something that was quite tragic.
Somebody smoked, was smoking on an airplane while it was in flight.
And, you know, there's nowhere for them to put their cigarette because because smoking had been banned so they flushed the
cigarette down the toilet and this this seems like very bizarre to me that's what i'm about to say
but somehow that caused the plane to crash like almost everybody died like i don't understand
how flushing a cigarette down toilet can do that maybe they maybe they didn't flush it down the toilet because it said it was it was like poorly disposed of maybe they
just put it in a trash can oh maybe they put it in where you put your paper towels oh yeah that
makes much more sense but yeah basically somebody did that and the plane crashed and everybody died
and so um so so they they decided that they're going to put ashtrays on
planes uh mandatory and the idea is you know that where they're getting at here is yes you know in a
perfect world you would you would have the no smoking symbol you know above their head you have
the smoke no smoking on the entry of the door the no smoking all over the bathroom the signs
everywhere and people just wouldn't smoke right but the reality is that you know eventually No smoking on the entry of the door, no smoking all over the bathroom, the signs everywhere.
And people just wouldn't smoke, right?
But the reality is that, you know, eventually you have to come to terms with that, you know, this is an addiction and that people, you know, their tendency.
Like if you did a use case study or something, you'd find that people just have to smoke, right?
And there's like one in a thousand or however many that just have to do it and so by putting in the ashtrays they're saying well look you know you know if somebody has to smoke if they're going to just like if they're willing to take
that risk of the fine and the alarm detector going off and them going jail and everything
and they're still going to do it then like we have to have a way for them to do it without
blowing up the plane and then it goes from there into like a little bit of hyperbole but it's actually really interesting
on uh sort of like how do you design for human nature and it gives like a doorknob as an example
um so i thought it was pretty cool so definitely give that article a looki yeah well um so it did say that the airline crashed because the smoke so
however it was improperly disposed of it filled the cabin with smoke and a bunch of people died
from smoke inhalation because there's no like when just pressurized and everything there's nowhere for
the smoke to go oh wow and so it just keeps building in the cabin oh so it's probably what
you're saying then he put it in where the paper towels
are and it causes a huge fire it was in 1973 so it was actually a while ago yeah yeah definitely
so all right is it that time it's time tool of the bi-week yeah all right you're up first man
all right so my tool of the bi-week it's actually two tools wait wait wait wait wait wait i know that's not fair
i'm breaking the rule man but now you're twice as awesome as me this week we've been we've been on
vacation i want to come back you know all all pistons firing so these the you're the you're
going to only use one of these tools though depending on what language you're programming in
um the tools are berkeley db and jdbm3 and basically what these are let's say you know let's say you
want to store a lot of data so what you want is a database right but when most people think of a
database they think of like mysql let's say so you know here you are let's say i'm writing some
program to i don't know just like count the number of times someone visits my site and just
store it on disk right so if i do mysql i have to set up a mysql server i have to you know like
have that service running on a machine somewhere i have to open that port because mysql communicates
through tcp i have to write some mysql client which uses the tcp. I have to write some MySQL client, which uses the TCP socket.
I have to serialize all my data
and take my data,
which might be a bunch of classes
and functions, things like that,
and turn it into MySQL tables.
I have to create the schema.
There's so much overhead, right?
You can avoid some of that by using SQLite,
but maybe that's for another week.
Oh, yeah, yeah.
Well, even with SQLite,
you have to do a lot of that. Yeah, but you still have some of those problems, yeah.
You have to create the tables. Sorry, not to rain on your
parade.
So, the simplest
thing, the simplest database
that I can think of, at least,
is a key value
pair, right?
So, basically, you just have a list of keys
and a hash table, basically,
but on disk.
And so that's exactly what Berkeley DB is.
It's just a simple hash table that persists the disk.
And you can put in keys, you can put in key value pairs,
and then later on you can search for the key and you can get the value.
And it does some clever caching.
But if you fall through the cache, cache you know it has a backup on disk
and it's also transactional what that means is you can queue up a bunch of commands and then you can
commit the commands and so let's say for example let's say i load patrick's profile i'm a web
server and patrick logs into my server on his computer and uh he goes and like
changes his password but then at exactly the same time uh evil patrick who's masquerading as regular
patrick is on patrick's phone and changes his password right there on the phone too or changes
something else changes his like profile picture it a Hello Kitty picture at exactly the same
time.
That can cause issues.
You could end up saving two things twice, and one can collide and things like that.
So you need to support transactions to deal with things like that.
So the thing that comes in second, the transaction will fail.
It'll say, hey, something weird has happened.
This data has been modified
you need to take a look at this and sort this out so it handles like the very basics of what
you need to have a have a what's called an ACID compliant database and ACID I don't remember do
you know what it stands for Patrick it's like atomic consistency isolation durability ah there you go perfect so yeah so you want that
so uh berkeley db has a bunch of bindings like c c++ um you know i think there's a python binding
actually i think it's part of python uh actually now um so if you're using java now java already has a really nice collections framework
right like java has map and you know hash map tree map linked list array list all these cool things
and since java already has all this infrastructure there's something called jdBM, which basically what it does is it gives you a map, like a Java map, but that map is backed to disk.
So in other words, you could write your program and have everything in memory, like all your usernames and passwords and all that in memory.
And then once your program gets more mature and you say, okay, I want to to deploy this you can just replace the new hash
map with jdbm3 hash map and it'll just deal with everything under the hood so it'll put things to
disk i need to go to disk it'll load things from disk etc etc and actually berkeley db is the most
popular database because it's installed like multiple times on everyone's machine like even if
you run windows windows actually uses berkeley db for a number of things oh wow so this doesn't
handle over the network though right like this is just for like local persistence to disk right
that's right and the other thing is um it doesn't handle multi-processor although now there are some
versions that are starting to get into that
okay but for the most part it's you know if you have a single program it could be multi-threaded
and i think we talked about this but uh just to recap really quick multi-threaded means you have
you know a bunch of different threads that could all be doing different things but they're all
sharing the same memory versus multi-process each one is a completely different program
and so uh berkeley db and jdbm don't support multi-process yet but they support multi-threaded
so nice yeah so i mean unless you're you know a lot of websites use mysql um but really unless
you're like some kind of powerhouse, you'd be totally fine.
Like if you're doing your own coding, you'd be totally fine using something like this.
And you'd save yourself a ton of time.
And then I think if you use like a key value pattern like that, right?
So if you can reduce it to something simple like that, then I think it would be easy to move it over to network.
Like I think Redis and other databases are kind of the same idea but for network connected
things so if you wanted to add in sharing with other people if you're using this key value
mentality there are other solutions that will take you to the next step that's right there's couch db
redis there's um h base there's a ton of them and we should maybe talk about dedicate some time to
that you know in the future because those are actually really really interesting right all right um yeah well what about your
tool of the bi-week nothing nearly so enterprisey or program i don't know anyways audacity so i've
i've thought well for sure we've talked about audacity before and maybe we have and maybe my
show notes are lacking but i
looked through all the show notes and i couldn't find it wow and i decided we needed to talk about
it because it is what you are listening through us the power by which you are listening to us now
definitely so that's what we use to record this podcast and edit it and you know it before to do
this kind of thing you used to have to buy expensive software. And then when Audacity came around, it really changed all of that.
So you can record, you can clean up, you can edit, you can mix multiple tracks together.
If we had cool sound effects, we would be able to put them in.
For right now, we use it to do our intros and our outros.
All that kind of stuff we do using Audacity.
And it's amazing and it's free.
And it's open source it's free and it's
open source yeah i remember when i used to use adobe premiere and then i think even before that
i used something called cool edit or maybe that was after but yeah i mean at some point i use
these programs they cost like hundreds of dollars and it was just it's just like they're very slow
and clunky and um you know audacity works on windows linux macacity works on Windows, Linux, Mac. It works on anything. Really nice interface.
Let's you do all the, like, they added all the polish, you know.
Like, for example, you know, I'm on my headphones,
and there's an option so that it won't use your speakers,
like won't use your microphone that's hooked up to your computer
if you have the headphones plugged in and things like that.
Yep.
Very nice.
Very powerful.
And if you don't know about it and you want to do
any sort of audio editing that's where you should go yeah totally totally so all right let's talk
about lua lua now how similar is lua to a luau very similar it's because i like luau's i love
luau's the only thing sometimes like like you see that pig what is that called
when they have the pig with the apple in its mouth yeah yeah suckling suckling pig that's right yeah
the suckling pig i think lua core dumps a lot more than the suckling pig but that might be because
the pig is dead oh okay we might have lost people from our trying to be punny
but yeah so lua originated in brazil it actually has an interesting history at some point brazil
actually had a like some kind of law where they weren't allowed you weren't allowed to import
source code it's like the craziest thing i've ever heard of yeah it's like almost like a trade
embargo of sorts yeah we want our country to stay behind in technology maybe that's why so many of
them use orchid oh man uh but yeah so so there's so there's uh so for people who don't know uh
orchid is a social network sort of like predecessor to facebook or any of these it was like even earlier than
friendster and for some reason it's like massive adoption in brazil but that's it
yeah although they said it's not anymore facebook surpassed or popularity in brazil
oh really well it's about time uh but anyway so uh yeah it started off in bra Brazil as a need to sort of create embeddable language.
But, you know, actually, although it sort of sounds like something, you know, it was created because there was no alternatives in Brazil.
The reality is it's a fantastic embeddable language.
And, you know, at the time it was created, the only language even remotely, you know, similar in its ability to sort of integrate
other languages is TCL or Tickle
as some people call it
we're talking like 1993
yeah this has been around for a long time
and I don't know
I've used Tickle a couple of times
like very very light usage
and I couldn't stand it
is that how you say it? I don't think I've ever heard it said that way before
I always just called it Tcl yeah i've heard both okay let's see if you all dig it up
it's okay it doesn't matter but yeah i mean lua is it goes way back and it's been around for a
while and the interesting thing about it is that a lot of those things that used to exist around
you know aren't really around anymore um but there are certain artifacts we have today
that are just from older than you would imagine.
Like even just the Bash shell and Bash scripting
and scripting on Linux or Unix type terminals.
These things are things that have been around for a while
and they haven't changed much.
And even things like Java.
When did Java first release?
We did not do research.
I was in high school, so it must have been like 98 or 97.
Yeah, so I mean, you're talking about even older than that.
It's saying 1995 was when it was first released.
So Lua was two years predating even Java, which is kind of crazy.
Yeah, yeah, Lua's around forever.
And it's still relevant today. Yeah, totally. So it is kind of crazy. Yeah, yeah. Lua's around forever. And it's still relevant today.
Yeah, totally.
So it is Tickle, according to Wikipedia.
I will correct my language from henceforth.
But yeah, so Lua is interpreted.
So it's like Python where it's compiled, but it could be compiled at runtime.
So it has that interpreted feel. So it's like kind of transp could be compiled at runtime so you know it has that it's like kind
of transparently compiled yeah exactly so you can create lua i think it's called lua c files just
like the pyc files in python and then you don't have to do the compiling um save yourself a little
bit of processor but uh yeah for the most part everyone just uses the source files and treats as an interpreter it's similar to python as dynamic typing but one thing it's very different
in lua everything is based on tables and meta tables and you know lists has dictionaries has um uh classes so a class
in python is uh has that sort of dictionary meta information and then has the class assignment
stuff i think does python have anything else uh core structures i think that's all of them
i mean there's like sets but sets are based on lists.
And then it has the usuals like string and number and all that.
In Lua, all you have are tables and meta tables,
which is something we'll talk about in a bit.
But with just tables and the primitive data types,
you can actually create a wide array of things in Lua.
Should we try to do an example of MetaTable?
I think I can try.
I'll try and pull this off.
Okay.
So there are features in all of these languages
which people tend to get excited about
or talk in depth about on the internet,
but that doesn't mean they...
And I don't know if this is the case with Lua or not i i personally haven't used the meta tables part of
lua but i mean just before you go into the explanation jason not to interrupt you uh totally
uh yeah so i mean like there's even like we talked about in c++ about meta programming
you know um this is something that gets talked about a lot because it's kind of cool and nifty
and whiz bang um but that doesn't mean that the majority of code even uses it or ever thinks about it or ever even comes close to thinking
about it like um but it might still be talked about on the internet and there's something
that as programmers we need to do a little bit of due diligence to avoid and again i don't know
that this applies in this specific case but just because something is discussed on the internet or
talked about doesn't mean it's something that you need to have in your program.
Yeah, totally.
I mean, I wrote Lua for a little over a year as a scripting language to another program that our company is working on.
But, yeah, we didn't use metatables or anything fancy like that.
And to Patrick's point, most of the time in Lua,
you're just taking advantage of how Lua can work with other programs.
And so you're usually doing the fancy thing in that other program.
So sorry, metatables.
Yeah, I'll give metatables a shot.
So first let's talk about tables briefly.
A table in Lua is a hash table.
It's an associative array.
So, for example, if you want in lua you can say you know you can create a new table like my table equals you know open brace close brace and then
you could say like my table uh key sunday equals zero and my table monday is one tuesday is two
wednesday is three etc etc and so then later on, you could say, well, what is Wednesday?
And it'll tell you three for the third day of the week, right?
Or I guess the fourth day of the week is zero-based.
But basically, you know, it's an associative race,
so it just uses the equals operation for whatever type it's using.
So you could have a table with tables in's using so you could have a table with
tables in it or you could have a table that maps numbers to strings it doesn't matter right because
it'll just uh it knows how to compare if two things are equal and so it can just hash anything
so wait so so i mean this is the second time we've kind of brought this up but maybe a quick
explanation of hash tables just like the idea of hashing is just taking one thing,
running some sort of function on it, and producing
a number. So like
if you take one number, you might
multiply it by 10.
And that's your hashing function. That's not a very good hashing
function. And then typically
like the simplest way to think about
a hash table is just an array. So let's say you have an array
that's size 10.
And you want to store things in it that aren't necessarily obvious that it should be an array. So let's say you have an array that size 10 and you want to store things in it that aren't necessarily obvious, you know, that it should be an array. So like to
Jason's point, if you want to store the day of the week Sunday somewhere in there, where should
Sunday go? Well, you could take the letters of Sunday and like add the ASCII value of each of
the letters, you know, modulus. So divide that and take the remainder of 10 and say like, that's the index
in the array I'm going to use to store anything that's Sunday. Or like Jason's saying, you can
use it kind of like more like maybe an enumeration where Sunday is kind of like the zeroth object or
store zero in it. So when you look it up later in the table, you can pull out the number zero
and you know that that is the value Sunday should have. Yeah, totally. And so there's something in
hash tables called
collision so let's say for example let's say you did what patrick was saying where you add up all
the ascii values and divide in modulus 10 and just coincidentally let's just say sunday and wednesday
when you did that they both had eight that doesn't mean that wednesday is going to replace sunday
what happens with the hash table is when it goes
to insert Wednesday, it'll see, oh, Sunday is already in this table, but Sunday and Wednesday
are two different things. So then it'll do like what's called a deep compare. So first it'll
compare just the hashing, the hash function. And if there's a collision, it'll do a deep compare
and say, is this the same item? Should I replace it? If it's not, then it'll, a deep compare and say is this the same item should i replace it um if it's not then it'll
there's many different things it can do then but uh um but yeah basically a hash table is a way to
get really fast lookup and entry of items and the reason why is because you don't have to search
through the whole array or whole you know storage because you know exactly where to go because of
this hashing function.
Right, and you don't have to sort either or try and put things in order.
But it doesn't help you.
If you do need a sorted list, a hash table won't help you.
That's right.
So, yeah, so tables.
So in Lua, let's say you have this table with days of the week,
Sunday, Monday, Tuesday, etc but you want the table to do
something special if it gets a string
it never saw before
this is sort of a weird
example coming up with on the fly here
but let's say
you had a table where
if someone, let's say this is
some kind of like cache
so it's a table to get the day of the week, but it's not always accurate.
So for example, let's say the table just has English days of the week.
So as the keys in the table would be Sunday,
so Sunday would map to zero, Monday would map to one,
Tuesday would map to two, et cetera, et cetera.
But then you could end up getting...
Domingo. Yeah, Domingo. Thank you. to two etc etc but then you could end up getting uh domingo yeah domingo thank you i couldn't remember any any day for any language okay so let's say you get domingo what you could do in
lua is you can create a meta table and what the meta table do is if there isn't a key in the table
but you try to look it up anyways like you're trying to look up domingo but it's not in the table, but you try to look it up anyways, like you're trying to look up Domingo, but it's not in the table, it could fall back on the meta table. And the meta table might do something like
go to some database that has like all the days of the week for all the foreign languages.
So by using this meta table concept, you know, if you want Sunday, you get it really quick.
You know, it's in the table,'s in memory but if you want domingo
which maybe you don't want that often let's say because the majority of your business is in the
u.s right now but occasionally there's a domingo that comes across um then you want to have this
meta table that captures that hits the database and then returns you know whatever what is that six or something is
domingo saturday or sunday uh it's sunday oh sunday because it returns zero for that
so that's what meta tables that you do and if you look on wikipedia there's some pretty clever
examples there's one where they uh they do the fibonacci sequence, which for people who don't know, it's, what is it, n plus n minus.
The sum of the two digits of the, or the two prior entries in the series.
Right.
So, for example, like, you know, the Fibonacci number of 1 is 1, and 2 is 1.
But then 3 is going to be f of 1 plus f of 2, which is 2.
And the Fibonacci sequence of 4 is going to be f of 2 plus f of 3, which is 3.
So they were able to use the metatables to say,
okay, I'll create a table, and 1 is 1 and 2 is 1.
And then I create a metatable where if they want anything besides 1 or 2, it's
the table entry of n minus 2 plus the table of entry of n minus 1. And so that all kind
of recurs backwards and Lua is smart about caching. So let's say something happens where
all of a sudden you have an influx of Spanish speaking people hitting your website, and everyone wants Domingo all of a sudden,
Lua will actually cache that value.
So you won't have to just keep hitting the database.
So it's clever about that.
This is also called memoization.
When you do like... Well, memoization is more with respect to recursion,
but if you do these kind of things
where you cache data in a table, in a hash table,
so you don't have to keep calling a function, Lua will do that for you.
It's pretty clever.
So it's cool because in some ways you're able to just use a table that in theory has infinitely many entries in it, has all of the Fibonacci sequence in it.
But then only when you actually try to use some entry of the Fibonacci sequence does it actually go and figure out what that number should be.
Right.
This is also called lazy, like either lazy loading or in this case lazy calculations.
It only calculates what it needs to.
That's right.
That's right.
Interesting.
So we kind of hinted at some of the strengths of Lua that we already mentioned that it was used as like a scripting language.
And it's kind of used as a scripting language I guess because it works so well with
C and C++ it's really easy to embed it and you said you've worked with it this way before?
Yeah definitely so Lua was designed to integrate with with C specifically but later on with c++ and so you know just to put this like in just a contrast
um let's say you want to embed like python for example well you have to use this like really
clunky like python c api and uh like everything is kind of based on these functions and you have
to like convert like python oh Oh, I forgot the...
So there's calling C from Python,
and then there's scripting events in C with Python.
Right, yeah.
And so both of those get complicated
because you have to transmute the types.
So in Python, you have lists, you have dictionaries,
you have all these different types, right,
as we talked about at the beginning. And each of those, you have dictionaries, you have all these different types, right? As we talked about at the beginning.
And each of those, you have to create some kind of analog on the C or C++ side,
or you have to create some kind of like accessors.
So you have to be able to say like, oh, this is a list in Python,
so I want to get the fourth element in this list in my C++ program.
Or I have this C++ array, I want Python to think of this as a list, you know,
and this kind of stuff ends up becoming like,
no matter how you do it, ends up becoming really clunky.
Lua, you know, it's kind of a double-edged sword.
Like it only has tables, but on the plus side,
it only has tables, right?
Which map exactly to C++, you know, hash maps.
So it makes it very easy to integrate++ hash maps.
So it makes it very easy to integrate the two
languages. And even easier because
people have, since so many
people are doing this with Lua, or
embedding it, they've created some
amazingly streamlined libraries to
make this happen. So one
is LuaBind, which I used
briefly. But the second one
I'm more familiar with is called Diluculum, which I used briefly, but the second one I'm more familiar with is called
Diluculum, which I think it's some African word or something, but we have a link in the
show notes so you guys can look it up.
But basically it's for C++ and it has a thing that maps Lua tables, actually anything in
Lua to the analog in C++++ and sort of does it all transparently
so you can just say hey you know go to the lua world and get me this variable and even like on
the other side in your lua program you can say hey go to the c++ world and get me this variable
and it does it all like very transparently nice yeah it's pretty awesome so because of that
strength you can think like
anywhere you'd want to script something so things you might want to script like often you hear this
in like video games so video games want to have some scripting done where you control what happens
when a player swings a sword and hits somebody you know what like what happens you can script
that event like i want to decrease damage by 10 and i want to you know trigger effect magic lightning bolts you know onto the screen and
these kinds of things you can imagine like through play testing and stuff you might want to tweak
those but you don't have to go in and actually like you know edit the code or have to even know
what the code means you might want to have other people be able to make those changes
and so scripting languages just provide that flexibility to you.
Yeah, exactly.
I mean, you know, most of these game studios,
the people who are creating the content, they're not programmers.
You know, they're just, they're often like game designers
who are just sort of like playing with the different variables.
Like, oh, if I make magic more powerful, how does that affect the game?
And let me play for a few hours on this setting.
And they can't afford, even if they did know how to program,
they can't afford to be recompiling code all the time and things like that.
They want to just make changes quick.
And so Lua sort of gives them that flexibility.
Yeah, Lua is also very fast.
You know, because it only has tables
basically hash tables
it doesn't have to do a lot of thinking
it doesn't have a lot of complicated instructions
or anything like that
and so the execution speed is awesome
and you can even use Lua on embedded devices
and things like that
which don't have strong processors
and not worry about it
yeah
so there's some good strengths and weaknesses I think you kind of alluded to the fact that don't have strong processors and not worry about it. Yeah.
So there's some good strengths and weaknesses.
I think you kind of alluded to the fact that they really only have tables and meta tables.
So, I mean, that's a strength that it's very simple that way,
but also, like everything, that can be a weakness as well
that it doesn't always obvious how to get what you need to get done.
Yeah, totally.
I mean, people have tried to shoehorn so much into the tables and meta tables.
Like someone created like a class-based infrastructure where, you know,
if you have getters and setters as like items, keys, and the table,
but it's really hacky.
And then once you start doing things like that,
performance sort of goes down the tubes because it's not the language isn't really designed for that it's
not really designed for you to hit a meta table every time you want to access a variable
and the other the other weakness is that it's just not very fully featured you know i mean no one's
taken the time to bind your favorite library to lua chances are you know like I mean if you
really like fluid dynamics or you want to use like some kind of physics engine
or if you want to do something like some kind of heavy like differential
equations or something you know chances are that that hasn't been you know
there's no binding for Lua for that and that's mainly because you know Lua is
designed to sort of be a supplement to another language.
So you're just not going to get the kind of features you get.
Like in Python, for example, if you want to just, let's say you're streaming out a bunch of data to disk,
and you want that data to be compressed.
Well, there's a gzip, you know, library, like part, which is part of the Python
standard library. So there's compression built in, you can say, look, write this to disk and
make it compressed. So that doesn't take up as much space. You're not going to find that kind of
functionality in Lua. So if you need those kind of bindings, you're going to have to write them
yourself, which could be really tedious. Yeah, yeah but there are some libraries it's not to say that it's not fully featured or
functional and we have a link here but i mean there's there are libraries for it and you know
it's fairly well supported it's not and again being around so long it kind of has to be and
it's just one of those things you're gonna have to go in and say this is what i get and not expect
that when you find a cool tool that it will have a binding for lua yeah yeah totally yeah i mean to patrick's
point there's a we post a link we'll post the link on the show notes and there is a ton of
there are a ton of uh you know different libraries for lua and things like that so
definitely uh i wouldn't shy away from it because of that um but yeah i mean definitely if you have some existing application
and you find yourself just constantly recompiling it and changing constants and recompiling it then
you probably should just be using lua so the people that use it i mean we talked about it
tends to be scripting so world of warcraft uses lua as their scripting engine so um you know other
people i know there's some mods and stuff that are written with scripting language in lua also
um i use this program to do some photo editing lightroom which is an adobe product that does
workflow for taking pictures and editing them and then you know kind of making libraries or
catalogs and saving them out.
And all the UI in there was scripted in Lua.
Yeah, I mean, UI is an obvious choice.
So in general, just to talk a little bit about things, like why you need scripting, right?
Now, we talked about a couple of the reasons, you know, with the recompiling and things like that. But also, some things like UI specifically is just a pain to write in a, you know,
statically typed language like C++.
So, for example, let's say, you know, you want to hit a button or a menu item,
and when you hit that button, you want a function to be called.
Well, in C++, to do do that you have to create some kind of
interface class it's a virtual class which has some method called you know like perform function
and then all of your classes which need to have this function need to inherit from that class
and you need to like downcast the class when you pass it into the button and it just
you have to go through all these hoops right but if you have an interpreted language like lua which is driving your gui then you can just
bind different actions to different buttons and lua doesn't care about the types of the
of the you know actions so it doesn't care if like oh this one function was part of a class
and now like you have to do all sorts of crazy wizardry to get access to that.
Lua, you know, because it's a scripting language, it doesn't have any of that overhead.
And so it makes it great for doing UI.
Yeah.
Yeah.
So Lua.
Yeah.
Give it a shot, man.
Don't write your UI in c++ if you can help it
so um on general notes i guess meta notes kind of like meta tables uh anyways um we have gotten
some good feedback from people some extra language suggestions some people writing in to tell us that
they found tips or tricks that we've mentioned useful. And as always, we appreciate that, you know, we are always glad to be out there and helping people and at least entertaining you,
hopefully. Yeah, totally. So if you do have something to say, you could check us out on
Google Plus, we have a programming throwdown plus page. And we're pretty good about putting the new
episodes linked there. Or, you know, if you have comments you have comments you can of course put them there hopefully positive but uh we're willing to take criticism as well yeah you can always if you
have something you don't necessarily want there you can always email us at programmingthrowdown
at gmail.com yeah one interesting thing somebody wrote in and said that uh i guess they can't
access the g plus page unless they're unless they have a G Plus account.
Is that true?
Oh, I don't know.
Yeah, to be honest, I haven't tried.
We shall try.
I thought it was public.
I thought there was a public section.
But, yeah, as Patrick was saying, just to reiterate,
if you can't access us on G Plus for whatever reason,
don't hesitate to shoot an email to programming throw down at gmail.com.
Yeah.
And I guess other,
if you can't see the plus page,
you can also check out the blog.
Oh,
that's right.
Totally throw down.blogspot.com.
Yeah.
You could follow the blog.
We definitely cross post everything on there.
Yeah.
And so then there's also,
you can put comments there and I believe that generate,
I don't,
we don't check that very often,
but I think it does actually send us an email when somebody posts a comment there.
That's true.
So we try to be easy to reach.
We're here for you people.
Definitely.
You know, if you have any – we've had a couple of requests,
and we want to fulfill the requests.
So definitely Java is going to be coming down the pipe,
and Go is going to be coming down the pipe.
You're foreshadowing.
Now we have
a lot to live up to but if there are any other requests uh from the audience don't hesitate we
definitely read every one of them and uh you know we uh we have a backlog that we're getting yeah
and don't be offended if we don't reply to you or you know whatever we are listening we are taking
it in um and yep hopefully we'll get there one day yeah yeah i
mean if you say you want a language you're gonna get it it just might uh it's just in the pipeline
i'm actually surprised i did make up a list and the list is pretty long so there are a lot of
languages to go through yeah totally so and then probably it's one of those things where more
is there more created than we're talking about like is there at least one created every two weeks
oh man there could be.
Uh-oh.
We might never finish this job, Jason.
Oh, it could go on forever.
Now I know how movie critics feel.
All right, on that note, that's all I got.
Everyone have a good time.
All right, see you guys later.
The intro music is Axo by Binar Pilot.
Programming Throwdown is distributed under a Creative Commons Attribution See you guys later.