Linux (28) Python (13) Raspberry Pi (5) Bugs (3) Install (3) C (2) Brainf**k (1) HTML (1) Maths (1) Sorts (1)

Sunday, 21 February 2016

How to fix the "Firefox already running" problem on Linux

After creating a script which included closing a firefox tab and hiding the window I realised I could not open firefox and just got a "Firefox is already running" error every time after running this script once.

I tried running the command
sudo killall firefox
As there may have been some hidden windows however this didn't work.

Then I tried reinstalling firefox
sudo apt-get install --reinstall firefox
This didn't seem to work either.

Note this command will remove all personal data from firefox, run at your own risk.

After some research I found this
sudo rm -fr /home/"USERNAME"/.mozilla
This worked and I could open firefox again however I don't believe its the best way of solving this problem.

I'm open to any better ways so post in the comments if you have any.

Wednesday, 17 February 2016

How to Install NVIDIA Drivers on Ubuntu 15.10 14.04

The NVIDIA graphics cards are often the best cards you can get for linux graphics cards with the propriety drivers being the best performing, however the open-source drivers lack support.This causes most users interested in gaming or graphics intensive tasks resorting to using the propriety drivers that NVIDIA release.

We need to do a few things before we can install the NVIDIA driver:
Note: Installing drivers can cause problems so make a backup.
Add the graphics PPA:
A PPA or Personal Package Archive is more up to date software thats not included by Ubuntu by default.
To add the PPA run:
sudo add-apt-repository ppa:graphics-drivers/ppa

Now update the package lists:
sudo apt-get update

Now install the NVIDIA driver:
sudo apt-get install nvidia-358 nvidia-settings

Reboot your machine:

After the reboot run:

If this starts up with no errors you have successfully installed the driver and it is running.

Saturday, 6 February 2016

How to create a Python Dictionary.

Dictionaries in python are quite similar to arrays in how they look however arrays are indexed by a range of numbers i.e. 1-10, but dictionaries are indexed by their key.You can set these keys to immutable data types only.They can also be known as key pair arrays.

You will used to seeing this to create a standard array using square brackets.
test_array = []

If you want to create a dictionary you use curly brackets.
test_dictionary = {}

The format of a dictionary looks like this.
{'TEST': 1}

With TEST being the key and 1 the pair.

If you want to store values in a dictionary
test_dictionary["KEY"] = "Pair"

Note: You don't have to just use string other data types in place of each one.

To iterate through a dictionary
for key, value in test_dictionary.items():
     print('{0} links to {1}'.format(key, value)
Note: Using format when printing strings is considered good practice.