Category Archives: Howto

Adding custom items to the panel – unity-2d

That was tricky!
There is no way to drag&drop push/pull/faceroll favorite app to launcher in unity-2d if you started it from terminal (or by other hacky way) except:
Read carefully the http://standards.freedesktop.org/desktop-entry-spec/latest/, or search for an existing .desktop files and modify that (#win):

akoskm@turing:~$ dpkg-query -S nautilus-home.desktop
nautilus: /usr/share/applications/nautilus-home.desktop

Now you know the location, let’s go and delete unnecessary things and modify patches according to your application:

gksu gedit /usr/share/applications/nautilus-home.desktop &

then File > Save As with the name of your application (I did this for eclipse so it will be eclipse-indigo.desktop).
Finally here is how my eclipse-indigo.desktop launcher looks like:

[Desktop Entry]
Version=1.0
Name=Eclipse Indigo
GenericName=IDE
Exec=/home/akoskm/Applications/eclipse-indigo/eclipse %U
Terminal=false
Icon=/home/akoskm/Applications/eclipse-indigo/icon.xpm
Type=Application
Categories=Programming;IDE;

Finally you should add it to the launcher. Start gconf-editor then navigate to /desktop/unity-2d/launcher.
Right-click to favorites key, Edit Key, Add and as New list value type the name of previously created .desktop file. Okay. You can move up/down the entries as you discovered already.
Now restart the panel:

killall unity-2d-launcher
.
You should see a launcher for your app.

Advertisements

Adding items to the panel – unity-2d

Not a big trick but if you were using unity (not the 2D one rather the Compiz version) you should expect that right clicking on an application brings up a menu where you can add your favorite application to the panel.
But this is not the case!
You should start the application, and _while_ it is running do a right-click on its icon in the panel and select “Keep In Launcher”.
Keep in Launcher

Internet Connection Sharing on Ubuntu & Windows with Ad-hoc 2.

A few months ago I made a quick tutorial about Internet Connection Sharing focusing to the case when we are sharing the connection from a machine with Windows installed to the other PC with Linux operating system. In this guide I’ll show you the contrary case, how to share your incoming connection with Linux.

First of all, make sure that you have installed the appropriate drivers for your network interfaces.

Let’s get started with my configuration: I have 2 laptops, one with Ubuntu 10.04 (Laptop 1) and the other with Windows XP (Laptop 2) installed. Both have 2 networking interfaces, Wireless and Ethernet – in the rest of the text just wlan and eth.

We need to share the incoming Internet connection from Ubuntu machine. This laptop is connecting with its network card to the modem with automatic IP address (through DHCP).
I’ll connect my laptops through Wireless. Here is the configuration for the first wireless card (wlan0) on the laptop which is directly connected to the modem:
Create a new Wireless connection, name it and set the mode to Ad-hoc.


Under the tab IPv4 Settings set the following parameters:

IP.: 192.168.88.1
Subnet.: 255.255.255.0
Gateway: Leave empty or set to the IP of your Ethernet card on this machine.

Type the following command in root terminal, do not use sudo:
First, configure the laptop for NAT-ing with the following command:
# iptables -t nat -A POSTROUTING -o ethN -j MASQUERADE # (1)
in my case N is 0, replace N with the number of the card which is directly connected to your modem.
Set IP Forwarding:
# echo 1 > /proc/sys/net/ipv4/ip_forward
Install dnsmasq using apt-get:
# apt-get install dnsmasq
and restart it:
# /etc/init.d/dnsmasq restart
Add the following line to /etc/sysctl.conf:
"net.ipv4.ip_forward = 1"
Reboot and repeat (1).

Before continuing with the next laptop make sure that you have working Internet connection on Laptop 1.

First you need to create an Ad-hoc network on your Windows machine too:


Because we are doing our sharing without any security, switch to Open network under Properties > Associations.


Set the following configuration for the Laptop 2 with Windows installed:

IP: 192.168.88.88
Subnet: 255.255.255.0
DNS: 192.168.88.1 (must be the IP of the wireless card on Laptop 1).


Comments are welcome, happy surfing! 🙂

Getting started with KDE development on openSUSE

Hi!

In this guide I’ll share my experiences and show you how to get started with KDE development. This article is based on the opensuse-wiki article on my personal solutions and on the helpful suggestions from the guys on #kde-devel channel.

If you are looking for something more official take a look to KDE TechBase.

Requirements:

    1) Space required for source files, executables, etc. is ~6.5GB (yes, pretty huge because building with full debugging symbols).
    2) Build dependencies: Here is the list for several distributions.
    3) an svn client

The openSUSE KDE team also provides two scripts kde4-run-env, kde4-build-env to set up the environment variables for the build dependencies (2).

  • Set up the environment

