https://speakerdeck.com/willroth/50-laravel-tricks-in-50-minutes - origin
Laravel 5.1 raised the bar for framework documentation, but there's much, much more lurking beneath the surface. In this 50-minute session, we'll explore 50 (yes, 50!) high-leverage implementation tips & tricks that you just won't find in the docs: the IoC Container, Blade, Eloquent, Middleware, Routing, Commands, Queues, Events, Caching — we'll cover them all! Join us as we drink from the fire hose & learn to take advantage of everything that Laravel has to offer to build better software faster!
Une approche qui permet d'alimenter des table views de manière déclarative, d'y combiner des données hétérogènes, et de gérer facilement et surtout de manière fiable les updates, par Amadour Griffais.
The world of JavaScript client-side frameworks is overflowing with contenders vying for the crown, but which one do you choose for your next project? Which one has what it takes?
In this talk we’ll look at the “Big 3”, AngularJS, Ember.js, and Backbone.js. We’ll compare them head to head, toe to toe. We’ll look at the pros and cons of each one. How do they handle form bindings? Talking to APIs? Code organization? Routing? Etc?
Who’ll come out victorious in this battle of the JavaScript frameworks, or will we all just come out bloodied and bruised on the other side? Guess we’ll find out!
Search application development can start the moment you download Solr. As you ingest your data, or a sample thereof, you can easily see the search results in a familiar search user interface. Want to facet on a field? Done. Want to full-text search on a field? Change some configuration, restart, reindex, and voila! Done right, the iterative process of development and discovery will help you better match users to the data they need and deliver a quality search experience.
Silex is a brand new PHP 5.3 micro framework built on top of the Symfony2 de decoupled components. In this session, we will discover how to build and deploy powerful REST web services with such a micro framework and its embedded tools.
The first part of this talk will introduce the basics of the REST architecture. We fill focus on the main concepts of REST like HTTP methods, URIs and open formats like XML and JSON.
Then, we will discover how to deploy REST services using most of interesting Silex tools like database abstraction layer, template engine and input validation. We will also look at unit and functional testing frameworks with PHPUnit and HTTP caching with Edge Side Includes and Varnish support to improve performances.
https://speakerdeck.com/willroth/50-laravel-tricks-in-50-minutes - origin
Laravel 5.1 raised the bar for framework documentation, but there's much, much more lurking beneath the surface. In this 50-minute session, we'll explore 50 (yes, 50!) high-leverage implementation tips & tricks that you just won't find in the docs: the IoC Container, Blade, Eloquent, Middleware, Routing, Commands, Queues, Events, Caching — we'll cover them all! Join us as we drink from the fire hose & learn to take advantage of everything that Laravel has to offer to build better software faster!
Une approche qui permet d'alimenter des table views de manière déclarative, d'y combiner des données hétérogènes, et de gérer facilement et surtout de manière fiable les updates, par Amadour Griffais.
The world of JavaScript client-side frameworks is overflowing with contenders vying for the crown, but which one do you choose for your next project? Which one has what it takes?
In this talk we’ll look at the “Big 3”, AngularJS, Ember.js, and Backbone.js. We’ll compare them head to head, toe to toe. We’ll look at the pros and cons of each one. How do they handle form bindings? Talking to APIs? Code organization? Routing? Etc?
Who’ll come out victorious in this battle of the JavaScript frameworks, or will we all just come out bloodied and bruised on the other side? Guess we’ll find out!
Search application development can start the moment you download Solr. As you ingest your data, or a sample thereof, you can easily see the search results in a familiar search user interface. Want to facet on a field? Done. Want to full-text search on a field? Change some configuration, restart, reindex, and voila! Done right, the iterative process of development and discovery will help you better match users to the data they need and deliver a quality search experience.
Silex is a brand new PHP 5.3 micro framework built on top of the Symfony2 de decoupled components. In this session, we will discover how to build and deploy powerful REST web services with such a micro framework and its embedded tools.
The first part of this talk will introduce the basics of the REST architecture. We fill focus on the main concepts of REST like HTTP methods, URIs and open formats like XML and JSON.
Then, we will discover how to deploy REST services using most of interesting Silex tools like database abstraction layer, template engine and input validation. We will also look at unit and functional testing frameworks with PHPUnit and HTTP caching with Edge Side Includes and Varnish support to improve performances.
iPhone applications can often benefit by talking to a web service to synchronize data or share information with a community. Ruby on Rails, with its RESTful conventions, is an ideal backend for iPhone applications. In this session you'll learn how to use ObjectiveResource in an iPhone application to interact with a RESTful web service implemented in Rails. This session isn't about how to build web applications that are served up on the iPhone. It's about how to build iPhone applications with a native look and feel that happen to talk to Rails applications under the hood. The upshot is a user experience that transcends the device.
Already given code from 4 files- 1-app-ctrl-js code- -- include expres.pdfas1mobiles
Already given code from 4 files:
1.app.ctrl.js code:
// include express
const express = require('express');
const app = express();
// include the mustache template engine for express
const mustacheExpress = require('mustache-express');
// include the model so the controller can use its functions
const Model = require('./app.model.js')
// registers the mustache engine with express
app.engine("mustache", mustacheExpress());
// sets mustache to be the view engine
app.set('view engine', 'mustache');
// sets /views to be the /views folder
// files should have the extension filename.mustache
app.set('views', __dirname + '/views');
// ************************* CONTROLLER ACTIONS ****************************
// delete a realtor action (given an id parameter)
app.get('/delete/:id', function(req,res) {
// 3. render the page with the realtor data
function renderPage(realtorArray) {
res.render('main_page', { realtors: realtorArray});
}
// 2. Get all the realtors, then render the page
function getRealtors() { Model.getAllRealtors(renderPage); }
// 1. delete the realtor first, then get all the realtors
Model.deleteRealtor(req.params.id, getRealtors);
});
// addform action puts the add realtor form on the page
app.get('/addform', function(req,res) {
// 2. render the page with the realtor data AND display the add form
function renderPage(realtorArray)
{
res.render('main_page', {addrealtor: true, realtors: realtorArray});
}
// 1. get all the realtors, then render the page
Model.getAllRealtors(renderPage);
});
// addrealtor action handles add form submit, inserts new realtor into table
app.get('/addrealtor', function(req,res) {
// 3. render the page with the realtor data
function renderPage(realtorArray) {
res.render('main_page', { realtors: realtorArray});
}
// 2. Get all the realtors, then render the page
function getRealtors() { Model.getAllRealtors(renderPage); }
// 1. Insert realtor into table using form data, then get all the realtors
Model.addRealtor(req.query, getRealtors);
});
// updateform action puts the update realtor form on the page
app.get('/updateform/:id', function(req,res) {
// 2. render the page with the realtor data AND display update form
function renderPage(realtorArray)
{
// filter the realtorArray for the realtor with the id parameter, that's
// the realtor that we want to populate the form with (see: formdata)
res.render('main_page',
{updaterealtor: true
,updateid: req.params.id
,formdata : realtorArray.filter(x => (x.rowid == req.params.id))[0]
,realtors: realtorArray
});
}
// 1. get all the realtors, then render the page
Model.getAllRealtors(renderPage);
});
// updaterealtor action handles updating the realtor in the database
app.get('/updaterealtor/:id', function(req,res) {
// 3. render the page with the realtor data
function renderPage(realtorArray) {
res.render('main_page', { realtors: realtorArray});
}
// 2. Get all the realtors, then render the page
function getRealtors() { Model.getAllRealtors(renderPage); }
// 1. update the re.
The presentation focuses on Rails scaffolding as a good starting point for playing with Ext. The biggest integration task from a Rails point of view is providing the correct JSON data structures that Ext can process - a task that can be solved in a re-usable way. Passing data around between Rails controllers and views and the actual JavaScript code is another focal point.
The presentation features a preview version of Martin Rehfeld's Ext Scaffold Generator, soon to be announced as a official Rails plugin.
by Martin Rehfeld
Brian and John introduce several concepts, including JavaScript Modules and Inversion of Control, and demonstrate how they alleviate many of the dominant problems encountered when building large JavaScript apps. This talk shows new architectural patterns and tangible examples of how these patterns improve testability, refactorability, composability, division of work, and team scalability.
S3 is a codename for Sahana Eden Server & Client can be on the same machine Each part needs to be debugged separately: Eclipse works well for the Server-side Python, whilst Firebug is excellent for the generated HTML/CSS/JavaScript JavaScript libraries we use include jQuery & ExtJS
There are notes on the Wiki for installing a developer environment on Windows, Mac or Linux machines if you wish to run in other environments later.
Look around the filesystem in web2py/applications/eden folder Similar layout structure to other MVC frameworks, such as Ruby-on-Rails & Django
JavaScript which doesn’t require server-side parsing put into static Python Libraries available: System Python, Web2Py, Eden (S3*)
The problems faced by both the victims of and responders to disasters are numerous. Beyond the trauma, this involves having to coordinate, manage and track things. In countries at risk of being affected by large scale sudden onset disasters, these problems can be massive and overwhelming.
Normally you work in a local branch on your PC. You Merge changes in regularly from Trunk. You Push your changes to your branch on LaunchPad (You Pull from LaunchPad to update your server sites)
Minimise the time taken to process Manage dependencies No need to import most of the libraries in ‘gluon/’
Create a new file in the models folder called inc.py & type in the text above – be careful to use the correct case for Field!
Create a new file in the controllers folder called inc.py & type in the text above – be careful to get the indentation correct!
Note that you’ll need to Register yourself as a user on the system before you’re allowed to create a resource. The 1 st user to register gets the Administrator role by default.
Create a new folder in the views folder called ‘ inc ’ & inside that put a new file ‘ incident_list_create.html’ . Type in the text above. Refresh the incident page to see the new text: http://127.0.0.1:8000/eden/inc/ incident No need to learn another macro language Defaults (non-REST) to views/controller/function.html Open the About page ( http://127.0.0.1:8000/eden/default/about ) & browse the variables We store our S3 variables in response.s3.*, session.s3.* so as not to pollute the Web2Py namespace
unique=True is a SQL-level constraint. Open your inc.py from the models directory & add the extra code above. Validators are DAL-level constraints which produce nice error messages instead of tickets! Validators provide server-side validation & some also provide client-side rendering & validation Web2Py automatically adds a Validator when the SQL constraint is set.
Fields default to type ‘string’. ‘ date’ is the SQL-level field type & also provides the class in the HTML which means we get a date widget Add the extra code above to your file & refresh the page, now enter a date.
Add the extra code above to your file & refresh the page to see the default value
Add this to your model (underneath the table definition) & try it out
You can check out the languages file, if you wish: http://127.0.0.1:8000/admin/default/design/eden#languages Update all languages
Add this to your model (underneath the table definition) & try it out Comment is rendered as ‘column3’ (although can be moved using ‘formstyle’) We also use the same space for Help buttons & ‘Add New Resource’ links. NB For optimal performance, we normally add such comments in the Controller instead & put them inside a ‘prep’ to tale effect just when ‘r.representation in shn_interactive_view_formats’
Add this to your model (underneath the table definition) & try it out Comment is rendered as ‘column3’ (although can be moved using ‘formstyle’) We also use the same space for Help buttons & ‘Add New Resource’ links. NB For optimal performance, we normally add such comments in the Controller instead & put them inside a ‘prep’ to tale effect just when ‘r.representation in shn_interactive_view_formats’
Add this to your model (underneath the table definition) & try it out Comment is rendered as ‘column3’ (although can be moved using ‘formstyle’) We also use the same space for Help buttons & ‘Add New Resource’ links. NB For optimal performance, we normally add such comments in the Controller instead & put them inside a ‘prep’ to tale effect just when ‘r.representation in shn_interactive_view_formats’
This should be available as a script or an alias ‘w2p’ iPython needs to be installed for object exploring.
Add this text to the file 000_config.py in the models folder. Navigate to the home page to see the module appear both there & on the menu. Try navigating to the module. Module Type 10 means appears in the ‘more’ section of the default modules menu. (Most deployments will create a fully-customised menu anyway)
Add this text to your controller file & now open the module. “ Custom View” is a Doc String One should be added to all functions for automatic documentation generators & interactive browsing of docs You can try this out in the Interactive Shell: w2p execfile("applications/eden/controllers/vts.py", globals()) help(index)
Create a file called ‘index.html’ inside the views/inc folder See plain HTML being interspersed with the server-side parsed Python Look at another module’s index.html What’s bad about this index?
Add this text to your controller (outside the functions – e.g. at the top) & see what effect this has on your module.
Copt this text into your model. Note the use of string substitution to define the tablename
Tells SQL that these fields are ‘reference’ fields (i.e. Foreign Keys) - They store integers which are a pointer to the ID field in the other tables.
Copy this text into your Model & refresh the presence page Reusable field defined in models/03_gis.py Includes additional useful configuration such as .requires & .represent
Copt this text into your controller. Try it out. Note the automation of the resource name to minimise the editing after copy/paste of new functions
Copy this text into your model & see what it does for the page IS_ONE_OF() will provide us a dropdown showing license plates, even though we actually store the ID. This is an S3 validator which extends Web2Py’s IS_IN_DB() to support the ‘deleted’ status & also allow the use of lambdas as formatting options.
We can add additional fields into the link table.
IS_ONE_OF provides the representation in the dropdown table.field.represent provides the representation in Display/List views A lambda is a Python feature for defining anonymous functions on the fly: http://diveintopython.org/power_of_introspection/lambda_functions.html
Optimise the query – we know we only want a single record & a single field from that record
Add the optimised query to your model.
Add this to your model underneath the definition of the Presence table & try out the URL. No need for dedicated presence() controller
Add this Resource Header definition to your Controller. Be careful to get the end brackets & commas right! ‘ r’ is the resource
Then plug it into the Controller
Take a look at the HTML structure of the page in Firebug.
Web2Py source code very accessible – small enough to be able to grasp the whole thing after not too long FORM defined in gluon/html.py: Dumb HTML elements SQLFORM defined in gluon/sqlhtml.py: Self-processing forms which update the database CRUD defined in gluon/tools.py: Wrappers around SQLFORM - We actually change CRUD a lot & are looking to remove it completely – building straight on top of SQLFORM() REST defined in modules/s3xrc.py: RESTful interface & XML representations If you drop down a level, then need to do things more manually & need to take care of framework issues yourself.
Whilst we spend a lot of time updating developer documentation, the actual codebase always moves faster, so the source is always the most authoritative source of information.