Pine: Handy RegEx Constraints in Laravel Routes

phpdeveloper.org - 2019-05-01(水) 00:00:02

It’s a well-known feature, but still in some cases it may require longer research to find the good regex patterns for defining constraints for our route parameters. Let’s see some idea.

Getting Started First of all, let’s see how to even use patterns to create rules for our rout...

カテゴリー: php

Voices of the ElePHPant: Interview with Kathy Forte

phpdeveloper.org - 2019-05-01(水) 00:00:02

Show Notes Kathy’s LinkedIn profile


This episode is sponsored byDay Camp 4 Developers

The post Interview with Kathy Forte appeared first on Voices of the ElePHPant.

カテゴリー: php

php[podcast] episodes from php[architect]: Frontend Fundamentals and Chris Hartjes

phpdeveloper.org - 2019-05-01(水) 00:00:02

In Episode 19 Eric, John, and Oscar record together again to discuss the April 2019 issue on the new frontend fundamentals, php[tek], and quite a lot more about web browsers than anyone anticipated. Topics Eric and John get a look behind the scenes into what goes into producing each magazine issu...

カテゴリー: php

423 Locked

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

The 423 Locked status-code does not appear in the base HTTP specification, but is part of WebDAV specification, which is an extension to HTTP.

A major goal of WebDAV was to provide a ‘filesystem over the web’. One of its core features is for users to ‘lock’ specific files and directories to prevent others from editing them.

A user can lock a resource by issuing a http LOCK method and later on unlock the resource by using the UNLOCK HTTP method.

Both ‘shared locks’ and ‘exclusive locks’ are supported.


Locking a resource

LOCK /article/5 HTTP/1.1 Content-Type: application/xml <?xml version="1.0"?> <d:lockinfo xmlns:d='DAV:'> <d:lockscope><d:exclusive/></d:lockscope> <d:locktype><d:write/></d:locktype> <d:owner>Evert</d:owner> </d:lockinfo>

A successful response to this includes a Lock-Token header.

HTTP/1.1 200 OK Content-Type: application/xml Lock-Token: <urn:uuid:e71d4fae-5dec-22d6-fea5-00a0c91e6be4> <?xml version="1.0"?> ...

If a user tries to make a change to a locked resource, they will get an error:

PUT /article/5 HTTP/1.1 Content-Type: text/plain New content HTTP/1.1 423 Locked Content-Type: application/xml <?xml version="1.0" encoding="utf-8" ?> <d:error xmlns:d="DAV:"> <d:lock-token-submitted> <d:href>/article/5</d:href> </d:lock-token-submitted> </d:error>

Unless, they also include the lock-token in the If header:

PUT /article/5 HTTP/1.1 Content-Type: text/plain If: <urn:uuid:e71d4fae-5dec-22d6-fea5-00a0c91e6be4> New content HTTP/1.1 204 No Content Usage on the web

I haven’t seen a lot of usage of LOCK, UNLOCK and the 423 code outside of WebDAV. However, I don’t see strong reasons against their usage.

A big part that the lock functionality of WebDAV hopes to solve, is avoiding problems with multiple users making updates on (groups of-) resources at the same time.

If you also have this issue, bear in mind that there is a more popular feature in HTTP to deal with this: Etags and the If-Match / If-None-Match headers.

These headers ten

Truncated by Planet PHP, read more at the original (another 1519 bytes)

カテゴリー: php

Community News: Latest PECL Releases (04.30.2019)

phpdeveloper.org - 2019-04-30(火) 22:05:01

Latest PECL Releases:

  • event 2.5.0
    Issue #53: Added EventConfig::setFlags() method. (There was no way to set EVENT_BASE_FLAG_* flags.)

  • uv 0.2.3
    - Fix Windows build - Fix PHP 7.4 build
  • gRPC 1.20.0
    - Added memory leak tests #17862 - Fixed segfault on accessing a closed client #18302 - Added ini settings for fork support #18539 - Fixed fork hang #18558
  • datadog_trace 0.20.0
    ### Added - Force tracing or discarding trace via special Span tag (manual.keep and manual.drop) #409 Fixed
    • Resource use by caching configuration values instead of processing data on every access #406
  • mysql_xdevapi 8.0.16
    WL#9879: Prepared statement support WL#11983: Support session-connect-attributes WL#12396: Support new session reset functionality orabug #28802543: classes: Driver, ExecutionStatus, Expression, and Statement orabug #28803208: the DocResult prototype appear wrong orabug #28803039: the fields() method seems odd orabug #28805757: how exactly are set() and replace() different?
