All-in-one guide about Floating point number
This is a useful guide contains fundamental knowledge about the Floating point arithmetic https://floating-point-gui.de/
This is a useful guide contains fundamental knowledge about the Floating point arithmetic https://floating-point-gui.de/
How you want your component to interact with the Apollo cache. Defaults to “cache-first”.
There are many options to this: “cache-first” | “cache-and-network” | “network-only” | “cache-only” | “no-cache” | “standby”
const { loading, error, data } = useQuery(QUERY, {
variables: queryVariables,
fetchPolicy: 'no-cache'
})
Suppose we have an index on id
column for a table with 10 million rows. The index will eventually become too large that can’t be fit in memory, so we would have to store it somewhere in disk blocks.
The search for an entry in the index would require several disk blocks access. One way to improve this is to use multilevel index. We treat the index just as a database table, and construct another index (outer index) on this index (inner index).
We can repeat this process as many times as needed, until the outer index has small size that can be kept in memory. This would reduce the number of disk accesses significantly.
References: https://www.cs.uct.ac.za/mit_notes/database/htmls/chp11.html#multilevel-indexes
Dictionary attack is a technique used to breach a password-protected system.
This method attempts to guess the correct password by systematically entering each word in a dictionary. This works because many users use normal words in dictionary as their passwords.
There are several ways to prevent this:
sequelize.transaction(t => {
models.Model.create(*model_attributes, { transaction: t })
})
Transaction can be wrapped even for junction table's methods
sequelize.transaction(t => {
user.AddRole(role, { transaction: t })
})
There are several system columns
that are implicitly defined by Postgresql for each table.
ctid
is a system column that stores the physical location of the row within its table.
Ref: link
This free course fits 13.8 billion years of history into six hours https://www.bighistoryproject.com/ highly recommend to try!
brew upgrade
Dataloader is a Nodejs library that provides batching and caching feature at the client to reduce requests to the backend server.
It is usually used with GraphQL to improve the queries performance.
Source Dataloader
The language server protocol is used between a tool (the client
i.e text editors, IDEs) and the language server
to integrate features like code completion
, jump to definition
, refactoring
into the tool
References:
1. On MacOS:
If you installed PostgreSQL via Homebrew:
pg_ctl -D /usr/local/var/postgres start
pg_ctl -D /usr/local/var/postgres stop
brew services start postgresql
brew services stop postgresql
2. On Windows:
First, you need to find the PostgreSQL database directory, it can be something like C:\Program Files\PostgreSQL\10.4\data
. Then open Command Prompt and execute this command:
pg_ctl -D "C:\Program Files\PostgreSQL\9.6\data" start
pg_ctl -D "C:\Program Files\PostgreSQL\9.6\data" stop
pg_ctl -D "C:\Program Files\PostgreSQL\9.6\data" restart
3. On Linux:
sudo service postgresql start
sudo service postgresql stop
Link reference:
https://tableplus.com/blog/2018/10/how-to-start-stop-restart-postgresql-server.html
AsciiDoc https://asciidoctor.org/docs/what-is-asciidoc/ is another type of markup languages similar to Markdown.
Ruby/Rails/RSpec style guides are using it instead of Markdown. Subjectively it feels a bit more natural than Markdown. GitHub support is lagging behind but is getting better.
Run this code in Chrome’s console to enter the live edit mode:
document.designMode = 'on'
Then try to edit the page!
Everyday
means each day
Every day
means ordinary
or typical
Using ==
to compare sensitive hashes leaves you vulnerable to timing attacks. This is because ==
returns false
as soon as it finds two characters that don’t match. An attacker can make many requests with different values and compare times to figure out how many characters were correct (the shorter the response, the fewer correct characters).
Solution: use a constant-time comparison algorithm.
Rack::Utils.secure_compare
or ActiveSupport::SecurityUtils.secure_compare
crypto.timingSafeEqual
See:
The sizes of text
and data
are fixed.
However, heap
and stack
can grow and shrink during run time. Each time a function is called, a record contains local variables, function parameters, return addresses is pushed to the stack
. When the function finished, that record will be popped from the stack.
Similarly, the heap
will grow as memory is dynamically allocated, and shrink when the memory is returned to the system. Notice that stack
and heap
size can grow toward each other but the OS has to make sure that they won’t overlap one another.
An interesting idea to store large JSON data in PG with bytea
type. Though, we need to handle the compression and uncompression manually.
Credit: https://jetrockets.pro/blog/how-to-store-large-json-in-postgresql-with-rails-attributes-api
Today I learned how to survive. If sitting in an airplane cabin is too secret, you can open the emergency door just to 'breathe fresh air'.
COPY results will be faster than INSERT due to they don’t have to do round trip, PostgreSQL doesn’t have to do planning and executing multiple INSERT statements.
COPY table_name [ ( column_name [, ...] ) ]
FROM { 'filename' | STDIN }
[ [ WITH ] ( option [, ...] ) ]
COPY { table_name [ ( column_name [, ...] ) ] | ( query ) }
TO { 'filename' | STDOUT }
[ [ WITH ] ( option [, ...] ) ]
where option can be one of:
FORMAT format_name
OIDS [ boolean ]
DELIMITER 'delimiter_character'
NULL 'null_string'
HEADER [ boolean ]
QUOTE 'quote_character'
ESCAPE 'escape_character'
FORCE_QUOTE { ( column_name [, ...] ) | * }
FORCE_NOT_NULL ( column_name [, ...] )
ENCODING 'encoding_name'
Default box-shadow
.box {
box-shadow: 0 3px 3px rgba(0,0,0,0.2);
}
Create smoother box-shadows by layering multiple
.shadow-5 {
box-shadow: 0 1px 1px rgba(0,0,0,0.12),
0 2px 2px rgba(0,0,0,0.12),
0 4px 4px rgba(0,0,0,0.12),
0 8px 8px rgba(0,0,0,0.12),
0 16px 16px rgba(0,0,0,0.12);
}
Shadows with decreasing alpha
.blog-shadow-sharp {
box-shadow: 0 1px 1px rgba(0,0,0,0.25),
0 2px 2px rgba(0,0,0,0.20),
0 4px 4px rgba(0,0,0,0.15),
0 8px 8px rgba(0,0,0,0.10),
0 16px 16px rgba(0,0,0,0.05);
}
git ls-files | xargs cat | wc -l
My name is Hung Nguyen and I am certainly the best looking guy in the business team.
ETS tables are in-memory storage that stores tuples as rows.
ETS is a common way of sharing states between processes/GenServers. But keep in mind that ETS is a datastore, not a database. So the support for transactions is very limited.
Working with ETS tables is done via erlang :ets
module
Reference: link