Tuesday, September 27, 2016

Self-Employment: Should you work for yourself? (infographic)

Entrepreneurship: Should You Work for Yourself? [Infographic]

There’s not much today’s young entrepreneur can’t achieve with her trusty laptop and a surplus of ambition. While the motivational content on ‘digital nomads’ is starting to eclipse the profiles on ‘unexpected start-up billionaires’, the message remains consistent: we live in a world of opportunity. For the independent spirits of the 21st century, it’s a welcome culture shift.

However, such bluster should not be taken entirely at face value. The reality of starting a business or surviving as a freelancer is not as glamorous as it first appears, and there are some people who just aren’t suited to it. As an independent entrepreneur, you need to be not just a code whizz or a source of perpetual good ideas – you need to be a salesperson, an accountant, and your own harsh boss.

The rewards are more than worth it if working for yourself suits your personality and skill set, though, so if you suspect you do then it’s worth looking into. If you’re curious, run through this useful infographic, which guides you through a self-assessment process to see if this is the path for you, and check out the handy pointers on how to proceed if you decide to go it alone.

by Irfan Ahmad via Digital Information World

Versioning Podcast, Episode 10, with Alex Fitzpatrick

In this episode, Tim and David are joined by Alex Fitzpatrick, Deputy Tech Editor for Time Magazine. They discuss the viability of the web as a mass publishing tool, the challenges of monetizing content in the age of the ad blocker, and the battle between walled gardens, silos, paywalls and the open web.

Continue reading %Versioning Podcast, Episode 10, with Alex Fitzpatrick%


by M. David Green via SitePoint

DevOps by Example: Tools, Pros and Cons of a DevOps Culture

There's a number of steps between applications and websites being conceived and being finally released --- design, programming, QA, and deployment. Let’s close the gap between the development and operations cycle, and review some of the practices of the DevOps movement.

Conventional Software Development: Dev vs Ops

Traditionally, there are distinct teams and processes for the different states of a project, from the initial states of analysis and design (when a product or idea is conceived), to the actual development and testing (e.g. when code is being written or a product is being developed), to finally deployment and maintenance (e.g. when a website, application, or product goes live).

There's good reason for this differentiation: they all demand a different set of skills. However, a strict (and at times even bureaucratic) separation of duties can add a lot of unnecessary delays, and experience proves that blurring some of these lines can be advantageous for all of the parties involved, and for the process as a whole.

This is true not only for software development, but for many industries. Think of Toyota, for example, the Japanese car manufacturer that's had, for many years, a strong culture of reducing what they call "waste" from the production chain so that they could fasten the flow of changes from development into operations. Furthermore, Toyota's practices have, in fact, heavily influenced the IT industry both in software development (see "lean software development") and in DevOps (see "Kanban: from Toyota to DevOps?" and "Using the Toyota Production System to explain DevOps").

DevOps: A Cultural Change for the Win

DevOps as the intersection of development, operations and quality assurance

DevOps as the intersection of development, operations and quality assurance. Wikipedia.

Much like with agile development, DevOps isn't a particular tool or technique that you can implement and you're done. Rather, it's a culture ---even a mindset --- that your team and organization can adopt and that will make processes smoother.

But what is it exactly? Think of developers being able to do some of the tasks that are normally assigned to system administrators, such as creating new servers, making updates to production sites, deploying apps. Also think of sysadmins sharing some duties with developers, and being able to manage multiple servers at once.

Benefits

Companies embracing a DevOps culture report significant improvements, and different surveys conducted among some of them seem to confirm these claims (see "Continuous Delivery: Huge Benefits, but Challenges Too").

