Thursday, May 29, 2014

Groking Browser Performance - Notes

My Notes From: Groking Browser Performance
https://joind.in/10620
Josh Holmes
slideshare.net/joshholmes

* 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
https://joind.in/10623
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
    Competition
    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.
Generics
    Placeholders for type are allowed
Collections
    Specialized array objects, not just an Array/Hash Table
    Frozen/Mutable
Async Functions
    Implementation isn't complete
    Parallelizing
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

Extensions
    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
https://joind.in/10624
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.
    UIs/UXs/Tablets

*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 Functionshttps://joind.in/10657
Andrew Cassell
Loves Closures!
Normal Regular Named Functions. 
Boring!

Lambdas
$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..
bindTo
--- 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.
Map/Reduce/Filter
array_map, array_reduce
Database
Currying
Memoization????
Monads
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
https://joind.in/10640
Derick Rethans
@derickr

Relational Database
    Row/Colum/Table/Results
    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

*Document
Must have an _id field
Schemaless
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'

Update
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
Sharding

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 Concepthttps://joind.in/10647
This is all Vanilla JavaScript.
Nothing about JQuery or MooTools or whatever.

*Scope

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

*Context

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??
Yeah!

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
}
Person.prototype.talk = function() {
    return "wah";
}

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

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

// Override
Developer.prototype.talk = function() {
    return "wooo";
}

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

Recommendations!!

Becoming a GoPHPer - Notes

My Notes From: Becoming a GoPHPer
https://joind.in/10650
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.