bass is a table-driven cross assembler with an embedded programming language, which is used to provide powerful macro support.
Tables allow bass to support any desired processor instruction set, and the optional ability to open target files in modification mode allows bass to be used as a patching assembler.
bass [options] source [source ...]
-o target will specify the default target filename, and overwrite any existing file by said filename.
-m target will specify the default target filenamd, and will modify, rather than replace, any existing file by said name.
-d name[=value] will create a define with the given name, and assign to it either an empty value or the value provided.
-c name[=value] will create a constant with the given name, and assign to it either a value of 1 or the value provided.
-strict will abort the assembly process on warnings.
-benchmark will display the time required to assemble the source.
Parsing consists of the following phases:
The tokenize phase will combine all source files, and insert any nested include statements into a single stream of instructions.
The analyze phase will parse blocks, such as macros and functions, and note where they begin and end.
The execute phase will recurse macro invocations, substitute defines and evaluate conditional expressions.
The query phase invokes the execute phase, and computes the values of constants and labels.
The write phase invokes the execute phase, uses the previously computed values for constants and labels, and writes to any opened output file.
Initially, each source file specified on the terminal is loaded in. For each source file, all tabs (\t) and carriage returns (\r) are converted to spaces, and each line is split by line feeds (\n). Next, each line is clipped at the first appearance of a comment marker (//). Then, each line is split by any semicolons (;) not appearing inside of quoted strings. That is to say, semicolons can be used inside of quoted strings. Using semicolons outside of strings splits the line into multiple statements. The semicolon acts as a statement separator, and not as a statement terminator, meaning that a semicolon is not required at the end of each line. Finally, if the statement is an include directive, the source file parser will be invoked recursively to load in nested source files.
Macros, functions, defines, variables and constants must be in the following format:
[_A-Za-z][_A-Za-z0-9.]*
Valid numbers must be in one of the following formats:
[0-9]+ integer 0b[01]+ binary 0o[0-7]+ octal 0x[0-9a-f]+ hex %[01]+ binary $[0-9a-f]+ hex
Numbers may be prefixed with - or + if desired.
Numbers may also use ' as a digit separator. For example:
123'456'789 //same as 123456789 0b1001'0110 //same as 0b10010110
Strings are surrounded by double-quotes. They support the following escape sequences:
\\ = backslash (\) \' = single-quote (') \" = double-quote (") \n = new line \t = tab
Strings may also be concatenated via the ~ operator, which is useful for string construction via defines:
"foo" ~ "bar" //equivalent to "foobar"
Characters are surrounded by single-quotes, and evaluate to integer values which can be used inside of expressions. They support the same escape sequences as strings.
Note that characters are not escaped for block tokenization. That means you must use '\b' instead of ';' to avoid splitting the character into two separate statements.
Execution acts much like a scripting language. Statements are evaluated and a control flow (stack frame) is maintained.
Expressions can be used to transform variables or constants by use of parameters. Expressions may be recursive.
expression sum(x, y) = x + y print sum(1, 2), "\n" //prints 3
Defines can be used to substitute values in expressions. The define keyword allows specifying an exact expression to substitute, whereas the evaluate keyword will evaluate the expression to an integer value. The latter is useful for conditional expressions. Defines must be declared before being used, and can be re-declared later on.
define x = 1 + 2 print "{x}\n" //prints "1 + 2\n" evaluate x = {x} + 3 //x = evaluate(1 + 2 + 3) print "{x}\n" //prints "6\n"
Defines can also take arguments for substitution.
define sum(x, y) = ({x} + {y}) print "{sum(1,2)}\n" //prints "(1 + 2)\n"
Defines can be invoked with: {defineName}. Defines with parameters can be invoked with {defineName(parameter, ...)}. If a define is not matched, there is no error, the literal {defineName} will be passed along to the assembler verbatim.
Defines are evaluated from right-to-left order, meaning that expressions such as {x{y}} will first expand {y}, and then the result of that expression, {x...}.
It is possible to test if a define has been declared or not by using this special syntax: {defined name}
//create {value} if it does not yet exist if !{defined value} { define value(...) }
{defined name} is substituted with either 1 (if a define by the given name exists) or 0 (if it does not.)
Macros are supported. They can take zero or more arguments, and name overloading with differing arity is possible. Recursion is supported, but requires conditionals in order to break infinite recursion. Macros must be declared before being used, and can be re-declared later on.
By default, macro parameters are simply the names of the values, and are passed in as defines. It is also possible to specify the type of the parameter, which will cause the invocation to pass the value in as the requested type. Supported types are: define, evaluate and variable.
macro seek(offset) { origin {offset} & 0x3fffff base 0xc00000 | {offset} } seek(0xc08000) macro test(define a, evaluate b, variable c, d) { //{d} has no type, so it defaults to "define d" } test(1+2, 1+2, 1+2, 1+2) //{a} = 1+2, {b} = 3, c = 3, {d} = 1+2
Because expanded macros are passed directly to the assembler, a macro with a label name cannot be expanded twice in the same scope, or the label name will be declared twice, resulting in an error. The special token {#} can be used in a label name, where it will be substituted with a numeric value that increments every time a macro is invoked.
Note that the invocation counter may not work as expected inside of recursive macros. Only use this for top-level macros.
Macros can be invoked with the syntax: macroName(parameter, parameter, ...). If a macro is not matched, there is no error, the literal macroName(...) will be passed along to the assembly phase. Note that macros cannot appear inside expressions: the macro invocation must be the entire statement.
Every time a macro is invoked, a new object stack frame is created, which will supercede all previous stack frames. All macro arguments, as well as any objects declared inside of said macro, are appended to the new frame. When the macro completes execution, said frame is destroyed, and said objects are lost. Note that this does not apply to constants, which must always be placed in the global frame to support forward-declarations.
It is however possible to access the global frame by prefixing object creation with the global keyword, for example:
macro square(value) { global evaluate result({value} * {value}) } square(16) print "{square.result}\n" //prints 256
Further, it is also possible to reference the parent frame by prefixing object creation with the parent keyword, which is useful for recursive macros, or to represent macro return values. For example:
macro factorial(variable n) { parent variable result = 1 if n >= 1 { factorial(n - 1) result = n * factorial.result } } factorial(10) print factorial.result, "\n" //prints 3628800
Macros can also be created without a stack frame by using the inline keyword, which will cause any objects created inside of them to appear in the same frame as the macro was invoked in. For example:
inline square(variable value) { variable result = value * value } function main { square(16) } print main.result, "\n" //prints 256
This is obviously not a good idea to use for recursive macros.
bass supports traditional conditional expressions.
define x = 16 while {x} > 0 { print "{x}\n" evaluate x = {x} - 1 } if {x} > 16 { ... } else if {x} > 8 { ... } else { ... }
Variables and constants can be used in conditional expressions. Just note that variables must be declared before they can be used in expressions. Only constants support forward-declaration.
Any statements that fall through the execute phase are passed into the assembly phase.
Variables and constants hold integer values. Variables must be declared before being used, but can be redefined. Constants can be used before their declaration, but subsequently cannot be redefined. Labels are stored as constants.
variable x = 16 lda #x //16 variable x = 32 lda #x //32 lda #y //64 constant y = 64
Arrays of variables can be created. The size of the array is fixed once it has been created, but the array can be redefined later on to another size if desired. Array elements not specified initially are initialized to zeroes.
array[4] x = 1,2,4,8 array[2] y y[1] = x[3] print y[0], ",", y[1], "\n" //prints 0,8 array[8] x //recreates a new array with eight entries
Labels can be created with the syntax: labelName:
loop: dex; bne loop
Labels without names can be created using - and +.
-; beq +; lsr; dex; bne -; + -; bra ++ //A: go to D -; bra + //B: go to C +; bra - //C: go to B +; bra -- //D: go to A
The previous - label can be referenced with -, and the next + label can be referenced with +. The second to last - label can be referenced with --, and the second to next + label can be referenced with ++. Deeper scoping is not supported: you will have to switch to named labels at this point.
Macros, defines, variables and constants can be scoped. This allows reuse of common names like loop and finish inside of scopes, without causing declaration collisions. Note that labels are stored as constants, meaning that scoping also applies to labels.
It's also important to understand that for macro scoping, the macro name's scope is determined where the macro is declared, and the actual scope used while executing a macro is determined where the macro is invoked.
variable offset = 16 namespace information { variable length = 32 lda #offset //16 lda #length //32 } lda #offset //16 lda #information.length //32
It is possible to declare a scope and label at the same time, which is a useful way to mark functions and their boundaries.
function main { subroutine: } jsr main.subroutine
It is also possible to create blocks which do not create scopes. These are used strictly for code clarity, and have no functional effect.
labelName: { } - { } + { } { }
Note that this command is parsed in the very first phase, and is only noted here for completeness. It includes another source file in place of this command.
Do not attempt conditional recursion on the same source file, as this will result in an infinite loop which will eventually exhaust all memory.
This command can be used in place of the -o filename [-create] command-line argument, or in addition to it, and can open multiple files sequentially for output (only one output file can be open at a time.) The create parameter, if specified, states to overwrite the target file if it already exists. Otherwise, the file is opened in modification mode.
This command will change the currently active architecture. An architecture is essentially a processor that bass supports.
bass will first try to select any built-in architecture by the given name, which allows bass to support architectures written as C++ modules. Currently, the only built-in architecture is none, which is also the default state at the start of assembly.
When no built-in architecture is found, bass will instead use its table-driver assembler architecture. This architecture takes a text file as input, which defines all supported opcodes and their encodings for a given processor.
The name is transformed to name.arch, and bass tries to find said file in two locations: first, in the architectures/ subdirectory next to the main bass executable. And second, in ~/.local/share/bass/architectures/ or %localappdata%/bass/architectures/, depending upon your OS.
bass ships with a variety of pre-made table architecture files. On Linux/BSD, users should run make install to place these files into the appropriate location to be used.
bass is also extensible, so users can add their own table architecture files to support additional processors. Architectures written in C++ will however require recompiling bass to include said architecture.
Note that the architecture command will also change the current endian mode of bass, to match that of the given processor architecture.
In the event that name does not match a built-in architecture, and no appropriate name.arch file can be found, this command will generate an error.
This command controls whether multi-byte values (eg from dw and dd) are output in little-endian (lsb) or big-endian (msb) format.
This command seeks the output file write cursor to the specified location.
This command creates a signed displacement against the origin value, which is used when computing the pc (program counter) value for labels. This command allows mapping file address space into a virtual memory address space.
This can be used to save and restore internal state. Currently supported values are: origin, base, pc.
This command copies a block from the currently open file to another location within the file. It does this by reading the entire block in first, and then writing said block out, so be careful with overlapping addresses.
This command inserts a binary file into the target file. You can optionally specify a name, offset and length. If you specify a name, it will create a label by the given name, which contains the address where the data begins, and it will also create name.size, which contains the size of the included data. If you specify an offset, it will seek that far into the referenced filename before copying the data. If you want to specify a length, you must specify an offset first, and the length will determine the maximum number of bytes to copy from the referenced filename.
This command deletes a file from disk. Useful for removing temporary work files needed by a project being assembled.
Inserts length number of bytes into the target file. The default fill byte is 0x00, but can be specified via with.
Modifies the mappings for strings passed to db, dw, etc. This can be used to map strings to custom tilemaps that do not follow traditional ASCII values.
char is the first value to modify, value is the value to map said char to, and length can be used for contiguous entries. For instance, if A-Z appear sequentially, give a value of 26 for the length, to avoid having to declare 26 separate assignments. Each step of length increments both the char and value by exactly one, so the characters must be contiguous with both ASCII and your custom map for this to work.
If you wish to restore the table to its default ASCII values, use the following command:
map 0, 0, 256
Inserts binary data directly into the target file. db stores 8-bit values, dw stores 16-bit values, dl stored 24-bit values, dd stored 32-bit values and dq stores 64-bit values.
Prints information to the terminal. Useful for debugging.
The print directive also supports formatting prefixes for variable or constant expressions. These are: binary, hex, and char. Example:
print "%", binary:15 //prints %1111 print "$", hex:65536 //prints $10000 print "'", char:65, "'" //prints 'A'
Seeks forward or backward from the current output file write address. The value can be positive (to seek forward) or negative (to seek backward.) This is useful for skipping bytes when in file modification mode.
Tracks writes to a given output file when enabled. Selecting a new output file automatically clears the tracking list. This is useful when using bass as a patching assembler to detect when the same file address is written to more than once. If this happens while the tracker is enabled, an error is produced.
Note: disabling the tracker does not clear the previously tracked addresses, in case you only wish to intentionally disable it for a short time. If you want to clear the tracking history, use the reset argument.
Prints a notice to the terminal, but continues assembly.
Prints a warning to the terminal, but continues assembly.
Prints an error to the terminal, and aborts assembly.
bass supports built-in functions. The syntax is equivalent to macros, however they are used in expressions rather than as statements, and they always return a numeric value.
seek(0x8000) //this is a macro statement ... if pc() > 0x8fff { //this is a function used inside an assembler statement ... }
Returns the number of elements in an array, or produces an error if the array is not defined.
Sorts the specified array in ascending order.
Produces an error if the expression evaluates to zero.
Returns the size of "filename" on disk, or produces an error if the file is not found.
Returns 1 if "filename" exists, or 0 if not.
Reads a byte from the currently open output file, or produces an error if there is no file currently open. The address provided is the origin, or literal file address. The base offset is not factored in when this function is used.
Important note: the resulting values read from a target file are only valid during the write phase of assembly! If you rely on the value read back during a previous pass to control outputting code, bass may assemble the source code incorrectly. Use this function with caution. It is mostly intended for when bass is used in patching mode.
Returns the current origin.
Returns the current base.
Returns the current program counter (origin + base.)
Regretfully, this documentation does not cover how to create your own architecture tables. This is an advanced topic to cover, and it is expected that these will be provided for you by any given bass distribution. bass was not really designed with end-users creating these tables in mind.
If you wish to create a new architecture table for bass, you will need to study the bass source code and the existing architecture files to gain an understanding of how they work.
Hopefully this has been informative. The best way to learn is through practice, so please do experiment and see what you can come up with!
Thank you for using bass!


Generic methods are a very efficient way to handle multiple datatypes using a single method. This problem will test your knowledge on Java Generic methods.
Let's say you have an integer array and a string array. You have to write a single method printArray that can print all the elements of both arrays. The method should be able to accept both integer arrays or string arrays.
You are given code in the editor. Complete the code so that it prints the following lines:
1
2
3
Hello
World
Do not use method overloading because your answer will not be accepted.


| Modifier and Type | Method and Description |
|---|---|
Job[] |
Cluster.getAllJobs()
Deprecated.
Use
Cluster.getAllJobStatuses() instead. |
static Job |
Job.getInstance()
|
static Job |
Job.getInstance(Cluster ignored)
Deprecated.
Use
getInstance() |
static Job |
Job.getInstance(Cluster ignored,
Configuration conf)
Deprecated.
|
static Job |
Job.getInstance(Configuration conf)
|
static Job |
Job.getInstance(Configuration conf,
String jobName)
|
static Job |
Job.getInstance(JobStatus status,
Configuration conf)
|
Job |
Cluster.getJob(JobID jobId)
Get job corresponding to jobid.
|
| Modifier and Type | Method and Description |
|---|---|
static Job |
ValueAggregatorJob.createValueAggregatorJob(Configuration conf,
String[] args)
Create an Aggregate based map/reduce job.
|
static Job |
ValueAggregatorJob.createValueAggregatorJob(String[] args,
Class<? extends ValueAggregatorDescriptor>[] descriptors) |
| Modifier and Type | Method and Description |
|---|---|
static void |
ChainReducer.addMapper(Job job,
Class<? extends Mapper> klass,
Class<?> inputKeyClass,
Class<?> inputValueClass,
Class<?> outputKeyClass,
Class<?> outputValueClass,
Configuration mapperConf)
Adds a
Mapper class to the chain reducer. |
static void |
ChainMapper.addMapper(Job job,
Class<? extends Mapper> klass,
Class<?> inputKeyClass,
Class<?> inputValueClass,
Class<?> outputKeyClass,
Class<?> outputValueClass,
Configuration mapperConf)
Adds a
Mapper class to the chain mapper. |
static void |
ChainReducer.setReducer(Job job,
Class<? extends Reducer> klass,
Class<?> inputKeyClass,
Class<?> inputValueClass,
Class<?> outputKeyClass,
Class<?> outputValueClass,
Configuration reducerConf)
Sets the
Reducer class to the chain job. |
| Modifier and Type | Method and Description |
|---|---|
static void |
DBInputFormat.setInput(Job job,
Class<? extends DBWritable> inputClass,
String inputQuery,
String inputCountQuery)
Initializes the map-part of the job with the appropriate input settings.
|
static void |
DataDrivenDBInputFormat.setInput(Job job,
Class<? extends DBWritable> inputClass,
String inputQuery,
String inputBoundingQuery)
setInput() takes a custom query and a separate "bounding query" to use
instead of the custom "count query" used by DBInputFormat.
|
static void |
DBInputFormat.setInput(Job job,
Class<? extends DBWritable> inputClass,
String tableName,
String conditions,
String orderBy,
String... fieldNames)
Initializes the map-part of the job with the appropriate input settings.
|
static void |
DataDrivenDBInputFormat.setInput(Job job,
Class<? extends DBWritable> inputClass,
String tableName,
String conditions,
String splitBy,
String... fieldNames)
Note that the "orderBy" column is called the "splitBy" in this version.
|
static void |
DBOutputFormat.setOutput(Job job,
String tableName,
int fieldCount)
Initializes the reduce-part of the job
with the appropriate output settings
|
static void |
DBOutputFormat.setOutput(Job job,
String tableName,
String... fieldNames)
Initializes the reduce-part of the job with
the appropriate output settings
|
| Modifier and Type | Method and Description |
|---|---|
static void |
FileInputFormat.addInputPath(Job job,
Path path)
Add a
Path to the list of inputs for the map-reduce job. |
static void |
MultipleInputs.addInputPath(Job job,
Path path,
Class<? extends InputFormat> inputFormatClass)
Add a
Path with a custom InputFormat to the list of
inputs for the map-reduce job. |
static void |
MultipleInputs.addInputPath(Job job,
Path path,
Class<? extends InputFormat> inputFormatClass,
Class<? extends Mapper> mapperClass)
|
static void |
FileInputFormat.addInputPaths(Job job,
String commaSeparatedPaths)
Add the given comma separated paths to the list of inputs for
the map-reduce job.
|
static void |
SequenceFileInputFilter.setFilterClass(Job job,
Class<?> filterClass)
set the filter class
|
static void |
FileInputFormat.setInputDirRecursive(Job job,
boolean inputDirRecursive) |
static void |
FileInputFormat.setInputPathFilter(Job job,
Class<? extends PathFilter> filter)
Set a PathFilter to be applied to the input paths for the map-reduce job.
|
static void |
FileInputFormat.setInputPaths(Job job,
Path... inputPaths)
Set the array of
Path s as the list of inputs
for the map-reduce job. |
static void |
FileInputFormat.setInputPaths(Job job,
String commaSeparatedPaths)
Sets the given comma separated paths as the list of inputs
for the map-reduce job.
|
static void |
FileInputFormat.setMaxInputSplitSize(Job job,
long size)
Set the maximum split size
|
static void |
FileInputFormat.setMinInputSplitSize(Job job,
long size)
Set the minimum input split size
|
static void |
NLineInputFormat.setNumLinesPerSplit(Job job,
int numLines)
Set the number of lines per split
|
| Modifier and Type | Method and Description |
|---|---|
Job |
ControlledJob.getJob() |
| Modifier and Type | Method and Description |
|---|---|
void |
ControlledJob.setJob(Job job)
Set the mapreduce job
|
| Constructor and Description |
|---|
ControlledJob(Job job,
List<ControlledJob> dependingJobs)
Construct a job.
|
| Modifier and Type | Method and Description |
|---|---|
static <K1,V1,K2,V2> |
MultithreadedMapper.setMapperClass(Job job,
Class<? extends Mapper<K1,V1,K2,V2>> cls)
Set the application's mapper class.
|
static void |
MultithreadedMapper.setNumberOfThreads(Job job,
int threads)
Set the number of threads in the pool for running maps.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
MultipleOutputs.addNamedOutput(Job job,
String namedOutput,
Class<? extends OutputFormat> outputFormatClass,
Class<?> keyClass,
Class<?> valueClass)
Adds a named output for the job.
|
static void |
FileOutputFormat.setCompressOutput(Job job,
boolean compress)
Set whether the output of the job is compressed.
|
static void |
MultipleOutputs.setCountersEnabled(Job job,
boolean enabled)
Enables or disables counters for the named outputs.
|
static void |
SequenceFileOutputFormat.setOutputCompressionType(Job job,
org.apache.hadoop.io.SequenceFile.CompressionType style)
Set the
SequenceFile.CompressionType for the output SequenceFile . |
static void |
FileOutputFormat.setOutputCompressorClass(Job job,
Class<? extends CompressionCodec> codecClass)
Set the
CompressionCodec to be used to compress job outputs. |
static void |
LazyOutputFormat.setOutputFormatClass(Job job,
Class<? extends OutputFormat> theClass)
Set the underlying output format for LazyOutputFormat.
|
static void |
FileOutputFormat.setOutputPath(Job job,
Path outputDir)
Set the
Path of the output directory for the map-reduce job. |
static void |
SequenceFileAsBinaryOutputFormat.setSequenceFileOutputKeyClass(Job job,
Class<?> theClass)
Set the key class for the
SequenceFile |
static void |
SequenceFileAsBinaryOutputFormat.setSequenceFileOutputValueClass(Job job,
Class<?> theClass)
Set the value class for the
SequenceFile |
| Modifier and Type | Method and Description |
|---|---|
static void |
KeyFieldBasedComparator.setKeyFieldComparatorOptions(Job job,
String keySpec)
Set the
KeyFieldBasedComparator options used to compare keys. |
void |
KeyFieldBasedPartitioner.setKeyFieldPartitionerOptions(Job job,
String keySpec)
Set the
KeyFieldBasedPartitioner options used for
Partitioner |
static <K,V> void |
InputSampler.writePartitionFile(Job job,
org.apache.hadoop.mapreduce.lib.partition.InputSampler.Sampler<K,V> sampler)
Write a partition file for the given job, using the Sampler provided.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
CLI.displayTasks(Job job,
String type,
String state)
Display the information about a job's tasks, of a particular type and
in a particular state
|
| Modifier and Type | Method and Description |
|---|---|
Job |
DistCp.createAndSubmitJob()
Create and submit the mapreduce job.
|
Job |
DistCp.execute()
Implements the core-execution.
|
| Modifier and Type | Method and Description |
|---|---|
protected Path |
DistCp.createInputFileListing(Job job)
Create input listing by invoking an appropriate copy listing
implementation.
|
void |
DistCp.waitForJobCompletion(Job job)
Wait for the given job to complete.
|
Copyright © 2017 Apache Software Foundation. All rights reserved.


I am a product designer specializing in the needs of startups. My core skills are product strategy, user experience, and visual design. I have led three startups through the process of creating their user experience from the ground up. Products I’ve designed have been used by 400mm users.
I am a co-founder of Red Lozenge, a company building a platform for behavioral change. I am responsible for product design and user experience strategy, and have designed everything from our logo to the user interface for our first iOS app.
I designed the user experience for MobJob, a new mobile app and web service for a Fortune 200 company. MobJob helps big brands crowdsource field marketing data in real time. We built a suite of products including iOS and Android apps, a web-based task creation interface, and a data dashboard.
Groupiter was founded to support collaboration for teams using Dropbox. We delivered a mobile app and set of web tools to enable teams to comment upon and annotate their Dropbox files. I managed the product strategy, conducted the user research, and completed the UX and visual design for the product.


jasonkakuyo.com
* * *
I Have A Dream
About Me
I believe in a purpose driven and visionary life
My Life's Worth
-
Passion:BasketBall
From my high school days in Ntare School till today my passion for BasketBall never dies
-
Profession:Economics
I am a professional Economist who has worked with the best firms in the country
-
Vocation:Ranching
I gained immense skills over the years from my Late Father as far as cattle keeping is concerned
I run a farm with hundreds of cattle. -
Mission:Preaching The Gospel
I do a lot preaching every where and any where
This has been as a result of the positive influence of my Man Of God And Mentor
Apostle Grace Lubega of Phaneroo Ministries
Services
-
Digital Strategy
I am certified digital marketing expert and trainer with google digital skills for africa
-
Economic And Financial Consultancy
I am available to serve you
-
Cattle Business
Are you in the cattle business?
Let's Talk -
Leadership and Mentorship
I have been a leader all my life and I want to mentor the next generation of leaders


The Embryo Digital Atlas
About
About Project
Acknowledgments
contact
an open source project
https://github.com/paulvill/paulvill.github.io


A bunch of example codes
This code system http://www.fhir.org/guides/test4/CodeSystem/blah-codes defines the following codes:


For Kubernetes 101, we will cover kubectl, pods, volumes, and multiple containers
In order for the kubectl usage examples to work, make sure you have an examples directory locally, either from a release or the source.
The easiest way to interact with Kubernetes is via the kubectl command-line interface.
For more info about kubectl, including its usage, commands, and parameters, see the kubectl CLI reference.
If you haven’t installed and configured kubectl, finish the prerequisites before continuing.
In Kubernetes, a group of one or more containers is called a pod. Containers in a pod are deployed together, and are started, stopped, and replicated as a group.
See pods for more details.
The simplest pod definition describes the deployment of a single container. For example, an nginx web server pod might be defined as such:
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
A pod definition is a declaration of a desired state. Desired state is a very important concept in the Kubernetes model. Many things present a desired state to the system, and it is Kubernetes’ responsibility to make sure that the current state matches the desired state. For example, when you create a Pod, you declare that you want the containers in it to be running. If the containers happen to not be running (e.g. program failure, …), Kubernetes will continue to (re-)create them for you in order to drive them to the desired state. This process continues until the Pod is deleted.
See the design document for more details.
Create a pod containing an nginx server (pod-nginx.yaml):
$ kubectl create -f docs/user-guide/walkthrough/pod-nginx.yaml
List all pods:
$ kubectl get pods
On most providers, the pod IPs are not externally accessible. The easiest way to test that the pod is working is to create a busybox pod and exec commands on it remotely. See the command execution documentation for details.
Provided the pod IP is accessible, you should be able to access its http endpoint with curl on port 80:
$ curl http://$(kubectl get pod nginx -o go-template=)
Delete the pod by name:
$ kubectl delete pod nginx
That’s great for a simple static web server, but what about persistent storage?
The container file system only lives as long as the container does. So if your app’s state needs to survive relocation, reboots, and crashes, you’ll need to configure some persistent storage.
For this example we’ll be creating a Redis pod with a named volume and volume mount that defines the path to mount the volume.
volumes:
- name: redis-persistent-storage
emptyDir: {}
volumeMounts:
# name must match the volume name below
- name: redis-persistent-storage
# mount path within the container
mountPath: /data/redis
Example Redis pod definition with a persistent storage volume (pod-redis.yaml):
pod-redis.yaml |
|---|
|
Notes:
/var/logs
).See volumes for more details.
Note: The examples below are syntactically correct, but some of the images (e.g. kubernetes/git-monitor) don’t exist yet. We’re working on turning these into working examples.
However, often you want to have two different containers that work together. An example of this would be a web server, and a helper job that polls a git repository for new updates:
apiVersion: v1
kind: Pod
metadata:
name: www
spec:
containers:
- name: nginx
image: nginx
volumeMounts:
- mountPath: /srv/www
name: www-data
readOnly: true
- name: git-monitor
image: kubernetes/git-monitor
env:
- name: GIT_REPO
value: http://github.com/some/repo.git
volumeMounts:
- mountPath: /data
name: www-data
volumes:
- name: www-data
emptyDir: {}
Note that we have also added a volume here. In this case, the volume is mounted into both containers. It is marked readOnly
in the web server’s case, since it doesn’t need to write to the directory.
Finally, we have also introduced an environment variable to the git-monitor
container, which allows us to parameterize that container with the particular git repository that we want to track.
Continue on to Kubernetes 201 or for a complete application see the guestbook example


| Name | Description |
|---|
$def with () $var jsfiles: managePageCommon.js ecoTemplateManage.js stormEcotemplateManage.js storm.js jsonlint/c/js/json2.js jsonlint/c/js/jsl.parser.js jsonlint/c/js/jsl.format.js jsonlint/c/js/jsl.interactions.js $var cssfiles:
The Manage Ecosystem Templates screen allows administrators to modify, add and delete Templates for Ecosystems.
Select one or more Templates from the list to the right, using the checkboxes. Select an action to modify or delete the Templates you've selected.
Templates cannot be deleted if they are referenced by any Ecosystems.
Click here for a more detailed introduction to Ecosystem Templates.
| Name | Description |
|---|
| Name | |
| Description | |
|
|
|
| New Template Name |


Hugs are given to friends/members from users by using the Friends:Hug function. The Friends:Hugs function displays a list of all hugs given to a member. This can either be used to show hugs recieved from other users, or show other users you've hugged.
{exp:friends:hugs} content {/exp:friends:hugs}
Parameters
The following parameters are available for use:
dynamic=
dynamic="off"
This parameter is available to stop the loop from looking into the URI for an ID of any type.
friends_only=
friends_only="y"
This parameter show hugs sent to or received from reciprocal friends only.
hug_label=
hug_label="Poked"
This parameter is optional and allows you to filter by the name of the label that was given to the hug. It's an optional feature that allows you to do more than hugging, and lets you do custom actions such as Poked, Tickled, etc. The default value is hug.
limit=
limit="10"
This parameter allows you to set a limit of hugs results you'd like to show for a given member. The default is 10.
member_id=
member_id="{segment_3}"
This parameter allows you to view hugs given/recieved for a specific member by specifying their member ID. You can hardcode a member ID, pass it through an embed, grab it from the URI, or specify CURRENT_USER to display results for the currently logged in user. Alternatively, you can use the username parameter.
orderby=
orderby="date"
This parameter gives you the ability to control the order in which your results are ordered in the list. You can order by most member and friends variables that you can parse.
paginate=
paginate="both"
This parameter allows you to control where the pagination will display. Options are top, bottom, or both. Used in conjunction with the friends_paginate variable pair.
sort=
sort="desc"
You can sort by asc or desc.
trigger=
trigger="cheese"
If you'd like to have the Hugs loop dynamically recognize a username in the URI, this parameter allows you to specify which trigger you're using in the URI to prepend the username segment. For example, your link might look like this: http://www.yoursite.com/friends/hugs/cheese/pie_man/
type=
type="sender"
This parameter allows you control the output of the Hugs results. Options are recipient - hugs you've recieved from other members, or sender - hugs you've given to other members. The default is recipient.
username=
username="{segment_3}"
This parameter allows you to view hugs given/recieved for a specific member by specifying their username. You can hardcode a username, pass it through an embed, grab it from the URI, or specify CURRENT_USER to display results for the currently logged in user. Alternatively, you can use the member_id parameter.
Variables
All standard and custom member fields and usual Friends variables are available for use here. Additionally, these exist as well:
friends_count
{friends_count}
This variable outputs the display order number for each result in the list of users.
friends_hug_date
{friends_hug_date format="%F %j, %Y"}
This variable displays the date the hug was given or received.
friends_hug_label
{friends_hug_label}
This variable displays the label that was given to the hug. It's an optional feature that allows you to do more than hugging, and lets you do custom actions such as Poked, Tickled, etc. The default value is hug.
friends_switch
{friends_switch="one|two"}
This variable allows you to switch a CSS class back and forth for all outputed results.
friends_total_results
{friends_total_results}
This variable outputs the total amount of results outputted in your list.
Variable Pairs
The following variable pairs are available for use:
friends_paginate
{friends_paginate} Page {friends_current_page} of {friends_total_pages} pages {friends_pagination_links} {/friends_paginate}
Pagination is available for this tag and works just like regular pagination, but each variable is prepended with friends_. Used in conjunction with the paginate parameter.
Conditionals
The following conditionals are available for use:
if friends_no_results
{if friends_no_results} Sorry, no results were found. {/if}
Thi conditional evaluates to true and displays it's contents when there are no results found for this tag.
Examples
Displaying Hugs Received From Other Users
The following example will display received hugs for the currently logged in user:

Hugs You've Received:

 {exp:friends:hugs member_id="CURRENT_USER" limit="15" }
{friends_screen_name} hugged you on {friends_hug_date format="%F %j, %Y"}
 {/exp:friends:hugs}

Displaying Hugs Sent To Other Users
The following example will display hugs sent from the currently logged in user:

Hugs You've Given to Others:

 {exp:friends:hugs type="sender" member_id="CURRENT_USER" limit="15" }
You hugged {friends_screen_name} on {friends_hug_date format="%F %j, %Y"}
 {/exp:friends:hugs}

Displaying Custom Hugs Recieved From Other Users
The following example will display received hugs for the currently logged in user that use the custom labeling feature available with the Hug feature:

You've Recently Received:

 {exp:friends:hugs member_id="CURRENT_USER" limit="5" }
{friends_screen_name} {friends_hug_label} you on {friends_hug_date format="%F %j, %Y"}
 {/exp:friends:hugs}

The above code could parse as (depending on the values you provided with the Hug function):

You've Recently Received:

Jonny poked you on November 9, 2012

Bob kicked you on November 6, 2012

Jonny kicked you on November 6, 2012

Britney tickled you on November 5, 2012

Sarah hugged you on October 31, 2012


--- layout: post title: AndEngine Is Totally Sweet! date: 2011-02-15 23:31:33 -06:00 comments: true categories: posterous_id: 43203082 ---
Here's the result of a couple hours of work. The cards are
touchable
and you can move more than one card at a time. The engine allows me
to
hold a card under each finger and rotate my phone in a 360 and
it
tracks my fingers perfectly. I was able to stitch together the
basic
functions because of the numerous example provided by
http://code.google.com/p/andengineexamples/


Watch it outside Boston edition is a special event, an outdoor film festival in Boston Public Garden, a park in Boston from August 5th to 8th, 6pm to midnight. The event appeals to audiences of all ages, consequently everyone has his own piece of film to go through. At this event you will watch all kinds of films dating from 90s to those of today! if you are someone who is often stressed out with work and never find some time to take a break. Then this, for sure is the show for you!
Watch it outside Boston edition is Free! Just do your Reservation online here on our website to guarantee your seat. hope to see you soon!


Logged in: Username | | Some Domain
This is an unsecured page, but you can access the secured pages after authenticating.


0
Click
0
Machine 1
amount:
0
cost:
0
Machine 2
amount:
0
cost:
0
Machine 3
amount:
0
cost:
0
Machine 4
amount:
0
cost:
0
Machine 5
amount:
0
cost:
0
Machine 6
amount:
0
cost:
0
Machine 7
amount:
0
cost:
0
Save
Remove Save


Cancel Subscription
Are you sure that you want to downgrade to the free plan?
{% if request.user.customer.current_subscription.status == 'canceled' %}
Your subscription has been downgraded to free plan. But you can still enjoy your {{ request.user.customer.current_subscription.plan }} until {{ request.user.customer.current_subscription.current_period_end }}.
{% else %}
{% if error %}
{{ error }}
{% endif %}
{% endif %}


Class ZOROSBridgeConnection
Inheritance
Inherited Members
Namespace: ZO.ROS
Assembly: Unity.ZeroSim.dll
Syntax
public class ZOROSBridgeConnection
Properties
| Improve this Doc View SourceHostname
Hostname or IP addresss
Declaration
public string Hostname { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Instance
Declaration
public static ZOROSBridgeConnection Instance { get; }
Property Value
| Type | Description |
|---|---|
| ZOROSBridgeConnection |
IsConnected
Checks if the ROS Bridge is connected.
Declaration
public bool IsConnected { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Port
TCP Port. Do not recommend changing.
Declaration
public int Port { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Serialization
Declaration
public ZOROSBridgeConnection.SerializationType Serialization { get; set; }
Property Value
| Type | Description |
|---|---|
| ZOROSBridgeConnection.SerializationType |
Methods
| Improve this Doc View SourceAdvertise(String, String, String)
Advertise a ROS message topic.
Declaration
public void Advertise(string topic, string type, string id = "zero_sim_unity")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | topic | ROS topic. For example: "/cmd_vel" |
| System.String | type | ROS message type. For example "geometry_msgs/Twist" |
| System.String | id | ROS node id. Default "zero_sim_unity" |
AdvertiseService<T>(String, String, Func<ZOROSBridgeConnection, ZOROSMessageInterface, String, Task>)
Advertises an external ROS service server. Requests come to the client via Call Service.
Declaration
public void AdvertiseService<T>(string service, string type, Func<ZOROSBridgeConnection, ZOROSMessageInterface, string, Task> serviceRequest)
where T : ZOROSMessageInterface
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | service | The name of the service to advertise. |
| System.String | type | The advertised service message type. |
| System.Func<ZOROSBridgeConnection, ZOROSMessageInterface, System.String, System.Threading.Tasks.Task> | serviceRequest |
Type Parameters
| Name | Description |
|---|---|
| T |
CallService<T, R>(T, String, String, Func<ZOROSBridgeConnection, ZOROSMessageInterface, Task>)
Call ROS service.
Declaration
public void CallService<T, R>(T calling_message, string service, string id, Func<ZOROSBridgeConnection, ZOROSMessageInterface, Task> serviceCallResponse)
where T : ZOROSMessageInterface where R : ZOROSMessageInterface
Parameters
| Type | Name | Description |
|---|---|---|
| T | calling_message | The calling message |
| System.String | service | Service name |
| System.String | id | Unique ID. Important to be Unique! |
| System.Func<ZOROSBridgeConnection, ZOROSMessageInterface, System.Threading.Tasks.Task> | serviceCallResponse | Callback when service responds |
Type Parameters
| Name | Description |
|---|---|
| T | Service call message type |
| R | Service response message type |
ConnectAsync()
Asynchronously connect to ROS Bridge server.
Declaration
public Task ConnectAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Task |
Examples
// run async task. if cannot connect wait for a couple of seconds and try again
Task rosBridgeConnectionTask = Task.Run(async () => {
await _rosBridgeConnection.ConnectAsync();
});
|
Improve this Doc
View Source
Publish<T>(T, String, String)
Publish message to topic.
Declaration
public void Publish<T>(T message, string topic, string id = "zero_sim_unity")
where T : ZOROSMessageInterface
Parameters
| Type | Name | Description |
|---|---|---|
| T | message | ROS Message type |
| System.String | topic | ROS Topic |
| System.String | id | Unique ID of sender. |
Type Parameters
| Name | Description |
|---|---|
| T | ROS Message derived from ZOROSMessageInterface |
SendBSON(JObject)
Declaration
public void SendBSON(JObject json)
Parameters
| Type | Name | Description |
|---|---|---|
| Newtonsoft.Json.Linq.JObject | json |
SendBSON(Byte[])
Declaration
public void SendBSON(byte[] byteArray)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | byteArray |
SendBSON(MemoryStream)
Declaration
public void SendBSON(MemoryStream memoryStream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.MemoryStream | memoryStream |
SendBSONAsync(JObject)
Declaration
public Task SendBSONAsync(JObject json)
Parameters
| Type | Name | Description |
|---|---|---|
| Newtonsoft.Json.Linq.JObject | json |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
SendBSONAsync(Byte[])
Declaration
public Task SendBSONAsync(byte[] byteArray)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | byteArray |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
SendBSONAsync(MemoryStream)
Declaration
public Task SendBSONAsync(MemoryStream memoryStream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.MemoryStream | memoryStream |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
SendJSONString(String)
Declaration
public void SendJSONString(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | message |
SendJSONStringAsync(String)
Declaration
public Task SendJSONStringAsync(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | message |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
ServiceResponse<T>(T, String, Boolean, String)
Send a response to a service call. NOTE: id parameter is very important.
Declaration
public void ServiceResponse<T>(T response_message, string service, bool result, string id)
where T : ZOROSMessageInterface
Parameters
| Type | Name | Description |
|---|---|---|
| T | response_message | the return values. If the service had no return values, then this field can be omitted (and will be by the rosbridge server) |
| System.String | service | the name of the service that was called |
| System.Boolean | result | |
| System.String | id | if an ID was provided to the service request, then the service response will contain the ID |
Type Parameters
| Name | Description |
|---|---|
| T | Response message |
Stop()
Stops ROS Bridge TCP Connection.
Declaration
public void Stop()
Subscribe<T>(String, String, String, Func<ZOROSBridgeConnection, ZOROSMessageInterface, Task>)
This command subscribes the client to the specified topic. It is recommended that if the client has multiple components subscribing to the same topic, that each component makes its own subscription request providing an ID. That way, each can individually unsubscribe and rosbridge can select the correct rate at which to send messages.
type – the (expected) type of the topic to subscribe to. If left off, type will be inferred, and if the topic doesn't exist then the command to subscribe will fail topic – the name of the topic to subscribe to throttle_rate – the minimum amount of time (in ms) that must elapse between messages being sent. Defaults to 0 queue_length – the size of the queue to buffer messages. Messages are buffered as a result of the throttle_rate. Defaults to 1. id – if specified, then this specific subscription can be unsubscribed by referencing the ID. fragment_size – the maximum size that a message can take before it is to be fragmented. compression – an optional string to specify the compression scheme to be used on messages. Valid values are "none" and "png"
If queue_length is specified, then messages are placed into the queue before being sent. Messages are sent from the head of the queue. If the queue gets full, the oldest message is removed and replaced by the newest message.
If a client has multiple subscriptions to the same topic, then messages are sent at the lowest throttle_rate, with the lowest fragmentation size, and highest queue_length. It is recommended that the client provides IDs for its subscriptions, to enable rosbridge to effectively choose the appropriate fragmentation size and publishing rate.
Declaration
public void Subscribe<T>(string id, string topic, string type, Func<ZOROSBridgeConnection, ZOROSMessageInterface, Task> subscriptionCallback)
where T : ZOROSMessageInterface
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | f specified, then this specific subscription can be unsubscribed by referencing the ID. |
| System.String | topic | the name of the topic to subscribe to |
| System.String | type | ROS message type |
| System.Func<ZOROSBridgeConnection, ZOROSMessageInterface, System.Threading.Tasks.Task> | subscriptionCallback | Called when message is received. |
Type Parameters
| Name | Description |
|---|---|
| T | ZOROSMessageInterface |
UnAdvertise(String)
Unadvertise a ROS message topic.
Declaration
public void UnAdvertise(string topic)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | topic |
UnAdvertiseService(String)
Stops advertising an external ROS service server
Declaration
public void UnAdvertiseService(string service)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | service | the name of the service to unadvertise |
Unsubscribe(String, String)
Unsubscribe a ROS message topic.
Declaration
public void Unsubscribe(string id, string topic)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | |
| System.String | topic |
Events
| Improve this Doc View Source_disconnectEvent
Declaration
public event ZOROSBridgeConnection.ROSBridgeConnectionChangeHandler _disconnectEvent
Event Type
| Type | Description |
|---|---|
| ZOROSBridgeConnection.ROSBridgeConnectionChangeHandler |
ROSBridgeConnectEvent
Event that is called when connected to ROS bridge.
Declaration
public event ZOROSBridgeConnection.ROSBridgeConnectionChangeHandler ROSBridgeConnectEvent
Event Type
| Type | Description |
|---|---|
| ZOROSBridgeConnection.ROSBridgeConnectionChangeHandler |
ROSBridgeDisconnectEvent
Event called when disconnected from ROS Bridge
Declaration
public event ZOROSBridgeConnection.ROSBridgeConnectionChangeHandler ROSBridgeDisconnectEvent
Event Type
| Type | Description |
|---|---|
| ZOROSBridgeConnection.ROSBridgeConnectionChangeHandler |