https://plugins.jetbrains.com/files/14957/137820/icon/pluginIcon.pngA free and open source plugin to run PHP code directly as if through Tinker without leaving your favorite IDE. Includes all PhpStorm features you are already used to like code completion, error correction and color scheme.Laravel News Links
Comic for September 25, 2021
https://assets.amuniversal.com/744dff80f250013976ad005056a9545d
Thank you for voting.
Hmm. Something went wrong. We will take a look as soon as we can.
Dilbert Daily Strip
I Love My Hoe Dag Garden Tool
https://i0.wp.com/toolguyd.com/blog/wp-content/uploads/2021/09/Hoe-Dag.jpg?resize=600%2C569&ssl=1
The Hoe Dag, shown in this photo by Lee Valley, has really been my MVP tool this past gardening season.
To be frank, it does not feel very heavy duty, but I put it through its paces, digging up rocks, roots, and heavy clay soil.
The Hoe Dag is said to be superb for digging, planting, tilling, weeding, and even chopping through roots. It’s described as rugged, and it has proven this to be true.
The multi-purposed gardening tool features an 8-1/2″ arc-shaped blade with a 2-1/2″ edge on one end and a 7/8″ edge on the other. It has a 15″ seasoned hardwood handle.
Lee Valley says that the Hoe Dag has been hand-crafted in the USA for over 50 years.
Although I’ve been hard on my Hoe Dag, I don’t forget that it’s handle is made of wood and that it’s attached to the steel head via a socket joint. It can handle a bit of abuse, but I reach for a different tool for heavier prying.
I absolutely definitely recommend the Hoe Dag. Sure, it’s basically a double-sided short-handle hoe, and there are other tools that are almost kind of like it, but they’re not quite the same.
The Hoe Dag is well-made, it’s extremely versatile, it’s comfortable and light to swing, and it’s made in the USA.
Price: $32.50
Buy Now via Lee Valley
See Also via Amazon
Lee Valley currently offers free ground shipping on orders $30 and up.
Related Posts:
ToolGuyd
Decorator Pattern vs. Proxy Pattern
https://doeken.org/assets/img/decorator-vs-proxy-pattern.jpg
There are two patterns in PHP that are very similar; The Decorator Pattern and The Proxy Pattern. Because they are so
similar, you can quickly mistake one for the other. Does that matter? Maybe not, but I think it’s good to know the
differences when communicating about them.
Similarities between Decorators and Proxies
Both the Decorator Pattern and the Proxy Pattern revolve around the idea of wrapping an instance of an existing
interface (let’s call that the inner instance) with a class that implements that same interface and delegates their
function calls to the same functions on their inner instance.
These patterns are very useful for adding or changing functionality of an instance without breaking encapsulation. It
can also change or extend functionalities of final
functions and classes. And because they usually serve one purpose
they can easily be tested.
Example
interface SubscriberInterface {
public function subscribe(string $email): void;
}
class SubscriberDecorator implements SubscriberInterface {
private SubscriberInterface $inner_subscriber;
public function subscribe(string $email): void {
$this->inner_subscriber->subscribe($email);
}
}
In this example you can see that our SubscriberDecorator
implements the SubscriberInterface
and it also requires
some instance of the SubscriberInterface
. After that it delegates the subcribe()
function to the same function on
that instance.
Differences between Decorators and Proxies
When it comes to naming a class a Decorator or a Proxy you have to look at its intent. What is the class actually doing
with the instance it is wrapping?
Required vs. Optional dependency
You might have noticed I didn’t include a __construct()
method in the previous example. This was intentional, because
this is where the first difference can be apparent.
A Decorator requires an instance of the interface it is wrapping, while a Proxy does not require such an
instance. A Proxy can receive an instance, but is also allowed to create this instance itself. So you can create
a new
Proxy on its own, while a Decorator needs another instance as dependency.
// Decorator
public function __construct(public SubscriberInterface $inner_subscriber){}
// Proxy
public function __construct(?SubscriberInterface $inner_subscriber = null){
$this->inner_subscriber = $inner_subscriber ?? new InnerSubscriber();
}
Additive vs. Restrictive
Decorators are additive; meaning they only add new functionality by wrapping the function call and returning the
original value. It can however do anything before or after that call. You can for example log every value when a
function is called or dispatch an event. Just make sure to return the original value.
Proxies are restrictive; meaning they can change the behavior of a function or even restrict calling a specific function
by throwing an exception.
Tip: Both Decorators and Proxies are allowed to add any extra functions or parameters that are not on the interface. It can therefore be wise to implement some magic
__isset()
,__get()
and__call()
methods on the Decorator or Proxy to pass these calls along to their inner instance as well. This way you can still call those methods and parameters even if you add multiple decorators on top.
public function __call($name, $arguments)
{
return $this->inner_subscriber->{$name}(...$arguments);
}
public function __get($name)
{
return $this->inner_subscriber->{$name};
}
public function __isset($name)
{
return isset($this->inner_subscriber->{$name});
}
General purpose vs. Specific purpose
Decorators serve a general purpose. It will add some functionality regardless of the instance it is wrapping. This means
that multiple decorators should be able to be applied on top of one another in any random order and still produce the
same result and added functionality.
Proxies serve a more specific purpose. It will mostly be used to change or append functionality to a specific instance
of the interface. Proxies also aren’t commonly stacked on top of one another as a single proxy is usually enough.
Tips for Decorators and Proxies
Here are a few tips you might consider when working with Decorators and Proxies.
Make a base abstraction
If you create multiple Decorators or Proxies of the same interface it can be beneficial to create an abstract class
of
the interface or a trait
that satisfies the interface, where every function is already deferred to the function on
the inner instance. If you are a package creator, you might even consider providing this implementation inside the
package. This way a Decorator or Proxy can extend
or use
this implementation and only (re)declare the functions
it needs.
interface SubscriberInterface
{
public function subscribe(string $email): bool;
public function unsubscribe(string $email): bool;
}
trait SubscriberTrait { ... }
{
private SubscriberInterface $inner_subscriber;
public function subscribe(string $email): bool
{
return $this->inner_subscriber->subscribe($email);
}
public function unsubscribe(string $email): bool
{
return $this->inner_subscriber->unsubscribe($email);
}
public function __call($name, $arguments)
{
return $this->inner_subscriber->{$name}(...$arguments);
}
public function __get($name)
{
return $this->inner_subscriber->{$name};
}
public function __isset($name)
{
return isset($this->inner_subscriber->{$name});
}
}
// You can now extend this class, or implement the interface and trait.
abstract class SubscriberDecorator implements SubscriberInterface
{
use SubscriberTrait;
public function __construct(SubscriberInterface $inner_subscriber)
{
$this->inner_subscriber = $inner_subscriber;
}
}
Single responsibility Decorators
It might be tempting to add multiple features onto a Decorator, but the beauty of them is that they can be added or
removed without changing the underlying code. So try to make tiny Decorators that focus on one thing and apply these on
top of each other. Again, this simpleness makes them easier to test as well.
Examples
You can find a couple of nice examples of Decorators and Proxies in Symfony.
Their developer toolbar shows a lot of information regarding events and cache, for example. They log this information by
decorating the current EventDispatcher with
a TraceableEventDispatcher and
the current cache adapter with
a TraceableAdapter
within the dev
environment.
An example of a Proxy can be found in
the DeflateMarshaller of
the symfony/cache
package. This Marshaller is restrictive due to its dependency on gzinflate()
& gzdeflate()
and
it’s changes to the output of the inner instance.
Thanks for reading
I hope you enjoyed reading this article! If so, please leave a 👍 reaction or a 💬 comment and consider subscribing to
my newsletter! I write posts on PHP almost every week. You can also follow me
on twitter for more content and the occasional tip.
Laravel News Links
Laravel Junior Code Review: 12 Tips on Everything [VIDEO]
http://img.youtube.com/vi/twPM-6X0pMI/0.jpgJunior Laravel code review, with tips on migrations, routing, PSR standards, Route Model Binding, and more.Laravel News Links
Scientists have found evidence that a meteor strike “1,000 times more powerful than the atomic bomb dropped on Hiroshima” obliterated the ancient cities of Sodom and Gomorra 🤯
https://media.notthebee.com/articles/614b5617017b4614b5617017b5.jpg
It’s funny how this Bible thing keeps being proven true:
Not the Bee
Enhanced PostgresSQL Driver for Laravel
https://laravelnews.imgix.net/images/laravel-postgresql-extended-featured.png?ixlib=php-3.3.1
Laravel PostgreSQL Enhanced is a package by Tobias Petry that offers many missing PostgreSQL-specific features to Laravel:
While in some applications, you want to support multiple database drivers using Eloquent, this package can offer additional features if you’re going to opt-in to making your application PostgreSQL-specific.
This package offers various index features, such as partial index support, include columns, index storage parameters. For example, the partial index support feature could be helpful when you have a table with a unique value (i.e., email) and you want to index to ignore rows with soft deletes:
1Schema::table('users', function(Blueprint $table) {
2 $table
3 ->uniqueIndex('email')
4 ->partial("deleted_at IS NULL");
5});
Besides these features, the package includes multiple column types that are available in PostgreSQL:
- Bit Strings
- Case-insensitive text (i.e., emails)
- Hstore
- IP Networks
- International Product Numbers
- Label Tree
- Ranges
- XML
I’d recommend checking out the readme for details on all the features this package provides. You can learn more about this package, get full installation instructions, and view the source code on GitHub.
Laravel News
Cosmic ‘airburst’ leveled a biblical city in the Jordan Valley
https://www.futurity.org/wp/wp-content/uploads/2021/09/tall-el-hammam-1600.jpg
New research finds evidence of a cosmic airburst destroying a biblical city called Tall el-Hammam.
In the Middle Bronze Age (about 3,600 years ago or roughly 1650 BCE), Tall el-Hammam was ascendant. Located on high ground in the southern Jordan Valley, northeast of the Dead Sea, the settlement in its time had become the largest continuously occupied Bronze Age city in the southern Levant, having hosted early civilization for a few thousand years.
At that time, it was 10 times larger than Jerusalem and five times larger than Jericho.
“All the observations stated in Genesis are consistent with a cosmic airburst, but there’s no scientific proof that this destroyed city is indeed the Sodom of the Old Testament.”
“It’s an incredibly culturally important area,” says James Kennett, emeritus professor of earth science at the University of California, Santa Barbara. “Much of where the early cultural complexity of humans developed is in this general area.”
A favorite site for archaeologists and biblical scholars, the mound hosts evidence of culture all the way from the Chalcolithic, or Copper Age, all compacted into layers as the highly strategic settlement was built, destroyed, and rebuilt over millennia.
But there is a 1.5-meter interval in the Middle Bronze Age II stratum that caught the interest of some researchers for its “highly unusual” materials. In addition to the debris one would expect from destruction via warfare and earthquakes, they found pottery shards with outer surfaces melted into glass, “bubbled” mudbrick, and partially melted building material, all indications of an anomalously high-temperature event, much hotter than anything the technology of the time could produce.
“We saw evidence for temperatures greater than 2,000 degrees Celsius,” says Kennett, whose research group at the time happened to have been building the case for an older cosmic airburst about 12,800 years ago that triggered major widespread burning, climatic changes, and animal extinctions.
The charred and melted materials at Tall el-Hammam looked familiar, and a group of researchers including impact scientist Allen West and Kennett joined Trinity Southwest University biblical scholar Philip J. Silvia’s research effort to determine what happened at this city 3,650 years ago.
“There’s evidence of a large cosmic airburst, close to this city called Tall el-Hammam,” Kennett says of an explosion similar to the Tunguska Event, a roughly 12-megaton airburst that occurred in 1908, when a 56-60-meter (183.7-196.85 feet) meteor pierced the Earth’s atmosphere over the Eastern Siberian Taiga.
The shock of the explosion over Tall el-Hammam was enough to level the city, flattening the palace and surrounding walls and mudbrick structures, according to the paper. The distribution of bones indicated “extreme disarticulation and skeletal fragmentation in nearby humans.”
For Kennett, further proof of the airburst was found by conducting many different kinds of analyses on soil and sediments from the critical layer. Tiny iron- and silica-rich spherules turned up in their analysis, as did melted metals.
“I think one of the main discoveries is shocked quartz. These are sand grains containing cracks that form only under very high pressure,” Kennett says of one of many lines of evidence that point to a large airburst near Tall el-Hammam. “We have shocked quartz from this layer, and that means there were incredible pressures involved to shock the quartz crystals—quartz is one of the hardest minerals; it’s very hard to shock.”
The airburst, according to the paper, may also explain the “anomalously high concentrations of salt” found in the destruction layer—an average of 4% in the sediment and as high as 25% in some samples.
“The salt was thrown up due to the high impact pressures,” Kennett says of the meteor that likely fragmented upon contact with the Earth’s atmosphere. “And it may be that the impact partially hit the Dead Sea, which is rich in salt.”
The local shores of the Dead Sea are also salt-rich, so the impact may have redistributed those salt crystals far and wide—not just at Tall el-Hammam, but also nearby Tell es-Sultan (proposed as the biblical Jericho, which also underwent violent destruction at the same time) and Tall-Nimrin (also then destroyed).
The high-salinity soil could have been responsible for the so-called “Late Bronze Age Gap,” the researchers say, in which cities along the lower Jordan Valley were abandoned, dropping the population from tens of thousands to maybe a few hundred nomads. Nothing could grow in these formerly fertile grounds, forcing people to leave the area for centuries. Evidence for resettlement of Tall el-Hammam and nearby communities appears again in the Iron Age, roughly 600 years after the cities’ sudden devastation in the Bronze Age.
Tall el-Hamman has been the focus of an ongoing debate as to whether it could be the biblical city of Sodom, one of the two cities in the Old Testament Book of Genesis that were destroyed by God for how wicked they and their inhabitants had become. One denizen, Lot, is saved by two angels who instruct him not to look behind as they flee. Lot’s wife, however, lingers and is turned into a pillar of salt. Meanwhile, fire and brimstone fell from the sky; multiple cities were destroyed; thick smoke rose from the fires; city inhabitants were killed and area crops were destroyed in what sounds like an eyewitness account of a cosmic impact event. It’s a satisfying connection to make.
“All the observations stated in Genesis are consistent with a cosmic airburst,” Kennett says, “but there’s no scientific proof that this destroyed city is indeed the Sodom of the Old Testament.” However, the researchers say, the disaster could have generated an oral tradition that may have served as the inspiration for the written account in the book of Genesis, as well as the biblical account of the burning of Jericho in the Old Testament Book of Joshua.
The study appear in Nature Scientific Reports.
Source: UC Santa Barbara
The post Cosmic ‘airburst’ leveled a biblical city in the Jordan Valley appeared first on Futurity.
Futurity
MyDumper 0.11.1 is Now Available
https://www.percona.com/blog/wp-content/uploads/2021/09/MyDumper-0.11.1-2048×1152.png
The new MyDumper 0.11.1 version, which includes many new features and bug fixes, is now available. You can download the code from here.
For this release, there are three main changes: 1) we added config file functionality which allows users to set session-level variables (one of the most requested features!), 2) we developed a better and robust import mechanism, and 3) we fixed all the filename related issues. Those changes and mostly the last one forced us to change the version number from 0.10.9 to 0.11.1 as a backup taken in 0.10.x will not work in 0.11.x and vice versa.
New Features:
- Adding order by part functionality #388
- improve estimated_step #376 #373
- Adding config file functionality #370
- Use only a config file to load the parameters #318
- We hope to add parameters and support custom SQL mode and character configuration #274
- [myloader] Add option to disable Galera Cluster (Wsrep) replication before importing #159
- mydumper can’t recreate mysql.proc + mysql.events due to 5.7 sql_mode #142
- trouble with global sql_big_selects=0 #50
- Enabling MAX_EXECUTION_TIME option #368
- mydumper dump big table failed, because of dumping time longer than max_execution_time #257
- trouble with global sql_big_selects=0 #50
- We hope to add parameters and support custom SQL mode and character configuration #274
- Adding sync mechanism and constraint split #352
- Table and database names changed to fix several issues #399
- bug for overwrite-tables option #272
- Problems related to log output when backing up table name with #179 #210
- parallel schema restore? #169 #311
- bug with table name #41 #56
- Export with table folders #212
- bug for overwrite-tables option #272
- [BUG] table name make mydumper fail #391
- [BUG] table name starts with checksum breaks myloader #382
- Fix issue #182 for tables with quotes #258
- Dump procedures and functions using case sensitive database name #69
Bug Closed:
- [BUG] Error occurs when using –innodb-optimize-keys and there is a column having a foreign key and part of a generated column #395
- Tables without indexes can cause segfault #386
Fixes:
- [ Fix ] on table name segfault and add free functions #401
- Adding the set session execution #398
- [ Fix ] When no index, alter_table_statement must be NULL #397
- Avoid logging SQL data on error #392
- [ fix ] The count was incorrect #390
- Fix on Debian version #387
- Fix package URLs #384
- Change quotes to backticks in SQL statements #350
- bug for overwrite-tables option #272
- mydumper: fix an ‘SQL injection’ issue when table name contains a ‘ or #168
Refactoring
Question Addressed:
- [QUESTION] Increase CPU usage Tuning restore #380
- [Question] how to use mydumper to backup 2 tables with different where conditions? #377
- column charset is ignored once it’s different from table charset. #156
- mydumper/myloader feature requests #84
- load Generated Columns error #175
Download MyDumper 0.11.1 Today!
Percona Database Performance Blog
How to Fix iOS 15’s Worst Feature
https://i.kinja-img.com/gawker-media/image/upload/c_fill,f_auto,fl_progressive,g_center,h_675,pg_1,q_80,w_1200/500003f6183ba8c5c76e259f038c6c81.jpg
iOS 15 is officially here, and while it brings many cool new features, there’s also one we really, really dislike: the new Safari search bar.
In iOS 15, Apple redesigned Safari so that the address bar has been relocated from the top of the screen to the bottom. Theoretically, this makes Safari easier to use single-handedly. Apple did improve the search bar so it doesn’t jump around anymore like it did in early beta versions of iOS 15. However, if you find that you don’t like the search bar at the bottom, you can easily switch the address bar back to the top.
After you update to iOS 15, open the Safari app on your phone. In the bottom left-hand corner, you should see the “aA” icon in the search bar. Tap it and then select the Show Top Address Bar. And that’s it. Whoosh, it’ll go back to being up top. If you end up liking the search bar at the bottom, no worries. You can tap the “aA” icon again to send the search bar back to the bottom.
You can also change it by heading on over to the Settings app. From there, scroll down to Safari, and select the Single Tab option. Doing it this way also allows you to control some other new features in Safari. For instance, you can toggle the Landscape Tab Bar setting. If you turn it off, then the search bar will disappear whenever you view Safari in Landscape mode. There’s also the Allow Website Tinting setting, which changes the search bar’s color scheme to match the website you’re visiting.
G/O Media may get a commission
Apple first introduced the ability to revert back to the original Safari design we all know and love with the sixth iOS 15 beta. The move followed some backlash from beta users regarding the ping-ponging search bar. (You can see it in action in our iOS 15 preview.) It was a rare move from the company, which doesn’t generally change course when it comes to executive design changes—even if they’re massively unpopular. See: the notorious MacBook Butterfly switches and that time Apple nixed the headphone jack. Still, we’re not about to complain about Apple giving users more control over customizing apps. Here’s to hoping Apple continues listening to feedback and giving customers more options in the future.
Gizmodo