Skip to main content

Posts

Showing posts with the label Operating System

Formatting JSON in Kate - KDE Editor

Some years ago, I wrote a post on Formatting XML in Kate - KDE Editor . This one  below is for JSON format. Like the XML one this one also makes use of a tool installed on your machine and is invoked from Kate as a filter. TLDR;   Kate  is one awesome editor ( If you don't like  Vim  for its 'CLI'ness ) When working from the command line we can use a handy tool ' jq ' to format JSON files and pretty print them. Well, the good news is we can use the same from within Kate  as well But it is a tedious task to use it when you have some content in  Kate  ( more so if it is an unsaved file ) and want to format it. Incase, you don't have  jq  installed, simply hit sudo apt-get install jq and that will install it for you. If you use  jq  you would do something like this, Save File (  MySavedFile.xml  ) Go to Command Line cat MySavedFile.txt | jq '.' - > MySavedFile.txt and then reload our file in  Kate . If you wish t...

Adjust brightness in Linux Mint

I installed Linux Mint Qiana 17.2 on my (very old) Acer Aspire laptop. Was pretty surprised that I was not able to adjust the screen brightness using the laptop buttons. The hack I got was as follows, Open terminal (as a superuser) We now need gksudo to edit the grub file You can do gksudo gedit /etc/default/grub   In the text file that opens, look for the line which says GRUB_CMDLINE_LINUX="" In the empty quotes i.e. the "" insert the words "acpi_backlight=vendor" The line now looks like this GRUB_CMDLINE_LINUX="acpi_backlight=vendor" Remember to save before you close the file Back again in the terminal session, type sudo update-grub Reboot ACPI is Advanced Configuration and Power Interface It is used when the machine starts to control the amount of power given to each device attached to the computer. When we do acpi_backlight=vendor it tries to load vendor drivers before it tries the default generic driver for screen ...

Formatting XML in Kate - KDE Editor

TLDR;   Kate is one awesome editor ( If you don't like Vim for its 'CLI'ness ) When working from the command line we can use a handy tool ' xmllint ' to format XML files using its --format option. But it is a tedious task to use it when you have some content in Kate ( more so if it is an unsaved file ) and want to format it. Incase, you don't have xmllint installed, simply hit sudo apt-get install libxml2-utils and that will install it for you. If you use xmllint you would do something like this, Save File ( MySavedFile.xml ) Go to Command Line cat MySavedFile.txt | xmllint --format - > MySavedFile.txt and then reload our file in Kate . If you wish to remain in Kate and get this done then you would need to do, Select text ( Complete or Partial ) Hit ' Ctrl + \ '  or go to Tools -> Filter Text Incase your Kate does not have the option for 'Filter Text' under tools, you just need to enable the 'Text F...

Solving "Adobe Flash Player" Issue on Ubuntu (Chromium and Firefox)

I was stuck in this situation where I followed all applied instructions to install/activate Flash Plugin for Chromium (Version 37.0.2062.120 Ubuntu 12.04 (281580) (64-bit)) and Firefox (38.0.5) 1. Download corresponding version of Flash from Adobe Site: https://get.adobe.com/flashplayer/ 2. Untar and move data to corresponding directories. 3. For some reason, it didn't work. Then after lot of search, I came across this post (Link at end of the article). Basically, what was missing in my case was a symbolic link in /usr/lib/mozilla/plugins/ So basically what we do is, Download the package from https://get.adobe.com/flashplayer/ mkdir /usr/lib/flash-plugin/ if it does not exist Extract the downloaded tar.gz and copy libflashplayer.so to / usr/lib/flash-plugin Give chmod 775 /usr/lib/flash-plugin/libflashplayer.so Finally, the missing link in my case, cd /usr/lib/mozilla/plugins/ ln -s /usr/lib/flash-plugin/libflashplayer.so . chmod 775 libflashplayer.so ...

Find size of package in Ubuntu before downloading it via command line

It is better to know the size of a package before downloading it. At times, apt-get install prompts before downloading the package and we can read the size there. However sometimes dependencies are downloaded and then there is a prompt for the BIG package. But by now some packages are already installed and if the BIG package is rejected because of slow bandwidth etc. an extra effort is to be made to clean the unnecessary packages too.( apt-get autoremove does it too. But, it is extra effort after all)   What we can do is this, apt-cache --no-all-versions show $package | grep '^Size: '   E.g: apt-cache --no-all-versions show qtoctave | grep '^Size: ' Size: 3891520 The size is in bytes. Ubunut Version: 12.04 LTS

Solving Ubuntu - Android unable to send file over bluetooth from phone to Dell Vostro Laptop

I have Ubuntu 12.04 LTS on my Dell Vostro laptop. I am able to send files over bluetooth from my PC to my Android mobile but not vice versa even though the two devices are paired.The file transfer just fails with " File Not Sent " message. The problem is the option to receive files is disabled in the gnome-file-share-properties of Ubuntu. To access this dialog open the terminal and type  gnome-file-share-properties Please note that you might be able to change the property if you are using the dialog as a root user.You need to be a non-root user for this. You just need to check the option for " Receive files in Downloads folder over Bluetooth " and it is done.

How a Linux System boots. What happens when you push the power On button...

Booting is a process when a computer system initializes itself and loads the operating system(OS). So what happens during a boot process on a Linux machine ( this post is relevant to Ubuntu, however most systems would do similar steps ) ? When you push the power on button, the BIOS (Basic Input/Output System) loads from the ROM present on the motherboard BIOS It launches the Power On Self test (POST) which involves starting the hardware specifically the screen and the keyboard and testing of the RAM i.e. main memory   Boot Loader Once the POST completes, the boot loader takes over. The boot loader is present on the hard disk and for Linux systems the common ones are GRUB and ISOLINUX . Depending on the type of system i.e BIOS/MBR or EFI /UEFI the location of the boot loader varies. For the former it is present at the boot sector and for the latter it is in EFI partition Common boot loaders for Linux are GRUB and ISOLINUX.The boot loader is  responsible for l...

How to restore sources.list file on Ubuntu

I recently messed up with my Ubuntu 12.04 /etc/apt/sources.list file. In order to restore it you need to run software-properties-gtk This will cause a window to appear, I have chosen only Canonical-supported free and open-source software(main), you can choose other options you want. This adds the following line to my blank/previously in-existent /etc/apt/sources.list deb http://archive.ubuntu.com/ubuntu precise main Now, run apt-get update and other apt-get commands as usual.

Debugging PHP Extension Developed in C/C++ using GDB

Launch PHP with GDB  gdb /etc/bin/php GNU gdb (GDB) 7.4.1-debian Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.  Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /etc/bin/php...done. (gdb) Use gdb as if you are using php interactive console (gdb) run -r 'print phpinfo();'