Difference between revisions of "Template:Mainpage-rssfeeds"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
m
(Usage:)
Line 30: Line 30:
 
</nowiki>
 
</nowiki>
  
* charset=...             The charset used by the feed. iconv is used to convert this.
+
{|
* short                   Do not show the description text for each news item.
+
|-
* max=x                   Shows x most recent headlines.
+
||charset=...   ||        The charset used by the feed. iconv is used to convert this.
* highlight= term1 term2 The terms separated by a space are highlighted.
+
|-
* filter= term1 term2    Show only rss items containing at least one of the terms.
+
|| short         ||          Do not show the description text for each news item.
* reverse                display the rss items in reverse order.
+
|-
* title=x                display an alternative title instead of chanel name.
+
|| max=x         ||        Shows x most recent headlines.
* title = none            dont display any title.
+
|-
 +
|| highlight= term1 term2 || The terms separated by a space are highlighted.
 +
|-
 +
|| filter= term1 term2    ||Show only rss items containing at least one of the terms.
 +
|-
 +
|| reverse                ||display the rss items in reverse order.
 +
|-
 +
|| title=x                ||display an alternative title instead of chanel name.
 +
|-
 +
|| title = none            ||dont display any title.
 +
|}
  
 
===Example:===  
 
===Example:===  

Revision as of 16:27, 29 July 2006

UNIQ19cbceaaee0f3d15-rss-00000000-QINU UNIQ19cbceaaee0f3d15-rss-00000001-QINU

GISWiki/RSS

Uses an extension from: http://meta.wikimedia.org/wiki/GISWiki/RSS

RSS-Feed Mediawiki extension

  • original by mutante 25.03.2005
  • extended by Duesentrieb 30.04.2005
  • extended by Rdb78 07.07.2005
  • extended by Mafs 10.07.2005, 24.07.2005
  • extended by User:Arcy 07.09.2005
  • Updated for MediaWiki 1.6 by User:piku 13.06.2006
  • Update for Wikicode output, by User:cogdog 14.jul.2006

Requires:

Installation:

  • put this file (rss.php) into the extension directory of your mediawiki installation
  • add the following to the end of LocalSettings.php: include("extensions/rss.php");
  • make sure magpie can be found by PHP.

Usage:

Use one section between <rss>-tags for each feed. The rss section may contain parameters separated by a pipe ("|"), just like links and templates. These parameters are supported:

charset=... The charset used by the feed. iconv is used to convert this.
short Do not show the description text for each news item.
max=x Shows x most recent headlines.
highlight= term1 term2 The terms separated by a space are highlighted.
filter= term1 term2 Show only rss items containing at least one of the terms.
reverse display the rss items in reverse order.
title=x display an alternative title instead of chanel name.
title = none dont display any title.

Example:

<rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss>

Life Expectancy Set To Hit 90 In South Korea, Study Predicts

Fri, 24 Feb 2017 07:00:00

According to a study published in the journal The Lancet, researchers have predicted that South Korea will likely become the first country where the average life expectancy will exceed 90 years. The researchers led by public-health researcher Majid Ezzati at Imperial College London used data from the World Health Organization and a suite of 21 statistical models they developed to figure out how life expectancy will change in 35 developed countries by 2030. Nature reports: Life expectancy is expected to increase in all 35 countries, in keeping with steady progress in recent decades, the team found. But it is South Korean women who will be living longest by 2030: there is a nearly 60% chance that their life expectancy at birth will exceed 90 years by that time, the team calculates. Girls born in the country that year can expect to live, on average, to nearly 91, and boys to 84, the highest in the world for both sexes. The nation's rapid improvement in life expectancy -- the country was ranked twenty-ninth for women in 1985 -- is probably down to overall improvements in economic status and child nutrition, the study notes, among other factors. South Koreans also have relatively equal access to health care, lower blood pressure than people in Western countries and low rates of smoking among women. As for the United States, the life expectancy is "predicted to be among the lowest of these countries by 2030; 80 for men (similar to the Czech Republic) and 83 for women (similar to Mexico)."

Share on Google+


Read more of this story at Slashdot.

Self-Driving Cars Should Be Liable For Accidents, Not the Passengers: UK Government

Fri, 24 Feb 2017 03:30:00

