|
||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
| Interface Summary | |
|---|---|
| AdminOperationsProtocol | Protocol for admin operations. |
| InputFormat<K,V> | InputFormat describes the input-specification for a
Map-Reduce job. |
| InputSplit | InputSplit represents the data to be processed by an
individual Mapper . |
| JobConfigurable | That what may be configured. |
| JobHistory.Listener | Callback interface for reading back log events from JobHistory. |
| JobTrackerMXBean | The MXBean interface for JobTrackerInfo |
| Mapper<K1,V1,K2,V2> | Maps input key/value pairs to a set of intermediate key/value pairs. |
| MapRunnable<K1,V1,K2,V2> | Expert: Generic interface for Mapper s. |
| OutputCollector<K,V> | Collects the <key, value> pairs output by Mapper s
and Reducer s. |
| OutputFormat<K,V> | OutputFormat describes the output-specification for a
Map-Reduce job. |
| Partitioner<K2,V2> | Partitions the key space. |
| RawKeyValueIterator | RawKeyValueIterator is an iterator used to iterate over
the raw keys and values during sort/merge of intermediate data. |
| RecordReader<K,V> | RecordReader reads <key, value> pairs from an
InputSplit . |
| RecordWriter<K,V> | RecordWriter writes the output <key, value> pairs
to an output file. |
| Reducer<K2,V2,K3,V3> | Reduces a set of intermediate values which share a key to a smaller set of values. |
| Reporter | A facility for Map-Reduce applications to report progress and update counters, status information etc. |
| RunningJob | RunningJob is the user-interface to query for details on a
running Map-Reduce job. |
| SequenceFileInputFilter.Filter | filter interface |
| TaskTrackerMXBean | MXBean interface for TaskTracker |
| TaskUmbilicalProtocol | Protocol that task child process uses to contact its parent process. |
| Class Summary | |
|---|---|
| ClusterStatus | Status information on the current state of the Map-Reduce cluster. |
| Counters | A set of named counters. |
| Counters.Counter | A counter record, comprising its name and value. |
| DefaultJobHistoryParser | Default parser for job history files. |
| DefaultTaskController | The default implementation for controlling tasks. |
| FileInputFormat<K,V> | A base class for file-based InputFormat . |
| FileOutputCommitter | An OutputCommitter that commits files specified
in job output directory i.e. |
| FileOutputFormat<K,V> | A base class for OutputFormat . |
| FileSplit | A section of an input file. |
| ID | A general identifier, which internally stores the id as an integer. |
| IsolationRunner | IsolationRunner is intended to facilitate debugging by re-running a specific task, given left-over task files for a (typically failed) past job. |
| JobClient | JobClient is the primary interface for the user-job to interact
with the JobTracker . |
| JobClient.Renewer | |
| JobConf | A map/reduce job configuration. |
| JobContext | |
| JobEndNotifier | |
| JobHistory | Provides methods for writing to and reading from job history. |
| JobHistory.HistoryCleaner | Delete history files older than one month. |
| JobHistory.JobInfo | Helper class for logging or reading back events related to job start, finish or failure. |
| JobHistory.MapAttempt | Helper class for logging or reading back events related to start, finish or failure of a Map Attempt on a node. |
| JobHistory.ReduceAttempt | Helper class for logging or reading back events related to start, finish or failure of a Map Attempt on a node. |
| JobHistory.Task | Helper class for logging or reading back events related to Task's start, finish or failure. |
| JobHistory.TaskAttempt | Base class for Map and Reduce TaskAttempts. |
| JobHistoryServer | JobHistoryServer is responsible for servicing all job history
related requests from client. |
| JobID | JobID represents the immutable and unique identifier for the job. |
| JobInProgress | JobInProgress maintains all the info for keeping a Job on the straight and narrow. |
| JobLocalizer | Internal class responsible for initializing the job, not intended for users. |
| JobProfile | A JobProfile is a MapReduce primitive. |
| JobQueueInfo | Class that contains the information regarding the Job Queues which are maintained by the Hadoop Map/Reduce framework. |
| JobStatus | Describes the current status of a job. |
| JobTracker | JobTracker is the central location for submitting and tracking MR jobs in a network environment. |
| JvmTask | |
| KeyValueLineRecordReader | This class treats a line in the input as a key/value pair separated by a separator character. |
| KeyValueTextInputFormat | An InputFormat for plain text files. |
| LineRecordReader | Treats keys as offset in file and value as line. |
| LineRecordReader.LineReader | Deprecated. Use LineReader instead. |
| MapFileOutputFormat | An OutputFormat that writes MapFile s. |
| MapReduceBase | Base class for Mapper and Reducer implementations. |
| MapReducePolicyProvider | PolicyProvider for Map-Reduce protocols. |
| MapRunner<K1,V1,K2,V2> | Default MapRunnable implementation. |
| MapTaskCompletionEventsUpdate | A class that represents the communication between the tasktracker and child tasks w.r.t the map task completion events. |
| MultiFileInputFormat<K,V> | Deprecated. Use CombineFileInputFormat instead |
| MultiFileSplit | Deprecated. Use CombineFileSplit instead |
| OutputCommitter | OutputCommitter describes the commit of task output for a
Map-Reduce job. |
| OutputLogFilter | Deprecated. Use
Utils.OutputFileUtils.OutputLogFilter
instead. |
| QueueAclsInfo | Class to encapsulate Queue ACLs for a particular user. |
| RawHistoryFileServlet | |
| SequenceFileAsBinaryInputFormat | InputFormat reading keys, values from SequenceFiles in binary (raw) format. |
| SequenceFileAsBinaryInputFormat.SequenceFileAsBinaryRecordReader | Read records from a SequenceFile as binary (raw) bytes. |
| SequenceFileAsBinaryOutputFormat | An OutputFormat that writes keys, values to
SequenceFile s in binary(raw) format |
| SequenceFileAsBinaryOutputFormat.WritableValueBytes | Inner class used for appendRaw |
| SequenceFileAsTextInputFormat | This class is similar to SequenceFileInputFormat, except it generates SequenceFileAsTextRecordReader which converts the input keys and values to their String forms by calling toString() method. |
| SequenceFileAsTextRecordReader | This class converts the input keys and values to their String forms by calling toString() method. |
| SequenceFileInputFilter<K,V> | A class that allows a map/red job to work on a sample of sequence files. |
| SequenceFileInputFilter.FilterBase | base class for Filters |
| SequenceFileInputFilter.MD5Filter | This class returns a set of records by examing the MD5 digest of its key against a filtering frequency f. |
| SequenceFileInputFilter.PercentFilter | This class returns a percentage of records The percentage is determined by a filtering frequency f using the criteria record# % f == 0. |
| SequenceFileInputFilter.RegexFilter | Records filter by matching key to regex |
| SequenceFileInputFormat<K,V> | An InputFormat for SequenceFile s. |
| SequenceFileOutputFormat<K,V> | An OutputFormat that writes SequenceFile s. |
| SequenceFileRecordReader<K,V> | An RecordReader for SequenceFile s. |
| ShuffleExceptionTracker | This class is used to track shuffle exceptions. |
| SkipBadRecords | Utility class for skip bad records functionality. |
| Task | Base class for tasks. |
| Task.CombineOutputCollector<K,V> | OutputCollector for the combiner. |
| Task.CombinerRunner<K,V> | |
| Task.CombineValuesIterator<KEY,VALUE> | |
| Task.NewCombinerRunner<K,V> | |
| Task.OldCombinerRunner<K,V> | |
| TaskAttemptContext | |
| TaskAttemptID | TaskAttemptID represents the immutable and unique identifier for a task attempt. |
| TaskCompletionEvent | This is used to track task completion events on job tracker. |
| TaskController | Controls initialization, finalization and clean up of tasks, and also the launching and killing of task JVMs. |
| TaskGraphServlet | The servlet that outputs svg graphics for map / reduce task statuses |
| TaskID | TaskID represents the immutable and unique identifier for a Map or Reduce Task. |
| TaskLog | A simple logger to handle the task-specific user logs. |
| TaskLogAppender | A simple log4j-appender for the task child's map-reduce system logs. |
| TaskLogServlet | A servlet that is run by the TaskTrackers to provide the task logs via http. |
| TaskLogsTruncater | The class for truncating the user logs. |
| TaskReport | A report on the state of a task. |
| TaskStatus | Describes the current status of a task. |
| TaskTracker | TaskTracker is a process that starts and tracks MR Tasks in a networked environment. |
| TaskTracker.MapOutputServlet | This class is used in TaskTracker's Jetty to serve the map outputs to other nodes. |
| TaskTrackerMetricsSource | Instrumentation for metrics v2 |
| TaskTrackerStatus | A TaskTrackerStatus is a MapReduce primitive. |
| TextInputFormat | An InputFormat for plain text files. |
| TextOutputFormat<K,V> | An OutputFormat that writes plain text files. |
| TextOutputFormat.LineRecordWriter<K,V> | |
| UserLogCleaner | This is used only in UserLogManager, to manage cleanup of user logs. |
| Utils | A utility class. |
| Utils.OutputFileUtils | |
| Utils.OutputFileUtils.OutputFilesFilter | This class filters output(part) files from the given directory It does not accept files with filenames _logs and _SUCCESS. |
| Utils.OutputFileUtils.OutputLogFilter | This class filters log files from directory given It doesnt accept paths having _logs. |
| Enum Summary | |
|---|---|
| FileInputFormat.Counter | |
| FileOutputFormat.Counter | |
| JobClient.TaskStatusFilter | |
| JobHistory.Keys | Job history files contain key="value" pairs, where keys belong to this enum. |
| JobHistory.RecordTypes | Record types are identifiers for each line of log in history files. |
| JobHistory.Values | This enum contains some of the values commonly used by history log events. |
| JobInProgress.Counter | |
| JobPriority | Used to describe the priority of the running job. |
| JobTracker.State | |
| Operation | Generic operation that maps to the dependent set of ACLs that drive the authorization of the operation. |
| Task.Counter | |
| TaskCompletionEvent.Status | |
| TaskLog.LogName | The filter for userlogs. |
| TaskStatus.Phase | |
| TaskStatus.State | |
| TIPStatus | The states of a TaskInProgress as seen by the JobTracker. |
| Exception Summary | |
|---|---|
| Counters.CountersExceededException | Counter exception thrown when the number of counters exceed the limit |
| FileAlreadyExistsException | Used when target file already exists for any operation and is not configured to be overwritten. |
| InvalidFileTypeException | Used when file type differs from the desired file type. |
| InvalidInputException | This class wraps a list of problems with the input, so that the user can get a list of problems together instead of finding and fixing them one by one. |
| InvalidJobConfException | This exception is thrown when jobconf misses some mendatory attributes or value of some attributes is invalid. |
| JobTracker.IllegalStateException | A client tried to submit a job before the Job Tracker was ready. |
A software framework for easily writing applications which process vast amounts of data (multi-terabyte data-sets) parallelly on large clusters (thousands of nodes) built of commodity hardware in a reliable, fault-tolerant manner.
A Map-Reduce job usually splits the input data-set into independent
chunks which processed by map tasks in completely parallel manner,
followed by reduce tasks which aggregating their output. Typically both
the input and the output of the job are stored in a
FileSystem
. The framework takes care of monitoring
tasks and re-executing failed ones. Since, usually, the compute nodes and the
storage nodes are the same i.e. Hadoop's Map-Reduce framework and Distributed
FileSystem are running on the same set of nodes, tasks are effectively scheduled
on the nodes where data is already present, resulting in very high aggregate
bandwidth across the cluster.
The Map-Reduce framework operates exclusively on <key, value>
pairs i.e. the input to the job is viewed as a set of <key, value>
pairs and the output as another, possibly different, set of
<key, value> pairs. The keys and values have to
be serializable as Writable
s and additionally the
keys have to be WritableComparable
s in
order to facilitate grouping by the framework.
Data flow:
(input) <k1, v1> | V map | V <k2, v2> | V combine | V <k2, v2> | V reduce | V <k3, v3> (output)
Applications typically implement
Mapper.map(Object, Object, OutputCollector, Reporter)
and
Reducer.reduce(Object, Iterator, OutputCollector, Reporter)
methods. The application-writer also specifies various facets of the job such
as input and output locations, the Partitioner, InputFormat
& OutputFormat implementations to be used etc. as
a JobConf
. The client program,
JobClient
, then submits the job to the framework
and optionally monitors it.
The framework spawns one map task per
InputSplit
generated by the
InputFormat
of the job and calls
Mapper.map(Object, Object, OutputCollector, Reporter)
with each <key, value> pair read by the
RecordReader
from the InputSplit for
the task. The intermediate outputs of the maps are then grouped by keys
and optionally aggregated by combiner. The key space of intermediate
outputs are paritioned by the Partitioner
, where
the number of partitions is exactly the number of reduce tasks for the job.
The reduce tasks fetch the sorted intermediate outputs of the maps, via http,
merge the <key, value> pairs and call
Reducer.reduce(Object, Iterator, OutputCollector, Reporter)
for each <key, list of values> pair. The output of the reduce tasks' is
stored on the FileSystem by the
RecordWriter
provided by the
OutputFormat
of the job.
Map-Reduce application to perform a distributed grep:
public class Grep extends Configured implements Tool { // map: Search for the pattern specified by 'grep.mapper.regex' & // 'grep.mapper.regex.group' class GrepMapper<K, Text> extends MapReduceBase implements Mapper<K, Text, Text, LongWritable> { private Pattern pattern; private int group; public void configure(JobConf job) { pattern = Pattern.compile(job.get("grep.mapper.regex")); group = job.getInt("grep.mapper.regex.group", 0); } public void map(K key, Text value, OutputCollector<Text, LongWritable> output, Reporter reporter) throws IOException { String text = value.toString(); Matcher matcher = pattern.matcher(text); while (matcher.find()) { output.collect(new Text(matcher.group(group)), new LongWritable(1)); } } } // reduce: Count the number of occurrences of the pattern class GrepReducer<K> extends MapReduceBase implements Reducer<K, LongWritable, K, LongWritable> { public void reduce(K key, Iterator<LongWritable> values, OutputCollector<K, LongWritable> output, Reporter reporter) throws IOException { // sum all values for this key long sum = 0; while (values.hasNext()) { sum += values.next().get(); } // output sum output.collect(key, new LongWritable(sum)); } } public int run(String[] args) throws Exception { if (args.length < 3) { System.out.println("Grep <inDir> <outDir> <regex> [<group>]"); ToolRunner.printGenericCommandUsage(System.out); return -1; } JobConf grepJob = new JobConf(getConf(), Grep.class); grepJob.setJobName("grep"); FileInputFormat.setInputPaths(grepJob, new Path(args[0])); FileOutputFormat.setOutputPath(grepJob, args[1]); grepJob.setMapperClass(GrepMapper.class); grepJob.setCombinerClass(GrepReducer.class); grepJob.setReducerClass(GrepReducer.class); grepJob.set("mapred.mapper.regex", args[2]); if (args.length == 4) grepJob.set("mapred.mapper.regex.group", args[3]); grepJob.setOutputFormat(SequenceFileOutputFormat.class); grepJob.setOutputKeyClass(Text.class); grepJob.setOutputValueClass(LongWritable.class); JobClient.runJob(grepJob); return 0; } public static void main(String[] args) throws Exception { int res = ToolRunner.run(new Configuration(), new Grep(), args); System.exit(res); } }
Notice how the data-flow of the above grep job is very similar to doing the same via the unix pipeline:
cat input/* | grep | sort | uniq -c > out
input | map | shuffle | reduce > out
Hadoop Map-Reduce applications need not be written in JavaTM only. Hadoop Streaming is a utility which allows users to create and run jobs with any executables (e.g. shell utilities) as the mapper and/or the reducer. Hadoop Pipes is a SWIG-compatible C++ API to implement Map-Reduce applications (non JNITM based).
See Google's original Map/Reduce paper for background information.
Java and JNI are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.
|
||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |


This appendix contains sample versions of the four programs described in the book. These are the adventure game (Nani Search), the intelligent genealogical logicbase (Family), the customer order entry system (Custord), and the expert system (Birds).
% NANI SEARCH - A sample adventure game % Copyright (C) 1990-1995 Amzi! inc. % All rights reserved % Nani Search is designed to illustrate Prolog programming. It % is an implementation of the principle example used in % this tutorial. main:- nani_search. % main entry point nani_search:- init_dynamic_facts, % predicates which are not compiled write('NANI SEARCH - A Sample Adventure Game'),nl, write('Copyright (C) Amzi! inc. 1990-1995'),nl, write('No rights reserved, use it as you wish'),nl, nl, write('Nani Search is designed to illustrate Prolog programming.'),nl, write('As such, it might be the simplest adventure game. The game'),nl, write('is the primary example used in this tutorial.'),nl, write('Full source is included as well.'),nl, nl, write('Your persona as the adventurer is that of a three year'),nl, write('old. The Nani is your security blanket. It is getting'),nl, write('late and you''re tired, but you can''t go to sleep'),nl, write('without your Nani. Your mission is to find the Nani.'),nl, nl, write('You control the game by using simple English commands'),nl, write('expressing the action you wish to take. You can go to'),nl, write('other rooms, look at your surroundings, look in things'),nl, write('take things, drop things, eat things, inventory the'),nl, write('things you have, and turn things on and off.'),nl, nl, write('Hit any key to continue.'),get0(_), write('Type "help" if you need more help on mechanics.'),nl, write('Type "hint" if you want a big hint.'),nl, write('Type "quit" if you give up.'),nl, nl, write('Enjoy the hunt.'),nl, look, % give a look before starting the game command_loop. % command_loop - repeats until either the nani is found or the % player types quit command_loop:- repeat, get_command(X), do(X), (nanifound; X == quit). % do - matches the input command with the predicate which carries out % the command. More general approaches which might work in the % listener are not supported in the compiler. This approach % also gives tighter control over the allowable commands. % The cuts prevent the forced failure at the end of "command_loop" % from backtracking into the command predicates. do(goto(X)):-goto(X),!. do(nshelp):-nshelp,!. do(hint):-hint,!. do(inventory):-inventory,!. do(take(X)):-take(X),!. do(drop(X)):-drop(X),!. do(eat(X)):-eat(X),!. do(look):-look,!. do(turn_on(X)):-turn_on(X),!. do(turn_off(X)):-turn_off(X),!. do(look_in(X)):-look_in(X),!. do(quit):-quit,!. % These are the predicates which control exit from the game. If % the player has taken the nani, then the call to "have(nani)" will % succeed and the command_loop will complete. Otherwise it fails % and command_loop will repeat. nanifound:- have(nani), write('Congratulations, you saved the Nani.'),nl, write('Now you can rest secure.'),nl,nl. quit:- write('Giving up? It''s going to be a scary night'),nl, write('and when you get the Nani it''s not going'),nl, write('to smell right.'),nl,nl. % The help command nshelp:- write('Use simple English sentences to enter commands.'),nl, write('The commands can cause you to:'),nl, nl, write(' go to a room (ex. go to the office)'),nl, write(' look around (ex. look)'),nl, write(' look in something (ex. look in the desk)'),nl, write(' take something (ex. take the apple)'),nl, write(' drop something (ex. drop the apple)'),nl, write(' eat something (ex. eat the apple)'),nl, write(' turn something on (ex. turn on the light)'),nl, write(' inventory your things (ex. inventory)'),nl, nl, write('The examples are verbose, terser commands and synonyms'),nl, write('are usually accepted.'),nl,nl, write('Hit any key to continue.'),nl, get0(_), look. hint:- write('You need to get to the cellar, and you can''t unless'),nl, write('you get some light. You can''t turn on the cellar'),nl, write('light, but there is a flash light in the desk in the'),nl, write('office you might use.'),nl,nl, look. % Initial facts describing the world. Rooms and doors do not change, % so they are compiled. room(office). room(kitchen). room('dining room'). room(hall). room(cellar). door(office,hall). door(hall,'dining room'). door('dining room',kitchen). door(kitchen,cellar). door(kitchen,office). connect(X,Y):- door(X,Y). connect(X,Y):- door(Y,X). % These facts are all subject to change during the game, so rather % than being compiled, they are "asserted" to the listener at % run time. This predicate is called when "nanisrch" starts up. init_dynamic_facts:- assertz(location(desk,office)), assertz(location(apple,kitchen)), assertz(location(flashlight,desk)), assertz(location('washing machine',cellar)), assertz(location(nani,'washing machine')), assertz(location(table,kitchen)), assertz(location(crackers,desk)), assertz(location(broccoli,kitchen)), assertz(here(kitchen)), assertz(turned_off(flashlight)). furniture(desk). furniture('washing machine'). furniture(table). edible(apple). edible(crackers). tastes_yuchy(broccoli). %%%%%%%% COMMANDS %%%%%%%%%%%%%%%%%%%%%%%%%% % goto moves the player from room to room. goto(Room):- can_go(Room), % check for legal move puzzle(goto(Room)), % check for special conditions moveto(Room), % go there and tell the player look. goto(_):- look. can_go(Room):- % if there is a connection it here(Here), % is a legal move. connect(Here,Room),!. can_go(Room):- respond(['You can''t get to ',Room,' from here']),fail. moveto(Room):- % update the logicbase with the retract(here(_)), % new room asserta(here(Room)). % look lists the things in a room, and the connections look:- here(Here), respond(['You are in the ',Here]), write('You can see the following things:'),nl, list_things(Here), write('You can go to the following rooms:'),nl, list_connections(Here). list_things(Place):- location(X,Place), tab(2),write(X),nl, fail. list_things(_). list_connections(Place):- connect(Place,X), tab(2),write(X),nl, fail. list_connections(_). % look_in allows the player to look inside a thing which might % contain other things look_in(Thing):- location(_,Thing), % make sure there's at least one write('The '),write(Thing),write(' contains:'),nl, list_things(Thing). look_in(Thing):- respond(['There is nothing in the ',Thing]). % take allows the player to take something. As long as the thing is % contained in the room it can be taken, even if the adventurer hasn't % looked in the the container which contains it. Also the thing % must not be furniture. take(Thing):- is_here(Thing), is_takable(Thing), move(Thing,have), respond(['You now have the ',Thing]). is_here(Thing):- here(Here), contains(Thing,Here),!. % don't backtrack is_here(Thing):- respond(['There is no ',Thing,' here']), fail. contains(Thing,Here):- % recursive definition to find location(Thing,Here). % things contained in things etc. contains(Thing,Here):- location(Thing,X), contains(X,Here). is_takable(Thing):- % you can't take the furniture furniture(Thing), respond(['You can''t pick up a ',Thing]), !,fail. is_takable(_). % not furniture, ok to take move(Thing,have):- retract(location(Thing,_)), % take it from its old place asserta(have(Thing)). % and add to your possessions % drop - allows the player to transfer a possession to a room drop(Thing):- have(Thing), % you must have the thing to drop it here(Here), % where are we retract(have(Thing)), asserta(location(Thing,Here)). drop(Thing):- respond(['You don''t have the ',Thing]). % eat, because every adventure game lets you eat stuff. eat(Thing):- have(Thing), eat2(Thing). eat(Thing):- respond(['You don''t have the ',Thing]). eat2(Thing):- edible(Thing), retract(have(Thing)), respond(['That ',Thing,' was good']). eat2(Thing):- tastes_yuchy(Thing), respond(['Three year olds don''t eat ',Thing]). eat2(Thing):- respond(['You can''t eat a ',Thing]). % inventory list your possesions inventory:- have(X), % make sure you have at least one thing write('You have: '),nl, list_possessions. inventory:- write('You have nothing'),nl. list_possessions:- have(X), tab(2),write(X),nl, fail. list_possessions. % turn_on recognizes two cases. If the player tries to simply turn % on the light, it is assumed this is the room light, and the % appropriate error message is issued. Otherwise turn_on has to % refer to an object which is turned_off. turn_on(light):- respond(['You can''t reach the switch and there''s nothing to stand on']). turn_on(Thing):- have(Thing), turn_on2(Thing). turn_on(Thing):- respond(['You don''t have the ',Thing]). turn_on2(Thing):- turned_on(Thing), respond([Thing,' is already on']). turn_on2(Thing):- turned_off(Thing), retract(turned_off(Thing)), asserta(turned_on(Thing)), respond([Thing,' turned on']). turn_on2(Thing):- respond(['You can''t turn a ',Thing,' on']). % turn_off - I didn't feel like implementing turn_off turn_off(Thing):- respond(['I lied about being able to turn things off']). % The only special puzzle in Nani Search has to do with going to the % cellar. Puzzle is only called from goto for this reason. Other % puzzles pertaining to other commands could easily be added. puzzle(goto(cellar)):- have(flashlight), turned_on(flashlight),!. puzzle(goto(cellar)):- write('You can''t go to the cellar because it''s dark in the'),nl, write('cellar, and you''re afraid of the dark.'),nl, !,fail. puzzle(_). % respond simplifies writing a mixture of literals and variables respond([]):- write('.'),nl,nl. respond([H|T]):- write(H), respond(T). % Simple English command listener. It does some semantic checking % and allows for various synonyms. Within a restricted subset of % English, a command can be phrased many ways. Also non grammatical % constructs are understood, for example just giving a room name % is interpreted as the command to goto that room. % Some interpretation is based on the situation. Notice that when % the player says turn on the light it is ambiguous. It could mean % the room light (which can't be turned on in the game) or the % flash light. If the player has the flash light it is interpreted % as flash light, otherwise it is interpreted as room light. get_command(C):- readlist(L), % reads a sentence and puts [it,in,list,form] command(X,L,[]), % call the grammar for command C =.. X,!. % make the command list a structure get_command(_):- respond(['I don''t understand, try again or type help']),fail. % The grammar doesn't have to be real English. There are two % types of commands in Nani Search, those with and without a % single argument. A special case is also made for the command % goto which can be activated by simply giving a room name. command([Pred,Arg]) --> verb(Type,Pred),nounphrase(Type,Arg). command([Pred]) --> verb(intran,Pred). command([goto,Arg]) --> noun(go_place,Arg). % Recognize three types of verbs. Each verb corresponds to a command, % but there are many synonyms allowed. For example the command % turn_on will be triggered by either "turn on" or "switch on". verb(go_place,goto) --> go_verb. verb(thing,V) --> tran_verb(V). verb(intran,V) --> intran_verb(V). go_verb --> [go]. go_verb --> [go,to]. go_verb --> [g]. tran_verb(take) --> [take]. tran_verb(take) --> [pick,up]. tran_verb(drop) --> [drop]. tran_verb(drop) --> [put]. tran_verb(drop) --> [put,down]. tran_verb(eat) --> [eat]. tran_verb(turn_on) --> [turn,on]. tran_verb(turn_on) --> [switch,on]. tran_verb(turn_off) --> [turn,off]. tran_verb(look_in) --> [look,in]. tran_verb(look_in) --> [look]. tran_verb(look_in) --> [open]. intran_verb(inventory) --> [inventory]. intran_verb(inventory) --> [i]. intran_verb(look) --> [look]. intran_verb(look) --> [look,around]. intran_verb(look) --> [l]. intran_verb(quit) --> [quit]. intran_verb(quit) --> [exit]. intran_verb(quit) --> [end]. intran_verb(quit) --> [bye]. intran_verb(nshelp) --> [help]. intran_verb(hint) --> [hint]. % a noun phrase is just a noun with an optional determiner in front. nounphrase(Type,Noun) --> det,noun(Type,Noun). nounphrase(Type,Noun) --> noun(Type,Noun). det --> [the]. det --> [a]. % Nouns are defined as rooms, or things located somewhere. We define % special cases for those things represented in Nani Search by two % words. We can't expect the user to type the name in quotes. noun(go_place,R) --> [R], {room(R)}. noun(go_place,'dining room') --> [dining,room]. noun(thing,T) --> [T], {location(T,_)}. noun(thing,T) --> [T], {have(T)}. noun(thing,flashlight) --> [flash,light]. noun(thing,'washing machine') --> [washing,machine]. noun(thing,'dirty clothes') --> [dirty,clothes]. % If the player has just typed light, it can be interpreted three ways. % If a room name is before it, it must be a room light. If the % player has the flash light, assume it means the flash light. Otherwise % assume it is the room light. noun(thing,light) --> [X,light], {room(X)}. noun(thing,flashlight) --> [light], {have(flashlight)}. noun(thing,light) --> [light]. % readlist - read a list of words, based on a Clocksin & Mellish % example. readlist(L):- write('> '), read_word_list(L). read_word_list([W|Ws]) :- get0(C), readword(C, W, C1), % Read word starting with C, C1 is first new restsent(C1, Ws), !. % character - use it to get rest of sentence restsent(C,[]) :- lastword(C), !. % Nothing left if hit last-word marker restsent(C,[W1|Ws]) :- readword(C,W1,C1), % Else read next word and rest of sentence restsent(C1,Ws). readword(C,W,C1) :- % Some words are single characters single_char(C), % i.e. punctuation !, name(W, [C]), % get as an atom get0(C1). readword(C, W, C1) :- is_num(C), % if we have a number -- !, number_word(C, W, C1, _). % convert it to a genuine number readword(C,W,C2) :- % otherwise if character does not in_word(C, NewC), % delineate end of word - keep get0(C1), % accumulating them until restword(C1,Cs,C2), % we have all the word name(W, [NewC|Cs]). % then make it an atom readword(C,W,C2) :- % otherwise get0(C1), readword(C1,W,C2). % start a new word restword(C, [NewC|Cs], C2) :- in_word(C, NewC), get0(C1), restword(C1, Cs, C2). restword(C, [], C). single_char(`,). single_char(`;). single_char(`:).single_char(`?). single_char(`!). single_char(`.). in_word(C, C) :- C >= `a, C =< `z. in_word(C, L) :- C >= `A, C =< `Z, L is C + 32. in_word(`',`'). in_word(`-,`-). % Have character C (known integer) - keep reading integers and build % up the number until we hit a non-integer. Return this in C1, % and return the computed number in W. number_word(C, W, C1, Pow10) :- is_num(C), !, get0(C2), number_word(C2, W1, C1, P10), Pow10 is P10 * 10, W is integer(((C - `0) * Pow10) + W1). number_word(C, 0, C, 0.1). is_num(C) :- C =< `9, C >= `0. % These symbols delineate end of sentence lastword(10). % end if new line entered lastword(`.). lastword(`!). lastword(`?).
% GENE.PRO - genealogical relationships % % Copyright (c) 1987-1995 Amzi! inc. % All rights reserved % % A Prolog database of relations derived from basic information about % individuals. The relations ships can all be read as 'relationship % of', so for example, parent(P,C) means P is parent of C. % % When there is a performance trade-of in the implementation of a rule, % it is assumed that in general the second argument of a relation will % most likely be bound. See for example full_sibling/2, which will % have a smaller search for full_sibling(X,joe), than full_sibling(joe,X). % % This code is used as an example of an embedded Prolog application. % One is a C++ application and the other Visual Basic. % % To use this code from Prolog, consult it in the listener and use the % following predicates: % % open(F) - opens a file of family relationships, ex. open('england.fam'). % open/1 just does a consult, so you can use consult instead. % close - retracts all the persons currently defined % save(F) - saves the persons in the named file % add_person(Name, Mother, Father, Gender, Spouse) - adds a person % fact with the specified attributes, checking semantics as it does % Relationship(P1, P2) - any relationship query, such as child(X,Y). % relation(R, P1, P2) - can be used to find the relationship between % individuals as well as pose relationship queries. parent(P,C) :- (mother(P,C) ; father(P,C)). child(C,P) :- parent(P,C). son(C,P) :- parent(P,C), male(C). daughter(C,P) :- parent(P,C), female(C). wife(W,P) :- spouse(W,P), female(W). husband(H,P) :- spouse(H,P), male(H). ancestor(A,P) :- parent(A,P). ancestor(A,P) :- parent(X,P), ancestor(A,X). descendent(D,P) :- parent(P,D). descendent(D,P) :- parent(P,X), descendent(D,X). full_sibling(S1, S2) :- mother(M,S2), mother(M,S1), S1 \= S2, father(F,S1), father(F,S2). half_sibling(S1, S2) :- mother(M,S2), mother(M,S1), S1 \= S2, father(F1,S1), father(F2,S2), F1 \= F2. half_sibling(S1, S2) :- father(F,S2), father(F,S1), S1 \= S2, mother(M1,S1), mother(M2,S2), M1 \= M2. sibling(S1, S2) :- full_sibling(S1,S2). sibling(S1, S2) :- half_sibling(S1,S2). sister(S,P) :- sibling(S,P), female(S). brother(B,P) :- sibling(B,P), male(B). step_sibling(S1, S2) :- parent(P2, S2), spouse(M2, P2), parent(M2, S1), not(parent(M2,S2)), not(half_sibling(S1,S2)). uncle(U,X) :- parent(P,X), brother(U,P). aunt(A,X) :- parent(P,X), sister(A,P). step_parent(P2,C) :- parent(P,C), spouse(P2,P), not(parent(P2,C)). step_mother(M,C) :- step_parent(M,C), female(M). step_father(F,C) :- step_parent(F,C), male(F). step_child(C2,P) :- step_parent(P,C2). step_daughter(D,P) :- step_child(D,P), female(D). step_son(S,P) :- step_child(S,P), male(S). nephew(N,X) :- sibling(S,X), parent(S,N), male(N). niece(N,X) :- sibling(S,X), parent(S,N), female(N). cousin(X,Y) :- parent(P,Y), sibling(S,P), parent(S,X). grandmother(GM,X) :- parent(P,X), mother(GM,P). grandfather(GF,X) :- parent(P,X), father(GF,P). grandparent(GP,X) :- parent(P,X), parent(GP,P). grandson(GS,X) :- grandchild(GS,X), male(GS). granddaughter(GD,X) :- grandchild(GD,X), female(GD). grandchild(GC,X) :- parent(X,C), parent(C,GC). %---------------------------------------------------------------------- % relation/3 - used to find relationships between individuals % relations([parent, wife, husband, ancestor, descendent, full_sibling, half_sibling, sibling, sister, brother, step_sibling, uncle, aunt, mother, father, child, son, daughter, step_parent, step_child, step_mother, step_father, step_son, step_daughter, nephew, niece, cousin, grandmother, grandfather, grandparent, grandson, granddaughter, grandchild]). relation(R, X, Y) :- relations(Rs), member(R,Rs), Q =.. [R,X,Y], call(Q). %---------------------------------------------------------------------- % person object % % These predicates define the interface to a person. All of the % genealogical rules are based on these predicates, which are % based on the basic representation of a person. These are the % only rules which need to be changed if the representation of % a person is changed. % % The current representation is flat database relations of the form: % person(Name, Gender, Mother, Father, Spouse). % add(Name,Gender,Mother,Father,Spouse) :- assert(person(Name,Gender,Mother,Father,Spouse)). add(Name,_,_,_,_) :- delete(Name), fail. open(FileName) :- consult(FileName). close :- retractall(person(_,_,_,_,_)). save(FileName) :- tell(FileName), listing(person), told. delete(X) :- retract(person(X,_,_,_,_)). person(X) :- person(X,_,_,_,_). male(X) :- person(X,male,_,_,_). female(Y) :- person(Y,female,_,_,_). mother(M,C) :- person(C,_,M,_,_). father(F,C) :- person(C,_,_,F,_). spouse(S,P) :- person(P,_,_,_,S), S \= single.
% CUSTORD % Copyright (c) 1990-1995 Amzi! inc. % All rights reserved % This is a sample Prolog program which implements a portion % of a customer order inventory application. It is not intended to % be complete, and only illustrates the concept of writing a database % application in Prolog. % This example extends the concept of an intelligent database to include % a full database application. It is really a rule based approach to % transaction processing. In fact a large percentage of the procedural % code normally written in database applications has to do with % enforcing semantic integrity rules involving multiple records. % The distinction between data and process is thoroughly blurred. Both % reside together in the same logicbase. % There is pure data as it might be defined in a relational database % (customer, item, inventory, order); there are rules which really % represent data views (item_quant); there are rules which add % intelligence to the logicbase (good_customer, valid_order); and there % are rules which are processes (order, report_inventory). main :- order. % customer(Name, Town, Credit-rating). customer(dennis, winchester, xxx). customer(dave, lexington, aaa). customer(ron, lexington, bbb). customer(julie, winchester, aaa). customer(jawaid, cambridge, aaa). customer(tom, newton, ccc). % item(Number, Name, Reorder-quantity). item(p1,thing,10). item(p2,stuff,10). item(p3,article,10). item(p4,object,10). item(p5,substance,10). item(p6,piece,10). item(p7,matter,10). % inventory(Number, Quantity). inventory(p1,10). inventory(p2,10). inventory(p3,10). inventory(p4,78). inventory(p5,23). inventory(p6,14). inventory(p7,8). % item-inv view or join item_quant(Item, Quantity):- item(Partno, Item, _), inventory(Partno, Quantity). % reorder if inventory below reorder point reorder(Item):- item(Partno, Item, Reorder_point), inventory(Partno, Quantity), Quantity < Reorder_point, write('Time to reorder '), write(Item), nl. reorder(Item):- write('Inventory level ok for '), write(Item), nl. % a good customer has a credit rating of aaa % or lives in winchester % or has ordered something good_customer(Cust):- customer(Cust, _, aaa). good_customer(Cust):- customer(Cust, winchester, _). good_customer(Cust):- order(Cust, _, _). % process order order:- write('Customer: '), read(Customer), write('Item: '), read(Item), write('Quantity: '), read(Quantity), valid_order(Customer,Item,Quantity), asserta(order(Customer,Item,Quantity)), update_inventory(Item,Quantity), reorder(Item). % an order is valid if % it doesn't go below zero inventory and % the customer is a good customer valid_order(C, I, Q):- item(Partno, I, _), inventory(Partno, Onhand), Q =< Onhand, good_customer(C). valid_order(C, I, Q):- write('Bad order'), nl, fail. % update the inventory update_inventory(I,Q):- item(Pn, I, _), inventory(Pn, Amount), NewQ is Amount - Q, retract(inventory(Pn, Amount)), asserta(inventory(Pn, NewQ)). % inventory report report_inventory:- item_quant(I, Q), write(I), tab(1), write(Q), nl, fail. report_inventory:-true.
% BIRDS % Copyright (c) 1990-1995 Amzi! inc. % All rights reserved % This is a sample of a classification expert system for identification % of certain kinds of birds. The rules are rough excerpts from "Birds of % North America" by Robbins, Bruum, Zim, and Singer. % This type of expert system can easily use Prolog's built in inferencing % system. While trying to satisfy the goal "bird" it tries to satisfy % various subgoals, some of which will ask for information from the % user. % The information is all stored as attribute-value pairs. The attribute % is represented as a predicate, and the value as the argument to the % predicate. For example, the attribute-value pair "color-brown" is % stored "color(brown)". % "identify" is the high level goal that starts the program. The % predicate "known/3" is used to remember answers to questions, so it % is cleared at the beginning of the run. % The rules of identification are the bulk of the code. They break up % the problem into identifying orders and families before identifying % the actual birds. % The end of the code lists those attribute-value pairs which need % to be asked for, and defines the predicate "ask" and "menuask" % which are used to get information from the user, and remember it. main :- identify. identify:- retractall(known(_,_,_)), % clear stored information bird(X), write('The bird is a '),write(X),nl. identify:- write('I can''t identify that bird'),nl. order(tubenose):- nostrils(external_tubular), live(at_sea), bill(hooked). order(waterfowl):- feet(webbed), bill(flat). order(falconiforms):- eats(meat), feet(curved_talons), bill(sharp_hooked). order(passerformes):- feet(one_long_backward_toe). family(albatross):- order(tubenose), size(large), wings(long_narrow). family(swan):- order(waterfowl), neck(long), color(white), flight(ponderous). family(goose):- order(waterfowl), size(plump), flight(powerful). family(duck):- order(waterfowl), feed(on_water_surface), flight(agile). family(vulture):- order(falconiforms), feed(scavange), wings(broad). family(falcon):- order(falconiforms), wings(long_pointed), head(large), tail(narrow_at_tip). family(flycatcher):- order(passerformes), bill(flat), eats(flying_insects). family(swallow):- order(passerformes), wings(long_pointed), tail(forked), bill(short). bird(laysan_albatross):- family(albatross), color(white). bird(black_footed_albatross):- family(albatross), color(dark). bird(fulmar):- order(tubenose), size(medium), flight(flap_glide). bird(whistling_swan):- family(swan), voice(muffled_musical_whistle). bird(trumpeter_swan):- family(swan), voice(loud_trumpeting). bird(canada_goose):- family(goose), season(winter), % rules can be further broken down country(united_states), % to include regions and migration head(black), % patterns cheek(white). bird(canada_goose):- family(goose), season(summer), country(canada), head(black), cheek(white). bird(snow_goose):- family(goose), color(white). bird(mallard):- family(duck), % different rules for male voice(quack), head(green). bird(mallard):- family(duck), % and female voice(quack), color(mottled_brown). bird(pintail):- family(duck), voice(short_whistle). bird(turkey_vulture):- family(vulture), flight_profile(v_shaped). bird(california_condor):- family(vulture), flight_profile(flat). bird(sparrow_hawk):- family(falcon), eats(insects). bird(peregrine_falcon):- family(falcon), eats(birds). bird(great_crested_flycatcher):- family(flycatcher), tail(long_rusty). bird(ash_throated_flycatcher):- family(flycatcher), throat(white). bird(barn_swallow):- family(swallow), tail(forked). bird(cliff_swallow):- family(swallow), tail(square). bird(purple_martin):- family(swallow), color(dark). country(united_states):- region(new_england). country(united_states):- region(south_east). country(united_states):- region(mid_west). country(united_states):- region(south_west). country(united_states):- region(north_west). country(united_states):- region(mid_atlantic). country(canada):- province(ontario). country(canada):- province(quebec). country(canada):- province(etc). region(new_england):- state(X), member(X, [massachusetts, vermont, etc]). region(south_east):- state(X), member(X, [florida, mississippi, etc]). region(canada):- province(X), member(X, [ontario,quebec,etc]). nostrils(X):- ask(nostrils,X). live(X):- ask(live,X). bill(X):- ask(bill,X). size(X):- menuask(size,X,[large,plump,medium,small]). eats(X):- ask(eats,X). feet(X):- ask(feet,X). wings(X):- ask(wings,X). neck(X):- ask(neck,X). color(X):- ask(color,X). flight(X):- menuask(flight,X,[ponderous,powerful,agile,flap_glide,other]). feed(X):- ask(feed,X). head(X):- ask(head,X). tail(X):- menuask(tail,X,[narrow_at_tip,forked,long_rusty,square,other]). voice(X):- ask(voice,X). season(X):- menuask(season,X,[winter,summer]). cheek(X):- ask(cheek,X). flight_profile(X):- menuask(flight_profile,X,[flat,v_shaped,other]). throat(X):- ask(throat,X). state(X):- menuask(state,X,[massachusetts,vermont,florida,mississippi,etc]). province(X):- menuask(province,X,[ontario,quebec,etc]). % "ask" is responsible for getting information from the user, and remembering % the users response. If it doesn't already know the answer to a question % it will ask the user. It then asserts the answer. It recognizes two % cases of knowledge: 1) the attribute-value is known to be true, % 2) the attribute-value is known to be false. % This means an attribute might have multiple values. A third test to % see if the attribute has another value could be used to enforce % single valued attributes. (This test is commented out below) % For this system the menuask is used for attributes which are single % valued % "ask" only deals with simple yes or no answers. a "yes" is the only % yes value. any other response is considered a "no". ask(Attribute,Value):- known(yes,Attribute,Value), % succeed if we know its true !. % and dont look any further ask(Attribute,Value):- known(_,Attribute,Value), % fail if we know its false !, fail. ask(Attribute,_):- known(yes,Attribute,_), % fail if we know its some other value. !, fail. % the cut in clause #1 ensures that if % we get here the value is wrong. ask(A,V):- write(A:V), % if we get here, we need to ask. write('? (yes or no): '), read(Y), % get the answer asserta(known(Y,A,V)), % remember it so we dont ask again. Y = yes. % succeed or fail based on answer. % "menuask" is like ask, only it gives the user a menu to to choose % from rather than a yes on no answer. In this case there is no % need to check for a negative since "menuask" ensures there will % be some positive answer. menuask(Attribute,Value,_):- known(yes,Attribute,Value), % succeed if we know !. menuask(Attribute,_,_):- known(yes,Attribute,_), % fail if its some other value !, fail. menuask(Attribute,AskValue,Menu):- nl,write('What is the value for '),write(Attribute),write('?'),nl, display_menu(Menu), write('Enter the number of choice> '), read(Num),nl, pick_menu(Num,AnswerValue,Menu), asserta(known(yes,Attribute,AnswerValue)), AskValue = AnswerValue. % succeed or fail based on answer display_menu(Menu):- disp_menu(1,Menu), !. % make sure we fail on backtracking disp_menu(_,[]). disp_menu(N,[Item | Rest]):- % recursively write the head of write(N),write(' : '),write(Item),nl, % the list and disp_menu the tail NN is N + 1, disp_menu(NN,Rest). pick_menu(N,Val,Menu):- integer(N), % make sure they gave a number pic_menu(1,N,Val,Menu), !. % start at one pick_menu(Val,Val,_). % if they didn't enter a number, use % what they entered as the value pic_menu(_,_,none_of_the_above,[]). % if we've exhausted the list pic_menu(N,N, Item, [Item|_]). % the counter matches the number pic_menu(Ctr,N, Val, [_|Rest]):- NextCtr is Ctr + 1, % try the next one pic_menu(NextCtr, N, Val, Rest).
Copyright ©1990,1996-97, 2004 Amzi! inc. All Rights Reserved


treatment COVID- clinical {border-style patients px;} #ffffff;} virus trials coronavirus SARS-CoV- substances days viral (). infection known ACE antiviral efficacy inhibits new px; respiratory trial vaccine {font-family chloroquine developed drug enzyme font-size hepatitis human infections licensed China activity administration analog day disease double; influenza novel protease treat vaccines (table Med PCR-confirmed Patients Remdesivir SARS Wuhan, action border-color border-width cell chronic course daily drugs effect effective high initiated number pneumonia potential remdesivir solid; standard studies viruses {font-style {font-weight ÂµM April Ebola Engl Medical Open acute bold cells coronaviruses courier; different em; herpes host infection, means nucleoside patient prevention pt;} receptor spread time treated used vitro


Early Animation
"the technique of photographing successive drawings or positions of puppets or models to create an illusion of movement when the movie is shown as a sequence."
Multiplane Camera
Ub Iwerks
Cel Animation
How the MPC came about
Before the MPC was invented, animators found it difficult to create tracking shots using the
traditional animation style. Animating forward motions became costly and time consuming.
The MPC fixed this by creating a realistic sense of depth in a cartoon setting.
- The MPC has been used for about 56 years
- 101 Dalmatians, Pinocchio, Dumbo, Bambi, etc. were all made using the MPC
- "Snow White and the Seven Dwarfs" was the first and "The Little Mermaid" was the last movie made using this technology
The Evolution of Disney Animation
- Cel and Multiplane Animation (1920s-1989)
- -Cinderella, Alice in Wonderland, Peter Pan
- CGI Animation (1990s-Today)
- -Aladdin, Beauty and the Beast, The Lion King
- Live Action (2006-Today)
- -Beauty and the Beast, Jungle Book, Maleficent
How would this hold up today?
Would we see this kind of animation today?
No.


A New Soundscape
Web Audio & MIDI
Ruth John | @Rumyra
Ruth John | @Rumyra
Hello
Hello Viewsource!
Real pleasure to be here. My name is Ruth, I'm here to talk to u about audio & midi, on the web.
I have to bypass intros as I have a lot to get through - you can find me on this thing the internet @rumyra twitter github codepen
I have this much to get through...
This is a video of me scrolling through the specification.. sped up 8 times - this is the working draft from last year - it moved into candidate recommendation last month. 6 years, it's here to stay.
It's a spec unto itself really - by the way the length of that video before I sped it up was 2 1/2 mins!
It's silly long.
If you're not from a musical background it can be pretty intimidating.
MDN DOCS
MDN docs of methods, functions, properties, events. I mean what even is a cent. Top tip - it's not a denomination of a currency.
Was this article helpful? To be honest it actually is. These docs are the most helpful. Go here.
The other barrier to entry when we talk about web audio - or when I do - is I see peoples minds - they do this:
Real website - camerons world
A website playing background music - the modern version of which is something like this:
bgsound isn't a tag anymore - we don't have to deal with this
Then there's the modern day equivilant.
An annoying advert that autoplays - yes I know.
http://afternooncareer.com/lp/int/uk/dn24/clx.htm
I mean this is intrusive and pretty horrible, ur probably trying to read an article
We have some measures in browsers now to help with this autoplay fiasco, which I'll discuss - so bearing in mind neither of these things are a thing
But actually there's some really great examples of audio just being used on plain ol' websites.
futurelibrary.no
This is my favourite, this is a project from Norway called future library, where they're growing a forest and getting authors to write books for every tree and every year.
Sounds are playing throughout, but beautiful & well thought out even mute fades it out
86andahalfyears.com
This is 86 and half years. A story website about the musings of an 86 1/2 yesr old man. But presented so excellently.
None of the sounds on these websites are intrusive, they enhance the experience, these aren't websites you flick to, or just read, you discover them. There is a place for audio here.
learningmusic.ableton.com
The web is connectivity, information - what better use than education.
Ableton, who make music software & instruments, launched this website giving users an overview to learn music.
Sure the subject matter is audio, but without the extensive functionality of the audio api this wouldn't be possible.
So how do we create experiences like these?

In reality, sounds aren't likely to be this pure - as I'm talking to you - the sound my voice is more distorted - more jaggy wave.
Now what we do when we record this digitally, is we take the amplitude value at a given time, we record that and that's what we're interpreting when we're playing it back.
Common rate is 44.1 khz - means taking 44,100 samples per second. Just numbers.
Let's begin - super code heavy
Audio Context
const context = new AudioContext();
So let's begin - the first thing we need to do...
Here I'm creating an instance of the audio context to be used within my application - I only need to do this once, this is the audio api. It gives me all the methods I'm going to need in endless supply.
The context is sort of the area where everything happens.
Think of it like a recroding studio. Instruments, mixing desks, effects.
prefix still needed in safari everyone
Loading Sounds
// DOM (audio, video element)
const mediaSource = context.createMediaElementSource(element);
// Streams (data, camera, mic)
const streamSource = context.createMediaStreamSource(stream);
// Buffer (file, data)
fetch('soundFile.mp4')
// read into memory as array buffer
.then(response => response.arrayBuffer())
// turn into raw audio data
.then(arrayBuffer => context.decodeAudioData(arrayBuffer))
// then play (see https://jakearchibald.com/2016/sounds-fun/)
Once you have that, you need some sounds.
Let's start with loading sounds - on a website this is important.
There are three main ways of loading sounds into this context.
buffers are containers data - samples. sample rate. create your own. Files are compressed, mp3, m4a, FLAC.
With the top two we by pass the buffer stuff, but there's no preload - when we fetch the file in the last method we load it into memory and get retreive it at any time. As a rule top one for not many and long tracks. Middle for streams, last for lots of short sounds.
Play Sounds
// connect to output
source.connect(context.destination);
// start our sound!
source.start();
Once you've got your sound we need to play it. This means connect it to the speakers and set it to play.
There's a couple more destinations, speakers are default. There's stream destination using MediaStream API, so you can broadcast to peers with Web RTC, or save to file, or you can collect the data in a buffer.
Play Sounds
Arps
[q] Now using the code that we have just seen, I've done this. I've got a sound, I've loaded it into a buffer, attached it to an event listener so I can set it to play when the button is pressed.
Great
Audio Graph & Nodes
So this is where I can start to talk about nodes.
So this is a representation of what we have just created. This is what we call an audio graph. So far a source and destination. These boxes you can see joined together we call nodes and as we add more effects we will add more nodes to this graph.
Let's say we want to add mute functionality - we can do that with a gain node.
Mute 👍
No mute 👎
Mute is important on the internet
If we look back at our previous examples, forest does this well, 86years not so mcuh
Regardless we can add that - there's a gain node
Mute: Gain Node
// create gain node
const gainNode = context.createGain();
// set value
gainNode.gain.value = 0;
// connect our nodes together
source.connect(gainNode).connect(context.destination);
source.start();
What we do is create one...
This controls volume. 0 value is nothing, 1 value is normal. 0.5 half. By setting it to 0 it will mute our audio. We can set this value to anything.
Need to connect it.
Mute Sounds
Arps
[w] Now using the code that we have just seen, I've done this. I've got a sound, I've loaded it into a buffer, attached it to an event listener so I can set it to play when the button is pressed.
Great
Our Audio Graph
Going back to our audio graph - this is what it looks like now. See it has our effect node in the middle, our gain node.
MDN Demo: Using Web Audio API
New Thing! Autoplay Policy
"Create or resume context from inside a user gesture"
OK so the autoplay policy. This is a discussion with browsers to combat the ugly things that happen onload in a browser. Videos, load noises, flashing animation.
I think there's a long way to go and a proper specification needs to be reached, there's only really one article on Chrome developers to go on, but it goes a little something like:
Create or resume...
When you create the context it has a state - which is suspended until user interaction
Resuming Context
button.addEventListener('click', function() {
// check if context is in suspended state (autoplay policy)
if (audioCtx.state === 'suspended') {
audioCtx.resume();
}
// now you can play things
}, false);
Here is a simple example - the button is an html element and on click event we're testing to see if the context is suspended if it is we just resume it.
So now that we've got sound, what can we do with it. THere's so much, it is the web after all. Information, education!
Web GL
Games & XR
I have put these in the same bracket - gaming, augmented reality, virtual reality... why?
Spatialisation
// create & set listener node
const listener = context.listener;
listener.positionX.value = window.innerWidth/2;
listener.positionY.value = window.innerHeight/2;
listener.positionZ.value = 295;
// create & set panner node
const panner = new PannerNode(audioCtx, {
panningModel: pannerModel,
distanceModel: distanceModel,
positionX: positionX,
positionY: positionY,
positionZ: positionZ,
orientationX: orientationX,
orientationY: orientationY,
orientationZ: orientationZ,
refDistance: refDistance,
maxDistance: maxDistance,
rolloffFactor: rollOff,
coneInnerAngle: innerCone,
coneOuterAngle: outerCone,
coneOuterGain: outerGain
})
Something we call spatialisation, I'm making sound, person listing, I move, sound moves. This emulates it.
This is the aptly named panner node.
3D sound scape to work with.
Create sound source - where sound is coming from and a listener, where it is picked up from.
We can make sounds appear as if they are infront or you, above you, to the left to the right.
Cones are like lights - ambient and spotlight.
PROPERTIES! on SOURCE
New Thing! Classes
You can create a node with class based syntax
my.pottermore.com
Can't see yourself using it?
The latest harry potter site - for pottermore - integrates 3d on the web (web gl) and thus environment sound effects along side background music
No one seems to mind if it's 3D right :)
three.js & A-Frame
Both three.js and a-frame include this panner functionality. So you can position audio within your 3d space when using those libraries.
Why? Let's go back to the why... the obvious one the one you usually see but it's really over whelming - instruments.
Synths, drum machines, sequencers...
This is blokdust. Built by Luke Twyman, Luke Phillips and Edward Silverton in Brighton.
It completely reinvents the interface of a synth - which is another thing the web empowers us to do.
It's well mental. A beautiful interface for a synth - you just pull things in, sound inputs, add effects, chain them together and output them. You can add controls.
Note this interface - it'll be important later.
So how do you make sounds...
Make Sounds
// waveform
const oscillator = context.createOscillator();
oscillator.type = 'triangle';
oscillator.frequency = 440;
// custom waveform
var wave = context.createPeriodicWave(real, imag, constraints);
oscillator.setPeriodicWave(wave);
[e] Instead of loading sounds, like we saw before, we can create them. There's an osciallator node. The sin wave you saw ealier, this can create one of those.
It can also create a number of default waves (specifically ones that are easy to generate) - square, triangle and sawtooth.
You can even make your own wave form to be generated. The PeriodicWave interface defines a periodic waveform that can be used to shape the output of an OscillatorNode.
This sounds a bit like this 'e'
Built in stuff
// jump frequency down
oscillator.frequency.exponentialRampToValueAtTime(10,
context.currentTime+1);
// jump volume down too!
gainNode.gain.exponentialRampToValueAtTime(0.001,
context.currentTime+0.9);
These properties we have on these nodes are of a type `audio param`
The audio api comes with some nice methods use on parameters - here's a good one - I use it commonly, so I wanted to share it.
exponential ramp to value at time
changes the value of the node at a set time - use it on frequency of osc AND if we create a gain node before, change volume
also linear value at time method. Exponential ramp is curve & nicer to hear.
Buffers
// make your own!
const node = context.createBufferSource(),
buffer = context.createBuffer(channels, frameCount, sampleRate),
data = buffer.getChannelData(0);
for (var i = 0; i < 4096; i++) {
data[i] = Math.random();
}
node.buffer = buffer;
// thanks http://www.justgoscha.com/programming/2014/04/08/creating-dynamic-audiobuffers-with-webaudio.html
[g] That audio buffer we passed the file data into earlier, to load the file. We don't have to load a file into a buffer, we can create that data ourselves. We know now it's just numbers.
The loop you see in the code here creates numbers that when passed into the buffer and played play white noise.
Are you ready it doesn't sound great.
Pink noise is better than white noise, it's softer, it reduces the harsher tones, we can use a function for that, or we can use another of the built in methods the api gives us.
And this is where we can really start to have some fun with the other filter nodes the api gives us.
Alter sounds
// filter/accentuate frequencies
const biquadFilter = context.audioCtx.createBiquadFilter();
biquadFilter.type = "lowpass";
biquadFilter.frequency.value = 500;
// manipulate waveform
const shaper = context.createWaveShaper();
shaper.curve = someCraMathsFunction();
// repeat buffer data
const reverb = context.createConvolver();
// fetch file to use as buffer or make here ...
reverb.buffer = bufferedFile;
[h] Here are some ways to alter sounds - remember these can be used on any nodes.
Biquad filter - algorithms on data - to enhance frequencies or filter them out. There's lots of types. High pass, low pass, high shelf, low sheif, peaking
Defines an array of numbers to multiply to the sample
often generated by recording a percussive noise or frequency sweep in a space. Does this all sound convoluted? Well, technically, it is!
If we put a bandpass type biquad filter on the white noise it now sounds like this:
Snare
Snare
[y] Then if we do what we did before and add a little gain drop odd - boom, we got a snare!
New Thing! IIR Filter
Super crazy Maths things
Infinite impulse response filter - 2 types in digital signal processing.
the biquad is a specific type or iir.
It gives you way more power and flexibility - but, you're looking at doing polynomial maths - so it's not for the faint hearted.
MDN Docs: Using IIR FIlters
Timing
const now = context.currentTime
See loads of code!
Timing is super important in audio. Whether you're just loading in and playing sounds, or you do want to take it further.
In web audio we have this currentTime property on the context itself. It accesses the audio subsystems hardware clock.
The web audio Api has a currentTime property. This starts when you instigate the api right at the start, but it uses system hardware for the clock and can be used as a benchmark all the way through. So let's say we load in a hi hat sound. We can simple create a loop and using currentTime, we can play the hi hat four times equally ina loop.
Music works like this, it has beats and these are mad eup into bars. Sometimes you have 4 beats in a bar, sometimes 3, sometimes two, sometimes 8 half beats. It's all just maths.
Long story short - we don't have to use javascript timing functions - which are dodgy.
Gives u benchmark throughout
Hi Hat
Hi Hat
[u] Then if we do what we did before and add a little gain drop odd - boom, we got a snare!
New Thing! Audio Worklets
Processing off the main thread
They're kinda here
So this takes all that number crunching off the main thread too - there's a few bits and bobs being done at the moment in regards to number crunching, better syntax
Audio Worklets
let worklet = new AudioWorkletNode(context, 'worketModule');
source.connect(worklet).connect(context.destination);
They're kinda here
So this takes all that number crunching off the main thread too - there's a few bits and bobs being done at the moment in regards to number crunching, better syntax
MDN Docs: Advanced Techniques
Well done everyone - fist bump!
Cos we haven't seen enough code right!
So wait - I think we might have just created a sound, a laser, and a drum kit... it's almost like we've created a mini synth, in 35 minutes. Now I have 10 to control it!
Super cool great - but I haven't shown you anything you can't do with hardware, or already existing software
MIDI
The web midi api is a different api altogether and I will explain why...
This is literally my favourite subject
This is not MIDI...
Real website - camerons world
A website playing background music - the modern version of which is something like this:
bgsound isn't a tag anymore - we don't have to deal with this
Then there's the modern day equivilant.
Web MIDI API
[144, 60, 100]
// call requestMIDIAccess
navigator.requestMIDIAccess({ sysex: false }).then(onMIDISuccess, onMIDIFailure);
// on success of MIDI device recognised
function onMIDISuccess(midiControl) {
var MIDI = midiControl;
// log each input data
MIDI.inputs.forEach(function (input) {
console.log(input.onmidimessage.data)
}
}
You make sure it’s avail, listen for attached device, when plugged in you can receive these afore mentioned messages. All I’m doing here is logging those messages - you can do whatever you want with them. Notice the sysex false - this is related to system messages and I will get back to that in a moment.
Now there’s a window of opportunity - there’s plenty of stuff we can start coding with that!
But what are these values?
the first byte 144 is the message type and channel, 144 is 90 in hex and the 9 says it's a 'Note on' message and the 0 is the channel number. A 'Note on' message has two data bytes, the first is the 'key number' which I'm guessing is the note number, so 60 would be C the second is 'note on velocity' and this has a value of 100, - 0-127 (I'm guessing this means the rate at which the note is turned on)
Demo
So if I plug in a MIDI instrument or controller and instigate the web MIDI api in my brwoser - this is the data you'll get
You should all see a keyboard - one of the most common MIDI enabled instruments. Now this is the data that the web MIDI api passes back to us when a MIDI device is plugged in. So let's take a look at the code.
SHUT THESE NOTES DOWN!
Arps
Laser
Kick
Snare
Hi Hat
madeon.fr/adventuremachine
components.novationmusic.com
This is Novations component software - novation make hardware
It works online and runs in the browser and updates & stores, samples & settings for their Novation Circuit, which is one of their syths.
All made possible with web midi.
Laurie Cape
or in fact use it for meaningless things like this guy who's literally just trying out font styles
and with all these things I wouldn't even dare think about how there's no piece of software on the market that satisfy's both your making music and playing live needs so you build your own - which is exactly what Matt McKegg did
Audio Design
in
Web Design
I know that the demos here aren't really what you'd put on a site. Although pls someone build a site with a laser button. But I do hope the techniques demonstrated are ones to use and really get you started with the API and help you understand what's possible and why.
My friend said to me recently the web we're in is like being in a mall - a shopping centre... we're bombarded with adverts, aggressive lights, moving parts _all_ the time. Of course we think audio is intrusive
We need more parks, more oceans, more forests.
Think about sound - think about it as part of design, it can be something simple (forms), animation is always enhanced - it's 2017, we don't need horrible load blaring music when we land on a page, we have all this power at our fingertips to make it really mature
We're so quick to pick up grid systems, animation apis, 3d, games, vr on the web, all great things. (why we have it) But we have it now! We have all this power.
When it comes to something as simple as ear magic we're reluctant and dismissive. Please think twice, I think we can be thoughtful - start a new wave of sound in our code.
Go Forth | Make Noise
Ruth John
@Rumyra
Thank You Very Much
Thank you very much, I'm Ruth John
All these examples you've seen are on codepen as part of codevember
Go have a relax and I hope you had a lovely conference!
Don't be narrow minded, be open minded.


Website made with love by Quinlan Pfiffer.
Database itself made by Quinlan Pfiffer and Kyle Terry.
Color pallete is Smiling Skies.
Background image on landing page is from here.
Various graphics are from The Noun Project:
- Firearm Disposal by Luis Prado from The Noun Project
- Database by Shmidt Sergey from The Noun Project
- Heat Stroke by Luis Prado from The Noun Project
- Poor by Luis Prado from The Noun Project
- Lazy by Aaron Tregent from The Noun Project


Much of "the law" is a set of naming conventions for shared ideas. So is the web.
The top level expressed here is:-
"G" is for Prose Objects. They are maintained in git, hence the "G". This is now where all our energy is going.
-
"GH" is for GitHub repos. "GHx" represents GitHub repos that we have imagined.
-
"P" is reserved for your private, preferred, proprietary materials. You will want some place to keep your private forms, clauses, instructions, etc.
-
"S" for some shared materials, stuff thought common and explanatory.
-
"U" means something like "you" and has info about persons and places.
-
"W" is intended to denote a www. website. "Wx" because not official.
-
"Z" is little bits of infrastructure text.
-
"ipfs" is experiments with the IPFS hashed text files.
-
"zFact" is a parking place for "facts" currently just a taxonomy of "FHIR" medical record codes.
A place to start might be: G/.


Words added to your block list will be filtered along with words we filter by default.
Enable Deep Search Add deep search for this blocked word.


 You can't miss him. They have the siren going, it's just a guessing game as to where he might be as the sound carries in all directions in the hills. We missed him last year, but we were on the ball this year. Jairah was very excited when he heard the siren. Scarlett hid behind me. I find bright red Santa's kind of scary, so I wasn't suprised! Not the best photo's but you will get the idea.
[caption id="attachment_288" align="aligncenter" width="373" caption="Just a wee bit excited!"][/caption]
[caption id="attachment_289" align="aligncenter" width="373" caption="Santa blending into the fire truck"][/caption]
[caption id="attachment_290" align="aligncenter" width="618" caption="Oh yes, some sort of sugary 'treat'"][/caption]


--- layout: default title: Steminist Store --- Steminist Store powered by Typeform {% include stayintouch.html %}


Soup
=============
### Ingredients
* 2 potatoes
* 2 onions
* 2 cloves of garlic
* olive oil
* 400 ml organic stock
* 3 bunches of watercress
### Instructions
* Peel and roughly chop the potatoes, onions and garlic.
* In a large saucepan, heat a little olive oil, then sauté the potato, onion and garlic until the onions are translucent.
* Add the stock and simmer until the potato is soft. Chop and add the watercress and simmer for a further 3 to 4 minutes.
* Using a hand blender, liquidise the soup until smooth.
* Serve with a swirl of crème fraîche and some Fortt’s Bath Oliver biscuits, if you like.
**Enjoy!**


AP Top Sports News at 1:22 a.m. EST
by EndPlayCook leads Vikings to 28-24 prime-time road win over Cowboys
Steelers defense leads way in 17-12 win over Rams
Titans rally, spoil Mahomes' return beating Chiefs 35-32
AP Top 25: LSU landslide No. 1; Minnesota jumps into top 10
Raptors end Lakers' 7-game winning streak in 113-104 victory
Sounders claim 2nd title in 4 years, beating Toronto FC 3-1
Hamlin races way into championship field with Phoenix win
Winston plays after brother's death, Spartans win easily
Maggert holes out to win and give McCarron Schwab Cup
Jackson dazzles as Ravens rout winless Bengals 49-13


MyApp
menu
Tom Scholz
<EMAIL_ADDRESS>home
Home
map
Map
location_on
Locations
edit_location
Edit locations
whatshot
News
settings
Settings
mode_editq
Imprint
bug_report
Report a bug
Home
Settings
Account
First Name
Last Name
Email
Change username
Change password
Validate password
Save


clone()
, unshare()
, setns()
, /proc/<pid>/ns/
)veth
: a pair of 2 interconnected network interfaces - a pipe.veth
pairAt the end of the workshop you learn:
veth
pairsA collision domain is a network segment connected by a shared medium.
The collision domain applies particularly in wireless networks, but also affected early versions of Ethernet.
A network collision occurs when more than one device attempts to send a packet on a network segment at the same time.
A network bridge is a computer networking device that creates a single network from multiple network segments.
In a bridged network communication between two hosts is possible without "flooding". Bridges reduce collisions by creating a separate collision domain per interface (port).
A multiport bridge is often called network switch.
For each received ethernet frame the switch learns from the frame's source MAC address and adds this together with an port identifier to the forwarding information base (FIB).
When bridge receives a frame it searches for the frame's destination address (MAC) in FIB to forward (or send) the frame to the exactly one port.
If the destination address is unknown the switch sends the frame out on all ports (except the ingress port).
A Linux bridge is a piece of software used to interconnect two or more network segments.
 It forwards packets between interfaces that are connected to it. It's usually used for forwarding between VMs and network namespaces on a host.
A Linux bridge is more powerful than a pure hardware bridge because it can also filter and shape traffic.
Tools to configure linux bridges:
Usage: brctl [commands]
commands:
addbr <bridge> add bridge
delbr <bridge> delete bridge
addif <bridge> <device> add interface to bridge
delif <bridge> <device> delete interface from bridge
hairpin <bridge> <port> {on|off} turn hairpin on/off
setageing <bridge> <time> set ageing time
setbridgeprio <bridge> <prio> set bridge priority
setfd <bridge> <time> set bridge forward delay
sethello <bridge> <time> set hello time
setmaxage <bridge> <time> set max message age
setpathcost <bridge> <port> <cost> set path cost
setportprio <bridge> <port> <prio> set port priority
show [ <bridge> ] show a list of bridges
showmacs <bridge> show a list of mac addrs
showstp <bridge> show bridge stp info
stp <bridge> {on|off} turn stp on/off
Create or delete a bridge
brctl addrb bridge0 # create bridge0
brctl delrb bridge0 # delete bridge0
Add or remove bridge interfaces
brctl addif bridge0 veth0 # add veth0 to bridge0
brctl delif bridge0 veth0 # delete veth0 from bridge0
Show current bridge / interfaces configuration
brctl show
Create or delete a bridge
ip link add name bridge0 type bridge # create bridge0
ip link delete dev bridge0 # delete bridge0
Add or remove bridge interfaces
ip link set dev veth0 master bridge0 # add veth0 to bridge0
ip link set dev veth0 nomaster # delete veth0 from bridge0
Show current bridge / interfaces configuration
ip link show type bridge
bridge link show
iproute2
provides tool called bridge
which enables advanced configuration of bridge ports
like filtering, mac-learning, STP, and manipulating FIB entries directly.
Open vSwitch is a production quality, multilayer virtual switch. It is designed to enable massive network automation through programmatic extension, while still supporting standard management interfaces and protocols.
Features:
ovs-vswitchd
, a daemon that implements the switch, along with a companion Linux kernel module for flow-based switching.ovsdb-server
, a lightweight database server that ovs-vswitchd queries to obtain its configuration.ovs-dpctl
, a tool for configuring the switch kernel module.ovs-vsctl
, a utility for querying and updating the configuration of ovs-vswitchd.ovs-appctl
, a utility that sends commands to running Open vSwitch daemons.Create or delete a bridge
ovs-vsctl add-br bridge0 # create bridge0
ovs-vsctl del-br bridge0 # delete bridge0
Add or remove bridge interfaces
ovs-vsctl add-port bridge0 veth0 # add veth0 to bridge0
ovs-vsctl del-port bridge0 veth0 # delete veth0 from bridge0
Show current bridge / interfaces configuration
ovs-vsctl show
ip netns add blue
ip netns add green
ip netns add red
ip netns add brown
ip link add name bridge0 type bridge
ip link add blue0 type veth peer name blue1
ip link add green0 type veth peer name green1
ip link add red0 type veth peer name red1
ip link add brown0 type veth peer name brown1
ip link set dev blue1 netns blue
ip link set dev green1 netns green
ip link set dev red1 netns red
ip link set dev brown1 netns brown
ip link set dev blue0 master bridge0
ip link set dev green0 master bridge0
ip link set dev red0 master bridge0
ip link set dev brown0 master bridge0
ip address add <IP_ADDRESS>/24 dev bridge0
ip link set dev bridge0 up
ip link set dev blue0 up
ip link set dev green0 up
ip link set dev red0 up
ip link set dev brown0 up
ip -n blue address add <IP_ADDRESS>/24 dev blue1
ip -n blue link set dev lo up
ip -n blue link set dev blue1 up
ip -n green address add <IP_ADDRESS>/24 dev green1
ip -n green link set dev lo up
ip -n green link set dev green1 up
ip -n red address add <IP_ADDRESS>/24 dev red1
ip -n red link set dev lo up
ip -n red link set dev red1 up
ip -n brown address add <IP_ADDRESS>/24 dev brown1
ip -n brown link set dev lo up
ip -n brown link set dev brown1 up
ping -c 1 <IP_ADDRESS>
ping -c 1 <IP_ADDRESS>
ping -c 1 <IP_ADDRESS>
ping -c 1 <IP_ADDRESS>
ip netns exec blue ping -c 1 <IP_ADDRESS> # blue ping green
ip netns exec blue ping -c 1 <IP_ADDRESS> # blue ping red
ip netns exec green ping -c 1 <IP_ADDRESS> # green ping brown
# Add default gateway on containers
ip -n blue route add default via <IP_ADDRESS>
ip -n green route add default via <IP_ADDRESS>
ip -n red route add default via <IP_ADDRESS>
ip -n brown route add default via <IP_ADDRESS>
# Enable IP Routing
sysctl -w net.ipv4.ip_forward=1
# Enable NAT for source subnet <IP_ADDRESS>/24
iptables -t nat -A POSTROUTING -s <IP_ADDRESS>/24 -j MASQUERADE


Jorge Aguirre is a junior studying computer science at Stanford University. As the IT Director for the Society of Latino Engineers and an Residential Computer Consultant for Kimball Hall, you could say he's into tech.


Functions
The following functions are available globally.
-
Error when there is not a file.
Declaration
Swift
private func isNoSuchFileError(_ error: Error?) -> Bool
-
Overload of the the
<
operatorDeclaration
Swift
func < (lhs: NSNumber, rhs: NSNumber) -> Bool
-
array of bytes, little-endian representation
Declaration
Swift
func arrayOfBytes<T>(value: T, length: Int? = nil) -> [UInt8]
-
Rotate left for MD5 implementation
Declaration
Swift
func rotateLeft(v: UInt32, n: UInt32) -> UInt32
-
sliceToUInt32 for MD5 implementation
Declaration
Swift
func sliceToUInt32Array(_ slice: ArraySlice<UInt8>) -> [UInt32]


Project: Spirent Attero powered by Calnex
Description: QuickCall library for network impairment emulation - delay, frame loss, reordering, capturing, link flapping, and more
Category: library
Class: Community
Tags: Test Equipment, Impairment
2 QuickCall Libraries in project://di_attero
stopImpairment
clearImpairments
disconnectSystem
connectSystem
| Argument |
Description |
| host |
|
pythonVersion
delayLoop
| Argument |
Description |
| startingDelay |
|
| endingDelay |
|
| step |
|
| stepDuration |
|
getVersion
getConnectionStatus
setSystemConnect
| Argument |
Description |
| attero |
|
| windowsHost |
|
setSystemDisconnect
setSettingsFileImport
| Argument |
Description |
| pathName |
|
| fileName |
|
setSettingsFileSave
| Argument |
Description |
| pathName |
|
| fileName |
.cst |
setSettingsDefault
setInterface1GbeElectrical
setInterface1GbeOptical
setInterface10GbeSfp
setInterface100MegElectrical
setImpairmentStart
setImpairmentStop
setImpairmentsClearAll
setImpairmentsClearProfile
| Argument |
Description |
| profile |
|
setFlowFilterImport
| Argument |
Description |
| filterName |
|
| pathName |
|
getInterfaceMediaType
getInterfaceSfpType
getInterfaceSettings
getInterfaceSpeed
setDelayLoop
| Argument |
Description |
| startingDelay |
|
| endingDelay |
|
| step |
|
| stepDuration |
|
setDelayRtd
| Argument |
Description |
| rtd |
Round Trip Delay in milliseconds |
setDelayUnidirectional
| Argument |
Description |
| delay |
Delay in Milliseconds |
| port |
Port 0 or Port 1 |
| profile |
Profile 0-7. 7 is the catch-all filter |
setBandwidthShaper
| Argument |
Description |
| committedRate |
Committed Rate in Mbps |
| committedBurstTol |
In bytes |
| excessBurstTol |
In bytes |
setBandwidthShaperUnidirectional
| Argument |
Description |
| committedRate |
Committed Rate in Mbps |
| committedBurstTol |
In bytes |
| excessBurstTol |
In bytes |
| profile |
|
setBandwidthPolicer
| Argument |
Description |
| committedBurstTol |
In bytes |
| excessBurstTol |
In Bytes |
| committedRate |
in Mbps |
| excessRate |
In Mbps |
setBandwidthPolicerUnidirectional
| Argument |
Description |
| committedBurstTol |
In bytes |
| excessBurstTol |
In Bytes |
| committedRate |
in Mbps |
| excessRate |
In Mbps |
| profile |
|
setFrameLossRate
| Argument |
Description |
| percentLoss |
Percentage |
| profile |
|
setFrameLossBurst
| Argument |
Description |
| profile |
|
| burstSize |
|
setErroredFramesBurst
| Argument |
Description |
| profile |
|
| burstSize |
|
setErroredFrameRate
| Argument |
Description |
| profile |
|
| percentErrored |
|
setLinkFlapConstant
| Argument |
Description |
| link |
0 or 1 |
setLinkFlapDuration
| Argument |
Description |
| link |
0 or 1 |
| duration |
Flap Duration in Seconds |
setDuplicateFramesBurst
| Argument |
Description |
| profile |
|
| burstSize |
number of duplicate frames |
setDuplicateFramesRate
| Argument |
Description |
| profile |
|
| percent |
|
setReorderedFramesBurst
| Argument |
Description |
| profile |
|
| burstSize |
|
setReorderedFramesRate
| Argument |
Description |
| profile |
|
| percent |
|
setCaptureStart
setCaptureStop
setCaptureSave
| Argument |
Description |
| pathName |
|
| fileName |
.cpd |


@(correctionForm: Form[Application.Correction])(visitorTypes: List[Visitor])(adjective: String)(noun: String) @import helper._ @main("Java Play Learning Environment!") {
We have identified you as a @adjective @noun!
What's that you say? Well...we must have been confused. Please, describe yourself for us now...
@if(correctionForm.hasGlobalErrors) { @correctionForm.globalError.message } @form(action = routes.Application.submitCorrection, args = 'id -> "correctionForm") { @inputText( field = correctionForm("adjective") , args = '_label -> "Adjective:" ) @inputText( field = correctionForm("noun") , args = '_label -> "Noun:" )} @if(!visitorTypes.isEmpty) {


Eri is awesoome and has an awesome story and I need to get a bio from here.
Minim ad sit dolore occaecat dolore mollit mollit qui ad dolor dolor labore in.


Student Survey Form
Thanks for participating in our survey
Name:
Email:
Age:
Subject:
Select your Favorite Subject
Mathematics
Science
Computer Science
Social Studies
Language
Physical Education
Hell Nothing!


Educational Codeforces Round 76 [Rated for Div. 2]
by PikMikeHello Codeforces!
On Nov/13/2019 17:35 (Moscow time) Educational Codeforces Round 76 (Rated for Div. 2) will start.
Series of Educational Rounds continue being held as Harbour.Space University initiative! You can read the details about the cooperation between Harbour.Space University and Codeforces in the blog post.
This round will be rated for the participants with rating lower than 2100. It will be held on extended ICPC rules. The penalty for each incorrect submission until the submission with a full solution is 10 minutes. After the end of the contest you will have 12 hours to hack any solution you want. You will have access to copy any solution and test it locally.
You will be given 7 problems and 2 hours to solve them.
The problems were invented and prepared by Roman Roms Glazov, Adilbek adedalic Dalabaev, Vladimir Vovuh Petrov, Ivan BledDest Androsov, Maksim Ne0n25 Mescheryakov and me. Also huge thanks to Mike MikeMirzayanov Mirzayanov for great systems Polygon and Codeforces.
Good luck to all the participants!
Our friends at Harbour.Space also have a message for you:
Attention Codeforces!
Calling on all tech disruptors, data specialists and computer science pioneers.
We are offering fully-funded international scholarships for exceptional tech specialists from around the world. Accelerate your career by becoming an industry expert capable of making key data-driven decisions that add value and drive innovation within tech industries.
Harbour.Space University has partnered with SCG, a leading business conglomerate in the ASEAN region, to offer exceptional tech specialists the opportunity to work and study in two of the most dynamic and vibrant cities in the world. Join our progressive two-year program based in Bangkok, with 6 of the 24 months in Barcelona, to develop the international mindset needed to accelerate your career and redefine how data drives the businesses of the future.
Tuition fee:
2 years | €45,800
Education:
3 hours of study per day | 15h per week
Work Experience:
4 hours of internship per day at SCG | 20h per week
Living Allowance:
€16,800 euros | €700 per month living allowance


| Interface | Description |
|---|---|
| MetadataLoader |
Interface for caller to specify a customized phone metadata loader.
|
| Class | Description |
|---|---|
| AlternateFormatsCountryCodeSet | |
| AsYouTypeFormatter |
A formatter which formats phone numbers as they are entered.
|
| CountryCodeToRegionCodeMap | |
| Phonemetadata | |
| Phonemetadata.NumberFormat | |
| Phonemetadata.NumberFormat.Builder |
Provides a dummy builder to 'emulate' the API of the code generated by the latest version of
Protocol Buffers.
|
| Phonemetadata.PhoneMetadata | |
| Phonemetadata.PhoneMetadata.Builder |
Provides a dummy builder.
|
| Phonemetadata.PhoneMetadataCollection | |
| Phonemetadata.PhoneMetadataCollection.Builder |
Provides a dummy builder.
|
| Phonemetadata.PhoneNumberDesc | |
| Phonemetadata.PhoneNumberDesc.Builder |
Provides a dummy builder.
|
| Phonenumber | |
| Phonenumber.PhoneNumber | |
| PhoneNumberMatch |
The immutable match of a phone number within a piece of text.
|
| PhoneNumberUtil |
Utility for international phone numbers.
|
| RegexCache |
LRU Cache for compiled regular expressions used by the libphonenumbers libary.
|
| ShortNumberInfo |
Methods for getting information about short phone numbers, such as short codes and emergency
numbers.
|
| ShortNumbersRegionCodeSet | |
| ShortNumberUtil | Deprecated |
| Enum | Description |
|---|---|
| NumberParseException.ErrorType | |
| Phonenumber.PhoneNumber.CountryCodeSource | |
| PhoneNumberUtil.Leniency |
Leniency when finding potential phone numbers in text
segments.
|
| PhoneNumberUtil.MatchType |
Types of phone number matches.
|
| PhoneNumberUtil.PhoneNumberFormat |
INTERNATIONAL and NATIONAL formats are consistent with the definition in ITU-T Recommendation
E123.
|
| PhoneNumberUtil.PhoneNumberType |
Type of phone numbers.
|
| PhoneNumberUtil.ValidationResult |
Possible outcomes when testing if a PhoneNumber is possible.
|
| ShortNumberInfo.ShortNumberCost |
Cost categories of short numbers.
|
| ShortNumberUtil.ShortNumberCost |
Cost categories of short numbers.
|
| Exception | Description |
|---|---|
| NumberParseException |
Generic exception class for errors encountered when parsing phone numbers.
|
Copyright © 2015 Google. All Rights Reserved.


Before Change
assert_(isinstance(i, list))
def test_vectorized_query_all_neighbors(self):
d, i = self.kdtree.query(np.zeros((2, 4, 3)), k=None, distance_upper_bound=1.1)
assert_equal(np.shape(d), (2, 4))
assert_equal(np.shape(i), (2, 4))
After Change
def test_vectorized_query_all_neighbors(self):
query_shape = (2, 4)
r = 1.1
np.random.seed(1234)
points = np.random.rand(*query_shape, self.kdtree.m)
d, i = self.kdtree.query(points, k=None, distance_upper_bound=r)
assert_equal(np.shape(d), query_shape)
assert_equal(np.shape(i), query_shape)


SuperBit Designer
Home
Portfolio
About Me
Contact
Contact us!
Name
*
Email
*
Subject
Message
*
Send
Reset


Documentation
Actions
Actions are a way to control your browsers by simulating user input such as mouse clicks and filling out input fields.
DocsSourceIssuesTrelloAssertions
Assertions check if the assumptions you made about a website are correct. They might check if the title of a page is as expected, or an element has a given text, if your mobile website version only displays a certain amount of elements and many more …
DocsSourceIssuesTrelloBrowsers
PhantomJS
Phantom JS is a headless web browser. It is installed with Dalek and set as the default browser to test in.
DocsSourceIssuesTrelloChrome
Any version of Google Chrome, Chromium or Chrome Canary can be used with DalekJS. By default, Dalek will try to use your standard Chrome installation to run your tests.
DocsSourceIssuesTrelloInternet Explorer
Any version of Internet Explorer >= 6 can be used with DalekJS.
DocsSourceIssuesTrelloFirefox
Any version of Mozilla Firefox >= 24 can be used with DalekJS as well as the Firefox OS emulator & Nightly/Aurora builds.
DocsSourceIssuesTrelloMobile Safari
Mobile Safari on iOS Emulator
DocsSourceIssuesTrelloOther
Other browsers will follow soon. If you would like to help, please get in touch with me. I have plans to get Desktop Opera, Chrome on Android & the Blackberry Browser running. For the other ones, I currently have no idea how to get them up & running.
Reports
Console
Daleks basic reporter, all the lovely colors & symbols you see when running Dalek.
DocsSourceIssuesTrelloHTML
This reporter makes beautiful (more or less) HTML reports.  Yep, this kind of an inception-ish thingy.
 It does what its name promises, writing super verbose test reports in a jUnit XML compatible file.
DocsSourceIssuesTrelloJSON
To make parsing of Daleks test results for other tools easier, there is a JSON reporter available. The Reporter can output the test results to a file in form of the Dalek JSON test protocol.
DocsSourceIssuesTrelloDrivers
Webdriver
DalekJS loves standards, so the basic driver that ships with Dalek is based on the Webdriver standard (you can find the specification here). That means, when using this driver, Dalek is able to communicate with every endpoint that implements the JSON-Wire protocol. Hurrah!
SourceIssuesTrelloSelenium
TBA.
Sauce
DalekJS loves Sauce Labs. With this optional driver installed, you are able to run your tests within the sauce cloud!
DocsSourceIssuesTrelloCommand Line Interface
The command line interface is your interface to the world of DalekJS. Currently, this is the way to run your tests. There might be a web interface later, for now stick to the CLI. It isn't difficult & I know you can do it!
DocsSourceIssuesTrelloGrunt integration
If you are as addicted to build & test your stuff with the help of Grunt as I am, well, then I hope that it makes you as happy as me that there is a grunt task for DalekJS already available.
DocsSourceIssuesTrello