$30 off During Our Annual Pro Sale. View Details »

CSC309 Lecture 10

CSC309 Lecture 10

Software Engineering II
Connecting Services II
(202304)

Javier Gonzalez-Sanchez
PRO

January 31, 2023
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. jgs
    CSC 309
    Software Engineering II
    Lecture 10:
    Connecting Services II
    Dr. Javier Gonzalez-Sanchez
    [email protected]
    www.javiergs.com
    Building 14 -227
    Office Hours: By appointment

    View Slide

  2. jgs
    Previously …

    View Slide

  3. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 4
    Bing Maps
    Box
    Name
    1
    Name
    2
    Cat
    Car
    What is a Flowchart diagram?
    _

    View Slide

  4. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 5
    Let’s Work
    Stories

    View Slide

  5. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 6
    Let’s Work
    Tasks

    View Slide

  6. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 7
    Let’s Work
    Class Diagram

    View Slide

  7. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 8
    Let’s Work
    Code
    I will pay soon

    View Slide

  8. jgs
    AccuWeather API

    View Slide

  9. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 10
    What if …?
    Box
    Name
    1
    Name
    2
    Cat
    Car
    What is a Flowchart diagram?
    _

    View Slide

  10. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 11
    1.Go to the AccuWeather Developer website at
    https://developer.accuweather.com/
    1.Sign up for a free account by filling out the registration form or sign in using
    your existing account credentials.
    2.Once you're signed in, select the "My Apps" dropdown from the top-right
    corner of the page and click on "Add New App".
    3.Fill out the required information about your application and agree to the terms
    of service. Then click on "Create App".
    4.Your new app will appear on the "My Apps" page. Click on your app to view
    your API key and copy it to use in your code.
    AccuWeather

    View Slide

  11. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 12
    {
    "LocalObservationDateTime": "2023-04-23T00:04:0007:00",
    "EpochTime":1682233440,
    "WeatherText":"Clear",
    "WeatherIcon":33,
    "HasPrecipitation":false,
    "PrecipitationType":null,
    "IsDayTime":false,
    "Temperature":{
    "Metric":{
    "Value":11.1,
    "Unit":"C",
    "UnitType":17
    },
    "Imperial":{
    "Value":52.0,
    "Unit":"F",
    "UnitType":18
    }
    },
    "Link":"http://www.accuweather.com/en/us/san-luis-obispo-ca/93401/current-
    weather/331999
    }
    Response

    View Slide

  12. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 13
    Java Script Object Notation (JSON)
    •Data is in name/value pairs
    •Commas separate data
    •Curly braces hold objects
    •Square brackets hold arrays
    JSON
    XML

    View Slide

  13. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 14
    Code AccuWeather (1/4)

    View Slide

  14. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 15
    Code AccuWeather (2/4)

    View Slide

  15. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 16
    Code AccuWeather (3/4)

    View Slide

  16. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 17
    Code AccuWeather (4/4)

    View Slide

  17. jgs
    OpenAI API

    View Slide

  18. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 19
    What if …?
    Box
    Name
    1
    Name
    2
    Cat
    Car
    What is a Flowchart diagram?
    _

    View Slide

  19. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 20
    1.Go to the OpenAI website at https://openai.com/ and click on the "Sign Up" button
    in the top-right corner of the page.
    2.Follow the prompts to create an account and verify your email address.
    3.Once you're logged in, click on your username in the top-right corner of the page
    and select "Dashboard" from the drop-down menu.
    4.Click on the "API Keys" tab in the dashboard menu.
    5.Click on the "New API Key" button.
    6.Enter a name for your API key and select the API permissions you want to grant to
    the key.
    7.Click the "Create" button to generate your new API key.
    Open AI

    View Slide

  20. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 21
    {"id":"cmpl78QWL0xfnaEHWzTuCJZhpBK3OshrR",
    "object":"text_completion",
    "created":1682242925,
    "model":"text-davinci-003",
    "choices":[{
    "text":"ANSWER TEXT HERE",
    "index":0,
    "logprobs":null,
    "finish_reason":"stop"
    }],
    "usage":{
    "prompt_tokens":1,
    "completion_tokens":76,
    "total_tokens":77
    }
    }
    Response

    View Slide

  21. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 22
    OpenAI (1/4)

    View Slide

  22. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 23
    OpenAI (2/4)

    View Slide

  23. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 24
    OpenAI (3/4)

    View Slide

  24. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 25
    OpenAI (4/4)

    View Slide

  25. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 26
    Next Step

    View Slide

  26. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 27
    Questions

    View Slide

  27. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 28
    Office Hours
    Tuesday and Thursday 3 - 5 pm
    But an appointment required
    Sent me an email – [email protected]

    View Slide

  28. jgs

    View Slide

  29. jgs
    CSC 309
    Software Engineering II
    Lab 10:
    Work in your Sprint
    Dr. Javier Gonzalez-Sanchez
    [email protected]
    www.javiergs.com
    Building 14 -227
    Office Hours: By appointment

    View Slide

  30. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 31
    Let’s Work

    View Slide

  31. jgs
    CSC 309 Software Engineering II
    Javier Gonzalez-Sanchez, Ph.D.
    [email protected]
    Winter 2023
    Copyright. These slides can only be used as study material for the class CSC308 at Cal Poly.
    They cannot be distributed or used for another purpose.

    View Slide