Category Archives: Fedora

[HOWTO] Configure Netbeans 6.9 to debug PHP files using xdebug in Fedora 14

I am using Netbeans 6.9 on Fedora 14 for Web development. I have enabled PHP debugging for making PHP development easier. Here is how you can do it too.

Install and enable xdebug

Use yum to install php-pecl-xdebug:

sudo yum install php-pecl-xdebug

Now, open the file /etc/php.d/xdebug.ini in a text editor as root. I use nano:

sudo nano /etc/php.d/xdebug.ini 

Now , make sure the following options are set enabled in ini:

; Enable xdebug extension module
zend_extension=/usr/lib/php/modules/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

Allow port for xdebug

sudo semanage port -a -t http_port_t -p tcp 9000 

Restart Apache:

sudo service httpd restart

Configure Netbeans to use PHP debugger

Now, open up the file /usr/share/netbeans/6.9/etc/netbeans.conf in a text editor and add the text “-J-Dorg.netbeans.modules.php.dbgp.level=400” in netbeans_default_options so that the line looks somewhat like this:

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Dapple.laf.useScreenMenuBar=true -J-Dsun.java2d.noddraw=true -J-Dorg.netbeans.modules.php.dbgp.level=400"

Restart netbeans and given that you have configured the project directories properly, you should be able to click on the debug button and start debugging PHP file.

[HOWTO] (Python Plasmoids – Part 1) Write Hello World Plasma Applet in Python

I am new to KDE and I have come to like the plasmoids on the Desktop. They can be used to display information (eg. Weather, Time, News) or can be used to carry out some tasks (upload images/text to web, check mail etc) easily.

I don’t have any experience of Plasmoid development. I have decided to learn to write Plasmoids. I have moderate knowledge of Python.. I am learning Plasmoid development in Python and will be posting my experience. Feel free to learn with me or correct me if I am wrong.

I will be using Fedora 14 with KDE 4.5 for all my development and testing. However, other distros with any sub-version of KDE 4 should work fine. I will be citing all the references and where you can learn more.

I will be using Kwrite and KDevelop to develop plasmoids. However, you can pick any editor of choice.

For Hello World plasmoid, create a directory called hello anywhere you want. Also, create the following directory structure inside hello:

hello/
├── contents
│   └── code

The directory structure must be as shown above. or the plasmoid will not work.

Now, we will need a metadata for the plasmoid. This metadata file will contain the name, version, author-name, type of plasmoids and other information about the plasmoid. It should be inside the plasmoid directory (i.e. inside hello in this case). Here is my sample of metadata.desktop.

[Desktop Entry]
Encoding=UTF-8
Name=Hello World
Comment=A Basic Hello World Example
Type=Service
ServiceTypes=Plasma/Applet
X-Plasma-API=python
X-Plasma-MainScript=code/main.py

X-KDE-PluginInfo-Author=_khAttAm_
X-KDE-PluginInfo-Email=khattam@khattam.info
X-KDE-PluginInfo-Name=hello
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=http://www.khattam.info
X-KDE-PluginInfo-License=GPL

Most of the fields are self-explanatory and to learn about the fields and other choices, see here.

As we have specified in X-Plasma-MainScript field in metadata.desktop, we will now create the file hello/contents/code/main.py. Note that you can use any filename for main.py but you will have to change in metadata.desktop accordingly.

The following is the very basic main.py which does absolutely nothing:

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyKDE4.plasma import Plasma
from PyKDE4 import plasmascript
 
class MainApplet(plasmascript.Applet):
    def __init__(self,parent,args=None):
        plasmascript.Applet.__init__(self,parent)
 
def CreateApplet(parent):
    return MainApplet(parent)

If the above plasmoid is run, you will see no output at all, just an empty plasmoid.
To run it, cd to the directory where you created the hello directory and run the following:

plasmoidviewer hello

If everything goes right, you will be able to see something like the following:

If any error occurs, you can see the output in the terminal to see whats wrong and hopefully fix it.

After running the application, lets analyse what we have done here.

Line 1-4 are import statements. If you are familiar with Python, you must be familiar with them. They are basically statements which tells the interpretor where to look for the functions and classes used in the program. Those are the minimum ones you will need for your Python plasmoids to work.

Lines 6-8 define a class derived from plasmascript.Applet. There must be at least one such class for your plasmoid to work. The name of the class may be anything you like. The class’ __init__ function initializes just the same function of base class which is to say it does nothing at all. While developing plasmoids later, you may want to do some stuff even prior to initialization of plasmoid. That stuff goes in this function.

There must be yet another function Createapplet() which must take 1 argument “parent” and pass it as initializer for the object of class derived from plasmascript.Applet and return the object. This function is in lines 10-11.

