フィードアグリゲーター

PHP: Hypertext Preprocessor: PHP 7.3.5 Release Announcement

phpdeveloper.org - 2019-05-03(金) 02:30:02

The PHP development team announces the immediate availability of PHP 7.3.5. This is a security release which also contains several bug fixes.All PHP 7.3 users are encouraged to upgrade to this version.For source downloads of PHP 7.3.5 please visit our downloads page, Windows source and binaries can ...

カテゴリー: php

stitcher.io: Short closures in PHP

phpdeveloper.org - 2019-05-03(金) 02:30:02

Short closures, also called arrow functions, are a way of writing shorter functions in PHP. This notation is useful when passing closures to functions like array_map or array_filter.

This is what they look like: // A collection of Post objects $posts = [/* … */];

$ids = array_map(fn($p...

カテゴリー: php

Ernst-Georg Schmid: Not all CASTs are created equal?

planet postgresql - 2019-05-03(金) 01:32:00
Can somebody explain this?

PostgreSQL 11.2.

The documentation says:

"A type cast specifies a conversion from one data type to another. PostgreSQL accepts two equivalent syntaxes for type casts:

CAST ( expression AS type )

expression::type

The CAST syntax conforms to SQL; the syntax with :: is historical PostgreSQL usage."

But when I test the lower limits of PostgreSQL's integer types, strange things happen.

select cast(-9223372036854775808 as bigint);
select cast(-2147483648 as integer);
select cast(-32768 as smallint);

All OK.

select -9223372036854775808::bigint;
select -2147483648::integer;
select -32768::smallint;

All fail with SQL Error [22003]: ERROR: out of range

But:

select -9223372036854775807::bigint;
select -2147483647::integer;
select -32767::smallint;

All OK.

???
カテゴリー: postgresql

PHP 7.2.18 Released

php.net - 2019-05-02(木) 18:47:58
カテゴリー: php

PHP 7.3.5 Release Announcement

php.net - 2019-05-02(木) 17:27:19
カテゴリー: php

Pavel Golub: 1-to-1 relationship in PostgreSQL for real

planet postgresql - 2019-05-02(木) 17:00:32

Years ago

Years ago I wrote the post describing how to implement 1-to-1 relationship in PostgreSQL. The trick was simple and obvious:

CREATE TABLE UserProfiles ( UProfileID BIGSERIAL PRIMARY KEY, ... ); CREATE TABLE Users ( UID BIGSERIAL PRIMARY KEY, UProfileID int8 NOT NULL, ... UNIQUE(UProfileID), FOREIGN KEY(UProfileID) REFERENCES Users(UProfileID) );

You put a unique constraint on a referenced column and you’re fine. But then one of the readers noticed, that this is the 1-to-(0..1) relationship, not a true 1-to-1. And he was absolutely correct.

Keep it simple stupid!

A lot of time is gone and now we can do this trick much simpler using modern features or PostgreSQL. Let’s check

BEGIN; CREATE TABLE uProfiles ( uid int8 PRIMARY KEY, payload jsonb NOT NULL ); CREATE TABLE Users ( uid int8 PRIMARY KEY, uname text NOT NULL, FOREIGN KEY (uid) REFERENCES uProfiles (uid) ); ALTER TABLE uProfiles ADD FOREIGN KEY (uid) REFERENCES Users (uid); INSERT INTO Users VALUES (1, 'Pavlo Golub'); INSERT INTO uProfiles VALUES (1, '{}'); COMMIT;

Things are obvious. We create two tables and reference each other using the same columns in both ways.
Moreover, in such model both our foreign keys are automatically indexed!
Seems legit, but executing this script will produce the error:

SQL Error [23503]: ERROR: insert or update on table "users" violates foreign key constraint "users_uid_fkey" Detail: Key (uid)=(1) is not present in table "uprofiles".

Oops. And that was the pitfall preventing the easy solutions years ago during my first post.

What about now?

But now we have DEFERRABLE constraints:

This controls whether the constraint can be deferred. A constraint that is not deferrable will be checked immediately after every command. Checking of constraints that are deferrable can be postponed until the end of the transaction (using the SET CONSTRAINTS command). NOT DEFERRABLE is the default. Currently, only UNIQUE, PRIMARY KEY, EXC

[...]
カテゴリー: postgresql

Pavel Stehule: pspg on Solaris

planet postgresql - 2019-05-02(木) 16:54:00
I fixed some issues and pspg can be used on Solaris too. I found some issues on Solaris side on utf8 support - but it is related just for subset of chars. Due this issues, don't use psql unicode borders.
カテゴリー: postgresql

PHP 7.2.18 Released

planet PHP - 2019-05-02(木) 09:00:00
The PHP development team announces the immediate availability of PHP 7.2.18. This is a security release which also contains several minor bug fixes.All PHP 7.2 users are encouraged to upgrade to this version.For source downloads of PHP 7.2.18 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.
カテゴリー: php

PHP 7.3.5 Release Announcement

planet PHP - 2019-05-02(木) 09:00:00
The PHP development team announces the immediate availability of PHP 7.3.5. This is a security release which also contains several bug fixes.All PHP 7.3 users are encouraged to upgrade to this version.For source downloads of PHP 7.3.5 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.
カテゴリー: php

Voices of the ElePHPant: Interview with Matthias Noback

phpdeveloper.org - 2019-05-02(木) 03:00:02

@matthiasnoback

Show Notes Style Guide for Object Design: Release of the PHP edition Mattias’ Blog

Audio

This episode is sponsored by

The post Interview with Matthias Noback appeared first on Voices of the ElePHPant.

カテゴリー: php

murze.be: ★ Video: getting started with event sourcing in Laravel

phpdeveloper.org - 2019-05-02(木) 02:30:02

The last few months I gave a talk on how to get started with event sourcing at several conferences and user groups. I took the time to record the talk at home. It's now published on YouTube so everybody can enjoy it. The video below is targeted at newcomers to event sourcing. We'll first explain a ...

カテゴリー: php

Blog entries :: phly, boy, phly: Managing Multiple PHP versions via the ondrej/php PPA

phpdeveloper.org - 2019-05-02(木) 02:30:02

Last week, I did some system updates, and then decided to compile the most recent PHP releases. I've used phpbrew to manage multiple PHP releases for a number of years, and having it install a new version is fairly routine. Except this time, it wasn't. Due to updates I installed, I was getting e...

カテゴリー: php

Laravel News: Testing Streamed Responses in Laravel

phpdeveloper.org - 2019-05-02(木) 02:30:02
Let’s look at how Laravel helps us write controllers that force a user download without creating a file on the server and how to write tests for streamed downloads. Visit Laravel News for the full post. The post Testing Strea...
カテゴリー: php

Ibrar Ahmed: Benchmark ClickHouse Database and clickhousedb_fdw

planet postgresql - 2019-05-02(木) 01:37:29

In this research,  I wanted to see what kind of performance improvements could be gained by using a ClickHouse data source rather than PostgreSQL. Assuming that I would see performance advantages with using ClickHouse, would those advantages be retained if I access ClickHouse from within postgres using a foreign data wrapper (FDW)? The FDW in question is clickhousedb_fdw – an open source project from Percona!

The database environments under scrutiny are PostgreSQL v11, clickhousedb_fdw and a ClickHouse database. Ultimately, from within PostgreSQL v11, we are going to issue various SQL queries routed through our clickhousedb_fdw to the ClickHouse database. Then we’ll see how the FDW performance compares with those same queries executed in native PostgreSQL and native ClickHouse.

Clickhouse Database

ClickHouse is an open source column based database management system which can achieve performance of between 100 and 1000 times faster than traditional database approaches, capable of processing more than a billion rows in less than a second.

Clickhousedb_fdw

clickhousedb_fdw, a ClickHouse database foreign data wrapper, or FDW, is an open source project from Percona. Here’s a link for the GitHub project repository:

https://github.com/Percona-Lab/clickhousedb_fdw

I wrote a blog in March which tells you more about our FDW: https://www.percona.com/blog/2019/03/29/postgresql-access-clickhouse-one-of-the-fastest-column-dbmss-with-clickhousedb_fdw/

As you’ll see, this provides for an FDW for ClickHouse that allows you to SELECT from, and INSERT INTO, a ClickHouse database from within a PostgreSQL v11 server.

The FDW supports advanced features such as aggregate pushdown and joins pushdown. These significantly improve performance by utilizing the remote server’s resources for these resource intensive operations.

Benchmark environment
  • Supermicro server:
    • Intel(R) Xeon(R) CPU E5-2683 v3 @ 2.00GHz
    • 2 sockets / 28 cores / 56 threads
    • Memory: 256GB of RAM
    • Storage: Samsung  SM863 1.9TB Enterprise SSD
    • Filesystem: ext4/xfs
  • OS: Linux
[...]
カテゴリー: postgresql

Hubert 'depesz' Lubaczewski: Waiting for PostgreSQL 12 – Allow VACUUM to be run with index cleanup disabled.

planet postgresql - 2019-05-01(水) 10:02:06
On 4th of April 2019, Robert Haas committed patch: Allow VACUUM to be run with index cleanup disabled.     This commit adds a new reloption, vacuum_index_cleanup, which controls whether index cleanup is performed for a particular relation by default. It also adds a new option to the VACUUM command, INDEX_CLEANUP, which can be used … Continue reading "Waiting for PostgreSQL 12 – Allow VACUUM to be run with index cleanup disabled."
カテゴリー: postgresql

Managing Multiple PHP versions via the ondrej/php PPA

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

Last week, I did some system updates, and then decided to compile the most recent PHP releases. I've used phpbrew to manage multiple PHP releases for a number of years, and having it install a new version is fairly routine.

Except this time, it wasn't. Due to updates I installed, I was getting errors first with compiling the GD extension, then with ext-intl:

  • If you want Freetype support in ext-gd, you are expected to install the package libfreetype-dev. On Ubuntu, this now installs libfreetype6-dev, which no longer includes the freetype-config binary that PHP's configure script uses to determine what features it supports.

  • Similarly, ext-intl depends on the package libicu-dev. Ubuntu's package now omits the icu-config binary used by PHP to determine feature support.

I searched for quite some time to find packages that would resolve these problems. I could have found the source code and compiled it and linked to that, but that would mean keeping that up-to-date on top of my PHP installs.

I even looked in the ondrej/php PPA, as that repository has multiple PHP versions already, including source packages.

And then I thought: why not try using those instead of phpbrew?

The rest of this post is how I made that work.

I use Ubuntu for my operating system. The instructions I present here should work on any Debian-based system, but your mileage may vary. If you are using an RPM-based system, yum will be your friend, but I have no idea how to add repositories in that system, nor if update-alternatives is available. As such, these instructions may or may not help you.

Which is okay. I mainly wrote them to help future me.

Register the PPA

First, I had to add the PPA to the system:

$ sudo add-apt-repository ppa:ondrej/ppa

Then the usual:

$ sudo apt update Approach to installation

I first identified the extensions I typically install, matched them to packages in the PPA, and made a list. I knew I'd be installing the same extensions across all PHP versions I wanted, so I figured I could script it a bit.

From there, I executed the following from the CLI:

$ for VERSION in 5.6 7.0 7.1 7.2 7.3;do for> for EXTENSION in {listed all extensions here};do for for> sudo apt install php${VERSION}-${EXTENSION} for for> done for> done

This grabbed and installed each PHP I needed along with all extensions I wanted.

Switching between versions

To switch between versions, you have two options:

  • Use the version-specific binaries: /usr/bin/php5.6, /usr/bin/php7.0, etc.

  • Set a default via update-alternatives:

    $ sudo update-alternatives --set php /usr/bin/php5.6

    If you're not sure what you have installed, use:

    $ sudo update-alternatives --config php

    which will give you a listing, and an ability to select the one to use.

Rootless alternatives

What if you'd rather not be root to switch the default version, though? Fortunately, update-alternatives allows specifying alternate config and admin directories.

Define the following alias in your shell's configuration:

alias update-my-alternatives='update-alternatives \ --altdir ~/.local/etc/alternatives \ --admindir ~/.local/var/lib/alternatives'

Additionally, make sure you add $HOME/.local/bin to your $PATH; since defining $PATH varies based on the shell you use, I'll leave that for you to accomplish.

If you open a new shell, the alias will now be available; alternately, source the file in which you defined it to have it take effect immediately.

Once you've done that, you can run the following, based on the PHP versions you've installed:

$ for VERSION in 5.6 7.0 7.1 7.2 7.3;do for> update-my-alternatives --install $HOME/.local/bin/php php /usr/bin/php${VERSION} ${VERSION//./0} for> done

This will create alternatives entries local to your own user, prioritizing them by version; as a result, the default, auto-selected version will be the most recently installed.

You can verify this by running update-my-alternatives --config php:

There are 5 choices for the alternative php (providing $HOME/.local/bin/php). Selection Path Priority Status ----------------

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

カテゴリー: php

Hubert 'depesz' Lubaczewski: Waiting for PostgreSQL 12 – Add SETTINGS option to EXPLAIN, to print modified settings.

planet postgresql - 2019-05-01(水) 03:22:52
On 3rd of April 2019, Tomas Vondra committed patch: Add SETTINGS option to EXPLAIN, to print modified settings.     Query planning is affected by a number of configuration options, and it may be crucial to know which of those options were set to non-default values. With this patch you can say EXPLAIN (SETTINGS ON) … Continue reading "Waiting for PostgreSQL 12 – Add SETTINGS option to EXPLAIN, to print modified settings."
カテゴリー: postgresql

Technical Thoughts, Tutorials, and Musings: PSR-14: Example - PSR-14 in a non-blocking application server

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

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...
カテゴリー: php

ページ