Wednesday, July 25, 2012

Sinatra pitfalls


I recently got interested in Sinatra as a way to create simple web applications quickly. Sinatra allows for one file web applications and it's like ruby's answer to PHP.

But I ran into a few pitfalls that aren't well documented in the Sinatra website or in the O'Reilly book (Sinatra: Up and Running).

Pitfalls:
* an explicit return quits the Sinatra app.
* the render command must be the last thing on the block or it might not work.
* the thin gem is not yet supported on Windows.

Additionally while the Sinatra website really pushes haml as a viable format, I found it kind of useless. While HTML can be easily copy and pasted (and debugged) haml just seems to add complications to it unless your familiar with it. That is haml has a very steep learning curve before you reap any benefits while HTML is totally linear. The more you learn the more you can use.

While this is similar to the criticism coffeescript gets, JavaScript's learning curve is not linear like HTML's. And coffeescript's is easier to learn that JavaScript. Which is why I keep saying that the number one feature of coffeescript is for teaching people JavaScript. Unfortunately all the coffeescript books assume fairly advanced JavaScript knowledge.

So:
Additional Pitfall:
* using haml, at all. Stick to HTML and erb.

Wednesday, June 13, 2012

DVD where to next?


Steam has released its first movie through its digital distribution network. Netflix streams movies directly to your computer. Hulu is the new cable. Is there a place for physical distribution?
Is Bluray dead?
The short answer is: yes it is. I used to work in the DVD industry and after getting laid-off a few years back I've been looking to re-invent myself as a writer, as a programmer and as a leader. Things easier said than done in this economy.
The sad part of this is that this digital transition was inevitable and foreseeable. Yet the studios and the vendors (I worked for a vendor) and even the retail stores all pretended that it wasn't happening, until it did. Blockbuster is no more, Hollywood Video is no more. All preventable 'deaths' if they'd moved their assents correctly.
The next thing on the chopping block is film canister delivery to movie theaters. With silver jumping in price (I'm not sure but I think it quadrupled) and silver being a huge component of the chemistry of film, suddenly figuring out digital distribution by shipping hard drives made more economic sense. This will lead to a loss of many film-distribution businesses (and possibly theaters that now need a digital projector to survive and those things aren't cheap).
So where to now DVDs?
Well people, cocooning is dead. DVDs were part of the trend of people cocooning. Separating themselves from others and creating 'man-caves', 'tv-rooms' and the like. This trend is dead too. Facebook killed it. Now with communities so easily formed, with sites like meet-up that facilitate face-to-face group creations, the next trend is communities. The individual experience of watching a movie at home will decrease, and the nuclear experience of watching a movie also. In fact the dinner and a movie date is also dead. It's now boring and passĂ©, like from a time before yelp could guide you to a cool interesting place.
So what's next?
I think that what's next for the world of movies is the shared experience. Cinespia has got it right by doing outdoor showings (in the Hollywood Forever cemetery). Bring a blanket, bring some food and you can have a picnic while watching a movie. A much nicer, more awesome experience than the quiet antiseptic movie theaters we have now. (When I was a kid watching a movie in a theater was awesome because in the silence and darkness you could feel that community.)
I think movies will either evolve back into these communal events or be driven by spectacle only and be like feeders to the secondary digital distribution channels. The best movies are the ones that make you think, the ones that you want to talk about. How great would it be if you really had that space yourself instead of having Kevin Smith do a show about it? (On Hulu of all places...) This is coming people and I can't wait. I like watching movies and I can't wait for them to become real date activities again. In the mean time I'll keep enjoying my reverse-cocooning, my going 'down to the pub' or in my case lugging my laptop to the cafĂ©.

Saturday, April 14, 2007

1.1 RTFM

Command Line Interface (BASH Shell)
1.1 RTFM

RTFM (Read the F@*%^#& Manual) was the first thing I learned about Unix and it's served me well on Linux. Almost every Linux command has a manual entry that's accessible through the command line. The command looks like this:
user@linux:~> man "command-name"

This will bring up the manual entry for a particular command. Which has an explanation of what the command does and the syntax of how to use it.

This is the first part of the manual entry for the "man" command.

MAN(1) Manual pager utils MAN(1)

NAME
man - an interface to the on-line reference manuals

SYNOPSIS
man [-c|-w|-tZ] [-H[browser]] [-T[device]] [-adhu7V] [-i|-I] [-m sys‐
tem[,...]] [-L locale] [-p string] [-C file] [-M path] [-P pager] [-r
prompt] [-S list] [-e extension] [[section] page ...] ...
man -l [-7] [-tZ] [-H[browser]] [-T[device]] [-p string] [-P pager] [-r
prompt] file ...
man -k [apropos options] regexp ...
man -f [whatis options] page ...

DESCRIPTION
man is the system's manual pager. Each page argument given to man is
normally the name of a program, utility or function. The manual page
associated with each of these arguments is then found and displayed. A
section, if provided, will direct man to look only in that section of
the manual. The default action is to search in all of the available
sections, following a pre-defined order and to show only the first page
Manual page man(1) line 1


As you can see the manual command reformatted the whole terminal window. So the first question is how do you quit?

To Quit press Q.
This is not intuitive at all and surprisingly missing from a lot of dead-tree resource manuals. To Interrupt press Ctrl-Z. This will halt the process but wont quit. I'm sure there is a way to restart the process but I haven't found it yet.

To access help press H.
This has a list of what all the keys do when pressed. Very useful.

To Navigate the manual entry:
To go down or up on the manual entry you can use the arrow keys or Page Up and Page Down keys.
Pressing W is the same as Page Up, pressing F as Page Down and Pressing E and Y the same as the arrow key down and up (respectively) if you have a limited keyboard.

Now you should read the manual entry for "man" and learn about the syntax of commands as explained by man.

Typing the command with the flag -? or -h will sometimes bring a different manual entry on the command.
There is also an "info" command that works the same way as the manual "man" command.

Intro: GNOME vs KDE

There are two major desktop environments in Linux: Gnome and KDE.
There is also a flame war between proponents of each.
So as a sort of disclaimer here is my take on them.

KDE is a new type of desktop environment. Very costumizable, somewhat busy and complicated. It is favored by programmers and famously the one used by Linus Trovaldis (the guy who created the Linux kernel). It is definitely new (it is not like Windows or any other OS), mature system with the better application integration. It has a steep learning curve. http://www.kde.org/whatiskde/

Gnome is sort of like a mixture of Windows XP and the Mac OSX. It is simple, but somewhat flat and while easy to costumize appearance-wise, it does not provide as much options as KDE. Because it is in-between the Windows and Mac interface, it's easy to learn. It is not as mature as KDE, but it's getting there. http://www.gnome.org/about/

I use Gnome. Mostly because I find it easier to use and it gets out of my way. Yet I use a lot of KDE applications which I believe are superior to their Gnome equivalents (like K3b for example). Like I said above the KDE is more mature and when the upcoming release of KDE4 it'll be far more advanced than Gnome. We'll see if I'll find it easier to use than its present form.

Funny thing, if you look at the website design of their respective website they are reminiscent of the Desktop Environments...

Other environments that I have used are:
XFCE which is like a simpler Gnome, Icewm which is like Win98 for Linux, and Fluxbox which is a super simple very fast window manager, but not a desktop environment.

Statement of Direction

I've been using linux for about a year now. It's a very cool system and it's come a long way since I first used it in 1995 when I was visiting a friend at MIT. I've found that there is a lack of compiled materials for linux (both online and in print) for the beginer linux user. They either shoot too low (computer newbie) or too high (compsci major). Which leaves me sort of stranded. I'm not a compsci guy or a programer but I need to know more about the system than the basic commands, and more importantly I'm not intimidated by a command line interface.
So here's where this blog comes it.
Hopefully irreverent, useful and an lonely planet guide reader's linux handbook.