Some of the these improvements include:

  • Accelerated time-to-market: shorten the time it takes from when an idea is conceived until it's available for sale or in production.
  • Building the right product: developers get faster feedback from users with more frequent releases and live testing of ideas (more on this later on the "A/B Testing" section).
  • Cost reduction: reports average a 20% reduction.
  • Improved productivity: with continuous delivery, developers and testers save time setting up and fixing their working environments. Also, deployments are significantly faster (more on this later in the "Continuous Integration with Jenkins" section).
  • Reliable releases: with smaller and more frequent releases, the changes in code --- and therefore the bugs introduced and their impact --- are also smaller.
  • Improved product quality: companies report a very significant reduction in open bugs and other issues (in some cases, by more than 90%).
  • Improved customer satisfaction: this is, not surprisingly, a byproduct of all of the previous improvements.

Examples

Same Production and Development Environments with Docker

docker logo

The conventional wisdom goes that one shouldn't mix production with development environments --- that these two should be carefully separated in order to avoid disasters. And while it's true that making changes to a live platform without testing and rollback mechanisms is, in fact, a formula for disaster, having multiple environments comes at a high operational cost.

Automating the creation of environments is key in DevOps, and one technology that enables this is Docker. We won't get into the full details here, but the principle is that, with Docker, you can create a well-tested and functional environment (called an image) that developers and engineers in the operations side will be to launch as software containers. Whenever an update or patch is required, the QA team will just patch the image, and the changes will be replicated in every new container that's launched.

This gives independence to programmers and designers to launch environments that are constantly updated and known to work (and as many of them as they need), and even deploy changes to live platforms, because the QA people are maintaining these environments and have already set the appropriate tests. It also provides a communication channel with the server administrators, because they're all basically working together in having a working environment that's good for both production and development.

Notice that this is also valid if development and deployment are carried out by the same people --- as in a single freelance developer --- because these concerns for testing and implementing a live application in different environments are still valid regardless of who's in charge of doing it.

For more info about what you can do with Docker, see Understanding Docker, Containers and Safer Software Delivery.

Continue reading %DevOps by Example: Tools, Pros and Cons of a DevOps Culture%


by Lucero del Alba via SitePoint

7 Ways to Nail Your Branding Like a Boss

Car branding

With large companies throwing millions upon millions of dollars at their brand image in an effort to stay relevant and compete in billion dollar industries, your branding as a smaller business is more important than ever.

If you get your branding and messaging right, you will have a much easier time sticking in your customer's minds, and being the first company they think of when it comes to finding a solution to the problems that your services or products solve.

Get it wrong, though, and you're going to be stuck in a sea of amateurs spinning their wheels, trying to figure out why you're not getting the traction you think your business deserves.

Strategy #1: Give Everything to the Same Designer the First Time!

Consistency is critical with your branding. If you're going to put the money into making sure your branding accurately portrays your messages, your values, and your business, you're going to want to make sure that there is only one person or one team working on the project for you.

If you're putting together each piece of the puzzle, one piece at a time, you're going to end up with an inconsistent message. By the time you realize the error of your ways, you'll usually have to start back from square one.

While most designs can be replicated, a designer's style cannot. There will be certain cues that one designer can pull off, while another one struggles and resorts to using their own style instead. This is what leaves your messaging inconsistent.

Strategy #2: Your Font Choice Matters More Than You Think

What messaging are you trying to get across with your branding? The font that you choose will either help you communicate it, or create a conflict.

For instance, if you're trying to show that you're a professional brand, and selling your products or services only to professionals, you don't necessarily want to use an energetic font. Perhaps a serif font, like the New York Times use in their logo, would be a better fit.

On the same token, if you're a young, hip startup, you don't necessarily want to use a stuffy font that's typically seen in investor newsletters designed for 50 to 60 year old men looking to retire after a long career in the corporate world.

Strategy #3: The Colors You Choose Convey Different Emotions

