Create a new Time
optional in '00:00' format, otherwise use current time
hour in 24 hour format
minute
Minutes in day
Minutes in hour
Milliseconds in day
Milliseconds in hour
Milliseconds in minute
Parse time string
in '00:00' format
Get string representation of Time
time format
As string
Get time as string suitable for display, including AM/PM if 12hr
in '00:00' format
time format
display string
Get current time suitable for display w/o AM/PM if 12hr
= time format
display string
Convert string to current time
in '00:00' format
time in milliSeconds from epoch
Calculate time delta from now on a 24hr basis
in '00:00' format
time delta in minutes
Determine if user wants 24 hr time
time format
true for 24 hour time
Determine if current time is between start and stop, inclusive
in '00:00' format
in '00:00' format
true if in the given range
Generated using TypeDoc
Time Class


Life is a long distance race - Brain Duncan, PhD Colleague
John Bio
Applied Computation
Courses John teaches.
John's talks.


An ultrasonic rangefinder using high frequency sound to determine distance to an object. The rangefinders generally operate at distances up to 7-9 feet. There are two styles of sensors in common use, some that use two transducers (a microphone and a speaker) and those that use a single transducer. The commonly used single transducer sensor is supplied by Maxbotics and uses an analog connection to the robot.
The sensor implemented by this class is the double transducer style with two digital I/O connections to the robot, one (output) to cause the sensor to send a ping and the other (input) to determine the distance to the target.
If your application uses the analog sensor, then don't use this class. Instead just use an analog input and refer to the sensor documentation for the mapping between voltage and distance.


Sensational Stockdale Last-Gasp Stop Helps Ulster To Crucial Away Win
by Maurice BrosnanA game-winning play from a big-game player saved Ulster as they left the Rec with a 17-16 victory over Bath.
It was Jacob Stockdale who was Dan McFarland's star as the Ireland winger made an outstanding last-second intervention to stop a certain Bath try and ensure the one-point victory.
With the clock in the red, Ulster led by a point and thought they had won the game only to be penalised for a crooked lineout. From the resulting scrum, Bath worked their way deep into their Ulster territory. Girvan Dempsey would have been delighted with the attacking play that finally seemed to click.
However, Stockdale marshaled his defence up before working back to make a crucial read and intercept Zach Mercer's pass.
"I think it shows the collective and how hard we work for each other to see Jacob get back and stop them in the corner," said John Cooney after the game. A superb start to their European campaign for Ulster.


Program Description: {{item.program.details}}
Program Manager Assessment: {{item.pm_observation}}
Overall Summary: {{item.summary_overall}}
| Government PM: | {{item.program.government_pm}} |
| COR: | {{item.program.government_cor}} |
| COTR: | {{item.program.government_cotr}} |
| Contractor: | {{item.program.contractor}} |
| Contract Type: | {{item.program.contract_type}} |
| Period of Performance: | {{item.program.period_of_performance}} |
|
|
|
|
Accomplishments:
{{item.summary_schedule}}
|
|
|
|


|
VirtualSCADA
1.0
VirtualSCADA Senior Design Project
|
Public Member Functions | |
| __construct ($a, $b, $junkCallback=null, $options) | |
| setOptions ($options) | |
| setSequences ($a, $b) | |
| setSeq1 ($a) | |
| setSeq2 ($b) | |
| findLongestMatch ($alo, $ahi, $blo, $bhi) | |
| linesAreDifferent ($aIndex, $bIndex) | |
| getMatchingBlocks () | |
| getOpCodes () | |
| getGroupedOpcodes ($context=3) | |
| Ratio () | |
Definition at line 43 of file SequenceMatcher.php.
| __construct | ( | $a, | |
| $b, | |||
$junkCallback = null , |
|||
| $options | |||
| ) |
The constructor. With the sequences being passed, they'll be set for the sequence matcher and it will perform a basic cleanup & calculate junk elements.
| string | array | $a | A string or array containing the lines to compare against. |
| string | array | $b | A string or array containing the lines to compare. |
| string | array | $junkCallback | Either an array or string that references a callback function (if there is one) to determine 'junk' characters. |
| array | $options |
Definition at line 88 of file SequenceMatcher.php.
| findLongestMatch | ( | $alo, | |
| $ahi, | |||
| $blo, | |||
| $bhi | |||
| ) |
Find the longest matching block in the two sequences, as defined by the lower and upper constraints for each sequence. (for the first sequence, $alo - $ahi and for the second sequence, $blo - $bhi)
Essentially, of all of the maximal matching blocks, return the one that startest earliest in $a, and all of those maximal matching blocks that start earliest in $a, return the one that starts earliest in $b.
If the junk callback is defined, do the above but with the restriction that the junk element appears in the block. Extend it as far as possible by matching only junk elements in both $a and $b.
| int | $alo | The lower constraint for the first sequence. |
| int | $ahi | The upper constraint for the first sequence. |
| int | $blo | The lower constraint for the second sequence. |
| int | $bhi | The upper constraint for the second sequence. |
Definition at line 246 of file SequenceMatcher.php.
| getGroupedOpcodes | ( | $context = 3 | ) |
Return a series of nested arrays containing different groups of generated opcodes for the differences between the strings with up to $context lines of surrounding content.
Essentially what happens here is any big equal blocks of strings are stripped out, the smaller subsets of changes are then arranged in to their groups. This means that the sequence matcher and diffs do not need to include the full content of the different files but can still provide context as to where the changes are.
| int | $context | The number of lines of context to provide around the groups. |
Definition at line 527 of file SequenceMatcher.php.
| getMatchingBlocks | ( | ) |
Return a nested set of arrays for all of the matching sub-sequences in the strings $a and $b.
Each block contains the lower constraint of the block in $a, the lower constraint of the block in $b and finally the number of lines that the block continues for.
Definition at line 352 of file SequenceMatcher.php.
| getOpCodes | ( | ) |
Return a list of all of the opcodes for the differences between the two strings.
The nested array returned contains an array describing the opcode which includes: 0 - The type of tag (as described below) for the opcode. 1 - The beginning line in the first sequence. 2 - The end line in the first sequence. 3 - The beginning line in the second sequence. 4 - The end line in the second sequence.
The different types of tags include: replace - The string from $i1 to $i2 in $a should be replaced by the string in $b from $j1 to $j2. delete - The string in $a from $i1 to $j2 should be deleted. insert - The string in $b from $j1 to $j2 should be inserted at $i1 in $a. equal - The two strings with the specified ranges are equal.
Definition at line 463 of file SequenceMatcher.php.
| linesAreDifferent | ( | $aIndex, | |
| $bIndex | |||
| ) |
Check if the two lines at the given indexes are different or not.
| int | $aIndex | Line number to check against in a. |
| int | $bIndex | Line number to check against in b. |
Definition at line 319 of file SequenceMatcher.php.
| Ratio | ( | ) |
Return a measure of the similarity between the two sequences. This will be a float value between 0 and 1.
Out of all of the ratio calculation functions, this is the most expensive to call if getMatchingBlocks or getOpCodes is yet to be called. The other calculation methods (quickRatio and realquickRatio) can be used to perform quicker calculations but may be less accurate.
The ratio is calculated as (2 * number of matches) / total number of elements in both sequences.
Definition at line 612 of file SequenceMatcher.php.
| setOptions | ( | $options | ) |
| setSeq1 | ( | $a | ) |
Set the first sequence ($a) and reset any internal caches to indicate that when calling the calculation methods, we need to recalculate them.
| string | array | $a | The sequence to set as the first sequence. |
Definition at line 125 of file SequenceMatcher.php.
| setSeq2 | ( | $b | ) |
Set the second sequence ($b) and reset any internal caches to indicate that when calling the calculation methods, we need to recalculate them.
| string | array | $b | The sequence to set as the second sequence. |
Definition at line 145 of file SequenceMatcher.php.
| setSequences | ( | $a, | |
| $b | |||
| ) |
Set the first and second sequences to use with the sequence matcher.
| string | array | $a | A string or array containing the lines to compare against. |
| string | array | $b | A string or array containing the lines to compare. |
Definition at line 113 of file SequenceMatcher.php.


The Goal of Project Completion is to provide our clients with affordable Handyman Services where you can trust the quality of work from an experienced source. The company was founded by current CEO, Kevin Holmes.
Kevin has been working as a licensed contractor in New York for over 15 years. He has been a certified electrician for the NYC Department of Environmental Protection for over 25 years and has been a real estate investor for more than 25 years as well.
Kevin is an active member of the community. He is always encouraging positive growth and development for those around him. He mentors local youth and delivers motivational speeches to young people about reaching their goals and mapping out their future.
Entrust Kevin with your most important investment. You can contact him for an estimate to solve your household needs or you can sign up for an annual maintenance plan to keep your home running smoothly. You can count on Kevin to treat your home as if it is his own.


Welcome to GradeStat!
GradeStat is an interactive grading application that fuses seamlessly with your bCourses account to bring you additional functionality. With GradeStat you can assign readers to grade assignments, track their progress and compare their results.
Get started by following the "Courses" link on the sidebar. The page that it brings you to will allow you to manage your courses and start grading. Good luck! If you have any concerns, feel free to contact us at help@meteor.GradeStat.com.


{% extends "layout.html" %} {% block content %}
A personal web application that simplify the management of your vinyls ♥


A web based mathematics and engineering platform
Login / Sign upIn CADWOLF, users create web pages that have all the functionality of a text editor, an analysis tool, and a programming language. This means that CADWOLF can replace Word, Excel, Matlab, and Python, with nothing to download or install.
Perform simultaneous documentation and analysis
Act as folders in both appearance and function
Parses text or files into variables to be brought into a document
Part numbreing to automatic structural redesign
Documents are simply web pages that are formatted to look similar to a standard Word file. Users interact with a GUI to add blocks to the document. These blocks can be text, equations, charts, images, videos, or a number of other things. The equations function just like a program and solve top to bottom in real time as they are changed. The combination of charts, equations, text, and other programming tools provides for what we call "simultaneous analysis and documentation.
Workspaces are simply web pages that are formatted to look and behave like a standard folder. Each user has their own workspace and this is where the user adds new files, subfolders, datasets, and images.
The analysis of test data or any kind of raw data is always a concern for engineers and scientists. The datasets module is a web page that lets the user paste in text and it then parses that text into a variable that can be imported into as many documents as desired.
A part tree is an commonly used engineering tool. Each component is given a unique number that identifies its place in the structure. The part tree module lets the user create a part numbering scheme and then add systems, subsystems, and parts. CADWOLF then assigns a document to each component where the design takes place.
Since CADWOLF documents can take inputs from other files, each component can be designed based upon requirements or neighboring designs. Therefore, when a design or requirement changes, the parts update themselves allowing for automatic redesign of entire structures.
Anyone that needs to solve and document a problem will find CADWOLF's features more useful than the conglomeration currenlty used. Students can store homework problems and access them for decades. Scientists can store and analyze data in the same platform where the documentation takes place.
Equations in documents track units like meters, seconds, etc, and solve accordingly
Line, spline, bar, column, heat maps, and several other charts available.
3D point clouds, surface maps, and line are also available.
Wide range of built in functions like trig, statistical tools, an FFT, and and ODE solver
when an equation solves, it shows in the proper mathematical format with integration symbols, etc.
Documents can be set so that user can read, use, or edit them.
There is nothing to download, install, or update. Everything is 100% web based
Save a document at work, then open it from home and pick up where you left off
Depending on your permissions, anyone with a web browser can read your documents
CADWOLF is designed to mimic the tools you already use. A CADWOLF document looks and feels like a Word document. Equations are entered into HTML inputs. Built in functions are invoked by using parenthesis. Charts are created and edited through a GUI.


