Disabling CPU throttling on Slackware Linux 13.1

Posted in Slackware on November 29, 2010 by mprnotes

After some time away from Slackware I decided to start using it again. So, after installing a lot of packages successfully I got my first problem trying to install ATLAS (Automatically Tuned Linear Algebra Software) from Slackbuilds.org. After running the script I got the following error message:

CPU Throttling apparently enabled!
It appears you have cpu throttling enabled, which makes timings
unreliable and an ATLAS install nonsensical. Aborting.

Searching on Google I found the following command to disable CPU throttling:

cpufreq-selector -g performance

But for some reason I got a message saying that the governor (-g parameter) was not valid. Then I figured out that the following comand should be used instead:

cpufreq-set -g performance

I don`t know the reason, but by using this I was able to compile Atlas and then finally Scipy.

Advertisements

Changing background image of LaTeX Beamer

Posted in LaTex on August 14, 2009 by mprnotes

I’ve learned a very nice trick to change the background image of your LaTeX Beamer presentations. First of all I will give an example how to change the background image for all your frames. All you have to do is to put the following code into the preamble of your .tex document:

\usebackgroundtemplate{
\includegraphics[width=\paperwidth,
height=\paperheight]{my_bg_image}
}

Now if you want to change the background only for one specific frame, then you have to create a block and set an image (in this example my_bg_image) as the background of this block and then you can enter the code of your frame, like the following example:

{
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{my_bg_image}}
\begin{frame}
\frametitle{Frame with nice background}
\begin{itemize}
\item 1
\item 2
\item 3
\end{itemize}
\end{frame}
}

That’s all. Now we are able to create some beautiful slides.

Check spelling of TeX documents

Posted in LaTex on April 6, 2009 by mprnotes

A quite useful tool when writing some scientific material for submission is the language spelling check. You can easily install it in Ubuntu with the following command:

sudo apt-get install aspell

and then you run

aspell –encoding=iso-8859-1 -lenĀ  check paper.tex

The input argument -len stands for english. If you want to change to Brazilian portuguese, you can use -lpt_BR, for instance. After you type in this command, an interative prompt will open that will allow you to interactively go through your text and check for misspellings. You can either change it or just ignore it if you prefer.

Using Qt Resource Files

Posted in PyQt, Python, Qt on October 5, 2008 by mprnotes

Sometimes when you write an application you might have some problems with your icons if you put all your images in a directory called “images” inside your application’s directory and then try to call the application from the command line somewhere else outside your application’s directory. The problem is that your icons will not appear, because the directory “images” is relative to your application’s directory.

To avoid this problem one could use the Qt Resource files to produce a .py module and then access all the icons from this module. First, you must create a .qrc file with the details of the resources you want to include. The .qrc file is a simple XML text file like the example below:

<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file alias="appicon.png">images/appicon.png</file>
<file alias="exit.png">images/exit.png</file>
<file alias="fileexport.png">images/fileexport.png</file>
<file alias="fileimport.png">images/fileimport.png</file>
<file alias="fileopen.png">images/fileopen.png</file>
<file alias="help.png">images/help.png</file>
</qresource>
</RCC>

Then you must run pyrcc4 with the following command to produce a resource module from this resource file

pyrcc4 -o resources_rc.py resources.qrc

Finally, you import your resources_rc.py module into your main application and you can use images with the following syntax: QIcon(“:/help.png”), where the leading :/ informs PyQt that you are using a resource file.

You can also use resource files with Qt Designer as the following image suggests.

After the creation of your resources you can simple drag and drop an icon, for example, from the Resource Editor into the icon property of the object you want to add a icon in your Property Editor.

Have fun!

How to setup Atheros 5007EG wireless network on 64 bits Kubuntu 8.04

Posted in Ubuntu on September 28, 2008 by mprnotes

In this post I describe what I did to get my wireless network card working on my recently installed Kubuntu 8.04 with KDE 4.

You can find the solution for installation of Atheros 5007 drivers at Ubuntu forums, in the following link:

http://ubuntuforums.org/showthread.php?t=816780

Now, let’s suppose that you have just installed your (K)ubuntu and you don’t have a Ethernet card so that you can use the internet to download the required packages to install the drivers for your wireless network card. If you have a dual boot machine you can use Windows to download the packages and then you can install in your Ubuntu. But, there are so many dependencies that it is quite boring and difficult to find out.

To solve this problem you can use the package USPC (Ubuntu Simple Package Crawler) which download the package you want and all dependencies from http://packages.ubuntu.com/ website.

So, you can run uspc on Windows, download the required packages to build the Atheros drivers and then you can install all the packages on your (K)ubuntu using this simple Shell script:

for i in $( ls *.deb ); do
        dpkg -i --force-depends $i
done

After this you can follow the instructions given in this topic of the Ubuntu forums to install your Atheros 5007 wireless card. Well, at least, it worked for my HP Pavilion dv6700 and I’m very happy about it.

Enjoy it!

Hi

Posted in Uncategorized on September 28, 2008 by mprnotes

Hi everyone outside there,

I’ve just created my blog to post some random notes in Computer Science, Programming, Ubuntu, Opensuse and some other related stuff for those who are interested in reading it.