カテゴリー: php

Eric Hanson: "Aquameta Revisited" on FLOSS Weekly

planet postgresql - 2019-04-30(火) 20:50:08

Eric talks about Aquameta 0.2 and the advantages of migrating the web stack into PostgreSQL on This Week in Tech's FLOSS Weekly.

カテゴリー: postgresql

Interview with Kathy Forte

planet PHP - 2019-04-30(火) 20:00:00

Show Notes Audio

This episode is sponsored by
Day Camp 4 Developers

The post Interview with Kathy Forte appeared first on Voices of the ElePHPant.

カテゴリー: php

Markus Winand: A Close Look at the Index Include Clause

planet postgresql - 2019-04-30(火) 09:00:00

Some database—namely Microsoft SQL Server, IBM Db2, and also PostgreSQL since release 11—offer an include clause in the create index statement. The introduction of this feature to PostgreSQL is the trigger for this long overdue explanation of the include clause.

Before going into the details, let’s start with a short recap on how (non-clustered) B-tree indexes work and what the all-mighty index-only scan is.

Recap: B-tree Indexes

To understand the include clause, you must first understand that using an index affects up to three layers of data structures:

  • The B-tree

  • The doubly linked list at the leaf node level of the B-tree

  • The table

The first two structures together form an index so they could be combined into a single item, i.e. the “B-tree index”. I prefer to keep them separate as they serve different needs and have a different impact on performance. Moreover, explaining the include clause requires making this distinction.

In the general case, the database software starts traversing the B-tree to find the first matching entry at the leaf node level (1). It then follows the doubly linked list until it has found all matching entries (2) and finally it fetches each of those matching entries from the table (3). Actually, the last two steps can be interleaved, but that is not relevant for understanding the general concept.

The following formulas give you a rough idea of how many read operations each of these steps needs. The sum of these three components is the total effort of an index access.0

  • The B-tree: log100(<rows in table>), often less than 5

  • The doubly linked list: <rows read from index> / 100

  • The table: <rows read from table>1

When loading a few rows, the B-tree makes the greatest contribution to the overall effort. As soon as you need to fetch just a handful of rows from the table, this step takes the lead. In either case—few or many rows—the doubly linked list is usually a minor factor because it stores rows with similar values next to each other so that a single read operation can fetch

カテゴリー: postgresql

PSR-14: Example - PSR-14 in a non-blocking application server

planet PHP - 2019-04-30(火) 05:51:00
PSR-14: Example - PSR-14 in a non-blocking application server

We continue our exploration of PSR-14's potential with a guest post. Cees-Jan Kiewiet was the Sponsor of PSR-14 (meaning the member of the Core Committee who bridged from the Working Group to the Core Committee), and is on the core team for ReactPHP. One wouldn't think there's any use cases for PSR-14 in an async environment like React, but one would be wrong.

Here's Cees-Jan with an explanation:

Continue reading this post on SteemIt.

Larry 29 April 2019 - 3:51pm
カテゴリー: php

Sebastian Insausti: An Overview of Streaming Replication for TimescaleDB

planet postgresql - 2019-04-29(月) 18:48:00

Nowadays, replication is a given in a high availability and fault tolerant environment for pretty much any database technology that you’re using. It is a topic that we have seen over and over again, but that never gets old.

If you’re using TimescaleDB, the most common type of replication is streaming replication, but how does it work?

In this blog, we are going to review some concepts related to replication and we’ll focus on streaming replication for TimescaleDB, which is a functionality inherited from the underlying PostgreSQL engine. Then, we’ll see how ClusterControl can help us to configure it.

