Oct 11, 2011

Maven exemplo básico


mvn archetype:generate -DgroupId=org.sonatype.mavenbook.simple \
-DartifactId=simple \
-Dpackage=org.sonatype.mavenbook \
-Dversion=1.0-SNAPSHOT


sdasd asdasdasd asdasdasdasdas das
sdasd asdasdasd asdasdasdasdas das
sdasd asdasdasd asdasdasdasdas das


Initial directory = /workspace/java/trunk/mvn/simple
+---src
| +---main
| | +---java
| | | +---org
| | | | +---sonatype
| | | | | +---mavenbook
| +---test
| | +---java
| | | +---org
| | | | +---sonatype
| | | | | +---mavenbook
Total directories = 11


sdasd asdasdasd asdasdasdasdas das


$ find .
.
./pom.xml
./src
./src/main
./src/main/java
./src/main/java/org
./src/main/java/org/sonatype
./src/main/java/org/sonatype/mavenbook
./src/main/java/org/sonatype/mavenbook/App.java
./src/test
./src/test/java
./src/test/java/org
./src/test/java/org/sonatype
./src/test/java/org/sonatype/mavenbook
./src/test/java/org/sonatype/mavenbook/AppTest.java




mvn install


asdasd asdas dasd asd as d asda sda sd asd


java -cp target/simple-1.0-SNAPSHOT.jar org.sonatype.mavenbook.App
Hello World!

May 26, 2008

Hello World orientado a objetos

Em C++
$ gvim helloWorld.cpp
 1 #include <iostream>
 2 #include <string>
 3 using namespace std;
 4
 5 class HelloWorld{
 6
 7 public:
 8         // construtor!
 9         HelloWorld(string mensagem) {
10                 this->_mensagem = mensagem;
11         }
12
13         // metodo show
14         void show() const {
15                 cout << "mensagem: "
16                      << this->_mensagem
17                      << endl;
18         }
19
20 private:
21         string _mensagem;
22 };
23
24 int main()
25 {
26         HelloWorld obj ("ola mundo");
27         obj.show();
28
29         return 0;
30 }


Compilando:
$ make helloWorld


Em Vim Script
 1 " metodos
 2 """""""""
 3
 4 function helloWorld#Show() dict
 5       echo s:message
 6 endfunction
 7
 8 function helloWorld#Get() dict
 9         call self.Show()
10 endfunction
11
12 function helloWorld#Set(message) dict
13         let s:message = a:message
14 endfunction
15
16
17 " Costrutor
18 """""""""""
19
20 function helloWorld#New(message)
21
22         let s:message = a:message
23
24         let Retval = {
25                         \ 'message': s:message,
26                         \ 'Set'         : function ('helloWorld#Set'),
27                         \ 'Get'         : function ('helloWorld#Get'),
28                         \ 'Show'   : function ('helloWorld#Show')
29         \}
30
31         return Retval
32
33 endfunction helloWorld#New


Usando:
$ cat usaHelloWorld.vim
let obj = helloWorld#New("Hello World")

echo "mensagem:" obj.message
echo "obj.Get:" | call obj.Get()
call obj.Set ("Ola Mundo!")
echo "obj.Get:" | call obj.Get()

Rename files with the command interpreter sh

sh is the standard command interpreter for the system.

ifi - input + filter + interpreter

Step 1:
$ ls Run*
Run this to install syntax and clip files for jEdit.ahk
Run this to install syntax and clip files for PSPad.ahk
Run this to install syntax and clip library files for TextPad.ahk
Run this to install syntax and cliptext files for EditPlus.ahk
Run this to install syntax file for MED.ahk
Run this to install syntax file for Notepad++.ahk
Run this to install syntax highlighting for ConTEXT.ahk
Run this to install syntax highlighting for UltraEdit.ahk


Step 2:
$ ls Run*| sed -r 's/.* (.*.ahk)/& => \1/'
Run this to install syntax and clip files for jEdit.ahk => jEdit.ahk
Run this to install syntax and clip files for PSPad.ahk => PSPad.ahk
Run this to install syntax and clip library files for TextPad.ahk => TextPad.ahk
Run this to install syntax and cliptext files for EditPlus.ahk => EditPlus.ahk
Run this to install syntax file for MED.ahk => MED.ahk
Run this to install syntax file for Notepad++.ahk => Notepad++.ahk
Run this to install syntax highlighting for ConTEXT.ahk => ConTEXT.ahk
Run this to install syntax highlighting for UltraEdit.ahk => UltraEdit.ahk


