Thursday, May 29, 2014

My php[tek] Schedule


Build your first Symfony2 application (09:00)
Stefan Koopmanschap
My Notes
Their Slides

Hacking Sites for Fun and Profit (14:00)

David Stockton
My Notes
Their Slides


Inside the Tech Challenges of Wikimedia (09:00)
Terry Chay
My Notes
Their Slides

Accelerating Web Applications with Varnish (10:30)
Samantha QuiƱones
My Notes
Their Slides
Adaptive Delivery - The other responsive (12:00)
Josh Trout
My Notes
Their Slides
Building scalable PHP applications using Google’s App Engine (14:00)
Ian Barber

My Notes
Their Slides
Becoming a GoPHPer (15:30)
Paddy Foran
My Notes
Their Slides
JavaScript's Difficult Concepts (17:00)

Jeff Carouth
My Notes
Their Slides

How to Get There (09:00)
Larry Ullman
My Notes
Their Slides
From SQL to noSQL (10:30)

Derick Rethans
My Notes
Their Slides
Obtaining Closure with Anonymous Functions (12:00)
Andrew Cassell
My Notes
Their Slides
How To Be A Great Developer (14:00)
Ed Finkler
My Notes
Their Slides
HHVM in 2014 (15:30)
Elizabeth Marie Smith
My Notes
Their Slides
Groking Browser Performance (17:00)
Josh Holmes
My Notes
Their Slides

Shell Revolution (10:30)
Chris Stone
My Notes
Their Slides

How to Get There - Notes

My Notes From: How to Get There

Walk Long Enough

* Knowledge
    Know Thyself
    Understand Your Brain
    Say "I Don't Know"
    Except That You Could Be Wrong
    Learn How To Ask Questions The Smart Way
    Rethink Brilliance
    Never Stop Learning
    Get Off the Computer

* Experience
    Be Honest
    Fail Quickly
    Learn to Fail Gracefully
    __Add Exception Handling to Your Life__
    Vary Your Strategies
    Watch Your Assumptions
    When You Can, Start Helping Others
    Being a Decent Person Matters

* Money
    Rethink How You Think About Clients
    Communicate Well
    Value Time
    Give It Away
    Do More Than You Say You'll Do

Be Honest
Work Hard
Never Stop Learning

Inside the Tech Challenges of Wikimedia - Notes

My Notes From: Inside the Tech Challenges of Wikimedia
Musics & Silly Video

Inside the Challenges of Wikipedia
PHP Terrorist
Middle Management
Does a good job of upselling talks the rest of the day.

** Frames
Using "Tax Relief" already frames the debate so you win.

*** Core Values
Vision Statement

** Features Engineering
 Visual Editor Team UI/UX
 Affordance (Discovering without thinking)

 Parsoid Team (Parsing)
 JQuery and still JQuery because V8 is fast enough

 Growth Team
 Viral Coefficient
 A/B Testing

 Core Team
 Gameification Habit Loop
 Cognitive Excess (Farmville vs. Wikipedia)
 Echo & Flow (Notification & Messaging)

 Fundraising and Engineering
 Data-Driven Framing
 "X Tagged You In a Photo" - People want photos.
 Data-Informed Framing

 Service Oriented Architecture Framing

 Challenge: Mobile
 He really likes Josh
 Desktop vs Mobile PageViews
 "Dimensionless Numbers" -> Use Comparisons to Other Numbers
 Current mobile strategy was trumped up when compared to global mobile usage.

 Challenge: Resistance to Change
 Arrows Impossibility Theorem
  - unrestrictred domain, non-dicatorship, pareto efficitency, independance of irrelevant alterntaives.
  - Initial distribution of goods is inherently inefficient.

** Parting Shot
Imagine Internet as City
 Public spaces on the Internet (Park, Museum, Church)

* There are only 60,000 users and they are all dicks to each other.

Shell Revolution - Notes

My Notes From: Shell Revolution
*Chris Stone

Black window puts fear in their heart.

Lost Art...

Fish Shell Script - Chris says look into it, but it wasn't his cup of tea.
Screen - Detach and reattach sessions/sockets
MOSH - The MObile SHell
    New, but built by MIT
    Drop In replacement of SSH
    Mac = mobile-shell, Linux = mosh
    No Terminal Scrollback
    Manage virtualization providers
    Support for Docker containers
    Gets rid of "works for me"

