Friday, June 26, 2015

SearchCap: Bing Adds Audio To Homepage, 7 Automated SEO Activities & Matt Cutts Extends Leave



Below is what happened in search today, as reported on Search Engine Land and from other places across the web. Be a part of the world's largest search marketing conference, Search Engine Land's SMX East. The robust agenda covers the latest tactics in paid search, SEO, mobile, analytics and more.

from My Pocket http://feeds.searchengineland.com/~r/searchengineland/~3/a7E-iFA1f88/searchcap-bing-adds-audio-to-homepage-7-automated-seo-activities-matt-cutts-extends-leave-224037 seo

Posts



SEO & Search Marketing Broaden your SEO with marketing resources for all skill levels: best practices, beginner guides, industry survey results, videos, webinars and more.

from My Pocket https://moz.com/blog/google-may-use-your-behavior-to-impact-search-rankings-whiteboard-friday?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+seomoz+%28SEOmoz+Daily+Blog%29

Laravel Podcast: Episode 30 Trouble, Trouble, Trouble...



The Laravel Podcast, hosted by Matt Stauffer (with regular guests Taylor Otwell and Jeffrey Way) has posted their latest episode today - Episode #30: Trouble, Trouble, Trouble....

from My Pocket http://www.phpdeveloper.org/news/22867 laravel

Joe Ferguson: How I use Laravel Homestead everyday



