Skip to main content

Posts

Showing posts from April, 2016

Timing a C++ program using ctime stl library

Some simple code to log your timing of a program in C++ // Timing code using ctime library // Author: Neville Andrade #include <iostream> #include <array> #include <vector> #include <algorithm> #include <tuple> #include <string> #include <ctime> typedef std::tuple<int, int> str_int_tuple; int main() {  time_t currentTime;  struct tm *localTime;    time(&currentTime);  localTime = localtime(&currentTime);  // Convert the current time to the local time  int Day = localTime->tm_mday;  int Month = localTime->tm_mon + 1;  int Year = localTime->tm_year + 1900;  int Hour = localTime->tm_hour;  int Min = localTime->tm_min;  int Sec = localTime->tm_sec;  std::cout << "This program was exectued at: " << Hour << ":" << Min << ":" << Sec << std::endl;  std::cout << "And the curren...

Shiny Programming: Highcharter library returning data to page with draggable points

This experiment is using the highcharter library to create an interactive graph and returns the value selected on the graph back to the webpage. A good way to see the effect of changing inputs on the output calculations. The Shiny application will be called Experiment3. To set things up I will need to create 4 things 1. Create an Experiment3 folder. 2. Create a server.R script file in the Experiment2 folder. 3. Create a ui.R script file in the Experiment3 folder. 4. Create an Experiment3_App.R script file outside the Experiment3 folder. The server.R script is library(shiny) library(highcharter) library(data.table) myData <- data.table(x=2012:2016, y=c(3900,  4200,  5700,  8500, 11900)) shinyServer(function(input, output) {     #Make a copy of the data table. It will be run only once when use opens the application   m_data <- myData     output$text1 <- renderText({     paste("You have selected ",input$x...