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 <stdio.h> | |
typedef struct X { | |
int a, b; | |
} X; | |
int main() { | |
X x = { 1, 2}; | |
X x2; | |
x2 = x; // data is copied |
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
=COUNTIF(a2:a15,">""") |
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
int f( object a) { | |
int z = 5; | |
return z; // RVO | |
return std::move(z); | |
} | |
int f2( object& a) { | |
int z = 5; | |
return z; // RVO | |
return std::move(z); |
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
class State; // forward declare a class - it exists but not tell you what's in it | |
// must declare it so that we can use it in Node but State uses Node so can't put them both first | |
class Node { | |
public: | |
Node(State *s) : state(s) {} | |
void process(); | |
State *state; // always need to work with pointers or references to objects with members - | |
//could be a question state or an answer state - don't know how big the state object will be - |
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 "Grading.h" | |
#include<numeric> | |
using namespace mpcs51044; | |
using namespace std; // when you're not in a header you are no imposing your choices on anyone else | |
// it's okay to use this here | |
double Student_info::grade() const | |
{ | |
double avg = accumulate(homework.begin(), homework.end(), 0.0) / homework.size(); |
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
' http://stackoverflow.com/questions/12856979/how-to-refresh-load-rtd-bloomberg-function-bdh-in-excel-in-vba | |
Application.run "RefreshAllWorkbooks" | |
Application.run "RefreshAllStaticData" |
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 <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
// my CPU has 32K of L1 cache | |
#define L1_CACHE_CAPACITY (32768 / sizeof(int)) | |
int array[L1_CACHE_CAPACITY][L1_CACHE_CAPACITY]; | |
struct timespec time_diff(struct timespec start, struct timespec end) { |
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
When a matrix can be inverted: | |
- matrix is a square matrix | |
- linearly independent columns | |
- the span of the basis is the basis R^n | |
if C is invertible then the span of B = R^n | |
span of B is R^n then C is invertible |
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
http://stackoverflow.com/questions/6114115/windows-virtualenv-pip-numpy-problems-when-installing-numpy |
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<stdio.h> | |
int main(int argc, char * argv[]) { | |
float f = 19.86; | |
int x, k; | |
for (k=0; k < 32; ++k) { | |
x = *(int*)&f >> (k); |