Text And Number Inputs
This field is required.
This field is required.
This field must be a valid email address.
This field is required.
This field is required.
The fields not match.
This field is required.
This field is required.
Date and time Input
This field is required.
This field is invalid.
This field is required.
Image Input Card
This field is required.
This field must be a valid image.
Search Input Card


We are hearing these names a lot, and it’s only going to continue (p.s. VOTE). But don’t these names seem a bit… ordinary to you?
library(babynames)
library(dplyr)
library(ggplot2)
How popular are these Democratic candidate names throughout history? The babynames dataset can help shed some light on this question. Let’s look at the proportion of babies with these particular names over time.
candidates = c("Elizabeth","Amy","Joseph","Peter", "Bernard","Michael", "Thomas")
candidate_status = c(T, F, T, F, T, T, F)
yearTotals = babynames %>% group_by(year) %>% summarise(yearTotal = sum(n))
candidateData = babynames %>% filter(name %in% candidates) %>% group_by(year, name) %>% summarise(count = sum(n))
candidateData = merge(candidateData, yearTotals, by.x="year", by.y="year")
candidateData$prop = candidateData$count/candidateData$yearTotal
ggplot(candidateData, aes(year, prop, col=name, group=name))+geom_point()+geom_line()+theme_minimal()+ylab("proportion of babies in year")
Fad names (with peaks): Amy, Thomas, Michael
More stable names: Bernard, Elizabeth, Joseph, Peter
For the sticklers, we can just look at the ones moving forward.
ggplot(subset(candidateData, name %in% candidates[candidate_status]), aes(year, prop, col=name, group=name))+geom_point()+geom_line()+theme_minimal()+ylab("proportion of babies in year")
But this is just proportion of babies over time. What about the ranking of names? (Insert ranked choice voting joke here.)
test = babynames %>% group_by(year, name) %>% summarise(count = sum(n))
allYears = unique(test$year)
# this is gross, but bear with me
helper <- function(x){
dat = subset(test, year == x)
dat = dat %>% arrange(desc(count))
dat$ranking = 1:nrow(dat)
return(dat)
}
byYearRanking = lapply(allYears, helper)
allRanked = do.call("rbind",byYearRanking)
allRanked %>% filter(name %in% candidates) %>% ggplot(.,aes(year, ranking, col=name, group =name))+geom_point()+geom_line()+theme_minimal()
Many of these names are ranked pretty high fairly consistently.
allRanked %>% filter(name %in% candidates[candidate_status]) %>% ggplot(.,aes(year, ranking, col=name, group =name))+geom_point()+geom_line()+theme_minimal()
Alas, poor Bernard, let’s zoom in a bit.
allRanked %>% filter(name %in% candidates) %>% ggplot(.,aes(year, ranking, col=name, group =name))+geom_point()+geom_line()+theme_minimal()+ylim(c(0,750))
It appears that these names often make the top 200 of baby names each year.
What are the average and best ranks across time?
allRanked %>% filter(name %in% candidates) %>% group_by(name) %>% summarise(avgRank = mean(ranking), bestRank = min(ranking)) %>% arrange(avgRank)
## # A tibble: 7 x 3
## name avgRank bestRank
## <chr> <dbl> <int>
## 1 Joseph 15.9 7
## 2 Thomas 30.4 10
## 3 Elizabeth 30.9 8
## 4 Michael 60.3 1
## 5 Peter 152. 67
## 6 Amy 288. 9
## 7 Bernard 594. 107
Joseph has the best average rank, but only Michael reached the top spot at one point in history.
How consistently were these names in the top 200, 100, or 50 spot over time?
allRanked %>% filter(ranking<=200) %>% group_by(name) %>% summarise(count = n()) %>% arrange(desc(count)) %>% filter(name %in% candidates)
## # A tibble: 7 x 2
## name count
## <chr> <int>
## 1 Elizabeth 138
## 2 Joseph 138
## 3 Michael 138
## 4 Thomas 138
## 5 Peter 112
## 6 Amy 48
## 7 Bernard 32
allRanked %>% filter(ranking<=100) %>% group_by(name) %>% summarise(count = n()) %>% arrange(desc(count)) %>% filter(name %in% candidates)
## # A tibble: 6 x 2
## name count
## <chr> <int>
## 1 Elizabeth 138
## 2 Joseph 138
## 3 Thomas 138
## 4 Michael 89
## 5 Peter 43
## 6 Amy 28
allRanked %>% filter(ranking<=50) %>% group_by(name) %>% summarise(count = n()) %>% arrange(desc(count)) %>% filter(name %in% candidates)
## # A tibble: 5 x 2
## name count
## <chr> <int>
## 1 Joseph 138
## 2 Elizabeth 137
## 3 Thomas 120
## 4 Michael 80
## 5 Amy 19
Out of 138 years of data, Joseph has always been in the top 50 of baby names. Elizabeth misses perfection by one year. Peter doesn’t crack the top 50 ceiling, but makes it into the top 100. Bernard manages to be in the top 200 for 32 years. It seems like these candidates are taking “name recognition” benefits a bit too far.
What does this mean for the presidential hopefuls? We love a good George, John, or James for president, but we’ve also had a Millard and Rutherford, so it’s anyone’s guess.
presidents <- c("George", "John", "Thomas", "James", "Andrew", "Martin", "William", "Zachary", "Millard", "Franklin", "Abraham", "Ulysses", "Rutherford", "Chester", "Grover", "Benjamin", "Theodore", "Woodrow","Warren","Calvin","Herbert", "Harry", "Dwight","Lyndon", "Richard","Gerald", "Ronald", "Barack", "Donald")
presidentData = babynames %>% filter(name %in% presidents) %>% group_by(year, name) %>% summarise(count = sum(n))
presidentData = merge(presidentData, yearTotals, by.x="year", by.y="year")
presidentData$prop = presidentData$count/presidentData$yearTotal
presidentPop = presidentData %>% group_by(name) %>% summarise(averageProp = mean(prop)) %>% arrange(desc(averageProp))
presidentPop$id = 1:nrow(presidentPop)
presidentData = merge(presidentData, presidentPop, by.x="name", by.y="name")
ggplot(subset(presidentData, id %in% 1:5), aes(year, prop, col=name, group=name))+geom_point()+geom_line()+theme_minimal()+ylab("proportion of babies in year")
ggplot(subset(presidentData, id %in% 6:10), aes(year, prop, col=name, group=name))+geom_point()+geom_line()+theme_minimal()+ylab("proportion of babies in year")
ggplot(subset(presidentData, id %in% 11:15), aes(year, prop, col=name, group=name))+geom_point()+geom_line()+theme_minimal()+ylab("proportion of babies in year")
ggplot(subset(presidentData, id %in% 16:20), aes(year, prop, col=name, group=name))+geom_point()+geom_line()+theme_minimal()+ylab("proportion of babies in year")
ggplot(subset(presidentData, id %in% 21:25), aes(year, prop, col=name, group=name))+geom_point()+geom_line()+theme_minimal()+ylab("proportion of babies in year")
ggplot(subset(presidentData, id %in% 26:30), aes(year, prop, col=name, group=name))+geom_point()+geom_line()+theme_minimal()+ylab("proportion of babies in year")


TASK 1
Invite your friends to join our system through your specific links.
Your invitation link【
www.xxxxxx.xxxxx.xxxxx
】
2018/2/25~2018/3/25
1 ITC/Person
Number of invitations :
0
COPY LINK
TASK 2
Sharing the specified message about ITC on your FACEBOOK.
2018/2/25~2018/3/25
1 ITC
SHARE
TASK 3
Sharing the specified message about ITC on your Twitter.
2018/2/25~2018/3/25
1 ITC
SHARE


Toggle navigation
Git exercises
Home
Exercises
{{ availableExercises.length }}
My progress
{{ currentCommitter.passedExercises.length || 0 }}
FAQ
Cheatsheet
Github
Show my progress


\verb char literal_text char
or
\verb*char literal_text char
Typesets literal_text exactly as typed, including special characters and spaces, using a typewriter (\tt) font. There may be no space between \verb or \verb* and char (space is shown here only for clarity). The *-form differs only in that spaces are printed as "visual" spaces, i.e., a short, squat "u".
Any char except a space (or a * for the \verb form) may be chosen as the delimiter. Thus, the input
\verb1This!is?the##1 verbatim ...
would produce
This!is?the## verbatim ...
The \verb command may not be used in the argument of another command. For example, it cannot be used in the text of a sectioning command.
See also Environments,
verbatim
Back to the LaTeX Table of Contents


{% extends "base.html" %} {% block page_title %}Books Catalogue - List{% endblock %} {% block page_heading_title %}
Sorry, there appears to be no books in the catalogue.