Some guides are suggesting the use of different startup scripts also. However I’ve created a new user for KDE development to protect my stable KDE configurations from my mistakes:

useradd -m -G users,audio,video -s /bin/bash kde-devel

you can do it without the -G option – like I did – If you want to create a user with default groups. And finally set a password for this user:

passwd kde-devel

Now you can continue your work on different ways, I did the following: my graphical session is running on tty6 and i started a new terminal session on tty1. To switch between terminal sessions use the <Ctrl>+<Alt>+<Fn>, n = 1,…,12 key combinations. This isn’t the best solution from the view of debugging because you can’t use clipboard between your terminal and graphical session and if something goes wrong and you need to copy+paste an output to the IRC channel/forums then this operation takes extra time.

So, Instead of switching to a new terminal session open your terminal emulator in your graphical session – Konsole – and log in with the kde-devel user and jump to the home directory:

su kde-devel
cd ~

Copy the scripts kde4-run-env, kde4-build-env into kde-devel‘s home directory. and add the following line to the~/.profile:

. ~/kde4-build-env

Now execute the script kde4-build-env with

. kde4-build-env

– actually re-logging with kde-devel have the same effect.

  • Download the sources

We’ll store everything what is related to KDE sources/build in the directory kde. Under kde create a subdirectory for the sources, and finally jump into the sources directory:

mkdir ~/kde/sources
cd ~/kde/sources

Now get the directory structure of KDE svn trunk:

svn checkout -N svn://anonsvn.kde.org/home/kde/trunk

with the -N option you are getting only the root directories without its contents. This will be useful later, after every checkout take a look to the current directory structure – just to see what are you doing.
So, you’ve checked out the trunk directory, go there

cd trunk

and check out the remaining directories.

svn up -N KDE
cd KDE

KDE is the last directory on the svn before the three module directories: kdebase kdelibs kdepimlibs – containing: base runtime elements, Personal Information Management modules and the basic libraries. Check out the sources for every module with:

svn up kdelibs kdepimlibs kdebase.
*This may take some time depending on your network connection speed.

  • Build the sources

We have all the sources just need to build them. The command cs is provided by the script kde4-build-env – if you’ve added the script properly to the .profile. First we need to build the kdelibs directory. Change the source patch to kdelibs with:

cs KDE/kdelibs

and start to build kdeblis:

cmakekde
*This may take some time depending on several factors, like systems load, CPU speed, etc.

Repeat this for the remaining modules:

cs KDE/kdepimlibs
cmakekde
cs KDE/kdebase
cmakekde

Remember, you can pause the building/compiling with <Ctrl>+<Z>:
[1]+ Stopped cmakekde
and resume with:
fg 1.

  • Run KDE 4

You can start from the terminal or with KDM. I started from a terminal session the KDM way is seems to be more complicated to implement.
Create a script runKDE:


#!/bin/bash
echo Setting up the KDE runtime environment.
. kde4-run-env
echo Starting the DBus session.
eval `dbus-launch --auto-syntax`
echo Starting the X server.
export DISPLAY=:1
X -novtswitch $DISPLAY &
echo Starting KDE 4 on tty8
sleep 2
startkde

and copy into /home/kde-devel/. Log out with kde-devel in your Konsole session. Switching between terminal sessions explained under “Set up the environment”. Now switch to tty1 and login as kde-devel and run the script runKDE:


./runKDE

if the script doesn’t switch automatically to tty8 – where your KDE is starting – then switch manually. The first start takes more time because KDE is build the configuration from scratch.

  • SVN Changes

For updating the sources just do:

cs KDE
svn up kdelibs kdepimlibs kdebase

and repeat the steps under “Build the sources”.

It’s possbile that while trying to “svn up” your sources svn returns with an error like:
No such revision X. This happens because the synchronization between the mirrors providing the sources for the anonymous svn. Wait a few minutes and try again.

All comments and corrections are appreciated.

Happy hacking!

KDE 4 trunk

Plasmoids

KDE 4 turnk

Desktop

Internet Connection Sharing on Ubuntu & Windows with Ad-hoc

Hi!

First I was very excited when my brother asked for my help to choose him a laptop. My other task was to share our internet connection between a Desktop PC and two laptops without using switch or router. Of course the story became more interesting due to the different operating systems. I’ll try to show how to set up your home network in such situations.

Important to make sure that you have installed drivers for networking interfaces!

About the connection: cable-net,  the modem is connected to the Desktop-PC with USB.

Configuring the wired interfaces:

Desktop-PC has two networking interfaces, the first (in the following text: eth0) has automatic network  address through the modem (DHCP). We need to allow to the other computers in our network (in this case just one laptop) to connect to the internet through this connection [1].

