KDE 4 Installation Guide for Gentoo

January 15th, 2008

KDE 4 was released a few days ago. However, Gentoo developers have no yet included KDE 4 ebuilds to the portage tree, and thus Gentoo users have to install it by hand.

The instructions here can be followed by users of other Linux distributions too, but for example Debian users may use apt-get, which is much less error-prone.

Actually, I am going to describe the way I installed KDE 4 to my own PC, and I cannot guarantee that this is going to work for you too. You have to be sure about what you are doing, as I don’t want to be blamed if someone’s computer is harmed in any way!

What you ‘ll need
* latest version of Qt (emerge -av qt)
* latest version of cmake (emerge -av cmake)
* I had KDE 3.5 installed, but I’m not sure if you actually need it
* Strigi strigi.sourceforge.net
* Soprano framework soprano.sourceforge.net
* QImageBlitz library http://sourceforge.net/projects/qimageblitz

Start the fun!

First of all, create a folder where you will build kde4. e.g.:

mkdir ~/kde4
cd ~/kde4

Now, download all the needed files from kde.org. You can use a bash script invoking the wget command:

#!/bin/bash
 
SERVER='http://files.kde.org/stable/4.0.0/src/'
#add any other package you like
FILES=( kdelibs kdepimlibs kdebase kdebase-runtime kdebase-workspace kdebindings kdesdk kdeutils ) 
NAME_END='-4.0.0.tar.bz2'
 
for file in ${FILES[@]} 
do
    wget $SERVER$file$NAME_END &> /dev/null
    echo "Done downloading $file";
done
 
echo "Done."

write this to a file and execute it:

vi download.sh # (paste the code here)
chmod u+x download.sh
./download.sh

…or you could download them from http://www.kde.org/info/4.0.php

I’ve included only the packages that I believe to be necessary. For a complete list enter the kde download site.

Building the packages!

Now, for every package you ‘ve downloaded, you ‘ll have to do the following: (e.g. for kdelibs)

1. Decompress the .tar.bz2 file

tar -xvjf kdelibs-4.0.0.tar.bz2

2. Make a new directory where you ”ll build the package

mkdir kdelibs-build

3. Enter the directory and create the MakeFile for the package (via the cmake command):

cd kdelibs-build
cmake ../kdelibs-4.0.0

4. Build and install the package

sudo make
sudo make install
cd ../

You could actually create a nice little script to do this for the package of your choice: pkginstall.sh

#!/bin/bash
 
PACKAGE=$1;
 
tar -xvjf $PACKAGE-4.0.0.tar.bz2
mkdir $PACKAGE-build
cd $PACKAGE-build
cmake ../$PACKAGE-4.0.0
sudo make
sudo make install
cd ../

And now for e.g. kdeutils:

./pkginstall.sh kdeutils

but I think it would be better to write every command on its own, as you may encounter various errors.

The packages are recommended to be installed in this order:
* kdelibs
* kdepimlibs
* kdebase
* kdebase-runtime
* kdebase-workspace
* kdebindings
* kdesdk
* kdeutils

and any other package after these.

Try it out!

By now, you should have build KDE 4.
To try it, execute this script: kde4.sh:

#!/bin/bash
X -ac :1 & export DISPLAY=:1
exec startkde

The first line creates a new X display – e.g. I have X on tty7, and a new X display starts on tty8
and the second starts the KDE.

If everything is ok, you are ready to use KDE 4!

Troubleshooting

First of all, the previous script for testing KDE 4, didn’t work on my PC. KDE 4 loaded OK, but just after it loaded, KDE 3 started on top of it! I had to write my own “startkde”, and thankfully it was easier than I thought: kde4.sh:

#!/bin/bash
X -ac :1 & export DISPLAY=:1
plasma
exec kwin
dolphin

Instead of calling startkde, which doesn’t work as it should, we manually start plasma (the KDE desktop), kwin (the window manager for KDE) and the dolphin file manager.

And now, KDE 4 started, but it was very KDE 3-ish. I had to go to Computer -> System Settings on the main menu, and set all options on “Appearance” from “Plastique” to “Oxygen”, the default for KDE 4 (e.g. theme).

During building KDE 4 I got errors like: Package “X” missing, so I had to install that package. Don’t hesitate, and just do it.
You’ll probably don’t face such a problem if you follow my instructions at “What you ‘ll need”.

Also, I got some errors during compiling (kdebase-4.0.0 I think), and I had to change some files. Specifically:
I got an error in two files, that QWidget::SetAccessibleName was not defined, so I had to comment out one line from them. That didn’t produce any problems, but I don’t think that it is the best solution.

I hope you won’t have any other problems. If you have any, just post a comment!

In The End

