A simple application apollo server and react
graphql
Design Graphql is base on what your want
Design Graphql is base on what your want
echo() ->
receive
{From, Msg} -> From ! {Msg}, echo();
%^pattern^ %^response^ %^keep loop
stop -> true
%^pattern^ ^a return value and stop receiving
end.The conclusion is add "homepage":".", in package.json.
If you are routing client side, index.html may still not work. In this case, you may using BrowserRouter. Change it to HashRouter.
Click: Different between them
For mac
sudo brew install redis-serveropen redis server
redis-servertest is work or not
redis-cli pingECHO 'hello word
QUITSET foo 100
GET foo // 100
SET bar 'hello world'
GET bar // hello world
INCR foo // 101
DECR foo // 100
EXISTS foo // 1
EXISTS foo1 // 0
DEL bar
EXISTS bar // 0
GET bar //(nir)
FLUSHALL // all empty
SET server:name someserver
GET server:name // "someserver"
SET server:port 8000
GET server:port
SET greeting "Hello world"
GET greeting
EXPIRE greeting 50 // set expirations to 50 second
TTL greeting
SETEX greeting 30 "hello world" // set value and expiration
PERSIST greeting // key will not expire
TTL greeting // -1
MSET key1 "hello" key2 "world"
APPEND key1 " world"
RENAME key1 greeting
LPUSH people "Brad" // 1
LPUSH people "Jen" // 2
LPUSH people "Tom" // 3
LRANGE people 0 -1 // return all // Tom Jen Brad
LRANGE people 1 2 // Jen Brad
RPUSH people "Harry"
LRANGE people 0 -1 // Tom Jen Brad Harry
LLEN people // 4
RPOP people // Harry
LPOP people
LINSERT people BEFORE "Brad" "TOM"
LRANGE people 0 -1 // Jen Tom Brad
SADD cars "Ford"
SADD cars "Honda"
SADD cars "BMW"
SISMEMBER cars "Ford" // 1
SISMEMBER cars "Chevy" // 0
SMEMBER cars // Honda BMW Ford
SCARD cars // 3
SMOVE cars mycars "Ford"
SMEMBER cars // Honda BMW
SMEMBER mycars // Ford
SRAM cars "BMW"
SMEMBER cars // Honda
ZADD users 1980 "Brad"
ZADD users 1975 "Jen"
ZADD users 1990 "Mike"
ZADD users 1990 "Kate"
ZRANK users "Mike" // 3
ZRANK users "Jen" // 0
ZRANK users "Brad" // 1
ZRANGE users 0 -1 // Jen Brad Kate Mike
ZINCRBY users 1 "Jen" // 1976
HSET user:brad name "Brad"
HSET user:brad email "brad@gmail.com"
HGET user:brad name
HGET user:brad email
HGETALL user:brad
HMSET user:john name "Jen" email "jen@yahoo.com" age "25"
HGETALL user:john
HKEYS user:john
HVAL user:john
HINCERBY user:john age 1 // 26
HDEL user:john age // 1
HLEN user:john // 2
SAVEThis guide covers the basics of setting up a development environment on a new Mac.
https://sourabhbajaj.com/mac-setup/
Draw a character and find the ASCII code
http://shapecatcher.com/index.html
Draw diagram online
Good online tool to test and learn regular expression
100 react component design challenge
https://www.florin-pop.com/blog/2019/09/100-days-100-projects/
Several bootstrap scheme.
Commend
npx create-react-app .npx means you use this package but don’t download it.
or with redux
npx create-react-app my-app --template redux

