How to specify controller and action in rails form

Leave a comment

Here’s a simple example of how to create a form specifying the controller action method in the form request.

rails-form

routes.rb

  match '/load',      to: 'load#new',           via: 'get'
  match '/load',      to: 'load#create',        via: 'post'

load/new.html.erb


<%= form_tag({controller: "load", action: "new"}, method: "post") do %>
    <%= label_tag(:q, "Search for:") %>
    <%= text_field_tag(:q) %>
    <%= submit_tag("Search") %>
<% end %>

load_controller.rb

class LoadController < ApplicationController

  def new

  end

  def create
    raise "foo"
  end

end

Here I am just purposely raising an exception to see if I hit the create method.

Running it looks like this

rails-parameters

You can see and pull the request params at the bottom like this:

  def create
    ...
    query = params[:q]
  end

How to cut a circle in half with illustrator

Leave a comment

Say you want a semi-circle and you want to split it in half.

half-circle-illustrator

Here’s how you do it.

Draw your circle

cirlce-illustrator

Select the knife tool

knife-tool-illustrator

Holding down the ‘Option’ key on your Mac, with your shape selected, drag the knife across the circle in a straight line.

cut-circle-illustartor

Now you should be able to drag one shape away from the other. Except this doesn’t always work for me (sometimes the whole shape wants to move).

In that case bring up the ‘Path Finder’ Window and with your newly cut shape highlighted select the ‘Minus Front’ option. That should cut away the bottom half of your shape.

minus-front-illustrator

And Voila! Half a circle with a nice contour around all the edges.

half-circle-illustrator

Links that help
http://jenniferbrowndesigns.blogspot.ca/2010/04/knife-tool-in-illustrator.html

Drawing the Human Face

Leave a comment

Human faces are great at teaching beginners the importance of proportionality when learning how to draw.

What makes the topic so fascinating, is learning that our brain is changing incoming visual signals to fit our preconceived conceptions.

For example, would you believe all four of these men below are of the same size?

4-men-train-track

Or how about this table. Does the surface of one look larger than the other?

same-size-table-top

As strange as this may same, the x4 men all all the same size, and the tabletop surfaces are of equal size too!

This phenomenon is called “visual constancy” and it throws us off when drawing.

The chopped off skull and misplaced ear

Two critical relationships beginners seem to struggle with is the location of the eyes, and the location of the ear in profile view.

Look at this early picture titled ‘Carpenter’ by Vincent van Gogh.

carpenter-van-gogh

Early on in his career, van Gogh struggled with problems of proportion. Like most of us, he put the eyes too high, and the ears too far forward.

Two years later, you can see how van Gogh had solved his problems with this much more proportionally correct picture titled ‘Old Man Reading’.

Old-Man-Reading-van-gogh

The eyes on the human head are actually located ½ way down the face.

eys-half-way-down-face

The the ears on the profile view are the same distance from the eye level to the chin.

Eye level to chin equals back of the eye to back of ear.

Once you grasp these non-refutable dimensions, drawing human faces becomes much easier. Here is an exercise where Betty asks her students to copy this picture called ‘Mme. Pierre Gautreau’ by John Singer Sargent.

mme-pierre-gautreau

The picture looks deceptively simple, but mastering and getting down the proportions is critical.

Here is my attempt.

my-attempt

It’s not great. It’s also not bad. I tried really hard to get the eyes, lips, and ears in the right place. But you can also see where I didn’t quite get the neck width right, or the mouth and chin (maybe this is a picture of her mother).

Anyways, the important thing to note is that there are critical maxims and rules of thumb to master if one is going to draw the human face correctly.

Back to the drawing board :)

face-proportions

How to add curves to a straight line in illustrator

Leave a comment

Say you have a shape that you want to add some curves to.

straight-line

Here I want to add some curves to the bottom straight line (it’s the outline of a super hero cape). Here’s how you do it.

1. Add some anchor points.

Select your shape, find the straight line you want to add a curve to, and add anchor points where you want the curves to appear.

First select the ‘Add anchor point tool’

add-anchor-point-tool

Then add your anchor points by clicking on the line where you want them to appear (more dots should appear on the line).

add-anchor-points

See where the straight line used to have no anchor points between the ends. Now it has two.

2. Add some curve.

Select your direction tool (shortcut – A)

direction-tool

then select the anchor point(s) you just added, and pull them in the direction you want your line to curve.

anchor-points-added

See how that bent our line? Next let’s smooth it out.

3. Smooth it out.

If you want jagged lines, you are done. If you want these to be curved, we need to convert these anchor points to ‘smooth’.

Using the same selector tool (short cut – A), select the anchor point you want to convert and then go to the top Illustrator and select ‘Convert Selector Points to Smooth’.

smooth-curve-with-anchor-points

That should now smooth out your line and give it some nice curve.

Happy drawing!

Links that help

http://help.adobe.com/en_US/illustrator/cs/using/WS714a382cdf7d304e7e07d0100196cbc5f-6246a.html#WS49B38026-E630-4b8e-8ABF-2AA6C629AE59a

How to draw a line with arrowheads at both ends adobe illustrator

Leave a comment

1. Draw your line using the pen tool.

draw-your-line

2. Open the Window > Stroke panel.

window-stroke-panel

If you don’t see the arrowhead section try toggling the ‘Show Options’ by hitting the little arrow with squiggly lines.

squiggle-line-options

show-options

3. Add your arrowheads.

add-arrow-heads

arrowheads

http://luanneseymour.wordpress.com/2012/10/30/creating-arrows-and-arrowheads-in-illustrator-cs6/

How Artists Give Depth – Perceiving Relationships

Leave a comment

Look at this drawing. There is a lot going on.

perspective

