domingo, 5 de julio de 2015

How to know my public IP in terminal

Hi everybody, today i share a simple list for get your public IP in linux command line.
First command, check your IP using dyndns service is very long command.
curl -s | grep -o "[[:digit:].]\+"
This is short command and very easy to remember.
Ipify is the same than ifconfig but response is in JSON format, prefer for webservices or other apps.
curl ''
Mi favorite is this command, is very elegant only send a request to obtain IP using DNS server.
dig +short
Other command is the same that others.
For to use this commands you need to install curl and digpackages.
For use curl install sudo aptitude install curl
For use dig install sudo aptitude install dnsutils

viernes, 3 de julio de 2015

Differents cases for you don't use position="replace" in Odoo xml

Hi everybody, today i explain how to use position attribute in Odoo XML.

Realy is very easy, only you never forget this rule:

Never use this attribute position="replace" NEVER NEVER.
<field name="street" position="replace">
    <!-- .... Never use!!!! -->
Exist other for example position="attribute", position="after", position="before"
<!-- You need add new attributes to field -->
<field name="street" position="attribute">
    <attribute name="class">big_field</attribute>
    <attribute name="value">Default Value</attribute>
    <attribute name="style">boder:solid 0.1em #f00;</attribute>

<!-- You need add other field after that -->
<field name="street" position="after">
    <field name="street2"/>

<!-- You need add other field before that -->
<field name="street" position="before">
    <field name="first_name"/>
Is very importan in your addons not use replace attribute because is posible in your view or inherit view other addons touch the same part and cause error and generates incompatibilities.

Other example with xpath expresion
<!-- add in all links with class 
is menu_links text color red. -->
<xpath expr="//a[@class='menu_links']" position="attributes">
    <attribute name="style">color:#f00;</attribute>

<!-- add in only in first link with class 
is menu_links text color red. -->
<xpath expr="//a[@class='menu_links'][0]" position="attributes">
    <attribute name="style">color:#f00;</attribute>

<!-- add in only in second link with class 
is menu_links text color red. -->
<xpath expr="//a[@class='menu_links'][1]" position="attributes">
    <attribute name="style">boder:solid 0.1em #f00;</attribute>
The last example is very dangerous because is possible the second link not exist and cause error.