Getting Started With Raygun: Insights and Crash Reporting for App Developers

Introducing Raygun

Nobody writes bugs into their software on purpose, but have you ever considered just how many problems exist in your software applications that you aren’t even aware of?

Have you ever received support requests and been unable to replicate a problem, or do you spend hours looking through log files to find the root causes of issues? We’ve all been there, dealing with unexpected issues that occur in our codebase.

The picture is not always clear as to what the route cause of the problem was, and your team might be spending hours hunting through logs to work it out.

Raygun offers solutions this problem, with a real-time window into how your application is performing for your customers, helping you pinpoint the improvement that needs to be made in seconds. Plus, Raygun offers workflow functionalities to collaborate with your fellow developers all the way through to deploying the fix.

Raygun

The Raygun platform offers essential software development tools that help keep a watchful eye on your web and mobile apps when issues arise. Offering both Error and Crash Reporting software, which helps detect, diagnose and destroy any exceptions your users encounter, and a Real User Monitoring tool that monitors each user session for things like slow loading assets, scripts and requests that could be slowing down your application’s performance, Raygun covers all bases.

Today we’ll be taking a deeper look into how you can set up real-time error and crash reporting for your applications with Raygun, regardless of which programming language and platform you use.

If you’ve ever clicked “Don’t Send” on an operating system crash reporting dialog then you know that few users actively report bugs—most simply walk away in frustration.

In fact, a survey by Compuware reported that only 16% of users try a crashing app more than twice. It’s vital to know if your software is crashing for your users. Raygun makes this easy.

With just a few short lines of code, you can integrate Raygun into your development environment in minutes. Raygun supports all major programming languages and platforms, so simply select the language you want to get started with. You’ll instantly begin receiving reports of errors and crashes and will be able to study diagnostic information and stack traces on the Raygun dashboard. 

For this tutorial, I’ll show you examples of tracking JavaScript apps such as Ghost and PHP-based WordPress, but Raygun works everywhere: front end, back end, web, and mobile.

Raygun screenshot

By pinpointing problems for you and telling you exactly where to look, Raygun helps you build healthier, more reliable software to delight your users and keep them coming back.

More importantly, Raygun is built for teams and supports integrations for workplace software such as team chat, e.g. Slack and Hipchat, project management tools, e.g. JIRA and Sprintly, and issue trackers, e.g. GitHub and Bitbucket. Raygun gives your team peace of mind that your software is performing as you want it to—flawlessly.

How cool are real-time Slack notifications for your entire team whenever your customers are encountering bugs, issues, and crashes!

Raygun integration with chat software like Slack

In this tutorial, I’ll walk you through setting up your application with Raygun step by step.

If you have any requests for future tutorials or questions and comments on today’s, please post them below. You can also reach me on Twitter @lookaheadio or email me directly.

Getting Started

One of the most powerful features of Raygun is that it works with all the major programming languages and platforms, and it’s amazingly easy to integrate. Just copy and paste the code into your application and Raygun will start monitoring for errors. In the case of WordPress, they provide a pre-built plugin.

Integrating Raygun With Your Application

After signing up, you’ll be presented with a short Raygun integration wizard. It starts with selecting your language of choice. Here’s the initial dashboard that you’ll see:

Raygun initial dashboard asking what language your app is written in

Here’s an example of integrating for use with any JavaScript code or platform.

Using Raygun With JavaScript

Once you select JavaScript, you’ll be shown your Application API Key (the key is the same for all platforms you choose and is application specific). For each environment or language you want to monitor, you should create a separate application to organise errors into different buckets.

Raygun is easy to use regardless of which JavaScript package management system you prefer:

Raygun JavaScript setup screen

For example, with Bower, run:

bower install raygun4js

From NuGet, open the console and run:

Install-Package raygun4js

But you can also just load the library from Raygun’s CDN within your application:

<script type="text/javascript" src="http://cdn.raygun.io/raygun4js/raygun.min.js"></script>

You can also download the minified production version or full development source and integrate your own way.

To begin catching exceptions in your application, call Raygun.init with your API key and then call attach:

<script src="dist/raygun.min.js"></script>
<script>
  Raygun.init('your-api-key-goes-here').attach();
</script>

If you’d like to set up a quick JavaScript-based application to try Raygun out, you might want to try my Envato Tuts+ tutorial walk-through of the open-source Ghost blogging platform.

For this tutorial, I’m going to use Raygun with a WordPress blog—both PHP and JavaScript errors can be caught in this manner.

Debugging With WordPress

To install Raygun for WordPress, you need the Raygun WordPress plugin:

Raygun WordPress setup

Once you’ve installed the plugin, you load the configuration menu from the WordPress dashboard and provide your API key:

Raygun4WP Configuration

Within a minute, you’ll start seeing errors collected in your Raygun dashboard. If not, click the Send Test Error button to trigger one.

The Raygun Dashboard

Initially, you’ll see an empty dashboard:

Empty Raygun dashboard

But once you’ve chosen your language and integrated your application, you’ll see a dashboard like this—oh, theme developers—in which Raygun helped me discover a plethora of WordPress theme code that hadn’t been kept up to date with the latest versions of PHP.

Full Raygun dashboard

Tracking Errors Across Code Deployments

When you integrate Raygun with your deployment tools, it can track errors according to specific versions of released software. This can help you identify and repair bad deployments quickly and easily:

Raygun deployments

You can read about how to integrate your deployment scripts with Raygun tagging in the documentation. Raygun provides guides for working with: Octopus Deploy, Bash, Powershell, Capistrano, Rake, Grunt, Atlassian Bamboo and FAKE – F# Make.

Managing Raygun Error Statuses

Raygun currently lets you assign error groups to one of five statuses. These are:

  • Active
  • Resolved
  • Resolved In Version x.xx
  • Ignored
  • Permanently Ignored

When an error is first received, it is assigned to Active and is visible in the first tab. You can then take action to change it to another status.

For example, as soon as I activated Raygun with WordPress and discovered a plethora of theme-related PHP compatibility issues, my email queue began to fill—but this was easily resolved by asking Raygun to only notify me of new reports.

You can also filter and manage issues by status through the interface quite easily. For example, it would be easy to delete all the errors resolved in WordPress version 4.3.

Raygun Error Detailed Views

When you click on errors, Raygun shows you their detail view with stack trace and a summary of which users and browsers or devices are being affected:

Error detail view

In detail view, Raygun also allows you and your team to comment and discuss specific issues:

Raygun error comments

Raygun User Tracking

If you implement user tracking with your Raygun integration, you can see exactly which of your authenticated users have run into specific errors and how often:

Raygun user tracking screen

Raygun offers easy documentation for linking error reports to the current signed-in user. Here’s an example for JavaScript:

By default, Raygun4JS assigns a unique anonymous ID for the current user. This is stored as a cookie. If the current user changes, to reset it and assign a new ID you can call:

Raygun.resetAnonymousUser();

To disable anonymous user tracking, call Raygun.init('apikey', { disableAnonymousUserTracking: true });.

You can provide additional information about the currently logged in user to Raygun by calling: Raygun.setUser('unique_user_identifier');.

This method takes additional parameters that are used when reporting over the affected users. The full method signature is:

setUser: function (user, isAnonymous, email, fullName, firstName, uuid)

Managing Your Team

Raygun is built around tracking issues across development teams. Through the settings area, it’s easy to add applications that you’re tracking and invite team members to participate:

Tuts team members on Raygun

As mentioned above, Raygun easily integrates with other team-based tools such as chat (Slack, Hipchat, etc.), project management (JIRA, Sprintly, etc.) and issue trackers (GitHub, Bitbucket, etc.).

Helpful Customer Support

Raygun support is excellent. In addition to the web-based documentation and email welcome guides, there’s helpful support personnel (like Nick) ready to guide you deeper into the service—Nick’s tips and availability just popped up as I was reviewing the service:

Raygun user help screen

The Raygun API

If you’d like to tailor or customize event triggers, you can post errors via the Raygun API however you’d like from your application. This can be helpful for developers wishing to integrate monitoring or specialized reporting across their services or to make the development process easier.

Raygun Pulse Real User Monitoring

Lastly, even though we talked through the setup of Raygun’s Crash Reporting software here, adding Pulse – Real User Monitoring is just as easy when adding the Raygun code snippet.