The another network interface of Desktop-PC is eth1 – it has static address, set to 192.168.0.1 with subnet mask 255.255.255.0 . We need to connect this network card (eth1) to one of our laptops directly. I connected it first to the laptop with Windows XP, of course you can connect it to the laptop with Linux but the Internet Connection Sharing and the IP configuration becomes more complicated in that case. When connecting our Desktop-PC and laptop directly we must to use crossover (crosslink) cable! So, we connected our Desktop-PC’s card (eth1) with our Laptop’s ethernet card (in the following text: eth2). The address configuration for this card need to be also automatic – eth1 will deal for eth2 an address, subnet mask and gateway too.

Configuring the wireless interface on Windows:

At this point you have working internet connection on both Desktop-PC and laptop (with the interface eth2). We’ll share this connection with the second laptop through an ad-hoc network. First of all you need to configure the eth2 card to allow the other computers in the network to connect to the internet through this connection ( see [1]).

Create an Ad-hoc wireless network with your integrated wireless card (wlan0 in the following)  on the laptop with Windows XP (no encryption used in this example to simplify the setup).

After creating an Ad-hoc network,  set static address for wlan0, IP: 192.168.88.1, subnet: 255.255.255.0. You have configured your Windows machines, move to the laptop with Linux.

Configuring the wireless interface on Linux:

In this example I’m using Ubuntu 9.10 Karmic Koala, but you will find the same expressions on other Linux distributions and in different Network Configuration Interfaces. Create a new wireless connection and set the connection type to Ad-hoc.

The most important part is the IP configuration. On your Linux laptop for the wireless interface (wlan1) set static addresses for IP: 192.168.88.88 (actually the end of this address can be anything – in the allowed range – the only important thing is that it must be different from the last part of your static address of the interface wlan0), subnet 255.255.255.0, for Gateway and DNS set the IP address of the interface wlan0.

Apply the changes and connect to this Ad-hoc network on your Windows and Linux laptops.

If you have any question, please comment.

Find executables for missing start menu applications

You will find the most programs in your Start menu. They have search function. Type there the programs name, that’s all. But, sometimes it happens that the installer doesn’t create start menu entry.
Our freshly installed package called tightvnc. So, if the program isn’t there, then you need to find the executable for it. In windows, you go to the place where the program was installed, and double click to the executable. In Linux: you need to open the Terminal, Konsole, whatever – the Command line.
Like in windows you can search for all installed programs in Add Remove programs. Here is the alternative – a bit faster. Type in Command line (CLI) the following:

rpm -qa | grep tightvnc

the output will be all installed packages containing the name tightvnc. Copy the FULL name (including number) of the tightvnc package, this is what you need. Now type this:

rpm -q --fileprovide [pasteherethefullname]

This will output the complete list of files installed from this package. The executables are mostly in the /usr/bin/ directory.
My output:

akoskm@linux-3fx0:~> rpm -q --fileprovide tightvnc-1.3.9-80.41
/etc/slp.reg.d
/etc/slp.reg.d/vnc.reg
/etc/sysconfig/SuSEfirewall2.d/services/vnc-httpd
/etc/sysconfig/SuSEfirewall2.d/services/vnc-server
/etc/xinetd.d/vnc
/usr/bin/vnc_inetd_httpd
/usr/bin/vncconnect
/usr/bin/vncpasswd
/usr/bin/vncpasswd.arg
/usr/bin/vncserver
/usr/bin/vncviewer
...

Now you can simple start any of these executables in the /usr/bin/ directory by typing them to the command line.

Creating and mounting ISO images in Linux terminal

There are thousand of applications outside for creating ISO images, and also a thousand for mounting and reading these virtual disks – but, have you ever thought that it’s possible through the Linux terminal, by using 2 simple commands? You’ll need 2 core applications: dd (DiskDump) and mount. These small applications are core components in every Linux distribution, so you don’t need to install anything. So, how to create ISO image with them?
Insert a disk into your optical drive – of course it’s also possible to create ISO image from an USB disk. Open the terminal window, and execute:

dd if=/dev/sr0 of=test.iso

where if points to your optical drive (input file), of is the patch, where the ISO image will be created (output file).
Now, our ISO image is done, lets go mount it! The first thing what we need is a mount point for our ISO image. Lets create one:

mkdir isoTmp

this will be the name of the directory where the ISO image will be mounted. Now mount the ISO with the command (only root can mount so you need superuser rights – and his password :)):

sudo mount -o loop test.iso isoTmp/

where the -o specifies that our device is a loop device, after that comes the patch for the .iso file, and finally the directory where we mount this ISO image. After executing this command the image will be mouted, and you can browse it on the local filesystem.
You can unmount it by executing:

sudo umount tmpMnt/

.

For more information about filesystems, and other specific options type:

man mount

in terminal.
Happy hacking! 🙂