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.

lunes, 22 de junio de 2015

My return random.randint(0, 1)

Hi everybody, i didn't posted like before days.
But the summer arrive and i will try posts new content. Now a days i publised a lot of commits and PR's (pull request) in my github account ( i will try posted all interesting things in my blog.

This is only a notify posts but the next posts i promise i published interesting things.

Thanks for followme @endika_iglesias

domingo, 1 de febrero de 2015

How to check if my website this ON?

With Selenium language, is very easy. Only need installed selenium python library.
Simple example using Selenium library
browser = webdriver.Firefox()
assert 'Google' in browser.title
In this example only checked if has the "Google" title.

Now, if don't has the correct title the webs site, takes a screenshot.
browser = webdriver.Firefox()
if 'Google' not in browser.title:
    base64 = browser.get_screenshot_as_base64()
Finally, you can program tasks to check your websites and send email on error. If you want see the full example code go to this url Github/Endika/test_script/