WWDC2003 Session 426
Transcript
Kind: captions
Language: en
this is one of the technologies that
we've got an apple that I think has has
tremendous potential and there but a lot
of developers that are already taking
advantage of Sherlock channels today
particularly on internets and within
corporations to deliver internal web
services to their customers and there's
some really cool Sherlock channels that
have appeared from third parties but
that you probably played with and so
this is a great we think Sherlock
channels and people are finding that
Sherlock channels are a great way to
actually get on to them onto Mac os10 if
they have an evil if they don't know
cocoa or carbon in fact if they can use
their expertise in JavaScript and XML
they can get onto the platform and take
advantage of some technology that's
their deliver some services on Mac OS 10
without having to write a fully native
app but certainly one advantage people
have seen and there's lots of others
that we'll get into in this session so
I'd like to invite Wayne lupfer all on
stage and he's going to talk you through
specifics Wayne runs the engineering
team that's responsible for Sherlock
channel thanks and welcome to the last
of the Internet technology sessions
delivering web services using sherlock
channels so in this session we're going
to talk about how to deliver web
services using sherlock channels and i
will talk about well what our web
services when is using a channel to
implement web services a good idea how
to get started and some of the new
things that we've provided in camper so
what you learn is first what's new in
Sherlock the application some of the
developer opportunities the structure of
a sherlock channel and then some of the
details about how to develop a channel
as well as some of the new features for
sherlock channel developers and then
we'll get into some advanced topics so
first what's new in Sherlock the
application well so when we thought
about doing a new version of Sherlock
for
Panther we wanted to do three things we
wanted to enhance the existing channels
we wanted to improve the performance and
we also wanted to provide a solution for
the channel management problem so in
particular with channels we one of the
channels that we put a lot of effort
into is the Yellow Pages channel and
we've had some requests to add white
pages which we've done and we've also
added some additional features to the
yellow pages themselves which we'll talk
about in a bit for performance we
rewrote the xquery engine from the
ground up and made it two to three times
faster in the Panther release as well as
more conformance with the emerging
excluded standard we've also made
substantial improvements in launch time
for the application as well as channel
switching between channels as far as
channel management is concerned there's
been with all the third-party channels
that have come out your toolbar gets
pretty busy and it's often hard to find
the channel that you're looking for so
we've provided a solution to organize
your channels that's patterned after the
smart safari bookmarks in addition we
found that folks were really interested
in using a bunch of third-party channels
but they didn't know where to find them
and you had to kind of do a google
search and now rummage around to try to
find where they are so we decided to
build the third-party channels directly
into the application so first the phone
book you'll notice that on the left side
there's a little control to decide
whether you're searching white pages or
yellow pages but in addition we've had a
lot of requests for category based
searching if I want to search for
Japanese restaurants I'm not really
looking for a business that has Japanese
restaurant in its name i'm really
looking i would really like to be able
to find retinoic a by category instead
of just by business name so we support
both in Panther the other requests we
got a lot was being able to find nier
not just a zip code or a city but also
near a very specific address I'm going
to this theater right I want to find the
nearby restaurant
and then we made printing from your
phonebook easier as well with a
one-button print the channels view is
the solution to the channel management
problem your toolbar just gets too
crowded putting everything in the
toolbar so we looked at the way Safari
did bookmarks and we pattern to the
Sherlock channel management view after
the way safari bookmarks are done and
this wise to control both what's in your
toolbar what's in your channel menu as
well as have direct access to all the
channels that apple provides even those
that are for other countries and we've
added view for third-party channels and
this is where we showcase all of your
channels and make them easily available
to users so they can they can find them
dragon to the ones they like to the
toolbar or even create their own
collections it's also the place where
the channel development tools show up so
if you're a channel developer and you
enable you enable the channel
development tools you'll see them show
up in the channels view so to
demonstrate this I'd like to invite
jessica con the channel and Sherlock
channel development lead up welcome Jeff
[Applause]
so first we're going to show the phone
book says you'll note on the left side
there's a control for white pages and
yellow pages right now we're in yellow
pages mode the first field there is the
business name or category field and if
you notice as Jessica starts typing it
automatically autocompletes to one of
the categories in this case she typed
restaurants and it auto completed after
just a few characters and you'll note
that in the pop-up we show maybe some
variations on restaurants so you can
choose a particular one for example say
I want look for Indian food I choose
Indian the next field over is the fine
year katica field intellect before you
can type zip codes and city names but
the thing we've added is that it
autocompletes city names so it has a
database of cities and as you start to
type it autocompletes and you'll see San
Francisco with just a few characters the
other thing it supports
is it directly supports your address
book and auto completion so for example
if you want to find restaurants near a
friend of yours you could type the name
of the friend of yours in there or in
this case we've added Moscone Center to
our address book because he's been
coming to moscone center a lot so we'd
like to see what restaurants are near
moscone center and as you see as Jessica
types it autocompletes from the address
book and then when you do the search
you'll find Indian restaurants near the
Moscone Center and driving directions to
boot maybe walking direction so right so
the other thing would like to show is
the channel management view now we
should be restoring the as you as noted
there's a toolbar in a channels menu
which allows you to control what's in
the toolbar what from the channels menu
we also provide access to all the Apple
channels so if you decide you want to
use some or others you can toss them
from your toolbar and then decide later
to go back and and put the lunch you're
just stood in or if you'd like you could
let's go back to the Apple channels
right so what Jessica's done is added
the Japanese news channel to the toolbar
and if we decide we no longer want the
Japanese news channel you can also
remove from the toolbar just as easily
you also note that at the bottom there
there's a grouping called my channels
now you can actually create as many of
these as you like it's really a lot like
the left column on iTunes where you can
create your own music collections where
you're creating collections with channel
so let's say there are particular
favorites I have I could select a number
of channels and then drag them right to
my channel and then that's provided a
custom collection of the channels that I
might like to use together
and then finally and maybe the most
importantly for the folks in this
audience we've added other channels
which is really where all of your
channels shine it gives developed it
gives customers direct access to all the
creativity that's out there it provides
a listing of the channel names as well
as descriptions of each channel which
you can customize in your channel on the
web so these these channel there are two
sources for this information one is the
dmoz open source directory which is
where we get an initial listing but also
if you're interested in making sure that
your channel shows up in this list
you're welcome to submit your channel to
Apple and we'll talk a bit about the
submission process a little bit later so
Thank You Jess let's go back to slides
so Sherlock is web services for the rest
of us but what our web services or maybe
web services are soaked or.net or wsdl
or uddi or any of a number of buzzwords
but we don't think that's what web
services are web services are airline
reservations movie listings yellow pages
translating things shopping finding
things on the net that's really what web
services are to a customer so what we
try to do is deliver short deliver web
services in a way that customers would
like to see them but there are a number
of challenges in doing this one is
integration of information information
can really come from many sources and so
in order to present the user one unified
view you'd really like to integrate it
from a number of different places and
you can do this in a web page however
the traditional method of doing this on
the web page is to create frames and to
have some information in one frame and
another information another frame but
what we'd like to do instead is to bring
this information together in a way that
not just displays the information but
really harness is it and allows you to
interact interact with a unified
interface rather
than just seeing the information that's
there so the other the other challenge
is providing a user interface and on the
web of course you can create fairly
creative user interfaces but there are
limits to it and what users really want
is the native aqua user interface and so
what Sherlock does is provide a native
user the native user interface that
users prefer in the context of the web
service another challenge is change so
you've let's say you deliver a web
service as an application but your
information source changes maybe maybe
which you had to do in order to get
certain information with the screen
scrape a particular site well what
happens is that site changes your
application breaks you have to your you
know your users are now out to lunch for
a while until you give them a new
version of the application so we have to
be able to deal with change another
challenge is security users aren't
necessarily comfortable downloading a
binary application on their disk they're
very comfortable browsing web pages and
following URLs because those provide a
sandbox environment so you really also
like something that has that capability
easily you can get to it easily through
a single link you'd like to be in a
sandbox environment so excuse me gonna
take drink
so what Sherlock web services provide
are a native user interface they're easy
to create they provide sandbox security
they also support changes on the web
because they live on the web the
Sherlock channel doesn't reside on your
disk it resides on the web and so you
need to make changes on the web it's
reflected immediately additionally they
integrate multiple sources of
information so instead of just
displaying bits of information from the
web in one page they allow you to
actually harness that information and do
computation based on it maybe you look
to take a city in state and look up a
zip code and they use that zip code to
query another side to get some
information about what theaters are
available and then you might use those
theaters that theater lifts to query
another side to find out what movies and
showtimes are available and much like
web pages they are accessible by a web
link you can collect a single URL get a
sherlock channel to come up much like
applications you can put them in the
dock you can actually save a shortcut to
a sherlock channel put in your dock and
in a single click you've open that web
service and we've added a third party
channels to sherlock to make them much
more easy to find so one question is
when do you want to create a channel
versus say a web page or an application
one way to think about it is that a
channel is kind of somewhere in between
the two so when you want something
that's more than a web page you want
more of a native user interface but you
don't want something as complex as an
application or that maybe to some users
may be interpreted as having some risk
of downloading it then you might want to
choose a sherlock channel we're very
very pleased with the number of
third-party channels and the creativity
out there and creating channels and I'd
like to to demonstrate one of the the
third party channels I'd like to invite
kevin agren senior business development
manager
version tracker demo one please first of
all thanks for having us out I'm here to
talk about two reasons first one being
why we chose to do a Sherlock channel
second one being how it's going to
benefit version tracker today and in the
long haul we know right now that we have
the world's biggest mac software
database we're tracking over 30,000
applications but what we're seeing is
that some users would rather view this
offline or in a sherlock channel versus
seeing this just on the version tracker
site mostly what we feel that the clean
interface is sherlock and the quick
search function versus coming to a
website especially if you're looking for
multiple products the sherlock channels
can offer you a much cleaner look the
information you want right away and it's
very accurate as well in our polls what
we've seen is a lot of people now are
coming over and using Sherlock is a
primary user interface versus going
through the web we also see that Apple
put this in the dock and so
strategically is a business to be part
of Sherlock for version tracker is very
important the channel development for us
was almost as fluid as doing a web page
because it's already built it's a simple
XML feed so we're pulling content down
right into it as far as the business
benefits I'm just going to take a quick
run here on the version tracker channel
and so what you can see here that this
is today's Mac software updates you can
also easily do this by a search to go in
for Sherlock you're going to pull up not
only Apple Sherlock here but every other
application that's going to be relevant
to it as well to search this in Sherlock
you're going to save time you're also
going to be able to look at many
applications versus what's going to be
found in our database the important part
is a business reversion trackers that
were also a media company on top of
building our own software applications a
lot of our revenue comes from
advertising dollars and when users
decide to click up page they're going to
come on diversion tracker and we're
generating impression based ad revenue
from every user that comes through here
it's amazing to us but what we have seen
now is that version tracker gets over 1
million searches per month through the
Sherlock channel so it's a significant
part of our business when users are in
the search pages and it's deeper than
the homepage it's a more educated user
and advertisers right now see that this
is a highly valuable position you've
seen probably a couple hundred different
advertisers come and go off the site but
our revenue comes from the long haul
companies like CDW they're believing in
the mac user and spending money online
with us definitely gives us time the
money and the manpower app version
tracker further develop our product
version trekker pro and it also allows
us to put your developers products out
in front as many users as possible with
Sherlock being in the DA conversion
tracker being a channel it's very nice
for us to increase our brand awareness
to all mac users who not
already where a version tracker when a
right when a developer registers with us
and they post their product we expect to
get that out as quick as we can we also
expect to get that out to as many people
as possible so when you have the
application posted here in our Sherlock
channel what you're going to see is that
as it's coming down the home page on
version tracker it's picked up instantly
in the Sherlock channel as well so for
the developer your advantages you're
also reaching these people through our
Sherlock channel that weren't on version
tracker as well one other thing that we
can say about Sherlock is with more OS
10 users coming on board Mac users all
the time when they use this learn about
version tracker we're also seeing an
increase in our sales for version
tracker pro and the last thing is that
the strategic positioning for version
tracker in here is we really feel like
we're the web is going is users want to
interface with something like a sherlock
channel so that they can come on make it
part of their morning they're going to
get on maybe look at their stock check
the software applications that they care
the most about and that's really all we
have to say from version tracker thank
you coming okay go back to five okay we
can go back to slides
so now I would like to take a survey how
many folks out there have developed a
sherlock channel already okay a few how
many folks are thinking about maybe
developing a sherlock channel quite
quite a few quite a few great okay well
you know this is really a developer
opportunity as you saw it you can
provide a more compelling user interface
through a sherlock channel much more
immediate right there you can update it
on the web you can get to it from the
web link from your website but also we
built the channels right into sherlock
so your user can see it either way and
it's comfortable for users they can
follow up link to get to it or they can
simply select the channel from within
sherlock and it provides better
visibility for your web services than
just having a website out in the sea of
millions and millions of websites so if
you'd like to develop a channel we've
provided a number of tools built right
into sherlock to help you do that
there's actually a de bug menu in in
sherlock that normally is invisible to
most users but if you enable it you'll
see a number of tools and we'll start to
talk about those later so the first step
is of course to develop your channel and
that's what the bulk of this talk will
be about but once you've done that you
can submit your channel to Apple and the
way you do that we got a menu item right
there in the debug menu you just choose
that item with your channel up front and
you'll go right to a web page that allow
you to to submit it to apple and then
we'll add it in it'll be built right
into Sherlock so let's talk a bit about
how to create a sherlock channel and
first i want to kind of give an overview
of the structure of a sherlock channel
to set us to set the stage for
understanding the components and how
they all fit together first we'll talk
about some channel design principles
briefly then we'll go into some detail
about the key elements of a channel will
give a demonstration of xquery which is
a great XML processing technology that
is under development by the w3c that
we've adopted in Sherlock and we'll talk
about some of the Sherlock extensions to
that technology
so first briefly the channel design
principles one thing to think about is
simply to focus on one topic searching
version tracker is an example very
specific purpose finding movies a very
specific purpose another guideline if
two it's great when your channel
launches to have some information
showing you'll note in the version
tracker channel the moment the channel
is opened it showed the latest updates
on version tracker so the user didn't
have to enter a query although they
could but immediately they saw relevant
information a third thing to consider is
for performance reasons you really want
to query the web only when necessary
obviously on the internet that could be
arbitrary delays and it's and for our
modem users it can take a long time to
download significant amounts of content
so obviously there are times when you
need to query the internet to get
information but to keep that to a
minimum cash stuff as much as possible
which Sherlock arrives negative ones to
let you do another guideline is to
remember users safe if you go to a
channel and use it to do a search let's
say for movies in a particular zip code
it's great if next time you go to that
channel it knows the zip code that you
entered last time so you don't have to
re-enter it that's a basic guideline and
of course follow the Aqua guidelines as
with any application so now let's talk
in some detail about what a chant what
composes a channel and how it's made up
the key elements of the channel are
shown here at the top one being the user
interface the data store below that and
then trigger some services and we'll
talk about each of those in turn so
that's the user interface what's shown
here is the user interface for the
Yellow Pages channel but it's really
tiny and hard to see so let me zoom in a
little bit so now we're looking at the
text entry field where you enter the
category say like restaurants for the
business name and you're seeing a little
bit of the results down below that so
this is the user interface the question
is how do you make a user interface for
Sherlock if you'd like to make a
sherlock channel and the answer is
really it the same as making it for an
application you use interface builder it
creates nib files the only difference is
although it's like a nap in this respect
it's not like a nap in that there's no
objective-c code or
c++ code or c code and its web resident
unlike an application so how do we do
this well we've added a palette inside
interface builder that lets you name the
UI elements in your user interface and
you'll see later how that allows us to
make the channel do what it needs to do
without adding a lot of code so as an
example on the phone book channel the
main query field might be named
phonebook query field and it's sort of
like a path where dot is used as a
separator and it can be arbitrarily deep
the results down below might be called
phonebook dot results and it of course
have structure within that that would be
accessed by adding dot more stuff so
then there's the datastore now the data
store is created at the time you run a
channel so it's not something you have
to put in your channel but it's created
of the time you run and it contains all
the data all the active data it contains
temporary data that you're using at the
moment it also contains persistent data
and it also reflects the data that is
contained in your you line it's a
hierarchical structure made up of arrays
and dictionaries arbitrarily deep and
it's addressed by these dotted paths
that I mentioned earlier items from the
datastore can be created at any time for
your own purpose and they're created as
their referenced or it automatically
when it when your channel runs directly
reflects the contents of your you lie so
you can access any value that's in your
UI by simply reading a datastore path
and that will tell you what the current
value is if the user changes it you can
be notified of that change and you can
respond to it but if you read the value
from the datastore entry it will always
reflect the current value if you write
to that value it's going to change the
UI so if you decide you want to change
the default on the text entry field you
simply write a new string in there and
then the UI changes it's a very powerful
metaphor for quickly putting together a
user interface
the third area is triggers this is where
you make things happen triggers one
whenever a particular element of the
data store changes and this may be an
element that's tied to use your
interface so if the user interface
changes the trigger runs or it may be an
element that say reflects data coming in
from the web so the moment the data
comes in a cure can run to respond to
that data arriving a trigger can invoke
services which we'll talk about at that
or and then perhaps perform calculations
based on the results of those calls and
then change the UI so it's really the
workforce one way to think about
triggers and the JavaScript that you
write in triggers is it's very much
analogous to JavaScript on a web page
you could think of the data store as
being like the Dom of the web page and
the triggers is being the the code that
causes changes to happen in that DOM and
last I'd like to talk about the services
now these are the basic ways you get
information from the web they're blended
in xquery which is a powerful xml and
HTML processing language and they let
you query the web and face get a web
page and extract the information you
need from that web page where maybe
you're querying a soap service and
extracting the information you need from
the XML that comes back it's also very
good at constructing XML in order to use
to send queries and processing the
results so one example is you may create
a service to given a city-state pair
query the web and get back a list of
theaters that are available in that
particular city and state my package
again as a service it then becomes one
function call that the JavaScript
trigger can call to get that information
and the details of where it has to go to
get the information how that hTML is
processed perhaps or XML and how to
extract the results is all hidden in the
service
so I want to say a little bit about
xquery x cree is a new emerging language
that is under development by the w3c and
if you go to w3c org you can see the
current spec it's really designed for
processing XML it has a relationship
with xslt and that both share xpath
underneath so if you're familiar with
those standards xquery would be pretty
straightforward to pick up so now I'd
like to invite just back up to
demonstrate xquery and also the X
Pathfinder channel so we go to demo
monthly
okay so just as open the ex Pathfinder
channel now this is one of the channels
that you'll get in the development tools
which you can subscribe to directly from
the debug menu it's really just a
sherlock channel but it helps you in
developing sherlock channel so at the
top there you see a text field where you
enter the URL so if we get the HTML from
this website which is apple com you'll
see down below it displays the content
of the website and that's using a safari
WebKit view and up above it shows you
the structure of the HTML that is being
fetched from that site so it's a proud
of column browser and you'll see HTML
the left and we go ahead and select HTML
and drill downs you'll see the two
things happen one as we start to see the
tag better within that so we see head
and body and we can click on body and go
further but you'll also see that down
below as we drill down and the content
rendered below also changes so really
what we're doing is we're assuming in
through the content and seeing what
portion of the HTML page we're seeing
this is a much more convenient way of
drilling down and finding the bit of
information that you want to extract
then staring at HTML and trying to
figure it out
down at the bottom you'll see there's an
xquery town and this is the xquery code
that is used to access what you see in
the display below so if you want to get
at that particular tab this is the
xquery code that will do it and in fact
it's an XPath path so let's go ahead and
copy that out of the X Pathfinder
channel and we'll switch over to the
xquery channel the xquery channel is
used for being able to execute and test
out any sort of xquery it's a great way
to learn xquery you know try something
out get one and you'll you'll see the
results let's go ahead and paste it in
the xquery channel and if we can zoom in
so we can maybe read it a little bit
better so you'll see there what this
xpath or xquery is doing is it's
fetching the document it's looking at
the HTML tag within it and then going
into the body tag within that the center
tag within that the table tag within
that my TR tag within that and that's
how we zoom in on the bit of data that
we want but in fact this is a little bit
fragile because if we change the order
of what's happening in the web page this
may no longer work and so one of the
things that we want to be able to do is
to make it more robust so the XPath
channel is a great starting point to get
you roughly where you want to be but
then you probably want to massage the
expression a little bit to make it more
robust so justice you want I guess I'm
taking over at this point so I'm going
to zoom you back out so that i can type
and change things without making you
feel ill and basically what i'm going to
do here is I'm going to append a bit of
text which I will show you when I do min
again but I'm adding a path that calls
our source function and that's going to
display the results of what we execute
in this channel in a way that you can
read basically when you actually keep
something in xquery the data type that's
returned by default is
an XML tree and so you need to sometimes
convert that into a human readable form
if you want to play with it in the
xquery channel so just to make this a
little less fragile you would probably
want to do something like you know take
out HTML body and center add a slash in
there if you guys know about X square if
you take an X square your ex passed
tutorial the double slash says I want
all tables in this document but then we
know we want the first table so we're
just going to add in a bracelet says
give me the first table so let me zoom
well first I'll run this and then i'll
zoom in and show you what I've done so
basically this is giving you the same TR
that we got in the expo finder channel
and I'll zoom in here and you can see
I've been able to remove three paths
elements in my command and so that's
basically three fewer things that can
break the web page you're querying
changes that's about it great thanks
Jeff ok let's go back to slide so as you
can see we've provided the tools to make
it easy to get at the information you
need to on the web and extract it for
use in your channel we've also provided
some extensions to both javascript which
is used in triggers and xquery which is
used in services to make it to make it
easier to do different kinds of HTTP
requests for example posts and dealing
with cookies and headers and those sorts
of things to deal with URL encoding and
translation and to do data matching
which is kind of a traditional Sherlock
to way of extracting information so now
I'd like to invite jessica back up to go
into much more detail about how to
actually develop a channel than
nitty-gritty welcome just thank you hi
everybody as Wayne said before I'm the
channel development lead and I'm going
to talk to you about how to actually get
started with developing your channels
please forgive me if I'm rushing through
but I'm a little short on time and I
want to make sure that we have plenty of
time for questions ok so what I'm going
to cover today is developing channels in
four steps
that's honestly all it takes then I'm
going to cover a little what's new for
developers in Panther and then a few
advanced topics so what are the four
steps for developing channels you create
your channel you customize your channel
you probably have to debug your channel
and then you deploy your channel I'm
going to talk about creating your
channel first so the steps to creating
the channel all involve using Xcode our
development environment which you've
probably all received on your CDs and
the first step that you want to take is
launched Xcode and create a new project
and you'll find that in your list of
choices you can choose to create a
sherlock channel we've provided a
template for that kind of project choose
to make one of those next you're going
to be presented with a panel to save
your channel project somewhere and make
sure you save it in an HTTP accessible
directory when you deploy your channel
it goes out on the web but to be able to
test your channel locally it needs to be
in either of a global web server
documents folder or maybe in your sights
folder in your user directory next make
sure you turn on personal web sharing it
will save you a lot of pain you're going
to wonder why your channels not showing
up and it's because you forgot to turn
on personal web sharing so you do that
in the sharing preference panel in
System Preferences finally go back to
Xcode and build and run your project
basically Sherlock's gonna launch and
it's going to launch with the right
environment variable set to get the
development you in the development you
you want to add your channel the
Sherlock we've realized that this is an
extra step that you probably don't want
to do so in future revisions hopefully
we will automate that for you but
remember to add your channel this will
prevent you prevent you this will
present you with a dialog where you have
to type in a little sherlock URL but
there's one there by default so you
really only have to edit a couple of
pieces of it to make sure that it's
pointing to your chip channels
definition file once you hit add then
Sherlock's going to display your channel
but it's our channel because it's the
one in the template so this probably
isn't exactly what you want that's why
you're going to customize them so
customizing your channel involves two
steps you give your channel its own
identity and then you enhance our
starter code to meet your specific needs
giving your channel its own identity
involved naming it describing it setting
its identifier and then giving it a
beautiful icon to really attract your
customers to it naming it's pretty
simple it's done in the localized
resources plist file that's where all
strings that could be displayed in
multiple languages are defined in a
sherlock channel so that you can see
what that file actually contains I've
highlighted the channel name key and
then I've named my channel WWDC 2003
example in that same file you can
describe your channel that's the channel
description key and I've said this
example demonstrates basic channel
development tasks what's that going to
get you well setting the name and
studying the description is going to
show up in the other channels view in
our channel management view so you want
to make sure that you describe
accurately what your channel does sell
it a little bit it'll get users to click
on it set aside enta fire this is
important not for your customers but for
Sherlock if you've developed
applications on our platform outside of
Sherlock a Coco app a carbon app but
you're probably familiar with the
concept of a bundle identifier and this
is basically the same thing but for
Sherlock here I've set the identifier to
calm a palatable you wdc 2003 example so
just like with bundle identifier a three
part string comprised of calm your
company your product name will make it
sufficiently unique that you probably
won't collide with other channels
finally the last it is to give it a
beautiful icon this is really important
it puts a level of polish on your
channel that users are really going to
appreciate I can't emphasize enough that
giving your channel an identity that
makes users want to double click on it
in the other channels view is going to
give you a larger customer base how can
you give it a beautiful icon well
briefly you can download the Aqua icon
kit from our developer website or you
can hire a professional design agency if
you're not a graphic artist okay so
you've given your channel and identity
but it still does what our default
channel does so enhance the starter code
to meet your deeds back to the diagram
that Wayne was using earlier channels
consist of interface triggers and
services at least from a developer's
point of view that
the stuff that you need to worry about
customizing first we're going to talk
about customizing the interfaces Wayne
mentioned the interface is designed with
interface builder it's the same as a
regular native used in any other kind of
app on our platform what's the point of
the interface well you display a pretty
picture to your users but also you need
to set up data in the interface to
connect your triggers so that when your
user interacts with your channel
something happens to execute a search
out onto the web so here I've opened up
channel nib which is the default nib
that comes as a result of creating the
Sherlock channel in the project template
in Xcode and I've clicked on the search
button and now I've gotten info about it
with the project inspector or the nib
inspector rather so with we mentioned
earlier again you can assign these
Sherlock names or Sherlock IDs to UI
elements and this is where you do it
choose the Sherlock item from the pop-up
there and then your main view has its
own identifiers and then you can
identify the button so here I've named
it internet search button okay this is
going to be useful to us in my next
example so let's move on triggers are
executed when a value for a data store
path changes or when the data store path
is notified so you can programmatically
just sort of touch a data store path
inside of a trigger and that can cause
the trigger to execute another figure to
execute triggers tend to use javascript
why because Java JavaScript is going to
execute in a linear and more
deterministic fashion than xquery if
you're familiar with channel development
at all or you've looked at any of our
sample stuff in xquery you can return a
dictionary right and the keys can be
data store pads and you can be setting
values to those paths but there's no
guarantee that if the dictionary has say
four items in it they're going to return
in that order so sometimes order is
important so it's better to use
JavaScript and data stored outset so
here's an example of a trigger and I'm
going to whizz past this screen because
you probably can't read it but triggers
tend to live in a file called channel
XML and they look something like this so
think back to that inspector where we
set internet search button
action is one of the default datastore
paths for NS button you're going to want
to check out our documentation on the
web the inside Mac like documentation
all of the default data store paths for
any particular kind of object are listed
there including an expectant actions so
briefly what this triggers doing is
using data store set to set the results
table to a particular setting it's an
all set and see it out it's turning on
the network arrows by another default
path thought animating and then it's
kicking off a search by notifying or
catching another data store path to
perform the search ok services you want
to perform your search you want to do
this in a service so that next data
store pass will probably execute a
search service services are called by
triggers they encapsulate data source
transactions is Wayne with mentioning um
we find that this makes it easier to
maintain a channel because it's much
more likely that your service is going
to need periodic maintenance when the
web changes so to isolate that from your
channel trigger code means that when you
need to change to accommodate a change
to a website you're only changing your
services file you don't need to upload
your whole channel file again they tend
to use xquery because it's a great XML
parsing mechanism so again you can't
really see this but soaked XML is
actually a services file that we shift
today and we use it ourselves in our
shipping channels and basically this is
just a definition of a function called
soap query it takes a few parameters
it's using the dictionary call to set up
HTTP headers and then it's doing a post
with the headers and asking for the data
back from that post returning it pretty
simple to execute a soap query okay so
I've gone running through how you can
make your channel you get an identity
customized it to talk to your web
service and return your results to your
users and ideally it would just work
fine but they probably don't be and if
the web changes as it often does and
your service changes you might need to
debug it debugging and channels is a
little different than debugging a cocoa
a poor a carbon and so you need to learn
a few new tricks first you need to make
liberal use of message and debug
statements which are sort of like printf
but messages for xquery and debug is for
JavaScript more importantly i think is
liberal use of the xquery and javascript
channels during your channel development
phase I'll explain why in a bit finally
there's the enhanced a bug menu which
Wayne mentioned we've had a de bug menu
all along but we've added a lot more
interesting stuff to it and Panther a
lot more useful stuff for you first
message in debug again message is used
in xquery code basically this little
sample is getting the HTML down from
Apple's website then it's logging it out
if you execute message statements you
will find that they if you're running
Sherlock from within project builder or
rather Xcode as we are in this example
you'll find these message statements in
its console but if you're just running
Sherlock stand alone without Xcode
you're going to want to look in console
app for these messages so it's logging
out the HTML from the site and then
continuing along and returning what it
wanted to return from the service
similarly you can use the bug I've
basically done the same thing here just
making use of the xml query JavaScript
object and calling document getting the
data debugging it out to the console and
returning it more importantly though as
I said xquery and JavaScript channels
you didn't see the JavaScript channel
earlier but it's the same concept as an
expert channel which we did demonstrate
why do you want to use these you really
want to unit test blocks of code as
you're developing your channel so that
when you paste it into your channel file
you just know it works a caveat though
in your channel file because it's an XML
file you need to escape special
characters so you know a less than
symbol would have to the ampersand LT
colon to work in your channel file to
work in the xquery channel you don't
want to escape it it's not an XML file
so you just need to sort of global
search and replace ampersand LP for a
real less than sign make sure you do
that so a little picture of what these
do here have got an xquery channel a
picture up there I'm getting again the
data from apple com I've got a little
xquery execute
to grab all the image tags and then I'm
asking for their storage attributes and
when you hit run all the service
attributes get put out in the results
area similarly the JavaScript channel I
couldn't really think of a good example
so I'm just checking that five plus 16
still equals 21 and in fact it did
finally the debug menu so the way you
turn it on although someone's edited my
slide to capitalized each and you don't
want to do that if you want to turn it
on with a default command which is
executed in terminal defaults write calm
down a pleasure lock Sherlock debug one
the next time you want your luck it's
going to come up with the debug menu and
there are a number of things we've added
you can turn on and off different levels
of logging you can turn off HTTP caching
which is pretty excellent as you're
developing a channel because you're
making changes all the time so you'd
rather just have the fresh copy right
away as soon as you've made a change you
can look at the data store and also
tickle the data store you can change its
values or notify things you can look at
your NS view hierarchy all kinds of good
stuff in there all right so hopefully
now you've got the tools to debug your
channels and you're ready to deploy it
so there are a few things to think about
when you're deploying first is so you
want to use subscriptions and
checkpoints once you've decided all that
you got to figure out how to ftp your
files to the web server of your choice
and then you just submit your channel
apple and it shows up in our other
channels view this is kind of a wordy
slide if i'm going to gloss over it
subscriptions and checkpoints so the
subscription file lists channels you're
deploying it's useful when you shoot
multiple channels like Apple does so we
use subscriptions for for instance our
apple channels are other channels which
are the third party channels our channel
development tools all of those things
that show up in the left-hand column of
the channel management view they will
increase your channels visibility if you
choose to use a subscription for that
very reason that they'll show up as a
separate folder or collection on that
left-hand side of the channel management
view and they're also very convenient
for your user because if you're shipping
multiple channels if you want to deploy
them one by one we user have to
click on a URL each time to add a
channel one at a time so just ship them
all at once in a subscription and they
just have to add the subscription
they're done why else are they useful
well subscriptions allow you to control
who sees your channels in a subscription
file you can require specific sherlock
versions or require a specific
geographic region for instance okay now
that you've decided to use a
subscription file perhaps you need to
wonder as to whether you want to use
checkpoints water checkpoints basically
you can designate certain files in your
channel hierarchy as a checkpoint and it
helps your lock to know what's change so
if you change the mod date on your web
server once you've deployed of a file
that is a checkpoint Sherlock's going to
know that it should take a look at
everything below that and possibly
update it all right so you're using a
subscription or you're not you're using
check going through you're not either
way you're up to being your files to a
public web server you could deploy on
your company's web servers you could
deploy on da map if you've got it on mac
account you could apply on any HTTP
server if you're using a channel for
internal purposes at your company you
can deploy on something like that but if
the channel is external make sure you
submit your channel to Apple we can't
stress enough how much this is going to
raise your channels visibility so when
that's a bug menu usage the submit
channel menu item and your channel will
appear in the other channels collection
alright so hopefully I should note at
this point actually that the reason I'm
glossing over the details of some of
these things like how do you create a
subscription file and what does a
checkpoint look like it's because it is
actually pretty well covered in our in
our documentation and so if you take a
look at the inside Mac likes
documentation on developer apple com
also you want to take a look definitely
at the release notes on your cds that
you got in developer documentation
release notes because we took great care
to update them with all the new
information which is what i'm going to
talk about right now so what's new for
sherlock channel developers in Panther
we've got some user interface
enhancements
we've got interop location communication
abilities that weren't there before
we've added some support for address
book we've added per channel health
support for help viewer and we've added
some versioning capabilities so that you
can adopt all of these things safely
first off the interface enhancements in
an astable view we've changed it so that
you can turn on type selection in
columns or an entire table you have more
control over whether users can delete
rows or not you can set the scroll
position of the table you can have
checkboxes in table cells and table
sorting can be done for you
automatically we change the NS combo box
to their we've changed it so that you
can turn on text selection text
selection on first mouse down or you can
turn that off and you have just
generally greater control over the list
behavior the HTML view of course is now
using the fabulous WebKit and that's
going to add a lot of capabilities if
you want to display more complicated
HTML you can set the default car set so
let's say you've narrowed down a chunk
of HTML in one of your services and in
so doing you've managed to strip out the
car set tag you can just tell the web
view that every time you're displaying
HTML that's what car set should be
whatever finally you can turn it on you
can turn on browsing within Sherlock so
links will be followed with in your HTML
view versus if the user clicks on a link
now in Jaguar rather if they click on a
link it will definitely be sent out to
the default handler for HTTP URLs so you
can actually just browse with interlock
now because the WebKit is powerful
enough to handle that inter application
communication so Sherlock is a
playground and that makes it safe for
users and we think it's pretty easy to
develop for but not the only ass out
there so maybe your channel wants to
talk with other applications we've
enabled this by using special URLs so
there are address book URLs ical and web
cal URLs to talk to ical and
health URL so that you can open help you
or from within your channel the way you
would use these URLs as you create one
in your in your channel source and then
you send it to system the JavaScript
system object with the openurl command
and if the URLs in there the system
object will decide what the proper
handler for that team is via launch
services and the right application will
be opened address book support so as you
saw in the phone book channel we've got
combo boxes that do all kinds of neat
completion they complete city-states
they complete on titles in the users
address books they'll even complete you
didn't see this but they will complete
on addresses in the users address book
so that's done in the Sherlock address
combo box we've packaged it up so that
you can just drag it in interface
builder drag a combo box in change the
custom types to Sherlock address combo
locks and you've got the same
functionality we have in the phone book
channel also there's a JavaScript
address book object and through that
object you can add things to the users
address book and you can search the
user's address book per channel health
it's really good user experience it's
its basic aqua savvy to provide help for
your software and to do so in help
viewer so we've enabled that in Panther
basically you tell us where your help
file is and we take care of the rest we
add an item to the help menu that points
to your channels help we open it when
the user chooses that item you're going
to want to take advantage of versioning
if you take advantage of any of these
new functionality of any of this new
functionality though and if you're
familiar with the concept of Gestalt sir
anything like that basically you can
check to see that something is there
before you use it or you can check to
see that Sherlock itself is a particular
version before you use something and
that's done by checking for the
existence of new JavaScript objects you
can call channel version from X queries
and that will give you back the version
of Sherlock and you can use version or
max version attributes on triggers or
services or subscriptions and again this
is all covered in the documentation so i
won't go into the exact detail
very briefly because I know I'm running
out of time advanced topics three of
them the most important in my opinion
localized resources printing and
performance tips if you take advantage
of any of these three advancing you're
going to provide your user with a much
better user experience localized
resources so not everybody in the world
speaks the language that you're
developing your channel in and if you
have the ability to localize your
channel into other ANC's languages
Sherlock will let you do that basically
you set a localized base URL which tales
tell Sherlock where to look for your
localized resources and then you can
access localized resources from your
code as well so if you're setting a
string dynamically so let's say you're
setting a label from within a trigger
with a data stored up set to the to the
labels pack you would call localized
resource get the right strings and then
set it you can also call localized URL
to get a URL that points into the right
L proj directory printing channels can
be kind of complex there's a lot of
information in there particularly
because you're aggregating information
from multiple websites or you're trying
to do better than a web page could do
and so you're showing a lot of stuff i
mean let's look at the phone book
channel we've got tables of results
we've got driving directions we've got a
big map sometimes that looks great in
Sherlock but it doesn't look great when
you print it out on an eight and a half
by eleven piece of paper and so I can't
help but stress that if you print it out
and it doesn't look too good your users
really not going to appreciate that
create a custom print view you just add
any of you to your nib you reorganize
your UI elements so that it'll look good
for eight and a half by eleven and then
if you do that be sure to set your
channels means you identify your data
for path so that a Sherlock loads your
channel it knows that one view is
actually the view to show in Sherlock
and the other view is your print view
performance tips nobody likes to use a
channel that's slow and we've been
working to make ours faster and I want
to share with you a little bit of what
we've learned about that a void
initialize globe initializes with
special chunk of code that all execute
before your channel shows up there's a
lot of stuff that we were doing and
initialized that did not have to be done
before the channel appeared if you are
doing stuff that doesn't have to be done
and initialized
move it to a later trigger execute any
given X hath only once so let's take a
little example let's say I download some
HTML with the document command and it's
in a variable dollar HTML and I want to
get all the anchors in that HTML and
then I'm going to need all of the
anchors hrs and all of the text for
those anchors well I could say dollar
HTML / /a flash text and then dollar
HTML / /a flash at href but since I'm
doing / /a twice and that might be
expensive why don't I saved that in a
variable next favor cash update for
infrequently changed resources we've
made use of this ourselves and basically
it's a flag that you can set on an HTTP
request and if you know a resource out
on the web is I'm going to change very
often there's an image out there that's
pretty static if you set that flag
you're able to get the image from the
cash first and then Sherlock will go
check to see if it's changed and pull it
down in the background so the next time
you access it you'll have the new thing
in the cash stream return data into the
view as it becomes available examples
where we do this with a pictures channel
in the internet channel if you have some
info first and you're waiting for others
don't make your user wait splat it out
into the view and wait for your stuff
and then splat the next stuff out
finally show cache data first and then
refresh we mentioned this as a tactic
for having a good channel user interface
we do this in the movies channel if you
do a movie search and we get your list
of theaters and and movies will show
that to the user again the next time
they launch and then updated in the
background so I'm going to invite Wayne
back up for a wrap up for our session
thank you Jeff so in summary Sherlock
allows you to deliver web services today
you can create them quickly there
updatable on the web they provide a
native aqua you I much like an
application but you can link to them
directly from the web or launch them
from the dock and in Panther they're
built right into Sherlock so for a road
map now of course all of these sessions
have already happened but for those of
you watching on DVD or if you'd like to
get the dvds the internet technology
safari over to provides a high-level
overview of the technologies used by
Safari and of course by Sherlock as well
the WebKit and the foundation URL API if
you'd like to add help tier channel then
you might be interested in session 408
for the apple health updates and how
to's and the next one there is more
about Safari and web standards which
again is interesting for HTML views and
such and then the session internet
application development the new frontier
is an environment provided by macromedia
that aims to provide Internet
applications that may also be of
interest if you're doing a lot of
graphics like you would in a flash kind
of context so and of course our friend
jon is is the guy to contact if you'd
like to ask for features or any sort of
thing like that and for more information
there's the Sherlock developer web page
which is very easy to get to developer
to the apple.com / Mac os10 flash
Sherlock has all the information you
need there there's a mailing list if
you'd like to ask questions if you're in
the midst of channel development and you
went into a problem you're not sure how
to deal with please ask on the mailing
lists we're more than happy to answer
questions there or other developers will
also chimed in an answer inside Mac os10
Sherlock channels is the documentation
for how to create Sherlock channels and
that's up at the developer website and
it's also on
or disc and then of course the release
notes will tell you specifically new
features that have been added in various
releases along the way including Panther
if you'd like to learn more about the
JavaScript language there are lots and
lots of references out there the sort of
main standard reference is out on the
ECMA site and there's the URL there but
of course there are many books out on
JavaScript xquery is much newer of
course and it's not yet a final standard
and so there really aren't as many
references out there but the the main
reference is at the w3c site and this is
both the language and then the function
to provide
you