"Electric charging points at all major motorway services and petrol stations, and the occupants of a self-driving car aren't liable in the case of an accident -- those are two of the measures proposed by a new law that the UK government hopes will let us reap the rewards of improved transport technology over the next few years," reports Ars Technica. "These changes are part of the Vehicle Technology and Aviation Bill (VTAB), a draft law that is basically a shopping list of governmental desires." From the report: The first item on the bill involves automated vehicles, and how to ensure that the vehicle's owner (which may or may not be a driver) and potential accident victims are protected. The bill says that insurance companies must offer two types of protection: for when a vehicle is acting autonomously, but also if the human driver decides to takes control. Essentially, the government wants to make sure that an accident victim can always claim compensation from the insurance company, even if the car was acting autonomously. It would then be up for the insurance company to try and reclaim that money from the car maker through existing common law and product liability arrangements. In a somewhat rare display of tech savviness, there are two exemptions listed in the bill. If the vehicle owner makes unauthorized changes to the car's software, or fails to install a software update as mandated by their insurance policy, then the insurer doesn't have to pay. It isn't clear at this point which capabilities will be enough to classify a vehicle as "self-driving." The draft law asks the department for transport (DfT) to work it out, post haste, and then to determine which vehicles qualify for the new type of insurance. The planned law also outlines new governmental powers to improve the UK's electric charging infrastructure.

Share on Google+


Read more of this story at Slashdot.

Study Reveals Bot-On-Bot Editing Wars Raging On Wikipedia's Pages

Fri, 24 Feb 2017 01:00:00

An anonymous reader quotes a report from The Guardian: A new study from computer scientists has found that the online encyclopedia is a battleground where silent wars have raged for years. Since Wikipedia launched in 2001, its millions of articles have been ranged over by software robots, or simply "bots," that are built to mend errors, add links to other pages, and perform other basic housekeeping tasks. In the early days, the bots were so rare they worked in isolation. But over time, the number deployed on the encyclopedia exploded with unexpected consequences. The more the bots came into contact with one another, the more they became locked in combat, undoing each other's edits and changing the links they had added to other pages. Some conflicts only ended when one or other bot was taken out of action. The findings emerged from a study that looked at bot-on-bot conflict in the first ten years of Wikipedia's existence. The researchers at Oxford and the Alan Turing Institute in London examined the editing histories of pages in 13 different language editions and recorded when bots undid other bots' changes. While some conflicts mirrored those found in society, such as the best names to use for contested territories, others were more intriguing. Describing their research in a paper entitled Even Good Bots Fight in the journal Plos One, the scientists reveal that among the most contested articles were pages on former president of Pakistan Pervez Musharraf, the Arabic language, Niels Bohr and Arnold Schwarzenegger. One of the most intense battles played out between Xqbot and Darknessbot which fought over 3,629 different articles between 2009 and 2010. Over the period, Xqbot undid more than 2,000 edits made by Darknessbot, with Darknessbot retaliating by undoing more than 1,700 of Xqbot's changes. The two clashed over pages on all sorts of topics, from Alexander of Greece and Banqiao district in Taiwan to Aston Villa football club.

Share on Google+


Read more of this story at Slashdot.

World's Only Sample of Metallic Hydrogen Has Been Lost

Fri, 24 Feb 2017 00:20:00

New submitter drunkdrone quotes a report from International Business Times: A piece of rare meta poised to revolutionize modern technology and take humans into deep space has been lost in a laboratory mishap. The first and only sample of metallic hydrogen ever created on earth was the rarest material on the planet when it was developed by Harvard scientists in January this year, and had been dubbed "the holy grail of high pressure physics." The metal was created by subjecting liquid hydrogen to pressures greater that those at the center of the Earth. At this point, the molecular hydrogen breaks down and becomes an atomic solid. Scientists theorized that metallic hydrogen -- when used as a superconductor -- could have a transformative effect on modern electronics and revolutionize medicine, energy and transportation, as well as herald in a new age of consumer gadgets. Sadly, an attempt to study the properties of metallic hydrogen appears to have ended in catastrophe after one of the two diamonds being used like a vice to hold the tiny sample was obliterated. The metal was being held between two diamonds at a pressure of around 71.7 million pounds per square inch -- more than a third greater than at the Earth's core. According to The Independent, one of these diamonds shattered while the sample was being measured with a laser, and the metal was lost in the process.

Share on Google+


Read more of this story at Slashdot.

Judge Rules Against Forced Fingerprinting

Thu, 23 Feb 2017 23:40:00

An anonymous reader quotes a report from The Stack: A federal judge in Chicago has ruled against a government request which would require forced fingerprinting of private citizens in order to open a secure, personal phone or tablet. In the ruling, the judge stated that while fingerprints in and of themselves are not protected, the government's method of obtaining the fingerprints would violate the Fourth and Fifth amendments. The government's request was given as part of a search warrant related to a child pornography ring. The court ruled that the government could seize devices, but that it could not compel people physically present at the time of seizure to provide their fingerprints "onto the Touch ID sensor of any Apple iPhone, iPad, or other Apple brand device in order to gain access to the contents of any such device." The report mentions that the ruling was based on three separate arguments. "The first was that the boilerplate language used in the request was dated, and did not, for example, address vulnerabilities associated with wireless services. Second, the court said that the context in which the fingerprints were intended to be gathered may violate the Fourth Amendment search and seizure rights of the building residents and their visitors, all of whom would have been compelled to provide their fingerprints to open their secure devices. Finally, the court noted that historically the Fifth Amendment, which protects against self-incrimination, does not allow a person to circumvent the fingerprinting process." You can read more about the ruling via Ars Technica.

