task_url stringlengths 30 116 | task_name stringlengths 2 86 | task_description stringlengths 0 14.4k | language_url stringlengths 2 53 | language_name stringlengths 1 52 | code stringlengths 0 61.9k |
|---|---|---|---|---|---|
http://rosettacode.org/wiki/HTTPS/Authenticated | HTTPS/Authenticated | The goal of this task is to demonstrate HTTPS requests with authentication.
Implementations of this task should not use client certificates for this: that is the subject of another task.
| #Ruby | Ruby | require 'uri'
require 'net/http'
uri = URI.parse('https://www.example.com')
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
request = Net::HTTP::Get.new uri
request.basic_auth('username', 'password')
http.request request
end |
http://rosettacode.org/wiki/HTTPS | HTTPS | Task
Send a GET request to obtain the resource located at the URL "https://www.w3.org/", then print it to the console.
Checking the host certificate for validity is recommended.
Do not authenticate. That is the subject of other tasks.
Readers may wish to contrast with the HTTP Request task, and also the task on HTT... | #C.23 | C# |
using System;
using System.Net;
class Program
{
static void Main(string[] args)
{
var client = new WebClient();
var data = client.DownloadString("https://www.google.com");
Console.WriteLine(data);
}
}
|
http://rosettacode.org/wiki/HTTPS | HTTPS | Task
Send a GET request to obtain the resource located at the URL "https://www.w3.org/", then print it to the console.
Checking the host certificate for validity is recommended.
Do not authenticate. That is the subject of other tasks.
Readers may wish to contrast with the HTTP Request task, and also the task on HTT... | #Clojure | Clojure |
(use '[clojure.contrib.duck-streams :only (slurp*)])
(print (slurp* "https://sourceforge.net"))
|
http://rosettacode.org/wiki/Huffman_coding | Huffman coding | Huffman encoding is a way to assign binary codes to symbols that reduces the overall number of bits used to encode a typical string of those symbols.
For example, if you use letters as symbols and have details of the frequency of occurrence of those letters in typical strings, then you could just encode each letter wi... | #Ada | Ada | with Ada.Containers.Indefinite_Ordered_Maps;
with Ada.Containers.Ordered_Maps;
with Ada.Finalization;
generic
type Symbol_Type is private;
with function "<" (Left, Right : Symbol_Type) return Boolean is <>;
with procedure Put (Item : Symbol_Type);
type Symbol_Sequence is array (Positive range <>) of Symbol_... |
http://rosettacode.org/wiki/Host_introspection | Host introspection | Print the word size and endianness of the host machine.
See also: Variable size/Get
| #Applesoft_BASIC | Applesoft BASIC | 1 DATA248,169,153,24,105,1,48
2 DATA6,24,251,144,2,251,56
3 DATA216,105,0,133,251,96
4 FOR I = 768 TO 787
5 READ B: POKE I,B: NEXT
6 CALL 768:M = PEEK (251)
7 PRINT " WORD SIZE: ";
8 IF NOT M THEN PRINT 8
9 M$ = "HYBRID 8/16"
10 IF M THEN PRINT M$
11 PRINT "ENDIANNESS: ";
12 PRINT "LITTLE-ENDIAN" |
http://rosettacode.org/wiki/Host_introspection | Host introspection | Print the word size and endianness of the host machine.
See also: Variable size/Get
| #ARM_Assembly | ARM Assembly | EndianTest:
mov r0,#0xFF
mov r1,#0x02000000 ;an arbitrary memory location on the Game Boy Advance.
;(The GBA is always little-endian but this test doesn't use that knowledge to prove it.)
str r0,[r1] ;on a little-endian CPU a hexdump of 0x02000000 would be: FF 00 00 00
... |
http://rosettacode.org/wiki/Hostname | Hostname | Task
Find the name of the host on which the routine is running.
| #AWK | AWK | $ awk 'BEGIN{print ENVIRON["HOST"]}'
E51A08ZD |
http://rosettacode.org/wiki/Hostname | Hostname | Task
Find the name of the host on which the routine is running.
| #BaCon | BaCon | PRINT "Hostname: ", HOSTNAME$ |
http://rosettacode.org/wiki/Hostname | Hostname | Task
Find the name of the host on which the routine is running.
| #Batch_File | Batch File | Hostname |
http://rosettacode.org/wiki/IBAN | IBAN |
This page uses content from Wikipedia. The original article was at IBAN. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance)
The International Bank Account Number (IBAN) is an internationally agree... | #Ring | Ring |
# Project : IBAN
codes = list(5)
codes[1] = "GB82 WEST 1234 5698 7654 32"
codes[2] = "GB82 TEST 1234 5698 7654 32"
codes[3] = "GB81 WEST 1234 5698 7654 32"
codes[4] = "SA03 8000 0000 6080 1016 7519"
codes[5] = "CH93 0076 2011 6238 5295 7"
for y = 1 to len(codes)
see codes[y]
flag = 1
codes[y] = ... |
http://rosettacode.org/wiki/Hough_transform | Hough transform | Task
Implement the Hough transform, which is used as part of feature extraction with digital images.
It is a tool that makes it far easier to identify straight lines in the source image, whatever their orientation.
The transform maps each point in the target image,
(
ρ
,
θ
)
{\displaystyle (\rho ,\theta )}
, ... | #D | D | import std.math, grayscale_image;
Image!Gray houghTransform(in Image!Gray im,
in size_t hx=460, in size_t hy=360)
pure nothrow in {
assert(im !is null);
assert(hx > 0 && hy > 0);
assert((hy & 1) == 0, "hy argument must be even.");
} body {
auto result = new Image!Gray(hx, hy)... |
http://rosettacode.org/wiki/Identity_matrix | Identity matrix | Task
Build an identity matrix of a size known at run-time.
An identity matrix is a square matrix of size n × n,
where the diagonal elements are all 1s (ones),
and all the other elements are all 0s (zeroes).
I
n
=
[
1
0
0
⋯
0
0
1
0
⋯
0
0
0
1
⋯
0
⋮
⋮
⋮
⋱
... | #Lambdatalk | Lambdatalk |
{def identity
{lambda {:n}
{A.new {S.map {{lambda {:n :i}
{A.new {S.map {{lambda {:i :j}
{if {= :i :j} then 1 else 0} } :i}
{S.serie 0 :n}}}} :n}
{S.serie 0 :n}} }}}
-> identity
{identity 2}
-> [[1,0],[0,1]]
{identity 5}
-> [[1,0,0,0,0],[0,1,0,0,0],[0,0,1,0,0... |
http://rosettacode.org/wiki/I_before_E_except_after_C | I before E except after C | The phrase "I before E, except after C" is a
widely known mnemonic which is supposed to help when spelling English words.
Task
Using the word list from http://wiki.puzzlers.org/pub/wordlists/unixdict.txt,
check if the two sub-clauses of the phrase are plausible individually:
"I before E when not pre... | #Scala | Scala | object I_before_E_except_after_C extends App {
val testIE1 = "(^|[^c])ie".r // i before e when not preceded by c
val testIE2 = "cie".r // i before e when preceded by c
var countsIE = (0,0)
val testCEI1 = "cei".r // e before i when preceded by c
val testCEI2 = "(^|[^c])ei".r // e before i when not preceded b... |
http://rosettacode.org/wiki/Increment_a_numerical_string | Increment a numerical string | Task
Increment a numerical string.
| #OCaml | OCaml | string_of_int (succ (int_of_string "1234")) |
http://rosettacode.org/wiki/Increment_a_numerical_string | Increment a numerical string | Task
Increment a numerical string.
| #Octave | Octave | nstring = "123";
nstring = sprintf("%d", str2num(nstring) + 1);
disp(nstring); |
http://rosettacode.org/wiki/Integer_comparison | Integer comparison |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #Maple | Maple | CompareNumbers := proc( )
local a, b;
printf( "Enter a number:> " );
a := parse(readline());
printf( "Enter another number:> " );
b := parse(readline());
if a < b then
printf("The first number is less than the second");
elif a = b then
printf("The first number is equal to the... |
http://rosettacode.org/wiki/Integer_comparison | Integer comparison |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #Mathematica_.2F_Wolfram_Language | Mathematica / Wolfram Language | a=Input["Give me the value for a please!"];
b=Input["Give me the value for b please!"];
If[a==b,Print["a equals b"]]
If[a>b,Print["a is bigger than b"]]
If[a<b,Print["b is bigger than a"]] |
http://rosettacode.org/wiki/HTTPS/Authenticated | HTTPS/Authenticated | The goal of this task is to demonstrate HTTPS requests with authentication.
Implementations of this task should not use client certificates for this: that is the subject of another task.
| #Run_BASIC | Run BASIC | html "
<CENTER><TABLE CELLPADDING=0 CELLSPACING=0 border=1 bgcolor=wheat>
<TR><TD colspan=2 bgcolor=tan align=center>LOGIN</TD></TR>
<TR><TD align=right>UserName</TD><TD>"
TEXTBOX #userName, ""
html "</TR></TD><TR><TD align=right>Password:</TD><TD>"
PasswordBox #passWord, ""
html "</TD></TR><TD align=center cols... |
http://rosettacode.org/wiki/HTTPS/Authenticated | HTTPS/Authenticated | The goal of this task is to demonstrate HTTPS requests with authentication.
Implementations of this task should not use client certificates for this: that is the subject of another task.
| #Rust | Rust |
extern crate reqwest;
use reqwest::blocking::Client;
use reqwest::header::CONNECTION;
fn main() {
let client = Client::new();
// reqwest uses strongly-typed structs for creating headers
let res = client
.get("https://www.example.com")
.basic_auth("user", Some("password"))
.he... |
http://rosettacode.org/wiki/HTTPS/Authenticated | HTTPS/Authenticated | The goal of this task is to demonstrate HTTPS requests with authentication.
Implementations of this task should not use client certificates for this: that is the subject of another task.
| #Scala | Scala | import java.net.{Authenticator, PasswordAuthentication, URL}
import javax.net.ssl.HttpsURLConnection
import scala.io.BufferedSource
object Authenticated extends App {
val con: HttpsURLConnection =
new URL("https://somehost.com").openConnection().asInstanceOf[HttpsURLConnection]
object PasswordAuthen... |
http://rosettacode.org/wiki/HTTPS | HTTPS | Task
Send a GET request to obtain the resource located at the URL "https://www.w3.org/", then print it to the console.
Checking the host certificate for validity is recommended.
Do not authenticate. That is the subject of other tasks.
Readers may wish to contrast with the HTTP Request task, and also the task on HTT... | #D | D |
auto data = get("https://sourceforge.net");
writeln(data);
|
http://rosettacode.org/wiki/HTTPS | HTTPS | Task
Send a GET request to obtain the resource located at the URL "https://www.w3.org/", then print it to the console.
Checking the host certificate for validity is recommended.
Do not authenticate. That is the subject of other tasks.
Readers may wish to contrast with the HTTP Request task, and also the task on HTT... | #Common_Lisp | Common Lisp |
(defun wget-drakma-string (url &optional (out *standard-output*))
"Grab the body as a string, and write it to out."
(write-string (drakma:http-request url) out))
(defun wget-drakma-stream (url &optional (out *standard-output*))
"Grab the body as a stream, and write it to out."
(loop with body = (drakma:http... |
http://rosettacode.org/wiki/Huffman_coding | Huffman coding | Huffman encoding is a way to assign binary codes to symbols that reduces the overall number of bits used to encode a typical string of those symbols.
For example, if you use letters as symbols and have details of the frequency of occurrence of those letters in typical strings, then you could just encode each letter wi... | #BBC_BASIC | BBC BASIC | INSTALL @lib$+"SORTSALIB"
SortUp% = FN_sortSAinit(0,0) : REM Ascending
SortDn% = FN_sortSAinit(1,0) : REM Descending
Text$ = "this is an example for huffman encoding"
DIM tree{(127) ch&, num%, lkl%, lkr%}
FOR i% = 1 TO LEN(Text$)
c% = ASCMID$(Text$,i%)
tree{(c%)}.... |
http://rosettacode.org/wiki/Host_introspection | Host introspection | Print the word size and endianness of the host machine.
See also: Variable size/Get
| #Babel | Babel | main :
{ "Word size: " << msize 3 shl %d << " bits" cr <<
"Endianness: " << { endian } { "little" } { "big" } ifte cr << } |
http://rosettacode.org/wiki/Host_introspection | Host introspection | Print the word size and endianness of the host machine.
See also: Variable size/Get
| #BBC_BASIC | BBC BASIC | DIM P% 8
!P% = -1
I% = 0 : REPEAT I% += 1 : UNTIL P%?I%=0
PRINT "Word size = " ; I% " bytes"
!P% = 1
IF P%?0 = 1 THEN PRINT "Little-endian"
IF P%?(I%-1) = 1 THEN PRINT "Big-endian" |
http://rosettacode.org/wiki/Host_introspection | Host introspection | Print the word size and endianness of the host machine.
See also: Variable size/Get
| #C | C | #include <stdio.h>
#include <stddef.h> /* for size_t */
#include <limits.h> /* for CHAR_BIT */
int main() {
int one = 1;
/*
* Best bet: size_t typically is exactly one word.
*/
printf("word size = %d bits\n", (int)(CHAR_BIT * sizeof(size_t)));
/*
* Check if the least significant bit... |
http://rosettacode.org/wiki/Hostname | Hostname | Task
Find the name of the host on which the routine is running.
| #BBC_BASIC | BBC BASIC | INSTALL @lib$+"SOCKLIB"
PROC_initsockets
PRINT "hostname: " FN_gethostname
PROC_exitsockets |
http://rosettacode.org/wiki/Hostname | Hostname | Task
Find the name of the host on which the routine is running.
| #C.2FC.2B.2B | C/C++ | #include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <unistd.h>
int main(void)
{
char name[_POSIX_HOST_NAME_MAX + 1];
return gethostname(name, sizeof name) == -1 || printf("%s\n", name) < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
} |
http://rosettacode.org/wiki/IBAN | IBAN |
This page uses content from Wikipedia. The original article was at IBAN. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance)
The International Bank Account Number (IBAN) is an internationally agree... | #Ruby | Ruby | def valid_iban? iban
len = {
AL: 28, AD: 24, AT: 20, AZ: 28, BE: 16, BH: 22, BA: 20, BR: 29,
BG: 22, CR: 21, HR: 21, CY: 28, CZ: 24, DK: 18, DO: 28, EE: 20,
FO: 18, FI: 18, FR: 27, GE: 22, DE: 22, GI: 23, GR: 27, GL: 18,
GT: 28, HU: 28, IS: 26, IE: 22, IL: 23, IT: 27, KZ: 20, KW: 30,
LV: 21, LB: 2... |
http://rosettacode.org/wiki/Hough_transform | Hough transform | Task
Implement the Hough transform, which is used as part of feature extraction with digital images.
It is a tool that makes it far easier to identify straight lines in the source image, whatever their orientation.
The transform maps each point in the target image,
(
ρ
,
θ
)
{\displaystyle (\rho ,\theta )}
, ... | #Go | Go | package main
import (
"fmt"
"image"
"image/color"
"image/draw"
"image/png"
"math"
"os"
)
func hough(im image.Image, ntx, mry int) draw.Image {
nimx := im.Bounds().Max.X
mimy := im.Bounds().Max.Y
him := image.NewGray(image.Rect(0, 0, ntx, mry))
draw.Draw(him, him.Bounds(... |
http://rosettacode.org/wiki/Identity_matrix | Identity matrix | Task
Build an identity matrix of a size known at run-time.
An identity matrix is a square matrix of size n × n,
where the diagonal elements are all 1s (ones),
and all the other elements are all 0s (zeroes).
I
n
=
[
1
0
0
⋯
0
0
1
0
⋯
0
0
0
1
⋯
0
⋮
⋮
⋮
⋱
... | #Lang5 | Lang5 | : identity-matrix
dup iota 'A set
: i.(*) A in ;
[1] swap append reverse A swap reshape 'i. apply
;
5 identity-matrix . |
http://rosettacode.org/wiki/I_before_E_except_after_C | I before E except after C | The phrase "I before E, except after C" is a
widely known mnemonic which is supposed to help when spelling English words.
Task
Using the word list from http://wiki.puzzlers.org/pub/wordlists/unixdict.txt,
check if the two sub-clauses of the phrase are plausible individually:
"I before E when not pre... | #Seed7 | Seed7 | $ include "seed7_05.s7i";
include "gethttp.s7i";
include "float.s7i";
const integer: PLAUSIBILITY_RATIO is 2;
const func boolean: plausibilityCheck (in string: comment, in integer: x, in integer: y) is func
result
var boolean: plausible is FALSE;
begin
writeln(" Checking plausibility of: " <& comme... |
http://rosettacode.org/wiki/Increment_a_numerical_string | Increment a numerical string | Task
Increment a numerical string.
| #Oforth | Oforth | "999" 1 + println
"999" asInteger 1 + asString println |
http://rosettacode.org/wiki/Increment_a_numerical_string | Increment a numerical string | Task
Increment a numerical string.
| #OoRexx | OoRexx | i=1
i+=1
Say i |
http://rosettacode.org/wiki/Integer_comparison | Integer comparison |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #Maxima | Maxima | /* all 6 comparison operators (last is "not equal") */
block(
[a: read("a?"), b: read("b?")],
if a < b then print(a, "<", b),
if a <= b then print(a, "<=", b),
if a > b then print(a, ">", b),
if a >= b then print(a, ">=", b),
if a = b then print(a, "=", b),
if a # b then print(a, "#", b))$ |
http://rosettacode.org/wiki/Integer_comparison | Integer comparison |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #MAXScript | MAXScript | a = getKBValue prompt:"Enter value of a:"
b = getKBValue prompt:"Enter value of b:"
if a < b then print "a is less then b"
else if a > b then print "a is greater then b"
else if a == b then print "a is equal to b" |
http://rosettacode.org/wiki/HTTPS/Authenticated | HTTPS/Authenticated | The goal of this task is to demonstrate HTTPS requests with authentication.
Implementations of this task should not use client certificates for this: that is the subject of another task.
| #Sidef | Sidef | require('WWW::Mechanize')
var mech = %s'WWW::Mechanize'.new(
cookie_jar => Hash.new,
agent => 'Mozilla/5.0',
)
mech.get('https://login.yahoo.com/')
mech.submit_form(
form_id => 'mbr-login-form', # form id
fields => Hash.new(
'login' => 'XXXXXX',
'passwd' => 'YYYYYY',
)) |
http://rosettacode.org/wiki/HTTPS/Authenticated | HTTPS/Authenticated | The goal of this task is to demonstrate HTTPS requests with authentication.
Implementations of this task should not use client certificates for this: that is the subject of another task.
| #Tcl | Tcl | package require http
package require tls
http::register https 443 ::tls::socket
# Generate the authentication
set user theUser
set pass thePassword
dict set auth Authenticate "Basic [binary encode base64 ${user}:${pass}]"
# Make a secure authenticated connection
set token [http::geturl https://secure.example.com/ -... |
http://rosettacode.org/wiki/HTTPS | HTTPS | Task
Send a GET request to obtain the resource located at the URL "https://www.w3.org/", then print it to the console.
Checking the host certificate for validity is recommended.
Do not authenticate. That is the subject of other tasks.
Readers may wish to contrast with the HTTP Request task, and also the task on HTT... | #Delphi | Delphi |
program ShowHTTPS;
{$APPTYPE CONSOLE}
uses IdHttp, IdSSLOpenSSL;
var
s: string;
lHTTP: TIdHTTP;
begin
lHTTP := TIdHTTP.Create(nil);
try
lHTTP.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(lHTTP);
lHTTP.HandleRedirects := True;
s := lHTTP.Get('https://sourceforge.net/');
Writeln(s);
... |
http://rosettacode.org/wiki/HTTPS | HTTPS | Task
Send a GET request to obtain the resource located at the URL "https://www.w3.org/", then print it to the console.
Checking the host certificate for validity is recommended.
Do not authenticate. That is the subject of other tasks.
Readers may wish to contrast with the HTTP Request task, and also the task on HTT... | #EchoLisp | EchoLisp |
;; asynchronous call back definition
(define (success name text) (writeln 'Loaded name) (writeln text))
;;
(file->string success "https:/sourceforge.net")
|
http://rosettacode.org/wiki/Huffman_coding | Huffman coding | Huffman encoding is a way to assign binary codes to symbols that reduces the overall number of bits used to encode a typical string of those symbols.
For example, if you use letters as symbols and have details of the frequency of occurrence of those letters in typical strings, then you could just encode each letter wi... | #Bracmat | Bracmat | ( "this is an example for huffman encoding":?S
& 0:?chars
& 0:?p
& ( @( !S
: ?
( [!p %?char [?p ?
& !char+!chars:?chars
& ~
)
)
|
)
& 0:?prioritized
& whl
' ( !chars:?n*%@?w+?chars
& (!n.!w)+!prioritized:?prioritized
)
& whl
' ( !prioritized:(?p.?x)+(... |
http://rosettacode.org/wiki/Host_introspection | Host introspection | Print the word size and endianness of the host machine.
See also: Variable size/Get
| #C.23 | C# | static void Main()
{
Console.WriteLine("Word size = {0} bytes,",sizeof(int));
if (BitConverter.IsLittleEndian)
Console.WriteLine("Little-endian.");
else
Console.WriteLine("Big-endian.");
} |
http://rosettacode.org/wiki/Hostname | Hostname | Task
Find the name of the host on which the routine is running.
| #C.23 | C# | System.Net.Dns.GetHostName(); |
http://rosettacode.org/wiki/Hostname | Hostname | Task
Find the name of the host on which the routine is running.
| #Cach.C3.A9_ObjectScript | Caché ObjectScript | Write ##class(%SYS.System).GetNodeName() |
http://rosettacode.org/wiki/IBAN | IBAN |
This page uses content from Wikipedia. The original article was at IBAN. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance)
The International Bank Account Number (IBAN) is an internationally agree... | #Rust | Rust |
fn main() {
for iban in [
"",
"x",
"QQ82",
"QQ82W",
"GB82 TEST 1234 5698 7654 322",
"gb82 WEST 1234 5698 7654 32",
"GB82 WEST 1234 5698 7654 32",
"GB82 TEST 1234 5698 7654 32",
"GB81 WEST 1234 5698 7654 32",
"SA03 8000 0000 6080 1016 ... |
http://rosettacode.org/wiki/Hough_transform | Hough transform | Task
Implement the Hough transform, which is used as part of feature extraction with digital images.
It is a tool that makes it far easier to identify straight lines in the source image, whatever their orientation.
The transform maps each point in the target image,
(
ρ
,
θ
)
{\displaystyle (\rho ,\theta )}
, ... | #Haskell | Haskell | import Control.Monad (forM_, when)
import Data.Array ((!))
import Data.Array.ST (newArray, writeArray, readArray, runSTArray)
import qualified Data.Foldable as F (maximum)
import System.Environment (getArgs, getProgName)
-- Library JuicyPixels:
import Codec.Picture
(DynamicImage(ImageRGB8, ImageRGBA8), Image, ... |
http://rosettacode.org/wiki/Identity_matrix | Identity matrix | Task
Build an identity matrix of a size known at run-time.
An identity matrix is a square matrix of size n × n,
where the diagonal elements are all 1s (ones),
and all the other elements are all 0s (zeroes).
I
n
=
[
1
0
0
⋯
0
0
1
0
⋯
0
0
0
1
⋯
0
⋮
⋮
⋮
⋱
... | #LFE | LFE |
(defun identity
((`(,m ,n))
(identity m n))
((m)
(identity m m)))
(defun identity (m n)
(lists:duplicate m (lists:duplicate n 1)))
|
http://rosettacode.org/wiki/I_before_E_except_after_C | I before E except after C | The phrase "I before E, except after C" is a
widely known mnemonic which is supposed to help when spelling English words.
Task
Using the word list from http://wiki.puzzlers.org/pub/wordlists/unixdict.txt,
check if the two sub-clauses of the phrase are plausible individually:
"I before E when not pre... | #Swift | Swift | import Foundation
let request = NSURLRequest(URL: NSURL(string: "http://wiki.puzzlers.org/pub/wordlists/unixdict.txt")!)
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue()) {res, data, err in
if (data != nil) {
if let fileAsString = NSString(data: data, encoding: NSUTF8StringEnco... |
http://rosettacode.org/wiki/Increment_a_numerical_string | Increment a numerical string | Task
Increment a numerical string.
| #OpenEdge.2FProgress | OpenEdge/Progress | DEFINE VARIABLE cc AS CHARACTER INITIAL "12345".
MESSAGE
INTEGER( cc ) + 1
VIEW-AS ALERT-BOX. |
http://rosettacode.org/wiki/Increment_a_numerical_string | Increment a numerical string | Task
Increment a numerical string.
| #Oz | Oz | {Int.toString {String.toInt "12345"} + 1} |
http://rosettacode.org/wiki/Integer_comparison | Integer comparison |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #Metafont | Metafont | message "integer 1: ";
a1 := scantokens readstring;
message "integer 2: ";
a2 := scantokens readstring;
if a1 < a2:
message decimal a1 & " is less than " & decimal a2
elseif a1 > a2:
message decimal a1 & " is greater than " & decimal a2
elseif a1 = a2:
message decimal a1 & " is equal to " & decimal a2
fi;
end |
http://rosettacode.org/wiki/HTTPS/Authenticated | HTTPS/Authenticated | The goal of this task is to demonstrate HTTPS requests with authentication.
Implementations of this task should not use client certificates for this: that is the subject of another task.
| #Visual_Basic | Visual Basic | Sub Main()
' in the "references" dialog of the IDE, check
' "Microsoft WinHTTP Services, version 5.1" (winhttp.dll)
Dim HttpReq As WinHttp.WinHttpRequest
Const WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 As Long = &H80&
Const WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 As Long = &H200&
Const WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 ... |
http://rosettacode.org/wiki/HTTPS/Authenticated | HTTPS/Authenticated | The goal of this task is to demonstrate HTTPS requests with authentication.
Implementations of this task should not use client certificates for this: that is the subject of another task.
| #Wren | Wren | /* https_authenticated.wren */
var CURLOPT_URL = 10002
var CURLOPT_FOLLOWLOCATION = 52
var CURLOPT_ERRORBUFFER = 10010
foreign class Curl {
construct easyInit() {}
foreign easySetOpt(opt, param)
foreign easyPerform()
foreign easyCleanup()
}
var curl = Curl.easyInit()
if (curl == 0) {
Sys... |
http://rosettacode.org/wiki/HTTPS | HTTPS | Task
Send a GET request to obtain the resource located at the URL "https://www.w3.org/", then print it to the console.
Checking the host certificate for validity is recommended.
Do not authenticate. That is the subject of other tasks.
Readers may wish to contrast with the HTTP Request task, and also the task on HTT... | #Erlang | Erlang |
-module(main).
-export([main/1]).
main([Url|[]]) ->
inets:start(),
ssl:start(),
case http:request(get, {URL, []}, [{ssl,[{verify,0}]}], []) of
{ok, {_V, _H, Body}} -> io:fwrite("~p~n",[Body]);
{error, Res} -> io:fwrite("~p~n", [Res])
end.
|
http://rosettacode.org/wiki/Huffman_coding | Huffman coding | Huffman encoding is a way to assign binary codes to symbols that reduces the overall number of bits used to encode a typical string of those symbols.
For example, if you use letters as symbols and have details of the frequency of occurrence of those letters in typical strings, then you could just encode each letter wi... | #C | C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BYTES 256
struct huffcode {
int nbits;
int code;
};
typedef struct huffcode huffcode_t;
struct huffheap {
int *h;
int n, s, cs;
long *f;
};
typedef struct huffheap heap_t;
/* heap handling funcs */
static heap_t *_heap_create(int s, lo... |
http://rosettacode.org/wiki/Host_introspection | Host introspection | Print the word size and endianness of the host machine.
See also: Variable size/Get
| #C.2B.2B | C++ | #include <bit>
#include <iostream>
int main()
{
std::cout << "int is " << sizeof(int) << " bytes\n";
std::cout << "a pointer is " << sizeof(int*) << " bytes\n\n";
if (std::endian::native == std::endian::big)
{
std::cout << "platform is big-endian\n";
}
else
{
std::cout <<... |
http://rosettacode.org/wiki/Host_introspection | Host introspection | Print the word size and endianness of the host machine.
See also: Variable size/Get
| #Cach.C3.A9_ObjectScript | Caché ObjectScript | USER>Write "Word Size: "_$Case($System.Version.Is64Bits(), 1: 64, : 32)
Word Size: 32
USER>Write "Endianness: "_$Case($System.Version.IsBigEndian(), 1: "Big", : "Little")
Endianness: Little |
http://rosettacode.org/wiki/Hostname | Hostname | Task
Find the name of the host on which the routine is running.
| #Clojure | Clojure |
(.. java.net.InetAddress getLocalHost getHostName)
|
http://rosettacode.org/wiki/Hostname | Hostname | Task
Find the name of the host on which the routine is running.
| #COBOL | COBOL | identification division.
program-id. hostname.
data division.
working-storage section.
01 hostname pic x(256).
01 nullpos pic 999 value 1.
procedure division.
call "gethostname" using hostname by value length of hostname
string hostname delimited by lo... |
http://rosettacode.org/wiki/IBAN | IBAN |
This page uses content from Wikipedia. The original article was at IBAN. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance)
The International Bank Account Number (IBAN) is an internationally agree... | #Scala | Scala | import scala.collection.immutable.SortedMap
class Iban(val iban: String) {
// Isolated tests
def isAllUpperCase = iban.toUpperCase == iban
def isValidpattern = (Iban.pattern findFirstIn iban).nonEmpty
def isNationalSize = {
Iban.ccVsLength.getOrElse(iban.take(2), 0) == iban.size
}
def isCheckNum... |
http://rosettacode.org/wiki/Hough_transform | Hough transform | Task
Implement the Hough transform, which is used as part of feature extraction with digital images.
It is a tool that makes it far easier to identify straight lines in the source image, whatever their orientation.
The transform maps each point in the target image,
(
ρ
,
θ
)
{\displaystyle (\rho ,\theta )}
, ... | #J | J | NB.*houghTransform v Produces a density plot of image y in hough space
NB. y is picture as an array with 1 at non-white points,
NB. x is resolution (width,height) of resulting image
houghTransform=: dyad define
'w h'=. x NB. width and height of target image
theta=. o. (%~ 0.5+i.) w ... |
http://rosettacode.org/wiki/Hough_transform | Hough transform | Task
Implement the Hough transform, which is used as part of feature extraction with digital images.
It is a tool that makes it far easier to identify straight lines in the source image, whatever their orientation.
The transform maps each point in the target image,
(
ρ
,
θ
)
{\displaystyle (\rho ,\theta )}
, ... | #Java | Java | import java.awt.image.*;
import java.io.File;
import java.io.IOException;
import javax.imageio.*;
public class HoughTransform
{
public static ArrayData houghTransform(ArrayData inputData, int thetaAxisSize, int rAxisSize, int minContrast)
{
int width = inputData.width;
int height = inputData.height;
i... |
http://rosettacode.org/wiki/Identity_matrix | Identity matrix | Task
Build an identity matrix of a size known at run-time.
An identity matrix is a square matrix of size n × n,
where the diagonal elements are all 1s (ones),
and all the other elements are all 0s (zeroes).
I
n
=
[
1
0
0
⋯
0
0
1
0
⋯
0
0
0
1
⋯
0
⋮
⋮
⋮
⋱
... | #LSL | LSL | default {
state_entry() {
llListen(PUBLIC_CHANNEL, "", llGetOwner(), "");
llOwnerSay("Please Enter a Dimension for an Identity Matrix.");
}
listen(integer iChannel, string sName, key kId, string sMessage) {
llOwnerSay("You entered "+sMessage+".");
list lMatrix = [];
integer x = 0;
integer n = (integer)sM... |
http://rosettacode.org/wiki/I_before_E_except_after_C | I before E except after C | The phrase "I before E, except after C" is a
widely known mnemonic which is supposed to help when spelling English words.
Task
Using the word list from http://wiki.puzzlers.org/pub/wordlists/unixdict.txt,
check if the two sub-clauses of the phrase are plausible individually:
"I before E when not pre... | #True_BASIC | True BASIC | DEF EOF(f)
IF END #f THEN LET EOF = -1 ELSE LET EOF = 0
END DEF
CLEAR
OPEN #1: NAME "UNIXDICT.TXT", org text, ACCESS INPUT, create old
DO
LINE INPUT #1: w$
IF POS(w$,"ie")<>0 THEN
IF POS(w$,"cie")<>0 THEN LET ci = ci+1 ELSE LET xi = xi+1
END IF
IF POS(w$,"ei")<>0 THEN
IF POS(w$,"cei")<>0 T... |
http://rosettacode.org/wiki/Increment_a_numerical_string | Increment a numerical string | Task
Increment a numerical string.
| #PARI.2FGP | PARI/GP | foo(s)=Str(eval(s)+1); |
http://rosettacode.org/wiki/Increment_a_numerical_string | Increment a numerical string | Task
Increment a numerical string.
| #Pascal | Pascal |
program TestIncNumString;
type
tMyNumString = string(20);
procedure IncMyString(var NumString: tMyNumString);
var
i: integer;
begin
readStr(NumString, i);
writeStr(NumString, succ(i))
end;
//example
var
MyNumString :tMyNumString;
BEGIN
MyNumString := '12345';
write(MyNumString,' turns into ');
IncMyStr... |
http://rosettacode.org/wiki/Integer_comparison | Integer comparison |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #min | min | "$1 is $2 $3."
("Enter an integer" ask) 2 times over over
(
((>) ("greater than"))
((<) ("less than"))
((==) ("equal to"))
) case
' append prepend % print |
http://rosettacode.org/wiki/Integer_comparison | Integer comparison |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #MiniScript | MiniScript | integer1 = input("Please Input Integer 1:").val
integer2 = input("Please Input Integer 2:").val
if integer1 < integer2 then print integer1 + " is less than " + integer2
if integer1 == integer2 then print integer1 + " is equal to " + integer2
if integer1 > integer2 then print integer1 + " is greater than " + integer2 |
http://rosettacode.org/wiki/HTTPS/Authenticated | HTTPS/Authenticated | The goal of this task is to demonstrate HTTPS requests with authentication.
Implementations of this task should not use client certificates for this: that is the subject of another task.
| #zkl | zkl | zkl: var ZC=Import("zklCurl")
zkl: var data=ZC().get("http://usr:pw@192.168.1.1/computer_list.xml")
L(Data(1,049),121,0)
zkl: data[0][121,*].text |
http://rosettacode.org/wiki/HTTPS | HTTPS | Task
Send a GET request to obtain the resource located at the URL "https://www.w3.org/", then print it to the console.
Checking the host certificate for validity is recommended.
Do not authenticate. That is the subject of other tasks.
Readers may wish to contrast with the HTTP Request task, and also the task on HTT... | #F.23 | F# |
#light
let wget (url : string) =
let c = new System.Net.WebClient()
c.DownloadString(url)
|
http://rosettacode.org/wiki/HTTPS | HTTPS | Task
Send a GET request to obtain the resource located at the URL "https://www.w3.org/", then print it to the console.
Checking the host certificate for validity is recommended.
Do not authenticate. That is the subject of other tasks.
Readers may wish to contrast with the HTTP Request task, and also the task on HTT... | #Frink | Frink | print[read["https://sourceforge.net/"]] |
http://rosettacode.org/wiki/HTTPS | HTTPS | Task
Send a GET request to obtain the resource located at the URL "https://www.w3.org/", then print it to the console.
Checking the host certificate for validity is recommended.
Do not authenticate. That is the subject of other tasks.
Readers may wish to contrast with the HTTP Request task, and also the task on HTT... | #Go | Go |
package main
import (
"io"
"log"
"net/http"
"os"
)
func main() {
r, err := http.Get("https://sourceforge.net/")
if err != nil {
log.Fatalln(err)
}
io.Copy(os.Stdout, r.Body)
}
|
http://rosettacode.org/wiki/Huffman_coding | Huffman coding | Huffman encoding is a way to assign binary codes to symbols that reduces the overall number of bits used to encode a typical string of those symbols.
For example, if you use letters as symbols and have details of the frequency of occurrence of those letters in typical strings, then you could just encode each letter wi... | #C.23 | C# | using System;
using System.Collections.Generic;
namespace Huffman_Encoding
{
public class PriorityQueue<T> where T : IComparable
{
protected List<T> LstHeap = new List<T>();
public virtual int Count
{
get { return LstHeap.Count; }
}
public virtual void A... |
http://rosettacode.org/wiki/Host_introspection | Host introspection | Print the word size and endianness of the host machine.
See also: Variable size/Get
| #Clojure | Clojure | (println "word size: " (System/getProperty "sun.arch.data.model"))
(println "endianness: " (System/getProperty "sun.cpu.endian")) |
http://rosettacode.org/wiki/Host_introspection | Host introspection | Print the word size and endianness of the host machine.
See also: Variable size/Get
| #Common_Lisp | Common Lisp | (machine-type) ;; => "X86-64" on SBCL here |
http://rosettacode.org/wiki/Hostname | Hostname | Task
Find the name of the host on which the routine is running.
| #CoffeeScript | CoffeeScript |
os = require 'os'
console.log os.hostname()
|
http://rosettacode.org/wiki/Hostname | Hostname | Task
Find the name of the host on which the routine is running.
| #Common_Lisp | Common Lisp | (defun get-host-name ()
#+(or sbcl ccl) (machine-instance)
#+clisp (let ((s (machine-instance))) (subseq s 0 (position #\Space s)))
#-(or sbcl ccl clisp) (error "get-host-name not implemented")) |
http://rosettacode.org/wiki/IBAN | IBAN |
This page uses content from Wikipedia. The original article was at IBAN. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance)
The International Bank Account Number (IBAN) is an internationally agree... | #Seed7 | Seed7 | $ include "seed7_05.s7i";
include "bigint.s7i";
const type: countryHash is hash [string] integer;
const func countryHash: initCountryCode is func
result
var countryHash: cc is countryHash.value;
begin
cc @:= ["AL"] 28; cc @:= ["AD"] 24; cc @:= ["AT"] 20; cc @:= ["AZ"] 28; cc @:= ["BE"] 16; cc @:= ["BH... |
http://rosettacode.org/wiki/Hough_transform | Hough transform | Task
Implement the Hough transform, which is used as part of feature extraction with digital images.
It is a tool that makes it far easier to identify straight lines in the source image, whatever their orientation.
The transform maps each point in the target image,
(
ρ
,
θ
)
{\displaystyle (\rho ,\theta )}
, ... | #Julia | Julia | using ImageFeatures
img = fill(false,5,5)
img[3,:] .= true
println(hough_transform_standard(img))
|
http://rosettacode.org/wiki/Hough_transform | Hough transform | Task
Implement the Hough transform, which is used as part of feature extraction with digital images.
It is a tool that makes it far easier to identify straight lines in the source image, whatever their orientation.
The transform maps each point in the target image,
(
ρ
,
θ
)
{\displaystyle (\rho ,\theta )}
, ... | #Kotlin | Kotlin | import java.awt.image.BufferedImage
import java.io.File
import javax.imageio.ImageIO
internal class ArrayData(val dataArray: IntArray, val width: Int, val height: Int) {
constructor(width: Int, height: Int) : this(IntArray(width * height), width, height)
operator fun get(x: Int, y: Int) = dataArray[y * wi... |
http://rosettacode.org/wiki/Identity_matrix | Identity matrix | Task
Build an identity matrix of a size known at run-time.
An identity matrix is a square matrix of size n × n,
where the diagonal elements are all 1s (ones),
and all the other elements are all 0s (zeroes).
I
n
=
[
1
0
0
⋯
0
0
1
0
⋯
0
0
0
1
⋯
0
⋮
⋮
⋮
⋱
... | #Lua | Lua |
function identity_matrix (size)
local m = {}
for i = 1, size do
m[i] = {}
for j = 1, size do
m[i][j] = i == j and 1 or 0
end
end
return m
end
function print_matrix (m)
for i = 1, #m do
pri... |
http://rosettacode.org/wiki/I_before_E_except_after_C | I before E except after C | The phrase "I before E, except after C" is a
widely known mnemonic which is supposed to help when spelling English words.
Task
Using the word list from http://wiki.puzzlers.org/pub/wordlists/unixdict.txt,
check if the two sub-clauses of the phrase are plausible individually:
"I before E when not pre... | #Tcl | Tcl | package require http
variable PLAUSIBILITY_RATIO 2.0
proc plausible {description x y} {
variable PLAUSIBILITY_RATIO
puts " Checking plausibility of: $description"
if {$x > $PLAUSIBILITY_RATIO * $y} {
set conclusion "PLAUSIBLE"
set fmt "As we have counts of %i vs %i words, a ratio of %.1f times"
set re... |
http://rosettacode.org/wiki/Increment_a_numerical_string | Increment a numerical string | Task
Increment a numerical string.
| #Perl | Perl | my $s = "12345";
$s++; |
http://rosettacode.org/wiki/Increment_a_numerical_string | Increment a numerical string | Task
Increment a numerical string.
| #Phix | Phix | integer {{n}} = scanf("2047","%d")
printf(1,"%d\n",{n+1})
|
http://rosettacode.org/wiki/Integer_comparison | Integer comparison |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #.D0.9C.D0.9A-61.2F52 | МК-61/52 | - ЗН С/П |
http://rosettacode.org/wiki/Integer_comparison | Integer comparison |
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |... | #ML.2FI | ML/I | "" Integer comparison
"" assumes macros on input stream 1, terminal on stream 2
MCSKIP MT,<>
MCSKIP SL WITH ~
MCINS %.
MCDEF SL SPACES NL AS <MCSET T1=%A1.
MCSET T2=%A2.
MCGO L1 UNLESS T1 EN T2
%A1. is equal to %A2.
%L1.MCGO L2 UNLESS %A1. GR %A2.
%A1. is greater than %A2.
%L2.MCGO L3 IF %A1. GE %A2.
%A1. is less than ... |
http://rosettacode.org/wiki/HTTPS | HTTPS | Task
Send a GET request to obtain the resource located at the URL "https://www.w3.org/", then print it to the console.
Checking the host certificate for validity is recommended.
Do not authenticate. That is the subject of other tasks.
Readers may wish to contrast with the HTTP Request task, and also the task on HTT... | #Groovy | Groovy |
new URL("https://sourceforge.net").eachLine { println it }
|
http://rosettacode.org/wiki/HTTPS | HTTPS | Task
Send a GET request to obtain the resource located at the URL "https://www.w3.org/", then print it to the console.
Checking the host certificate for validity is recommended.
Do not authenticate. That is the subject of other tasks.
Readers may wish to contrast with the HTTP Request task, and also the task on HTT... | #Haskell | Haskell | #!/usr/bin/runhaskell
import Network.HTTP.Conduit
import qualified Data.ByteString.Lazy as L
import Network (withSocketsDo)
main = withSocketsDo
$ simpleHttp "https://sourceforge.net/" >>= L.putStr |
http://rosettacode.org/wiki/HTTPS | HTTPS | Task
Send a GET request to obtain the resource located at the URL "https://www.w3.org/", then print it to the console.
Checking the host certificate for validity is recommended.
Do not authenticate. That is the subject of other tasks.
Readers may wish to contrast with the HTTP Request task, and also the task on HTT... | #Icon_and_Unicon | Icon and Unicon | # Requires Unicon version 13
procedure main(arglist)
url := (\arglist[1] | "https://sourceforge.net/")
w := open(url, "m-") | stop("Cannot open " || url)
while write(read(w))
close(w)
end |
http://rosettacode.org/wiki/Huffman_coding | Huffman coding | Huffman encoding is a way to assign binary codes to symbols that reduces the overall number of bits used to encode a typical string of those symbols.
For example, if you use letters as symbols and have details of the frequency of occurrence of those letters in typical strings, then you could just encode each letter wi... | #C.2B.2B | C++ | #include <iostream>
#include <queue>
#include <map>
#include <climits> // for CHAR_BIT
#include <iterator>
#include <algorithm>
const int UniqueSymbols = 1 << CHAR_BIT;
const char* SampleString = "this is an example for huffman encoding";
typedef std::vector<bool> HuffCode;
typedef std::map<char, HuffCode> HuffCode... |
http://rosettacode.org/wiki/Host_introspection | Host introspection | Print the word size and endianness of the host machine.
See also: Variable size/Get
| #D | D | void main() {
import std.stdio, std.system;
writeln("Word size = ", size_t.sizeof * 8, " bits.");
writeln(endian == Endian.littleEndian ? "Little" : "Big", " endian.");
} |
http://rosettacode.org/wiki/Host_introspection | Host introspection | Print the word size and endianness of the host machine.
See also: Variable size/Get
| #Delphi | Delphi | program HostIntrospection ;
{$APPTYPE CONSOLE}
uses SysUtils;
begin
Writeln('word size: ', SizeOf(Integer));
Writeln('endianness: little endian'); // Windows is always little endian
end. |
http://rosettacode.org/wiki/Hostname | Hostname | Task
Find the name of the host on which the routine is running.
| #Crystal | Crystal | hostname = System.hostname |
http://rosettacode.org/wiki/Hostname | Hostname | Task
Find the name of the host on which the routine is running.
| #D | D | import std.stdio, std.socket;
void main() {
writeln(Socket.hostName());
} |
http://rosettacode.org/wiki/Hostname | Hostname | Task
Find the name of the host on which the routine is running.
| #Delphi | Delphi | program ShowHostName;
{$APPTYPE CONSOLE}
uses Windows;
var
lHostName: array[0..255] of char;
lBufferSize: DWORD;
begin
lBufferSize := 256;
if GetComputerName(lHostName, lBufferSize) then
Writeln(lHostName)
else
Writeln('error getting host name');
end. |
http://rosettacode.org/wiki/IBAN | IBAN |
This page uses content from Wikipedia. The original article was at IBAN. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance)
The International Bank Account Number (IBAN) is an internationally agree... | #Sidef | Sidef | func valid_iban(iban) {
static len = Hash(
AD=>24, AE=>23, AL=>28, AO=>25, AT=>20, AZ=>28, BA=>20, BE=>16, BF=>27,
BG=>22, BH=>22, BI=>16, BJ=>28, BR=>29, CG=>27, CH=>21, CI=>28, CM=>27,
CR=>21, CV=>25, CY=>28, CZ=>24, DE=>22, DK=>18, DO=>28, DZ=>24, EE=>20,
EG=>27, ES=>24, FI=>18, FO=>18, FR=>27, GA=... |
http://rosettacode.org/wiki/Hough_transform | Hough transform | Task
Implement the Hough transform, which is used as part of feature extraction with digital images.
It is a tool that makes it far easier to identify straight lines in the source image, whatever their orientation.
The transform maps each point in the target image,
(
ρ
,
θ
)
{\displaystyle (\rho ,\theta )}
, ... | #Maple | Maple | with(ImageTools):
img := Read("pentagon.png")[..,..,1]:
img_x := Convolution (img, Matrix ([[1,2,1], [0,0,0],[-1,-2,-1]])):
img_y := Convolution (img, Matrix ([[-1,0,1],[-2,0,2],[-1,0,1]])):
img := Array (abs (img_x) + abs (img_y), datatype=float[8]):
countPixels := proc(M)
local r,c,i,j,row,col:
row := Array([]);
c... |
http://rosettacode.org/wiki/Hough_transform | Hough transform | Task
Implement the Hough transform, which is used as part of feature extraction with digital images.
It is a tool that makes it far easier to identify straight lines in the source image, whatever their orientation.
The transform maps each point in the target image,
(
ρ
,
θ
)
{\displaystyle (\rho ,\theta )}
, ... | #Mathematica_.2F_Wolfram_Language | Mathematica / Wolfram Language |
Radon[image, Method -> "Hough"]
|
http://rosettacode.org/wiki/Identity_matrix | Identity matrix | Task
Build an identity matrix of a size known at run-time.
An identity matrix is a square matrix of size n × n,
where the diagonal elements are all 1s (ones),
and all the other elements are all 0s (zeroes).
I
n
=
[
1
0
0
⋯
0
0
1
0
⋯
0
0
0
1
⋯
0
⋮
⋮
⋮
⋱
... | #Maple | Maple |
> LinearAlgebra:-IdentityMatrix( 4 );
[1 0 0 0]
[ ]
[0 1 0 0]
[ ]
[0 0 1 0]
[ ]
... |
http://rosettacode.org/wiki/I_before_E_except_after_C | I before E except after C | The phrase "I before E, except after C" is a
widely known mnemonic which is supposed to help when spelling English words.
Task
Using the word list from http://wiki.puzzlers.org/pub/wordlists/unixdict.txt,
check if the two sub-clauses of the phrase are plausible individually:
"I before E when not pre... | #TUSCRIPT | TUSCRIPT |
$$ MODE TUSCRIPT,{}
words=REQUEST("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt")
size=SIZE(words)
ieei=cie=xie=cei=xei=0
LOOP word=words
IF (word.nc." ie "," ei ") CYCLE
IF (word.ct." ie "&& word.ct." ei ") THEN
ieei=ieei+1
IF (word.ct." Cie ") THEN
cie=cie+1
ELSEIF (word.ct." Cei ") THEN
cei=c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.