Wednesday, September 16, 2015

The Ultimate Guide to Landing Page Builders for Startups

In a world that moves this fast, ideas must be prototyped, tested and launched in as little time as possible. Gone are the days when companies and individuals could afford to spend months designing a page only to find out that buyers weren’t even interested in the product it featured. Reaching product-market fit, or the […]

Continue reading %The Ultimate Guide to Landing Page Builders for Startups%


by Laura Busche via SitePoint

Build a Superfast PHP Server in Minutes with Icicle

Event-based programming is a strange topic for PHP developers. In a language as procedural; events are little more than function calls. Nothing happens between events, and all meaningful code is still blocking.

Languages like JavaScript show us what PHP could be like if event loops were at the center. Some folks have taken these insights and coded them into event loops and HTTP servers. Today we’re going to create an HTTP server, in PHP. We’ll connect it to Apache to serve static files quickly. Everything else will pass through our PHP HTTP server, based on Icicle.

Icicles illustration

You can find the example code at http://ift.tt/1LgVnKK

Continue reading %Build a Superfast PHP Server in Minutes with Icicle%


by Christopher Pitt via SitePoint

The Full Stack Overflow Developer

This article is part of a web development series from Microsoft. Thank you for supporting the partners who make SitePoint possible.

In a few talks and interviews I lamented about a phenomenon in our market that’s always been around, but seems to be rampant by now: the one of the Full Stack Overflow developer. Prompted by Stephen Hay on Twitter, I shall now talk a bit about what this means.

Cut-Copy-Paste

Full Stack Overflow developers work almost entirely by copying and pasting code from Stack Overflow instead of understanding what they are doing. Instead of researching a topic, they go there first to ask a question hoping people will just give them the result.

[author_more]

In many cases, this works out. It is amazing what you can achieve by pasting things you don’t understand, that people who know what they are doing put out there.

I am not having a go at Stack Overflow here. It is an incredible resource and it is hard to create a community like this and not drown in spam and mediocrity (trust me, I am an admin on several technical Facebook groups).

We had that problem for a long time. I challenge anyone learning PHP to not simply copy the code examples in the notes. For years, code reference sites have given us answers we wanted, but didn’t need. Heck, even Matt’s Script Archive is probably the source for many a spam mailer as people used formmail.pl without knowing what it does.

I am, however, worried about how rampant this behaviour is today. Of course, it is understandable:

  • Creating something is more fun than reading up on how to create something.
  • Using something that works immediately, even if you don’t know how it does it, feels better than encountering the frustration of not being able to fix something.
  • You feel like you cheated the system – shortcuts are fun, and makes you feel like you’re cleverer than all those chumps who spend all this time learning.
  • Our job is mainstream and there is a massive need for developers. The speed of how we are asked to deliver has massively increased. People want results quicker, rather than cleaner.

We, as a community, are partly to blame for breeding this kind of developer:

  • When we answer questions, we tend to give the solution instead of analysing what the person really needs. This is much more work, so we tend to avoid it.
  • Posting the "one true solution" and winning a thread on Stack Overflow feels great – even if we have no plan whatsoever to come back to it later if it turns out not to be such a good idea any longer as the environment changed.
  • Getting recognition, Karma and upvotes for giving the solution is much easier than getting it for being the person who asks the right questions to get to the source of the problem.
  • It is easy to lose patience with getting the same questions over and over again and a "just use jQuery" is easy to paste.

So what? Why is it a problem if people are faster and more effective in releasing products?

Of course, you can call me a grumpy old so-and-so now and tell me that the concept of learning the basics in software is an outdated concept. The complexity of today’s products makes it almost impossible to know everything and in other, highly successful environments using lots of packages and libraries is par for the course. Fine, although we seem to be understanding that software as a whole might be more broken than we care to admit, and this might be one of the causes.

There are several problems with Full Stack Overflow development:

Continue reading %The Full Stack Overflow Developer%


by Christian Heilmann via SitePoint

Scanning a QR Code with Cordova

A barcode is a machine readable image that encapsulates some data about the object to which it’s attached to. A Quick Response Code (QR Code) is a popular type of barcode for mobile use due to its fast readability and greater storage capacity compared to ordinary barcodes.

