GithubHelp home page GithubHelp logo

priyanka-maz / weather360 Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 55.75 MB

This is a weather app which addresses the need for a fast and easy to manage article system, while providing a focus on weather and climate information. It uses Azure Virtual Machine, Azure Text-To-Speech, Java Servlet, JDBC, Tomcat, MySQL, JSP.

Home Page: http://20.232.170.85:8080/Weather_News/Index

License: MIT License

Java 50.24% HTML 26.27% CSS 23.48%
azure frt-microsoft frt-project linux-virtual-machine openweathermap-api tts-api wttr

weather360's Introduction

Weather360

This is a weather app which addresses the need for a fast and easy to manage article system, while providing a focus on weather and climate information.

  • It uses the following Azure Services: Azure Virtual Machine, Azure Text-To-Speech.
  • The backend is coded using Java Servlet, Tomcat Server, JDBC db connection, MySQL database, JSP for frontend.

Setup on Azure

  1. Create a Linux VM for running the application backend and storing the MySQL database.

Azure VM

  1. Create an API key for accessing the Azure Speech Services.

Azure Speech

Navigate to article.jsp and paste in your Azure Speech Services Key in the following code block:

        try {
            fetch("https://eastus.tts.speech.microsoft.com/cognitiveservices/v1", {
              method: "POST",
              headers: {
                "Ocp-Apim-Subscription-Key": "",
                "Content-Type": "application/ssml+xml",
                "X-Microsoft-OutputFormat": "audio-16khz-128kbitrate-mono-mp3",
              },
              body: `<speak version='1.0' xml:lang='en-US'>
                     <voice xml:lang='en-US' xml:gender='Female' name='en-US-JennyNeural'>
                         ${textContent}
                     </voice>
                 </speak>`,
            })
              .then((response) => response.arrayBuffer())
              .then((arrayBuffer) => {
                var blob = new Blob([arrayBuffer], { type: 'audio/mp3' });
                var url = URL.createObjectURL(blob);
                var audio = new Audio();
                audio.src = url;
                audio.play();
              })
              .catch((error) => {
                console.error("Error:", error);
                alert("Oops! An error occurred.");
              });
          } catch (error) {
            console.error("Error:", error);
            alert("Oops! An error occurred.");
          }

Note: API keys used for the deployment of the demo have been removed from this git repo for security reasons.

Setup Java Project

  • Clone the repo

    git clone https://github.com/priyanka-maz/Weather360
  • Make sure MySQL is installed. We assume user:'root', password:'abcd'.

  • Make sure Apache Tomcat 9.0.x is installed.

Using Eclipse

  1. Import project into Eclipse.

  2. Setup tomcat server on any available port (say, 8080).

Using jre directly (such as on a Linux VM on Azure)

  1. Export WAR file from Eclipse.

  2. Install tomcat-9.0.x server following instructions given at https://www.digitalocean.com/community/tutorial_collections/how-to-install-apache-tomcat

  3. Navigate to tomcat manager and upload and deploy WAR file.

Note: Navigate to /Startup to have the application automatically create the database and tables for you.

Screenshots

Index1 Index2 Loc Wttr Register Login Profile Posts Deleted Upload Success Post Tags Faq About Error

Features

  • User Registration and Session Cookie based authentication for login.
  • Passwords are stored using Bcrypt Hashing Algorithm.
  • Users may logout.
  • Users may specify their default location for displaying of weather news.
  • Users may post articles with images and tags.
  • Users may delete their own posts.
  • Latest 6 posts can be viewed from the front page; others may be navigated using the posts link.
  • Users can view wether information for any location of their choice.
  • Users can listen to a TTS version of posts using Azure's Speech Service.

File Structure

.
├── LICENSE .................................................... License terms
├── README.md .................................................. This document
└── Weather News
    ├── build
    │   └── classes
    │       └── pkg ............................................ Compiled Java classes
    └── src
        └── main
            ├── java
            │   └── pkg ........................................ Java Servlet sources
            └── webapp ......................................... HTML and JSP templates
                ├── META-INF
                │   └── MANIFEST.MF ............................ JAR manifest
                ├── other
                │   ├── css .................................... Font and CSS rules
                │   └── js ..................................... JS files
                ├── Pics ....................................... Static and Uploaded images
                └── WEB-INF
                    ├── lib
                    │   └── mysql-connector-java-8.0.30.jar .... MySQL connector JAR
                    └── web.xml ................................ Listing of servlet welcome files

weather360's People

Contributors

prateek-ganguli avatar priyanka-maz avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

pganguli

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.