Skip to content

Instantly share code, notes, and snippets.

View DragonOsman's full-sized avatar

Osman Zakir DragonOsman

View GitHub Profile
// chapter21ex7.cpp : Defines the entry point for the console application.
// Osman Zakir
// 12 / 20 / 2017
// Bjarne Stroustrup: Programming: Principles and Practice Using C++ 2nd Edition
// Chapter 21 Exercise 7
// Exercise Specifications:
/**
* Write a binary search function for a vector<int> (without using the stan-
* dard one). You can choose any interface you like. Test it. How confident
* are you that your binary search function is correct? Now write a binary
#include <boost/beast/core.hpp>
#include <boost/beast/http.hpp>
#include <boost/beast/version.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/connect.hpp>
#include <boost/config.hpp>
#include <cstdlib>
#include <cctype>
#include <iostream>
#include <memory>
// Osman Zakir
// 3 / 16 / 2018 (date for when work on this application started--these comments were put here on 8 / 20 / 2018)
// This is the JavaScript code for the Google Maps GUI + Currency Converter web application. It shows a Google Map
// with an info window appearing on the user's geolocation coordinates with an HTML form centered on it. The form
// has an input element to type in the amount of money in the base currency to convert, two dropdown menus populated
// with a list of currencies requested from the currency API, and a button to submit the form. The API access key is
// requested from the backend server application which is holding it in an environment variable to use there as well.
// The "from" currency dropdown by default selects USD, with the "to" currency dropdown selecting the currency used at the
// the place where the info window is opened in. Functionality to react to a click event on the map is also included: when
// a user clicks on the map, a new info window is opened there (th
// Osman Zakir
// 3 / 16 / 2018
// Currency Converter Web Application
// This application uses a Google Map as its UI. The user's geolocation is taken if the browser has permission, and an info window is opened at that location
// which displays a HTML form. The user can then enter the money amount to convert into a text box that accepts only numeric input,
// and choose the currency to convert to from a drop down menu
// (note: with the current currency API plan, changing the base currency (USD by default) isn't allowed).
#include <boost/beast/core.hpp>
#include <boost/beast/http.hpp>
#include <boost/beast/core.hpp>
#include <boost/beast/http.hpp>
#include <boost/beast/version.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <cstdlib>
#include <iostream>
#include <string>
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
// Osman Zakir
// 4 / 4 / 2018
// currency_converter_app main.cpp
// This is a currency converter web application written in Wt. The GUI is a Google Map with an info window that displays a form
// The form takes the user's input for what currencies to convert to and from, respectively, and the amount to convert. The form submits
// to the executable made by this C++ code file
#include <Wt/WApplication.h>
#include <Wt/WServer.h>
#include <Wt/Http/Client.h>
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="authur" content="Osman Zakir" />
<link href="resources/styles/styles.css" rel="stylesheet" />
<title>DragonOsman Currency Converter</title>
</head>
<body>
@DragonOsman
DragonOsman / main.cpp
Last active May 19, 2018 13:00
Wt Hello World
// Osman Zakir
// 4 / 4 / 2018
// currency_converter_app main.cpp
// This is a currency converter web application written in Wt. The GUI is a Google Map with an info window that displays a form
// The form takes the user's input for what currencies to convert to and from, respectively, and the amount to convert. The form submits
// to the executable made by this C++ code file
#include <Wt/WApplication.h>
#include <Wt/WServer.h>
#include <Wt/Http/Client.h>
@DragonOsman
DragonOsman / console_messages.txt
Created April 10, 2018 11:57
JavaScript console messages when testing app front-end
2 SEC7113: CSS was ignored due to mime type mismatch
wt.css (1,1)
Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys
Google Maps API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required
HTML1300: Navigation occurred.
localhost:8080 (1,1)
[2018-Apr-19 15:06:14.037] 12524 - [info] "config: reading Wt config file: wt_config.xml (location = 'C:\Users\Osman\programming\visual_studio_2017\Projects\currency_converter_app\Debug\currency_converter_app.exe')"
[2018-Apr-19 15:06:14.068] 12524 - [info] "WServer/wthttp: initializing built-in wthttpd"
[2018-Apr-19 15:06:14.361] 12524 - [info] "wthttp: started server: http://127.0.0.1:8080"
[2018-Apr-19 15:06:19.469] 12524 - [info] "Wt: session created (#sessions = 1)"
[2018-Apr-19 15:06:19.477] 12524 [/ DnPM6t8CswH9VO5j] [info] "WEnvironment: UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299"
127.0.0.1 - - [2018-Apr-19 15:06:19.518] "GET / HTTP/1.1" 200 3057
[2018-Apr-19 15:06:19.537] 12524 - [info] "WebRequest: took 68.014 ms"
127.0.0.1 - - [2018-Apr-19 15:06:19.716] "GET /?wtd=DnPM6t8CswH9VO5j&request=style&page=1 HTTP/1.1" 200 83
127.0.0.1 - - [2018-Apr-19 15:06:19.721] "GET /resources/transitions.css HTTP/1.1" 30