Wednesday, October 14, 2015

The Perfect #SocialMedia Management Tool: A Dream or Reality? - #infographic

The Perfect #SocialMedia Management Tool: A Dream or Reality? - #infographic

Today's internet savvy consumers can within seconds of walking into your business, tweet about their experiences, good or bad. If keeping up with what's being said about you online isn't enough, add to the mix managing the conversations and the content your customers consume.

In the end, finding one social media management tool that can do all that and more can prove to be a serious challenge.

With all of the choices out there, how do you decide on a social media marketing tool for your business? Are you concerned with pricing, usability or support? All of the above?

Luckily for us, the kind folks over at G2 Crowd took the time to assess four of the market's top social media management tools and to give us some crucial insight into where we might need to start our search.

The tools reviewed were Hootsuite, AgoraPulse, SproutSocial and Sendible. Hootsuite, Sprout Social and Sendible have been around for a while, but what really struck me was the positive user feedback on the company that I sometimes refer to as "the little engine that could," AgoraPulse.

by Guest Author via Digital Information World

How Tech Firms are Becoming More Diverse by Changing the Way They Recruit

Using PostCSS for Minification and Optimization

In the last tutorial you learned how to use PostCSS to help make your stylesheets more cross browser compatible, in particular dealing with issues arising from support for legacy versions of IE.

In this tutorial we’re going to learn how to make your stylesheets more efficient and load faster, by using PostCSS to perform various minification and optimization operations.

You’ll learn how to:

  • Combine multiple stylesheets into one via the @import rule, even if some of your stylesheets are coming from Bower components or npm modules, ensuring you need only a single http request to load your site’s CSS.
  • Combine matching media queries into one, allowing you to use the same media query in multiple locations during development but still end up with the efficiency of consolidated queries in your final stylesheet.
  • Use the cssnano pack to perform all kinds of optimizations from stripping white space and comments to minifying certain types of code and much more.

Let’s get started!

Setup Your Project

The first thing you’ll need to do is setup your project to use either Gulp or Grunt, depending on your preference. If you don't already have a preference for one or the other I recommend using Gulp as you'll need less code to achieve the same ends, so you should find it a bit simpler to work with.

You can read about how to setup Gulp or Grunt projects for PostCSS in the previous tutorials

respectively.

If you don't want to manually setup your project from scratch though, you can download the source files attached to this tutorial, and extract either the provided Gulp or Grunt starter project into an empty project folder. Then with a terminal or command prompt pointed at the folder run the command npm install.

Install Plugins

For this tutorial we’re going to be using two individual plugins, plus a plugin pack. Install them by running the following command inside your project folder:

Now the plugins are installed, let’s go ahead and load them into your project.

Load Plugins via Gulp

If you’re using Gulp, add these variables under the variables already in the file:

Now add each of those new variable names into your processors array:

Do a quick test that everything is working by running the command gulp css then checking that a new “style.css” file has appeared in your project’s “dest” folder.

Load Plugins via Grunt

If you’re using Grunt, update the processors object, which is nested under the options object, to the following:

Do a quick test that everything is working by running the command grunt postcss then checking that a new “style.css” file has appeared in your project’s “dest” folder.

That has all the plugins installed and loaded, so let’s move onto learning how to use them for minification and optimization.

Inline/Combine Files with @import

Rather than individually loading multiple stylesheets, it’s more efficient wherever possible to combine your stylesheets into one.

For example, use of Normalize.css is very common, but, if you load it as a standalone stylesheet before your main stylesheet, it requires multiple http requests, hence slowing down load time.

However if you use the postcss-import plugin by Maxime Thirouin, you can combine Normalize.css into your main stylesheet, via use of the @import rule, giving you the same CSS with only one http request.

@import then Inline Normalize.css

Let’s go ahead and do this now, importing and then inlining Normalize.css into our project’s stylesheet. Start by downloading “normalize.css” into your project’s “src” folder, from http://ift.tt/1unRGLi

At the top of your “src/style.css” file add the following line:

As you already have postcss-import installed, that’s all you have to do. It will see the @import rule and automatically inline the code from the normalize.css file into your stylesheet.

