Coding 101 44 (Transcript)
Father Robert Ballecer: On this
episode of Coding 101, we’re back to programming, with Lou Maresca. This time he’s
here with the holiday pricer.
Netcasts you love, from people you trust. This is TWIT.
Bandwidth for Coding 101 Is provided by CacheFly, at cachefly.com.
This
episode of Coding 101 is brought to you by Lynda.com. Lynda.com is an easy and
affordable way to help you learn. Instantly stream thousands of courses created
by experts on business, software, web development, graphic design, and more.
For a free trail, visit Lynda.com/c101. Lynda.com/c101. And by Squarespace. The all in one
platform that makes it fast and easy to create your own professional website or
online portfolio. Now introducing SquareSpace 7 with
even better site management tools and other improvements. For a free two
week trail and 10% off, go to squarespace.com and use the offer code C101.
Fr. Robert: Welcome to Coding 101. It’s the show
where we let you into the wonderful world of the code monkey. I’m father Robert
Ballecer, the digital Jesuit, I’m here with our code
warrior Mr. Lou Maresca. Lou, thank you and welcome back to Coding 101.
Lou Maresca: Thanks for
having me back Padre, appreciate it.
Fr. Robert: Now when we were talking about this
episode, it’s a slightly modified Coding 101 format, so we’ve been doing a lot
of interviews. The wildcard went longer than we normally do, but now we’re
getting back into coding. But rather than teaching lessons, we’re going to show
people how to actually make applications. How to make
programs that they may want for themselves. And you’ve come up with a
doozy. You’re calling it the holiday pricer, although, someone in the chatroom
says it should be Santa’s little helper. And I really like that. Explain to me
what was your idea with coming up with this program.
Lou: So I think every holiday season, the
black Friday, cyber Monday, even just before Christmas, I always get tired of
going to the sites and seeing the prices and seeing how they change and
tracking that information. There are sites that do it, some of them charge you, some of them you don’t know what they’re actually
doing behind the scenes. So there’s a lot going on and I just wanted to have
something for myself. Something that I can run, I know exactly what its doing. It’s going to track exactly the products that I
want. So that’s kind of the motivation behind it.
Fr. Robert: And see, I like this. Because this is sort of that top down rather than the bottom up
approach. You’ve got an idea and the idea is simple. It’s solving a
problem that you may have, especially around the holiday time. Which is, there might be an item or two that you want. You
want that but you want to know exactly when it drops in price, or exactly when it’s
available, and that’s what your program is going to let us do.
Lou: Right, exactly.
Fr. Robert: Before we get there, there’s actually
some very exciting news and this is why I wanted you back for the first module
after the wild cards. We’re actually going to do Perl, but when I read this, I
said “oh, Lou has got to come back. He’s got to talk about this.” One of the
issues we’ve always had with the C Sharp modules, because remember, we’ve done
two so far, has been people say well, its Windows specific. Unless you’re
running a Windows system, why are you going to use .net? Why would you want to
use C Sharp? Well, Lou, want to tell us a little something, something about
what happened at Redman about a week and a half ago?
Lou: You bet. So originally the C Sharp
language was open source. So just recently, Microsoft has decided to open
source the entire thing. Not only the language itself, but the compiler and the
platform and making it soon readily available for all of these platforms,
whether it be Linux or Macs or OSS or Windows. So
that’s kind of the key, is its breaking open the entire thing. And it also
allows you to build apps like Android and iOS apps directly inside of Visual
Studio which is another huge leap forward for everyone who likes Visual Studio
too.
Fr. Robert: Now, Redman has announced that they’re
going to be releasing the entire .net server stack. So everything that has to
do with serving things out. Connecting back to databases,
creating pages. That’s all completely open source.
They are holding back a tiny bit on the client side, but as you said, if you
want to develop in .net for Android or OS 10, that’s now completely possible.
What I like about this, is they’re going to be working with Xamarin,
specifically the Xamarin sponsored group known as Mono, to create the
framework. The .net framework based on C Sharp for both Android and OS 10 and I’m
assuming eventually for iOS. Which means we’re getting down to that true write
once, compile many times. Write it, compile it for Windows, compile it for iOS
10, and compile it for Android, which is Linux. How does that change the game
for you as a developer?
Lou: It’s huge because the majority of the
code that I write is C Sharp. It’s all in what we call the Windows stack. But
now it gives me the ability, the experience that I have, to kind of take it
forward and move it to these other platforms. I think a lot of Java developers
today have that experience because they can build it for Android, they can
build it for OSX, they can build it for Windows, Linux.
What they didn’t have is iOS and so now this kind of opens the door to that for
C Sharp as well. It kind of gives that ability to go cross platforms and be
able to use really cool IDEs like Visual Studio. I mean, to me it doesn’t
matter who you talk to, whether a Windows developer or not, Visual Studios is
really the pinnacle in IDE web development for web and programming today. So
it’s a really cool app.
Fr. Robert: Someone in the chatroom is saying oh,
.net is a marketing scheme, where as Microsoft forces you to buy new OS and
hardware to be able to use their hardware to write code on. That’s something I’ve
heard a lot. When we did the first two modules, they were all saying oh, so you
just want us to buy Windows. No, that’s what this whole announcement is about.
You don’t. In fact, Microsoft is going to be releasing a fully featured, fully
functional version of the Visual Studio for everyone to use. So they’re not
going to break it down. This is really going to hurt the bottom line because
Microsoft was making a lot of money. Maybe it’s not the topic for this
particular show, but Lou, I’d love to hear your insight on why now? Why do this
when Microsoft could have just kept it the old way and again, yeah, forced
people to use Windows, forced people to buy new hardware, rather than say here
you go, and we hope you develop for it.
Lou: I don’t know. I think that Microsoft
has had a narrow scope around enterprise, around Windows Apps, and this new
kind of structure that Microsoft is kind of turning itself into is cross
platform, cloud service, services, platform, that kind of thing. And making it
readily available for everyone to use and people who have different experiences
and different things can also use these things as well. We’ve always had really
good platforms and services, it’s just that people
don’t want to use them, because they kind of have to intermix with other
technologies they don’t understand. I think that’s where we’re going, is that’s
where we’re making it easier for everybody to kind of use what Microsoft can
actually deploy around services and support and C Sharp and .net. Really easy
languages like .net languages. I think it’s just about time we start doing that
and broadening our spectrum and broadening our scope and I think that’s just
where we’re going, where we’re heading.
Fr. Robert: Well, let’s leave the philosophy of
coding out for just a second. Because I know it can make people a little bit
angry. Instead, let’s jump back into our program. You’ve got a great idea, lets
show how the developments going to work. But before that, let’s take just a
moment to thank the first sponsor of this episode of Coding 101. I know there’s a lot of people out there who watch a show like
Coding 101. And you say well, there’s a lot of gaps.
We don’t always fill in all the holes. And that’s true. Even during this
module, you’re going to find that we don’t give you step by step by step. You
do require a little bit of base knowledge. And this just because we can’t spend
20 episodes building an app. we need you to find another place to fill in your
little bits of knowledge holes. Those knowledge absences. Which is why we’re happy to have, as part of the show,
Lynda.com. What is Lynda.com? Lynda.com is a one stop shop. A repository for knowledge. Bothe of new
knowledge and knowledge that you just need a refresher course on. Lynda.com is an easy and affordable way to help you learn. You can instantly
stream thousands of courses created by experts on software, web development,
graphic design, and more. Lynda.com works directly with industry experts and
software companies to provide timely training, often the same day you get the
new releases on the new versions on the street. You’ll find new courses on
Lynda. So you’re always up to speed. All courses are produced at the highest
quality. Which means it’s not going to be like a YouTube video with shaky video
or bad lighting or bad audio. They take all that away because they don’t want
you to focus on the production, they want you to focus
on the knowledge. They include tools like searchable transcripts, playlists and
certificates of course completion, which you can publish to your LinkedIn
profile. Which is great if you’re a professional in the field
and you want your future employers to know what you’re doing. Whether
you’re a beginner or advanced, Lynda has courses for all experience levels, which
means they’re going to be able to give you that reference that place to go back
to when you get stumped by one of our assignments. You can learn while you’re
on the go with the Lynda.com apps for iOS and Android and they’ve got classes
for all experience levels. One low monthly price of $25 gives you unlimited
access to over 100,000 video tutorials, plus premium plan members can download
project files and practice along with the instructor. If you’ve got an annual
plan, you can download the courses to watch offline. Making
it the ultimate source of information. Whether you’re completely new to
coding or you want to learn a new programming language, or just sharpen your
development skills, Lynda.com is the perfect place to go. They’ve got you
covered. They’ve got new programming courses right now including the
Programming the Internet of Things with iOS, Building a Note taking app for iOS
8, and Building Android and iOS apps with Dreamweaver CC and Phone Gap. For any
software you rely on, Lynda.com can help you stay current with all software
updates and learn the ins and outs to be more efficient and productive. Right
now we’ve got a special offer for all of you to access the courses free for 10
days. Visit Lynda.com/c101 to try Lynda.com free for 10 days. That’s
Lynda.com/c101. Lynda.com/c101. And we thank Lynda for
their support of Coding 101. Lou, take us though this. We talked a little bit
about app development in the last module that you were on. We talked about a
procedure, a way to program, that looked at it from 4 different things. The
first was to look at breaking down the functions of the program that we want.
So what exactly do we want to be able to do? The second was to gather the
resources. What do we have available to us? What can we use? What things can we
put into our environment? The third was to create a logic tree for our program
so that we knew the steps that we had to program and the fifth thing was to
make every part of that logic tree a reality. So take me step by step on what
we need to do to create Santa’s Little Helper, or the Holiday Pricer.
Lou: So yeah, good outline. I think the
first thing is really kind of decide what the requirements for the app are. I
think for me, requirement for the app would be for me to go to a site, maybe
Newegg.com, and I go to a product, let’s say it’s the Intel processor, and I
want to go and track that price. So I’m going to save that URL, paste it into
this app, then it should be able to pull up the price. And then from there on
out it should be able to cycle through every time I run the app or periodically
throughout the day it’ll go in and grab the price from that site. So the idea
is I should be able to take the URL, put it into the application, and then it’ll
just start tracking it. So that’s my requirement for that.
Fr. Robert: Okay, so we know what we want it to do.
We want to have it go outside, find an item, track a price, and then at some
point, report to me. That’s the whole view part. It has to tell me the useful
information. Now the question I have is, what’s
available? Because I can’t just write a program that will surf to a site and
start looking for individual items unless I want to write something scripted. I’m
assuming you might have something a little bit more elegant than that.
Lou: Exactly, I think one of the things that
some sites like Best Buy or even Amazon or EBay, most of them have what we call
an API or SDK. I think we saw that a little bit when we were doing the Google
segment awhile back and we were talking about using the task API. A lot of
these other services like Best Buy, like Amazon, like Google, they all have this API that you can call to get information. I have an example,
this is the Best Buy API and it’s really a pretty good API. And all it requires
you to do is get an API ID. It’s very similar, you can
just go sign up and say I want to get an API ID or key. And then every time you
call their service you just kind of put that in the call and it knows this is
the person that’s calling them and they can track you by using that. Some of
them don’t. For instance, the Amazon one, there’s an open one and a closed one.
Some of them like the EBay one, they also require an API key because they want
to track how much traffic you’re putting against their site and stuff. So they
want you to have that API.
Fr. Robert: Actually, Steve in the chatroom has a
good question, I’m sure there’s a lot of people asking
it. And that is, why would these stores have an API? If you’re Best Buy, don’t
you want people to go to bestbuy.com? Why would you want to publish an API that
would allow people to bypass this beautiful website that you spent all this
money to create?
Lou: Its traffic. If you’re going to get
some information about a product and pricing from them and that kind of, at the
very least designates you to go buy it from them, that’s the key. Is they want people buying from them whether it’s from their
website or its third party though their website. That’s really what they’re
trying to do is opening the door for other places advertisers and so on to kind
of point people back to their site. This app is really kind of similar to that,
because you think about it, I’m getting data from the sites and then at some
point maybe they might be the minimum or lowest price and they have the best shipping
so I might just go and buy it from them. So I think that’s the key, is why they
have APIs. Some of them don’t. I’ll give you an example. We’re going to go
through an example of using Newegg. Newegg doesn’t have a public API, and so
that means there’s kind of two ways to get data from them. One of them is use
the API that their website uses because their website underlines the API to get
data. Or you do what they call screen script. so You basically will basically
take the webpage in your app, load the webpage up, go through the XML or HTML
that’s under the covers, and just find the price and then steal the price off
the page and then every time your app will just kind of go out to that site and
grab the price every time. So there is multiple ways to do it but that’s the
more complex kind of ad-hock way of doing it.
Fr. Robert: Yeah, it’s kind of the cluge to do it.
You can use screen scraping, but what I’ve found is if you write a screen
scraping program, sometimes it only takes the change of a little bit of
formatting to throw your screen scraping program off and then you’ve got to go
back in and figure out what they’ve changed and what you have to change in your
side to make it work right. But to get back to the quick tip, there are people
who may not remember from the first and second C Sharp module what these APIs
are. And remember, we’ve actually talked about this concept before. This idea of taking code that you may not have written and then
being able to use it by creating an instance of a class. This is what
this is. It’s essentially taking this code that someone else has written.
They’ve given you an interface, the API, so that you can get a key which gives
you access to it, so you can just use a few set parameters, and hopefully Lou
will show us what those parameters are, to call over to the code that Best Buy
has run and just get back the information that you want. Could you take us
through the third step? So now we know what we want the program to do, we know
what resources we have available, the API or screen scraping. The third thing
that we wanted to do was create a logic tree. So as you are programming, as you’re
thinking about putting this together, what are the steps? What are the
functions that you are thinking about coding as you go through the problem?
Lou: I first start with the lowest level.
For instance, I said, I want to be able to take a URL from a browser, stick it
in the app and it’s going to give me a price. So what components do we have
there? I think we have a URL, which in C Sharp language is a string, they do
have a class that you can wrap around it called a URI but right now we’ll just
call it a string. And then also what is a price today? A price in most currency
types is a decimal value where you have a number in the front, a decimal point
and then some numbers on the end. So we’ll basically call it a regular decimal
in C Sharp. So when you actually talk about the API, the API that we could
actually build up is, I like to call this price provider, and then I just have
two methods. One that will accept an item ID, or a URI, in
this case URL. And it will basically return a decimal of some type. And
that’s kind of like my structure, my basic structure of the app. so it’s pretty
simple API. And then what we can do is build specific instances of that. So for
instance, I’ll pop up what we call the Best Buy provider. And you’ll notice
that I have a specific provider type, but it has the two methods that implement
it. What we call inherited from price provider. And right away, if I were to
build another class down here called the JC Penny provider or whatever, I could
do that and then immediately call it price provider and inherit from that. And
then the key to this is once I actually hit go, it’s going to implement the
interface for me here. So right away it already implemented the two methods for
me. Of course they say they’re not implemented, but I’m just going to put
coding here and then go and get that data. So this is kind of my basic
structure of my app, of what I wanted to actually do.
Fr. Robert: I know people are starting to get a bit
lost in the chatroom, don’t worry, don’t freak out. Because remember, we are
going to make all this code available. You will be able to download exactly
what Lou was working on. It will work on your computer and then you can start
poking around. So what we want you to do during these sessions, these next
three episodes, where we go over Santa’s Little Helper, you will be able to use
the same assets that we have. So don’t worry, we’re coming back for you. Now
Lou, the last part of the structure for creating a program was to actually turn
that logic tree into code. I want to do that. I want to give you the rest of
the time in the episode to actually take people step by step through the first
parts of actually using these APIs and using this code to scrape off that
information. But before we do that we do have to take one more break and then
we’ll continue non-stop. I’m happy to do this one because, well you know we’ve
been talking a lot about scraping data off the internet but sometimes you want
to be able to present your information. Sometimes you want a slick interface.
Sometimes you want to be able to show people your portfolio, your website, your
new project. Maybe I should create a website for all the drones that we’ve been
creating. It’s all about location, location, location and it’s all about
creativity. You don’t want to be bogged down by the backend, about finding a
server, or finding a provider, getting the right domain name. Wouldn’t it be
nice if you could go to one place and have all of the taken care of for you for
1 low monthly price? Well there is a place like that – it’s called Squarespace.
Squarespace is that one place you can go to on the internet to easily get your
project or portfolio on the internet and I love Square Space because they’re
always improving their platform. In fact they just released Squarespace 7. That
makes getting started much easier and they have a unique web presence that is
built up over templates that they give you. It’s now more all in one, it’s
simpler to navigate and it’s simpler to operate in 1 seamless experience.
Squarespace 7 allows you easier editing. You can edit on 1 screen which means
you no longer have to toggle between site manager and preview mode. You can
even preview designs in divide modes - that you see exactly how it will look on
tablets and mobiles. Now it also offers instant access to professional stock
photography from… It’s now integrated into the package. They’ll allow direct
purchases inside the platform from getting images at just $10 each for your
site. No more having to jump out, get an image imported into Squarespace, make
sure all your licensing is taken care of. It’s all in 1 interface. You can get
google branded email with Squarespace 7 so you can have the branded email for
your small business and it’s automatically set up when you set up your
Squarespace account. They’ve got templates, designed for specific professions
which this is a big one. All their templates have been beautiful but now they
give you the option to switch between different classes of templates. You can
move between templates for musicians, artists, architects, chefs. They designed
those templates, those category specific templates so that you can find the one
that looks right for the project, for the business, for the industry that
you’re trying to represent. On Squarespace 7 the developer platform is now on a
beta which means that you can customize your site exactly as you wish. If
you’re a developer you have access to the same platform that Squarespace uses
for its own site – complete code control They also give you e-commerce with all
subscription plan levels that includes the ability to accept donations which is
great for non-profits, cash wedding registries and school fund drives and it’s
easy to use. Yes, sometimes you’ll run into a ram but it’s easy to get it
solved because Squarespace offers you support; 24 hours a day 7 days a week.
They’ve got an army of folk in their forums giving you self-help articles and
video workshops to browse at your leisure. It also starts at just $8 a month so
it’s not going to break the bank. That includes a free domain if you sign up
for a year. The Squarespace portfolio, the note, metric and blog mobile apps
are on the go extensions of your website so that you can monitor and make
changes from anywhere. They include the hosting so again it becomes a 1 stop
shop. You don’t have to worry about buying different services from different
providers. It’s all from 1 place. It’s all in a square space. Here’s what we
want you to do. We want you to start a free 2 week trial with no credit card
required and start building your website today. When you decide to sign up for
Squarespace make sure to use the offer code c101 to get 10% off and to show
your support for Coding 101. To begin using Squarespace 7 now existing
customers can go to the setting tab to activate all of your new features. We
thank Squarespace for their support of Coding 101. A better web awaits and it
starts with your new Squarespace website. Lou, take us home. Show us how we’re
going to access those API.
Lou: One of the first things is kind of understanding
how these API work and what they give back to you. So if you go to my screen
real quick I’ll show you. This is an example of the Best Buy API where they
allow you to as it says search and return a product based off of its
description or SKU. So in the retail world a SKU obviously is a product number
in the context of that retailer. Best Buy uses SKU, Amazon uses what they call
ASN and a lot of other sites like Newegg uses a
special type / number that they have. Most of them use their own. Most of the
API will return a description of that item by using that ID. So if you look
here this is what they call the API request here and I’ll zoom in a little
closer so you can see a bit better. As you’ll notice that the API has some
components in here. One of them is what type of product it is and in this case
it’s a modem and they’re using a little wild card on the end saying give me all
modems that – everything that is a modem. They are saying ok what do I want to show, open this request, return the name and
the description, the height of it and the width. They’re saying the format I
want to return is what we call json format. So json format is a special type of
data format just like xml is. They call it JavaScript object notation and it’s
just a really fancy way of saying lets represent an object using just the
special syntax, 1 being these little brackets to kind of designate the
breakdown of the product. You notice here is a name in quotes. That’s an
attribute of the property of that item of that products description. This is
just the format that is going to come back in and json is pretty prevalent in
the web development world.
Fr. Robert: So looking at the screen at the first
line at the top, the request, that’s what you would actually send into their
API and you would end it with your API key from Best Buy. So all you have to do
is write a program so it could properly create this line to send to them and
then down below that is the data that you get back. So you have to be able to
parse that into usable information.
Lou: Right exactly. I have this old slide
from a long time ago and I wanted to show it really quick. This is just what
json is and what it looks like. They have this class in C Sharp called
“employees and there is a first name and a last name and then I have employees
which is a list of employees. You notice down here is an xml version of it
where it has a list of employees, there are employees… and then there is a
bunch of employee XMLs. Then in the json version of it you notice it’s a little
bit more compact. It has a lot more quotes around it but again it’s just a
different way of formatting that data and people like to use it because it’s a
lot more compact than xml and it actually transfers a lot better when it comes
to browsers and mobile devices and stuff; so that’s kind of the key to why APIs
use it.
Fr. Robert: There are going to be people who say
wait a minute if this is just a http request why do I
need to write a program. Why would I want to write this in dot net but if I
remember correctly dot net has built in “http get” functionality so you don’t
have to rewrite most of that code.
Lou: Exactly. They have what they call http
client and you can actually use this if you go into the infamous nugget
repository which is this thing that you can actually go to. Its
nugget.org. You can actually go into nugget manager with a visual c and
they have this really nice what we call Microsoft http client libraries and
what this allows you to use is not only on the dot net framework for desktop
but Windows phone overlay, Windows apps for the store and then also for
portable class libraries which then are things that will only be transferable
to OSx and Android as well. They give you this ability to kind of use this and
build the apps to basically call and make http requests. It’s pretty simple
stuff.
Fr. Robert: Right and since it’s all built in it
means that basically I just call that library and now I have something built in
that I can use to say with this parameter and maybe my API key, do that. Go
ahead and do an http get.
Lou: Right. So lots of different APIs; like
for instance the Best Buy API has the ability to kind of within the URL itself
you put what you what; so you’ll request in here – I want the modem description
and this is exactly what I want to return using my API key in the format that I
want. That’s just a normal get request that you can make because you’re just
using the URL and its returning some data underneath which is a response using
json. The key here though is that some APIs don’t do that. So for instance the
Newegg API that they use for their website – they actually post a request and
the request is kind of constructed in a way that you can’t really tell what it’s
like – what is actually going on. I’ll show you what it looks like on the
screen here. This is what the new API is and this is the request that they’re
making in the body of the http request. You’ll notice in here that the key word
– and then if anybody has ever been to Newegg this is kind of like the Newegg
item ID that they are using. This is not going to be part of the URL
unfortunately. The URL that they’re using is a little different. The URL
actually looks like this which is – they have this special API URL in there and
search .egg and then query on the end of it and then inside the body they are
posting this special message.
Fr. Robert: Newegg does have an API; it’s just not
really designed to be a public API?
Lou: Exactly.
Fr. Robert: You can use it because people have
figured out how to hit it but it’s not designed to just pack yourself a
program.
Lou: Yes and honestly it actually is deigned
to be hit pretty hard. They use it for their site, they also use it for any of
the apps that they have on all the platforms so like Android, Windows Store,
Windows Phone. If you use their app it’s actually built to basically get data
for items. So the best deals for the day and product information, product
specifics that all comes from using this API. So yes it’s not public. Making
that public means they can change it at any time and break your app but it is
public to use? I’d say yes because they’re using it everywhere else anyway but
again you just risk the fact that it might be broken if they decide to change it one day.
Fr. Robert: I get it. It is public because anyone
outside can access it. They just don’t publish it and advertise it like some
other sites might. I have to ask this and that is; as someone is looking at
which sites they might want to include in their program, whatever they create
for their Santa’s little helper. Do you prefer to use sites that give you back
json replies?
Lou: I think xml or json – those are 2
formats that are really easily used within especially .net or java application
development platforms. So I think the ones that can give that back formatted
that way are much easier. Now if they give back – some of them give back html,
some of them are RSS feeds where you have to use the RSS format whether its
atom or whatever. I normally prefer either xml or json because it’s a little
easier to use but some of the other ones are fairly self-explanatory too. But I
do look for the ones that have xml or json.
Fr. Robert: The next question; if someone is
looking at creating this for whatever items they’re looking for this holiday
season – what do you suggest they do to find whether or not something has
either a publically advertised or public but not advertised – maybe even a
private API that they can hit.
Lou: Let’s talk about the public one first,
those are the easiest one. So Bing or Google search for like JC Penny’s API,
Best Buy’s API, Best Buy developer and that kind of thing and normally it’ll
come up with a bunch of search results whether it be 3rd party or the actual
site. I usually just do a search on Best Buy.com and it’ll be able to tell you.
Normally it’s a product search API or a product marketing API and they usually
call them. But you just do simple searches and find them. If you don’t find
them like in Newegg’s case you can find a bunch of 3rd party apps that charge
you for wrapping their non-public or priority APIs and in that case you have to
make a decision on whether you want to build your own or figure out what their
API is or screen scrape in that case.
Fr. Robert: I found developer forms to be very good
at that because if there is a site that has an API but they haven’t published
anything about it, if it’s popular enough chances are that there are some
developers who’ve already hit it and backwards engineered the API commands. But
then again you always have to remember if you’re going to do that there is
always the chance that they’re going to change their API with absolutely no
notice and no explanation and suddenly it will break everything. If a company
is publically advertising an API then it means that they’re going to keep the
support for all the developers. That’s something that you want to keep in the
back of your mind. You can do it but it’s easier if you just choose a company
that wants you to use their data.
Lou: Right, I think that’s kind of the key
too. If you’re building an app from a platform like Android or iOS or Windows
Phone they have this concept of silent upgrades or updates and so if you really
do want to build an app that you want to actually ship to everyone in the world
and let people use it and you want to use a private API, it doesn’t really
prevent you, you can still do it and then you just have to keep up on it and
say ok well I’ll fix the app and deploy an update so these people can still use
it. I guess that’s an alternative if you’re really kind of stuck between a rock
and a hard place. But either way it’s really up to you if you want to use a
private one or not.
Fr. Robert: We’ve got Patrick Delahanty being a
smart artist in the chat room saying Companies changing their APIs and not
telling us? No one would do that – Google Calendar. So yes it does happen. Just
know that if your program stops working there is a change that the API may have
changed. Just go back to the documentation and figure out what they flipped and
flip it back. We actually have another question here from M5; he wants to know
if this program can look for items by asim. Not sure what that is but I think it’s
some way to actually catalogue things. The thing about using a program like
this which is going out to different sites is you’re at the mercy of whatever
they catalogue their items as. It’s not like Best Buy and Newegg and Amazon
etc., etc. aren’t going to use the same identifying information for each and
every single product; which means you’re going to have to do a little bit of
leg work…just a little bit to figure out how the inventory identification works
for every site you want to hit.
Lou: There is a concept that we call
provider and so you can have what’s called price provider and it differentiates
between every site there is. So Amazon Site puts in its identification number –
that one is you basically have to go and figure out what that number is. The
cool think about Amazon Site is they also can allow you to search by serial
number and other things. If you know what the serial number is for that item
you’ll won’t necessarily need to use ASAN. But Best
Buy doesn’t allow it. They want you to use their SKU number or description.
Newegg wants you to use their internal product ID. They have an internal
product and an external product ID. So they allow you to search for both. But
again it’s all dependent on these sites and how they track things retail wise
on the back end.
Fr. Robert: Honestly it would be a little strange
if you said “hey Newegg could you use the same tracking numbers as Amazon so it
makes it easier for me to compare and see which I’m going to buy from? I think
that’s not really what… You can do that on your back end but they won’t do it
for you. Now Lou, next week…we’ve been talking about the APIs this week and how
we get that information but next week you’re actually going to take this
information and bring it into the program. You’re going to show us how to do
that right?
Lou: Exactly right. We’re going to try to
pinpoint 3 or 4 different APIs, one of them that’s really hard and that doesn’t
have a public API and then a couple other ones that are public and how we
actually use that and utilize it and save it.
Fr. Robert: Lou Maresca –
senior developer with Microsoft, it is so good to have you back in the Code
Warrior seat. Could you please tell the folks at home where they can find you,
make sure they know where they can find you on Twitter, of course @LouMM and
where else they might find your work when you’re not being our Code Warrior.
Lou: So a quick plug – obviously visual
studio, check it out. Visualstudio.com, check it out, the newest open store
version is the 2015 version and also all my work is at crm.dynamics.com.
Fr. Robert: Lou Maresca our Code Warrior we salute you. We’ll see you next time.
Lou: Thanks guys.
Fr. Robert: Now folks I know that this was a lot of
information. It always is whenever we get to the code modules. We tried to take
it really slow because people were having trouble with APIs last time so we try
to explain each and every step. We’re going to repeat it on next week’s episode
but remember you can also go to our show page at twit.tv/code. When you go
there you’ll find not just all of our episodes but our show notes and most
importantly you’ll find a link where you can download the package – the code,
the framework that we’ve been using in order to create this. Which means you
can actually run the program out of the box. After you unzip it you’ll be able
to run Santa’s little helper and figure out exactly how it works. We want you
to have these assets because as we go on in episodes and as we add little bits
and pieces of knowledge to the project we want you to be able to fool around
with it. Break it, stretch it, make it do something we didn’t tell you to do
and then post it to our Google Plus community. You can find out Google Plus
community at plus.google.com/twitcoding101. Or just go to Google Plus and
search for Coding 101. If you post it in that community I will be pulling
examples to show off in the next episode. So if you’ve got a change you made to
Santa’s little helper or if you want to show us what you did with your API keys
that’s a great place to do it. Make sure you drop over – remember twitcoding101
on Google Plus. Don’t forget that you can also find me on Twitter at
twitter.com/padresj, that is @padresj. If you follow
me you’ll be able to find out what I’m doing each week on Coding 101. I always
tweet out the night before what the project is going to be. And you’ll be able
to suggest guests that you want on the show in the future. In fact the guest
that we had for the interviews came directly from requests made by my Twitter
followers. So follow me on Twitter and be part of the Coding 101 experience.
Don’t forget that we do this show live every week Thursday at 1:30 PM Pacific
time at live.twit.tv. If you watch live you’ll get to see the pre-show, the
post show and everything in between. So you can see the bloopers that get
edited out of the downloaded version. And as long as you’re watching live jump
into our chat room at irc.twit.tv. You guys are right down there so I can
actually talk back and forth with you during the show. If you’ve got questions
about what we’re doing, if you need us to slow down that’s the place to go at irc.twit.tv.
I want to thank everyone here at the brick house that makes this show possible
– to Lisa and to Leo and of course to my fantastic Code Warrior Lou Maresca and
my TD. I’m not sure if he has a camera on himself but, oh there we go. Cranky
Hippo, could you please tell people where they can find you on the Twit TV
network?
Bryan Burnett: They can find me doing the show with
you called Know How on Thursdays just before Marketing Mavericks which was the
show before this and check out all that drone stuff that we’ve been doing.
Fr. Robert: Drone. Thank you very much, until next
time. I’m father Robert Ballecer. End of line!