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
// in terminal in the desired folder location run... | |
python -m SimpleHTTPServer 8000 | |
// in the browser go to the port number the server was started | |
http://localhost:8000 |
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
//This template allows to compare pairs, and return them in ascending order. | |
template <class T1, class T2, class Pred = std::less<T2> > | |
struct sort_pair_second { | |
bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) { | |
Pred p; | |
return p(right.second, left.second); | |
} | |
}; | |
//Implementation example |
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
//GET request | |
//-------------------------------------------------------------- | |
void ofApp::getRequestToURL(){ | |
//This is what we will be posting to the | |
string getRequest = "http://localhost:8000/api/recommendations/?ids="; | |
//we pass the IDs to our string for the GET post | |
for ( int i = 0; i < suggestedProducts.size(); i++){ | |
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
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --allow-file-access-from-files |
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
//testApp reference from another class: | |
//from a .cpp file, for example, "particle.cpp" you can do two things: | |
//a) include "testApp.h" (so you know what's inside the testApp) | |
//b) cast the ofGetAppPtr as a testApp ptr | |
//This is will be the .cpp of the class particle |
NewerOlder