Datatables: Cannot read property ‘mData’ of undefined

FYI dataTables requires a well formed table. It must contain <thead> and <tbody> tags, otherwise it throws this error. Also check to make sure all your rows including header row have the same number of columns. The following will throw error (no <thead> and <tbody> tags) <table id=”sample-table”> <tr> <th>title-1</th> <th>title-2</th> </tr> <tr> <td>data-1</td> <td>data-2</td> … Read more

How to color the Git console?

As noted by @VonC, color.ui defaults to auto since Git 1.8.4 From the Unix & Linux Stackexchange question How to colorize output of git? and the answer by @Evgeny: git config –global color.ui auto The color.ui is a meta configuration that includes all the various color.* configurations available with git commands. This is explained in-depth … Read more

What’s the difference between console.dir and console.log?

In Firefox, these function behave quite differently: log only prints out a toString representation, whereas dir prints out a navigable tree. In Chrome, log already prints out a tree — most of the time. However, Chrome’s log still stringifies certain classes of objects, even if they have properties. Perhaps the clearest example of a difference … Read more

JUnit test for System.out.println()

using ByteArrayOutputStream and System.setXXX is simple: private final ByteArrayOutputStream outContent = new ByteArrayOutputStream(); private final ByteArrayOutputStream errContent = new ByteArrayOutputStream(); private final PrintStream originalOut = System.out; private final PrintStream originalErr = System.err; @Before public void setUpStreams() { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); } @After public void restoreStreams() { System.setOut(originalOut); System.setErr(originalErr); } sample test cases: @Test public … Read more

How can I call controller/view helper methods from the console in Ruby on Rails?

To call helpers, use the helper object: $ ./script/console >> helper.number_to_currency(‘123.45′) => “R$ 123,45” If you want to use a helper that’s not included by default (say, because you removed helper :all from ApplicationController), just include the helper. >> include BogusHelper >> helper.bogus => “bogus output” As for dealing with controllers, I quote Nick’s answer: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)