Archive for the ‘Pràctiques’ Category

Treball de recerca: Projecte Gilean

diumenge, març 22nd, 2009

Ja és el meu tercer any a la Facultat d’Informàtica de Barcelona. He trobat el codi del treball de recerca de segon de batxillerat a l’Escola Joan Pelegrí d’Hostafrancs (coses de tenir GNU/Linux, que no s’ha de formatar gaire sovint), i he pensat que estaria bé penjar el document sencer. Amb un company, Víctor Díaz Jiménez (que ara fa Enginyeria de Telecomunicacions a La Salle), vam muntar un robot controlat amb el port paral·lel. Funcionava de forma teledirigida amb l’ordinador, programada llegint un fitxer de text, o de forma autosuficient. Està programat amb Visual Basic 6, tot i que la idea inicial era fer-ho en C++ o Java i sota Linux, però no va ser possible.

Deixo aquí el text, el codi i unes fotos. Probablement necessiteu la biblioteca io.dll, que trobareu a geekhideout.

Aquesta obra està subjecta a una llicència Reconeixement-NoComercial-CompartirIgual 2.5 de
Creative Commons. Per veure’n una còpia, visiteu http://creativecommons.org/licenses/by-nc-
sa/2.5/ o envieu una carta a Creative Commons, 559 Nathan Abbott Way, Stanford, California
94305, USA.

Projecte Gilean: zip que conté el document, llicències, i annexos

Codi de C-Gilean: programari de control del robot construït

El codi té llicència GPL. Atenció estudiants de batxillerat: GPL vol dir que en podeu fer el que vulgueu, però és obligat reconèixer l’autor original «Eduard Gamonal» i mantenir la llicència.

Captures del programari:

i del robot

Shell, find it! Some examples of the find command line tool

dilluns, març 16th, 2009

Have you lost something? You may fall in love with the find command. GNU Find tells you where a file is, given a condition. You shall use regular expressions and parameters related to lots of file features, like last access date, last modification date, its i-node, the file format of the device where it’s being saved, etc.

The syntax is find dir1 … dirM cond1 .. condN. It will search the directory tree rooted at each diri, for i = 1 to M, all files matching conditions cond1 to condN evaluated from left to right.

Let’s see some examples:

  1. find /bin -links +1
    Searches files in /bin and its subdirectories having 1 or more hard links.
  2. find /bin -links +1 -type f
    Idem, but only matches regular files (-type f).
  3. find -size +8k -printf ‘%p %s\n’
    If no directory root is given, the default is . (the working one). This command seeks files whose size is at least 8KB and writes its name and size.
  4. find . -name core -exec rm -i {} \; -print
    Looks for files called «core» (-name core), asks for confirmation to delete them (-exec rm -i {} \;) and, after all, prints their name (-print). Notice that you can run any command with «-exec». In rm -i, -i stands for «Ask for a confirmation», and «{}» means «the file matching the conditions». «-exec» must be closed with «\;».
  5. find /usr/include -name ‘*.h’ -exec grep -H SIGCHLD {} \;
    Looks from /usr/include on all files with the extension .h (-name ‘*.h’, with quotes to avoid the shell understanding the * as a metacharacter and letting the find command use it) and having the string «SIGCHLD». That is, for each file that has matched the conditions, «grep -H SIGCHLD» is run.
  6. find -atime +1 -type f -exec mv {} TMP \;
    Moves files that haven’t been accessed today (-atime +1) to the dir called TMP, in our working directory.

Thanks FIB.


Entra