Monday, September 21, 2015

Build an Ecommerce Business: Tips From an Ecommerce Founder

Many entrepreneurs mistake the “e” in “ecommerce” for “easy,” and frankly, it’s hard to blame them. The rise of platforms like Shopify and Volusion have made setting up an online shop a breeze, and with drop shipping services like Scalable Press and Doba, you never even have to be in the same room as the […]

Continue reading %Build an Ecommerce Business: Tips From an Ecommerce Founder%


by Joshua Kraus via SitePoint

How to Use FontAwesome in an Android App

Removing the Pain of User Authorization with Sentinel

Most non-basic multi-user applications need some roles and permission levels. If you ever used Wordpress, you must have noticed that they have a super admin, admin, editor, author, etc. Simplifying the development and integration of a permission system is what Cartalyst’s Sentinel package is trying to accomplish. The package provides an API for dealing with users, groups, permissions, etc. In this article, we’ll use it to create a small demo app.

Cartalyst Sentinel

Environment Setup

For our sample application in this tutorial, we will be using the Slim micro-framework and Vagrant. You can check out the final demo on Github to see the result. Let’s start by first requiring the necessary packages:

composer require slim/slim:~2.0
composer require twig/twig:~1.*
composer require cartalyst/sentinel:2.0.*

Sentinel suggests installing Illuminate Eloquent, Illuminate Events, Symfony Http Foundation and ircmaxell password-compat so let’s add those to the project.

composer require illuminate/database illuminate/events symfony/http-foundation ircmaxell/password-compat

Because working with users, groups and permissions requires some database interaction, we need to create our database with the necessary tables. If you are using Laravel you can install the database using the migrate command.

Continue reading %Removing the Pain of User Authorization with Sentinel%


by Younes Rafie via SitePoint

7 MORE Photoshop Master Tips to Speed up Your Workflow

Speed and quality.

That's what everyone is looking for when they use Photoshop. That's why knowing how to fully automate and optimize your working process is so important.

In the previous article, we explored some of the best tips which can help you to boost your workflow. Now, we're going to examine seven more tips, focused on streamlining the way your work with Photoshop.

Again, for the sake of brevity, we'll talk mostly what needs to be done, rather than the nitty-gritty detail. For fine-grained instructions, dig into the Photoshop's documentation or you can search the Web for practical solutions and tutorials.

1. Learn and Practice Keyboard Shortcuts

[caption id="attachment_115284" align="alignright" width="240"]WPM by Jason Devaun WPM by Jason Devaun[/caption]

When beginners start using Photoshop, they usually learn to perform a particular task by following a logical set of steps. During their movement from point A to point B, they are like a tourist train that needs to stop at every way station along the route.

This is not wrong – we all started in that way – but at some point you have to step up your game. Once we know how to perform a particular task, we need to catch that express train that skips the way stations. That express train is the keyboard shortcut!

Keyboard

Here is a Photoshop's default keyboard shortcuts list. If you prefer other shortcuts, you can edit the existing ones or even create your own for the tasks which don't have a shortcut assigned. Just go to Edit > Keyboard Shortcuts and make the needed changes.

2. Swap Your Computer Mouse with Graphic Tablet

Let's face it: Using a mouse for drawing and painting is not natural. There's a reason that pens aren't shaped like potatoes.

Using a tablet for the first time may feel a little strange, but once you get used to working with it, you'll wonder how you coped without it.

Intuos Tablet set up

With one hand on your keyboard (remember those keyboard shortcuts) and the other on the pen, your speed will really spike for tasks like masking, retouching, and vector linework.

The key factors to consider when buying a drawing tablet are:

  • size
  • pressure sensitivity
  • tilt sensitivity
  • price

You don't need to spend a great deal but if you use Photoshop for painting you might find a tablet with tilt sensitivity useful.

There are also some other handy features, like touch support and shortcut keys, which can add an extra layer of speediness and comfort to your workflow, but are dependent on your budget.

Rather than going into fine detail on tablets here, I'd recommend you check out Parka Blogs excellent 2015 tablet buyers guide for a great summary of what you'll need in a tablet.

Personally, I use an old Bamboo Pen with no tilt sensitivity, no touch support, and no express keys, as I don't generally use Photoshop for painting or drawing. The tablet works perfectly for making selections, using tools such as Dodge and Burn, etc. – all the features I need for my current Photoshop work.

3. Automate Your Workflow with Photoshop's Actions, Droplets, and Scripts

