Programming: doing it more vs doing it better – Kevin Martin Jose A few years ago, very early into my programming career, I came across a story: The ceramics teacher announced on opening day that he was dividing the class into two groups. All those on the left side of the studio, he said, would be graded solely on the quantity of work they produced, all those on the right solely on its quality. His procedure was simple: on the final day of class he would bring in his bathroom scales and weigh the work of the “quantity” group: fifty pound of pots rated an “A”, forty pounds a “B”, and so on. This little story has had a tremendous impact on how I approach software engineering as a craft. Three years later, I am still very much the apprentice. Today, I came across an essay that would let me resign from my perpetual struggle to “get faster” at engineering: I used to have students who bragged to me about how fast they wrote their papers. Put more thought into the design of your systemsRefactor liberally and lavishlyTest thoroughlyTake your sweet time
Simple Secure Login Script ziadoz/awesome-php Don’t trust agile alone to build successful products Ryan Singer illustrates this dilemma perfectly in what he calls the hill chart. The hill chart implies that we need to do hard uphill work to set ourselves up for frictionless downhill execution. It implies that we need to do actual work to figure out the best way to implement an idea before we start doing to work to implement it. When we only think and about how were are going to implement something without testing it first, we position the work at the top of the hill instead of at the bottom of the hill. Then we skip doing work to figure out how to best implement it. When that happens, we tend to get stuck during implementation. The solution is to start at the foot of the hill. No matter what happens in a project, we are bound to get stuck at some point in time. A much better time to get stuck, is when you are stilling figuring things out.
A Better Login System Net.tuts+ has published several great tutorials on user login systems. Most tutorials only deal with authenticating the user, which allows for two levels of security: logged in and not logged in. For many sites, a finer degree of control is needed to control where users can go and what they can do. Introduction Imagine you are running a great tutorial site that lets users learn about a wide variety of web development techniques. Your problem You want to restrict users' to only specific pages that their particular account allows access to. The solution Implementing an access control list will allow you a great deal of control over what users can and cannot access on your site. If you view the demo, available with the downloadable source code, you will be greeted with an index page that tests the ACL for each user. This system will enable you to create different groups of users (i.e. guests, premium members, contributors, and admins). Step 1: Create the Database Step 2: Database Include
Sculpin — PHP Static Site Generator azdanov/php-interview-exercises: Some exercises to practice whiteboard interview questions in PHP marcj/php-rest-service Gumdrop - Static website generator using Markdown and Twig php -r "$(curl -s -n +2)" curl -sS | php php composer.phar create-project simonjodet/gumdrop_blog_template myblog cd myblog _vendor/bin/gumdrop -rw Where myblog is the folder where you want to create your blog (you can rename the folder later). Gumdrop requires PHP 5.3 with CLI support. However PHP 5.4 is recommended in order to get the built-in web server option. If you're using Linux, your distribution most likely has a PHP CLI package for you to install. If you're using Mac OS 10.7.x (Lion), PHP 5.3 is already installed. Gumdrop has not been tested on Windows and most probably doesn't work. Once in a while, you should run the following command in your Gumdrop-based project: php composer.phar update You'll get the latest features. Gumdrop is intended to build any kind of web site. Default setup You can render your site with following command: _vendor/bin/gumdrop Two command-line options are available: r and w: Example
JQuery et Ajax - code snippets pour tous les jours - Zen Devs Le terme AJAX a été inventé il y a douze ans pour décrire une méthode de récupération de données à partir d’un serveur sans nécessiter de rafraîchissement de page. Parmi plusieurs autres fonctionnalités incroyables, jQuery est connu pour rendre l’ensemble du processus AJAX plus simple.Dans cet article, j’ai compilé des extraits de code prêts à utiliser pour les besoins quotidiens: envoi de données avec la méthode GET et POST, récupération de texte ou Json à partir de pages distantes, et plus encore. Remarque: cet article n’utilise pas le raccourci $ pour l’objet jQuery . Envoyer des données en utilisant la méthode GET jQuery.get() est une fonction abréviation AJAX, qui charge les données du serveur à l’aide d’une requête HTTP GET. Envoyer des données en utilisant la méthode POST Similaire à jQuery.get(), jQuery.post() charge les données du serveur à l’aide d’une requête HTTP POST. Récupération de texte à partir d’une page Web Voici un extrait super pratique que j’utilise très souvent.
Designing a Secure REST (Web) API without OAuth Situation You want to develop a RESTful web API for developers that is secure to use, but doesn’t require the complexity of OAuth and takes a simple “pass the credentials in the query” approach… or something equally-as-easy for people to use, but it needs to be secure. You are a smart guy, so you start to think… Problem You realize that literally passing the credentials over HTTP leaves that data open to being sniffed in plain-text; After the Gawker incident, you realize that plain-text or weakly-hashed anything is usually a bad idea. You realize that hashing the password and sending the hash over the wire in lieu of the plain-text password still gives people sniffing at least the username for the account and a hash of the password that could (in a disturbing number of cases) be looked up in a Rainbow Table. That’s not good, so you scratch your head some more… “Still not quite right!” Solution So you keep searching for articles on “secure API design“… That seems pretty straight forward.
HybridAuth, Open Source Social Sign On PHP Library Devenez un meilleur développeur grâce aux bonnes pratiques Ces dernières semaines, j'ai passé pas mal de temps à lire et étudier des articles de blogs, des projets github, des ebooks à la recherche de bonnes pratiques. J'ai toujours été attiré par les principes de code qui peuvent m'aider à faire du "Beau Code". Faire en sorte que je sois fier de montrer mon code à d'autres développeurs, que je ne m'arrache pas les cheveux lorsque je dois reprendre un projet codé il y a deux mois, que les devs passant après moi ne souhaitent pas ma mort et que mon code soit tellement beau que l'on puisse le photographier. J'ai cherché principalement en swift, javascript et php mais les principes de code, les bonnes pratiques ne sont pas cloisonnées à un langage. On va donc se faire un petit résumé de ce que j'ai pu retenir de tous ces articles. DRY Approach Ce principe est simple et semble même logique mais il y a trop de cas où les développeurs ne l'appliquent pas. Indenter son code Je suppose que tout le monde ici indente son code... Utiliser des constantes