In this tutorial I will create a Cordova app which can scan QR Codes and store data obtained from decoding the QR Codes. To scan the barcode I will use the BarcodeScanner Cordova plugin.

Continue reading %Scanning a QR Code with Cordova%


by Narayan Prusty via SitePoint

This Week's HTML5 and Browser Technology News (Issue 206)


Read this e-mail on the Web
HTML 5 Weekly
Issue 206 — September 16, 2015
Christian Heilmann
The ‘template’ element lets you define ‘inert’ content in HTML that won’t be rendered or executed by the browser but that you can then bring into the DOM later. It works almost everywhere except IE and Edge.


Modernizr
Some 2 years since the last major release, Modernizr 3, a JS library that lets you detect the availability of numerous next-gen Web technologies, brings a lot of things up to date and over 100 new types of ‘detect’ have been added.


Jonathan Watt
Mozilla has been working on a Microsoft-led proposal called Directory Upload for allowing full directory uploads from the browser. Learn more here including why they haven’t adopted Chrome’s approach.


Hired.com  Sponsored
On Hired, we'll bring the options to you. With over 2,000 pre-screened tech companies in 10 cities in the US & UK, you'll be sure to find what you're looking for. Join Hired today.

Hired.com

Smashing Magazine
Heydon Pickering demonstrates using frames defined in SVG along with CSS defined transitions to produce striking and efficient cel-style animations.


The Polymer Summit 2015
Paul Irish demonstrates how the Chrome DevTools can help you understand where time is spent in your app and effective means of profiling your performance.


YouTube
Google provides details on what they are doing to progress WebRTC and related internal developments - they also cover details on the recently announced Alliance for Open Media, an effort to create royalty-free video codecs.


W3C
SVG (Scalable Vector Graphics) is an increasingly useful and supported format for specifying vector and mixed vector/raster graphics. Tons of examples and code buried within.


Little Workshop
A well produced dungeon crawler game. Loads fast, good graphics, a great example of what HTML5 and WebGL can do when used elegantly. Must be good as I’m not into dungeon crawlers and it stole 20 minutes..


O'Reilly Media
Fluent is an annual JavaScript and Web Platform conference (which I chair) based on San Francisco. We’re looking for more great speakers for 2016’s event.


In brief

Curated by Peter Cooper and published by Cooper Press.
Want to post a job? E-mail us or use our self-serve system.

Unsubscribe : Change email address : Read this issue on the Web

Published by Cooper Press Ltd. Office 30, Lincoln Way, Louth, LN11 0LS, UK


by via HTML5 Weekly

Introduction to Blocks in Scratch

Mastering WP_Query: Properties and Methods

Welcome to yet another part of our "Mastering WP_Query" series. How are we doing so far? I hope you're enjoying these tutorials as much as we're enjoying writing them.

In this tutorial, you're going to learn about the properties and methods of the WP_Query class. But first, I think it's appropriate to talk about what "properties" and "methods" are in a class.

Shall we?

What Are Properties and Methods, Exactly?

In PHP, there's a way to write code in a cleaner way: object-oriented programming, or OOP. With OOP, we use "classes" as blueprints—I took the term from one of the classic posts of Code Tuts+, "Object-Oriented PHP for Beginners" by Jason Lengstorf:

A class, for example, is like a blueprint for a house. It defines the shape of the house on paper, with relationships between the different parts of the house clearly defined and planned out, even though the house doesn't exist.

(And remember that WP_Query is an essential class of the WordPress core.)

When you understand the notion of PHP classes, "properties" and "methods" become extremely easy to understand since the words are just synonyms for "variables" and "functions". Yep, properties are variables of a PHP class and methods are functions of a PHP class.

Now we've covered what they are, let's get to know each of those properties and methods.

Warning: It wouldn't be wise to change the properties directly. As the Codex says, you should interact with them using the methods of WP_Query.

Properties of the WP_Query Class

Let's begin with the properties, or the variables, of the WP_Query class.

The Query String: $query

This property stores the query passed to the $wp_query object.

The Array of Query Variables: $query_vars

This property stores an associative array of the variables (and their values) of $query.

The Queried Object: $queried_object

This property stores the currently queried object, like the $post object if it's a post query or the $author object if it's an author query.