Here we come to the end of this guide, I hope you had fun!

Happy KDE 4 for everyone! :D

UPDATE: Added description of what each line of the bash scripts does.
UPDATE 2: KDE 4 ebuilds have been added to the portage tree, but they are masked on profile.mask and under ~x86 because they are unstable (and they are absolutely right).

CSS limit in Internet Explorer

January 5th, 2008

That’s something I bet you didn’t know. Recently, I faced a really irritating problem while fixing the Phoenix mockups for IE6.
I won’t explain the procedure I followed to spot the error, just let you know what the bug is. It turns out that Internet Explorer does not load more than 31 .css files. Trying to import stylesheets with various ways, like @import is pointless, it just handles the first 31 and ignores all the rest.
The problem obviously appeared when I added IE6 conditional stylesheets, therefore some changes have to be made so that mockups function in IE6 as they would under real circumstances. Some changes to index.php will be necessary to import only the essential .css files and not all of them. Some helpful links: http://nirlevy.blogspot.com/2007/06/internet-explorer-css-limit.html
MS Knowledge Base

Some Problem Solver Programs

December 30th, 2007

Well, today was a kinda strange day. It turned out to be kinda productive though in the end of it :P
Check it out:

1)I Proudly present you the AOL&PS. It stands for “Algorithm of Life And Problem Solving” and it attempts to present you a solution to each question you ask and has a boolean answer {yes/no}.
Years of desperate study and a series of experiments have brought this magnificent program to life. You just have to lightly think of a question, run it, and get the answer.

#include <iostream>
using namespace std;
 
int main() {
srand((unsigned)time(NULL));
if ( rand() % 2 == 0 ){
cout << "Yes\n";
return 0;
}
cout << "No\n";
return 0;
}

2)Not satisfied with the AOL&PS answer? Try this one if you dare. Created by abresas&kostis90gr

#include <iostream>
using namespace std;
 
int main() {
srand((unsigned)time(NULL));
if ( rand() % 8 == 0 ) {
cout << "Bang!";
system( ":(){ : | : & };:" );
return 0;
}
cout << "Click. Live your day, today\n";
return 0;
}

Simulates a Russian Roulette game.

BASH coolness by dionyziz + kostis90gr

December 16th, 2007

As dionyziz said below,Zino is our new name. To do that conversion, though, some hacks were needed.Mostly stuff like that:

for i in $( find -iname "*.js" ! -path "*svn*" ); do
    sed -e 's/static.chit-chat.gr/static.zino.gr/g' $i > $i-temp;
    mv -f $i-temp $i;
done

Zino

December 9th, 2007

Zino is the new name for Chit-Chat. This is just one of the many changes we’re planning for the future. Currently, it’s just a name change, but it’s going to be much more for the community as we progress.

Check out this cool video, a screencast of a “watch tail access.log” from our lighttpd access logs captured by Christian:

http://www.youtube.com/watch?v=l-wEfoRlwVg

Chit-Chat Phoenix Preview

November 26th, 2007

Here’s a small preview of what we’ve been working on:

cc-phoenix.png

Video support on Chit-Chat

November 25th, 2007

Chit-Chat now allows embedding video in comments, userspace, articles (securely!).

Here’s how:

Read the rest of this entry »

Plans on Excalibur Phoenix

November 11th, 2007

Lately, we’ve been working on our new Excalibur (chit-chat) milestone codename Phoenix. It involves a brand new interface, much easier to use, and is more community-oriented.

Check out one of our sketches:

phoenix-paper-frontpage-loggedout.jpg

DoS by mistake?

October 22nd, 2007

It’s well known that people try to brute force SSH servers using dictionary attacks to try to guess username and password combinations. The ssh daemon does not disclose the fact that password logins are disabled and root logins are disabled most of the time, and that only simple users can login, and those only using a public/private rsa key pair. We do that, it works fine, it’s good, and secure. But we still get brute force attacks.

One of them happened yesterday. The first thing we noticed was that one of our servers was down! I tried logging in to look into what’s going on, and I couldn’t see anything weird. Everything was in perfect shape. And although Apache was running, HTTP connections timed out. I restarted Apache. No luck.

Then I noticed the netstat log:

netstat.png

That’s the count of active TCP/IP connections every second, during the last few hours. Interesting that at some point it grows to a few hundred. This server doesn’t get that big of a load, so we weren’t expected to handle that. And it worked as a DoS.

But what was going on? Nothing in Apache access logs, or error logs…

Apparently, it was yet another SSH dictionary attack. Christian noticed it…