Whether you realize it or not, the colors you use convey different emotions. Take a look at what some of the more common colors tend to do to people, and how they make them feel about your business.

  • Red: Using red in your branding shows your audience that you're energetic, passionate, and intense. Think about brands like Coca-Cola and Red Bull.
  • Yellow: Using yellow in your branding shows that you're optimistic and joyful. Brands like Ferrari, Shell, and Best Buy are all perfect examples of the beaming yellow color.
  • Orange: When you use orange in your messaging, you're giving off the vibe that you're creative, determined, and unique. Home Depot, Fanta, and Firefox are all great examples.
  • Pink: If your brand wants to put across a feminine message, using pink in your graphics is a great way to do it. Some notable brands that are more feminine in nature are Barbie and the Oxygen Network.
  • Blue: The color blue helps you portray trustworthiness, calm, comfort, and reliability. Some of the world's biggest brands use blue, like IBM, Samsung, Intel, GE, and Ford Motors.
  • Black: Some brands that use black in their messaging are making a point that they're luxurious, bold, mysterious, and serious. Think about Bentley Motors.

Strategy #4: Claim Every Profile You Can & Use Specific Sizes

When people search for you online, you want them to be able to easily find you, no matter what platform they're using. That's why you need to claim profiles for your business every chance you get.

Don't just think about the most common platforms, either. While Facebook, Twitter, Instagram, Pinterest, and Google+ are the first stop for most businesses, you can gain a lot of traction by claiming profiles on some of the lesser known platforms.

As customers search for you, they won't just find your website. They'll see the same messaging wherever they visit.

Strategy #5: Develop a Tone of Voice, and Stick to It

Your branding doesn't just include the images you're using, or the font that graces your website's pages. It goes much deeper than that. Customers want to know who you are, why you do what you do, and how you're going to solve the problems that they're having.

If you haven't already figured out your mission statement, or know why you're doing what you're doing — what really drives your business forward (other than profits) — you're leaving money on the table.

By getting very specific about your messaging and who your target customer is, you'll have a much easier time making sales, because your target audience will know that you're speaking specifically to them.

Continue reading %7 Ways to Nail Your Branding Like a Boss%


by Andrew James via SitePoint

Build a Search Engine with Node.js and Elasticsearch

Elasticsearch is an open source search engine, which is gaining popularity due to its high performance and distributed architecture. In this article, I will discuss its key features and walk you through the process of using it to create a Node.js search engine.

Introduction to Elasticsearch

Elasticsearch is built on top of Apache Lucene, which is a high performance text search engine library. Although Elasticsearch can perform the storage and retrieval of data, its main purpose is not to serve as a database, rather it is a search engine (server) with the main goal of indexing, searching, and providing real-time statistics on the data.

Elasticsearch has a distributed architecture that allows horizontal scaling by adding more nodes and taking advantage of the extra hardware. It supports thousands of nodes for processing petabytes of data. Its horizontal scaling also means that it has a high availability by rebalancing the data if ever any nodes fail.

When data is imported, it immediately becomes available for searching. Elasticsearch is schema-free, stores data in JSON documents, and can automatically detect the data structure and type.

Elasticsearch is also completely API driven. This means that almost any operations can be done via a simple RESTful API using JSON data over HTTP. It has many client libraries for almost any programming language, including for Nodes.js. In this tutorial we will use the official client library.

Elasticsearch is very flexible when it comes to hardware and software requirements. Although the recommended production setting is 64GB memory and as many CPU cores as possible, you can still run it on a resource-constrained system and get decent performance (assuming your data set is not huge). For following the examples in this article, a system with 2GB memory and a single CPU core will suffice.

You can run Elasticsearch on all major operating systems (Linux, Mac OS, and Windows). To do so, you need the latest version of the Java Runtime Environment installed (see the Installing Elasticsearch section). To follow the examples in this article, you'll also need to have Node.js installed (any version after v0.11.0 will do), as well as npm.

Elasticsearch terminology

Elasticsearch uses its own terminology, which in some cases is different from typical database systems. Below, is a list of common terms in Elasticsearch and their meaning.

Index: This term has two meanings in Elasticsearch context. First is the operation of adding data. When data is added, the text is broken down into tokens (e.g. words) and every token is indexed. However, an index also refers to where are all the indexed data is stored. Basically, when you import data, it is indexed into an index. Every time you want to perform any operation on data, you need to specify its index name.