So, streaming replication is based on shipping the WAL records and having them applied to the standby server. So, first, let’s see what WAL is.


Write Ahead Log (WAL) is a standard method for ensuring data integrity, it is automatically enabled by default.

The WALs are the REDO logs in TimescaleDB. But, what are the REDO logs?

REDO logs contain all changes that were made in the database and they are used by replication, recovery, online backup and point in time recovery (PITR). Any changes that have not been applied to the data pages can be redone from the REDO logs.

Using WAL results in a significantly reduced number of disk writes, because only the log file needs to be flushed to disk to guarantee that a transaction is committed, rather than every data file changed by the transaction.

A WAL record will specify, bit by bit, the changes made to the data. Each WAL record will be appended into a WAL file. The insert position is a Log Sequence Number (LSN) that is a byte offset into the logs, increasing with each new record.

The WALs are stored in the pg_wal directory, under the data directory. These files have a default size of 16MB (the size can be changed by altering the --with-wal-segsize configure option when building the server). They have a unique incremental name, in the following format: "00000001 00000000 00000000".

The number of WAL files contained in pg_wal will depend on the value assigned to the min_

カテゴリー: postgresql

PSR-14: Example - Delayed Events, Queues, and Asynchronicity

planet PHP - 2019-04-27(土) 07:34:00
PSR-14: Example - Delayed Events, Queues, and Asynchronicity

One of the long-running debates while designing PSR-14 was how to handle events that were inherently mono-directional. Often, a library will trigger an Event that is, from its point of view, entirely informational. The Event object it fires has no mutator methods so Listeners have no way to interact with each other, which means that the order Listeners run in is irrelevant. It also means Listeners can pass no data back to the emitting library, which means the result of the Event can have no impact on the Emitter's further logic.

This special case opens up more options for how to execute the Listeners. Because there is guaranteed no communication from Listener to Listener or from Listener to Emitter, it's safe to run the Listeners concurrently. In fact, it's safe to run the Listeners concurrently with the Emitter. The Emitter doesn't even need to wait for the Listeners to fire before continuing.

Continue reading this post on SteemIt.

Larry 26 April 2019 - 5:34pm
カテゴリー: php

php|architect: Frontend Fundamentals and Chris Hartjes

phpdeveloper.org - 2019-04-26(金) 23:30:02

In Episode 19 Eric, John, and Oscar record together again to discuss the April 2019 issue on the new frontend fundamentals, php[tek], and quite a lot more about web browsers than anyone anticipated. Topics Eric and John get a look behind the scenes into what goes into producing each magazine issu...

カテゴリー: php

Jobin Augustine: Watch Webinar: Upgrading / Migrating Your Legacy PostgreSQL to Newer PostgreSQL Versions

planet postgresql - 2019-04-26(金) 22:00:10

Please join Percona’s PostgreSQL Support Technical Lead, Avinash Vallarapu and Senior Support Engineers, Fernando Laudares, Jobin Augustine and Nickolay Ihalainen as they demonstrate the methods to upgrade a legacy version of PostgreSQL to a newer version using built-in as well as open source tools.

Watch the Recorded Webinar

To start, this webinar opens with a list of solutions that are built-in to PostgreSQL to help us upgrade a legacy version of PostgreSQL with minimal downtime. Next, the advantages of choosing such methods will be discussed. You will then notice a list of prerequisites for each solution, reducing the scope of possible mistakes. It’s important to minimize downtime when upgrading from an older version of PostgreSQL server. Therefore, we will present 3 open source solutions that will help us either minimize or completely avoid downtime.

Additionally, we will be publishing a series of 5 blog posts that will help us understand the solutions available to perform a PostgreSQL upgrade. Our presentation will show the full process of upgrading a set of PostgreSQL servers to the latest available version. Furthermore, we’ll show the pros and cons of each of the methods we employed.

Topics covered in this webinar include the following:

1. PostgreSQL upgrade using pg_dump/pg_restore (with downtime)
2. PostgreSQL upgrade using pg_dumpall (with downtime)
3. Continuous replication from a legacy PostgreSQL version to a newer version using Slony.
4. Replication between major PostgreSQL versions using Logical Replication
5. Fast upgrade of legacy PostgreSQL with minimum downtime.