Step 3:
$ ls Run*| sed -r 's/.* (.*.ahk)/mv & \1/'
mv Run this to install syntax and clip files for jEdit.ahk jEdit.ahk
mv Run this to install syntax and clip files for PSPad.ahk PSPad.ahk
mv Run this to install syntax and clip library files for TextPad.ahk TextPad.ahk
mv Run this to install syntax and cliptext files for EditPlus.ahk EditPlus.ahk
mv Run this to install syntax file for MED.ahk MED.ahk
mv Run this to install syntax file for Notepad++.ahk Notepad++.ahk
mv Run this to install syntax highlighting for ConTEXT.ahk ConTEXT.ahk
mv Run this to install syntax highlighting for UltraEdit.ahk UltraEdit.ahk


Step 4:
$ ls Run*| sed -r 's/.* (.*.ahk)/mv "&" \1/'
mv "Run this to install syntax and clip files for jEdit.ahk" jEdit.ahk
mv "Run this to install syntax and clip files for PSPad.ahk" PSPad.ahk
mv "Run this to install syntax and clip library files for TextPad.ahk" TextPad.ahk
mv "Run this to install syntax and cliptext files for EditPlus.ahk" EditPlus.ahk
mv "Run this to install syntax file for MED.ahk" MED.ahk
mv "Run this to install syntax file for Notepad++.ahk" Notepad++.ahk
mv "Run this to install syntax highlighting for ConTEXT.ahk" ConTEXT.ahk
mv "Run this to install syntax highlighting for UltraEdit.ahk" UltraEdit.ahk


Step 5:
$ ls Run*| sed -r 's/.* (.*.ahk)/mv "&" \1/'| sh


Other example: .texi -> .CCCAA
$ ls *.texi| sed 's/.*/ mv & `basename & .texi`.CCCAA/'|sh

Passando variáveis para o sed.

Para usar variáveis no sed nao use ' aspas simples, apenas " aspas dupals
veja os exeplos:

exemplo 01:
$ var=value
$ echo TEXT| sed "s/T/$var/"
valueEXT


exemplo 02:
$ var=T
$ echo TEXT| sed "s/$var/V/g"
VEXV


Referências:
http://aurelio.net/sed/
http://www.gnu.org/software/sed/manual/sed.html
http://thobias.org/doc/sosed.html

May 24, 2008

Bash completion with ZZ functions


$ wget http://funcoeszz.net/funcoeszz
$ mv funcoeszz-8.3.sh funcoeszz
$ chmod +x funcoeszz
$ sudo mv funcoeszz /usr/bin
$
$ cat >> .bashrc
_funcoeszz()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="zzajuda zzarrumanome zzascii zzbeep zzbyte zzcalcula zzcalculaip zzchavepgp zzcinclude zzcnpj zzcontapalavra zzconverte zzcores zzcpf zzdata zzdetransp zzdicasl zzdicbabelfish zzdicbabylon zzdicjargon zzdicportugues zzdictodos zzdiffpalavra zzdolar zzdominiopais zzdos2unix zzfoneletra zzfreshmeat zzgoogle zzhora zzhoracerta zzhowto zzipinternet zzkill zzlimpalixo zzlinha zzlinuxnews zzlocale zzloteria zzmaiores zzmaiusculas zzminusculas zzmoeda zznatal zznomefoto zznoticiaslinux zznoticiassec zzpronuncia zzramones zzrpmfind zzsecurity zzsenha zzseq zzsigla zzss zztempo zztool zztrocaarquivos zztrocaextensao zztrocapalavra zzuniq zzunix2dos zzwhoisbr zzwikipedia zzzz"
if [[ ${cur} == zz* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}
complete -F _funcoeszz funcoeszz


Mar 14, 2008

The Human Element



For each of us,
there is a moment of discovery.
We turn a page,
we raise a hand.
And just then, in the flash of a synapse,
we learn that life is elemental.
And this knowledge changes everything.
We look around and see the grandness of the scheme.
Sodium bonding with chlorine,
carbon bonding with oxygen,
hydrogen bonding with oxygen.
We see all things connected.
We see life unfold.
And in the dazzling brilliance of this knowledge,
we may overlook the element not listed on the chart.
Its importance so obvious,
its presence is simply understood.
The missing element
is the human element.
And when we add it to the equation,
the chemistry changes.
Every reaction is different.
Potassium looks to bond with potential.
Metals behave with hardened resolve.
And hydrogen and oxygen form desire.
The human element
is the element of change.
It gives us our footing to stand fearlessly
and face the future.
It is a way of seeing
that gives us a way of touching.
Issues,
ambitions,
lives.
The human element.
Nothing is more fundamental.
Nothing more elemental.

Louis Vuitton first TV ad [where will life take you?]



What is a journey?
A journey is not a trip.
It's not a vacation.
It's a process. A discovery.
It's a process of self-discovery.
A journey brings us face to face with ourselves.
A journey shows us not only the world,
but how we fit in it.
Does the person create the journey
or does the journey create the person?
The journey is life itself.
Where will life take you?