Your SlideShare is downloading. ×
0
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
You Either Surf Or You Fight
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

You Either Surf Or You Fight

3,447

Published on

Integrating Library Services with Google Wave

Integrating Library Services with Google Wave

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,447
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
11
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. You Either Surf or You Fight: Integrating Library Services With Google Wave
    Sean Hannan
    Sheridan Libraries
    Johns Hopkins University
  • 2. Google Wave
    http://wave.google.com
    Collaborative platform
  • 3. Why Library Services there?
    You can’t always force users to come to you
    Go where they are
  • 4. Wave Apps
    Two types
    Gadgets
    Like existing iGoogle gadgets
    Robots
    Real-time interaction
    Let’s go for the real-time interaction
  • 5. Already on Wave?
    Invite uncle-milty@appspot.com to a conversation
  • 6. Creating a Wave Robot
    Libraries for Java and Python
    Deployment using Google AppEngine
  • 7. App Engine
    http://appengine.google.com
    Google’s cloud-computing platform
    Free for up to 1.3 million requests per day
  • 8. Set up the Application
    Create an application at appengine.google.com
    Set up an application identifier <app>.appspot.com
  • 9. App Engine SDK
    Download the App Engine SDK from http://code.google.com/appengine/downloads.html
    Start the App Engine Launcher and create a new application
  • 10. Set up the app.yaml
    application: uncle-milty
    version: 2
    runtime: python
    api_version: 1
    handlers:
    - url: /_wave/.*
    script: uncle-milty.py
    - url: /assets
    static_dir: assets
  • 11. Wave Robot API
    Download the files from svn:
    svn checkout http://wave-robot-python-client.googlecode.com/svn/trunk/src/waveapi waveapi
    Drop it in the application directory
  • 12. Wave Concepts
    Wavelet
    The conversation taking place within Google Wave
    Blip
    Every message as part of the wavelet
    Hierarchical
    Each of these have unique identifiers that can be used to programmatically address them
  • 13. Project Overview
    A simple chat bot
    Searches the library catalog for results
  • 14. Code it up!
    Available on github: http://github.com/MrDys/uncle-milty
  • 15. External Libraries
    External libraries are a-okay
    Just drop it in the project directory
    Going to use BeautifulSoup to scrape the OPAC
  • 16. Imports
    from waveapi import events
    from waveapi import model
    from waveapi import robot
    from waveapi import document
    from waveapi.ops import OpBuilder
    import logging
    import urllib2
    from BeautifulSoup import BeautifulSoup
  • 17. OnRobotAdded Function
    def OnRobotAdded(properties, context):
    """Invoked when the robot has been added."""
    logging.debug("created")
    root_wavelet = context.GetRootWavelet()
    root_wavelet.CreateBlip().GetDocument().SetText("Hi, I'm Milton S. Eisenhower and I'd be happy to help you with your research. I will search the JHU catalog for anything that you say to me and I'll let you know if I find anything.")
  • 18. OnBlip Submitted Function
    def OnBlipSubmitted(properties, context):
    blip = context.GetBlipById(properties['blipId'])
    page = urllib2.urlopen("https://catalog.library.jhu.edu/ipac20/ipac.jsp?menu=search&aspect=subtab22&npp=5&ipp=20&spp=20&profile=general&ri=&index=ALTITLE&term=" + blip.GetDocument().GetText() + "&x=0&y=0&aspect=subtab22")
  • 19. OnBlipSubmitted Function con’t
    soup = BeautifulSoup(page)
    results = soup.findAll(title="View more information")
    sub_blip = context.GetRootWavelet().CreateBlip()
    sub_blipdoc = sub_blip.GetDocument()
  • 20. OnBlipSumitted Function con’t
    outputstr = ""
    count = 0
    for i in results:
    if count >= 5:
    break
    else:
    itemstr = str(i)
    itemstr = itemstr.replace('class="smallBoldAnchor"', '')
    outputstr = outputstr + itemstr + "<br/>"
    count = count + 1
  • 21. OnBlipSubmitted Function con’t
    logging.debug(outputstr)
    sub_blipdoc.SetText(" ")
    builder = OpBuilder(context)
    builder.DocumentAppendMarkup(sub_blip.waveId, sub_blip.waveletId, sub_blip.blipId, outputstr)
    logging.debug(sub_blip.waveId + " " + sub_blip.waveletId + " " + sub_blip.blipId)
  • 22. Register Event Handlers
    if __name__ == '__main__':
    myRobot = robot.Robot('Milton S. Eisenhower',
    image_url='http://uncle-milty.appspot.com/assets/milty.png',
    version='2',
    profile_url='http://uncle-milty.appspot.com/')
    myRobot.RegisterHandler(events.BLIP_SUBMITTED, OnBlipSubmitted)
    myRobot.RegisterHandler(events.WAVELET_SELF_ADDED, OnRobotAdded)
    myRobot.Run()
  • 23. Gotchas
    CSS
    Doesn’t really like it, so keep it simple
    HTML Links
    Won’t let you do it directly, must use OpBuilder
  • 24. Deployment
    Just hit ‘Deploy’ in the App Engine Launcher
  • 25. Debugging
    Use the logging library
    View the log results in realtime on http://appengine.google.com
  • 26. What next?
    Could be improved in a lot of ways
    More services integrated
    Create a menu-like system to select options
  • 27. Q&A
    Questions?

×