Modern browsers employ optimization techniques like compiling code to bytecode or native code for fast execution. A benchmark test was conducted of various JavaScript performance tasks across browsers. The tests examined math operations, identifier resolution, data access, arrays, regular expressions, strings, DOM manipulation, SHA1 hashing, and canvas rendering. Chrome and Safari performed best overall due to their layout engines, while Firefox, Edge, and Opera also competed closely. Internet Explorer lagged other browsers. Faster compiled code, memory access, and GPU acceleration contributed to differences in results.
The document discusses Drupal's #states functionality for dynamically showing and hiding form elements based on user interactions. It describes the anatomy of state definitions, how dependencies between elements are defined, targeting elements using CSS selectors, built-in state names like visible and checked, and how to define custom triggers for state changes beyond default DOM events.
This document discusses building web services using the Zend Framework. It introduces key components for building SOAP, XML-RPC, and RESTful services, including the Zend_Soap, Zend_XmlRpc, and Zend_Rest libraries. It provides an example of building a timesheet API and exposing it through different protocols, demonstrating how to define methods, handle requests and responses, and implement clients. Documentation of the API using docblocks is also covered.
The document discusses unit testing Zend Framework applications. It provides an overview of setting up PHPUnit for testing, including creating a phpunit.xml file and TestHelper bootstrap file. It also discusses testing Zend Forms and Models, including writing tests to validate form data and test that models are empty on construction. Code examples are provided for writing tests for a CommentForm and CommentModel class.
This document contains code for a C# class called "test" that defines properties and validation attributes for a web form model. It includes properties for email, name, date, and other fields, along with attributes for validation rules like required, data type, length, and regular expressions. It also contains JavaScript code to add client-side validation logic and datepicker functionality to the form fields.
Hacking Your Way To Better Security - Dutch PHP Conference 2016Colin O'Dell
The goal of this talk is to educate developers on common security vulnerabilities, how they are exploited, and how to protect against them. We'll explore several of the OWASP Top 10 attack vectors like SQL injection, XSS, CSRF, session hijacking, and insecure direct object references. Each topic will be approached from the perspective of an attacker to see how these vulnerabilities are detected and exploited using several realistic examples. Once we've established an understanding of how these attacks work, we'll look at concrete steps you can take to secure web applications against such vulnerabilities. The knowledge gained from this talk can also be used for participating in "Capture the Flag" security competitions.
The document discusses the concept of Object Calisthenics, which are programming guidelines aimed at writing better object-oriented code. It specifically outlines 9 guidelines/rules adapted for PHP programming:
1. Only one level of indentation per method.
2. Do not use the 'else' keyword.
3. Wrap all primitive data types and strings in objects.
4. Collections of objects should be first-class objects.
5. Only call one method on an object per line.
6. Do not abbreviate names.
7. Keep classes small with under 200 lines of code and 10 methods.
8. Limit the number of instance variables in a class to 2-5.
9
In 2010, I told everyone how to start unit testing Zend Framework applications. In 2011, let’s take this a step further by testing services, work flows and performance. Looking to raise the bar on quality? Let this talk be the push you need to improve your Zend Framework projects.
The document discusses Drupal's #states functionality for dynamically showing and hiding form elements based on user interactions. It describes the anatomy of state definitions, how dependencies between elements are defined, targeting elements using CSS selectors, built-in state names like visible and checked, and how to define custom triggers for state changes beyond default DOM events.
This document discusses building web services using the Zend Framework. It introduces key components for building SOAP, XML-RPC, and RESTful services, including the Zend_Soap, Zend_XmlRpc, and Zend_Rest libraries. It provides an example of building a timesheet API and exposing it through different protocols, demonstrating how to define methods, handle requests and responses, and implement clients. Documentation of the API using docblocks is also covered.
The document discusses unit testing Zend Framework applications. It provides an overview of setting up PHPUnit for testing, including creating a phpunit.xml file and TestHelper bootstrap file. It also discusses testing Zend Forms and Models, including writing tests to validate form data and test that models are empty on construction. Code examples are provided for writing tests for a CommentForm and CommentModel class.
This document contains code for a C# class called "test" that defines properties and validation attributes for a web form model. It includes properties for email, name, date, and other fields, along with attributes for validation rules like required, data type, length, and regular expressions. It also contains JavaScript code to add client-side validation logic and datepicker functionality to the form fields.
Hacking Your Way To Better Security - Dutch PHP Conference 2016Colin O'Dell
The goal of this talk is to educate developers on common security vulnerabilities, how they are exploited, and how to protect against them. We'll explore several of the OWASP Top 10 attack vectors like SQL injection, XSS, CSRF, session hijacking, and insecure direct object references. Each topic will be approached from the perspective of an attacker to see how these vulnerabilities are detected and exploited using several realistic examples. Once we've established an understanding of how these attacks work, we'll look at concrete steps you can take to secure web applications against such vulnerabilities. The knowledge gained from this talk can also be used for participating in "Capture the Flag" security competitions.
The document discusses the concept of Object Calisthenics, which are programming guidelines aimed at writing better object-oriented code. It specifically outlines 9 guidelines/rules adapted for PHP programming:
1. Only one level of indentation per method.
2. Do not use the 'else' keyword.
3. Wrap all primitive data types and strings in objects.
4. Collections of objects should be first-class objects.
5. Only call one method on an object per line.
6. Do not abbreviate names.
7. Keep classes small with under 200 lines of code and 10 methods.
8. Limit the number of instance variables in a class to 2-5.
9
In 2010, I told everyone how to start unit testing Zend Framework applications. In 2011, let’s take this a step further by testing services, work flows and performance. Looking to raise the bar on quality? Let this talk be the push you need to improve your Zend Framework projects.
Javascript & jQuery: A pragmatic introductionIban Martinez
This document provides an introduction to Javascript and jQuery. It covers Javascript data types including numbers, strings, Booleans, null/undefined, and arrays. It then covers jQuery topics like jQuery objects, selectors, CSS manipulation, events including ready and load, and AJAX/JSON requests using both asynchronous and synchronous modes. It includes examples for working with numbers, strings, selectors, events, AJAX calls and shortcuts. The document aims to provide a pragmatic introduction to Javascript and jQuery concepts and functionality.
We, as developers, often think that we don’t have to or don’t need to know what are what they call design patterns. We think that we already know how to build a software and don’t need all this theory. Years after years, by having to deal with the low maintainability of my own codebases, I explored a lot of ways of decoupling applications, in order to have enterprise-grade software that last for years. With concrete examples, I want to share with you some design patterns and how they can help you to grow well structured and decoupled applications.
Backbone is a JavaScript framework that provides models, collections, and views for building single-page web applications. Models contain key-value data and custom events, and collections provide a rich API for working with collections of models. Views handle user interface elements and connect events to methods. The document describes how Backbone components like models, collections, routers and views work together to build a simple todo list application.
Your code sucks, let's fix it - DPC UnConRafael Dohms
How do you measure the quality of your code? Performance and testing are just one aspect of code, in order to meet deadlines and make maintenance quicker you also need your code to be readable, decoupled and generally easier to comprehend and work with. This talk will go over tips and exercises to help you identify trouble areas, refactor them and train you to write better code in future projects. Come make your code look and function better.
This document provides an overview of Backbone.js and how it can be used to build dynamic web applications. It discusses the main Backbone components:
- Models represent single data objects and can be validated.
- Collections hold ordered sets of models and can fetch data from the server.
- Views handle the display and interaction of data from models and collections.
- Routers map URLs to functions that control the application flow.
The document then gives an example of using Backbone to build a simple shopping cart application with Products and Cart views, demonstrating how the components work together.
Luc Bors presented ways to bring common UI patterns to Oracle ADF applications, including implementing tabbed navigation, context menus for tabs, closing tabs, and most recently used functionality. The document also discussed implementing real-time updates using database change notification and the active data framework. Finally, it covered patterns still under investigation such as grouping tabs, drag and drop tabs, duplicating tabs, and adding sticky notes.
Software development is riddled with explicit and implicit costs. Every decision you make has a cost attached to it. When you're writing code, you're making an investment, the size of which will for a long time define the costs of your future growth. Making right decision about these investments is very tricky and the cost of wrong decisions might be crippling for both business and teams that support it.
Extreme Programming and Test Driven Development in particular are practices that are aiming at supporting development effort by making it easier to introduce change. That said, sometimes those tools can become a problem of its own when applied in the wrong way or for the wrong context. Understanding software cost forces is a very important skill of successful teams and something that helps understand how to apply XP and TDD in different contexts.
All projects start with a lot of enthusiasm. As many projects grow the technical debt gets bigger and the enthusiasm gets less. Almost any developer can develop a great project, but the key is maintaining an ever evolving application with minimal technical debt without loosing enthusiasm.
During this talk you will be taken on the journey of application design. The starting point is an application that looks fine but contains lots of potential pitfalls. We will address the problems and solve them with beautiful design. We end up with testable, nicely separated software with a clear intention.
This document discusses the principle of separation of concerns in software engineering. It provides an overview of separation of concerns and how it relates to breaking programs into distinct and separate areas of responsibility. The document then provides several examples of how to apply separation of concerns through different techniques like horizontal separation by layer (presentation, business, data), vertical separation by module, aspect-oriented programming for cross-cutting concerns, and dependency inversion. The benefits highlighted include increased reusability, maintainability, code quality, and understandability of the application.
The document is a presentation on Web Components. It introduces Web Components as a standardized set of browser APIs that allow defining custom HTML elements. It provides an example of creating a tooltip using Web Components. It then discusses benefits like maintainability, reusability and encapsulation. The presentation compares Web Components to frameworks like React and Vue, noting they are not directly comparable. It demonstrates using Web Components to build interactive tabs. Finally, it discusses key Web Component APIs like shadow DOM, custom elements and HTML templates.
The document discusses several design patterns in Ruby including Template Method, Strategy, Observer, Factory, Builder, and Adapter patterns. For each pattern, it provides a code example to illustrate how the pattern can be implemented in Ruby. It focuses on explaining how each pattern works and how it can be applied to solve common programming problems.
1. The document discusses strategies for optimizing software costs, including the costs of introduction, change, and ownership over the lifetime of a project.
2. It emphasizes focusing on optimizing for cost of introduction early on, as this cost is relatively easy to optimize and loses relevance over time. However, cost of change increases exponentially and is most important to optimize for longer-term projects.
3. Cost of ownership involves ongoing maintenance and allows balancing the costs of introduction and change by selectively taking ownership of only necessary logic through techniques like testing and refactoring.
Introduction to CQRS and Event SourcingSamuel ROZE
Event Sourcing is the idea that every state of your application can be represented by a sequence of events. Using these two principles as the heart of a system or an application is quite common but can be challenging if we don’t use the right tools or architecture.
How do you create applications with an incredible level of extendability without losing readability in the process? What if there's a way to separate concerns not only on the code, but on the service definition level? This talk will explore structural and behavioural patterns and ways to enrich them through tricks of powerful dependency injection containers such as Symfony2 DIC component.
The document describes how Angular templates are rendered with local variables and bindings. It shows an example Greeter component with an input and greeting property. The component's template is rendered with a Greeter instance and a local name variable bound to the input. Expressions in the template first check locals then the component class properties. Other examples show ngFor rendering a list and encapsulated shadow DOM rendering.
Devs for Leokz e 7Masters - WTF Oriented ProgrammingFabio Akita
The document discusses WTF oriented programming techniques including:
- Using try/catch blocks to safely access nested object attributes
- Applying the Law of Demeter to avoid violating encapsulation
- Mapping and selecting arrays instead of iterating with each
- Storing translations in locale files instead of hardcoding strings
- Conditional logic to dynamically set form field values
The examples provide concise code snippets that implement various WTF patterns for handling errors, following principles of object-oriented design, and internationalization.
The document discusses refactoring legacy PHP code, specifically dealing with code that has no separation between PHP and HTML. It recommends separating code into controllers and views by gathering all code, separating controller and view code, assigning variables to a view object, changing variable references in the view code, and splitting the files. Specific problems in legacy PHP code like no separation of concerns, global variables, and reliance on includes can be addressed through techniques like creating view classes, encapsulating logic in objects, and wrapping includes in functions to untangle dependency webs. The goal is to safely change code implementation without changing behavior through refactoring.
This document describes the Database Abstraction Layer (DBTNG) introduced in Drupal 7. DBTNG provides a unified API for database queries that works across different database backends like MySQL, PostgreSQL, and SQLite. It supports both static and dynamic queries. Static queries use placeholders and prepared statements for security, while dynamic queries are built programmatically using a query builder object. Methods are provided for SELECT, INSERT, UPDATE, DELETE, and MERGE queries. Transactions and reading from slave databases are also supported.
WordCamp Denver 2012 - Custom Meta BoxesJeremy Green
Jeremy Green gave a presentation on developing with custom meta boxes in WordPress. He explained that custom meta boxes allow adding custom data to posts and pages in the administrative interface. He demonstrated how to add a custom meta box to a plugin or theme using add_meta_box(), and how to create input fields, save the data, and retrieve the custom field values. The presentation included tips for using custom meta boxes such as prefixing field names with underscores and using delete_post_meta() to remove fields.
The document discusses jQuery features including:
- The end() command which can be used to traverse back through filtered elements.
- Computed values which allow setting CSS properties with a callback function.
- The map() utility which can be used to project arrays and array-like objects.
- Custom events which allow decoupling code by triggering named events.
- Deferred objects which provide a cleaner way to handle asynchronous callbacks and queues.
Backbone.js is a JavaScript framework that aims to solve issues with messy JavaScript code by implementing an MVC pattern and object-oriented principles, providing structure through core concepts like Models for data storage, Collections for grouping Models, and Views for rendering display logic, as well as a Router for navigation. It is lightweight at only 6kb and supports RESTful JSON APIs and event-driven programming.
Javascript & jQuery: A pragmatic introductionIban Martinez
This document provides an introduction to Javascript and jQuery. It covers Javascript data types including numbers, strings, Booleans, null/undefined, and arrays. It then covers jQuery topics like jQuery objects, selectors, CSS manipulation, events including ready and load, and AJAX/JSON requests using both asynchronous and synchronous modes. It includes examples for working with numbers, strings, selectors, events, AJAX calls and shortcuts. The document aims to provide a pragmatic introduction to Javascript and jQuery concepts and functionality.
We, as developers, often think that we don’t have to or don’t need to know what are what they call design patterns. We think that we already know how to build a software and don’t need all this theory. Years after years, by having to deal with the low maintainability of my own codebases, I explored a lot of ways of decoupling applications, in order to have enterprise-grade software that last for years. With concrete examples, I want to share with you some design patterns and how they can help you to grow well structured and decoupled applications.
Backbone is a JavaScript framework that provides models, collections, and views for building single-page web applications. Models contain key-value data and custom events, and collections provide a rich API for working with collections of models. Views handle user interface elements and connect events to methods. The document describes how Backbone components like models, collections, routers and views work together to build a simple todo list application.
Your code sucks, let's fix it - DPC UnConRafael Dohms
How do you measure the quality of your code? Performance and testing are just one aspect of code, in order to meet deadlines and make maintenance quicker you also need your code to be readable, decoupled and generally easier to comprehend and work with. This talk will go over tips and exercises to help you identify trouble areas, refactor them and train you to write better code in future projects. Come make your code look and function better.
This document provides an overview of Backbone.js and how it can be used to build dynamic web applications. It discusses the main Backbone components:
- Models represent single data objects and can be validated.
- Collections hold ordered sets of models and can fetch data from the server.
- Views handle the display and interaction of data from models and collections.
- Routers map URLs to functions that control the application flow.
The document then gives an example of using Backbone to build a simple shopping cart application with Products and Cart views, demonstrating how the components work together.
Luc Bors presented ways to bring common UI patterns to Oracle ADF applications, including implementing tabbed navigation, context menus for tabs, closing tabs, and most recently used functionality. The document also discussed implementing real-time updates using database change notification and the active data framework. Finally, it covered patterns still under investigation such as grouping tabs, drag and drop tabs, duplicating tabs, and adding sticky notes.
Software development is riddled with explicit and implicit costs. Every decision you make has a cost attached to it. When you're writing code, you're making an investment, the size of which will for a long time define the costs of your future growth. Making right decision about these investments is very tricky and the cost of wrong decisions might be crippling for both business and teams that support it.
Extreme Programming and Test Driven Development in particular are practices that are aiming at supporting development effort by making it easier to introduce change. That said, sometimes those tools can become a problem of its own when applied in the wrong way or for the wrong context. Understanding software cost forces is a very important skill of successful teams and something that helps understand how to apply XP and TDD in different contexts.
All projects start with a lot of enthusiasm. As many projects grow the technical debt gets bigger and the enthusiasm gets less. Almost any developer can develop a great project, but the key is maintaining an ever evolving application with minimal technical debt without loosing enthusiasm.
During this talk you will be taken on the journey of application design. The starting point is an application that looks fine but contains lots of potential pitfalls. We will address the problems and solve them with beautiful design. We end up with testable, nicely separated software with a clear intention.
This document discusses the principle of separation of concerns in software engineering. It provides an overview of separation of concerns and how it relates to breaking programs into distinct and separate areas of responsibility. The document then provides several examples of how to apply separation of concerns through different techniques like horizontal separation by layer (presentation, business, data), vertical separation by module, aspect-oriented programming for cross-cutting concerns, and dependency inversion. The benefits highlighted include increased reusability, maintainability, code quality, and understandability of the application.
The document is a presentation on Web Components. It introduces Web Components as a standardized set of browser APIs that allow defining custom HTML elements. It provides an example of creating a tooltip using Web Components. It then discusses benefits like maintainability, reusability and encapsulation. The presentation compares Web Components to frameworks like React and Vue, noting they are not directly comparable. It demonstrates using Web Components to build interactive tabs. Finally, it discusses key Web Component APIs like shadow DOM, custom elements and HTML templates.
The document discusses several design patterns in Ruby including Template Method, Strategy, Observer, Factory, Builder, and Adapter patterns. For each pattern, it provides a code example to illustrate how the pattern can be implemented in Ruby. It focuses on explaining how each pattern works and how it can be applied to solve common programming problems.
1. The document discusses strategies for optimizing software costs, including the costs of introduction, change, and ownership over the lifetime of a project.
2. It emphasizes focusing on optimizing for cost of introduction early on, as this cost is relatively easy to optimize and loses relevance over time. However, cost of change increases exponentially and is most important to optimize for longer-term projects.
3. Cost of ownership involves ongoing maintenance and allows balancing the costs of introduction and change by selectively taking ownership of only necessary logic through techniques like testing and refactoring.
Introduction to CQRS and Event SourcingSamuel ROZE
Event Sourcing is the idea that every state of your application can be represented by a sequence of events. Using these two principles as the heart of a system or an application is quite common but can be challenging if we don’t use the right tools or architecture.
How do you create applications with an incredible level of extendability without losing readability in the process? What if there's a way to separate concerns not only on the code, but on the service definition level? This talk will explore structural and behavioural patterns and ways to enrich them through tricks of powerful dependency injection containers such as Symfony2 DIC component.
The document describes how Angular templates are rendered with local variables and bindings. It shows an example Greeter component with an input and greeting property. The component's template is rendered with a Greeter instance and a local name variable bound to the input. Expressions in the template first check locals then the component class properties. Other examples show ngFor rendering a list and encapsulated shadow DOM rendering.
Devs for Leokz e 7Masters - WTF Oriented ProgrammingFabio Akita
The document discusses WTF oriented programming techniques including:
- Using try/catch blocks to safely access nested object attributes
- Applying the Law of Demeter to avoid violating encapsulation
- Mapping and selecting arrays instead of iterating with each
- Storing translations in locale files instead of hardcoding strings
- Conditional logic to dynamically set form field values
The examples provide concise code snippets that implement various WTF patterns for handling errors, following principles of object-oriented design, and internationalization.
The document discusses refactoring legacy PHP code, specifically dealing with code that has no separation between PHP and HTML. It recommends separating code into controllers and views by gathering all code, separating controller and view code, assigning variables to a view object, changing variable references in the view code, and splitting the files. Specific problems in legacy PHP code like no separation of concerns, global variables, and reliance on includes can be addressed through techniques like creating view classes, encapsulating logic in objects, and wrapping includes in functions to untangle dependency webs. The goal is to safely change code implementation without changing behavior through refactoring.
This document describes the Database Abstraction Layer (DBTNG) introduced in Drupal 7. DBTNG provides a unified API for database queries that works across different database backends like MySQL, PostgreSQL, and SQLite. It supports both static and dynamic queries. Static queries use placeholders and prepared statements for security, while dynamic queries are built programmatically using a query builder object. Methods are provided for SELECT, INSERT, UPDATE, DELETE, and MERGE queries. Transactions and reading from slave databases are also supported.
WordCamp Denver 2012 - Custom Meta BoxesJeremy Green
Jeremy Green gave a presentation on developing with custom meta boxes in WordPress. He explained that custom meta boxes allow adding custom data to posts and pages in the administrative interface. He demonstrated how to add a custom meta box to a plugin or theme using add_meta_box(), and how to create input fields, save the data, and retrieve the custom field values. The presentation included tips for using custom meta boxes such as prefixing field names with underscores and using delete_post_meta() to remove fields.
The document discusses jQuery features including:
- The end() command which can be used to traverse back through filtered elements.
- Computed values which allow setting CSS properties with a callback function.
- The map() utility which can be used to project arrays and array-like objects.
- Custom events which allow decoupling code by triggering named events.
- Deferred objects which provide a cleaner way to handle asynchronous callbacks and queues.
Backbone.js is a JavaScript framework that aims to solve issues with messy JavaScript code by implementing an MVC pattern and object-oriented principles, providing structure through core concepts like Models for data storage, Collections for grouping Models, and Views for rendering display logic, as well as a Router for navigation. It is lightweight at only 6kb and supports RESTful JSON APIs and event-driven programming.
Stop Making Excuses and Start Testing Your JavaScriptRyan Anklam
The document provides tips for adding testing to JavaScript projects. It recommends choosing a testing environment and dialect, then setting up the tests by installing dependencies and configuring files. Common issues like testing asynchronous code and methods that call other methods can be addressed with spies, stubs, mocks and promises. Tests should focus on isolated units of code and avoid direct DOM manipulation when possible. Automating testing through build tools like Grunt and Testem helps to easily run and watch tests. Overall, the document emphasizes making testing easy by writing maintainable, modular code and setting up automation.
Taming that client side mess with Backbone.jsJarod Ferguson
Backbone.js gives structure to web applications by providing models, collections, views and connecting them to APIs. It includes models for representing and handling data, collections for managing multiple models, views for presenting data and handling user interaction, and connects everything to APIs. Using Backbone avoids callback soup and keeps logic separated. Many large sites use Backbone including GitHub, Medium, and Uber.
The document defines a fib function that recursively calculates Fibonacci numbers and prints the 10th Fibonacci number. It then defines some unit tests for a Calculator class that test the add method by asserting the expected result. Finally, it defines some unit tests for a User class that test validating a user object.
The document discusses several key aspects of JavaScript functions including:
1. Functions can be defined in 3 ways - with the function keyword, a function expression, or a function declaration.
2. Closures allow functions to access variables from outer scopes even after the outer function has closed. This allows functions to cache values.
3. Functions are objects that can be passed around and assigned to variables like any other object.
4. Prototypal inheritance is used in JavaScript to inherit properties and methods from one object to another using prototypes.
5. The this keyword is dynamically bound based on the invocation context of a function. Understanding how this works is important for using objects correctly.
This document discusses various jQuery secrets including:
1. Utilities for saving and removing state from DOM elements using jQuery.data() and jQuery.removeData().
2. Hidden events like getData, setData, and changeData that are emitted when data is read, set, or changed on an element.
3. Extending jQuery with custom functions, properties, and AJAX shortcuts.
4. Binding custom events and namespaces, self-defined animation speeds, and extending jQuery plugins.
The document discusses techniques for writing clean JavaScript code. It provides examples of code smells and improvements to address issues like attaching events from the outside, separating selection from logic, shallow scope, overwriting default behavior, and separating logic from views. The document advocates for practices like modularizing functions, separating DOM manipulation from models, and creating model objects to represent DOM elements rather than directly manipulating the DOM. It encourages learning clean JavaScript techniques to write better structured and more maintainable code.
This document summarizes jQuery secrets presented by Bastian Feder. It discusses utilities like jQuery.data() and jQuery.removeData() for saving and removing state on DOM elements. It also covers AJAX settings, events, extending jQuery, and jQuery plugins. The presentation provides code examples for working with data, events, namespaces, AJAX, and extending jQuery functionality.
Building complex User Interfaces with Sitecore and ReactJonne Kats
- React is a JavaScript library developed by Facebook that is used by companies like AirBnb, Netflix, and Twitter.
- React focuses only on the view layer of MVC.
- It uses a virtual DOM for rendering UI rather than directly manipulating the real DOM, allowing for faster re-renders and more efficient change detection.
Silex is a brand new PHP 5.3 micro framework built on top of the Symfony2 de decoupled components. In this session, we will discover how to build and deploy powerful REST web services with such a micro framework and its embedded tools.
The first part of this talk will introduce the basics of the REST architecture. We fill focus on the main concepts of REST like HTTP methods, URIs and open formats like XML and JSON.
Then, we will discover how to deploy REST services using most of interesting Silex tools like database abstraction layer, template engine and input validation. We will also look at unit and functional testing frameworks with PHPUnit and HTTP caching with Edge Side Includes and Varnish support to improve performances.
Adding Dependency Injection to Legacy ApplicationsSam Hennessy
Dependency Injection (DI) is a fantastic technique, but what if you what to use dependency injection in your legacy application. Fear not! As someone who as done this very thing, I will show how you can successful and incrementally add DI to any application. I will present a number of recipes and solutions to common problems and give a tour of the various PHP DI projects and how they can help.
This session introduces most well known design patterns to build PHP classes and objects that need to store and fetch data from a relational databases. The session will describe the difference between of the Active Record, the Table and Row Data Gateway and the Data Mapper pattern. We will also examine some technical advantages and drawbacks of these implementations. This talk will expose some of the best PHP tools, which ease database interactions and are built on top of these patterns.
The document discusses MontageJS bindings and how they can be used to define relationships between object properties. It provides examples of different types of bindings including property bindings, map bindings, and array range bindings. It also previews upcoming changes to how bindings will be defined and array operations will work.
This document contains a summary of jQuery secrets presented by Bastian Feder. It discusses various techniques including saving and removing state from DOM elements using jQuery.data() and jQuery.removeData(), extending jQuery functionality through plugins, and customizing AJAX requests and event handling. The presentation provides code examples for working with jQuery's data storage methods, namespaces, promises/deferreds, global AJAX settings, and extending jQuery.
Building Evented Single Page ApplicationsSteve Smith
Building single page applications has always seemed like a dark art. Guess what? It's not. The key is really simple—let the URL dictate everything. I'll show how to use the window location's hash in combination with jQuery's event system to drive your entire application, from link clicks to form submissions to history management and beyond.
Building evented single page applicationsSteve Smith
Building single page applications has always seemed like a dark art. Guess what? It's not. The key is really simple—let the URL dictate everything. I'll show how to use the window location's hash in combination with jQuery's event system to drive your entire application, from link clicks to form submissions to history management and beyond.
jQuery: out with the old, in with the newRemy Sharp
This document provides an overview and introduction to jQuery. It discusses understanding jQuery and its core functionality as a DOM library. It covers selecting elements, DOM navigation/filtering, debugging selectors, new features like deferreds/promises in jQuery's Ajax functionality. It also discusses best practices like letting the browser handle effects natively when possible, proper use of document ready, and designing well-behaved jQuery plugins.
The document discusses unit testing Zend Framework applications. It begins by explaining the importance of testing and some common excuses for not testing. It then provides examples of setting up PHPUnit configuration and bootstrap files for testing Zend Framework applications. The document demonstrates how to write tests for Zend Forms and models, including testing with both valid and invalid data. It shows how to modify models to add validation filters and validators.
Similar to Modern JavaScript Engine Performance (20)
How to Setup Default Value for a Field in Odoo 17Celine George
In Odoo, we can set a default value for a field during the creation of a record for a model. We have many methods in odoo for setting a default value to the field.
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...EduSkills OECD
Andreas Schleicher, Director of Education and Skills at the OECD presents at the launch of PISA 2022 Volume III - Creative Minds, Creative Schools on 18 June 2024.
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...indexPub
The recent surge in pro-Palestine student activism has prompted significant responses from universities, ranging from negotiations and divestment commitments to increased transparency about investments in companies supporting the war on Gaza. This activism has led to the cessation of student encampments but also highlighted the substantial sacrifices made by students, including academic disruptions and personal risks. The primary drivers of these protests are poor university administration, lack of transparency, and inadequate communication between officials and students. This study examines the profound emotional, psychological, and professional impacts on students engaged in pro-Palestine protests, focusing on Generation Z's (Gen-Z) activism dynamics. This paper explores the significant sacrifices made by these students and even the professors supporting the pro-Palestine movement, with a focus on recent global movements. Through an in-depth analysis of printed and electronic media, the study examines the impacts of these sacrifices on the academic and personal lives of those involved. The paper highlights examples from various universities, demonstrating student activism's long-term and short-term effects, including disciplinary actions, social backlash, and career implications. The researchers also explore the broader implications of student sacrifices. The findings reveal that these sacrifices are driven by a profound commitment to justice and human rights, and are influenced by the increasing availability of information, peer interactions, and personal convictions. The study also discusses the broader implications of this activism, comparing it to historical precedents and assessing its potential to influence policy and public opinion. The emotional and psychological toll on student activists is significant, but their sense of purpose and community support mitigates some of these challenges. However, the researchers call for acknowledging the broader Impact of these sacrifices on the future global movement of FreePalestine.
A Visual Guide to 1 Samuel | A Tale of Two HeartsSteve Thomason
These slides walk through the story of 1 Samuel. Samuel is the last judge of Israel. The people reject God and want a king. Saul is anointed as the first king, but he is not a good king. David, the shepherd boy is anointed and Saul is envious of him. David shows honor while Saul continues to self destruct.
2. WEB
fast
means fast
JavaScript
One of the most important factors to a good user
experience is fast execution of web pages. This means :
• Compilation
• Fast Interpreting
• Fast Memory Access
• Fast Garbage Collection
4. because THIS
function init() {
alert(“hello user”);
}
is slowly becoming...
5. (function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var
validator=$.data(this[0],'validator');if(validator){return validator;}validator=new
$.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.setti
ngs.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function
handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input
type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentF
orm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return
handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return
validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return
valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return
result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var
existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument
.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return
existingRules;}var filtered={};$.each(argument.split(/s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var
data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);i
f(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return
data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(""+a.value);},filled:function(a){return!!$.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form
){this.settings=$.extend({},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1)return function(){var
args=$.makeArray(arguments);args.unshift(source);return
$.validator.format.apply(this,args);};if(arguments.length>2&¶ms.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(par
ams,function(i,n){source=source.replace(new RegExp("{"+i+"}","g"),n);});return
this
source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),on
submit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhi
ghlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in
this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in
this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);else if(element.parentNode.name in
this.submitted)this.element(element.parentNode)},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,err
orClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is
required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date
(ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value
again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0}
characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and
{1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to
{0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.current
Form);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset
();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/s/),function(index,name){groups[name]=key;});});var
rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var
validator=$.data(this[0].form,"validator");validator.settings["on"+event.type]&&validator.settings["on"+event.type].call(validator,this[0]);}$(this.currentForm).delegate("focusin focusout
keyup",":text, :password, :file, select, textarea",delegate).delegate("click",":radio, :checkbox, select, option",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-
form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).trigg
erHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var
i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return
this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var
result=this.check(element);if(result){delete
this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return
result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in
errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in
errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm(
);this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return
this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return
this.size()==0;},size:function(){return
this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus();}catch(e){}}},findLast
Active:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var
validator=this,rulesCache={};return
$([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&co
6. With the evolution of complex applications, browsers need to keep up
to be able to deliver what developers need in terms of performance.
DONE?
what
can
be
most modern browsers employ optimization techniques such as:
• compiling source code into byte-code or native code
• fast source code / byte code inerpreting
• hidden classes
• fast property access
• fast garbage collection
• type optimisation
• many others
8. HOW WE
TESTED
purpose
mathematical operations
identifier resolution
data access
built arrays
regex
tests strings
DOM
SHA1
canvas
also, the V 8 Benchmark Suite
9. MATH
HOW?
• primitive operations such as addition, multiplication
• bitwise operations
• built in functions
WHY?
• speed of compiled code
• bytecode versus native code
• optimization of built in functions
10. Identefier
resolution
WHY? because of
the scope chain
higher recursion depth means
slow access times for
variables which are not locally
defined.
HOW?
1. create a large scope chain
2. test time need to read / write memory from
variabiles situated on the highes activation object
11. Data access HOW?
by testing time needed to read /
write properties from an object in
both their forms
WHY?
to test hidden class creation, hash based
property lookups, inline caching and time
needed to resolve false identifications of
object type
12. ARRAYS
WHY?
to test memory access for
compiled code for
contiguous zones of
memory
1. create large arrays
2. test memory access and traversal times
HOW? 3.
4.
5.
concatenation
reversing
joining
6. removing elements
13. RegEX
• some browsers create native
code which are used to solve
specific regular expressions
• only viabile for long strings
WHY?
HOW?
• repeated solving of patterns of average complexity
in a string of average length.
14. DOM
due to the live nature of HTMLELements and
WHY?
HTMLCollections, objects and querries need
constant update when properties are changed
making simple thinks as property access
VERY slow.
HOW?
HTMLCollection creation
attribute modification
tree traversal
element searching
15. STRINGS
string conversion and manipulation is very
important in a JavaScript program as it is a
WHY?
common way to do type conversion and
transforming raw data into a human readable
form
string conversion
HOW? concatenation
index based search
splitting
16. SHA1
WHY?
because more
MATH HOW?
SHA1 contains a multitude
of complex primitive math
and bitwise operation making
them perferct to test execution
speed of byte code / native compiled
code
19. MATH
moste browsers use some form of source compilation
into either intermediate bytecode or native machine
WHY?
code.
this means that most primitive calculations take
toughly the same time across all browsers, apart from
a few anomalies
YES we retested Firefox under windows and linux, but
no change was recorded.
20. Identefier
resolution
the top browsers managed to have constant look-up
time regardless of recursion depth and the size of
WHY?
the scope chain.
bottom browsers however were affected heavely by
recursion depth
21. DATA
access
most modern JavaScript engines use hidden
WHY?
classes or a method of inline caching the
adress of previously searched properties
this makes the performance among all
browsers closer than in other tests
22. ARRAYS
as with most benchmarks used, a very important
factor in performance is the speed of the
WHY?
compiled source code
accessing contiguous zones of memory is made
faster by knowing the exact location of every
member in an array, characteristic brough by
bytecode or native machine code
23. RegEX
some JavaScript engines use special techniques
to optimize regular expression solving.
some compile the entire source code, some just
WHY?
create specialized blocks of machine code
specifically for regular expressions.
due to the average length of the expression and
text, the time needed to compile the source code
did not surpass the time needed to solve the
expression
24. STRINGS
the strings test saw the closest range of result, only a
WHY?
27% difference bretween the top browser
this is due largely because, passed source
compilation, there isn’t a great range of optimizations
that can be done on string manipulation
25. DOM
Google Chrome and Safari share the same layout
engine, WebKit, which has a major impact on
WHY?
DOM manipulation in JavaScript
this is why they are both at the top with relatively
close performance
26. SHA1
because the SHA1 algorithm is comprised of mostly
WHY?
primitive mathematical and bitwise operations
this test was a continuation of the Math test, seeing
similar results, with the same uniformly distributed
results
27. CANVAS
the key factor in canvas performance is the utilization
of the GPU to do most of the 2D rendering. This is
WHY?
why the top scorers had the best GPU accelerated
system
it should be noted, that for every browser all systems
related to GPU acceleration were turned on,
enabeling them to extract the maximum performance
they can
28. V8 Benchmark
Suite
It’s no suprise that the Google benchmark suite
had their in-house built browser as the top scorer
WHY? but what about Internet Explorer? The JIT
compiler is only available to the 32 bit version of
the browser, which was not used on the testing
machine (as it has a 64 bit operating system).
30. both development versions (Canary and Nightly managed to improve on it’s current
stable release)
Internet explorer still came last, despite it’s major improvements over its predecessor
31. WANT
MORE ?
visit our wiki page to learn more about the tests performed
http://js-engine-performance.wikidot.com/
Catalin Dumitru colin.dumitru@gmail.com
Iustina Camelia Melinte iustina.melinte@gmail.com