Development reference: Difference between revisions
No edit summary |
No edit summary |
||
(5 intermediate revisions by the same user not shown) | |||
Line 24: | Line 24: | ||
|} | |} | ||
{| class="mw-collapsible mw-collapsed wikitable" | {| class="mw-collapsible mw-collapsed wikitable" | ||
! | ! nosql enhances, not replaces, SQL | ||
|- | |- | ||
| | | Not all data should be denormalized, and not all data should be normalized. The optimal mix considers the extent of the data. | ||
* | |||
* | * Precise schemas are good when not overdone | ||
* | * When a container has an array with a large number of elements, it should be normalized | ||
* Sparse data and heterogeneous data are the best candidates for denormalization | |||
Postgres with JSON allows an elegant combination of nosql and SQL. | |||
|} | |} | ||
{| class="mw-collapsible mw-collapsed wikitable" | {| class="mw-collapsible mw-collapsed wikitable" | ||
Line 574: | Line 576: | ||
|- | |- | ||
| | | | ||
{| class="mw-collapsible mw-collapsed wikitable" | |||
! String escape formatting across different languages and systems | |||
|- | |||
| | |||
* c++ to JSON: always use nlohmann::json j.dump() to encode, to ensure strings are properly escaped | |||
* JSON to c++: always use nlohmann::json j.parse() " | |||
* c++ to Javascript: use raw_to_Javascript() to properly escape | |||
* c++ to sqlite: use SqliteLocalModel::safestr(), which uses double_doublequotes(str) | |||
|} | |||
[[Postgres]] | |||
[[Simple-Web-Server]] | [[Simple-Web-Server]] | ||
Line 817: | Line 830: | ||
|- | |- | ||
| | | | ||
{| class="mw-collapsible mw-collapsed wikitable" | |||
! Sqlite timestamp-to-readable-date query | |||
|- | |||
| | |||
select quote, timestamp, strftime('%Y-%m-%d %H:%M:%S', datetime(timestamp, 'unixepoch')) from StockQuotes as s where s.symbol="TSLA" order by timestamp; | |||
|} | |||
{| class="mw-collapsible mw-collapsed wikitable" | |||
! Sqlite copy row (pita) | |||
|- | |||
| Here's how you can clone a row in sqlite: | |||
CREATE TEMPORARY TABLE tmp AS SELECT * FROM StockPicks where id=1; | |||
UPDATE tmp SET id = NULL; | |||
INSERT INTO StockPicks SELECT * FROM tmp; | |||
DROP TABLE tmp; | |||
|} | |||
{| class="mw-collapsible mw-collapsed wikitable" | |||
! Count records within a range | |||
|- | |||
| This groups records into ranges, sorts by them, and gives a count, sweet: | |||
select count(*), id/1000000 as groupid from AccountHistory group by groupid; | |||
|} | |||
{| class="mw-collapsible mw-collapsed wikitable" | {| class="mw-collapsible mw-collapsed wikitable" | ||
! Sqlite table size analysis | ! Sqlite table size analysis | ||
Line 828: | Line 862: | ||
cd ~/development/thedigitalage/AbetterTrader/server/db_archive | cd ~/development/thedigitalage/AbetterTrader/server/db_archive | ||
~/apps/sqlite-tools/sqlite-tools-linux-x86-3220000/sqlite3_analyzer at_server_test.sqlite__2018-03-14_EOD__.sqlite | ~/apps/sqlite-tools/sqlite-tools-linux-x86-3220000/sqlite3_analyzer at_server_test.sqlite__2018-03-14_EOD__.sqlite | ||
|} | |} | ||
|} | |} |
Revision as of 11:10, 24 October 2018
Design, programming and version control.
Patterns | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
C++ | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
c++11 | |||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
boost | ||||||
---|---|---|---|---|---|---|
|
C++ libraries | ||
---|---|---|
|
C/C++ building/linking | ||||
---|---|---|---|---|
|
C/C++ debugging | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
C | ||||
---|---|---|---|---|
|
Javascript |
---|
RESTFul http | ||
---|---|---|
|
css |
---|
/* class="first second" */ .first.second {} /* class="first" OR class="second" */ .first, .second {} /* class="first second", or class="second", or class="third second", or class="second third" */ .second {} /* apply to any .child at any depth under .parent */ .parent .child {} /* apply to .child if it is DIRECTLY under .parent */ .parent > .child {} |
SQL | ||||||||
---|---|---|---|---|---|---|---|---|
|
Android |
---|
Java |
---|
Kotlin |
---|
Maven |
---|
Scala |
---|
Python |
---|
Go |
---|
PHP | |||
---|---|---|---|
|
git |
---|
Bash basics but please prefer node or python :-) |
---|
misc | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|