Compile your file, and when you look at your “dest/style.css” file you should see the entire contents of “normalize.css” therein:

You can use this same process to combine as many separate stylesheets as you need to. Just place @import lines in your “src/style.css” file wherever you want the inlined code to be inserted.

Automatic Bower Component and Node Module Discovery

One very helpful feature of this plugin is its ability to automatically discover CSS files situated inside your “bower_components” or “node_modules” folder.

For example, rather than manually downloading “normalize.css” as we did above, you could instead just run the command bower install normalize.css --save in your project. This would automatically download the latest “normalize.css” file into the “bower_components/normalize.css” folder.

Note: If you don’t have Bower setup on your computer learn how here.

At the top of your stylesheet, you could now instead use this line:

The postcss-import plugin will look inside your “bower_components” folder and find “normalize.css”, then proceed to inline it just as in the previous example.

The same process can be followed for any stylesheets that are in your “node_modules” folder, meaning you can use either Bower or npm to handle downloads, dependency management and updates. When using either service this plugin gives you an easy means of combining third party CSS files into your own stylesheets.

Ways to Leverage @import Inlining

Inlining imported CSS files in this way is not only a very efficient way of combining files from different sources, such as Bower components, it also gives you the option of organizing your project into multiple separate stylesheets.

For example, you might create one file to control your layout, and another to control your color scheme. If you wanted to change your color scheme you could then follow a process like this:

  1. Duplicate original color stylesheet
  2. Modify it with new color codes
  3. Import the new color stylesheet into your project
  4. Compile to create alternate colored stylesheet

You could then repeat this process as many times as you wanted, making it efficient to create multiple color schemes for the same design.

Some projects use separate stylesheets to provide multiple color schemes like this, but in the process create slowdown from added http requests. With this approach you always end up with just one http request, despite having a lot of freedom in what might be included in your single stylesheet.

Read more about postcss-import at: http://ift.tt/19VYIyP

Combine Matching Media Queries

The css-mqpacker plugin by Kyo Nagashima will find matching media queries in your stylesheet and combine them into one. This allows you to organize your CSS how you please in your development stylesheets, repeating media queries if you need to, without concern over any loss of efficiency in your production stylesheet.

Let’s put together an example of the type of use case where you might want to repeat media queries, such as if you’re organizing your design’s layout and visuals separately. In a real project this might mean using completely separate files, one for layout and one for visuals, but for the sake of simplicity we’ll do this all in our “src/style.css” file.

We’ll start with some layout code. We’ll add a .column class that will make two 50% width columns sit side by side, by default. Then we’ll use a media query to have them stack on top of each other at smaller sizes. Add this code to your stylesheet:

Next we’ll add some visuals to set a gray border around our columns. The first column will have the class .column_one and the second will have the class .column_two. We’re going to use the same media query as we did with our layout to change up how we apply a border to our columns, depending on whether they’re sitting side by side or one on top of the other.

Add this code to your stylesheet as well:

Now, recompile your “src/style.css” file and take a look at the resulting “dest/style.css” content.

As you can see in the code below, the css-mqpacker plugin has identified the two matching media queries, and combined them into one:

Note: The above code will be minified in your “dest/style.css” file due to the cssnano plugin. To see the code unminified, temporarily comment out cssnano from your Gulpfile or Gruntfile’s processors array.

Read more about css-mqpacker at http://ift.tt/1eqKXUY

cssnano Plugin Pack

For comprehensive and multifaceted CSS optimization, the cssnano pack by Ben Briggs is a very powerful option, yet one that is pretty much plug and play. It brings together around twenty-five plugins, and can perform an impressive number of different types of optimization.

Among a long list of optimizations, it can:

  • Strip whitespace and final semicolons
  • Remove comments
  • Optimize font weights
  • Discard duplicate rules
  • Optimize calc() use
  • Minify selectors
  • Minimize longhand properties
  • Merge rules

We’re going to process some example code in your project that will see all of the above optimizations applied.

Add this code to your “src/style.css” file:

Then recompile your file.

Note: you may wish to comment out any code you already had, so you can clearly see the results.

In your “dest/style.css” file you should now see the optimized code:

