duplicates = multiple editions
A Classical Introduction to Modern Number Theory,Kenneth IrelandMichael Rosen
A Classical Introduction to Modern Number Theory,Kenneth IrelandMichael Rosen
public class IntersectionTypes { | |
public static <S extends String & SafeString> void mainJava8() { | |
Worker.safeWork( | |
Validator.validate("Hello world!") | |
); | |
S s = Validator.validate("Intersection types must be aliased"); | |
Worker.safeWork(s); | |
} | |
public static /* look Ma, no generics for type aliasing! */ void mainJava10plus() { |
type Replace<T, X, Y> = { | |
[k in keyof T]: T[k] extends X ? Y : T[k]; | |
}; | |
declare const higherKindedTypeKey: unique symbol; | |
type HigherKindedTypeBrand = typeof higherKindedTypeKey; | |
type HigherKindedType<T> = T & HigherKindedTypeBrand; | |
type $ = {[higherKindedTypeKey]: unknown}; | |
type HigherKindedTypeReplace<T, X, Y> = T extends $ ? Y : Replace<T, X, Y> | |
type HKT<T extends HigherKindedType<any>, X, Y> = HigherKindedTypeReplace<T, X, Y> |
export declare const nominalTag: unique symbol | |
type UniqueTypes = string | number | symbol | boolean | |
/** | |
* Needs no validation nominal types | |
* (allows the base type T to be uplifted without a cast) | |
*/ | |
export type Unique<T, M extends UniqueTypes> = T & { [nominalTag]?: M } |
Finarfin: Aye. That, in truth, none might e'er deny. Yet lettest thou not cease to bear in mind, that elders be but Eldar, e'en as their offspring, and subject no less than more unto equal passions, to the world's storms and the heart's disquiet, and to wrath, and inconstancy, even as to the over-mastering pride, that durst not yield concession of any, lest smallest surrender be presage to the all; and willfulness doth ever raise the cry of Willful! - as 'twere a mirrored shield to turn back just rebuke.
[with a sweeping gesture, looking at his sons even as he addresses her]
For hard indeed, and surpasseth measure, to be held unto reckoning by one subject, for fealty, and if 'tis so, how much more so when him that challengeth is child and student, younger in years, in knowing, and in deed, and holding all those - or so it seemeth - but from one's self, as a gem's light inwrought by the artisan; for so easily and swift do we forget, that neither earth, nor holy fire, are of our own sole making
Summary: use good/established messaging patterns like Enterprise Integration Patterns. Don't make up your own. Don't expose transport implementation details to your application.
As much as possible, I prefer to hide Rabbit's implementation details from my application. In .Net we have a Broker abstraction that can communicate through a lot of different transports (rabbit just happens to be our preferred one). The broker allows us to expose a very simple API which is basically:
# Via http://pydanny.com/jinja2-quick-load-function.html | |
from jinja2 import FileSystemLoader, Environment | |
def render_from_template(directory, template_name, **kwargs): | |
loader = FileSystemLoader(directory) | |
env = Environment(loader=loader) | |
template = env.get_template(template_name) | |
return template.render(**kwargs) |
{ | |
"name": "parse-user-agent", | |
"version": "0.0.1", | |
"private": true, | |
dependencies: { | |
"platform": "~1.1.0", | |
"split": "~0.3.0" | |
} | |
} |
from flask import Flask, url_for | |
from werkzeug.serving import run_simple | |
from werkzeug.wsgi import DispatcherMiddleware | |
app = Flask(__name__) | |
app.config["APPLICATION_ROOT"] = "/abc/123" | |
@app.route("/") | |
def index(): |
# Looping per line of input | |
some | command | sequence | while read var1 var2; do | |
# something here | |
done | |
# Reading a file line by line | |
while read var1 var2 etc; do | |
perform --commands --with $var1 $var2 $etc | |
done < some-file.ext |