XPATH

The XPATH(XML Path Language) is a query language from the W3C, it is used to select nodes in an XML file.

Full Path

In this example I start with “/” that say we start on root and then i navigate from element to element.

 

Anywhere

In this example I use the “//” to search in the full document to find all a nodes.(you could use the “//” behind a “/” like “/html/body/div//a” to find all elements in html body div.)

 

Attributes

you could use the “@” to find all elements wit the attribute class that is the string “secondarary”.

 

As example you could select all hrefs where the Attributes contains a string:

Or select all hrefs where the text from the URL contains a string:

 

Array

If you select all Elements you get an Array, in the example above I select the firs element from my result Array.You should avoid this, better is to navigate over the class or ID because if the Page changes a bit the XPATH don’t work any more.

 

That are some basics, if you need something special take a look into the Network or on my page.As example Web crawling in PHP or Perl.

HTML store data in data tag

If you want to store some data in a tage you could use the data- tag. try it:

1


code:  

HTML Mail to line break

If you want to make a line break in the mail body to you could use this: its just a line feed and carriage return. For white spaces you could use this: for more information look at RFC 2368   This is a little example:   Try it: Mail to  

Perl Formater for Terminal and HTML

If you want to bring your "ps" or another tabel in a good format you could use this skript: Here we have a good terminal format: This is the raw HTML output: And in the browser it looks pretty like this :
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 782116 56436 ? Ssl 14:22 0:03 --NONE--
root 7 0.0 0.0 11728 1348 pts/0 Ss 14:22 0:00 sh
root 61 0.0 0.0 19740 1212 pts/0 R+ 15:44 0:00 ps

Image Preview with JavaScript and HTML

If you have an image and want to load a preview image or gif you could use two solution. Html Option : Line 2: set default image Line 3: on mouse over load my preview gif Line 4: on mouse out event load the default image JavaScript Option : Sometimes you get something like this 'http://www.exampl.com/image1.jpg,http://www.exampl.com/image2.jpg' and you want to use it as a preview. Line 2 and 3 are calling the JavaScript Function. Line 4 is set by the JavaScript. Use this Call to set the Default image, the first Parameter is the ID and the second the array. This is the JavaScript Object to handle the Preview. TR : change the image with the time-out from 400ms. run: get the element,split the array,time-out and then change the image. stop: time-out and then load the first image of the array. dev:loads the default image