Saturday, February 25, 2012

For beginners CSS / HTML

vim  /html/webCSS1.html
vim /html/style/style.css 


file - webCSS1.html


<html>
    <head>
        <title> Metodo 3 </title> 
        <link rel="stylesheet" type="text/css" href="style/style.css" />    
    </head>


    <body>
        <h1>Using css style</h1> 
    </body>
</html>

file - style.css 


body{
    background-color : #B0E2FF;
}

open the file "webCSS1.html" in your browser.
see your page .
=)

How to install the command tree for mac

To install, download the source code and extract the tarball like so:
curl -O ftp://mama.indstate.edu/linux/tree/tree-1.5.3.tgz
tar xzvf tree-1.5.3.tgz
cd tree-1.5.3/
ls -al

Now you have to change Makefile to match your environment. If you’re using Linux,you can probably skip this step. If not, simply uncomment the lines for your operating system and comment out all the others. For example, if you’re using Mac OS X, do the following: 

open Makefile : vim Makefile
  1. Comment out the following lines so they look like this:
    # Linux defaults:
    #CFLAGS=-ggdb -Wall -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
    #CFLAGS=-O2 -Wall -fomit-frame-pointer -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
    #LDFLAGS=-s
  2. Uncomment these lines, like so:
    # Uncomment for OS X:
    CC=cc
    CFLAGS=-O2 -Wall -fomit-frame-pointer -no-cpp-precomp
    LDFLAGS=
    XOBJS=strverscmp.o
INSTALL
als:~ als$ curl -O ftp://mama.indstate.edu/linux/tree/tree-1.5.3.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 34494  100 34494    0     0   8055      0  0:00:04  0:00:04 --:--:-- 32388
als:~ als$ tar xzvf tree-1.5.3.tgz 
x tree-1.5.3/CHANGES
x tree-1.5.3/INSTALL
x tree-1.5.3/LICENSE
x tree-1.5.3/Makefile
x tree-1.5.3/README
x tree-1.5.3/tree.c
x tree-1.5.3/strverscmp.c
x tree-1.5.3/man/tree.1
x tree-1.5.3/man/tree.1.fr
als:~ als$ cd tree-1.5.3
als:tree-1.5.3 als$ ls -al
total 208
drwxr-xr-x  10 als  staff    340 25 Fev 22:37 .
drwxr-xr-x+ 47 als  staff   1598 25 Fev 22:37 ..
-rw-r--r--   1 als  staff   6772 19 Out  2009 CHANGES
-rw-r--r--   1 als  staff    362 27 Ago  2008 INSTALL
-rw-r--r--   1 als  staff  18009 12 Ago  2004 LICENSE
-rw-r--r--   1 als  staff   2089 19 Out  2009 Makefile
-rw-r--r--   1 als  staff   4167 19 Out  2009 README
drwxr-xr-x   4 als  staff    136 25 Fev 22:37 man
-rw-r--r--   1 als  staff   5322 27 Ago  2008 strverscmp.c
-rw-r--r--   1 als  staff  52732 24 Nov  2009 tree.c
als:tree-1.5.3 als$ vim Makefile 
 Make changes to the Makefile according to your system operability.
 Commenting on the lines that are not in their system.

als:tree-1.5.3 als$ sudo make install
cc -O2 -Wall -fomit-frame-pointer -no-cpp-precomp   -c -o strverscmp.o strverscmp.c
cc  -o tree tree.o strverscmp.o
install -d /usr/bin
install -d /usr/man/man1
if [ -e tree ]; then \
install -s tree /usr/bin/tree; \
fi
install man/tree.1 /usr/man/man1/tree.1
als:tree-1.5.3 als$ tree 
.
├── CHANGES
├── INSTALL
├── LICENSE
├── Makefile
├── README
├── man
│   ├── tree.1
│   └── tree.1.fr
├── strverscmp.c
├── strverscmp.o
├── tree
├── tree.c
└── tree.o


1 directory, 12 files



HTML - Tables

<html>
     <head>
         <title>Tables HTML</title>
     </head>

     <body>

        <table border = "1" width="60%">
            <tr>
                <td>Cell 1  HTML</td>
                <td>Cell 2  TABLES</td>
            </tr>
            <tr>
                <td>Cell 3  ANDRE L S</td>
                <td>Cell 4  COMMAND LINE</td>
            </tr>
        </table>
     </body>
</html>

will look like this in the browser:


Cell 1 HTML Cell 2 TABLES
Cell 3 ANDRE L S Cell 4 COMMAND LINE

HMTL - link / Attributes