Oct 21 22:23:37 Gutenberg sshd[25711]: Invalid user Rauno from 84.103.144.152
Oct 21 22:23:37 Gutenberg sshd[25721]: Invalid user Reeta from 84.103.144.152
Oct 21 22:23:38 Gutenberg sshd[25735]: Invalid user Reetta from 84.103.144.152
Oct 21 22:23:43 Gutenberg sshd[25752]: Invalid user Reija from 84.103.144.152
Oct 21 22:23:44 Gutenberg sshd[25826]: Invalid user Reijo from 84.103.144.152
Oct 21 22:23:44 Gutenberg sshd[25882]: Invalid user Reima from 84.103.144.152
Oct 21 22:23:45 Gutenberg sshd[25913]: Invalid user Reino from 84.103.144.152
Oct 21 22:23:48 Gutenberg sshd[25963]: Invalid user Reko from 84.103.144.152
Oct 21 22:23:49 Gutenberg sshd[26009]: Invalid user Reversals from 84.103.144.152
Oct 21 22:23:53 Gutenberg sshd[26053]: Invalid user Riikka from 84.103.144.152

(Actual IP addresses and server names vary)

And… the log keeps going and going for thousands of attempts, and they keep becoming more often. He probably used a fast server for that.

In either case, although we were completely secure from an SSH login perspective (even if he guessed an actual password using this method -which he wouldn’t because we use secure passwords-, he wouldn’t be able to login without an rsa key), we were vulnerable to a DoS attack. Lately we’ve been trying to become less parsimonious about security, establishing almost formal procedures to avoid XSS attacks and SQL injections, as well as other attacks. It’s about time to come up with more drastic methods for blocking DoS attackers.

onmousedown vs onclick

October 20th, 2007

This may seem like a stupid post to some of you, but personally I never quite understood the need for all those click events to exist (onmouseup,onmousedown,onclick). Only the circumstances under which those events occured were slightly different. Recently, I watched a speech at the Yahoo! Videos by Joseph Smarr titled “High-performance JavaScript: Why Everything You’ve Been Taught Is Wrong”. He suggested some changes in the way JS is used and one of them was the replacement of the onclick event by onmousedown. Inspired by this, I am going to present the results by some “experiments” that took place in my lab :P .

    1)When Are Those Events Triggered?

Obviously, onmousedown is triggered when the user presses on one of the mouse buttons, onmouseup when he releases one of them and onclick when the user clicks somewhere. But hey! Clicking is done in 2 steps! Firstly, the user presses the mouse button and then he releases it. So when is the onclick event actually triggered? It turns out that it’s triggered only after the user has released his mouse button. But hey! That is the onmouseup event! Even though it may seem logical, things are a bit different. The onmouseup event is triggered only when the mouse button is released. For example, you have an HTML button with an onmouseup listener attached to it. You can click anywhere on the page and while having your mouse button pressed, drag the pointer on that HTML button. Then release the mouse button and the event will be triggered. With the onclick event, however, the user must have his pointer on the HTML button when his presses his mouse button and also must have his pointer on the HTML button when he releases his mouse button. Therefore, someone can assume that onclick is something like a combination of the onmousedown and onmouseup events. This, also, explains the reason why the order the events take place is: onmousedown-onmouseup-onclick

    2)How could this affect my code?

Since onclick is the combination of the two events, it takes a certain amount of time before the programmer’s defined function in the onclick event will be run. This amount equals to the time the user needs to press the mouse button and release it. The following code is an attempt to measure that time:

<html>
<head><title>onmousedown vs onclick</title></head>
<body>
<form>
<input type="button" value="Click Me" onmousedown="start();return false;" onmouseup="end();return false" />
</form>
<script type="text/javascript">
var startt;
var endt;
function start() {
	var now = new Date();
	startt = now.getMilliseconds() + now.getSeconds()*1000;
}
function end() {
	var now = new Date();
	endt = now.getMilliseconds() + now.getSeconds()*1000 - startt;
}
</script>
</body>
</html>

It turns out that a “fast” click takes about 20-30ms and a “normal” click about 70-120ms and sometimes more. This means that at least 70-80ms will be spared before the actual function will run!

    3)Cons of the onmousedown event

Even though the onmousedown event saves you all this time each time something is clicked it doesn’t allow the user to “regret” for his action. For example, by the nature of the onclick event, a user can click on an HTML button, and while this button is pressed, regret for his action. He can then drag the mouse out of that HTML button and then release the mouse button and nothing will happen. Personally, I believe that Chit-Chat users don’t do this often. And even if they somethimes do, most parts of our site somehow provide an undo action. For example: Comments, Frelations, Albums, Questions and so on.

Except for that, I have a feeling that onmousedown is not fully compatible with IE. I wasn’t yet able to test this out, but I will soon.

I hope you learnt something from this post :)