Add menu entry in ubuntu

Sometimes, you might want to download a program without installing it system wide. Or, you might not have an installer, but still, you would like to have a shortcut in the application menu.

To achieve that, here is what needed to be done:

  1. Create a desktop entry of the application you want to insert
  2. Copy this entry to ~/.local/share/applications.

The second part is pretty simple. but how to create a desktop entry file? Here:

Desktop entries are actually simple text file that follow some guidelines.

  1. The file postfix is "desktop" (same as txt for text file and so on)
  2. The file contains several key-value pairs, most important are Exec, Terminal and probably Icon.
  3. You don't have to create it from scratch. Here is a desktop entry for robomongo I've created. Note that you need to remove the txt postfix part for it to work. You should change the other parameters as well (Name for example or comment).

If you wish to copy a shortcut that  was installed through a debian package to your desktop, these are usually located in /usr/share/applications.

 

 

Downloads:

  1. robomongo.desktop

Updating systray under ubuntu 13.04

OK. With the new release of Ubuntu, the systray is even less supported.

To make it reasonable again, some steps need to be taken:

add-apt-repository ppa:timekiller/unity-systrayfix

has to be execute to restore some of the lost capability.

Then make sure you have apt-get install dconf-tools This will assist you later on in setting the environment.
Now, execute the regular apt-get dist-upgrade -y to get all the updates and restart unity (you can just log in again).

Setting configuration

start dconf editor (Alt-F2 from unity) and then: navigate to com > canonical > unity > panel and then “systray-whitelist”. Here you can put any values you like to see. I like to see them all, (Skype, true crypt and what have you) so I have just put ‘all’.

Configuring php.ini for upload

Well – sometimes you need to upload files bigger then the default 2M.

In php, you have to tweak the php.ini to get this done. The first parameter is upload_max_filesize. This one is usually 2M, and set the lower limit (at this point). However, changing this will not give you the option for, let say 100M. for that to happen, you’ll need yet another parameter. You see, the upload size is one thing, which is part of another thing – the maximum post size, or in php.ini lingo – post_max_size. This one default to 8M, so if you change the first to anything bigger then 8M, you will still have a limit of 8M.

You should probably set the post maximum to a higher value then the upload limit, php does this for a reason, which is that files can be a part from a bigger form with additional data/ files.

Yet another point to remember: you might want to check the memory limit option, in case your site is under a lot of memory intensive actions.

Enabling the notification panel in unity

The problem? Unity does not show the notification panel. This is a big issue, since some applications reside only there,and without this applet, we can’t call them back after starting them, close them or configure them (yes, we can kill them, but this is something else).

we are going to use the command for this – there is an options for GUI, but it’s simpler.

just under the terminal, using your own username (no need for sudo or root) use this command:

gsettings set com.canonical.Unity.Panel systray-whitelist "['all']"

Now, you might see the “all” part. This does mean that you can select only certain applications to go there, if you want them.

Closing Android socket

Assume we have a Socket that is connected to a server. Usually, we will use a secondary thread to read from the socket in a blocking connection.

If the user want to terminate the connection, in Java, we can call socket.close(). But not in Android (well, we can, but it will do nothing). While the thread is still alive and waiting, close() will not be executed and the connection will remain active. So, what can be done?

One way is to terminate the thread. This is obviously not a very good way, and denied the thread from executing its final code correctly.

The second and the right one, is simply to call Socket.shutdownInput() method. This will create a disconnection for the waiting thread, the thread will die according to plan and your application will run just fine!