<?xml version="1.0" ?> <rss version="2.0"> <channel> <title>This is my first RSS feed!</title> <link>http://www.myWebSite.com</link> <description>I am testing out creating an RSS feed...</description> <item> <title>The First Item to Check Out</title> <link>http://www.myWebSite.com/story1.htm</link> <description>This is the first article on my Web site!</description> </item> <item> <title>The Second Item to Check Out</title> <link>http://www.myWebSite.com/story1.htm</link> <description>This is the second article on my Web site!</description> </item> ... </channel> </rss>
Tag Archive for web
Baseline RSS XML
RSS Pointer for IE7 and/or Firefox
<link rel="alternate" type="application/rss+xml" title="Feed Title" href="http://foo.org/FeedGenerator.aspx" />
comunicazione con un Web Server
var variables:URLVariables = new URLVariables();
variables.miavariabile = "Ciao";
var request:URLRequest = new URLRequest();
request.url = "http://www.miodominio.com/miapagina.php";
request.method = URLRequestMethod.POST;
request.data = variables;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener(Event.COMPLETE, completeHandler);
try {
loader.load(request);
} catch (error:Error) {
trace("Errore nel caricamento dell' URL");
}
function completeHandler(event:Event):void {
var x_xml:XML = XML(event.target.data);
trace(x_xml);
}
Category: Uncategorized |
Tags: 30, actionscript, CS3, flash, get, internet, LoadVars, php, post, sendAndLoad, server, Sviluppo, Tutorials, URLLoader, URLRequest, URLVariables, web, xml
Get the IP exposed to the internet
wget -q -O - <a href="http://www.whatismyip.org
" >http://www.whatismyip.org
source
List apache server clients IPs by occurence (with country and provider info)
#!/usr/bin/perl -w
use strict;
#
# List apache server clients IPs by occurence (with country and provider info)
# perl administration web log apache
#
my %ips;
my $logfile = '/var/log/apache2/access.log';
open my $fh, '<', $logfile
or die "cannot open file $logfile: $!
";
#
# hash ip occurences
while (<$fh>) {
$ips{$1}++ if (/^(d+.d+.d+.d+)/);
}
#
# sort ip by occurence and print
# get whois data, parse and print
foreach my $ip (sort { $ips{$b} <=> $ips{$a} } keys %ips) {
print $ips{$ip} . " " . $ip;
my $result = qx{ whois -B -h whois.ripe.net $ip };
my ($country, $descr) = ('', '');
if ($result =~ /country:s+(w+)/) {
$country = $1;
}
if ($result =~ /descr:s+(.+?)
/) {
$descr = $1 ;
}
print " " . lc($country);
print " " . lc($descr) . "
";
}
#
# command line alternative (without dns info):
# awk '{print $1}' /var/log/apache2/access.log | sort | uniq -c
Download linked JPEGs from a Web page, on the command line
lwp-request -o links <a href="http://flickr.com/" >http://flickr.com/</a> | grep jpg | perl -pe "chomp; s/.*?(S+jpg)/$1 /;" | xargs wget
#or
lwp-request -o links <a href="http://flickr.com" >http://flickr.com</a> | grep jpg | perl -pe "chomp; s/IMGs*(.*jpg)/$1 /;" | xargs wget
#The following will download the numbered images site.com/gallery/01.jpg through site.com/gallery/16.jpg
perl -e "$i=0;while($i<16){open(WGET,qq/|xargs wget/);printf WGET qq{http://site.com/gallery/%02d.jpg},++$i}"
Category: Uncategorized |
Tags: commandline, download, grabit, http, lwp, numbered, one-liners, perl, pipe, productivity, scraping, sequential, shortcut, textonly, tools, web
Read local file with XmlHttpRequest
/* Read a file using xmlhttprequest
If the HTML file with your javascript app has been saved to disk,
this is an easy way to read in a data file. Writing out is
more complicated and requires either an ActiveX object (IE)
or XPCOM (Mozilla).
fname - relative path to the file
callback - function to call with file text
*/
function readFileHttp(fname, callback) {
xmlhttp = getXmlHttp();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState==4) {
callback(xmlhttp.responseText);
}
}
xmlhttp.open("GET", fname, true);
xmlhttp.send(null);
}
/*
Return a cross-browser xmlhttp request object
*/
function getXmlHttp() {
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp == null) {
alert("Your browser does not support XMLHTTP.");
}
return xmlhttp;
}
Category: Uncategorized |
Tags: web
css run-time expression
<!--[if lte IE 6]>
<style type="text/css" media="screen">
.wrap,
.searchpanel,
.messages,
.constrain,
.footer div {
width: expression(document.body.clientWidth > 1000 ? "1000px" : document.body.clientWidth < 912 ? "765px" : "98%" );
}
</style>
<![endif]-->
Automated UI test with Selenium-RC, WWW::Selenium and Test::More
use WWW::Selenium;
use Test::More tests => 2; #update to reflect the number of tests to be run
my $sel = WWW::Selenium->new( host => "localhost",
port => 4444,
browser => "*iexplore", # *iehta has more cross-domain privileges than *iexplore
browser_url => "http://mysite.com",
);
$sel->start();
$sel->open("http://mysite.com/testpopup.html");
diag("Check whether the popup is hidden.");
my $canSeePopup = $sel->is_visible("modalWindow");
ok ($canSeePopup == 0, "Popup is not visible.");
diag("Check whether the magic is hidden.");
ok(
$sel->is_visible("modalWindowMagicLayer") == 0,
"CSS magic is hidden... for now."
);
$sel->stop();;
Category: Uncategorized |
Tags: automation, behavior, commandline, environment, interaction, markup, qa, selenium, selenium-rc, test, ui, ux, web, work
Deny Access to .svn Files From Web
RewriteEngine On RedirectMatch 404 /.svn(/|$)