We have returned the Applet object as it is without modifications. We will now add some stuff to the Applet object before returning. In this tutorial, we will just add a label saying “Hello World”. To add a label however, we need to have a layout. So,we set a layout and then add a label on top of it.
To do that, we will be using init() method which is called after the applet is initialized and added. Here is the new code for main.py:

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyKDE4.plasma import Plasma
from PyKDE4 import plasmascript

class MainApplet(plasmascript.Applet):
    def __init__(self,parent,args=None):
        plasmascript.Applet.__init__(self,parent)
 
    def init(self):
        layout=QGraphicsLinearLayout(Qt.Vertical, self.applet)
        label = Plasma.Label(self.applet)
        label.setText("Hello World")
        layout.addItem(label)
        self.applet.setLayout(layout)
 
def CreateApplet(parent):
    return MainApplet(parent)

The added code is the init() from line 10-15. First, a variable layout is set as QGraphicsLinearLayout(). This takes two arguments, one is the parent and the other is either Qt.Vertical or Qt.Horizontal. This layout orientation parameter decides whether the added items (if there are more than one) are arranged vertically or horizontally.

In line 12, a new Plasma.Label object is created. It takes in parent as the constructor argument. Other plasma widgets are available here. There is no Python specific documents as of now but the C++ documents work fine and it is easy to figure out how to use it in Python.

In line 13, we use a method setText() of Plasma.Label to set the text of the label and in the next line, we add the item to the layout we created earlier. Finally, in line 15 we set the layout we created as the label for the current applet.

When done testing, you may want to install the plasmoid to see how it looks on the desktop. To do that, you must zip it install it using plasmapkg. Change to hello/ directory and run the following to zip it to hello.zip:

zip -r ../hello.zip ./

Now, run the following to install it:

plasmapkg -i hello.zip

Now, you can add the plasmoid to your desktop. To remove it, just run:

plasmapkg -r hello

Here is what we have at the end:

Conclusion

This is a simple tutorial from a newbie to create Plasmoids in Python. However, we did not do any useful work with it. In the next tutorial, I will try to cover my experience creating something useful.

References

http://techbase.kde.org/Development/Tutorials/Plasma/JavaScript/GettingStarted
http://developers-blog.org/blog/default/2009/06/01/Python-Plasmoid-Example
http://techbase.kde.org/Development/Tutorials/Plasma/Python/Using_widgets
http://doc.trolltech.com/4.4/qgraphicsgridlayout.html
http://doc.trolltech.com/4.4/qgraphicslayout.html
http://doc.trolltech.com/4.4/qgraphicslinearlayout.html
http://api.kde.org/4.4-api/kdelibs-apidocs/plasma/html/classPlasma_1_1Applet.html
http://api.kde.org/4.x-api/kdelibs-apidocs/plasma/html/annotated.html

[HOWTO] Install Firefox 4 in Fedora 14

Firefox 4 is currently in beta and not available in the Fedora repository. However, it can be installed by adding Spot repository from FedoraPeople. To install, open up the terminal and run the following from terminal as root (to be root, run su and enter root password):

wget http://repos.fedorapeople.org/repos/spot/firefox4/fedora-firefox4.repo -O /etc/yum.repos.d/firefox4.repo
yum install firefox4

When done, Firefox 4 is ready to use.

[HOWTO] Install VirtualBox 4.0 Final in Fedora

To install VirtualBox 4.0 in Fedora, first make sure you have removed old version of virtualbox and then open the terminal and type in su and enter password to login as root and type the following commands:

wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo --output-document=/etc/repos.d/virtualbox.repo
yum update
yum install VirtualBox-4.0

VirtualBox will be installed and ready to use.

Hope this helps.

[SOLVED] “Process exited with status 0” in kdevelop

I have recently installed KDevelop and was looking for a good editor for programming. I found KDevelop was mentioned in many discussions. So, I decided to give it a try. However, when I ran it, I got the following error:

Process error – KDevelop
Process exited with status 0

However, it did not seem to affect the functionality after closing the dialog, it was quite annoying. I ran it from the terminal and looked for possible error messages, however, I could not find anything.
Later, I noticed that the error had magically stopped showing any more. I had installed a few packages after that and I thought that might have solved the problem. After a few hit and trials (of removing the recently installed packages), I found that removing the “git” package brought the error back again.

So, if you are running into similar problems, just install the package git. However, if you do not intend to use git and refuse to install it, you can also disable the plugin by navigating to Settings>Configure KDevelop>Plugins and removing the check mark next to “Git Support”.

[HOWTO] Install Oxygen-transparent and make your KDE Desktop look awesome in Fedora 14

