By using this website and API you are agreeing to the privacy policy
(Click here to get more information on what data collects)
✔ I agree
🔗Information:
is a REST API that serves uniformly and well formatted jokes.It can be used without any API token, membership, registration or payment.
It supports a variety of filters that can be applied to get just the right jokes you need.
The usage is very simple and similar to other RESTful APIs and requires only basic knowledge of HTTP requests and JSON, XML, YAML or plain text.
If you come across a term you don't understand, you can try opening the menu and clicking on the section "Terminology".
currently serves jokes from different languages. To submit a new joke, please click here.
To report a bug or a grammar mistake or to suggest a feature, please use the GitHub issue tracker.
If you want to contribute to , please read the Contributing Guide.
If you are new to , please start by reading the Getting Started Guide
§ Note:
If you enjoy using and want to support the development, please consider donating here ♥I can't speak all languages, so please note that I can't ensure format and validity of jokes that aren't in English or German.
If you do come across an invalid joke or a joke that is formatted incorrectly, please consider opening an issue or submitting a pull request.
§ Uptime:
| Last day: | |
| Last week: | |
| Last month: |
§ Security:
has been a target of DoS attacks in the past, which is why there is now a limit of requests per minute and why joke submissions are manually curated. For more information click here.All dependencies are tested for vulnerabilities by Snyk, you can find a summary of the known vulnerabilities here.
Page security score (powered by Mozilla Observatory):
🔗News:
-
now has its own domain!
You can now replace the base URL https://sv443.net/jokeapi/v2 with https://v2.jokeapi.dev/
Note: you should always use the v2 subdomain to call the API but you can omit it if you just want to view the documentation.
For backwards compatibility the old URL will still be usable until version 2 will be deprecated. -
Is serving too many offensive jokes?
Try using version 2.3.0's new safe mode and the explicit flag.
🔗Try it out here:
| Select category / categories: |
|
| Select language: |
|
| Select flags to blacklist: |
(optional)
|
| Select response format: |
|
| Select at least one joke type: |
|
|
Search for a joke that contains this search string: |
|
|
Search for a joke in this ID range: |
(optional)
From:
To:
|
| Amount of jokes: |
|
URL: (Loading...)
Result:
(Set parameters and click "Send Request" above)
🔗Getting Started:
doesn't require any API token, authorization or payment to work, although there is a hard limit of requests per minute due to some DoS attacks I have been getting.To start using , you can do one of these two things:
-
You can see if your language has a wrapper for (to see a list of officially supported wrappers, click here)
Then, follow its documentation to communicate with the API (Disclaimer: I don't take any responsibility for their code). -
You can directly communicate with with HTTP requests (XHR) from within your code.
Here's a few resources to get you started: (Python XHR Crash Course, JavaScript XHR Documentation, .NET HttpClient Class Documentation)
Once you know how to send HTTP requests, please take a look at all the endpoints has.
After you've finished reading that, you can start testing out the different endpoints with a client such as Postman and look at some examples by going to the "Examples" section.
If your project really can't contain any explicit jokes, consider enabling the Safe Mode.
If you know any good jokes and want to add them to , please click here.
If you need any help, feel free to join my Discord server.
I struggled at explaining some features so consult the provided examples if you don't understand them.
🔗Official API Wrappers:
A wrapper library translates some API into an interface that is easier to use for a certain language or environment.In the case of RESTful APIs like , a wrapper library makes it so you can use your language's features to communicate with the API while the wrapper will do all the HTTP requests for you in the background.
Disclaimer: I will not take any responsibility for the wrappers, they are community-made and I can't ensure security, validity and compatibility.
Also, some of these might be outdated or not finished yet. Please consider supporting the creators or contributing to the libraries :)
The following is a list of officially supported wrappers:
| Language | Wrapper | Author | |
|---|---|---|---|
| Rust | Sv443_JokeAPI Rust Crate | canarado | |
| Python | Sv443s JokeAPI Python Wrapper | thenameswere |
|
| Node.js | JokeAPI - JavaScript wrapper | sahithyandev | |
| Go | jokeapi-go | Icelain |
(Click here to see the icon attributions)
🔗Submit a Joke:
Payload Preview:
🔗Rate Limiting:
Due to being target of DoS attacks in the past, every client has a request budget of requests they can send per minute.Sending any requests after this limit will make the API temporarily give you a HTTP 429 error until the time runs out.
When submitting jokes, your budget is only requests per minute.
Almost everywhere when using , you will be getting the following headers which tell you all you need to know about your current request budget:
| Name | Description |
|---|---|
| Retry-After | Tells you in how many seconds your request budget gets reset back to |
| RateLimit-Limit | How many requests in total you can send to per minute |
| RateLimit-Remaining | How many requests you have left in your budget |
| RateLimit-Reset | Contains an IMF-fixdate timestamp of when your request budget gets reset back to |
🔗URL Parameters:
URL parameters are like the settings or the configuration of an HTTP request.The parameters need to be prefixed by a single question mark (?) and separate key/value pairs need to be delimited from another by an ampersand (&). Keys are separated from values with an equals sign (=).
Example: https://example.org/some/page?key1=foo&key2=bar&key3=baz ... (yellow = key/value pair)
§ Format:
?format=formatThis parameter is global - it can be used on every single endpoint of (excluding the documentation and static content).
It is used to change the response format from the default (JSON) to (Loading...), depending on what you need.
If the format parameter is invalid or not specified at all, the default value of JSON will be used.
Available formats are (Loading...)
Example 1 (click to view)
URL: /joke/Any?format=xml
<data>
<category>Programming</category>
<type>single</type>
<joke>// This line doesn't actually do anything, but the code stops working when I delete it.</joke>
<flags>
<nsfw>false</nsfw>
<religious>false</religious>
<political>false</political>
<racist>false</racist>
<sexist>false</sexist>
<explicit>false</explicit>
</flags>
<id>12</id>
<lang>en</lang>
</data>
Example 2 (click to view)
URL: /joke/Any?format=txt
How many programmers does it take to screw in a light bulb?
None. It's a hardware problem.
§ Blacklist Flags:
?blacklistFlags=flag1[,flag2,...]This parameter can only be used on the "joke" endpoint.
If it is used, jokes that match the specified flag(s) will not be served (what is a flag?).
If you want to use multiple flags, separate them with a comma (,) or a plus sign (+).
These are all the available flags: (Loading...)
Example 1 (click to view)
URL: /joke/Any?blacklistFlags=nsfwUsing the above URL makes sure you don't get any jokes that are not safe for work.
Example 2 (click to view)
URL: /joke/Any?blacklistFlags=nsfw,racist,sexist,explicitUsing the above URL makes sure you don't get any jokes that are not safe for work, racist and sexist and that doesn't contain explicit language (swear words, etc.).
§ Language:
?lang=langcodeThis parameter can be used on every endpoint, but it is possible that no translations or jokes exist yet for your language.
There are two types of languages; system languages and joke languages. Both are separate from each other.
All system messages like errors can have a certain system language, while jokes can only have a joke language.
It is possible, that system languages don't yet exist for your language while jokes already do.
If no suitable system language is found, will default to English.
The language codes in follow the ISO 639-1 / Alpha-2 specification.
If you are interested in providing translations, please read the Contributing Guide; it will explain it.
You can also submit jokes in different languages. Please understand that I will not be able to ensure their proper formatting or legitimacy.
Currently available system languages: (Loading...)
Currently available joke languages: (Loading...)
Example 1 (click to view)
URL: /joke/Any?lang=ruUsing the above URL will fetch only jokes that are Russian. If an error gets returned, it will also be in Russian, provided a translation was found.
§ Joke Type:
?type=typeThis parameter can only be used on the "joke" endpoint.