<html>

     <head>
        <title> Attributes </title>
     </head>

     <body>

        <p style="background-color:#00688B;">Line Attributes</p>
        <p>Background-color</p>
        <body style="background-color:#6CA6CD;">
        <hr/>
        <p>Links</p>
        <a href="http://www.youtube.com/">Click here go to Youtube</a><br/>
        <a href="http://www.ufpa.br/dicas/htm/htm-cor2.htm">Click here go to Table Colors HTML</a><br/>

        <p><a href="#intro">Link to Introduction</a></p>
        <p><a href="#text">Link to Text</a></p>
        <hr/>

        <p>Images</p>
        <img src="http://3.bp.blogspot.com/-DqQBD6_9oKk/TZTTMsit--I/AAAAAAAAAC8/GDa8OGEeWLU/s1600/ciencia_da_computacao_c2.gif"/>
        <img src="http://3.bp.blogspot.com/-DqQBD6_9oKk/TZTTMsit--I/AAAAAAAAAC8/GDa8OGEeWLU/s1600/ciencia_da_computacao_c2.gif" width="250px" height="250px" />
        <p>Gifs</p>
        <img src="http://www.reinodosgifs.net/galeriadegifs/emoticons_msn/06.gif"/>
     
        <h1 id="intro">Introduction</h1>
        <p>Text text text text</p>

        <h1 id="text">Text</h1>
        <p>Text text text text</p>

    </body>

</html>

will look like this in the browser:


Line Attributes
Background-color

Links
Click here go to Youtube
Click here go to Table Colors HTML
Link to Introduction
Link to Text

Images

 Gifs

Introduction

Text text text text

Text

Text text text text

HTML - For beginners

Example.html 

<html>
     <head>
        <title> Tags </title>
     </head>
     <body>
         <p>Some Tags</p><hr/>
        <strong>Stronger emphasis.</strong><br/>
        <small>This should be in small.</small><br/>
        <p>used for paragraphs.</p>
        <em>Emphasis text.</em></br>
        <h1>Heading</h1>
        <h2>Subhead</h2>
        <h3>Sub-subhead</h3>
        <hr/>
     </body>
</html>

Will look like this in the browser:

Some Tags

Stronger emphasis.
This should be in small.

used for paragraphs.
Emphasis text.

Heading 

Subhead

Sub-subhead




For beginners - HTML / CSS

HTML
Tutorial 
http://www.html.net/tutorials/html/introduction.php


CSS
Definitions
http://linguistlist.org/audio-video/tutorials/Basic-CSS-tutorial.pdf
http://www.w3c.br/divulgacao/pdf/guia-css-w3cbr.pdf
http://www.w3c.br/pub/Cursos/CursoCSS3/css-web.pdf
http://www.pereiraaps.com/Apostilas/css.basico.pdf
http://pt.wikipedia.org/wiki/Cascading_Style_Sheets
Tutorial 
http://pt-br.html.net/tutorials/css/introduction.php

Thursday, February 23, 2012

Removing the redundancy file.txt

andre@fera:~$ cat file_A.txt
Desktop
Documents
Downloads
examples.desktop
Music

andre@fera:~$ cat file_B.txt
Desktop
Documents
Downloads
examples.desktop
Music
work
andre

#concatenating
andre@fera:~$ cat  cat file_A.txt cat file_B.txt > file_AB.txt

#removing the redundancy
andre@fera:~$ sort file_AB.txt | uniq > file_AB.uniq.txt

#number of lines
andre@fera:~$ wc -l file_AB.uniq.txt
7 file_AB.uniq.txt

#number of lines
andre@fera:~$ wc -l file_AB.txt
12 file_AB.txt

andre@fera:~$ cat file_AB.txt
Desktop
Documents
Downloads
examples.desktop
Music
Desktop
Documents
Downloads
examples.desktop
Music
work
andre

andre@fera:~$ cat file_AB.uniq.txt
andre
Desktop
Documents
Downloads
examples.desktop
Music
work

Tuesday, February 21, 2012

Perl - Host connected to the network count

#!/usr/bin/perl
use strict;
use warnings;
use Net::Ping;

my $rede = '192.168.0';
my ($addX,$contHost) = (0,0);

    while( $addX++ < 255 ){
                         
    my $p = Net::Ping->new();
    if ($p->ping("$rede.$addX")){
        print "$rede.$addX is alive.\n";
        $contHost++;
    }else{
        print "$rede.$addX is dead.\n";
    }    
    $p->close();                                                                                                                                                                                                                                                                                                                                                      }
print "Total Host : $contHost\n";


result :


./pingHost.pl
192.168.0.1 is alive.
192.168.0.2 is alive.
192.168.0.3 is dead.
192.168.0.4 is dead.
...

Perl - Ways to recover @ARGV



#!/usr/bin/perl
use strict;
use warnings;

#ways to recover
print join (" | ",@ARGV),"\n";
print "$ARGV[0] - $ARGV[1] - $ARGV[2]\n";

result : argument [example for blog]

$ ./blog.pl example for blog
example | for | blog
example - for - blog

$./blog.pl
Use of uninitialized value $ARGV[0] in concatenation (.) or string at ./blog.pl line 10.
Use of uninitialized value in concatenation (.) or string at ./blog.pl line 10.
Use of uninitialized value in concatenation (.) or string at ./blog.pl line 10.
- -




Basic commands of VIM


esc + i                   = insert
esc + : + w            = save
esc + : + wq          = save exit 
esc + : q                = exit 
esc + : + q!           = forced out 
/name                   = search by standard
[numero]yy          = copy line 
esc + p                 = paste line        
dd[numera]          = delete the number of lines  
esc + u                 = undo

Wednesday, February 15, 2012