The ID of the Queried Object: $queried_object_id

This property stores the ID of the queried object.

The Posts Returned From the Query: $posts

This property stores the posts returned from the query.

The Number of Posts Being Displayed: $post_count

This property stores the number of posts for the current query.

The Number of Posts Returned from the Query: $found_posts

This property stores the number of posts without the LIMIT clause of the SQL query.

The Number of Pages: $max_num_pages

This property stores the number of pages—it's calculated by dividing $found_posts by $posts_per_page.

The Index of the Current Post: $current_post

This property stores the index number of the current item in the Loop. For example, it's -1 if the Loop has just started and it's incremented by the next_post() method.

The Current Post: $post

This property stores, well, the current post.

Conditional Tag Booleans: $is_{conditional}

The following properties are stored as booleans, giving information about the current post's status:

  • $is_single: Checks if it's a single post of any post type (except "attachment" and "page" post types) or not.
  • $is_page: Checks if it's a page or not.
  • $is_archive: Checks if it's an archive page or not.
  • $is_preview: Checks if it's a post preview or not.
  • $is_date: Checks if it's a date-based archive page or not.
  • $is_year: Checks if it's a year-based archive page or not.
  • $is_month: Checks if it's a month-based archive page or not.
  • $is_time: Checks if it's a time-based (hourly, minutely or secondly) archive page or not.
  • $is_author: Checks if it's an author's archive page or not.
  • $is_category: Checks if it's a category archive page or not.
  • $is_tag: Checks if it's a tag archive page or not.
  • $is_tax: Checks if it's a taxonomy archive page or not.
  • $is_search: Checks if it's a "search results" page or not.
  • $is_feed: Checks if it's a feed or not.
  • $is_comment_feed: Checks if it's a comment feed or not.
  • $is_trackback: Checks if it's a trackback or not.
  • $is_home: Checks if it's the main blog page or not.
  • $is_404: Checks if it's a 404 error page or not.
  • $is_comments_popup: Checks if it's a comments popup window or not.
  • $is_admin: Checks if it's the administration panel or not.
  • $is_attachment: Checks if it's an attachment or not.
  • $is_singular: Checks if it's a single post of any post type (including "attachment" and "page" post types) or not.
  • $is_robots: Checks if it's a query for the robots.txt file or not.
  • $is_posts_page: Checks if it's the "Posts Page" (set on the "Reading Settings" page in the admin panel) or not.
  • $is_paged: Checks if it's a paginated query and it's not the first page.

Methods of the WP_Query Class

Now that we're done with the properties, let's move on to the methods (functions) of the WP_Query class.

init()

This method simply initializes the object, setting all properties to NULL, 0 or FALSE.

parse_query( $query )

This method uses the $query property to parse the query and populate all other properties (except $posts, $post_count, $post and $current_post).

parse_query_vars()

This method reparses the query variables.

get( $query_var )

This method fetches a given query variable.

set( $query_var, $value )

This method sets the given query variable to a specific value.

&get_posts()

This method returns the posts requested by the query and populates the $posts and $post_count properties.

next_post()

This method increments the $current_post index and advances to the next post in $posts, returning the current post object. (This method must be used inside a Loop to work properly.)

the_post()

This method sets the global $post variable with the next post's data. (This method must be used inside a Loop to work properly.)

have_posts()

This method checks if there are any posts left to work on, and returns FALSE if there aren't. (This method must be used before a Loop to work properly.)

rewind_posts()

This method simply resets the $current_post and $post properties.

&query( $query )

This method calls two of its sibling methods, parse_query() and get_posts(), and returns the result of get_posts().

get_queried_object()

This method returns the queried object. (It sets $queried_object if it's not already set.)

get_queried_object_id()

This method, similar to the one above, returns the queried object's ID ($queried_object_id).

Quick Tip: If there's an ampersand before a method, it means that the method returns by reference.

Wrapping Up for Today

I hope I managed to make it clear for you what "properties" and "methods" mean for classes. And if you understood the purpose of the properties and methods of the WP_Query class, I can say that I've done a decent job!

Do you have anything to add to this article? Share your thoughts with us in the Comments section below. And if you liked the article, don't forget to share it with your friends.

See you in the next part of the series!


by Barış Ünver via Tuts+ Code