Blog Spot!


Google Chrome icon is fuzzy/blurry in Docky

askubuntu

I ran into this problem myself. I fixed it by editing the google-chrome.desktop file found in /usr/share/applications

sudo vi /usr/share/applications/google-chrome.desktop

You'll find a line

Exec=/usr/bin/google-chrome-stable %U

I changed mine to

Exec=google-chrome %U

After restarting Google Chrome the icon was all shiny and nice :) Hope this helps.

Added on 12.Aug.2015
Tags: chrome fix troubleshoot linux icon mint ubuntu

16 commands to check hardware information on Linux

Hardware information

  • lscpu The lscpu command reports information about the cpu and processing units. It does not have any further options or functionality.

  • lshw A general purpose utility, that reports detailed and brief information about multiple different hardware units such as cpu, memory, disk, usb controllers, network adapters etc. Lshw extracts the information from different /proc files.
    Use: sudo lshw -short

  • hwinfo Hwinfo is another general purpose hardware probing utility that can report detailed and brief information about multiple different hardware components, and more than what lshw can report.

  • lspci The lspci command lists out all the pci buses and details about the devices connected to them. The vga adapter, graphics card, network adapter, usb ports, sata controllers, etc all fall under this category.

  • lsscsi Lists out the scsi/sata devices like hard drives and optical drives.

  • lsusb This command shows the USB controllers and details about devices connected to them. By default brief information is printed. Use the verbose option "-v" to print detailed information about each usb port.

  • Inxi Inxi is a 10K line mega bash script that fetches hardware details from multiple different sources and commands on the system, and generates a beautiful looking report that non technical users can read easily.

  • lsblk List out information all block devices, which are the hard drive partitions and other storage devices like optical drives and flash drives.

  • df Reports various partitions, their mount points and the used and available space on each.

  • Pydf An improved df version written in python, that displays colored output that looks better than df.

  • fdisk Fdisk is a utility to modify partitions on hard drives, and can be used to list out the partition information as well.

  • mount The mount is used to mount/unmount and view mounted file systems.

  • free Check the amount of used, free and total amount of RAM on system with the free command.

  • dmidecode The dmidecode command is different from all other commands. It extracts hardware information by reading data from the SMBOIS data structures.

  • /proc files Many of the virtual files in the /proc directory contain information about hardware and configurations.

  • hdparm The hdparm command gets information about sata devices like hard disks.

Artice

Added on 06.Aug.2015
Tags: hardware info linux cmd

How to debug Node.js applications

How to debug Node.js applications

node-inspector could save the day! Use it from any browser supporting websockets. Breakpoints, profiler, livecoding etc... It is really awesome...

Install it with

sudo npm install -g node-inspector

then run

node-debug app.js

stackoverflow

Added on 03.Aug.2015
Tags: debug node js app

Remove duplicate values in a JavaScript array

Function calls are expensive in Javascript, for maximal performance, replace filter with a loop and get rid of other function calls:

function uniq(a) {
    var seen = {};
    return a.filter(function(item) {
        return seen.hasOwnProperty(item) ? false : (seen[item] = true);
    });
}

function uniq_fast(a) {
    var seen, out, len, i, item, j;

    seen = {};
    out  = [];
    len  = a.length;
    j    = 0;

    for(i = 0; i < len; i++) {
         item = a[i];
         if(seen[item] !== 1) {
               seen[item] = 1;
               out[j++] = item;
         }
    }
    return out;
}

stackoverflow

Added on 29.Jul.2015
Tags: js array duplicate remove performance

Find duplicate values in a JavaScript array

You could sort the array and then run through it and then see if the next (or previous) index is the same as the current. Assuming your sort algorithm is good, this should be less than O(n2):

var arr = [9, 9, 111, 2, 3, 4, 4, 5, 7];
var sorted_arr = arr.sort(); // You can define the comparing function here. 
                             // JS by default uses a crappy string compare.
var results = [];
for (var i = 0; i < arr.length - 1; i++) {
    if (sorted_arr[i + 1] == sorted_arr[i]) {
        results.push(sorted_arr[i]);
    }
}

alert(results);
// in a function
function compare(arr) {
  var sorted_arr, results, i, len;

  sorted_arr = arr.sort();
  results = [];

  for (i = 0, len = arr.length; i < len - 1; i++) {
    if (sorted_arr[i + 1] == sorted_arr[i]) {
      results.push(sorted_arr[i]);
    }
  }
  return results;
}

stackoverflow

Added on 29.Jul.2015
Tags: js array duplicate find

Search


PHP Libraries


Carbon lib / docs
Idiorm lib / docs
Image Workshop lib / docs
lorenzos/Minixed lib / docs
Parsedown lib / docs
PHP Paginator lib / docs
PHP Redis lib / docs
QrCode lib / docs
Requests lib / docs
Slim lib / docs
Spyc lib / docs
TWIG lib / docs
Upload lib / docs
Validation lib / docs
Zebra Image lib / docs

JS Libraries


AJV lib / docs
BackboneJS lib / docs
Bootstrap Notify lib / docs
C3.js lib / docs
ChartJS lib / docs
FastMD5 lib / docs
HighlightJS lib / docs
jQuery-Storage lib / docs
JS-Cookie lib / docs
Leaflet JS lib / docs
LowDB lib / docs
Marked lib / docs
NeedlyJS lib / docs
ParcelJS lib / docs
RequireJS lib / docs
Swig lib / docs
Toastr lib / docs
Underscore lib / docs
ValidateJS lib / docs
top