Jose Mourinho's Man United will be revealed over next week of games
12 Oct 2016
Category: Sport
Now we shall see what Jose Mourinho has concluded from his first two months of competitive football at Manchester United. Over the next six days, he will face Liverpool in the traditional no-quarter-asked-because-none-is-ever-given-anyway North-West knife fight, then it's Fenerbahce in a Europa League that he has promised to take seriously. Then he returns to his former realm in West London, Stamford Bridge, site of three Premier League triumphs but also of his greatest failure and most ignominious sacking.
Mourinho learned quickly after the defeat at Watford last month that any poor result at this club is given immediate forensic attention. He may have railed against the "Einsteins" in the media who pored over his every decision, but their enthusiasm for critical analysis is unlikely to diminish if the next week goes badly. A veteran of the crucibles at Milan and Madrid, Mourinho will know that by the end of this run of games, he'll be either be heralded as a genius, destined to avenge himself for last season's catastrophe, or castigated as a busted flush, a man like so many others whose time at the top ended without him even realising. Such is modern football.
NSo how will it unfold? Well, don't look to this particular "Einstein" for that. The Premier League, so predictable for so long, is now the most capricious major league in Europe, and predictions are a mug's game. But if we can be reasonably sure of anything here, it's that the Europa League will take a back seat this week. Mourinho may have pledged allegiance to UEFA's economy class funfair but he must have had his fingers crossed at the time.
On his return to Chelsea, he claimed that it was "not good for a big club to go there [the Europa League] and win it," saying that it was, "better for the evolution of the players and the team to be in the Champions League." Admittedly, this statement may have been at least partly motivated by his desire to belittle the achievements of his predecessor and nemesis Rafa Benitez, but that doesn't necessarily mean it's a fib. Expect the fringe players against Fenerbahce but for Liverpool and Chelsea, expect the front line troops.
Slowly this season, we've seen Mourinho's United take form. The defence has remained relatively assured from day one. Chris Smalling has recovered from injury and slotted in alongside the exuberant Eric Bailly, while Daley Blind has slipped out to the left to cover the injured, and publicly criticised, Luke Shaw. United haven't kept a clean sheet in the league since August but looking behind the numbers, it's hard to legislate for Demarai Gray's stunning effort and perhaps harder still for David de Gea's clanger against Stoke. United are good enough at the back.
There are issues that need to be addressed in midfield, especially when faced with the prospect of Jurgen Klopp's hard pressing, high-octane Liverpool. Ander Herrera offers much needed dynamism in the middle but his partner Paul Pogba needs to be more disciplined alongside him. Confidence restored after a ferocious winner for France in midweek, he has to remember to do that boring stuff as well as the fancy stuff otherwise Liverpool will tear through the central areas.
Mourinho's biggest call has been to drop Wayne Rooney for Juan Mata and it was long overdue. Mourinho suggested that the media has been eroding Rooney's confidence but that's an odd development for a player who has been in the spotlight since 2004 and who has been the subject of lurid headlines on the front pages far more damaging than anything recently seen on the back pages. Poor Mata has spent most of his career at Old Trafford filling in elsewhere and now he's making the most of a run in his favourite position. Perhaps it is simply a question of form or confidence but right now, Mata looks far more dangerous than his English counterpart..
Zlatan Ibrahimovic is a permanent fixture at centre-forward. He may lack pace but flanked by Jesse Lingard and Marcus Rashford, that doesn't have to be a problem. There are some who feel the big Swede should have offered more to the cause so far but his height, strength, technique and composure make him the first name on Mourinho's team sheet. The absence of Henrikh Mkhitaryan continues to raise eyebrows but the Armenian playmaker is expected to be fit for Monday, though it seems unlikely that he'll be offered a chance of what would be only his second league start of the season.
Ultimately, the success or failure of this United team won't be determined simply by the individuals but by the way they operate together. This side does not want for quality. Balance has been their issue. Chelsea, the final opponents of this week, are in the same position, striving to find their groove. But Liverpool are already there. They can't keep a clean sheet but with 13 goals in their last four league games, they haven't always needed one. Their front three are interchangeable, their central three are ever-present (though Adam Lallana's injury may end that run). After just over a year of Klopp, they are taking shape.
That's the challenge for Mourinho now: taking all this talent and moulding into one of the sort of relentless winning machines he's been renowned for building. This week will be the biggest test that he's faced since he took over at Old Trafford. And given that he has a cup tie with Manchester City coming up soon, the week after isn't looking too pretty, either.


Given a string s
, return the length of the longest substring that contains at most two
distinct characters.
Example 1:
Input: s = "eceba" Output: 3 Explanation: The substring is "ece" which its length is 3.
Example 2:
Input: s = "ccaabbb" Output: 5 Explanation: The substring is "aabbb" which its length is 5.
Constraints:
1 <= s.length <= 104
s
consists of English letters.


These are all the requests submitted by employees. Click view on a request to approve, deny, and edit. The statistics page is also available.


If you don’t want to deal with building it yourself, go to github CI (click on the latest succesful run to get a list of binaries). These are 64-bit for all platforms.
Now get https://github.com/aardappel/lobster (download zip). This has all the data files and examples. Place the binary you obtained in bin
.
You can also get both from https://github.com/aardappel/lobster/releases (lobster_<date>_<platform>.zip
and Source code (zip)
), but these are usually way behind using the most recent builds above, so not recommended.
Pre-Requirements: Git, CMake, a C++17 compiler, Mesa dev files (apt-get install mesa-common-dev
).
git clone https://github.com/aardappel/lobster.git
cd lobster/dev
cmake -DCMAKE_BUILD_TYPE=Release
make -j8
cd ..
bin/lobster samples/pythtree.lobster
Pre-Requirements: VS2019 Community edition or better, C++ desktop tools installed.
Get https://github.com/aardappel/lobster using your favorite git tool (best), or just download a .zip
from there otherwise.
Open dev\lobster\lobster.sln
, ensure Release
is selected in the top bar, Build -> Build Solution
, then close if no errors.
Pre-Requirements: Latest XCode.
Get https://github.com/aardappel/lobster using your favorite git tool (best), or just download a .zip
otherwise.
Open dev/xcode/lobster/lobster.xcodeproj
, ensure lobster_release > My Mac
is selected as scheme in the top bar, Product -> Build
, then close if no errors.
You now have a lobster
executable in your bin
folder. You can run this with any Lobster file as argument to run it, for example bin/lobster.exe samples/pythtree.lobster
should work.
For more advanced usage, including how to run it from an editor, check the rest of the docs


Bailee Madison Announces End of 'Just Between Us' Podcast With Sister Kaitlin Vilasuso
JJJ is incredibly sad over the fact that Bailee Madison and sister Kaitlin Vilasuso are ending their podcast, Just Between Us.
In a note on her Instagram, the 20-year-old actress revealed that the duo just released the final episode.
“Yesterday we released our final @justbtweenus episode,” she started. “@kaitlinvilasuso & I had no idea what to expect when we decided to go on this year journey with @podcastone (Thank you guys!!), but boy can we both agree now that it couldn’t have been more special or memorable.”
Bailee continues, “Thank you so much for welcoming our little show into your lives, sharing moments and stories with us, and for listening to us every week ❤ it has meant the world to Katie and I and let us just say… we are so excited for what’s ahead. @kaitlinvilasuso – you’re the best podcast host and partner & this is just the beginning.”
“To all of our friends- old and new: thank you so much for coming on our show, sitting in our living room and speaking honestly and openly. We hope you’ll join us for whatever our next sister adventure is!!!!!!! We love you guys!!”
You can listen to all of the podcast episodes HERE!


CSBot is the best chatbot development Company in Nigeria, we are revolutionizing the Nigerian Customer Service landscape, and we are located in Lagos! Are you looking to integrate automated chatbots into your Brand on Facebook? A lot of Companies in Nigeria are currently doing same. And with Messaging Apps surpassing Social Media platforms as the destination of choice for most users, more and more business is being conducted on FB Messenger, WhatsApp, WeChat, Viber, BBM, and Telegram
So why use a Chatbot?
Chatbots are automated and so do not mind responding to the same questions over and over again from different customers.
Because they are robots, Chatbots cannot get angry at a customer for any reason. They simply do not bring their drama to work.
Any time of the day you message a Chatbot, you will always get answers. This helps in improving sales and customer satisfaction.
Humans can only handle a few customers at the same time, however, a chatbot can handle hundreds of conversations at the same exact time.
By employing a Chatbot to answer your most asked questions, you would ultimately save the cost of employing first-level support staff
At the end of the session, the customer is usually able to get the information he/she wants. As far as it is in the system, the Chatbot knows it.
The chatbot by default has your basic Facebook information, so can personalize messages by calling your name or identifying your gender.
The most effective chatbots are built with guides that are simple to follow for customers to get the answers they are looking for
Since messenger applications work on Smartphones, Tablets, and Desktops, your chatbot can handle customers accessing from different devices.
Find Below our Chatbot Development and Maintenance Pricing
A Basic Chatbot that explains your product, and collects customer contact details, for a Sales person to follow up on. Ensuring immediate customer response and basic information gathering.
Sample: https://m.me/smstk
A Standard Chatbot provides additional conversation branches to answer most customer Frequently Asked Questions, and also collects details for a Sales person to close the sale or conclude the support
Sample: OBBTI
Beyond Intelligently serving information and collecting customer contact details, an Advanced Chatbot also integrates AI powered NLP and other third party tools like Online Payment, database information, and API Integrations
Sample:
1st Floor Front,
3 Thorborn Avenue, Sabo, Yaba
Lagos, Nigeria
P: (234)<PHONE_NUMBER>, (234)<PHONE_NUMBER>
H: 24 Hours Service


2 references to _syncobject
System.Management.Automation (2)
engine\remoting\client\Job2.cs (2)
94
lock (
_syncobject
)
111
lock (
_syncobject
)


Ocean [ag12], ocean, in Crystal Sea
Last updated Turn #149
Ocean [ag12], ocean, in Crystal Sea
------------------------------------------------------------------------
13: Sirocco Traveller [ja8y], ship, 10 hulls, 1 rowing port, 30 sails,
13: 8% damaged, arrived from Ocean [af12], owner:
13: Phantasm [n4b], Imperial Empire, duke, with one peasant,
13: two workers, 32 sailors, 15 lt. xbowmen, accompanied by:
13: Elisabeth [hn0y], Pen, with 21 pikemen
14: Sirocco Traveller [ja8y], ship, 10 hulls, 1 rowing port, 30 sails,
14: 8% damaged, departed for Ocean [ah12].
18: It has begun to rain.
Routes leaving Ocean:
North, to Ocean [af12], 6 days
East, to Ocean [ag13], 6 days
South, to Ocean [ah12], 6 days
West, to Ocean [ag11], 6 days
It is raining.


1 What is bsmdoc?
bsmdoc is a tool to generate technical static html docs:
- Light-weighted;
- Highly extendable;
- Single file doc: generate everything in a single file.
bsmdoc splits the whole doc into blocks (e.g., equation block, paragraph block, heading block, ...). In the following sections, we will show each block in detail, as well as the way to extend the existing blocks.
1.1 Installation
bsmdoc can be installed with pip
$ pip install bsmdoc
You can also clone the repository and run setup.py
$ pip install -e .
1.2 Get Started
Create a file (e.g., helloworld.bsmdoc) with content
= hello world
Compile the file
$ bsmdoc helloworld.bsmdoc
It will generate helloworld.html in the same folder, which may look like
<!DOCTYPE html>   <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="generator" content="bsmdoc 0.0.8"> <link rel="stylesheet" href="css/bsmdoc.css" type="text/css">

hello world

 Last updated 2020-07-20 07:10:38 GMT by bsmdoc.

