Friday, February 10, 2017

Solution to infamous "Firefox is already running but is not responding." problem! Ubuntu 14.04


Try this simple solution if you have received this error:

Firefox is already running but is not responding. You must either close Firefox or restart your system.
 
This worked on Ubuntu 14.04.

First:

Run:
$ ps aux | grep firefox 

and kill the returned processes with PID:
$ kill PID

If the problem still persists:

$ cd ~
$ cd ./mozilla
$ cd firefox
$ ls

now you will see a directory with extension ".default". The filename is a combination of letters and numbers. CD into that directory.

$ cd [filename].default
$ ls -a

now you will see a file named lock (or .lock). delete that. Problem is solved.

$ rm .lock

Problem should be solved by now.

Thursday, December 8, 2016

Enable and use external USB bluetooth 4.0 dongle on Ubuntu 14.04

Here is how you can use your external USB bluetooth 4.0 dongle in Ubuntu, even if you have an in-built bluetooth device. My in-built one is buggy, so I bought CSR8510 A10 USB bluetooth for cheap, and using it with my wireless headset.


Steps for manual connection:


# Step 1: Find alias for my adapter
sudo hciconfig
# hci1: {stuff} (this is the new one)
# hci0: {stuff} (built-in)

# Step 2: Discover available devices
bt-adapter -a hci1 -d
# {bd mac}

# Step 3: Bind bluetooth device
bt-device -a hci1 -c {bd mac}

# Step 4: Connect audio device
bt-audio -a hci1 -c {bd mac}
 
 
  
Worked like a charm for me.  Got it from here: http://askubuntu.com/questions/594843/how-can-a-specify-specific-bluetooth-adapter

Thursday, May 16, 2013

Python: listing all files and directories under a directory



import os

allfiles = list()

# listing all the files in the subdirectories
root = "yourDirectory/"
path = os.path.join(root, "targetdirectory")

for path, subdirs, files in os.walk(root):
    for name in files:
        s = os.path.join(path, name)
        allfiles.append(str(s))


for l in allfiles:
    print l

BZ2 compression & decompression in python

pretty easy!

let's say your .bz2 file is "filename":

import bz2

bfile = bz2.BZ2File(filename,"r")
for line in bfile:   
    print line.strip()