sunnuntai 8. helmikuuta 2009

Porting QFLR5 for Ubuntu



I have found the XFLR5 X-foil front-end pretty nice as the original X-foil is a bit hard to use. I have been able to run the XFLR5 on Ubuntu with wine, however, it is not without bugs when run under wine. So there is an another alternative - use a native Linux version that does not officially exist yet.

The author of the program has been working on a Qt-version (it is there in the svn). I tried to compile it to Ubuntu. However, because it was using the windows.h min and max, it didn't compile out of the box today.

I created the following patch (the blogger makes the patch look incorrect, please look at the actual patch file, from here if you want to use it: karoliina-minmaxlinuxpatch.diff ):

karoliina@aurora:~/MyProjects/xflr5/branches/QFLR5$ more karoliina-minmaxlinuxpatch.diff
Index: Objects/Foil.cpp
===================================================================
--- Objects/Foil.cpp (revision 62)
+++ Objects/Foil.cpp (working copy)
@@ -32,6 +32,7 @@
#include
#include
#include
+#include

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
@@ -625,7 +626,7 @@
{
//Returns the foil's length

- return max(m_rpExtrados[m_iExt].x, m_rpExtrados[m_iInt].x);
+ return std::max(m_rpExtrados[m_iExt].x, m_rpExtrados[m_iInt].x);
}

double CFoil::GetLowerY(double x)
@@ -881,8 +882,8 @@

for (i=0; i> m_NXPanels[i];
- m_NXPanels[i] = max(1,m_NXPanels[i] );
- m_NXPanels[i] = min(MAXCHORDPANELS, m_NXPanels[i]);
+ m_NXPanels[i] = std::max(1,m_NXPanels[i] );
+ m_NXPanels[i] = std::min(MAXCHORDPANELS, m_NXPanels[i]);
}

for (i=0; i<=m_NPanel; i++) @@ -1442,8 +1442,8 @@ m_NYPanels[i] = (int)f; } else ar >> m_NYPanels[i];
- m_NYPanels[i] = max(1,m_NYPanels[i] );
- m_NYPanels[i] = min(50, m_NYPanels[i]);
+ m_NYPanels[i] = std::max(1,m_NYPanels[i] );
+ m_NYPanels[i] = std::min(50, m_NYPanels[i]);
}
int total = 0;
for (i=0; i


This patch replaces the min and max to std::min and std::max, ensuring the min and max from are being used. This enables the successful compilation on Ubuntu side.

I have a temporary binary (no debian package yet, I need to agree with the developer when it would be ready for packaging), available for Ubuntu Intrepid:

http://www.katix.org/karoliina/packages/QFLR5-ubuntu-intrepid-bin

tiistai 25. marraskuuta 2008

xorg.conf which works with nvidia-glx-177 on Intrepid and Lenovo T61p

A workmate asked what my xorg.conf contains. So here it comes:

karoliina@aurora:~$ more /etc/X11/xorg.conf
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 1.0 (buildd@rothera) Mon Oct 13 14:53:48 UTC 2008

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 1.0 (buildmeister@builder63) Wed Oct 1 15:09:35 PDT 2008

Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "Module"
Load "dbe"
Load "extmod"
Load "type1"
Load "freetype"
Load "glx"
Load "dri"
EndSection

Section "ServerFlags"
Option "Xinerama" "0"
EndSection

Section "InputDevice"

# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "IBM"
HorizSync 53.2 - 63.9
VertRefresh 50.0 - 60.0
Option "DPMS"
EndSection

Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro FX 570M"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "1"
Option "metamodes" "DFP-0: nvidia-auto-select +0+0, DFP-1: nvidia-auto-select +1680+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection

torstai 25. syyskuuta 2008

Downloading all specific files from web server to your Linux desktop

Everyone knows that there is the wget command in the Ubuntu. But by default its behavior is not very nice if you want to get for example backup of your home directory on the web server only. If you don't have wget, you can install it by going to shell and typing:


sudo apt-get install wget


Example case: You have lots of pictures on your home page, in images folder. You want to get them all to your Linux desktop, ie. you want to make a backup. But you want only the images, not the other files that are in that folder, what do you do? Or what if you want to download all my music without needing to click download for provided links for each file separately?

I was asking around from the Linux gurus around me, but I could not get a simple answer other than read the man pages. Ok, I went and read the man pages. There were some examples, and they did not do what they promised to do until I combined them to the following:

This does to my music folder on our server a mirror to your hard disk, but it has adverse side effect, it keeps the web server directory stucture:


wget -r -l1 --no-parent -L -A.mp3 http://www.katix.org/karoliina/music/


I just wanted to have the mp3-files from one folder. So I searched further the man page.

Here is the line what did for me what I wanted:


wget -r -l1 --no-parent -L -A.mp3 -p --convert-links -nH -nd -P./ http://www.katix.org/karoliina/music/


It still downloads the robots.txt. But you can go and delete the unnecessary file. And if you want all my music, here is what you can do. In shell (terminal), go to your desired folder and then copy-paste this command line to the shell. And you'll be done as quickly as the network allows.

keskiviikko 2. heinäkuuta 2008

How to set up nVidia driver to Ubuntu Hardy on Lenovo T61p laptop

1. Download the latest nVidia driver from nVidia site. The driver should be 32 bit Linux (assuming you are running 32-bit version and not the AMD-64 -version), Quadro FX570M if you are running IBM T61p laptop. Otherwise (on other machines) select the appropriate display controller from the menu. Save the file to a location that you can easily access when you are in text mode (mandatory step).

2. Boot the Ubuntu (mandatory).
When the password dialog appears, press CTRL+ALT+F1
When text mode appears and asks for login, log in with your username and password.

3. Become root (mandatory):
sudo su
and then give your password

4. Stop the gdm (replace with kdm if you are running Kubuntu or kdm-kde4 if you are running Kubuntu-KDE4 remix)
/etc/init.d/gdm stop

5. If you don't have compilation environment, you can install it by (optional):
apt-get update
apt-get install gcc g++ glibc

6. Uninstall now the nvidia open source driver (mandatory):
dpkg --purge xserver-xorg-video-all xserver-xorg-video-nvidia

Now you have no display driver installed on your system at all, you can't start X.

Go to the directory where you have the nVidia driver package located.
It is named something like NVIDIA-something.run.
TYPE (mandatory):
chmod +x NVIDIA*.run

Now execute the package (mandatory):
./NVIDIA.....run (replace .... with the correct filename which depends on which driver version you have).

Accept license agreement.
Answer to the question if the installer wants to download precompiled kernel module from nVidia site that "No".
It may state that you have already a nVidia driver installed and if you want to uninstall the driver first. Answer yes to that kind of question.
The installer asks also if you want to modify the xorg.conf for the driver. Answer yes to that kind of question.
Your new driver is now successfully installed if you didn't receive any errors in the process.

You can now restart the gdm to log in the system without rebooting:
/etc/init.d/gdm restart

If you are using external display in addition to the laptop screen, you may need to reboot to get it functioning correctly. You need to have both the external display and laptop display turned on when you boot the computer for the nVidia driver to autoconfigure it properly.

If your display settings still aren't correct, you can edit them with nvidia-settings (optional):
Open terminal window
sudo nvidia-settings

Change the settings to appropriate and save to xorg.conf. Please note that you may need to run the nvidia-settings from terminal window instead of clicking the icon or menu item which launches nvidia-settings because in order to write to the xorg.conf you need to be root and Ubuntu wasn't designed to support the nVidia settings application as it has its own (but sometimes not working) installers for binary drivers (the envy package which may work for some, but at least didn't work for me with IBM T61p and Hardy).