Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Saturday, August 18, 2012

Removing Shortcuts From the Gnome Applications Menu Manually

If you installed a program without using the Ubuntu Software Center and there is no uninstaller (or you just deleted the folder), the shortcut to your removed application may still remain in the Application Menu.

If you try to remove it using Alacarte, you may be surprised to see that your shortcut doesn't appear there. If you find it in Alacarte, read this.

This happened to me when I accidentally deleted the Netbeans folder. The shortcut to Netbeans remained in the Gnome Application menu, but it didn't appear in Alacarte.

After searching a while for a solution, I finally found it - shortcuts that do not appear in Alacarte can be found at:
/home/yourUsername/.local/share/applications/

Your shortcuts will look like:
/home/dystopiancode/.local/share/applications/netbeans-7.1.2.desktop

So, if delete them here, they will disappear from the Gnome Application menu.

Sunday, April 15, 2012

Compiling and Linking using gcc in Command Line under Linux

Let us suppose that we have a simple program "hello world" program: place in the source file helloWorld.c.

Compiling the source file
gcc -c helloWorld.c
  • gcc - invokes the compiler
  • -c - the compiler flag that specifies that only compilation will be done (no linking)
  • helloWorld.c - the path to the C source file
After running this command you will observe that new file helloWorld.o has appeared. This file is the object file resulted after the compilation. In order to create an executable you will need to call the gcc again to do the linking.

Creating the executable
gcc -o helloWorld helloworld.o
  • gcc - invokes the compiler
  • -o - places the output in a specified file (in our case helloWorld), which will represent the executable
  • helloWorld - the executable who resulted
  • helloworld.o - the path to the object file
Running the executable
./helloWorld

Now, let's say that you have 2 source files, main.c and interface.c and main.c uses some functions defined in interface.c.

First, we will need to compile the source files in order to obtain the object files:
gcc -c main.c
gcc -c interface.c
By invoking the gcc, you will obtain 2 object files: main.o and interface.o.

In order to create the executable, you will need to invoke gcc again, but this time both object files will need to be specified.
gcc -o main main.o interface.

Now you will have in your folder the newly created executable main.

Let's say now that the source file interface.c contains a call to the double sqrt(double number) function from math.h. In order to obtain the executable, you will have to manually link to the m (mathematical) library:
gcc -o main main.o interface.-lm

If your program, would have been linked to a user library who we shall call myLib.a placed in /usr/lib/myLib.a, the gcc invocation would had looked like:
gcc -o main main.o interface.o /usr/lib/myLib.a

If you would need to compile and link multiple files (for a larger project), the method presented above will prove to be cumbersome and time consuming. A better method is the use of a makefile, but this will be discussed in another article.

Sunday, March 11, 2012

Customizing the Gnome 3 Applications Menu with Alacarte

The Gnome 3 Applications menu can contain launchers to all the applications you installed, but showing all of them can bring a drawback in performance, especially when you search for one in particular or at startup.

The solution is to display only the launchers you need and hide/remove the rest.

Also, some system updates tend to duplicate some of your launchers, so knowing how to remove/hide them can make your life easier.
Gnome 3 Activities Applications Panel
You can easily customize the visible launchers by using the Gnome menu editor Alacarte:
1)Open a terminal console (Ctrl + Alt +t)
2)Type:
alacarte 
This should open the Gnome Menu Editor like in the picture below:
Showing/Hiding Applications
In the middle window you can see two columns: Show and Item. 

If you uncheck the checkbox on the Show column the item will no longer be visible when you will enter the Applications Menu.

You can also delete and add new applications to the Applications menu:
  • To add a new launcher, click on the New Item button to the right. This will trigger a dialog like in the image below.
  • To remove a application, select it in the central window and then click on the Delete button to the right. Remember, once a launcher is deleted there is no turning back, so use this option with caution.
  • To add a new menu (like Accessories, Education, etc), click on the New Menu button to the right.
  • To see what's behind a launcher click the Properties button on the right. The dialog triggered will be similar to the one in the image below.



Sunday, December 4, 2011

Solving Eclipse Update Problem on Linux

If you just installed Eclipse and want to update it (HELP ->CHECK FOR UPDATES), you may encounter the following problem:
This error will happen if you installed Eclipse using package managers like Ubuntu Software Center or the Synaptics Package Manger. This happens because Eclipse will be installed in a secured location where its contents can only be modified with the root's permission.

To solve this problem you need to start Eclipse as root. To do this, you simply must open a terminal and type:
sudo Eclipse
After you inputted the root password (if you don't know it, check with the administrator), this will start Eclipse as root and will allow you to get the much needed updates (by going to HELP->CHECK FOR UPDATES).

Monday, October 31, 2011

Solving Gcc Math.h Linking Problem in Eclipse

If you use Eclipse/gcc and have functions that need the math.h library, you may find out that the linker can't find functions like sqrt or pow and signal it like this:

undefined reference to `pow'    Matrix.c    /TzUtils/Sources    line 152    C/C++ Problem
undefined reference to `pow'    Matrix.c    /TzUtils/Sources    line 204    C/C++ Problem

This thing happens because the library which contains math.h is not linked by default. To link it you will need to add the extra flag -Im.

In Eclipse this can be done by:
  1. Right click on your project in Project Explorer and select Properties.
  2. Go to C\C++ Build -> Settings -> Tool Settings -> Gcc Linker -> Libraries and click on green plus button to add a new library. When the dialog pops up, write m, and Eclipse will automatically add the -Im flag.



Friday, September 23, 2011

Configuring Gamma Correction in Linux using xgamma

You can easily change the gamma correction factor in Linux by using the following command
xgamma -gamma newValue
The newValue signifies the new gamma correction factor. It should be around 0.5 - 1. You can use higher or lower values than 0.5-1, but you may end up with much too bright or much too dark screen (the minimum value which the script accepts is 0.1 and the maximum value is 10 - I wouldn't recommend trying those).

The best way to find the ideal gamma value for your monitor is to query first the xgamma value:
xgamma
After querying the value, increase the factor with 0.1 if you want your screen brighter or decrease it with 0.1 if you want your screen darker. Do it until you get the value you seek.

If you want to a fine tunning you can modify the red, green or blue component:
xgamma -rgamma rVal -ggamma gVal -bgamma bVal
The testing method should remain the same as the one described above. Increasing/Decreasing the values too much can leave with an interesting (as in not so great) view.

Useful links:
xgamma man
Related Posts Plugin for WordPress, Blogger...