## How are Vedea and Processing different?

Two basic differences,

• Processing is really easy to install (can't find Vedea installer anywhere, someone please put a link in the comments if you do)
• Processing is about a lot more than just interactive info-graphics, data visualizations and computational art. You can interface it with just about any sensor via a micro-controller and also hack into your computer hardware such as the mouse, keyboard, mic, camera and speaker to do really cool stuff. (check out Exhibition Archives \ Processing.org )

## What are the main advantages and use-cases of currying?

If your functions are in curried form, that makes it more convenient to partially apply them. It's never necessary, but it's often syntactically lighter. For example, suppose that you have a list of integers xs, and you'd like to add 3 to each of them.

In Standard ML, the operator + has type int * int -> int. If you want to add 3 to each element of a list using map, you need a one argument function that adds 3, which you can get by partially applying +:

map (fn y => 3 + y) xs

In Ocaml, on the other hand, + is curried — that is, it has type int -> int -> int. (The arrow right-associates, so that's the type of a function that consumes an integer and produces a function that consumes an integer and produces an integer.)  This makes partially applying + a bit shorter:

map ((+) 3) xs

These same techniques work in untyped, higher-order languages such as Perl and Python as well, but it's easier to explain in a typed language, where you can see the difference between curried and uncurried + in their types.

If you write your functions in a curried style, the order of the arguments affects which arguments you can partially apply conveniently. For example, given a list of floats in Ocaml, it's syntactically lighter to find the reciprocal of every number than to divide every number by 2:

map ((/.) 1) xs             (* reciprocal of every number in xs *)
map (fun x -> x /. 2) xs    (* half of every number in xs *)

There are a few solutions to this problem. One, employed by Haskell, is operator sections, which allow partially applying either operand:

map (1 /) xs    -- reciprocal of every number in xs
map (/ 2) xs    -- half of every number in xs

More generally, the Scheme cut macro (http://srfi.schemers.org/srfi-26…) facilitates arbitrary partial application. For example, given a vector v and a list of indices into that vector indices, we can set each of those indices in the vector to 0:

(for-each (cut vector-set! v <> 0) indices)

In this example, <> is the placeholder for the argument that isn't partially applied; cut actually allows an arbitrary number of placeholders. Note that this is not an example of currying, but an attempt to provide a more flexible way to do partial application than currying provides.

## What are the advantages of Erlang over other programming languages?

There's a lot of runtime introspection above and beyond hot code swapping. You can attach a console to a running node and inspect and modify state interactively.  I'm a big fan of debugging with printfs, but if you've got a stateful server in production and you want to debug it, it's a lot easier to connect using a real REPL shell than with say gdb.

## What's the best tutorial on OpenGL?

Go through some presentations that describes overview of OpenGL Graphics e.g
OpenGLES – Graphics Programming in Android  (Disclosure: My talk at GDG conference)

At highlevel, this is how graphics pipeline works

1) Geometry of the 3D Model is described .
2) The geometry is divided into triangles. Transformations are applied to the model (i.e triangles of the model) are called Model Transforms
3) We have a virtual camera corresponding to eye. The transformation applied on the camera are called View Transforms
4) To give a 3D effect, perspective projection is applied which converts the  3D model to 2D space. These are called Projection Transforms
5) Model View Projection Transformations transform the objects and put them into screen space. These are described by MVP matrices
6) Rasterize the triangles to get the pixels( they are called fragments till you get to the final stage)
7) Fragments are shaded. It can be as simple as using interpolated color or complex (Apply lighting and texturing to get realism)
8) Fragments are combined(blended) to get a single pixel. The combination can be any arbitary operation like blending or as simple as displaying the closest pixel to the observer .  This blending phase combine the fragments generated by (possibly several primitives that overlapped and compute final color

Now you must realize at a very highlevel, we do the following
1. Transformation – Transform the geometry to Screen space
2. Rasterization – Rasterize the pixels(or fragments)
3. Applying Lighting and Texturing
4. Blend the fragments to single color.
5. Shaders are user defined code used to customize the pipeline
We will expand on each of these section in details

Transformation
Watch few introductory videos e.g , this  video from Samsung  gives overview of the transformations

Become familiar with the transformations going on at high level (these are model, view and projection transformations). Also be familiar with terms like View Frustum . Some basic math will help in knowing what is going on Diary of a Graphics Programmer. Optionally if you like to know more details and the math  GLSL Programming/Vertex Transformations

Page on Ntu
Page on Ntu
OpenGL
The Basic Graphics Pipeline

RASTERIZATION
Rasterization is simply the process of finding which pixels are lying inside the triangle. We can say that we are just coloring the triangles. If the color attributes at the vertices are same we can uniformly color the region. Otherwise the attributes at the vertices must be interpolated. See a demo of interpolated triangle in openGL

LIGHTING
Recall that rasterizer just interpolates the color. For most applications this is sufficient, but in presence of light we need more sophisticated models. The effect of light is captued using Shading equations.  The simplest lighting is Flat Shading. There are advanced mathematical models like Phong/Gourard.

Get Overview of Lighting from
optionally if you want to learn  Lighting in detail, watch video by Barbara Hecker

It covers different lighting models.

Texture MappingLearn some basic texture mapping here
Page on Csusb
Optionally you can also dive into advanced texture mapping –

BlendingThe blending phase combine the fragments generated by (possibly several primitives that overlapped and compute final color
Learn about different blending modes here

We also need to remove parts of those surfaces that are partially obscured by other surfaces. These are called hidden surfaces. Hidden Surface Removal. This is done using Depth buffer

Read how the fixed functionality of the pipeline is replaced using shaders
GLSL Tutorial

BOOKSI found book by Peter Shirely to be very good for learning the concepts of computer graphics. Most books dive into the details without giving the motivation. Shirley gives good background  of the concepts.

Fundamentals of Computer Graphics: Peter Shirley, Michael Ashikhmin, Steve Marschner: 9781568814698: Amazon.com: Books
VIDEOSwatch courses like Online Graphics (Berkeley CS 184) Videos   or NPTEL

Watching few videos in Computer Graphics Series by  Dr. Sukhendu das

and also few related videos in the play list

Subscribe to youtube channel Computer graphics. Most of the videos are general and not informative like lectures. But they are motivating This video is also very general, but may interest if you are into game programming

DEMOS
Watch demos of how things work. There are lot of demos that let you change for e.g the model view projection matrices , lighting parameters. One of the best demos is from Nate Robbins. Get Nate Robbin's OpenGL demos and change the parameters and see how it affects the rendering.

Have OpenGL Programming  as reference. There seems to be hundreds of OpenGL calls. Its easy to learn if you break down to categories. This page has nicely summarized them OpenGL Quick Reference Guide

Ideally you should install some framework on your local system, but if you want quick web demo, use

Web Demos
The Lessons | Learning WebGL
WebGL Shader Lab – Coded Structure
Lesson 0: Getting started with WebGL or other frameworks

PRACTICE OpenGL USING GLUT / FreeGLUT

OpenGL Step by Step has some exercises. Try few of them. Install GLUT
Page on Ntu helps in installing glut. Try  Some Keyboard and Mouse Handling
Mouse event handling source code in OpenGL. Try some animation e.g Moving ball. Apply Texture using
OpenGL Programming/Intermediate/Textures

Get the OpenGL code running with Shaders. Watch this for reference. Page on Csusb. Write you own Fragment shader to draw circle
WebGL Lesson 13 – per-fragment lighting and multiple programs

PRACTICE OpenGLESOpenGLES is a subset of OpenGL. It deprecates few functions like glBegin/glEnd which is used to describe geometry. Get OpenGLES samples working on Android

Android Lesson One: Getting Started.

In OpenGLES, geometry is specified using Vertex Buffers. Learn more about it hereChapter 5. Objects in Depth .Try advanced stuff on android also e.g Android Lesson Four: Introducing Basic Texturing

iPhone users
OpenGL ES From the Ground Up, Part 2: A Look at Simple Drawing
All about OpenGL ES 2.x – (part 2/3)
OpenGL ES Programming Guide for iOS

ADDTIONAL RESOURCESThough OpenGL doesn't care about the modeling tools, its good to understand the overview how this is done. Just take a  quick glance at Page on Cssb

You can dive into math if you are interestedPage on Essentialmath. Homogeneous Coordinates are used to represent vertices

If you want an indepth knowledge read A trip through the Graphics Pipeline 2011, part 1  and other parts

And watch in depth lectures by John Owens (UCDavis)
(this one is on Pipeline overview, but also others on Rasterization etc)

## What are the advantages of Haskell over other functional programming languages?

With Haskell, I can produce correct code significantly faster than in other languages. Here’s why:

• An expressive type system promotes agility better than the so-called “agile programming languages” because of how types support radical refactoring. When I decide to change an interface deep in some large system, the type checker subsequently tells me everywhere else in the program I need to change to get it up-to-date. Other languages’ type systems can sort of do this, but it requires more expressiveness than you get from Java to make types more helpful than annoying.
• No amount of testing can deliver the confidence that passing the type checker does in proving the absence of some varieties of bugs. In the iterative refinement cycle, once a program types again, the vast majority of the time it passes the regression suite as well. Types are the first line of defense.
• Purity makes a program easier to reason about. Side-effects are often used for non-local communication, which leads to a variety of difficult bugs. We need side-effects sometimes, and Haskell’s design makes it very easy to see where effectful computation is happening and where it isn’t. It may also turn out that referential transparency is the key to allowing mere mortals to do parallel programming.
• Type classes provide ad-hoc overloading, which makes some things more pleasant than in other members of the ML family. More importantly, advanced type class techniques provide type-level metaprogramming, which often allows for type-directed synthesis of what would otherwise be large amounts of boilerplate. Boilerplate is annoying and, because it requires maintenance, expensive.
• Monad transformers are a great way of layering effects in otherwise pure code. Very, very little of my code is in the IO monad; in my current project, it’s confined to two files that together comprise less than 5% of the total line count. On the other hand, most major system components run in a monad specialized for what they need to do, which makes it very easy to see what kind of information flows where.

As far as I’m concerned, Haskell has one big downside:

• It has no macro system. I use Template Haskell, and it helps in some circumstances, but it’s no substitute for a real macro facilty such as syntax-case.

I’m wouldn’t claim that Haskell is a silver bullet (http://en.wikipedia.org/wiki/No_…) — it may not turn a 10X into a 100X — but my experience is that if you can learn it well, it will increase your productivity. It’s more fun, too.

## What programming languages support comparison of a value between two numbers without making two comparisons?

In Python, you can use multiple operators in the same comparison:

>>> 1 < 2 <= 2 < 3
True

## What are the trade-offs between effect typing, monads, and uniqueness typing?

It depends, of course, on what you’re trying to accomplish — they certainly aren’t interchangeable. If your goal is to get a handle on state in some way, consider:

• A type-and-effect system usually allows you to write in direct style — the ‘natural’ style that you’re used to, whereas monads (usually) will require explicit sequencing, and uniqueness types will require explicit threading.
• If your goal is to model effects in a pure language, an effect system won’t do it. You can generally embed uniqueness types into an effect system, and you can embed an effect system into an (indexed) monad, but then you’re back in explicit-sequencing-land. Likewise, you can use a state monad in an uniqueness-type system to avoid explicit threading, but then you're stuck with explicit sequencing.
• Uniqueness types and effects are both features that have to be built-in to your type system, whereas monads are a programming technique that can be applied in any higher-order language, or provided as a library.
• Monads can encapsulate a variety of effects (such as non-determinism) that don’t fall into a uniqueness-type framework, and probably don’t work out as neatly in an effect system. However, no one knows how to compose these things in general — it usually has to be worked out on a case-by-case basis.
• Uniqueness types and effect systems can make it clear when some code accesses or affects only a portion of some larger state, which may be more difficult to see using a monad.

Many of the above generalizations are not strictly true, but I hope they’re close enough. I’d also suggest looking at linear type systems as an alternative to uniqueness types — they can express many of the same things, but I think linear types are cleaner.

## How long does it take to master Erlang?

Try finding an online tutorial, but don't be afraid to ask a friend for help — if you're fortunate enough to have one that knows Erlang.  The core language isn't too bad if you're familiar with FP, but the associated concepts like gen_*, supervision hierarchies, and error handling are tricky.  Don't be ashamed to ask for help … it's not as straightforward as most of the languages you've learned.

Implement the things you're learning.  After you learn a concept, try building something that uses that concept.  If nothing comes to mind, ask someone for an assignment or find a tutorial with homework.  Reading tutorials and manuals will tell you how a feature works, but you won't really understand where it's appropriate to use until you've actually used it incorrectly a few times.  Experience is key; you'll probably find that after a while of programming Erlang that everything you wrote more than two weeks ago is complete crap.

Once you get into the real world use http://erldocs.com for reference.  It's the same material as http://www.erlang.org/doc but presented better.

## Python (programming language): Is there a Python equivalent to PHP's trim() function?

string.strip() is what you're looking for.

In [2]: help(''.strip)
Help on built-in function strip:

strip(…)
S.strip([chars]) -> string or unicode

Return a copy of the string S with leading and trailing
whitespace removed.
If chars is given and not None, remove characters in chars instead.
If chars is unicode, S will be converted to unicode before stripping

Python strip differs slightly from PHP's trim in the specific whitespace characters that it will remove. PHP trim will remove null characters, while Python strip will remove '\x0c'. Both will remove '\t', '\n', '\x0b', '\r', and ' '.

## What other choices do I have besides JavaScript for programming web browsers?

There is also Google Web Toolkit (http://code.google.com/webtoolkit/) which allows you to write in Java and essentially compile to JavaScript. Many of their products like gmail and maps are written using this framework. Haven't used it myself but the results sort of speak for themselves.