This utility will load a .nbt saved structure file, a .schematic file, a .schem WorldEdit Schematic, or a .litematica schematic file and generate one or more command block commands that will re-create the structure in Minecraft. This is useful if you have 'ops' on a Minecraft server and want to import a structure, but you cannot download, edit and re-upload the world or upload the .nbt file to the server. This also allow using saved structure files that are larger than the game normally supports, such as ones generated by MCEdit or other similar utilities (once those utilities support 1.13). This can also be used on single player worlds if cheats are enabled, or cheats can be temporarily enabled by opening a single player world to LAN and enabling cheats. Once 'cheats' are enabled, you can go into creative mode to place and edit command blocks by typing '/gamemode creative' in chat (changing the 'creative' to 'survival' will switch you back to survival mode), and you can get a command block by typing '/give @p command_block'.
Earlier versions of this utility (for Minecraft Java version 1.12 or earlier) supported .schematic files used by MCEdit and similar utilities. Those files are still supported, but due to the large changes in how Minecraft works (no more block ids or 4-bit block data, instead using block names and block state), .shematic files may not completely convert correctly, and take more time to process as all the block id and block data has to be converted to the correct block names and block states.
Launch S2CB. If you have Java installed, this should just involve double clicking on the .jar file. The default settings should be fine initially. Click the 'Choose...' button and select the structure file that you want to open, after setting all the options and parameters.
Within a few seconds the output area at the bottom should have some information about the structure and a series of commands that will recreate it. If you used the default settings, then to recreate the structure in Minecraft you would place the same number of command blocks down in your world as there are commands, in a line from west to east. The north west corner of the build will be one block south and one block east of the west most command block. Copy the commands into the blocks, with command 1 going into the west most block, command 2 in the block just east of block 1, command 3 in the block just east of command 2, etc. and the last command in the east most block. Then just activate the command block in order, from 1 to N, waiting for the previous command to finish running before activating the next command. This should be just a few seconds, depending on lag. Command blocks can be activated by powering them with redstone, the easiest way to do this is to place a redstone torch next to them, or a redstone block. You can also place a button or pressure plate on or next to the command blocks (hold shift (crouch) if placing on the command block, but don't place on top of the command block as blocks are spawned on top of the command block) and use them to activate the command block. The first command block will generate a red glazed terracotta block, a redstone block, and an activator rail on top of it. These will be removed by the last command block. A few stray sand block items will be created as a side effect when multiple command blocks are needed.
You can manually highlight and copy (CTRL-C) the commands for pasting into the command blocks in Minecraft. However, you may find it easier to just click the 'Copy Command' button at the bottom right of the window. After choosing a structure, this will show 'Copy Command 1', and clicking it will automatically place the command for the first command block into your clipboard, and ready the button for copying the second command (changing the label to 'Copy Command 2'). Once the final command has been copied, the button will disable itself. You can use the 'Reset' button at any time to reset the Copy Command button back to copying the first command.
If the new command offset is 'East No Space' (the default), before the the list on commands, will be a single command that will place all the command blocks needed for recreating the structure (they will be empty, you will still need to fill them with the correct commands), and it will create a flying machine to activate the command blocks that you can start after you have filled the command blocks with the correct commands. If your structure only needs a few commands, this isn't too useful, however, if your structure takes many command block, this saves you from placing all the command blocks and from activating them correctly. It is recommended that you place a command block facing upwards (with the circle side on top, this is so it is obvious that the block gets modified and faces north when the command is run) and put the one generation command into this block and activate it. Once activated, it will replace itself and place a row of command block equal to the amount needed to re-create your structure. The command blocks will be all facing north, except every 5th one will be facing up, while every 25th will be facing south. This is to make it easier to keep track of where you are when filling the command blocks with the commands to generate the structure.  The machine will stop at the end after hitting the furnace that was placed. Be careful destroying the flying machine, as to not activate it again; it is recommended to first destroy the redstone block, followed by the two observer blocks, then the other blocks in any order.
This utility was initially designed to output commands meant to be put in command blocks, so that there was no need to access the world save file to recreated the structure.
While this does work, this somewhat limits the size of structures that can be imported this way.
Once structures reach a certain size, the number of command blocks needed to recreate them becomes very large.
Filling 50 or 100 command blocks with the proper command is possible, but as the number of command blocks increase, the chance of making an error and needing to move or re-copy commands increases.
If you happen to have access to the world save, for example, in a single player world, or you have access to the server files of a multiplayer world, I have added an option to generate a Minecraft Data Pack that can be used to spawn the structure with one command block, no matter the structure size.
To use this, change the output type to 'Data Pack' from 'Command Block' before generating the commands.
This will prompt you to save the data pack file at the end of conversion.
You can then copy this file into the 'datapacks' directory of the Minecraft world you want to import the structure into.
In the world, you would place one command block at the north west corner of the area you want the structure build, and put in to it the command
'function s2cb.
This actually may require multiple functions to be called (as functions have a limit of about 65000 commands each), but each function should automatically execute the next function if needed.
(It does this by deleting the command block and any blocks directly to the north or west, then replaces the command block with a command block to run the next function, and then powers it).
Setting output to 'Data Pack' will disable a few options, such as New Command Offset, as the don't apply to re-creating a structure with a data pack.
If more than one command is needed for the structure, this controls the placement of the additional command blocks relative to the previous one.
The default setting is 'East No Space', which means that the command blocks are lined from West to East, with the start in the West, with no space between the command blocks.
Other options include: 'East One Space', which has the command blocks lined from West to East, with one space between the command blocks (one space allows easier redstone wiring without needing to be careful to not activate adjacent command blocks).
'West No Space', and 'West One Space' have the command block go from East to West, with the first command block being the East most and the last command block being the West most.
The build is still made one block South and one block East of the first command block.
'North No Space' and 'North One Space' have the command block lined up from South to North, with the first command block in the South, and the last command block in the North.
Again, the build is still made one block South and one block East of the first command block.
'South No Space' and 'South One Space' have the command block lined up from North to South, with the first command block in the North, and the last command block in the South.
'Same Cmd Block' requires that all the commands are run from the same location, either editing the command block to change the command, or by breaking and replacing the command block after each command is run.
Finally, 'Minecart Command Blocks' can be used of you want of have one or more minecart command blocks with the commands run over a single activator rail.
This has a few minor differences compared to all the other settings.
Because we cannot use the top of the first command block as work space, the work space is one block south and one block east of the activator rail.
This causes the whole build to be spawned one block further east and one block further south compared the other setting, however, since it also isn't on top of the command block, the build is also one block lower than it would be with other settings.
The structures are recreated using 'setblock' and 'fill' commands and 'summon' commands for entities (with some 'clone' commands possible if that option is enabled). As such, unlike my original version of this utility, it doesn't need a flat base to build on. However, certain builds may benefit from a flat base (ones with sand or gravel floors), and so this option will create a base of the specified material one block below the structure.
Normally the structure is constructed so that it's northwest corner is 1 block south and 1 block east of the first (or only) command block. Adjusting the build offset will move where that location is.  Currently limited to +-255 for each direction. Be careful to not have the resulting build area overlap the command block(s) creating the build.
With Quiet checked, a command will be run at the start of the build preventing additional command block output from being displayed in the chat log.
With Clear checked, the build area will be filled with air, removing all blocks from the area, before the structure is re-created.
When No Dangerous Blocks is selected, blocks of Lava, TNT or Fire won't be placed. This is useful for moving structures from worlds with fire tick turned off to worlds with fire tick turned on, to prevent them from burning themselves down, or to make sure that TNT isn't accidentally set off as the structure is re-created. These blocks can then be manually placed if wanted.
With No Monsters checked, no hostile mobs / creatures will be spawned while re-creating the structure, although passive mobs will still be spawned.
With No Mobs checked, no mobs / creatures will be spawned, passive or hostile. Other entity types will still be created.
With No Projectiles checked, no projectiles will be recreated. Projectiles are thrown eggs, shot arrows, thrown snowballs, fireballs, small fireballs, thrown ender pearls, eye of ender signals, thrown potions, thrown xp bottles, wither skull projectiles, and launched fireworks_rockets.
With Remove Barriers checked, commands will be run at the end to remove barrier blocks. This is useful for bringing in slime block machine structures that have been 'jammed' using barrier blocks.
If this is checked, this will limit the length of the line of command blocks generated for a structure so that it is not longer than the structure is in the direction chosen for the command blocks to go in (the New Command Offset direction).
This has a few limitations: 1. the line of command blocks will be at least 100 blocks long, even if the structure is narrower than that 2. this controls the number of command blocks, so if you choose one of the 'One Space' settings, it may be twice as long as the build is in that direction 3. the length of the command block line will always be a multiple of 25 for easy placement.
Each additional line of command blocks will be 3 blocks above and one block back from the previous line.
For example, if your structure is 160 blocks wide, but needs 321 command blocks to be generated, and you chose 'East No Space' (the default) offset, the first line will be as normal, with the first block starting 1 block north and 1 block west of the build area, and it will be 150 block long (the largest multiple of 25 less than 160).
The second line of command blocks will be 3 blocks above the initial command block (2 air blocks between them), and one block further away from the build area, perpendicular to the command block line direction; in this case, one block to the north.
(This offset is so blocks can fall on the initial command block.)

The final line of command blocks is another 3 blocks up and one block further away form the build area, and this time is only 21 command blocks long, as that is the number of commands that remain.
With Ignore Wire Power checked, redstone wires will be created without specifying their previous power level, relying on the game to recalculate the correct power level. This results in smaller commands, as fill commands can be used to place most redstone wires, instead of using setBlock to individually place each piece of redstone wire with it's power level specified. Unchecked, each piece of redstone wire is placed individually with it's power level specified, which might be needed for some really complex redstone creations.
If checked, will more carefully place rails, one at a time, following the rail line directions, compared to just placing them along with other blocks, west to east, north to south, bottom to top.
Rails are a bit of a strange 'block' in Minecraft, one of a few whose shape / direction is affected by blocks placed around it, after it has been placed. Because of this, the order that the rails are placed in affect the final layout of the track - especially when you have multiple rail lines running along side each other or crossing in complex ways.
When unchecked (the default), the rails are placed along with other blocks, west to east, north to south, bottom to top. This is fine if you only have one or a few rail lines, that are always at least a block apart and have no or just a few 'T' junctions. In that case, the only issue will possibly the 'T' junctions, possibly needing the curve to have it's direction changed in order to be correct.
If you have rail lines that run right next to each other without space between them, or have many 'T' junctions or places where 4 rails converge on one curve, then you will want to enable this option to ensure as many rails are placed correctly as possible. With the option checked, rails are placed one at a time, following along the rail path to ensure that they are connecting to their proper neighbors, starting from 'safe' locations (places where a rail is only surrounded by other rails that it connects to and that connect to it). This option makes the commands larger, but should greatly reduce the potential errors in rail placement. The only issues that should remain when this is checked is circumstances that required rails to be placed to correct the direction of other rails to be placed, and then the 'correction rails' were deleted. For example, a series of rail lines, without spaces between them ending all in a row would still turn into connected curve pairs even with 'Complex Rails' checked, but where they ran along side each other would be correct, which may not be the case with it unchecked, depending on the direction they were traveling.
With Min Water checked, only water source blocks are added, leading to smaller commands. Unchecked, all water blocks, source and flowing, are added. Normally, just adding the water source block back should be enough to recreate a structure, letting the natural flow recreate any flowing water areas. However, you may need to manually update the water to get it to flow (for some reason, water placed with setBlock doesn't check if it can flow when it is placed). However, if your build used certain methods to shape the water flow, such as specifically building holes to force the flow in one direction, and then later filling them in, then you may need to uncheck this option to have the flowing water put back exactly like it was.
With Min Entities checked, entities will be imported with only the essential properties needed to create them. Unchecked, all the properties of the entity saved in the structure will be reproduced.
With Hollow Out checked, blocks that are surrounded completely by non-transparent block are removed from the build. This should make most structures need less commands to reproduce, and should look identical. However, it is possible that for certain structures, this will actually cause it to need more commands (because areas that could be done with a single large fill now will need several fill or set block commands), or it could break certain mechanisms (for example, removing blocks that are supposed to be pushed by a piston). Use with caution.
With Check Clones checked, the structure is scanned for duplicate area of the structure.
These duplicate area are then reproduced by cloning the original area, instead of using setblock and fill commands to recreate them.
This is useful for reproducing castle walls or patterened floors or other sub-structures with regular repeating blocks.
Minimum cloned area are 3x3x3 and must contain at least two block types, and areas up to 16x16x16 will be cloned.
This process is CPU and memory intensive.
This can take a few minutes for a 256x256x256 structure.
You may need 4 GB of ram accessible to Java or more for large structures.
Normally, fill are done so that every block placed is correct, limiting fills to consecutive blocks of the same type.
However, sometimes thre are large areas of a single type of block, with just a few other types of blocks sprinkled in (for example, underground of normal terrain is mostly stone with a few other block types mixed in).
If this option is turned on, this utility will search for areas like this that can be done as a big fill, which later has some blocks replaced.
This search can take a lot of time, about 10 minutes for a 256x256x256 structure.
This can result in some areas being filled in that are later replaced with air again (when typically air 'blocks' are never placed except at the start when you have 'clear' selected).
This may result in more commands needed in certain cases, but the search for fills is tuned to try to avoid this (with fill only being done if more than 10 blocks more than then number of air blocks that will need to be replaced are placed by the fill).
Due to how the search works, it will get a somewhat faster as it goes along (as the search space is reduced by areas previously filled in).
This is only really useful for large structures.
In testing, it reduces the number of command blocks needed by about 10% on some structures, but may not help at all (or actually take more command blocks) depending on the specific structure.
Will help further reduce the number of commands needed for a large structure that has already been 'hollowed out'.
This utility was originally tested in single player and Minecraft was found to support command lengths up to about 32500 characters.
The utility currently tries to keep command lengths to to about 32000 characters (it stops adding more commands to the current command block at the point, adding one additional command to remove the minecarts this command added).
However, testing on a multiplayer server, I found that when I attempted to insert a command of that length into a command block, I was often kicked from the server, although upon rejoining, it was found that the full text of the command was in the command block.
I found that if I limited the command block length to 30000 characters, this no longer happened.
I'm not sure if this happens for all servers, or if it is because of particular settings on the server I normally play on.
That is what the Server Safe option does, it limits the command block length to 30000 characters instead of 32000 characters.
This will on average require about 7% more command blocks to generate a structure compared to unchecked, but should prevent you from getting kicked from multiplayer servers.
Most blocks that can be colored use the same 16 numbers to represent to colors, using the same number to represent the same color for each block type.
This is typically 0 for white, 1 for orange, 2 for magenta, 3 for light blue, etc. , 14 for red, and 15 for black.
This goes for wool, glass, stained clay, glazed terracotta, beds, carpets, etc.
Except that for some reason, banners and the patterns on banners don't follow this same scheme.
The base banner color and color of patterns seem to have everything reversed (at least for banners from Minecraft 1.12).
This also seems to be true for a few schematics I've tried for 1.8.9.
However there are other schematics that even with the correction to reverse the number order, don't seem to have the correct color.
This setting allows you to apply the banner color correction to both the base color and pattern colors, or only one of them, or not to apply it at all.
This only applies to schematic files, that store banner colors as numbers.
The default it to apply the correction to both the base color and the pattern colors, as this seems to be correct for most schematics.
Code for this utility was written by Brian Risinger - TroZ in Minecraft.
Inspiration came from several places, but mainly from MrGarretto whose similar
Structure to Command MCEdit filter caused me to abandon my falling sand approach (where every block (including additional command blocks) was spawned in as a falling sand block) and instead use
this current stacked Command Block Minecart approach (which was possible once two passenger boats were added to the game) to running multiple commands.
This code uses the QUERZ NBT LIBRARY to read nbt files.
This code uses code from the Litematica Mod in order to properly litematica files.
This code uses GUAVA 18 Google Core Libraries for Java.
This code uses Apache Commons Lang Library.
This was mostly coded between 10pm and 2am, so if you find any issues, that is probably the reason.


mmsoda --addtools mmsoda --addtools --quiet mmsoda --builddb mmsoda --docinstall mmsoda --docinstall --quiet mmsoda --help mmsoda --showoptions mmsoda --rmpath mmsoda --root evalResults = mmsoda() [evalResults,critGelRub] = mmsoda() [evalResults,critGelRub,sequences] = mmsoda() [evalResults,critGelRub,sequences,conf] = mmsoda() [evalResults,critGelRub,sequences,metropolisRejects,conf] = mmsoda()
mmsoda --addtools
If the MMSODA software is run offline (as opposed to being run compiled on the cluster), this command adds the ./model, ../mmsoda/comms, ../mmsoda/enkf, ../mmsoda/mo, ../mmsoda/mmlib, ../mmsoda/tools, ../mmsoda/visualization directories to the MATLAB search path.
mmsoda --addtools --quiet
Same as mmsoda --addtools, but without any verbose feedback.
Builds the database that is used by the docsearch command. See also builddocsearchdb. Only used offline.
Installs the documentation by writing the 'mmsoda-styles.css' style sheet file using the user-specific styles; adds the necessary directories to the MATLAB search path by calling mmsoda --addtools --quiet Only used offline.
mmsoda --docinstall --quiet
Same as mmsoda --docinstall, but without any verbose feedback.
mmsoda --help
Prints a help message to the screen.
mmsoda --showoptions
Prints a list of all authorized options for the mmsoda configuration. See also table below.
mmsoda --rmpath
Removes the MMSODA directories from the MATLAB search path.
mmsoda --root
Prints the root directory of the MMSODA Toolbox for MATLAB.
evalResults = mmsoda()
[evalResults,critGelRub] = mmsoda()
[evalResults,critGelRub,sequences] = mmsoda()
[evalResults,critGelRub,sequences,conf] = mmsoda()
[evalResults,critGelRub,sequences,metropolisRejects,conf] = mmsoda()
Calls the SODA parameter optimization algorithm. mmsoda() expects 3 directories to be present in the current working directory, some of which need to contain particular files. Furthermore, the current working directory should contain a copy of `Makefile' to be able to compile the MATLAB code into an executable, which can then be run on the cluster. It further requires an executable script 'run-mmsoda.sh' or a PBS jobscript 'jobscript-mmsoda.pbs'.
So the general structure of files and folders is as follows:
Note that in the above list, X can be one of four strings 'bypass', 'scemua', 'reset', or 'soda', depending on the type of optimization that is being performed; Y is a string 'so' or 'mo', depending on whether the optimization is single-objective or multi-objective; Z is a number indicating which parameter combinations are contained in the file.
Note that the 'mmsoda-toolbox' folder must be located at the same level as the current working directory.
Further note that 'X-Y-tempstate.mat', 'X-results-enkf-evals-Z-Z.mat', and 'X-results.mat' are output files and are therefore generated by the SODA software (as opposed to by the user). In contrast, 'constants.mat' and 'conf.mat' must be created by the user prior to starting the optimization.
The 'data', 'model', and 'results' directories must be located in the directory that the mmsoda() function is called from (which usually is the current working directory). All three folders must be present, even though your specific setup may not require all three to have anything in them. You must adhere to the naming convention as displayed above, at least with regard to the folder names and file names that are displayed in bold.
Further down you'll find an overview of the meaning of mmsoda()'s output variables. In the meantime, the table below lists what configuration variables can be included in conf.mat and what their intended purpose is. Individual configuration variables may or may not be required, depending on what type of optimization you are doing:
| Configuration variable | bypass | scemua | reset | soda | Description |
| assimilate | N | N | U | U | Logical row vector with the same number of elements as conf.priorTimes. True values indicate at which times data assimilation should occur. |
| avgWalltimePerParSet | N | N | N | N | This field is used to record how long it took on average to evaluate one parameter combination. |
| badScore | U | U | U | U | This value is assigned as objective score when an error occurs during evaluation of the model. This opion is useful when certain parts of the parameter space result in model crashes, for instance due to integration errors. |
| convMaxDiff | U | U | U | U | This scalar value is used in determining whether the optimization has converged. Is a more stringent criterion than just assuming that convergence has been achieved when the Gelman-Rubin values in the critGelRub array are less than 1.2. Its default value is 0.001. |
| convUseLastFraction | U | U | U | U | This scalar real valued option determines what fraction of the record of samples is used in determining whether the optimization has converged. |
| converged | N | N | N | N | Logical scalar indicating which whether the optimization has converged acording to the Gelman-Rubin criterion. |
| covModelPert | N | N | N | U,R | Covariance of the model perturbations (white noise). |
| covObsPert | N | N | N | U,R | Covariance of the observation perturbations (white noise). |
| critGelRubConvd | U | U | U | U | The Gelman-Rubin criterion must be less that conf.critGelRubConvd for convergence to be achieved. Its default value is 1.2. See also convMaxDiff. |
| drawInterval | U | U | U | U | This scalar integer value determines how often the call to the visualization script is made. It is measured in generations, not model evaluations. |
| doPlot | U | U | U | U | This logical scalar detemines whether any visualization is performed. Note that doPlot can be true even when running compiled on a remote cluster, but that this only works when X forwarding has been enabled for your SSH connection to the cluster and that it requires an X environment to run on your local machine. Since Windows does not use X for its graphics, Windows users need an additional program (for instance Xming) to be able to view any MATLAB figures over SSH. See also drawInterval. |
| evalCol | N | N | N | N | This scalar integer value holds the column in evalResults, sequences, and metropolisRejects that contains the model evaluation number. |
| executeInParallel | N | N | N | N | This logical scalar indicates whether the optimization is executed in parallel or not. |
| initMethodKF | N | N | U,R | U,R | This string option determines what method is used to initialize the state variables that are subject to Ensemble Kalman Filter updating. Currently, only 'reference' is implemented. |
| initValuesKF | N | N | U,R | U,R | When conf.initMethodKF is set to 'reference', initValuesKF contains the initial values of the state variables that are subject to state updating by the Ensemble Kalman Filter. |
| initMethodNOKF | N | N | U,R* | U,R* | This string option determines what method is used to initialize the variables that are not subject to Ensemble Kalman Filter updating, but that are unique to individual ensemble members. Currently, only 'reference' is implemented. Required when namesNOKF is not empty. |
| initValuesNOKF | N | N | U,R* | U,R* | When conf.initMethodNOKF is set to 'reference', initValuesNOKF contains the initial values of the variables that are not subject to state updating by the Ensemble Kalman Filter, but that are unique to individual ensemble members. Required when initMethodNOKF is 'reference'. |
| isSingleObjective | N | N | N | N | Logical scalar indicating whether the optimization is single-objective or not. Note that its value is always the opposite of conf.isMultiObjective. |
| isMultiObjective | N | N | N | N | Logical scalar indicating whether the optimization is multi-objective or not. Note that its value is always the opposite of conf.isSingleObjective. |
| jumpRate | U | U | U | U | This scalar real value acts as a scaler on the covariance matrix that is used to generate new samples in mmsodaGenerateOffspring. Its default value is 2.4*sqrt(conf.nOptPars). |
| llCols | N | N | N | N | For single-objective optimization, llCols is a scalar integer that indicates which column in evalResults, sequences, and metropolisRejects holds the log likelihood information. For multi-objective optimization, llCols is a row vector of integers, that indicates which columns in evalResults, sequences, and metropolisRejects hold the objective scores (which need not necessarily be all log likelihood values). |
| modeGelRub | U | U | U | U | This string option determines how the Gelman-Rubin criterion is calculated. If set to 'strict', the SODA algorithm will calculate the second term from the equation from the paper as is, i.e. 2*(((m+1)*(n-1))/(m*n^2)) If set to 'loose', the SODA algorithm will use a slightly different version, viz. 2*(((m+1)*(n-1))/(m*n)^2), the difference being in the placement of the parentheses in the denominator. Default is 'loose'. |
| modeStr | U,R | U,R | U,R | U,R | This string option can be one of the following: 'bypass', 'scemua', 'reset', or 'soda'. It determines what kind of optimization will be performed.
If modeStr is set to 'bypass', than the call to the model function file is bypassed, hence the name. This is useful if the objective function calculates the log-likelihood directly, for instance on known probability distributions (benchmark functions). If modeStr is set to 'scemua', the SODA algorithm does not do any state updating, and thus behaves like SCEM-UA (hence the name). If modeStr is set to 'reset', the SODA algorithm does perform state updating, but with full confidence on the measurements. In this mode the ensemble consists of just one member, and is therefore cheaper in terms of computation time. If modeStr is set to 'soda', the SODA algorithm does perform state updating according to an Ensemble Kalman Filter. Depending on what mode is selected, the algorithm will remove fields from conf or reset some of its fields. Also, the required fields are not the same for each mode; for instance, in 'bypass' mode, there is no need for the modelName field. |
| modelName | N | U,R | U,R | U,R | Name of the model whose parameters are calibrated. Note that the model should be located in a subfolder ./model. |
| namesNOKF | N | N | U,R* | U,R* | Cell array of strings, listing the names of the variables that are not subject to state updating, but that are unique to individual members in the ensemble. (R*: required if there are variables with values that are unique for individual ensemble members). |
| nCompl | U | U | U | U | Number of complexes to be used in the optimization. |
| nDASteps | N | N | N | N | Number of data assimilation steps. |
| nGelRub | U | U | U | U | Minimum number of generations for convergence to be achieved. |
| nMembers | N | N | N | U,R | Number of members to be used for the Ensemble Kalman Filter. For SCEM-UA and RESET modes, its value is 1. Not needed for BYPASS mode. |
| nModelEvalsMax | U | U | U | U | Maximum number of parameter combinations to be evaluated. |
| nOffspring | N | N | N | N | Number of offspring that is generated in a generation. Calculated as conf.nOffspringFraction * conf.nSamples. |
| nOffspringFraction | U | U | U | U | Fraction of conf.nSamples, used to calculate how many offspring there are per generation. |
| nOffspringPerCompl | N | N | N | N | Number of offspring that each complex has. |
| nOptPars | N | N | N | N | Number of parameters that are optimized. |
| nNOKF | N | N | N | N | Number of values that are not part of the state updating by the Ensemble Kalman Filter, but are nevertheless unique to individual members. Equal to numel(conf.namesNOKF). |
| nObjs | N | N | N | N | Number of objectives to be used in the optimization. Equal to 1 for single-objective optimization. |
| nOutputs | N | R | N | N | Only used for modeStr = 'scemua'. Number of outputs that MMSODA can expect from the model at a given time. For example if your model simulates the behavior of a system with 3 states and 2 flows, then nOutputs must be 3+2=5. |
| nPrior | N | N | N | N | Number of times at which a prior prediction should be generated for a given parameter set. Equal to numel(conf.priorTimes). |
| nSamples | U | U | U | U | Number of samples in a generation. |
| nSamplesPerCompl | N | N | N | N | Number of samples in a generation, divided by the number of complexes. |
| nStatesKF | N | N | N | N | Number of states that are subject to state updating by the Ensemble Kalman Filter. |
| nWorkers | N | N | N | N | Integer spefifying how many workers are used, if the optimization is executed in parallel. One CPU core counts as one worker. Workers can be distributed over multiple nodes. |
| objCallStr | U,R* | U,R* | U,R* | U,R* | String argument specifies the name of the function that calculates the log likelihood objective score. Only used in single-objective optimization. Note that only the function name is specified, the input and output arguments are prescribed by the SODA algorithm, implying that the objective functions must adhere to a prescribed format. (R*: required for single-objective optimization). |
| objCallStrs | U,R* | U,R* | U,R* | U,R* | Cell array of strings, specifiying the names of the objective functions. Individual elements of objCallStrs are subject to the same rules as those listed under its single-objective counterpart, objCallStr. (R*: required for multi-objective optimization). |
| objCol | N | N | N | N | This scalar integer defines which column in evalResults, sequences, and metropolisRejects holds the objective score. For single-objective optimization, it is equal to conf.llCol (the column that holds the log-likelihood), while for multi-objective optimization, it is equal to conf.paretoCol (the column that holds the Pareto score). |
| obsState | N | N | U,R | U,R | 2-D array containing the observed state values. Size of the array should be conf.nStatesKF rows by conf.nDASteps columns. |
| obsStateTime | N | N | N | N | Calculated as conf.obsStateTime = conf.priorTimes(conf.assimilate). |
| objTexName | U | U | U | U | For single-objective optimization, this field contains the name of the objective function for use in visualization, as a TeX formatted string. |
| objTexNames | U | U | U | U | For multi-objective optimization, this field contains the names of the objective functions for use in visualization, as a cell array of TeX formatted strings. |
| optEndTime | U | U | U | U | This field contains a serial date number. If the built-in now function returns a value greater than that listed in optEndTime, no new offspring will be generated, and the optimization stops. |
| optStartTime | N | N | N | N | At the start of the optimization, the date and time are stored in this field as a serial date number. |
| parCols | N | N | N | N | Row vector of integers that specify which columns in evalResults, sequences, and metropolisRejects hold parameter combinations. |
| paretoCol | N | N | N | N | For multi-objective optimization, this scalar integer value specifies which column in evalResults, sequences, and metropolisRejects holds the Pareto score. |
| paretoMethod | U | U | U | U | This string value specifies which method is used to calculate the Pareto scores in evalResults and sequences. Valid strings are 'g' for Goldberg (1989) ranking, 'z' for Zitzler and Thiele (1999) ranking, and 'v' for Vrugt (2003) ranking. |
| parNames | U,R | U,R | U,R | U,R | Cell array of strings containing the names of the parameters as used in the model. |
| parNamesTex | U | U | U | U | Cell array of strings containing the TeX formatted names of the parameters for use in visualiation. |
| parSpaceHiBound | U,R | U,R | U,R | U,R | Row vector containing the upper bounds of the parameter space for each parameter. |
| parSpaceLoBound | U,R | U,R | U,R | U,R | Row vector containing the lower bounds of the parameter space for each parameter. |
| priorTimes | N | U,R | U,R | U,R | Row vector containing the times for which the model should generate a prior prediction. |
| randSeed | U | U | U | U | Random seed to be used in the optimization. |
| realPartOnly | U | U | U | U | In generating the jumping distance from the covariance of the complex in mmsodaGenerateOffspring, it can sometimes happen that complex numbers are generated. Setting realPartOnly to true forces the SODA algorithm to ignore the complex part. Default value is true. |
| sampleDrawMode | U | U | U | U | This field contains either one of the following strings: 'stratified random' or 'stratified'. Default is 'stratified random', but sometimes 'stratified' is useful for making response surfaces (if conf.nSamples is equal to conf.nModelEvalsMax, and conf.nModelEvalsMax.^(1/conf.nOptPars) is an integer. For example, if the parameter space is 5-dimensional, the number of samples could be 10^5 for a response surface that has 10 elements in each dimension.) |
| saveEnKFResults | N | N | U | U | Logical scalar that indicates whether the (unaggregated) results of all ensemble members of all parameter combinations should be saved to file. Default is false. |
| saveInterval | U | U | U | U | Scalar integer that indicates the interval at which the optimization algorithm saves the preliminary results to file. Note that this does not include the information pertaining to individual ensemble memebers. Further note that it is measured in generations, not model evaluations. |
| startFromUniform | U | U | U | U | Scalar logical value that indicates whether the optimization should start from a uniform prior (i.e. the optimization is a new one) or that the run will be a continuation of a previous run. In the latter case, SODA will look for the file ./results/X-Y-tempstate.mat with X equal to 'bypass', 'scemua', 'reset', or 'soda', and Y equal to either 'so' or 'mo'. |
| stateNamesKF | N | U,R | U,R | U,R | Row cell array of strings that contains the names of the state variables as used in the model, for which state updating is performed when modeStr is set to 'reset' or 'soda'. |
| stateSpaceHiBound | N | N | U,R | U,R | Row vector containing the upper bound of the state space for each state for which state updating is performed. |
| stateSpaceLoBound | N | N | U,R | U,R | Row vector containing the lower bound of the state space for each state for which state updating is performed. |
| thresholdL | U | U | U | U | Threshold likelihood ratio that is (very rarely) used in the Metropolis scheme. |
| useIniFile | U | U | U | U | String that specifies from which file the required options are read if the user does not specify them explicitly. |
| verboseOutput | U | U | U | U | Set to true for (more) verbose output. |
| visualizationCall | U | U | U | U | This string is called every so often depending on doPlot and drawInterval options. By default its value is mmsodaVisualization3, which is a script that comes with MMSODA. It visualizes the Markov chains, as well as the marginal parameter distributions and the objective score. |
| walltime | U | U | U | U | This double scalar can be used to set the desired maximum walltime in days for the optimization. When the optimization starts, mmsoda() calculates optEndTime by adding the walltime to the current time. This can be useful on cluster machines, where the optEndTime depends on the time at which the optimization starts (which is not usually controlled by the user). It is advisable to use a walltime value which is less than the walltime reserved for the PBS job in order to avoid that the optimization is cut short by the scheduler. For example, if calculating one generation takes 10 minutes then the MMSODA configuration walltime should be about 10 minutes shorter than the PBS walltime. |
| Output argument | Description |
| evalResults | This 2-D array is ordered as follows: For single-objective optimization, column conf.evalCol holds the model evaluation number; columns conf.parCols hold the parameter combination; column conf.llCols holds the log-likelihood score. For multi-objective optimization, column conf.evalCol holds the model evaluation number; columns conf.parCols hold the parameter combination; columns conf.llCols hold the log-likelihood scores (or other types of scores) associated with each objective function. Column conf.paretoCol hold the Pareto score. |
| critGelRub | This array holds the Gelman-Rubin convergence information. The scale reduction criterion is calculated after every generation. Column 1 in critGelRub holds the iteration number of the last model evaluation before the Gelman-Rubin scale reduction criterion was assessed; columns 1+1:N hold the value of the Gelman-Rubin scale reduction criterion for each parameter, with N the number of calibration parameters. |
| sequences | Rows and columns of this array hold the exact same information as evalResults, but divided over conf.nCompl Markov chains. |
| metropolisRejects | This array has the same size and dimensions as the sequences array, but instead it holds the parameter space samples that were rejected by the Metropolis scheme. |
| conf | This structure array holds the configuration variables as specified by the user, with some fields added by the SODA algorithm. |


--- layout: page title: 'Rent Board' ---
Meets March 7th, July 11th, September 12th and November 6th
7:00 pm
Borough Hall - 2nd Floor, Blue Room
Council Liaison: Matthew Cokeley
Members (1 year terms):
Darlene Capobianco
Linda Chice
Nick Cirillo
Jennifer Ersalesi
Robert Fagan
Stacey Torres


Founder and CEO of LKS Art Company.
Hello. My name is Leah Kim Sung (8) and I ❤ art, swimming and gynmastics.
My Hobbies
Contact Me


Nasz Kontakt
#} {##} {#Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been#} {# the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley#} {# of type and scrambled it to make a type specimen book. It has survived not only five centuries,#} {# but also the leap into electronic typesetting, remaining essentially unchanged. It was#} {# popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,#} {# and more recently with desktop publishing software like Aldus PageMaker including versions of#} {# Lorem Ipsum.
#} {##} {#Ponad 500 usatysfakcjonowanych klientów
#} {# #} {#Where we Are?
#} {##} {#Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum#} {# has been the industry's standard dummy text ever since the 1500s, when an unknown#} {# printer took a galley of type and scrambled it to make a type specimen book. It has#} {# survived not only five centuries, but also the leap into electronic typesetting.
#} {# #}


See also: IRC log
<Norm> Scribe: timbl
<Norm> Date: 9 August 2004
-------------------------------------------------
<skw-scribe> Issue diwg-1
<skw-scribe> DC: requested discussion because we say nothing about URI with question marks in them.
<skw-scribe> DC: May be a useful distinction between machine generated and human generated rather than statically/dynamically generated URI
This is scribe.perl Revision: 1.115 of Date: 2005/02/15 22:31:37 Check for newer version at http://dev.w3.org/cvsweb/~checkout~/2002/scribe/ Guessing input format: RRSAgent_Text_Format (score 1.00) Found Scribe: timbl Inferring ScribeNick: timbl WARNING: 1 scribe lines found (out of 15 total lines.) Are you sure you specified a correct ScribeNick? WARNING: No "Topic:" lines found. Present: RF PC DC SW TBL NW(Chair) Agenda: http://www.w3.org/2001/tag/2004/08/09-11-tag.html Found Date: 9 Aug 2004 People with action items: WARNING: Input appears to use implicit continuation lines. You may need the "-implicitContinuations" option. WARNING: No "Topic: ..." lines found! Resulting HTML may have an empty (invalid) <ol>...</ol>. Explanation: "Topic: ..." lines are used to indicate the start of new discussion topics or agenda items, such as: <dbooth> Topic: Review of Amy's report[End of scribe.perl diagnostic output]


{% set current_page = "import" %} {% extends 'base.html' %} {% block body %}
Uploaded files should be in CSV format.


Installation¶
Samewords requires Python 3.6 installed in your system. If you are on
a Mac OSX machine, and you use Homebrew, you can
run brew install python3
. If you do not use Homebrew (or run a
Windows machine), download the latest official python
distribution and follow the
instructions.
Optional: Virtual environment¶
Before installation you may want to create a virtual environment (see more here) for the installation, if you don’t want to install the script globally. This is also particularly useful if you want to hack on the script.
To create a virtual environment for the project, run:
$ mkvirtualenv -p python3 <name>
Where <name>
is the name you want to give the venv.
After activating the virtual environment (workon
or source
, see
the guide linked above or search the interwebs), install the package.


--- layout: post tags: [Dependency Injection, Software Design] date: 2011-09-19 14:44:47 UTC title: "Message Dispatching without Service Location" description: "How to do loosely-coupled message dispatching without the Service Locator anti-pattern." --- {% include JB/setup %}
Once upon a time I wrote a blog post about why Service Locator is an anti-pattern, and ever since then, I occasionally receive rebuffs from people who agree with me in principle, but think that, still: in various special cases (the argument goes), Service Locator does have its uses.
Most of these arguments actually stem from mistaking the mechanics for the role of a Service Locator. Still, once in a while a compelling argument seems to come my way. One of the most insistent arguments concerns message dispatching - a pattern which is currently gaining in prominence due to the increasing popularity of CQRS, Domain Events and kindred architectural styles.
In this article I'll first provide a quick sketch of the scenario, followed by a typical implementation based on a ‘Service Locator', and then conclude by demonstrating why a Service Locator isn't necessary.
Appropriate use of message dispatching internally in an application can significantly help decouple the code and make roles explicit. A common implementation utilizes a messaging interface like this one:
public interface IChannel { void Send<T>(T message); }
Personally, I find that the generic typing of the Send method is entirely redundant (not to mention heavily reminiscent of the shape of a Service Locator), but it's very common and not particularly important right now (but more about that later).
An application might use the IChannel interface like this:
var registerUser = new RegisterUserCommand( Guid.NewGuid(), "Jane Doe", "password", "jane@ploeh.dk"); this.channel.Send(registerUser); // ... var changeUserName = new ChangeUserNameCommand( registerUser.UserId, "Jane Ploeh"); this.channel.Send(changeUserName); // ... var resetPassword = new ResetPasswordCommand( registerUser.UserId); this.channel.Send(resetPassword);
Obviously, in this example, the channel variable is an injected instance of the IChannel interface.
On the receiving end, these messages must be dispatched to appropriate consumers, which must all implement this interface:
public interface IConsumer<T> { void Consume(T message); }
Thus, each of the command messages in the example have a corresponding consumer:
public class RegisterUserConsumer : IConsumer<RegisterUserCommand> public class ChangeUserNameConsumer : IConsumer<ChangeUserNameCommand> public class ResetPasswordConsumer : IConsumer<ResetPasswordCommand>
This certainly is a very powerful pattern, so it's often used as an argument to prove that Service Locator is, after all, not an anti-pattern.
In order to implement IChannel it's necessary to match messages to their appropriate consumers. One easy way to do this is by employing a DI Container. Here's an example that uses Autofac to implement IChannel, but any other container would do as well:
private class AutofacChannel : IChannel { private readonly IComponentContext container; public AutofacChannel(IComponentContext container) { if (container == null) throw new ArgumentNullException("container"); this.container = container; } public void Send<T>(T message) { var consumer = this.container.Resolve<IConsumer<T>>(); consumer.Consume(message); } }
This class is an Adapter from Autofac's IComponentContext interface to the IChannel interface. At this point I can always see the “Q.E.D.” around the corner: “look! Service Locator isn't an anti-pattern after all! I'd like to see you implement IChannel without a Service Locator.”
While I'll do the latter in just a moment, I'd like to dwell on the DI Container-based implementation for a moment.
While AutofacChannel uses Autofac (a DI Container) to implement the functionality, it's not (necessarily) a Service Locator in action. This was the point I already tried to get across in my previous post about the subject: just because its mechanics look like Service Locator it doesn't mean that it is one. In my implementation, the AutofacChannel class is a piece of pure infrastructure code. I even made it a private nested class in my Composition Root to underscore the point. The container is still not available to the application code, so is never used in the Service Locator role.
One of the shortcomings about the above implementations is that it provides no fallback mechanism. What happens if the container can't resolve the matching consumer? Perhaps there isn't a consumer for the message. That's entirely possible because there are no safeguards in place to ensure that there's a consumer for every possibly message.
The shape of the Send method enables the client to send any conceivable message type, and the code still compiles even if no consumer exists. That may look like a problem, but is actually an important insight into implementing an alternative IChannel class.
Consider the IChannel.Send method once again:
void Send<T>(T message);
Despite its generic signature it's important to realize that this is, in fact, a weakly typed method (at least when used with type inferencing, as in the above example). Equivalently to a bona fide Service Locator, it's possible for a developer to define a new class (Foo) and send it - and the code still compiles:
this.channel.Send(new Foo());
However, at run-time, this will fail because there's no matching consumer. Despite the generic signature of the Send method, it contains no type safety. This insight can be used to implement IChannel without a DI Container.
Before I go on I should point out that I don't consider the following solution intrinsically superior to using a DI Container. However, readers of my book will know that I consider it a very illuminating exercise to try to implement everything with Poor Man's DI once in a while.
Using Poor Man's DI often helps unearth some important design elements of DI because it helps to think about solutions in terms of patterns and principles instead of in terms of technology.
However, once I have arrived at an appropriate conclusion while considering Poor Man's DI, I still tend to prefer mapping it back to an implementation that involves a DI Container.
Thus, the purpose of this section is first and foremost to outline how message dispatching can be implemented without relying on a Service Locator.
While this alternative implementation isn't allowed to change any of the existing API, it's a pure implementation detail to encapsulate the insight about the weakly typed nature of IChannel into a similarly weakly typed consumer interface:
private interface IConsumer { void Consume(object message); }
Notice that this is a private nested interface of my Poor Man's DI Composition Root - it's a pure implementation detail. However, given this private interface, it's now possible to implement IChannel like this:
private class PoorMansChannel : IChannel { private readonly IEnumerable<IConsumer> consumers; public PoorMansChannel(params IConsumer[] consumers) { this.consumers = consumers; } public void Send<T>(T message) { foreach (var c in this.consumers) c.Consume(message); } }
Notice that this is another private nested type that belongs to the Composition Root. It loops though all injected consumers, so it's up to each consumer to decide whether or not to do anything about the message.
A final private nested class bridges the generically typed world with the weakly typed world:
private class Consumer<T> : IConsumer { private readonly IConsumer<T> consumer; public Consumer(IConsumer<T> consumer) { this.consumer = consumer; } public void Consume(object message) { if (message is T) this.consumer.Consume((T)message); } }
This generic class is another Adapter - this time adapting the generic IConsumer<T> interface to the weakly typed (private) IConsumer interface. Notice that it only delegates the message to the adapted consumer if the type of the message matches the consumer.
Each implementer of IConsumer<T> can be wrapped in the (private) Consumer<T> class and injected into the PoorMansChannel class:
var channel = new PoorMansChannel( new Consumer<ChangeUserNameCommand>( new ChangeUserNameConsumer(store)), new Consumer<RegisterUserCommand>( new RegisterUserConsumer(store)), new Consumer<ResetPasswordCommand>( new ResetPasswordConsumer(store)));
So there you have it: type-based message dispatching without a DI Container in sight. However, it would be easy to use convention-based configuration to scan an assembly and register all IConsumer<T> implementations and wrap them in Consumer<T> instances and use this list to compose a PoorMansChannel instance. However, I will leave this as an exercise to the reader (or a later blog post).
In conclusion, I find that I can still defend my original claim: Service Locator is an anti-pattern.
That claim, by the way, is falsifiable, so I do appreciate that people take it seriously enough by attempting to disprove it. However, until now, I've yet to be presented with a scenario where I couldn't come up with a better solution that didn't involve a Service Locator.
Keep in mind that a Service Locator is defined by the role it plays - not the shape of the API.
Comments
I'm helping a .NET vendor improve their blog by finding respected developers who will contribute guest posts. Each post will include your byline, URL, book link (with your Amazon affiliate link) and a small honorarium. It can either be a new post or one of your popular older posts.
Being an author myself, I know that getting in front of new audiences boosts sales, generates consulting opportunities and in this case, a little cash. Would you be interested? If so, let me know and I'll set you up.
Cheers,
Bob Walsh
Looking forward to getting your book later this month.
I think it comes down to the definition of Service Locator. I'm not sure that the AutofacChannel example is much different than a common example I come up against, which is a ViewModel factory that more or less wraps a call to the container, and then gets injected as a IViewModelFactory into classes that need to create VMs. I don't feel that this is "wrong," as I only allow this kind of thing in cases where more explicit injection is significantly more painful. However I do still think of it as Service Location, and it does violate the Three Calls Pattern. As long as I limit the number of places this is allowed and everyone is aware of them, I see little risk in doing it this way. Some might argue it's a slippery slope . . .
Whether it is a static dependency or an injected instance, it seems unnatural to me to call a service directly from a domain object. I think I've seen you say the same thing, but I'm not sure in what context.
Anyway, was wondering if you had any additional thoughts on the subject. I've been struggling with it for a while, and have settled (temporarily) on firing events outside of the domain object (i.e. call the domain.Method, then fire the event from the command handler).
Thanks for writing.
It's my experience that in MVVM one definitely needs some kind of factory to create ViewModels. However, there's no reason to define it as a Service Locator. A normal (generic) Abstract Factory is preferable, and achieves the same thing.
Regarding the question about whether or not to raise Domain Events from within Entities: it bothered me for a while until I realized that when you move towards CQRS and Event Sourcing, Commands and Events become first-class citizens and this problem tends to go away because you can keep the logic about which commands raises which events decoupled from the Entities. In this architectural style, Entities are immutable, so nothing ever changes within them.
In CQRS we have consumers that consume Commands and Events, and typically we have a single consumer which is responsible for receiving a Command and (upon validation) convert it to an Event. Such a consumer is a Service which can easily hold other Services, such as a channel upon which Events can be published.
Thanks.
I had that problem previously, but I thought I fixed it months ago. From where I'm sitting, the code looks OK both in Google Reader on the Web, Google Reader on Android as well as FeedDemon. Can you share exactly where and how it looks unreadable?
http://imgur.com/LvCfJ
Thanks.
Thanks.
Why I am posting:
I am currently designing the architecture of a new application and I want to design my domain models persistent ignorant but still use them directly in the NHibernate mapping to benefit from lazy loading and to not have near identical entity objects. One part of a PI domain model is that the models might rely on services to do their work which get injected using constructor injection. Now, NHibernate needs a default constructor by default but that can be changed (see: http://fabiomaulo.blogspot.com/2008/11/entities-behavior-injection.html). In the middle of this post there is a class implementation called ReflectionOptimizer that is responsible for creating the entities. It uses an injected container to receive an instance of the requested entity type or falls back to the default implementation of NHibernate if that type is unknown to the container.
Do you think this is using the container in a service locator role?
I think not, because a Poor Man's DI implementation of this class would get a list of factories, one for each supported entity and all of this is pure infrastructure.
The biggest benefit of changing the implementation in a way that it receives factories is that it fails fast: I am constructing all factories along with their dependencies in the composition root.
What is your view on this matter?
It'd be particularly clean if you could inject an Abstract Factory into your NHibernate infrastructure and keep the container itself isolated to the Composition Root. In any case I agree that this sounds like pure infrastructure code, so it doesn't sound like Service Location.
However, I'd think twice about injecting Services into Entities - see also this post from Miško Hevery.
If Message Bus is used - how is about Layers? Should it be some kind of "Superlayer" (visible for all other layers?)
How do you think - in which situation should Message Bus be involved?
Should it better be implemented or is there some good products? (C#, not commerce licence)
It's not too hard to implement a message bus on top of a queue system, but it might be worth taking a look at NServiceBus or Rebus.
I have implemented this pattern before and everything is well when the return type is void.
So, for dispatching messages, this is a really usefull and flexible pattern
However, I was looking into implementing the same thing for a query dispatcher. The structure is similar, with the difference that your messages are queries and that the consumer actually returns a result.
I do have a working implementation but I cannot get type inference to work on my query dispatcher. That means that every time I call the query dispatcher I need to specify the return type and the query type
This may seem a bit abstract, but you can check out it this question on StackoverFlow: type inference with interfaces and generic constraints.
I'm aware that the way I'm doing it there is not possible with c#, but I was wondering if you'd see a pattern that would allow me to do that.
What is your view on this matter?
Many thanks!
Kenneth, thank you for writing. Your question reminded my of my series about Role Hints, particularly Metadata, Role Interface, and Partial Type Name Role Hints. The examples in those posts aren't generically typed, but I wonder if you might still find those patterns useful?
Hi Mark,
I am also using this pattern as an in-process mediator for commands, queries and events. My mediator (channel in your case) now uses a dependency resolver, which is a pure wrapper around a DI container and only contains resolve methods.
I am now trying to refactor the dependency resolver away by creating separate factories for the command, query and event handlers (in your example this are the consumers). In my current code and also in yours and dozens of other implementations on the net don’t deal with releasing the handlers. My question is should this be a responsibility of the mediator (channel)? I think so because the mediator is the only place that knows about the existence of the handler. The problem I have with my answer is that the release of the handler is always called after a dispatch (send) even though the handler could be used again for sending another command of the same type during the same request (HTTP request for example). This implies that the handler’s lifetime is per HTTP request.
Maybe I am thinking in the wrong direction but I would like to hear your opinion about the releasing handler’s problem.
Many thanks in advance,
Martijn Burgers
Martijn, thank you for writing. The golden rule for decommissioning is that the object responsible for composing the object graph should also be responsible for releasing it. That's what some DI Containers (Castle Windsor, Autofac, MEF) do - typically using a Release method. The reason for that is that only the Composer knows if there are any nodes in the object graph that should be disposed of, so only the Composer can properly decommission an object graph.
You can also implement that Resolve/Release pattern using Pure DI. If you're writing a framework, you may need to define an Abstract Factory with an associated Release method, but otherwise, you can just release the graph when you're done with it.
In the present article, you're correct that I haven't addressed the lifetime management aspect. The Composer here is the last code snippet that composes the PoorMansChannel object. As shown here, the entire object graph has the same lifetime as the PoorMansChannel object, but I don't describe whether or not it's a Singleton, Per Graph, Transient, or something else. However, the code that creates the PoorMansChannel object should also be the code that releases it, if that's required.
In my book's chapter 8, I cover decommissioning in much more details, although I don't cover this particular example. I hope this answer helps; otherwise, please write again.


Migration Guide from Spray
General notes
Features which are not ported to the akka-http:
- respondWithStatus also known as overrideStatusCode has not been forward ported to Akka HTTP, as it has been seen mostly as an anti-pattern. More information here: https://github.com/akka/akka/issues/18626
- respondWithMediaType was considered an anti-pattern in spray and is not ported to Akka HTTP. Instead users should rely on content type negotiation as Akka HTTP implements it. More information here: https://github.com/akka/akka/issues/18625
- Registering Custom Media Types changed from Spray in order not to rely on global state.
Removed HttpService
Spray’s HttpService was removed. This means that scala code like this:
val service = system.actorOf(Props(new HttpServiceActor(routes)))
IO(Http)(system) ! Http.Bind(service, "<IP_ADDRESS>", port = 8080)
needs to be changed into:
Http().bindAndHandle(routes, "<IP_ADDRESS>", port = 8080)
Changes in Marshalling
Marshaller.of can be replaced with Marshaller.withFixedContentType.
Was:
Marshaller.of[JsonApiObject](`application/json`) { (value, contentType, ctx) =>
ctx.marshalTo(HttpEntity(contentType, value.toJson.toString))
}
Replace with:
Marshaller.withFixedContentType(`application/json`) { obj =>
HttpEntity(`application/json`, obj.toJson.compactPrint)
}
Akka HTTP marshallers support content negotiation, now it's not necessary to specify content type when creating one “super” marshaller from other marshallers:
Before:
ToResponseMarshaller.oneOf(
`application/vnd.api+json`,
`application/json`
)(
jsonApiMarshaller,
jsonMarshaller
}
After:
Marshaller.oneOf(
jsonApiMarshaller,
jsonMarshaller
)
Changes in Unmarshalling
Akka Http contains a set of predefined unmarshallers. This means that scala code like this:
Unmarshaller[Entity](`application/json`) {
case HttpEntity.NonEmpty(contentType, data) =>
data.asString.parseJson.convertTo[Entity]
}
needs to be changed into:
Unmarshaller
.stringUnmarshaller
.forContentTypes(`application/json`)
.map(_.parseJson.convertTo[Entity])
Changes in MediaTypes
MediaType.custom can be replaced with specific methods in MediaType object.
Was:
MediaType.custom("application/vnd.acme+json")
Replace with:
MediaType.applicationWithFixedCharset("application/vnd.acme+json", HttpCharsets.`UTF-8`)
Changes in Rejection Handling
RejectionHandler now uses a builder pattern – see the example:
Before:
def rootRejectionHandler = RejectionHandler {
case Nil =>
requestUri { uri =>
logger.error("Route: {} does not exist.", uri)
complete((NotFound, mapErrorToRootObject(notFoundError)))
}
case AuthenticationFailedRejection(cause, challengeHeaders) :: _ => {
logger.error(s"Request is rejected with cause: $cause")
complete((Unauthorized, mapErrorToRootObject(unauthenticatedError)))
}
}
After:
RejectionHandler
.newBuilder()
.handle {
case AuthenticationFailedRejection(cause, challengeHeaders) =>
logger.error(s"Request is rejected with cause: $cause")
complete((Unauthorized, mapErrorToRootObject(unauthenticatedError)))
.handleNotFound { ctx =>
logger.error("Route: {} does not exist.", ctx.request.uri.toString())
ctx.complete((NotFound, mapErrorToRootObject(notFoundError)))
}
.result()
.withFallback(RejectionHandler.default)
Changes in HTTP Client
The Spray-client pipeline was removed. Http’s singleRequest should be used instead of sendReceive:
//this will not longer work
val token = Authorization(OAuth2BearerToken(accessToken))
val pipeline: HttpRequest => Future[HttpResponse] = (addHeader(token) ~> sendReceive)
val patch: HttpRequest = Patch(uri, object))
pipeline(patch).map { response ⇒
…
}
needs to be changed into:
val request = HttpRequest(
method = PATCH,
uri = Uri(uri),
headers = List(Authorization(OAuth2BearerToken(accessToken))),
entity = HttpEntity(MediaTypes.`application/json`, object)
)
http.singleRequest(request).map {
case … => …
}
Changes in Headers
All HTTP headers have been moved to the akka.http.scaladsl.model.headers._ package.
Changes in form fields and file upload directives
With the streaming nature of http entity, it’s important to have a strict http entity before accessing multiple form fields or use file upload directives. One solution might be using next directive before working with form fields:
val toStrict: Directive0 = extractRequest flatMap { request =>
onComplete(request.entity.toStrict(5.seconds)) flatMap {
case Success(strict) =>
mapRequest( req => req.copy(entity = strict))
case _ => reject
}
}
And one can use it like this:
toStrict {
formFields("name".as[String]) { name =>
...
}
}
Contents


The server is currently nervous and confused, but it's not your fault. Please come back later, and let me know if the problem persists.
- Internal Server Error -


To get any source code for the SharedHere project or any other project from code.google.com you need a application called “Git Bash” for Windows operating systems. It’s basically a command line interface kind of thing that interacts with Google Code's Open Source hosting. To download Git Bash, go HERE and click the green “Download GitHub for Windows” button, this should start your download. When the download finishes locate the GitHub Setup.exe file on your machine and install it. Further information on configuring your Git Bash (GitHub) can be found on the same download page under “Setup Git” section.
Once you’re done with download and the installation part of Git Bash run the following command to get a local copy of the sharedhere project git clone https://code.google.com/p/sharedhere/


-
01
Don't start a company unless it's an obsession and something you love.
-
02
If you have an exit strategy. it's not an obsession.
-
03
Hire People who you think will love working there.
-
04
Sales cure all.
-
05
Know your core competencies and focus on being great at them.
-
06
Lunch is chance to get out of the office and talk.
-
07
No offices. These is nothing private in a startup.
-
08
As far as technology, go with what you know.
-
09
Keep the organization flat.
-
10
Never buy swag.
-
11
Never hire a PR firm.
-
12
Make the job fun for employees.


A web application for displaying images from NASA with the ability to search based on a given phrase, create image collections and share them with others.


Filters
PRICE
100
200
300
500
to
100
200
300
500
BRAND
COLOR
Sort By
Relevance
Price-Low to High
Price-High to Low


This app was developed by William Russell with help from Skyler Streeter
You can view the source code on Github


WITNESS LIST Criminal Jurisprudence Committee April 20, 1999-2:00P HB 628 For: Hubbarth, W. Rusty (Justice For All) McDougal, Michael A. (Montgomery County District Attorney) Sager, Janice (Self and Texans for Equal Justice) Registering, but not testifying: For: Bible, Lori (Self and People Against Violent Crime (PAVC)) Bledsoe, Caty L. (NAACP) Carr, Verna Lee (Self and People Against Violent Crime) Funderburgh, Carol (Self and People Against Violent Crime) LeRoy, Sandra S. (Self and Texans for Equal Justice) McDaniel, Gay (Texas Association Against Sexual Assault) McGuire, Randy (Texas Police Chief's Association / Lubbock Police Department) McVey, Beverly (For The Love of Christi) HB 831 For: Delgado, Joe (Self) Riester, Erin (Bexar County) Rust, Jim (Travis County Commissioner's Court) On: Oeller, Carol (Harris County Pretrial Services) Registering, but not testifying: For: Jahns, Marcus (Self and Bexar County) Kamm, Robert (Travis County Commissioners Court on Behalf of Travis County) Lee, Donald (Texas Conference of Urban Counties) Mendez, Mark (Tarrant County Commissioners Court) HB 853 For: Denholm, John (Self and Harris County Sheriff Tommy Thomas) Registering, but not testifying: For: Sallans, Jim (Harris County Deputies Organization) HB 998 For: Kline, Sandy (Houston Police Department) Registering, but not testifying: For: Mann, Tom (Texas Police Chief's Association / Lubbock Police Department) HB 1011 For: Diaz, Albert R. (Harris County Sheriff's Department) HB 1265 On: Pedde, Ron (TNRCC) HB 1428 For: Johnson, Mark (Self) Stacy, Kim (Self) Stacy, Ron (Self) HB 1753 For: Hubbarth, W. Rusty (Justice For All) LeRoy, Sandra S. (Self and Texans for Equal Justice) Registering, but not testifying: For: Carr, Verna Lee (Self and People Against Violent Crime) Crawen, Marsha (Self) McDougal, Michael A. (Montgomery County District Attorney's) McVey, Beverly (For The Love of Christi) Sager, Janice (Self and Texans for Equal Justice) HB 2111 For: Yenne, Jeri (Self) HB 2112 For: Yenne, Jeri (Self) HB 2125 For: Arnold, Dennis R. (Self) Till, Randall (Self) Registering, but not testifying: For: Bishop, Bruce (Self) HB 2130 For: Prindle, Judge Sandy (Self and Justice of the Peace and Constables Association of Texas) HB 2346 For: Craven, Marsha (Self and The Houston Chapter of Parents) Gurski, Nan (Self and Houston Chapter Parents of Murdered Children) Kahan, Andy (Self) Registering, but not testifying: For: Coll, Fransciso D. (Mothers Against Drunk Driving) LeRoy, Sandra S. (Self and Texans For Equal Justice) McVey, Beverly (For The Love of Christi) Posey, John (Mothers Against Drunk Driving) Sager, Janice (Self and Texans for Equal Justice) Sherman, Nora Jo (Self) Sherman Rafes, Sheri (Self) HB 2725 For: Momsen, Richarda Duffy (Self and City of El Paso) HB 2739 Against: Bojorquez, Alan (Texas Municipal League) HB 2978 For: Ward III, Bert P. (Self and Harris County Sheriff) HB 2984 For: Hampton, Keith S. (Texas Criminal Defense Lawyers Assn) Leavitt, Randy (TCDLA) Against: Posey, John (MADD) Weeks, David (Self) Williams, Christie (Dallas County Criminal District Attorney's Office) Registering, but not testifying: Against: Coll, Francisco D. (Mothers Against Drunk Driving) Corrigan, Jennifer (Texas Council on Family Violence) Granger, J.D. (Tarrant County District Attorney's Office) McDougal, Michael A. (Montgomery County District Attorney) HB 3055 For: Brown, T.J. (Self and City of Fort Worth Police Department) Cook, Clifford R. (City of Fort Worth Police Department) HB 3068 For: Hampton, Keith S. (Texas Criminal Defense Lawyers Assn.) Against: Curl, David (Self and Tarrant County District Attorney's Office) Curry, Alan (Harris County District Attorney's Office) HB 3070 For: Hampton, Keith S. (Texas Criminal Defense Lawyers Assn.) Against: Curl, David (Self and Tarrent County District Attorney's Office) Curry, Alan (Harris County District Attorney's Office) HB 3071 For: Hampton, Keith S. (Texas Criminal Defense Lawyers Assn) Against: Curl, David (Tarrant County District Attorney's Office) Curry, Alan (Harris County District Attorney's Office) HB 3228 Registering, but not testifying: For: Bridges, Thomas L. (Self) HB 3230 For: Bridges, Thomas L. (Self) HB 3255 For: Kahan, Andy (Self and Harris County Victim Advisory Council) Sherman, Dr. Nora Jo (Self and My daughter, my husband, myself) Sherman Rafes, Sheri (Self) Registering, but not testifying: For: Bledsoe, Gary (Self and NAACP) Craven, Marsha (Self) Gurski, Nan (Self) Martinez, Amanda (Self and NAACP - Texas) HB 3324 For: Brown, Pamela M. (Hidalgo County Bar Association Pro Bono Project) Kahan, Andy (Self and Harris County Victim Advisory Council) Rogoff, Regina (Legal Aid of Central Texas) Sherman, Dr. Nora Jo (Self and My daughter, my husband, myself) Summerlin, Errol A. (Self and Coastal Bend Legal Services) Registering, but not testifying: For: Chapman, Randall (Self and Texas Legal Services Center and the Legal Hotline for Older Texans) Comstock - Tolagan, Jim (Advocacy, Inc.) Corrigan, Jennifer (Texas Council on Family Violence) Del Castillo, Catherine (Self) Donovan, Suzanne (Texas Criminal Defense Lawyers Assoc.) Ozmun, Scott (Self and Volunteer Legal Services of Central Texas and Legal Aid of Central Texas) Secrest, Teresa P. (Self) Sherman Refes, Sheri (Self) On: Oliver, Julie (Texas Lawyers Care) HB 3332 For: Hampton, Keith S. (Texas Criminal Defense Lawyers Association) Against: McDougal, Michael A. (Montgomery County District Attorney) Registering, but not testifying: For: Wischkaemper, Bill (Self) HB 3540 Registering, but not testifying: On: Cain, Camille (Governor's Office Criminal Justice Division) HB 3765 For: Bible, Lori (Self and People Against Violent Crime) Hubbarth, W. Rusty (Justice for All) Sager, Janice (Self and Texans for Equal Justice) Torres, Vincent (Self) Registering, but not testifying: For: Carr, Verna Lee (Self and People Against Violent Crimes) Corrigan, Jennifer (Texas Council on Family Violence) Craven, Marsha (Self) Funderburgh, Carol (Self and People Against Violent Crime) Kahan, Andy (Self and Harris County Victim Advisory Council) Leroy, Sandra S. (Self and Texans for Equal Justice) McVery, Beverly (For The Love of Christi) Posey, John (MADD) Sherman, Nora Jo (Self) Sherman Rafes, Sheri (Self) HB 3775 For: Lee, Donald (Texas Conference of Urban Counties) Prindle, Judge Sandy (Self and Justice of the Peace Association) Registering, but not testifying: For: O'Shiele, R.L. "Bud" (Self) Richard, Jim (Self and County Judge Jim Adolphus) HB 3789 For: Barnhill, David W. (Self) Barnhill, Pamela (Self) Tremblay, Jeanne (Self) SB 46 For: Kendrick, Delvin H. (Houston Police Department) Registering, but not testifying: For: Mann, Tom (Texas Police Chief's Association / Lubbock Police Department)


Get a free balloon pet for every $4 PlushCoin purchase, or all 30 balloon pets available for a $100 Plush Coin purchase in the Goodies Market!
Lookin' good! Choose your default style when playing our games:


{% extends 'layouts/layout-manage-v10.html' %} {% block pageTitle %} Change your address {% endblock %} {% block content %}
You cannot change your address online. Contact your GP to change your address.
Your GP surgery is:
The Spa Surgery
Mowbray Square Medical Centre, Mowbray Square, Harrogate, HG1 5AR
01423 503218
spa.surgery@nhs.net


- above() - Method in class capstone.utility.Index
-
The Index above must be valid.
- above() - Method in class capstone.utility.Point
-
Returns the point above this one.
- AbstractPair<T extends java.lang.Comparable<T>,U extends java.lang.Comparable<U>> - Class in capstone.utility
-
A basic pair class like std::pair in C++ that encapsulates
two objects of same or different type.
- AbstractPair(T, U) - Constructor for class capstone.utility.AbstractPair
-
Constructs the pair from these two arguments.
- AbstractPair(AbstractPair<T, U>) - Constructor for class capstone.utility.AbstractPair
-
Copy-constructor.
- AbstractPair() - Constructor for class capstone.utility.AbstractPair
-
Default constructor, required in some cases.
- add(Component) - Method in class capstone.ui.ButtonSlot
-
Adds a component and also adds some spacing.
- add(Widget) - Method in class capstone.ui.ButtonSlot
-
Adds a widget and also adds some spacing.
- add(ButtonSlot.Kind) - Method in class capstone.ui.ButtonSlot
-
Adds one of the kinds of default buttons
defined by the ButtonSlot.Kind enum
- add(T) - Method in class capstone.ui.ComboBox
-
Adds an option to the ComboBox's ListWidget.
- add(T, Action) - Method in class capstone.ui.ListWidget
-
Adds a new entry to the list.
- add(Component) - Method in class capstone.ui.MenuWindow
-
Adds components on the left instead of entirely-centered
(as does the default Widget method) by default.
- add(Widget, Component.Alignment) - Method in class capstone.ui.Widget
-
Adds a Widget (its hook) to this Widget.
- add(Widget) - Method in class capstone.ui.Widget
-
Adds a Widget (its hook) to this Widget.
- add(Component, Component.Alignment) - Method in class capstone.ui.Widget
-
Adds a component to the widget.
- add(Component) - Method in class capstone.ui.Widget
-
Adds a component to the widget.
- add(Panel, Widget, Component.Alignment) - Method in class capstone.ui.Widget
-
Adds the Widget with the given alignment to a Panel.
- add(Panel, Widget) - Method in class capstone.ui.Widget
-
Adds the Widget with CENTER alignment to a Panel.
- add(Panel, Component, Component.Alignment) - Method in class capstone.ui.Widget
-
Adds a Component with the given alignment to a Panel.
- add(Panel, Component) - Method in class capstone.ui.Widget
-
Adds a Component with CENTER alignment to a Panel.
- add(Element) - Method in class capstone.utility.Page
-
Adds an element to the page.
- add(Element) - Method in class capstone.utility.PageGrid
-
Adds an element to the grid.
- add(Index, Element) - Method in class capstone.utility.PageGrid
-
Adds an element to the page at the index.
- addBorder(Border, String) - Method in class capstone.ui.Widget
-
Delegates the component call to the hook.
- addCancelButton() - Method in class capstone.ui.ListWidget
-
Adds a CANCEL-button to the bottom of the list.
- addComponentListener(ComponentListener) - Method in class capstone.ui.Widget
-
Delegates the component call to the hook.
- addSpace(int, int) - Method in class capstone.ui.Widget
-
Adss space to the panel.
- addSpace(Panel, int, int) - Method in class capstone.ui.Widget
-
Adds space to the panel with the specified width and height.
- amountOfFreeSpace() - Method in class capstone.utility.Page
-
- apply(Point) - Method in class capstone.utility.Pattern
-
Applies the current delta in the pattern to the given point,
without moving to the next Delta in the pattern.
- area() - Method in class capstone.utility.Region
-
- Arrows() - Static method in class capstone.utility.KeyMap
-
- at(int) - Method in class capstone.data.Highscore
-
Gets the entry at the given spot in the ranking.
- at(Point) - Method in class capstone.utility.Page
-
Returns the element at that point on the page, if any.
- at(int) - Method in class capstone.utility.Pattern
-
- at(Region.Vertical, Region.Horizontal) - Method in class capstone.utility.Region
-
Returns the point at the specified location.


Lover of interface design, typography, Hawaiian shirts, Radiohead, Belgian beer, IDM, photography, cinematography, thrift stores, typography, illustration, motion design, PF Flyers, creative coding... did I mention typography?
Design systems, prototyping, interaction + visual design, product strategy, user research.
5 years of product design experience, including early & late stage startups and a public company.


24a2 is a simple game engine that lets you to build a game in a few hours. It has a very limited set of features which makes it easy to learn, and encourages you to solve problems creatively.
24a2 games are written in JavaScript (or TypeScript) and are played in a web browser, so you can easily share what you’ve created.
ℹ 24a2 is new, and may have bugs. If you spot anything, please raise an issue. If you like 24a2, please support us by giving us a star on GitHub ⭐
Introduction
All 24a2 games feature a 24 by 24 grid of dots. You can set the color of each dot, and read the color of each dot back. 24a2 can also run a function you define when an arrow key is pressed, or when a dot is clicked on.
That’s about it! There are a few other features, which you can find out about in the tutorial and the API reference.
Using 24a2 means you don’t have to think about the visual style of your game, complicated physics or sound - you can just focus on actually building something.
Example games
Here are a few demo games you can play to get a feel for what 24a2 is like:
Example code
// We use this config object to specify the functions that
// 24a2 should call on each frame of the game
let config = {
create: create,
update: update,
onKeyPress: onKeyPress,
};
// Initialise a new game
let game = new Game(config);
// Create is called once, at startup. Use this function to
// initialise variables etc
function create(game: Game) {}
// Update is called on each iteration of the game
function update(game: Game) {
const frameCount = game.getFrameCount();
game.setText(`Frame count: ${frameCount}`);
if (frameCount === 100) {
// We can stop the game with game.end()
game.end();
}
}
// onKeyPress is called when one of the arrow keys is called
function onKeyPress(direction: Direction) {}
// Start the game
game.run();


After supporting acts Tribulation and All Them Witches failed to gain movement from the crowd, Motorpoint’s ticketholders grew restless, awaiting the arrival of anti-pope character and frontman ‘Cardinal Copia’ with his supporting mob of ‘Nameless Ghouls and Ghoulettes’; to say they delivered just doesn’t cut it.
12 photos of Ghost in concert
View gallery
The Swedish hard-rockers nailed the blueprint for opening a tour: singe eyebrows off the audience with flamethrowers and fireworks, destroy their vocal chords with innumerable shouting matches, get their aching bones moving with a hit-laden set list and, most surprisingly, keep them laughing with heaps of stage banter.
Beneath the macabre but exquisite stage and costume design (Copia seemingly changing with every passing song) we were granted these brief moments of comical respite with Ghouls performing pantomime-like guitar-solo battles, throwing raunchy gestures at one another or sometimes just getting in a scuffle; a refreshing break from metal acts that refuse to break their precious macho exterior.
It wasn’t quite enough to steal the limelight from Copia. A man wrapped in mystery (and a variety of papal outfits) but not afraid to show an intimate side; there were countless moments of sex-ridden dance moves and promises that: “This next song is going to make your ass wobble!” and I must say it did.
But do not be fooled. Comedic value aside Ghost came to rock and they did it well. The surging basslines of From the Pinnacle to the Pit, the uncompromised chugs of Mummy Dust and the Satan-summoning screams of Year Zero all of which elevated by tremendous mixing on behalf of the venue that raised these ecclesiastical rockers to the clarity of studio recording.
This was a magical night that transcended the realms of a gig; this was a show. Music that packed so much punch and comedy that packed so much personality despite the Ghouls rigid visages, it all culminated in a sorrowful farewell as these masters of the dark arts gave their love, took a bow, and left without another word; and we all stared into the darkness, hoping for their return.


Semester: CMT 7th
Deptt: CET
If you have not already downloaded the files for this class - please download them at github.com/shameemreza/intro-bootstrap
If you have not already downloaded the files for this class - please download them at github.com/shameemreza/intro-bootstrap
Twitter's Bootstrap is a frontend UI (user interface) framework that speeds up the development of new websites and web applications.
It is the #1 project on github with 65,000+ stars and over 23,000 forks
Bootstrap is an open source project on GitHub, meaning anyone can contribute to its progress.
A front-end web development framework is simply a collection of production-ready HTML/CSS/JavaScript components that we can use in our designs.
Bear in mind that Bootstrap is not just a CSS grid. It also comes with tons of features that you can use to build a fully-functional website.
Bootstrap is designed to be responsive, which means that your HTML elements will respond to changes in screen size.
So this desktop design:
Also looks great on a tablet:
And rad on a smartphone!
Bootstrap is also mobile-first, which means that certain mobile-friendly styles (like the ability to zoom in) are included in the core files.
Bootstrap stylishly fast-tracks your web development. It's an excellent tool to get your project up and running in no time!
You can download all the necessary Bootstrap files from getbootstrap.com or from the Bootstrap repo on GitHub.
(I included all of these in your Example Files folder, so no need to download from Bootstrap today!)Styles for common HTML elements, including the grid system, typography, tables, forms, and buttons.
Styles for common user interface elements, like tabs & pills, breadcrumbs, navigation bars, alerts, page headers, and more.
Similar to components, Bootstrap uses JavaScript plugins for tooltips, popovers, carousels, modal windows, and other elements
Check out some of the components by opening the example.html file in your browser window.
Bootstrap is based on a 12-column grid, and uses CSS classes to decide the width of each element.
Each element can take up between 1-12 columns worth of space...
.container
(fixed-width) or .container-fluid
(full-width) for proper alignment and padding..row
) to create horizontal groups of columns.
[CONTENT FOR ROW]
Open up columns.html in your browser window.
Resize your browser to see where the columns break to fit 100% of the width.
Open up columns-fluid.html in your browser window.
Resize your browser to see where the columns break to fit 100% of the width.
If you want to have two 50% columns on a mobile phone, you would use .col-xs-6
nested in a .row
, and the rows would be consistent on every device...
[COLUMN 1 CONTENT]
[COLUMN 2 CONTENT]
Two 50% columns on a mobile phone
If you want to have four 25% columns on a desktop, and would like them to break to 100% on a tablet, you would use .col-md-3
nested in a .row
.
[COLUMN 1 CONTENT]
[COLUMN 2 CONTENT]
[COLUMN 3 CONTENT]
[COLUMN 4 CONTENT]
Four 25% columns on desktop that break to 100% width on a tablet.
1. Open index.html in Sublime Text and make a simple, two-column layout.
1a. Extra credit: make a three-column layout.
2. Don't forget to put some content in your columns.
3. Resize your browser to see what happens.
Bootstrap has 4 different types of navigation
Default Navbars are responsive meta components that serve as navigation headers for your application or site. They begin collapsed (and are toggleable) in mobile views and become horizontal as the available viewport width increases.
Add .navbar-fixed-top
and include a .container
or .container-fluid
to center and pad navbar content.
Body Padding Required:
body { padding-top: 70px; }
Add .navbar-fixed-bottom
and include a .container
or .container-fluid
to center and pad navbar content.
Body Padding Required:
body { padding-bottom: 70px; }
Full-width navbar that scrolls away with the page.
Add a navbar of your choice to index.html.
A lightweight, flexible component that can optionally extend the entire viewport to showcase key content on your site.
Hello, world!
...
Add a jumbotron to index.html.
In the jumbotron, include a headline, a paragraph, and a button.
Images in Bootstrap 3 can be made responsive-friendly via the addition of the .img-responsive
class. This applies max-width: 100%;
and height: auto;
to the image so that it scales nicely to the parent element.
Bootstrap also includes the following classes to make styling your images easier:
.img-rounded
applies rounded edges.img-circle
takes a square image and applies the style border-radius: 50%;
.img-thumbnail
applies a border with rounded edges to the image
Add images to your columns
(hint: we included some puppy photos in the images folder of your example files!)
(hint x2: remember to make your img src=""
relative!)
Bootstrap comes with some amazing button classes for you to use out of the box. We all know that making those perfectly subtle rounded cornered buttons, is a pain.
The .btn
class can be applied to either a
<button>
or a <a>
Bootstrap has different classes for providing extra visual weight and identifig the primary action in a set of buttons.
Sometimes you need a really big button for that call to action.
For larger or smaller buttons add .btn-lg
, .btn-sm
, or .btn-xs
for additional sizes.
Add buttons to your columns.
Add a larger button to your jumbotron.
Extra Credit: play with the different classes for different colors.
Customize your CSS before you even download your Bootstrap files by visiting http://getbootstrap.com/customize/
Want to customize your Bootstrap page even more? Just create your own CSS and include it in the head
, below the Bootstrap CSS to add and override styles!
Before you start creating custom CSS for your design, always check the Bootstrap documentation to see if they've already created a class that does what you want.
Get Bootstrap: All documentation and download files for Bootstrap
Bootstrap Expo: Check out all the rad site designs that use Bootstrap
Bootstrap on GitHub: Check out the Bootstrap repo. Maybe even contribute to the project!
Media Query, Cross-Browser CSS & More
April 26th 8am - 9:30am
CET Lab-II or Room 207
All about WordPress Basics
April 29th 9:30am - 11am


%inherit file="base_template.htm" />
<%block name="header">
%block>
<%block name="content">
Fitness Groups
%if userWeights:
| Member Name |
Weight Lost |
%for f, q in zip(members, userWeights):
| ${f} |
${q} |
%endfor
%else:
Looks like nobody else has joined the group yet. Enter your friends emails to get the group started!
%endif
%block>
<%block name="footer">
%block>


---
sort_order: 22
tei_id: rdx_191dd.p.idp3785408
annotation_count: 0
images:
small-thumbnail: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfcv7/mini-thumbnail/
json: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfcv7/info/
full: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfcv7/fs/
page: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfcv7/single-page/
thumbnail: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfcv7/thumbnail/
title: Page 22
number: 22
---
{% raw %}23 TlIS LAND-CLAIM,{% endraw %}
{% raw %}Tne man's eyes liiirly blazed with malice, aud iustiuctively{% endraw %}
{% raw %}he clutched and half raised his gun, which hitherto had rested{% endraw %}
{% raw %}against the tree,{% endraw %}
{% raw %}" Take care, Newcome! don't shoot!" exclaimed AUen,{% endraw %}
{% raw %}hastily, " I apologize for my discourteous language, which{% endraw %}
{% raw %}you were so unwise as to provoke. Let this business slop{% endraw %}
{% raw %}here, before it comes to something we should all regret."{% endraw %}
{% raw %}" / shouldn't apologize—I'd have the man arrested," cried{% endraw %}
{% raw %}the Doctor, passionately.{% endraw %}
{% raw %}" Have me arrested if you dare!" hissed Newcome, through{% endraw %}
{% raw %}his clenched teeth. Saying which, he laid his gun on his arm,{% endraw %}
{% raw %}and stalked into the woods.{% endraw %}
{% raw %}The young men stood conversing for a few minutes,{% endraw %}
{% raw %}undecided what course to pursue with so desperate au enemy,{% endraw %}
{% raw %}when sharp and loud came two distinct reports, almost in the{% endraw %}
{% raw %}same moment, and the Doctor fell to the ground, exclaiming,{% endraw %}
{% raw %}as he fell:{% endraw %}
{% raw %}" Allen ! my God, I'm shot!"{% endraw %}
{% raw %}For a short interval of time the young man was so distracted{% endraw %}
{% raw %}by the loss of his friend as not to know what course it was{% endraw %}
{% raw %}best to pursue. But seeing at last that the Doctor had really{% endraw %}
{% raw %}ceased to live, the necessity of doing something to secure{% endraw %}
{% raw %}his murderer suggested itself; and despairing of success{% endraw %}
{% raw %}single-handed in such an undertaking, he set out rapidly for{% endraw %}
{% raw %}the trading-post, as the nearest point at which help could be{% endraw %}
{% raw %}obtained,{% endraw %}
{% raw %}Soou the whole settlement was engaged in the pursuit, if{% endraw %}
{% raw %}pursuit it could be called, for the ciUprit had made no effort{% endraw %}
{% raw %}to escape, but w.as found stUl in the woods, near the spot{% endraw %}
{% raw %}where the murder was committed. The man eyed those who{% endraw %}
{% raw %}came to arrest him at first with a defiant scorn; but wheu{% endraw %}
{% raw %}told that he was accused of the wUlful murder of Dr, Henry{% endraw %}
{% raw %}Edwards, he gave a terrified start, and drooped his head{% endraw %}
{% raw %}forward as if smitten with a sudden mortal pang.{% endraw %}
{% raw %}The dead body of Ed>vards was conveyed to Fairview, the{% endraw %}
{% raw %}county town, and laid out in the room where the examination{% endraw %}
{% raw %}•was to be held, before one of the district judges.{% endraw %}


×
keyboard_arrow_left
keyboard_arrow_left
Filters
{{data.currentarea.area}}
{{#data.listcover}}
{{.}}
{{/data.listcover}}
Time Period
keyboard_arrow_rightt
email
Feedback
Feedback
×
Message:
Enter a message.
You can put your email address if you want us to reach you back. Email address:
Enter a valid email or no email.
We'll never share your email with anyone else.
{{data.data}}
Do you like cookies?
🍪 We use cookies to ensure you get the best experience on our website by complying to the European cookie law.
Learn more
I agree