<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://robowiki.net/w/index.php?action=history&amp;feed=atom&amp;title=FixingParticipantLinks</id>
	<title>FixingParticipantLinks - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://robowiki.net/w/index.php?action=history&amp;feed=atom&amp;title=FixingParticipantLinks"/>
	<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=FixingParticipantLinks&amp;action=history"/>
	<updated>2026-04-27T04:18:00Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>http://robowiki.net/w/index.php?title=FixingParticipantLinks&amp;diff=51493&amp;oldid=prev</id>
		<title>Beaming: Created page with &quot;Unfortunately, links to bots' jar files became rotten. Sometimes the hosting website goes down, sometimes API is changed. Luckily we have [http://robocode-archive.strangeautom...&quot;</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=FixingParticipantLinks&amp;diff=51493&amp;oldid=prev"/>
		<updated>2017-09-08T03:06:09Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Unfortunately, links to bots&amp;#039; jar files became rotten. Sometimes the hosting website goes down, sometimes API is changed. Luckily we have [http://robocode-archive.strangeautom...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Unfortunately, links to bots' jar files became rotten. Sometimes the hosting website goes down, sometimes API is changed. Luckily we have [http://robocode-archive.strangeautomata.com archive]. To fix a link to a workable one, just replace the bad link to the archived one. You can do it by hand for your favorite bot or you can run the script below&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# Check rumble page for bots with rotten links.&lt;br /&gt;
