Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const e = require('text-encoding'); //it is built-in for some browsers. We neeed to install it in Node.js | |
const uint8array = new e.TextEncoder().encode(stringData); | |
const normalArray = Array.prototype.slice.call(uint8array); | |
// http://docs.parseplatform.org/js/guide/#creating-a-parsefile | |
const file = new Parse.File(fileName, normalArray); | |
file.save().then(function() { | |
// The file has been saved to Parse. | |
}, function(error) { | |
// The file either could not be read, or could not be saved to Parse. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ref: https://stackoverflow.com/a/35007461/7354486 | |
var tester = require("./test.js"); | |
console.log("test2"); | |
console.log("first line2"); | |
exports.handler3 = (event, context, callback) => { | |
console.log("event2:", event); | |
tester.test5(); | |
// TODO implement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// #include <error.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <time.h> | |
// forked process can use the file descriptor from parent's process without open again. Then two process can synchronize the file operations. | |
// ref: | |
// https://stackoverflow.com/questions/5284062/two-file-descriptors-to-same-file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// not use now | |
// uWebSockets part, comment now, change to use qt's built-in WebSocket | |
//TODO Grimmer: this is for new CARTA, and is using hacked way to workaround passing command/object id/callback issue. | |
// void SessionDispatcher::startWebSocketServer() { | |
// std::cout << "websocket starts running" << std::endl; | |
// uWS::Hub h; | |
// // DesktopConnector *conn = this; | |
// h.onMessage([this](uWS::WebSocket<uWS::SERVER> *ws, char *message, size_t length, uWS::OpCode opCode) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AZHU.storage = { | |
save : function(key, jsonData, expirationMin){ | |
if (!Modernizr.localstorage){return false;} | |
var expirationMS = expirationMin * 60 * 1000; | |
var record = {value: JSON.stringify(jsonData), timestamp: new Date().getTime() + expirationMS} | |
localStorage.setItem(key, JSON.stringify(record)); | |
return jsonData; | |
}, | |
load : function(key){ | |
if (!Modernizr.localstorage){return false;} |