Es mostren els missatges amb l'etiqueta de comentaris linux (English version). Mostrar tots els missatges
Es mostren els missatges amb l'etiqueta de comentaris linux (English version). Mostrar tots els missatges

diumenge, 30 de setembre del 2007

NetBeans 5.5 with C++ and Qt

In this post I want to explain to you how I can make a C++/Qt program using the Sun IDE Netbeans.
First of all, I tried to do it with both NetBeans and Eclipse. However, I finally choose the first because Eclipse is really hard and uses many computer resources. In addition, I feel the window view of NetBeans more atracttive than Eclipse one.

So, the steps I neede to follow to reach my goal are explained on the next lines (I work with Ubuntu Feisty):
  1. NetBeans instalation (download page) :
    • $ chmod 777 netbeans-5_5_1-linux.bin
    • $ sudo ./netbeans-5_5_1-linux.bin
  2. NetBeans C/C++ Pack instalation (download page):
    • $ chmod 777 netbeans-c++-5_5_1_u1-linux.bin
    • $ sudo ./netbeans-c++-5_5_1_u1-linux.bin
  3. Configure the C++ libraries (directories where .h files can be found) because NetBeans default configuration doesn't include them. In order to manage this configuration I had to go to: Tools -> Options -> C/C++ -> Code Assistance -> C++ Compiler. Once there I had to add all the C++ directories:
    /usr/include/c++/4.1.2/backward/
    /usr/include/c++/4.1.2/bits/
    /usr/include/c++/4.1.2/debug/
    /usr/include/c++/4.1.2/ext/
    /usr/include/c++/4.1.2/i486-linux-gnu/
    /usr/include/c++/4.1.2/tr1/
    /usr/include/c++/4.1.2/
    /usr/include/ /usr/local/include/
    /usr/lib/gcc/i486-linux-gnu/4.1.2/include/
    Some of them are redundant, but I added also.
    You can see the window in the next image:

  4. Configure the Qt libraries (directories where .h files can be found). In order to get this configuration I had to do right click on the project and then: Properties -> C/C++ -> C++ Compiler -> General -> Include Directories. Once there I had to include the Qt directory (/usr/include/qt4/ in my system):
In this moment NetBeans is configured and we can use C++ amb Qt!! :D
Here is a little peace of code:

#include <stdlib.h>
#include <QtGui/QApplication>
#include <QtGui/QPushButton>

int main(int argc, char** argv)
{
QApplication qapplication(argc, argv);
QPushButton hello("hello", 0);
hello.show();
return qapplication.exec();
}

And this is the explanation ^^

dimarts, 24 de juliol del 2007

How to write into a NTFS partition from Linux

In this post I would like to explain to you how we can load a NTFS partition in such a way that it can be accessed from Linux not only for reading the information in it but also for writing new one (or erase).
Not many days have past since tools and drivers allowing totally access to NTFS from Linux have appeared thanks to reverse engineering. This is because NTFS specifications are not opened so computer scientist do not know how this format works.
Well, in order to mount a NTFS partition you only have to follow this steps (remember that I am using Ubuntu Fiesty):
  1. Instal Fuse package (it can be found in Synaptic under the name of afuse) and all the dependencies that the Packeges Manager suggests.
  2. Instal de package ntfs-3g and the dependencies that Synaptic suggests.
With only this two instalations we have the necessary tools to write in the NTFS partition (it seems that in the future this driver will be in the kernel of Linux).
After doing this two simple steps it only remains to mount the device, an external hard disc in my case:
  1. If the devide is mounted automatically when you connect it to your PC it must be umounted. This happens because with automatic monting the ntfs-3g driver does not work so the device have only reading permissions:
    $ sudo umount /dev/sdc5
  2. Mount the partition using the driver:
    $ sudo mount -t ntfs-3g /dev/sdc5 /media/aux_disk
  3. If you want to umount the device:
    $ sudo umount -t ntfs-3g /dev/sdc5
So, this is all! With this simple steps you can execute mkdir, for example, in the NTFS partition with no problems :D

dimecres, 11 de juliol del 2007

How to format an USB

I would like to make use of this post to explain to you how you can format you USB from linux (in an Ubuntu "Fiesty", to be precise :P).
The steps you have to follow are very simply:
  1. Connect you usb.
  2. If it is mounted automatically you have to umount it before you can format it:
    $ cat /etc/mtab
    # With this command you can look for your usb device
    $ sudo umount /dev/sdb1
  3. Formatting:
    $ sudo mkfs.vfat -I /dev/sdb1
    # The command mkfs.vfat formats your usb into FAT32
  4. Mount the usb:
    $ sudo mount -t auto /dev/sdb1 /media/disk
  5. Check its capacity:
    $df -h
With this 5 steps you will have your USB as a new one. It's easy, isn't it? :D