Notice how horizontal edges that fall on the horizon are flat?
Also notice how any horizontal edges above the horizon converge down?
And how horizontal edges below the horizon converge up?

“Art is a lie that makes us realize the truth.” – Pablo Picasso, 1923

“Point of view is worth 80 points of IQ.” – Alan Kay, Computer Scientist

These concepts are part of the perspective paradox. We know alls sides of a square have equal length sides, yet if we want to draw one with perspective, that ‘rule’ needs to be broken.

Art has concepts that helps artists deal with perspective. One of them is vanishing points.

Vanishing Points

The vanishing point is that level on the horizon the artists eventually sees all lines of perspective converging. It’s that classic road fading off into the horizon.

When we do this a couple of things happen.

  1. Horizontal edges that are below the horizon converge up.
  2. Horizontal edge below converge down.
  3. And those on the horizon are flat.

Get this wrong in your drawing and things are going to look weird. So it’s a maxim artists use to maintain perspective.

Here’s a building I happen to be sitting inside.

perspective-lines-photo

Can you see the vanishing point? Here is me trying to capture it.

vanishing-point-building

If an artist were doing this for real, they would be way more careful than I am (I just eyeballed it). But you can see it. It’s there in every picture with depth.

The trick is identifying the vanishing points in your drawings, respecting them, and then drawing everything else in a way that respects them.

Easier said than done. Here is me trying to fill in some detail.

filling-in-detail

It’s OK (in that I picked a vanishing point). But you can see how bad it looks if you get the horizontal edges wrong.

getting-it-wrong

Here’s a beautiful drawing (with lots of challenging perspective lines) by Alex Eben Meyer.

eben_meyer_times_dining

Anyways, as a software programmer learning to draw, what I take away from all this is there are rules of thumb, design patterns, and maxims in art, just like there are in software and anything else.

I enjoy learning about these because it helps me see the world differently, in ways I couldn’t before.

Vanishing lines are neat. You need to respect them, else your drawing will come out all funny and the human eye will reject.

More drawing posts:
How Artists Draw the Hard Parts – Negative Spaces
Modified Contour Drawing Exercise
Drawing on the right side of the brain
Three exercises to get you going
Vases and faces
Drawing upside down
Use contour drawing to see things differently

Betty’s excellent book Drawing on the Right Side of the Brain.

How Artists Draw the Hard Parts – Negative Spaces

4 Comments

Ever wonder how artists draw the really hard part of pictures, like the legs and the horns on this big horn sheep?

big-horn-sheep

They do it by NOT drawing the the legs and the horns. They draw the negative spaces.

Drawing negatives spaces shuts off the L-Mode left hand side of your brain (the one used for language) and instead kicks in the R-Mode right hand side (the one for drawing).

partial-negative-space

But your left brain lacks the words to describe the negative spaces it is drawing, the right side simple draws what it sees (or doesn’t see).

finished-sheep

So by focusing on the spaces, and ignoring the hard parts, you can take a complicated, tough picture, and get the hard parts right by drawing the spaces.

This is one technique artists use to get the hard parts right.

Other notes from Betty’s Book:

  • professional artists put as much attention and detail into these negative spaces as they do the objects they are drawing
  • the forms take care of themselves when you focus on the negative space
  • beginner artists struggle with drawing because they put all their attention and focus on the object they are drawing, and none to the space around it

Negative spaces have three important functions:

  1. Negative spaces make difficult drawing tasks easy.
  2. Emphasis on negative space unifies your drawing and strengthens your composition. Emphasis on negative spaces automatically creates unity, and, conversely, ignoring negative spaces inevitably di-unifies an artwork.
  3. Most important, learning to pay attention to negative spaces will enrich and expand your perceptual abilities. You will find yourself intrigued by seeing negative space all around you.

Exercise: drawing a chair

Here we are going to draw a chair. Only we are not going to draw it at all! Instead, we are going to draw the easy parts, the negative spaces.

So here is the chair I have chosen to draw.

chair-to-draw

And here is my attempt at capturing the negative spaces.

negative-space-chair

Hmmm. No so good. This was harder than I thought!

Now admittedly, I am not following Betty’s instructions to a tee. For one I don’t have a plane viewer to simulate the taking a picture and then copying what you see. But also, I really felt the pain of spacing and composition (getting everything spaced right).

Betty refers to this challenge as finding your ‘basis unit’, and this is something all beginners struggle with.

You see whenever you start drawing a picture, you need somewhere to start. More than that, the size at which you draw that first thing, sets the stage for the rest of the picture.

If you draw the legs of the chair too big, your picture will spill beyond your borders. Too small, and everything else will seem out of whack.

To remedy this, Betty has some exercises that basically build kind of grid system, or cross hairs, so you can draw everything else relative to it’s position in your view. That’s why I have that ‘+’ sign in the middle of my picture. It helps me space everything relative to that.

Doing this exercise also made me appreciate how much is going on whenever I traced pictures (something I used to do a lot as a kid).

When you take a cartoon, comic books strip, or picture and trace it, all the spacing is handled for you. You don’t need to worry about the size of the head vs the size of the body. It is all handled because it’s a picture!

That’s how photography started. It was artists who had planer viewers they used to look at scenes through for perspective, and then photography came along and did all that for us.

Anyways, fascinating topic. Not my greatest drawing, but I can appreciated the power of negative spacing, and will try to leverage it, along with contour lines, in future drawings.

More drawing posts:
Modified Contour Drawing Exercise
Drawing on the right side of the brain
Three exercises to get you going
Vases and faces
Drawing upside down
Use contour drawing to see things differently

Betty’s excellent book Drawing on the Right Side of the Brain.

Older Entries

Follow

Get every new post delivered to your Inbox.

Join 302 other followers

%d bloggers like this: