notational velocity

"Scotty...how much longer before we reach Notational Velocity?." ..."Jeem...I'm giving her all she's got!

You might be wondering what this entry is about. Over the years, I have used all kinds of tools to keep notes. The yellow Sticky thing that floats around, notepad, textmate, google docs and a google chrome extension, Evernote...I keep changing cause I never seem to be satisfied. Actually now that I think about it, I have used so many "note" keeps that I have lost a lot of notes in the morass over the years. Hopefully that will change!

I just want something that is always around, fast, and easy to use. I was experimenting with an IDE called ZED and there was some mention of interfacing with Notational Velocity National Velocity Website so I checked it out. Turns out its an editor and the reference had to do with the fact that Zed Zed Website sort of borrowed or got its idea for finding files from how NV works.

To make a very long story short. I love NV and I use it daily. I just like the way it works. Simple and fast. Give it a look-see.

NV screenshot

angularJS

"It's tax day..my printer ran out of ink as usual...oh yes...angular!..."

I have delved some with Handlebars, Mustache..well...I get them confused..they all have the mustaches right? Sometimes I think somewhere in the GIT universe there is this one giant repo from which everything is forked. Until I find it I will continue looking at trees in the forest.

I have changed gears to so speak. So many javascript things of interest to learn, but Angular to me looks the most promising right now. I will keep notes here on what i learn about angular and javascript.

The starting point if setting up angular:

1
2
3
4
5
6
7
// MODULE  definition
var angularApp = angular.module('angularApp', []);

// CONTROLLER definition
angularApp.controller('mainController', ['$scope', function ($scope) {

}]);

Terminology

  • ng-app (directive attaches application module to the page )

  • ng-controller (directive attaches a controller function to the page)

  • ng-show = "attribute" (directive)

  • ng-hide = "attribute" (directive)

  • ng-repeat = "product in store.products" (example only but gives us an EACH method for an array)

Expressions:

Statements or conditions in between ..for example, a boolean field that evaluates to true or false.

  • AngularJS expressions are written inside double braces: .
  • AngularJS expressions binds data to HTML the same way as the ng-bind directive.
  • AngularJS will "output" data exactly where the expression is written.
  • AngularJS expressions are much like JavaScript expressions: They can contain literals, operators, and variables.

We are living in the future so our present it our past.

rails view debug

"I would really like to see you..really..."

It's fairly easy to debug controllers. Use you IDE debugger, or PRY, and set your debug. But how about in views, for example the variables being rendered via ERB or HAML or whatever.

Rails has some helpers you can use: In particular, debug and to_yaml. Just go into your view code and add either(or both of the following)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def use debug
<%= debug @article %>
<p>
  <b>Title:</b>
  <%= @article.title %>
</p>

end

def use to_yaml
<%= simple_format @article.to_yaml %>
<p>
  <b>Title:</b>
  <%= @article.title %>
</p>

end

rake rails:update

"I just want to test out this railscast...."

I am sure you have done this. You find a railscast about something you are interested in, and besides watching the vid, you want to run the app.

You download it, and all heck breaks loose due to the rc demo using older versions of just about anything. Rather than using RVM or something to create or duplicate the original environment, I prefer just to upgrade it to the most current thing I am using on my dev machine. I really don't like loading up old versions of stuff all over the place.

One issue i ran into..some weird issue about a configuration file. Differences in configuration can happen with major upgrades, say going from rails 3.2 to 4.x.

Rails provides a rake rails:update task to update configuration files. Be sure you’ve committed your application with git before running rake rails:update in case you need to roll back changes.

1
2
3
def update_config_files
puts "rake rails:update"
end

The rake rails:update will identify every configuration file in your application that differs from a new Rails application. When it detects a conflict, it will offer to overwrite your file.

Don’t blindly allow rake rails:update to overwrite your files. Many of your files will be different because you’ve made changes from a default new Rails application. You’ll need to check each file to determine if rake rails:update is seeing your own changes or pointing out changes due to a Rails update.

When rake rails:update offers to overwrite a file, enter d (for “diff”) and review the differences. Most differences will be your own. If you’re uncertain, don’t overwrite the file; make a note for yourself and investigate later. If you are certain that the difference is due to a Rails version change, you can allow rake rails:update to overwrite the file.

Why I like Rubymine

"I like tools and going to Home Depot to look at them. Even buy unfortunately."

Anyone who does Rails is constantly trying out new tools it looks like anyway. I think the fear is...you will go to a job, and they will say.."we only use VIM here!"...or EMACS...well I tried them..and I hate them...but that said I did want to try one of the popular text editors. I use sublime, but now I have switched to Atom...they are about exactly the same but I just like the feel of Atom better.

BUT..I have always used JetBrain products going back to PHPStorm and Webstorm...so I was familiar with them, and the price was the same as what they want for sublime(Atom is free). Of course..we all know..Adobe made the best IDE's in history..but I guess suffer from marketing!

JetBrains ruby/rails product is Rubymine. I pretty much use it most of the time. I can do everything that Sublime/Atom can do AND more. Here are a few of the things that shine, and I will update this post as I find more.

Rubymine things I like

  1. Model Dependency Diagram. It's built it. You can see a visual representation of your model dependencies. To me I like it for reference sometimes when I am forgetting my "through" associations. Here is an example of a small app:

Rubymine Diagram

  1. Database Tool. I use SQLite, MySQL, and Postgres, mostly Postgres. For any of these database, Rubymine has a database tool that once you configure it to point to your database, gives you a tool to do all the normal database IDE functions. Modify records either via a table interface, or just use SQL. A picture is worth a thousand words:

Rubymine Database tool