フィードアグリゲーター

428 Precondition Required

planet PHP - 2019-05-29(水) 00:00:00

To avoid multiple users writing to the same resources and overwriting each others changes, its useful to take advantage of conditional requests, using the If-Match, If-None-Match, If-Modified-Since and If-Unmodified-Since headers.

These headers are opt-in though. If a server wants to force a client to use them, a server can return 428 Precondition Required. Forcing clients to use Etags and precondition means there’s a lower chance of clients overwriting changes, because they are forced to to consider the current state of the service before changing something.

412 Precondition Failed is a bit different, as that status code is only used when a client did submit precondition headers, but the headers didn’t match the current state of the resource.

Example PUT /foo.txt HTTP/1.1 Content-Type: text/plain Hello world HTTP/1.1 428 Precondition Required Content-Type text/plain Please try submitting this request again with a If-Match header References
カテゴリー: php

Umair Shahid: Postgres is the coolest database – Reason #4: It is extendable

planet postgresql - 2019-05-28(火) 17:50:10
PostgreSQL is packed with features. What may not be part of the core is available as extensions. What are extensions – you ask? PostgreSQL exposes APIs that are designed to easily allow external programs to load into the database and function just like core features. So if you find that you need a feature in […]
カテゴリー: postgresql

PHP fwdays 2019

php.net - 2019-05-28(火) 06:30:01
カテゴリー: php

Firefox gets BigInt, and bigint-money gets 1.0 release

planet PHP - 2019-05-28(火) 01:00:00

A couple of days ago news got out that Firefox will be getting support for BigInt in Firefox 68. This is great news for everyone who likes really large numbers.

My current job is in finance, and the workarounds for dealing with big integers in browsers have been a bit frustrating.

A few months ago I set off to build a Javascript/Typescript library to do fixed-point financial math, called bigint-money. Soon this means that I can start using this not just server-side, but also in browsers. To celebrate, I just released version 1.0.

Since my last blogpost, the following features were added:

  1. Before all rounding was done using ‘Bankers Rounding’ a.k.a. ‘round half to 0’, but since then support has been added for other rounding methods such as ‘half away from 0’, ‘half towards 0’ and ‘truncate’.
  2. New comparison functions: isLesserThan(), isGreaterThan(), isEqual(), isLesserThanOrEqual(), isGreaterThanOrEqual(). All of this could be done before with the compare() function, but these functions will make your source a lot easier to read.
  3. More precision. In the past I picked an arbitrary maximum precision of 12 decimals, because it felt like this should be enough for any currencies I could find. Since then I actually ran into cases where I needed more. ERC-20 and Ethereum actually use up to 18 decimals. The new default is a precision of 20 decimals.
  4. abs() and sign() methods, contributed by flacktack, which behave similar to Math.abs() and Math.sign().

If you’re interested, check out the project on Github.

カテゴリー: php

ページ