View Problem

Check your language appears on the langref.org site

Your language name should appear within the HTML found at the http://langreg.org main page.
ExpandDiskEdit
clojure
(def *url* "http://langref.org/")
(def *lang* "clojure")

(with-open [ stream (.openStream (URL. *url*)) ]
(let [ body (str (line-seq (BufferedReader. (InputStreamReader. stream)))) ]
(str "Language " *lang* " does "
(if-not (re-matches (re-pattern (str ".*" *url* *lang* ".*")) body) "not ")
"exist")))
ExpandDiskEdit
cpp C++/CLI .NET 2.0
HttpWebRequest^ httpReq = safe_cast<HttpWebRequest^>(WebRequest::Create(url)); httpReq->KeepAlive = false;
StreamReader^ httpStream = gcnew StreamReader(httpReq->GetResponse()->GetResponseStream());
String^ htmlPage = httpStream->ReadToEnd(); httpStream->Close();

Console::WriteLine("{0} {1} {2}", url, (htmlPage->IndexOf(url + language) > 0 ? "offers" : "does not offer"), language);
ExpandDiskEdit
erlang
URL = "http://langref.org/", Language = "erlang", Regexp = ".*" ++ URL ++ Language ++ ".*",

case http:request(URL) of
{ok, {_, _, Body}} ->
case regexp:first_match(Body, Regexp) of
{match, _, _} -> io:format("Language ~s exists @ ~s~n", [Language, URL]);
_ -> false
end;
{error, ErrorInfo} -> throw("Error: " ++ http:format_error(ErrorInfo))
end,
ExpandDiskEdit
fantom
language := "Fantom"
url := `http://langref.org/`

response := WebClient(url).getStr
if (Regex.fromStr("\\b$language.lower\\b").matcher(response).find)
echo("Language $language appears at ${url}.")
ExpandDiskEdit
fsharp
let httpReq = (WebRequest.Create(url) :?> HttpWebRequest)
httpReq.KeepAlive <- false
let httpStream = new StreamReader(httpReq.GetResponse().GetResponseStream())
let htmlPage = httpStream.ReadToEnd()
httpStream.Close()

let offerStatus = (if (htmlPage.IndexOf(url ^ language) > 0) then "offers" ; else "does not offer")
Console.WriteLine("{0} {1} {2}", url, offerStatus, language)
DiskEdit
groovy
assert new URL('http://langref.org').text.contains('groovy')
DiskEdit
haskell
{-# LANGUAGE OverloadedStrings #-}
import Control.Lens ((^.))
import Control.Monad (liftM)
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.Encoding as TL
import Network.Wreq (get, responseBody)

main = do
hasHaskell <- liftM
(\r -> (T.isInfixOf "haskell") . TL.decodeUtf8 $ r ^. responseBody)
(get "http://langref.org")

if hasHaskell then do
putStrLn "Haskell found"
else do
putStrLn "Haskell not found"
DiskEdit
haskell
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad (liftM)
import Data.Char (toLower)
import Data.List (isInfixOf)
import Network.HTTP (getRequest, getResponseBody, simpleHTTP)

main = do
hasHaskell <- liftM
(\body -> "haskell" `isInfixOf` (map toLower body))
(getResponseBody =<< simpleHTTP (getRequest "http://langref.org"))

if hasHaskell then do
putStrLn "Haskell found"
else do
putStrLn "Haskell not found"
ExpandDiskEdit
java
String url = "http://langref.org/", language = "java", line = null, regexp = ".*" + url + language + ".*";

BufferedReader in = new BufferedReader(new InputStreamReader((new URL(url)).openStream()));
while ((line = in.readLine()) != null)
if (line.matches(regexp)) { System.out.printf("Language %s exists @ %s\n", language, url); break; }

in.close();
DiskEdit
perl
# requires libwww-perl
use LWP::Simple;

if (grep /perl/, get('http://langref.org/')) {
print 'perl appears on langref.org';
} else {
print 'perl does not appear on langref.org';
}
ExpandDiskEdit
php
if (preg_match("/PHP/i", file_get_contents("http://langref.org/"))) {
echo "PHP appears on langref.org";
} else {
echo "PHP doesn't appear on langref.org";
}
DiskEdit
python
from urllib import urlopen
print urlopen('http://langref.org').read().find('python') >= 0 and 'found' or 'not found'
ExpandDiskEdit
ruby
Net::HTTP.start(URL, 80) do |http|
status = if http.get('/').body =~ /#{SRCHEXP}/ then "offers" else "does not offer" end
puts "http:\/\/#{URL} #{status} #{LANGUAGE}"
end
ExpandDiskEdit
scala
val url = "http://langref.org/" ; val language = "scala" ; val srchexp = url + language;

val source = Source.fromURL(url).getLines

while (source.hasNext) if (source.next.contains(srchexp)) printf("Language %s exists @ %s\n", language, url)

Submit a new solution for clojure, cpp, erlang, fantom ...
There is 1 other solution in go