Share on Google+


Read more of this story at Slashdot.


===rss.php=== 

<?php
# RSS-Feed Mediawiki extension
# 
# original by mutante 25.03.2005
# extended by Duesentrieb 30.04.2005
# extended by Rdb78 07.07.2005
# extended by Mafs  10.07.2005, 24.07.2005
# extended by User:Arcy  07.09.2005
# Updated for MediaWiki 1.6 by User:piku 13.06.2006
# Update for Wikicode output, by User:cogdog 14.jul.2006
#
# Requires: 
#  * magpie rss parser <http://magpierss.sourceforge.net/>
#  * iconv <http://www.gnu.org/software/libiconv/>, see also <http://www.php.net/iconv>
#
# Installation:
#  * put this file (rss.php) into the extension directory of your mediawiki installation 
#  * add the following to the end of LocalSettings.php: include("extensions/rss.php");
#  * make sure magpie can be found by PHP.
#
# Usage:
#  Use one section between <rss>-tags for each feed. The rss section may contain parameters
#  separated by a pipe ("|"), just like links and templates. These parameters are supported:
#
#    * charset=...             The charset used by the feed. iconv is used to convert this.
#    * short                   Do not show the description text for each news item.
#    * max=x                   Shows x most recent headlines.
#    * highlight= term1 term2  The terms separated by a space are highlighted.
#    * filter= term1 term2     Show only rss items containing at least one of the terms.
#    * reverse                 display the rss items in reverse order.
#    * title=x                 display an alternative title instead of chanel name.
#    * title = none            dont display any title.
#
# Example: 
#    <rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss>
#

#change this according to your magpie installation!
require_once('rss_fetch.inc'); 

#install extension hook
$wgExtensionFunctions[] = "wfRssExtension"; 

#extension hook callback function
function wfRssExtension() { 
  global $wgParser;

  #install parser hook for <rss> tags
  $wgParser->setHook( "rss", "renderRss" );
}