Have a look through the list of optimizations mentioned in the bullet list above, then compare the example code before and after compilation to see how each one of these changes takes place:

  • Whitespace, comments and final semicolons are gone
  • font-weight: normal and font-weight: bold are converted to font-weight: 400 and font-weight: 700
  • The second, repeated instance of the rule font-weight: normal; has been removed from the .css_nano style
  • The calc() property has been reduced to a static value
  • The selectors .css_nano, .css_nano + p, [class*="css_nano"], .css_nano have been minified to .css_nano,.css_nano+p,[class*=css_nano]
  • The longhand properties margin-top: 1rem; margin-bottom: 2rem; margin-left: 1.5rem; margin-right: 2.5rem; have been reduced to margin:1rem 2.5rem 2rem 1.5rem;
  • The a and p styles have been merged to share their common font-weight: 700; setting

For a full list of optimizations cssnano provides check out: http://ift.tt/1KorU0d

Configuring Options and Disabling Modules

There are several independent plugins employed by the cssnano pack, and you may wish to configure settings for, or fully disable, some of them.

To disable a plugin, pass its name in your options for cssnano with the setting “false” applied. For example, if you don’t want to optimize font weights set the following in your Gulpfile/Gruntfile:

You can follow the same approach to configure options for a plugin, giving the name of the plugin first then setting its options.

For example, you can set the precision, (number of decimal places), the calc plugin should use. By default calc( 100% / 2.76 ) would give you 36.23188%. But if you wanted to trim that precision down to two decimal places you could do it like so:

The calc value would now output to 36.23%.

For more info on cssnano options visit: http://ift.tt/1Pu4eKG

Quick Recap

Let’s have a rundown of what we covered above:

  • The postcss-import plugin gives you an efficient way to inline stylesheets.
  • It can be used to combine third party stylesheets, including through auto-discovery in your “bower_components” or “npm_modules” folder.
  • It can be used to allow you to split your stylesheets into parts, then recombine them later.
  • The css-mqpacker plugin allows you to duplicate media queries so you can organize your CSS how you please, including into separate files, and then have all matching media queries combined in your final stylesheet.
  • The cssnano pack brings together around 25 different plugins, giving plug and play access to a long list of minification and optimization functions.
  • It can be configured to use whichever included plugins you want, with the options you want.

Up Next: Preprocessing with PreCSS

In the next tutorial we’ll dive into using PostCSS for preprocessing via an excellent plugin pack named PreCSS. This pack gives immediate access to Sass-like syntax and functionality, with variables, mixins, conditionals, extends and more.

See you in the next tutorial!


by Kezz Bracey via Tuts+ Code

Function Currying in Swift

Mastering WP_Query: 10 Useful Examples

Now that we learned almost everything about the WP_Query class, it's time to try out some examples. In this part, we're going to work on 10 different scenarios to utilize the WP_Query class and related functions.

It will be a fun exercise and I hope it will be equally educational. Let's begin!

A Quick Reminder on Creating a Loop With WP_Query

Just to make this article be understandable separately from the "Mastering WP_Query" series, I should do a nano-tutorial on creating WordPress loops with the WP_Query class.

It's not different than creating a regular loop, really. A typical WordPress loop goes like this:

And creating a loop with the WP_Query class has only a few differences:

Let's see the difference between the two:

  • We set some arguments for our WP_Query instance,
  • We instantiated the WP_Query class,
  • We added $my_query-> to the beginning of the have_posts() and the_post() functions (so they're now the methods of the WP_Query class),
  • And we reset the data of $post so it can return to the main query.

Now we know how to create a loop with WP_Query and the difference between a regular loop and a loop created with WP_Query. We're not going to create loops in every example (for the sake of keeping the tutorial short and on topic), so you can refer to this section if you need to create a loop with the examples below.

Example #1: An Author's Posts in This Year

Let's say that you want to list a specific author's posts written in the current year in a special "Author's Posts This Year" section. A simple combination of two WP_Query parameters will suffice:

Pass this query in a loop and you're good to go!

Example #2: "Latest Posts From This Category" (Except the Current Post)

Let's say that you want to create a loop under each post in their single post pages, and list latest posts from the category that the post is in. Of course, you have to exclude the current post in case it might be one of the latest posts from that category. Here's how you create the query with the 'cat' and 'post__not_in' parameters:

For the loop, I suggest creating three or four columns with post thumbnails above post titles. It will look really nice right under the post and before the comments section.

Example #3: "Most Popular Posts" Ordered by Comment Count

WordPress doesn't have a built-in "post view count" system, and plugins that provide this functionality are famous for slowing down the website (because on each post view, the plugins write in the database over and over again to record the view counts). However, there's another kind of measurement to determine which posts are most "popular": counting comments. And unlike view counts, comment counts are already in the database—the WP_Query class makes it super easy to order posts by comment count:

See how easy this is? Now imagine creating a custom page template with a loop running this query—a "Most Commented Posts" page.

Example #4: A Simple Slider Setup

When using WordPress to build corporate websites, portfolios or web magazines, sliders have become a "must-have" industrial standard. I'm not really a fan of sliders (I think it's bad UX) but the web seems to like it, so I can't just say no to my clients while making websites for them. If they want sliders, I use a simple query using the WP_Query class:

The 'cat' argument can be used to retrieve slides from different categories so you can separate slide groups and use multiple sliders on multiple pages. If you're going to use just one slider in your website, you can delete that line and you're good to go.

Example #5: A Random Quote in the Sidebar

If you're keen on literature or religious, you might want to have some of your favorite quotes in the sidebar—it's not a waste of space if you use the area with purpose. So, if you're going to list a random quote in your sidebar on each page view, you can use the following code snippet to create the post type and use the following query to create a loop in your sidebar:

An easy and elegant solution.

Example #6: Listing Products Between a Price Range

I found this example on Scribu.net and I must say, it might be the best WP_Query trick in this tutorial. It's a bit more technical than the others, too, because it can be applied to a WordPress-powered e-commerce website in this context.

Here's the code snippet you'll use if you want to list items from a custom "Product" post type and filter the results with the "price" custom fields:

A big kudos to Silviu-Cristian Burca!

Example #7: A Shortcode to Embed Posts Inside Posts

Here's a fun exercise—and we get to use the Shortcode API too! In this example, we're going to create a shortcode that can embed a post within a post. (I hardly contained myself from naming the shortcode [postception].) In the following code snippet, we create a shortcode function that allows us to embed posts (or any custom post type) and lets us choose whether to show the full post or just an excerpt:

Example #8: List of Current Scheduled Posts (With Optional Excerpts)

Here's an idea: Why don't you display some "sneak peeks" of your upcoming posts to your visitors? You can use the following function to list your scheduled posts with or without excerpts after the titles:

Example #9: "Post From a Year Ago Today"

If your blog is older than a year, and your content is timeless (meaning both a person from 2015 and 2025 will find the article relevant), adding a "Post From a Year Ago Today" section might boost your page views. Here's how you do it:

Use this query to build a loop that displays a single post from yesteryear.

Example #10: Show Children of Current Page

You have nothing other than sub-pages' titles to put inside your "Services", "Our Works" or "My Portfolio" page? Maybe an intro paragraph, but you're right, those pages are doomed to be "placeholders". Still, it's a good idea to place sub-pages in there—maybe a grid with square thumbnails and titles below. Let's see which query we should use when creating such a page template:

Wrapping Up

I hope you enjoyed these examples as much as I did while preparing them. I paid special attention to giving varying examples both to be fun and to spark your creativity.

If you thought of better examples while reading these ones, or have questions, don't hesitate to shoot a comment below. And if you liked the article, don't forget to share it with your friends!

In the next part, we'll talk about WP_User_Query, one of the sister classes of WP_Query. See you then!


by Barış Ünver via Tuts+ Code

Trying Linux for the First Time: a Beginner’s Guide

You're probably familiar with Windows and/or Mac OS. But they aren't the only operating systems available. A popular alternative is Linux. In this article, Lesley Lutomski introduces Linux and what you need to know to give it a try.


Linux penguin

I'm constantly surprised by people who tell me they'd like to try Linux, but think it's “too hard”.

There seems to be a common misapprehension that Linux is “for geeks”. Certainly, this was once the case: dedicated users compiled their own kernels, and it wasn't for the faint-hearted.

But Linux has come a long way since those days. So, if you've never tried it, or tried it many years ago and gave up, I'd encourage you to think again.

Choose Your Flavor

Linux comes in many “flavors”, or “distributions”—normally referred to as distros. Some of these are aimed firmly at a mainstream audience, and I'd suggest using one of these to get your feet wet. The best known of these is possibly Ubuntu, which is the one I use and the one I'll concentrate on here. Linux Mint is also popular, but there are many more.

Ubuntu Gnome desktopUbuntu Gnome desktop

Difficult or Not?

So is it difficult to use? Not in my experience. The first thing I noticed when we switched to Ubuntu was the sudden reduction in the number of distress calls I received from my husband. He seemed to experience fewer problems using the system than he had on Windows XP, and also seemed to feel more confident about trying things for himself, rather than panicking that he might “break something”.

I also set up a Xubuntu system for an elderly friend who had never used a computer of any kind, and she rapidly got to grips with it.

What Are the Benefits?

For many people, cost will be a consideration. Most popular Linux distros—and their associated software—are free to download and use. For others, the open-source nature of the OS appeals.

Linux is also far less susceptible to viruses than Windows. The main reason for this is simply that most viruses are designed to target Windows machines and will have no effect on a Linux system. It's not true that Linux systems are immune to viruses, but they are very rare. A humorous explanation can be found here.

This added security is one reason we chose it for our elderly friend. Although Linux viruses are rare, ClamAV is free and helps ensure you don't inadvertently download and pass on viruses to friends with Windows.

ubuntu gnome desktop traditionalUbuntu Gnome desktop – traditional version

Will Linux Be Compatible with My Hardware?

Linux will run well on most PCs, although if you have the very latest cutting-edge technology, you may find it's not immediately supported.

On the other hand, installing Linux can be a great way to breathe new life into old hardware. Some distros are designed to be lightweight—such as the Ubuntu variant Xubuntu—and will perform well on systems with limited resources.

It's also possible to run Linux on a Mac, although I have no experience of this. The Ubuntu Forums—a great source of help and support—have a dedicated section for Apple hardware users.

How to Choose a Distro?

The easiest way is simply to try one and see if you like it. This isn't nearly as radical as it sounds.

Many distros are free to download, after which you can burn them to DVD. They can then be run as a “live” CD/DVD. In other words, you boot your system from the DVD—or a USB drive—and run the OS from there. It doesn't have to be installed, and nothing is written to your hard drive—although you should be able to access files on your hard drive while in Linux.

This is a great way to get a feel for the distro at no risk, and it also lets you check there are no problems with your hardware. The Ubuntu site provides very clear tutorials for getting all this done.

Ubuntu options

A word of caution, though; running from a live DVD is noticeably slower than running from a hard drive, so you should make allowances for this. Also, should you decide to stick with Linux, you may find extra proprietary drivers to improve the performance of graphics and other hardware.

Continue reading %Trying Linux for the First Time: a Beginner’s Guide%


by Lesley Lutomski via SitePoint

Building an Image Gallery Component with Polymer

Web components are becoming the future trend of Web application development. They allow us to group HTML markup, scripts, and styles into a reusable component. These components are part of the browser and hence don't need external JavaScript libraries like jQuery to provide its functionality. As reported by Wikipedia,

Web Components are a set of standards currently being produced by Google engineers as a W3C specification that allow for the creation of reusable widgets or components in web documents and web applications. The intention behind them is to bring component-based software engineering to the World Wide Web. The components model allows for encapsulation and interoperability of individual HTML elements.

In short, web components resolve the complexity of elements in a Web page and provide a simpler and easily understandable element structure. HTML already provides sets of built in tags such as headers, paragraphs, lists and so on. However, in some cases the existing tags are not enough to provide the right support to large Web applications and here is where Web components come to the rescue. Some libraries, most notably Polymer, are making web components usable in non supporting browsers with Polyfill Web Components.

In this tutorial, we're going to learn how to create an Image Gallery component with Polymer version 1.0. All the code provided in this article is available on GitHub.

Continue reading %Building an Image Gallery Component with Polymer%


by Rakhitha Nimesh via SitePoint