Pulse provides you with all the session data from ‘real’ users when they are interacting with your applications. This is far more powerful than traditional synthetic testing, as data is taken directly from the user’s browser, letting you see how a user’s unique device, browser, OS, location or connection speed affected the application’s performance. Problematic scripts, requests and assets can be identified as the route cause and optimizations made to improve the overall performance of your application.

Raygun Pulse real user monitoring

Couple Pulse with Crash Reporting data and you have all the tools available to ensure your customers are receiving a great user experience.

In Summary

I hope you’ve found Raygun easy to use and helpful to your development requirements. To recap, here are some of the major benefits of the service:

  • Raygun provides a complete overview of problems across your entire development stack. Intelligent grouping of errors lets you see the highest priority issues rather than flooding you with notifications for every error.
  • Raygun supports all major programming languages and platforms. Every developer can use it. Developer time is expensive, so stop wasting time trying to hunt down bugs. Fix issues faster and build more features instead!
  • Raygun is built for teams. You can invite unlimited team members to your account—no restrictions. Raygun helps you create a team workflow for fixing bugs and provides custom notifications and a daily digest of error events for all of your team.
  • For large corporate entities, Raygun Enterprise can provide cloud support or the ability to securely self-host a version of the service for your needs.

When you give Raygun a try, please let us know your questions and comments below. You can also reach me on Twitter @lookaheadio or email me directly. Or, if Raygun saves you a ton of time right away, you can browse my Envato Tuts+ instructor page to read the other tutorials I’ve written.

Related Links

View Tutorial: Getting Started With Raygun: Insights and Crash Reporting for App Developers

How to Create a Hanukkah Themed Icon Pack in Adobe Illustrator

Final product image
What You’ll Be Creating

In today’s tutorial we’re going to break
away from the regular stuff that we’ve done in the past and tackle something different,
even special you may say, since we’re going to recreate some iconic objects and
symbols from the Jewish holiday of Hanukkah.

That being said, if
you’re a proud kippah owner, put it on and get ready for a touch of
awesomeness.

Oh, and don’t forget you can always expand the project by heading over
to GraphicRiver where you can find some awesome Hanukkah themed icon packs
waiting to be grabbed.

1. How to Set Up a New Document

Since I’m sure that you already
have Illustrator up and running in the background, bring it up and let’s set up
a New Document (File > New or Control-N)
using the following settings:

  • Number
    of Artboards:
    1
  • Width:
    800
    px
  • Height:
    600
    px
  • Units:
    Pixels

And from the Advanced tab:

  • Color
    Mode:
    RGB
  • Raster
    Effects:
    Screen (72ppi)
  • Preview Mode: Default
setting up a new document

Quick
tip:
some of you might have noticed that the Align New Objects to Pixel Grid option
is missing, which is because I’m running the new CC 2017 version of the
software, where great changes have been made to the way Illustrator handles the way shapes snap to the underlying Pixel Grid.

2. How to Set Up a Custom Grid

Since we’re going to
be creating the icons using a pixel-perfect workflow, we’ll want to set up a
nice little Grid so that we can have
full control over our shapes—that is if we’re running the older version of the
software.

Step 1

Go to the Edit > Preferences > Guides & Grid submenu, and adjust
the following settings:

  • Gridline
    every:
    1 px
  • Subdivisions: 1
setting up a custom grid

Quick
tip:
you can learn more about grids by reading this
in-depth piece on how Illustrator’s Grid System works.

Step 2

Once we’ve set up our custom grid, all we
need to do in order to make sure our shapes look crisp is enable the Snap to Grid option found under the View menu, which will transform into Snap to Pixel each time you enter Pixel Preview mode.

Now, if you’re new to
the whole “pixel-perfect workflow”, I strongly recommend you go through my how
to create pixel-perfect artwork
tutorial, which will help you widen your
technical skills in no time.

3. How to Set Up Layers

With the new document created, it would be
a good idea to structure our project using a few layers, since this way
we can maintain a steady workflow by focusing on one icon at a time.

That being said, bring up the Layers panel, and create a total of
four layers, which we will rename as follows:

  • layer 1: reference grids
  • layer 2: dreidel
  • layer 3: sufganiyot
  • layer 4: menorah
setting up the layers

4. How to Create Reference Grids

The
Reference Grids
(or Base Grids)
are a set of precisely delimited reference surfaces, which allow us to build
our icons by focusing on size and consistency.

Usually, the size of the grids determines
the size of the actual icons, and they should always be the first decision you
make on you start a new project, since you’ll always want to start from the
smallest possible size and build on that.

Now, in our case, we’re going to be
creating the icon pack using just one size, more exactly 128 x 128 px, which is a fairly large one.

Step 1