#parser hook callback function
function renderRss($input, $argv, $parser = null) {
  if (!$parser) $parser =& $GLOBALS['wgParser'];
  global $wgOutputEncoding;

  $DefaultEncoding = "ISO-8859-1";
  $DisableCache = true;

  # $input = mysql_escape_string($input);

  if (!$input) return ""; #if <rss>-section is empty, return nothing

  #parse fields in rss-section
  $fields= explode("|",$input);
  $url= @$fields[0];

  $args= array();
  for ($i=1; $i<sizeof($fields); $i++) {
    $f= $fields[$i];

    if (strpos($f,"=")===False) $args[strtolower(trim($f))]= False;
    else {
      list($k,$v)= explode("=",$f,2);
      if (trim($v)==False) $args[strtolower(trim($k))] = False; 
      else $args[strtolower(trim($k))]= trim($v);
    }
  }

  #get charset from argument-array    
  $charset= @$args["charset"];
  if (!$charset) $charset= $DefaultEncoding;

  #get max number of headlines from argument-array
  $maxheads = @$args["max"];
  $headcnt = 0;

  #get short-flag from argument-array
  #if short is set, no description text is printed
  if (isset($args["short"])) $short = True; else $short = False;

  #get reverse-flag from argument-array
  if (isset($args["reverse"])) $reverse = True; else $reverse = False;

  #get highlight terms from argument-array    
  $rssHighlight= @$args["highlight"];
  $rssHighlight= str_replace("  "," ", $rssHighlight);
  $rssHighlight= explode(" ", trim($rssHighlight));

  #get filter terms from argument-array    
  $rssFilter= @$args["filter"];
  $rssFilter= str_replace("  "," ", $rssFilter);
  $rssFilter= explode(" ", trim($rssFilter));    

  #fetch rss. may be cached locally.
  #Refer to the documentation of magpie for details.
  $rss = @fetch_rss($url);


  #check for errors.
  if ($rss->ERROR) {
     # return "Feed error"; #localize...
      #return "<div>Failed to load RSS feed from $url: ".$rss->ERROR."</div>"; #localize...
  }

  if (!is_array($rss->items)) {
     # return "Feed error"; #localize...
      #return "<div>Failed to load RSS feed from $url!</div>"; #localize...
  }

  #Bild title line    
  #get title from argument-array    
  
  $rssTitle= @$args["title"];
  $rssTitle= trim($rssTitle);

  if ($rssTitle !=='none') {
    if ($rssTitle=='') {
        $title= iconv($charset,$wgOutputEncoding,$rss->channel['title']);
        if ($rss->channel['link']) $title= "[".$rss->channel['link']." $title]";
        $output = "=== $title ===\n";
    }
    else
    {
      $title= "[".$rss->channel['link']." $rssTitle]";
      $output="=== $title ===\n";
    }
  } else {
      $output="\n\n\n";
  }
  
  if ($reverse) $rss->items = array_reverse($rss->items);

  $description = False; 
  foreach ($rss->items as $item) {
      if ($item['description']) {$description = True; break;}
  }

  #Bild items
  if (!$short and $description) { #full item list

    $output.="";
    foreach ($rss->items as $item) {

      $d_text = true;
      $d_title = true;

      $href = trim(iconv($charset,$wgOutputEncoding,$item['link']));
      $title = trim(iconv($charset,$wgOutputEncoding,$item['title']));

      $d_title = wfRssFilter ($title, $rssFilter);
      $title= wfRssHighlight($title, $rssHighlight);

      #bild description text if desired
      if ($item["description"]) {
        $text= trim(iconv($charset,$wgOutputEncoding,$item['description']));

        #avoid pre-tags
        $text= str_replace("\r"," ",$text);
        $text= str_replace("\n"," ",$text);
        $text= str_replace("\t"," ",$text);

        $d_text = wfRssFilter ($text, $rssFilter);
        $text= wfRssHighlight($text, $rssHighlight);

        $display = $d_text or $d_title;

      }
        else   {
          $text = "";
          $display = $d_title;
        }       

      if ($display) {
        $output.="* [$href $title]";
        if ($text) $output.="<br>$text";
        $output .= "\n";
      }

    #Cut off output when maxheads is reached:
    if (++$headcnt == $maxheads)  break;

    }
    # $output.="</dl>";
  }
  else { #short item list
   #  $output.="<ul>";
    foreach ($rss->items as $item) {
      $href = trim(iconv($charset,$wgOutputEncoding,$item['link']));
      $title = trim(iconv($charset,$wgOutputEncoding,$item['title']));

        $d_title = wfRssFilter ($title, $rssFilter);
        $title= wfRssHighlight($title, $rssHighlight);

        if ($d_title ) $output.="* [$href $title]\n";

      #Cut off output when maxheads is reached:
      if (++$headcnt == $maxheads)  break;
    }
    # $output.="</ul>";
  }


  if ($DisableCache) {

    global $wgVersion;

    # Do not cache this wiki page.
    # for details see http://public.kitware.com/Wiki/User:Barre/MediaWiki/Extensions
    global $wgTitle, $wgDBprefix;
    $ts = mktime();
    $now = gmdate("YmdHis", $ts + 120);
    $ns = $wgTitle->getNamespace();
    $ti = wfStrencode($wgTitle->getDBkey());

    $version = preg_replace("/^([1-9]).([1-9]).*/", "\\1\\2", $wgVersion);
    if ($version>14) $sql = "UPDATE $wgDBprefix"."page SET page_touched='$now' WHERE page_namespace=$ns AND page_title='$ti'";
    else             $sql = "UPDATE $wgDBprefix"."cur SET cur_touched='$now' WHERE cur_namespace=$ns AND cur_title='$ti'";

    wfQuery($sql, DB_WRITE, "");
  }

  $out = $parser->parse ($output, $parser->mTitle,$parser->mOptions, true, false);
  return $out->getText();
}


function wfRssFilter ($text, $rssFilter) {

  $display = true;

  if (is_array($rssFilter)) {
    foreach($rssFilter as $term) {

      if ($term) {
        $display = false;
        if (preg_match("|$term|i", $text, $a))  {  $display = true; return $display; }
      }
    if ($display) break;
    }
  }
  return $display;
}


function wfRssHighlight($text, $rssHighlight) {

  $i=0;
  $starttag = "v8x5u3t3u8h";
  $endtag   = "q8n4f6n4n4x";

  $color[]="coral";
  $color[]="greenyellow";
  $color[]="lightskyblue";
  $color[]="gold";
  $color[]="violet";

  $count_color = count($color);

  if (is_array($rssHighlight)) {
    foreach($rssHighlight as $term) {
      if ($term) {
        $text = preg_replace("|\b(\w*?".$term."\w*?)\b|i", "$starttag"."_".$i."\\1$endtag", $text);
        $i++;
        if ($i == $count_color) $i=0;
        }
      }
    }
  # to avoid trouble should someone wants to highlight the terms "span", "style", ...
  for ($i=0; $i<5; $i++) {
    $text = preg_replace("|$starttag"."_".$i."|", "<span style=\"background-color:".$color[$i]."; font-weight: bold;\">", $text);
    $text = preg_replace("|$endtag|", "</span>", $text);
    }

  return $text;
}

?>