Domain Driven Design basically means to let business logic decide on object model, and construct the rest of the code from that starting point. Instead of, say, starting off by designing db schema and build from grounds up.
Continue readingAuthor Archives: lucia
Why Use Assertion
And, what is the difference between raising normal errors and assertions? Basically:
Raising Error | Assertion |
Raise ValueError('Input not in range [1, 10]') | assert 1 <= v <= 10 |
Intended for users | Intended for developers |
Happens when user action is illegal | Happens when code contains bug |
To signal to user to take a different course of action | To easily find where code starts to error |
Cannot and should not be disabled | Can be disabled during compilation, therefore should not be used in logics like data validation |
AttributeError: module ‘selectors’ has no attribute ‘SelectSelector’
Usually, the error module x has no attribute y
means that:
- Your working directory contains a
x
file, which collides with python’sx
module - You are running a python script from a directory (thereby making it your current working directory) where file
x
collides with python’sx
module
Kindle Clippings Processor
The online service that I used to use for processing kindle clippings, my.clippings.io, released a new version this week. And lo and behold, everything useful is behind a paywall.
I only needed it for processing My Clippings.txt
to export it into Evernote, and it’s just file processing of standard format txt, so I thought I’d just whip up a simple version for my own use.
Initially I had planned to write a script for it, like the ruby one I did for cleaning up the mess of record files in kindle, after you delete books. But on second thought, it would be nice if other non-technical people can use it easily too. So, here it is:
On upload of a clippings file, it will have your highlights grouped by book title and sorted by location and timestamp.
AWS Keywords 101
An 101 intro to AWS’s numerous commonly confusing abbreviations.
Continue readingHow to Disable Any NextJS Warning
Since NextJS log is no longer part of webpack logs, we cannot use FilterWarningsPlugin
. Instead, use node level stdout filter, for example, intercept-stdout
.
NodeJS: How to get the root path of project
For reference:
require('path').resolve('./')
To proxy local ssh authentications onto remote
$ ssh [email protected] -A
Ref: http://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/ssh.1
How to have multiple instances of i18next for component library
When you want to include i18n
in your react component library, but the two use cases of i18next
conflict with one another — long story short, you need I18nextProvider
.
Error with css-loader
Error message looks like this:
var api = require("!./node_modules/[email protected]@style-loader/dist/runtime/injectStylesIntoStyleTag.js");
If you’re using Storybook, or multiple webpack configs of dev/prod, or simply multiple rules… Either way, this error means you’ve specified rules for CSS more than once.
For example, Storybook already has a set of default rules for various file types, and CSS is one of them, so you cannot specify custom CSS
rules again.