Ubuntu: How to fix if screen brightness is not working

Recently I bought a new Dell Inspiron 3521 and Installed Ubuntu 13.10. Then I seen a minor issue it was screen brightness was not working. But in Try Ubuntu mode screen brightness was working well.

It may be your machine having same issue. So, lets go to fix this problem. Here is the solution I found some where:

First open /etc/default/grub:

$ sudo nano /etc/default/grub

In /etc/default/grub around line 12 there could be a line with written this:

GRUB_CMDLINE_LINUX=""

If found then change it as below line or if not then paste the below line:

GRUB_CMDLINE_LINUX="acpi_backlight=vendor"

Now save changes by pressing Ctrl+O then Enter Key

That’s it, you have done

But you should update Grub to apply changes. So also do this:

$ sudo update-grub

And what? Restart you machine.

How to find date interval in JavaScript

var get_date = function(interval) {
    // Get current time
    var now = (new Date).getTime();

    // Check if interval has some value
    if(!isNaN(parseInt(interval))) {
        now += parseInt(interval);
    }

    // Initialize date object
    var today = new Date(now);
    var yyyy = today.getFullYear();
    var mm = today.getMonth() + 1;
    var dd = today.getDate();
    var hh = today.getHours();
    var ii = today.getMinutes();
    var ss = today.getSeconds();

    // Lead 0 if month is less than 10        
    if(mm < 10) {
        mm = '0' + mm;
    }
    // Lead 0 if day is less than 10
    if(dd < 10) {
        dd = '0' + dd;
    }

    // Lead 0 if hours is less than 10
    if(hh < 10) {
      hh = '0' + hh;
    }

    // Lead 0 if minutes is less than 10
    if(ii < 10) {
      ii = '0' + ii;
    }

    // Lead 0 if seconds is less than 10
    if(ss < 10) {
      ss = '0' + ss;
    }

    return yyyy + '-' + mm + '-' + dd + ' ' + hh + ':' + ii + ':' + ss;
}

Now use the function above to add interval to current date:

// Get current date
console.log(get_date());

// Add one day to current date
var interval = 86400000 * 1;
console.log(get_date(interval));
// Similarly add 20 days to current date
var interval = 86400000 * 20;
console.log(get_date(interval));
// Subtract 20 days to current date to past date
var interval = 86400000 * -20;
console.log(get_date(interval));

Find last 10 days records even some days is missing between

Here I’m selecting last 10 days records from transaction table even there is some days has no any transaction.

SELECT * FROM `transaction` `t`
WHERE 
    DATE(`t`.`timestamp`) < (
        SELECT DATE(`s`.`timestamp`) FROM `transaction` `s`
        GROUP BY DATE(`s`.`timestamp`)
        ORDER BY DATE(`s`.`timestamp`)
                DESC LIMIT 10,1
    )
ORDER BY `t`.`timestamp` DESC

SAMPLE: Results will be only for previous date:

Read More

Searching for HTML content slider?

Here I found a Cool and Fully customizable carousel which full fills our each type of requirements.

If you are using this then there is no any option to find other carousel. This fits with our every need.

This is carouFredSel.

jQuery.carouFredSel is a plugin that turns any kind of HTML element into a carousel. It can scroll one or multiple items simultaneously, horizontal or vertical, infinite and circular, automatically or by user interaction. Oh, and it’s responsive too.

Also find cool carousels built with carouFredSel. Here is lots of carousel which completes our any type of requirements.

Cool Carousels

Good Luck.

How to find Database size?

Here I found some important query to find database and table sizes. Execute the below SQL script to list out the entire schema/database size:

MySQL

Find entire databases and sizes

SELECT `table_schema` AS "Database", (SUM( `data_length` + `index_length`) / (1024 * 1024)) AS "Size(MB)"
FROM `information_schema`.`TABLES` GROUP BY `table_schema`;

Find size for a single schema/database

Read More

jQuery Addon Tagging

jQuery Tagging helps to select tags for new post

Find more info here: Tagging

Ubuntu Phone OS

Wow,

It’s good to hear about Ubuntu Phone OS. Today canonical has announced Ubuntu for phone.

Ubuntu Phone OS

Read more