This document summarizes magic methods in PHP that allow for custom object behavior. It discusses methods for stringification (__toString()), object lifecycle (__construct(), __destruct()), property overloading (__get(), __set(), etc.), method overloading (__call(), __callStatic()), serialization (__sleep(), __wakeup()), cloning (__clone(), __set_state()), and object invocation (__invoke()). Examples are provided for each method. Performance benchmarks at the end show that magic methods have negligible overhead compared to normal method calls.
PHP unserialization vulnerabilities: What are we missing?Sam Thomas
Video at: https://www.youtube.com/watch?v=PqsudKzs79c
An introduction to PHP unserialization vulnerabilities, with some practical tips on methodology. Based around three new exploits for old vulnerabilities (CVE-2011-4962, CVE-2013-1453, CVE-2013-4338).
PHP unserialization vulnerabilities: What are we missing?Sam Thomas
Video at: https://www.youtube.com/watch?v=PqsudKzs79c
An introduction to PHP unserialization vulnerabilities, with some practical tips on methodology. Based around three new exploits for old vulnerabilities (CVE-2011-4962, CVE-2013-1453, CVE-2013-4338).
This is all about socket programming in java using TCP and UDP socket and an example of simple Echo Server.
Also includes concepts of the socket, Socket class and methods and use of those.
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...Philip Schwarz
Follow in the footsteps of refactoring guru Martin Fowler as he improves the design of a program in a simple yet instructive refactoring example whose JavaScript code and associated refactoring is herein adapted to Java.
Based on the second edition of ‘the’ Refactoring book.
In the process, we’ll be using the following Java language features incorporated into long-term support (LTS) version JDK 17 (the previous LTS version being JDK 11):
Text blocks (JDK 15)
Records (JDK 16)
Sealed interfaces (JDK 17)
Here is a github repository with the whole refactoring, from start to finish, following the steps seen in the slides https://github.com/philipschwarz/refactoring-a-first-example-java
Inheritance and Polymorphism in Python. Inheritance is a mechanism which allows us to create a new class – known as child class – that is based upon an existing class – the parent class, by adding new attributes and methods on top of the existing class.
Functional programming can be an excellent approach to designing decoupled, reusable systems with a rich domain model. In fact, the lessons from applying DDD in a functional language translate well to object-oriented programming.
Long thought to be relegated to the domain of fast, multithreaded desktop applications, race conditions have made their way into web applications. These bugs are often difficult to test for, and are becoming increasingly prevalent due to faster and faster clients, while server-side languages like Node.js and PHP are struggling to keep up. Race conditions are no longer just bugs- when they are found in critical components of web applications, they become a serious security vulnerability. If the proper checks and defensive measures are not in place, databases get confused, “one-time-use” becomes a relative term, and “limited” becomes “unlimited”. This talk will detail specific examples where malicious users could cause damage or profit from a race-condition flaw in a web application. A custom open-source tool will also be introduced to help security researchers and developers easily check for this class of vulnerability in web applications.
Here we are going to learn why is a good practice to use interfaces and how they are different from abstraction classes. Further more we are going to see how which one of them to use.
Slides for a lightning talk on Java 8 lambda expressions I gave at the Near Infinity (www.nearinfinity.com) 2013 spring conference.
The associated sample code is on GitHub at https://github.com/sleberknight/java8-lambda-samples
This is all about socket programming in java using TCP and UDP socket and an example of simple Echo Server.
Also includes concepts of the socket, Socket class and methods and use of those.
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...Philip Schwarz
Follow in the footsteps of refactoring guru Martin Fowler as he improves the design of a program in a simple yet instructive refactoring example whose JavaScript code and associated refactoring is herein adapted to Java.
Based on the second edition of ‘the’ Refactoring book.
In the process, we’ll be using the following Java language features incorporated into long-term support (LTS) version JDK 17 (the previous LTS version being JDK 11):
Text blocks (JDK 15)
Records (JDK 16)
Sealed interfaces (JDK 17)
Here is a github repository with the whole refactoring, from start to finish, following the steps seen in the slides https://github.com/philipschwarz/refactoring-a-first-example-java
Inheritance and Polymorphism in Python. Inheritance is a mechanism which allows us to create a new class – known as child class – that is based upon an existing class – the parent class, by adding new attributes and methods on top of the existing class.
Functional programming can be an excellent approach to designing decoupled, reusable systems with a rich domain model. In fact, the lessons from applying DDD in a functional language translate well to object-oriented programming.
Long thought to be relegated to the domain of fast, multithreaded desktop applications, race conditions have made their way into web applications. These bugs are often difficult to test for, and are becoming increasingly prevalent due to faster and faster clients, while server-side languages like Node.js and PHP are struggling to keep up. Race conditions are no longer just bugs- when they are found in critical components of web applications, they become a serious security vulnerability. If the proper checks and defensive measures are not in place, databases get confused, “one-time-use” becomes a relative term, and “limited” becomes “unlimited”. This talk will detail specific examples where malicious users could cause damage or profit from a race-condition flaw in a web application. A custom open-source tool will also be introduced to help security researchers and developers easily check for this class of vulnerability in web applications.
Here we are going to learn why is a good practice to use interfaces and how they are different from abstraction classes. Further more we are going to see how which one of them to use.
Slides for a lightning talk on Java 8 lambda expressions I gave at the Near Infinity (www.nearinfinity.com) 2013 spring conference.
The associated sample code is on GitHub at https://github.com/sleberknight/java8-lambda-samples
Presentation showing that writing tests is not really hard with examples on testing a simple class, testing with dataproviders, fixtures, mocks, stubs, databases and how to use zend framework bootstrap for MVC testing.
Given at php|tek 09 unconf sessions.
Singletons in PHP - Why they are bad and how you can eliminate them from your...go_oh
While Singletons have become a Pattern-Non-Grata over the years, you still find it surprisingly often in PHP applications and frameworks. This talk will explain what the Singleton pattern is, how it works in PHP and why you should avoid it in your application.
Part 1 of an in-company training. Complete set of slides under:
Part 1: https://www.slideshare.net/VasilyKartashov/effective-php-part-1
Part 2: https://www.slideshare.net/VasilyKartashov/effective-php-part-2
Part 3: https://www.slideshare.net/VasilyKartashov/effective-php-part-3
Part 4: https://www.slideshare.net/VasilyKartashov/effective-php-part-4
Part 5: https://www.slideshare.net/VasilyKartashov/effective-php-part-5
Part 6: https://www.slideshare.net/VasilyKartashov/effective-php-part-6
More about the author: http://notes.kartashov.com/about/
Scope is a major factor in any application, from programing scope to project scope, and communication is key. We will discuss different application scopes including global, functional, class, and package scope. We'll demonstrate how namespaces fit into the scope and how everything ties together with communication of the project itself.
Software should be perfect, but it isn't! Bugs in the software ranges from small "inoffensive ones" to the ones that makes the news when a bunch of credit card data is stole.
On this talk we will review different testing methodologies and tools, and we will focus on using PHPUnit to assert how your software works and how to exterminate your bugs.
PHP 8.0 is expected to be released by the end of the year, so it’s time to take a first look at the next major version of PHP. Attributes, union types, and a just-in-time compiler are likely the flagship features of this release, but there are many more improvements to be excited about. As PHP 8.0 is a major version, this release also includes backwards-incompatible changes, many of which are centered around stricter error handling and more type safety.
This talk will discuss new features already implemented in PHP 8, backwards-compatibility breaks to watch out for, as well as some features that are still under discussion.
PHP 8.0 is expected to be released by the end of the year, so it’s time to take a first look at the next major version of PHP. Attributes, union types, and a just-in-time compiler are likely the flagship features of this release, but there are many more improvements to be excited about. As PHP 8.0 is a major version, this release also includes backwards-incompatible changes, many of which are centered around stricter error handling and more type safety.
Presentation from phpfwdays 2020.
Initially presented at Software Architecture Conference in Boston, MA on 3/18/15.
Distributed systems are complex beasts. Breaking your application into multiple services introduces new types of errors, cascading failures, and CAP theorem limitations. Unfortunately, your uptime and sanity both suffer. This session will focus on various tactics and learnings from Lucid Software's migration to a service oriented architecture.
Initiallly presented at Scala User Group in SLC, UT on 3 Sep 2014.
Anorm is part of the Typesafe Play! framework stack. It has nice features, but is lacking performance. Relate is a new library, inspired by Anorm, whose performance is closer to the underlying JDBC library. This makes it a better candidate for enterprise and time sensitive workloads.
Initially presented at OpenWest 2014 conference.
Graphite and StatsD gather line series data and offer a robust set of APIs to access that data. While the tools are robust, the dashboards are straight from 1992 and alerting off the data is nonexistent. Nark, an opensource project, solves both of these problems. It provides easy to use dashboards and readily available alerts and notifications to users. It has been used in production at Lucid Software for almost a year. Related to Nark are the tools required to make Graphite highly available.
Graphite has an amazing ability to scale horizontally and achieve high availability. What the community is missing is a single source for alerting and dashboards on top of this already amazing product. That's where Nark comes in.
Nark is an open source project developed to provide alerting and dashboards for graphite. Developed by engineers at Lucid Software, Nark provides value to ops and product teams alike. Come learn about the project, how you can use it, and how to contribute.
The problem with frameworks and ORMs is the lackadaisical manner with which they write queries. Their focus is to straddle multiple database engines, not to write queries in the optimal way. The database layer is always the hardest layer to scale. Why would you put additional strain on your database to avoid writing SQL? This session focuses on understanding indices, queries, and optimization in MySQL.
Originally presented at the Northeast PHP 2013 conference.
Git is hard to learn, but that's not a good excuse to ignore it. This presentation aims to teach the bare essentials for operating a git repository.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
2. The Barlocker
● Chief Architect at Lucid
Software Inc
● Started using PHP in 2005
● Graduated with BS in CS from
BYU in 2008
● Developed software for the
following industries:
– Network Security
– Social Gaming
– Financial
– Productivity
3. Magic Methods
● All object methods beginning with '__' are reserved.
● To gain the magic functionality, define the method on the
class.
<?php
class MyClass {
private $var1 = 5;
public function doSomething() {
echo "hello!n";
}
}
<?php
class MyClass {
private $var1 = 5;
public function doSomething() {
echo "hello!n";
}
public function __toString() {
return 'This is a MyClass';
}
}
6. __toString
● public string __toString()
● Called when an object is cast as a string.
● Throwing an exception inside this method will cause a
fatal error.
● No default implementation.
7. __toString
<?php
class NoTostringExample {
public $a = 1;
}
$obj = new NoTostringExample();
echo "Stringified " . $obj . "n";
?>
$ php notostring.php
PHP Catchable fatal error: Object of class NoTostringExample could not be
converted to string in notostring.php on line 8
8. __toString
<?php
class TostringExample {
public $a = 2;
public function __toString() {
return 'TostringExample(' . $this->a . ')';
}
}
$obj = new TostringExample();
echo "Stringified " . $obj . "n";
?>
$ php tostring.php
Stringified TostringExample(2)
9. __toString
<?php
class BadTostringExample {
public $a = 3;
public function __toString() {
echo 'TostringExample(' . $this->a . ')' . "n";
}
}
$obj = new BadTostringExample();
echo "Stringified " . $obj . "n";
?>
$ php badtostring.php
TostringExample(3)
PHP Catchable fatal error: Method BadTostringExample::__toString() must return a
string value in badtostring.php on line 11
11. __construct
● public void __construct($params, …)
● Called when an object is first initialized.
● Must explicitly call parent::__construct() in children.
● Default implementation does nothing.
12. __destruct
● public void __destruct()
● Called when an object is garbage collected.
● Must explicitly call parent::__destruct() in children.
● Default implementation does nothing.
13. __destruct
● public void __destruct()
● Called when an object is garbage collected.
● Must explicitly call parent::__destruct() in children.
● Default implementation does nothing.
14. __construct / __destruct
$ php construct.php
Starting
Construct
Ending
Destruct
<?php
class Construct {
public function __construct() {
echo "Constructn";
}
public function __destruct() {
echo "Destructn";
}
}
echo "Startingn";
$obj = new Construct();
echo "Endingn";
?>
15. __construct / __destruct
<?php
class MyDB {
private $connection = null;
public function __construct($host, $user, $pass) {
$this->connection = dbconnect($host, $user, $pass);
}
public function __destruct() {
$this->connection->close();
}
}
17. __get
● public mixed __get($name)
● Called when an inaccessible property is read.
● Not called in chains. ($x = $obj->noexist = 5;)
● Default implementation emits a warning and returns null
or emits a fatal error.
● Does not apply to static context.
18. __set
● public void __set($name, $value)
● Called to write a value to an inaccessible property.
● Default implementation adds a public variable to the
class.
● Does not apply to static context.
19. __isset
● public mixed __isset($name)
● Triggered by calling isset() or empty() on inaccessible
properties
● Default implementation checks for existence of property
and ignores visibility.
● Does not apply to static context.
20. __unset
● public mixed __unset($name)
● Triggered by calling unset() on inaccessible properties
● Default implementation removes accessible properties.
● Does not apply to static context.
21. Property Test
See code from
http://www.php.net/manual/en/language.oop5.overloading.php#object.get
27. __sleep
● public array __sleep()
● Called when serialize() is called on the object.
● Returns an array of field names to include in the serialized
version of the object.
28. __wakeup
● public void __wakeup()
● Called when unserialize() is called on the serialized
object.
29. __sleep / __wakeup
See code from
http://www.php.net/manual/en/language.oop5.magic.php#object.sleep
38. Performance
● Each benchmark was run 10 times.
● Each run is shown as a different set of columns in the
graphs.
● Each run is exactly 1 million calls to the item being tested.
46. Lucid Software Inc
● Building the next generation of collaborative web
applications
● VC funded, high growth, profitable
● Graduates from Harvard, MIT, Stanford
● Team has worked at Google, Amazon, Microsoft
https://www.lucidchart.com/jobs