1.3 1-minute Tutorial
bsmdoc also provides some commands to create html project and doc.
First, create a project
$ bsmdoc --new-project myprj
The above command will
- create a folder myprj;
- copy the default css and javascript files to it;
- create a index.bsmdoc from template;
- compile the above index.bsmdoc to generate index.html.
Now, you can update the index.bsmdoc and then compile it
$ bsmdoc index.bsmdoc
Add a new doc from template
$ bsmdoc --new-doc myprj/page
It will create the page.bsmdoc in folder myprj from template and compile it.
2 Heading
heading block is defined by a line starting with =
level 1
level 2
level 3
level 4
level 5
level 6
= level 1 == level 2 === level 3 ==== level 4 ===== level 5 ====== level 6
As you have seen, heading block must start at a new line. Otherwise, =
(e.g., in a paragraph) is just normal equal sign.
bsmdoc supports all 6 heading levels as shown above. However, we don't think anyone needs all these 6 levels (remember, "The Feynman Lectures on Physics" only uses 2 levels).
heading text can spread over multiple lines as long as they are enclosed by "{}
", as shown in the following example. Actually, "{}
" also define a basic block in bsmdoc. It is quite flexible to define the heading text; generally, you are allowed to put everything in it.
multiple
line
heading
multiple line heading
= {multiple\n line\n heading} = {multiple line heading}
To add reference to the heading block, first you need to add a label with command "\label
". Then, it can be referenced as a normal in-page link.
section with label
This section ...
= {section with label \label{sec-label}} This [#sec-label|section] ...
By default, the heading block will not be automatically numbered. The following configuration is used to turn on the automatic numbering
\config{heading_numbering|True}
bsmdoc will not start the automatic heading numbering until you set the above flag. Thus if you want bsmdoc to add numbering to the whole doc, simply put the above configuration line at the beginning of the doc. You also can set the start heading level for automatic numbering. For example, the following line will tell bsmdoc to start heading numbering from level 2 (i.e., H2
)
\config{heading_numbering_start|2}
When referencing to a heading block with automatic heading numbering on, the link text will be automatically filled with its index if it is empty,
Sec. [#sec-heading] ...
It can also be achieved by \ref
command
Sec. \ref{sec-heading}...
bsmdoc will generate the table of contents from the headings, if the following configuration is enabled
\config{show_table_of_contents|True}
Only the headings with automatic numbering will be included in the content list. The table of contents is generated by a function block makecontent. Its input is a list that contains all the headings. The default implementation generates an un-ordered list
@BFunction('makecontent') def bsmdoc_makecontent(contents, **kwargs): """ table of contents is a list, each item [level, text, label] level: 1~6 text: the caption text label: the anchor destination """ if not contents: return "" first_level = min([c[0] for c in contents]) call = [] for c in contents: # the text has been parsed, so ignore the parsing here txt = BFunction().tag(c[1], 'a', 'href="#%s"' % c[2]) call.append(['-' * (c[0] - first_level + 1), txt]) return BFunction().listbullet(call)
3 List
bsmdoc defines two kinds of list blocks: unordered list and ordered list.
A line leading with "-
" will be rendered as unordered list. "-
" will be ignored if it is not at the start of a line. Such rule holds for all heading, unordered list, and ordered list blocks.
- start each line
- with an hyphen -.
- more asterisks gives deeper
- and deeper levels.
- more asterisks gives deeper
- line breaks
don't break levels.- but jumping levels creates empty space.
- start each line - with an hyphen -. -- more asterisks gives deeper --- and deeper levels. - line breaks\n don't break levels. --- but jumping levels creates empty space. any other start ends the list.
Ordered list starts with "*
"
- start each line
- with a start '*'
- more asterisks gives deeper
- and deeper levels.
- more asterisks gives deeper
- line breaks
don't break levels.- but jumping levels creates empty space.
* start each line * with a start '*' ** more asterisks gives deeper *** and deeper levels. * line breaks\n don't break levels. *** but jumping levels creates empty space. any other start ends the list.
unordered and ordered lists can also be arbitrarily combined
- unordered level 1
- ordered item 1
- ordered item 2
- unordered item 3
- unordered item 4
- unordered level 1 -* ordered item 1 -* ordered item 2 -- unordered item 3 -- unordered item 4
Each item of a list can spread over multiple lines as long as they are enclosed by "{}
":
- unordered level 1
more text here bsmdoc- ordered item2
- {unordered level 1\n more text here [bsmdoc.feiyilin.com | bsmdoc] } -* ordered item2
4 Link
Text between [
and ]
will be rendered as link block
[http://bsmedit.feiyilin.com]
Link text can be customized with "|
"
[http://bsmdoc.feiyilin.com | bsmdoc]
Or email
<EMAIL_ADDRESS>| Email]
You can also easily define in-page links with \anchor
command
In page link \anchor{myanchor}
Then, you can link to the in-page link by
My in-page [#myanchor|link]
4.1 Footnote
One special in-page link is footnote
⚓. It will automatically add the link to the position it gets defined, and add the footnote content at the end of the page. bsmdoc also adds a shortcut at the end of the footnote content, so you can return to the footnote definition position easily.
footnote example\footnote{This is a footnote}.
bsmdoc will automatically add indexing to each footnote. When you move the cursor to the footnote link, the footnote content will be shown in a popup window. So you may not need to go to the end of the page to see the footnote content. The image, equation and table blocks support similar feature.
4.2 Reference & Citation
bsmdoc has an easy way to add references and citations. For example, the following command will add a book reference
\reference{Simon|Simon Haykin, "Adaptive Filter Theory," Prentice Hall, 4th edition, Sep. 2001}
Simon before "|
" is the alias, which can be used to cite it, e.g.,
The LMS algorithm in \cite{Simon}...
And the reference is not required to be defined before citation. If bsmdoc can not find the reference when it sees \cite
, it will trigger the second scan, in case the reference is defined after the citation. If the reference is still missing at the second scan, bsmdoc will show a warning.
All cited references will be appended to the end of the document in the citation order. If you want to add the reference without citation, you can use the hide
argument of the cite
command
\cite{hide|Simon}...
In this case, it will not generate the link to the reference, but the reference will still be added to the reference list even if there is no explicit citation in the document.
5 Image & Video
5.1 Image
The syntax of the image block is
{!image|| image_file_path !}
So, to include an image
{!image|| ./image/scatter.svg !}
You can add optional caption to an image block
{!image|| \caption{Example scatter image} ./image/scatter.svg !}
To add reference to an image, you need to
add a label to an image block with
\label
command{!image|| \label{img-scatter} \caption{Example scatter image} ./image/scatter.svg !}
add reference to the image with
\ref
commandFig. 3 shows a scatter diagramFig. \ref{img-scatter} shows a scatter diagram
Here the reference link \ref{img-scatter}
) is defined after the definition of the image block. The reference link text is automatically replaced with the image index. In some case, if the reference link is created before the image block is defined, bsmdoc will not know the destination when it sees the reference link. In this case, the second scan will automatically be triggered to solve the reference link.
When the cursor is moved to the reference link, the referenced image will be highlighted if it is visible; otherwise, the image will be shown in a popup window. Such feature is inspired by "The Feynman Lectures on Physics" website. It allows you to view the images at the current reference position. Otherwise, you would have to follow the link to the original place where the image is first included. To use such feature, the image label should start with "img-
", which is hard-coded in the Javascript. The references to equation, table, and footnote behave similarly.
As you have seen, the image block can automatically add the numbering to the image with label. The default automatic indexing format is: "Fig. I.
", where "I
" is the current index. You can configure the automatic prefix text. For example, to change it to "Image
", the following line can be inserted before a image block definition (usually at the beginning of the doc, so that it affects all the image blocks)
\config{image_numbering_prefix|Image }
For example
{!image|| \config{image_numbering_prefix|Image } \label{img-scatter2} \caption{Example scatter image} ./image/scatter.svg !}
The options to configure the image numbering
| Option | Description |
|---|---|
| image_numbering | True or False (default). Turn on/off numbering, e.g., \config{image_numbering|True} |
| image_numbering_prefix | The numbering prefix (default "Fig."). To change the prefix, e.g., \config{image_numbering_prefix|Image.} |
| image_numbering_num_prefix | The numbering prefix (default ""). To change the prefix, e.g., \config{image_numbering_num_prefix|3.} |
5.2 Video
Video block is almost same as the image block. Its syntax is
{!video|| video_file_path !}
For example, to add reference to an image, you need to
add a label to an image block with
\label
command{!video|| \label{video-waves} \caption{Example video} ./image/waves.mp4 !}
add reference to the image with
\ref
commandFig. 5 shows a scatter diagramFig. \ref{video-waves} shows a scatter diagram
The options to configure the video numbering
| Option | Description |
|---|---|
| video_numbering | image (default) or True or False. Turn on/off numbering. If it is set to image, then it will share numbering with image block. |
| video_numbering_prefix | The numbering prefix (default "Video."). Only valid if video_numbering is not image. |
| video_numbering_num_prefix | The numbering prefix (default ""). Only valid if video_numbering is not image. |
6 Equation
Equation is rendered with mathjax: both inline and normal equation blocks. The configuration may look like:

Such configuration can be included in a configuration file, which will be shown in detail in Sec. 12.
bsmdoc looks for "\(...\)
" (or "$...$
") as delimiters for inline equation block
Newton's second law is often stated as \(F=ma\), which means the force (\(F\)) acting on an object is equal to the mass ($m$) of an object times its acceleration ($a$).
The normal equation block looks like
{!math||{% Latex Equation %}!}
or
$$ Latex Equation $$
For example
{!math||{% \begin{align} \begin{bmatrix} 0 & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & 0 \label{eqn:matrix} \end{bmatrix} \end{align} %}!}
bsmdoc generally keeps the equation content (i.e., the content between {%...%}
) untouched, except <
and >
, which will be replaced with <
and >
respectively, to avoid conflicts with html tags. For example,
$a > 5$
$a>5$
Unlike the image block mentioned above, the reference to equation is also handled by mathjax. The syntax is same as \(Latex\)
Eq. (\ref{eqn:matrix}) or Eq. (\eqref{eqn:matrix})
As mentioned above, same as the image block, when move the cursor to the equation reference link, bsmdoc will highlight the referenced equation if it is visible. Otherwise, a popup window will be displayed to show the equation.
7 Table
The table block is defined with {{...}}
, where
- each row is ended by "
|-
"; - each column in a row is terminated by "
|
".
The content in each column of each row can be anything defined above, for example, Link, Image, Equation,...
| item1 | \(E=MC^2\) |
| bsmdoc |
{{ item1 | $E=MC^2$ ||- [http://bsmdoc.feiyilin.com|bsmdoc] | {!div|figure|image-left|image-thumbnail||\image{image/scatter.svg}!} ||- }}
Optionally, a heading line can be added in the front of the table block
the heading line is delimited by "
|+
".Heading1 Heading2 item1 item2 item3 item4 {{ Heading1 | Heading2||+ item1 | item2 ||- item3 | item4 ||- }}
Furthermore, a caption can be added to the table block too
| Heading1 | Heading2 |
|---|---|
| item1 | item2 |
| item3 | item4 |
{{ \caption{Example table title} Heading1 | Heading2||+ item1 | item2 ||- item3 | item4 ||- }}
bsmdoc can also add the automatic indexing to the table caption. To do that, you need to
turn on the option
\config{table_numbering|True}
bsmdoc will add the automatic indexing to all the tables defined after the above line, until you explicitly turn off the configuration.
add the label to each table if you want to reference it
\label{table_label}
For example
| Heading1 | Heading2 |
|---|---|
| item1 | item2 |
| item3 | item4 |
{{ \config{table_numbering|True} \label{tbl-example} \caption{Example table title} Heading1 | Heading2||+ item1 | item2 ||- item3 | item4 ||- }}
The default automatic indexing format is: "Table. I.
", where "I
" is the current index. It can also be customized. For example, to change it to "TABLE
", the following line can be inserted before the table block definition
\config{table_numbering_prefix|TABLE }
| Heading1 | Heading2 |
|---|---|
| item1 | item2 |
| item3 | item4 |
{{ \config{table_numbering_prefix|TABLE } \label{tbl-example2} \caption{Example table title} Heading1 | Heading2||+ item1 | item2 ||- item3 | item4 ||- }}
The label enables not only the automatic indexing, but also the cross-reference. Reference to a table is as easy as image and equation blocks
Table \ref{tbl-example} shows how to make a table in bsmdoc.
If the table label text starts with "tbl-
", when the cursor is moved to the reference index, the table will be highlighted if it is visible; otherwise, a popup window will be displayed to show the table content.
The options to configure the table numbering
| Option | Description |
|---|---|
| table_numbering | True or False (default). Turn on/off numbering. |
| table_numbering_prefix | The numbering prefix (default "Table."). |
| table_numbering_num_prefix | The numbering prefix (default ""). |
8 Syntax Highlighting
bsmdoc uses Pygments for syntax highlighting. The syntax is
{!highlight|language||{% code %}!}
where language
can be any language supported by Pygments. For example,
Python
print("Hello World")
{!highlight|python||{% print("Hello World") %}!}
Matlab
fprintf(1, 'Hello, world!\n');
{!highlight|matlab||{% fprintf(1, 'Hello, world!\n'); %}!}
C++
#include <iostream> using namespace std; int main () { cout << "Hello World!"; return 0; }
{!highlight|C++||{% #include <iostream> using namespace std; int main () { cout << "Hello World!"; return 0; } %}!}
The highlight
block supports a couple of options to format the code:
- obeytabs: to replace tab with 4 space
gobble=N: remove the first N characters from each line.
print("Hello World")
{!highlight|python|gobble=4||{% print("Hello World") %}!}
- autogobble: remove leading common white space from each line.
All other keyword arguments will be forwarded to HtmlFormatter. The following example turns on the line number, and highlights line 6.
1 2 3 4 5 6 7 8
#include <iostream> using namespace std; int main () { cout << "Hello World!"; return 0; }
{!highlight|C++|linenos=table|hl_lines=(6,)||{% #include <iostream> using namespace std; int main () { cout << "Hello World!"; return 0; } %}!}
It is also possible to use other packages for syntax highlighting, which will be discussed in detail in Sec. 10.
9 Raw Text Block
Sometimes you may want to skip the parsing from bsmdoc. For example, to highlight the code, it is basically not a good idea to let bsmdoc parse the code. Instead, the raw data should be sent to the code highlighting block. In another example, you may have seen similar syntax between the latex macro and the bsmdoc commands (e.g., both are preceded by "\
"). If bsmdoc tries to parse these latex macros, the result is obviously not what you want. Thus, bsmdoc defines the raw text block. It basically tells bsmdoc to ignore all the rules on its content.
The syntax of the raw text block is
{% Content %}
In this case, bsmdoc will stop parsing the Content
between {%...%}
, and the raw text will be either sent to the final html file or send to the other function blocks to process.
However, sometimes you may still want to slightly process the Content
before sending to the html file. For example, the Content
may contain symbols (e.g., < >
), which may cause conflict to the html tags. You can use the escape function block to process the data
{!escape||{% Content %}!}
In this case, <
and >
will be replaced with <
and >
, respectively.
<
(>
) with <
(>
). Thus, there is no need to explicitly call the escape function block.
By symmetry, bsmdoc also defines the unescape function block, which will replace <
(>
) with <
(>
).
10 Function Block
Function block makes things really interesting. Without function block, bsmdoc is almost useless. Function block provides a easy way to allow the content to be processed before sent to the final html file. As you have seen above, the syntax of a function block looks like
{!command content !}
where command
is optional and may contain the name and arguments of the corresponding function block.
As described above, many features mentioned above are implemented with function blocks. For example,
image block:
{!image|| image-path !}
equation block:
{!math||{% latex-equation %}!}
syntax highlight block:
{!highlight|language||{% code %}!}
div tag

 content

{!div|div-class|| content !}
pre tag

 content

{!pre||{% content %}!}
general tag
<key class="tag-class"> content </key>
{!tag|key|tag-class|| content !}
The command
section is optional. When the command
section is not defined, the function block behaves exactly same as the simple block ({}
). Otherwise, the corresponding function will be called to process the content.
As you may have already figured out, the command
section is defined as
command|arg0|arg1|arg2|...|argN||
The command can have arbitrary number of arguments, which are separated by "|
". And the command is always terminated by "||
". It is also possible to combine multiple commands, e.g.,
command0|arg0|arg1|arg2||command1|arg0|arg1|arg2||
In this case, the commands are called from right to left. Thus in the above example, command1
will be called first, and its result will be sent to command0
. The result from command0
will be sent to the html file. It is equivalently to the following nested blocks
{!command0|arg0|arg1|arg2|| {!command1|arg0|arg1|arg2|| content !}!}
The function block makes it easy to extend bsmdoc. We could have defined all kinds of function blocks to generate all html tags, and write a comprehensive doc so we can look up later. We don't. Otherwise, that will not be significantly different from remembering all html syntax. Instead, we make it easy to add new functions.
When bsmdoc sees the following function block
{!command|arg0|arg1|| content !}
it will search for the function decorated with "@BFunction('command')
". If found, it will execute the command with list "[arg0, arg1]
" as argument. For example, if you want to define a function block to achieve the "delete" effect,
first you need to define the function (e.g., "
bsmdoc_del
") with decorator "@BFunction('del')
"; the function name (bsmdoc_del
) is not important.@BFunction('del') def bsmdoc_del(data, *args, **kwargs): return "%s"%data
*args
will have all the arguments from the function block. For example, ifdel
is called as{!del|arg0|arg1|| content !}
then bsmdoc will call
bsmdoc_del
bybsmdoc_del("content", "arg0", "arg1", **kwargs)
Here
**kwargs
are additional arguments from bsmdoc, for exampleargument description inline True
if it is a inline block (we will discuss the inline block shortly).filename the current filename lineno the line number of the start of the function block fun_args the list string arguments from function block fun_kwargs the dict of keyword arguments from function block Such info may be helpful to show debugging tips once some error happens.
bsmdoc will also parse the arguments from the function. All string arguments will be in list fun_args (e.g., 'args0') and keyword arguments will be in dict fun_kwargs (e.g., argument key=value will be convert to fun_kwargs[key]=value). In this case, if value is a number, it will be convert to a number, e.g., "answer=42" will be fun_kwargs['answer']=42; otherwise, value will be a string, e.g., "today=sunday" will be fun_kwargs['today']='sunday'.
For a argument to be recognized as keyword argument, first, it has to have an "
=
" in it; second, the string to the left of the first "=
" shall be a valid python identifier.Now
del
(the name from@BFunction
decorator) can be used as all the other blocks,delete
{!del|| delete !}
All command
functions shall return a string, which will be sent to the next block or the html file. If the function does not need to change the html file, it shall return the empty string.
The next question is where to put the function definition? One straightforward solution is to define the above bsmdoc_del
function in bsmdoc.py and then all the documents can use the del
function block. However, that also means once you need some missing features, you need to go back to the bsmdoc.py and define the functions there. It may cause two potential issues:
- It needs to edit additional file bsmdoc.py besides the docs you are working on. Thus the change is not local to the doc itself. If there is some mistake in the code, suddenly no doc can be compiled;
- How about two docs need slightly different implementation of some function? You may end up either using some slightly different (but not straightforward) function names, or adding additional arguments to the function blocks.
Neither way is scalable. bsmdoc provides the third choice: the function block can be defined in the same doc where it is called. To achieve that, bsmdoc define a special exec
block
{!exec||{% code %}!}
which will execute the code
automatically.
Thus, including the following code in your doc will automatically add the bsmdoc_del
function just as it is defined in bsmdoc.py (but be careful, since bsmdoc will call python function "exec()
" for this feature, it may cause some security concerns).
{!exec||{% @BFunction('del') def bsmdoc_del(data, *args, **kwargs): return "%s"%content %}!}
With the exec
block, you can replace all the predefined blocks with this method. For example, you can define your code highlight function block so that you can highlight your own language or with other library
{!exec||{% @BFunction('highlight') def bsmdoc_highlight(data, *args, **kwargs): ... %}!}
Or in some case, you just want to use your own function for some arguments. For example, you want to call your own function to highlight the code for a specific language, and use the default function for all the others. In this case, you may try
{!exec||{% bsmdoc_highlight_raw = BFunction().highlight # get the current highlight function @BFunction('highlight') def bsmdoc_highlight(data, *args, **kwargs): if args[0] != 'mylang': return bsmdoc_highlight_raw(data, *args, **kwargs) # highlight 'mylang' ... %}!}
It may work fine to compile most of your docs, until one day it fails and python complains indefinite loop. The problem here is that the above definition assumes such code will only be called once. But it is not always true for bsmdoc. As mentioned before, bsmdoc may scan the doc multiple times to solve the late-defined references. Thus, when bsmdoc executes the above code second time, bsmdoc_highlight_raw
will not refer to the original bsmdoc_highlight
, instead, it will also point to the local defined copy. The definition will be equivalent to
{!exec||{% bsmdoc_highlight_raw = BFunction().highlight @BFunction('highlight') def bsmdoc_highlight(data, *args, **kwargs): if args[0] != 'mylang': return bsmdoc_highlight(data, *args, **kwargs) # highlight 'mylang' ... %}!}
It is apparently an indefinite loop.
Several techniques can be used to solve this problem. For example, you can always define the whole function by yourself, instead of calling the default function in some branches. Or you may check whether the local function has been defined or not
{!exec||{% try: bsmdoc_highlight_raw except NameError: bsmdoc_highlight_raw = BFunction().highlight @BFunction('highlight') def bsmdoc_highlight(data, *args, **kwargs): if args[0] != 'mylang': return bsmdoc_highlight(data, *args, **kwargs) # highlight 'mylang' ... %}!}
Or you can tell bsmdoc to execute the code for the first scan only
{!exec|firstRunOnly||{% bsmdoc_highlight_raw = BFunction().highlight @BFunction('highlight') def bsmdoc_highlight(data, *args, **kwargs): if lang != 'mylang': return bsmdoc_highlight(data, *args, **kwargs) # highlight 'mylang' ... %}!}
10.1 Generate Images
Besides defining the function block, the exec
block can also be used to execute arbitrary python code (be careful!). One application is to embed the python code to generate the figure with matplotlib package,
{!exec||{% import os.path if not os.path.isfile("pie.svg"): import matplotlib.pyplot as plt import numpy as np plt.clf() plt.figure(figsize=(4,4)) # Compute pie slices N = 20 theta = np.linspace(0.0, 2 * np.pi, N, endpoint=False) radii = 10 * np.random.rand(N) width = np.pi / 4 * np.random.rand(N) ax = plt.subplot(111, projection='polar') bars = ax.bar(theta, radii, width=width, bottom=0.0) # Use custom colors and opacity for r, bar in zip(radii, bars): bar.set_facecolor(plt.cm.viridis(r / 10.)) bar.set_alpha(0.5) plt.savefig("image/pie.svg") %}!}
Then you can include the pie.svg in your html file
{!image|| ./image/pie.svg !}
Thus, there may be no need to use other software to generate figures.
10.2 Include Source Code
With function block, it is easy to include source code in html doc. For example, to import the python source code in your doc, you can define the following function block
{!exec|firstRunOnly||{% import inspect import six @BFunction('codesnippet') def bsmdoc_codesnippet(data, *args, **kwargs): d = eval(data) if isinstance(d, six.string_types): return d else: return inspect.getsource(d) %}!}
Then you can include the source code (e.g., matplotlib.pyplot.plot) by
@docstring.copy_dedent(Axes.plot) def plot(*args, scalex=True, scaley=True, data=None, **kwargs): return gca().plot( *args, scalex=scalex, scaley=scaley, **({"data": data} if data is not None else {}), **kwargs)
{!exec|firstRunOnly||{% import matplotlib.pyplot as plt %}!} {!highlight|python||codesnippet|| plt.plot !}
It can be easily extended to include arbitrary code. For example, the following block returns the content of a source file. Of course, you can write a function block to just return certain sections (e.g., a function), instead of the whole file.
{!exec|firstRunOnly||{% @BFunction('ccodesnippet') def bsmdoc_ccodesnippet(data, *args, **kwargs): with open(data.strip(), 'r') as f: return ''.join(f.readlines()) return data %}!}
Then you can include the source code by
$(window).on("load", function() { // Cache selectors var lastId, topMenu = $(".menu"), topTitleHeight = $(".toptitle").outerHeight()+15, topUL = topMenu.find('ul'), // All list items menuItems = topMenu.find("a"), // Anchors corresponding to menu items scrollItems = menuItems.map(function(){ var item = $($(this).attr("href")); if (item.length) { return item; } }); var auto_hide_child_menu = menuItems.length > 15; // Bind click handler to menu items so we can get a fancy scroll animation if (!auto_hide_child_menu) { menuItems.click(function(e){ var href = $(this).attr("href"), offsetTop = href === "#" ? 0 : $(href).offset().top-15+1; $('html, body').stop().animate({ scrollTop: offsetTop }, 300); e.preventDefault(); }); } function update_menu() { // Get container scroll position var fromTop = $(this).scrollTop() + 15; // Get id of current scroll item var cur = scrollItems.map(function(){ if ($(this).offset().top < fromTop) return this; }); // Get the id of the current element cur = cur[cur.length-1]; var id = cur && cur.length ? cur[0].id : ""; if (lastId !== id) { lastId = id; // Set/remove active class menuItems.removeClass("active"); menuItems.filter("[href='#"+id+"']").addClass("active"); if (auto_hide_child_menu) { topUL.find('ul').each(function(index){ $(this).css('display', 'none'); }); } menu = menuItems.filter("[href='#"+id+"']"); menuul = menu.closest('ul').css('display', 'inline-block'); menu.closest('li').children('ul').css('display', 'inline-block'); } } // Bind to scroll $(window).scroll(function(){ update_menu(); }); update_menu(); });
{!highlight|javascript||ccodesnippet|| js/menu.js !}
10.3 Inline Function Block
The difference between function block and inline function block is similar to the equation block and inline equation block. In other words, the output of the inline block can be embedded in paragraphs. The syntax is similar to the \(\LaTeX\) macro:
\command{arg0|arg1|...|argN|content}
In general, the blocks defined in the above section can also be used as inline block. For example
content
content

\tag{code|content} \pre{content}
bsmdoc defines a special inline function block for configuration (\config{}
). It adds a configuration item to bsmdoc's global configuration table, and output empty string to the html file. Thus, it will not directly update the html docs, although the other blocks may rely on such configurations to control their behaviors. The syntax is
\config{option|value}}
We have seen heading, image, and table blocks use such feature to set the label and caption. We will see more configurations in Sec. 12.
10.4 Express Function Block
Besides the way mentioned above, there is a shortcut to define a function block, if it returns a simple string. The syntax to define a function is
\newfun{name|content}
For example
\newfun{bsmdoc|\tag{strong|bsmdoc}}
Once it is defined, it can be used as
\bsmdoc
where \bsmdoc
will be replaced with the result of \tag{strong|bsmdoc}
, i.e.,
bsmdoc
11 Input Redirection
When the doc becomes large, you can split your doc into several docs and includes them in the top doc with the "#include
" directive. For example, suppose you are writing a book, and have created chappter1.bsmdoc, chapter2.bsmdoc, .... Then, you can include all the chapters in your book.bsmdoc
#include chapter1.bsmdoc #include chapter2.bsmdoc
bsmdoc will replace the line #include chapter1.bsmdoc with the content of the file chappter1.bsmdoc.
The #include
is implemented with function bsmdoc_include
@BFunction('include') def bsmdoc_include(data, **kwargs): filename = data.strip() if os.path.isfile(filename): return _bsmdoc_readfile(filename, **kwargs) else: _bsmdoc_error("can't not find %s" % filename, **kwargs) return ""
Here data
will be anything following #include
. In the previous example, it will be "chapter1.bsmdoc" or "chapter2.bsmdoc". If the file is opened successfully, by default bsmdoc_include will return the filename and its content.
It is easy to extend the bsmdoc_include function for more advanced applications, for example
{!exec|firstRunOnly||{% bsmdoc_include_raw = BFunction().include @BFunction('include') def bsmdoc_include(data): # assume 'data' has multiple sections separated by '|', in the format of # PATTERN | MAX LINE | FILENAME d = data.strip().split('|') if len(d) == 1: # one section, return the default return bsmdoc_include_raw(data) elif len(d) == 3: import re # assume the last parameter is the filename c = bsmdoc_include_raw(d[-1]) if not c: # invalid filename return c lines = c[1].split('\n') pattern = [] for i, l in enumerate(lines): # search the PATTERN if re.match(d[0], l): pattern.append(i) if len(pattern) == 2: # return the content between the first and second instances of PATTERN if pattern[1] - pattern[0] > int(d[1]): # too many lines, cut it pattern[1] = pattern[0] + int(d[1]) return (c[0], '\n'.join(lines[pattern[0]+1:pattern[1]])) return c return None %}!}
Then the following code will include the content between the first two headings from file myfile.bsmdoc. And the maximum number of lines is limited to 16.
#include ^(\\s)*=+|16|./myfile.bsmdoc
12 HTML Template
By default, bsmdoc uses the following template to generate the html file, which defines 4 sections (i.e., html, header, body and footer)
[html] begin = <!DOCTYPE html>  end=  [header] begin =  <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> end =  content = bsmdoc_css = ['css/bsmdoc.css'] bsmdoc_js = ['js/bsmdoc.js'] menu_css = ['css/menu.css'] menu_js = ['js/menu.js'] mathjax =   jquery =  [body] begin =
 end =
  # default content is # %(article_menu)s #
 # %(article_title)s # %(article_content)s #
 content = [footer] begin =
 end =
 content =
 Last updated %(UPDATED)s by bsmdoc%(SOURCE)s.

Using a separate configuration file seems not to be compatible with our goal to include everything in a single file, although sometimes it may be convenient (for example, to use the same configuration file for multiple docs). bsmdoc also provides a way to include the customized template in your doc, for example
{!config||{% [html] begin = <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">  end=  ... %}!}
In this case, "config" function block is called without any argument. And its content should have a INI file structure.
bsmdoc uses ConfigParser to parse the configurations. Thus, %()s will be resolved to the corresponding configuration values. The configuration name is case insensitive. For example,
%(TITLE)s will be replaced with "my html title", if you config the title with
\config{title|my html title}
- %(UPDATED)s will be replaced with the time when the html file is generated.
- %(SOURCE)s will be replaced with the bsmdoc filename.
It is easy to create a configuration by
define the macro content, e.g.,
\config{MYMACRO|...}
use the configuration in the template
...%(MYMACRO}s...
bsmdoc defines "css
" configuration to insert additional css
in the html file without change the html template
\config{css|my.css}
To insert multiple css files, separate them with white-space
\config{css|my.css my2.css}
or
\config{css|my.css} \config{css|add|my2.css}
where add
option tells bsmdoc to append the configuration to the current one.
Similarly, bsmdoc also defines the "js
" configuration to include javascripts in the html file
\config{js|myjs.js myjs2.js}
There are two ways to define doc title. The first one is to use the toptitle
configuration. For example, the following line will define the top title

 bsmdoc -- another technical html doc generator
 <a href='mailto:tq<EMAIL_ADDRESS>

\config{doctitle|bsmdoc -- another technical html doc generator} \config{subtitle|[mailto:tq<EMAIL_ADDRESS>It is easy to see that it is equivalent to the following code
{!div|toptitle|| bsmdoc -- another technical html doc generator {!div|subtitle|| [mailto:tq<EMAIL_ADDRESS>!} !}


Graphics Class
The Graphics class exposes an easy to use API for generating vector drawing instructions and drawing them to a specified context. Note that you can use Graphics without any dependency on the Easel framework by calling draw directly, or it can be used with the Shape object to draw vector graphics within the context of an Easel display list.
Example
var g = new createjs.Graphics(); g.setStrokeStyle(1); g.beginStroke(createjs.Graphics.getRGB(0,0,0)); g.beginFill(createjs.Graphics.getRGB(255,0,0)); g.drawCircle(0,0,3); var s = new createjs.Shape(g);
s.x = 100;
s.y = 100;
stage.addChild(s);
stage.update();
Note that all drawing methods in Graphics return the Graphics instance, so they can be chained together. For example, the following line of code would generate the instructions to draw a rectangle with a red stroke and blue fill, then render it to the specified context2D:
myGraphics.beginStroke("#F00").beginFill("#00F").drawRect(20, 20, 100, 50).draw(myContext2D);
Tiny API
The Graphics class also includes a "tiny API", which is one or two-letter methods that are shortcuts for all of the Graphics methods. These methods are great for creating compact instructions, and is used by the Toolkit for CreateJS to generate readable code. All tiny methods are marked as protected, so you can view them by enabling protected descriptions in the docs.| Tiny | Method | Tiny | Method |
| mt | moveTo | lt | lineTo |
| a/at | arc / arcTo | bt | bezierCurveTo |
| qt | quadraticCurveTo (also curveTo) | r | rect |
| cp | closePath | c | clear |
| f | beginFill | lf | beginLinearGradientFill |
| rf | beginRadialGradientFill | bf | beginBitmapFill |
| ef | endFill | ss | setStrokeStyle |
| s | beginStroke | ls | beginLinearGradientStroke |
| rs | beginRadialGradientStroke | bs | beginBitmapStroke |
| es | endStroke | dr | drawRect |
| rr | drawRoundRect | rc | drawRoundRectComplex |
| dc | drawCircle | de | drawEllipse |
| dp | drawPolyStar | p | decodePath |
Here is the above example, using the tiny API instead.
myGraphics.s("#F00").f("#00F").r(20, 20, 100, 50).draw(myContext2D);
Constructor
Graphics
()
Item Index
Methods
- _appendDraw
- _appendInstructions
- _newPath
- _setProp
- _updateInstructions
- a
- arc
- arcTo
- at
- beginBitmapFill
- beginBitmapStroke
- beginFill
- beginLinearGradientFill
- beginLinearGradientStroke
- beginRadialGradientFill
- beginRadialGradientStroke
- beginStroke
- bezierCurveTo
- bf
- bs
- bt
- c
- clear
- clone
- closePath
- cp
- curveTo
- dc
- de
- decodePath
- dp
- dr
- draw
- drawAsPath
- drawCircle
- drawEllipse
- drawPolyStar
- drawRect
- drawRoundRect
- drawRoundRectComplex
- ef
- endFill
- endStroke
- es
- f
- getHSL static
- getRGB static
- initialize
- inject
- isEmpty
- lf
- lineTo
- ls
- lt
- moveTo
- mt
- p
- qt
- quadraticCurveTo
- r
- rc
- rect
- rf
- rr
- rs
- s
- setStrokeStyle
- ss
- toString
Properties
- _active
- _activeInstructions
- _ctx static
- _dirty
- _fillInstructions
- _instructions
- _oldInstructions
- _strokeIgnoreScale
- _strokeInstructions
- _strokeMatrix
- _strokeStyleInstructions
- BASE_64 static
- beginCmd static
- Command static
- fillCmd static
- STROKE_CAPS_MAP static
- STROKE_JOINTS_MAP static
- strokeCmd static
Methods
_appendDraw
()
protected
_appendInstructions
()
protected
_newPath
()
protected
_setProp
-
name
-
value
Used to create Commands that set properties
_updateInstructions
()
protected
a
()
protected
arc
-
x
-
y
-
radius
-
startAngle
-
endAngle
-
anticlockwise
Draws an arc defined by the radius, startAngle and endAngle arguments, centered at the position (x, y). For example, to draw a full circle with a radius of 20 centered at (100, 100):
arc(100, 100, 20, 0, Math.PI*2);
For detailed information, read the whatwg spec. A tiny API method "a" also exists.
Parameters:
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
arcTo
-
x1
-
y1
-
x2
-
y2
-
radius
Draws an arc with the specified control points and radius. For detailed information, read the whatwg spec. A tiny API method "at" also exists.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
at
()
protected
beginBitmapFill
-
image
-
repetition
-
matrix
Begins a pattern fill using the specified image. This ends the current sub-path. A tiny API method "bf" also exists.
Parameters:
-
image
HTMLImageElement | HTMLCanvasElement | HTMLVideoElementThe Image, Canvas, or Video object to use as the pattern.
-
repetition
StringOptional. Indicates whether to repeat the image in the fill area. One of "repeat", "repeat-x", "repeat-y", or "no-repeat". Defaults to "repeat". Note that Firefox does not support "repeat-x" or "repeat-y" (latest tests were in FF 20.0), and will default to "repeat".
-
matrix
Matrix2DOptional. Specifies a transformation matrix for the bitmap fill. This transformation will be applied relative to the parent transform.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
beginBitmapStroke
-
image
-
[repetition=repeat]
Begins a pattern fill using the specified image. This ends the current sub-path. Note that unlike bitmap fills, strokes do not currently support a matrix parameter due to limitations in the canvas API. A tiny API method "bs" also exists.
Parameters:
-
image
HTMLImageElement | HTMLCanvasElement | HTMLVideoElementThe Image, Canvas, or Video object to use as the pattern.
-
[repetition=repeat]
String optionalOptional. Indicates whether to repeat the image in the fill area. One of "repeat", "repeat-x", "repeat-y", or "no-repeat". Defaults to "repeat".
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
beginFill
-
color
Begins a fill with the specified color. This ends the current sub-path. A tiny API method "f" also exists.
Parameters:
-
color
StringA CSS compatible color value (ex. "red", "#FF0000", or "rgba(255,0,0,0.5)"). Setting to null will result in no fill.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
beginLinearGradientFill
-
colors
-
ratios
-
x0
-
y0
-
x1
-
y1
Begins a linear gradient fill defined by the line (x0, y0) to (x1, y1). This ends the current sub-path. For example, the following code defines a black to white vertical gradient ranging from 20px to 120px, and draws a square to display it:
myGraphics.beginLinearGradientFill(["#000","#FFF"], [0, 1], 0, 20, 0, 120).drawRect(20, 20, 120, 120);
A tiny API method "lf" also exists.
Parameters:
-
colors
ArrayAn array of CSS compatible color values. For example, ["#F00","#00F"] would define a gradient drawing from red to blue.
-
ratios
ArrayAn array of gradient positions which correspond to the colors. For example, [0.1, 0.9] would draw the first color to 10% then interpolating to the second color at 90%.
-
x0
NumberThe position of the first point defining the line that defines the gradient direction and size.
-
y0
NumberThe position of the first point defining the line that defines the gradient direction and size.
-
x1
NumberThe position of the second point defining the line that defines the gradient direction and size.
-
y1
NumberThe position of the second point defining the line that defines the gradient direction and size.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
beginLinearGradientStroke
-
colors
-
ratios
-
x0
-
y0
-
x1
-
y1
Begins a linear gradient stroke defined by the line (x0, y0) to (x1, y1). This ends the current sub-path. For example, the following code defines a black to white vertical gradient ranging from 20px to 120px, and draws a square to display it:
myGraphics.setStrokeStyle(10).
beginLinearGradientStroke(["#000","#FFF"], [0, 1], 0, 20, 0, 120).drawRect(20, 20, 120, 120);
A tiny API method "ls" also exists.
Parameters:
-
colors
ArrayAn array of CSS compatible color values. For example, ["#F00","#00F"] would define a gradient drawing from red to blue.
-
ratios
ArrayAn array of gradient positions which correspond to the colors. For example, [0.1, 0.9] would draw the first color to 10% then interpolating to the second color at 90%.
-
x0
NumberThe position of the first point defining the line that defines the gradient direction and size.
-
y0
NumberThe position of the first point defining the line that defines the gradient direction and size.
-
x1
NumberThe position of the second point defining the line that defines the gradient direction and size.
-
y1
NumberThe position of the second point defining the line that defines the gradient direction and size.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
beginRadialGradientFill
-
colors
-
ratios
-
x0
-
y0
-
r0
-
x1
-
y1
-
r1
Begins a radial gradient fill. This ends the current sub-path. For example, the following code defines a red to blue radial gradient centered at (100, 100), with a radius of 50, and draws a circle to display it:
myGraphics.beginRadialGradientFill(["#F00","#00F"], [0, 1], 100, 100, 0, 100, 100, 50).drawCircle(100, 100, 50);
A tiny API method "rf" also exists.
Parameters:
-
colors
ArrayAn array of CSS compatible color values. For example, ["#F00","#00F"] would define a gradient drawing from red to blue.
-
ratios
ArrayAn array of gradient positions which correspond to the colors. For example, [0.1, 0.9] would draw the first color to 10% then interpolating to the second color at 90%.
-
x0
NumberCenter position of the inner circle that defines the gradient.
-
y0
NumberCenter position of the inner circle that defines the gradient.
-
r0
NumberRadius of the inner circle that defines the gradient.
-
x1
NumberCenter position of the outer circle that defines the gradient.
-
y1
NumberCenter position of the outer circle that defines the gradient.
-
r1
NumberRadius of the outer circle that defines the gradient.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
beginRadialGradientStroke
-
colors
-
ratios
-
x0
-
y0
-
r0
-
x1
-
y1
-
r1
Begins a radial gradient stroke. This ends the current sub-path. For example, the following code defines a red to blue radial gradient centered at (100, 100), with a radius of 50, and draws a rectangle to display it:
myGraphics.setStrokeStyle(10)
.beginRadialGradientStroke(["#F00","#00F"], [0, 1], 100, 100, 0, 100, 100, 50)
.drawRect(50, 90, 150, 110);
A tiny API method "rs" also exists.
Parameters:
-
colors
ArrayAn array of CSS compatible color values. For example, ["#F00","#00F"] would define a gradient drawing from red to blue.
-
ratios
ArrayAn array of gradient positions which correspond to the colors. For example, [0.1, 0.9] would draw the first color to 10% then interpolating to the second color at 90%, then draw the second color to 100%.
-
x0
NumberCenter position of the inner circle that defines the gradient.
-
y0
NumberCenter position of the inner circle that defines the gradient.
-
r0
NumberRadius of the inner circle that defines the gradient.
-
x1
NumberCenter position of the outer circle that defines the gradient.
-
y1
NumberCenter position of the outer circle that defines the gradient.
-
r1
NumberRadius of the outer circle that defines the gradient.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
beginStroke
-
color
Begins a stroke with the specified color. This ends the current sub-path. A tiny API method "s" also exists.
Parameters:
-
color
StringA CSS compatible color value (ex. "#FF0000", "red", or "rgba(255,0,0,0.5)"). Setting to null will result in no stroke.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
bezierCurveTo
-
cp1x
-
cp1y
-
cp2x
-
cp2y
-
x
-
y
Draws a bezier curve from the current drawing point to (x, y) using the control points (cp1x, cp1y) and (cp2x, cp2y). For detailed information, read the whatwg spec. A tiny API method "bt" also exists.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
bf
()
protected
bs
()
protected
bt
()
protected
c
()
protected
clear
()
Graphics
Clears all drawing instructions, effectively resetting this Graphics instance. Any line and fill styles will need to be redefined to draw shapes following a clear call. A tiny API method "c" also exists.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
clone
()
Graphics
Returns a clone of this Graphics instance.
Returns:
A clone of the current Graphics instance.
closePath
()
Graphics
Closes the current path, effectively drawing a line from the current drawing point to the first drawing point specified since the fill or stroke was last set. A tiny API method "cp" also exists.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
cp
()
protected
curveTo
()
Maps the familiar ActionScript curveTo()
method to the functionally similar quadraticCurveTo
method.
dc
()
protected
de
()
protected
decodePath
-
str
Decodes a compact encoded path string into a series of draw instructions. This format is not intended to be human readable, and is meant for use by authoring tools. The format uses a base64 character set, with each character representing 6 bits, to define a series of draw commands.
Each command is comprised of a single "header" character followed by a variable number of alternating x and y position values. Reading the header bits from left to right (most to least significant): bits 1 to 3 specify the type of operation (0-moveTo, 1-lineTo, 2-quadraticCurveTo, 3-bezierCurveTo, 4-closePath, 5-7 unused). Bit 4 indicates whether position values use 12 bits (2 characters) or 18 bits (3 characters), with a one indicating the latter. Bits 5 and 6 are currently unused.
Following the header is a series of 0 (closePath), 2 (moveTo, lineTo), 4 (quadraticCurveTo), or 6 (bezierCurveTo) parameters. These parameters are alternating x/y positions represented by 2 or 3 characters (as indicated by the 4th bit in the command char). These characters consist of a 1 bit sign (1 is negative, 0 is positive), followed by an 11 (2 char) or 17 (3 char) bit integer value. All position values are in tenths of a pixel. Except in the case of move operations which are absolute, this value is a delta from the previous x or y position (as appropriate).
For example, the string "A3cAAMAu4AAA" represents a line starting at -150,0 and ending at 150,0.
A - bits 000000. First 3 bits (000) indicate a moveTo operation. 4th bit (0) indicates 2 chars per
parameter.
n0 -<PHONE_NUMBER>00. Absolute x position of -150.0px. First bit indicates a negative value, remaining bits
indicate 1500 tenths of a pixel.
AA -<PHONE_NUMBER>00. Absolute y position of 0.
I - 001100. First 3 bits (001) indicate a lineTo operation. 4th bit (1) indicates 3 chars per parameter.
Au4 -<PHONE_NUMBER>10111000. An x delta of 300.0px, which is added to the previous x value of -150.0px to
provide an absolute position of +150.0px.
AAA -<PHONE_NUMBER>00000000. A y delta value of 0.
A tiny API method "p" also exists.
Parameters:
-
str
StringThe path string to decode.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
dp
()
protected
dr
()
protected
draw
-
ctx
Draws the display object into the specified context ignoring its visible, alpha, shadow, and transform. Returns true if the draw was handled (useful for overriding functionality).
NOTE: This method is mainly for internal use, though it may be useful for advanced uses.
Parameters:
-
ctx
CanvasRenderingContext2DThe canvas 2D context object to draw into.
drawAsPath
-
ctx
Draws only the path described for this Graphics instance, skipping any non-path instructions, including fill and
stroke descriptions. Used for DisplayObject.mask
to draw the clipping path, for example.
Parameters:
-
ctx
CanvasRenderingContext2DThe canvas 2D context object to draw into.
drawCircle
-
x
-
y
-
radius
Draws a circle with the specified radius at (x, y).
var g = new createjs.Graphics();
g.setStrokeStyle(1);
g.beginStroke(createjs.Graphics.getRGB(0,0,0));
g.beginFill(createjs.Graphics.getRGB(255,0,0));
g.drawCircle(0,0,3);
var s = new createjs.Shape(g);
s.x = 100;
s.y = 100;
stage.addChild(s);
stage.update();
A tiny API method "dc" also exists.
Parameters:
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
drawEllipse
-
x
-
y
-
w
-
h
Draws an ellipse (oval) with a specified width (w) and height (h). Similar to drawCircle, except the width and height can be different. A tiny API method "de" also exists.
Parameters:
-
x
NumberThe left coordinate point of the ellipse. Note that this is different from drawCircle which draws from center.
-
y
NumberThe top coordinate point of the ellipse. Note that this is different from drawCircle which draws from the center.
-
w
NumberThe height (horizontal diameter) of the ellipse. The horizontal radius will be half of this number.
-
h
NumberThe width (vertical diameter) of the ellipse. The vertical radius will be half of this number.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
drawPolyStar
-
x
-
y
-
radius
-
sides
-
pointSize
-
angle
Draws a star if pointSize is greater than 0, or a regular polygon if pointSize is 0 with the specified number of points. For example, the following code will draw a familiar 5 pointed star shape centered at 100, 100 and with a radius of 50:
myGraphics.beginFill("#FF0").drawPolyStar(100, 100, 50, 5, 0.6, -90);
// Note: -90 makes the first point vertical
A tiny API method "dp" also exists.
Parameters:
-
x
NumberPosition of the center of the shape.
-
y
NumberPosition of the center of the shape.
-
radius
NumberThe outer radius of the shape.
-
sides
NumberThe number of points on the star or sides on the polygon.
-
pointSize
NumberThe depth or "pointy-ness" of the star points. A pointSize of 0 will draw a regular polygon (no points), a pointSize of 1 will draw nothing because the points are infinitely pointy.
-
angle
NumberThe angle of the first point / corner. For example a value of 0 will draw the first point directly to the right of the center.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
drawRect
()
Maps the familiar ActionScript drawRect()
method to the functionally similar rect
method.
drawRoundRect
-
x
-
y
-
w
-
h
-
radius
Draws a rounded rectangle with all corners with the specified radius.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
drawRoundRectComplex
-
x
-
y
-
w
-
h
-
radiusTL
-
radiusTR
-
radiusBR
-
radiusBL
Draws a rounded rectangle with different corner radii. Supports positive and negative corner radii. A tiny API method "rc" also exists.
Parameters:
-
x
NumberThe horizontal coordinate to draw the round rect.
-
y
NumberThe vertical coordinate to draw the round rect.
-
w
NumberThe width of the round rect.
-
h
NumberThe height of the round rect.
-
radiusTL
NumberTop left corner radius.
-
radiusTR
NumberTop right corner radius.
-
radiusBR
NumberBottom right corner radius.
-
radiusBL
NumberBottom left corner radius.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
ef
()
protected
endFill
()
Graphics
Ends the current sub-path, and begins a new one with no fill. Functionally identical to beginFill(null)
.
A tiny API method "ef" also exists.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
endStroke
()
Graphics
Ends the current sub-path, and begins a new one with no stroke. Functionally identical to beginStroke(null)
.
A tiny API method "es" also exists.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
es
()
protected
f
()
protected
getHSL
-
hue
-
saturation
-
lightness
-
[alpha]
Returns a CSS compatible color string based on the specified HSL numeric color values in the format "hsla(360,100,100,1.0)", or if alpha is null then in the format "hsl(360,100,100)".
createjs.Graphics.getHSL(150, 100, 70);
// Returns "hsl(150,100,70)"
Parameters:
-
hue
NumberThe hue component for the color, between 0 and 360.
-
saturation
NumberThe saturation component for the color, between 0 and 100.
-
lightness
NumberThe lightness component for the color, between 0 and 100.
-
[alpha]
Number optionalThe alpha component for the color where 0 is fully transparent and 1 is fully opaque.
Returns:
A CSS compatible color string based on the specified HSL numeric color values in the format "hsla(360,100,100,1.0)", or if alpha is null then in the format "hsl(360,100,100)".
getRGB
-
r
-
g
-
b
-
[alpha]
Returns a CSS compatible color string based on the specified RGB numeric color values in the format "rgba(255,255,255,1.0)", or if alpha is null then in the format "rgb(255,255,255)". For example,
createjs.Graphics.getRGB(50, 100, 150, 0.5);
// Returns "rgba(50,100,150,0.5)"
It also supports passing a single hex color value as the first param, and an optional alpha value as the second param. For example,
createjs.Graphics.getRGB(0xFF00FF, 0.2);
// Returns "rgba(255,0,255,0.2)"
Parameters:
-
r
NumberThe red component for the color, between 0 and 0xFF (255).
-
g
NumberThe green component for the color, between 0 and 0xFF (255).
-
b
NumberThe blue component for the color, between 0 and 0xFF (255).
-
[alpha]
Number optionalThe alpha component for the color where 0 is fully transparent and 1 is fully opaque.
Returns:
A CSS compatible color string based on the specified RGB numeric color values in the format "rgba(255,255,255,1.0)", or if alpha is null then in the format "rgb(255,255,255)".
initialize
()
protected
Initialization method.
inject
-
callback
-
data
Provides a method for injecting arbitrary Context2D (aka Canvas) API calls into a Graphics queue. The specified callback function will be called in sequence with other drawing instructions. The callback will be executed in the scope of the target canvas's Context2D object, and will be passed the data object as a parameter.
This is an advanced feature. It can allow for powerful functionality, like injecting output from tools that export Context2D instructions, executing raw canvas calls within the context of the display list, or dynamically modifying colors or stroke styles within a Graphics instance over time, but it is not intended for general use.
Within a Graphics queue, each path begins by applying the fill and stroke styles and settings, followed by drawing instructions, followed by the fill() and/or stroke() commands. This means that within a path, inject() can update the fill & stroke styles, but for it to be applied in a predictable manner, you must have begun a fill or stroke (as appropriate) normally via the Graphics API. For example:
function setColor(color) {
this.fillStyle = color;
}
// this will not draw anything - no fill was begun, so fill() is not called:
myGraphics.inject(setColor, "red").drawRect(0,0,100,100);
// this will draw the rect in green:
myGraphics.beginFill("#000").inject(setColor, "green").drawRect(0,0,100,100);
// this will draw both rects in blue, because there is only a single path
// so the second inject overwrites the first:
myGraphics.beginFill("#000").inject(setColor, "green").drawRect(0,0,100,100)
.inject(setColor, "blue").drawRect(100,0,100,100);
// this will draw the first rect in green, and the second in blue:
myGraphics.beginFill("#000").inject(setColor, "green").drawRect(0,0,100,100)
.beginFill("#000").inject(setColor, "blue").drawRect(100,0,100,100);
Parameters:
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
isEmpty
()
Boolean
Returns true if this Graphics instance has no drawing commands.
Returns:
Returns true if this Graphics instance has no drawing commands.
lf
()
protected
lineTo
-
x
-
y
Draws a line from the current drawing point to the specified position, which become the new current drawing point. A tiny API method "lt" also exists.
For detailed information, read the whatwg spec.
Parameters:
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
ls
()
protected
lt
()
protected
moveTo
-
x
-
y
Moves the drawing point to the specified position. A tiny API method "mt" also exists.
Parameters:
Returns:
The Graphics instance the method is called on (useful for chaining calls).
mt
()
protected
p
()
protected
qt
()
protected
quadraticCurveTo
-
cpx
-
cpy
-
x
-
y
Draws a quadratic curve from the current drawing point to (x, y) using the control point (cpx, cpy). For detailed information, read the whatwg spec. A tiny API method "qt" also exists.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
r
()
protected
rc
()
protected
rect
-
x
-
y
-
w
-
h
Draws a rectangle at (x, y) with the specified width and height using the current fill and/or stroke. For detailed information, read the whatwg spec. A tiny API method "r" also exists.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
rf
()
protected
rr
()
protected
rs
()
protected
s
()
protected
setStrokeStyle
-
thickness
-
[caps=0]
-
[joints=0]
-
[miterLimit=10]
-
[ignoreScale=false]
Sets the stroke style for the current sub-path. Like all drawing methods, this can be chained, so you can define the stroke style and color in a single line of code like so:
myGraphics.setStrokeStyle(8,"round").beginStroke("#F00");
A tiny API method "ss" also exists.
Parameters:
-
thickness
NumberThe width of the stroke.
-
[caps=0]
String | Number optionalIndicates the type of caps to use at the end of lines. One of butt, round, or square. Defaults to "butt". Also accepts the values 0 (butt), 1 (round), and 2 (square) for use with the tiny API.
-
[joints=0]
String | Number optionalSpecifies the type of joints that should be used where two lines meet. One of bevel, round, or miter. Defaults to "miter". Also accepts the values 0 (miter), 1 (round), and 2 (bevel) for use with the tiny API.
-
[miterLimit=10]
Number optionalIf joints is set to "miter", then you can specify a miter limit ratio which controls at what point a mitered joint will be clipped.
-
[ignoreScale=false]
Boolean optionalIf true, the stroke will be drawn at the specified thickness regardless of active transformations.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
ss
()
protected
Properties
_ctx
CanvasRenderingContext2D
protected
static
Command
Function
static
Exposes the Command class used internally by Graphics. Useful for extending the Graphics class or injecting functionality.
STROKE_CAPS_MAP
Array
final
static
Maps numeric values for the caps parameter of setStrokeStyle to corresponding string values. This is primarily for use with the tiny API. The mappings are as follows: 0 to "butt", 1 to "round", and 2 to "square". For example, to set the line caps to "square":
myGraphics.ss(16, 2);
STROKE_JOINTS_MAP
Array
final
static
Maps numeric values for the joints parameter of setStrokeStyle to corresponding string values. This is primarily for use with the tiny API. The mappings are as follows: 0 to "miter", 1 to "round", and 2 to "bevel". For example, to set the line joints to "bevel":
myGraphics.ss(16, 0, 2);


This carousel-example is created for your inspiration, you may use it for free in all of your projects. If you like it, please help me "keep up the good work" and donate.


Description
Hexagon is a frenetic action game where you control a small triangle that orbits the hexagon in the middle of the screen. Various shapes and line segments fall toward the hexagon, and it's your job to avoid them in order to continue. It was developed in 2012 by the Irish video game designer Terry Cavanagh in the short span of one morning for the GDC Pirate Kart V, a two-day event in which hundreds of programmers around the world attempt and create as many games as humanly in 48 hours. The whole experience is set to a phenomenal chiptune track courtesy of Chipzel.