View Category

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.
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
cpp
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);
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}.")

Send an email

Use library functions, classes or objects to create a short email addressed to your own email address. The subject should be, "Greetings from langref.org", and the user should be prompted for the message body, and whether to cancel or proceed with sending the email.
ruby
require 'net/smtp'
require 'webrick/utils'

body = <<END_OF_MESSAGE
This is a message from langref.org
END_OF_MESSAGE

SMTPSRV = 'smtp.somewhere.com'
USER = 'me' ; DOMAIN = 'somewhere.com' ; FROM = USER + '@' + DOMAIN
TO = 'dest@somewhereelse.com'
SUBJECT = 'Greetings from langref.org'
DATE = Time.now.rfc2822()
MSGID = '<' + WEBrick::Utils.random_string(21) + '.' + WEBrick::Utils.random_string(21) + '@' + SMTPSRV + '>'

Net::SMTP.start(SMTPSRV, 25) do |smtp|
smtp.open_message_stream(FROM, [TO]) do |msg|
msg.puts "From: #{FROM}"
msg.puts "To: #{TO}"
msg.puts "Subject: #{SUBJECT}"
msg.puts "Date: #{DATE}"
msg.puts "Message-ID: #{MSGID}"
msg.puts
msg.puts body
end
end
fantom
// read message body
echo("Enter message body. End the message with '.' character on a separate line:")
in := Env.cur.in
buf := StrBuf()
line := in.readLine;
while (line != null)
{
if (line.trim == ".")
break;
buf.add(line)
line = in.readLine
}

// construct email
email := Email
{
to = [ "someone@somewhere" ]
from = "me@mydomain"
subject = "Greetings from langref.org"
body = TextPart { text = buf.toStr }
}
mailClient := SmtpClient
{
host = "smtp.somewhere.net"
username = "me"
password = "my password"
log.level = LogLevel.debug
}

// send or abort
echo("Send email '$email.subject' to $email.to?: ");
line = in.readLine
echo("response=$line")
if (line?.trim.compareIgnoreCase("y") == 0)
mailClient.send(email)
else
echo("Aborted!")