Type: Elasticsearch provides a more detailed categorization of documents within an index, which is called type. Every document in an index, should also have a type. For example, we can define a library index, then index multiple types of data such as article, book, report, and presentation into it. Since indices have almost fixed overhead, it is recommended to have fewer indices and more types, rather than more indices and fewer types.

Search: This term means what you might think. You can search data in different indices and types. Elasticsearch provides many types of search queries such as term, phrase, range, fuzzy, and even queries for geo data.

Filter: Elasticsearch allows you to filter search results based on different criteria, to further narrow down the results. If you add new search queries to a set of documents, it might change the order based on relevancy, but if you add the same query as a filter, the order remains unchanged.

Aggregations: These provide you with different types of statistics on aggregated data, such as minimum, maximum, average, summation, histograms, and so on.

Suggestions: Elasticsearch provides different types of suggestions for input text. These suggestions could be term or phrase based, or even completion suggestions.

Installing Elasticsearch

Elasticsearch is available under the Apache 2 license; it can be downloaded, used, and modified free of charge. Before installing it, you need to make sure you have the Java Runtime Environment (JRE) installed on your computer. Elasticsearch is written in Java and relies on Java libraries to run. To check whether you have Java installed on your system, you can type the following in the command line.

java -version

Using the latest stable version of the Java is recommended (1.8 at the time of writing this article). You can find a guide for installing Java on your system here.

Next, to download the latest version of Elasticsearch (2.3.5 at the time of writing this article), go to the download page and download the ZIP file. Elasticsearch requires no installation and the single zip file contains the complete set of files to run the program on all of the supported operating systems. Unzip the downloaded file and you are done! There are several other ways to get Elasticsearch running, such as getting the TAR file or packages for different Linux distributions (look here).

If you are running Mac OS X and you have Homebrew installed, you can install Elasticsearch using brew install elasticsearch. Homebrew automatically adds the executables to your path and installs the required services. It also helps you update the application with a single command: brew upgrade elasticsearch.

To run Elasticsearch on Windows, from the unzipped directory, run bin\elasticsearch.bat from the command line. For every other OS, run ./bin/elasticsearch from the terminal. At this point it should be running on your system.

As I mentioned earlier, almost all operations you can do with Elasticsearch, can be done via RESTful APIs. Elasticsearch uses port 9200 by default. To make sure you are running it correctly, head to http://localhost:9200/ in your browser, and it should display some basic information about your running instance.

For further reading about installation and troubleshooting, you can visit the documentations.

Graphical User Interface

Elasticsearch provides almost all its functionality through REST APIs and does not ship with a graphical user interface (GUI). While I cover how you can perform all the necessary operations through APIs and Node.js, there are several GUI tools that provide visual information about indices and data, and even some high level analytics.

Kibana, which is developed by the same company, provides a real-time summary of the data, plus several customized visualization and analytics options. Kibana is free and has detailed documentation.

There are other tools developed by the community, including elasticsearch-head, Elasticsearch GUI, and even a Chrome extension called ElasticSearch Toolbox. These tools help you explore your indices and data in the browser, and even try out different search and aggregation queries. All these tools provide a walkthrough for installation and use.

Setting Up a Node.js Environment

Elasticsearch provides an official module for Node.js, called elasticsearch. First, you need to add the module to your project folder, and save the dependency for future use.

npm install elasticsearch --save

Then, you can import the module in your script as follows:

const elasticsearch = require('elasticsearch');

Finally, you need to set up the client that handles the communication with Elasticsearch. In this case, I assume you are running Elasticsearch on your local machine with an IP address of 127.0.0.1 and the port 9200 (default setting).

const esClient = new elasticsearch.Client({
  host: '127.0.0.1:9200',
  log: 'error'
});

