日本における貧困率のカウントには、相対的貧困が用いられる。日本における貧困率にカウントされるのは、2017年の国民生活基礎調査の場合、年間の等価処分所得が122万円未満の世帯。
世界における貧困率のカウントには、絶対的貧困が用いられる。世界単位で貧困率にカウントされるのは、2015年の世界銀行の設定の場合、貧困線を購買力平価が1.90$/日(1ドル112円として年間で7.77万円)未満の世帯。
A List of What Cannot JCache do
- JCache cannot save the order of insertion. You should use LinkedHashMap for that purposes.
- JCache cannot update whole entries in a cache atomically. You should use AtomicReference or some locking mechanisms for that purpose. (Ofcourse you can update a cache atomically if a cache has always only one reference.)
- JCache doesn't offer read-write lock. You should use ReadWriteLock for that purpose.
- JCache doesn't offer unmodifiable view of cache. You should use Collections.unmodifiableMap() for that purpose.
The meanings of word "cache" in software engineering
I think the word "cache" has so many different meanings in different contexts like below.
Note: In this list, the word "invalidated" means the source of cached value might be changed.
- Something like the cache in web browsers. The cache stores the result of each operation that had already called (Typically, these operations had cost large resources). The values in the cache might be invalidated partially because some input is volatile, but not coherent.
- Something like the result of precomputation. The cache stores the result of operations that programmers specified (because it will cost large time or memory). It might not be invalidated.
- Something like memoization. The cache stores the result of each operation that the programmers specified and had already called. It might not be invalidated but might be discarded because of time-space tradeoff (e.g. weak reference in Java). It should be coherent.
- Something like the in-memory views in RDBMS. The cache stores the values in files or tables that programmers specified, in order to reduce the cost of access or implement read-only view. It might be invalidated and must be coherent. It must be updated atomically.
- Something like on-memory copy of files. The cache stores the values in files or tables that programmers specified, in order to reduce the cost of access. Sometimes it might be invalidated, but the programmers can control the timing of invalidation. The coherency doesn't matter, but it must be updated atomically.
- Something like cache on CPUs or L2ARC. The cache stores the data that had already accessed, in order to reduce the cost of access. It might be updated or invalidated. It must be coherent, but doesn't have to be updated atomically.
- (Not in the table below) Something like on-memory data stores (e.g. memcached). The cache stores the values that programmers specified. It might be updated and never be invalidated (sometimes values are only in the cache!). It doesn't have to be updated atomically.
I tried to organize these concepts in a table like below:
Target of Cache | Invalidated? | Coherent? | Atomic? | Example | |
---|---|---|---|---|---|
1 | each | no | no | no | Memoization |
2 | each | no | no | yes | Memoization |
3 | each | no | yes | no | Memoization |
4 | each | no | yes | yes | Memoization |
5 | each | yes | no | no | Cache in Web Browsers |
6 | each | yes | no | yes | Cache in Web Browsers |
7 | each | yes | yes | no | ? |
8 | each | yes | yes | yes | ? |
9 | whole | no | no | no | Precomputation |
10 | whole | no | no | yes | Precomputation |
11 | whole | no | yes | no | Precomputation |
12 | whole | no | yes | yes | Precomputation |
13 | whole | yes | no | no | ? |
14 | whole | yes | no | yes | On-memory Copy of Files |
15 | whole | yes | yes | no | CPU Cache or L2ARC |
16 | whole | yes | yes | yes | In-memory Views in RDBMS |
Difference of GitHub API and GitLab API
Format of Personal Access Tokens
- In GitHub, personal access tokens are hex string, like
e72e16c7e42f292c6912e7710c838347ae178b4a
. - In GitLab, personal access tokens are like Base62 string, like
9koXpg98eAheJpvBs5tK
.
Personal Access Tokens as OAuth2 Tokens
- In GitHub, personal access tokens are used as OAuth2 tokens.
- In GitHub, personal access tokens are different from OAuth2 tokens (There are also private tokens, but I couldn't find the way to get it).
HTTP Request Header for Authorization
- In GitHub, personal access tokens are passed via "Authorization" header in HTTP request like
Authorization: token e72e16c7e42f292c6912e7710c838347ae178b4a
(also you can useAuthorization: Bearer
instead ofAuthorization: token
). - In GitHub, personal access tokens are passed via "PRIVATE-TOKEN" header in HTTP request like
PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK
.
Query String for Authorization
- In GitHub, you can pass personal access tokens via query string like
GET /projects?access_token=e72e16c7e42f292c6912e7710c838347ae178b4a
. - In GitLab, you can pass personal access tokens via query string like
GET /projects?private_token=9koXpg98eAheJpvBs5tK
.
HTTP Status Code for Authorization Failure
- In GitHub, you will get 404 error when you failed to authorize (you cannot distinguish the authorization error from the other errors).
- In GitLab, you will get 401 error when you failed to authorize (you can distinguish the authorization error from the other errors).
How to Specify a Project
- In GitHub, you can specify a project by name, like
GET /api/v3/repos/Project/Repository/pulls
. - In GitLab, you cannot specify a project by name. You should use a project ID, like
GET /api/v4/projects/12/merge_requests
. You cannot see the project ID in the Web UI (You have to call API for project IDs, or see hidden tag in HTML source).
How to List All Comments in Pull Requests
- In GitHub, you can list all the comments in pull requests like
GET /api/v3/repos/Project/Repository/pulls/comments
. - In GitLab, you cannot list all the comments in pull requests. You should specify each merge request and get comments like
GET /api/v4/projects/12/merge_requests/42/notes
(42 is the iid of a merge request).
Content-Type header in HTTP response
- HTTP response of GitHub API contains
Content-Type
header likeContent-Type: application/json; charset=utf-8
. - HTTP response of GitLab API does not contain
Content-Type
header, SoInvoke-RestMethod
of PowerShell causes mojibake (see http://satob.hatenablog.com/entry/2018/01/18/014615).