Reduce PDF file size in Linux

A GhostScript command can help in reducing your pdf size.

$gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -sOutputFile=output.pdf input.pdf

You can also use the following parameters for -dPDFSETTINGS instead of /screen:

  • /screen – Lowest quality, lowest size
  • /ebook – Moderate quality
  • /printer – Good quality
  • /prepress – Best quality, highest size

I was able to reduce 1.5 MB size to  400KB. 🙂

 

Advertisements
Posted in Uncategorized | Leave a comment

Welcome page is missing in Qt Creator

I am using Qt creator 3.0.1 with Qt 5.2.1 on ubuntu 14.04 32-bit. My
welcome page was empty, no examples, no documentation. I searched for its solution. But some links says it is a bug unsolved, some says solved. However, after 2 days of struggle of finding its solution, I was able to have beautiful warm welcome pages 🙂

To make it’s documentation working:

This link says” Most of the Welcome screen functionality is available using the File->Recent Projects, File->Sessions and File->Session Manager, you miss only access to Demos and Examples and a couple of links”  I tried clicking on Session Manager, its popup as link “what is a session?” , clicking on that link, I got my documentation. Don’t know how, but indeed. Here is the screenshot of pop window with a link:

session.png

To make a warm welcome page with all its functionalities like examples, tutorials, etc:

I searched a lot but found none. I followed link as

$sudo apt-get install qtbase5-examples qtbase5-doc-html
$sudo apt-get install qtdeclarative5-examples qtdeclarative5-doc-html

but it was still not working.

Fortunately, found a link where this solution was given. QtCreator3.0 needs QtQuick version 2 to show its welcome page.

$sudo apt-get install qtdeclarative5-qtquick2-plugin

Now, Welcome page is giving me a full warm welcome  🙂

welcome

 

Posted in Qt | Leave a comment

commands to check Qt version and select one from many

$qtchooser -list-versions            #This will give you list of Qt versions installed on your system

$export QT_SELECT=qt4        # to select qt4, simillarly can  try selecting differernt versions too.

Posted in Qt, Uncategorized | Leave a comment

libboost installation

Currently, I am working on  CAD software and I need boost library for it. I am installing FreeCAD which demands minimum version of 1.33. here is list of dependencies of FreeCAD https://packages.debian.org/source/jessie/freecad My system is giving me

My system is giving me error about libboost that some packages of libboost are not installed though I installed it. Trying various solutions, now I am building it from source. I download libboost-1.6.0

Steps are same as http://www.boost.org/doc/libs/1_48_0/more/getting_started/unix-variants.html#easy-build-and-install

i did,

cd boost_1.60
./bootstrap.sh --prefix=/usr/local/
./b2 install

To check version of libboost installed:

$dpkg -s libboost-dev | grep 'Version'
or 
$cat /usr/include/boost/version.hpp | grep "BOOST_LIB_VERSION"
Posted in Uncategorized | Leave a comment

Fix broken package in Ubuntu

This problem is too common, sometimes we have some partial downloaded packages that stuck in our apt-get package manager and create troubles for us.

To do this try these commands and see if any works for your case:

1) You can delete the lock file with the following command: 
$sudo rm /var/lib/apt/lists/lock
You may also need to delete the lock file in the cache directory
$sudo rm /var/cache/apt/archives/lock

2) $sudo apt-get clean && sudo apt-get update
3) $sudo apt-get update --fix-missing
4) $sudo dpkg --configure -a
5) $sudo apt-get install -f

6) If above command does not work then open /var/lib/dpkg/status file and remove the blocks of packages that were creating trouble for you.

6th point was new for me thats why I wrote this post 😛


Posted in Uncategorized | Leave a comment

Removing all files located

Sometimes, we need to delete all the files searched by locate command. What we do ( i do this before :P) is to go to those files path and delete them manually, one by one, which was a tedious job.

So to do this using command, type:

$locate <search-string> | xargs rm -Rf

What xargs does is take a line from the input, and append it to another command, executing that other command for every line in the input. So by typing locate foobar | xargs rm -f, the output of the locate command will be patched onto the end of the rm -f command, and executed for each line produced by locate foobar.

You can verify the result by executing $locate <search-string>  command again. If you still see those files after terminal, Probably case is your database of locate command is not updated after removing files, so to do this you need to give command to update the database of locate. I had same case and my friend mandeep helped me with this command 🙂

$sudo udpatedb

reference: http://askubuntu.com/a/18393

Posted in Linux, Uncategorized | Tagged , | Leave a comment

Octave 4.0 installation on ubuntu 14.04 from PPA

Octave is one of the free and open source alternative to MATLAB, can be used for numerical computations, image processing, data analysis and in many fields. Ubuntu 14.04 comes with octave version 3.8, Which has some less features needed for image processing. Version 4.0 comes with the more features and therefore I install PPA on my system to get updated version of octave. Install the required dependencies using command:

$sudo apt-get build-dep octave

Now install octave: $ sudo apt-add-repository ppa:octave/stable
$ sudo apt-get update
$ sudo apt-get install octave
$ sudo apt-get install liboctave-dev
liboctave-dev comes with the necessary tools/ development files for the GNU Octave language

Note: during my installation I had some issues of incomplete configurations, which I solve as: https://jasleen7956.wordpress.com/2016/03/05/errors-were-encountered-while-processing-e-sub-process-usrbindpkg-returned-an-error-code-1/
Now octave is installed, to launch it type: $octave

To launch only cli, $octave-cli

To install packages inside octave, open octave and type 

octave >> pkg install -forge <package-name>

Now, the package is installed but you need to load the installed package in octave to use commands of this package

octave >> pkg load <package-name>

You can see the list of packages currently loaded in octave as:

octave >> pkg list

Now you can run octave commands for you work. That’s it 🙂

Posted in Image processing, octave | Leave a comment