Finally!! I have completely downloaded Fedora 13

I am happy today because I have been able to completely download and install Fedora 13 DVD. I started the download through Free Download Manager on 28 May 2010 and it finished 18 August 2010.

Some may be wondering why this so late. Well I live in Swaziland where I have to go to an internet cafe in town whenever I want to download stuff. It takes about 30 minutes to get to town from home by public transport. Since I have a job I usually go there once a week. The internet access through my mobile phone helps in reading and downloading small files.

The Free Download Manager app is kept in my memory stick (4GB) and stores my downloads there too. So when I got to the cafe I would resume the download. The download speed of late was slow which added to the long delay.

I hope you can understand how some of us here get their Linux fix. The lack of internet at home means that we end with reading reviews only and not experimenting. Sometimes some Windows based magazines would help in that I would find a distro ISO file on the cover DVD. Unfortunately, those do not suit me as they do not have a lot of applications I use daily as they fit into one CD.

Small review

So far I am happy with the Fedora 13. The laptop brightness buttons work unlike in Fedora 11. I was able to configure the touchpad to my liking after some Google searching. The KDE System Settings touchpad section was able to enable tapping, but, it could not setup vertical circular scrolling the way I wanted. I trigger scrolling using the right edge, but selecting Right Edge trigger did not work. I had to modify a text file to do that.

I am glad that the installed KDE SC is working smoothly. I was not sure that it would work as I had experienced a performance lag in KDE SC 4.4.0 that I had compiled myself. I think that would be the graphics driver fault. I won’t say anything about GNOME as I’m not used to it, except that this time I was able to enable desktop effects in GNOME.

Missing Applications

There are some applications I use and like that do not come with the F13 DVD. It was like that in F11 and I had to download the source packages and compile them, which means I have to do the same again. But I’m tired of compiling from scratch. Now there is an idea that I have conceived today for guys like us.

I am thinking of 2 applications that will work in hand to help in downloading rpms when I am in an internet cafe. One will need to be run in Linux and it will have to check the installed applications database and output a file that will help in resolving dependencies to a memory stick. The other app will be run at the internet cafe and should be sort of a download manager. When downloading the rpms it will resolve dependencies by using the file generated at home and downloading other needed packages.

The program to run at the internet cafe might need to be a Windows app as in Swaziland the internet cafes run Windows XP.

Categories: Uncategorized Tags: , , ,

Capturing a screenshot showing mouse cursor in KDE

In this post I will describe how you can add code to capture a screenshot in KDE with the mouse cursor also shown in the image. This is being used in a video screen capture program I am currently writing using KDE, Qt and ffmpeg libraries. There is a function in Qt to capture a screenshot of the desktop, but it does not capture the cursor.

Luckily, X11 provides a way to get the current cursor image. Once you have it you then have to draw it on top of the screenshot. Roughly, these are the steps

  1. get screenshot (it has no cursor)
  2. get current cursor position
  3. get image of current cursor
  4. paint the cursor onto screenshot at the correct position

So lets see how to do it…

Includes


#include <QApplication>
#include <QPainter>

#include <X11/Xlib.h>
#include <X11/extensions/Xfixes.h>

You need the XFixes extension headers.

Step 1 – Take the screenshot

int x = 0; // (x, y) offsets on the screen
int y = 0;
int width = -1; //everything to the right
int height = -1; //everything to the bottom
QDesktopWidget *desktop = QApplication::desktop();

QPixmap pic = QPixmap::grabWindow( desktop->winId(), x, y, width, height);
//convert it to a QImage in order to paint in a separate thread, otherwise
//there is no need
QImage screenshot = pic.toImage();

Step 2 – Cursor position

Since we will get the cursor image separately we need to know where to paint it on the screenshot.

QPoint mousePos = QCursor::pos();

You might need to offset the coordinates if you are grabbing part of the screen. Like this
mousePos -= QPoint(x, y);

so that the position is translated to right position on the image.

Step 3 – Cursor image

XFixesCursorImage *xfcursorImage = XFixesGetCursorImage( QX11Info::display() );
QImage mouseCursor( (uchar*)
xfcursorImage->pixels, xfcursorImage->width,xfcursorImage->height, QImage::Format_ARGB32_Premultiplied );
mousePos -= QPoint(
xfcursorImage->xhot, xfcursorImage->yhot);

We get the cursor image and then convert it into a QImage. The position is offset for cursors whose hot spot is not at top left corner of cursor image (suggested by Christoph).

Step 4 – Paint cursor onto screenshot

Now we just have to paint the cursor onto our screenshot from step 1. [The cursor should only be drawn if it lies in image region on the screen.]

QPainter p(screenshot);
p.drawImage(mousePos, mouseCursor);

Done. Now you can do anything you want with the screenshot, as for me I feed it to libavcodec to produce a video file.

Fancy mouse cursors

The code works very well with the normal cursors I have in KDE 4.2. I have not tested it in KDE 4.4. Unfortunately, I noticed that some other cursors, the fancy ones, are not drawn at the correct position. In one video file I recorded a window resize and the resize cursor was outside the window border.

Categories: KDE, Programming Tags: , , ,

Konvertible: Audio file converter

I have been doing some programming lately. For the first time I have a program written by me  that I use it now and then. In the past I would write programs for learning purposes and would not use them after that. The program is Konvertible and is used for audio file conversion. Like WAV to MP3, etc.

It needs ffmpeg to work. The output formats depend on your installed ffmpeg.

It is said you learn things till you die. I learnt a lot as I worked on Konvertible, but what stands out is the bit rate of audio files. As I was testing the program I found out that you get small sized files if you use a lower bit rate at the expense of audio quality.

This being my first contribution to Linux community introduced me to dealing with problems of my own code not working in others.( I thought that since Konvertible compiled and worked  on my computer, it would on others. ) I thought they would crucify me with their comments, but they did not.  I am now encouraged more than before to contribute.

Categories: KDE, Konvertible, Programming

Education Assessment style

I will be writing my last exam paper on Monday (26 May 2008) for my final year B.Sc degree. I was majoring in Computer Science and Physics. Before and during the exam I had time to recap on my education experience from primary school up to now. I found out that the education system in my country is not that much interested in intelligence, but in memorizing.

Well, its not all subjects, but a majority of them require one to be able to read, understandand cram all the notes to one’s head. Why? 

Basis
The above conclusion is based on observation of the questions asked in tests and exams. Some of them can be passed without any understanding of what is being asked. Some questions go like: “State the disadvantages of overpopulation. [8 marks].” In the notes there are also 8 of these, so what has a student go to do? Just vomit the notes as they are.

My solution
Teachers and lecturers should stop testing memory capabilities of students, but understanding. I suggest that they ask questions that need application of notes. If they do want students to recall the notes, let it be not everything. Say if there are 12 problems to something, then just require at most 4. 

 

 

Categories: Education
Follow

Get every new post delivered to your Inbox.