The log options ensures that all the errors are logged. In the rest of this article, I will use the same esClient object to communicate with Elasticsearch. The complete documentation for the node module is provided here.

Note: all of the source code for this tutorial is provided on GitHub. The easiest way to follow along is to clone the repo to your PC and run the examples from there:

git clone https://github.com:sitepoint-editors/node-elasticsearch-tutorial.git
cd node-elasticsearch-tutorial
npm install

Importing the Data

Throughout this tutorial, I will use an academic articles dataset with randomly generated content. The data is provided in JSON format, and there are 1000 articles in the dataset. To show what the data looks like, one item from the dataset is shown below.

{
    "_id": "57508457f482c3a68c0a8ab3",
    "title": "Nostrud anim proident cillum non.",
    "journal": "qui ea",
    "volume": 54,
    "number": 11,
    "pages": "109-117",
    "year": 2014,
    "authors": [
      {
        "firstname": "Allyson",
        "lastname": "Ellison",
        "institution": "Ronbert",
        "email": "Allyson@Ronbert.tv"
      },
      ...
    ],
    "abstract": "Do occaecat reprehenderit dolore ...",
    "link": "http://ift.tt/2di0OLV",
    "keywords": [
      "sunt",
      "fugiat",
      ...
    ],
    "body": "removed to save space"
  }

The field names are self-explanatory. The only point to note is that the body field is not displayed here, since it contains a complete, randomly generated article (with between 100 and 200 paragraphs). You can find the complete data set here.

While Elasticsearch provides methods for indexing, updating, and deleting single data points, we're going to make use of Elasticserch's bulk method to import the data, which is used to perform operations on large data sets in a more efficient manner:

// index.js

const bulkIndex = function bulkIndex(index, type, data) {
  let bulkBody = [];

  data.forEach(item => {
    bulkBody.push({
      index: {
        _index: index,
        _type: type,
        _id: item.id
      }
    });

    bulkBody.push(item);
  });

  esClient.bulk({body: bulkBody})
  .then(response => {
    console.log('here');
    let errorCount = 0;
    response.items.forEach(item => {
      if (item.index && item.index.error) {
        console.log(++errorCount, item.index.error);
      }
    });
    console.log(
      `Successfully indexed ${data.length - errorCount}
       out of ${data.length} items`
    );
  })
  .catch(console.err);
};

const test = function test() {
  const articlesRaw = fs.readFileSync('data.json');
  bulkIndex('library', 'article', articles);
};

Here, we are calling the bulkIndex function passing it library as the index name, article as the type and the JSON data we wish to have indexed. The bulkIndex function in turn calls the bulk method on the esClient object. This method takes an object with a body property as an argument. The value supplied to the body property is an array with two entries for each operation. In the first entry, the type of the operation is specified as a JSON object. Within this object, the index property determines the operation to be performed (indexing a document in this case), as well as the index name, type name, and the document ID. The next entry corresponds to the document itself.

Note that in future, you might add other types of documents (such as books or reports) to the same index in this way. We could also assign a unique ID to each document, but this is optional — if you do not provide one, Elasticsearch will assign a unique randomly generated ID to each document for you.

Assuming you have cloned the repository, you can now import the data into Elasticsearch by executing the following command from the project root:

$ node index.js
1000 items parsed from data file
Successfully indexed 1000 out of 1000 items

Checking the data was indexed correctly

One of the great features of Elasticsearch is near real-time search. This means that once documents are indexed, they become available for search within one second (see here). Once the data is indexed, you can check the index information by running indices.js (link to source):

// indices.js

const indices = function indices() {
  return esClient.cat.indices({v: true})
  .then(console.log)
  .catch(err => console.error(`Error connecting to the es client: ${err}`));
};

Methods in the client's cat object provide different information about the current running instance. The indices method lists all the indices, their health status, number of their documents, and their size on disk. The v option adds a header to the response from the cat methods.

