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/Handle_a_signal | Handle a signal | Most operating systems provide interrupt facilities, sometimes called signals either generated by the user or as a result of program failure or reaching a limit like file space.
Unhandled signals generally terminate a program in a disorderly manner.
Signal handlers are created so that the program behaves in a well-defi... | #Haskell | Haskell | import Prelude hiding (catch)
import Control.Exception (catch, throwIO, AsyncException(UserInterrupt))
import Data.Time.Clock (getCurrentTime, diffUTCTime)
import Control.Concurrent (threadDelay)
main = do t0 <- getCurrentTime
catch (loop 0)
(\e -> if e == UserInterrupt
... |
http://rosettacode.org/wiki/Handle_a_signal | Handle a signal | Most operating systems provide interrupt facilities, sometimes called signals either generated by the user or as a result of program failure or reaching a limit like file space.
Unhandled signals generally terminate a program in a disorderly manner.
Signal handlers are created so that the program behaves in a well-defi... | #HicEst | HicEst | seconds = TIME()
DO i = 1, 1E100 ! "forever"
SYSTEM(WAIT = 500) ! milli seconds
WRITE(Name) i
ENDDO
SUBROUTINE F2 ! call by either the F2 key, or by a toolbar-F2 click
seconds = TIME() - seconds
WRITE(Messagebox, Name) seconds
ALARM(999) ! quit immediately
END |
http://rosettacode.org/wiki/Hash_join | Hash join | An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm.
Task[edit]
Implement the "hash join" algorithm, and demonstrate tha... | #Prolog | Prolog | % Name/Age
person_age('Jonah', 27).
person_age('Alan', 18).
person_age('Glory', 28).
person_age('Popeye', 18).
person_age('Alan', 28).
% Character/Nemesis
character_nemisis('Jonah', 'Whales').
character_nemisis('Jonah', 'Spiders').
character_nemisis('Alan', 'Ghosts').
character_nemisis('Alan', 'Zombies'... |
http://rosettacode.org/wiki/Haversine_formula | Haversine formula |
This page uses content from Wikipedia. The original article was at Haversine formula. 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 haversine formula is an equation important in navigation, g... | #BASIC256 | BASIC256 |
global radioTierra # radio de la tierra en km
radioTierra = 6372.8
function Haversine(lat1, long1, lat2, long2 , radio)
d_long = radians(long1 - long2)
theta1 = radians(lat1)
theta2 = radians(lat2)
dx = cos(d_long) * cos(theta1) - cos(theta2)
dy = sin(d_long) * cos(theta1)
dz = sin(theta1) - sin(theta2)
r... |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #Forth | Forth | \ The Forth word ." does not insert a newline character after outputting a string
." Goodbye, World!" |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #Fortran | Fortran | program bye
write (*,'(a)',advance='no') 'Goodbye, World!'
end program bye |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #FreeBASIC | FreeBASIC | ' FB 1.05.0 Win64
Print "Goodbye, World!"; '' the trailing semi-colon suppresses the new line
Sleep |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Efene | Efene | io.format("Hello world!~n") |
http://rosettacode.org/wiki/Hash_from_two_arrays | Hash from two arrays | Task
Using two Arrays of equal length, create a Hash object
where the elements from one array (the keys) are linked
to the elements of the other (the values)
Related task
Associative arrays/Creation
| #Harbour | Harbour | LOCAL arr1 := { 6, "eight" }, arr2 := { 16, 8 }
LOCAL hash := { => }
LOCAL i, j
FOR EACH i, j IN arr1, arr2
hash[ i ] := j
NEXT |
http://rosettacode.org/wiki/Hash_from_two_arrays | Hash from two arrays | Task
Using two Arrays of equal length, create a Hash object
where the elements from one array (the keys) are linked
to the elements of the other (the values)
Related task
Associative arrays/Creation
| #Haskell | Haskell | import Data.Map
makeMap ks vs = fromList $ zip ks vs
mymap = makeMap ['a','b','c'] [1,2,3] |
http://rosettacode.org/wiki/Harshad_or_Niven_series | Harshad or Niven series | The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits.
For example, 42 is a Harshad number as 42 is divisible by (4 + 2) without remainder.
Assume that the series is defined as the numbers in increasing order.
Task
The task is to create a function/method/... | #Common_Lisp | Common Lisp | (defun harshadp (n)
(zerop (rem n (digit-sum n))))
(defun digit-sum (n &optional (a 0))
(cond ((zerop n) a)
(t (digit-sum (floor n 10) (+ a (rem n 10))))))
(defun list-harshad (n &optional (i 1) (lst nil))
"list the first n Harshad numbers starting from i (default 1)"
(cond ((= (length lst) n) (reverse lst... |
http://rosettacode.org/wiki/Hello_world/Newbie | Hello world/Newbie | Task
Guide a new user of a language through the steps necessary
to install the programming language and selection of a text editor if needed,
to run the languages' example in the Hello world/Text task.
Assume the language-newbie is a programmer in another language.
Assume the language-newbie is competent in install... | #Writing_your_first_program | Writing your first program | print("Hello World!"); |
http://rosettacode.org/wiki/Hello_world/Newbie | Hello world/Newbie | Task
Guide a new user of a language through the steps necessary
to install the programming language and selection of a text editor if needed,
to run the languages' example in the Hello world/Text task.
Assume the language-newbie is a programmer in another language.
Assume the language-newbie is competent in install... | #Python | Python | >>> print('hello world') |
http://rosettacode.org/wiki/Hello_world/Newbie | Hello world/Newbie | Task
Guide a new user of a language through the steps necessary
to install the programming language and selection of a text editor if needed,
to run the languages' example in the Hello world/Text task.
Assume the language-newbie is a programmer in another language.
Assume the language-newbie is competent in install... | #QB64 | QB64 | Hello, world!
Stack empty.
/O> |
http://rosettacode.org/wiki/Halt_and_catch_fire | Halt and catch fire | Task
Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok?
The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an... | #XBS | XBS | error("Crashed"); |
http://rosettacode.org/wiki/Halt_and_catch_fire | Halt and catch fire | Task
Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok?
The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an... | #XPL0 | XPL0 | proc Recurse; Recurse; Recurse |
http://rosettacode.org/wiki/Halt_and_catch_fire | Halt and catch fire | Task
Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok?
The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an... | #Z80_Assembly | Z80 Assembly | di
halt |
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #AutoHotkey | AutoHotkey | SysGet, MonitorCount, MonitorCount
SysGet, MonitorPrimary, MonitorPrimary
MsgBox, Monitor Count:`t%MonitorCount%`nPrimary Monitor:`t%MonitorPrimary%
Loop, %MonitorCount%
{
SysGet, MonitorName, MonitorName, %A_Index%
SysGet, Monitor, Monitor, %A_Index%
SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index%
... |
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #Axe | Axe | OPTION GUI TRUE
PRAGMA GUI gtk3
FUNCTION Define_Window
LOCAL (*max)() = gtk_window_maximize TYPE void
LOCAL id
id = GUIDEFINE("{ type=WINDOW name=window }")
CALL GUIFN(id, "window", max)
RETURN id
ENDFUNCTION
SUB Print_Dimensions
LOCAL (*size)() = gtk_window_get_size TYPE void
LO... |
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #BaCon | BaCon | OPTION GUI TRUE
PRAGMA GUI gtk3
FUNCTION Define_Window
LOCAL (*max)() = gtk_window_maximize TYPE void
LOCAL id
id = GUIDEFINE("{ type=WINDOW name=window }")
CALL GUIFN(id, "window", max)
RETURN id
ENDFUNCTION
SUB Print_Dimensions
LOCAL (*size)() = gtk_window_get_size TYPE void
LO... |
http://rosettacode.org/wiki/Hello_world/Graphical | Hello world/Graphical |
Task
Display the string Goodbye, World! on a GUI object (alert box, plain window, text area, etc.).
Related task
Hello world/Text
| #AutoHotkey | AutoHotkey | MsgBox, Goodbye`, World! |
http://rosettacode.org/wiki/Hello_world/Graphical | Hello world/Graphical |
Task
Display the string Goodbye, World! on a GUI object (alert box, plain window, text area, etc.).
Related task
Hello world/Text
| #AutoIt | AutoIt | #include <GUIConstantsEx.au3>
$hGUI = GUICreate("Hello World") ; Create the main GUI
GUICtrlCreateLabel("Goodbye, World!", -1, -1) ; Create a label dispalying "Goodbye, World!"
GUISetState() ; Make the GUI visible
While 1 ; Infinite GUI loop
$nMsg = GUIGetMsg() ; Get any messages from the GUI
Switch $nMsg ; Swi... |
http://rosettacode.org/wiki/Handle_a_signal | Handle a signal | Most operating systems provide interrupt facilities, sometimes called signals either generated by the user or as a result of program failure or reaching a limit like file space.
Unhandled signals generally terminate a program in a disorderly manner.
Signal handlers are created so that the program behaves in a well-defi... | #Icon_and_Unicon | Icon and Unicon | global startTime
procedure main()
startTime := &now
trap("SIGINT", handler)
every write(seq()) do delay(500)
end
procedure handler(s)
stop("\n",&now-startTime," seconds")
end |
http://rosettacode.org/wiki/Handle_a_signal | Handle a signal | Most operating systems provide interrupt facilities, sometimes called signals either generated by the user or as a result of program failure or reaching a limit like file space.
Unhandled signals generally terminate a program in a disorderly manner.
Signal handlers are created so that the program behaves in a well-defi... | #Java | Java | import sun.misc.Signal;
import sun.misc.SignalHandler;
public class ExampleSignalHandler {
public static void main(String... args) throws InterruptedException {
final long start = System.nanoTime();
Signal.handle(new Signal("INT"), new SignalHandler() {
public void handle(Signal sig) {... |
http://rosettacode.org/wiki/Hash_join | Hash join | An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm.
Task[edit]
Implement the "hash join" algorithm, and demonstrate tha... | #PureBasic | PureBasic | Structure tabA
age.i
name.s
EndStructure
Structure tabB
char_name.s
nemesis.s
EndStructure
NewList listA.tabA()
NewList listB.tabB()
Macro SetListA(c_age, c_name)
AddElement(listA()) : listA()\age = c_age : listA()\name = c_name
EndMacro
Macro SetListB(c_char, c_nem)
AddElement(listB()) : listB(... |
http://rosettacode.org/wiki/Haversine_formula | Haversine formula |
This page uses content from Wikipedia. The original article was at Haversine formula. 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 haversine formula is an equation important in navigation, g... | #BBC_BASIC | BBC BASIC | PRINT "Distance = " ; FNhaversine(36.12, -86.67, 33.94, -118.4) " km"
END
DEF FNhaversine(n1, e1, n2, e2)
LOCAL d() : DIM d(2)
d() = COSRAD(e1-e2) * COSRAD(n1) - COSRAD(n2), \
\ SINRAD(e1-e2) * COSRAD(n1), \
\ SINRAD(n1) - SINRAD(n2)
= ASN(MOD(d()) / 2) * 6372.8... |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #Frink | Frink | print["Goodbye, World!"] |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #Gambas | Gambas | Public Sub Main()
Print "Goodbye, "; 'The semicolon stops the newline being added
Print "World!"
End |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #gecho | gecho | 'Hello, <> 'World! print |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Egel | Egel |
def main = "Hello World!"
|
http://rosettacode.org/wiki/Hash_from_two_arrays | Hash from two arrays | Task
Using two Arrays of equal length, create a Hash object
where the elements from one array (the keys) are linked
to the elements of the other (the values)
Related task
Associative arrays/Creation
| #Huginn | Huginn | from Algorithms import materialize, zip;
main() {
keys = [1, 2, 3];
values = ['a', 'b', 'c'];
hash = materialize( zip( key, values ), lookup );
} |
http://rosettacode.org/wiki/Hash_from_two_arrays | Hash from two arrays | Task
Using two Arrays of equal length, create a Hash object
where the elements from one array (the keys) are linked
to the elements of the other (the values)
Related task
Associative arrays/Creation
| #Icon_and_Unicon | Icon and Unicon | link ximage # to format the structure
procedure main(arglist) #: demonstrate hash from 2 lists
local keylist
if *arglist = 0 then arglist := [1,2,3,4] # ensure there's a list
every put(keylist := [], "key-" || !arglist) # make keys for each entry
every (T := table())[keyli... |
http://rosettacode.org/wiki/Harshad_or_Niven_series | Harshad or Niven series | The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits.
For example, 42 is a Harshad number as 42 is divisible by (4 + 2) without remainder.
Assume that the series is defined as the numbers in increasing order.
Task
The task is to create a function/method/... | #Cowgol | Cowgol | include "cowgol.coh";
sub digitsum(n: uint16): (sum: uint8) is
sum := 0;
while n != 0 loop
sum := sum + (n % 10) as uint8;
n := n / 10;
end loop;
end sub;
sub nextHarshad(m: uint16): (n: uint16) is
n := m;
loop
n := n + 1;
if n % digitsum(n) as uint16 == 0 the... |
http://rosettacode.org/wiki/Hello_world/Newbie | Hello world/Newbie | Task
Guide a new user of a language through the steps necessary
to install the programming language and selection of a text editor if needed,
to run the languages' example in the Hello world/Text task.
Assume the language-newbie is a programmer in another language.
Assume the language-newbie is competent in install... | #Quackery | Quackery | Hello, world!
Stack empty.
/O> |
http://rosettacode.org/wiki/Hello_world/Newbie | Hello world/Newbie | Task
Guide a new user of a language through the steps necessary
to install the programming language and selection of a text editor if needed,
to run the languages' example in the Hello world/Text task.
Assume the language-newbie is a programmer in another language.
Assume the language-newbie is competent in install... | #Ra | Ra |
class HelloWorld
**Prints "Goodbye, World!"**
on start
print "Goodbye, World!"
|
http://rosettacode.org/wiki/Hello_world/Newbie | Hello world/Newbie | Task
Guide a new user of a language through the steps necessary
to install the programming language and selection of a text editor if needed,
to run the languages' example in the Hello world/Text task.
Assume the language-newbie is a programmer in another language.
Assume the language-newbie is competent in install... | #Racket | Racket |
#lang racket
(displayln "Hello world!")
|
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #BBC_BASIC | BBC BASIC | SPI_GETWORKAREA = 48
DIM rc{l%,t%,r%,b%}
SYS "SystemParametersInfo", SPI_GETWORKAREA, 0, rc{}, 0
PRINT "Maximum width = " ; rc.r% - rc.l%
PRINT "Maximum height = " ; rc.b% - rc.t% |
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #C | C |
#include<windows.h>
#include<stdio.h>
int main()
{
printf("Dimensions of the screen are (w x h) : %d x %d pixels",GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
return 0;
}
|
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #C.23 | C# | using System;
using System.Drawing;
using System.Windows.Forms;
static class Program
{
static void Main()
{
Rectangle bounds = Screen.PrimaryScreen.Bounds;
Console.WriteLine($"Primary screen bounds: {bounds.Width}x{bounds.Height}");
Rectangle workingArea = Screen.PrimaryScreen.Worki... |
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #Creative_Basic | Creative Basic |
DEF Win:WINDOW
DEF Close:CHAR
DEF ScreenSizeX,ScreenSizeY:INT
DEF L,T,ClientWidth,ClientHeight:INT
GETSCREENSIZE(ScreenSizeX,ScreenSizeY)
WINDOW Win,0,0,ScreenSizeX,ScreenSizeY,@MINBOX|@MAXBOX|@SIZE|@MAXIMIZED,0,"Get Client Size",MainHandler
'Left and top are always zero for this function.
GETCLIENTSIZE(Win,L... |
http://rosettacode.org/wiki/Hello_world/Graphical | Hello world/Graphical |
Task
Display the string Goodbye, World! on a GUI object (alert box, plain window, text area, etc.).
Related task
Hello world/Text
| #AWK | AWK | # Usage: awk -f hi_win.awk
BEGIN { system("msg * Goodbye, Msgbox !") }
|
http://rosettacode.org/wiki/Hello_world/Graphical | Hello world/Graphical |
Task
Display the string Goodbye, World! on a GUI object (alert box, plain window, text area, etc.).
Related task
Hello world/Text
| #Axe | Axe | ClrHome
Text(0,0,"Goodbye, world!")
Pause 5000 |
http://rosettacode.org/wiki/Handle_a_signal | Handle a signal | Most operating systems provide interrupt facilities, sometimes called signals either generated by the user or as a result of program failure or reaching a limit like file space.
Unhandled signals generally terminate a program in a disorderly manner.
Signal handlers are created so that the program behaves in a well-defi... | #JavaScript | JavaScript | (function(){
var count=0
secs=0
var i= setInterval( function (){
count++
secs+=0.5
console.log(count)
}, 500);
process.on('SIGINT', function() {
clearInterval(i)
console.log(secs+' seconds elapsed');
process.exit()
});
})();
|
http://rosettacode.org/wiki/Handle_a_signal | Handle a signal | Most operating systems provide interrupt facilities, sometimes called signals either generated by the user or as a result of program failure or reaching a limit like file space.
Unhandled signals generally terminate a program in a disorderly manner.
Signal handlers are created so that the program behaves in a well-defi... | #Jsish | Jsish | /* Handle a signal, is jsish */
var gotime = strptime();
var looping = true;
var loops = 1;
function handler() {
printf("Elapsed time: %ds\n", (strptime() - gotime) / 1000);
looping = false;
}
Signal.callback(handler, 'SIGINT');
Signal.handle('SIGINT');
while (looping) {
puts(loops++);
Event.upd... |
http://rosettacode.org/wiki/Hash_join | Hash join | An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm.
Task[edit]
Implement the "hash join" algorithm, and demonstrate tha... | #Python | Python | from collections import defaultdict
def hashJoin(table1, index1, table2, index2):
h = defaultdict(list)
# hash phase
for s in table1:
h[s[index1]].append(s)
# join phase
return [(s, r) for r in table2 for s in h[r[index2]]]
table1 = [(27, "Jonah"),
(18, "Alan"),
(28, ... |
http://rosettacode.org/wiki/Haversine_formula | Haversine formula |
This page uses content from Wikipedia. The original article was at Haversine formula. 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 haversine formula is an equation important in navigation, g... | #bc | bc |
#!/bin/sh
#-
# © 2021 mirabilos Ⓕ CC0; implementation of Haversine GCD from public sources
#
# now developed online:
# https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=useful-scripts/mirkarte.git;a=blob;f=geo.sh;hb=HEAD
if test "$#" -ne 4; then
echo >&2 "E: syntax: $0 lat1 lon1 lat2 lon2"
exit 1
fi
set -... |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #Genie | Genie | [indent=4]
/*
Hello, with no newline, in Genie
valac helloNoNewline.gs
*/
init
stdout.printf("%s", "Goodbye, World!") |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #GML | GML | show_message("Goodbye, World!") |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #Go | Go | package main
import "fmt"
func main() { fmt.Print("Goodbye, World!") } |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Egison | Egison |
(define $main
(lambda [$argv]
(write-string "Hello world!\n")))
|
http://rosettacode.org/wiki/Hash_from_two_arrays | Hash from two arrays | Task
Using two Arrays of equal length, create a Hash object
where the elements from one array (the keys) are linked
to the elements of the other (the values)
Related task
Associative arrays/Creation
| #Ioke | Ioke | {} addKeysAndValues([:a, :b, :c], [1, 2, 3]) |
http://rosettacode.org/wiki/Hash_from_two_arrays | Hash from two arrays | Task
Using two Arrays of equal length, create a Hash object
where the elements from one array (the keys) are linked
to the elements of the other (the values)
Related task
Associative arrays/Creation
| #J | J | hash=: vals {~ keys&i. |
http://rosettacode.org/wiki/Harshad_or_Niven_series | Harshad or Niven series | The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits.
For example, 42 is a Harshad number as 42 is divisible by (4 + 2) without remainder.
Assume that the series is defined as the numbers in increasing order.
Task
The task is to create a function/method/... | #Crystal | Crystal | harshad = 1.step.select { |n| n % n.to_s.chars.sum(&.to_i) == 0 }
puts "The first 20 harshard numbers are: \n#{ harshad.first(20).to_a }"
puts "The first harshard number > 1000 is #{ harshad.find { |n| n > 1000 } }"
|
http://rosettacode.org/wiki/Hello_world/Newbie | Hello world/Newbie | Task
Guide a new user of a language through the steps necessary
to install the programming language and selection of a text editor if needed,
to run the languages' example in the Hello world/Text task.
Assume the language-newbie is a programmer in another language.
Assume the language-newbie is competent in install... | #Raku | Raku | raku -e'say "Hello World!"'
|
http://rosettacode.org/wiki/Hello_world/Newbie | Hello world/Newbie | Task
Guide a new user of a language through the steps necessary
to install the programming language and selection of a text editor if needed,
to run the languages' example in the Hello world/Text task.
Assume the language-newbie is a programmer in another language.
Assume the language-newbie is competent in install... | #REXX | REXX | /*REXX program to greet the world enthusiastically. */
say "Hello world!" |
http://rosettacode.org/wiki/Hello_world/Newbie | Hello world/Newbie | Task
Guide a new user of a language through the steps necessary
to install the programming language and selection of a text editor if needed,
to run the languages' example in the Hello world/Text task.
Assume the language-newbie is a programmer in another language.
Assume the language-newbie is competent in install... | #Ring | Ring |
sayHello()
func sayHello
see "Hello World" + nl
|
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #Delphi | Delphi |
unit Main;
interface
uses
Winapi.Windows, System.SysUtils, Vcl.Forms;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
w,h:Integer;
begin
w := Screen.Monitors[0].WorkareaRe... |
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #EGL | EGL | egl.defineClass(
'utils', 'Browser',
{
"getViewportWidth" : function () {
return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
},
"getViewportHeight" : function(){
return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
}
});
|
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #FBSL | FBSL | #INCLUDE <Include\Windows.inc>
ShowWindow(ME, SW_MAXIMIZE)
BEGIN EVENTS
END EVENTS |
http://rosettacode.org/wiki/Hello_world/Graphical | Hello world/Graphical |
Task
Display the string Goodbye, World! on a GUI object (alert box, plain window, text area, etc.).
Related task
Hello world/Text
| #BaCon | BaCon | OPTION GUI TRUE
gui = GUIDEFINE("{ type=window name=window XtNtitle=\"Graphical\" } \
{ type=labelWidgetClass name=label parent=window XtNlabel=\"Goodbye, World!\" } ")
CALL GUIEVENT$(gui) |
http://rosettacode.org/wiki/Hello_world/Graphical | Hello world/Graphical |
Task
Display the string Goodbye, World! on a GUI object (alert box, plain window, text area, etc.).
Related task
Hello world/Text
| #BASIC | BASIC | ' Demonstrate a simple Windows application using FreeBasic
#include once "windows.bi"
Declare Function WinMain(ByVal hInst As HINSTANCE, _
ByVal hPrev As HINSTANCE, _
ByVal szCmdLine as String, _
ByVal iCmdShow As Integer) As Integer
End WinMain( GetModuleHandle( null ), null, Command( ), SW_NORMA... |
http://rosettacode.org/wiki/Handle_a_signal | Handle a signal | Most operating systems provide interrupt facilities, sometimes called signals either generated by the user or as a result of program failure or reaching a limit like file space.
Unhandled signals generally terminate a program in a disorderly manner.
Signal handlers are created so that the program behaves in a well-defi... | #Julia | Julia |
ccall(:jl_exit_on_sigint, Cvoid, (Cint,), 0)
function timeit()
ticks = 0
try
while true
sleep(0.5)
ticks += 1
println(ticks)
end
catch
end
end
@time timeit()
println("Done.")
|
http://rosettacode.org/wiki/Handle_a_signal | Handle a signal | Most operating systems provide interrupt facilities, sometimes called signals either generated by the user or as a result of program failure or reaching a limit like file space.
Unhandled signals generally terminate a program in a disorderly manner.
Signal handlers are created so that the program behaves in a well-defi... | #Kotlin | Kotlin | // version 1.1.3
import sun.misc.Signal
import sun.misc.SignalHandler
fun main(args: Array<String>) {
val startTime = System.currentTimeMillis()
Signal.handle(Signal("INT"), object : SignalHandler {
override fun handle(sig: Signal) {
val elapsedTime = (System.currentTimeMillis() - star... |
http://rosettacode.org/wiki/Hash_join | Hash join | An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm.
Task[edit]
Implement the "hash join" algorithm, and demonstrate tha... | #Racket | Racket | #lang racket
(struct A (age name))
(struct B (name nemesis))
(struct AB (name age nemesis) #:transparent)
(define Ages-table
(list (A 27 "Jonah") (A 18 "Alan")
(A 28 "Glory") (A 18 "Popeye")
(A 28 "Alan")))
(define Nemeses-table
(list
(B "Jonah" "Whales") (B "Jonah" "Spiders")
(B "Alan" ... |
http://rosettacode.org/wiki/Hash_join | Hash join | An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm.
Task[edit]
Implement the "hash join" algorithm, and demonstrate tha... | #Raku | Raku | sub hash-join(@a, &a, @b, &b) {
my %hash := @b.classify(&b);
@a.map: -> $a {
|(%hash{a $a} // next).map: -> $b { [$a, $b] }
}
}
# Testing:
my @A =
[27, "Jonah"],
[18, "Alan"],
[28, "Glory"],
[18, "Popeye"],
[28, "Alan"],
;
my @B =
["Jonah", "Whales"],
["Jonah", "S... |
http://rosettacode.org/wiki/Haversine_formula | Haversine formula |
This page uses content from Wikipedia. The original article was at Haversine formula. 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 haversine formula is an equation important in navigation, g... | #C | C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define R 6371
#define TO_RAD (3.1415926536 / 180)
double dist(double th1, double ph1, double th2, double ph2)
{
double dx, dy, dz;
ph1 -= ph2;
ph1 *= TO_RAD, th1 *= TO_RAD, th2 *= TO_RAD;
dz = sin(th1) - sin(th2);
dx = cos(ph1) * cos(th1) - cos(th2);
d... |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #Groovy | Groovy | print "Goodbye, world" |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #GUISS | GUISS | Start,Programs,Accessories,Notepad,Type:Goodbye World[pling] |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #Harbour | Harbour | ?? "Goodbye, world"
or
QQout( "Goodbye, world" )
|
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #EGL | EGL |
program HelloWorld
function main()
SysLib.writeStdout("Hello world!");
end
end
|
http://rosettacode.org/wiki/Hash_from_two_arrays | Hash from two arrays | Task
Using two Arrays of equal length, create a Hash object
where the elements from one array (the keys) are linked
to the elements of the other (the values)
Related task
Associative arrays/Creation
| #Java | Java | import java.util.HashMap;
public static void main(String[] args){
String[] keys= {"a", "b", "c"};
int[] vals= {1, 2, 3};
HashMap<String, Integer> hash= new HashMap<String, Integer>();
for(int i= 0; i < keys.length; i++){
hash.put(keys[i], vals[i]);
}
} |
http://rosettacode.org/wiki/Harshad_or_Niven_series | Harshad or Niven series | The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits.
For example, 42 is a Harshad number as 42 is divisible by (4 + 2) without remainder.
Assume that the series is defined as the numbers in increasing order.
Task
The task is to create a function/method/... | #D | D | void main() {
import std.stdio, std.algorithm, std.range, std.conv;
enum digSum = (int n) => n.text.map!(d => d - '0').sum;
enum harshads = iota(1, int.max).filter!(n => n % digSum(n) == 0);
harshads.take(20).writeln;
harshads.filter!(h => h > 1000).front.writeln;
} |
http://rosettacode.org/wiki/Hello_world/Newbie | Hello world/Newbie | Task
Guide a new user of a language through the steps necessary
to install the programming language and selection of a text editor if needed,
to run the languages' example in the Hello world/Text task.
Assume the language-newbie is a programmer in another language.
Assume the language-newbie is competent in install... | #Robotic | Robotic |
* "Hello world!"
end
|
http://rosettacode.org/wiki/Hello_world/Newbie | Hello world/Newbie | Task
Guide a new user of a language through the steps necessary
to install the programming language and selection of a text editor if needed,
to run the languages' example in the Hello world/Text task.
Assume the language-newbie is a programmer in another language.
Assume the language-newbie is competent in install... | #Ruby | Ruby |
puts "Hello World!!"
|
http://rosettacode.org/wiki/Hello_world/Newbie | Hello world/Newbie | Task
Guide a new user of a language through the steps necessary
to install the programming language and selection of a text editor if needed,
to run the languages' example in the Hello world/Text task.
Assume the language-newbie is a programmer in another language.
Assume the language-newbie is competent in install... | #Rust | Rust | fn main() {
println!("Hello world!");
} |
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #FreeBASIC | FreeBASIC | ' FB 1.05.0 Win64
' Using SystemParametersInfo function in Win32 API
Dim As Any Ptr library = DyLibLoad("user32")
Dim Shared SystemParametersInfo As Function (ByVal As ULong, ByVal As ULong, ByVal As Any Ptr, ByVal As ULong) As Long
SystemParametersInfo = DyLibSymbol(library, "SystemParametersInfoA")
Type Rect
As... |
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #Gambas | Gambas | FMain.Maximized = True
FMain.Visible = False ' The form can be invisible |
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #Gambas_2 | Gambas | Public Sub Form_Open()
Print Desktop.Width
Print Desktop.Height
End |
http://rosettacode.org/wiki/Hello_world/Graphical | Hello world/Graphical |
Task
Display the string Goodbye, World! on a GUI object (alert box, plain window, text area, etc.).
Related task
Hello world/Text
| #BASIC256 | BASIC256 | clg
font "times new roman", 20,100
color orange
rect 10,10, 140,30
color red
text 10,10, "Goodbye, World!" |
http://rosettacode.org/wiki/Hello_world/Graphical | Hello world/Graphical |
Task
Display the string Goodbye, World! on a GUI object (alert box, plain window, text area, etc.).
Related task
Hello world/Text
| #batari_Basic | batari Basic | playfield:
................................
................................
................................
.XX..XXX.XXX.XX..XX..X.X.XXX....
.X.X.X.X.X.X.X.X.XXX..X..XX...X.
.XXX.XXX.XXX.XX..XXX..X..XXX.X..
................................
.....X.X.XXX.XX..X...XX...X.....
.....XXX.X.X.XXX.X...X.X..X.....
.....XXX.XX... |
http://rosettacode.org/wiki/Handle_a_signal | Handle a signal | Most operating systems provide interrupt facilities, sometimes called signals either generated by the user or as a result of program failure or reaching a limit like file space.
Unhandled signals generally terminate a program in a disorderly manner.
Signal handlers are created so that the program behaves in a well-defi... | #Liberty_BASIC | Liberty BASIC |
nomainwin
WindowHeight=DisplayHeight
open "Handle a signal" for graphics as #1
#1 "trapclose [quit]"
#1 "down;setfocus;place 10 20"
#1 "\Press CTRL + C to stop."
#1 "when characterInput [keyPressed]"
start=time$("ms")
timer 500, [doPrint]
wait
[quit] close #1:end
[doPrint]
if sigInt then
timer 0
#1 "\Seco... |
http://rosettacode.org/wiki/Handle_a_signal | Handle a signal | Most operating systems provide interrupt facilities, sometimes called signals either generated by the user or as a result of program failure or reaching a limit like file space.
Unhandled signals generally terminate a program in a disorderly manner.
Signal handlers are created so that the program behaves in a well-defi... | #MATLAB | MATLAB | function sigintHandle
k = 1;
tic
catchObj = onCleanup(@toc);
while true
pause(0.5)
fprintf('%d\n', k)
k = k+1;
end
end |
http://rosettacode.org/wiki/Hash_join | Hash join | An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm.
Task[edit]
Implement the "hash join" algorithm, and demonstrate tha... | #REXX | REXX | /*REXX program demonstrates the classic hash join algorithm for two relations. */
S. = ; R. =
S.1 = 27 'Jonah' ; R.1 = "Jonah Whales"
S.2 = 18 'Alan' ; R.2 = "Jonah Spiders"
... |
http://rosettacode.org/wiki/Haversine_formula | Haversine formula |
This page uses content from Wikipedia. The original article was at Haversine formula. 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 haversine formula is an equation important in navigation, g... | #C.23 | C# | public static class Haversine {
public static double calculate(double lat1, double lon1, double lat2, double lon2) {
var R = 6372.8; // In kilometers
var dLat = toRadians(lat2 - lat1);
var dLon = toRadians(lon2 - lon1);
lat1 = toRadians(lat1);
lat2 = toRadians(lat2);
var a = Math.Sin(dLat / ... |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #Haskell | Haskell | main = putStr "Goodbye, world" |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #HolyC | HolyC | "Goodbye, World!"; |
http://rosettacode.org/wiki/Hello_world/Newline_omission | Hello world/Newline omission | Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output.
Task
Display the string Goodbye, World! without a trailing newline.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Standard error
Hello world/Text
| #Io | Io |
write("Goodbye, World!")
|
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Eiffel | Eiffel | class
HELLO_WORLD
create
make
feature
make
do
print ("Hello world!%N")
end
end |
http://rosettacode.org/wiki/Hash_from_two_arrays | Hash from two arrays | Task
Using two Arrays of equal length, create a Hash object
where the elements from one array (the keys) are linked
to the elements of the other (the values)
Related task
Associative arrays/Creation
| #JavaScript | JavaScript |
var keys = ['a', 'b', 'c'];
var values = [1, 2, 3];
var map = {};
for(var i = 0; i < keys.length; i += 1) {
map[ keys[i] ] = values[i];
}
|
http://rosettacode.org/wiki/Hash_from_two_arrays | Hash from two arrays | Task
Using two Arrays of equal length, create a Hash object
where the elements from one array (the keys) are linked
to the elements of the other (the values)
Related task
Associative arrays/Creation
| #jq | jq | # hash(keys) creates a JSON object with the given keys as keys
# and values taken from the input array in turn.
# "keys" must be an array of strings.
# The input array may be of any length and have values of any type,
# but only the first (keys|length) values will be used;
# the input will in effect be padded with nul... |
http://rosettacode.org/wiki/Harshad_or_Niven_series | Harshad or Niven series | The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits.
For example, 42 is a Harshad number as 42 is divisible by (4 + 2) without remainder.
Assume that the series is defined as the numbers in increasing order.
Task
The task is to create a function/method/... | #Delphi | Delphi | proc nonrec dsum(word n) word:
word r;
r := 0;
while n ~= 0 do
r := r + n % 10;
n := n / 10
od;
r
corp
proc nonrec next_harshad(word n) word:
while
n := n + 1;
n % dsum(n) ~= 0
do od;
n
corp
proc nonrec main() void:
word n;
byte i;
write("... |
http://rosettacode.org/wiki/Hello_world/Newbie | Hello world/Newbie | Task
Guide a new user of a language through the steps necessary
to install the programming language and selection of a text editor if needed,
to run the languages' example in the Hello world/Text task.
Assume the language-newbie is a programmer in another language.
Assume the language-newbie is competent in install... | #Scala | Scala | scala -e 'println(\"Hello_world\")' |
http://rosettacode.org/wiki/Hello_world/Newbie | Hello world/Newbie | Task
Guide a new user of a language through the steps necessary
to install the programming language and selection of a text editor if needed,
to run the languages' example in the Hello world/Text task.
Assume the language-newbie is a programmer in another language.
Assume the language-newbie is competent in install... | #ScratchScript | ScratchScript | setl 'print("Hello, world!");' |
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #Go | Go | package main
import (
"fmt"
"github.com/go-vgo/robotgo"
)
func main() {
w, h := robotgo.GetScreenSize()
fmt.Printf("Screen size: %d x %d\n", w, h)
fpid, err := robotgo.FindIds("firefox")
if err == nil && len(fpid) > 0 {
pid := fpid[0]
robotgo.ActivePID(pid)
robotgo.Ma... |
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions | GUI/Maximum window dimensions | The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an... | #Groovy | Groovy | def window = java.awt.GraphicsEnvironment.localGraphicsEnvironment.maximumWindowBounds
println "width: $window.width, height: $window.height" |
http://rosettacode.org/wiki/Hello_world/Graphical | Hello world/Graphical |
Task
Display the string Goodbye, World! on a GUI object (alert box, plain window, text area, etc.).
Related task
Hello world/Text
| #Batch_File | Batch File | @echo off
::Output to message box [Does not work in Window 7 and later]
msg * "Goodbye, World!" 2>nul
::Using MSHTA.EXE Hack::
@mshta javascript:alert("Goodbye, World!");code(close());
@mshta vbscript:Execute("msgbox(""Goodbye, World!""):code close")
pause |
http://rosettacode.org/wiki/Handle_a_signal | Handle a signal | Most operating systems provide interrupt facilities, sometimes called signals either generated by the user or as a result of program failure or reaching a limit like file space.
Unhandled signals generally terminate a program in a disorderly manner.
Signal handlers are created so that the program behaves in a well-defi... | #NewLISP | NewLISP | ; Mac OSX, BSDs or Linux only, not Windows
(setq start-time (now))
(signal 2 (lambda()
(println
(format "Program has run for %d seconds"
(- (apply date-value (now))
(apply date-value start-time))))
(exit 0)))
(while (println (++ i))
... |
http://rosettacode.org/wiki/Handle_a_signal | Handle a signal | Most operating systems provide interrupt facilities, sometimes called signals either generated by the user or as a result of program failure or reaching a limit like file space.
Unhandled signals generally terminate a program in a disorderly manner.
Signal handlers are created so that the program behaves in a well-defi... | #Nim | Nim | import times, os, strutils
let t = epochTime()
proc handler() {.noconv.} =
echo "Program has run for ", formatFloat(epochTime() - t, precision = 0), " seconds."
quit 0
setControlCHook(handler)
for n in 1 ..< int64.high:
sleep 500
echo n |
http://rosettacode.org/wiki/Hash_join | Hash join | An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm.
Task[edit]
Implement the "hash join" algorithm, and demonstrate tha... | #Ring | Ring | Table1 = [[27, "Jonah"], [18, "Alan"], [28, "Glory"], [18, "Popeye"], [28, "Alan"]]
Table2 = [["Jonah", "Whales"], ["Jonah", "Spiders"], ["Alan", "Ghosts"], ["Alan", "Zombies"], ["Glory", "Buffy"]]
hTable = []
Qtable = []
for a in table1
h = hashing(a[2])
add(htable,[h , a])
next
for b in table2
h = hashing(b[1]... |
http://rosettacode.org/wiki/Haversine_formula | Haversine formula |
This page uses content from Wikipedia. The original article was at Haversine formula. 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 haversine formula is an equation important in navigation, g... | #C.2B.2B | C++ |
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
const static double EarthRadiusKm = 6372.8;
inline double DegreeToRadian(double angle)
{
return M_PI * angle / 180.0;
}
class Coordinate
{
public:
Coordinate(double latitude ,double longitude):myLatitude(latitude), myLongitude(longitude)
{}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.