Oxygen-transparent is a modification of KDE Oxygen-style to add cool transparency. It was supposed to be merged to KDE 4.6, but the idea has been dropped due to issues with the theme. However, it can be installed in KDE 4.5 and 4.6 currently. I am using KDE 4.5 in Fedora 14 and here is how I got it installed.

However, before installing, do note what the developer has to say:
– this will erase your current oxygen installation;
– this will likely be erased by any future update of oxygen by your distribution packages;
– again, this is experimental

Having said that, lets continue.

Installing Build Dependencies
Run the following command as root to install build dependencies. To run as root, type “su” followed by your password and then enter the following.

yum install kdebase-workspace-devel kdelibs-devel subversion libXrender-devel libX11-devel gcc-c++ cmake gcc wget

Getting The Helper Script
To make the installation easy developer HugoPereira has written a script available at KDE-Look.org. Download and save the script to an empty directory and make it executable.

To download the currently available version of the script, you can run the following commands:

mkdir /tmp/oxygen-transparent
cd /tmp/oxygen-transparent
wget http://kde-look.org/CONTENT/content-files/127752-oxygen-setup.pl --output-document=oxygen-setup.pl
chmod +x oxygen-setup.pl

Running The Helper Script
You can run the helper script (as root or any normal user) by typing in the following:

./oxygen-setup

The script will download the latest sources from svn, then runs cmake and compiles the code locally.

If the compilation is successful, you should get a mesage:

— done

type “cd build; make install” (as root, or using sudo) to install.
report problems to “hugo[at-the-rate]oxygen-icons.org”.

Run the following as root and the new theme should be installed:

cd build; make install

That should install the modified oxygen theme.

Log out and log back in to see the changes in effect. Also, after logging back in, you can configure the theme by running oxygen-settings (Alt+F2 and type in oxygen-settings). Open up “System Settings”> “Application Appearance” and press “Configure” to adjust transparency values.

Hope this helps.

[SOLVED] CMake Error: your CXX compiler: “CMAKE_CXX_COMPILER-NOTFOUND” was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.

I am running Fedora KDE Spin. I was trying to compile a program. I tried running cmake but I got the following error:

CMake Error: your CXX compiler: “CMAKE_CXX_COMPILER-NOTFOUND” was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.

I already had gcc and cpp packages installed but I was still getting the above error.

I later figured that the package gcc-c++ was not installed. I installed it via yum and the error was gone:

yum install gcc-c++

Hope this helps.

[HOWTO] Move controls (maximize, minimize, close) to the left in KDE 4

I have used Ubuntu Lucid since its early alpha stages to the final and then continued using it until lately. I am used to having title bar control buttons (i.e. maximize, minimize, close) on the left side of the window. I recently moved to Fedora 14 KDE Edition and was having problems with the control buttons. So, I moved them to the left. Here is how it is done.

Right click on the title bar and select “Configure Window Behaviour”.

Click on “Window Decorations” in the left pane.

Click on “Configure Buttons” and you should see your current title structure. Drag around to get the following configuration.

Hope this helps.

[HOWTO] Enable MP3/AVI/MPEG/FLV and other audio/video formats playable in Fedora 14

I just installed Fedora 14 KDE Spin and like many other Linux distros, it does not play MP3, MPEG and several other formats by default. To enable playback of these proprietary formats, you must install non-free codecs. To get those, I installed the Livna and RPM Fusion repos by clicking the following links and opening each with KPackageKit:
Livna
RPM Fusion Free
RPM Fusion Non-Free

Wait for them to be installed and when done search KPackageKit for SMplayer and VLC. For audio playback, you can install a great KDE Audio Player known as Amarok. You can play almost any format with VLC but you might want to keep another player handy for playback. To enable almost any media support for Amarok and SMplayer, you must install gstreamer-plugins-bad and gstreamer-plugins-ugly and xine-lib-extras-freeworld.

Hope this helps.

[SOLVED] Could not create a python ScriptEngine for the [name-of-plasmoid] widget

I recently installed Fedora 14 KDE Live Spin and am trying to get my hands into plasmoid development. I picked python as a language of choice but was getting the following error while trying to run plasmoids:

The object could not be created for the following reason:
Could not create a python ScriptEngine for the [name-of-plasmoid] widget.

I checked if PyQT4, PyKDE4 and kdebase-workspace-python-applet were installed and they were but I was still getting the errors. I had almost given up but then I realized that I had just upgraded a lot of packages. So, I just rebooted and I was able to add plasmoids without problems.
If you are getting this error, you must check if you can run the plasmoid with plasmoidviewer from the terminal and check for errors in the terminal.
Hope this helps.