When you run the above snippet, you will notice it outputs a color code to indicate the health status of your cluster. Red indicates something is wrong with your cluster and it is not running. Yellow means the cluster is running, but there is a warning, and green means everything is working fine. Most likely (depending on your setting) you will get a yellow status when running on your local machine. This is because the default settings contain five nodes for the cluster, but in your local machine there is only one instance running. While you should always aim for green status in a production environment, for the purpose of this tutorial you can continue to use Elasticsearch in yellow status.

$ node indices.js
elasticsearch indices information:
health status index   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   library   5   1       1000            0     41.2mb         41.2mb

Continue reading %Build a Search Engine with Node.js and Elasticsearch%


by Behrooz Kamali via SitePoint

7 Must Have WordPress Plugins for Business Websites

In my humble opinion, WordPress really is amazing. It’s so user-friendly and intuitive that you really can build an entire website without needing any knowledge of HTML coding. So, it comes as no surprise to me to discover that around there are now almost 75 million sites using WordPress. All these individuals and companies can’t be wrong. So, if you’re developing a website for your business, then I’d recommend taking a look at WordPress.

One of the most incredible features that WordPress has to offer is the sheer amount of plugins that are available for the platform. These plugins allow you to enhance the functionality (of the already powerful) platform, chop, change and customise your site until it reflects your business, sell your products and services more effectively, and create an engaging space for your customers to visit.

So, in particular order, here is a selection of 7 of the best WordPress plugins for business websites.

Continue reading %7 Must Have WordPress Plugins for Business Websites%


by Sally Wood via SitePoint

Single-File Symfony Apps? Yes, with MicroKernelTrait!

A Single Page Application (SPA) offers a desktop experience to users of a web application by loading a single HTML page, and dynamically updating it as required without reloading. However, a Symfony application may have hundreds of classes, and in a basic application we end up with lots of files we don't really need.

Illustration of a programmer holding up an elephant

The latest versions of Symfony (2.8 and 3.0) introduce us to the concept of a Single File Application (SFA) - a super-slim application or micro-framework implemented in one file.

To follow along, you need to have a running web server and have your way of running web applications locally. See Laravel Valet article for a quick way of setting up a local development environment that doesn't require configuring a web server, virtual hosts and mucking about with a hosts file. Another option is our trusty Homestead Improved for a ready-to-go experience.

Step 1: Install Barebones Symfony

We are going to install Symfony with Composer as it allows us install only the main package. Create a folder where you usually have your web applications and let's call it sfa. I've got mine under ~/Sites/sfa. In it, we install Symfony:

composer require symfony/symfony

Now, create 2 folders inside sfa and name them app and web.

Step 2: The Front Controller

Inside sfa/web we will house our front controller - a file that receives all requests to the application, passes it to the right place for processing and returns the response to the client that made the request.

You can call this file anything, but you need to make sure your web server has been configured to find it in the correct place. Laravel has public/index.php, Drupal 8 has index.php, and Symfony has web/app_dev.php (during development) and web/app.php (during production). Since this is a Symfony application, let's call ours app_dev.php:

<?php

use Symfony\Component\HttpFoundation\Request;

require __DIR__.'/../vendor/autoload.php';
require __DIR__ . '/../app/SfaKernel.php';

$kernel = new SfaKernel('dev', true);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

Two small differences between this file and a vanilla Symfony 3 installation.

Firstly, our kernel class is going to be in app/SfaKernel.php. Nothing stops us from calling it Kernel.php, but we want something different. Secondly, we opt not to call the loadClassCache() method. Our application is a slim one, without a good number of classes from a standard installation, so we can leave that method out for now.

Even though we're talking about a single file app, you'll notice it's not really a single file - we do have a front controller and a mini-kernel which does all the heavy lifting. That's in addition to all the other classes loaded from vendor. However, for all intents and purposes, starting and running a Symfony app from a single Kernel file can be regarded as a single file application.

Continue reading %Single-File Symfony Apps? Yes, with MicroKernelTrait!%


by Deji Akala via SitePoint