# If possible replace the bad link with the one pointing to archive&lt;br /&gt;
#  http://robocode-archive.strangeautomata.com/robots/&lt;br /&gt;
&lt;br /&gt;
archiveURL=&amp;quot;http://robocode-archive.strangeautomata.com/robots&amp;quot;&lt;br /&gt;
archiveRegEx=&amp;quot;robocode-archive.strangeautomata.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
logFile=&amp;quot;changes.log&amp;quot;&lt;br /&gt;
&lt;br /&gt;
PARTICIPANTSURL=&amp;quot;http://robowiki.net/wiki/RoboRumble/Participants?action=raw&amp;quot;&lt;br /&gt;
TAGbegin=&amp;quot;&amp;lt;pre&amp;gt;&amp;quot;&lt;br /&gt;
TAGend=&amp;quot;&amp;lt;\/pre&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
goodJarRegEx=&amp;quot;\(Java archive data (JAR)\)\|\(Zip\)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# mw extension stands for MediaWiki&lt;br /&gt;
wikiPageFileWeb=Participants.Web.mw&lt;br /&gt;
wikiPageFileFixed=Participants.Fixed.mw&lt;br /&gt;
&lt;br /&gt;
function getParticipantsPage () {&lt;br /&gt;
&lt;br /&gt;
	curl --silent --max-time 10 &amp;quot;$1&amp;quot; &amp;gt; &amp;quot;$wikiPageFileWeb&amp;quot; || { echo &amp;quot;ERROR: cannot download participant Wiki Page at $1&amp;quot;; exit 1; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getBotsList () {&lt;br /&gt;
	cat &amp;quot;$1&amp;quot; | sed -e 0,/$TAGbegin/d  -e /&amp;quot;$TAGend&amp;quot;/,\$d&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getHeader () {&lt;br /&gt;
	cat &amp;quot;$1&amp;quot; | sed -ne 0,/$TAGbegin/p&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getFooter () {&lt;br /&gt;
	cat &amp;quot;$1&amp;quot; | sed -ne /$TAGend/,\$p&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function isUrlValidJar () {&lt;br /&gt;
	# url pointing to archive are assumed good&lt;br /&gt;
	echo &amp;quot;$1&amp;quot; | grep -q -i &amp;quot;$archiveRegEx&amp;quot;   &amp;amp;&amp;amp; return 0&lt;br /&gt;
	# we need about 100 bytes to see if URL is JAR&lt;br /&gt;
	curl --silent --location --max-time 10 --range 0-100 &amp;quot;$1&amp;quot; \&lt;br /&gt;
		| file --brief - | grep -q &amp;quot;$goodJarRegEx&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function makeArchiveURLforBotName () {&lt;br /&gt;
	echo &amp;quot;$archiveURL&amp;quot;/&amp;quot;$1&amp;quot;.jar|sed -e s'/ \+/_/g'&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function fixParticipantsLinks () {&lt;br /&gt;
	#reads stdin&lt;br /&gt;
	inRobotsList=0&lt;br /&gt;
	while read ln&lt;br /&gt;
	do&lt;br /&gt;
		botName=`echo &amp;quot;$ln&amp;quot; | cut -d , -f 1`&lt;br /&gt;
		botURL=`echo &amp;quot;$ln&amp;quot; | cut -d , -f 2`&lt;br /&gt;
		if  (isUrlValidJar &amp;quot;$botURL&amp;quot;)&lt;br /&gt;
		then&lt;br /&gt;
			#echo url is good&lt;br /&gt;
			echo $ln&lt;br /&gt;
		else&lt;br /&gt;
			# echo url is rotten&lt;br /&gt;
			# making archive url&lt;br /&gt;
			# replacing white spaces with one underscore&lt;br /&gt;
			newUrl=`makeArchiveURLforBotName &amp;quot;$botName&amp;quot;`&lt;br /&gt;
&lt;br /&gt;
			# checking that archive has this bot jar&lt;br /&gt;
			if (isUrlValidJar &amp;quot;$newUrl&amp;quot;)&lt;br /&gt;
			then&lt;br /&gt;
				echo $botName,$newUrl&lt;br /&gt;
				echo &amp;quot;Replacing link for $botName with achieved one&amp;quot; &amp;gt;&amp;gt; &amp;quot;$logFile&amp;quot;&lt;br /&gt;
				echo &amp;quot;   old rotten link was&amp;quot; &amp;gt;&amp;gt; &amp;quot;$logFile&amp;quot;&lt;br /&gt;
			        echo &amp;quot;      $botURL&amp;quot; &amp;gt;&amp;gt; &amp;quot;$logFile&amp;quot;&lt;br /&gt;
				echo &amp;quot;   new link is&amp;quot; &amp;gt;&amp;gt; &amp;quot;$logFile&amp;quot;&lt;br /&gt;
		      		echo &amp;quot;      $newUrl&amp;quot; &amp;gt;&amp;gt; &amp;quot;$logFile&amp;quot;&lt;br /&gt;
			else&lt;br /&gt;
				echo &amp;quot;Removing all records for $botName. The link is rotten and no archived Jar file&amp;quot; &amp;gt;&amp;gt; &amp;quot;$logFile&amp;quot;&lt;br /&gt;
			       	echo &amp;quot;	  old record was&amp;quot; &amp;gt;&amp;gt; $logFile&lt;br /&gt;
		      		echo &amp;quot;        $ln&amp;quot; &amp;gt;&amp;gt; &amp;quot;$logFile&amp;quot;&lt;br /&gt;
			fi&lt;br /&gt;
		fi&lt;br /&gt;
	done&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
getParticipantsPage &amp;quot;$PARTICIPANTSURL&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;=============================================&amp;quot; &amp;gt;&amp;gt; &amp;quot;$logFile&amp;quot;&lt;br /&gt;
date &amp;gt;&amp;gt; &amp;quot;$logFile&amp;quot;&lt;br /&gt;
echo &amp;quot;=============================================&amp;quot; &amp;gt;&amp;gt; &amp;quot;$logFile&amp;quot;&lt;br /&gt;
&lt;br /&gt;
getHeader &amp;quot;$wikiPageFileWeb&amp;quot; &amp;gt; &amp;quot;$wikiPageFileFixed&amp;quot;&lt;br /&gt;
getBotsList &amp;quot;$wikiPageFileWeb&amp;quot; | fixParticipantsLinks &amp;gt;&amp;gt; &amp;quot;$wikiPageFileFixed&amp;quot;&lt;br /&gt;
getFooter &amp;quot;$wikiPageFileWeb&amp;quot; &amp;gt;&amp;gt; &amp;quot;$wikiPageFileFixed&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo Ready to upload Wiki page with fixed links is in the file &amp;quot;$wikiPageFileFixed&amp;quot;&lt;br /&gt;
echo Below are the changes done to its originanl stored in &amp;quot;$wikiPageFileWeb&amp;quot;&lt;br /&gt;
diff -u &amp;quot;$wikiPageFileWeb&amp;quot; &amp;quot;$wikiPageFileFixed&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Beaming</name></author>
		
	</entry>
</feed>