If it is not set or set to an invalid value, you will receive jokes of both types.
Available types are: single, twopart
Example (click to view)
URL: /joke/Any?type=twopart
{
"category": "Programming",
"type": "twopart",
"setup": "What is a dying programmer's last program?",
"delivery": "Goodbye, world!",
"flags": {
"nsfw": false,
"religious": false,
"political": false,
"racist": false,
"sexist": false,
"explicit": false
},
"id": 58,
"lang": "en"
}
(no jokes with type "single" will be served)
§ Contains:
?contains=stringThis parameter can only be used on the "joke" endpoint.
If this parameter is specified, only jokes that contain the value of this parameter will be served (case insensitive).
IMPORTANT: If the value of this parameter contains special characters, it needs to be percent-encoded according to the URI syntax standard, otherwise you might get an error or a wrong response.
Example (click to view)
URL: /joke/Any?contains=C%23 (%23 = pound character / hashtag / # - so the thing searched for here is "C#")
{
"category": "Programming",
"type": "twopart",
"setup": "Why do programmers wear glasses?",
"delivery": "Because they need to C#",
"flags": {
"nsfw": false,
"religious": false,
"political": false,
"racist": false,
"sexist": false,
"explicit": false
},
"id": 51,
"lang": "en"
}
§ ID Range:
?idRange=number[-number]This parameter can only be used on the "joke" endpoint.
If it is used, you will only get jokes that are inside the specified range of IDs.
The lower and upper boundary of the ID range needs to be delimited with a minus (-), comma (,) or a plus sign (+).
If you only want to get a single joke by its ID, you can also ignore the delimiter and just use the single ID as the value for this parameter.
As there are currently jokes, the ID range can be any range from 0 -
Example 1 (click to view)
URL: /joke/Any?idRange=0-55Using the above URL will make only serve you jokes that are inside the ID range of 0 to 55.
Example 2 (click to view)
URL: /joke/Any?idRange=33Using the above URL will make only serve you the joke with the ID 33 (provided there are no other filters that are blacklisting that joke).
§ Joke Amount:
?amount=numberThis parameter can only be used on the "joke" endpoint.
If it is used, you will get a certain number of jokes in a single request.
If has less jokes than demanded, it will not error out but instead send the maximum amount of jokes it can serve.
Maximum possible number is and using an invalid value will make default to 1.
The joke format will change from the default when you set the amount parameter to 2 or more.
Click to view the format when fetching multiple jokes
{
"error": false,
"jokes": [
{
"category": "Misc",
"type": "single",
...
},
...
],
"amount": 10
}
Example (click to view)
URL: /joke/Any?amount=5Using the above URL will make serve you five jokes at once.
§ Submission Dry Run:
?dry-runThis parameter can only be used on the "submit" endpoint. It doesn't need a value (part to the right of the equals character).
If present, will respond just like the usual "submit" endpoint except the joke isn't actually saved to the API.
This functionality can be used to check if a joke is valid / what is wrong with it.
A successful dry run will have its error property set to false.
It will also have a message property with a short status message and a timestamp property with a 13-character UNIX timestamp.
🔗Safe Mode:
Safe Mode was added in version 2.3.0. If enabled, will try its best to serve only jokes that are considered safe for everyone.Unsafe jokes are those who can be considered explicit in any way, either through the used language, its references or its blacklist flags.
Jokes from the category Dark are also generally marked as unsafe.
Note: this filter is really fine but that doesn't mean human error is out of the question.
If you find any jokes that you consider unsafe but are served even when safe mode is activated, please submit an issue here.
The Safe Mode can be enabled by adding the value-less URL parameter safe-mode to the URL.
Example 1 (click to view)
URL: /joke/Any?safe-modeUsing the above URL will make sure you won't get any unsafe jokes.
Example 2 (click to view)
URL: /joke/Misc,Programming?format=xml&safe-mode&type=singleThis URL will yield a safe joke from the Misc or Programming category in the file format XML that's also of type single.
🔗Errors:
In all response data, no matter from which endpoint will have a boolean "error" parameter.Usually, it is set to false, which means there was no error in your request or on the server.
If the "error" parameter is set to true though, there was an error and will add an "internalError", "message", "causedBy", "additionalInfo" and "timestamp" parameter.
The "internalError" parameter will be set to false, if the error was due to a malformed or failed request and it will be true, if the error is 's fault.
The "message" parameter will contain a short version of the error message and the "timestamp" parameter will contain a 13-character Unix timestamp.
The "causedBy" parameter is an array of possible causes of this error and the "addidionalInfo" parameter contains a more descriptive error message.
If possible, will try to translate the error messages but keep in mind there might not exist a translation for your language yet or it is not 100% perfect.
You can view an example of an error, where an invalid category was used, just below this paragraph.
Together with the HTTP status code, which will also be set according to the type of error, these parameters can be used to improve error handling massively from what was the error system in previous versions of .
Example Error:
{
"error": true,
"internalError": false,
"code": 106,
"message": "No matching joke found",
"causedBy": [
"No jokes were found that match your provided filter(s)"
],
"additionalInfo": "The specified category is invalid - Got: \"foo\" - Possible categories are: \"Any, Misc, Programming, Dark, Pun, Spooky, Christmas\" (case insensitive)",
"timestamp":<PHONE_NUMBER>412
}
§ Status Codes:
| Code | Name | Description |
|---|---|---|
| 200 | Ok | The request was accepted and processed successfully and the response text contains the requested data or a status message |
| 201 | Created | The joke submission is formatted correctly and was accepted and successfully saved (unless ?dry-run was used) |
| 400 | Bad Request | The request you have sent to is formatted incorrectly and cannot be processed |
| 403 | Forbidden | You have been added to the blacklist due to malicious behavior and are not allowed to send requests to anymore |
| 404 | Not Found | The URL you have requested couldn't be found |
| 413 | Payload Too Large | The payload data sent to the server exceeds the maximum size of bytes |
| 414 | URI Too Long | The URL exceeds the maximum length of characters |
| 429 | Too Many Requests | You have exceeded the limit of requests per minute and have to wait a bit until you are allowed to send requests again |
| 500 | Internal Server Error | There was a general internal error within . You can get more info from the properties in the response text |
| 523 | Origin Unreachable | My server is temporarily offline due to maintenance or a dynamic IP update. Please be patient in this case. |
Success • Client Error • Server Error
🔗Troubleshooting:
HTTP Error 403:
First, please check if you can access all endpoints with your web browser. If not, your IP address has most likely been acting malicious and was permanently blacklisted.If you keep getting HTTP 403 (Forbidden) response codes in your program but not in your browser and have never shown malicious behavior before, the issue is most likely that Cloudflare is blocking your request.
This might be due to inconsistent request data or headers that are often used in malicious requests or cyber attacks (most of the time it's gonna be the fault of the library you are using).
A fix to this issue would be to explicitly set a User-Agent header in each of your requests.
This is the user agent of your browser which you should be able to use in the fix described above:
(Something didn't work, please enter "navigator.userAgent" without quotes in your JavaScript console instead)
HTTP Error 429: You will get 429 errors occasionally if you exceed the maximum of requests per minute.
In this case, you will need to wait up to one minute to be able to talk to the API again.
If you want to index the API or fetch all jokes, are better off going to the GitHub repository, where you will find everything you need and you don't need to spam .
🔗Endpoints:
An endpoint is an access point to send the HTTP requests to and get your response.offers these following endpoints:
§ Get Joke:
GET
/joke/[Category/-ies]
This endpoint is the one you want to call to get a joke.
A valid joke category or multiple joke categories, delimited with a comma, plus or minus character (, + -) must be provided in the URL.
These are all the available categories: (Loading...)
To see how this URL is built with certain parameters set, visit the "Try It" section.
Full example - click to view
/joke/Programming,Misc?format=xml&blacklistFlags=nsfw,sexist&type=single&lang=ru&amount=2Will give two Russian joke from either the Programming or the Misc category, with the payload format XML,
with the joke type "single", while also preventing all jokes that are potentially not safe for work and sexist from being served.
Supported URL parameters:
(More info on filtering parameters)
§ Info:
GET
/info
This endpoint provides a lot of information about and its jokes:
- The version number
- The amount of jokes
- All the available categories, flags, types and formats
- A 13-character UNIX timestamp
- The URL to a joke submission form
- A list of languages (code and name) currently supports
- The minimum and maximum values of an ID range per each language
- The amount of safe jokes there are per language
- A string with some information, like a message of the day
Supported URL parameters:
§ Categories:
GET
/categories
This endpoint returns a list / an array of all available joke categories, all available category aliases and a 13-character UNIX timestamp.
Supported URL parameters:
§ Language Code:
GET
/langcode/[Language]
This endpoint returns the ISO 639-1 language code of a provided language. It is searched with a fuzzy search, so you just have to provide the approximate language name.
The resulting language code is to be used in fetching and submitting jokes in different languages.
Example 1 - click to view
/langcode/german
{
"error": false,
"code": "de"
}
Example 2 - click to view
/langcode/sw3d1sh
{
"error": false,
"code": "sv"
}
Supported URL parameters:
§ Supported Languages:
GET
/languages
This endpoint returns lists of supported languages in jokes and supported languages in system messages (error messages).
Also, it returns a list of possible ISO 639-1 language codes you can use to submit a joke or add a translation.
Example - click to view
/languages
{
"defaultLanguage": "en",
"jokeLanguages": [
"de",
"en"
],
"systemLanguages": [
"de",
"en",
"ru"
],
"possibleLanguages": [
{
"code": "aa",
"name": "Afar"
},
{
...
},
...
],
"timestamp":<PHONE_NUMBER>702
}
Supported URL parameters:
§ Flags:
GET
/flags
This endpoint returns a list / an array of all available blacklist flags and a 13-character UNIX timestamp.
Supported URL parameters:
§ Formats:
GET
/formats
This endpoint returns a list / an array of all available response formats and a 13-character UNIX timestamp.
Supported URL parameters:
§ Ping:
GET
/ping
This endpoint returns a parameter named "ping" that contains the word "Pong!" and a 13-character UNIX timestamp.
It is intended for external uptime monitoring but you can also use it if you want to.
Supported URL parameters:
§ Endpoints:
GET
/endpoints
This endpoint returns a list / an array of all available endpoints, their usage (method, url and supported parameters) and a short description each.
Note: the lang parameter will not work here.
Supported URL parameters:
§ Submit Joke:
POST
/submit
This endpoint is used to programatically submit a joke to be reviewed and added to 's official jokes.
If you instead just want to manually submit a joke, please click here.
To ensure backwards compatibility you can use the PUT method even though it is discouraged.
Using the PUT method might be deprecated in the future.
The payload needs to be sent as JSON. Different formats are not allowed here.
The request payload has to follow the same object structure that the jokes are served in when using the "joke" endpoint.
Make sure to add a "formatVersion" property, though, which just contains the current joke format version ().
This is needed since there were a few changes to the object format since the previous versions and this serves as a kind of acknowledgement.
The joke category has to be any valid category, excluding "Any".
If the joke type is set to "single", the properties "setup" and "delivery" will need to be omitted and the joke is to be put in the "joke" property.
If the joke type is set to "twopart", the "joke" property is to be replaced with the properties "setup" and "delivery".
The "flags" property needs to be an object that contains the boolean properties "nsfw", "religious", "political", "racist", "sexist" and "explicit". These need to be set accordingly.
The joke ID doesn't need to be provided as it will be automatically assigned to the joke.
This endpoint has a unique URL parameter; ?dry-run, which if present will make the API respond just like the usual "submit" endpoint except the joke isn't actually saved to the API.
This functionality can be used to check if a joke is valid / what is wrong with it without having the joke actually submitted to the API.
If the joke is valid and the server accepted the submission, you will get a response with the status code 201.
Example Payload:
{
"formatVersion": ,
"category": "Misc",
"type": "single",
"joke": "A horse walks into a bar...",
"flags": {
"nsfw": true,
"religious": false,
"political": true,
"racist": false,
"sexist": false,
"explicit": false
},
"lang": "en"
}
Supported URL parameters:
Click here to see how the server responds to a joke submission
Server Response:
{
"error": false,
"message": "Joke submission was successfully saved. It will soon be checked out by the author.",
"submission": {
"formatVersion": 2,
"category": "Misc",
"type": "single",
"joke": "A horse walks into a bar...",
"flags": {
"nsfw": true,
"religious": false,
"political": true,
"racist": false,
"sexist": false,
"explicit": false
},
"lang": "en"
},
"timestamp":<PHONE_NUMBER>560
}
Click here to see how the server responds to a submission dry run
Server Response:
{
"error": false,
"message": "Dry Run complete! No errors were found.",
"timestamp":<PHONE_NUMBER>681
}
🔗Filtering Jokes:
I created with the main purpose of it having many versatile filtering options as other APIs didn't offer this amount of customization.In this section you will learn how the filtering works.
There are six different filtering methods in :
🔗API Tokens:
has a way of whitelisting certain clients. This is achieved through an API token.At the moment, you will only receive one of these tokens temporarily if something breaks or if you are a business and need more than requests per minute.
If you do end up receiving a token, using it is as easy as adding an Authorization header with the actual token as its value.
You will receive a response header called Token-Valid which will contain the number 1 if the token is valid.
If the token is invalid, the Token-Valid header will be set to 0 and will treat your request as if you didn't supply a token in the first place.
🔗Examples:
These are some examples in some commonly used languages to show you how you could implement :Node.js (click to show)
Node.js:
const https = require("https"); // Native module, no need to explicitly install
const baseURL = "";
const categories = ["Programming", "Misc", "Pun", "Spooky", "Christmas"];
const params = [
"blacklistFlags=nsfw,religious,racist",
"idRange=0-100"
];
https.get(`${baseURL}/joke/${categories.join(",")}?${params.join("&")}`, res => {
console.log("\n");
res.on("data", chunk => {
// On data received, convert it to a JSON object
let randomJoke = JSON.parse(chunk.toString());
if(randomJoke.type == "single")
{
// If type == "single", the joke only has the "joke" property
console.log(randomJoke.joke);
console.log("\n");
}
else
{
// If type == "twopart", the joke has the "setup" and "delivery" properties
console.log(randomJoke.setup);
setTimeout(() => {
console.log(randomJoke.delivery);
console.log("\n");
}, 3000);
}
});
res.on("error", err => {
// On error, log to console
console.error(`Error: ${err}`);
});
});
Web-JavaScript (click to show)
Web-JS:
var baseURL = "";
var categories = ["Programming", "Misc", "Pun", "Spooky", "Christmas"];
var params = [
"blacklistFlags=nsfw,religious,racist",
"idRange=0-100"
];
var xhr = new XMLHttpRequest();
xhr.open("GET", baseURL + "/joke/" + categories.join(",") + "?" + params.join("&"));
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status < 300) // readyState 4 means request has finished + we only want to parse the joke if the request was successful (status code lower than 300)
{
var randomJoke = JSON.parse(xhr.responseText);
if(randomJoke.type == "single")
{
// If type == "single", the joke only has the "joke" property
alert(randomJoke.joke);
}
else
{
// If type == "single", the joke only has the "joke" property
alert(randomJoke.setup);
alert(randomJoke.delivery);
}
}
else if(xhr.readyState == 4)
{
alert("Error while requesting joke.\n\nStatus code: " + xhr.status + "\nServer response: " + xhr.responseText);
}
};
xhr.send();
C# (click to show)
C#:
using System;
using System.Threading.Tasks;
using System.Net.Http;
namespace JokeAPIExample
{
class Program
{
static async Task Main(string[] args)
{
string joke = await GetJoke();
Console.WriteLine("Joke = " + joke);
}
public async static Task GetJoke()
{
var client = new HttpClient();
var response = await client.GetAsync("https://jokeapi.dev/joke/Any?format=txt&type=single&blacklistFlags=nsfw,racist,sexist&lang=en");
var joke = await response.Content.ReadAsStringAsync();
return joke;
}
}
}
C# - Advanced (click to show)
C#:
using System;
using System.Threading.Tasks;
using System.Net.Http;
using Newtonsoft.Json; // Install with NuGet Package Manager: https://www.nuget.org/packages/Newtonsoft.Json/12.0.3?_src=template
namespace TestHttpRequest
{
class Program
{
static async Task Main(string[] args)
{
Joke randomJoke = await GetJokeAdvanced();
if (randomJoke.type == "single")
{
Console.WriteLine(randomJoke.joke);
}
else
{
Console.WriteLine(randomJoke.setup);
System.Threading.Thread.Sleep(3000);
Console.WriteLine(randomJoke.delivery);
}
}
public async static Task GetJokeAdvanced()
{
const string baseUrl = "https://jokeapi.dev";
string[] categories = { "Programming", "Miscellaneous", "Pun", "Spooky", "Christmas" };
string[] parameters = {
"blacklistFlags=nsfw,religious,racist,sexist",
"idRange=0-100"
};
string requestUrl = $"{baseUrl}/joke/{string.Join(",", categories)}?{string.Join("&", parameters)}";
Joke randomJoke;
using (var httpClient = new HttpClient())
{
var json = await httpClient.GetStringAsync(requestUrl);
randomJoke = JsonConvert.DeserializeObject(json);
}
return randomJoke;
}
}
public class Joke
{
public string type { get; set; }
public string joke { get; set; }
public string setup { get; set; }
public string delivery { get; set; }
public int id { get; set; }
public Flags flags { get; set; }
}
public class Flags
{
public bool nsfw { get; set; }
public bool religious { get; set; }
public bool political { get; set; }
public bool racist { get; set; }
public bool sexist { get; set; }
}
}
🔗Terminology:
You might come across some terms in this documentation you don't understand. This section teaches you what those terms mean.§ Categories:
has a first, coarse filter that just categorizes the jokes depending on what the joke is about or who the joke is directed at.A joke about programming will be in the "Programming" category, dark humor will be in the "Dark" category and so on.
If you want jokes from all categories, you can instead use "Any", which will make randomly choose a category.
Since version 2.3.0, there are now aliases to these categories. This section explains how they work.
These are all the available categories: (Loading...)
To set the category you want, you need to add it to the URL path, just after the "/joke" endpoint, like this: /joke/Programming
§ Category Aliases:
Since version 2.3.0, there are now category aliases. You can use these as a shorter or just different version of the normal set of categories.Internally, these aliases will be resolved to one of the normal set of categories and your request (including the API's response) will be treated as if you used the resolved value.
The following is a list of aliases and what they will be resolved to internally:
| Alias | Resolved Category |
|---|
Example - click to view
The following URL will make resolve the alias Coding, giving you a joke from the category Programming:/joke/Coding
§ (Blacklist-) Flags:
Blacklist Flags (or just "Flags") are a more fine layer of filtering.Multiple flags can be set on each joke and they tell you something about the offensiveness of each joke.
You can tell to not give you jokes that have the specified flags by using the ?blacklistFlags URL parameter.
These are all the available flags: (Loading...)
§ (Response-) Formats:
Response Formats (or just "Formats") are a way to get your data in a different file format.Maybe your environment or language doesn't support JSON natively. In that case, is able to convert the JSON-formatted joke to a different format for you.
You can tell which file format to respond with by using the ?format URL parameter.
These are all the available formats: (Loading...)
§ Joke Type:
Each joke comes with one of two types: single or twopart.If a joke is of type "twopart", it has a setup string and a delivery string, which are both part of the joke.
They are separated because you might want to present the users the delivery after a timeout or in a different section of the UI.
A joke of type "single" only has a single string, which is the entire joke.
If you only want one type of joke, you can use the ?type URL parameter.
These are the available types: single, twopart
§ Search String:
If the search string filter is used, only jokes that contain the specified string will be returned.You can specify this search string by using the ?contains URL parameter.
IMPORTANT: If the value of this parameter contains special characters, it needs to be percent-encoded according to the URI standard (MDN Reference), otherwise you might get an error or a wrong response.
§ ID Range:
If this filter is used, you will only get jokes that are within the provided range of IDs.You don't necessarily need to provide an ID range though, a single ID will work just fine as well.
Example: an ID range of 0-9 will mean you will only get one of the first 10 jokes, while an ID range of 5 will mean you will only get the 6th joke.
You can set the ID range by using the ?idRange URL parameter.
As there are currently jokes, the ID range can be anywhere in the range of 0 to
This range varies from language to language though, so I recommend taking a look at the /info endpoint, which contains all possible ID ranges.
§ Joke Amount:
This filter allows you to set a certain amount of jokes to receive in a single call to the "Get Joke" endpoint.You can set it using the ?amount URL parameter.
Setting the filter to an invalid number will result in the API defaulting to serving a single joke.
Setting it to a number larger than will make default to the maximum ().
If you request more than jokes, the API will try to serve them encoded with Brotli, Gzip or Deflate, depending on whether or not you set a Accept-Encoding header.
🔗Contributors:
The following is a list of people that have directly contributed to 's development.I am very grateful for this voluntary effort to improve and would like to thank anyone who contributed :)
(Loading...)
If you want to contribute to , please read this guide.
🔗Dependents:
These are some of the projects that depend on :
- dozens Advices by ZephyrVentum
- shadow-bot by QGIsK
- Jokepy by aksty
- Dark1 by whiteadi
- Prejudice-Networks by LiamTownsley
- https://irshad.ml/humour.html by draco-malfoy
- Random-Joke-Generator-with-Flutter by variousnabil
- comma by ThatCopy
- Joke Teller by AlHood77
- Jokes plugin for Craft CMS 3.x by remcoov
- PoshBot.Joker by ToastIT-dev
- JokeAPI_ComputerCraft by Sv443
- Dev Dad Jokes by Jonathan Bossenger
(Submit an issue to get your project added here)
🔗Legal Stuff:
§ License:
is licensed under the MIT License.
Before modifying and / or redistributing the source code, please take two minutes to read the license text.
You can view the full license text by clicking here.
Before modifying and / or redistributing the source code, please take two minutes to read the license text.
You can view the full license text by clicking here.
§ Privacy:
has to collect some anonymized data to work.
To view a list with details, please click here.
To view the privacy policy, please click here.
To view the site notice / imprint, click here.
To view a list with details, please click here.
To view the privacy policy, please click here.
To view the site notice / imprint, click here.
§ Disclaimer:
I will hereby not claim any legal responsibility or liability for and the jokes it serves (especially those from the "Dark" category).
Whether it is used maliciously or breaks something in your project or someone gets offended by a joke, I can't be held accountable.
Additionally, I will only be able to provide security updates for a small selection of versions, a list of which you can find here.
I am doing my best to ensure security and stability but there's only so much a single developer can do.
Please report any issue that may arise to the GitHub issue tracker and I will try my best to fix it as soon as possible.
If you want to contact me, you can join my Discord server (fastest way to contact me) or send me an E-Mail: (click to show)
Whether it is used maliciously or breaks something in your project or someone gets offended by a joke, I can't be held accountable.
Additionally, I will only be able to provide security updates for a small selection of versions, a list of which you can find here.
I am doing my best to ensure security and stability but there's only so much a single developer can do.
Please report any issue that may arise to the GitHub issue tracker and I will try my best to fix it as soon as possible.
If you want to contact me, you can join my Discord server (fastest way to contact me) or send me an E-Mail: (click to show)
🔗Attributions:
These are the attributions to everything made by third parties that is based on or needs to function.
§ Fonts:
uses these third party fonts on its documentation page:
- Cascadia Code by Microsoft
- Roboto by Google
§ Other Attributions:
Third party icons used on this page:
All of these icons are protected from being indexed by the majority of web crawlers.
The rectangular badges, like the ones found in the uptime and security sections, are powered by Shields.io
- The Rust icon is owned by Mozilla.
- The Python icon is owned by the Python Software Foundation.
- The Node.js icon is a trademark of the OpenJS Foundation.
- The Go icon is owned by Google.
All of these icons are protected from being indexed by the majority of web crawlers.
The rectangular badges, like the ones found in the uptime and security sections, are powered by Shields.io
§ Libraries:
uses these libraries:
- Code-Prettify by Google
- JSLib by Sv443
§ Dependencies:
These are the packages depends on (excluding dependencies of dependencies and devDependencies):


Welome to Ātisuto-アーティスト a website where you can share your art in many forms. Before you do, check out the art collection of the many artists who have already shared their art with us. Please feel free to comment on the art to give valuable feedback to the artists!!
Click on one of the arrows below to preview the art styles which can be found on this website. Once you know which style your interested in go to the art page and enjoy.


The Thin Red Line
Starring Sean Penn and Ben Chaplin Directed By Terrence Malick Running Time: 2 hours 50 minutes
(20th Century Fox)
Wow, this is a toughie to review. A return to directing from Badlands director Malick, The Thin Red Line is a movie that will delight some, and bore the hell out of others. Myself, I was certainly leaning towards the 'delight' side. The plot, even though the film doesn't really have one, centres around a group of American soldiers and their thoughts and feelings fighting against the Japanese. The screenplay is mainly carried along by voice overs of the various cast members, and suitable imagery is inserted through to emphasise the symbolism.
The Thin Red Line is certainly an intriguing affair, much more intellectual and provoking than the ridiculous trailers promise. While Fox are trying to market this film as competition to Saving Private Ryan, by showing mainly clips of the action sequences, The Thin Red Line is nothing like Spielbergs effort. Although it sometimes tries a little too hard to be profound, the makings of a truly great movie are contained inside The Thin Red Line, unlike the typical 'Hollywoodness' that featured throughout Ryan.
Having never seen Malick's previous films, I was not quite sure what to expect from a Malick movie. Thankfully, I was not disappointed. While missing some of the interesting camera techniques Spielberg exploited well in Ryan, Malick takes things at a much slower pace. He also likes to get his message across, using heavy symbolism throughout to show the develop and growth of the few principal characters. The style may be annoying to same: you may feel patronised after the 10th close up shot of wildlife. But it's there, and it largely works. Sometimes Malick likes to go into excess, the first five minutes drags out a very simple point. And the incessant use of voice overs to progress the plot may eventually grate.
Another criticism may be that the characters never get enough time to develop. We _do_ get to know a few characters well, principally Ben Chaplins, Nick Noltes and Sean Penns. All three actors are great, by the way, with Nolte's hard assed colonel being the most enjoyable performance, and Sean Penn and Chaplin delivering very intense performances. Considering the minimal script they have, and the huge reliance on voice overs, the cast have to show their emotions and feelings through their actions, and they all do this admirable. Even the bit actors leave an impact: John Cusack and Woody Harrelson amongst others aren't bad at all. But again the film seems to go into excess. John Travolta and George Clooney turn up in split second roles, and neither performance is that good. They could of been cut out, but what would be the point in a film that seems to cherish every characters that features?
Despite the overlength, the sometimes unnesscary cameos, and the rampant symbolism, The Thin Red Line is a demanding movie that can be enjoyed. Although the entertainment factor can't reach that of Saving Private Ryan, the film has a huge amount to offer for the patient.
RATING=***1/2 OUT OF *****
A David Wilcock Review ©1999
DAVID WILCOCK<EMAIL_ADDRESS>Visit the Wilcock Movie Page! http://www.wilcock54.freeserve.co.uk
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


"PINNACLE "a little wing, (Matthew 4:5; Luke 4:9). On the southern side of the temple court was a range of porches or cloisters forming three arcades. At the south-eastern corner the roof of this cloister was some 300 feet above the Kidron valley. The pinnacle, some parapet or wing-like projection, was above this roof, and hence at a great height, probably 350 feet or more above the valley.
"PINNACLE "a little wing, (Matthew 4:5; Luke 4:9). On the southern side of the temple court was a range of porches or cloisters forming three arcades. At the south-eastern corner the roof of this cloister was some 300 feet above the Kidron valley. The pinnacle, some parapet or wing-like projection, was above this roof, and hence at a great height, probably 350 feet or more above the valley.


WITNESS LIST Constitutional Revision, Select Committee May 30, 2002-1:00P Interim Charge 1 On: Anderson, Greg (Texas A&M University System) Boldt, Bob (University of Texas Investment Management Company) Diebel, Phil (University of North Texas System) Francis, Patrick (Legislative Budget Board) Graves, Howard (Texas A&M University System) Hugetz, Edward (University of Houston System) Iberg, Cathy (University of Texas Investment Management Company) Kennedy, Kerry (University of Texas System) Rogers, Jesse (Self) Smith, David (Texas Tech University System) Urbanovsky, Lamar (Texas State University System)


ZoneDelegate class
An adapted view of the parent zone.
This class allows the implementation of a zone method to invoke methods on the parent zone while retaining knowledge of the originating zone.
Custom zones (created through Zone.fork or runZoned) can provide implementations of most methods of zones. This is similar to overriding methods on Zone, except that this mechanism doesn't require subclassing.
A custom zone function (provided through a ZoneSpecification) typically records or wraps its parameters and then delegates the operation to its parent zone using the provided ZoneDelegate.
While zones have access to their parent zone (through Zone.parent) it is recommended to call the methods on the provided parent delegate for two reasons:
- the delegate methods take an additional
zone
argument which is the zone the action has been initiated in. - delegate calls are more efficient, since the implementation knows how to skip zones that would just delegate to their parents.
Constructors
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
createPeriodicTimer(
Zone zone, Duration period, void f(Timer timer ) ) → Timer -
createTimer(
Zone zone, Duration duration, void f() ) → Timer -
errorCallback(
Zone zone, Object error, StackTrace stackTrace ) → AsyncError -
fork(
Zone zone, ZoneSpecification specification, Map zoneValues ) → Zone -
handleUncaughtError(
Zone zone, Object error, StackTrace stackTrace ) → void -
print(
Zone zone, String line ) → void -
registerBinaryCallback<
R, T1, T2> (Zone zone, R f(T1 arg1, T2 arg2 ) ) → ZoneBinaryCallback< R, T1, T2> -
registerCallback<
R> (Zone zone, R f() ) → ZoneCallback< R> -
registerUnaryCallback<
R, T> (Zone zone, R f(T arg ) ) → ZoneUnaryCallback< R, T> -
run<
R> (Zone zone, R f() ) → R -
runBinary<
R, T1, T2> (Zone zone, R f(T1 arg1, T2 arg2 ), T1 arg1, T2 arg2 ) → R -
runUnary<
R, T> (Zone zone, R f(T arg ), T arg ) → R -
scheduleMicrotask(
Zone zone, void f() ) → void -
noSuchMethod(
Invocation invocation ) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
Object other ) → bool -
The equality operator. [...]
inherited


Student Health Insurance
Menu
Home
Please Add Insurance
StudentID
CoursesEntrolled
InsuranceTerm
InsuranceStartDate
InsuranceEndDate
Copyright © Your Website 2018
You Have successfully registered


| # | Team Name | Wins | Speaks | Ranks | Tiebreaker | {% for team, wins, speaks, ranks, tiebreaker in varsity %}
|---|---|---|---|---|---|
| {{ forloop.counter }} | {{ team.display_backend }} | {{ wins }} | {{ speaks|floatformat:2 }} | {{ ranks|floatformat:2 }} | {{ tiebreaker }} |
| # | Team Name | Wins | Speaks | Ranks | Tiebreaker | {% for team, wins, speaks, ranks, tiebreaker in novice %}
|---|---|---|---|---|---|
| {{ forloop.counter }} | {{ team.display_backend }} | {{ wins }} | {{ speaks|floatformat:2 }} | {{ ranks|floatformat:2 }} | {{ tiebreaker }} |


Joel Matip issues injury update as Liverpool defender targets comeback
Liverpool have a series of injuries ahead of their Premier League fixture with Crystal Palace, with Joel Matip definitely missing the clash due to a long term knee issue
by Alex SmithJoel Matip has admitted that he hasn't put a time-frame on his return to the Liverpool side.
Centre back Matip suffered a knee injury during the Reds' Premier League victory over Sheffield United in October.
The 28-year-old missed a 4-3 win at home to RB Salzburg in the Champions League and the narrow triumph over Leicester but returned to Jurgen Klopp's back line against Manchester United after three weeks absent.
But since the draw at Old Trafford, Matip has been laid off by the injury and is still yet to return to training.
Liverpool face Crystal Palace at Selhurst Park on Saturday but will have to do so without Matip again.
"I don't want to put a time on it," Matip told Sky Sports. "I'm just taking my time and we'll see.
"Of course it's hard to get injured but unfortunately that's the life of a player. I am working hard at the moment to get back.
"I'm always trying to do my best, sometimes it works and sometimes it doesn't. Hopefully I'm back as soon as possible."
Matip is one of a number of injury worries for Klopp for the trip to south London.
Mohamed Salah and Andy Robertson are both doubts with ankle injuries, Joe Gomez and Jordan Henderson both returned from international duty early with problems, while Virgil van Dijk walked out on Holland as a result of "personal issues".
Cameroon international Matip was left heartbroken by Liverpool's failure to win the Premier League last season, having missed out by a point to Manchester City .
But he insists that he and his teammates have learned lessons from that near miss.
"You can learn from everything. Even if you fail. It was a hard time but we didn't do too badly last season and we'll try to improve," he said.
"We are in November, it's so early in the season. We just want to win the next game and we'll see.
"It's great to be in this position, we've worked really hard to be here but we cannot rest. There's no time to rest."


fun getStringArray(key: String): Array<String>?
Gets a String from the wrapped UBObject Returns null if the value was not an array, the key-value pair did not exist or the array type was not a String


| ID Game | Game State and Room | Players | ||||
|---|---|---|---|---|---|---|
| Id Game: {{m._id}} |
State: {{m.state}} Room:{{m.room}} | Id Player: {{f.player.uid}} | Name:{{f.player.name}} | Status:{{f.player.status}} | Status Date:{{f.player.statusDate}} | Score:{{f.score}} |
| ID Game | Game State and Room | Players | ||||
|---|---|---|---|---|---|---|
| Id Game: {{m._id}} |
State: {{m.state}} Room:{{m.room}} | Id Player: {{f.player.uid}} | Name:{{f.player.name}} | Status:{{f.player.status}} | Status Date:{{f.player.statusDate}} | Score:{{f.score}} |


GET STARTED
Get started on math problems
Begin with these problems. They were done with grade 7 students. A good place to start. If you don’t understand something, move on to the next problem. Most of the problems are arranged in progressions: doing one gives you clues and ideas for doing later ones.
Arithmetic and combinatorics I
Arithmetic and combinatorics II
Problems on sequences and golden ratio
Then do these problem sets, which were used with grade 8 students:
Intro to competition problems
More competition problems
The first methodically develops ideas involved in solving some interesting problems from Russian books. The second is a collection of applied problems.
And then finally you can try these:
Patterns in Pascal’s triangle
Polygonal numbers investigation
The first is an in-depth study of Pascal’s triangle through 90+ problems, many of them solved. Pascal’s triangle is particularly important, since there is hardly a competition that doesn’t ask a question involving binomial numbers in one way or another. The second document is a development of techniques for solving a famous problem about polygonal numbers.
Get started on programming
Dive right into computer science. We often use programming to analyze math problems. It’s very helpful to see how problems behave computationally. Don’t be scared of this, just start writing code. You learn by doing: there is no other way. Get Racket: it’s easy to install, intuitive, and easy to learn. I had great success teaching programming – even to grade 6 – using Racket! Download it and play with it!
Then do as many of these exercises as you can:
Racket computer science I
Racket computer science II
Work on these projects:
A study of binomials with Racket
Binomials and recursion with Racket
Geometry with Racket
Watch these videos:
Especially the one about the Sierpinski triangle. And of course follow my blog to see examples of Racket in action.
SICP and PAIP
Structure and interpretation of Computer Programs (SICP) is considered by many to be the greatest computer science textbook ever written. This book was formerly used at MIT. Here are links to the new PDF and online HTML5 versions.
Do the SICP exercises with Racket and compare your solutions to mine here:
Paradigms of Artificial Intelligence Programming (PAIP) is another great book, the classic on artificial intelligence. The new two-part online vesion looks great:
PAIP is done in Common Lisp, but it’s not too hard to translate the projects, code and ideas into Racket. It would be good training for you to do so.
Project Euler
When you feel ready, you can use your programming skills for solving Project Euler problems!


--- layout: post title: "morning lyrics (science fiction special release)" comments: true ---
In the year of '39 came a ship in from the blue
The Volunteers came home that day
And they bring good news of a world so newly born
Though their hearts so heavily weigh
For the earth is old and grey, little darlin' we'll away
But my love this cannot be
For so many years have gone though I'm older but a year
Your mother's eyes from your eyes cry to me.


{{ post.title }}
{% if post.read_time %} {% endif %} {% if post.excerpt %}{{ post.excerpt | markdownify | strip_html | truncate:200}}
{% endif %}---
# Copyright 2019 OpenPrinting
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
title: "OpenPrinting"
layout: splash
date: 2016-03-23T11:48:41-04:00
header:
overlay_color: "#000"
overlay_filter: "0.5"
overlay_image: /assets/images/rotation_pantone.jpg
actions:
- label: "Learn More"
url: "/about-us/"
excerpt: "We make printing just work!"
intro:
- excerpt: "OpenPrinting develops IPP-based printing technology for Linux®/Unix® operating systems."
feature_row:
- image_path: /assets/images/OpenPrintingBox.png
alt: "About Us"
title: "About Us"
excerpt: "Learn more about OpenPrinting, how it works, the people involved, and the projects maintained by it"
url: "/about-us"
btn_label: "Read More"
btn_class: "btn--primary"
- image_path: /assets/images/contribute.png
title: "Contribute"
excerpt: "Know how you can be part of an excellent community and help improve printing experience for millions of users"
url: "/contribute"
btn_label: "Read More"
btn_class: "btn--primary"
- image_path: /assets/images/cups.png
title: "CUPS"
excerpt: "CUPS is the standards-based, open source printing system that is used on Linux® and other operating systems."
url: "https://openprinting.github.io/cups/"
btn_label: "Read More"
btn_class: "btn--primary"
database_intro:
- excerpt: "Most modern printers work using OpenPrinting software without additional drivers or software.
OpenPrinting also hosts a printer compatibility database of legacy printers supported by free software drivers."
database_row:
- image_path: /assets/images/ipp-everywhere.png
alt: "Driverless Printers"
title: "Driverless Printers"
excerpt: "Most modern printers work 'out of the box' with OpenPrinting software. Browse the thousands of driverless printers."
url: "/printers"
btn_label: "Browse"
btn_class: "btn--primary"
- image_path: /assets/images/printer.png
alt: "Foomatic Printer Database"
title: "Legacy Printers"
excerpt: "The Foomatic printer database lists all of the printers that are supported by free software printer drivers."
url: "https://openprinting.org/printers"
btn_label: "Browse"
btn_class: "btn--primary"
- image_path: /assets/images/wsl-printing-icon.png
alt: "Legacy Printers under Windows"
title: "Windows?!"
excerpt: "Our Printer Applications revive old printers under current Windows, any model which works under Linux."
url: "/wsl-printer-app/"
btn_label: "Read More"
btn_class: "btn--primary"
collaboration_intro:
- excerpt: "OpenPrinting collaborates with standards groups and participates in coding/documentation programs."
collaboration_row:
- image_path: assets/images/pwg.png
alt: "IEEE-ISTO Printer Working Group"
title: "Printer Working Group"
excerpt: "OpenPrinting collaborates with the PWG's Internet Printing Protocol workgroup to support this ubiquitous printing standard."
url: "https://www.pwg.org/ipp/"
btn_label: "Read More"
btn_class: "btn--primary"
- image_path: assets/images/gsoc.jpeg
alt: "GSoC - OpenPrinting"
title: "GSoC - OpenPrinting"
excerpt: "OpenPrinting participates in the GSoC program under its umbrella organization The Linux Foundation."
url: "/gsoc/"
btn_label: "Read More"
btn_class: "btn--primary"
- image_path: assets/images/gsod.jpg
alt: "GSoD - OpenPrinting"
title: "GSoD - OpenPrinting"
excerpt: "OpenPrinting participates in the GSoD program under its umbrella organization The Linux Foundation."
url: "/gsod/"
btn_label: "Read More"
btn_class: "btn--primary"
---
{% include feature_row id="intro" type="center" %}
{{ post.excerpt | markdownify | strip_html | truncate:200}}
{% endif %}


The data for the examples presented in this talk will come from Project Gutenberg.
Gutenberg hosts over 50,000 free ebooks in which their copyright has run out or are otherwise in the public domain.
We will be using the texts in the Gutenberg Bookshelf, it categorises a large number of texts into 'bookshelves' of related texts. e.g. Adventure, Sci-Fi etc.
The plain text files in the bookshelves total around 30GB of data.
Given some search terms:
To solve this we will use the well known Term Frequency-Inverse Document Frequency (tf-idf) method.
Inherently skewed data set; 228 bookshelves, 1 book minimum, 1341 book maximum, standard deviation ~ 121
https://www.gutenberg.org/w/index.php?title=Category:BookshelfTo create more balanced computation across the workers maybe we can partition the data into more evenly weighted partitions?
The problem roughly falls into a class of optimization problems known as packing problems.
https://en.wikipedia.org/wiki/Packing_problemsThese are NP-hard problems so we will need to make use of heuristical methods or possibly a constraint solver.
Our problem seems most closely related to the Bin packing problem (minimum number of bins of a certain volume) or maybe the Multiprocessor scheduling problem (pack into a specific number of bins)
Attempted using a constraint solver (in Python), it was FAR too slow!
from pyschedule import Scenario, solvers
import base64
def bin_packing_solver(items, get_size=lambda x: x[1], get_label=lambda x: x[0],
partitions=10, horizon=None):
if not horizon:
horizon = get_size(items[0]) + 1
S = Scenario('binpacking', horizon=horizon)
resources = map(lambda x: S.Resource(str(x)), range(partitions))
tasks = map(lambda x: S.Task(base64.b64encode(get_label(x)), get_size(x)), items)
for t in tasks:
t += reduce(lambda x,y: x|y, resources)
S.use_makespan_objective()
solvers.mip.solve(S,msg=1)
return {base64.b64decode(str(s[0])): s[1] for s in S.solution()[:-1]}
Note: that these methods were chosen for their ease of implementation, the actual methods are however somewhat orthogonal to solving this partitioning problem in Spark.
(defn grow-bins [bins item]
(conj bins (add-to-bin {:size 0 :items []} item)))
(defn first-fit-pack
"Simple first fit algorithm that grows bins once reaching max-size.
Should give min required bins."
[items max-size]
(let [init-bins [{:size 0 :items []}]]
(reduce (fn [bins item]
(if-let [fit (select-bin bins item max-size)]
(update-in bins [fit] #(add-to-bin % item))
(grow-bins bins item)))
init-bins items)))
(let [items [[:a 9] [:b 7] [:c 6] [:d 5] [:e 5] [:f 4] [:g 3] [:h 2] [:i 1]]]
(assert
(= (first-fit-pack items 9)
[{:size 9 :items [[:a 9]]}
{:size 9 :items [[:b 7] [:h 2]]}
{:size 9 :items [[:c 6] [:g 3]]}
{:size 9 :items [[:d 5] [:f 4]]}
{:size 6 :items [[:e 5] [:i 1]]}])))
(defn add-to-smallest-bin [n bins item]
(if (< (count bins) n)
(grow-bins bins item)
(update-in bins [(select-smallest-bin bins)]
#(add-to-bin % item))))
(defn first-fit-smallest-bin-pack
"Simple first fit algorithm that continues to add to the smallest bin
once n bins have been filled to max-size."

EMR Cluster:
Methods:


×
Cache
Environment
History
Include
Log
0
Request
Session
Sql Log
33 - 44 ms
Timer
0.42 s - 14.6 MB
Variables


Configuration levels
merest allows to configure your API on three levels:
- API Application
- Model router
- End-point
Read more about configuration
Configuring API application
Router configuration
End-point configuration
Model methods
Next (Installation) >


uComponents: 100 karma votes and 10,000 downloads!
Very proud and happy to announce that uComponents has reached 100 karma votes and 10,000 downloads! (that’s not including the additional 4,000 download from our CodePlex project)
I just downloaded the 10,000th copy of uComponents. is.gd/ZVxhfy #H5YR #Umbraco
— Douglas Robar(@drobar) September 7, 2011
A huge thank you to the uComponents team for developing a great set of Umbraco components – and an even bigger THANK YOU to the Umbraco community for use it! #h5yr