Development guide for TVTK¶
- Author
Prabhu Ramachandran
- Contact
- Copyright
2004-2011, Enthought, Inc.
Contents
Introduction¶
This document provides some details on how TVTK works and how it is implemented. Basic documentation on the installation, features and usage of tvtk is provided in the README.txt file that should be in the same directory as this file.
How tvtk works¶
All tvtk classes derive from TVTKBase. This is defined in tvtk_base.py. TVTKBase provides basic functionality common to all tvtk classes. Most importantly it provides for the following:
Allows one to wrap an existing VTK object or create a new one. TVTKBase.__init__ accepts an optional VTK object, that can be used to wrap an existing VTK object. Read the method docstring for more details.
Sets up the event handlers that allow us to listen to any changes made to the underlying VTK object.
Basic support for pickling the object.
The update_traits automatically updates the traits of the tvtk class such that they reflect the state of the underlying VTK object.
Common code to change the underlying VTK object when the trait is changed.
As mentioned above, tvtk classes can either wrap an existing VTK object or create a new one and manage the new object.
Automatic trait updation¶
One very important feature of tvtk objects is that any VTK related traits of object are dynamically updated if the underlying VTK object is changed. This is achieved by adding an observer to the VTK object that effectively calls TVTKBase.update_traits when the ‘ModifiedEvent’ is invoked. Here is an example of a VTK observer callback:
>>> import vtk
>>> p = vtk.vtkProperty()
>>> def cb(obj, evt):
... print obj.__class__.__name__, evt
...
>>> p.AddObserver("ModifiedEvent", cb)
1
>>> p.SetRepresentationToWireframe()
vtkOpenGLProperty ModifiedEvent
As can be seen, when the property is modified, the callback is called. The trouble with this approach is that p now holds a reference to cb. Thus if cb were the update_traits method of the tvtk class that manages the VTK object, we run into a non-garbage-collectable reference cycle issue and a huge memory leak. To get around this we use the functionality provided by messenger.py. Effectively, TVTKBase.__init__ tells messenger to call self.update_traits when it is called back from the VTK object. Messenger itself uses weakrefs so the reference cycle problem does not exist. The VTK object basically calls messenger.send and messenger takes care of the rest. This allows the tvtk class to be safely used and also allows for automatic trait updation.
Each tvtk class has an attribute called _updateable_traits_. This is a tuple of tuples. Each tuple contains a pair of strings like so:
>>> p = tvtk.Property()
>>> p._updateable_traits_[:4]
(('opacity', 'GetOpacity'),
('frontface_culling', 'GetFrontfaceCulling'),
('point_size', 'GetPointSize'),
('specular_color', 'GetSpecularColor'))
The first string is the name of the trait and the second the name of the function used to obtain the value of the trait from the VTK object. TVTKBase.update_traits uses this tuple and for each trait it calls the relevant VTK ‘get’ function and updates the value of the trait.
While this whole process seems to be inefficient, it actually works quite well in practice and does not appear to be slow at all.
Messaging¶
The messaging functionality is defined in tvtk/messenger.py. Unit tests are in the ‘tests/’ directory. As described in the previous section, tvtk objects use the messenger functionality to ensure that the traits are always up to date. messenger.py is well documented and tested. So please read the docstrings for more details. Here is some basic information from the documentation.
messenger.py implements a simple, robust, safe, Messenger class that allows one to register callbacks for a signal/slot (or event/handler) kind of messaging system. One can basically register a callback function/method to be called when an object sends a particular event. The Messenger class is Borg. So it is easy to instantiate and use. This module is also reload-safe, so if the module is reloaded the callback information is not lost. Method callbacks do not have a reference counting problem since weak references are used. The main functionality is provided by three functions, connect, disconnect and send.
connect basically allows one to connect an object, obj, that emits an event, event to a callback function, callback.
When an object calls send, it passes itself, the event it wishes to emit along with any optional arguments and keyword arguments to send.
The messenger class thus provides a simple observer pattern implementation that makes it easy to do inter-object communication. For further details please read the code and docstrings. Also look at the test suite in tests/test_messenger.py.
Pickling¶
TVTKBase provides the basic functionality for pickling. Essentially, the dictionary (self.__dict__) of the tvtk object is pickled. The _vtk_obj attribute is not pickled since VTK objects are not picklable. Other irrelevant attributes are also removed. __setstate__ works even on a live object by checking to see if self._vtk_obj exists. Some of the tvtk classes override these methods to implement them better. For example look at the code for the Matrix4x4 class.
Array handling¶
TVTK lets the user pass Numeric arrays/Python lists in place of the DataArray, CellArray, Points etc. classes. This is done by finding the call signature of the wrapped VTK method, checking to see if it has an array and then intelligently generating the appropriate VTK array data using the signature information. This generated VTK data array is then passed to the wrapped function under the covers. This functionality also works if the method has multiple call signatures (overloaded VTK method) and one of them involves arrays. The main functions to do this conversion magic are in the array_handler.py module. The wrapper_gen.py module generates the appropriate wrapper code depending on the call signature. So if a method has no VTK objects in its signature, no wrapping is necessary. If it only has non-array VTK objects, then array handling is unnecessary but one must dereference the VTK object from the passed tvtk wrapper object. If the call signature involves VTK array objects, then any Numeric arrays or Python lists are converted to the correct VTK data array and passed to the wrapped VTK object.
For the efficient conversion to CellArray objects, an extension module is required. The sources for this extension module are in src/array_ext.*. The Cython file can be used to generate the src/array_ext.c file like so:
$ cd src
$ cython array_ext.pyx
The sources ship with the generated source file so that folks without Cython can build it.
special_gen.py defines all the additional methods for the DataArray and other classes that allow these objects to support iteration, __repr__, __getitem__ etc.
The magical tvtk instance¶
When one does the following:
>>> from tvtk.api import tvtk
The imported tvtk is really an instance of a class and not a module! This is so because, the tvtk classes are almost 800 in number and they wrap around the entire VTK API. VTK itself allows one to import all the defined classes in one go. That is, if one does import vtk, one can instantiate all VTK related classes. This is very useful functionality. However, importing 800 wrapper classes in one go is extremely slow. Thus, tvtk provides a convenient solution to get around the problem. While tvtk is a class instance, it behaves just like you’d expect of a module.
It supports tab-completion on class names.
Allows one to access all the tvtk classes.
Imports extremely fast. Any slowness in the import is really because tvtk needs to import VTK. Thus importing tvtk should not be much slower than importing vtk itself.
Imports the tvtk classes only on demand.
All the tvtk related code is generated and saved into the tvtk_classes.zip file. The tvtk instance is basically an instance of the TVTK class. This is defined in tvtk_helper.py. This file is inside the ZIP file. For each wrapped VTK class, TVTK defines a property having the name of the wrapper tvtk class. The get method of the property basically returns the class after importing it dynamically from the ZIP file. This is done in the get_class function. Each class thus imported is cached (in _cache) and if a cached copy exists the class is not re-imported. Note that in the implementation, the class and its parent classes need to be imported. These parent classes are also cached.
enthought/tvtk/__init__.py adds the tvtk_classes.zip file into sys.path and instantiates the TVTK class to provide the tvtk instance.
Note that any files inside the tvtk_classes.zip are automatically generated.
Miscellaneous details¶
tvtk_base.py defines some important and frequently used traits that are used in tvtk. It is used by all the tvtk classes. It provides a couple of useful functions (get_tvtk_name and camel2enthought) to perform name mangling so one can change the VTK method name to an enthought style name. The module also provides the function deref_vtk, that lets one obtain the underlying VTK object from the tvtk object.
Code Generation¶
All the tvtk classes are dynamically generated. code_gen.py is the main driver module that is responsible for this. Code generation works involves the following steps.
Listing and sorting all the VTK classes into a class hierarchy. This is done by class_tree.py. ClassTree basically organizes all the VTK classes into a tree structure. The tree is organized into “levels”. The classes with no bases are at the lowest level (the root) and the higher levels represent classes that have one or more bases. Each class in the tree is represented as a Node. Each node has references to its children and parents. Thus one can walk the entire class hierarchy given a single node. This is fairly generic code and will work with any class hierarchy. Its main function is to allow us to generate the classes in the right order and also allows us to easily find the parents and children of a class in a class hierarchy. More details are in the file class_tree.py. UTSL.
Parsing the methods of each VTK class and categorizing them. This step also involves finding the default values of the state of the VTK objects, the valid range of values etc. This entire functionality is provided by vtk_parser.py. VTK parser module is completely self documenting and the public interface is fairly simple. The VTKMethodParser by default uses an instance of the ClassTree class to do some of its work (the use of the ClassTree can be turned off though).
Formatting the output code correctly (indentation). This is handled by the indenter.Indent class. The Indent class lets us format a code-string suitably so that the code is formatted at the current indentation level.
Massaging VTK documentation suitably. This is done by indenter.VTKDocMassager.
Generating the tvtk code. Done mainly by code_gen.py.
Generating a ZIP file of the code, also done by code_gen.py.
The code_gen module defines a TVTKGenerator class that drives the code generation. The module uses the wrapper_gen module to generate the wrapper classes.
The wrapper_gen defines a WrapperGenerator class. An instance of this class creates an instance of the VTKMethodParser (and uses its internal ClassTree instance). TVTKGenerator uses this class tree.
For each class in the VTK hierarchy (starting from classes at the root of the tree), the class is parsed, and a suitable tvtk wrapper class (with the name of the class and file name of the module suitably modified) is generated using the functionality provided by WrapperGenerator. A separate tvtk_helper module (described in the The magical tvtk instance section) is also simultaneously updated with the class for which the wrapper is generated. All of these classes are dumped into a temporary directory. These classes are then put into a ZIP file.
The tvtk_helper.py code is generated by the HelperGenerator class. The other tvtk classes are generated by the WrapperGenerator class. ‘WrapperGenerator` also makes use of the SpecialGenerator to write special code for some of the VTK classes.
TVTKGenerator uses the other code generators and drives the entire code generation process, builds a ZIP file and optionally cleans up the temporary directory where the wrapper code was written.
Please run the following:
$ python code_gen.py -h
To see a list of options to the code generator. Some of the options are extremely useful during development. For example do this to generate the code for a few classes alone:
$ python code_gen.py -n -z -o /tmp/tvtk_tmp vtkCollection \
vtkProperty vtkConeSource
The -n option ensures that ‘/tmp/tvtk_tmp’ is not removed. -z inhibits ZIP file generation.


The list-item-filter
directive is a fast and simple way to filter li
elements within a ul
or ol
. To use this simply add list-item-filter
as an attribute on the ul
or ol
element. The filter-text
attribute which should be bound to a variable in the controller containing the
text the list should be filtered by.
The only additional step required is to give each li
a key
attribute. This attribute should contain
the text each item should be filtered by.


Working With Media Contents
Working with Image
Use
<Img>
to insert image in HTML document or webpage
Using relative path in image


{% extends "index.html" %} {% block body_content %}
An animation containing a shuffle of 10000 columns will be created here. It will not be insanely demanding on the cpu but might slow down or freeze the browser on old computers or mobile devices.


Success is ... knowing your purpose in life, growing to reach your maximum potential, and sowing seeds that benefit others.
Failure is the condiment that gives success its flavor.
I'm just a dummy button


Reset Your Password
Username/email
We'll send password reset link to your email.
Reset Password
Return to signin


Component: tos.chips.rf230.SoftwareAckLayerC
configuration SoftwareAckLayerC
Provides
interface
RadioReceive
interface
RadioSend
Uses
interface
SoftwareAckConfig
as
Config
interface
RadioReceive
as
SubReceive
interface
RadioSend
as
SubSend
Wiring


Automatically derive odd wrapping behavior for your browser
This is a hack to automatically derive
a spanAffectsWrapping
regexp for a browser. See the
comments above that variable
in lib/codemirror.js
for some more details.
This is a hack to automatically derive
a spanAffectsWrapping
regexp for a browser. See the
comments above that variable
in lib/codemirror.js
for some more details.


Student Description
Details
{% for std_des, detls in result.items() %}
{{std_des}}
{{detls}}
{% endfor %}


Blurred UI
Learning Process:
Background
Navbar
Cards
Credits:
Design and created by Lucas Adriel
Copyright © 2019
Morning
Choose the Period
Afternoon
Choose the Period
Night
Choose the Period


- cacheSize() - Method in class com.glmapview.GLMapRasterTileSource
-
Returns size of cache database
- cancel() - Method in class com.glmapview.GLMapDownloadTask
-
Cancels task.
- cancel() - Method in class com.glmapview.GLSearchOffline
-
Cancels search operation.
- cancelled - Variable in class com.glmapview.GLMapDownloadTask
-
- captureFrameWhenFinish(GLMapView.ScreenCaptureRawCallback) - Method in class com.glmapview.GLMapView
-
Capture frame when surface will be created and loading of resources finished.
- captureFrameWhenFinish(GLMapView.ScreenCaptureCallback) - Method in class com.glmapview.GLMapView
-
Capture frame when surface will be created and loading of resources finished.
- center() - Method in class com.glmapview.GLMapBBox
-
Center of bbox
- changeMapZoom(double, MapPoint, double, int) - Method in class com.glmapview.GLMapView
-
Change zoom level of map.
- changeStyle(GLMapMarkerStyleCollection) - Method in class com.glmapview.GLMapMarkerLayer
-
Change style of layer
- com.glmapview - package com.glmapview
-
- convertDisplayDeltaToInternal(MapPoint) - Method in class com.glmapview.GLMapView
-
Converts a distance between two points on the screen to delta in internal format of GLMapView.
- convertDisplayDeltaToInternal(MapPoint, double, double) - Method in class com.glmapview.GLMapView
-
Converts a distance between two points on the screen to delta in internal format of GLMapView.
- convertDisplayToInternal(MapPoint) - Method in class com.glmapview.GLMapView
-
Converts a point on the surface to an internal map coordinate.
- convertInternalToDisplay(MapPoint) - Method in class com.glmapview.GLMapView
-
Converts a point in internal format of GLMapView to point on the surface of view.
- crashNDK() - Static method in class com.glmapview.GLMapView
-
- crashNDK2() - Static method in class com.glmapview.GLMapView
-
- createDownloadTask(GLMapInfo, Context) - Static method in class com.glmapview.GLMapManager
-
Create map downloading task
- createDownloadTask(GLMapInfo, File) - Static method in class com.glmapview.GLMapManager
-
Create map downloading task
- CreateFromBytes(byte[], byte[]) - Static method in class com.glmapview.GLSearchCategories
-
Loads categories from given source data
- CreateFromGeoCoordinates(double, double) - Static method in class com.glmapview.MapPoint
-
Creates map point from geo coordinates
- createFromGeoJSON(String) - Static method in class com.glmapview.GLMapVectorObject
-
Create an array of GLMapVectorObject from string
- createFromGeoJSONStream(InputStream) - Static method in class com.glmapview.GLMapVectorObject
-
Create an array of GLMapVectorObject from stream
- createGeoLine(MapPoint, MapPoint, double) - Static method in class com.glmapview.GLMapVectorObject
-
Adds big circle line from `start` to `end`.
- createImageGroup(GLMapImageGroupCallback) - Method in class com.glmapview.GLMapView
-
Creates a GLMapImageGroup.
- createMultiline(MapPoint[][]) - Static method in class com.glmapview.GLMapVectorObject
-
Loads multiline geometry to vector object
- createMultilineGeo(MapGeoPoint[][]) - Static method in class com.glmapview.GLMapVectorObject
-
- createPoint(MapPoint) - Static method in class com.glmapview.GLMapVectorObject
-
Loads point to vector object
- createPolygon(MapPoint[][], MapPoint[][]) - Static method in class com.glmapview.GLMapVectorObject
-
Loads polygon geometry to vector object.
- createPolygonGeo(MapGeoPoint[][], MapGeoPoint[][]) - Static method in class com.glmapview.GLMapVectorObject
-
- createStyle(String) - Static method in class com.glmapview.GLMapVectorCascadeStyle
-
Creates cascade style object.
- createStyle(String) - Static method in class com.glmapview.GLMapVectorStyle
-
Creates style object.
- get(long) - Method in class com.glmapview.GLMapVectorObjectList
-
Returns object at the index
- getAngle() - Method in class com.glmapview.GLMapImage
-
Angle of image
- getBBox() - Method in class com.glmapview.GLMapTrackData
-
Retrurns bbox of track
- getBBox() - Method in class com.glmapview.GLMapVectorObject
-
Returns bbox of object
- getBBox() - Method in class com.glmapview.GLMapVectorObjectList
-
Calculate bbox of all objects in list
- getByteCount() - Method in class com.glmapview.GLMapTrackData
-
Size of internal data of GLMapTrackData.
- getCenterTileState() - Method in class com.glmapview.GLMapView
-
- getChildMaps() - Static method in class com.glmapview.GLMapManager
-
Return array of maps including submaps
- getChilds() - Method in class com.glmapview.GLSearchCategory
-
- getCustomObjectCategory(Object) - Method in interface com.glmapview.GLSearchOffline.GLMapSearchCompletion
-
- getCustomObjectLocation(Object) - Method in interface com.glmapview.GLSearchOffline.GLMapSearchCompletion
-
- getDownloadProgress() - Method in class com.glmapview.GLMapInfo
-
- getDownloadTask(GLMapInfo) - Static method in class com.glmapview.GLMapManager
-
Returns download task for map
- getDrawOrder() - Method in class com.glmapview.GLMapImage
-
Returns draw order of image
- getDrawOrder() - Method in class com.glmapview.GLMapTrack
-
Returns draw order of object
- getFontScale() - Method in class com.glmapview.GLMapView
-
- getHeight() - Method in class com.glmapview.GLMapImage
-
Loaded image height.
- getIconName() - Method in class com.glmapview.GLSearchCategory
-
- getImageIndex(int) - Method in interface com.glmapview.GLMapImageGroupCallback
-
Method must return variant of image to use
- getImagePos(int) - Method in interface com.glmapview.GLMapImageGroupCallback
-
Method must return location of image on map
- getImagesCount() - Method in interface com.glmapview.GLMapImageGroupCallback
-
Method must return total number of images that will be displayed by image group
- getImageVariantBitmap(int) - Method in interface com.glmapview.GLMapImageGroupCallback
-
Method must return bitmap to use for given variant of image
- getImageVariantOffset(int) - Method in interface com.glmapview.GLMapImageGroupCallback
-
Method must return offset to use for given variant of image
- getImageVariantsCount() - Method in interface com.glmapview.GLMapImageGroupCallback
-
Method must return number of unique images that will be used by image group
- getLat() - Method in class com.glmapview.GLMapInfo
-
- getLocaleSettings() - Method in class com.glmapview.GLMapView
-
- getLocalizedName(GLMapLocaleSettings) - Method in class com.glmapview.GLMapInfo
-
Return name of map for given locale settings.
- getLon() - Method in class com.glmapview.GLMapInfo
-
- getMapAngle() - Method in class com.glmapview.GLMapView
-
Get current angle of the map.
- getMapCenter(MapPoint) - Method in class com.glmapview.GLMapView
-
Get coordinates of the origin point of the map.
- getMapCenter() - Method in class com.glmapview.GLMapView
-
Get coordinates of the origin point of the map.
- getMapDownloadTasks() - Static method in class com.glmapview.GLMapManager
-
- getMapID() - Method in class com.glmapview.GLMapInfo
-
- getMapOrigin(MapPoint) - Method in class com.glmapview.GLMapView
-
Origin point of the map coordinate system.
- getMapOrigin() - Method in class com.glmapview.GLMapView
-
- getMaps() - Method in class com.glmapview.GLMapInfo
-
- getMaps() - Static method in class com.glmapview.GLMapManager
-
- getMapWithID(long) - Static method in class com.glmapview.GLMapManager
-
- getMapZoom() - Method in class com.glmapview.GLMapView
-
Get current zoom level of the map.
- getMultilineGeoPoints() - Method in class com.glmapview.GLMapVectorObject
-
- getMultilinePoints() - Method in class com.glmapview.GLMapVectorObject
-
Returns points of multiline for object with type of TYPE_LINE
- GetNativeCallbacks() - Static method in class com.glmapview.GLMapTrackData
-
Interface to create and modify track data from jni code.
- getOffset() - Method in class com.glmapview.GLMapImage
-
Offset of image
- getPosition() - Method in class com.glmapview.GLMapImage
-
Position of image
- getRasterTileSources() - Method in class com.glmapview.GLMapView
-
- getSearchCategory(GLSearchCategories) - Method in class com.glmapview.GLMapVectorObject
-
Search category for vector object returned by search
- getSize() - Method in class com.glmapview.GLMapInfo
-
- getSizeOnDisk() - Method in class com.glmapview.GLMapInfo
-
- getStartedWith(String[], GLMapLocaleSettings) - Method in class com.glmapview.GLSearchCategories
-
Returns categories that starts with given words
- getState() - Method in class com.glmapview.GLMapInfo
-
- getStyleOptions() - Method in class com.glmapview.GLMapView
-
- getTop() - Method in class com.glmapview.GLSearchCategories
-
- getType() - Method in class com.glmapview.GLMapVectorObject
-
Returns type of object
- getWidth() - Method in class com.glmapview.GLMapImage
-
Loaded image width.
- GLMapBBox - Class in com.glmapview
-
GLMapBBox is used to define some rectangular area of map
- GLMapBBox() - Constructor for class com.glmapview.GLMapBBox
-
Default constructor.
- GLMapBBox(double, double, double, double) - Constructor for class com.glmapview.GLMapBBox
-
Initialize bbox with given data
- GLMapBBox(GLMapBBox) - Constructor for class com.glmapview.GLMapBBox
-
Copy constructor
- GLMapDownloadTask - Class in com.glmapview
-
GLMapDownloadTask
downloads map and extracts it at the same time
- GLMapImage - Class in com.glmapview
-
GLMapImage
is a bridge class, to work with GLMap internal representation of image on map.
- GLMapImage() - Constructor for class com.glmapview.GLMapImage
-
- GLMapImageGroup - Class in com.glmapview
-
GLMapImageGroup
is a bridge class, to work with GLMap internal representation of image group.
- GLMapImageGroupCallback - Interface in com.glmapview
-
- GLMapInfo - Class in com.glmapview
-
GLMapInfo is information object about offline map.
- GLMapInfo.State - Enum in com.glmapview
-
- GLMapLocaleSettings - Class in com.glmapview
-
`GLMapLocaleSettings` is used to set language order to all `GLMapView` objects
- GLMapLocaleSettings() - Constructor for class com.glmapview.GLMapLocaleSettings
-
Default constructor set order of languages to [Locale.getDefault(), "native"]
- GLMapLocaleSettings(String[]) - Constructor for class com.glmapview.GLMapLocaleSettings
-
Constructor with defined order of languages
- GLMapManager - Class in com.glmapview
-
A singleton object that manages offline maps
- GLMapManager() - Constructor for class com.glmapview.GLMapManager
-
- GLMapManager.StateListener - Interface in com.glmapview
-
- GLMapMarkerImage - Class in com.glmapview
-
Class that hold information of image used by GLMapMarkerStyleCollection
- GLMapMarkerImage(String, Bitmap, Point) - Constructor for class com.glmapview.GLMapMarkerImage
-
Constructor with offset
- GLMapMarkerImage(String, Bitmap) - Constructor for class com.glmapview.GLMapMarkerImage
-
Default constructor
- GLMapMarkerLayer - Class in com.glmapview
-
GLMapMarkerLayer
displays big number of markers with given style.
- GLMapMarkerLayer(Object[], GLMapMarkerStyleCollection) - Constructor for class com.glmapview.GLMapMarkerLayer
-
Initializes GLMapMarkerLayer
with given markers and `styleCollection`
- GLMapMarkerLayer(GLMapVectorObjectList, GLMapVectorCascadeStyle, GLMapMarkerStyleCollection) - Constructor for class com.glmapview.GLMapMarkerLayer
-
Initializes GLMapMarkerLayer
with given vector objects and `style`
- GLMapMarkerStyleCollection - Class in com.glmapview
-
GLMapMarkerStyleCollection
class holds collection of styles, used to draw marker layer.
- GLMapMarkerStyleCollection() - Constructor for class com.glmapview.GLMapMarkerStyleCollection
-
- GLMapMarkerStyleCollectionDataCallback - Class in com.glmapview
-
GLMapMarkerStyleCollectionDataCallback
is called for each marker or cluster to get display data
- GLMapMarkerStyleCollectionDataCallback() - Constructor for class com.glmapview.GLMapMarkerStyleCollectionDataCallback
-
- GLMapRasterTileSource - Class in com.glmapview
-
GLMapRasterTileSource is used to setup custom raster tile source.
- GLMapRasterTileSource(String) - Constructor for class com.glmapview.GLMapRasterTileSource
-
Default constructor of GLMapRasterTileSource
- GLMapTrack - Class in com.glmapview
-
GLMapTrack
is a bridge class, to work with GLMap internal representation of track on map.
- GLMapTrack() - Constructor for class com.glmapview.GLMapTrack
-
Default constructor
- GLMapTrackData - Class in com.glmapview
-
Class holding data for track
- GLMapTrackData(GLMapTrackData.PointsCallback, int) - Constructor for class com.glmapview.GLMapTrackData
-
Constructor with callback
- GLMapTrackData(List) - Constructor for class com.glmapview.GLMapTrackData
-
Constructor from raw data
- GLMapTrackData.PointsCallback - Interface in com.glmapview
-
Callback for filling track data
- GLMapVectorCascadeStyle - Class in com.glmapview
-
- GLMapVectorObject - Class in com.glmapview
-
GLMapVectorObject
is a bridge class, to work with GLMap internal representation of vector object.
- GLMapVectorObjectList - Class in com.glmapview
-
GLMapVectorObject
is a bridge class, to work with GLMap internal representation of array of vector object.
- GLMapVectorObjectList() - Constructor for class com.glmapview.GLMapVectorObjectList
-
Constructor of empty list
- GLMapVectorStyle - Class in com.glmapview
-
- GLMapView - Class in com.glmapview
-
GLMapView is a custom SurfaceView that renders and presents vector map
- GLMapView(Context, AttributeSet, int) - Constructor for class com.glmapview.GLMapView
-
Creates map view
- GLMapView(Context, AttributeSet) - Constructor for class com.glmapview.GLMapView
-
Creates map view
- GLMapView(Context) - Constructor for class com.glmapview.GLMapView
-
Creates map view
- GLMapView(Context, TextureView) - Constructor for class com.glmapview.GLMapView
-
Creates map view
- GLMapView.Animation - Annotation Type in com.glmapview
-
- GLMapView.GLMapPlacement - Annotation Type in com.glmapview
-
- GLMapView.GLMapTileState - Annotation Type in com.glmapview
-
- GLMapView.GLUnits - Annotation Type in com.glmapview
-
- GLMapView.ResourceLoadCallback - Interface in com.glmapview
-
Called when GLMapView need to load some image
- GLMapView.ScreenCaptureCallback - Interface in com.glmapview
-
Called when GLMapView finished rendering map and text to Bitmap
- GLMapView.ScreenCaptureRawCallback - Interface in com.glmapview
-
Called when GLMapView finished rendering map and text to raw data
- GLSearchCategories - Class in com.glmapview
-
`GLSearchCategories` class holds a set of `GLSearchCategory` that will be used to sort search results by priority.
- GLSearchCategory - Class in com.glmapview
-
`GLSearchCategory` class holds information about category that can be displayed to user.
- GLSearchOffline - Class in com.glmapview
-
`GLSearchOffline` class contains a set of parameters that defines search in offline maps
- GLSearchOffline() - Constructor for class com.glmapview.GLSearchOffline
-
- GLSearchOffline.GLMapSearchCompletion - Interface in com.glmapview
-
- scaleMap(double, MapPoint) - Method in class com.glmapview.GLMapView
-
Change zoom level of map in relative units.
- scaleMap(double, MapPoint, double, int) - Method in class com.glmapview.GLMapView
-
Change zoom level of map in relative units.
- screenCaptured(Bitmap) - Method in interface com.glmapview.GLMapView.ScreenCaptureCallback
-
- screenCaptured(int[], int, int) - Method in interface com.glmapview.GLMapView.ScreenCaptureRawCallback
-
- screenScale - Variable in class com.glmapview.GLMapView
-
- screenScale - Variable in class com.glmapview.ImageManager
-
- set(MapPoint) - Method in class com.glmapview.MapGeoPoint
-
Set coordinates of point from map point
- set(MapGeoPoint) - Method in class com.glmapview.MapPoint
-
Set coordinates of point from geo point
- SetAllowedTileDownload(boolean) - Static method in class com.glmapview.GLMapManager
-
Allows
GLMapManager
to download single tiles when downloaded vector maps does not contain data.
- setAngle(float) - Method in class com.glmapview.GLMapImage
-
Set angle of image.
- setAttributionPosition(int) - Method in class com.glmapview.GLMapView
-
Sets position of attribution.
- setAttributionText(String) - Method in class com.glmapview.GLMapRasterTileSource
-
This method is used to set attribution text.
- setBBox(GLMapBBox) - Method in class com.glmapview.GLSearchOffline
-
Sets bounding box where search will be performed
- setBitmap(Bitmap) - Method in class com.glmapview.GLMapImage
-
Set new image to draw
- setCachesDir(String) - Static method in class com.glmapview.GLMapManager
-
Sets location of caches before initialization.
- setCategories(GLSearchCategories) - Method in class com.glmapview.GLSearchOffline
-
Sets categories that used to sort results by importance.
- setCenter(MapPoint) - Method in class com.glmapview.GLSearchOffline
-
Sets center of search.
- setCenterTileStateChangedCallback(Runnable) - Method in class com.glmapview.GLMapView
-
- setClusteringEnabled(boolean) - Method in class com.glmapview.GLMapMarkerLayer
-
Enable or disable clustering for this layer.
- setData(GLMapTrackData) - Method in class com.glmapview.GLMapTrack
-
Set new track data
- setDataCallback(GLMapMarkerStyleCollectionDataCallback) - Method in class com.glmapview.GLMapMarkerStyleCollection
-
Sets dataCallback that will be used by markerLayer to get display information about markers
- setDrawOrder(int) - Method in class com.glmapview.GLMapImage
-
Sets draw order of image
- setDrawOrder(int) - Method in class com.glmapview.GLMapImageGroup
-
Changes draw order of the image group
- setDrawOrder(int) - Method in class com.glmapview.GLMapMarkerLayer
-
Set draw order of layer before adding to GLMapView
- setDrawOrder(int) - Method in class com.glmapview.GLMapTrack
-
Set draw order of track
- setFontScale(float) - Method in class com.glmapview.GLMapView
-
Set scale of font.
- setHidden(boolean) - Method in class com.glmapview.GLMapImage
-
Set visibility of image.
- setHidden(boolean) - Method in class com.glmapview.GLMapTrack
-
Set object hidden
- setLimit(int) - Method in class com.glmapview.GLSearchOffline
-
Sets maximum number of results to fetch from map
- setLocaleSettings(GLMapLocaleSettings) - Method in class com.glmapview.GLMapView
-
Sets map locale settings
- setLocaleSettings(GLMapLocaleSettings) - Method in class com.glmapview.GLSearchOffline
-
Sets locale settings that used to sort results by importance.
- setMapAngle(double) - Method in class com.glmapview.GLMapView
-
Set zoom level of the map.
- setMapAngle(double, double, int) - Method in class com.glmapview.GLMapView
-
Set zoom level of the map.
- setMapCenter(MapPoint) - Method in class com.glmapview.GLMapView
-
Set coordinates of the origin point of the map.
- setMapCenter(MapPoint, double, int) - Method in class com.glmapview.GLMapView
-
Set coordinates of the origin point of the map.
- setMapDidMoveCallback(Runnable) - Method in class com.glmapview.GLMapView
-
Set callback that will be called after move animation finished
- setMapOrigin(MapPoint) - Method in class com.glmapview.GLMapView
-
Origin point of the map coordinate system (X, Y).
- setMapZoom(double) - Method in class com.glmapview.GLMapView
-
Set zoom level of the map.
- setMapZoom(double, double, int) - Method in class com.glmapview.GLMapView
-
Set zoom level of the map.
- setMarkerLocation(long, MapPoint) - Static method in class com.glmapview.GLMapMarkerStyleCollection
-
Sets location of marker on the map.
- setMarkerLocationFromVectorObject(long, GLMapVectorObject) - Static method in class com.glmapview.GLMapMarkerStyleCollection
-
Sets location of marker on the map from vectorObject.point().
- setMarkerLocationLatLon(long, double, double) - Static method in class com.glmapview.GLMapMarkerStyleCollection
-
Sets location of marker on the map.
- setMarkerStyle(long, int) - Static method in class com.glmapview.GLMapMarkerStyleCollection
-
Sets style of marker.
- setMarkerText(long, String, Point, GLMapVectorStyle) - Static method in class com.glmapview.GLMapMarkerStyleCollection
-
Sets text for marker.
- setNeedsUpdate() - Method in class com.glmapview.GLMapImageGroup
-
Trigger update images in group.
- setObjectTag(long, String, String) - Method in class com.glmapview.GLMapVectorObjectList
-
Set tag for given object
- setOffset(MapPoint) - Method in class com.glmapview.GLMapImage
-
Image offset from position.
- setOnSizeChangedCallback(Runnable) - Method in class com.glmapview.GLMapImage
-
Sets callback that is called when image size is changed.
- setPointData(long, int, int, int) - Static method in class com.glmapview.GLMapTrackData
-
Set data for native point.
- setPointDataGeo(long, double, double, int) - Static method in class com.glmapview.GLMapTrackData
-
Set data for native point.
- setPosition(MapPoint) - Method in class com.glmapview.GLMapImage
-
Sets position of image on map.
- setRasterTileSources(GLMapRasterTileSource[]) - Method in class com.glmapview.GLMapView
-
By default rasterTileSources is nil.
- setRotatesWithMap(boolean) - Method in class com.glmapview.GLMapImage
-
Set whether image rotates with the map.
- setScaleRulerBottomText(String) - Method in class com.glmapview.GLMapView
-
Set text that will be displayed under scale ruler.
- setScaleRulerStyle(int, int, MapPoint, double) - Method in class com.glmapview.GLMapView
-
Set style of scale ruler.
- setStyleName(int, String) - Method in class com.glmapview.GLMapMarkerStyleCollection
-
Set name for style that can be used from mapcss
- setStyleOptions(String[]) - Method in class com.glmapview.GLMapView
-
- setText(String, GLMapVectorStyle) - Method in class com.glmapview.GLMapImage
-
Set new text to draw
- setTileRefreshTimeInterval(long) - Method in class com.glmapview.GLMapRasterTileSource
-
Cached tile will be refreshed if it will stay in cache more than given time.
- setTileSize(int) - Method in class com.glmapview.GLMapRasterTileSource
-
This method is used to set size of tile in points.
- setUserInteractionEnabled(boolean) - Method in class com.glmapview.GLMapView
-
If map do not need to handle touches set userInteractionEnabled to false.
- setValidZoomMask(int) - Method in class com.glmapview.GLMapRasterTileSource
-
This method is used to define valid zooms for tile source.
- setValueForKey(String, String) - Method in class com.glmapview.GLMapVectorObject
-
Set value for key
- setWidth(float) - Method in class com.glmapview.GLMapTrack
-
Sets width of track
- SI - Static variable in annotation type com.glmapview.GLMapView.GLUnits
-
- size() - Method in class com.glmapview.GLMapVectorObjectList
-
Returns size of list
- size_x - Variable in class com.glmapview.GLMapBBox
-
X size of the bounding box
- size_y - Variable in class com.glmapview.GLMapBBox
-
Y size of the bounding box
- SortMaps(GLMapInfo[], MapPoint) - Static method in class com.glmapview.GLMapManager
-
Sorts array of
GLMapInfo
by distance from given point
- spannedName(Object, Object, int, GLMapLocaleSettings) - Method in class com.glmapview.GLMapVectorObject
-
Returns spanned name where parts that matched search are highlighted.
- spannedName(Object, Object, int, GLMapLocaleSettings) - Method in class com.glmapview.GLSearchCategory
-
Returns spanned name where parts that matched search are highlighted.
- start() - Method in class com.glmapview.GLMapDownloadTask
-
Starts map downloading
- start(List, GLSearchOffline.GLMapSearchCompletion) - Method in class com.glmapview.GLSearchOffline
-
Starts search.
- startDecelerate(MapPoint, double) - Method in class com.glmapview.GLMapView
-
Starts decelerate animation.
- startImagePositionAnimation(GLMapImage, MapPoint, MapPoint, double, int) - Method in class com.glmapview.GLMapView
-
Animate position of image.
- surfaceChanged(SurfaceHolder, int, int, int) - Method in class com.glmapview.GLMapView
-
- surfaceCreated(SurfaceHolder) - Method in class com.glmapview.GLMapView
-
- surfaceDestroyed(SurfaceHolder) - Method in class com.glmapview.GLMapView
-


Overview | Reports | Quarter | Contract
| Vendor Name: | DELSYS RESEARCH GROUP INC. |
| Reference number: | K8A53-14-9127 |
| Contract Date: | 2015-03-19 |
| Description of work: | 0491 Other Prof. Serv. - Management consulting - OGD or programs |
| Contract period: | 2015-01-21 to 2015-03-31 |
| Delivery Date: | |
| Contract Value: | $21,712.50 |
| Comments: | Provision of services to identify, categorize, determine interests, and analyze the major stakeholders for marine oil spill research in Canada across all sectors |


Since 7th grade, game development was my passion - mainly the programming portion. I loved creating game mechanics and I was the master of the worlds I created. Then, I attended the University of Texas at Austin with the hopes of getting into their Arts and Entertainment Technology major program because of its focus in game development. My first time applying to the major ended in rejection. However I did not let that stop me and I applied again the year after and I managed to get accepted during one of their most competitive years for selection at that point. However, as I took more classes on computer science fundamentals, computer programming, web design and interaction, and taking web development courses on Udemy my interests shifted to web/software development. With my prior knowledge of game programming, I realised that my skills could transfer to software development as well. Unfortunately I was unable to transfer into UT's Computer Science Program, however I will not let this stop me from pursuing software development as a career. Programming for games has been a blast and I will never stop doing it, but my main focus now is creating more practical applications that I can apply to real world problems and situations. Creating my own website has been one of the most enjoyable projects I have done - comparable to participating in the 2019 Diversity Hackathon and HackTx. I do not regret making this transition to software development and I hope to learn more about it each day I pursue this career.


Demonstrates using ColorMatrixFilter and BlurFilter. Adjust sliders to view results.
ColorMatrixFilter
BlurFilter


Toggle navigation
Inventory DB
Home
Logout
Tools
Change Profile (Name, Email, or Password)
Check Loaner or Return Request from Other Users
Batch Add Parts
Add a New Part
User Guide
User Group Management
User Guide
Welcome {{firstname}}


This field lets you set a "name" for each Code Dx analysis published from Jenkins. Analysis names are mainly used to identify the bars in the "First Seen" and "Last Modified" filters on Code Dx's Findings page.
You can use build/environment variables to construct a different name for each analysis. For example:
Build #${BUILD_NUMBER}
would create the name `Build #26` for the 26th build of the project.
You can construct links using a syntax similar to markdown, i.e. [link text](link url)
. This also works with build variables:
Build [#${BUILD_NUMBER}]($BUILD_URL)
Some Jenkins plugins, like the Git plugin, provide "macros" which allow for some additional customization. In this example, the analysis name will be set to the first 8 characters of the git commit hash:
${GIT_REVISION, length=8}
For more information on "macros", see the
Token Macro Plugin Wiki.
Note: the analysis name feature is only supported by Code Dx versions 2.4.0 and up. If the server you plan to publish to is older than version 2.4.0, the analysis name will be ignored.


Thanks to all of these guys for making this Possible!
Mr S (me) - Owner of Re!Animate
Vyond - Owners of Comedy World, Lil Peepz, Chibi Peepz, Anime, Space Citizens, White Houserz, Cartoon Classics, Politics and Celebrity, Holiday & Seasonal, Monster Mayhem, Stick Figures, Full Energy and Domo themes
Click here to go back to the mainpage


Hilarious throwback video of Okyeame Kwame rapping surfaces online
by Lizbeth BrownGhpage.com has chanced upon a hilarious video of Ghanaian rapper and songwriter Okyeame Kwame that shows that there is indeed hope for everyone.
Okyeame Kwame also known as Mr. Versatile was singing some verses from a song that featured the Late Daasebre Gyamenah.
The versatile rapper who is popularly known for his good rapping skills delivered a good performance that the crowd loved.
The video which has surfaced online has gained a lot of reactions from social media users and fans of Okyeame Kwame.
Watch the video below;
Okyeame Kwame shot to fame after he joined a hiplife group known as “Akyeame” where they recorded several hit songs but parted ways in 2004.
Okyeame Kwame also won the Artist of the year at the 2009 Ghana Music Awards after describing himself as the Best Rapper Alive (BRA).
Aside from music, Okyeame Kwame launched his “Versatile Show” in 2012 where he blends his music with drama and poetry.


(#) Unknown nullness !!! WARNING: Unknown nullness This is a warning. Id : `UnknownNullness` Summary : Unknown nullness Note : **This issue is disabled by default**; use `--enable UnknownNullness` Severity : Warning Category : Interoperability: Kotlin Interoperability Platform : Any Vendor : Android Open Source Project Feedback : https://issuetracker.google.com/issues/new?component=192708 Affects : Kotlin and Java files Editing : This check runs on the fly in the IDE editor See : https://developer.android.com/kotlin/interop#nullability_annotations Implementation : [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/InteroperabilityDetector.kt) Tests : [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/InteroperabilityDetectorTest.kt) Copyright Year : 2018 To improve referencing this code from Kotlin, consider adding explicit nullness information here with either `@NonNull` or `@Nullable`. !!! Tip This lint check has an associated quickfix available in the IDE. (##) Options You can configure this lint checks using the following options: (###) ignore-deprecated Whether to ignore classes and members that have been annotated with `@Deprecated`. Normally this lint check will flag all unannotated elements, but by setting this option to `true` it will skip any deprecated elements. Default is false. Example `lint.xml`: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~xml linenumbers <lint> <issue id="UnknownNullness"> <option name="ignore-deprecated" value="false" /> </issue> </lint> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (##) Example Here is an example of lint warnings produced by this check: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text src/test/pkg/Test.java:10:Warning: Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations [UnknownNullness] public Object error1(Integer error2, int[] error3) { return null; } ----- src/test/pkg/Test.java:14:Warning: Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations [UnknownNullness] public Float error4; ----- src/test/pkg/Test.java:16:Warning: Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations [UnknownNullness] public Float error5; ----- src/test/pkg/Test.java:18:Warning: Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations [UnknownNullness] public Object error6() { return null; } ------ src/test/pkg/Test.java:19:Warning: Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations [UnknownNullness] protected Float error7; ----- src/test/pkg/Test.java:34:Warning: Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations [UnknownNullness] public Float error8; ----- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here is the source file referenced above: `src/test/pkg/Test.java`: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~java linenumbers package test.pkg; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @SuppressWarnings({"ClassNameDiffersFromFileName", "MethodMayBeStatic"}) public class Test { public void ok(int x, float y, boolean z) { } @Nullable public Object ok2(@NonNull Integer i, @NonNull int[] array) { return null; } private Object ok3(Integer i) { return null; } public Object error1(Integer error2, int[] error3) { return null; } @NonNull public Float ok4 = 5; @NonNull protected Float ok5 = 5; private Float ok6 = 5; public Float error4; /** Field comment */ public Float error5; /** Method comment */ public Object error6() { return null; } protected Float error7; // Don't flag public methods and fields in non-public classes or // in anonymous inner classes @SuppressWarnings("ResultOfObjectAllocationIgnored") class Inner { public void ok(Integer i) { new Runnable() { @Override public void run() { } public void ok2(Integer i) { } }; } } @Deprecated public Float error8; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can also visit the [source code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/InteroperabilityDetectorTest.kt) for the unit tests for this check to see additional scenarios. The above example was automatically extracted from the first unit test found for this lint check, `InteroperabilityDetector.testNullness`. To report a problem with this extracted sample, visit https://issuetracker.google.com/issues/new?component=192708. (##) Suppressing You can suppress false positives using one of the following mechanisms: * Using a suppression annotation like this on the enclosing element: ```kt // Kotlin @Suppress("UnknownNullness") fun method() { problematicStatement() } ``` or ```java // Java @SuppressWarnings("UnknownNullness") void method() { problematicStatement(); } ``` * Using a suppression comment like this on the line above: ```kt //noinspection UnknownNullness problematicStatement() ``` * Using a special `lint.xml` file in the source tree which turns off the check in that folder and any sub folder. A simple file might look like this: ```xml <?xml version="1.0" encoding="UTF-8"?> <lint> <issue id="UnknownNullness" severity="ignore" /> </lint> ``` Instead of `ignore` you can also change the severity here, for example from `error` to `warning`. You can find additional documentation on how to filter issues by path, regular expression and so on [here](https://googlesamples.github.io/android-custom-lint-rules/usage/lintxml.md.html). * In Gradle projects, using the DSL syntax to configure lint. For example, you can use something like ```gradle lintOptions { disable 'UnknownNullness' } ``` In Android projects this should be nested inside an `android { }` block. * For manual invocations of `lint`, using the `--ignore` flag: ``` $ lint --ignore UnknownNullness ...` ``` * Last, but not least, using baselines, as discussed [here](https://googlesamples.github.io/android-custom-lint-rules/usage/baselines.md.html).


Comments
-
Brett
Created an attachment (id=25) Crash Log
-
Greg Hurrell
Thanks for the report and the crash log. I haven't seen this one myself and I can't reproduce it here, although I suspect its a case of timing; you have to open the preferences at exactly the right moment to trigger it.
Where you opening the preferences for the very first time (ie. while it was building a list of preference panes and the spinning progress indicator was in the window) or had you already had it open in that same session? What did you see on the screen at the time, if anything?
I will take a look at the code and see if I can isolate the cause. The log you've attached shows the crash occurring where the window is being added to the application's "Window" menu. At first glance I am not sure what I could do to prevent this from occurring as all I'm doing at that point is telling Cocoa to put the window onscreen... Nothing tricky.
If you see it again can you please let me know?
-
Brett
It seems to have only happened the very first time I was opening the preferences pane. Ever since I can't seem to get the issue to arise. I'll try again with each new version as you roll them out.
I sw the items within the preferences pane... the Show All was selected and the other icons were showing, but there was obviously a hiccup while opening, then the Prefs pane and entire Menubar tool exited.
-
Greg Hurrell
Changing assignment to reflect my new email address.
http://wincent.com/a/news/archives/2006/05/change_of_email.php
Add a comment
Comments are now closed for this issue.


AlgoBOWL currently has an experimental command line you can use to interface with it. It is not currently to feature-parity with the web interface.
Run pip install --user algobowl. Ensure ~/.local/bin is in your PATH.
First, set the default server for your commands by running algobowl config set-default-server ${tg.request.application_url}.
Then, run algobowl auth login and follow the instructions.
Run algobowl --help.
Your currently logged-in clients are listed below.
| Client Name | Date Added | Options |
|---|---|---|
| ${token["client_name"]} | ${token["date_added"]} | Revoke |


|
Fig 1
|
Annual mean surface air temperature anomalies relative to 19 ... |
|
Fig 2
|
Timings for when global and CONUS 5-year mean annual mean te ... |
|
Fig 3
|
Boxplots showing the ranges in annual and seasonal temperatu ... |
|
Fig 4
|
A comparison between 2°C threshold crossing times for global ... |
|
Fig 5
|
Impact of internal climate variability on the threshold cros ... |
|
Fig 6
|
Same as Fig 4 but showing comparisons between 2°C and 3°C th ... |
|
Fig 7
|
Signal-to-noise ratio for 5-year mean annual mean global, CO ... |
|
Fig 8
|
Importance of three sources of uncertainty in the projection ... |


--- layout: page title: About header-img: "img/about-bg.png" ---
MSW | Educator | Transitioning into tech in hopes of using technology to break down systemic barriers to equity.


Authorize an email for account creation:
New Authorization
(email from which a single account can be created from)


Resourceful individual with an eagerness to accept challenges while learning and gaining experience from them. Wishing to build more interactive websites as a full stack web developer.
View ResumeAn intersting face recognition app which recognizes the face based on an API. The frontend of the app is built using reactjs and the backend of the app is powered by nodejs. The user details are hashed based on bcrypt and they are stored in a postgres database.
An interesting todolist website powered by nodejs backend server and in the front end it uses ejs, html and css. The todolist data is stored in a mongodb database and this enire website is hosted in heroku web server.
A frontend keeper app based on reactjs which uses react hooks and lots of interesting things.


src/lib/value-object.coffee:5
dictionary-structured data model
This module provides the following classes:


Class: Octokit::EnterpriseManagementConsoleClient
| Relationships & Source Files | |
| Namespace Children | |
|
Modules:
| |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Instance Chain:
|
|
| Inherits: | Object |
| Defined in: | lib/octokit/enterprise_management_console_client.rb, lib/octokit/enterprise_management_console_client/management_console.rb |
Overview
EnterpriseManagementConsoleClient
is only meant to be used by GitHub Enterprise Admins
and provides access to the management console API endpoints.
Constant Summary
Class Method Summary
Instance Attribute Summary
Authentication
- Included
| #application_authenticated? | Indicates if the client has OAuth Application client_id and secret credentials to make anonymous requests at a higher rate limit. |
| #basic_authenticated? | Indicates if the client was supplied Basic Auth username and password. |
| #bearer_authenticated? | Indicates if the client was supplied a bearer token. |
| #token_authenticated? | Indicates if the client was supplied an OAuth access token. |
| #user_authenticated? | Indicates if the client was supplied an OAuth access token or Basic Auth username and password. |
Configurable
- Included
Instance Method Summary
-
#faraday_configuration
private
We fall back to raw Faraday for handling the licenses because I'm suspicious that Sawyer isn't handling binary POSTs correctly: https://github.com/lostisland/sawyer/blob/03fca4c020f465ec42856d0486ec3991859b0aed/lib/sawyer/agent.rb#L85.
- #password_hash private
ManagementConsole
- Included
| #add_authorized_key | Add an authorized SSH keys on the Enterprise install. |
| #authorized_keys | Fetch the authorized SSH keys on the Enterprise install. |
| #config_check | Alias for ManagementConsole#config_status. |
| #config_status | Get information about the Enterprise installation. |
| #delete_authorized_key | Alias for ManagementConsole#remove_authorized_key. |
| #edit_maintenance_status | Alias for ManagementConsole#set_maintenance_status. |
| #edit_settings | Modify the Enterprise settings. |
| #get_authorized_keys | Alias for ManagementConsole#authorized_keys. |
| #get_maintenance_status | Alias for ManagementConsole#maintenance_status. |
| #get_settings | Alias for ManagementConsole#settings. |
| #maintenance_status | Get information about the Enterprise maintenance status. |
| #remove_authorized_key | Removes an authorized SSH keys from the Enterprise install. |
| #set_maintenance_status | Start (or turn off) the Enterprise maintenance mode. |
| #settings | Get information about the Enterprise installation. |
| #start_configuration | Start a configuration process. |
| #upgrade | Upgrade an Enterprise installation. |
| #upload_license | Uploads a license for the first time. |
Warnable
- Included
| #octokit_warn | Wrapper around Kernel#warn to print warnings unless OCTOKIT_SILENT is set to true. |
Connection
- Included
| #agent | Hypermedia agent for the GitHub API. |
| #delete | Make a HTTP DELETE request. |
| #get | Make a HTTP GET request. |
| #head | Make a HTTP HEAD request. |
| #last_response |
|
| #paginate | Make one or more HTTP GET requests, optionally fetching the next page of results from URL in Link response header based on value in |
| #patch | Make a HTTP PATCH request. |
| #post | Make a HTTP POST request. |
| #put | Make a HTTP PUT request. |
| #root | Fetch the root resource for the API. |
| #boolean_from_response | Executes the request, checking if it was successful. |
| #parse_query_and_convenience_headers, #request, #reset_agent, #sawyer_options |
Authentication
- Included
Configurable
- Included
| #configure | Set configuration options using a block. |
| #reset! | Reset configuration options to default values. |
| #same_options? | Compares client options to a Hash of requested options. |
| #setup | Alias for Configurable#reset!. |
| #fetch_client_id_and_secret, #options |
Constructor Details
.new(options = {}) ⇒ EnterpriseManagementConsoleClient
# File 'lib/octokit/enterprise_management_console_client.rb', line 21
def initialize( = {}) # Use options passed in, but fall back to module defaults # rubocop:disable Style/HashEachMethods # # This may look like a `.keys.each` which should be replaced with `#each_key`, but # this doesn't actually work, since `#keys` is just a method we've defined ourselves. # The class doesn't fulfill the whole `Enumerable` contract. Octokit::Configurable.keys.each do |key| # rubocop:enable Style/HashEachMethods instance_variable_set(:"@#{key}", [key] || Octokit.instance_variable_get(:"@#{key}")) end end
Instance Method Details
#faraday_configuration (private)
We fall back to raw Faraday for handling the licenses because I'm suspicious that Sawyer isn't handling binary POSTs correctly: https://github.com/lostisland/sawyer/blob/03fca4c020f465ec42856d0486ec3991859b0aed/lib/sawyer/agent.rb#L85
# File 'lib/octokit/enterprise_management_console_client/management_console.rb', line 160
def faraday_configuration @faraday_configuration ||= Faraday.new(url: @management_console_endpoint) do |http| http.headers[:user_agent] = user_agent http.request :multipart http.request :url_encoded # Disabling SSL is essential for certain self-hosted Enterprise instances if [:ssl] && ! [:ssl][:verify] http.ssl[:verify] = false end http.use Octokit::Response::RaiseError http.adapter Faraday.default_adapter end end
#password_hash (private)
[ GitHub ]# File 'lib/octokit/enterprise_management_console_client/management_console.rb', line 154
def password_hash { query: { api_key: @management_console_password } } end


Performs simple matrix math
Sets the Error-messages and the state
Creates a new matrix-object with given rows, columns and fill
(Number)
The amount of rows of the matrix
(Number)
The amount of columns of the matrix
(Number)
The number with wich the matrix will be filled
Toggels if Error messages are displayed
Creates a diagnonal matrix-object
(Object)
The matrix that will be cloned and converted
(any)
(Number)
The number that will fill the result
(Number)
The number that will fill the diagonal line
Object
:
A new matrix with the same dimensions as the input-matrix but with a new set of numbers
Creates a matrix-object with random numbers
(Object)
The matrix that will be cloned and converted
(Number)
The minimum random number
(Number)
The maximum random number
Object
:
A new matrix with the same dimensions as the input-matrix but with random numbers randing form min to max
Creates a new matrix from the sum of the elements of two matrices or a matrix and a number
(Object)
The matrix that will be cloned and converted
(Object)
The matrix whose elements will be added to the elements of M1
Object
:
A new Matrix with the same dimensions as the input Matrix but with a new set of numbers
Creates a new matrix from the difference of the elements of two matrices or a matrix and a number
(Object)
The matrix that will be cloned and converted
(Object)
The matrix whose elements will be subtracted from the elements of M1
Object
:
A new Matrix with the same dimensions as the input Matrix but with a new set of numbers
Creates a new matrix from the product of the elements of two matrices or a matrix and a number
(Object)
The matrix that will be cloned and converted
(Object)
The matrix whose elements will be multiplied by the elements of M1
Object
:
A new Matrix with the same dimensions as the input Matrix but with a new set of numbers
Creates a new matrix from the division of the elements of two matrices or a matrix and a number
(Object)
The matrix that will be cloned and converted
(Object)
The matrix whose elements will be divided by the elements of M1
Object
:
A new Matrix with the same dimensions as the input Matrix but with a new set of numbers
Creates a new matrix-object from a JSON-file
(any)
The JSON-file that contains all the necessary information of a matrix-object
any
:
A new matrix-objet with the information of the JSON-file
Shows the contents of the matrix in the console
Represents a matrix as a two-dimensional array
any
:
An array with the elements of the input-matrix
Represents a matrix as a one-dimensional array
any
:
An array with the elements of the input-matrix
Represents a matrix as a string
any
:
A string with the elements of the input-matrix
Represents a matrix-object as a JSON-file
any
:
A JSON-file with the elements of the input-matrix-object
Creates the sum of all elements of the matrix
any
:
The sum of all the elements of the input-matrix
Creates a copy of a matrix-object
any
:
A copy of the input-matrix
Converts the matrix to a unit-matrix
Creates the transposed version of a matrix
any
:
The transposed matrix
Inverts the elements of a matrix


dataset import COLLECTION_NAME SHEET_ID SHEET_NAME ID_COL_NO [CELL_RANGE]
dataset supports importing data from a single sheet at a time from a Google Sheets document. To do this you need to beable to authenticate with the Google Sheets v4 API and an account with the permissions allowing it to read the Google Sheets document. Google Sheets like Excel workbooks include multiple talbes in a single document. This is usually called a sheet. When importing a Google Sheet into a dataset collection the collection needs to exist and you need to identity the source of the key. If none is provided the key will be created as the row number of each JSON document constructed from the column header and cell value. This is problematic if someome sorts the sheet differently and then re-imports the data into the collection. So usually you want to explicitly set the column that will be used as as the record key in the collection. That way you can re-import the sheet’s data into your collection and replacing the stale data.
In this example we’re using the example Google Sheet from the Golang Google Sheets API v4 Quickstart. You’ll first need to have created a credentials.json file as described in the Step 1 of the Google Cloud SDK docs and placed it in etc/credentials.json. Our collection name is “DemoStudentList.ds”.
export GOOGLE_CLIENT_SECRET_JSON="etc/credentials.json"
dataset DemoStudentList.ds init
dataset import DemoStudentList.ds "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms" 1 "A1:Z"
dataset keys DemoStudentList.ds | while read KY; do dataset read DemoStudentList.ds "${KY}"; done
Related topics: dotpath, export-csv, import-csv, and export-gsheet


{% extends "base.html" %} {% block body %} ← Back to Inbox {{ subject }} {% if attachments %}
This email has attachments 🎉


No class on November 22nd
Potentially no class on November 15th
(maybe just shortened)
Visualizations used to tell a directed story or to make a point.
Think one page scrollers or visualizations embedded in articles.
Tend to generally have a stronger focus on design and mood, as there is no cumbersome utilitarian interface to get in the way.
Visualizations that foster a free user-experience, letting them draw their own hypotheses and conclusions.
Usually some sort of sandbox or interface with a lot of user defined control.
Stronger attention needs to be paid to the organization of user interface elements, to make them both visually unobstrusive and easy to learn.
bundle exec jekyll serve --watch
Prepare mockups of how you might visualize your data. Come up with at least 2 different ways to encode your data.


f4ratio() d() f4() f3()
f4ratio()
d()
f4()
f3()
Calculate the D, f4, f4-ratio, or f3 statistic.
qpWave()
Find the most likely number of ancestry waves using the qpWave method.
qpAdm()
Calculate ancestry proportions in a set of target populations.
qpAdm_rotation()
Fit qpAdm models based on the rotation strategy described in Harney et al. 2020 (bioRxiv)
qpAdm_filter()
Filter qpAdm rotation results for only 'sensible' models
loginfo()
Print the full log output of an admixr wrapper to the console.
eigenstrat()
EIGENSTRAT data constructor
filter_bed()
Filter EIGENSTRAT data based on a given BED file
transversions_only()
Remove transversions (C->T and G->A substitutions)
relabel()
Change labels of populations or samples
reset()
Reset modifications to an EIGENSTRAT object
merge_eigenstrat()
Merge two sets of EIGENSTRAT datasets
count_snps()
Count the number/proportion of present/missing sites in each sample
read_ind() read_snp() read_geno()
read_ind()
read_snp()
read_geno()
Read an EIGENSTRAT ind/snp/geno file.
write_ind() write_snp() write_geno()
write_ind()
write_snp()
write_geno()
Write an EIGENSTRAT ind/snp/geno file.
read_output()
Read an output file from one of the ADMIXTOOLS programs.


@* * Copyright 2021 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @(deferralPeriodOver: Boolean)(implicit messages: Messages)
@messages("covid.deferral.vat_bills_due")
@messages("covid.deferral.if_you_cancelled_direct_debit") @messages("covid.deferral.payment_support_service") @messages("covid.deferral.as_soon_as_possible")
@messages("covid.deferral.you_still_need_to_submit")
@messages("covid.deferral.you_have_until_march")


From the Thrift website:
Thrift is clearly abundant in features. What is sorely lacking though is good documentation. This guide is an attempt to fill that hole. But note that this is a reference guide — for a step-by-step example on how to use Thrift, refer to the Thrift tutorial.
Many aspects of the structure and organization of this guide have been borrowed from the (excellent) Google Protocol Buffer Language Guide. I thank the authors of that document.
A PDF version is also available.
Copyright © 2013 Diwaker Gupta
This work is licensed under the Creative Commons Attribution-NonCommercial 3.0 Unported License.
I welcome feedback and contributions to this guide. You can find the source code over at GitHub. Alternatively, you can file a bug.
I thank the authors of Thrift for the software, the authors of the Google Protocol Buffer documentation for the inspiration and the Thrift community for the feedback. Special thanks to Dave Engberg from Evernote for his input.
I’m an open source geek and a software architect. I blog over at Floating Sun and you can find more about me here.
Language Reference
Types
The Thrift type system consists of pre-defined base types, user-defined structs, container types, exceptions and service definitions.
Base Types
-
bool: A boolean value (true or false), one byte
-
byte: A signed byte
-
i16: A 16-bit signed integer
-
i32: A 32-bit signed integer
-
i64: A 64-bit signed integer
-
double: A 64-bit floating point number
-
binary: A byte array
-
string: Encoding agnostic text or binary string
Note that Thrift does not support unsigned integers because they have no direct translation to native (primitive) types in many of Thrift’s target languages.
Containers
Thrift containers are strongly typed containers that map to the most commonly used containers in popular programming languages. They are annotated using the Java Generics style. There are three containers types available:
-
list<t1>: An ordered list of elements of type t1. May contain duplicates.
-
set<t1>: An unordered set of unique elements of type t1.
-
map<t1,t2>: A map of strictly unique keys of type t1 to values of type t2.
Types used in containers may be any valid Thrift type (including structs and exceptions) excluding services.
Structs and Exceptions
A Thrift struct is conceptually similar to a C struct — a convenient way of grouping together (and encapsulating) related items. Structs translate to classes in object-oriented languages.
Exceptions are syntactically and functionally equivalent to structs except that they are declared using the exception keyword instead of the struct keyword. They differ from structs in semantics — when defining RPC services, developers may declare that a remote method throws an exception.
Details on defining structs and exceptions are the subject of a later section.
Services
Service definitions are semantically equivalent to defining an interface (or a pure virtual abstract class) in object-oriented programming. The Thrift compiler generates fully functional client and server stubs that implement the interface.
Details on defining services are the subject of a later section.
Typedefs
Thrift supports C/C++ style typedefs.
typedef i32 MyInteger //
typedef Tweet ReTweet //
| Note there is no trailing semi-colon | |
| Structs can also be used in typedefs |
Enums
When you’re defining a message type, you might want one of its fields to only have one of a pre-defined list of values. For example, let’s say you want to add a tweetType field for each Tweet, where the tweetType can be TWEET, RETWEET, DM, or REPLY. You can do this very simply by adding an enum to your message definition — a field with an enum type can only have one of a specified set of constants as its value (if you try to provide a different value, the parser will treat it like an unknown field). In the following example we’ve added an enum called TweetType with all the possible values, and a field of the same type:
enum TweetType {
TWEET, //
RETWEET = 2, //
DM = 0xa, //
REPLY
} //
struct Tweet {
1: required i32 userId;
2: required string userName;
3: required string text;
4: optional Location loc;
5: optional TweetType tweetType = TweetType.TWEET //
16: optional string language = "english"
}
| Enums are specified C-style. Compiler assigns default values starting at 0. | |
| You can of course, supply specific integral values for constants. | |
| Hex values are also acceptable. | |
| Again notice no trailing semi-colon | |
| Use the fully qualified name of the constant when assigning default values. |
Note that unlike Protocol Buffers, Thrift does NOT yet support nested enums (or structs, for that matter).
Enumerator constants MUST be in the range of positive 32-bit integers.
Comments
Thrift supports shell-style, C-style multi-line as well as single-line Java/C++ style comments.
# This is a valid comment.
/*
* This is a multi-line comment.
* Just like in C.
*/
// C++/Java style single-line comments work just as well.
Namespaces
Namespaces in Thrift are akin to namespaces in C++ or packages in Java — they offer a convenient way of organizing (or isolating) your code. Namespaces may also be used to prevent name clashes between type definitions.
Because each language has its own package-like mechanisms (e.g. Python has modules), Thrift allows you to customize the namespace behavior on a per-language basis:
namespace cpp com.example.project //
namespace java com.example.project //
| Translates to namespace com { namespace example { namespace project { | |
| Translates to package com.example.project |
Includes
It is often useful to split up Thrift definitions in separate files to ease maintainance, enable reuse and improve modularity/organization. Thrift allows files to include other Thrift files. Included files are looked up in the current directory and by searching relative to any paths specified with the -I compiler flag.
Included objects are accessed using the name of the Thrift file as a prefix.
include "tweet.thrift" //
...
struct TweetSearchResult {
1: list<tweet.Tweet> tweets; //
}
| File names must be quoted; again notice the absent semi-colon. | |
| Note the tweet prefix. |
Constants
Thrift lets you define constants for use across languages. Complex types and structs are specified using JSON notation.
const i32 INT_CONST = 1234; //
const map<string,string> MAP_CONST = {"hello": "world", "goodnight": "moon"}
| Semi-colon is (confusingly) optional; hex values are valid here. |
Defining Structs
Structs (also known as messages in some systems) are the basic building blocks in a Thrift IDL. A struct is composed of fields; each field has a unique integer identifier, a type, a name and an optional default value.
Consider a simple example. Suppose you want to build a Twitter-like service. Here is how you might define a Tweet:
struct Location { //
1: required double latitude;
2: required double longitude;
}
struct Tweet {
1: required i32 userId; //
2: required string userName; //
3: required string text;
4: optional Location loc; //
16: optional string language = "english" //
}
| Every field must have a unique, positive integer identifier | |
| Fields may be marked as required or optional | |
| Structs may contain other structs | |
| You may specify an optional "default" value for a field | |
| Multiple structs can be defined and referred to within the same Thrift file |
As you can see, each field in the message definition has a unique numbered tag. These tags are used to identify your fields in the wire format, and should not be changed once your message type is in use.
Fields may be marked required or optional with obvious meanings for well-formed structs. Thrift will complain if required fields have not been set in a struct, for instance. If an optional field has not been set in the struct, it will not be serialized over the wire. If a default value has been specified for an optional field, the field is assigned the default value when the struct is parsed and no value has been explicitly assigned for that field.
Unlike services, structs do not support inheritance, that is, a struct may not extend other structs.
|
Required Is Forever You should be very
careful about marking fields as required. If
at some point you wish to stop writing or sending
a required field, it will be problematic to
change the field to an optional field #8201;— old
readers will consider messages without this
field to be incomplete and may reject or drop
them unintentionally. You should consider writing
application-specific custom validation routines
for your buffers instead. Some have come to
the conclusion that using required does more
harm than good; they prefer to use only optional.
However, this view is not universal.
|
Defining Services
While there are several popular serialization/deserialization frameworks (like Protocol Buffers), there are few frameworks that provide out-of-the-box support for RPC-based services across multiple languages. This is one of the major attractions of Thrift.
Think of service definitions as Java interfaces — you need to supply a name and signatures for the methods. Optionally, a service may extend other services.
The Thrift compiler will generate service interface code (for the server) and stubs (for the client) in your chosen language. Thrift ships with RPC libraries for most languages that you can then use to run your client and server.
service Twitter {
// A method definition looks like C code. It has a return type, arguments,
// and optionally a list of exceptions that it may throw. Note that argument
// lists and exception list are specified using the exact same syntax as
// field lists in structs.
void ping(), //
bool postTweet(1:Tweet tweet) throws (1:TwitterUnavailable unavailable), //
TweetSearchResult searchTweets(1:string query); //
// The 'oneway' modifier indicates that the client only makes a request and
// does not wait for any response at all. Oneway methods MUST be void.
oneway void zip() //
}
| Confusingly, method definitions can be terminated using comma or semi-colon | |
| Arguments can be primitive types or structs | |
| Likewise for return types | |
| void is a valid return type for functions |
Note that the argument lists (and exception lists) for functions are specified exactly like structs.
Services support inheritance: a service may optionally inherit from another service using the extends keyword.
|
Nested Types As of this writing, Thrift
does NOT support nested type definitions.
That is, you may not define a struct (or an
enum) within a struct; you may of course
use structs/enums within other structs. |
Generated Code
This section contains documentation for working with Thrift generated code in various target languages. We begin by introducing the common concepts that are used across the board — these govern how the generated code is structured and will hopefully help you understand how to use it effectively.
Concepts
Here is a pictorial view of the Thrift network stack:
+-------------------------------------------+ | cGRE | | Server | | (single-threaded, event-driven etc) | +-------------------------------------------+ | cBLU | | Processor | | (compiler generated) | +-------------------------------------------+ | cGRE | | Protocol | | (JSON, compact etc) | +-------------------------------------------+ | cGRE | | Transport | | (raw TCP, HTTP etc) | +-------------------------------------------+
Transport
The Transport layer provides a simple abstraction for reading/writing from/to the network. This enables Thrift to decouple the underlying transport from the rest of the system (serialization/deserialization, for instance).
Here are some of the methods exposed by the Transport interface:
-
open
-
close
-
read
-
write
-
flush
In addition to the Transport interface above, Thrift also uses a ServerTransport interface used to accept or create primitive transport objects. As the name suggest, ServerTransport is used mainly on the server side to create new Transport objects for incoming connections.
-
open
-
listen
-
accept
-
close
Here are some of the transports available for majority of the Thrift-supported languages:
-
file: read/write to/from a file on disk
-
http: as the name suggests
Protocol
The Protocol abstraction defines a mechanism to map in-memory data structures to a wire-format. In other words, a protocol specifies how datatypes use the underlying Transport to encode/decode themselves. Thus the protocol implementation governs the encoding scheme and is responsible for (de)serialization. Some examples of protocols in this sense include JSON, XML, plain text, compact binary etc.
Here is the Protocol interface:
writeMessageBegin(name, type, seq)
writeMessageEnd()
writeStructBegin(name)
writeStructEnd()
writeFieldBegin(name, type, id)
writeFieldEnd()
writeFieldStop()
writeMapBegin(ktype, vtype, size)
writeMapEnd()
writeListBegin(etype, size)
writeListEnd()
writeSetBegin(etype, size)
writeSetEnd()
writeBool(bool)
writeByte(byte)
writeI16(i16)
writeI32(i32)
writeI64(i64)
writeDouble(double)
writeString(string)
name, type, seq = readMessageBegin()
readMessageEnd()
name = readStructBegin()
readStructEnd()
name, type, id = readFieldBegin()
readFieldEnd()
k, v, size = readMapBegin()
readMapEnd()
etype, size = readListBegin()
readListEnd()
etype, size = readSetBegin()
readSetEnd()
bool = readBool()
byte = readByte()
i16 = readI16()
i32 = readI32()
i64 = readI64()
double = readDouble()
string = readString()
Thrift Protocols are stream oriented by design. There is no need for any explicit framing. For instance, it is not necessary to know the length of a string or the number of items in a list before we start serializing them.
Here are some of the protocols available for majority of the Thrift-supported languages:
-
binary: Fairly simple binary encoding — the length and type of a field are encoded as bytes followed by the actual value of the field.
-
compact: Described in THRIFT-110
-
json:
Processor
A Processor encapsulates the ability to read data from input streams and write to output streams. The input and output streams are represented by Protocol objects. The Processor interface is extremely simple:
interface TProcessor {
bool process(TProtocol in, TProtocol out) throws TException
}
Service-specific processor implementations are generated by the compiler. The Processor essentially reads data from the wire (using the input protocol), delegates processing to the handler (implemented by the user) and writes the response over the wire (using the output protocol).
Server
A Server pulls together all of the various features described above:
-
Create a transport
-
Create input/output protocols for the transport
-
Create a processor based on the input/output protocols
-
Wait for incoming connections and hand them off to the processor
Next we discuss the generated code for specific languages. Unless mentioned otherwise, the sections below will assume the following Thrift specification:
namespace cpp thrift.example
namespace java thrift.example
enum TweetType {
TWEET,
RETWEET = 2,
DM = 0xa,
REPLY
}
struct Location {
1: required double latitude;
2: required double longitude;
}
struct Tweet {
1: required i32 userId;
2: required string userName;
3: required string text;
4: optional Location loc;
5: optional TweetType tweetType = TweetType.TWEET;
16: optional string language = "english";
}
typedef list<Tweet> TweetList
struct TweetSearchResult {
1: TweetList tweets;
}
exception TwitterUnavailable {
1: string message;
}
const i32 MAX_RESULTS = 100;
service Twitter {
void ping(),
bool postTweet(1:Tweet tweet) throws (1:TwitterUnavailable unavailable),
TweetSearchResult searchTweets(1:string query);
oneway void zip()
}
Java
Generated Files
-
a single file (Constants.java) containing all constant definitions
-
one file per struct, enum and service
$ tree gen-java `-- thrift `-- example |-- Constants.java |-- Location.java |-- Tweet.java |-- TweetSearchResult.java |-- TweetType.java `-- Twitter.java
|
Naming Conventions
While the Thrift compiler does not enforce any naming conventions, it is advisable to stick to standard naming conventions otherwise you may be in for some surprises. For instance, if you have a struct named tweetSearchResults (note the mixedCase), the Thrift compiler will generated a Java file named TweetSearchResults (note the CamelCase) containing a class named tweetSearchResults (like the original struct). This will obviously not compile under Java. |
Types
Thrift maps the various base and container types to Java types as follows:
-
bool: boolean
-
binary: byte[]
-
byte: byte
-
i16: short
-
i32: int
-
i64: long
-
double: double
-
string: String
-
list<t1>: List<t1>
-
set<t1>: Set<t1>
-
map<t1,t2>: Map<t1, t2>
As you can see, the mapping is straight forward and one-to-one for the most part. This is not surprising given that Java was the primary target language when the Thrift project began.
Typedefs
The Java language does not have any native support for "typedefs". So when the Thrit Java code generator encounters a typedef declaration, it merely substitutes it with the original type. That is, even though you may have typedefd TypeA to TypeB, in the generated Java code, all references to TypeB will be replaced by TypeA.
Consider the example IDL above. The declaration for tweets in the generated code for TweetSearchResults is simply public List<Tweets> tweets.
Enums
Thrift enums map to Java enum types. You can obtain the numeric value of an enum by using the getValue method (via the interface TEnum). In addition, the compiler generates a findByValue method to obtain the enum corresponding to a numeric value. This is more robust than using the ordinal feature of Java enums.
Constants
Thrift puts all defined constants in a public class named Constants as public static final members. Constants of any of the primitive types are supported.
|
Contain your Constants
If you have multiple Thrift files (in the same namespace) containing const definitions, the Thrift compiler will overwrite the Constants.java file with the definitions found in the file processed last. You must either define all your constants in a single file, or invoke the compiler on a single file that includes all the other files. |
C++
Generated Files
-
all constants go into a single .cpp/.h pair
-
all type definitions (enums and structs) go into another .cpp/.h pair
-
each service gets its own .cpp/.h pair
$ tree gen-cpp |-- example_constants.cpp |-- example_constants.h |-- example_types.cpp |-- example_types.h |-- Twitter.cpp |-- Twitter.h `-- Twitter_server.skeleton.cpp
Types
Thrift maps the various base and container types to C++ types as follows:
-
bool: bool
-
binary: std::string
-
byte: int8_t
-
i16: int16_t
-
i32: int32_t
-
i64: int64_t
-
double: double
-
string: std::string
-
list<t1>: std::vector<t1>
-
set<t1>: std::set<t1>
-
map<t1,t2>: std::map<T1, T2>
Other Languages
Python, Ruby, Javascript etc.
Best Practices
Versioning/Compatibility
Protocols evolve over time. If an existing message type no longer meets all your needs — for example, you’d like the message format to have an extra field — but you’d still like to use code created with the old format, don’t worry! It’s very simple to update message types without breaking any of your existing code. Just remember the following rules:
-
Don’t change the numeric tags for any existing fields.
-
Any new fields that you add should be optional. This means that any messages serialized by code using your "old" message format can be parsed by your new generated code, as they won’t be missing any required elements. You should set up sensible default values for these elements so that new code can properly interact with messages generated by old code. Similarly, messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing. However, the unknown fields are not discarded, and if the message is later serialized, the unknown fields are serialized along with it — so if the message is passed on to new code, the new fields are still available.
-
Non-required fields can be removed, as long as the tag number is not used again in your updated message type (it may be better to rename the field instead, perhaps adding the prefix "OBSOLETE_", so that future users of your .thrift can’t accidentally reuse the number).
-
Changing a default value is generally OK, as long as you remember that default values are never sent over the wire. Thus, if a program receives a message in which a particular field isn’t set, the program will see the default value as it was defined in that program’s version of the protocol. It will NOT see the default value that was defined in the sender’s code.
Translations
-
Serbo-Croatian by Anja Skarba of http://webhostinggeeks.com/