An obscure but ubiquitous design pattern in PHP development is known as Funky Caching. Using real architectural examples as a lens to look at this one simple PHP design pattern, we see how we can design web architectures that are "organic, democratic, and lasting/"
Inside a Digital Collection: Historic Clothing in OmekaArden Kirkland
In July of 2014, I was invited to present a guest lecture for Foundations of Digital Data (IST676) at the Syracuse University School of Information Studies, taught by Angela U. Ramnarine-Rieks. This talk provides an inside look at creating a digital collection. As this was an online, asynchronous class, I recorded my presentation as a YouTube video, which you can see at http://youtu.be/vYTggDBqBgQ. It includes some discussion of the technical underpinnings of the Omeka site I've created for Vassar's collection of historic clothing, including slides that show my customizations in PHP for showing related items.
Inside a Digital Collection: Historic Clothing in OmekaArden Kirkland
In July of 2014, I was invited to present a guest lecture for Foundations of Digital Data (IST676) at the Syracuse University School of Information Studies, taught by Angela U. Ramnarine-Rieks. This talk provides an inside look at creating a digital collection. As this was an online, asynchronous class, I recorded my presentation as a YouTube video, which you can see at http://youtu.be/vYTggDBqBgQ. It includes some discussion of the technical underpinnings of the Omeka site I've created for Vassar's collection of historic clothing, including slides that show my customizations in PHP for showing related items.
PHP remains the most popular server-side language on the Web and the most favoured language for Web attacks. The security vulnerabilities and attack techniques become more sophisticated though. For example, the vulnerability types PHP Object Instantiation and Phar Deserialization are comparatively unknown to traditional types like XSS and SQLi. In this technical talk, we look at a couple of critical security bugs found in popular open source PHP applications, such as WordPress, WooCommerce and Shopware. We will focus on fundamental design flaws and new state-of-the-art exploitation techniques that are used by attackers to compromise web servers through these issues which can occur in any other application as well.
PHP tutorial for beginners with examples. In this session you will be learning lot of things. Know about the PHP introduction. Begin from basics and find the required details about it. PHP tutorial for beginners is available for you, watch till the end.
Take the help of this PHP admin tutorial for beginners and check the required information. Complete details required to get by you from this session. First know PHP basics and then proceed for other concepts. Greetings from Websoles Strategic Digital Solutions.
PHP remains the most popular server-side language on the Web and the most favoured language for Web attacks. The security vulnerabilities and attack techniques become more sophisticated though. For example, the vulnerability types PHP Object Instantiation and Phar Deserialization are comparatively unknown to traditional types like XSS and SQLi. In this technical talk, we look at a couple of critical security bugs found in popular open source PHP applications, such as WordPress, WooCommerce and Shopware. We will focus on fundamental design flaws and new state-of-the-art exploitation techniques that are used by attackers to compromise web servers through these issues which can occur in any other application as well.
PHP tutorial for beginners with examples. In this session you will be learning lot of things. Know about the PHP introduction. Begin from basics and find the required details about it. PHP tutorial for beginners is available for you, watch till the end.
Take the help of this PHP admin tutorial for beginners and check the required information. Complete details required to get by you from this session. First know PHP basics and then proceed for other concepts. Greetings from Websoles Strategic Digital Solutions.
Learning of Php and My SQL Tutorial | For BeginnersRatnesh Pandey
PHP provides support for the HTTP PUT method used by some clients to store files on a server.
MySQL is a freely available open source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL).
Vibrant Technologies is headquarted in Mumbai,India.We are the best php training provider in Navi Mumbai who provides Live Projects to students.We provide Corporate Training also.We are Best php classes in Mumbai according to our students and corporators
2019-03 PHP without PHP Architecture @ Confooterry chay
An obscure but ubiquitous design pattern in PHP development is known as Funky Caching. Using real architectural examples as a lens to look at this one simple PHP design pattern, we see how we can design web architectures that are "organic, democratic, and lasting"
A sure way to make data and ML work for you in a 10x manner is to start with low-hanging fruit: a recommender system. It's been a useful application of data science to the consumer-facing web since the early days of the internet. This talk explains how one was built to recommend colleges to prospective high school students, the application of popularity tables and collaborative filters, as well as other approaches and the reasons for doing them.
2019-02 The Recommendation Engine @ SunshinePHPterry chay
One of the surest ways to start down that path of making your data science and machine learning work for you is to find low-hanging fruit. Recommender systems have proven to be one of the most useful applications of data science to the consumer-facing web since the earliest days of the internet. This talk covers why and how one was built to recommend colleges to prospective high school students, the application of popularity tables and collaborative filters, as well as other approaches and the reasons for doing them sparkled with some war stories about their success and failures. Hopefully after this you can find how your data can work for your users to transparently improve their interaction with your websites instead of sitting in the back office somewhere helping some executive add graphs to their TPS reports.
2013-08 10 evil things - Northeast PHP Conference Keynoteterry chay
This does not cover the animations or videos, because the Youtube (included) video has bugs related to the builds/transitions, it might be a good idea to download the slides separately and follow along in that window. (When the official conference video is available, I'll upload that instead.)
Abstract: http://www.northeastphp.org/talks/view/156/Keynote-Ten-Evil-Things-Features-Engineering-at-Wikipedia
A framework for understanding what, how, and why Features engineering is done on Wikipedia.
Wikipedia is the 5th largest website on the internet. The problem: the community that builds the "sum of all knowledge" is shrinking.
The goal of Features Engineering is to reverse that editor trend. This talk covers 10 concepts in the modern web that Wikipedia is leveraging to reverse the decline.
10 Evil(ish) Things and how they relate to Features Engineering at the WMFterry chay
Draft of 5 minute talk about Features Engineering for Wikimedia Foundation Monthly Metrics.
Note this is a PDF because Keynote upload is currently broken on SlideShare. I am including the speaker notes because of this. You can view the builds on Youtube: http://www.youtube.com/watch?v=ltqNe-ZyANE&feature=youtu.be
Also the licensing is reserved because a couple of the images I used are not CC-BY-SA, if I have time I'll work on that.)
ome companies are born lucky, and some companies have to make their luck. If your business unfortunately falls into the latter category, the way you make your luck in the Web 2.0 world is through virality. It’s a simple concept: a tiny bit of math, a lot of experimentation, and almost no common sense. Using experiences at three startups, Terry will explain what viral tuning is and how it is done. Learn how mushy business terminology like “hockey stick” and “viral marketing” meets the hard programming reality of building it on your LAMP website.
http://www.oscon.com/oscon2011/public/schedule/detail/18892
2011 07 Living without your Linemen—OSCONterry chay
http://www.oscon.com/oscon2011/public/schedule/detail/18893
If a website architect is the quarterback, then site operations is the offensive line—overworked, underappreciated, and only noticed when it fails. They make you look good. However, four years ago cloud computing networks like Amazon Web Services and Slicehost have appeared. While deficiencies in frameworks in other languages have forced those worlds to adopt Infrastructure-as-a-Service, the PHP world—with it’s ultra-cheap shared-hosting (on one end) and tradition of dominance on some of the most trafficked websites (on the other)—has been slow to move. But as the technology continues to disrupt, modern web engineers will be expected to use their programming skills to not only build, but also provision and maintain fast, scalable websites.
The efficiencies of a web-based language and experience in scalable website architecture offer a unique opportunity for programmers to transfer their skills when wearing a sysop hat. Not to mention some of the best libraries for programming them are written in PHP! When going from a small pet project to a go-live site, maybe we can learn to live without our linemen.
Take a simple PHP trick and follow it on a huge tangent to the philosophy of good web architecture.
Presentation given as Flash Talk at Automattic Meetup in Seaside on September 2010
Presentation originally a long form, but in the spirit of things, I have cut it down.
Automattic is the company I work for. The company is distributed worldwide and once a year we gather at a remote location and meet face-to-face. This year, all the employees are taking a little time during the meetup to compose and give at least one presentation for each other, talking about any subject we are passionate about.
This is based on <a>a PHP Advent article I wrote almost two years ago</a> and formed a low key presentation. I thought it’d be nice to give a more “traditional” PHP talk at the meetup—but one which I felt the audience at large could relate to.
I hope you enjoy it.
Presentation given as Flash Talk at Automattic Meetup in Seaside on September 2010
Presentation is supposed to be Pecha Kucha style. But due to preparation constraints, it's given as a short form.
Automattic is the company I work for. The company is distributed worldwide and once a year we gather at a remote location and meet face-to-face. This year, all the employees are taking a little time during the meetup to compose and give at least one presentation for each other, talking about any subject we are passionate about.
I started writing this talk a couple years back, and I have never found a venue to actually deliver it. Matt, claims that, “You will not find a friendlier group of people to present to in the world” and that “Everybody has a story.”
This is mine.
Hope you enjoy it.
10 Minute Lightning Talk for the Automattic Meetup at Seaside, September 2010
Automattic is the company I work for. The company is distributed worldwide and once a year we gather at a remote location and meet face-to-face. This year, all the employees are taking a little time during the meetup to compose and give at least one presentation for each other, talking about any subject we are passionate about.
For this presentation I chose the subject of photography. Specifically, taking one photo from start to publish describing how I took the shot and the editing steps I chose.
Like many bloggers—Automattic is also known as WordPress—I’m passionate about photography and I felt that many of the other people it the room might be interested in it also—our founder and CEO’s online handle is “photomatt.”
I hope you enjoy this presentation!
This was the second presentation I gave that day. I composed it just after I finished the first.
Presentation given as Flash Talk at Automattic Meetup in Seaside on September 2010
Presentation is given as an Ignite Talk format (20 slides x 15 seconds/slide = 5 minutes. Autopush.)
Automattic is the company I work for. The company is distributed worldwide and once a year we gather at a remote location and meet face-to-face. This year, all the employees are taking a little time during the meetup to compose and give at least one presentation for each other, talking about any subject we are passionate about.
In the e-mail requesting submissions, Matt mentioned that <a>Scott Berkun “did a very cool post and video on giving ignite talks</a>, so I modelled this talk after that.
Hope you enjoy it.
A PDF version of my slidedeck for the closing keynote at PHP|tek titled "Chinese Proverbs" and given at PHP|tek Chicago in May 2009.
There was no abstract for this talk.
PDF version of my slide deck for "PHP Without PHP" given at International PHP Conference in Berlin, Germany on May 2009
Abstract:
An obscure but ubiquitous design pattern in PHP development is known as Funky Caching. Using real architectural examples as a lens to look at this one simple PHP design pattern, we see how we can design web architectures that are "organic, democratic, and lasting."
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
When stars align: studies in data quality, knowledge graphs, and machine lear...
PHP Without PHP—Confoo
1. PHP without PHP
The Philosophy of
Good Architecture
terry chay
2010-03-10T09:30+0500
Confoo
Montreal, Canada
Thursday, March 18, 2010
An obscure but ubiquitous design pattern in PHP development is known as Funky Caching. Using real architectural examples as a lens to look at this one simple
PHP design pattern, we see how we can design web architectures that are "organic, democratic, and lasting…"
2. Funky Caching
Prologue #1
Thursday, March 18, 2010
Two prologues
3. aka
Thursday, March 18, 2010
Often attributed to Rasmus, but actually invented by Stig First you create an ErrorDocument
line in your apache.conf. What this does is tell the webserver to redirect all missing files to a
PHP script called “error.php” in your directory root. You then create this handler:
Reference:
http://derickrethans.nl/errorhandling/rasmus-trick.html
http://lerdorf.com/tips.pdf
4. aka
ErrorDocument trick
Thursday, March 18, 2010
Often attributed to Rasmus, but actually invented by Stig First you create an ErrorDocument
line in your apache.conf. What this does is tell the webserver to redirect all missing files to a
PHP script called “error.php” in your directory root. You then create this handler:
Reference:
http://derickrethans.nl/errorhandling/rasmus-trick.html
http://lerdorf.com/tips.pdf
5. aka
ErrorDocument trick
Smarter Caching
Thursday, March 18, 2010
Often attributed to Rasmus, but actually invented by Stig First you create an ErrorDocument
line in your apache.conf. What this does is tell the webserver to redirect all missing files to a
PHP script called “error.php” in your directory root. You then create this handler:
Reference:
http://derickrethans.nl/errorhandling/rasmus-trick.html
http://lerdorf.com/tips.pdf
6. aka
ErrorDocument trick
Smarter Caching
… Rasmus’s Trick (Stig’s trick)
Thursday, March 18, 2010
Often attributed to Rasmus, but actually invented by Stig First you create an ErrorDocument
line in your apache.conf. What this does is tell the webserver to redirect all missing files to a
PHP script called “error.php” in your directory root. You then create this handler:
Reference:
http://derickrethans.nl/errorhandling/rasmus-trick.html
http://lerdorf.com/tips.pdf
7. aka
ErrorDocument trick
Smarter Caching
… Rasmus’s Trick (Stig’s trick)
Thursday, March 18, 2010
Often attributed to Rasmus, but actually invented by Stig First you create an ErrorDocument
line in your apache.conf. What this does is tell the webserver to redirect all missing files to a
PHP script called “error.php” in your directory root. You then create this handler:
Reference:
http://derickrethans.nl/errorhandling/rasmus-trick.html
http://lerdorf.com/tips.pdf
8. aka
ErrorDocument trick
Smarter Caching
… Rasmus’s Trick (Stig’s trick)
Go into apache.conf (or .htaccess) and
ErrorDocument 404 /error.php
Thursday, March 18, 2010
Often attributed to Rasmus, but actually invented by Stig First you create an ErrorDocument
line in your apache.conf. What this does is tell the webserver to redirect all missing files to a
PHP script called “error.php” in your directory root. You then create this handler:
Reference:
http://derickrethans.nl/errorhandling/rasmus-trick.html
http://lerdorf.com/tips.pdf
9. Error.PHP
$filepath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); //or $_SERVER['REDIRECT_URL']
$basepath = dirname(__FILE__).DIR_SEP;
// Test to see if you can work with it
if (false) { //…EDIT…
//output a 404 page
include('404.html'); // see http://www.alistapart.com/articles/perfect404/ for tips
return;
}
// Generate the file
// …EDIT…
$data = 'something';
// Don't send 404 back, send 200 OK because this is a pretty smart 404
// not a clueless one! http://www.urbandictionary.com/define.php?term=404
header(sprintf('%s 200', $_SERVER['SERVER_PROTOCOL']));
//Show the file
echo $data;
//Store the page to bypass PHP on the next request. Use a temp file with a
// link trick in order to avoid race conditions between concurrent PHP
// processes.
$tmpfile = tempnam($basepath.'tmp','fc');
$fp = fopen($tmpfile,'w'); //remove the "_" this is crashing my blog syntax hilighter
fputs($fp, $data);
fclose($fp);
@link($basepath.$filepath, $tmpfile); //suppress errors due to losing race
unlink($tmpfile);
Thursday, March 18, 2010
What does this trick do? Basically, when a file doesn’t exist, it gives an opportunity for PHP to
create the data and return it instead of a 404 error page.
The code above is pretty canonical, the only exceptions are where you branch to show the
default error page…
syntax highlighting code:
php_value highlight.string '#b02c04'
php_value highlight.comment '#8e98a6'
php_value highlight.keyword '#96ad53'
#php_value highlight.bg '#f1f7d7'
php_value highlight.default '#524e37'
php_value highlight.html '#95ad53'
10. Error.PHP
$filepath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); //or $_SERVER['REDIRECT_URL']
$basepath = dirname(__FILE__).DIR_SEP;
// Test to see if you can work with it
if (false) { //…EDIT…
//output a 404 page
include('404.html'); // see http://www.alistapart.com/articles/perfect404/ for tips
return;
}
// Generate the file
// …EDIT…
$data = 'something';
// Don't send 404 back, send 200 OK because this is a pretty smart 404
// not a clueless one! http://www.urbandictionary.com/define.php?term=404
header(sprintf('%s 200', $_SERVER['SERVER_PROTOCOL']));
//Show the file
echo $data;
//Store the page to bypass PHP on the next request. Use a temp file with a
// link trick in order to avoid race conditions between concurrent PHP
// processes.
$tmpfile = tempnam($basepath.'tmp','fc');
$fp = fopen($tmpfile,'w'); //remove the "_" this is crashing my blog syntax hilighter
fputs($fp, $data);
fclose($fp);
@link($basepath.$filepath, $tmpfile); //suppress errors due to losing race
unlink($tmpfile);
Thursday, March 18, 2010
What does this trick do? Basically, when a file doesn’t exist, it gives an opportunity for PHP to
create the data and return it instead of a 404 error page.
The code above is pretty canonical, the only exceptions are where you branch to show the
default error page…
syntax highlighting code:
php_value highlight.string '#b02c04'
php_value highlight.comment '#8e98a6'
php_value highlight.keyword '#96ad53'
#php_value highlight.bg '#f1f7d7'
php_value highlight.default '#524e37'
php_value highlight.html '#95ad53'
11. Error.PHP
$filepath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); //or $_SERVER['REDIRECT_URL']
$basepath = dirname(__FILE__).DIR_SEP;
// Test to see if you can work with it
if (false) { //…EDIT…
//output a 404 page
include('404.html'); // see http://www.alistapart.com/articles/perfect404/ for tips
return; Ceheck
}
// Generate the file
// …EDIT…
$data = 'something';
// Don't send 404 back, send 200 OK because this is a pretty smart 404
// not a clueless one! http://www.urbandictionary.com/define.php?term=404
header(sprintf('%s 200', $_SERVER['SERVER_PROTOCOL']));
//Show the file
echo $data;
//Store the page to bypass PHP on the next request. Use a temp file with a
// link trick in order to avoid race conditions between concurrent PHP
// processes.
$tmpfile = tempnam($basepath.'tmp','fc');
$fp = fopen($tmpfile,'w'); //remove the "_" this is crashing my blog syntax hilighter
fputs($fp, $data);
fclose($fp);
@link($basepath.$filepath, $tmpfile); //suppress errors due to losing race
unlink($tmpfile);
Thursday, March 18, 2010
…and where you generate the actual data to render to the user.
12. Error.PHP
$filepath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); //or $_SERVER['REDIRECT_URL']
$basepath = dirname(__FILE__).DIR_SEP;
// Test to see if you can work with it
if (false) { //…EDIT…
//output a 404 page
include('404.html'); // see http://www.alistapart.com/articles/perfect404/ for tips
return;
}
// Generate the file
// …EDIT…
$data = 'something';
// Don't send 404 back, send 200 OK because this is a pretty smart 404
// not a clueless one! http://www.urbandictionary.com/define.php?term=404
header(sprintf('%s 200', $_SERVER['SERVER_PROTOCOL']));
//Show the file
echo $data;
//Store the page to bypass PHP on the next request. Use a temp file with a
// link trick in order to avoid race conditions between concurrent PHP
// processes.
$tmpfile = tempnam($basepath.'tmp','fc');
$fp = fopen($tmpfile,'w'); //remove the "_" this is crashing my blog syntax hilighter
fputs($fp, $data);
fclose($fp);
@link($basepath.$filepath, $tmpfile); //suppress errors due to losing race
unlink($tmpfile);
Thursday, March 18, 2010
At the bottom is where the magic happens. It places the generated file directly into the web
server path. What this means is that the next request to the same web resource goes directly
for that resource without starting up this code and regenerating the data.
Reference:
404 defined: http://en.wikipedia.org/wiki/HTTP_404
404 discussion: http://www.alistapart.com/articles/perfect404/
404 examples: http://www.plinko.net/404/
HTTP codes: http://www.urbandictionary.com/define.php?term=404
13. PHP without PHP
Thursday, March 18, 2010
PHP never gets instantiated after the first request!
At that point it truly becomes PHP without PHP.
14. Paradigms
Prologue #2
Thursday, March 18, 2010
15. Code Complete
The metaphor of Code as
construction comes from this
book…
We now know this is
fundamentally wrong…
Thursday, March 18, 2010
About the book and the metaphor.
The foundation of Steve McConnell’s seminal text, Code Complete, was that software development should be based around the paradigm
of construction. But that was fundamentally flawed because of the mythical man-month—the “man-month” term itself originally coming
from construction work. We now know McConnell was wrong and software isn’t construction, it is engineering. And we’re called “software
engineers,” not “software workers” for this reason: we’re engineers, not construction workers.
16. Mythical Man Month
reorganize notes
too much text
“man-month” is a term from
construction work
The premise is that man and
months are interchangeable.
This means that in order to
reach a deadline I simply add
more people to the project.
Thursday, March 18, 2010
Rhe foundation of Steve McConnell’s seminal text, Code Complete, was that software
development should be based around the paradigm of construction. But that was
fundamentally flawed because of the mythical man-month—the “man-month” term itself
originally coming from construction work. We now know McConnell was wrong and software
isn’t construction, it is engineering. And we’re called “software engineers,” not “software
workers” for this reason: we’re engineers, not construction workers.
18. paritionable
with training
traning + communication
unpartitionable
20
Time to COmplete Title
too much text 15
10
5
Number of People
Thursday, March 18, 2010
19. paritionable
with training
traning + communication
unpartitionable
20
Time to COmplete Title
First consider something like
p a i n t i n g a f e n c e : e v e r y t h i n g much text
too i s 15
partionable (man-month).
10
5
Number of People
Thursday, March 18, 2010
20. paritionable
with training
traning + communication
unpartitionable
20
Time to COmplete Title
First consider something like
p a i n t i n g a f e n c e : e v e r y t h i n g much text
too i s 15
partionable (man-month).
…add a constant time for training. 10
5
Number of People
Thursday, March 18, 2010
21. paritionable
with training
traning + communication
unpartitionable
20
Time to COmplete Title
First consider something like
p a i n t i n g a f e n c e : e v e r y t h i n g much text
too i s 15
partionable (man-month).
…add a constant time for training. 10
…add communication cost: n(n-1)/2.
5
Number of People
Thursday, March 18, 2010
22. paritionable
with training
traning + communication
unpartitionable
20
Time to COmplete Title
First consider something like
p a i n t i n g a f e n c e : e v e r y t h i n g much text
too i s 15
partionable (man-month).
…add a constant time for training. 10
…add communication cost: n(n-1)/2.
5
Compare to the unpartitionable
(single man)
Number of People
Thursday, March 18, 2010
23. paritionable
with training
traning + communication
unpartitionable
20
Time to COmplete Title
First consider something like
p a i n t i n g a f e n c e : e v e r y t h i n g much text
too i s 15
partionable (man-month).
…add a constant time for training. 10
…add communication cost: n(n-1)/2.
5
Compare to the unpartitionable
(single man)
Adding people to a late project
makes it later! Number of People
Thursday, March 18, 2010
24. Engineer and
graphics
Architect
Thursday, March 18, 2010
Software as Engineering vs. other. My title at Tagged is currently “software architect.” And I
have a “radical” idea that maybe titles are that way because they mean something. Meaning
that if I’m hired as a software architect then I should think like an architect and find my
inspiration from architecture.
25. 1 Fallingwater
organic, democratic, plasticity, continuity
Thursday, March 18, 2010
So lets find our inspiration from architecture and see how it explains the Funky Caching
pattern through three buildings. the first is one known as Fallingwater.
References:
Fallingwater logo from: http://www.fallingwater.org/
26. Thursday, March 18, 2010
In Eastern mountain range of the United States there is a house that is CANTILEVERed 40 feet
above a waterfall. This is one of the most famous buildings by American architect, FRANK
LLOYD WRIGHT. In 1991 it was voted as the best all-time work of American architecture by
the American Institute of Architects. Even though it is OVER 80KM from the nearest city
people over a MILLION PEOPLE have traveled to see it.
Reference:
Image from http://commons.wikimedia.org/wiki/File:Falling_Water_01.jpg
Wikipedia: http://en.wikipedia.org/wiki/Fallingwater
Frank Lloyd Wright: http://franklloydwright.org/Home.html
27. …including me
Thursday, March 18, 2010
Yes, including me as a kid. The day it was built, TIME MAGAZINE wrote about it. Because it
was a quintessential example of ORGANIC ARCHITECTURE of FLW.
References:
Der Spiegel: http://en.wikipedia.org/wiki/Der_Spiegel
28. Hatchway Staircase View at the main (living room) level, from the
bridge (from east)
Thursday, March 18, 2010
A staircase connects the house directly to the stream below. The stream and waterfall,
although not seen, can be heard in all parts of the house. The HATCHWAY that consists of
SLIDING GLASS DOORS and the bottom step has no support from below. (FLOAT above like
the water floats)
References:
http://wright-house.com/frank-lloyd-wright/fallingwater-pictures/06E-hatchway-
fallingwater.html
29. Beyond the glass Fallingwater: Living room terraces and glass
walls (from east).
Thursday, March 18, 2010
WINDOWS WRAP AROUND THE ENTIRE BUILDING so that the building MERGES with the
surrounding GREENERY. Similarly the TUNGSTEN LIGHTING and the glasses compliments the
FALL FOLIAGE of the region…
30. Fall Foliage View from lookout, downstream.
Thursday, March 18, 2010
This is the VIEW that FLW planned for the house.
References:
http://wright-house.com/frank-lloyd-wright/fallingwater-pictures/F1SW-fallingwater-in-
fall.html
31. Fall Foliage View from lookout, downstream.
Thursday, March 18, 2010
32. No barriers Detail: corner window at the guest house,
from southeast.
Thursday, March 18, 2010
Panes of glass are caulked directly to each other and to the steel frame or stone walls to
further symbolize the lack of barriers between the construction and the surrounding nature.
References:
http://wright-house.com/frank-lloyd-wright/fallingwater-pictures/34SE-guest-house-
window.html
33. Existing tree The trellis over the driveway is built to
accommodate a tree.
Thursday, March 18, 2010
The driveway trellis has a semi-circular cutaway to accommodate an existing tree.
References:
http://wright-house.com/frank-lloyd-wright/fallingwater-pictures/15-tree-in-trellis-
fallingwater.html
34. Local quarry Living room, west (downstream) side, from
southeast
Thursday, March 18, 2010
The stone floor in the living room, quarried from local rocks
http://wright-house.com/frank-lloyd-wright/fallingwater-pictures/livingroom-
fallingwater.html
35. Existing boulder Living room fireplace and hearth, looking
from kitchen door to south windows
Thursday, March 18, 2010
The rock in the foreground is is an original boulder not disturbed from it’s original position.
References:
http://wright-house.com/frank-lloyd-wright/fallingwater-pictures/7-living-room-fireplace-
hearth.php
36. Existing boulder Living room fireplace and hearth, looking
from kitchen door to south windows
Thursday, March 18, 2010
The rock in the foreground is is an original boulder not disturbed from it’s original position.
References:
http://wright-house.com/frank-lloyd-wright/fallingwater-pictures/7-living-room-fireplace-
hearth.php
37. Thursday, March 18, 2010
From details like these to the whole view taken in at once, one gets a feeling that, in spite of
the SHARP HORIZONTAL AND VERTICAL LINES of the building, the whole lives in harmony with
its environment "instead of lording above [it] in an isolated spot as a man-made imposition.”
Why is this building as recognizable as any NATURAL WONDER?
38. Philosophy
organic,
democratic,
plasticity,
continuity.
Thursday, March 18, 2010
Surveyed the grounds before building. Organic: "form follows function." Wright argued that
"form and function are one." Democratic “design should accommodate needs” Plasticity:
“physical element should remove barriers.” Continuity “element should be part of nature”
39. Why on PHP?
Thursday, March 18, 2010
How prevalent is funky caching? Every time you visit PHP.NET, you use it (need to get the
order of needle-haystack by typing http://php.net/strstr). A cynic would say, because PHP is
so SLOW TO EXECUTE, it needs solutions like this to perform well. The problem with this
argument is that NO WEB LANGUAGE OUTPERFORMS STATIC SERVERS. Becase it trades off
speed of execution with SPEED FOR EASE OF DEVELOPMENT. As Andrei mentioned earlier, that
is fundamental to its design. In fact, all dynamically-typed scripting languages make this
tradeoff.
40. Harmony with Environment
Thursday, March 18, 2010
The ubiquity of this trick in the PHP world is because it—like Frank Lloyd Wright's Fallingwater
—lives in harmony with its environment. The environment is an APACHE WEB SERVER,
persistent data store in the form of a RELATIONAL DATABASE, and the demands of large-
scale, CONSUMER-CENTRIC web sites. Would this solution exist without an ErrorDocument
handler built into Apache? Would this solution exist if we didn't persist content on a
(relatively) slow data store like a database? Would this solution exist if the consumer didn't
demand millisecond response time for dynamic content?
41. Harmony with Environment
Apache web server: ErrorDocument
Thursday, March 18, 2010
The ubiquity of this trick in the PHP world is because it—like Frank Lloyd Wright's Fallingwater
—lives in harmony with its environment. The environment is an APACHE WEB SERVER,
persistent data store in the form of a RELATIONAL DATABASE, and the demands of large-
scale, CONSUMER-CENTRIC web sites. Would this solution exist without an ErrorDocument
handler built into Apache? Would this solution exist if we didn't persist content on a
(relatively) slow data store like a database? Would this solution exist if the consumer didn't
demand millisecond response time for dynamic content?
42. Harmony with Environment
Apache web server: ErrorDocument
Customer-centric: Performance
paramount
Thursday, March 18, 2010
The ubiquity of this trick in the PHP world is because it—like Frank Lloyd Wright's Fallingwater
—lives in harmony with its environment. The environment is an APACHE WEB SERVER,
persistent data store in the form of a RELATIONAL DATABASE, and the demands of large-
scale, CONSUMER-CENTRIC web sites. Would this solution exist without an ErrorDocument
handler built into Apache? Would this solution exist if we didn't persist content on a
(relatively) slow data store like a database? Would this solution exist if the consumer didn't
demand millisecond response time for dynamic content?
43. Harmony with Environment
Apache web server: ErrorDocument
Customer-centric: Performance
paramount
Relational Database: Slow
persistence
Thursday, March 18, 2010
The ubiquity of this trick in the PHP world is because it—like Frank Lloyd Wright's Fallingwater
—lives in harmony with its environment. The environment is an APACHE WEB SERVER,
persistent data store in the form of a RELATIONAL DATABASE, and the demands of large-
scale, CONSUMER-CENTRIC web sites. Would this solution exist without an ErrorDocument
handler built into Apache? Would this solution exist if we didn't persist content on a
(relatively) slow data store like a database? Would this solution exist if the consumer didn't
demand millisecond response time for dynamic content?
44. Harmony with Environment
Apache web server: ErrorDocument
Customer-centric: Performance
paramount
Relational Database: Slow
persistence
Harmony with PHP itself…
Thursday, March 18, 2010
The ubiquity of this trick in the PHP world is because it—like Frank Lloyd Wright's Fallingwater
—lives in harmony with its environment. The environment is an APACHE WEB SERVER,
persistent data store in the form of a RELATIONAL DATABASE, and the demands of large-
scale, CONSUMER-CENTRIC web sites. Would this solution exist without an ErrorDocument
handler built into Apache? Would this solution exist if we didn't persist content on a
(relatively) slow data store like a database? Would this solution exist if the consumer didn't
demand millisecond response time for dynamic content?
45. write text to talk about
it
Architecture of PHP Modern web architecture
Thursday, March 18, 2010
The language itself. PHP is a component of A WHOLE SYSTEM. It’s glue code.
46. PHP is “Cheap”
graphcis money
shorten quote
“A project done in Java will cost 5 times
as much, take twice as long, and be
harder to maintain than a project done
in a scripting language such as PHP or
Perl.”
—Phillip Greenspun
Thursday, March 18, 2010
developer time and resources
47. PHP is “Scalable”
“That a Java servlet performs better
graphics notes?
shortne quote
than a PHP script, under optimal
conditions [has] nothing to do with
scalability. The point is can your
application continue to deliver
consistent performance as volume
increases. PHP delegates all the ‘hard
stuff’ to other systems.”
—Harry Fuecks
Thursday, March 18, 2010
shared-nothing architecture
48. PHP is “Pragmatic”
“PHP is not about purity in CS
graphics
shorten quote
principles or architecture; it is about
solving the ugly web problem with an
admittedly ugly, but extremely
functional and convenient solution. If
you are looking for purity, you are in
the wrong boat. Get out now before
you get hit by a wet cat!”
—Rasmus Lerdorf
Thursday, March 18, 2010
designed to solve the web problem
Could this "ugly, but extremely functional and convenient" web language have been built to
solve anything other than the ugly web problem?
49. 2 Bellefield Towers
Design Hubris
Thursday, March 18, 2010
One block from where my mother used to work, on the corner of Fifth Avenue and Bellefield
in Pittsburgh, stands a strange sight…
50. make video of wpaking
towards?
Thursday, March 18, 2010
If you weren’t in PITTSBURGH IN THE LATE 1980’s you wouldn’t have understood how his could have happened. On this ground
once stood the original Bellefield church built in the 1880’s. Since its CONGREGATION HAD BEEN MOVED further down Fifth
Avenue, the building was sold a century later to developers trying to exploit the new business attracted by the PITTSBURGH
SUPERCOMPUTING CENTER. They wanted to level it and build a new building, but were blocked when people mobilized to SAVE
THE OLD TOWER. The developer then proceeded to honor this by DEMOLISH EVERYTHING BUT THE TOWER and building the
ironically-named “Bellefield Towers” next to it.
51. Gothic Romanesque architecture The current Bellefield Church (two blocks
away)
Thursday, March 18, 2010
This is the current Bellefield Church and an example of city architecture of which the tower is
one of them…
52. Other city towers Allegheny Courthouse Main Tower & Four
Tower Types at Jail (and other towers)
Thursday, March 18, 2010
The center is the county courthouse and jail, the top right is the local Korean church, and the
bottom right is a private residence in the same neighborhood.
53. Tower of
Learning
Within spitting distance of
Bellefield Towers
Thursday, March 18, 2010
54. redo builds
break out slides
quots
Carnegie Library Most iconic moment in baseball history
Thursday, March 18, 2010
The photo at the top is was taken from the Cathedral of learning (previous slide).
55. redo builds
break out slides
quots
Carnegie Library Most iconic moment in baseball history
Thursday, March 18, 2010
The photo at the top is was taken from the Cathedral of learning (previous slide).
56. Why is Bellefield
Towers so Ugly?
Thursday, March 18, 2010
When faced with a gorgeous 100-year old example of the area’s architecture, INSTEAD OF WORKING
WITH THE ENVIRONMENT like Frank Lloyd Wright did with Fallingwater—in the same area of
Pennsylvania no less!—the developer simply sawed it off! The CURVED MODERN ARCHITECTURE of the
TOWERS of the latter serves only to emphasize how it was built with no consideration of the
surrounding environment. I GREW UP WATCHING THIS HAPPEN and it is a LIFE LESSON IN
ARCHITECTURAL HUBRIS.
57. Design Hubris?
break out slides, graphics
Thursday, March 18, 2010
“I’m a developer, I can make the software conform to my needs.”
Oh really? That sounds a lot like trying to “lord over the environment with an isolated man-made
imposition.” “But what I mean is it’s all man-made in software, there is no environment.”
58. Design Hubris?
Frameworks (almost by definition)
break out slides, graphics
Thursday, March 18, 2010
“I’m a developer, I can make the software conform to my needs.”
Oh really? That sounds a lot like trying to “lord over the environment with an isolated man-made
imposition.” “But what I mean is it’s all man-made in software, there is no environment.”
59. Design Hubris?
Frameworks (almost by definition)
break out slides, graphics
Develop in the PHP community?
Thursday, March 18, 2010
“I’m a developer, I can make the software conform to my needs.”
Oh really? That sounds a lot like trying to “lord over the environment with an isolated man-made
imposition.” “But what I mean is it’s all man-made in software, there is no environment.”
60. Design Hubris?
Frameworks (almost by definition)
break out slides, graphics
Develop in the PHP community?
Take over an existing project?
Thursday, March 18, 2010
“I’m a developer, I can make the software conform to my needs.”
Oh really? That sounds a lot like trying to “lord over the environment with an isolated man-made
imposition.” “But what I mean is it’s all man-made in software, there is no environment.”
61. Design Hubris?
Frameworks (almost by definition)
break out slides, graphics
Develop in the PHP community?
Take over an existing project?
Limitations of Site Operations?
Hosting? or Virtual hosting?
Thursday, March 18, 2010
“I’m a developer, I can make the software conform to my needs.”
Oh really? That sounds a lot like trying to “lord over the environment with an isolated man-made
imposition.” “But what I mean is it’s all man-made in software, there is no environment.”
62. Design Hubris?
Frameworks (almost by definition)
break out slides, graphics
Develop in the PHP community?
Take over an existing project?
Limitations of Site Operations?
Hosting? or Virtual hosting?
Business needs trump programmer
desire?
Thursday, March 18, 2010
“I’m a developer, I can make the software conform to my needs.”
Oh really? That sounds a lot like trying to “lord over the environment with an isolated man-made
imposition.” “But what I mean is it’s all man-made in software, there is no environment.”
63. Design Hubris?
Frameworks (almost by definition)
break out slides, graphics
Develop in the PHP community?
Take over an existing project?
Limitations of Site Operations?
Hosting? or Virtual hosting?
Business needs trump programmer
desire?
Dealt with a user request?
Thursday, March 18, 2010
“I’m a developer, I can make the software conform to my needs.”
Oh really? That sounds a lot like trying to “lord over the environment with an isolated man-made
imposition.” “But what I mean is it’s all man-made in software, there is no environment.”
64. add slideshow
…at Tagged
Thursday, March 18, 2010
cover cube story, (where cubes are good- Yahoo, sales, user QA), cover waterfall process
65. …at Tagged break out slides
Thursday, March 18, 2010
When I joined my current company, they had a couple services written in Java, only Zend Accelerator could code cache their PHP 4 installation,
Oracle RAC powered the back-end and development occurred by engineers working in cubes with a relatively heavyweight waterfall development
process.
Even though I prefer Python to Java for services, we’ve increased our Java development to around 40% of our code base! Even though I prefer
MySQL to Oracle, we still use Oracle as our back-end. Even the transition to the open office occurred after it became apparent the company had
outgrown the cube-space.
66. …at Tagged break out slides
Cubes
Thursday, March 18, 2010
When I joined my current company, they had a couple services written in Java, only Zend Accelerator could code cache their PHP 4 installation,
Oracle RAC powered the back-end and development occurred by engineers working in cubes with a relatively heavyweight waterfall development
process.
Even though I prefer Python to Java for services, we’ve increased our Java development to around 40% of our code base! Even though I prefer
MySQL to Oracle, we still use Oracle as our back-end. Even the transition to the open office occurred after it became apparent the company had
outgrown the cube-space.
67. …at Tagged break out slides
Cubes
Waterfall process
Thursday, March 18, 2010
When I joined my current company, they had a couple services written in Java, only Zend Accelerator could code cache their PHP 4 installation,
Oracle RAC powered the back-end and development occurred by engineers working in cubes with a relatively heavyweight waterfall development
process.
Even though I prefer Python to Java for services, we’ve increased our Java development to around 40% of our code base! Even though I prefer
MySQL to Oracle, we still use Oracle as our back-end. Even the transition to the open office occurred after it became apparent the company had
outgrown the cube-space.
68. …at Tagged break out slides
Cubes
Waterfall process
Oracle RAC
Thursday, March 18, 2010
When I joined my current company, they had a couple services written in Java, only Zend Accelerator could code cache their PHP 4 installation,
Oracle RAC powered the back-end and development occurred by engineers working in cubes with a relatively heavyweight waterfall development
process.
Even though I prefer Python to Java for services, we’ve increased our Java development to around 40% of our code base! Even though I prefer
MySQL to Oracle, we still use Oracle as our back-end. Even the transition to the open office occurred after it became apparent the company had
outgrown the cube-space.
69. …at Tagged break out slides
Cubes
Waterfall process
Oracle RAC
Java
Thursday, March 18, 2010
When I joined my current company, they had a couple services written in Java, only Zend Accelerator could code cache their PHP 4 installation,
Oracle RAC powered the back-end and development occurred by engineers working in cubes with a relatively heavyweight waterfall development
process.
Even though I prefer Python to Java for services, we’ve increased our Java development to around 40% of our code base! Even though I prefer
MySQL to Oracle, we still use Oracle as our back-end. Even the transition to the open office occurred after it became apparent the company had
outgrown the cube-space.
70. …at Tagged break out slides
Cubes
Waterfall process
Oracle RAC
Java
PHP4
Thursday, March 18, 2010
When I joined my current company, they had a couple services written in Java, only Zend Accelerator could code cache their PHP 4 installation,
Oracle RAC powered the back-end and development occurred by engineers working in cubes with a relatively heavyweight waterfall development
process.
Even though I prefer Python to Java for services, we’ve increased our Java development to around 40% of our code base! Even though I prefer
MySQL to Oracle, we still use Oracle as our back-end. Even the transition to the open office occurred after it became apparent the company had
outgrown the cube-space.
71. …at Tagged break out slides
Cubes
Waterfall process
Oracle RAC
Java
PHP4
Zend Accelerator
Thursday, March 18, 2010
When I joined my current company, they had a couple services written in Java, only Zend Accelerator could code cache their PHP 4 installation,
Oracle RAC powered the back-end and development occurred by engineers working in cubes with a relatively heavyweight waterfall development
process.
Even though I prefer Python to Java for services, we’ve increased our Java development to around 40% of our code base! Even though I prefer
MySQL to Oracle, we still use Oracle as our back-end. Even the transition to the open office occurred after it became apparent the company had
outgrown the cube-space.
72. Rework
Thursday, March 18, 2010
Book on management by the founders of 37 Signals. Their last book was “Getting Real” about web business.
73. Rework
From the Founders of 37
Signals
Thursday, March 18, 2010
Book on management by the founders of 37 Signals. Their last book was “Getting Real” about web business.
74. Rework
From the Founders of 37
Signals
Thursday, March 18, 2010
Book on management by the founders of 37 Signals. Their last book was “Getting Real” about web business.
75. Rework
From the Founders of 37
Signals
Last Book: “Getting Real”
Thursday, March 18, 2010
Book on management by the founders of 37 Signals. Their last book was “Getting Real” about web business.
76. Rework
Thursday, March 18, 2010
- cliche ridden with few examples “Hannah Montanta” reach for you dreams
- “would rather be celebrities than businesspeople.”
- 'Meetings are toxic.' In reality, good meetings are good and bad meetings are not good (generalization)
- “Planning, they say, is not recommended” - only applies to their business
- “They need to stop behaving like children.”
- “Outside money is plan”, about why you should never take on third-party investors.37signals reveals that it took money from Bezos Expeditions,
the VC company that invests on behalf of the Amazon founder, Jeff Bezos, in 2006.
77. Rework
“Not Just Bad,
but dangerous”
Thursday, March 18, 2010
- cliche ridden with few examples “Hannah Montanta” reach for you dreams
- “would rather be celebrities than businesspeople.”
- 'Meetings are toxic.' In reality, good meetings are good and bad meetings are not good (generalization)
- “Planning, they say, is not recommended” - only applies to their business
- “They need to stop behaving like children.”
- “Outside money is plan”, about why you should never take on third-party investors.37signals reveals that it took money from Bezos Expeditions,
the VC company that invests on behalf of the Amazon founder, Jeff Bezos, in 2006.
78. Rework
“Not Just Bad,
but dangerous”
—John Vincent, Leon
Restaurants
Thursday, March 18, 2010
- cliche ridden with few examples “Hannah Montanta” reach for you dreams
- “would rather be celebrities than businesspeople.”
- 'Meetings are toxic.' In reality, good meetings are good and bad meetings are not good (generalization)
- “Planning, they say, is not recommended” - only applies to their business
- “They need to stop behaving like children.”
- “Outside money is plan”, about why you should never take on third-party investors.37signals reveals that it took money from Bezos Expeditions,
the VC company that invests on behalf of the Amazon founder, Jeff Bezos, in 2006.
79. Solutions Consider
Environment
Thursday, March 18, 2010
Why? Because that is the environment and your solutions have to work within that environment. Anything else is architectural hubris.
Let’s say it is the early days of social networking and you join a company that is using Java/J2EE instead of PHP, or Oracle instead of MySQL, or they’re using Perl/Mason instead of your
favorite (PHP) framework, as Marco mentioned earlier—there are so many to choose from that the number is second only to Java.
Do you go in and say your experience building a CMS or e-store trumps their experience working on a nascent social network? Do you replace all the Java engineers with PHP ones? Do you
replace MySQL with Oracle? Do you rewrite the site from scratch using your favorite framework?
I’m not saying that in all these instances these architects shouldn’t have made the decisions they did. I am not qualified to answer that since I didn’t work at these places.
But what I do know was that in the vast majority of cases, people went in without considering the existing environment. I do know the dynamics of a Facebook.com is different from the
dynamics of Gamespot.com or Amazon.com. I do know a social network is different from a CMS or e-store. And all these solutions are very different from ones in enterprise.
Like building Fallingwater without getting an adequate survey done, every day people make the mistake of not looking before acting. They try to make PHP look like Java with dollar signs,
as Luke mentioned earlier. They expected the environment to conform to their reality so they can lord over it with “some isolated man-made imposition.”
80. 3 Golden Gate Bridge
The Design Pattern
Thursday, March 18, 2010
I’ve long since moved from the woods of Western Pennsylvania to the San Francisco
Peninsula. I am fortunate that my weekly run passes with a near-constant view of the most
recognizable architecture in the American West:
References:
Image licensed from: http://www.istockphoto.com/file_closeup.php?id=6091847
81. design build
quote of goldne gate
bridge
Thursday, March 18, 2010
my weekend run
82. quote from emperor
norton
the other bridge
Thursday, March 18, 2010
What’s interesting is that there are much longer spans in the country and the world. Even in
the same city, there exists a beautiful bridge that is both longer and of more utility. And yet
this bridge represents the icon of San Francisco and of the state as a whole.
85. Same problem,
different pattern
Original design was hybrid
cantilever-suspension.
Replaced by purse
suspension
Thursday, March 18, 2010
The original design was for a hybrid cantilever and suspension structure. But it was replaced
with a pure suspension design because the former was deemed too ugly. A pure suspension
of this length had never been attempted before.
86. Art Deco quote of art deco
movemebnt
Bridge Tower, Lighting,
pedestrial walkway
Thursday, March 18, 2010
Irving Morrow designed the bridge tower, lighting, and pedestrian walkways with an entirely Art Deco decorative influence.
87. International
Orange
Rust colored like the
environment it lives in … and
safe.
Thursday, March 18, 2010
The bridge was painted in a specially formulated anti-rust paint in International Orange on demand
from locals. The War Department, and others. The Navy alone originally demanded it be painted black
with yellow stripes to assure visibility with passing ships. The rust-colored paint evokes the hills of
Marin to the north as well as the setting sun. It is natural and visible enough to be safe.
88. Part of the
whole
Thursday, March 18, 2010
rust-colored suspension-only art deco structure It becomes an icon. Every week I pass by it and am inspired and
thankful I can live in so beautiful a city.
89. Design Patterns
Defined shorten quote
Thursday, March 18, 2010
This quote is the origin of “design pattern.”
90. Design Patterns
Defined shorten quote
“Each pattern describes a
problem which occurs over
and over again in our
environment, and then
describes the core of the
solution to that problem, in
such a way that you can use
this solution a million times
over, without ever doing it
the same way twice.”
Thursday, March 18, 2010
This quote is the origin of “design pattern.”
91. Certainly iconic Me in front of both icons
Thursday, March 18, 2010
But how are we to know which way to do it? Or even if it is the right pattern to be using in our
situation? The answer is found in how both a house in Pennsylvania and a bridge in San Francisco
represent ultimate expressions of architecture. They are wholly appropriate for the environment
in which they stand.
92. blend transition in
stages
Never the same way twice How do you know which one?
How do you know which way?
Thursday, March 18, 2010
A cantilever is wholly appropriate to create the floating look of Fallingwater, but that same
pattern would disrupted the naturalness of the Golden Gate Bridge. When choosing between a
singleton and a global variable, which pattern to use is determined by the environment.
93. Funky Caching again
“search for the closest matching valid
URL and redirect, and use attempted
url text as a DB keyword lookup”
—Rasmus Lerdorf
Thursday, March 18, 2010
the first is in Rasmus’s talk and you can see PHP.NET in others.
94. cleanup text
Thursday, March 18, 2010
At my previous company, we had the problem where images are stored on the database but need to be generated in multiple sizes and thumbnails
and streamed fast to the user. Previews and thumbnails can be dynamically and instantly generated from border parts, primary graphics, colors,
and sample font and text and then stored statically on a server using this method. Stuff may be stored in normal form on the database, but
representations built dynamically and served statically
95. Thursday, March 18, 2010
Address complaint about storing in database…Not all images are stored in the database. In fact, at Tagged, not a single image is stored on a database. However, at Plaxo, the admin tool
to manage ecard content requires the assets be done by a non-developer but the only way of pushing out filesystem changes is through change control and there is little need of user
generated content. In fact, outside e-cards, the entire Plaxo address book database (including the thumbnail photo of yourself) is stored in a database. I’m not the architect of that, nor do
I see much a problem with it.
What I point out you CAN now get away with putting image content on the database again with this trick. That’s pretty impressive because different assets on a site (statics, javascripts,
web pages, user data, application, back-end, corporate site, customer support, etc) are usually managed on an ad hoc basis optimized for the task at hand. Not all of them can resort to
using a filesystem push or web tier restart.
96. Javascript and CSS
put a graphic or some
text
compiling & caching
Thursday, March 18, 2010
Recently, Tagged has run across the very same performance (size and number) issues in
Javascript. The solution: Funky caching hooked up to a javascript compressor powered by a
Java service back-end to dynamically catenate and compress javascripts into a unique URL on
demand.
97. Thursday, March 18, 2010
We recently imported 1/64th of our production data over to the staging environment for testing, but the user’s images would
take too much time and disk space to import. We could just link the images, but then tester’s didn’t know which ones they
uploaded and which ones were proxied from the live website. The solution was to spend an hour writing a Funky Caching Proxy.
If the image was missing, the ErrorDocument handler would try to grav the image from the production website and add a
watermark.
98. Thursday, March 18, 2010
Since this is only for testing, there is no need to waste disk space by storing the created file.
The performance hit of real-time generation of redundant requests is unnoticeable to Quality
Assurance.
99. <?php
$watermark = '3129080702_c4e76f71d7_o.png';
$dead_url = 'http://example.com/dead_image.png';
// {{{ start_image($filename, &$data)
/**
* Creates a gd handle for a valid file
* @param $filename string the file to get
* @param $data array the imagesize
* @return resource GD handle
*/
function start_image($filename, &$data) {
$data = @getimagesize($filename);
if (empty($data)) { return null; }
$data['ratio'] = $data[0]/$data[1]; expand callouts
switch($data[2]) {
case IMG_GIF: return imagecreatefromgif($filename);
case 3: //problem where IMG_PNG is not bound correctly for my install
case IMG_PNG: return imagecreatefrompng($filename);
case IMG_JPG: return imagecreatefromjpeg($filename);
case IMG_WBMP: return imagecreatefromwbmp($filename);
case IMG_XPM: return imagecreatefromxbm($filename);
}
return null;
}
// }}}
$requestimg = $_SERVER['REDIRECT_URL'];
if (!$_SERVER['QUERY_STRING']) {
// redirect user to invalid image
tag_http::redirect($dead_url);
return '';
}
// grab image to temp {{{
$ch = curl_init($_SERVER['QUERY_STRING']);
$tempfile = tempnam('/tmp', 'prod_remote_');
$fp = f_open($tempfile, 'w'); //again delete the "_"
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec_($ch); //delete the final "_"
curl_close($ch);
fclose($fp);
// }}}
Thursday, March 18, 2010
100. <?php
$watermark = '3129080702_c4e76f71d7_o.png';
$dead_url = 'http://example.com/dead_image.png';
// {{{ start_image($filename, &$data)
/**
* Creates a gd handle for a valid file
* @param $filename string the file to get
* @param $data array the imagesize
* @return resource GD handle
*/
function start_image($filename, &$data) {
$data = @getimagesize($filename);
if (empty($data)) { return null; }
$data['ratio'] = $data[0]/$data[1]; expand callouts
switch($data[2]) {
case IMG_GIF: return imagecreatefromgif($filename);
case 3: //problem where IMG_PNG is not bound correctly for my install
case IMG_PNG: return imagecreatefrompng($filename);
case IMG_JPG: return imagecreatefromjpeg($filename);
case IMG_WBMP: return imagecreatefromwbmp($filename);
case IMG_XPM: return imagecreatefromxbm($filename);
}
return null;
}
// }}}
$requestimg = $_SERVER['REDIRECT_URL'];
if (!$_SERVER['QUERY_STRING']) {
// redirect user to invalid image
tag_http::redirect($dead_url);
return '';
}
// grab image to temp {{{
$ch = curl_init($_SERVER['QUERY_STRING']);
$tempfile = tempnam('/tmp', 'prod_remote_');
$fp = f_open($tempfile, 'w'); //again delete the "_"
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec_($ch); //delete the final "_"
curl_close($ch);
fclose($fp);
// }}}
Thursday, March 18, 2010
101. <?php
$watermark = '3129080702_c4e76f71d7_o.png';
$dead_url = 'http://example.com/dead_image.png';
// {{{ start_image($filename, &$data)
/**
* Creates a gd handle for a valid file
* @param $filename string the file to get
* @param $data array the imagesize
* @return resource GD handle
*/
function start_image($filename, &$data) {
$data = @getimagesize($filename);
if (empty($data)) { return null; }
$data['ratio'] = $data[0]/$data[1];
switch($data[2]) {
case IMG_GIF: return imagecreatefromgif($filename);
case 3: //problem where IMG_PNG is not bound correctly for my install
case IMG_PNG: return imagecreatefrompng($filename);
case IMG_JPG: return imagecreatefromjpeg($filename);
case IMG_WBMP: return imagecreatefromwbmp($filename);
case IMG_XPM: return imagecreatefromxbm($filename);
}
return null;
}
// }}}
$requestimg = $_SERVER['REDIRECT_URL'];
if (!$_SERVER['QUERY_STRING']) {
// redirect user to invalid image
tag_http::redirect($dead_url);
return '';
}
// grab image to temp {{{
$ch = curl_init($_SERVER['QUERY_STRING']);
$tempfile = tempnam('/tmp', 'prod_remote_');
$fp = f_open($tempfile, 'w'); //again delete the "_"
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec_($ch); //delete the final "_"
curl_close($ch);
fclose($fp);
// }}}
Thursday, March 18, 2010
102. <?php
$watermark = '3129080702_c4e76f71d7_o.png';
$dead_url = 'http://example.com/dead_image.png';
// {{{ start_image($filename, &$data)
/**
* Creates a gd handle for a valid file
* @param $filename string the file to get
* @param $data array the imagesize
* @return resource GD handle
*/
function start_image($filename, &$data) {
$data = @getimagesize($filename);
if (empty($data)) { return null; }
$data['ratio'] = $data[0]/$data[1];
switch($data[2]) {
case IMG_GIF: return imagecreatefromgif($filename);
case 3: //problem where IMG_PNG is not bound correctly for my install
case IMG_PNG: return imagecreatefrompng($filename);
case IMG_JPG: return imagecreatefromjpeg($filename);
case IMG_WBMP: return imagecreatefromwbmp($filename);
case IMG_XPM: return imagecreatefromxbm($filename);
}
return null;
}
// }}}
$requestimg = $_SERVER['REDIRECT_URL'];
if (!$_SERVER['QUERY_STRING']) {
// redirect user to invalid image
tag_http::redirect($dead_url);
return '';
}
// grab image to temp {{{
$ch = curl_init($_SERVER['QUERY_STRING']);
$tempfile = tempnam('/tmp', 'prod_remote_');
$fp = f_open($tempfile, 'w'); //again delete the "_"
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec_($ch); //delete the final "_"
curl_close($ch);
fclose($fp);
// }}}
Thursday, March 18, 2010
103. <?php
$watermark = '3129080702_c4e76f71d7_o.png';
$dead_url = 'http://example.com/dead_image.png';
// {{{ start_image($filename, &$data)
/**
* Creates a gd handle for a valid file
* @param $filename string the file to get
* @param $data array the imagesize
* @return resource GD handle
*/
function start_image($filename, &$data) {
$data = @getimagesize($filename);
if (empty($data)) { return null; }
$data['ratio'] = $data[0]/$data[1];
switch($data[2]) {
case IMG_GIF: return imagecreatefromgif($filename);
case 3: //problem where IMG_PNG is not bound correctly for my install
case IMG_PNG: return imagecreatefrompng($filename);
case IMG_JPG: return imagecreatefromjpeg($filename);
case IMG_WBMP: return imagecreatefromwbmp($filename);
case IMG_XPM: return imagecreatefromxbm($filename);
}
return null;
}
// }}}
$requestimg = $_SERVER['REDIRECT_URL'];
if (!$_SERVER['QUERY_STRING']) {
// redirect user to invalid image
tag_http::redirect($dead_url);
return '';
}
// grab image to temp {{{
$ch = curl_init($_SERVER['QUERY_STRING']);
$tempfile = tempnam('/tmp', 'prod_remote_');
$fp = f_open($tempfile, 'w'); //again delete the "_"
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec_($ch); //delete the final "_"
curl_close($ch);
fclose($fp);
// }}}
Thursday, March 18, 2010
104. // configure image and dimensions {{{
$size_data = array();
$im = start_image($tempfile, $size_data);
if (!$im) {
unlink($tempfile);
tag_http::redirect($dead_url);
return;
}
// }}}
// get watermark information {{{
$wm_data = array();
$wm = start_image($watermark, $wm_data);
if (!$wm) {
unlink ($tempfile);
tag_http::redirect($dead_url);
return;
}
// }}}
// add watermark {{{
if ($size_data['ratio']> $wm_data['ratio']) {
// image is wider format than the watermark
$new_smaller_dim = $wm_data[0] * ($size_data[1]/$wm_data[1]);
$dst_x = ($size_data[0] - $new_smaller_dim)/2;
$dst_y = 0;
$dst_w = $new_smaller_dim;
$dst_h = $size_data[1];
} else {
// image is taller format than the watermark
$new_smaller_dim = $wm_data[1] * ($size_data[0]/$wm_data[0]);
$dst_x = 0;
$dst_y = ($size_data[1] - $new_smaller_dim)/2;
$dst_w = $size_data[0];
$dst_h = $new_smaller_dim;;
}
imagecopyresized($im, $wm, $dst_x, $dst_y, 0, 0, $dst_w, $dst_h, $wm_data[0], $wm_data[1]);
header(sprintf('%s 200', $_SERVER['SERVER_PROTOCOL']));
header(sprintf('Content-type: %s',$size_data['mime']));
// }}}
switch ($size_data[2]) {
case IMG_GIF: imagegif($im); break;
case 3: case IMG_PNG: imagepng($im); break;
case IMG_JPG: imagejpeg($im); break;
case IMG_WBMP: imagewbmp($im); break;
case IMG_XPM: imagexbm($im); break;
}
imagedestroy($wm);
imagedestroy($im);
unlink($tempfile);
Thursday, March 18, 2010
105. // configure image and dimensions {{{
$size_data = array();
$im = start_image($tempfile, $size_data);
if (!$im) {
unlink($tempfile);
tag_http::redirect($dead_url);
return;
}
// }}}
// get watermark information {{{
$wm_data = array();
$wm = start_image($watermark, $wm_data);
if (!$wm) {
unlink ($tempfile);
tag_http::redirect($dead_url);
return;
}
// }}}
// add watermark {{{
if ($size_data['ratio']> $wm_data['ratio']) {
// image is wider format than the watermark
$new_smaller_dim = $wm_data[0] * ($size_data[1]/$wm_data[1]);
$dst_x = ($size_data[0] - $new_smaller_dim)/2;
$dst_y = 0;
$dst_w = $new_smaller_dim;
$dst_h = $size_data[1];
} else {
// image is taller format than the watermark
$new_smaller_dim = $wm_data[1] * ($size_data[0]/$wm_data[0]);
$dst_x = 0;
$dst_y = ($size_data[1] - $new_smaller_dim)/2;
$dst_w = $size_data[0];
$dst_h = $new_smaller_dim;;
}
imagecopyresized($im, $wm, $dst_x, $dst_y, 0, 0, $dst_w, $dst_h, $wm_data[0], $wm_data[1]);
header(sprintf('%s 200', $_SERVER['SERVER_PROTOCOL']));
header(sprintf('Content-type: %s',$size_data['mime']));
// }}}
switch ($size_data[2]) {
case IMG_GIF: imagegif($im); break;
case 3: case IMG_PNG: imagepng($im); break;
case IMG_JPG: imagejpeg($im); break;
case IMG_WBMP: imagewbmp($im); break;
case IMG_XPM: imagexbm($im); break;
}
imagedestroy($wm);
imagedestroy($im);
unlink($tempfile);
Thursday, March 18, 2010
106. // configure image and dimensions {{{
$size_data = array();
$im = start_image($tempfile, $size_data);
if (!$im) {
unlink($tempfile);
tag_http::redirect($dead_url);
return;
}
// }}}
// get watermark information {{{
$wm_data = array();
$wm = start_image($watermark, $wm_data);
if (!$wm) {
unlink ($tempfile);
tag_http::redirect($dead_url);
return;
}
// }}}
// add watermark {{{
if ($size_data['ratio']> $wm_data['ratio']) {
// image is wider format than the watermark
$new_smaller_dim = $wm_data[0] * ($size_data[1]/$wm_data[1]);
$dst_x = ($size_data[0] - $new_smaller_dim)/2;
$dst_y = 0;
$dst_w = $new_smaller_dim;
$dst_h = $size_data[1];
} else {
// image is taller format than the watermark
$new_smaller_dim = $wm_data[1] * ($size_data[0]/$wm_data[0]);
$dst_x = 0;
$dst_y = ($size_data[1] - $new_smaller_dim)/2;
$dst_w = $size_data[0];
$dst_h = $new_smaller_dim;;
}
imagecopyresized($im, $wm, $dst_x, $dst_y, 0, 0, $dst_w, $dst_h, $wm_data[0], $wm_data[1]);
header(sprintf('%s 200', $_SERVER['SERVER_PROTOCOL']));
header(sprintf('Content-type: %s',$size_data['mime']));
// }}}
switch ($size_data[2]) {
case IMG_GIF: imagegif($im); break;
case 3: case IMG_PNG: imagepng($im); break;
case IMG_JPG: imagejpeg($im); break;
case IMG_WBMP: imagewbmp($im); break;
case IMG_XPM: imagexbm($im); break;
}
imagedestroy($wm);
imagedestroy($im);
unlink($tempfile);
Thursday, March 18, 2010
107. // configure image and dimensions {{{
$size_data = array();
$im = start_image($tempfile, $size_data);
if (!$im) {
unlink($tempfile);
tag_http::redirect($dead_url);
return;
}
// }}}
// get watermark information {{{
$wm_data = array();
$wm = start_image($watermark, $wm_data);
if (!$wm) {
unlink ($tempfile);
tag_http::redirect($dead_url);
return;
}
// }}}
// add watermark {{{
if ($size_data['ratio']> $wm_data['ratio']) {
// image is wider format than the watermark
$new_smaller_dim = $wm_data[0] * ($size_data[1]/$wm_data[1]);
$dst_x = ($size_data[0] - $new_smaller_dim)/2;
$dst_y = 0;
$dst_w = $new_smaller_dim;
$dst_h = $size_data[1];
} else {
// image is taller format than the watermark
$new_smaller_dim = $wm_data[1] * ($size_data[0]/$wm_data[0]);
$dst_x = 0;
$dst_y = ($size_data[1] - $new_smaller_dim)/2;
$dst_w = $size_data[0];
$dst_h = $new_smaller_dim;;
}
imagecopyresized($im, $wm, $dst_x, $dst_y, 0, 0, $dst_w, $dst_h, $wm_data[0], $wm_data[1]);
header(sprintf('%s 200', $_SERVER['SERVER_PROTOCOL']));
header(sprintf('Content-type: %s',$size_data['mime']));
// }}}
switch ($size_data[2]) {
case IMG_GIF: imagegif($im); break;
case 3: case IMG_PNG: imagepng($im); break;
case IMG_JPG: imagejpeg($im); break;
case IMG_WBMP: imagewbmp($im); break;
case IMG_XPM: imagexbm($im); break;
}
imagedestroy($wm);
imagedestroy($im);
unlink($tempfile);
Thursday, March 18, 2010
108. Beyond Funky
Caching
Thursday, March 18, 2010
With a bit of creativity this concept can apply to modern applications where instead of
caching on the filesystem, you cache in memcache; instead of bypassing the application
server, you bypass the web servers themselves with a content distribution network; instead of
serving static content from the edge, you serve dynamic pages.
Whether to use it and how to use it is always determined by the environment.
109. San Francisco quotes of san francisco?
Looking around you for
inspiration
Thursday, March 18, 2010
I hope this tour helps you see software development in a different way—that finding solutions are about using the right solution in a manner that fits with the environment.
Even then I realize that we can’t architect structures that work as harmoniously together as a city such as San Francisco. Story of Rounded Rectangles…
Bill Atkinson worked mostly at home, but whenever he made significant progress he rushed in to Apple to show it off to anyone who would appreciate it. This time, he
visited the Macintosh offices at Texaco Towers to show off his brand new oval routines, which were implemented using a really clever algorithm. Bill had added new code to
QuickDraw (which was still called LisaGraf at this point) to draw circles and ovals very quickly. That was a bit hard to do on the Macintosh, since the math for circles usually
involved taking square roots, and the 68000 processor in the Lisa and Macintosh didn't support floating point operations. But Bill had come up with a clever way to do the
circle calculation that only used addition and subtraction, not even multiplication or division, which the 68000 could do, but was kind of slow at.
Bill's technique used the fact the sum of a sequence of odd numbers is always the next perfect square (For example, 1 + 3 = 4, 1 + 3 + 5 = 9, 1 + 3 + 5 + 7 = 16, etc). So
he could figure out when to bump the dependent coordinate value by iterating in a loop until a threshold was exceeded. This allowed QuickDraw to draw ovals very quickly.
Bill fired up his demo and it quickly filled the Lisa screen with randomly-sized ovals, faster than you thought was possible. But something was bothering Steve Jobs. "Well,
circles and ovals are good, but how about drawing rectangles with rounded corners? Can we do that now, too?"
"No, there's no way to do that. In fact it would be really hard to do, and I don't think we really need it". I think Bill was a little miffed that Steve wasn't raving over the fast
ovals and still wanted more.
Steve suddenly got more intense. "Rectangles with rounded corners are everywhere! Just look around this room!". And sure enough, there were lots of them, like the
whiteboard and some of the desks and tables. Then he pointed out the window. "And look outside, there's even more, practically everywhere you look!". He even persuaded
110. Thanks!
resize
tychay@php.net
terrychay.com/blog
Thursday, March 18, 2010
Editor's Notes
An obscure but ubiquitous design pattern in PHP development is known as Funky Caching. Using real architectural examples as a lens to look at this one simple PHP design pattern, we see how we can design web architectures that are &quot;organic, democratic, and lasting…&quot;
Two prologues
Often attributed to Rasmus, but actually invented by Stig First you create an ErrorDocument line in your apache.conf. What this does is tell the webserver to redirect all missing files to a PHP script called “error.php” in your directory root. You then create this handler: Reference: http://derickrethans.nl/errorhandling/rasmus-trick.html http://lerdorf.com/tips.pdf
What does this trick do? Basically, when a file doesn’t exist, it gives an opportunity for PHP to create the data and return it instead of a 404 error page. The code above is pretty canonical, the only exceptions are where you branch to show the default error page… syntax highlighting code: php_value highlight.string '#b02c04' php_value highlight.comment '#8e98a6'php_value highlight.keyword '#96ad53'#php_value highlight.bg '#f1f7d7'php_value highlight.default '#524e37'php_value highlight.html '#95ad53'
… and where you generate the actual data to render to the user.
At the bottom is where the magic happens. It places the generated file directly into the web server path. What this means is that the next request to the same web resource goes directly for that resource without starting up this code and regenerating the data. Reference: 404 defined: http://en.wikipedia.org/wiki/HTTP_404 404 discussion: http://www.alistapart.com/articles/pe rfect404/ 404 examples: http://www.plinko.net/ 404/ HTTP codes: http://www.urbandictionary.com/define.php?te rm=404
PHP never gets instantiated after the first request! At that point it truly becomes PHP without PHP.
About the book and the metaphor. The foundation of Steve McConnell’s seminal text, Code Complete , was that software development should be based around the paradigm of construction. But that was fundamentally flawed because of the mythical man-month —the “man-mon th” term itself originally coming from construction work. We now know McConnell was wrong and software isn’t construction, it is engineering . And we’re called “software engine ers,” not “software workers” for this reason: we’re engineers, not construction workers.
Rhe foundation of Steve McConnell’s seminal text, Code Complete , was that software development should be based around the paradigm of construction. But that was fundamentally flawed because of the mythical man-month —the “man-mon th” term itself originally coming from construction work. We now know McConnell was wrong and software isn’t construction, it is engineering . And we’re called “software engine ers,” not “software workers” for this reason: we’re engineers, not construction workers.
Software as Engineering vs. other. My title at Tagged is currently “software architect.” And I have a “radical” idea that maybe titles are that way because they mean something. Meaning that if I’m hired as a software architect then I should think like an architect and find my inspiration from architecture.
So lets find our inspiration from architecture and see how it explains the Funky Caching pattern through three buildings. the first is one known as Fallingwater. References: Fallingwater logo from: http://www.fallingwater.org /
In Eastern mountain range of the United States there is a house that is CANTILEVERed 40 feet above a waterfall. This is one of the most famous buildings by American architect, FRANK LLOYD WRIGHT. In 1991 it was voted as the best all-time work of American architecture by the American Institute of Architects. Even though it is OVER 80KM from the nearest city people over a MILLION PEOPLE have traveled to see it. Reference: Image from http://commons.wikimedia.org/wiki/File:Falling_Water_01.jpg Wikipedia: http://en.wikipedia.org/wiki/Fallingwater Frank Lloyd Wrigh t: http://franklloydwright.org/Home.html
Yes, including me as a kid. The day it was built, TIME MAGAZINE wrote about it. Because it was a quintessential example of ORGANIC ARCHITECTURE of FLW. References: Der Spiegel: http://en.wikipedia.org/wiki/Der_Spiegel
A staircase connects the house directly to the stream below . The stream and waterfall, although not seen, can be heard in all parts of the house. The HATCHWAY that consists of SLIDING GLASS DOORS and the bottom step has no support from below. (FLOAT above like the water floats) References: http://wright-house.com/frank-lloyd-wright/fallingwater-p ictures/06E-hatchway-fallingwater.html
WINDOWS WRAP AROUND THE ENTIRE BUILDING so that the building MERGES with the surrounding GREENERY. Similarly the TUNGSTEN LIGHTING and the glasses compliments the FALL FOLIAGE of the region…
This is the VIEW that FLW planned for the house. References: http://wright-house.com/frank-lloyd-wright/fallingwater-pictures/F1SW-fallingwater-in-fall.html
Panes of glass are caulked directly to each other and to the steel frame or stone walls to further symbolize the lack of barriers between the construction and the surrounding nature. References: http://wright-house.co m/frank-lloyd-wright/fallingwater-pictures/34SE-guest-house-window.html
The driveway trellis has a semi-circular cutaway to accommodate an existing tree . References: http://wright-house.com/frank-lloyd-wright/fallingwater -pictures/15-tree-in-trellis-fallingwater.html
The stone floor in the living room , quarried from local rocks http://wright-hous e.com/frank-lloyd-wright/fallingwater-pictures/livingroom-fallingwater.html
The rock in the foreground is is an original boulder not disturbed from it’s original position. References: http://wright-house.com/frank-lloyd-wright/fallingwater-pictures/7-living-room-fireplace-hearth.php
From details like these to the whole view taken in at once, one gets a feeling that, in spite of the SHARP HORIZONTAL AND VERTICAL LINES of the building, the whole lives in harmony with its environment &quot;instead of lording above [it] in an isolated spot as a man-made imposition.” Why is this building as recognizable as any NATURAL WONDER?
Surveyed the grounds before building. Organic: &quot;form follows function.&quot; Wright argued that &quot;form and function are one.&quot; Democratic “design should accommodate needs” Plasticity: “physical element should remove barriers.” Continuity “element should be part of nature”
How prevalent is funky caching? Every time you visit PHP.NET, you use it (need to get the order of needle-haystack by typing http://php.net/strstr ). A cynic would say, because PHP is so SLOW TO EXECUTE, it needs solutions like this to perform well. The problem with this argument is that NO WEB LANGUAGE OUTPERFORMS STATIC SERVERS. Becase it trades off speed of execution with SPEED FOR EASE OF DEVELOPMENT. As Andrei mentioned e arlier , that is fundamental to its design. In fact, all dynamically-typed scripting languages make this tradeoff.
The ubiquity of this trick in the PHP world is because it—like Frank Lloyd Wright's Fallingwater—lives in harmony with its environment. The environment is an APACHE WEB SERVER, persistent data store in the form of a RELATIONAL DATABASE, and the demands of large-scale, CONSUMER-CENTRIC web sites. Would this solution exist without an ErrorDocument handler built into Apache? Would this solution exist if we didn't persist content on a (relatively) slow data store like a database? Would this solution exist if the consumer didn't demand millisecond response time for dynamic content?
The language itself. PHP is a component of A WHOLE SYSTEM. It’s glue code.
developer time and resources
shared-nothing architecture
designed to solve the web problem Could this &quot;ugly, but extremely functional and convenient&quot; web language have been built to solve anything other than the ugly web problem?
One block from where my mother used to work, on the corner of Fifth Avenue and Bellefield in Pittsburgh, stands a strange sight…
References: Map of Pitt: http://www.tour.pitt.edu/documents/map200506.pdf
If you weren’t in PITTSBURGH IN THE LATE 1980’s you wouldn’t have understood how his could have happened . On this ground once stood the original Bellefield church built in the 1880’s. Since its CONGREGATION HAD BEEN MOVED further down Fifth Avenue, the building was sold a century later to developers trying to exploit the new business attracted by the PITTSBURGH SUPERCOMPUTING CENTER. They wanted to level it and build a new building, but were blocked when people mobilized to SAVE THE OLD TOWER. The developer then proceeded to honor this by DEMOLISH EVERYTHING BUT THE TOWER and building the ironically-named “Bellefield Towers” next to it.
This is the current Bellefield Church and an example of city architecture of which the tower is one of them…
The center is the county courthouse and jail, the top right is the local Korean church, and the bottom right is a private residence in the same neighborhood.
The photo at the top is was taken from the Cathedral of learning (previous slide).
When faced with a gorgeous 100-year old example of the area’s architecture, INSTEAD OF WORKING WITH THE ENVIRONMENT like Frank Lloyd Wright did with Fallingwater—in the same area of Pennsylvania no less!—the developer simply sawed it off! The CURVED MODERN ARCHITECTURE of the TOWERS of the latter serves only to emphasize how it was built with no consideration of the surrounding environment. I GREW UP WATCHING THIS HAPPEN and it is a LIFE LESSON IN ARCHITECTURAL HUBRIS.
“ I’m a developer, I can make the software conform to my needs.”Oh really? That sounds a lot like trying to “lord over the environment with an isolated man-made imposition.” “But what I mean is it’s all man-made in software, there is no environment.”
cover cube story, (where cubes are good- Yahoo, sales, user QA), cover waterfall process
When I joined my current company, they had a couple services written in Java, only Zend Accelerator could code cache their PHP 4 installation, Oracle RAC power ed the bac k-end and development occurred by engineers working in cubes with a relatively heavyweight waterfall development process.Even though I prefer Python to Java for services, we’ve increased our Java development to around 40% of our code base! Even though I prefer MySQL to Oracle, we still use Oracle as our back-end. Even the transition to the open office occurred after it became apparent the company had outgrown the cube-space.
Book on management by the founders of 37 Signals. Their last book was “Getting Real” about web business.
- cliche ridden with few examples “Hannah Montanta” reach for you dreams - “would rather be celebrities than businesspeople.” - 'Meetings are toxic.' In reality, good meetings are good and bad meetings are not good (generalization) - “Planning, they say, is not recommended” - only applies to their business - “They need to stop behaving like children.” - “Outside money is plan”, about why you should never take on third-party investors.37signals reveals that it took money from Bezos Expeditions, the VC company that invests on behalf of the Amazon founder, Jeff Bezos, in 2006.
Why? Because that is the environment and your solutions have to work within that environment. Anything else is architectural hubris. Let’s say it is the early days of social networking and you join a company that is using Java/J2EE instead of PHP, or Oracle instead of MySQL, or they’re using Perl/Mason instead of your favorite (PHP) framework, as Marco m entioned earlier —there are so many to choose from that the number is second only to Java.Do you go in and say your experience building a CMS or e-store trumps their experien ce working on a nascent social network? Do you replace all the Java engineers with PHP ones? Do you replace MySQL with Oracle? Do you rewrite the site from scratch using your favorite framework? I’m not saying that in all these instances these architects shouldn’t have made the decisions they did. I am not qualified to answer that since I didn’t work at these places.But what I do know was that in the vast majority of cases, people went in without considering the existing environment. I do know the dynamics of a Facebook.com is different from the dynamics of Gamespot.com or Amazon.com. I do know a social network is different from a CMS or e-store. And all these solutions are very different from ones in enterprise .Like building Fallingwate r without get ting an adequate survey done, every day people make the mistake of not looking before acting. They try to make PHP look like Java with dollar signs, as Luke mentioned earlier . They expected the environ ment to conform to their reality so they can lord over it with “some isolated man-made imposition.”
I’ve long since moved from the woods of Western Pennsylvania to the San Francisco Peninsula. I am fortunate that my weekly run passes with a near-constant view of the most recognizable architecture in the American West : References: Image licensed from: http://www.istockphoto.com/file_closeup.php?id=6091847
my weekend run
What’s interesting is that there are much longer spans in the country and the world. Even in the same city, there exists a beautiful bridge that is both longer and of more utility. And yet this bridge represents the icon of San Francisco and of the state as a whole.
The original design was for a hybrid cantilever and suspension structure. But it was replaced with a pure suspension design because the former was deemed too ugly. A pure suspension of this length had never been attempted before.
Irving Morrow designed the bridge tower, lighting, and pedestrian walkways with an entirely Art Deco decorative influence.
The bridge was painted in a specially formulated anti-rust paint in International Orange on demand from locals. The War Department, and others. The Navy alone originally demanded it be painted black with y ellow stripes to assure visibility with passing ships . The rust-colored p aint evokes the hills of Marin to the north as well as the setting sun. It is natural and visible enough to be safe.
rust-colored suspension-only art deco structure It becomes an icon. Every week I pass by it and am inspired and thankful I can live in so beautiful a city.
This quote is the origin of “design pattern.”
But how are we to know which way to do it? Or even if it is the right pattern to be using in our situation? The answer is found in how both a house in Pennsylvania and a bridge in San Francisco represent ultimate expressions of architecture. They are wholly appropriate for the environment in which they stand.
A cantilever is wholly appropriate to create the floating look of Fallingwater, but that same pattern would disrupted the naturalness of the Golden Gate Bridge. When choosing between a singleton and a global variable, which pattern to use is determined by the environment.
the first is in Rasmus’s talk and you can see PHP.NET in others.
At my previous company, we had the problem where images are stored on the database but need to be generated in multiple sizes and thumbnails and streamed fast to the user. Previews and thumbnails can be dynamically and instantly generated from border parts, primary graphics, colors, and sample font and text and then stored statically on a server using this method. Stuff may be stored in normal form on the database, but representations built dynamically and served statically
Address complaint about storing in database…Not all images are stored in the database. In fact, at Tagged, not a single image is stored on a database. However, at Plaxo, the admin tool to manage ecard content requires the assets be done by a non-developer but the only way of pushing out filesystem changes is through change control and there is little need of user generated content. In fact, outside e-cards, the entire Plaxo address book database (including the thumbnail photo of yourself) is stored in a database. I’m not the architect of that, nor do I see much a problem with it.What I point out you CAN now get away with putting image content on the database again with this trick. That’s pretty impressive because different assets on a site (statics, javascripts, web pages, user data, application, back-end, corporate site, customer support, etc) are usually managed on an ad hoc basis optimized for the task at hand. Not all of them can resort to using a filesystem push or web tier restart.
Recently, Tagged has run across the very same performance (size and number) issues in Javascript. The solution: Funky caching hooked up to a javascript compressor powered by a Java service back-end to dynamically catenate and compress javascripts into a unique URL on demand.
We recently imported 1/64th of our production data over to the staging environment for testing, but the user’s images would take too much time and disk space to import. We could just link the images, but then tester’s didn’t know which ones they uploaded and which ones were proxied from the live website. The solution was to spend an hour writing a Funky Caching Proxy. If the image was missing, the ErrorDocument handler would try to grav the image from the production website and add a watermark .
Since this is only for testing, there is no need to waste disk space by storing the created file. The performance hit of real-time generation of redundant requests is unnoticeable to Quality Assurance.
With a bit of creativity this concept can apply to modern applications where instead of caching on the filesystem, you cache in memcache; instead of bypassing the application server, you bypass the web servers themselves with a content distribution network ; instead of serving static content from the edge, you serve dynamic pages.Whether to use it and how to use it is always determined by the environment.
I hope this tour helps you see software development in a different way—that finding solutions are about using the right solution in a manner that fits with the environment. Even then I realize that we can’t architect structures that work as harmoniously together as a city such as San Francisco. Story of Rounded Rectangles… Bill Atkinson worked mostly at home, but whenever he made significant progress he rushed in to Apple to show it off to anyone who would appreciate it. This time, he visited the Macintosh offices at Texaco Towers to show off his brand new oval routines, which were implemented using a really clever algorithm. Bill had added new code to QuickDraw (which was still called LisaGraf at this point) to draw circles and ovals very quickly. That was a bit hard to do on the Macintosh, since the math for circles usually involved taking square roots, and the 68000 processor in the Lisa and Macintosh didn't support floating point operations. But Bill had come up with a clever way to do the circle calculation that only used addition and subtraction, not even multiplication or division, which the 68000 could do, but was kind of slow at. Bill's technique used the fact the sum of a sequence of odd numbers is always the next perfect square (For example, 1 + 3 = 4, 1 + 3 + 5 = 9, 1 + 3 + 5 + 7 = 16, etc). So he could figure out when to bump the dependent coordinate value by iterating in a loop until a threshold was exceeded. This allowed QuickDraw to draw ovals very quickly. Bill fired up his demo and it quickly filled the Lisa screen with randomly-sized ovals, faster than you thought was possible. But something was bothering Steve Jobs. &quot;Well, circles and ovals are good, but how about drawing rectangles with rounded corners? Can we do that now, too?&quot; &quot;No, there's no way to do that. In fact it would be really hard to do, and I don't think we really need it&quot;. I think Bill was a little miffed that Steve wasn't raving over the fast ovals and still wanted more. Steve suddenly got more intense. &quot;Rectangles with rounded corners are everywhere! Just look around this room!&quot;. And sure enough, there were lots of them, like the whiteboard and some of the desks and tables. Then he pointed out the window. &quot;And look outside, there's even more, practically everywhere you look!&quot;. He even persuaded Bill to take a quick walk around the block with him, pointing out every rectangle with rounded corners that he could find. When Steve and Bill passed a no-parking sign with rounded corners, it did the trick. &quot;OK, I give up&quot;, Bill pleaded. &quot;I'll see if it's as hard as I thought.&quot; He went back home to work on it. Bill returned to Texaco Towers the following afternoon, with a big smile on his face. His demo was now drawing rectangles with beautifully rounded corners blisteringly fast, almost at the speed of plain rectangles. When he added the code to LisaGraf, he named the new primitive &quot;RoundRects&quot;. Over the next few months, roundrects worked their way into various parts of the user interface, and soon became indispensable.