Run before render() to check this component need to render or not.
signal condition –> waiting monitor –> signaling
monitor PC {
Object buffer;
void produce(Object o){
if(buffer != null){ // while
empty.wait();
}
buffer = o;
full.signal();
}
Object consume() {
if(buffer == null) // while
full.wait();
Object temp = buffer;
empty.signal();
return temp;
}
}// Assumption: E < S < W (Signal and urgent wait)
monitor Semaphore {
int permit;
void acquire() {
if(permit == 0){
permitsAvailable.wait();
} else {
permit--;
}
}
void release(){
if(!permitAvailable.isEmpty()){
permitsAvailable.signal();
} else{
permit++;
}
}
}assume start first and stop
* –> new feature from C++11
| Algorithm Name | Usage | Mutating? | Head File | Complexity |
|---|---|---|---|---|
| accumulate | Accumulate values in range | N | numeric | O(n) |
| adjacent_difference | Compute adjacent difference of range and return to another place | N | numeric | O(n) |
| adjacent_find | Find first equal adjacent elements in range | N | algorithm | O(n) |
| all_of* | Test condition on all elements in range | N | algorithm | O(n) |
| any_of* | Test if any element in range fulfills condition | N | algorithm | O(n) |
| binary_search | Test if value exists in sorted sequence | N | algorithm | On average O(logn + 2). On non-random-access iterator is O(n) |
| copy | Copy range of elements | N(copy) | algorithm | O(n) |
| copy_backward | Copy range of elements backward | N(copy) | algorithm | O(n) |
| copy_if* | Copy certain elements of range | N(copy) | algorithm | O(n) |
| copy_n* | Copies the first n elements from the range beginning | N(copy) | algorithm | O(n) |
| count | Count appearances of value in range | N | algorithm | O(n) |
| count_if | Return number of elements in range satisfying condition | N | algorithm | O(n) |
| equal | Test whether the elements in two ranges are equal | N | algorithm | O(n) |
| equal_range | Get sub range of equal elements | N | algorithm | O(2logn + 1) for random access iterator, otherwise O(n) |
| fill | Fill range with value | Y | algorithm | O(n) |
| fill_n | Assigns val to the first n elements of the sequence pointed by first | Y | algorithm | O(n) |
| find | Find the first element in range | N | algorithm | O(n) |
| find_end | Find last subsequence in range | N | algorithm | O(m*(1+n-m)) |
| find_first_of | Returns an iterator to the first element in the range [first1,last1) that matches any of the elements in [first2,last2) | N | algorithm | O(nm) |
| find_if | Find the first element in range in some condition | N | algorithm | O(n) |
| find_if_not* | Find the first element in range in some condition | N | algorithm | O(n) |
| for_each | Apply function to range | N | algorithm | O(n) |
| generate | Assigns the value returned by successive calls to gen to the elements in the range [first,last) | Y | algorithm | O(n) |
| generate_n | Assigns the value returned by successive calls to gen to the first n elements of the sequence pointed by first | Y | algorithm | O(n) |
| includes | Test whether sorted range includes another sorted range | N | algorithm | O(n) |
| inner_product | Compute cumulative inner product of range | N | numeric | O(n) |
| inplace_merge | Merge consecutive sorted ranges | Y | algorithm | O(n) if extra memory is available, otherwise is O(nlogn) |
| iota | Store increasing sequence | Y | numeric | O(n) |
| is_heap* | Test if range is heap | N | algorithm | O(n) |
| is_heap_until* | Find first element not in heap order. | N | algorithm | O(n) |
| is_partitioned* | Test whether range is partitioned | Y | algorithm | O(n) |
| is_permutation* | Compares the elements in the range [first1,last1) with those in the range beginning at first2, and returns true if they just different permutation | N | algorithm | O(n) |
| is_sorted* | Check whether range is sorted | N | algorithm | O(n) |
| is_sorted_until* | Find first unsorted element in range | N | algorithm | O(n) |
| iter_swap | Swaps the elements pointed to by a and b | Y | algorithm | O(1) |
| lexicographical_compare | Compare two range lexicographically. | N | algorithm | O(n) |
| lower_bond | Return iterator to lower bound | N | algorithm | O(logn + 1) for random access iterator, otherwise O(n) |
| make_heap | Make heap from range | Y | algorithm | O(3n) |
| max | Returns the largest of a and b. If both are equivalent, a is returned. | N | algorithm | O(1) |
| max_element | Return largest element in range | N | algorithm | O(n) |
| merge | Merge sorted ranges | Y | algorithm | O(n) |
| min | Returns the smallest of a and b. If both are equivalent, a is returned. | N | algorithm | O(1) |
| minmax* | Return smallest and largest elements from give 2 value or initializer | N | algorithm | O(1) |
| minmax_element* | Return smallest and largest elements in range | N | algorithm | O(n) |
| min_element | Return smallest element in range | N | algorithm | O(n) |
| mismatch | Return first position where two ranges differ | N | algorithm | O(n) |
| move* | Move range of elements | Y | algorithm | O(n) |
| move_backward* | Move range of elements backward | Y | algorithm | O(n) |
| next_permutation | Rearranges the elements in the range [first,last) into the next lexicographically greater permutation | Y | algorithm | O(n) |
| none_of* | Test if no elements fulfill condition | N | algorithm | O(n) |
| nth_element | Find the nth element and put it the exact palce.(quick select) | Y | algorithm | O() |
| partial_sort | Partially sort elements in range while the remaining elements are left without any order | Y | algorithm | O(mlogn) |
| partial_sort_copy | Copy and partially sort range | Y (if in-place) | algorithm | O(mlogn) |
| partial_sum | Compute partial sums of range and return to another place | N | numeric | O(n) |
| partition | Partition range in two and the iterator returned points to the first element of the second group. | Y | algorithm | O(n) |
| partition_copy* | Partition range into two | N | algorithm | O(n) |
| partition_point* | Get partition point and Returns an iterator to the first element in second part | N | algorithm | O(logn + 2) |
| pop_heap | Pop element from heap range. Range shrink and value is at end. | Y | algorithm | O(logn) |
| prev_permutation | Rearranges the elements in the range [first,last) into the previous lexicographically-ordered permutation. | Y | algorithm | O(n) |
| push_heap | Push element into heap range. Range extend | Y | algorithm | O(logn) |
| random_shuffle | Randomly rearrange elements in range | Y | algorithm | O(n) |
| remove | Removed element equal to val and returns an iterator to the new end of that range. | Y | algorithm | O(n) |
| remove_copy | Remove and copy to new place | Y | algorithm | O(n) |
| remove_copy_if | Remove in a given condition and copy | Y | algorithm | O(n) |
| remove_if | Remove in a given condition | Y | algorithm | O(n) |
| replace | Assigns new_value to all the elements that compare equal to old_value | Y | algorithm | O(n) |
| replace_copy | Replace and copy | Y | algorithm | O(n) |
| replace_copy_if | Replace in a given condition and copy | Y | algorithm | O(n) |
| replace_if | Replace in a given condition | Y | algorithm | O(n) |
| reverse | Reverses the order of the elements in the range [first,last) | Y | algorithm | O(n) |
| reverse_copy | Copies the elements in [first,last) but in reverse order | Y | algorithm | O(n) |
| rotate | Rotates the order of the elements and middle becomes the new first element | Y | algorithm | O(n) |
| rotate_copy | Rotate and copy | Y | algorithm | O(n) |
| search | Search range for subsequence | N | algorithm | O(n*m) |
| search_n | Search range for n continue elements | N | algorithm | O(n) |
| set_difference | Difference of two sorted ranges | N(copy) | algorithm | O(2(n+m)-1) |
| set_intersection | Intersection of two sorted ranges | N(copy) | algorithm | O(2(n+m)-1) |
| set_symmetric_difference | Symmetric difference of two sorted ranges | N(copy) | algorithm | O(2(n+m)-1) |
| set_union | Union of two sorted ranges | N(copy) | algorithm | O(2(n+m)-1) |
| shuffle* | Randomly rearrange elements in range using generator | Y | algorithm | O(n) |
| sort | Sort elements in range | Y | algorithm | O(nlogn) |
| sort_heap | Sort elements of heap | Y | algorithm | O(nlogn) |
| stable_partition | Partition range in two - stable ordering | Y | algorithm | O(n) with enough space. Otherwise O(nlogn) |
| stable_sort | Sort elements preserving order of equivalents | Y | algorithm | O(nlogn) with enough space, otherwise O(nlognlogn) |
| swap | Exchanges the values of a and b | Y | algorithm | O(1) |
| swap_ranges | Exchanges a range of value | Y | algorithm | O(n) |
| transform | Transform range | Y | algorithm | O(n) |
| unique | Remove consecutive duplicates in range | Y | algorithm | O(n) |
| unique_copy | Copy range removing duplicates | Y | algorithm | O(n) |
| upper_bond | Return iterator to upper bound. Since [first, last), the value pointed by the iterator must larger than val | N | algorithm | O(logn + 1) for random access iterator, otherwise O(n) |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[])
{
vector<int> iv = {1,2,3,4,5,6};
vector<int> iv2(6);
copy(iv.begin(), iv.end(), iv2.begin());
// iv2: 1 2 3 4 5 6
vector<int> iv3(3);
copy_if(iv.begin(), iv.end(), iv3.begin(), [](int a){return a % 2 == 0;});
// iv3: 2 4 6
vector<int> iv4(5);
copy_n(iv.begin(), 5, iv4.begin());
// iv4: 1 2 3 4 5 6
vector<int> iv5(6);
copy_backward(iv.begin(), iv.end(), iv5.end());
// iv5: 1 2 3 4 5 6
return 0;
}$font-stack: Helvetica, sans-serif;
$primary-color: #333;
body {
font: 100% $font-stack;
color: $primary-color;
}.container {
width: 100%;
}
article[role='main'] {
float: left;
width: 600px / 960px * 100%;
}
article[role='complementary'] {
float: right;
width: 300px / 960px * 100%;
}$name: foo;
$attr: border;
p.#{$name} {
#{$attr}-color: blue;
}This is compile to: