Monday, April 10, 2017

New Coffee Break Course: Taming Python With Unit Tests

How to Build a Content Strategy From the Ground Up

Content strategy

Content is the currency of the web, and for good reason.

However, a lot of people expect to see instant results once they publish their first post. Content marketing is truly a long-term game. But, when done properly it can help send you traffic for years to come.

It’s the cumulative impact of each piece of content you publish that truly gets your business the results you’re looking for.

It takes some work to build a content strategy from the ground up, but it’s a much better plan than pressing publish and crossing your fingers. Below you’ll learn how you can create a stellar content strategy from the ground up.

Why Content Marketing Is Important

Face it, a lot of advertising is invasive. Today’s consumers are bombarded with advertisements more frequently than ever before.

Most other forms of marketing and lead generation are focused on the short term. Sure, you might see more instant results with other means, but when it comes to long term business goals, your content will help you get there.

Plus, the content you create can help to improve any other existing marketing strategies you might have in the works. For example, content can help to improve your search engine presence, give you something to share on social media and bolster your existing brand.

Benefits of Content Marketing

Beyond enhancing existing strategies content marketing also has certain benefits all on its own. Remember, it’s a long-term strategy, so you won’t experience these benefits right away, but if you stick with it they’ll start to show up.

  • Greater search engine presence. The more high-quality content you have the more indexed pages you’ll have in Google, thus giving you a larger online presence.
  • More targeted traffic. Every piece of content you publish has the potential to generate traffic for you. Whether that’s from your own posts ranking, or referral traffic from other sharing and linking to your content.
  • Increased brand visibility. When people read and engage with and share your content you’re not only growing your online presence, but cultivating a positive relationship with these readers at the very same time.
  • Improved customer relationships. The relationships with your customers are everything. By producing high-quality content that solves their problems you deepen your relationship and show that you can be trusted before they even decide to buy.
  • Decreasing costs over time. The great thing about content is you only have to pay once, and it can continue to generate traffic and revenue for your business for a long time to come.

How to Build Your Content Strategy

Every great content strategy starts with a plan. The plan highlighted below might seem like a lot of work. But, it’s work you only have to do once and can base your entire content strategy around.

1. Organizing and Building the Backbone

A great content strategy starts with understanding your market. You need to know who your audience is, what their interests are, what kind of questions they want answered, and how they like to consume content.

Some of your best ideas will come from things that are already successful. It’s hard to create content from scratch that’s guaranteed to be a hit. However, you can take ideas and strategies from players in your niche that have worked and put your own spin on it.

This helps in two ways. First, it gives you the certainty that what you create is going to be successful, no need to reinvent the wheel. Two, it immediately positions you as an authority as you have a well-crafted piece of content that puts you in the running.

To seed your idea bank ask yourself the following questions:

  • Is there a specific form of content my audience likes?
  • How long can I spend on each piece I create?
  • Do I have any existing data or content I’d like to utilize?

1. Competitor and Market Understanding

Studying your competitors is a surefire way to see what is and isn’t working in your niche. This will help you differentiate from what’s already out there in your space, so you can avoid treading the same path again and again.

Continue reading %How to Build a Content Strategy From the Ground Up%


by Kevin Wood via SitePoint

Building a Python Code Review Scheduler: Processing Log

In this tutorial series, you'll see how to build a code review scheduler using Python. Throughout the course of this series, you'll brush up against some basic concepts like reading emails, sending an email, executing terminal commands from Python program, processing git logs, etc.

In the first part, you'll start by setting up the basic configuration files, reading git logs, and processing them for sending the code review request. 

Getting Started

Start by creating a project folder called CodeReviewer. Inside the CodeReviewer folder, create a file called scheduler.py

Assuming the code review scheduler will be run against multiple projects, you'll need to specify the project name against which the scheduler will run and the number of days for which the log needs to processed. So first read these two parameters as arguments from the code review program. 

Let's make use of the argparse Python module for reading the program parameters. Import the library and add the program arguments. You can use the ArgumentParser method of the argparse module to initiate the parser. Once it's initiated, you can add the arguments to the parser. Here is the code for reading the arguments from the program:

Setting Up Project Configurations

Let's maintain a separate config file that will be processed by the code reviewer. Create a file called config.json inside the project directory CodeReviewer. Inside the config file, there will be information about each project that will be processed. Here is how the project config file would look:

A few more options would be added to the project configurations in the later parts. 

Let's read the configuration JSON file into the Python program. Import the JSON module and load the JSON data read from the config file.

Read Commit Info From the Repository

When the reviewer script is run, the project name is specified as a parameter. Based on the project name specified, check if its configurations are available and clone the repository. 

First, you need to find the project URL from the configurations. Iterate the project's data and find the project URL as shown:

Once you have the project URL, check if the project is already cloned. If not, clone the project URL. If it already exists, navigate to the existing project directory and pull the latest changes.

To execute system commands, you'll be making use of the Python os module. Create a method to execute system commands since you'll be using it frequently. Here is the execute_cmd method:

Processing the Git Log

After fetching the commit log from the Git repository, you'll analyze the log. Create a new Python method called process_commits to process the Git logs.

Git provides us with the commands to get the commit log. To get all logs from a repository, the command would be:

The response would be:

You can also get logs specific to the number of days from the time the command is executed. To get logs since n number of days, the command would be:

You can narrow it down further to see whether a particular commit was an addition, modification, or deletion. Execute the above command with --name-status:

The above command would have the following output:

The A letter on the left side of the README.md file indicates addition. Similarly, M would indicate modification and D would indicate deletion.

Inside the process_commits method, let's define the Git command to be executed to get the log history. 

Pass the above command cmd to the execute_cmd method.

Read the response, iterate each line, and print the same.

Make a call to the process_commits method after the configurations have been read.

Save the above changes and try to execute the code reviewer using the following command:

As you can see, we have started the code reviewer with the number of days and the project name to process. You should be able to see the following output:

So when you execute the code reviewer, you can see that the repository is created if it doesn't already exist, or else it is updated. After that, based on the number of days provided, it fetches the commit log history to process. 

Now let's analyze the commit log to find out the commit Id, commit date, and commit author.

As seen in the logs, the commit id starts with the keyword commit , author starts with the keyword Author:, and date starts with the keyword Date:. You'll be using the following keywords to identify the commit Id, author and date for a commit.

Let's try to get the commit Id from the Git log lines. This is quite straightforward. You only need to check if the line starts with the keyword commit.

Save the changes and execute the scheduler and you should be able to get the commit Id.

The next task is to extract the author name. To check if the line contains the author info, you'll first check if the line starts with the Author keyword. If it does, you'll make use of a regular expression to get the user. 

As you can see, the user email address is inside the "less than greater than" signs. We'll use a regular expression to read the email address between < >. The regular expression will be like this:

Import the Python re module to use regular expressions in Python.

Now check if the line starts with the Author keyword. If it does, extract the user email address using the regular expression above. Here is how it would look:

To extract the commit date from the log, you need to check if the line starts with the Date keyword. Here is how it would look:

Here is the final process_commits method:

Save the above changes and start the code reviewer.

You should have each commit detail with the commit Id, Author and commit date printed on the terminal.

Wrapping It Up

In this first part of the Python Code Review Scheduler, you saw how to set up the project. You read the input parameters required by the scheduler to process the project. In the next part of this tutorial series, we'll collect the commit details from the process_commits method and send the commit to random developers for code review.

Don’t hesitate to see what we have available for sale and for study on Envato Market, and don't hesitate to ask any questions and provide your valuable feedback using the feed below.

I hope you enjoyed the first part. Do let us know your thoughts or any suggestions in the comments below.

Source code from this tutorial is available on GitHub.


by Roy Agasthyan via Envato Tuts+ Code

Clutterless

Clutterless Free WordPress Theme

'Clutterless' is an ultra minimal One Page blogging theme. The WordPress theme features a unique slide-out info sidebar as well as AJAX loading posts - meaning the theme is technically One Page. Absolutely all distractions have been stripped out, so readers can focus on what is important, the content.

by Rob Hope via One Page Love

Collect.io

Collect.io

Great looking launching soon page for Collect.io - an upcoming (Open Source) visual bookmark manager. The interactive 'Organize your resources' section is really impressive.

by Rob Hope via One Page Love

Five Simple Ways to Build Artificial Intelligence in 2017

The artificial intelligence and voice recognition space has been growing rapidly. The idea of having a personal assistant you can beckon with the words "Siri", "Alexa", "Cortana" or "Ok Google" which connects us to the web and the ever growing Internet of Things (IoT) is becoming ever more commonplace. Even Facebook started getting into the action, releasing its own AI assistant named "M" to a select few within Facebook Messenger. Soon enough, we shall all have artificial intelligence assistants at our disposal!

Luckily for developers who don't want to wait any longer, there are also a range of services available that make it simple to get started with the basics of building your own artificial intelligence system for whatever purpose you can dream up. Connect up your smart home, control a self made media center, deliver all sorts of information via a personal AI assistant... there are so many options available thanks to APIs and services. This lead up throughout 2015 has made 2016 the year where developers can really get into artificial intelligence and start building solutions of their own.

In this overview, we'll look at the services that exist which can enable developers to begin connecting their own apps and IoT devices to voice recognition and artificial intelligence throughout 2016.

Wit.ai

Wit.ai

Wit.ai is a service which provides a nice combination of both voice recognition and machine learning for developers. It provides the service to convert verbal commands into text and can also be trained up in how to understand those commands. Early in 2015, they joined Facebook and opened up the entire platform to be free for both public and private instances. Its development has continued since then with new features appearing throughout the year and no sign of things slowing down!

Wit.ai has two main elements to it that you set up within your app - intents and entities. An intent is what action an instruction should take (e.g. turn on a light). An entity is a specific object or piece of information that our AI needs to know about to enact that intent (e.g. which light? Is it a smart light? Should it understand particular colors the light can switch to?). Rather than needing to create intents from scratch, Wit.ai also provides access to existing intents from the developer community which is quite neat!

Wit.ai also has the concept of "roles", where it can learn to differentiate between entities in different contexts (e.g. numbers in different parts of an instruction can refer to different things - like an age, an order, a count). It also has some entity types built in that it can understand, such as temperature, URLs, emails, duration... etc.

There is a Wit.ai API for developers of iOS, Android, Node.js, Raspberry Pi, Ruby, Python, C, Rust and Windows Phone. It even has a JavaScript plugin for front end developers.

Api.ai

Api.ai

Api.ai is another service which provides similar capabilities to Wit.ai, with intents and entities. Just like Wit.ai, Api.ai is free to use. It also has a paid enterprise option which allows for this to be run on a private cloud internally and more from their services team. This is potentially valuable if your usage needs to be totally private.

One key focus of Api.ai that differs from Wit.ai is its "Domains". Domains are a whole collection of knowledge and data structures from Api.ai that are ready for use in every Api.ai agent (apps are called "agents" in Api.ai). Domains can include knowledge of common verbs and content types. As an example, it understands the different types of data that a request of "Book restaurant" needs, compared to "Book hotel". It has a range of real information about encyclopedia-like topics such as history, word definitions, people of significance (e.g. celebrities, writers, characters), movies, stock prices and a lot more.

Api.ai has SDKs for Android, iOS, the Apple Watch, Node.js, Cordova, Unity, C#, Xamarin, Windows Phone, Python and JavaScript. The Unity integration in particular might open this up to a range of additional platforms not listed above! It also can be integrated with Amazon's Echo and Microsoft's Cortana.

Jasper

Jasper

If you'd rather do more of the programming side of the AI yourself and you are a fan of Raspberry Pi, you could look into Jasper. Jasper is an open source personal assistant written in Python that runs on the Raspberry Pi Model B.

Jasper provides always-on voice control and some default modules for things like asking for the time, weather, news, Gmail inbox status, Facebook notifications, Spotify controls and more. For the Python developer who wants total control - Jasper might just be for you!

Continue reading %Five Simple Ways to Build Artificial Intelligence in 2017%


by Patrick Catanzariti via SitePoint

Building With the Twitter API: Analyzing Your Followers