Start by locking all
but the reference grid layer, and then grab the Rectangle Tool (M) and create a 128 x 128 px orange (#F15A24) square, which will help define the
overall size of our icons.

creating the main shape for the reference grid

Step 2

Add another smaller 120 x 120 px one (#FFFFFF) which will
act as our active drawing area, thus giving us an all-around 4 px padding.

creating the main shape for the active drawing area

Step 3

Group the two squares composing the
reference grid using the Control-G keyboard
shortcut, and then create two copies at a distance of 40 px from one another, making sure to align them to the center of
the Artboard.

Once you’re done,
lock the current layer and move on to the next one where we’ll start working on
our first icon.

creating and positioning all three reference grids

5. How to Create a Dreidel Icon

We’re going to kick off the project by
creating the little wooden toy that normally bears the four Hebrew letters  נ (Nun), ג (Gimmel), ה (Hey), and ש (Shin),
only we’ll going to be presenting just the third one. That being said, make
sure you’re on the right layer (that would be the second one) and then zoom in
on the first reference grid so that we can get started.

Step 1

Create the main shape for the Dreidel’s body using a 64 x 80 px rectangle (#BA8258) which we
will adjust by setting the Radius of
its top corners to 2 px and its
bottom ones to 32 px from within the
Transform panel. Position the
resulting shape by center aligning to the bottom edge of the underlying active
drawing area, at a distance of 4 px.

creating and positioning the main shape for the dreidels body

Step 2

Switch over to Pixel Preview mode (Alt-Control-Y), and start working on
the tip by clicking on it using the Add Anchor
Point Tool
to make it pointier, and then adjusting its side curves by first
smoothening them out using the Convert
selected anchor points to smooth
tool, and then playing with their handles.

adjusting the shape of the dreidels body using the anchor point handles

Step 3

Give the resulting shape
an outline using the Offset Path method,
by first selecting it and then going to Object
> Path > Offset Path and entering 4 px into the Offset value field.

adding the outline to the dreidels body

Step 4

Change the color of
the outline that we’ve just created to #54423E so that it can stand out from
the front fill shape, selecting and grouping the two together using the Control-G keyboard shortcut afterwards.

changing the color of the dreidels main outline

Step 5

Create the front
section of the toy using a 64 x 62 px rectangle
(#E0A26E) which we will adjust by setting the Radius of its top corners to 2
px
and its bottom ones to 32 px.
Give the resulting shape a 4 px thick
outline (#54423E) and then group (Control-G)
and position the two over the larger body, center aligning them to the outline’s
top edge.

creating and positioning the main shapes for the dreidels front section

Step 6

Start working on the
little Hey symbol, by creating a 28 x 8
px
rectangle which we will color using #54423E and then center align to
the Dreidel’s body, at a distance of 14
px
from its outline.

creating the main shape for the upper section of the dreidels hey symbol

Step 7

Select the shape that we’ve just created, and
start adjusting it by setting the Radius
of its right corners to 2 px and
its bottom-left one to 4 px.

adjusting the corner of the top section of the dreidels symbol

Step 8

Using the Rectangle Tool (M) add a 4 x 4 px square (#54423E) which we will
position above the shape that we created in the previous steps, aligning it
to its left side, and then adjust it by setting the Radius of its top-left corner to 4 px.

adding the top-left corner to the dreidels hey symbol

Step 9

Finish off the upper
section of the symbol by creating an 8 x
8 px
circle (#54423E), which we will adjust by selecting its top and right anchor points using the Direct Selection Tool (A) and then
deleting them by pressing Delete.
Unite the remaining anchors using
the Pen Tool (P) and then select all
the symbol’s shapes and group them using Pathfinder’s
Unite Shape Mode.

adding the top-right curvature to the top section of the dreidels symbol

Step 10

Create the symbol’s
left stem using an 8 x 18 px rectangle
(#54423E) which we will adjust by setting the Radius of its top-left and bottom-right corners to 8 px, positioning the resulting shape
underneath the shape that we’ve created in the previous steps, at a distance of
4 px.

creating and positioning the left stem for the dreidels symbol

Step 11

Create the right stem using an 8 x 22 px rectangle (#54423E) which we
will adjust by setting the Radius of
its top-left corner to 4 px and its bottom
one to 8 px, positioning the
resulting shape right underneath the symbol’s top section, at a distance of 2 px from its right edge.

Then, once you’re
done, select and group all three shapes together using the Control-G keyboard shortcut, doing the same for the dreidel’s
composing shapes afterwards.

creating and positioning the right stem to the dreidels symbol

Step 12

Finish off the dreidel by adding the
little handle using a 12 x 28 px rectangle
(#BA8258) which we will adjust by setting the Radius of its top corners to 2
px
. Give the resulting shape a 4 px outline
(#54423E) and then group (Control-G)
and center align the two to the upper section of the toy’s body.

As always, before you
move on, don’t forget to select and group all the icon’s composing shapes
together using the Control-G keyboard
shortcut.

adding the handle to the upper section of the dreidels body

6. How to Create
a Sufganiyot Plate Icon

Assuming you’ve
already locked the previous layer and moved on to the next one, zoom in on the
second reference grid, and let’s start working on our little Sufganiyot plate.

Step 1

Create the main shape
for the plate’s body using a 112 x 112
px
circle, which we will color using #82705B, giving it a 4 px thick outline (#54423E). Group the
two shapes (Control-G) and then
position them by aligning them to the center of the underlying active drawing
area.

creating and positioning the main shapes for the plates body

Step 2

Add a little detail
line to the center of the plate by creating a 104 x 104 px circle (#54423E) from which we will cut out a smaller 100 x 100 px one using Pathfinder’s Minus Front Shape Mode.

adding the circular detail line to the plates body

Step 3

Create the center
darker section of the plate using a 48 x
48 px
circle (#725F4C) with a 4 px thick
outline (#54423E), which we will group (Control-G)
and then center align to the larger underlying body.

adding the center darker section to the plates body

Step 4

Create the Star of David
using an 18 x 15 px rectangle (#54423E) (1),
which we will adjust by adding a new anchor
point to the middle of its top edge using the Add Anchor Point Tool (+), removing the side ones afterwards (2). 

Flip the resulting shape’s fill with
its stroke (Control-X), setting its Weight
to 2 px and making its Cap and Corner round (3). Once you’re done making the adjustments, create a
copy of the shape (4) which we will flip horizontally (right click > Transform > Reflect > Horizontal) and then
push to the bottom by 5 px (right click > Transform > Move >
Vertical > 5 px
) (5). Finally, group (Control-G) the two shapes together and then center align them to
the plate’s darker section.

Since we’re pretty much done working on the plate, you can do the same with
its composing shapes.

creating the plates star of david

Step 5

Start working on the
first sufganiyah, by creating a 36 x 36
px
circle, which we will color using #FFBB71 and give a 4 px thick outline (#54423E). Then group (Control-G) and position the two by center aligning them to the
upper edge of the plate’s outline.

creating and positioning the main shapes for the first sufganiyah

Step 6

Add the jelly
filling by creating a 4 x 4 px circle
(#E87552) with a 4 px thick outline
(#54423E) which we will group (Control-G)
and then center align to the doughnut’s body.

creating and positioning the main shapes for the sufganiyahs jelly filling

Step 7

Finish off the doughnut by adding the powdered sugar using a bunch of 2 x 2 px circles which we will color using #FFE3C5. Take your time,
and once you’re done make sure to group the circles together using the Control-G keyboard shortcut, repeating
the same process for the doughnut’s composing shapes afterwards.

adding the powdered sugar to the first sufganiyah

Step 8

Create the second sufganiyah using a copy
of the one that we’ve just made (Control-C
> Control-F
) which we will position onto the lower-left side of the
plate, at a distance of 4 px from
the original.

Also you can give the
duplicate a different feeling by flipping it either horizontally or vertically (right click > Transform > Reflect
> Horizontal
or Vertical depending
on what you decide to go with) so that they won’t end up looking exactly the
same.

creating and positioning the second sufganiyah

Step 9

Add the third and last doughnut, using a
second copy of the original (Control-C
> Control-F
) which we will position onto the right side of the plate,
positioning it 16 px from the top
one and 12 px from the left one.

Once you’re done, don’t
forget to select all the icon’s composing shapes and group them together using
the Control-G keyboard shortcut.

creating and positioning the third sufganiyah

7. How to Create a Menorah Icon

We are now down to our third and last icon
of the project, so assuming you’ve already learned the drill, zoom in on that
third reference grid, and let’s get started.

Step 1

Create the main shape
for the Menorah’s base using a 40 x 4 px
rectangle, which we will color using #FCC96D, give a 4 px thick outline (#54423E) and then center align to the bottom
edge of the underlying active drawing area.

creating and positioning the main shapes for the menorahs base

Step 2

Using the Rectangle Tool (M) add a 40 x 2 px horizontal detail line to the
center of the shapes that we’ve just created, coloring it using #54423E.

adding the horizontal detail line to the menorahs base

Step 3

Add the base’s side
sections using two 2 x 8 px rectangles
(#54423E) which we will vertically center align using the Align panel, selecting and grouping (Control-G) all its shapes afterwards.

adding the side section to the menorahs base

Step 4

Create the base’s round back section using
a 28 x 16 px ellipse which we will
color using #DDA654 and then adjust by removing its bottom half by selecting
its bottom anchor point with the Direct Selection Tool (A) and then
pressing Delete. Unite the resulting
path using the Control-J keyboard
shortcut, and then give it a 4 px thick
outline (#54423E), grouping (Control-G)
and positioning the two behind the base’s lower section (right click > Arrange > Send to Back).

Once you have them in
place, select all the base’s composing shapes and group (Control-G) those as well.

creating and positioning the back section of the menorahs base

Step 5

Create the Menorah’s
central spine, using a 2 x 72 px rectangle
(#DDA654) with a 4 px thick outline
(#54423E) which we will center align to the base, positioning them so that the
outlines end up overlapping.

creating and positioning the main shapes for the menorahs spine

Step 6

Start working on the
main shapes for the first set of arms by creating a 26 x 26 px circle (#DDA654) from which we will cut out a smaller 22 x 22 px one, center aligning the
resulting shape to the spine and positioning it 23 px from the underlying active drawing area’s top edge.

creating and positioning the main shapes for the menorahs first set of arms

Step 7

Create the second set
of arms using a 54 x 54 px circle (#DDA654)
from which we will remove a smaller 50 x
50 px
one, center aligning the resulting shape to the shape from the
previous step.

creating and positioning the main shapes for the menorahs second set of arms

Step 8

Create the third set
of arms using an 82 x 82 px circle
(#DDA654) from which we will cut out a smaller 78 x 78 px one, center aligning the resulting shape to the previously
created ring.

creating and positioning the main shapes for the menorahs third set of arms

Step 9

Create the main
shapes for the fourth and last set of arms using a 110 x 110 px circle (#DDA654) from which we will cut out a smaller 106 x 106 px one, center aligning the
resulting shape to the previous ring.

creating and positioning the main shapes for the menorahs fourth set of arms

Step 10

Once you have all
four rings in place, take your time and remove the top half from each one of them, by placing a big enough rectangle (highlighted with orange) on
top, and then using Pathfinder’s Minus Front Shape Mode to cut it out
from the underlying shape.

adjusting the shape of the menorahs first ring

Step 11

Assuming you’ve
finished removing the upper halves, give each of the resulting shapes a 4 px thick outline, making sure to
change their color to #54423E.

adding the outlines to the menorahs arms

Step 12

Since we’ll want the arms to look as if
they were connected with the spine, we’ll have to select their outlines, and
send them to the back by right clicking
> Arrange > Send to Back
.

Once you do that, it
would be a good idea to select and group (Control-G)
the spine and its arms so that they won’t get separated by accident.

correctly positioning the outlines of the menorahs arms

Step 13

Create the main
shapes for the Menorah’s center candle using a 2 x 16 px rectangle (#FFE1BD) with a 4 px thick outline (#54423E) which we will position on top of the
central spine, making sure their outlines overlap.

creating and positioning the main shapes for the menorahs center candle

Step 14

Add a 12 x 4 px rectangle (#54423E) to the
base of the candle’s outline, and another 4
x 2 px
one (#54423E) above it, selecting and grouping (Control-G) all its composing shapes afterwards.

adding details to the menorahs center candle

Step 15

Using copies (Control-C > Control-F) of the candle
that we’ve just finished creating, add the remaining ones so that each arm ends
up having one.

adding the remaining candles to the menorahs arms

Step 16

With the candles in
place, create the main shapes for the front decorative plate using a 30 x 22 px ellipse (#FCC96D) with a 4 px thick outline (#54423E) which we
will group (Control-G) and then
align to the center of the Menorah, at a distance of 31 px from its base.

creating and positioning the main shapes for the menorahs front decorative plate

Step 17

Grab a copy (Control-C) of the Star of David that we
created for the second icon, and paste it (Control-F)
onto the third reference grid, center aligning it to the Menorah’s decorative
plate.

Once you have it in
place, you can group (Control-G) it
to the plate so that they won’t get separated by accident.

positioning the start of david onto the menorahs front decorative plate

Step 18

Finish off the icon by adding the smaller
decorative plate using a 6 x 4 px ellipse
(#FCC96D) with a 4 px outline (#54423E),
which we will group (Control-G) and then
align to the center of the Menorah’s fourth arm, at a distance of 12 px from its base.

Once you have the
piece in place, select all the icon’s composing shapes and group those as well.

creating and positioning the main shapes for the menorahs secondary decorative plate

That’s It!

There you have it—a
really easy and pretty straightforward process for creating your very own
Hanukkah themed icon pack using nothing more than the basic tools and shapes
that you probably already work with on a regular basis.

I
hope you found the steps easy to follow and most importantly learned something
new and useful along the way.

finished project preview
View Tutorial: How to Create a Hanukkah Themed Icon Pack in Adobe Illustrator

Building Your Startup: Issue Tracking and Feature Planning

Final product image
What You’ll Be Creating

This tutorial is part of the Building Your Startup With PHP series on Envato Tuts+. In this series, I’m guiding you through launching a startup from concept to reality using my Meeting Planner app as a real-life example. Every step along the way, I’m releasing the Meeting Planner code as open-source examples you can learn from. I’m also addressing startup-related business issues as they arise.

Learning to Manage Project Issues

Even for a one-person startup, it helps to have more than a spreadsheet (or paper) to track issues, ideas, and bugs. 

A few years ago, I’d used Lighthouse for my grant-funded NewsCloud Community Starter Project. Last year, I’d been introduced to Asana during a consulting gig. The pronunciation of the name drove me a bit nuts at first—as a yogi, I regularly pronounce the word āsana or asa·na, which typically represents a flow of yoga poses. The Asana folks pronounce it a·sauna. 

Meeting Planner Asana - Intro screen at Asana

Eventually, I found my way and discovered the tool works well whether you’re working with a variety of people or just solo.

In today’s episode, I’ll walk you through how I began using Asana for Meeting Planner. I use Asana not only to track issues but to organize them and plan for the future. I also use it to track and process bugs.

I’ll also cover how I used Asana to plan for the upcoming alpha milestone for Meeting Planner and its beta and release milestones.

I appreciate that Asana is ready for growth; as Meeting Planner adds contractors and full-time people, it will be easy to integrate them into my organizing efforts.

In the meantime, if you haven’t tried out Meeting Planner yet, go ahead and schedule your first meeting. If you run into anything I should be tracking in Asana, begin by posting it to our Freshdesk site which I wrote about earlier in Collecting and Managing User Reports and Feedback. If it’s a bug or feature that’s needed, I’ll migrate it to Asana.

I also participate in the comment threads below, so please share your experience! You can also reach me on Twitter @reifman. I’m always interested in new feature requests and suggested tutorial topics.

As a reminder, all of the code for Meeting Planner is written in the Yii2 Framework for PHP. If you’d like to learn more about Yii2, check out our parallel series Programming With Yii2.

Getting Started With Asana

The video below highlights the mission for Asana — put simply, it’s an issue tracking, management, and communication tool primarily for teams:

I’ll walk you through how I’m using Asana, but there are a variety of ways to configure it to organize your work and your team’s work—its flexibility is one of the things that makes Asana powerful.

On my consulting work last year, one of the first things I did was step in and completely reorganize and simplify the company’s use of Asana and its projects, tasks, and work items. This helped everyone in the team make better use of the tool and move forward with the critical work ahead.

Sign Up for Asana

To get started with Asana, just visit the home page and register via Google or traditional email. I chose Google:

Meeting Planner Asana - Sign Up for Asana

Sign in with your Google account to complete your registration:

Meeting Planner Asana - Google Sign In

Setting Up Your Project

Create Your Workspace

Asana allows multiple workspaces, but I began with just one for Meeting Planner:

Meeting Planner Asana - Create Your Workspace

Workspaces allow for multiple sub-projects, so the workspace is essentially a container for all things Meeting Planner. You can create another workspace for your other major efforts, such as your moonlighting startup or house remodel.

Creating Projects Within Your Workspace

Here’s what Asana will look like with your empty workspace. You can create a number of projects within each workspace. Notice the Get started with a project hint at bottom left:

Meeting Planner Asana - Creating a Project

For Meeting Planner, I created an initial project for Release 1.0 and a separate project for bug tracking, which I’ll address further below.

Here’s the New Project form:

Meeting Planner Asana - New Project Form

Within the Release 1.0 project, I created tags for alpha and beta release to easily organize and migrate issues from one stage to another. You can’t add tags until you have tasks.

Adding Tasks

To add a task, just click on the plus sign icon and then Task:

Meeting Planner Asana - Add Task Menu

Here’s the New Task form:

Meeting Planner Asana - New Task Form

Tagging Tasks

Once you’ve created tasks, you can tag them. For my organization system, I used tags to designate incremental releases: alpha and beta. You can also use tags to organize topic areas.

Meeting Planner Asana - Adding Tags to Tasks

Navigation With Projects and Tags

Once you’ve created projects and tags, you can drag shortcuts to the Asana sidebar view. Below, you can see that I can easily navigate between the alpha release view, the beta view, the final release, and bugs:

Meeting Planner Asana - Left Sidebar Navigation View

Here’s what the beta project view looks like; it mostly consists of tickets for Planned Features, a section I’ve created for the project. I’ll review sections below.

Meeting Planner Asana - Beta Release View of Planned Features

Using Asana to Track Bugs

For tracking bugs in Asana, I created a separate project and set up sections for the priorities of the bugs: P0, P1, P3, P5, and Requested Testing. 

To add a section, you have to hover the mouse over the Add Task button to make Add Section appear:

Meeting Planner Asana - Hover to display the add section button

I created sections for each bug priority level. P0 is for critical bugs:

Meeting Planner Asana - The empty P0 Section

Adding a Bug

To add bugs, you just add tasks to the Bugs Project (shown as Quality Assurance below, a term I later abandoned):

Meeting Planner Asana - Adding a ticket for a bug

I also tag the bug for which release it needs to be fixed for. The above bug is tagged for alpha.

Looking Ahead to the Alpha Release

Once all the organizing work above is done, I can now get a clear view of both features and defects that need to be addressed to complete the alpha release milestone.

Here’s the view of the alpha release, the bugs that need to be fixed and the remaining tasks:

Meeting Planner Asana - The current Asana view of the Alpha Release

What’s Next?

With Asana, I’ve found this system of organizing greatly helps me stay focused and progress more quickly with Meeting Planner.

As I mentioned at the beginning of this tutorial, there are many ways to configure Asana for your team’s communication, issue tracking, and processes. Don’t assume that the way I’ve demonstrated here is the only way to use Asana. It’s an extremely flexible tool.

Going forward, I’m working feverishly to prepare Meeting Planner for alpha release. Asana has made this easier.

I’m also beginning to focus more on the upcoming investment gathering effort with Meeting Planner. I’m just beginning to experiment with WeFunder based on the implementation of the SEC’s new crowdfunding rules. Please consider following our profile. I will also write more about this in a future tutorial.

Again, while you’re waiting for more episodes, schedule your first meeting (from your phone!). Also, I’d appreciate it if you share your experience below in the comments and I’m always interested in your suggestions. You can also reach me on Twitter @reifman directly. You can also post them at the Meeting Planner support site.

Watch for upcoming tutorials in the Building Your Startup With PHP series.

Related Links

View Tutorial: Building Your Startup: Issue Tracking and Feature Planning

Photoshop in 60 Seconds: How to Create a Portrait Quote

Final product image
What You’ll Be Creating

In this quick 60-second video, you’ll learn how to use Adobe Photoshop to combine a portrait image and typography into an attractive portrait quote.

How to Create a Portrait Quote in Photoshop

A personal quote is a good way to communicate your own values and beliefs. One great way to associate yourself with your selected quote is to craft it into a portrait image. This can be used for the header of a resume or a profile pic on social media. In any case, it’s a simple enough process to create in Photoshop.

The following project uses this photo of a Girl Looking Away from PhotoDune and the font Amulhed Brush from GraphicRiver.

 

How to Create a Portrait Quote

Step 1

Begin with the portrait on its own layer above a solid colored background, and duplicate the portrait by dragging that layer to the new layer icon. Then hide the copy.

Select an image

Step 2

Next, use the Rectangular Marquee Tool to create a rectangular selection around half of the profile image. Make sure the original portrait layer is the active layer, and use the add layer mask button in the base of the Layers panel to hide half of the model’s face.

Half

Step 3

Then use the Horizontal Type Tool to drag out a rectangular area to hold the text.

By defining the text area first, we ensure that the text gets entered as paragraph text, which means it will automatically line-wrap and you don’t have to do it manually. Make sure the text layer is positioned between the original portrait layer and its copy, and then reveal the copy layer and clip it to the text by holding down the Alt or the Option key and clicking between the two layers.

Adding text

A Bit More Detail

If you are interested in learning more about combining typography with photos, consider the following links:

View Tutorial: Photoshop in 60 Seconds: How to Create a Portrait Quote

New Course: How to Use the Google Drive API

Final product image
What You’ll Be Creating

Want to know how the Google Drive API works and how you can use it in your projects? If so, our new Coffee Break Course, How to Use the Google Drive API, is for you.

In a super-condensed course of just ten minutes, Envato Tuts+ instructor Reggie Dawson will teach you how to authorize and access the Google Drive API, how to get a listing of files, and how to display a properly formatted picker for files in Drive.

Watch the introduction below to find out more.

 

You can take our new Coffee Break Course straight away with a free 10-day trial of our monthly subscription. If you decide to continue, it costs just $15 a month, and you’ll get access to hundreds of courses, with new ones added every week.

If you’re interested in the Google Drive API, why not check out the useful Google Drive scripts and plugins on Envato Market? You can find lots of handy utilities, such as Use-your-Drive, a WordPress plugin that helps you to easily integrate Google Drive into your WordPress website or blog. Use-your-Drive allows you to view, download, delete, and rename files and folders directly from a WordPress page.

View Tutorial: New Course: How to Use the Google Drive API

How to Draw a Winter Landscape From Scratch

Final product image
What You’ll Be Creating

Winter is cold and unpleasant, but it definitely creates beautiful landscapes. Mountains and tree branches covered with snow, lakes turned into ice… Even if there’s no winter where you live, you can create some winter magic by drawing a snowy scene. In this tutorial I will show you how!

What You Will Need

  • Sheet of paper
  • HB pencil
  • 2B pencil
  • 5B pencil
  • 8B pencil
  • Pencil sharpener
  • Eraser
what tools do i need for drawing

1. How to Sketch the Mountains

Step 1

Take the HB pencil and sketch the general outline of the mountains with sharp, ragged lines. Press as lightly as possible—the lines should be barely visible.

You can use a reference for this step—for example, one of the mountain photos on PhotoDune.

how to draw outline of mountains

Step 2

Draw some “branching” all over the mountains.

how to start drawing a mountain

Step 3

Now add branches to these lines. You don’t need to be very careful—draw these lines sharply, chaotically. Nature doesn’t like perfection!

mountain sketch

Step 4

Change your grip to a looser one, to draw with a side of the lead. 

how to hold a pencil

Use this grip to shade one side of each branch. This should create a 3D effect.

how to shade mountains

Step 5

Change your grip back to the precise one (the one you use for writing), and make the edges of the ridges more detailed.

how to draw a simple sketch of mountains

2. How to Draw Snow on the Mountains

Step 1

Take the 2B pencil now, tilt it (change the grip) and darken the shadowed side of each ridge. This is supposed to be the area uncovered by the snow. Feel free to press hard to achieve a deep, dark shade.

how to draw dark parts of the mountains

Step 2

Continue the process by going lower and lower, leaving some space for the snow. To create a proper pattern, imagine that the snow is sliding over the ridges.

how to draw snow on the mountains

Step 3

Shade the same side of the ridges some more to create a contrast between the shadowed and the illuminated side.

how to shade the mountains

Step 4

Tilt the pencil and draw the area uncovered with snow on the other side. Don’t press as hard so that you keep the contrast between both sides.

how to draw details on mountains

Step 5

Take the 5B pencil, make sure it’s sharp, and use it to add details/detailed shading on the shadowed side.

how to draw rocks on the mountains

Step 6

Take the eraser, clean it, and use it to carefully brighten the snow between the ridges. Be careful not to erase the details!

how to draw snow with eraser

Step 7

Take the HB pencil, make sure it’s sharp, and use it to create a border between the “naked” rock and the snow layer. You can also add some details (loose rocks) with it.

how to draw snow

3. How to Draw a Winter Landscape With Frozen Lake and Trees

Step 1

If we darken the sky, the contrast will make the snow look whiter. Take the 2B pencil, tilt it, and fill the sky with it. Then blur it using a finger.

how to quickly draw sky

Step 2

Use the eraser to “draw” the clouds. You can learn more about drawing clouds from my tutorial:

how to draw clouds with eraser

Step 3

Use the HB pencil to outline the shore of the lake. Leave some area of snow between the mountains and the lake.

how to draw a lake

Step 4

To create a nicer composition and a sense of scale, sketch some trees that are closer to the viewer than the mountains.

how to draw nice composition

Step 5

Take the 2B pencil, tilt it slightly, and sketch the branches. Leave some white between them to place snow there.

You can learn more about drawing trees from my tutorial:

how to draw snowy trees

Step 6

Use the HB pencil to draw the outline of the snow. Make it heavy!

how to draw snow on trees

Step 7

Take a well-sharpened 8B pencil and darken the branches, adding some details to them.

how to draw snowy evergreens

Step 8

Use the 5B pencil to shade the ground under the trees.

how to draw snow ground

Step 9

Take the HB pencil and sketch more trees going deeper and deeper into the background. This will add a sense of distance.

how tocreate depth in picture

Step 10

Shade the trees, with contrast fading as they go deeper into the background.

how to draw trees with aerial perspective

Step 11

Add a whole forest of tiny trees under the mountains. Draw them with the 2B pencil, and don’t try to include any details—they can be just a bunch of short lines.

how to draw trees from distance

Step 12

Take the HB pencil and stress the line of the shore again to know exactly where the lake starts.

how to sketch a lake

Step 13

Take the 5B pencil, tilt it, and draw a very basic reflection of the scene. Ice is not as reflective as water, so don’t worry about the details.

how to draw reflection in frozen lake

Step 14

Take the eraser and smudge it over the lake. This will create an effect of a matte reflection.

how to draw frozen lake

Step 15

Scan the drawing or take a photo of it, and don’t forget to clean it up before sharing!

how to draw winter scenery with pencils

That Was Cool!

Did you like this tutorial? Don’t forget to try others from the Drawing Nature series:

how to draw winter landscape
View Tutorial: How to Draw a Winter Landscape From Scratch

Learn the Tone Curve in 5 Minutes

The tone curve is one of the most useful tool for photographers. It can be used to make any tonal adjustments like brightening your image and adding contrast. It’s found in many software like Lightroom, Capture One, Premiere, After Effects and mobile apps like Lightroom Mobile. In this tutorial, you’ll learn in a simple way on […]

The post Learn the Tone Curve in 5 Minutes appeared first on Photoshop Tutorials.

View Tutorial: Learn the Tone Curve in 5 Minutes

HTTPie, a Human-Friendly cURL-Like Tool

cURL is a commonly used command-line tool for making HTTP requests. In this tutorial, we’ll have a look at HTTPie, a command-line tool for making HTTP requests in a human-friendly way. HTTPie uses commands with simple and natural syntax and displays the output in a presentable manner. 

From the official docs:

HTTPie (pronounced aitch-tee-tee-pie) is a command line HTTP client. Its goal is to make CLI interaction with web services as human-friendly as possible. It provides a simple http command that allows for sending arbitrary HTTP requests using a simple and natural syntax, and displays colorized output. HTTPie can be used for testing, debugging, and generally interacting with HTTP servers.

Getting Started

In order to get started with HTTPie on an Ubuntu machine, you need to install the package using apt-get.

sudo apt-get install httpie

Once it’s installed, you should have HTTPie on your system. Try to make a GET request to any website using HTTPie:

http www.tutsplus.com

The above query gives the following response:

HTTP Response

That looks as if HTTPie is installed and working on your system. If you look closely, the colored output of the above command shows that the URL has been moved permanently to https://tutsplus.com. Hence, to do a GET request query on tutsplus, modify the query:

http https://tutsplus.com

The above query would return the HTML output of the GET request on the URL https://tutsplus.com

As seen from the above query, the only information HTTPie needs to perform a request is the URL.

Performing Basic Requests Using HTTPie

Before diving deep into HTTPie commands, we’ll have a look at how to perform the basic requests using HTTPie. We’ll be making use of json-server to have a dummy server up and running for making requests. To get started with json-server, install the server using npm.

npm install -g json-server

Create a file called index.js which will create some random data for our dummy server.

// index.js
module.exports = function() {
  var data = { users: [] }
  // Create 5 users
  for (var i = 0; i < 5; i++) {
    data.users.push({ id: i, name: 'user' + i })
  }
  return data
}

Run the json server using the index.js file.

json-server index.js

Now the server should be up and running at http://localhost:3000/.

GET Request Using HTTPie

By default if a URL is given to HTTPie, it assumes the request type to be GET and performs accordingly. Here is an example of a GET request:

http http://localhost:3000/users

The above request displays the following output:

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 212
Content-Type: application/json; charset=utf-8
Date: Tue, 18 Oct 2016 03:40:15 GMT
ETag: W/"d4-4+4+bS4GA0+D/tDXlF8voQ"
Expires: -1
Pragma: no-cache
Vary: Origin, Accept-Encoding
X-Content-Type-Options: nosniff
X-Powered-By: Express

[
    {
        "id": 0, 
        "name": "user0"
    }, 
    {
        "id": 1, 
        "name": "user1"
    }, 
    {
        "id": 2, 
        "name": "user2"
    }, 
    {
        "id": 3, 
        "name": "user3"
    }, 
    {
        "id": 4, 
        "name": "user4"
    }
]

POST Request Using HTTPie

To perform a POST request using HTTPie, we need to add the POST keyword along with the data to be posted to the URL. Here is an example:

http POST http://localhost:3000/users id=007 name=RoyAgasthyan

The command would display the following output on the terminal screen:

HTTP/1.1 201 Created
Access-Control-Allow-Credentials: true
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 43
Content-Type: application/json; charset=utf-8
Date: Tue, 18 Oct 2016 03:46:22 GMT
ETag: W/"2b-mpj//lkYJiGiWBB42OLoKA"
Expires: -1
Pragma: no-cache
Vary: Origin, X-HTTP-Method-Override, Accept-Encoding
X-Content-Type-Options: nosniff
X-Powered-By: Express

{
    "id": "007", 
    "name": "RoyAgasthyan"
}

Try doing a GET request using HTTPie, and you should see the newly posted data in the response.

Submitting Forms Using HTTPie

Submitting a form is another request that is commonly performed by a user. With HTTPie, it becomes quite a bit easier to submit a form over a URL by specifying the form option as shown:

http --form POST www.yourformposturl.com name='Roy'

When the above command is executed, the Content-Type is automatically set to application/x-www-form-urlencoded; charset=utf-8, hence you don’t need to set it explicitly.

Handling HTTP Redirect

As you may have noticed in our earlier example, by default HTTPie does not handle HTTP redirects. When we tried to do a GET request on www.tutsplus.com, it showed a message stating the URL had been moved. If you want HTTPie to handle redirects, you need to add an option called follow to the request command.

http --follow www.tutsplus.com

The above HTTPie query would handle HTTP redirects, if any.

Download Files Using HTTPie

HTTPie provides a feature to download files from a server, similar to the wget command. In order to download the file, you need to specify a download option along with the URL.

http --download http://www.tutorialspoint.com/python/python_tutorial.pdf

The above command would display a response as shown below:

HTTP/1.1 200 OK
Accept-Ranges: bytes
Access-Control-Allow-Headers: X-Requested-With
Access-Control-Allow-Origin: *
Content-Length: 3945951
Content-Type: application/pdf
Date: Tue, 18 Oct 2016 04:01:43 GMT
Etag: "3c35df-52fe21b892a6f"
Last-Modified: Thu, 07 Apr 2016 09:57:34 GMT
Server: ECS (pnq/AF9A)
X-Cache: HIT

Downloading 3.76 MB to "python_tutorial.pdf-1"
 |  28.03 %    1.05 MB   63.85 kB/s  0:00:43 ETA

Handling Authentication

Accessing a web service URL would require some or other kind of authentication. HTTPie supports most of the commonly used authentication mechanisms. By default, HTTPie supports basic authentication, so you only need to pass in the username and password to the request with the -a option. 

http -a username:password www.mywebservice.com

To use a digest authentication, you’ll need to pass in the authentication mechanism name using the -A option.

http -A digest -a username:password www.myservice.com

Customizing the Response Display

When we make a request to a URL, all the data along with the header information is displayed in the terminal. HTTPie provides an option to customize the output response. You can print the individual header and body information by specifying the --header and --body option along with the request.

http https://www.tutsplus.com --header

The above command would print the header information as shown:

HTTP/1.1 301 Moved Permanently
CF-RAY: 2f6669f88fc43548-LHR
Connection: keep-alive
Date: Sun, 23 Oct 2016 16:02:32 GMT
Location: https://tutsplus.com/
Server: cloudflare-nginx
Set-Cookie: __cfduid=dfea480f2567e7c463e66999adfdc73d71477238552; expires=Mon, 23-Oct-17 16:02:32 GMT; path=/; domain=.tutsplus.com; HttpOnly
Transfer-Encoding: chunked

Now, if you try the HTTP request along with the --body option, it should only print the body portion.

http www.google.com --body

The above command would print the following output:

<HTML>

<HEAD>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <TITLE>302 Moved</TITLE>
</HEAD>

<BODY>
    <H1>302 Moved</H1>
    The document has moved
    <A HREF="http://www.google.co.in/?gfe_rd=cr&amp;ei=OBwQWPO7Juyq8wf13bzYBw">here</A>.
</BODY>

</HTML>

Maintaining Sessions

While using HTTPie, each request is independent of other requests. We can keep sessions in case we want to persist the session for other HTTP requests. In order to maintain a session, all we need to do is create a named session as shown:

http --session=roy -a roy:mypass www.myservice.com

The above command would create a session called roy which can be used for other requests by using the session name. Here is an example which uses the session roy:

http --session=roy www.myservice.com

Auto Complete Using HTTP Prompt

It might be difficult to remember all commands related to HTTPie. The http-prompt toolkit provides an auto complete feature which can be used along with HTTPie. To get started with http-prompt, install it using pip:

sudo pip install http-prompt

To start a session, invoke http-prompt with the server URL which we’ll be querying. Restart the json-server that we installed and invoke the http-prompt as shown:

http-prompt http://localhost:3000/users

Type in a few letters of HTTP and the auto complete should show up.

A demo of the autocomplete

Type in httpie and it should display the URL we are querying.

http http://localhost:3000/users

All the HTTPie request commands should be working in the http-prompt. Try typing in GET and it should pop up in the auto complete. On entering the GET command, the following response should be displayed.

The response of a GET command

Wrapping It Up

In this tutorial, we saw how to get started with HTTPie, a more human-friendly cURL alternative. We saw how to do the basic request operations like GET and POST using HTTPie and some other features. For in-depth information on using HTTPie, do have a look at the official documentation. Also check out the official documentation for http-prompt. Do let us know your thoughts in the comments below.

View Tutorial: HTTPie, a Human-Friendly cURL-Like Tool

Let’s Go: Golang Concurrency, Part 1

Overview

Every successful programming language has some killer feature that made it successful. Go’s forte is concurrent programming. It was designed to around a strong theoretical model (CSP) and provides language level syntax in the form of the “go” keyword that starts an asynchronous task (yeah, the language is named after the keyword) as well as a built-in way to communicate between concurrent tasks. 

In this article (part one), I’ll introduce the CSP model that Go’s concurrency implements, goroutines, and how to synchronize the operation of multiple cooperating goroutines. In a future article (part two), I’ll write about Go’s channels and how to coordinate between goroutines without synchronized data structures.

CSP

CSP stands for Communicating Sequential Processes. It was first introduced by Tony (C. A. R.) Hoare in 1978. CSP is a high-level framework for describing concurrent systems. It is much easier to program correct concurrent programs when operating at the CSP abstraction level than at the typical threads and locks abstraction level.

Goroutines

Goroutines are a play on coroutines. However, they are not exactly the same. A goroutine is a function that is executed on a separate thread from the launching thread, so it doesn’t block it. Multiple goroutines can share the same OS thread. Unlike coroutines, goroutines can’t explicitly yield control to another goroutine. Go’s runtime takes care of implicitly transferring control when a particular goroutine would block on I/O access. 

Let’s see some code. The Go program below defines a function, creatively called “f”, which sleeps randomly up to a half second and then prints its argument. The main() function calls the f() function in a loop of four iterations, where in each iteration it calls f() three times with “1”, “2” and “3” in a row. As you would expect, the output is:

--- Run sequentially as normal functions
1
2
3
1
2
3
1
2
3
1
2
3

Then main invokes f() as a goroutine in a similar loop. Now the results are different because Go’s runtime will run the f goroutines concurrently, and then since the random sleep is different between the goroutines, the printing of the values doesn’t happen in the order f() was invoked. Here is the output:

--- Run concurrently as goroutines
2
2
3
1
3
2
1
3
1
1
3
2
2
1
3

The program itself uses the “time” and “math/rand” standard library packages to implement the random sleeping and waiting in the end for all goroutines to complete. This is important because when the main thread exits, the program is done, even if there are outstanding goroutines still running.

package main

import (
    "fmt"
	"time"
	"math/rand"
)

var r = rand.New(rand.NewSource(time.Now().UnixNano()))

func f(s string) {
	// Sleep up to half a second
	delay := time.Duration(r.Int() % 500) * time.Millisecond
	time.Sleep(delay)
	fmt.Println(s)	
}


func main() {
	fmt.Println("--- Run sequentially as normal functions")
	for i := 0; i < 4; i++ {
		f("1")
		f("2")
		f("3")
	}

	fmt.Println("--- Run concurrently as goroutines")
	for i := 0; i < 5; i++ {
		go f("1")
		go f("2")
		go f("3")
	}
	
	// Wait for 6 more seconds to let all go routine finish
	time.Sleep(time.Duration(6) * time.Second)
	fmt.Println("--- Done.")	
}

Sync Group

When you have a bunch of wild goroutines running all over the place, you often want to know when they are all done. 

There are different ways to do that, but one of the best approaches is to use a WaitGroup. A WaitGroup is a type defined in the “sync” package that provides the Add(), Done() and Wait() operations. It works like a counter that counts how many go routines are still active and waits until they’re all done. Whenever you start a new goroutine, you call Add(1) (you can add more than one if you launch multiple go routines). When a goroutine is done, it calls Done(), which reduces the count by one, and Wait() blocks until the count reaches zero. 

Let’s convert the previous program to use a WaitGroup instead of sleeping for six seconds just in case in the end. Note that the f() function uses defer wg.Done() instead of calling wg.Done() directly. This is useful to ensure wg.Done() is always called, even if there is a problem and the goroutine terminates early. Otherwise, the count will never reach zero, and wg.Wait() can block forever.

Another little trick is that I call wg.Add(3) just once before invoking f() three times. Note that I call wg.Add() even when invoking f() as a regular function. This is necessary because f() calls wg.Done() regardless of whether it runs as a function or goroutine.

package main

import (
    "fmt"
	"time"
	"math/rand"
	"sync"
)

var r = rand.New(rand.NewSource(time.Now().UnixNano()))
var wg sync.WaitGroup

func f(s string) {
	defer wg.Done()
	// Sleep up to half a second
	delay := time.Duration(r.Int() % 500) * time.Millisecond
	time.Sleep(delay)
	fmt.Println(s)	
}


func main() {
	fmt.Println("--- Run sequentially as normal functions")
	for i := 0; i < 4; i++ {
		wg.Add(3)
		f("1")
		f("2")
		f("3")
		
	}

	fmt.Println("--- Run concurrently as goroutines")
	for i := 0; i < 5; i++ {
		wg.Add(3)
		go f("1")
		go f("2")
		go f("3")
	}
	
	wg.Wait()	
}

Synchronized Data Structures

The goroutines in the 1,2,3 program don’t communicate with each other or operate on shared data structures. In the real world, this is often necessary. The “sync” package provides the Mutex type with Lock() and Unlock() methods that provide mutual exclusion. A great example is the standard Go map. 

It isn’t synchronized by design. That means that if multiple goroutines access the same map concurrently without external synchronization, the results will be unpredictable. But, if all goroutines agree to acquire a shared mutex before every access and release it later, then access will be serialized.

Putting It All Together

Let’s put it all together. The famous Tour of Go has an exercise to build a web crawler. They provide a great framework with a mock Fetcher and results that let you focus on the problem at hand. I highly recommend that you try solving it by yourself.

I wrote a complete solution using two approaches: a synchronized map and channels. The complete source code is available here.

Here are the relevant parts of the “sync” solution. First, let’s define a map with a mutex struct to hold fetched URLs. Note the interesting syntax where an anonymous type is created, initialized and assigned to a variable in one statement.

var fetchedUrls = struct {
    urls map[string]bool
	m    sync.Mutex
}{urls: make(map[string]bool)}

Now, the code can lock the m mutex before accessing the map of URLs and unlock when it’s done.

// Check if this url has already been fetched (or being fetched)
    fetchedUrls.m.Lock()
	if fetchedUrls.urls[url] {
		fetchedUrls.m.Unlock()
		return
	}

	// OK. Let's fetch this url
	fetchedUrls.urls[url] = true
	fetchedUrls.m.Unlock()

This is not completely safe because anyone else can access the fetchedUrls variable and forget to lock or unlock. A more robust design will provide a data structure that supports safe operations by doing the locking/unlocking automatically.

Conclusion

Go has superb support for concurrency using lightweight goroutines. It is much easier to use than traditional threads. When you need to synchronize access to shared data structures, Go has your back with the sync.Mutex

There is a lot more to tell about Go’s concurrency. Stay tuned…

View Tutorial: Let’s Go: Golang Concurrency, Part 1

How to Create a 3D Cylinder Text Effect in Adobe Photoshop

Final product image
What You’ll Be Creating

We’re going Red for World AIDS Day 2016 with this 3D text effect. Use Photoshop’s 3D tools and settings, along with adjustment layers and filters, to create a simple, 3D cylinder text effect.

Let’s quote directly from WorldAIDSDay.org on what this annual event is about:

World AIDS Day is held on the 1st December each year and is an opportunity for people worldwide to unite in the fight against HIV, show their support for people living with HIV and to commemorate people who have died. World AIDS Day was the first ever global health day, held for the first time in 1988.

This text effect was inspired by the many Layer Styles available on GraphicRiver.

Tutorial Assets

The following assets were used during the production of this tutorial.

1. How to Add a Color Fill Layer

Step 1

Create a new 1920 x 1080 px document, and then click the Create new fill or adjustment layer icon at the bottom of the Layers panel, and choose Solid Color.

Solid Color Layer

Step 2

Use the Color #9d2323.

Fill Color

2. How to Create a Text Shape

Step 1

Create the text using the font Unintended, and set the Size to 250 pt.

Create the Text

Step 2

Right-click the text layer, and choose Convert to Shape.

Rename the shape layer to Text.

Convert to Shape

3. How to Subtract Ellipses From a Text Shape

Step 1

Pick the Ellipse Tool, click the Geometry Options icon, and set the Fixed Size‘s W and H values to 11.

Geometry Options

Step 2

Hold the Option key to subtract the ellipse from the text shape, and then click-drag slightly to create the ellipse.

Place the ellipse in the center of one of the text’s dots, and then release all to subtract.

Add a Hole

Step 3

Repeat that for a couple of other dots over the text.

Add More Holes

4. How to Downsize a Document and Create a Rectangle Shape Background

Step 1

This is an optional step if you want to work with a smaller document size.

Go to Image > Image Size, and enter any new dimension values you like. Here, the Width is set to 1250 px.

Image Size

Step 2

Pick the Rectangle Tool, and create a rectangle shape that extends a little bit outside the document, and then rename its layer to Ground.

Create a Rectangle Background

5. How to Create a 3D Scene

Step 1

For each of the Text and Ground layers, select it, and then go to 3D > New 3D Extrusion from Selected Path.

Create 3D Extrusions

Step 2

Select both 3D layers, and then go to 3D > Merge 3D Layers.

Merge 3D Layers

6. How to Work With the 3D Scene

Step 1

To access the 3D mesh settings and properties, you’ll need to open two panels: the 3D panel and the Properties panel (both found under the Window menu).

The 3D panel has all the components of the 3D scene, and when you click the name of any of those, you’ll be able to access its settings in the Properties panel. So make sure to always select the tab of the element you want to modify in the 3D panel before you change its settings in the Properties panel.

3D Panels

Step 2

If you select the Move Tool, you’ll find a set of 3D Modes for it to the right of the Options bar.

When you choose one of those, you can then click and drag to perform changes (on the selected element in the 3D panel).

Use those modes to change the Current View into an angle you like.

Move Tool 3D Modes

7. How to Change a 3D Ground Mesh Settings

Step 1

Select the Ground mesh tab in the 3D panel, and then, in the Properties panel, change the Extrusion Depth to 2.

Change the Extrusion Depth

Step 2

Click the Coordinates icon at the top of the Properties panel, and then change the X-Rotation Angle to 90.

Change the X-Rotation Angle

Step 3

In the 3D panel, click the 3D panel menu icon and choose Move Object to Ground Plane.

Move Object to Ground Plane

8. How to Change the 3D Text Mesh Settings

Step 1

Select the Text mesh in the 3D panel, and then click the Deform icon at the top of the Properties panel.

Change the Extrusion Depth to 15 and the Vertical Angle (Y) to 3.

Text Mesh Deform Settings

Step 2

Click the Coordinates icon at the top of the Properties panel, and then change the X-Rotation Angle to 90.

Change the X-Rotation Angle

Step 3

Click the 3D panel menu icon, and choose Move Object to Ground Plane.

Move Object to Ground Plane

Step 4

Click the Cap icon at the top of the Properties panel, and then change the Bevel Width to 3 and the Contour to Half Round.

Text Mesh Cap Settings

9. How to Use the 3D Axis

Step 1

Pick the Move Tool, and use the 3D Axis to move the Ground meshes below the text.

The arrows at the ends of the axis move the mesh, the part below them is used for rotation, and the cubes are used for scaling. The cube in the center is used to scale the object uniformly. All you need to do is click and drag the part you want.

Move the Ground Mesh

Step 2

Click the Current View tab in the 3D panel, and then choose Left from the View dropdown menu in the Properties panel.

Change the Current View

Step 3

Zoom in and move the camera view around until you can see the side of the text clearly.

Adjust the Camera View

Step 4

Next, select the Text mesh and rotate it so that it is parallel to the Ground mesh.

Rotate the Text Mesh

Step 5

Move the text mesh to the ground plane, and then click the Default Camera tab in the 3D panel to change the camera view again.

Move to the Ground Plane

10. How to Create a Simple 3D Material

Step 1

Select all the text Material tabs, as well as the Ground Front Inflation Material tab.

Then, in the Properties panel, click the Diffuse texture icon, and choose Remove Texture.

Remove the Diffuse Texture

Step 2

After that, create the material using these settings:

  • Diffuse: 109, 22, 28
  • Specular: 56, 38, 40
  • Shine: 35
Material Settings

11. How to Create a Dot Pattern

Step 1

Create a new 50 x 50px document with a Black background.

Then, pick the Elliptical Marquee Tool and create a 30 x 30px circle in the center of the document.

Create a new layer on top of the Background layer, fill the selection with the color #eeeeee, and then press Command-D to deselect.

Create a Dot

Step 2

Duplicate the circle layer four times, and place the center of each of the copies on one of the corners.

Create the Corner Dots

Step 3

Go to Edit > Define Pattern, and type Dots for the Name.

Close this file to go back to the 3D scene.

Define the Pattern

12. How to Apply a Bump Texture

Step 1

Click the Ground Front Inflation Material tab in the 3D panel, and then click the Bump folder icon in the Properties panel, and choose New Texture.

Create a New Bump Texture

Step 2

Create a new 500 x 500px document, and click OK.

If a new file doesn’t automatically open, click the Bump texture icon and choose Edit Texture.

Open the Texture

Step 3

Duplicate the Background layer.

Duplicate the Background Layer

Step 4

Double-click the Background copy layer to apply a Pattern Overlay effect using the Dots pattern.

Save and close the file when you’re done.

Pattern Overlay

13. How to Edit a Bump Texture’s UV Properties

Step 1

Click the Bump texture icon, and choose Edit UV Properties.

Edit UV Properties

Step 2

Change the Tile values to get a result you like.

Tile Values

Step 3

Decrease the Bump value to 1.

Change the Bump Value

14. How to Adjust a 3D Scene’s Lighting

Step 1

Select the Infinite Light 1 tab in the 3D panel, and then, in the Properties panel, change the Intensity to 65% and the Shadow Softness to 30%.

Infinite Light Settings

Step 2

Use the Move Tool to move the light around, or enter numerical values for the Coordinates.

Move the Infinite Light

Step 3

Click the Add new light to Scene icon at the bottom of the 3D panel, and choose New Spot Light.

New Spot Light

Step 4

Change the Intensity to 75%, the Shadow Softness to 30%, the Hotspot value to 30, and the Cone to 85.

Then, check the Light Falloff box, and change the Inner value to 350 and the Outer to 800.

Keep in mind that you can choose any other values you like based on the result you want to achieve.

Spot Light Settings

Step 5

Move the light around until you like how the overall lighting of the scene looks.

Move the Spot Light

15. How to Render Parts of a 3D Scene

Step 1

We’re going to render two versions of the scene: one of the ground only, and one of the final scene.

So start by setting the Ground Front Inflation Material‘s Bump value to 0.

Change the Bump Value

Step 2

Make the Text mesh invisible by clicking the eye icon next to it.

Go to 3D > Render 3D Layer. You can stop it any time by pressing the Esc key.

Render the Ground

Step 3

Once the rendering is done, press Command-A to select all, and then Command-C to copy.

Select and Copy the Ground

Step 4

Press Shift-Command-V to paste in place, and rename the pasted layer to BG.

Paste the Copies Background

16. How to Render a 3D Scene

Step 1

Make the BG layer invisible, and then select the 3D layer again, and make the Text mesh visible.

Show the Text Mesh

Step 2

Set the Ground Front Inflation Material‘s Bump value back to 1.

Change the Bump Value

Step 3

Go to 3D > Render 3D Layer to render the full scene.

Render the 3D Scene

17. How to Use a Layer Mask

Step 1

Make the BG layer visible, and then change its Fill value to 80%.

Hold the Option key, and then click the Add layer mask icon at the bottom of the Layers panel.

Add a Layer Mask

Step 2

Pick the Brush Tool, and select the Mask‘s thumbnail.

Set the Foreground Color to White, and then use a soft, round, slightly big brush tip to unmask some areas of the ground, and cover the pattern of the 3D scene’s ground below it.

Paint to Un-mask

18. How to Adjust the Lighting and Apply Pattern Overlays

Step 1

Add a Levels adjustment layer on top of all layers, and then change the Shadows value to 7, the Gamma to 0.85, and the Highlights to 235.

Levels Settings

Step 2

Add a Pattern fill layer, and use the MBossed pattern.

Pattern Fill Layer

Step 3

Change the Pattern layer’s Blend Mode to Linear Burn, and its Opacity to 15%.

Pattern Layer Settings

19. How to Apply a High Pass Filter

Step 1

Create a new layer on top of all layers, and press the Shift-Command-Option-E keys to create a stamp layer.

Rename the layer to High Pass, and then right-click it and choose Convert to Smart Object.

Create a Stamp Layer Smart Object

Step 2

Go to Filter > Other > High Pass, and set the Radius to 1.

Apply a High Pass Filter

Step 3

Change the High Pass layer’s Blend Mode to Soft Light.

Change the Blend Mode

Congratulations! You’re Done

In this tutorial, we converted some text into a shape, and created holes in some parts of it. Then, we created a rectangle and converted it along with the text shape into a 3D layer.

After that, we worked on the 3D scene, modified the mesh settings, created patterns and materials, moved the camera angle, and adjusted the lighting.

Finally, we rendered two versions of the 3D scene and used a couple of adjustment and fill layers, as well as a high pass filter, to finish off the effect.

Please feel free to leave your comments, suggestions, and outcomes below.

Final Result
View Tutorial: How to Create a 3D Cylinder Text Effect in Adobe Photoshop