We will walk you through and demonstrate methods that you may find useful in your database environment. We will witness how simple and quick it is to perform the upgrade using these methods.

カテゴリー: postgresql

Álvaro Hernández: Having lunch with PostgreSQL, MongoDB and JSON

planet postgresql - 2019-04-26(金) 17:15:00

On a post titled “Postgres JSON, Developer Productivity, and The MongoDB Advantage”, Buzz Moschetti discussed about PostgreSQL’s handling of JSON and how (inconvenient) it is for developers, specially when compared to MongoDB. While the post is almost 18 months old, the principles described there have not changed, and I (mostly) respectfully disagree. Here is my opinion on the topic.

Let’s see what there is on today’s menu.

Small bites

SQL syntax and, indeed, the relational model as a whole are designed to work with single, scalar values which carry the same type from row to row, not rich shapes like JSON that can contain substructures and arrays and different elements from row to row.

If anything, SQL is about set operations on tuples, not scalar values. But, I get Buzz’s point, he probably meant “columns”. Yet still not correct. The SQL standard has had support for arrays as a column type since 1999! Including functions to access, construct or create arrays. PostgreSQL is actually more advanced, supporting multidimensional arrays, and even a set of key-value pairs with the hstore datatype (again: all that within a single column). On top of that, PostgreSQL also supports custom data types (which can also be row types or data structures) and combinations of all that. So not simple scalar values. And it obviously supports JSON (with the jsonb data type), which will be further discussed here.

And the extensions to SQL utilized by Postgres to manipulate JSON are proprietary, unknown to most SQL developers, and not supported or even recognized by most 3rd party SQL tools.

I’m not aware of MongoDB’s language being part of any standard, so we should assume Buzz’s comment about proprietary language applies to both MongoDB and PostgreSQL equally. Being that true, there are some important catches:

  • PostgreSQL’s proprietary syntax is only for accesing JSON data. The rest of the language, and data accessed via non JSON data types, is pure, standard SQL. None of MongoDB’s query language is standard.

  • It is ironic to m

カテゴリー: postgresql

10 reasons to become a consultant or have a consulting business

planet PHP - 2019-04-26(金) 11:46:00

In this video I share 10 good reasons to start a consulting business or become a consultant. Before you start looking into how to become a consultant, Adam Culp of Beachcasts PHP videos shares points from his experience to help you figure out if being a PHP consultant is the right job for you. As you look into how to become a consultant, and before you become a consultant, consider these things carefully.

Or you can view this video on YouTube at: https://youtu.be/J7gpMYAKmDM

#10 Multiple Hats
#9 Constant New Problems (to solve)
#8 Always Learning
#7 Helping (mentoring) People
#6 You’re The Fixer
#5 “Expert” vs “Resource”
#4 Fame!
#3 Sell, Sell, Sell!
#2 Travel
#1 Flexible Schedule

BONUS considerations for the self-employed
#1 No Dress Code
#2 Unlimited Earning Potential
#3 Unlimited sick days / vacation
#4 Flexible Work Location
#5 Freedom to say “No” or turn down jobs

カテゴリー: php

Interview with Matthias Noback

planet PHP - 2019-04-25(木) 20:00:00
カテゴリー: php

JPUG 総会併設セミナー 2019-06-15

www.postgresql.jp news - 2019-04-25(木) 19:39:17
JPUG 総会併設セミナー 2019-06-15 anzai 2019/04/25 (木) - 19:39
カテゴリー: postgresql

2019年度 第14回総会

www.postgresql.jp news - 2019-04-25(木) 19:36:03
2019年度 第14回総会 anzai 2019/04/25 (木) - 19:36
カテゴリー: postgresql

第 160 回理事会議事録 (2019-4)

www.postgresql.jp news - 2019-04-25(木) 19:15:43
第 160 回理事会議事録 (2019-4) anzai 2019/04/25 (木) - 19:15
カテゴリー: postgresql