PHP straight on the CLI

    Parse and Tranform Text
    sed 's/regexp/replacement/g' inputFile > outputFile
    Find and replaces string and write to new file

    ps ax | grep Dropbox | awk '{print $1}'

    He doesn't like VI very much. Nano is good for quick and dirty work.

Resources - Courses Online


Groking Browser Performance - Notes

My Notes From: Groking Browser Performance
Josh Holmes

* Define Performance
* Web Runtime Architecture
* Performance Measurment Tools
* Demos

Fewer DOM Elements is better
Fewer CSS Rules are better
Fewer Lines of Script

JQuery off the CDN actually makes a big difference.
Performance is a very odd duck.

Network/CPU/GPU are important things to think about.

Web Runtime Archetecture Flow Chart (Networking to Compositing)
6 items are able to be loaded from a server at the same time.
More subdomains -> More connections available
If you had wildcard subdomains would that just be really awesome?

DOM Tree -> CSS -> JS -> DOM API
Layout is just a great game of Tetris

JS rewriting the DOM can cause rewrite thrashing.
60hz = 60fps

F12 Developer Tools

UI Responsiveness Tool

If you aren't going to use a script code don't include it.
It'll affect render time even if it does nothing.

You can check for Memory leaks by taking memory snapshots and comparing

requestAnimationFrame will allow things to run at the current framerate

Creating a valid display tree can take a long time.
Be careful how you ask for it.

Debugger can ignore any library code so it doesn't get debugged.
You don't have to walk through minified code... because that's terrible.

HHVM in 2014 - Notes

My Notes From: HHVM in 2014
HipHop Compiled PHP to C
JIT (Just In Time Compiler)
HPHPc is dead.
Runs anywhere on 64-bit x86 Linux
Plug and Pray.

Splat and Variadics Syntax

Easy to install on Ubunutu (Binaries!)
45 Dependancies

Working on making it more open source.
Pushing people toward FastCGI Drop in.

HHVM Bytecode Interpreter
Won't see any performance improvements on a Mac without JIT

"Repo Authoratative Mode" assumes no changes so you get 10% performance gain.

Large Complex codebases show great results.
Quicker response and more responses.

phpng is an official PHP JIT.

Politics of open sourcing
    Feedback from users
    Affect change in the market place
    Cross pollination

Hack -> Google via hacklang/hack.lang
    Strict typing
    Type hinting
    Static analysics

Don't run Hack in strict because it'll say your code is BAD BAD BAD
Run in partial mode so it'll behave.
Change the syntax in your file by putting a comment after
Constructor arg promotion
    Removes a bit of boiler plate code.
    Placeholders for type are allowed
    Specialized array objects, not just an Array/Hash Table
Async Functions
    Implementation isn't complete
XHtml for PHP
    Sees complete blocks of HTML as long as they are properly formatted/closed
    Don't need to use double quotes

HPHPd -> Debugger

    Normally Messy
    You can write a HHVM extension in PHP
    You can write parts of an HHVM extension in C++ because blurring lines is fun.

PHP is Edgecase hell due to lack of a spec.
Compatibility layer for PECL extensions.
No Name Parameters

How To Be A Great Developer - Notes

My Notes From: How To Be A Great Developer
C64 Theme

*Practice Empathy

Understand how/why a person feels.
Most important skill.
Don't assume you know how a decision was made.
Keep in mind users and rest of the team.
    Asking questions in a non judgemental way.
    "Can you explain to me why you did things this was?"
    Developers interact with computers on the edgecase.

*Practice Humility

You are wrong about a great many things.
The less you fear being wrong, the more confident you can be.
    Nobody has maxed out thier technical level of expertese.
    Gender/Cultural politics.
Understand what you do well, and what you don't

*Always be Learning

Liberally learn new tech, conservatively use them.
Any tech could be the right choice for the right situation.

*Avoid Tribalism

Make it a safe place.
Choices in tech only search what you make.
Nothing should be absolute (pro or con)
    100% Advertising
X vs Y arguments isn't worth the time.
Loyalty to people, not brands/companies/tech

*Better Your Community

Make other's lives better.
Make the community around you better.

Obtaining Closure with Anonymous Functions - Notes

My Notes From: Obtaining Closure with Anonymous Functions
Andrew Cassell
Loves Closures!
Normal Regular Named Functions. 

$sum = function () { return true; }
echo $sum;

Lambdas are instance of Closure

callable, or Closure are good for type hinting.

