Friday, September 18, 2009

How Do I Open An .rsd File

fstab and mount subdirectories

decided today that the disc will mount XPkiem at every system startup. Ultimately, I want to standardize collection of catalogs, images, code, etc., so I do not have to search hard time with XP, once disk with Ubuntu in search of what happened to occupy. For example, I work on the report in OO.org on Windows and Ubuntu, but I do not have access to an ext3 partition from Windows. Therefore Podlinkuj the My Documents / home / daniel, including the need to appropriate entries in the fstab.

It was with this little problem, but I do not załatwiłoby use search engine.
in turn:
can type "sudo

fdisk-l" to get a list of all drives. Since my drive is internal and has no chance to change his name, I could just refer to her
/ dev/sda1 /
. However, the other drives in fstab UUID link to disk, so I just I do. Such a small digression: I have two external drives and USB flash drive. I tell them not to be installed in the directory / media / disk and / media/disk1, but for example in the directory / media / black / media / silver depending on which one is connected.
For UUID disk type: sudo

vol_id / dev/sda1

In my case I got:

ID_FS_UUID = 5E543A8F543A69C3
Now we need to open the fstab: gksu gedit / etc / fstab
and at the end add:

#
XP disk with UUID = 5E543A8F543A69C3 / media / xp ntfs-3g defaults 0 0

I segregate tabem column, but can also be a space. After the turn, they are: Disc ID, mount point, file system, options, and another about 2 parameters that are mostly zeros. Anything relating to the frequency of some activities, but do not know how because I did not go into the subject. ;) Alternative entry may be:

/ dev/sda1 / media / xp ntfs-3g defaults 0 0

Here I refer to the disk by name. For more information on what else may be appealed on the web.
Finally save and go back to the console. Now we need to let us know the system to przemontował wszystkie dyski zgodnie z nowym plikiem fstab:

sudo mount -a

No i błąd:

mount: mount point /media/XP does not exist

Zatem trzeba naprawić to niedopatrzenie:

sudo mkdir /media/XP

Tym razem
sudo mount -a
nie wyrzuca żadnych komunikatów i można cieszyć się zamontowanym dyskiem.

Teraz przykładowe dowiązanie katalogu z obrazami: /media/XP/Documents\040and\040Settings/Yelonek/Moje\040dokumenty/Moje\040obrazy /home/daniel/Obrazy none bind 0 0
Co to za \040? Otóż jeśli w nazwie występuje spacja, instead we give a corresponding "escape sequence". This value is 32 (ANSI code for space) in octal. Were there a simple insert a space, then after calling sudo mount-a will get a message that "fstab is bad", because the program finds a space for the transition to the next column.

repeated calling
~ / Images

and again we see the old files. You can move them to the My Pictures directory and then bind to the directories. Now everything is as it should be.
* PS ~ (tilde) represents your home directory, or in my case / home / daniel

Wednesday, September 16, 2009

Big Breasted Hair Stylist

Sqlite - exercise

recently became interested in another topic, namely SQL. So far I have heard that it is a powerful tool for database management, but somehow never took up be yourself and do not sit at this. Recently I have some free time, so I looked on the website:
www.w3schools.com
where there are lots of materials about SQL and it is very accessible form. After crossing the grounds had the opportunity to send a few queries to the training database. This proved easier than I thought. serving as a library database, chose a Sqlite3. It is quite simple and do not need to place any SQL servers or something. Shall be installed using:

sudo apt-get install libsqlite3-0 libsqlite3-dev Very likely that libsqlite3-0 is already in the system because it uses such as Firefox.

Now create a new project, add to the linker / usr/lib/libsqlite3.so and write some code:

/ * * File: main.cpp
* Author: Daniel
* * Created on September 14 2009, 22:24
* / # include
stdlib.h # include # include \u0026lt;sqlite3.h>
\u0026lt;iostream>
\u0026lt;string> # include # include # \u0026lt;sstream> include \u0026lt;vector>
using std:: court;
using std:: endl; / * *

* / / / show error message if it exists, and if not then the code value
void handleReturnCode (returncode int, char * errormsg = NULL) { if (returncode! = SQLITE_OK) {if (errormsg! = NULL) {
std:: court
sqlite3_free (errormsg);
} else {std:: court
}}}

/ / structure that stores data about a person sOsoba struct {
std:: string name; std:: string name; Int rokUrodzenia;

sOsoba (const char * p_imie, const char * p_nazwisko, const int p_rokUrodzenia) {name = p_imie
; }};
int main (int argc , char ** argv) {sqlite3 * db
;
int returncode; court
sqlite3_open returncode = ("test2.db", & db);
if (returncode! = 0) std:: court
char * errormsg; court
returncode = sqlite3_exec (db, "DROP TABLE IF EXISTS tab", NULL, NULL, & errormsg);
 handleReturnCode (returncode, Errormsg); 

court
returncode = sqlite3_exec (db,
"create table tab (name string, name string,
rokUrodzenia integer);"
NULL, NULL, & errormsg);
handleReturnCode (returncode, errormsg);

court
std:: vector \u0026lt;sOsoba> listaOsob;
listaOsob.push_back (sOsoba ("Donald", "Tusk", 1957));
listaOsob.push_back (sOsoba ("Lech", "Kaczynski, 1949));
listaOsob.push_back (sOsoba ("Jaroslaw", "Kaczynski, 1949));
listaOsob.push_back (sOsoba ("Greg", "Napieralski, 1974));
listaOsob.push_back (sOsoba ('Waldemar', 'Pawlak, 1959));
listaOsob.push_back (sOsoba (" Greg "," Schetyna , 1963));

/ / Add more names
std:: vector \u0026lt;sOsoba>:: iterator it = listaOsob.begin ();
while (it! = listaOsob.end ()) {court

name
Name
std:: stringstream query; << ErrorMsg << std::endl;
query

name << "Return code: " << returnCode << std::endl;


name


rokUrodzenia
returncode = sqlite3_exec (db, query.str (). c_str (), NULL, NULL, & errormsg);
handleReturnCode (returncode, errormsg);
it + +;}


char ** result, int
nRows, ncols;
/ / query about the politicians who born after 1960
sqlite3_get_table (db,
"select name, rokUrodzenia
from Table
WHERE rokUrodzenia> 1960
order to rokUrodzenia asc",
& result, & nRows, & ncols, & errormsg);
court
/ / null line is the header table, and the rest of the results, so rows are nRows + 1 << "Otwieranie bazy danych: " << endl;
for (int i = 0; and
for (int j = 0; j << returnCode << std::endl;
court
if (j> 0 & & i> 0) {
/ / to check whether it is easy to convert a number << "Usunięcie tabeli tab" << endl;
int year = atoi (result [i * ncols + j]);
court

}}} << "Utworzenie tabeli tab" << endl;
court

/ / free memory allocated for the table
sqlite3_free_table (result);

court
sqlite3_close (db); << "Utworzenie listy osob" << endl;
/ / call system command exporting tab table to csv file
system ("sqlite3-csv test2.db \\" select * from tab; \\ "> wyjscie.csv");
court
/ / display the contents of a csv file in the console
system ("cat wyjscie.csv ");

return (EXIT_SUCCESS);}