Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
Changed --hmac-cbc to --cbc-file to account for the next version of
cppcms_make_key included with CppCMS. Bug report:

https://sourceforge.net/p/cppcms/bugs/129/

Fixed bug in stdev where it wasn't actually using the result of
std::accumulate. However, since this function currently isn't
being used, this has no effect on the program.

Fixed tabbing issues in Javascript code.
  • Loading branch information
floft committed Sep 17, 2014
1 parent 3382fb8 commit ceb30c3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use make and then generate the keys and put them in */srv/freetron* or
whatever website directory you choose:

cppcms_make_key --hmac sha256 --cbc aes256 \
--hmac-file website/hmac.txt --hmac-cbc website/cbc.txt
--hmac-file website/hmac.txt --cbc-file website/cbc.txt

###Running###
Website interface: ``./freetron --daemon website/``
Expand Down
2 changes: 1 addition & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ if(NOT EXISTS "${WEBSITE}/hmac.txt")
"${WEBSITE}/cbc.txt"
COMMAND "${EXE_MAKE_KEY}" --hmac sha256 --cbc aes256
--hmac-file "${WEBSITE}/hmac.txt"
--hmac-cbc "${WEBSITE}/cbc.txt"
--cbc-file "${WEBSITE}/cbc.txt"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
endif()

Expand Down
5 changes: 2 additions & 3 deletions math.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@ Coord findCenter(const std::vector<Coord>& points);
//
// Type should probably be std::vector<double>
template<class Type>
double stdDev(const Type& v)
double stdev(const Type& v)
{
if (v.size() == 0)
return 0;

double total = 0;
std::accumulate(v.begin(), v.end(), total);
double total = std::accumulate(v.begin(), v.end(), 0);

double mean = total/v.size();
double inroot = 0;
Expand Down
44 changes: 22 additions & 22 deletions website/files/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
*/

function validUser(username) {
if (username.length < 4 || username.length > 30)
return false;
if (username.length < 4 || username.length > 30)
return false;

if (!username.match(/^[A-Za-z0-9\-_\.]+$/))
return false;
if (!username.match(/^[A-Za-z0-9\-_\.]+$/))
return false;

return true;
return true;
}

function password(pass) {
Expand Down Expand Up @@ -165,13 +165,13 @@ function isPdf(type, name) {
}

function validKey(key) {
if (key.length < 1 || key.length > 10)
return false;
if (key.length < 1 || key.length > 10)
return false;

if (!key.match(/^[0-9]+$/))
return false;
if (!key.match(/^[0-9]+$/))
return false;

return true;
return true;
}

// Mostly from http://matlus.com/html5-file-upload-with-progress/
Expand Down Expand Up @@ -381,16 +381,16 @@ function createEntry(id, name, date, formData) {
sId.className = "id";
sId.innerHTML = id;

var sDel = document.createElement("span");
var sDel = document.createElement("span");
sDel.className = "del";
sDel.onclick = function() { deleteEntry(sDel) };
sDel.innerHTML = "X";

var sName = document.createElement("span");
var sName = document.createElement("span");
sName.className = "name";
sName.innerHTML = name;

var sDate = document.createElement("span");
var sDate = document.createElement("span");
sDate.className = "date";
sDate.innerHTML = "&mdash; " + date;

Expand All @@ -416,7 +416,7 @@ function createEntry(id, name, date, formData) {
* All pages
*/
function confirmExit() {
if (window.needToConfirm)
if (window.needToConfirm)
return "Are you sure you want to leave this page? You will lose data if you do."
}

Expand All @@ -433,11 +433,11 @@ function logoutOnclick() {
// function(evt) { /* canceled */ },
// optionalData);
function http(url, complete, fail, progress, cancel, send) {
var con;
try { con = new XMLHttpRequest(); }
catch (e) { try { con = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) { try { con = new ActiveXObject("Microsoft.XMLHTTP"); }
catch (e) { return; } } }
var con;
try { con = new XMLHttpRequest(); }
catch (e) { try { con = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) { try { con = new ActiveXObject("Microsoft.XMLHTTP"); }
catch (e) { return; } } }

if (typeof complete === "undefined")
return; // Don't bother creating the request
Expand Down Expand Up @@ -477,16 +477,16 @@ function http(url, complete, fail, progress, cancel, send) {
}
}

con.open("POST", url, true);
con.send(send);
con.open("POST", url, true);
con.send(send);
}

function goHome() {
window.location.replace("/");
}

var $ = function(id) {
return document.getElementById(id);
return document.getElementById(id);
}

window.onload = function() {
Expand Down

0 comments on commit ceb30c3

Please sign in to comment.