Joe Ferguson has a new post to his site sharing a bit about how he uses Homestead (the Laravel project's virtual machine offering) in his every day development.

from My Pocket http://www.phpdeveloper.org/news/22868 laravel

Thursday, June 25, 2015

Easy Laravel Book: Using Scopes With Laravel 5



The "Easy Laravel Book" website has posted a new tutorial today looking at the use of scopes in Laravel, a packaging method for creating reusable chunks of code for use across the application.

from My Pocket http://www.phpdeveloper.org/news/22864 laravel

Wednesday, June 24, 2015

What is Code "Golf"?



From the grand archives of "Things Chris was totally confused about for far too long and now half understands so might as well blog it": code golf. I would hear someone say something like "I got it down that small from my own golf.

from My Pocket https://css-tricks.com/what-is-code-golf/

Friday, June 19, 2015

Popular Users per Language and Region with Silex and Github



The Github API V3 is a very powerful set of API endpoints that you can use to retrieve useful information about your repositories, activities, and events. Not only that, it allows you to access public information on others.

from My Pocket http://www.sitepoint.com/popular-users-per-language-region-silex-github/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+PHPMaster_feed+%28PHPMaster%29

VOLUME 31 OF THE HACKER DIGEST RELEASED



The latest volume of The Hacker Digest is now out. Volume 31 contains all issues from 2014, rearranged in book form and totaling nearly 300 pages. The Kindle and Nook versions are great for anyone who wants the text of all of the articles sent directly to their devices for easy and legible reading.

from My Pocket https://www.2600.com/content/volume-31-hacker-digest-released hack

Thursday, June 18, 2015

Querying Your Database from Millions of Fibers (Rather than Thousands of Threads)



We’re excited to announce another very interesting guest post on the jOOQ Blog by Fabio Tudone from Parallel Universe. Parallel Universe develops an open-source stack that allows developers to easily code extremly concurrent application on the JVM.

from My Pocket http://feeds.dzone.com/~r/javalobby/frontpage/~3/LhCs44TXoXc/querying-your-database

Introducing Support for Ionic Framework in Appery.io



Here at Appery.io, we’ve recently introduced support for the Ionic Framework in our App Builder, giving users an even more powerful tool for creating functional and beautiful app UIs. Between our recent update with AngularJS and Bootstrap, and now Ionic, we’re working hard to make Appery.

from My Pocket http://feeds.dzone.com/~r/javalobby/frontpage/~3/2e0wSjk07to/introducing-support-ionic

Stripe is hiring for developer support



Developer Support at Stripe is full service. We are persistent at solving problems for engineers from a multitude of backgrounds.

from My Pocket https://news.ycombinator.com/item?id=9730276

How to Lose Money on Paid Marketing



Paid marketing is a powerful tool, it’s one of the few ways to scale user growth but if not measured correctly it’s also one of the best ways to drain your bank account, fast.

from My Pocket http://jamiequint.com/how-to-lose-money-on-paid-marketing/

Hooking up : zapping your brain : The Long and Short Season 4



I sign a form and confirm that I don't have a history of seizures. Nord takes down my hair and puts a headband on my head. She positions two sponges dipped in saline solution on the front of my skull where the frontal cortex sits under my cranium.

from My Pocket http://thelongandshort.org/issues/season-four/hooking-up-zapping-your-brain.html

Aneurysm ‹ Literary Hub



The following is from Henry Marsh’s Do No Harm, a memoir where one of Britain's foremost neurosurgeons gives an intimate view inside delicate and dangerous surgeries.

from My Pocket http://lithub.com/aneursym/

12 Best PHP Debugging Tools for Developers



We all know that PHP is one speedier and popular scripting language that is well known and much appreciate for the fact that it comes endowed with features like detailed documentation, vast community, ready-to-use scripts and well-supported frameworks.

from My Pocket http://designimag.com/best-php-debugging-tools/ php




from My Pocket http://feeds.dzone.com/~r/dzone/frontpage/~3/a3f7wjt24vk/14_useful_html_css_frameworks_for_developers.html frontend dev

Speed up GROUP BY queries with subselects in MySQL



Written by David Ducos for Percona. We usually try to avoid subselects because sometimes they force the use of a temporary table and limits the use of indexes. But, when is good to use a subselect?

from My Pocket http://feeds.dzone.com/~r/dzone/frontpage/~3/KiiGMR1DpNU/speed_up_group_by_queries_with_subselects_in_mysql.html datadb, php




from My Pocket http://www.dzone.com/links/r/how_to_receive_a_million_packets_per_second.html linux




from My Pocket http://www.dzone.com/links/r/the_psychology_behind_not_finishing_projects.html psiho

AngularJS Search Box Using Filter



Hi all, I hope you are fine . If you are new to angular JS I suggest you to read the Basics of AngularJS. Now with the belief that you have read my previous article, we are starting.

from My Pocket http://www.codeproject.com/Articles/1001610/AngularJS-Search-Box-Using-Filter angularjs

How We Made Application Framework Using AngularJS and Django



Last spring we had an idea to do a simple cloud backup service for Linux servers - BitCalm. Since then work on the project was carried out mainly in the evenings and on weekends, to expedite the process, it was decided to use only those technologies in which we have experience.

from My Pocket http://www.codeproject.com/Tips/1001553/How-We-Made-Application-Framework-Using-AngularJ angularjs

Building Secure PHP Apps



Samuel Adeshinasamshaltechs.blogspot.comWhen writing a PHP enabled Web application, many of us like to focus on every other thing but the vulnerability of our apps or Web sites to black hat hackers, unauthorized user or bot access or generally speaking insecurity.

from My Pocket http://www.phpclasses.org/reviews/id/securephpa.html

Laravelista.com: Build an API with Lumen and Fractal



On the Laravelista.com site there's a recent tutorial posted showing you how to create an API with Lumen and Fractal, a combination of the popular Laravel-based microframework and Fractal, an output handling library that makes it simpler to transform data to your needs.

from My Pocket http://www.phpdeveloper.org/news/22833 laravel

Tuesday, June 16, 2015

PHP Integration with Embedded Hardware Device Sensors



Many new embedded system boards with high-end computing capabilities have become the norm in the world of the Internet of (Every)Thing(s).

from My Pocket http://www.phpclasses.org/blog/post/287-PHP-Integration-with-Embedded-Hardware-Device-Sensors.html code php

Backup – How phpbu Can Help



Backups are often considered a necessary evil. But having a backup when you really need it is one of the best things, just like it is the worst thing if you need a backup and you realize you don’t have one.

from My Pocket https://nomadphp.com/2015/06/09/backup-how-phpbu-can-help/ php

Boxing up your Apps as Phars Quickly and Easily with Box



In this tutorial, we’ll use Box to package a PHP application into a Phar, in order to make it easily distributable and globally installable via Composer. We need a project for this, and packaging up yet another “Hello World” script would be pointless.

from My Pocket http://www.sitepoint.com/boxing-apps-phars-quickly-easily-box/ code php

Ed Zynda: Aspect Oriented PHP And The Interceptor Pattern



Ed Zynda has a recent post to his site looking at the use of the Interceptor design pattern with the aspect oriented methodology in PHP. He doesn't get into the basic concepts of AOP, so you might want to find out a bit more in other places.

from My Pocket http://www.phpdeveloper.org/news/22815 laravel

Exploring Github’s Public Events with PHP and Google BigQuery



If you’ve been following along with my previous articles about Github’s API, you know that Github’s developers are doing their best to ease the pain of interacting with Github data.

from My Pocket http://www.sitepoint.com/exploring-githubs-public-events-php-google-bigquery/ php

Real-time Apps with Laravel 5.1 and Event Broadcasting



In Laravel 5.1, the framework includes functionality called broadcasting events that makes it easy to create real-time apps in PHP. With this new functionality, an app can publish events to various cloud-based real-time PubSub solutions, like Pusher, or to Redis.

from My Pocket http://www.sitepoint.com/real-time-apps-laravel-5-1-event-broadcasting/ laravel

Wednesday, June 3, 2015

Code Reviews: Before You Even Run The Code



I do a lot of code reviewing, both in my day job as principal developer and also as an open source maintainer. Sometimes it seems like I read more code than I write! Is that a problem? I'm tempted to say that it isn't.

from My Pocket http://www.lornajane.net/posts/2015/code-reviews-before-you-even-run-the-code

Record Retrieval and Pagination in Bolt CMS



Bolt is a lightweight CMS built on Silex with Symfony components that’s fast, easy, and fun to develop with. My recent affinity for Bolt has turned it into my CMS of choice as I make a conscious effort to choose wisely and step away from bloated frameworks.

from My Pocket http://www.sitepoint.com/record-retrieval-pagination-bolt-cms/

Tuesday, June 2, 2015

Phil Sturgeon: The Importance of Serializing API Output



Phil Sturgeon as a new post to his site today talking about the importance of serialized API output and why it's important to think about what to share and how they're shared.

from My Pocket http://www.phpdeveloper.org/news/22770

Laravel Podcast: Episode 28 Documentation, JavaScript, & Conspiracy Theories



The Laravel Podcast, with host Matt Stauffer and guests Taylor Otwell and Jeffrey Way, has posted their latest episode today: Episode 28: Documentation, JavaScript, & Conspiracy Theories. You can listen to this latest episode in a few different ways.

from My Pocket http://www.phpdeveloper.org/news/22771

Monday, June 1, 2015

Why you should never extend the interface

What's wrong with this code sample?

<?php

class MyClass {
    public function myFunction() {

    }
}

class myOtherClass extends MyClass {
    public function MyOtherFunction() {

    }
}

class Controller {

    public function doSomething(MyClass $object) {
        $object->MyOtherFunction();
    }

}

On first blush, it might seem that this is ordinary inheritance, and we're doing everything we should be doing. But there's something very wrong here.

The problem here is that we're extending the interface. Extending the interface itself isn't necessarily bad, but we're making a second mistake: we're then typehinting on the wrong object type.

Let's talk about why we want to avoid this practice.

The Liskov Substitution Principle

I've discussed the Liskov Substitution Principle a few times through this newsletter. But let's go over it again.

The Liskov Substitution Principle says that one object should be replacable with another object of the same type, without breaking the program.

In other words, all objects of type A should replace one another, and the application should work just fine.

But our code sample above has a big problem: we're typehinting on one object type (MyClass) but we're relying on the interface of a different object type: myOtherClass. This means that if we actually pass in an instance of MyClass, our application will break.

Let's fix it.

So, now that we know what the problem is, how do we fix it? There are three different possible solutions.


1. Treat as abstract.
First, we can treat MyClass as an abstract class, and mark it abstract. We can then include the abstract method definition, but not the code. This fixes our typehint.


<?php

abstract class MyClass {
    public function myFunction() {
    }

    abstract public function MyOtherFunction();
}

Once we've done this, our typehint is accurate and we don't have to worry about the method we want not existing, because the abstract definition guarantees it.

2. Change the typehint for the object being used.
Instead of fixing the base class, we can fix the typehint and typehint on the actual object type we want. This solves the problem by ensuring that we are telling the application precisely what to expect.

<?php


class Controller {

    public function doSomething(MyOtherClass $object) {
        $object->MyOtherFunction();
    }

}

Of course, we are now hinting on a specific object, instead of an interface. But this is still better than relying on an interface that may or may not exist in future.

3. Define different interfaces, and hint on the one we want.
It's possible in PHP to define two interfaces, and implement both of them in the same object. For example:


<?php

interface MyClass {
    public function myFunction(); }

interface myOtherClass extends MyClass {
    public function MyOtherFunction();
}

With these two interfaces, we can typehint on the interface we want, but leave the implementation details up to the future object that's going to be created. We're still guaranteed a particular interface, and this makes it easy to follow the Liskov Substitution Principle.

Objects know one another by their interface.

Regardless
 of the solution you might choose, there's one rule that you have to remember and understand: objects know each other by their interfaces.

The public methods form the "interface" or "API" that other objects use to communicate with a given object. Outside objects know nothing of the internal protected and private methods an object has; they can't use them. So, an object's interface is the only way to describe it to the outside world.

This interface therefore define's an objects type. In PHP, interfaces can't define anything besides public methods, and this is by design: when we typehint, we're saying "give me an object that has these methods."

Are your interfaces too large?

Let's talk about interfaces...

Lots of developers struggle to grasp the concept of the "interface" in PHP. But once they get the idea and understand how it works, they then struggle with a new problem: writing interfaces that are too complicated.

This might seem like a contradiction in terms: after all, we want to create comprehensiveinterfaces that describe the behavior of a particular object type. And since we don't generally want to extend the interface, shouldn't the interface we write be complete?

Yes, and no. Let me explain.

The overbearing interface

Let's take a look at a common database interface that many of my students come up with when they're tasked with writing a database layer:

<?php

interface MyDBObject {

        public function connect($host, $db, $user, $pass);

        public function query($query, array $params);

        public function prepare($query);

        public function beginTransaction();

        public function commit();

        public function rollback();

}


This interface looks good: it handles the connection and the connection-level functionality without adding in query-specific behaviors. That's what we want.

But then I pose this question to them: what happens when you encounter a database that doesn't support transactions?

Most modern databases are ACID compliant. But some still aren't. And what happens when you have to implement one of those?

Their answer is often to simply leave the transaction-aware methods blank. But this is a problem, because the Interface Segregation Principle says that no object should be required to implement a method it doesn't use.

Oops.

Fixing the interface

PHP doesn't require that we use a single interface for each object we create. In fact, the beauty of PHP interfaces is that we can implement lots of them, even though we don't have the ability to do multiple inheritance.

So, to solve this problem we can break this interface into *two separate interfaces*:

<?php

interface MyDBObject {

        public function connect($host, $db, $user, $pass);

        public function query($query, array $params);

        public function prepare($query);
}

interface TransactionAware extends MyDBObject {

        public function beginTransaction();

        public function commit();

        public function rollback();

}


There, now we have two interfaces we can use. Great! This lets us implement only those methods we need for older, non-ACID compliant databases, while giving us the methods we need for modern database applications.

Avoiding "God" objects

Another common error is the creation of an interface that does *everything*. Even if a behavior is in scope for a particular object, that doesn't mean we should necesarily implement it in this object.

Let me explain.

The Imagick library in PHP has a single object that has literally hundreds of public methods. The object interface is huge. I have it on slides in a presentation and four slides isn't enough to show the whole interface. This interface is behemoth.

This is a classic "God" object. The object is enormous, and probably does far more than it should.

My general rule of thumb is that an object should have no more than six to eight public methods or it is probably overreaching. Of course, this is not a hard and fast rule: there are many objects with a single role that have ten or twelve methods. But it is a good rule for the start of the evaluation process, and for taking a hard look at your object.

The bottom line

Creating an overbearing object or an inflexible interface is a good way to end up with objects that describe behaviors that are out of scope or not even implemented. We want to avoid both. Discrete, clean interfaces are preferable in all cases, and that's what we should strive to achieve.

When your object-oriented code, isn't.

Hey Guys, 

By the time most new PHP developers are mid-level, they have learned that object-oriented code is the approach that works for them and for programming in general. And so they decide that they want to use objects. But for too many developers, that choice to use objects doesn't represent a shift in how they develop: their objects are still procedural, but now we have procedural code wrapped in a class.

Oops.

The failure to actually object-orient our OO code is one of the biggest mistakes we can make, but luckily it's also one that we can fix.

A different thought process

Object-oriented development is a different thought process from procedural code. In procedural code, we think in a straight line, from start to finish, as our program progresses. Object-oriented code, though, necessarily contains some misdirection. And so, we have to retrain our brains.

So how do we do this?

First, we start by recognizing that objects are entities that represent other aspects of our code, or our application. For example, when dealing with POST data, instead of simply reaching for the superglobals, we want to recognize that the POST data is part of a larger context, and represent them in some object form.

We can also recognize the fact that every service or dependency we have (database, file system, cache, APIs) are things that are worthy of being represented by objects that can be mocked, tested and removed by configuration.

Writing for tests

One of the advantages of well-written object-oriented code is the testability of that code. Instead of having to rely on the "browser refresh" test method, we can write automated tests that swap one object for another, and test against known states. This dramatically improves our reliability and development process.

But in order to do this, we have to recognize that outside services and dependencies need to be mockable, to be testable. And so, object-oriented development should revolve around making this easy to accomplish.

This is where test-driven development (or TDD) really shines: by forcing us to develop tests first, we end up writing testable code that matches our assumptions and expectations. While developing your tests first may seem to be overkill, if you approach development this way, you'll quickly find that it's something you cant' live without. And your object-oriented applications will be better for it.

NEW PRODUCTS – Adafruit FONA 808 – Mini Cellular GSM + GPS Breakout / Passive GPS Antenna uFL – 9mm x 9mm : dBi gain / Passive GPS Antenna uFL – 15mm x 15mm 1 dBi gain : Adafruit Industries – Makers, hackers, artists, designers and engineers!



Check out all the Circuit Playground Episodes! Our new kid’s show and subscribe! Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.

from My Pocket https://blog.adafruit.com/2015/05/29/new-products-adafruit-fona-808-mini-cellular-gsm-gps-breakout-passive-gps-antenna-ufl-9mm-x-9mm-2dbi-gain-passive-gps-antenna-ufl-15mm-x-15mm-1-dbi-gain/

How One Publisher Increased Employee Engagement by 90%



Social media adoption can pose many challenges for larger organizations. The more staff you employ, the more time-consuming it is to ensure the digital skill level is on par across all roles and departments.

from My Pocket http://blog.hootsuite.com/how-wiley-increased-employee-engagement/

WTF is Internet-Speak and How To Use It Without Being Awk



A decade ago, this sentence wouldn’t have made any sense. Now, it’s as commonplace as any watercooler discussion about the weather—thanks to the ubiquity of Internet use among over half the world population.

from My Pocket http://blog.hootsuite.com/how-to-internet-speak/

Bing's App-Linking Tags Advance SEO



Let's play a quick game. I'm going to guess at least 10 apps you probably have on your phone. If I get at least five right, you owe me a hypothetical cookie, and if I get less than five right, I owe you a hypothetical cookie.

from My Pocket http://feeds.searchenginewatch.com/~r/sewblog/~3/JCX1CcK6jk8/bings-app-linking-tags-advance-seo

Hyundai to Take Voice Search to the Open Road



Accessing Google Maps and navigating Google Now's voice search while driving just got a lot easier for Android users with 2015 Hyundai Sonatas.

from My Pocket http://feeds.searchenginewatch.com/~r/sewblog/~3/VHCWXjE2rh8/hyundai-to-take-voice-search-to-the-open-road

"World White Web" Seeks to Diversify Google Image Search



Johanna Burai, a student at Beckmans College of Design in Stockholm, Sweden, recently noticed some serious whitewashing in Google Image searches. According to Burai, an image search for "Hand" turns up over 800 results, but all of the hands, she noticed, were white.

from My Pocket http://feeds.searchenginewatch.com/~r/sewblog/~3/L5IrzXrlhlM/-world-white-web-seeks-to-diversify-google-image-search

7 Directives to Help You Navigate the SEO Landscape of the Future



Think of a Rip Van Winkle like scenario where an SEO who went to sleep a few years ago, woke up today. Will he be able to recognize the current SEO process? Probably not - it's changed drastically.

from My Pocket http://feeds.searchenginewatch.com/~r/sewblog/~3/VCA1gO7zEjA/7-directives-to-help-you-navigate-the-seo-landscape-of-the-future