Difference between revisions of "Template:Mainpage-rssfeeds"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
m
(RSS-Feed Mediawiki extension)
Line 7: Line 7:
 
http://meta.wikimedia.org/wiki/GISWiki/RSS
 
http://meta.wikimedia.org/wiki/GISWiki/RSS
  
 +
__NOTOC__
 
==RSS-Feed Mediawiki extension==
 
==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 <nowiki><rss>-tags for each feed. The rss section may contain parameters
 +
separated by a pipe ("|"), just like links and templates. These parameters are supported:
 +
</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.
 +
* 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:===
 +
<nowiki><rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss></nowiki>
 +
 +
<rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss>
 +
 
<pre><nowiki>
 
<pre><nowiki>
  

Revision as of 16:20, 29 July 2006

UNIQ8c62d8ad009f2f1b-rss-00000000-QINU UNIQ8c62d8ad009f2f1b-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>

Vine's Source Code Was Accidentally Made Public For Five Minutes

Tue, 26 Jul 2016 00:45:00

An anonymous reader writes from The Register: Vine, the six-second-video-loop app acquired by Twitter in 2012, had its source code made publicly available by a bounty-hunter for everyone to see. The Register reports: "According to this post by @avicoder (Vjex at GitHub), Vine's source code was for a while available on what was supposed to be a private Docker registry. While docker.vineapp.com, hosted at Amazon, wasn't meant to be available, @avicoder found he was able to download images with a simple pull request. After that it's all too easy: the docker pull https://docker.vineapp.com:443/library/vinewww request loaded the code, and he could then open the Docker image and run it. 'I was able to see the entire source code of Vine, its API keys and third party keys and secrets. Even running the image without any parameter, [it] was letting me host a replica of Vine locally.' The code included 'API keys, third party keys and secrets,' he writes. Twitter's bounty program paid out -- $10,080 -- and the problem was fixed in March (within five minutes of him demonstrating the issue)."

Share on Google+


Read more of this story at Slashdot.

Amazon Partners With UK Government To Test Drone Deliveries

Tue, 26 Jul 2016 00:05:00

An anonymous reader quotes a report from USA Today: [Recent rules from the Federal Aviation Administration mean delivery by drone is years away in the United States, but packages may be winging their way to customers sooner rather than later in the United Kingdom, where Amazon just got permission to begin a new trial of its delivery drones.] The U.K. Civil Aviation Authority gave Amazon permission to test several key drone delivery parameters. They include sending drones beyond the line of sight of their operator in rural and suburban areas, testing sensor performance to make sure the drones can identify and avoid obstacles and allowing a single operator to manage multiple highly-automated drones. U.S. rules are outlined in a 624-page rulebook from the Federal Aviation Administration. They allow commercial drones weighing up to 55 pounds to fly during daylight hours. The aircraft must remain within sight of the operator or an observer who is in communication with the operator. The operators must be pass an aeronautics test every 24 months for a certificate as well as a background check by the Transportation Security Administration. The rules govern commercial flights, such as for aerial photography or utilities inspection. Amazon's goal is to use drones to deliver packages up to 5 pound to customers in 30 minutes or less. Amazon released a statement today detailing its partnership with the UK Government that may one day turn its Prime Air drone delivery service into reality.

Share on Google+


Read more of this story at Slashdot.

China Releases Test Footage of Ballistic Missile Defense System

Mon, 25 Jul 2016 23:20:00

An anonymous reader quotes a report from Mirror.co.uk: China has released footage of its first interception test of a mid-air ballistic missile, destroying a target miles above Earth. Footage of the experiment, which took place in 2010, has never been made public until now. According to Chinese news agency CCTV, Xu Chunguang, an expert working at a military base in northwest China, said: "All of our research is meant to solve problems that may crop up in future actual combats." It reportedly took researchers another three years to develop the core technologies to improve the system. A second successful test was reportedly conducted in January 2013. China's decision to finally release the footage could be seen as a warning shot to the U.S., which was critical of China for not notifying the Pentagon of the tests at the time. In May, China announced it would send submarines armed with nuclear missiles into the Atlantic Ocean, arguing it had little choice if America continued to advance its weapons systems. China has recently denounced South Korea's decision to deploy a U.S. Terminal High Altitude Area Defense (THAAD) anti-missile system to counter threats from North Korea, saying that it harmed the foundation of their mutual trust.

Share on Google+


Read more of this story at Slashdot.

Nvidia Claims Its New Chip Is the 'World's Fastest GPU' for Game and VR Design

Mon, 25 Jul 2016 22:41:00

An anonymous reader shares a VentureBeat report: Nvidia announced today the Quadro P6000 graphics card for workstations, using the "world's fastest GPU." The graphics card is targeted at designers who have to create complex simulations for everything from engineering models to virtual reality games. The Quadro P6000 is based on Nvidia's new Pascal graphics architecture, and it uses a GPU with 3,840 processing cores. It can reach 12 teraflops of computing performance, or twice as fast as the previous generation. Nvidia unveiled the new platform for artists, designers, and animators at the Siggraph graphics technology conference in Anaheim, Calif. AnandTech has more details on this. From their article:As NVIDIA's impending flagship Quadro card, this is based on the just-announced GP102 GPU. The direct successor to the GM200 used in the Quadro M6000, the GP102 mixes a larger number of SMs/CUDA cores and higher clockspeeds to significantly boost performance. Paired with P6000 is 24GB of GDDR5X memory, running at a conservative 9Gbps, for a total memory bandwidth of 432GB/sec. This is the same amount of memory as in the 24GB M6000 refresh launched this spring, so there's no capacity boost at the top of NVIDIA's lineup. But for customers who didn't jump on the 24GB -- which is likely a lot of them, including most 12GB M6000 owners -- then this is a doubling (or more) of memory capacity compared to past Quadro cards. At this time the largest capacity GDDR5X memory chips we know of (8Gb), so this is as large of a capacity that P6000 can be built with at this time. Meanwhile this is so far the first and only Pascal card with GDDR5X to support ECC, with NVIDIA implementing an optional soft-ECC method for the DRAM only, just as was the case on M6000.

Share on Google+


Read more of this story at Slashdot.

Bitcoin Not Money, Rules Miami Judge In Dismissing Laundering Charges

Mon, 25 Jul 2016 22:00:00

An anonymous reader quotes a report from Miami Herald: Bitcoin does not actually qualify as money, a Miami-Dade judge ruled Monday in throwing out criminal charges against a Miami Beach man charged with illegally selling the virtual currency. The defendant, Michell Espinoza, was charged with illegally selling and laundering $1,500 worth of Bitcoins to undercover detectives who told him they wanted to use the money to buy stolen credit-card numbers. But Miami-Dade Circuit Judge Teresa Mary Pooler ruled that Bitcoin was not backed by any government or bank, and was not "tangible wealth" and "cannot be hidden under a mattress like cash and gold bars." "The court is not an expert in economics, however, it is very clear, even to someone with limited knowledge in the area, the Bitcoin has a long way to go before it the equivalent of money," Pooler wrote in an eight-page order. The judge also wrote that Florida law -- which says someone can be charged with money laundering if they engage in a financial transaction that will "promote" illegal activity -- is way too vague to apply to Bitcoin. "This court is unwilling to punish a man for selling his property to another, when his actions fall under a statute that is so vaguely written that even legal professionals have difficulty finding a singular meaning," she wrote. Espinoza's case is believed to be the first money-laundering prosecution involving Bitcoin.

Share on Google+


Read more of this story at Slashdot.


<?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;
}

?>