JavaScript ist eine sehr dynamische Sprache und verhält sich zudem je nach Browser unterschiedlich. Daher sind automatisierte Tests besonders wertvoll. Dieser Vortrag zeigt, wie Cross-Browser-Tests für JavaScript entwickelt werden können.
Vortrag von der MobileTech Conference 2011
PDO (PHP Data Objects) provides a common interface for accessing databases in PHP. It uses prepared statements to separate SQL structures from user-supplied input, improving security and performance. PDO supports databases like MySQL, PostgreSQL, SQLite, and Oracle. It offers flexible fetching of query results as arrays, objects, or callbacks. PDO also includes features like transactions, metadata retrieval, and error handling via exceptions.
JavaScript ist eine sehr dynamische Sprache und verhält sich zudem je nach Browser unterschiedlich. Daher sind automatisierte Tests besonders wertvoll. Dieser Vortrag zeigt, wie Cross-Browser-Tests für JavaScript entwickelt werden können.
Vortrag von der MobileTech Conference 2011
PDO (PHP Data Objects) provides a common interface for accessing databases in PHP. It uses prepared statements to separate SQL structures from user-supplied input, improving security and performance. PDO supports databases like MySQL, PostgreSQL, SQLite, and Oracle. It offers flexible fetching of query results as arrays, objects, or callbacks. PDO also includes features like transactions, metadata retrieval, and error handling via exceptions.
BGA eğitmenleri tarafından hazırlanan Beyaz Şapkalı Hacker (CEH) Laboratuvar Kitabıdır. Dokümanı https://www.bgasecurity.com/makale/beyaz-sapkali-hacker-ceh-lab-kitabi/ adresimiz üzerinden indirebilirsiniz.
Pentest ekiplerinin kullandığı Kali dağıtımı ile Linux dünyasına giriş dökümanıdır. Bu döküman; güvenlik alanına giriş yapmak isteyen insanların Türkçe kaynak problemini gidermeyi amaçlayarak hazırlanmıştır. Bu açık kaynak projesine katkı sağlamak isteyen gönüllü linux kullanıcıları ise bize ulaşabilirler. Yazım hatası, anlam karmaşası, yanlış bilgi veya iyileştirmeler için mehmet.ince@intelrad.com adresine mail atabilirsiniz. İyi çalışmalar.
PHP is a server-side scripting language used to create dynamic web pages. It allows embedding PHP code within HTML pages and interacting with databases. Key elements of PHP include variables, control structures, functions, and sessions. Sessions store user data on the server instead of the client to avoid cookies and allow tracking users across multiple pages.
Linux 4.x Tracing: Performance Analysis with bcc/BPFBrendan Gregg
Talk about bcc/eBPF for SCALE15x (2017) by Brendan Gregg. "BPF (Berkeley Packet Filter) has been enhanced in the Linux 4.x series and now powers a large collection of performance analysis and observability tools ready for you to use, included in the bcc (BPF Complier Collection) open source project. BPF nowadays can do system tracing, software defined networks, and kernel fast path: much more than just filtering packets! This talk will focus on the bcc/BPF tools for performance analysis, which make use of other built in Linux capabilities: dynamic tracing (kprobes and uprobes) and static tracing (tracepoints and USDT). There are now bcc tools for measuring latency distributions for file system I/O and run queue latency, printing details of storage device I/O and TCP retransmits, investigating blocked stack traces and memory leaks, and a whole lot more. These lead to performance wins large and small, especially when instrumenting areas that previously had zero visibility. Tracing superpowers have finally arrived, built in to Linux."
BGA eğitmenleri tarafından hazırlanan Beyaz Şapkalı Hacker (CEH) Laboratuvar Kitabıdır. Dokümanı https://www.bgasecurity.com/makale/beyaz-sapkali-hacker-ceh-lab-kitabi/ adresimiz üzerinden indirebilirsiniz.
Pentest ekiplerinin kullandığı Kali dağıtımı ile Linux dünyasına giriş dökümanıdır. Bu döküman; güvenlik alanına giriş yapmak isteyen insanların Türkçe kaynak problemini gidermeyi amaçlayarak hazırlanmıştır. Bu açık kaynak projesine katkı sağlamak isteyen gönüllü linux kullanıcıları ise bize ulaşabilirler. Yazım hatası, anlam karmaşası, yanlış bilgi veya iyileştirmeler için mehmet.ince@intelrad.com adresine mail atabilirsiniz. İyi çalışmalar.
PHP is a server-side scripting language used to create dynamic web pages. It allows embedding PHP code within HTML pages and interacting with databases. Key elements of PHP include variables, control structures, functions, and sessions. Sessions store user data on the server instead of the client to avoid cookies and allow tracking users across multiple pages.
Linux 4.x Tracing: Performance Analysis with bcc/BPFBrendan Gregg
Talk about bcc/eBPF for SCALE15x (2017) by Brendan Gregg. "BPF (Berkeley Packet Filter) has been enhanced in the Linux 4.x series and now powers a large collection of performance analysis and observability tools ready for you to use, included in the bcc (BPF Complier Collection) open source project. BPF nowadays can do system tracing, software defined networks, and kernel fast path: much more than just filtering packets! This talk will focus on the bcc/BPF tools for performance analysis, which make use of other built in Linux capabilities: dynamic tracing (kprobes and uprobes) and static tracing (tracepoints and USDT). There are now bcc tools for measuring latency distributions for file system I/O and run queue latency, printing details of storage device I/O and TCP retransmits, investigating blocked stack traces and memory leaks, and a whole lot more. These lead to performance wins large and small, especially when instrumenting areas that previously had zero visibility. Tracing superpowers have finally arrived, built in to Linux."
4. Schlüsselwörter
● class ● interface
● const ● abstract
● function ● Final
● public ● extends
● protected ● implements
● private
5. Interface
interface MyInterface {
● Kann Methoden, }
public function output1($text);
Constanten enthalten interface MyInterface2 extends MyInterface {
const DELIMITER = PHP_EOL;
● public }
nur Signatur keine Logik
class MyClass implements MyInterface2 {
●
public function output1($text) {
echo $text . self::DELIMITER;
● können Interfaces }
}
erweitern echo 'A' . MyInterface2::DELIMITER;
Klassen Signatur muss
$class = new MyClass();
● $class->output1('test');
exakt mit Interface
übereinstimmen A
test
6. Abstract
abstract class AbstractClass {
● Klassen, Methoden abstract protected function getValue();
abstract protected function prefixValue($prefix);
public function printOut() {
● Kann nicht instanziiert }
print $this->getValue () . "n";
werden
}
class ConcreteClass1 extends AbstractClass {
protected function getValue() {
● Kann Methoden, }
return "ConcreteClass1";
Variablen,
public function prefixValue($prefix) {
return "{$prefix}ConcreteClass1";
}
Constanten enthalten }
$class1 = new ConcreteClass1();
● Sichtbarkeit kann $class1->printOut();
echo $class1->prefixValue('FOO_');
aufgeweicht aber ConcreteClass1
nicht verstärkt werden FOO_ConcreteClass1
7. Final
class MyClass {
● Methode final public function getClassName() {
return __CLASS__;
}
● Kann nicht }
überschrieben werden final class MyClassFinal extends MyClass {
public function getValue() {
return 'Gordon';
● Klasse }
}
● Kann nicht mehr
erweitert werden
8. Type Hinting
class MyClass
● Objects {
public function test(OtherClass $otherclass) {
echo $otherclass->var . PHP_EOL;
● Object }
public function test_array(array $input_array) {
print_r($input_array);
● Spezial object }
}
● array class OtherClass {
public $var = 'Hallo Welt';
}
● keine weiteren $class = new MyClass();
$class ->test(new OtherClass());
$class->test_array(array(1, 'Gordon'));
Hallo Welt
Array
(
[0] => 1
[1] => Gordon
)
12. Construct & Destruct
class MyClass {
● Initialisieren und public function __construct() {
echo '__construct' . PHP_EOL;
löschen }
public function __destruct() {
echo '__destruct' . PHP_EOL;
}
}
$class = new MyClass();
echo 'do something' . PHP_EOL;
unset($class);
__construct
do something
__destruct
13. To String
class MyClass {
● Aufruf bei einen public function __toString() {
return 'Gordon' . PHP_EOL;
String cast auf ein }
}
Object $class = new MyClass();
echo $class;
echo (string) $class;
echo $class->__toString();
Gordon
Gordon
Gordon
14. Set & Get
class MyClass {
● Nur bei nicht public function __set($name, $value) {
echo '__set' . PHP_EOL;
existierende }
$this->$name = $value;
Eigenschaften
public function __get($name) {
return 'not exist';
}
}
● Unkontrolliertes $class = new MyClass();
setzen von
var_dump($class->name);
$class->name = 'Peter';
var_dump($class->name);
Eigenschaften $class->name = 'Marco';
var_dump($class->name);
verhindern
string(9) "not exist"
__set
string(5) "Peter"
string(5) "Marco"
15. Call & Call Static
Wenn Funktion nicht
class MyClass {
● public function __call($name, $arguments) {
echo '__call' . PHP_EOL;
existiert oder nicht
echo $this->getName();
}
static public function __callStatic($name, $arguments) {
sichtbar ist }
echo '__callStatic' . PHP_EOL;
echo self::getName();
static protected function getName() {
● __callStatic erst ab }
}
return 'Gordon';
PHP 5.3 $class = new MyClass();
$class->getName2();
$class->getName();
MyClass::getName2();
__call
Gordon
__call
Gordon
__callStatic
Gordon
18. Problem
class MyCounter {
● Macht mehr als die public function __construct() {
$this->memcache = new Memcache();
Klasse soll }
$this->memcache->connect('localhost:11211');
public function setCounter($counter) {
Schlecht testbar
$this->memcache->set('counter', $counter);
● }
}
● Memcacheinstanz $class = new MyCounter();
$class->setCounter(4);
muss laufen
19. Vereinfachen
class MyCounter {
● Memcacheinstanz public function __construct($cache) {
$this ->cache = $cache;
injizieren }
public function setCounter($counter) {
$this->cache->set('counter', $counter);
}
}
$cache = new Memcache();
$cache->connect('localhost:11211');
$class = new MyCounter($cache);
$class->setCounter(4);
20. Testbar machen
interface MyIStorage {
● Memcache Kapseln }
public function set($name, $value);
class MyStorageMemcache implements MyIStorage {
public function __construct($memcache) {
$this->cache = $memcache;
}
public function set($name, $value) {
$this->cache->set($name, $value);
}
}
class MyCounter {
public function __construct(MyIStorage $cache) {
$this->cache = $cache;
}
public function setCounter($counter) {
$this->cache->set('counter', $counter);
}
}
$memcache = new Memcache();
$memcache->connect('localhost:11211');
$cache = new MyStorageMemcache($memcache);
$class = new MyCounter($cache);
$class->setCounter(4);
22. Neues I
class MyClass {
● Heredoc für static $varStatic = 'Gordon';
public $var = <<<DATA
Eigenschaften Hello World!
DATA;
Variable als
}
●
$className = 'MyClass';
Klassenreferenz $class = new $className();
echo $class->var;
echo $className::$varStatic . PHP_EOL;
Hello World!
Gordon
23. Neues II
class MyClass {
● __destruct Exception public function __destruct() {
throw new Exception('No Fatal Error');
Kein Fatal Error }
public function __invoke($x) {
var_dump($x);
__invoke()
}
● }
__callStatic() $class = new MyClass();
$class(5);
try {
unset($class);
} catch(Exception $e) {
echo $e->getMessage() . PHP_EOL;
}
int(5)
No Fatal Error
24. Late Static Bindings
class A {
● Schlüsselwort static public static function who() {
echo __CLASS__ . PHP_EOL;
}
● ruft die Funktion in public static function test() {
self ::who();
der Kindklasse auf
}
public static function testLateStaticBinding() {
static::who(); // Here comes Late Static Bindings
}
}
class B extends A {
public static function who() {
echo __CLASS__ . PHP_EOL;
}
}
B::test();
B::testLateStaticBinding();
A
B
25. Namespaces
namespace A;
● Namespace
ini_set('error_reporting', E_ALL);
● immer am Anfang der Datei ini_set('display_errors', true);
● Benutzen function str_repeat($input, $multiplier = 2) {
return str_repeat($input . ' ', $multiplier);
}
● Use A;
new MyClass(); var_dump(str_repeat('Gordon'));
var_dump(Astr_repeat('Gordon', 3));
● new AMyClass(); var_dump(str_repeat('Gordon', 3));
● spezielle Konstanten können
nicht überschrieben werden
● NULL, TRUE, FALSE,
ZEND_THREAD_SAFE und
ZEND_DEBUG_BUILD
string(14) "Gordon Gordon "
string(21) "Gordon Gordon Gordon "
string(18) "GordonGordonGordon"