| Home | Trees | Indices | Help |
|---|
|
|
A model can be updated or not. Make sure updates can be switched on and off.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from |
|
|||
|
Inherited from |
|
x.__init__(...) initializes x; see help(type(x)) for signature
|
Get or set, whether automatic updates are performed. When updates are off, the model might be in a non-working state. To make the model work turn updates on again. :param bool|None updates: bool: whether to do updates None: get the current update state |
Update the model from the current state. Make sure that updates are on, otherwise this method will do nothing :param bool trigger_parent: Whether to trigger the parent, after self has updated |
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Tue Jul 4 11:59:41 2017 | http://epydoc.sourceforge.net |


Preparation time
less than 30 mins
Cooking time
10 to 30 mins
Serves
Serves 4
Preheat the oven to 210C/410F/Gas 7.
Season the pork fillet and brush with honey.
Heat a frying pan until hot and add the butter. When foaming, add the pork. Sear on each side until golden brown.
Place in the oven and cook for 8-10 minutes until just cooked through - juices will run clear when pierced when the pork is cooked.
Remove from the oven and rest for five minutes.
To make the rösti, grate the potatoes and apple on a large grater into a tea towel.
Twist the tea towel around and squeeze out any water and starch.
Place the dry potato mix into a bowl and add the créme fraîche and egg yolks.
Season with salt and freshly ground black pepper.
Fill a 8cm/3in chefs' ring halfway with the potato mix. Place a prune on top.
Fill to the top with the remaining potato mix and press down firmly.
Heat a frying pan until hot and add the butter. Place the rösti into the pan. Remove the ring and cook the rösti for 2-3 minutes on either side until golden brown and crisp.
Serve the rösti with the sliced pork fillet.