Anonymous Functions aren't scary.

function($a) {return $a; }

Lambda and Closures have scope.

$LperGal = 10;
$galToL = function($gallons) use ($LperGal) {
echo $gallons * $LprGal;
echo $galToL(10);

Pass by reference... &$LperGal if you want to edit the value.

Closures have..
--- bind ----
--- __invoice ----

bindTo changes the scope of $this when used inside the function.

Reasons to use.
Don't pollute namespace with functions.
Fewer function names laying around - reduces cruft.
array_map, array_reduce
Dependancy Injection

Don't use function_create or the Closure::bind .... because???

Curry/Database Display using his funky library.
Database ORM thing that's popular in Russia??

Memoization -> the same as caching
Just storing stuff in an array to avoid double computation.

Monads -> MonadPHP
Allows you to focus on just making sure the data you want is available instead
of testing all the data.... I think??

From SQL to noSQL - Notes

My Notes From: From SQL to noSQL
Derick Rethans

Relational Database
    Normalization -> 1NF/2NF/3NF

Key/Val -> MemCache/Redis
Column -> Cassandra/Hadoop
Graph -> neo4j
Document -> CouchDB/MongoDB

Relational Databases value ACI
Theoretical Ideas.

NoSQL solutions value CAP
Consistency/Availability/Partition Tolerance

Must have an _id field
Documents can have embedded documents or embedded arrays.
Duplicated data in a NoSQL is not a bad thing, but more complicated.

Don't need to create database and schemas.
$m = new MongoClient;
$m->dbname->steps->insert([name => 'derick']);

Use single quotes everywhere.
Query operators start with a $ so that can be obnoxious for PHP.
Greater than or Equal -> '$gte'

Inc, Set, Unset, '$addToSet', '$push'

Use and Atomic value like INC (increment) to avoid race conditions.

No Schema, No Schema Validation, No Checks and Balances.
Having a good model becomes very important.

Don't use values as keys. ie derick => 'twitter user'

Not inforced foriegn keys are allowed
IE: blog post content with blog post views
Article collection and Views collection.
Probably keep a Article View Counter in the article collection rather than counting on the view collection.

Master/Slave Replication
Master/Slave Replication with Failover
Multi-Master Replication

Maximum of 12 server in a Replicaset

Eventual Consistency
    Only Gaurantee Perfection by reading from Master
    A delay of seconds to slaves is probably acceptable in most cases.

Wednesday, May 28, 2014

JavaScript's Difficult Concepts - Notes

My Notes From: JavaScript's Difficult Concept
This is all Vanilla JavaScript.
Nothing about JQuery or MooTools or whatever.


Global vs Function
Always use **var** keyword when you name a variable inside a function.
Declare all variables at the top of your function.


The **this** keyword
callbacks are commonly used in JS???

The __this__ keyword and the context within the function depend entirely on how the function was invokes.

The default context will be the global context for functions invoked by name or variable name within the global context.

.call() is how you use __this__ properly. --> Switch the context of this.
.apply() is different.. allows more params??

Using .call and .apply gives you the control you might need over the context inside a function or method

The **ProtoType Chain**
"The most complicated inheritance model ever created"
Classless, Instance Based

// ** Use a Capital Letter for the function name as a Construction
function Person(name) {
    // blah
} = function() {
    return "wah";

Always use Function.prototype to add methods to your constructor functions for performance reasons.

// Extend the Person object
function Dev(name) {, name);
Developer.prototype = Object.create(Person.prototype); // Inherit
Developer.prototype.constructor = Developer; // Override constructor type

// Override = function() {
    return "wooo";

All Objects have the prototype through which we can accompolish inheritcan in JS


Becoming a GoPHPer - Notes

My Notes From: Becoming a GoPHPer
Paddy Foran

* What is It?

Modern Magic C
The language was designed.
No Manifests -> Code should be self documenting
Nothing is automagic
Automate with tools -> Allow Tools to update your code for newer versions
Meant to Innovate Programming Practice
A Philosophy Driven Language rather than a Feature Driven Language.

* What is Wierd?

Go is compiled
Go is a system language, not a web language by design
Packages are the equivalient of Library/Namespaces
"main" is a special package.
It is the entry point.
Packages are imported from code repos
Go uses **structs** instead of Classes -> like JS
Structs can be combined.. that's odd.
Static Typing
Initialization is not assignment i := 0
Garbage Collected normall though.
Scope is pickier about shadowing, but can notify you on compile (modifying inside foreach loop)
Visibility is Lexicographic
    Capitalize first letter in variable makes it public (PublicVariable vs privateVariable)
Pass By Value, not Pass By Reference
You have to use &Pointers to get things to work like we are used to.

* What is Good?

go build -> Build
go test -> Automated Testing using Testing Library
go fmt -> Automated Code formatting
go get -> Fetches the dependancies
race detector, test coverage, profilers
runtime environment is the operating system (actually globally works?)
stdlib http server is production ready
Interfaces are "Duck Taping"
Concurrency: GoRoutines -> Threads
    go RunThisThingThreaded(x, y) // That's concurrent Kyle

* What is Hard?

Static Types
No Frameworks
No time waiting for Go to compile

* After Hours

Vendors -> No specific way to do it. Hopeful the community will make a decision.

Building scalable PHP applications using Google’s App Engine - Notes

My Notes From: Building scalable PHP applications using Google’s App Engine
*Ian Barber
**Google Developer Relations

There's a command line tool for Google stuff.

Scale Up or **Down** based on usage.
Free to start
PaaS, IaaS

GeoLocation is included in the Request.
You don't get to see proper traffic because it isn't a proper server. It's an app.

Normal PHP gd/json/simplexml PHP 5.4.22
Read Only File System (Google Cloud Storage)

Google URL Fetching Service is automatically used for fetching.
Can't use cURL

Modules - His "Single Favorite Thing" about AppEngine
Scaling modules manually (fixed) or basic (max num) allow control

YAML configs.
Handlers are like Mod Rewrite - Redirect everything to index.php
Static Content you need access to, use static_dir config

app yaml
api yaml
dispatch yaml
queue yaml
cron yaml
dos yaml (DDOS)

CloudSQL (MySQL 5.5/5.6)
Cloud Data Store (Schemaless, NoSQL) - FREE TIER!
CDS available via REST API

Reading -
Google_Client() is a bit overly verbose (support for PHP 5.2)
Authentication you may as well use Google_Client for that because it's a huge pain.
Data Store using the Google_Client means highly optimized connection.

Caching -
Memcache - One big pool. No charge for usage. You can pay for fewer evictions by paying for storage.
'Cache-Control' http header. (Classical Gas)

Writing -
Faster if you type your properties (int/string/etc)
Mutation Upsert

Logging -
Developers Console already takes care of it.
syslog writes to the dev console logging

Polymer Ajax -> Just another Buzzword JS/Display Framework?

Sign In -
Oath - PHP Google Service

Deployment - --oauth2 update api.yaml app.yaml
git push appengine master (configure for automatic deployment)

Is the Queue good?
Mostly not. One way queue.
You just submit the request and cross your fingers.

A bunch of "Messaging Stuff" in the pipeline.

Data center closest to the user will start new machines if neccessary.
Cloud Data Service runs similar for closes geography.
CloudSQL is a much more normal VM of a DB.

Adaptive Delivery - The other responsive - Notes

My Notes From: Adaptive Delivery - The other responsive
* The Other Responsive
Responsive -> **Client** adapts the site
    CSS(Media Queries) / Javascript / Single Code Base
    More CSS Code that everybody downloads - More Processing time.
    Less Testing / Less Debugging

Adaptive Delivery -> **Server** adapts the site
    Networking to multiple code bases
    Single code base for different content

Device Definition Library
    WURFL (Community Version) -> Plugin to Apache
    Giant XML file with API

Gannett's Solution
    Dual application with shared library of code
    Network level adaptive delivery handled by Akamai (Same URL)

7" Tablets get Mobile Layout
10" Tablets get Desktop Layout

Lower end mobile devices don't support scroll support, but do have touch.
They use a "..." for clicking instead of scrolling.

And... he's done early.

Accelerating Web Applications with Varnish - Notes

My Notes From: Accelerating Web Applications with Varnish
* About Me
Varnish is the first real revolutionary tech encountered

Static content continues to dominate the web
No One Likes Stale

Dynamic content is expensive to delivery but cheap to maintain

Content Delivery via HTTP (Historical)

Dynamic Backends
Databases! Venerable! Relational!
More and More Complex Databases Start to Be Terrible

SQL Query is Relational Algebra

Eliminate repeated interactions at cost of freshness.
Increases performance of course (throw in front of a DB)
Reddis: Cache and Datastore are starting to merge.
Cacheing proxies

Memcache is developer focused
CDN is not flexible
Static Pre-Rendering
  Just render all files statically and serve those
  Hides terrible performance
Cache Reverse Proxies
  Symfony2 Comes with a Reverse Proxy

Varnish 3 (Varnish 4 exists and is cool/fun)

Virtual Memory is a cache!
Caching-Reverse Proxies.. Squid writes objects to disk, written to memory when requested

Varnish works within the Operating Systems VM.
Trusts the kernel to do the kernel's job.

VCL is Varnish Config Language (You can Inline C Programming if you are crazy)
VCL is compiled into memory and can be hard to configure

-f VCL file to load
-s Config storage
-T Where Varnish listens for admin
-a Where Varnish listens for HTTP

Backend - Apache, NGINX, etc.
Can use a cluster of backends.

Logical clusters of backends

Load Balancing to Varnish Server.
Varnish Server to Load Balanacing to Origin Servers.
Round Robin to a bunch of servers.

Directors are rules that Varnish follows so you can tell Varnish how to run

Kind of Object Oriented VCS. Something about Varnish 4.

Bypass the proxy for local clients.

Pre-defined points in the request-response cycle.

Grace Mode
If it can't access a resouces you can make it return the last available resouce.

Saint Mode
Return expired objects

Managing Varnish
Command Line Interface is available

Purging is pretty simple.
PURGE /obsolete/resource
Clears memory
Not instantly happening

Banning Objects
Never delivery from cache, always origin.
Is Instant, but doesn't clear memor.

gzip/deflate are usually variations of the same thing so no need to try both.

Edge Side Includes
Varnish supports a subset of ESI

Replaying Traffic
A log that can be played on cold Varnish to warm it up

A programming language that you have learn.
Default is an ugly flow chart.
It is C so you can break it easily.

Politico doesn't use memcached now.
All services live behind varnish servers.

Varnish -> Application -> Varnish -> API

VCL has "Objects" that are modular.
Modular Stuff!

Varnish does suport SSL (according to the documenation)

A/B Testing Server Side stuff would be terribly more difficult than the JS stuff we do.

Hacking Sites for Fun and Profit - Notes

My Notes From: Hacking Sites for Fun and Profit
SQL Injection

?id=5 and 1=1
?id=5 and 1=2
?id=5 and substring(@@version)

XSS send session to another site.

Filter Input. Escape Output.

Command Injection
Escape Shell Arg

Code, Regex, Log, LDAP Injection

Session Puzzling

** Admin Password From the Forgot Password Form
Forgot Password with Username "admin" and email of registered user.
Emailed to the user without any problems.

** Registration Form
username1').('email', 'fist2', 'last2', 'x', 'pw2', 'username2'

** Search Input
Passing the input unescaped into a grep command. *; ls -al
gouda *; cat....

** Dev Mode

Hackathon On Wednesday
Get involved in OpenSource and a Project

Build your first Symfony2 application - Notes

My Notes From: Build your first Symfony2 application
** Framework Overview

** History
Standard Distribution

** Use Composer
composer create-project symfony/framework-standard-edition myProject/ 2.4.4

777 app/cache
777 app/logs

app directory is where all the app stuff lives.
bin directory containst a couple binaries
src where all custom code
vendor third party librarires
web is document root

assetic is a thing

use composer again!



** Web Directiory

** Bundles
controllers, entities, views, configs, forms, etc.

** Libraries
Composer install should update all the things.

app console generate:bundle
namespace - then Bundle becuse you need to name bundles "Bundle"

He prefers annotation configuration


app/console cache:clear
sudo app/console cache:clear

** Doctrine Databases
He's having problems... Ooops.

app/console doctrine:generate:create
app/console doctrine:generate:entity

app/console doctrine:schema:update --dump-sql
app/console doctrine:schema:update --force

Doctrine Migrations??
Not going to show you those right now.

app/console doctrine:generate:crud

Doctrine has a soft delete extension.
Remove removes it from the database hard.

Make sure you have a service layer between your controller and doctrine.
It's the best practice.

** Twig!
Define Blocks

** Forms!
Forms! Objects! Validation!
PostType extends AbstractType

Just reviewing the automatically generated code for form.

Group Validators ??

Propel ( is an alternative to Doctrine.

** Services

Creating a PDO service from scratch.
When creating a PDO service don't register a service for "/PDO" but use "PDO" instead

Never inject the container because it's untestable.