Photoshop's actions can be one of the most powerful weapons in your automation arsenal. A task made up of multiple steps can be performed automatically with one single click. It takes time to record an action the first time, but time is saved every time that action is repeated in future.

Let's say that you have a dozen images which you want to convert to a specific size and resolution. Instead of repeating the conversion for each one of the images, you can perform the task once, and save it as an action.

[author_more]
7 Photoshop Master Tips to Boost Your Productivity
What is Adobe Extract - And Why Should You Care?
Generating Responsive Image Assets with Photoshop CC 2014
[/author_more]

Applying actions in Photoshop requires you to:

+open the Actions panel +find the desired action +click the Play button

Wouldn't it be great, if we could perform this operation in a faster and easier way? Well... there is such a way, and it's called droplet.

Droplets

{IMG}

A droplet is a special file – which you create and save on your hard drive – containing a specific action defined by you. To apply that action, you only need to drag an image over the droplet and.. well.. drop it. Et voila.

The cool part is you don't even have to open Photoshop!

Besides actions, there is one more similar method to automate your workflow. Photoshop allows you to use built-in or user-created scripts. A script is more flexible and powerful than a standard action because it can change its behavior according to certain conditions – but you will need at least a decent working knowledge of JavaScript to write it.

This is not a big problem. There are plenty of scripts built by other people which you can download and use. One the other hand, if you know JavaScript, you can surely take the advantage of writing your own custom scripts.

Continue reading %7 MORE Photoshop Master Tips to Speed up Your Workflow%


by Ivaylo Gerchev via SitePoint

How to Save Multiple Checkbox Values to a Database in Rails

Imagine you have a form in your Rails app which is backed by an ActiveRecord model. In this form there are a bunch of checkboxes, the values of which you want to persist to your database. How do you go about handling this scenario?

As ever, the code for this article can be found on our GitHub repo.

The Anti-Pattern

Well, an initial reaction might be to create a string column in the database to hold all of the checkbox data. You could then use a before_save hook in the model to build the string and use check_box_tag helpers in the view to display the check boxes.

Let’s have a quick look at what this might look like. To do so, we’ll create a demo app into which you can enter the name of a professor and select their various areas of expertise.

rails new cb-demo && cd cb-demo
rails g scaffold professor name:string expertise:string
rake db:migrate

After that open up /app/views/professors/_form.html.erb and replace:

<%= f.label :expertise %><br>
<%= f.text_field :expertise %>

with:

<%= label_tag 'expertise_physics', 'Physics' %>
<%= check_box_tag 'professor[expertise][]', 'Physics', checked('Physics'), id: 'expertise_physics' %>

<%= label_tag 'expertise_maths', 'Maths' %>
<%= check_box_tag 'professor[expertise][]', 'Maths', checked('Maths'), id: 'expertise_maths' %>

In /app/controllers/professors_controller.rb alter:

params.require(:professor).permit(:name, :expertise)

to:

params.require(:professor).permit(:name, expertise:[])

Then in /app/models/professor.rb add:

before_save do
  self.expertise.gsub!(/[\[\]\"]/, "") if attribute_present?("expertise")
end

And in /app/helpers/professors_helper.rb add:

def checked(area)
  @professor.expertise.nil? ? false : @professor.expertise.match(area)
end

Finally, run rails s and navigate to http://localhost:3000/professors

And as you can see, it works. But unfortunately, that’s about all it does. Saving checkbox data to the database this way will just cause problems further down the road. For example as the number of professors and the number of areas of expertise grow, queries to find out which profs are assosciated with which areas will become a horrific mess.

Also what happens if you want to delete or rename an area of expertise? In this case you’d have to manipulate the database directly, which is almost never a good thing (not to mention time consuming and error-prone).

The Right Way

Luckily, there is a much better way to accomplish this — namely by moving Expertise into its own model and declaring a has_and_belongs_to_many association between Expertise and Professor. This will create a direct many-to-many connection between the models (by means of a join table — a database table that maps two or more tables together by referencing the primary keys of each data table).

As the Rails guide states:

A has_and_belongs_to_many association creates a direct many-to-many connection with another model, with no intervening model. For example, if your application includes assemblies and parts, with each assembly having many parts and each part appearing in many assemblies, you could declare the models this way:

You can visualize it like so (where expertises_professors is the join table):

Diagram illustrating HABTM association

Continue reading %How to Save Multiple Checkbox Values to a Database in Rails%


by James Hibbard via SitePoint

Working With Control, Sensing and Operators in Scratch

Business Skills for Freelance Developers