OpenEJB now has support for EJB 2.0 Local Interfaces. This is very nice for when OpenEJB is combined with Tomcat or embedded in another application where Remote interfaces are not always needed. See the "Moviefun" example in the source or binary distributions for how to use them. Note that no other EJB 2.0 features (such as CMP 2 or MDBs) are supported in the OpenEJB 1.x codebase.
Collapsed EAR s are an OpenEJB invention allowing you to combine your ejbs and servlets in the same archive and classloader. This is essentially a new way to embed OpenEJB into Tomcat so that OpenEJB and your EJBs are loaded only into your webapp. Combine this with an embedded database and you have a complete mini-J2EE environment that can be hosted in your Tomcat webapp space.
See the "Moviefun" example in the distribution which will be online for a short while here:
http://demo1.openejb.org/moviefun
(visit http://demo1.openejb.org/moviefun/setup.jsp to reset)
It is now possible to deploy and run EJB apps that are not in a *.jar archive. For example, for ejb app located at:
/home/jsmith/myejbapp/META-INF/ejb-jar.xml
Simply add a Deployments declaration to the openejb.conf like the following:
<Deployment dir="/home/jsmith/myejbapp" />
In OpenEJB 1.0 beta1, the use of openejb-jar.xml is not required for ejb-jar.xml files that do not contain CMP EntityBeans or ejbs with multiple datasource references.
The speed of the Remote Server has been improved tremendously to compensate for differing default parameters for TCP Socket creation and closing in the Mac OSX Java VM. This makes sequential calls from a Remote Client to the Server several times faster.
In 0.9.2 and before, the JDO database was using the private JNDI namespace of the very first CMP accessed to grab a datasource and hold onto it for use on all requests into the CMP container. This was configured with something like this:
<database name="Global_TX_Database" engine="instantdb">
<jndi name="java:comp/env/jdbc/basic/entityDatabase" />
<mapping href="conf/default.cmp_mapping.xml" />
</database>
This was just wrong. We've switched it so that the "jndi" tag of a Castor database.xml file can be set directly to the global JNDI name of a Connector element declared in an openejb.conf file.
<database name="Global_TX_Database" engine="instantdb">
<jndi name="java:openejb/connector/Default JDBC Database" />
<mapping href="conf/default.cmp_mapping.xml" />
</database>
This is still not so optimal as we do not want to people using OpenEJB's internal jndi and encourage people to become dependent on it. Newer releases of Castor allow for a completely programmatic way to configure a JDO database. In future releases, these global and local database files will go away all together! You will only need to specify your mapping.xml and will be able to pack it in your ejb jar.
In 0.9.2 all EJBs were added to the same classloader as the Containers, Server and all the other EJBs. In 1.0 beta1, all the EJBs are still in the same classloader, but one that is a child of the Container and Server. The code to keep each EJB jar in it's own classloader does exist, but limitations in the way we configure the CMP container with Castor prevent us from using it. When the CMP change made above is fixed, we will support separate classloaders for each EJB jar as an option.


Collector Marsha:
One more round, what do you say? Uh oh, what is this? I'm out of Nebulite Orbs! Come back when I've had time to gather some more.


Dasynq manual
This is the manual for the Dasynq event loop library.- Introduction
- Reference
Introduction
An event loop library provides a means for waiting on events that occur asynchronously. One good example is network input/output; in a server with multiple client connections, a mechanism is needed to wait until data is available, or until it is possible to write data, to one or more of the current connections (and to be able to identify which connections are ready). Dasynq is a multi-platform, thread-safe C++ library which provides such functionality.
Note that an event loop generally supports managing various different kinds of event. Dasynq can be used for detecting:
- read/write readiness on sockets, pipes, and certain devices including terminals and serial lies;
- connections to listening sockets;
- reception of POSIX signals (such as SIGTERM); and
- child process status notifications (termination etc).
Dasynq is fully thread safe, allowing events to be polled and processed on any thread. There are some limitations on the use the Dasynq API in a multi-threaded application. However, when used in a single-thread application, the API is just about as straight-forward as the API of most other event loop libraries.
Dasynq is also intended to allow development of extremely robust client applications. Where possible, it allows pre-allocation of resources to prevent allocation failures from occurring at inopportune moments during program execution.


export type Fiber = {|
// These first fields are conceptually members of an Instance. This used to
// be split into a separate type and intersected with the other Fiber fields,
// but until Flow fixes its intersection bugs, we've merged them into a
// single type.
// An Instance is shared between all versions of a component. We can easily
// break this out into a separate object to avoid copying so much to the
// alternate versions of the tree. We put this on a single object for now to
// minimize the number of objects created during the initial render.
// Tag identifying the type of fiber.
tag: TypeOfWork,
// Unique identifier of this child.
key: null | string,
// The function/class/module associated with this fiber.
type: any,
// The local state associated with this fiber.
stateNode: any,
// Conceptual aliases
// parent : Instance -> return The parent happens to be the same as the
// return fiber since we've merged the fiber and instance.
// Remaining fields belong to Fiber
// The Fiber to return to after finishing processing this one.
// This is effectively the parent, but there can be multiple parents (two)
// so this is only the parent of the thing we're currently processing.
// It is conceptually the same as the return address of a stack frame.
return: Fiber | null,
// Singly Linked List Tree Structure.
child: Fiber | null,
sibling: Fiber | null,
index: number,
// The ref last used to attach this node.
// I'll avoid adding an owner field for prod and model that as functions.
ref: null | (((handle: mixed) => void) & {_stringRef: ?string}),
// Input is the data coming into process this fiber. Arguments. Props.
pendingProps: any, // This type will be more specific once we overload the tag.
memoizedProps: any, // The props used to create the output.
// A queue of state updates and callbacks.
updateQueue: UpdateQueue | null,
// The state used to create the output
memoizedState: any,
// Bitfield that describes properties about the fiber and its subtree. E.g.
// the AsyncUpdates flag indicates whether the subtree should be async-by-
// default. When a fiber is created, it inherits the internalContextTag of its
// parent. Additional flags can be set at creation time, but after than the
// value should remain unchanged throughout the fiber's lifetime, particularly
// before its child fibers are created.
internalContextTag: TypeOfInternalContext,
// Effect
effectTag: TypeOfSideEffect,
// Singly linked list fast path to the next fiber with side-effects.
nextEffect: Fiber | null,
// The first and last fiber with side-effect within this subtree. This allows
// us to reuse a slice of the linked list when we reuse the work done within
// this fiber.
firstEffect: Fiber | null,
lastEffect: Fiber | null,
// This will be used to quickly determine if a subtree has no pending changes.
pendingWorkPriority: PriorityLevel,
// This is a pooled version of a Fiber. Every fiber that gets updated will
// eventually have a pair. There are cases when we can clean up pairs to save
// memory if we need to.
alternate: Fiber | null,
// Conceptual aliases
// workInProgress : Fiber -> alternate The alternate used for reuse happens
// to be the same as work in progress.
// __DEV__ only
_debugID?: DebugID,
_debugSource?: Source | null,
_debugOwner?: Fiber | ReactInstance | null, // Stack compatible
_debugIsCurrentlyTiming?: boolean,
|};


Box'D
Box'd is a 2D plaformer game where the player is a ball with eyes and life.The goal is to collect coins from the outside world to make a living, get strong and get along the journey.
Home


Like the unix which
utility.
Finds the first instance of a specified executable in the PATH
environment variable. Does not cache the results, so hash -r
is not
needed when the PATH changes.
var which = require('which')
// async usage
which('node', function (er, resolvedPath) {
// er is returned if no "node" is found on the PATH
// if it is found, then the absolute path to the exec is returned
})
// sync usage
// throws if not found
var resolved = which.sync('node')
// if nothrow option is used, returns null if not found
resolved = which.sync('node', {nothrow: true})
// Pass options to override the PATH and PATHEXT environment vars.
which('node', { path: someOtherPath }, function (er, resolved) {
if (er)
throw er
console.log('found at %j', resolved)
})
Same as the BSD which(1)
binary.
usage: which [-as] program ...
You may pass an options object as the second argument.
path
: Use instead of the PATH
environment variable.pathExt
: Use instead of the PATHEXT
environment variable.all
: Return all matches, instead of just the first one. Note that
this means the function returns an array of strings instead of a
single string.


Select a sample from the list below...
... or just drag'n'drop your MusicXML file on this page.
Current width: ???px
Zoom factor: ???%
Zoom controls:
Cursor controls:


Just as in-memory “databases” like Redis sound like a bad idea, but turn out to be really useful because we recognize that (1) we have lots of memory and (2) many applications do not need to store that much hot data anyway. It is important to realize that times are changing, constraints have to be revisited and when the right tradeoffs are made, we can have a game changer. We have to dare to think different.
Similarly, PHP, Ruby on rails, Node.js seems inefficient for server code, compared to compiled languages like Go, but in practice, most of the workload is IO bound, and the interpreter overhead is insignificant. Node.js takes this assumption even further by using event loops and callbacks to avoid having tons of threads with huge overhead, all waiting for IO tasks to be completed.
Using only callbacks to achieve concurrency is nice, but this code style is not palatable. Search for callback hells. Since then, we have made many attempts to improve the code style. We have seen libraries like async:
async.waterfall([
function(callback) {
callback(null, 'one', 'two');
},
function(arg1, arg2, callback) {
// arg1 now equals 'one' and arg2 now equals 'two'
callback(null, 'three');
},
function(arg1, callback) {
// arg1 now equals 'three'
callback(null, 'done');
}
], function (err, result) {
// result now equals 'done'
});
async.waterfall([
myFirstFunction,
mySecondFunction,
myLastFunction,
], function (err, result) {
// result now equals 'done'
});
This looks better but is still awkward. Ideally, the code should look as if it is synchronous. It should look as close as possible to:
const x = myFirstFunction();
const y = mySecondFunction(x);
const z = myLastFunction(y);
A better style is with promise chaining:
myFirstFunction()
.then(mySecondFunction)
.then(myLastFunction);
This looks slightly neater than using async.waterfall
, but still forces you to split your code into blocks whenever you need to call an asynchronous function. Each block has to be moved into a function, anonymous or not.
To me, the current best way is with the new async-await. The code will look synchronous:
const delay = (ms, result) =>
new Promise(resolve => setTimeout(() => resolve(result), ms));
async function delays() {
let a = await delay(800, "Hello, I'm in an");
console.log(a);
let b = await delay(400, "async function!");
console.log(b);
}
delays();
Previously, using promise chaining, you would need something like this:
delay(800, "Hello, I'm in an")
.then((a) => {
console.log(a);
return delay(400, "async function!");
})
.then((b) => {
console.log(b);
});
The async-await style allows you to work with promises in a more natural way. Old async functions using callbacks can also be turned into functions that returns a promise via util.promisify
.
Finally, error handling is also easier with async-await than previous approaches. We shall not go into that.


Chinese woman sentenced to 8 months for Mar-a-Lago trespass
by Associated PressFORT LAUDERDALE, Fla. (AP) — A federal judge has sentenced a Chinese businesswoman to eight months in prison for trespassing at President Donald Trump’s Mar-a-Lago club and lying to Secret Service agents.
Judge Roy Altman also ordered Monday that 33-year-old Yujing Zhang be deported after completing her sentence. She received nearly eight months credit because she has been jailed since her arrest March 30, so she has about one more week to serve.
Altman said it was a “serious offense” to trespass on a government property, particularly one where the president is staying.
Assistant U.S. Attorney Rolando Garcia argued for an 18-month sentence, saying Zhang “lied to everybody” to get into Mar-a-Lago including Secret Service agents, the club’s receptionist and even her taxi driver. Garcia also pointed to the electronics found on her person and in her hotel.


My name is Camila.
I am a programer and designer looking to make a beautiful impact on the world of technology.
+ read more
Or read what I'm learning today
Code guide by mdo
The Unicorn Workflow
Asana’s Rebrand
I'm currently looking for Front End Developement, Javascript, Game Development, or charity work.
If you know of any relevant jobs please get in touch.
<EMAIL_ADDRESS>Codepen
Linked In Profile


Half of and a Half
问题描述 :
Gardon bought many many chocolates from the A Chocolate Market (ACM). When he was on the way to meet Angel, he met Speakless by accident.
“Ah, so many delicious chocolates! I’ll get half of them and a half!” Speakless said.
Gardon went on his way, but soon he met YZG1984 by accident….
“Ah, so many delicious chocolates! I’ll get half of them and a half!” YZG1984 said.
Gardon went on his way, but soon he met Doramon by accident….
“Ah, so many delicious chocolates! I’ll get half of them and a half!” Doramon said.
Gardon went on his way, but soon he met JGShining by accident….
“Ah, so many delicious chocolates! I’ll get half of them and a half!” JGShining said.
.
.
.
After had had met N people , Gardon finally met Angel. He gave her half of the rest and a half, then Gardon have none for himself. Could you tell how many chocolates did he bought from ACM?
“Ah, so many delicious chocolates! I’ll get half of them and a half!” Speakless said.
Gardon went on his way, but soon he met YZG1984 by accident….
“Ah, so many delicious chocolates! I’ll get half of them and a half!” YZG1984 said.
Gardon went on his way, but soon he met Doramon by accident….
“Ah, so many delicious chocolates! I’ll get half of them and a half!” Doramon said.
Gardon went on his way, but soon he met JGShining by accident….
“Ah, so many delicious chocolates! I’ll get half of them and a half!” JGShining said.
.
.
.
After had had met N people , Gardon finally met Angel. He gave her half of the rest and a half, then Gardon have none for himself. Could you tell how many chocolates did he bought from ACM?
输入:
Input contains many test cases.
Each case have a integer N, represents the number of people Gardon met except Angel. N will never exceed 1000;
Each case have a integer N, represents the number of people Gardon met except Angel. N will never exceed 1000;
输出:
For every N inputed, tell how many chocolates Gardon had at first.
样例输入:
2
样例输出:
7
很水的一道题！题目很优美！
大数！！！！
#include<stdio.h> #include<string.h> int num[1010][1010]; int main() { int i,n,j; memset(num,0,sizeof(num)); num[0][1]=1; for(i=1;i<1010;i++) { for(j=1;j<1010;j++) { if(j==1) num[i][j]+=(num[i-1][j])*2+1; else num[i][j]+=num[i-1][j]*2; } for(j=2;j<1010;j++) { if(num[i][j-1]>9) num[i][j]+=num[i][j-1]/10; num[i][j-1]%=10; } } while(scanf("%d",&n)!=EOF) { for(i=1010;i>=1;i--) if(num[n][i]!=0) { printf("%d",num[n][i]); break; } for(j=i-1;j>=1;j--) printf("%d",num[n][j]); printf("\n"); } return 0; }
转自：http://blog.csdn.net/u011518888/article/details/9890891
(adsbygoogle = window.adsbygoogle || []).push({});
爱死孙小迷了！
爱死孙小迷了！
爱死孙小迷了！
爱死孙小迷了！
爱死孙小迷了！
爱死孙小迷了！
爱死孙小迷了！
爱死孙小迷了！
算法，他认识我，我不认识他，后来有人告诉我你写的这段代码就是XXX算法。。。
不错，赞一个！
2的64次方是多少？ 这到底是在考什么啊
看见的晚了，只能提交一次唉
This write-up presents the gentle in which we can notice the fact. this is extremely wonderful one and gives in depth info.
秒！~
很好的思路，可以借鉴
其实国内大部分公司对算法都不够重视。特别是中小型公司老板根本都不懂技术，也不懂什么是算法，从而也不要求程序员懂什么算法，做程序从来不考虑性能问题，只要页面能显示出来就是好程序，这是国内的现状，很无奈。
第二个方法挺不错。NewHead代表新的头节点，通过递归找到最后一个节点之后，就把这个节点赋给NewHead，然后一直返回返回，中途这个值是没有变化的，一边返回一边把相应的指针方向颠倒，最后结束时返回新的头节点到主函数。
不考虑最后将结果排序的话，快排的时间复杂度是O(N) ，而堆排的是O(N*logK)
给力！
第一段代码中：
next = next ;
明显不对吧，应该是 next =j;才对
这个方法是错的，不信你试试：
20 5
1 A:9
1 A:9
1 A:9
1 A:6
1 A:4
正确答案应该是19，这个答案是18
map[nodes .index][nodes .index] == 0 就是判断不相邻的。这个是可以证明的。


Module plasmid_assessor.Assessment
View Source
import re
import matplotlib.pyplot as plt
import Bio
import Bio.Restriction
from Bio.Seq import Seq
from Bio.SeqFeature import SeqFeature, FeatureLocation
import dnacauldron as dc
try:
from dna_features_viewer import BiopythonTranslator
except ImportError:
class AssessmentTranslator:
"""Please install dna_features_viewer to use this class."""
def __init__(self):
raise Exception("Please install dna_features_viewer to use this class.")
else:
class AssessmentTranslator(BiopythonTranslator):
"""Custom translator for highlighting key features."""
def compute_feature_color(self, feature):
assessment_ref = "plasmid_assessment"
if assessment_ref in feature.qualifiers:
if feature.qualifiers[assessment_ref] == "enzyme":
return "red"
elif feature.qualifiers[assessment_ref] == "excised":
return "yellow"
elif feature.qualifiers[assessment_ref] == "backbone":
return "tab:cyan"
else:
return "tab:blue" # default dna_features_viewer color
else:
return "tab:blue"
class Assessment:
"""The plasmid assessment class.
**Parameters**
**record**
> A Biopython `SeqRecord`.
**enzyme**
> A restriction enzyme (`str`). A Biopython `RestrictionType` will be looked
up using the string.
"""
UNKNOWN_IDS = [
"None",
"",
"<unknown id>",
".",
"EXPORTED",
"<unknown name>",
"Exported",
]
def __init__(self, record, enzyme):
self.record = record
self.enzyme = Bio.Restriction.__dict__[enzyme]
self.enzyme_name = str(self.enzyme)
self.results = {}
def assess_plasmid(self, other_enzymes=None):
"""Evaluate plasmid for Golden Gate.
**Parameters**
**other_enzymes**
> List of enzymes used in higher level assemblies (`list`).
"""
if other_enzymes:
self.other_enzymes = ", ".join([str(enz) for enz in other_enzymes])
self.add_name()
self.check_circularity()
self.get_number_of_sites()
self.evaluate_orientation()
self.digest_plasmid()
self.count_other_sites(other_enzymes)
self.check_enzyme_site_locations()
self.sum_results()
self.plot_plasmid()
def add_name(self):
"""Set a name for the assessment."""
# To display on the report:
if str(self.record.id).strip() in self.UNKNOWN_IDS:
self.name = "Unnamed plasmid"
else:
if len(self.record.id) > 16: # Genbank limit, also for width in report
self.name = self.record.id[:16] + "..."
else:
self.name = self.record.id
def check_circularity(self):
if "topology" not in self.record.annotations:
self.results["is_circular"] = False
elif self.record.annotations["topology"] == "circular":
self.results["is_circular"] = True
else:
self.results["is_circular"] = False
def get_number_of_sites(self):
if "is_circular" in self.results:
is_linear = not self.results["is_circular"]
else:
is_linear = False
restriction_batch = Bio.Restriction.RestrictionBatch([self.enzyme])
analysis = Bio.Restriction.Analysis(
restriction_batch, sequence=self.record.seq, linear=is_linear
)
self.analysis_results = analysis.full(linear=is_linear)
self.results["number_of_sites"] = len(self.analysis_results[self.enzyme])
# Add as features for plot in report:
for enzyme, sites in self.analysis_results.items():
for site in sites:
self.record.features.append(
SeqFeature(
FeatureLocation(site, site + 1),
id=str(enzyme),
type="misc_feature",
qualifiers={
"label": str(enzyme),
"plasmid_assessment": "enzyme",
},
)
)
def evaluate_orientation(self):
self.results["is_site_orientation_correct"] = False # default
# Forward strand:
self.iter_forward = [
match.end() for match in re.finditer(self.enzyme.site, str(self.record.seq))
]
if sum(1 for _ in self.iter_forward) == 1:
self.forward_enzyme = self.iter_forward[0]
# rev_complement_site = str(self.record.seq.reverse_complement())
rev_complement_site = str(Seq(self.enzyme.site).reverse_complement())
self.iter_reverse = [
m.start()
for m in re.finditer(rev_complement_site, str(self.record.seq))
]
if sum(1 for _ in self.iter_reverse) == 1: # 1 site in both strands:
self.results["is_site_orientation_correct"] = True
self.reverse_enzyme = self.iter_reverse[0]
if self.results["is_site_orientation_correct"]:
if self.reverse_enzyme < self.forward_enzyme:
self.record.features.append(
SeqFeature(
FeatureLocation(
self.reverse_enzyme - 1, self.forward_enzyme + 1
),
id=str(self.enzyme),
type="misc_feature",
qualifiers={
"label": "Excised",
"plasmid_assessment": "excised",
},
)
)
else: # put annotation together from two pieces:
self.record.features.append(
SeqFeature(
FeatureLocation(0, self.forward_enzyme + 1),
id=str(self.enzyme),
type="misc_feature",
qualifiers={
"label": "Excised",
"plasmid_assessment": "excised",
},
)
)
self.record.features.append(
SeqFeature(
FeatureLocation(self.reverse_enzyme - 1, len(self.record)),
id=str(self.enzyme),
type="misc_feature",
qualifiers={
"label": "Excised",
"plasmid_assessment": "excised",
},
)
)
def digest_plasmid(self):
# Obtain fragments and get the backbone's overhangs.
# This method has two assumptions:
# - the sequence has two, correctly oriented enzyme sites.
# - the sequence is circular.
# Therefore there will be exactly two fragments, with one containing both sites.
self.results["digest"] = {}
if not self.results["is_circular"]:
return
if not self.results["is_site_orientation_correct"]:
return
record_fragments = dc.StickyEndFragment.list_from_record_digestion(
record=self.record, enzyme=self.enzyme, linear=False
)
if self.enzyme.site in record_fragments[0].to_standard_string():
backbone_index = 1 # there are only two fragments
excise_index = 0
else:
backbone_index = 0
excise_index = 1 # reversed
self.results["digest"]["backbone_seq"] = record_fragments[backbone_index]
self.results["digest"]["excised_seq"] = record_fragments[excise_index]
self.results["digest"]["first_overhang"] = str(
record_fragments[excise_index].seq.left_end
)
self.results["digest"]["last_overhang"] = str(
record_fragments[excise_index].seq.right_end
)
def count_other_sites(self, other_enzymes):
self.results["other_sites"] = {}
self.results["other_sites"]["has_any_other_sites"] = False
if other_enzymes is None:
return
bio_enzymes = [Bio.Restriction.__dict__[enzyme] for enzyme in other_enzymes]
restriction_batch = Bio.Restriction.RestrictionBatch(bio_enzymes)
# Work with the assumption that the sequence is circular:
analysis = Bio.Restriction.Analysis(
restriction_batch, sequence=self.record.seq, linear=False
)
self.results["other_sites"]["enzyme"] = analysis.full(linear=False)
for enzyme, matches in self.results["other_sites"]["enzyme"].items():
if len(matches) != 0:
self.results["other_sites"]["has_any_other_sites"] = True
# Also add as features for plot in report:
for site in matches:
self.record.features.append(
SeqFeature(
FeatureLocation(site, site + 1),
id=str(enzyme),
type="misc_feature",
qualifiers={
"label": str(enzyme),
"plasmid_assessment": "enzyme",
},
)
)
def check_enzyme_site_locations(self):
"""Flag enzyme sites that are within the retained backbone."""
try:
self.results["other_sites"]["has_any_other_sites"]
self.results["is_site_orientation_correct"]
except KeyError:
print("Run assessment methods first!")
else:
self.sites_outside_excised_region = {}
if (
self.results["other_sites"]["has_any_other_sites"]
and self.results["is_site_orientation_correct"]
):
# if there are no other sites, no need to run:
if self.reverse_enzyme < self.forward_enzyme:
# orientation = reverse -> forward
for enzyme, sites in self.results["other_sites"]["enzyme"].items():
problem_sites = []
for site in sites:
if self.reverse_enzyme < site < self.forward_enzyme:
pass
else:
problem_sites += [str(site)]
if problem_sites != []:
self.sites_outside_excised_region[
str(enzyme)
] = problem_sites
txt = "" # for the pdf report
for (
enzyme,
problem_sites,
) in self.sites_outside_excised_region.items():
txt += enzyme + ": " + " ".join(problem_sites) + ";"
self.sites_outside_excised_region_txt = txt
else:
# orientation = forward -> reverse
for enzyme, sites in self.results["other_sites"]["enzyme"].items():
problem_sites = []
for site in sites:
if self.forward_enzyme < site < self.reverse_enzyme:
# in this case the site is within the retained backbone
problem_sites += [str(site)]
if problem_sites != []:
self.sites_outside_excised_region[
str(enzyme)
] = problem_sites
txt = "" # for the pdf report
for (
enzyme,
problem_sites,
) in self.sites_outside_excised_region.items():
txt += enzyme + ": " + " ".join(problem_sites) + ";"
self.sites_outside_excised_region_txt = txt
else: # no other sites or orientation not correct
self.sites_outside_excised_region_txt = ""
def sum_results(self):
self.results["pass"] = True
if self.results["is_circular"] is False:
self.results["pass"] = False
return
if self.results["is_site_orientation_correct"] is False:
# implicitly checks number of sites too
self.results["pass"] = False
return
if self.sites_outside_excised_region_txt:
self.results["pass"] = False
return
# if self.results["other_sites"]["has_any_other_sites"]:
# self.results["pass"] = False
# return
def plot_plasmid(self):
"""Plot an outline of the plasmid."""
fig, ax = plt.subplots(figsize=(7, 4))
graphic_record = AssessmentTranslator().translate_record(self.record)
graphic_record.plot(ax=ax, with_ruler=False, strand_in_label_threshold=2)
self.fig = fig
Classes
Assessment
class Assessment(
record,
enzyme
)
The plasmid assessment class.
Parameters
record
A Biopython
SeqRecord
.
enzyme
A restriction enzyme (
str
). A BiopythonRestrictionType
will be looked up using the string.
View Source
class Assessment:
"""The plasmid assessment class.
**Parameters**
**record**
> A Biopython `SeqRecord`.
**enzyme**
> A restriction enzyme (`str`). A Biopython `RestrictionType` will be looked
up using the string.
"""
UNKNOWN_IDS = [
"None",
"",
"<unknown id>",
".",
"EXPORTED",
"<unknown name>",
"Exported",
]
def __init__(self, record, enzyme):
self.record = record
self.enzyme = Bio.Restriction.__dict__[enzyme]
self.enzyme_name = str(self.enzyme)
self.results = {}
def assess_plasmid(self, other_enzymes=None):
"""Evaluate plasmid for Golden Gate.
**Parameters**
**other_enzymes**
> List of enzymes used in higher level assemblies (`list`).
"""
if other_enzymes:
self.other_enzymes = ", ".join([str(enz) for enz in other_enzymes])
self.add_name()
self.check_circularity()
self.get_number_of_sites()
self.evaluate_orientation()
self.digest_plasmid()
self.count_other_sites(other_enzymes)
self.check_enzyme_site_locations()
self.sum_results()
self.plot_plasmid()
def add_name(self):
"""Set a name for the assessment."""
# To display on the report:
if str(self.record.id).strip() in self.UNKNOWN_IDS:
self.name = "Unnamed plasmid"
else:
if len(self.record.id) > 16: # Genbank limit, also for width in report
self.name = self.record.id[:16] + "..."
else:
self.name = self.record.id
def check_circularity(self):
if "topology" not in self.record.annotations:
self.results["is_circular"] = False
elif self.record.annotations["topology"] == "circular":
self.results["is_circular"] = True
else:
self.results["is_circular"] = False
def get_number_of_sites(self):
if "is_circular" in self.results:
is_linear = not self.results["is_circular"]
else:
is_linear = False
restriction_batch = Bio.Restriction.RestrictionBatch([self.enzyme])
analysis = Bio.Restriction.Analysis(
restriction_batch, sequence=self.record.seq, linear=is_linear
)
self.analysis_results = analysis.full(linear=is_linear)
self.results["number_of_sites"] = len(self.analysis_results[self.enzyme])
# Add as features for plot in report:
for enzyme, sites in self.analysis_results.items():
for site in sites:
self.record.features.append(
SeqFeature(
FeatureLocation(site, site + 1),
id=str(enzyme),
type="misc_feature",
qualifiers={
"label": str(enzyme),
"plasmid_assessment": "enzyme",
},
)
)
def evaluate_orientation(self):
self.results["is_site_orientation_correct"] = False # default
# Forward strand:
self.iter_forward = [
match.end() for match in re.finditer(self.enzyme.site, str(self.record.seq))
]
if sum(1 for _ in self.iter_forward) == 1:
self.forward_enzyme = self.iter_forward[0]
# rev_complement_site = str(self.record.seq.reverse_complement())
rev_complement_site = str(Seq(self.enzyme.site).reverse_complement())
self.iter_reverse = [
m.start()
for m in re.finditer(rev_complement_site, str(self.record.seq))
]
if sum(1 for _ in self.iter_reverse) == 1: # 1 site in both strands:
self.results["is_site_orientation_correct"] = True
self.reverse_enzyme = self.iter_reverse[0]
if self.results["is_site_orientation_correct"]:
if self.reverse_enzyme < self.forward_enzyme:
self.record.features.append(
SeqFeature(
FeatureLocation(
self.reverse_enzyme - 1, self.forward_enzyme + 1
),
id=str(self.enzyme),
type="misc_feature",
qualifiers={
"label": "Excised",
"plasmid_assessment": "excised",
},
)
)
else: # put annotation together from two pieces:
self.record.features.append(
SeqFeature(
FeatureLocation(0, self.forward_enzyme + 1),
id=str(self.enzyme),
type="misc_feature",
qualifiers={
"label": "Excised",
"plasmid_assessment": "excised",
},
)
)
self.record.features.append(
SeqFeature(
FeatureLocation(self.reverse_enzyme - 1, len(self.record)),
id=str(self.enzyme),
type="misc_feature",
qualifiers={
"label": "Excised",
"plasmid_assessment": "excised",
},
)
)
def digest_plasmid(self):
# Obtain fragments and get the backbone's overhangs.
# This method has two assumptions:
# - the sequence has two, correctly oriented enzyme sites.
# - the sequence is circular.
# Therefore there will be exactly two fragments, with one containing both sites.
self.results["digest"] = {}
if not self.results["is_circular"]:
return
if not self.results["is_site_orientation_correct"]:
return
record_fragments = dc.StickyEndFragment.list_from_record_digestion(
record=self.record, enzyme=self.enzyme, linear=False
)
if self.enzyme.site in record_fragments[0].to_standard_string():
backbone_index = 1 # there are only two fragments
excise_index = 0
else:
backbone_index = 0
excise_index = 1 # reversed
self.results["digest"]["backbone_seq"] = record_fragments[backbone_index]
self.results["digest"]["excised_seq"] = record_fragments[excise_index]
self.results["digest"]["first_overhang"] = str(
record_fragments[excise_index].seq.left_end
)
self.results["digest"]["last_overhang"] = str(
record_fragments[excise_index].seq.right_end
)
def count_other_sites(self, other_enzymes):
self.results["other_sites"] = {}
self.results["other_sites"]["has_any_other_sites"] = False
if other_enzymes is None:
return
bio_enzymes = [Bio.Restriction.__dict__[enzyme] for enzyme in other_enzymes]
restriction_batch = Bio.Restriction.RestrictionBatch(bio_enzymes)
# Work with the assumption that the sequence is circular:
analysis = Bio.Restriction.Analysis(
restriction_batch, sequence=self.record.seq, linear=False
)
self.results["other_sites"]["enzyme"] = analysis.full(linear=False)
for enzyme, matches in self.results["other_sites"]["enzyme"].items():
if len(matches) != 0:
self.results["other_sites"]["has_any_other_sites"] = True
# Also add as features for plot in report:
for site in matches:
self.record.features.append(
SeqFeature(
FeatureLocation(site, site + 1),
id=str(enzyme),
type="misc_feature",
qualifiers={
"label": str(enzyme),
"plasmid_assessment": "enzyme",
},
)
)
def check_enzyme_site_locations(self):
"""Flag enzyme sites that are within the retained backbone."""
try:
self.results["other_sites"]["has_any_other_sites"]
self.results["is_site_orientation_correct"]
except KeyError:
print("Run assessment methods first!")
else:
self.sites_outside_excised_region = {}
if (
self.results["other_sites"]["has_any_other_sites"]
and self.results["is_site_orientation_correct"]
):
# if there are no other sites, no need to run:
if self.reverse_enzyme < self.forward_enzyme:
# orientation = reverse -> forward
for enzyme, sites in self.results["other_sites"]["enzyme"].items():
problem_sites = []
for site in sites:
if self.reverse_enzyme < site < self.forward_enzyme:
pass
else:
problem_sites += [str(site)]
if problem_sites != []:
self.sites_outside_excised_region[
str(enzyme)
] = problem_sites
txt = "" # for the pdf report
for (
enzyme,
problem_sites,
) in self.sites_outside_excised_region.items():
txt += enzyme + ": " + " ".join(problem_sites) + ";"
self.sites_outside_excised_region_txt = txt
else:
# orientation = forward -> reverse
for enzyme, sites in self.results["other_sites"]["enzyme"].items():
problem_sites = []
for site in sites:
if self.forward_enzyme < site < self.reverse_enzyme:
# in this case the site is within the retained backbone
problem_sites += [str(site)]
if problem_sites != []:
self.sites_outside_excised_region[
str(enzyme)
] = problem_sites
txt = "" # for the pdf report
for (
enzyme,
problem_sites,
) in self.sites_outside_excised_region.items():
txt += enzyme + ": " + " ".join(problem_sites) + ";"
self.sites_outside_excised_region_txt = txt
else: # no other sites or orientation not correct
self.sites_outside_excised_region_txt = ""
def sum_results(self):
self.results["pass"] = True
if self.results["is_circular"] is False:
self.results["pass"] = False
return
if self.results["is_site_orientation_correct"] is False:
# implicitly checks number of sites too
self.results["pass"] = False
return
if self.sites_outside_excised_region_txt:
self.results["pass"] = False
return
# if self.results["other_sites"]["has_any_other_sites"]:
# self.results["pass"] = False
# return
def plot_plasmid(self):
"""Plot an outline of the plasmid."""
fig, ax = plt.subplots(figsize=(7, 4))
graphic_record = AssessmentTranslator().translate_record(self.record)
graphic_record.plot(ax=ax, with_ruler=False, strand_in_label_threshold=2)
self.fig = fig
Class variables
UNKNOWN_IDS
Methods
add_name
def add_name(
self
)
Set a name for the assessment.
View Source
def add_name(self):
"""Set a name for the assessment."""
# To display on the report:
if str(self.record.id).strip() in self.UNKNOWN_IDS:
self.name = "Unnamed plasmid"
else:
if len(self.record.id) > 16: # Genbank limit, also for width in report
self.name = self.record.id[:16] + "..."
else:
self.name = self.record.id
assess_plasmid
def assess_plasmid(
self,
other_enzymes=None
)
Evaluate plasmid for Golden Gate.
Parameters
other_enzymes
List of enzymes used in higher level assemblies (
list
).
View Source
def assess_plasmid(self, other_enzymes=None):
"""Evaluate plasmid for Golden Gate.
**Parameters**
**other_enzymes**
> List of enzymes used in higher level assemblies (`list`).
"""
if other_enzymes:
self.other_enzymes = ", ".join([str(enz) for enz in other_enzymes])
self.add_name()
self.check_circularity()
self.get_number_of_sites()
self.evaluate_orientation()
self.digest_plasmid()
self.count_other_sites(other_enzymes)
self.check_enzyme_site_locations()
self.sum_results()
self.plot_plasmid()
check_circularity
def check_circularity(
self
)
View Source
def check_circularity(self):
if "topology" not in self.record.annotations:
self.results["is_circular"] = False
elif self.record.annotations["topology"] == "circular":
self.results["is_circular"] = True
else:
self.results["is_circular"] = False
check_enzyme_site_locations
def check_enzyme_site_locations(
self
)
Flag enzyme sites that are within the retained backbone.
View Source
def check_enzyme_site_locations(self):
"""Flag enzyme sites that are within the retained backbone."""
try:
self.results["other_sites"]["has_any_other_sites"]
self.results["is_site_orientation_correct"]
except KeyError:
print("Run assessment methods first!")
else:
self.sites_outside_excised_region = {}
if (
self.results["other_sites"]["has_any_other_sites"]
and self.results["is_site_orientation_correct"]
):
# if there are no other sites, no need to run:
if self.reverse_enzyme < self.forward_enzyme:
# orientation = reverse -> forward
for enzyme, sites in self.results["other_sites"]["enzyme"].items():
problem_sites = []
for site in sites:
if self.reverse_enzyme < site < self.forward_enzyme:
pass
else:
problem_sites += [str(site)]
if problem_sites != []:
self.sites_outside_excised_region[
str(enzyme)
] = problem_sites
txt = "" # for the pdf report
for (
enzyme,
problem_sites,
) in self.sites_outside_excised_region.items():
txt += enzyme + ": " + " ".join(problem_sites) + ";"
self.sites_outside_excised_region_txt = txt
else:
# orientation = forward -> reverse
for enzyme, sites in self.results["other_sites"]["enzyme"].items():
problem_sites = []
for site in sites:
if self.forward_enzyme < site < self.reverse_enzyme:
# in this case the site is within the retained backbone
problem_sites += [str(site)]
if problem_sites != []:
self.sites_outside_excised_region[
str(enzyme)
] = problem_sites
txt = "" # for the pdf report
for (
enzyme,
problem_sites,
) in self.sites_outside_excised_region.items():
txt += enzyme + ": " + " ".join(problem_sites) + ";"
self.sites_outside_excised_region_txt = txt
else: # no other sites or orientation not correct
self.sites_outside_excised_region_txt = ""
count_other_sites
def count_other_sites(
self,
other_enzymes
)
View Source
def count_other_sites(self, other_enzymes):
self.results["other_sites"] = {}
self.results["other_sites"]["has_any_other_sites"] = False
if other_enzymes is None:
return
bio_enzymes = [Bio.Restriction.__dict__[enzyme] for enzyme in other_enzymes]
restriction_batch = Bio.Restriction.RestrictionBatch(bio_enzymes)
# Work with the assumption that the sequence is circular:
analysis = Bio.Restriction.Analysis(
restriction_batch, sequence=self.record.seq, linear=False
)
self.results["other_sites"]["enzyme"] = analysis.full(linear=False)
for enzyme, matches in self.results["other_sites"]["enzyme"].items():
if len(matches) != 0:
self.results["other_sites"]["has_any_other_sites"] = True
# Also add as features for plot in report:
for site in matches:
self.record.features.append(
SeqFeature(
FeatureLocation(site, site + 1),
id=str(enzyme),
type="misc_feature",
qualifiers={
"label": str(enzyme),
"plasmid_assessment": "enzyme",
},
)
)
digest_plasmid
def digest_plasmid(
self
)
View Source
def digest_plasmid(self):
# Obtain fragments and get the backbone's overhangs.
# This method has two assumptions:
# - the sequence has two, correctly oriented enzyme sites.
# - the sequence is circular.
# Therefore there will be exactly two fragments, with one containing both sites.
self.results["digest"] = {}
if not self.results["is_circular"]:
return
if not self.results["is_site_orientation_correct"]:
return
record_fragments = dc.StickyEndFragment.list_from_record_digestion(
record=self.record, enzyme=self.enzyme, linear=False
)
if self.enzyme.site in record_fragments[0].to_standard_string():
backbone_index = 1 # there are only two fragments
excise_index = 0
else:
backbone_index = 0
excise_index = 1 # reversed
self.results["digest"]["backbone_seq"] = record_fragments[backbone_index]
self.results["digest"]["excised_seq"] = record_fragments[excise_index]
self.results["digest"]["first_overhang"] = str(
record_fragments[excise_index].seq.left_end
)
self.results["digest"]["last_overhang"] = str(
record_fragments[excise_index].seq.right_end
)
evaluate_orientation
def evaluate_orientation(
self
)
View Source
def evaluate_orientation(self):
self.results["is_site_orientation_correct"] = False # default
# Forward strand:
self.iter_forward = [
match.end() for match in re.finditer(self.enzyme.site, str(self.record.seq))
]
if sum(1 for _ in self.iter_forward) == 1:
self.forward_enzyme = self.iter_forward[0]
# rev_complement_site = str(self.record.seq.reverse_complement())
rev_complement_site = str(Seq(self.enzyme.site).reverse_complement())
self.iter_reverse = [
m.start()
for m in re.finditer(rev_complement_site, str(self.record.seq))
]
if sum(1 for _ in self.iter_reverse) == 1: # 1 site in both strands:
self.results["is_site_orientation_correct"] = True
self.reverse_enzyme = self.iter_reverse[0]
if self.results["is_site_orientation_correct"]:
if self.reverse_enzyme < self.forward_enzyme:
self.record.features.append(
SeqFeature(
FeatureLocation(
self.reverse_enzyme - 1, self.forward_enzyme + 1
),
id=str(self.enzyme),
type="misc_feature",
qualifiers={
"label": "Excised",
"plasmid_assessment": "excised",
},
)
)
else: # put annotation together from two pieces:
self.record.features.append(
SeqFeature(
FeatureLocation(0, self.forward_enzyme + 1),
id=str(self.enzyme),
type="misc_feature",
qualifiers={
"label": "Excised",
"plasmid_assessment": "excised",
},
)
)
self.record.features.append(
SeqFeature(
FeatureLocation(self.reverse_enzyme - 1, len(self.record)),
id=str(self.enzyme),
type="misc_feature",
qualifiers={
"label": "Excised",
"plasmid_assessment": "excised",
},
)
)
get_number_of_sites
def get_number_of_sites(
self
)
View Source
def get_number_of_sites(self):
if "is_circular" in self.results:
is_linear = not self.results["is_circular"]
else:
is_linear = False
restriction_batch = Bio.Restriction.RestrictionBatch([self.enzyme])
analysis = Bio.Restriction.Analysis(
restriction_batch, sequence=self.record.seq, linear=is_linear
)
self.analysis_results = analysis.full(linear=is_linear)
self.results["number_of_sites"] = len(self.analysis_results[self.enzyme])
# Add as features for plot in report:
for enzyme, sites in self.analysis_results.items():
for site in sites:
self.record.features.append(
SeqFeature(
FeatureLocation(site, site + 1),
id=str(enzyme),
type="misc_feature",
qualifiers={
"label": str(enzyme),
"plasmid_assessment": "enzyme",
},
)
)
plot_plasmid
def plot_plasmid(
self
)
Plot an outline of the plasmid.
View Source
def plot_plasmid(self):
"""Plot an outline of the plasmid."""
fig, ax = plt.subplots(figsize=(7, 4))
graphic_record = AssessmentTranslator().translate_record(self.record)
graphic_record.plot(ax=ax, with_ruler=False, strand_in_label_threshold=2)
self.fig = fig
sum_results
def sum_results(
self
)
View Source
def sum_results(self):
self.results["pass"] = True
if self.results["is_circular"] is False:
self.results["pass"] = False
return
if self.results["is_site_orientation_correct"] is False:
# implicitly checks number of sites too
self.results["pass"] = False
return
if self.sites_outside_excised_region_txt:
self.results["pass"] = False
return
AssessmentTranslator
class AssessmentTranslator(
features_filters=(),
features_properties=None
)
Custom translator for highlighting key features.
View Source
class AssessmentTranslator:
"""Please install dna_features_viewer to use this class."""
def __init__(self):
raise Exception("Please install dna_features_viewer to use this class.")
Ancestors (in MRO)
- dna_features_viewer.BiopythonTranslator.BiopythonTranslator.BiopythonTranslator
- dna_features_viewer.BiopythonTranslator.BiopythonTranslatorBase.BiopythonTranslatorBase
Class variables
default_feature_color
graphic_record_parameters
ignored_features_types
label_fields
Static methods
quick_class_plot
def quick_class_plot(
record,
figure_width=12,
**kwargs
)
Allows super quick and dirty plotting of Biopython records.
This is really meant for use in a Jupyter/Ipython notebook with the "%matplotlib inline" setting.
from dna_features_viewer import BiopythonTranslator BiopythonTranslator.quick_plot(my_record)
View Source
@classmethod
def quick_class_plot(cls, record, figure_width=12, **kwargs):
"""Allows super quick and dirty plotting of Biopython records.
This is really meant for use in a Jupyter/Ipython notebook with
the "%matplotlib inline" setting.
>>> from dna_features_viewer import BiopythonTranslator
>>> BiopythonTranslator.quick_plot(my_record)
"""
graphic_record = cls().translate_record(record)
ax, _ = graphic_record.plot(figure_width=figure_width, **kwargs)
return ax
Methods
compute_feature_box_color
def compute_feature_box_color(
self,
feature
)
Compute a box_color for this feature.
View Source
def compute_feature_box_color(self, feature):
"""Compute a box_color for this feature."""
return "auto"
compute_feature_box_linewidth
def compute_feature_box_linewidth(
self,
feature
)
Compute a box_linewidth for this feature.
View Source
def compute_feature_box_linewidth(self, feature):
"""Compute a box_linewidth for this feature."""
return 0.3
compute_feature_color
def compute_feature_color(
self,
feature
)
Compute a color for this feature.
If the feature has a color
qualifier it will be used. Otherwise,
the classe's default_feature_color
is used.
To change the behaviour, create a subclass of BiopythonTranslator
and overwrite this method.
View Source
def compute_feature_color(self, feature):
assessment_ref = "plasmid_assessment"
if assessment_ref in feature.qualifiers:
if feature.qualifiers[assessment_ref] == "enzyme":
return "red"
elif feature.qualifiers[assessment_ref] == "excised":
return "yellow"
elif feature.qualifiers[assessment_ref] == "backbone":
return "tab:cyan"
else:
return "tab:blue" # default dna_features_viewer color
else:
return "tab:blue"
compute_feature_fontdict
def compute_feature_fontdict(
self,
feature
)
Compute a font dict for this feature.
View Source
def compute_feature_fontdict(self, feature):
"""Compute a font dict for this feature."""
return None
compute_feature_html
def compute_feature_html(
self,
feature
)
Gets the 'label' of the feature.
View Source
def compute_feature_html(self, feature):
"""Gets the 'label' of the feature."""
return self.compute_feature_label(feature)
compute_feature_label
def compute_feature_label(
self,
feature
)
Compute the label of the feature.
View Source
def compute_feature_label(self, feature):
"""Compute the label of the feature."""
label = feature.type
for key in self.label_fields:
if key in feature.qualifiers and len(feature.qualifiers[key]):
label = feature.qualifiers[key]
break
if isinstance(label, list):
label = "|".join(label)
return label
compute_feature_label_link_color
def compute_feature_label_link_color(
self,
feature
)
Compute the color of the line linking the label to its feature.
View Source
def compute_feature_label_link_color(self, feature):
"""Compute the color of the line linking the label to its feature."""
return "black"
compute_feature_legend_text
def compute_feature_legend_text(
self,
feature
)
View Source
def compute_feature_legend_text(self, feature):
return None
compute_feature_linewidth
def compute_feature_linewidth(
self,
feature
)
Compute the edge width of the feature's arrow/rectangle.
View Source
def compute_feature_linewidth(self, feature):
"""Compute the edge width of the feature's arrow/rectangle."""
return 1.0
compute_filtered_features
def compute_filtered_features(
self,
features
)
Return the list of features minus the ignored ones.
By the method keeps any feature whose type is not in ignored_features_types and for which all filter(f) pass.
View Source
def compute_filtered_features(self, features):
"""Return the list of features minus the ignored ones.
By the method keeps any feature whose type is not in
ignored_features_types and for which all filter(f) pass.
"""
return [
f
for f in features
if all([fl(f) for fl in self.features_filters])
and f.type not in self.ignored_features_types
]
quick_plot
def quick_plot(
self,
record,
figure_width=12,
**kwargs
)
Allows super quick and dirty plotting of Biopython records.
This is really meant for use in a Jupyter/Ipython notebook with the "%matplotlib inline" setting.
from dna_features_viewer import BiopythonTranslator BiopythonTranslator.quick_plot(my_record)
View Source
def quick_plot(self, record, figure_width=12, **kwargs):
"""Allows super quick and dirty plotting of Biopython records.
This is really meant for use in a Jupyter/Ipython notebook with
the "%matplotlib inline" setting.
>>> from dna_features_viewer import BiopythonTranslator
>>> BiopythonTranslator.quick_plot(my_record)
"""
graphic_record = self.translate_record(record)
ax, _ = graphic_record.plot(figure_width=figure_width, **kwargs)
return ax
translate_feature
def translate_feature(
self,
feature
)
Translate a Biopython feature into a Dna Features Viewer feature.
View Source
def translate_feature(self, feature):
"""Translate a Biopython feature into a Dna Features Viewer feature."""
properties = dict(
label=self.compute_feature_label(feature),
color=self.compute_feature_color(feature),
html=self.compute_feature_html(feature),
fontdict=self.compute_feature_fontdict(feature),
box_linewidth=self.compute_feature_box_linewidth(feature),
box_color=self.compute_feature_box_color(feature),
linewidth=self.compute_feature_linewidth(feature),
label_link_color=self.compute_feature_label_link_color(feature),
legend_text=self.compute_feature_legend_text(feature),
)
if self.features_properties is not None:
other_properties = self.features_properties
if hasattr(other_properties, "__call__"):
other_properties = other_properties(feature)
properties.update(other_properties)
return GraphicFeature(
start=feature.location.start,
end=feature.location.end,
strand=feature.location.strand,
**properties
)
translate_record
def translate_record(
self,
record,
record_class=None,
filetype=None
)
Create a new GraphicRecord from a BioPython Record object.
Parameters
record A BioPython Record object or the path to a Genbank or a GFF file.
record_class The graphic record class to use, e.g. GraphicRecord (default) or CircularGraphicRecord. Strings 'circular' and 'linear' can also be provided.
filetype Used only when a Genbank or a GFF file is provided; one of "genbank" or "gff" to be used. Default None infers from file extension.
View Source
def translate_record(self, record, record_class=None, filetype=None):
"""Create a new GraphicRecord from a BioPython Record object.
Parameters
----------
record
A BioPython Record object or the path to a Genbank or a GFF file.
record_class
The graphic record class to use, e.g. GraphicRecord (default) or
CircularGraphicRecord. Strings 'circular' and 'linear' can also be
provided.
filetype
Used only when a Genbank or a GFF file is provided; one of "genbank"
or "gff" to be used. Default None infers from file extension.
"""
classes = {
"linear": GraphicRecord,
"circular": CircularGraphicRecord,
None: GraphicRecord,
}
if record_class in classes:
record_class = classes[record_class]
if isinstance(record, str) or hasattr(record, "read"):
record = load_record(record, filetype=filetype)
filtered_features = self.compute_filtered_features(record.features)
return record_class(
sequence_length=len(record),
sequence=str(record.seq),
features=[
self.translate_feature(feature)
for feature in filtered_features
if feature.location is not None
],
**self.graphic_record_parameters
)


Thymeleaf Page Layouts
TABLE OF CONTENTS
- Introduction
- Example Application
- Thymeleaf Standard Layout System
- Thymeleaf Tiles Integration
- Thymeleaf Layout Dialect
- Other Layout Options
- Future Plans
Introduction
Usually websites share common page components like the header, footer, menu and possibly many more. These page components can be used by the same or different layouts. There are two main styles of organizing layouts in projects: include style and hierarchical style. Both styles can be easily utilized with Thymeleaf without losing its biggest value: natural templating.
Include-style layouts
In this style pages are built by embedding common page component code directly within each view to generate the final result. In Thymeleaf this can be done using Thymeleaf Standard Layout System:
The include-style layouts are pretty simple to understand and implement and in fact they offer flexibility in developing views, which is their biggest advantage. The main disadvantage of this solution, though, is that some code duplication is introduced so modifying the layout of a large number of views in big applications can become a bit cumbersome.
Hierarchical-style layouts
In hierarchical style, the templates are usually created with a parent-child relation, from the more general part (layout) to the most specific ones (subviews; e.g. page content). Each component of the template may be included dynamically based on the inclusion and substitution of template fragments. In Thymeleaf this can be done using: Thymeleaf Layout Dialect and Thymeleaf Tiles Integration.
The main advantages of this solution are the reuse of atomic portions of the view and modular design, whereas the main disadvantage is that much more configuration is needed in order to use them, so the complexity of the views is bigger than with Include Style Layouts which are more "natural" to use.
Example Application
All the samples and code fragments presented in this article are available on GitHub at https://github.com/thymeleaf/thymeleafexamples-layouts
Thymeleaf Standard Layout System
Thymeleaf Standard Layout System offers page fragment inclusion that is similar to JSP includes, with some important improvements over them:
Basic inclusion with th:include and th:replace
Thymeleaf can include parts of other pages as fragments (whereas JSP only includes complete pages) using th:include (will include the contents of the fragment into its host tag) or th:replace (will actually substitute the host tag by the fragment's). This allows the grouping of fragments into one or several pages. Look at the example. The home/homeNotSignedIn.html template is rendered when the anonymous user enters the home page of our application.
Class thymeleafexamples.layouts.home.HomeController
Template home/homeNotSignedIn.html
You can open the file directly in a browser:
In the above example, we are building a page that consists of page header and page footer. In Thymeleaf all fragments can be defined in a single file (e.g. fragments.html) or in a separate files, like in this particular case.
Let's shortly analyze the inclusion statement:
The first part of the statement, fragments/header, is a template name that we are referencing. This can be a file (like in this example) or it can reference to the same file either by using the this keyword (e.g. this :: header) or without any keyword (e.g. :: header). The expression after double colon is a fragment selector (either fragment name or DOM selector). As you can see also see, the header fragment contains a markup that is used for static prototyping only.
Header and footer are defined in the following files:
Template fragments/header.html
...which we can open directly in a browser:
And template fragments/footer.html
Note how that the referenced fragments are specified with th:fragment attributes. This way we can define multiple fragments in one template file, as it was mentioned earlier.
What is important here, is that all the templates can still be natural templates and can be viewed in a browser without a running server.
Including with DOM Selectors
In Thymeleaf, fragments don't need to be explicitly specified using th:fragment at the page they are extracted from. Thymeleaf can select an arbitrary section of a page as a fragment (even a page living on an external server) by means of its DOM Selector syntax, similar to XPath expressions and CSS selectors.
The above code will include a paragraph with class="notice" from thymeleaf.org. In order to make it happen, the template engine must be configured with UrlTemplateResolver:
For the DOM Selector syntax reference checkout this section in Thymeleaf documentation: DOM Selector syntax.
Using expressions
In templatename :: domselector, both templatename and domselector can be fully-featured expressions. In the below example we want to include different fragments depending on a condition. If the authenticated user is an Admin, we will show a different footer than for a regular user:
fragments/footer.html has slightly changed, as we need to have two footers defined:
Parameterized inclusion
Fragments can specify arguments, just like methods. Whenever they are explicitly specified with a th:fragment attribute, they can provide an argument signature that can then be filled in with arguments from the calling th:include or th:replace attributes.
Examples talk best. We can use parameterized inclusion in many contexts but one real life context is displaying messages on different pages of our application after successful form submission. Let's look at the signup process in the application:
As you can see, after a successful signup the user will be redirected to the home page with a flash attribute filled in. We want to create a reusable and parameterized fragment. This can be done as follows:
The above alert fragment takes two arguments: type and message. The type is the message type used for styling a message whereas the message is a text that will be shown to the user. If we wanted, we could have even ensured that arguments existed or met certain conditions using a th:assert attribute.
In order to include alert in any template we may write the following code (please note, that the value of a variable can be an expression):
Parameterized fragments let developers create functional-like fragments that are easier to reuse. Read more about parameterized fragments in the Thymeleaf documentation: Parameterizable fragment signatures.
Fragment inclusion from Spring @Controller
Fragments can be directly specified from a Spring MVC controller, i.e. signup :: signupForm; which can be useful for AJAX controllers that return only a small fragment of HTML to the browser. In the example below, the signup form fragment will be loaded upon AJAX request and the whole signup view - on regular request:
The fragment is defined in signup/signup.html:
The above fragment is loaded when a new user wants to signup from a home page. The modal dialog will be shown upon clicking Signup button and the content will be loaded via AJAX call (see home/homeNotSignedIn.html).
References
Please check Thymeleaf documentation that describes this topic very thoroughly. You can find it here: Template Layout.
Natural templating is greatly explained in Bringing Thymeleaf and Natural Templates to the Spring PetClinic article in And what about the Natural Templates thing? chapter. The example can be found on GitHub.
Thymol
When a Thymeleaf template is used as a static prototype, we cannot see the fragments we are including using the th:include/th:replace host tags. We can only see the fragments aside, opening their own template documents.
However, there is a way to see the real fragments included into our pages while prototyping. This can be done using Thymol, an unofficial JavaScript library that is an implementation of Thymeleaf's standard fragment inclusion functionality, providing static support for some Thymeleaf attributes like th:include or th:replace, conditional display with th:if/th:unless, etc.
As Thymol's author states: Thymol was created in order to provide a more accurate static representation of Thymeleaf's dynamic templating capabilities by offering support for Thymeleaf attributes through a statically accessible javascript library
Thymol documentation and examples can be found on the official project site here: Thymol at SourceForge.net.
Thymeleaf Tiles Integration
The Apache Tiles 2 Dialect was created in order to provide a more comfortable migration path to all those developers who are currently using Apache Tiles 2 with JSP. Tiles is one of the most used Java templating frameworks, and a lot of JSP users are used to thinking in terms of Tiles when it comes to layout.
Tiles dialect offers the possibility to go on doing layouts in the same way with Thymeleaf! In addition, The Tiles dialect allows mixing JSPs and Thymeleaf, so that migrating JSP applications gets much easier.
Configuration
To get started with Tiles Dialect we need to include it into the pom.xml. The dependency is:
We will also need to configure the integration by adding a view resolver bean that will resolve Tiles views, a Tiles Configurer bean and of course the additional dialect to our template engine. Let's go through it really quickly:
Tiles view resolver
This view resolver will resolve Tiles views. We will configure it to have lower precedence, meaning that it will be used when the previous one cannot resolve the views. We also need to set the viewClass property of the resolver to ThymeleafTilesView.class.
Basic view resolver
The basic view resolver will not resolve the views whose names start with message/* — those are our Tiles-based views, and they will be resolved by the previous ViewResolver bean. This is very important, if we want to have several view resolvers in the application working alongside:
Template Engine
We need to add the Tiles Dialect to the template engine:
Tiles Configurer
The Tiles configurer bean will configure the Tiles container by adding Tiles definition files to it:
The complete configuration of the application lives in WebMvcConfig, a Spring java configuration class.
Tiles definition
The Tiles definition is a standard XML file. In our example it looks like this:
In the above example, the message/* views will use a message/layout.html. In the layout file we use two Tiles attributes that will be evaluated to message/{1} :: title and message/{1} :: content fragments accordingly.
The layout file reads as follows:
We can see several things in the above example. Firstly, the layout is a natural template and it is a valid UI design prototype (in this example the layout is very simple):
Secondly, we can mix standard layout (th:include/th:replace) with Tiles dialect. Thirdly, Thymeleaf has ability to include a template fragment instead of the whole template.
Thymeleaf Layout Dialect
Layout Dialect gives people the possibility of using hierarchical approach, but from a Thymeleaf-only perspective and without the need to use external libraries, like Apache Tiles. Thymeleaf Layout Dialect uses layout/decorator templates to style the content, as well as it can pass entire fragment elements to included pages. Concepts of this library are similar to SiteMesh or JSF with Facelets.
Configuration
To get started with Layout Dialect we need to include it into the pom.xml. The dependency is:
We will also need to configure the integration by adding an additional dialect to our template engine:
No other changes are required.
Creating a layout
The layout file is defined in /WEB-INF/views/task/layout.html:
We can open the file directly in a browser:
The above file is our decorator for content pages we will be creating in the application. The most important thing about the above example is layout:fragment="content". This is the heart of the decorator page (layout). You can also notice, that header and footer are included using Standard Thymeleaf Layout System.
The content page looks as follows (WEB-INF/views/task/list.html):
And in the browser it looks like this:
Content of this task/list view will be decorated by the elements of task/layout view. Please note layout:decorator="task/layout" attribute in <html> element. This attribute signals to the Layout Dialect which layout should be used to decorate given view.
And what about Natural Templates using the Layout Dialect? Again, possible! In just the same way as with Tiles Dialect, you simply need to add some prototyping-only markup around the fragments being included in your templates and that's it!
Include style approach with Layout Dialect
Layout Dialect supports not only hierarchical approach — it also provides a way to use it in an include-style way (layout:include). Comparing with standard Thymeleaf includes, with Layout Dialect you can pass HTML elements to the included page. Useful if you have some HTML that you want to reuse, but whose contents are too complex to pass by means of parameterized inclusion in standard Thymeleaf dialect.
This is an example of a reusable alert fragment using layout:fragment (task/alert.html):
The calling of the above fragment may look as follows (task/list.html):
Or:
In this case, the entire alert-content of task/alert (/WEB-INF/views/task/alert.html) template will be replaced by custom HTML above.
References
Please check out the Layout Dialect documentation that describes this topic very thoroughly. You will definitively find some more advanced examples than in this article. You can find the documentation here: Layout Dialect.
Other Layout Options
For some of the developers neither of the solutions presented before is sufficient. Thymeleaf Standard Layout System is not enough and using external libraries is not an option. In that case, the custom solution may be the way to go.
Thymeleaf Custom Layout
One of such a solutions is well described in this blog post: Thymeleaf template layouts in Spring MVC application with no extensions. The idea of this solution is really simple. Let's visualize that with an example:
Example view file (1):
And the layout file (2):
What will happen?
- Controllers return view names, that translate to single Thymeleaf view file (1)
- Before rendering the view, the original viewName attribute in ModelAndView object is replaced with with the name of the layout view and the original viewName becomes an attribute in ModelAndView.
- The layout view (2) contains several include elements: <div th:replace="${view} :: content">Page Content</div>
- The actual view file contains fragments, pulled by the template which embeds the actual view
The project can be found on GitHub.
Future Plans
And finally, what's the future of Thymeleaf layouts? There are some really interesting things planned:
Fragment-as-a-parameter inclusion
Current Thymeleaf fragments allow passing arguments, but these arguments are normally just small pieces of text. It is not really comfortable to pass a complete HTML, as it is possible with hierarchical layout systems (including the Layout Dialect).
In the future, it will be possible to select and pass entire subtrees of markup as arguments. See this ticket for more details.
Decoupled templates
In order to make the communication between UI designers and developers easier, Thymeleaf will offer the possibility to separate HTML markup and Thymeleaf processors into separate files as an option. See this ticket for more details.
Tiles 3 support
The Apache Tiles integration module currently only supports Tiles 2 integration. Tiles 3, although seems to be very alike Tiles 2, has a different architecture and therefore a separate module will be created in the future.
Summary
In this article, we described many ways of achieving the same: layouts. You can build layouts using Thymeleaf Standard Layout System that is based on include-style approach. You can use Apache Tiles with Tiles Dialect, if you are either migrating from Tiles or if Tiles is your choice. You also have powerful Layout Dialect, that uses decorator pattern for working with layout files. Finally, you can easily create your own solution. Hopefully, this article gives you some more insights on the topic and you will find your preferred approach depending on your needs.


--- title: Come Visit!!! date: 2011-04-01 00:00:00 -06:00 categories: - whats-blooming layout: post blog-banner: whats-blooming-now-spring.jpg post-date: April 1, 2011 post-time: 11:29 AM blog-image: wbn-default.jpg ---
The garden is filled with color everywhere you look. The Irises and other bulbs are open in the Rose Garden and Floral walk and the Daffodils are just beginning to show signs of color.....so get ready for a great show in the next few weeks.
On your way to check out the incredible bulb display in the Rose Garden, look for these gorgeous blooms.
Helleborus foetidus - Stinking Hellebore
Iris histrioides 'Frank Elder' - Dwarf Iris
Under the Russian Olives
Don't forget to look at out great addition inside the Orangerie. It's called a Living wall. The greenhouse staff did a great job designing and planting it. The photos do not do it justice. Come and see it in person.


Tom.js: Guide & Examples
Setting Up Tom.js
In order to play the sounds, Tom.js requires SoundManager2 to already be initialised. After Including the JavaScript source, SoundManager must be setup by using the following codeblock:
soundManager.setup({
url:'soundmanager2/swf',
onready: function() {
// Once this function's called, we can create a Tom.js instance.
},
debugMode: false
});
Now on the soundManager onready call, Tom.js and the resolvers can be initialized with the following.
// Create Tom Instance
var tom = new Tom();
// Register Resolvers
// (These resolvers can be found in /resolvers in the repository)
tom.registerResolver('soundcloud', new SoundcloudResolver('SOUNDCLOUD_KEY'));
tom.registerResolver('ex.fm', new ExfmResolver('EX_FM_KEY'));
Resolving and Playing
var track = new tom.Track('Newton Faulkner', 'Let\'s Get Together');
track.resolve(function(err, results) {
if(err) return console.error(err);
track.play();
});


Tiny JavaScript library to force client-side session timeout of a web page.
After a set amount of inactivity the web page is cleared and the user must reload in order to continue working. Useful for complying with baroque security requirements.
Why? This script is:
less than 2k minified (see forced-timeout.min.js
),
has no external dependencies (no jQuery/YUI/Sensha),
works in browsers as old as IE5, and
MIT licensed (use for whatever, I don't care)
To use forced-timeout.js, simply add the following to your page:
<script type='text/javascript' src='forced-timeout.min.js'></script>
See test.html
for a complete example, or read on for additional
instructions.
The session expiration time and message can be configured using
optional <meta>
tags, like this:
<!-- set timeout to 5 minutes and message to "Later, Skater!" -->
<meta id='x-forced-timeout-time' value='5'/>
<meta id='x-forced-timeout-text' value='Later, Skater!'/>
<!-- load forced-timeout.js -->
<script type='text/javascript' src='forced-timeout.js'></script>
You can also use the x-forced-timeout-debug meta tag to set the expiration time to 10 seconds (for debugging):
<!-- set session timeout to 10 seconds -->
<meta id='x-forced-timeout-debug' value='1'/>
If you need to do some cleanup or automatically redirect to an
authentication page, you can listen for a forcedtimeout
event on
the document element:
// sample function
function bye() {
alert('bye!');
}
// do something after forcedtimeout event
if (document.addEventListener) {
// modern browsers, ie9+
document.addEventListener('forcedtimeout', bye, false);
} else {
// older browser fallback
document.onforcedtimeout = bye;
}
By design, the forcedtimeout
event triggers after the session
timeout has occurred, so stopping the event will not prevent the
timeout.
All configuration is optional. That said, below is a full list of
configuration options that can be specified via <meta>
tags:
x-forced-timeout-time: Time (in minutes) before session expiration. Defaults to "30" if unspecified. Example:
<meta id='x-forced-timeout-time' value='10'/>
x-forced-timeout-text: Text to replace page contents with on session expiration. Defaults to "Session Expired." if unspecified. Example:
<meta id='x-forced-timeout-text' value='Later, Skater!'/>
x-forced-timeout-events: Space-delimited list of events to watch for. Defaults to "mousemove keyup" if unspecified.
<meta id='x-forced-timeout-events' value='mousemove scroll'/>
x-forced-timeout-debug: Set to '1' to force expiration time to 10 seconds and polling interval to 5 seconds. Useful for debugging. Defaults to "" if unspecified. Example:
<meta id='x-forced-timeout-debug' value='1'/>
forced-timeout.js
, to
generate the minified version and documentation.Copyright (c) 2014 Paul Duncan<EMAIL_ADDRESS>All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
The names of contributors may not be used to endorse or promote products derived from this software without specific prior written permission.


| Attributes |
| Name | Required | Request-time | Type | Description |
| binding | no | false | javax.el.ValueExpression | Using an EL expression, bind the component reference to a bean property, so that the component may be accessed in the bean. |
| customExporter | no | false | java.lang.Object | Specifies an object that implements a custom format type to use instead of one of the built-in formats. When this attribute is specified, it will override the "type" attribute. The object must extend org.icefaces.ace.component.dataexporter.Exporter. |
| encoding | no | false | java.lang.String | Define a character encoding to use. Default = 'UTF-8'. |
| excludeColumns | no | false | java.lang.String | Define a comma separated list of column indexes (zero-relative) to be excluded from export. |
| expandedOnly | no | false | boolean | When using row expansion in the table, specify whether the child rows should be exported only if the parent row has been expanded by the user. Default = 'false'. |
| fileName | yes | false | java.lang.String | Define the filename of the generated file, defaults to dataTable id. |
| id | no | false | java.lang.String | The component identifier for this component. This value must be unique within the closest parent component that is a naming container. |
| includeFooters | no | false | boolean | Disable whether column footers should be included at the bottom of the file. This is not applicable when attribute 'type' is set to 'xml'. Default = 'true'. |
| includeHeaders | no | false | boolean | Disable whether column headers should be included at the top of the file. This is not applicable when attribute 'type' is set to 'xml'. Default = 'true'. |
| label | no | false | java.lang.String | Define the text that will appear on the button to trigger the export. Default value is 'Export'. Attribute applies only if the component has no children. |
| pageOnly | no | false | boolean | Enable to export only the current page instead of the whole data set. Default = 'false'. |
| postProcessor | no | false | javax.el.MethodExpression | Defines a public void method to invoke after the PDF or XLS document has been generated, allowing developers to manipulate the document. It must take a single argument of type Object. The object will be of type com.lowagie.text.Document (iText library) for PDF documents and of type org.apache.poi.ss.usermodel.Workbook (Apache POI library) for XLS documents. |
| preProcessor | no | false | javax.el.MethodExpression | Defines a public void method to invoke before the PDF or XLS document is generated, allowing developers to manipulate the document. It must take a single argument of type Object. The object will be of type com.lowagie.text.Document (iText library) for PDF documents and of type org.apache.poi.ss.usermodel.Workbook (Apache POI library) for XLS documents. |
| rendered | no | false | boolean | Return true if this component (and its children) should be rendered during the Render Response phase of the request processing lifecycle. Default = 'true'. |
| selectedRowsOnly | no | false | boolean | Enable to export only the currently selected rows instead of the whole dataset. Default = 'false'. |
| style | no | false | java.lang.String | Custom inline CSS styles to use for this component. These styles are generally applied to the root DOM element of the component. This is intended for per-component basic style customizations. Note that due to browser CSS precedence rules, CSS rendered on a DOM element will take precedence over the external stylesheets used to provide the ThemeRoller theme on this component. If the CSS properties applied with this attribute do not affect the DOM element you want to style, you may need to create a custom theme styleClass for the theme CSS class that targets the particular DOM elements you wish to customize. |
| styleClass | no | false | java.lang.String | Custom CSS style class(es) to use for this component. These style classes can be defined in your page or in a theme CSS file. |
| target | yes | false | java.lang.String | Define the id of the ace:dataTable whose data will be exported. |
| type | yes | false | java.lang.String | Define the format of file export. Available formats: "xls","pdf","csv", "xml". |
| userColumnOrder | no | false | boolean | Specify whether the columns should be exported according to the order established by the user in the client. When false, the column order defined in the markup will be used. Default = 'true'. |


Reports
JRadioButton
components which are not placed in a
ButtonGroup
. A quick fix is available to group radio buttons placed in adjacent grid cells.


Shreenath City is a leading township located in Talawali chanda A.B. Road, Indore.Find the meaning of true luxury in cultural environment.With rain water harvesting and ground water recharging.Our township is secured with 8 ft. high Boundary wall which will make you feel more safe.To take care of your health we have a wonderful Jogging Track.We also have kids Play Area, Landscaping & Theme Garden, Grand Entrance Lobby & Gate.Our township is CCTV secured also
Shreenath City is a leading township located in Talawali chanda A.B. Road, Indore.Find the meaning of true luxury in cultural environment.With rain water harvesting and ground water recharging.Our township is secured with 8 ft. high Boundary wall which will make you feel more safe.To take care of your health we have a wonderful Jogging Track.We also have kids Play Area, Landscaping & Theme Garden, Grand Entrance Lobby & Gate.Our township is CCTV secured also


written by Joćo Pedro Neto,
with
Claude Chaunier's
invaluable contribution
The place seemed quiet. The rare night welcomed both moons. Xlior, the largest, shined with a confusing mixture of reds and yellows from both Grut the Old, and Hurt the New, the Suns of this binary system. Zork landed the spaceship very softly into the golden desert.
"Nice place!" - said Turn.
"Sort of..." - replied Zork.
"What do you mean?"
"Kind of dangerous, but don't worry... It's night!"
"Night!!!? What makes it dangerous?" - asked Turn with some anxiety.
"Little bugs! Crawl in you legs, and NAG!" - Zork said that with a strange noise directly from his two hidronoizels.
"And we are here!?!?! How long is a night?"
"Never know... Binary systems have confusing days and nights!" - said Zork very seriously.
"You are kidding me, right?"
"Right!" - and Zork smiled with Turn's relief.
Turn walked into the ship, took the xhe'noh projector and created a set of chess boards within the virtual field of that strange artifact.
"A game?" - asked Turn.
"Sure! But what game?"
"Chess, of course!"
Zork seemed a little confused.
"I suppose you wanted to ask what chess variant?"
"Right!"
"Anyone! I always saw myself as a meta chess player! Give me the rules, and let's move on!" - said Turn in an exciting mood - "Well, I remember when I showed you the Hitchhiker's Guide, we were playing TIDE chess."
"FIDE!"
"Yeah, yeah... FIDE Chess. What about something for a change?"
"Ok for me! What are your thoughts?"
"I always wanted to play some Space-Time variants, but never had the change for it!"
"Why? No opponent?"
"Nope... No Time!"
Time is not an arrow or a river that never flows backwards. Time is the maker of worlds and galaxies, Time is the impenetrable white core of all black holes, it's the entropy that flows in your body and mind. But Time is also the most powerful entity that accepts any credit card to change direction for a week or two.
"Most games start from the beginning, right?" - asked Turn.
"Right! What else?"
"Ļ know one that does not!"
Progressive RetroChess by the CV community
"Wow! So you run faster and faster just to arrive at an initial setup?"
"Yes! It means twisting Time and making it go backwards!"
"Hmmm..."
"What?"
"Does that mean that Time Travel is possible?"
"Beats me, but the Guide should have something more to say about it!"
Time Travel is possible! Those who think that an impressive number of impossible paradoxes arise from that possibility are the same who thought that printing newspapers on strawberries was a ridiculous thing to do. They don't laugh now, after feeling the might of the Zillion Zorkmids of the Strawberry Industries and News (SIN) cartel.
[HG2C page -5]
The King's Time Escape by Claude Chaunier
"What does the introductory comment have to do with Chess or even Time Travel???" - asked Zork
"Oh... It's just a commercial banner from SIN! They do have a lot of money..."
Zork looked at his friend in surprise... Well, the Guide editors must make a living... - he thought
"Anyway," - he changed the subject - "are there other ways to see Time?"
"Sure!"
"How?"
"Well, Time is a kind of cake..."
"A Cake??"
"Well, kind of... It has layers... Time within Time within Time..."
Simulated Chess by Claude Chaunier
"And this can even go further!" -said Turn going to the next integer page.
Self-referential Chess by Claude Chaunier
"That“s strange..."
"What? Time layers?"
"No, comparing it with a cake!" - said Zork
"It“s just a narrow way to see it! The Guide talks a bit about this..."
Time is usually seen as a straight arrow moving forward. This movement metaphor is poor, since it only brings to the curious mind, the opposite sense of travel back in Time. However, there are other ways, like turning right or left, even go up or down in Time. Time does not have one single dimension, It can flow in different orthogonal ways at "the same time". This is an active field of study at VariantsTown, where many new games are prepared to represent this temporal complexity. Variants where one player goes backward with the two colors and the other forward with the two colors; where both players change direction at their convenience; or where white pieces always go forward and black pieces backward - like anti-matter which can be seen just as matter going backward. Time is just like a Cake!
[HG2C page 324+6.2i]
"But there is also a definitive way to see Time!"
"Yes?"
"Not seeing Time!"
One Shot Chess by Joćo Pedro Neto
. . q .   r .  r .  n .  n .  p .
"Curious..." - commented Zork - "But, if we do not have Time, what else remains?"
Space is not continuous. Early civilizations called quanta some discrete parts of space. Deeper scientific theories have found that each quantum is made of squara (or squares) forming nxn boards. A quantum's behavior is defined by chess rules and specific game dynamics within its core. Quanta close together have similar game dynamics, but the rules are basically the same. What nobody knows is which variant Nature plays.
"Can quanta be divided?" - asked Zork absent-mindedly.
"Into smaller quanta, you mean?"
"Yes..."
"Well, no, that's why they call them Quanta." - Turn claimed.
"Hmm..." - Zork didn't look convinced.
"But we can split Pieces!" - Turn quickly added.
  White can win with the simultaneous B/2axc8 B/2dxc8:
If it is Black's turn however, Black may try to split and escape quickly, for example with K/8c7 K/8c6 K/8c5 K/8c4 K/8c3 K/8c2 K/8b8 K/8a8, but White can easily capture it all immediately. It seems better for the Black King to capture one half of a Bishop and to reunite itself with K/2xd5 K/2c8.. . k .  B/2 . . . . B/2 . . .
"So Space is not only about boards, it's also about objects!" - said Turn.
"Of course! But there are also a lot of variants dealing with N-dimensional topologies!"
"I think there is something about that in the Guide" - Turn looked into the dimensional chapters of the HG2C and selected one little passage:
The default Chess board limits itself into two dimensions, those called ranks and columns. However, since Space is multidimensional, there is also a set of Chess games with other connections made between the squares where pieces lies. A simple sample are those variants where a third dimension is added. Some ancient legends talk about a game, in the Onyx system, with 65536 dimensions and just a King on each side. The looser is the player who, after some finite turns, cannot find his King on the board.
[HG2C page 681]
"Nice one!" - Zork laughed - "But I don't like those, I prefer the variants that change the way squares behave!"
"How?"
     x .  N . . . .   N . r . . . . . K . R . . .  K .
"So, you say that you redefine the squares, but what you are doing is changing the board topology into some invisible ways."
"I suppose, but many connections between things are invisible!"
"True, true!"
 k .  k .  r .  r .    N-N . . . .
Some notes:
"Curious... Now, there is no strange topology, but a different way for the pieces themselves to see Space."
"Yes! On this game, the Universe stretches and shrinks upon request."
"Even the other pieces change sizes - from their point of view of course!"
"When speaking of Chess, that's all it matters!"
The Universe is a global entity that surrounds everything! In a sense, the Universe IS everything. But in the other sense (if there were just two senses...), the Universe is how YOU see it, nothing more, nothing less. So, in principle, the way you see it can change the Universe, if you know how. If not, you had better change the spaceship's trajectory when a massive meteor is coming your way!
[HG2C page 76576]
"But, the pieces can be just that, simple concepts that obey the rules of their strange Universe!"
"Sure! Read this text and this variant:"
Boards are the archetype of Space. Different boards reflect on different Universe topologies, and their connectivity induces the Laws that shape that Universe. Despite the fact that square boards are the best approximation to our daily life, galactic travels showed in practice that our own conceptual boards are not plane! After many theoretical efforts to explain this curvature in Space-Time, the only possible explanation surfaced the sky of VariantsTown - the curvature has its source in the overweight of the two fat Kings that are playing the game governing our entire Universe.
  p . . . . O . O . O O .  n .  N O B . .  O K . . . .   O . .  O B . . n . . n .   p . . . .   Nc3 Nf6 3. g1=Q b1=Q ...
Some notes:
"I suppose that if they were able to, all those pieces would get some odd laws of Nature to explain the behavior of their Universe!" - commented Zork.
"Is'n it exactly what we do?" - said Turn in a whisper - "And that reminds me of something else!"
A chess King read an old book, where a Red Queen, in order to exercise her mind, thought daily about a couple of impossible things just before breakfast. For his royal intellect, he thought, that would be easy to do and he started to create impossible games to see his servants play them. After some months of hard times trying to learn and waste time with those strange games, his Minister approached the King and said the following: "Your Majesty, I'm very happy about your ideas and wonderful games, but isn't that a trivial task for someone so wise and powerful? You, my Liege, could aim at higher goals!". The King was surprised. "What is more difficult than an impossible game?", he asked. "Creating a number of possible rules to achieve an impossible game is hard, but creating an impossible number of rules to achieve a possible game is even harder!", the Minister answered. "I have an idea", the King said, "I will create an impossible number of rules to define a possible game". "Magnificent idea, my King", the Minister said, "You are a true genius!", "I know, my honest Minister, I know...". Then the King went to his castle and stayed there until the brightest Sun of the System got old and red and hotter, expanded and consumed his world, the castle, the King and the fading memory of his wise Minister.
[HG2C page 3.14159265...]
"paradox?" - said Zork
"Paradox!"
"What?"
"You said Paradox with a lowercase p"
"Er... What do you mean by that?"
"Never mind!"
...
Sidestepping Chess by Claude Chaunier
"That reminds me of an eternal cycle, a kind of perpetual momentum machine" - said Zork
"Indeed it does! Or an infinite hole, where pieces always return after falling!"
"Paradox!"
"You got it right, this time!"
The Looping Flow of Chess by Claude Chaunier
"These are weird games!" - commented Zork after trying to imagine how he may play them.
"You didn't see anything yet!"

Some notes:
"This is getting too weird!" - said Zork.
"Well, and we just started..." - answered Turn moving his hand into the gold sand - "Have you ever wondered that an Holobook may always have a page between any two pages?"
"How is that?"
"Check this Guide section: Between pages 8201 and 8202, there is an addendum numbered 8201 1/2"
"Ok! And so what?"
"So, check what is on the left side of page 8201 1/2!"
Zork pressed the left button. Page 8201 appeared!
"No, no" - said Turn, "Use the Cantor left button. No... yes, that one!"
Page 8201 1/4 appeared.
"Now, once more!"
Page 8201 1/8.
"Now turn back a couple of times!"
Pages 8201 3/16, 8201 7/32 and 8201 15/64 showed their unique faces.
"What happened? From where all these pages came from?"
"Addendums of addendums of addendums... Don't worry, that's why there is the Natural forward and backward buttons in the Guide. If you only had the Cantor buttons, and started at page 1, you would never get to page 2."
"Is that true?"
"Well, you would need a pretty impressive number of eons to do that!" - said Turn in a grin. He opened his hand, dropping myriads of sand particles and returning them to the vast golden desert.
  k . . . . . k .  n . . . . . n .  O p . . => . O . p .  O . O . . O . . O . . . R K . . . R R K . . ^
Variant:
Some notes:
"That's a melancholic-oriented game..." - added Turn.
"A what?"
"To those people that feel a deep melancholy about something in the past"
"That's a way to classify games?"
"Sure! Why not? Imagine: you can classify games by goal, by move attributes, by board topology, or even by color!"
"Color?"
"TrexMex Chess must be played with yellow Bishops, or else..."
"Don't tell me!"
"Right!
"I suppose there are games for love and for rage!"
"More for rage than for love..." - Turn looked into the dark sky - "but yes, there are!"
"Let me check the Guide!"
Clone and Destroy by Joćo Pedro Neto
note: The Knight is a very powerful piece in this variant
"Wanna play?" - asked Turn
"No! No!"- said Zork - "And what about love?"
"Here is a good example"
Romeo and Juliet by Joćo Pedro Neto
"So, each Queen is in love with the other King?" - said Zork.
"I guess so! There is also a component of envy, but that always comes along with love..."
"Who are those guys?" - asked Zork.
"If I recall well, it's a story written by William Othello, who lived on Elsinore. These are two people that met and fall in love during a Tempest on a ship with a lot of mad and crooked Kings!"
"Oh, a Chess story!"
"What else?"
Turn switched on the mentu-arkanoid, the antigravitical auxiliar device, and the spaceship traveled in a complete silence through the empty darkness of the Planet. The wind welcomed their faces, and they felt the softness of the moment. After a while, Zork said:
"That method is interesting. See how you feel and pick the appropriate game!"
"There is always the possibility that your opponent mood is different from yours. That's why there are some games with different setups and rules for each player. Anyway, it's a price to pay for such an absorbing classification. Some games are hybrids, they fall into two categories of games."
"There are shades of gray between classes?"
"Sure! There are always enough shades to surprise anyone of us!"
Life does not fit on just Black and White. Since mixing is possible and often occurs, an infinite set of shades populate the Universe and Everything (and that means a lot of things!). Amazingly, this is a territory yet to be discovered on the world of CVs, just compared to the potential market for spherical bananas!
[HG2C page 10000]
Shades of Gray by Joćo Pedro Neto
"Don't forget one thing!" - said Zork, after reading the rules.
"What?"
"Shadows!"
Light and Shadows by Joćo Pedro Neto
note: Since Kings are not limited by dark/light forces, they may
be useful to enlighten/darken nearby square areas.
note: To
play, you may use an extra chess board and a
set of small numbered pieces of paper to record the square's LV.
"Shades are everywhere!" - said Zork seeing a thin horizontal line of light on the horizon
"The Candle or the Sun fighting darkness inside a circle of light!" - answered Turn with an ancient almost forgotten sentence
"Or the opposite!"
"How?"
"The Dark Matter that fights light inside a circle of darkness."
"Are you mentioning Black Holes?"
A Black Hole is a place where all the White squares has been removed from the local representational Chess board. That means that almost no Chess games can be represented, and so, almost all Laws of Nature collapse! By the Law of Symmetry, there must also be some places where no Black squares exist, creating White Holes. Some primitive civilizations thought that would be the Quasars, but that's not true! White Holes, for some unknown reason are not known in this Galaxy! This may be a fantastic statistical shift. Another theory says that White Holes may be inside Black ones, by some other force that needs to be explained or even found!
[HG2C page 999]
Relentless Black Hole Chess by Joćo Pedro Neto
"Captured by the Universe..."
"Well, Turn, remember when I said that I was kidding?"
"Yes?"
"I was kidding about not knowing when the night ended, not about the deadly crawling daylight bugs!"
Hurt's light started to appear in the southern horizon. The night was fading away...


Guilherme Freitas
Master's in Software Engineering.
Hey! My name is Guilherme, nice to meet you. I am a researcher and software developer with focus on Java. Currently, I am working in the electronic payments business, developing the most used API platform in Brazil for electronic payments by acquirers and facilitators. On the daily basis, I use Spring Boot as the main framework and knowledge in relational and non-relational databases, reactive and non-reactive data streams such as Kafka, development using an event-driven paradigm, and integrated and unitary testing framework.
As a researcher, I am member of Collaborative and Automated Software Engineering CASE Lab and Research Group at Digital Metropolis Institute IMD. In 2020 I finished my master’s in Software Engineering at the Department of Informatics and Applied Mathematics DIMAp. My advisor was Professor Uirá Kulesza. In my research, I study the impact of continuous integration adoption on several software quality metrics.You can download my research here. My bachelor’s degree (2017) was in Systems Information. I was advised by Professor Dennis Sávio. We developed an agile project management tool integrated with GitHub and tested with software engineer students. You can download my research here.
My research interests are systems performance evaluation techniques and mining of software repositories with focus on several software quality metrics. I am currently researching the impact of continuous integration on code and design software quality metrics .


|
Name
|
{{ team?.name }}
|
|||||
|
|
Home Games
|
{{ team?.teamConfigPreLoaded?.homeGamesMin }}
|
|
(min)
|
||
|
{{ team?.teamConfigPreLoaded?.homeGamesMax }}
|
|
(max)
|
||||
|
|
Away Games
|
{{ team?.teamConfigPreLoaded?.awayGamesMin }}
|
|
(min)
|
||
|
{{ team?.teamConfigPreLoaded?.awayGamesMax }}
|
|
(max)
|
||||
|
|
Consecutive Home Games
|
|
{{ team?.teamConfigPreLoaded?.consecutiveHomeGamesMax }}
|
Using league's configuration
|
(max)
|
|
|
|
Consecutive Away Games
|
|
{{ team?.teamConfigPreLoaded?.consecutiveAwayGamesMax }}
|
Using league's configuration
|
(max)
|


Adding datapoints in real time with heatmap.js
Looking for more examples?
Check out the full
list of all heatmap.js examples
with more pointers & inline documentation.


Room Navigation
Menu
Home
Graph
Instruction
Room navigation can be a complex task for a mobile robot.Mobile robot can be used in many applications such as indoor and outdoor security patrols, material transport.
Run
Evaluate
Graph
Instruction:
X:
Y:
Z:


I am currently a Cloud Engineering student who is working towards the AWS Cloud Practioner certificate. I am currently on the AWS ReStart Programme with TechTalent Academy which is an intensive 12 week course with a mix of classroom lectures and labs that are able to complete at home. I have always had a strong interest in IT and Computing, and have finally decided to pursue my career goal of working in IT and Computing.
I have many skills some of them include: problem-solving, work good as an individual or as part of a team, great communication skills, fast learner, and the abaility to work with pressure and deadlines. I am looking at taking the next step and getting into the I.T industry and gaining an entry level role within the IT industry.