#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2018, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
''' Represent granular events that can be used to trigger callbacks.
Bokeh documents and applications are capable of supporting various kinds of
interactions. These are often associated with events, such as mouse or touch
events, interactive downsampling mode activation, widget or tool events, and
others. The classes in this module represent these different events, so that
callbacks can be attached and executed when they occur.
It is possible to respond to events with ``CustomJS`` callbacks, which will
function with or without a Bokeh server. This can be accomplished by passing
and event class, and a ``CustomJS`` model to the
:func:`~bokeh.model.Model.js_on_event` method. When the ``CustomJS`` is
executed in the browser, its ``cb_obj`` argument will contain the concrete
event object that triggered the callback.
.. code-block:: python
from bokeh.events import ButtonClick
from bokeh.models import Button, CustomJS
button = Button()
button.js_on_event(ButtonClick, CustomJS(code='console.log("JS:Click")'))
Alternatively it is possible to trigger Python code to run when events
happen, in the context of a Bokeh application running on a Bokeh server.
This can accomplished by passing an event class, and a callback function
to the the :func:`~bokeh.model.Model.on_event` method. The callback should
accept a single argument ``event``, which will be passed the concrete
event object that triggered the callback.
.. code-block:: python
from bokeh.events import ButtonClick
from bokeh.models import Button
button = Button()
def callback(event):
print('Python:Click')
button.on_event(ButtonClick, callback)
.. note ::
There is no throttling of events. Some events such as ``MouseMove``
may trigger at a very high rate.
'''
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
log = logging.getLogger(__name__)
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
# External imports
# Bokeh imports
from .util.future import with_metaclass
#-----------------------------------------------------------------------------
# Globals and constants
#-----------------------------------------------------------------------------
__all__ = (
'ButtonClick',
'DoubleTap',
'LODStart',
'LODEnd',
'MouseEnter',
'MouseLeave',
'MouseMove',
'MouseWheel',
'Pan',
'PanEnd',
'PanStart',
'Pinch',
'PinchEnd',
'PinchStart',
'PlotEvent',
'PointEvent',
'Press',
'Reset',
'SelectionGeometry',
'Tap',
)
#-----------------------------------------------------------------------------
# Private API
#-----------------------------------------------------------------------------
_CONCRETE_EVENT_CLASSES = dict()
class _MetaEvent(type):
''' Metaclass used to keep track of all classes subclassed from Event.
All Concrete Event classes (i.e. not "abstract" event base classes with
no ``event_name``) will be added to the _CONCRETE_EVENT_CLASSES set which
is used to decode event instances from JSON.
'''
def __new__(cls, clsname, bases, attrs):
newclass = super(_MetaEvent, cls).__new__(cls, clsname, bases, attrs)
if newclass.event_name is not None:
_CONCRETE_EVENT_CLASSES[newclass.event_name] = newclass
return newclass
#-----------------------------------------------------------------------------
# General API
#-----------------------------------------------------------------------------
class Event(with_metaclass(_MetaEvent, object)):
''' Base class for all Bokeh events.
This base class is not typically useful to instantiate on its own.
'''
_event_classes = []
event_name = None
def __init__(self, model):
''' Create a new base event.
Args:
model (Model) : a Bokeh model to register event callbacks on
'''
self._model_id = None
if model is not None:
self._model_id = model._id
@classmethod
def decode_json(cls, dct):
''' Custom JSON decoder for Events.
Can be used as the ``object_hook`` argument of ``json.load`` or
``json.loads``.
Args:
dct (dict) : a JSON dictionary to decode
The dictionary should have keys ``event_name`` and ``event_values``
Raises:
ValueError, if the event_name is unknown
Examples:
.. code-block:: python
>>> import json
>>> from bokeh.events import Event
>>> data = '{"event_name": "pan", "event_values" : {"model_id": 1, "x": 10, "y": 20, "sx": 200, "sy": 37}}'
>>> json.loads(data, object_hook=Event.decode_json)
<bokeh.events.Pan object at 0x1040f84a8>
'''
if not (('event_name' in dct) and ('event_values' in dct)):
return dct
event_name = dct['event_name']
if event_name not in _CONCRETE_EVENT_CLASSES:
raise ValueError("Could not find appropriate Event class for event_name: %r" % event_name)
event_values = dct['event_values']
model_id = event_values.pop('model_id')
event = _CONCRETE_EVENT_CLASSES[event_name](model=None, **event_values)
event._model_id = model_id
return event
[docs]class PlotEvent(Event):
''' PlotEvent is the base class for all events applicable to Plot models.
'''
def __init__(self, model):
from .models import Plot
if model is not None and not isinstance(model, Plot):
msg ='{clsname} event only applies to Plot models'
raise ValueError(msg.format(clsname=self.__class__.__name__))
super(PlotEvent, self).__init__(model=model)
[docs]class LODStart(PlotEvent):
''' Announce the start of "interactive level-of-detail" mode on a plot.
During interactive actions such as panning or zooming, Bokeh can
optionally, temporarily draw a reduced set of the data, in order to
maintain high interactive rates. This is referred to as interactive
Level-of-Detail (LOD) mode. This event fires whenever a LOD mode
has just begun.
'''
event_name = 'lodstart'
[docs]class LODEnd(PlotEvent):
''' Announce the end of "interactive level-of-detail" mode on a plot.
During interactive actions such as panning or zooming, Bokeh can
optionally, temporarily draw a reduced set of the data, in order to
maintain high interactive rates. This is referred to as interactive
Level-of-Detail (LOD) mode. This event fires whenever a LOD mode
has just ended.
'''
event_name = 'lodend'
[docs]class SelectionGeometry(PlotEvent):
''' Announce the coordinates of a selection event on a plot.
Attributes:
geometry (dict) : a dictionary containing the coordinates of the
selection event.
final (bool) : whether the selection event is the last selection event
in the case of selections on every mousemove.
'''
event_name = "selectiongeometry"
def __init__(self, model, geometry=None, final=True):
self.geometry = geometry
self.final = final
super(SelectionGeometry, self).__init__(model=model)
[docs]class Reset(PlotEvent):
''' Announce a button click event on a plot ResetTool.
'''
event_name = "reset"
def __init__(self, model):
super(Reset, self).__init__(model=model)
[docs]class PointEvent(PlotEvent):
''' Base class for UI events associated with a specific (x,y) point.
Attributes:
sx (float) : x-coordinate of the event in *screen* space
sy (float) : y-coordinate of the event in *screen* space
x (float) : x-coordinate of the event in *data* space
y (float) : y-coordinate of the event in *data* space
Note that data space coordinates are relative to the default range, not
any extra ranges, and the the screen space origin is at the top left of
the HTML canvas.
'''
event_name = None
def __init__(self, model, sx=None, sy=None, x=None, y=None):
self.sx = sx
self.sy = sy
self.x = x
self.y = y
super(PointEvent, self).__init__(model=model)
[docs]class Tap(PointEvent):
''' Announce a tap or click event on a Bokeh plot.
Attributes:
sx (float) : x-coordinate of the event in *screen* space
sy (float) : y-coordinate of the event in *screen* space
x (float) : x-coordinate of the event in *data* space
y (float) : y-coordinate of the event in *data* space
'''
event_name = 'tap'
[docs]class DoubleTap(PointEvent):
''' Announce a double-tap or double-click event on a Bokeh plot.
Attributes:
sx (float) : x-coordinate of the event in *screen* space
sy (float) : y-coordinate of the event in *screen* space
x (float) : x-coordinate of the event in *data* space
y (float) : y-coordinate of the event in *data* space
'''
event_name = 'doubletap'
[docs]class Press(PointEvent):
''' Announce a press event on a Bokeh plot.
Attributes:
sx (float) : x-coordinate of the event in *screen* space
sy (float) : y-coordinate of the event in *screen* space
x (float) : x-coordinate of the event in *data* space
y (float) : y-coordinate of the event in *data* space
'''
event_name = 'press'
[docs]class MouseEnter(PointEvent):
''' Announce a mouse enter event onto a Bokeh plot.
Attributes:
sx (float) : x-coordinate of the event in *screen* space
sy (float) : y-coordinate of the event in *screen* space
x (float) : x-coordinate of the event in *data* space
y (float) : y-coordinate of the event in *data* space
.. note::
The enter event is generated when the mouse leaves the entire Plot
canvas, including any border padding and space for axes or legends.
'''
event_name = 'mouseenter'
[docs]class MouseLeave(PointEvent):
''' Announce a mouse leave event from a Bokeh plot.
Attributes:
sx (float) : x-coordinate of the event in *screen* space
sy (float) : y-coordinate of the event in *screen* space
x (float) : x-coordinate of the event in *data* space
y (float) : y-coordinate of the event in *data* space
.. note::
The leave event is generated when the mouse leaves the entire Plot
canvas, including any border padding and space for axes or legends.
'''
event_name = 'mouseleave'
[docs]class MouseMove(PointEvent):
''' Announce a mouse movement event over a Bokeh plot.
Attributes:
sx (float) : x-coordinate of the event in *screen* space
sy (float) : y-coordinate of the event in *screen* space
x (float) : x-coordinate of the event in *data* space
y (float) : y-coordinate of the event in *data* space
.. note::
This event can fire at a very high rate, potentially increasing network
traffic or CPU load.
'''
event_name = 'mousemove'
[docs]class MouseWheel(PointEvent):
''' Announce a mouse wheel event on a Bokeh plot.
Attributes:
delta (float) : the (signed) scroll speed
sx (float) : x-coordinate of the event in *screen* space
sy (float) : y-coordinate of the event in *screen* space
x (float) : x-coordinate of the event in *data* space
y (float) : y-coordinate of the event in *data* space
.. note::
By default, Bokeh plots do not prevent default scroll events unless a
WheelZoomTool or WheelPanTool is active. This may change in future
releases.
'''
event_name = 'wheel'
def __init__(self, model, delta=None, **kwargs):
self.delta = delta
super(MouseWheel, self).__init__(model, **kwargs)
[docs]class Pan(PointEvent):
''' Announce a pan event on a Bokeh plot.
Attributes:
delta_x (float) : the amount of scroll in the x direction
delta_y (float) : the amount of scroll in the y direction
direction (float) : the direction of scroll (1 or -1)
sx (float) : x-coordinate of the event in *screen* space
sy (float) : y-coordinate of the event in *screen* space
x (float) : x-coordinate of the event in *data* space
y (float) : y-coordinate of the event in *data* space
'''
event_name = 'pan'
def __init__(self, model, delta_x=None, delta_y=None, direction=None, **kwargs):
self.delta_x = delta_x
self.delta_y = delta_y
self.direction = direction
super(Pan, self).__init__(model, **kwargs)
[docs]class PanEnd(PointEvent):
''' Announce the end of a pan event on a Bokeh plot.
Attributes:
sx (float) : x-coordinate of the event in *screen* space
sy (float) : y-coordinate of the event in *screen* space
x (float) : x-coordinate of the event in *data* space
y (float) : y-coordinate of the event in *data* space
'''
event_name = 'panend'
[docs]class PanStart(PointEvent):
''' Announce the start of a pan event on a Bokeh plot.
Attributes:
sx (float) : x-coordinate of the event in *screen* space
sy (float) : y-coordinate of the event in *screen* space
x (float) : x-coordinate of the event in *data* space
y (float) : y-coordinate of the event in *data* space
'''
event_name = 'panstart'
[docs]class Pinch(PointEvent):
''' Announce a pinch event on a Bokeh plot.
Attributes:
scale (float) : the (signed) amount of scaling
sx (float) : x-coordinate of the event in *screen* space
sy (float) : y-coordinate of the event in *screen* space
x (float) : x-coordinate of the event in *data* space
y (float) : y-coordinate of the event in *data* space
.. note::
This event is only applicable for touch-enabled devices.
'''
event_name = 'pinch'
def __init__(self, model, scale=None, **kwargs):
self.scale = scale
super(Pinch, self).__init__(model, **kwargs)
[docs]class PinchEnd(PointEvent):
''' Announce the end of a pinch event on a Bokeh plot.
Attributes:
sx (float) : x-coordinate of the event in *screen* space
sy (float) : y-coordinate of the event in *screen* space
x (float) : x-coordinate of the event in *data* space
y (float) : y-coordinate of the event in *data* space
.. note::
This event is only applicable for touch-enabled devices.
'''
event_name = 'pinchend'
[docs]class PinchStart(PointEvent):
''' Announce the start of a pinch event on a Bokeh plot.
Attributes:
sx (float) : x-coordinate of the event in *screen* space
sy (float) : y-coordinate of the event in *screen* space
x (float) : x-coordinate of the event in *data* space
y (float) : y-coordinate of the event in *data* space
.. note::
This event is only applicable for touch-enabled devices.
'''
event_name = 'pinchstart'
#-----------------------------------------------------------------------------
# Dev API
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------


-
Y. Ma, X. Zhang, P. Zhang, K. Zhan*, "Entropy neural estimation for graph contrastive learning," in ACM MM, 2023, 31,--.
arXiv
-
Z. Tian, X. Zhang, P. Zhang, K. Zhan*, "Improving semi-supervised semantic segmentation with dual-level Siamese structure network," in ACM MM, 2023, 31,--.
arXiv
-
Y. Ma, K. Zhan*, "Self-contrastive graph diffusion network," in ACM MM, 2023, 31,--.
arXiv
-
Y. Tang, K. Zhan*, Z. Tian, M. Zhang, S. Wang, X. Wen, "Curriculum knowledge switching for pancreas segmentation," in ICIP, 2023, --.
arXiv
-
Z. Liao, X. Zhang, W. Su, K. Zhan*, "View-consistent heterogeneous network on graphs with few labeled nodes," IEEE Transactions on Cybernetics, 2023, 54(9), 5523--5532.
-
C. Liu, Z. Liao, Y. Ma, K. Zhan*, "Stationary diffusion state neural estimation for multiview clustering," in AAAI (Oral), 2022, 36(7), 7542--7549.
arXiv
-
K. Zhan, C. Niu, "Mutual teaching for graph convolutional networks," Future Generation Computer Systems, 2021, 115, 837--843.
arXiv
-
Y. He, W. Su, X. Li, K. Zhan*, "Multiscale dual-level network for hyperspectral image classification," Journal of Electronic Imaging, 2020, 29(3), 033008.
-
K. Zhan, C. Niu, C. Chen, F. Nie, C. Zhang, Y. Yang, "Graph structure fusion for multiview clustering," IEEE Transactions on Knowledge and Data Engineering, 2019, 31(10), 1984--1993.
-
K. Zhan, X. Chang, J. Guan, L. Chen, Z. Ma, Y. Yang, "Adaptive structure discovery for multimedia analysis using multiple features," IEEE Transactions on Cybernetics, 2019, 49(5), 1826-1834.
-
K. Zhan, F. Nie, J. Wang, Yi Yang, "Multiview consensus graph clustering," IEEE Transactions on Image Processing, 2019, 28(3), 1261--1270.
-
C. Chen, C. Niu, X. Zhan, K. Zhan*, "Generative approach to unsupervised deep local learning," Journal of Electronic Imaging, 2019, 28(4), 043005.
arXiv
-
K. Zhan, L. Kong, B. Liu, Y. He, "Multimodal image seamless fusion," Journal of Electronic Imaging, 2019, 28(2), 023027.
-
J. Wang, B. Liu, Y. He, K. Zhan*, "Adaptive scalable kernel for hyperspectral image classification," Journal of Electronic Imaging, 2019, 28(1), 013051.
-
K. Zhan, C. Zhang, J. Guan, J. Wang, "Graph learning for multiview clustering," IEEE Transactions on Cybernetics, 2018, 48(10), 2887--2895.
-
K. Zhan, J. Shi, J. Wang, H. Wang, Y. Xie, "Adaptive structure concept factorization for multiview clustering," Neural Computation, 2018, 30(4), 1080--1103.
-
W. Li, Y. Xie, H. Zhou, Y. Han, K. Zhan*, "Structure-aware image fusion," Optik, 2018, 172, 1-11.
-
K. Zhan, J. Shi, J. Wang, F. Tian, "Graph-regularized concept factorization for multi-view document clustering," Journal of Visual Communication and Image Representation, 2017, 48, 411--418.
-
K. Zhan, Y. Xie, H. Wang, Y. Min, "Fast filtering image fusion," Journal of Electronic Imaging, 2017,26(6),063004.
-
K. Zhan, H. Wang, Y. Xie, C. Zhang, Y. Min, "Albedo recovery for hyperspectral image classification," Journal of Electronic Imaging, 2017, 26(4), 043010.
-
K. Zhan, J. Shi, H. Wang, Y. Xie, Q. Li, "Computational mechanisms of pulse-coupled neural networks: A comprehensive review,"
Archives of Computational Methods in Engineering, 2017, 24(3), 573–-588.
-
K. Zhan, J. Shi, J. Teng, Q. Li, M. Wang, F. Lu, "Linking synaptic computation for image enhancement," Neurocomputing, 2017, 238, 1--12.
-
K. Zhan, D. Wei, J. Shi, J. Yu, "Cross-utilizing hyperchaotic and DNA sequences for image encryption," Journal of Electronic Imaging, 2017, 26(1), 013021.
-
K. Zhan, H. Wang, H. Huang, Y. Xie, "Large margin distribution machine for hyperspectral image classification," Journal of Electronic Imaging, 2016, 25(6), 063024.
-
K. Zhan, J. Guan, Y. Yang, Q. Wu, "Unsupervised discriminative hashing," Journal of Visual Communication and Image Representation, 2016, 40, 847--851.
-
K. Zhan, J. Teng, J. Shi, Q. Li, M. Wang, "Feature-linking model for image enhancement," Neural Computation, 2016, 28(6), 1072--1100.
-
K. Zhan, Q. Li, J. Teng, M. Wang, J. Shi, "Multifocus image fusion using phase congruency," Journal of Electronic Imaging, 2015, 24(3), 033014.
-
K. Zhan, J. Shi , Q. Li, J. Teng, M. Wang, "Image segmentation using fast linking SCM," in Proc. IJCNN, IEEE: 2015, 25, 2093--2100.
-
K. Zhan, H.Zhang, Y. Ma, "New spiking cortical model for invariant texture retrieval and image processing," IEEE Transactions on Neural Networks, 2009, 20(12), 1980--1986.
|


U.S. MARSHALS
A Film Review by James Berardinelli
RATING: **1/2 OUT OF ****
United States, 1998 U.S. Release Date: 3/6/98 (wide) Running Length: 2:13 MPAA Classification: PG-13 (Violence, profanity) Theatrical Aspect Ratio: 1.85:1
Cast: Tommy Lee Jones, Wesley Snipes, Robert Downey Jr., Joe Pantoliano, Tom Wood, Lorenzo Clemons, Ray Toler, LaTanya Richardson, Kate Nelligan, Irene Jacob Director: Stuart Baird Producers: Anne Kopelson, Arnold Kopelson Screenplay: John Pogue Cinematography: Andrzej Bartkowiak Music: Jerry Goldsmith U.S. Distributor: Warner Brothers
To me, the idea of a sequel to THE FUGITIVE always seemed like a bad idea. True, Sam Girard (Tommy Lee Jones) was a more interesting character than Richard Kimball (Harrison Ford), but could he carry a movie on his own? Sadly, we'll never really know, because the Girard of U.S. MARSHALS bears only a token resemblance to the character who doggedly pursued Kimball in THE FUGITIVE. As re-invented here, Girard is a generic action hero; most of the quirks that made him interesting (and that earned Jones an Oscar) are absent. With a few minor re- writes, John McClane from the DIE HARD movies could have been plugged into this role.
The script tries to recapture the energy of THE FUGITIVE by re- cycling various plot elements. As in the original, Girard is pursuing an innocent man, and he suspects that there's more to the case than meets the eye.  For a little variety, the conspiracy in U.S. MARSHALS implicates officials of the U.S. government, not a one-armed man and doctors.
This time around, the wrongly-accused man is a suspected murderer named Sheridan (Wesley Snipes). Supposedly, he killed two federal agents, but someone wants him dead before his case ends up in court. A murder attempt on the airplane transporting him to prison goes wrong, and the plane crash lands. During the ensuing confusion, Sheridan gets away. Soon, U.S. Marshal Sam Girard and his faithful team are on the job, setting up roadblocks and closing off the perimeter. The Feds, wanting to be kept informed of the manhunt's progress, force Girard to add another member to his team -- slick, self-confident John Royce (Robert Downey Jr.). And the chase is on.
Unfortunately, it's not just one chase -- it's one after another after another. The repetitiveness quickly grows tiresome, and the movie ends up lasting at least thirty minutes too long. The bloated running length has nothing to do with extra time needed to unravel the needlessly convoluted plot. It simply offers an opportunity for the characters to do a lot more running around before the final, inevitable confrontation between Girard, Sheridan, and a traitor (whose identity, despite being easy to guess, shall remain unrevealed here).
Tommy Lee Jones, who turned in a delicious performance as Girard in THE FUGITIVE, is (like the screenplay) on auto-pilot here. He's a 52 year old action hero who runs, climbs, shoots, and swims, all without getting a hair out of place. Snipes' Sheridan appears to have undergone a personality extraction -- there's nothing deeper than the bare-bones "innocent guy on the run." Most of the supporting characters are equally faceless, with the exception of Joe Pantoliano's Cosmo, who acts like he drinks too much coffee. Swiss actress Irene Jacob, the dark- haired beauty from Kieslowski's RED, represents the classic case of talent being wasted. She plays Sheridan's girlfriend.
While I enjoyed THE FUGITIVE, I wasn't the film's biggest booster. I thought the coincidence-laden plot was poorly constructed. But the action sequences were often nail-biters, the lead characters were well- developed, and the dialogue was intelligent. U.S. MARSHALS exhibits many of THE FUGITIVE's faults with few of its strengths. As a result, this movie is a routine exercise in stunt choreography, with more valleys than peaks, and not enough tension to keep the viewer engaged for the full 143-minute length. U.S. MARSHALS is workmanlike, and that makes it, at best, a marginal choice for theatrical viewing.
Copyright 1998 James Berardinelli
- James Berardinelli e-mail<EMAIL_ADDRESS>Now with more than 1400 reviews... The ReelViews web site: http://movie-reviews.colossus.net/
"My belief is that no movie, nothing in life, leaves people neutral.
-- David Puttnam
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Here at Epicodus we offer several different tracks for students to choose from. There are so many --> coding language options out there that offer many different opportunities and it can be a bit overwhelming, but don't be overwhelmed!
We are here to help you figure out which language you might not only enjoy the most, but excel at based off some of your interests. All you have to do is answer the quesions below and we'll automatically give you some suggestions on what path might best fit you.
These are the following tracks that Epicodus currently offers. Here you can read about each track to learn and follow that up by doing the questionnaire.
Ruby is a favorite among developers who build interactive web applications. It involves creating user accounts, entering info, and interacting with dynamic content. It is very popular among start ups looking to quickly build their brand.
Java is very common in big businesses. It is one of the most popular languages and is used for high-performance processing to building Android based applications.
CSS is mainly used for making things look professional and nice. It consists of colors, designs, and layouts on the webpage.
C# is the most popular among big businesses and is mainly used for the building of internal software. It has the backing of tech titan Microsoft and is one of the most in-demand languages.


{% if result %} {% else %} {% endif %}
File API & FileReader API not supported
class is
this is a list of the files you just uploaded, click on them to load/download them


--- layout: post title: Make an interactive graffiti wall date: 2013-03-14 15:08:32.000000000 +01:00 categories: - tutorial tags: - interaction - raspberry pi - router - tutorial status: publish type: post published: true meta: _edit_last: '1' _rawhtml_settings: '0,0,0,0' _pagelines_layout_mode: one-sidebar-right box_set: default-boxes author: login: cybear email<EMAIL_ADDRESS>display_name: cybear first_name: '' last_name: '' ---
[caption id="attachment_194" align="aligncenter" width="595"] Make an interactive graffiti wall using Raspberry Pi and Node.JS[/caption]
In this tutorial we will enable a projector or display to be painted on using connected smartphones. With the setup described, it's easy to implement your own multi-device applications.
A personal note: As a frontend developer, I think it's amazing to be able to leverage such a humble hardware setup. Just using a Raspberry Pi and some accessories, I get a web server that users can connect to with Wi-Fi and the rendering of HTML5 and CSS3 to a display. The software is all open source and all open web standards.
There are however limitations to how much you can do on the rendering side. Most importantly, CSS3 is not hardware accelerated on the Raspberry Pi yet. I've published some performance tweaks if you want to delve into that.
[caption id="attachment_202" align="aligncenter" width="595"] Raspberry Pi, SD card, Wi-Fi router, USB cables, network cable, charger, HDMI cable[/caption]
[caption id="attachment_214" align="aligncenter" width="595"] Software: Debian, NodeJS, Socket.IO, Chromium[/caption]
There's more to be said about this setup. I will go through the details in a blog post coming up.
First acquire all the hardware in the list above. You probably have most of the things already. If you don't have a case for the Raspberry Pi, don't despair. You can make one in Lego or out of any box of the right size. Download the official Raspbian image and copy it to the SD card. Connect your Pi to your network and power it up. Establish a connection from your working machine via SSH. User pi, default password raspberry.
Add your local machine's public SSH key if you don't want to type your password every time you connect:
# from localhost, add ssh-key to your Raspberry Pi
# to avoid having to type password all the time
ssh-copy-id -i .ssh/id_rsa.pub pi@raspberrypi
raspi-config is a useful utility for getting started with your Raspberry Pi. It has an easy-to-use graphical (well, ncurses) interface. I recommend doing these things now:
sudo raspi-config
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git-core
sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update
sudo chmod +x /usr/bin/rpi-update
sudo rpi-update
Because of the certification process in Debian Stable, current NodeJS in APT is 0.6. We want to run a more recent version so we have to install it manually.
Update: The official NodeJS site now provides binaries for Raspberry Pi! Simply download the binary at http://nodejs.org/dist/v0.10.5/ (switch the number to whatever is considered latest stable by the NodeJS site.) The filename of your download should be called something like node-v0.10.5-linux-arm-pi.tar.gz.
If you want to be able to easily jump between NodeJS versions and don't mind building it locally (takes hours!) then I still recommend using NVM which is a handy version manager for Node itself.
git clone git://github.com/creationix/nvm.git ~/.nvm
. ~/.nvm/nvm.sh
echo . ~/.nvm/nvm.sh >> .bashrc
nvm install v0.10.5
nvm alias default 0.10.5
Get the source code for this project and install its dependencies
git clone https://github.com/cybear/capture-smartphone.git
cd capture-smartphone
npm install
We want our server to start automatically. For NodeJS, we can use the following script to use a node.js app as a daemon:
Create /etc/init.d/node-app
#/bin/sh
#This script is copied from https://github.com/chovy/node-startup
NODE_EXEC=/home/pi/.nvm/v0.10.5/bin/node
NODE_ENV="production"
NODE_APP='app.js'
APP_DIR='/home/pi/capture-smartphone';
PID_FILE=$APP_DIR/app.pid
LOG_FILE=$APP_DIR/app.log
###############
# REDHAT chkconfig header
# chkconfig: - 58 74
# description: node-app is the script for starting a node app on boot.
### BEGIN INIT INFO
# Provides: node
# Required-Start: $network $remote_fs $local_fs
# Required-Stop: $network $remote_fs $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop node
# Description: Node process for app
### END INIT INFO
case "$1" in
start)
if [ -f $PID_FILE ]
then
echo "$PID_FILE exists, process is already running or crashed"
else
echo "Starting node app..."
NODE_ENV=$NODE_ENV $NODE_EXEC $APP_DIR/$NODE_APP 1>$LOG_FILE 2>&1 &
echo $! > $PID_FILE;
fi
;;
stop)
if [ ! -f $PID_FILE ]
then
echo "$PID_FILE does not exist, process is not running"
else
echo "Stopping $APP_DIR/$NODE_APP ..."
echo "Killing `cat $PID_FILE`"
kill `cat $PID_FILE`;
rm $PID_FILE;
echo "Node stopped"
fi
;;
restart)
if [ ! -f $PID_FILE ]
then
echo "$PID_FILE does not exist, process is not running"
else
echo "Restarting $APP_DIR/$NODE_APP ..."
echo "Killing `cat $PID_FILE`"
kill `cat $PID_FILE`;
rm $PID_FILE;
NODE_ENV=$NODE_ENV $NODE_EXEC $APP_DIR/$NODE_APP 1>$LOG_FILE 2>&1 &
echo $! > $PID_FILE;
echo "Node restarted"
fi
;;
*)
echo "Usage: /etc/init.d/node-app {start|stop|restart}"
;;
esac
Now it needs to have a Run flag and we need to start the service:
sudo chmod +x /etc/init.d/node-app
#start it!
sudo /etc/init.d/node-app start
#if it seems to work, make it start upon boot
sudo update-rc.d node-app defaults
The main display is rendered by the Raspberry Pi. We want it to hide the mouse cursor, disabling the screensaver and to run in full screen mode. The package unclutter hides the mouse cursor and x11-server-utils enables us to disable the screensaver.
sudo apt-get install chromium x11-xserver-utils unclutter
For this kind of a device, I'd like the browser to start automatically and in full screen.  By now you should have your own interactive graffiti wall. Simply connect the Pi to your router, then connect smartphones to your SSID and fire up the web page!
If you're inspired and want to make something of your own, be my guest to fork the code of this project. It should be fairly easy if you know JavaScript! Stay tuned for a blog post describing the web technologies used for this example.


| Interface | Description |
|---|---|
| EnumeratingTypeConverter<T,D> | |
| TypeConverter<T,D> |
Interface for objects that implement a type conversion
from an underlying data representation.
|
| TypeFilterProducer<T,D> |
TypeProducer with methods to create Filters.
|
| TypeProducer<T,D> |
Implemented by classes that produce classes based on the value of a database field.
|
| Class | Description |
|---|---|
| EnumProducer<E extends java.lang.Enum<E>> |
A TypeProducer for producing Enum values from a String field
|
| LazyTypeConverter<T,D,F extends TypeConverter<T,D>> | |
| NumericEnumProducer<E extends java.lang.Enum<E>> |
TypeProducer that stores Enum values using their numeric ordinal value.
|
Repository
to
perform custom type conversions.


License. More...
Public Member Functions | |
| (id) | - init |
| Default constructor for a new object. | |
| (void) | - addCapacity: |
| Adds a single object to capacities. | |
| (void) | - addTag: |
| Adds a single object to tags. | |
| (NSString *) | - description |
| Returns a string representation of this object; useful for testing and debugging. | |
Properties | |
| NSString * | licenseId |
| The unique ID identifying the license. | |
| NSString * | type |
| The license type (ex. | |
| NSString * | pool |
| The name of the pool in which the license is kept. | |
| NSMutableArray * | capacities |
| The capacities available for this license, indicating how many licenses are in use, how many are available, how many Amazon EC2 instances can be supported, etc. | |
| NSMutableArray * | tags |
| A list of tags for the License. |
License.
| - (void EC2License.)addCapacity: | (EC2LicenseCapacity *) | capacity |
Adds a single object to capacities.
This function will alloc and init capacities if not already done.
| - (void EC2License.)addTag: | (EC2Tag *) | tag |
Adds a single object to tags.
This function will alloc and init tags if not already done.
| - (NSString * EC2License.)description |
Returns a string representation of this object; useful for testing and debugging.
| - (id EC2License.)init |
Default constructor for a new object.
Callers should use the property methods to initialize this object after creating it.
- (NSString *) type [read, write, retain] |
The license type (ex.
"Microsoft/Windows/Standard").


public abstract class Provider
extends java.lang.Object
ServiceDelegate
and
Endpoint
objects.| Modifier | Constructor and Description |
|---|---|
protected |
Provider()
Creates a new instance of Provider
|
| Modifier and Type | Method and Description |
|---|---|
abstract Endpoint |
createAndPublishEndpoint(java.lang.String address,
java.lang.Object implementor)
Creates and publishes an endpoint object with the specified
address and implementation object.
|
Endpoint |
createAndPublishEndpoint(java.lang.String address,
java.lang.Object implementor,
WebServiceFeature... features)
Creates and publishes an endpoint object with the specified
address, implementation object and web service features.
|
Endpoint |
createEndpoint(java.lang.String bindingId,
java.lang.Class<?> implementorClass,
Invoker invoker,
WebServiceFeature... features)
Creates an endpoint object with the provided binding, implementation
class, invoker and web service features.
|
abstract Endpoint |
createEndpoint(java.lang.String bindingId,
java.lang.Object implementor)
Creates an endpoint object with the provided binding and implementation
object.
|
Endpoint |
createEndpoint(java.lang.String bindingId,
java.lang.Object implementor,
WebServiceFeature... features)
Creates an endpoint object with the provided binding, implementation
object and web service features.
|
abstract ServiceDelegate |
createServiceDelegate(java.net.URL wsdlDocumentLocation,
javax.xml.namespace.QName serviceName,
java.lang.Class<? extends Service> serviceClass)
Creates a service delegate object.
|
ServiceDelegate |
createServiceDelegate(java.net.URL wsdlDocumentLocation,
javax.xml.namespace.QName serviceName,
java.lang.Class<? extends Service> serviceClass,
WebServiceFeature... features)
Creates a service delegate object.
|
abstract W3CEndpointReference |
createW3CEndpointReference(java.lang.String address,
javax.xml.namespace.QName serviceName,
javax.xml.namespace.QName portName,
java.util.List<org.w3c.dom.Element> metadata,
java.lang.String wsdlDocumentLocation,
java.util.List<org.w3c.dom.Element> referenceParameters)
Factory method to create a
W3CEndpointReference . |
W3CEndpointReference |
createW3CEndpointReference(java.lang.String address,
javax.xml.namespace.QName interfaceName,
javax.xml.namespace.QName serviceName,
javax.xml.namespace.QName portName,
java.util.List<org.w3c.dom.Element> metadata,
java.lang.String wsdlDocumentLocation,
java.util.List<org.w3c.dom.Element> referenceParameters,
java.util.List<org.w3c.dom.Element> elements,
java.util.Map<javax.xml.namespace.QName,java.lang.String> attributes)
Factory method to create a
W3CEndpointReference . |
abstract <T> T |
getPort(EndpointReference endpointReference,
java.lang.Class<T> serviceEndpointInterface,
WebServiceFeature... features)
The getPort method returns a proxy.
|
static Provider |
provider()
Creates a new provider object.
|
abstract EndpointReference |
readEndpointReference(javax.xml.transform.Source eprInfoset)
read an EndpointReference from the infoset contained in
eprInfoset . |
public static Provider provider()
The algorithm used to locate the provider subclass to use consists of the following steps:
jakarta.xml.ws.spi.Provider
is defined, then its value is used as the name of the implementation class.
This phase of the look up enables per-JVM override of the Jakarta XML Web Services implementation.
ServiceLoader
class,
to attempt to locate and load an implementation of Provider
service using
the default loading mechanism.
public abstract ServiceDelegate createServiceDelegate(java.net.URL wsdlDocumentLocation, javax.xml.namespace.QName serviceName, java.lang.Class<? extends Service> serviceClass)
wsdlDocumentLocation
- A URL pointing to the WSDL document
for the service, or null
if there isn't one.serviceName
- The qualified name of the service.serviceClass
- The service class, which MUST be either
jakarta.xml.ws.Service
or a subclass thereof.public ServiceDelegate createServiceDelegate(java.net.URL wsdlDocumentLocation, javax.xml.namespace.QName serviceName, java.lang.Class<? extends Service> serviceClass, WebServiceFeature... features)
wsdlDocumentLocation
- A URL pointing to the WSDL document
for the service, or null
if there isn't one.serviceName
- The qualified name of the service.serviceClass
- The service class, which MUST be either
jakarta.xml.ws.Service
or a subclass thereof.features
- Web Service features that must be configured on
the service. If the provider doesn't understand a feature,
it must throw a WebServiceException.public abstract Endpoint createEndpoint(java.lang.String bindingId, java.lang.Object implementor)
bindingId
- A URI specifying the desired binding (e.g. SOAP/HTTP)implementor
- A service implementation object to which
incoming requests will be dispatched. The corresponding
class MUST be annotated with all the necessary Web service
annotations.public abstract Endpoint createAndPublishEndpoint(java.lang.String address, java.lang.Object implementor)
address
- A URI specifying the address and transport/protocol
to use. A http: URI MUST result in the SOAP 1.1/HTTP
binding being used. Implementations may support other
URI schemes.implementor
- A service implementation object to which
incoming requests will be dispatched. The corresponding
class MUST be annotated with all the necessary Web service
annotations.public abstract EndpointReference readEndpointReference(javax.xml.transform.Source eprInfoset)
eprInfoset
.eprInfoset
- infoset for EndpointReferenceEndpointReference
unmarshalled from
eprInfoset
. This method never returns null
.WebServiceException
- If there is an error creating the
EndpointReference
from the specified eprInfoset
.java.lang.NullPointerException
- If the null
eprInfoset
value is given.public abstract <T> T getPort(EndpointReference endpointReference, java.lang.Class<T> serviceEndpointInterface, WebServiceFeature... features)
endpointReference
, then those reference
parameters MUST appear as SOAP headers, indicating them to be
reference parameters, on all messages sent to the endpoint.
The parameter serviceEndpointInterface
specifies
the service endpoint interface that is supported by the
returned proxy.
The parameter endpointReference
specifies the
endpoint that will be invoked by the returned proxy.
In the implementation of this method, the Jakarta XML Web Services
runtime system takes the responsibility of selecting a protocol
binding (and a port) and configuring the proxy accordingly from
the WSDL metadata of the
serviceEndpointInterface
and the EndpointReference
.
For this method
to successfully return a proxy, WSDL metadata MUST be available and the
endpointReference
MUST contain an implementation understood
serviceName
metadata.T
- Service endpoint interfaceendpointReference
- the EndpointReference that will
be invoked by the returned proxy.serviceEndpointInterface
- Service endpoint interfacefeatures
- A list of WebServiceFeatures to configure on the
proxy. Supported features not in the features
parameter will have their default values.WebServiceException
- endpointReference
is illegal
serviceEndpointInterface
is specified
WebServiceFeature
public abstract W3CEndpointReference createW3CEndpointReference(java.lang.String address, javax.xml.namespace.QName serviceName, javax.xml.namespace.QName portName, java.util.List<org.w3c.dom.Element> metadata, java.lang.String wsdlDocumentLocation, java.util.List<org.w3c.dom.Element> referenceParameters)
W3CEndpointReference
.
This method can be used to create a W3CEndpointReference
for any endpoint by specifying the address
property along
with any other desired properties. This method
can also be used to create a W3CEndpointReference
for
an endpoint that is published by the same Jakarta EE application.
To do so the address
property can be provided or this
method can automatically determine the address
of
an endpoint that is published by the same Jakarta EE application and is
identified by the serviceName
and
portName
properties. If the address
is
null
and the serviceName
and
portName
do not identify an endpoint published by the
same Jakarta EE application, a
javax.lang.IllegalStateException
MUST be thrown.
address
- Specifies the address of the target endpointserviceName
- Qualified name of the service in the WSDL.portName
- Qualified name of the endpoint in the WSDL.metadata
- A list of elements that should be added to the
W3CEndpointReference
instances wsa:metadata
element.wsdlDocumentLocation
- URL for the WSDL document location for
the service.referenceParameters
- Reference parameters to be associated
with the returned EndpointReference
instance.W3CEndpointReference
created from
serviceName
, portName
,
metadata
, wsdlDocumentLocation
and referenceParameters
. This method
never returns null
.java.lang.IllegalStateException
- address
, serviceName
and
portName
are all null
.
serviceName
service is null
and the
portName
is NOT null
.
address
property is null
and
the serviceName
and portName
do not
specify a valid endpoint published by the same Jakarta EE
application.
serviceName
is NOT null
and is not present in the specified WSDL.
portName
port is not null
and it
is not present in serviceName
service in the WSDL.
wsdlDocumentLocation
is NOT null
and does not represent a valid WSDL.
WebServiceException
- If an error occurs while creating the
W3CEndpointReference
.public W3CEndpointReference createW3CEndpointReference(java.lang.String address, javax.xml.namespace.QName interfaceName, javax.xml.namespace.QName serviceName, javax.xml.namespace.QName portName, java.util.List<org.w3c.dom.Element> metadata, java.lang.String wsdlDocumentLocation, java.util.List<org.w3c.dom.Element> referenceParameters, java.util.List<org.w3c.dom.Element> elements, java.util.Map<javax.xml.namespace.QName,java.lang.String> attributes)
W3CEndpointReference
.
Using this method, a W3CEndpointReference
instance
can be created with extension elements, and attributes.
Provider
implementations must override the default
implementation.
This method can be used to create a W3CEndpointReference
for any endpoint by specifying the address
property along
with any other desired properties. This method
can also be used to create a W3CEndpointReference
for
an endpoint that is published by the same Jakarta EE application.
To do so the address
property can be provided or this
method can automatically determine the address
of
an endpoint that is published by the same Jakarta EE application and is
identified by the serviceName
and
portName
propeties. If the address
is
null
and the serviceName
and
portName
do not identify an endpoint published by the
same Jakarta EE application, a
javax.lang.IllegalStateException
MUST be thrown.
address
- Specifies the address of the target endpointinterfaceName
- the wsam:InterfaceName
element in the
wsa:Metadata
element.serviceName
- Qualified name of the service in the WSDL.portName
- Qualified name of the endpoint in the WSDL.metadata
- A list of elements that should be added to the
W3CEndpointReference
instances wsa:metadata
element.wsdlDocumentLocation
- URL for the WSDL document location for
the service.referenceParameters
- Reference parameters to be associated
with the returned EndpointReference
instance.elements
- extension elements to be associated
with the returned EndpointReference
instance.attributes
- extension attributes to be associated
with the returned EndpointReference
instance.W3CEndpointReference
created from
serviceName
, portName
,
metadata
, wsdlDocumentLocation
and referenceParameters
. This method
never returns null
.java.lang.IllegalStateException
- address
, serviceName
and
portName
are all null
.
serviceName
service is null
and the
portName
is NOT null
.
address
property is null
and
the serviceName
and portName
do not
specify a valid endpoint published by the same Jakarta EE
application.
serviceName
is NOT null
and is not present in the specified WSDL.
portName
port is not null
and it
is not present in serviceName
service in the WSDL.
wsdlDocumentLocation
is NOT null
and does not represent a valid WSDL.
wsdlDocumentLocation
is NOT null
but
wsdli:wsdlLocation's namespace name cannot be got from the available
metadata.
WebServiceException
- If an error occurs while creating the
W3CEndpointReference
.public Endpoint createAndPublishEndpoint(java.lang.String address, java.lang.Object implementor, WebServiceFeature... features)
Provider
implementations must override the
default implementation.address
- A URI specifying the address and transport/protocol
to use. A http: URI MUST result in the SOAP 1.1/HTTP
binding being used. Implementations may support other
URI schemes.implementor
- A service implementation object to which
incoming requests will be dispatched. The corresponding
class MUST be annotated with all the necessary Web service
annotations.features
- A list of WebServiceFeatures to configure on the
endpoint. Supported features not in the features
parameter will have their default values.public Endpoint createEndpoint(java.lang.String bindingId, java.lang.Object implementor, WebServiceFeature... features)
Provider
implementations
must override the default implementation.bindingId
- A URI specifying the desired binding (e.g. SOAP/HTTP)implementor
- A service implementation object to which
incoming requests will be dispatched. The corresponding
class MUST be annotated with all the necessary Web service
annotations.features
- A list of WebServiceFeatures to configure on the
endpoint. Supported features not in the features
parameter will have their default values.public Endpoint createEndpoint(java.lang.String bindingId, java.lang.Class<?> implementorClass, Invoker invoker, WebServiceFeature... features)
Provider
implementations must override the default implementation.bindingId
- A URI specifying the desired binding (e.g. SOAP/HTTP).
Can be null.implementorClass
- A service implementation class that
MUST be annotated with all the necessary Web service
annotations.invoker
- that does the actual invocation on the service instance.features
- A list of WebServiceFeatures to configure on the
endpoint. Supported features not in the features
parameter will have their default values.


"No matter how experienced you are, trying to piece together logs and metrics when things are on fire is quite complicated." -- Matt Klein (Lyft)
Distributed system reaches the masses.
Your 'problem surface' is now exponentially bigger.
"Reaching production is only the beginning" -- Pierre Vincent (Poppulo)
What is service mesh observability
It is a set of instrumentation you add into your services that capture and expose information about the service-to-service communication that helps you answer many questions about your service mesh.
Common types
Traces
Events
Metrics
Logs
"Monitoring tells you whether a system is working, observability lets you ask why it isn't working." -- Baron Schwartz (VividCortex)
"Istio provides an easy way to create a network of deployed services with load balancing, service-to-service authentication, monitoring, and more, without requiring any changes in service code." -- istio.io


---
layout: post
title: "My Week in Review"
date: 2015-08-16 10:50:00 +0000
categories:
tags:
image: https://s3.amazonaws.com/audreywatters/2015-08-16-ams.jpg
imagecredits: https://www.flickr.com/photos/surreal_badger/20601872381/in/dateposted-public/
---
Travel
- Madison, Hermosa Beach, and Amsterdam
- Upcoming week: Toronto and Brooklin (Maine)
Hack Education
Essays Elsewhere
Speaking
- I gave a keynote at the Digital Pedagogy Lab. (See above for transcript.)
- I led a workshop on GitHub at the Digital Pedagogy Lab. (Repo for GitHub 101 is here.)
- I gave a plenary talk at the Scratch 2015 conference. (See above for transcript)
Known Notes and Fragments
Other Projects
- I sent some thoughts on Pearson and Amplify to Anya Kamenetz for a story on the state of ed-tech business.
Viewing
- I watched The Avengers: Age of Ultron and Fast and Furious 7 on the flight from LAX to AMS.


Bullet Collision Detection & Physics Library
src
BulletDynamics
BulletDynamics Directory Reference
Directory dependency graph for BulletDynamics:
Directories
directory
Character
directory
ConstraintSolver
directory
Dynamics
directory
Featherstone
directory
MLCPSolvers
directory
Vehicle
Generated by
1.8.13


Order Type
Limit
Iceberg
IoC
FoK
AON
Basket
Basket
Order Type
Limit
Iceberg
IoC
FoK
AON
Basket
Exclusive
Volume Constrained
Cumulative Volume Constrained
Basket Type
Exclusive
Volume Constrained
Cumulative Volume Constrained
Basket Type
Exclusive
Volume Constrained
Cumulative Volume Constrained


I have built in some degree of flexibility into the error handling. The routines that return status information return 0 if successful and -1 for an error. You can access further error information via the functions:
HSTIOError hstio_err(); char *hstio_errmsg();
The first merely returns an enumerated code. The second returns a text
string with the error message itself. These functions can be examined
after any operation. ``hstio_
err()'' will return 0 if there
was no error.
In addition, you can install a global error handler. Suppose you have a function of the form:
void detect_error() { fprintf(stderr,"There was an ERROR!\n%s\n", hstio_errmsg()); ... or whatever ... ... decide what to do ... }
Then, you can install this function as a global error handler with the function:
push_hstioerr(detect_error);
There is a stack of function pointers (limited to a nesting depth of 32, which is arbitrary). If there is a non-zero pointer on the stack, that function is automatically called when an error occurs. You are free to do anything in the error handling function: print a message, abort, or whatever. Execution continues after executing the error handling function.
Of course, there is also a pop function:
pop_hstioerr();
So, you can manipulate the error handling stack as you see fit, e. g. by installing a new error handling function at the beginning of some complex procedure and popping it at the end. At any point, if you want to override the action of the global handler and give special handling after executing some function, you can merely push 0 onto the stack before executing the operation. That prevents the global error handler from being called. Of course, the pop function then restores the global error handler.


Technical blog from Craig Russell.
This post describes a pattern of launching coroutines which cancel when the Activity or ViewModel is destroyed, but support allowing important parts of the coroutine to run uncancelled.
When you have an Activity
and a ViewModel
, you need to pay attention to the scopes in which you launch coroutines. Launching a coroutine from an Activity
will result in it having a different lifecycle than if launched from ViewModel
. And what happens if you have async work that you don’t want to cancel if the Activity
or ViewModel
are destroyed?
In our codebase, we typically marked our ViewModel
functions with suspend
when they would involve asynchronous work, and launched the coroutine from the Activity
. Part of the rationale for this was that it made testing much easier. We knew how to write a test for a suspend function.
Let’s consider this example; we have the TabSwitcherActivity
which is used to show users their open tabs and let them switch, add, and close tabs.
For brevity, let’s just focus on the close tab functionality.
class TabSwitcherActivity : CoroutineScope by MainScope() {
fun onTabDeleted(tab: TabEntity) {
launch { viewModel.onTabDeleted(tab) }
}
}
class TabSwitcherViewModel {
suspend fun onTabDeleted(tab: TabEntity) {
tabRepository.delete(tab)
}
}
class TabRepository {
suspend fun delete(tab: TabEntity) {
deleteOldPreviewImages(tab.tabId)
tabsDao.deleteTabAndUpdateSelection(tab)
}
}
Activity
Activity
launches a coroutine, and calls delete method on ViewModel
ViewModel
calls delete method on TabRepository
TabRepository
deletes the tab from the databaseThere is a problem looming here. The reason we are using coroutines at all in this flow is because deleting from the database is an asynchronous operation; it might not happen immediately since it involves disk IO.
What happens if the user navigates away from the Activity
immediately after hitting the delete button but before the tab is deleted? Consider this sequence 👇
If the Activity is destroyed, the coroutine will be cancelled and we might fail to honor the user’s decision to delete the tab. This is dangerous! ⚠ If the user thinks the tab will be deleted, we can’t disregard that just because the user hit the back button or rotated their phone.
Activity
which is now destroyed.ViewModel
instead of the Activity
.
Activity
, the Activity
, ViewModel
and coroutine will all be destroyed and cancelled and we’ll still fail to honor the user’s action.GlobalScope.launch
from the Repository
.
Snackbar
when the tab was deleted for instance, it would be trickier to achieve with this approach.Thread
and firing that off to do the deletion. ❌Repository
, we can use NonCancellable
to ensure the deletion cannot be cancelled once started. ✅NonCancellable
✨A non-cancelable job that is always active. It is designed for
withContext
function to prevent cancellation of code blocks that need to be executed without cancellation.
Well now, that sounds pretty handy for our scenario. Let’s explore NonCancellable further, and see what the code looks like for our TabRepository
. As it turns out, it requires just a tiny change to our TabRepository
to get this new behavior.
suspend fun delete(tab: TabEntity) {
withContext(Dispatchers.IO + NonCancellable) {
deleteTabImagePreview(tab)
tabsDao.deleteTab(tab)
}
}
Within a coroutine, we can mark a block as NonCancellable
to ensure it runs to completion once started.
Activity
which launched the coroutine is still around, it’ll be able to take action to confirm deletion with the user (e.g., show a Snackbar
)Activity
is destroyed, the coroutine it launched should be cancelled too. However, with NonCancellable
, we ensure that the tab will be deleted (as long as the app itself isn’t killed)Activity
is already dead, nothing in the coroutine after the block marked with NonCancellable
will execute; the refusal to be stopped applies only to code within the block.


| Opcode/Instruction | Op/En | 64/32 -bit Mode | CPUID Feature Flag | Description |
|---|---|---|---|---|
| VEX.NDD.LZ.0F38.W0 F3 /1 BLSR r32, r/m32 | VM | V/V | BMI1 | Reset lowest set bit of r/m32, keep all other bits of r/m32 and write result to r32. |
| VEX.NDD.LZ.0F38.W1 F3 /1 BLSR r64, r/m64 | VM | V/N.E. | BMI1 | Reset lowest set bit of r/m64, keep all other bits of r/m64 and write result to r64. |
| Op/En | Operand 1 | Operand 2 | Operand 3 | Operand 4 |
| VM | VEX.vvvv (w) | ModRM:r/m (r) | NA | NA |
Copies all bits from the source operand to the destination operand and resets (=0) the bit position in the destina-tion operand that corresponds to the lowest set bit of the source operand. If the source operand is zero BLSR sets CF.
This instruction is not supported in real mode and virtual-8086 mode. The operand size is always 32 bits if not in 64-bit mode. In 64-bit mode operand size 64 requires VEX.W1. VEX.W1 is ignored in non-64-bit modes. An attempt to execute this instruction with VEX.L not equal to 0 will cause #UD.
temp ← (SRC-1) bitwiseAND ( SRC ); SF ← temp[OperandSize -1]; ZF ← (temp = 0); IF SRC = 0 CF ← 1; ELSE CF ← 0; FI DEST ← temp;
ZF and SF flags are updated based on the result. CF is set if the source is zero. OF flag is cleared. AF and PF flags are undefined.
BLSR:
unsigned __int32 _blsr_u32(unsigned __int32 src);
BLSR:
unsigned __int64 _blsr_u64(unsigned __int64 src);
None
See Section 2.5.1, “Exception Conditions for VEX-Encoded GPR Instructions”, Table 2-29; additionally
| #UD | If VEX.W = 1. |


About
I'm a designer, almost illustrator, gamer, occasional writer, who will probably take up photography sometime, or not, all-around creative, Pizza and cheesecake enthusiast from Georgetown, Guyana..
So in a nutshell, I build, create and design stuff.
About
I'm a designer, almost illustrator, gamer, occasional writer, who will probably take up photography sometime, or not, all-around creative, Pizza and cheesecake enthusiast from Georgetown, Guyana..
So in a nutshell, I build, create and design stuff.


|
Helix
|
#include <SchedEntry.h>
Public Member Functions | |
| SchedEntry (xmlNodePtr node) | |
| virtual | ~SchedEntry () |
| bool | MatchesTime (time_t t) |
| void | LaunchProcess (void) |
Private Member Functions | |
| void | ParseSecond (char *d) |
| Grabs the second values. More... | |
| void | ParseMinute (char *d) |
| Grabs the minute values. More... | |
| void | ParseHour (char *d) |
| Grabs the hour values. More... | |
| void | ParseDayw (char *d) |
| Grabs the day of week values. More... | |
| void | ParseDaym (char *d) |
| Grabs the day of month values. More... | |
| void | ParseMonth (char *d) |
| Grabs the month values. More... | |
| void | ParseYear (char *d) |
| Grabs the year values. More... | |
| void | ParseValues (char *d, vector< int > &) |
| general parser for a string of values. More... | |
| void | ReadMsg (xmlNodePtr schedule_entry_node) |
| Reads the sub node to our node. More... | |
Private Attributes | |
| bool | m_isactive |
| twine | m_sec_value |
| vector< int > | m_sec_list |
| twine | m_min_value |
| vector< int > | m_min_list |
| twine | m_hour_value |
| vector< int > | m_hour_list |
| twine | m_dayw_value |
| vector< int > | m_dayw_list |
| twine | m_daym_value |
| vector< int > | m_daym_list |
| twine | m_mon_value |
| vector< int > | m_mon_list |
| twine | m_year_value |
| vector< int > | m_year_list |
| xmlDocPtr | m_msg |
This class defines our schedule entry object. It contains a description of one schedule entry and functions to tell if a given time smapshot matches the scheduled time for this entry to run. This also contains a function that will send the scheduled message to a processor and return.
| SchedEntry::SchedEntry | ( | xmlNodePtr | node | ) |
Schedule entries are read from the schedule portion of the configuration file. As such, the standard way to create a schedule entry object is with an xml node pointer.
|
virtual |
The destructor cleans up all of the data held by this class.
| void SchedEntry::LaunchProcess | ( | void | ) |
This method allows the caller to launch the scheduled message represented by this object. The intent of this method is to be called upon a true return from a call to MatchesTime. However, it is provided as a seperate independant function so that the scheduling engine may make appropriate decisions in alternative cases.
| bool SchedEntry::MatchesTime | ( | time_t | t | ) |
This method checks to see if the given time value matches the time for this schedule entry to run.
|
private |
Grabs the day of month values.
|
private |
Grabs the day of week values.
|
private |
Grabs the hour values.
|
private |
Grabs the minute values.
|
private |
Grabs the month values.
|
private |
Grabs the second values.
|
private |
general parser for a string of values.
|
private |
Grabs the year values.
|
private |
Reads the sub node to our node.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |


Toggle navigation
Kankemwa.I
About
Services
Contact
Hackathons
Resume
Contact Me
Software engineer, hackathon junkie & maker
of cool things that live on the internet, geek.
Follow me on Github
Follow me on LinkedIn
Follow me on Twitter
Follow me on Devpost


Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to<EMAIL_ADDRESS>so we can send you a copy immediately.
Concrete class for working with Atom entries.
Zend_Gdata_App_Extension_Content $_content = 'null'
atom:content element
Zend_Gdata_App_Extension_Control $_control = 'null'
app:control element
Zend_Gdata_App_Extension_Edited $_edited = 'null'
app:edited element
string $_entryClassName = 'Zend_Gdata_App_Entry'
Class name for each entry in this feed*
Zend_Gdata_App_Extension_Published $_published = 'null'
atom:published element
string $_rootElement = 'entry'
Root XML element for Atom entries.
Zend_Gdata_App_Extension_Source $_source = 'null'
atom:source element
Zend_Gdata_App_Extension_Summary $_summary = 'null'
atom:summary element
delete(
)
:
void
Deletes this entry to the server using the referenced Zend_Http_Client to do a HTTP DELETE to the edit link stored in this entry's link collection.
getContent(
)
:
Zend_Gdata_App_Extension_Content
Gets the value of the atom:content element
getControl(
)
:
Zend_Gdata_App_Extension_Control
Gets the value of the app:control element
getDOM(
$doc
=
null, $majorVersion
=
1, $minorVersion
=
null
)
:
getPublished(
)
:
Zend_Gdata_App_Extension_Published
Sets the value of the atom:published element This represents the publishing date for an entry
getSource(
)
:
Zend_Gdata_App_Extension_Source
Gets the value of the atom:source element
getSummary(
)
:
Zend_Gdata_App_Extension_Summary
Gets the value of the atom:summary element This represents a textual summary of this entry's content
reload(
string|null $uri
=
null, string|null $className
=
null, array $extraHeaders
=
array
)
:
mixed
Reload the current entry. Returns a new copy of the entry as returned by the server, or null if no changes exist. This does not modify the current entry instance.
save(
string|null $uri
=
null, string|null $className
=
null, array $extraHeaders
=
array
)
:
Zend_Gdata_App_Entry
Uploads changes in this entry to the server using Zend_Gdata_App
setContent(
Zend_Gdata_App_Extension_Content $value
)
:
Zend_Gdata_App_Entry
Sets the value of the atom:content element
setControl(
Zend_Gdata_App_Extension_Control $value
)
:
Zend_Gdata_App_Entry
Sets the value of the app:control element
setPublished(
Zend_Gdata_App_Extension_Published $value
)
:
Zend_Gdata_App_Entry
Sets the value of the atom:published element This represents the publishing date for an entry
setSource(
Zend_Gdata_App_Extension_Source $value
)
:
Zend_Gdata_App_Entry
Sets the value of the atom:source element
setSummary(
Zend_Gdata_App_Extension_Summary $value
)
:
Zend_Gdata_App_Entry
Sets the value of the atom:summary element This represents a textual summary of this entry's content
takeChildFromDOM(
$child
)
:


Comments
-
Greg Hurrell
I wonder if this is because you have
'hidden'
set to off and there are unsaved changes in the current buffer.Do you have it turned off? ie. what does VIM say when you do
:echo &hidden
? -
anonymous
The output of
:echo &hidden
is0
and you are probably right. I tried it again and the error happens when i have something modified and unsaved in current buffer. -
Greg Hurrell
I'll have a think and see if there's some way I can improve the UI here. I don't think I can (or should) override
'hidden'
, but I could at least suppress the error message and emit a friendlier warning instead. Perhaps there is even a way to avoid the error entirely (ie. falling back to opening in a new tab or split, and emitting a message explaining why this happened). -
Greg Hurrell
Ok, for the time being I am opening in a split when opening would otherwise fail (due to
'hidden'
being off and'modified'
being true).The commit is here.
Will mark this one as closed. New release including the change on the way shortly.
-
Greg Hurrell
Status changed:
- From: new
- To: closed
Add a comment
Comments are now closed for this issue.


$
0.00
/month
- No Support
- 1 Website
- 10GB Disk Space
- 3 Database
- 1 Email Address
$
29.00
/month
- 24/7 Support
- 1 Website
- 100GB Disk Space
- 10 Database
- 10 Email Address
$
39.00
/month
- 24/7 Support
- Unlimited Website
- 500GB Disk Space
- 25 Database
- 50 Email Address
$
99.00
/month
- 24/7 Support
- Unlimited Website
- Unlimited Disk Space
- Unlimited Database
- 100 Email Address


Book An Appointment Customer Contact
Please fill out the contact details for the customer below
{% extends "layout.html" %} {% block page_title %} GOV.UK prototype kit {% endblock %} {% block content %}
Please fill out the contact details for the customer below


--- title: My First Post slug: my-first-post excerpt: What is this line date: 2021-05-21 ---
Before we reach for a database, let's discuss how to store each blog post within its own HTML file. Then, in our routes file, we can use a route wildcard to determine which post needs to be fetched and passed to the view.


TIMEOUT(1) User Commands TIMEOUT(1) NAME timeout - run a command with a time limit SYNOPSIS timeout [OPTION] DURATION COMMAND [ARG]... timeout [OPTION] DESCRIPTION Start COMMAND, and kill it if still running after DURATION. Mandatory arguments to long options are mandatory for short options too. --foreground When not running timeout directly from a shell prompt, allow COM‐ MAND to read from the TTY and receive TTY signals. In this mode, children of COMMAND will not be timed out. -k, --kill-after=DURATION also send a KILL signal if COMMAND is still running this long after the initial signal was sent. -s, --signal=SIGNAL specify the signal to be sent on timeout. SIGNAL may be a name like `HUP' or a number. See `kill -l` for a list of signals --help display this help and exit --version output version information and exit DURATION is a floating point number with an optional suffix: `s' for sec‐ onds (the default), `m' for minutes, `h' for hours or `d' for days. If the command times out, then exit with status 124. Otherwise, exit with the status of COMMAND. If no signal is specified, send the TERM signal upon timeout. The TERM signal kills any process that does not block or catch that signal. For other processes, it may be necessary to use the KILL (9) signal, since this signal cannot be caught. AUTHOR Written by Padraig Brady. REPORTING BUGS Report timeout bugs to<EMAIL_ADDRESS>GNU coreutils home page: <http://www.gnu.org/software/coreutils/> General help using GNU software: <http://www.gnu.org/gethelp/> Report timeout translation bugs to <http://translationproject.org/team/> COPYRIGHT Copyright © 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO kill(1) The full documentation for timeout is maintained as a Texinfo manual. If the info and timeout programs are properly installed at your site, the command info coreutils 'timeout invocation' should give you access to the complete manual. GNU coreutils 8.12.197-032bb September 2011 TIMEOUT(1)


This tools allows simple creation of text data in multiple languages. This data is created in the browser, and can be downloaded as a tab-separated value file.
This data can then be loaded into a spreadsheet or text application.
Important: The data entered with this tool is not transmitted to any online application or website. It can be downloaded to the local computer, but is not made available to anyone or any entity without the user's specific action.
To fix or update entries,
To save the data to your computer:
This creates a locale file in your downloads folder. The file is stored in tab-separated-value format which can be opened with a spreadsheet program or any simple text editor.
An existing TSV file can be uploaded from the local disk by:
After loading a file, adding more lines, editing entries, and saving work as described above.
When adding data, shift-Enter creates a new line within the cell without moving to the next entry. This allows typing more than one line in an entry. This could be for multiple definitions, for example. Editing works fine, too.
Download of multiple lines works, with lines separated by a special set of characters "⟩NL⟨". This allows loading into a spreadsheet in a single cell, but does not automatically become new lines within that cell. In Excel, it's possible to do a Replace command to turn these into new lines within the cell.
Uploading such a TSV file works well with the dictionaryN site as long as the "⟩NL⟨" text is used to indicate the line breaks within the cell.


Our Products
Triptych are an exciting and creative way to showcase your favorite moments. Wall displays tell an entire story over multiple prints rather than being limited to a single print. They are offered in a variety of formats and are adaptable to almost any display situation.


Older interpreters, such as ITF, are extremely curt when an error condition is reached (for example, an illegal opcode). It was assumed that Infocom's shipped story files were bug-free, which is mostly true, so that errors could only arise through a bug elsewhere in the interpreter.
In debugging Inform games, though, many error conditions can arise and it is extremely helpful to report these as fully as possible. These include:
As mentioned in S 3, it's helpful to screen out any illegal ZSCII characters between 0 and 31 which are accidentally printed: crashes can be very mysterious when they cause interpreters to send control codes to the terminal.
In addition, an interpreter might provide options for keeping track of maximum stack usage and the typical number of opcodes executed between each read from the keyboard. (But watching these is a time-wasting activity, so they should be options.)
Finally, infinite loops fairly often happen, as in any programming language. On a system without pre-emptive multi-tasking, this may lock up the whole machine, as the usual way that porters implement multi-tasking is to return control to the host operating system only when the keyboard is read. This can be avoided by providing a point in the code which could return control to the OS from time to time (say, every 2000 instructions).
A number of post-Infocom games have been released which contain errors, most often trying to perform illegal operations on object 0. Many interpreters silently ignored these errors, which can make it very to notice and track down bugs.
It is desirable for modern interpreters to be able to notify players about these bugs, but this can also ruin gameplay. It is highly recommended, then, that interpreters have four levels of error checking, selectable by the user (through a command-line or menu option, or similar):
Section 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 / 10 / 11 / 12 / 13 / 14 / 15 / 16
Appendix A / B / C / D / E / F


[gecode-users] Gecode versus Ilog Solver
Guido Tack
tack at ps.uni-sb.de
Mon May 22 14:23:52 CEST 2006
Hi!
> I want to give some short sentences about my experiences concerning Ilog
> Solver 6.1 and Gecode 1.1 constraint library in C++.
Ok, feedback is always very welcome!
> I formulated my CSP, a special search strategy and some contraint
> propagators both with Ilog and Gecode.
>
> In my opinion the strict parting between modelling level and
> implementation level in Ilog makes its usage complicated. For branching
> or propagation you ve got to switch to implementation level and can use
> some macros to generate the modelling level. but thats no clear solution
> for me. Your cant get a good interface (e.g. readable headers) for
> your modelling classes.
> The solution of Gecode is better to handle and open for a deeper look
> into details.
That could be stated as one of our design principles ;-)
> As you can see in my often questioning: support is great for Gecode. The
> Ilog support people need at least a week for answering from my own
> experience. That's breaking hard in your programming progress. Thanks
> for your support! ;) (looking forward to your tutorial.. that will deal
> with the remaining starting problems!)
You're very welcome. Of course, one difference is that we can't give any
guarantees that we're going to respond at all, while Ilog pays people for
giving support. Of course, we'll try to do our best.
Concerning the tutorial, in fact, people asking questions gives us a good idea
of what parts need special care. So, any feedback on what you consider
especially difficult (or fairly easy) is welcome.
> Summarising I can say that my developing and modelling time in Gecode is
> at least half than in Ilog. Maybe in part by a better knowledge of some
> techniques in such libraries now (tried Ilog first).
>
> But in the end Gecode is so far easier to handle for me.. ;)
>
> Think some enjoyable words are also nice for such a user list!
Indeed they are! Thanks a lot. And keep bothering us ;-)
Cheers,
Guido
--
Guido Tack
Programming Systems Lab, Saarland University, Germany
http://www.ps.uni-sb.de/~tack
More information about the gecode-users
mailing list


DeletionPolicy
attribute
With the DeletionPolicy
attribute you can preserve, and in some cases, backup
a resource when its stack is deleted. You specify a DeletionPolicy
attribute for
each resource that you want to control. If a resource has no DeletionPolicy
attribute, AWS CloudFormation deletes the resource by default.
This capability also applies to stack update operations that lead to resources being deleted from stacks. For example, if you remove the resource from the stack template, and then update the stack with the template. This capability doesn't apply to resources whose physical instance is replaced during stack update operations. For example, if you edit a resource's properties such that CloudFormation replaces that resource during a stack update.
Exception: The default policy is Snapshot
for AWS::RDS::DBCluster
resources and for AWS::RDS::DBInstance
resources that don't specify the DBClusterIdentifier
property.
To keep a resource when its stack is deleted, specify Retain
for that
resource. You can use retain for any resource. For example, you can retain a nested stack,
Amazon S3 bucket, or EC2 instance so that you can continue to use or modify those resources after
you delete their stacks.
If you want to modify resources outside of CloudFormation, use a retain policy and then delete the stack. Otherwise, your resources might get out of sync with your CloudFormation template and cause stack errors.
For resources that support snapshots, such as AWS::EC2::Volume
, specify
Snapshot
to have CloudFormation create a snapshot before deleting the
resource.
The following snippet contains an Amazon S3 bucket resource with a Retain
deletion
policy. When this stack is deleted, CloudFormation leaves the bucket without deleting it.
JSON
{ "AWSTemplateFormatVersion" : "2010-09-09", "Resources" : { "myS3Bucket" : { "Type" : "AWS::S3::Bucket", "DeletionPolicy" : "Retain" } } }
YAML
AWSTemplateFormatVersion: '2010-09-09' Resources: myS3Bucket: Type: AWS::S3::Bucket DeletionPolicy: Retain
DeletionPolicy
options
- Delete
-
CloudFormation deletes the resource and all its content if applicable during stack deletion. You can add this deletion policy to any resource type. By default, if you don't specify a
DeletionPolicy
, CloudFormation deletes your resources. However, be aware of the following considerations:-
For
AWS::RDS::DBCluster
resources, the default policy isSnapshot
. -
For
AWS::RDS::DBInstance
resources that don't specify theDBClusterIdentifier
property, the default policy isSnapshot
. -
For Amazon S3 buckets, you must delete all objects in the bucket for deletion to succeed.
Note The default behavior of CloudFormation is to delete the secret with the ForceDeleteWithoutRecovery flag.
-
- Retain
-
CloudFormation keeps the resource without deleting the resource or its contents when its stack is deleted. You can add this deletion policy to any resource type. When CloudFormation completes the stack deletion, the stack will be in
Delete_Complete
state; however, resources that are retained continue to exist and continue to incur applicable charges until you delete those resources.For update operations, the following considerations apply:
-
If a resource is deleted, the
DeletionPolicy
retains the physical resource but ensures that it's deleted from CloudFormation's scope. -
If a resource is updated such that a new physical resource is created to replace the old resource, then the old resource is completely deleted, including from CloudFormation's scope.
-
- Snapshot
-
For resources that support snapshots, CloudFormation creates a snapshot for the resource before deleting it. When CloudFormation completes the stack deletion, the stack will be in the
Delete_Complete
state; however, the snapshots that are created with this policy continue to exist and continue to incur applicable charges until you delete those snapshots.Resources that support snapshots include:


--- title: dogenerator permalink: doge/ description: such doge generator, wow social: true socialImg: assets/social/doge.jpg --- {% include header.html %}


{% if problem_basics["exists"] %} {% if last_submission["passed"] %}
{{ problem_details["answer_code"]}}{% if len(problem_details["answer_description"]) > 0 %}
{{ problem_details["answer_description"] }}
{% end %} {% else %}Either you have not yet passed this problem or you passed it previously but your most recent submission is not passing. Please make sure your code passes the problem, and then you'll be able to view the instructor's answer.
{% end %} {% else %}This problem does not exist.
{% end %}


Web Design & Development, Databse Design, Cloud Computing, Human Computer Interaction Systems, Software Engineering


{% extends 'base.html' %} {% block content %} 404 Nothing is here. {% endblock content %}
Nothing is here.


Web Designer Wall
A wall of design ideas, web trends, and tutorials
Best Web Gallery
Featuring the best CSS and Flash web sites
N.Design Studio
Blog and design portfolio of WDW designer, Nick La


The method .map is very handy when you want to transform all the elements in an array. Normally, you could try to use a for loop, but this changes the original input array. If you want to transform without having to change the original array, you can use .map to iterate over the array. Additionally, if you actually do want to modify the original array, you simply have to use .map! In either case, .map is an important tool when applying changes over an entire array.
For example, if you went out to eat with your friends and wanted to figure out each person/s bill, you could put the prices into an array. However, rather than add tip to each person's price individually, you could use .map to iterate over the array like so:
bill = [4, 5, 7, 8, 10] bill_plus_tip = bill.map { |price| price * 1.2} puts bill_plus_tip.join(", ") #=> 4.8, 6.0, 8.4, 9.6, 12.0
Not only can you use .map to iterate over number based arrays, you can also use it to transform arrays of strings. Say for example you had an array containing the names of everyone you wanted to invite to a special event. However, you realize you forgot to capitalize the names of everyone in the array. No problem, just use .map to capitalize every name in the array like so:
invite = ["john", "mary", "bill", "helen", "erica"] proper_invite = invite.map {|name| name.capitalize} puts proper_invite.join(", ") #=> John, Mary, Bill, Helen, Erica
As you can see, enumerables are extremely useful tools in programming that allow us to take a function and apply it numerous times across the values we need them to. This often saves us lots of time and effort, in addition to allowing us to make our code much shorter and easier to read.


 However, the past years, informatics have become more and more important for my research. I'm analysing huge amounts of data on cluster computers. And with the neuropowertools, I've learned to create both back-end and front-end programming. During this learning process, I relied very much on online resources. Which means: google, stack overflow, google, blogs,... So many people have helped me becoming a semi-informatician without even knowing. It's now time to pass it forward. On this page, I'll try to post from time to time little tips and tricks that made my life as a scientist easier.
This one is for those of you who rely on high performance computing for their research ! I recently discovered a few commands that make life really easy. My first steps to a data scientist were made with R. As a consequence, I still like writing all my programs interactively: first line by line. Once I get through a program without errors/bugs, I submit a job on the HPC. However, most of my programs are statistical analyses, so often I have to deal with ALL THE RANDOMNESS ! For example: I run thousands of simulations in a loop for multiple hours or days, and somewhere there is a bug. Aarghhh!!
Now there are multiple solutions:
[joke@mycomputer ~] ssh joke@othercomputer
[joke@othercomputer ~] screen
[joke@othercomputer ~] srun --time=20:00:00 bash
[joke@computenode ~] python -i myprogram.py
[Control-A-D]
[joke@othercomputer ~] exit
When I get home in the evening:
[joke@mycomputer ~] ssh joke@othercomputer
[joke@othercomputer ~] screen -list
There are screens on: 8502.pts-103.othercomputer (Detached)
[joke@othercomputer ~] screen -r 8502
[joke@computenode ~] Error !! Message about the error
[joke@computenode ~] >>


|
aws-crt-cpp
C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.
|
#include <HttpConnection.h>
Public Member Functions | |
| HttpClientConnectionProxyOptions () | |
| HttpClientConnectionProxyOptions (const HttpClientConnectionProxyOptions &rhs)=default | |
| HttpClientConnectionProxyOptions (HttpClientConnectionProxyOptions &&rhs)=default | |
| HttpClientConnectionProxyOptions & | operator= (const HttpClientConnectionProxyOptions &rhs)=default |
| HttpClientConnectionProxyOptions & | operator= (HttpClientConnectionProxyOptions &&rhs)=default |
| ~HttpClientConnectionProxyOptions ()=default | |
| void | InitializeRawProxyOptions (struct aws_http_proxy_options &raw_options) const |
Public Attributes | |
| String | HostName |
| uint16_t | Port |
| Optional< Io::TlsConnectionOptions > | TlsOptions |
| AwsHttpProxyConnectionType | ProxyConnectionType |
| std::shared_ptr< HttpProxyStrategy > | ProxyStrategy |
| AwsHttpProxyAuthenticationType | AuthType |
| String | BasicAuthUsername |
| String | BasicAuthPassword |
Configuration structure that holds all proxy-related http connection options
| Aws::Crt::Http::HttpClientConnectionProxyOptions::HttpClientConnectionProxyOptions | ( | ) |
|
default |
|
default |
|
default |
| void Aws::Crt::Http::HttpClientConnectionProxyOptions::InitializeRawProxyOptions | ( | struct aws_http_proxy_options & | raw_options | ) | const |
Intended for internal use only. Initializes the C proxy configuration structure, aws_http_proxy_options, from an HttpClientConnectionProxyOptions instance.
| raw_options | - output parameter containing low level proxy options to be passed to the C interface |
If this object itself does not live to the C call that uses raw_options, you will get a crash.
|
default |
|
default |
| AwsHttpProxyAuthenticationType Aws::Crt::Http::HttpClientConnectionProxyOptions::AuthType |
Backwards compatibility achieved by invoking CreateBasicHttpProxyStrategy if (1) ProxyStrategy is null (2) AuthType is AwsHttpProxyAuthenticationType::Basic
| String Aws::Crt::Http::HttpClientConnectionProxyOptions::BasicAuthPassword |
| String Aws::Crt::Http::HttpClientConnectionProxyOptions::BasicAuthUsername |
| String Aws::Crt::Http::HttpClientConnectionProxyOptions::HostName |
The name of the proxy server to connect through. Required.
| uint16_t Aws::Crt::Http::HttpClientConnectionProxyOptions::Port |
The port of the proxy server to connect to. Required.
| AwsHttpProxyConnectionType Aws::Crt::Http::HttpClientConnectionProxyOptions::ProxyConnectionType |
What kind of proxy connection to make
| std::shared_ptr<HttpProxyStrategy> Aws::Crt::Http::HttpClientConnectionProxyOptions::ProxyStrategy |
Proxy strategy to use while negotiating the connection. Use null for no additional steps.
| Optional<Io::TlsConnectionOptions> Aws::Crt::Http::HttpClientConnectionProxyOptions::TlsOptions |
Sets the TLS options for the connection to the proxy. Optional.


| Figure 1 |
Experimental orchards location. Flowering and maturity dates ... |
| Figure 2 |
Description of data source, time-span, number of observed cu ... |
| Figure 3 |
Information on the number of observed cultivars and the over ... |
| Figure 4 |
BBCH descriptors (Meier 40 ) corresponding to the flowering ... |
| Figure 5 |
Comparison of flowering dates in days (from 1st of January) ... |


Test Chromium performance of multi-repo patches on the top webpages
See the
How-To page
for documentation on each field below.


|
Q |
Why am I getting so much data back?
|
| A |
Each association will be traversed in both directions,
unless there is a restriction defined. If, for example, the
subject table is employee, and the association
from department
table to employee table is enabled, you
will not only get all departments associated with any subject
employee, but also all employees associated with one of these departments.
If you get lines that you do not want to get, you need to make a further restriction. The Progress Panel can help you in such a case.
It shows the chain of associations for each
exported row back to a subject row, where the export
starts. I recommend reading the tutorial that explains these things.
Instead of adding all restrictions you need, starting from
the unrestricted model, you can also go the opposit way: at
first disable all associations (except dependencies) via the menu item
"Edit->Disable all
associations". Then remove restrictions
until you get all the rows you are looking for.
It is easier to get a working extraction model in this way, but it is more difficult to ensure that the model is not too restrictive, i.e. that you get all the rows you want.
In my experience the best way to define an extraction model
is to use the "Closure" view.
The closure view lists all tables that are directly or
indirectly associated with the subject table (where the
export starts), according to the restrictions, ordered by
distance.
Check each table of this list from top to bottom. If you
don't want to have rows from the table to be exported, select
the table and disable the association which will be automatically selected (the context menu of the table is also available here). The table disapears from the list as soon as
it is no longer associated with the subject.
You could also first check the tables with the highest degree (the degree of a table is the total number of adjacent tables that can be reached directly with an enabled association.) this way. These are often the tables that increase the closure significantly and therefore have many associations to be restricted.
In this way, you simply get an extraction model that extracts rows only from tables from which you want to extract data.
Finally, check all associations between the remaining
tables.
|
|
Q |
What does $DISTANCE and $IS_SUBJECT mean? |
| A |
$DISTANCE and $IS_SUBJECT are special expressions used
in restriction conditions in order to define restriction
models based on topological properties of rows.
| Expression |
Type |
|
| A.$DISTANCE or B.$DISTANCE |
INTEGER |
Minimum length of all paths from the row back to
any subject row.
The distance of a subject row is 0. |
| A.$BIRTHDAY |
INTEGER |
Synonym for A.$DISTANCE |
| A.$IS_SUBJECT |
BOOLEAN |
Synonym for A.$DISTANCE=0 |
| $IN_DELETE_MODE |
BOOLEAN |
Is true during "Delete Reduction" stage, otherwise false |
|
|
Q |
What is the preferred way to update an existing data model and extraction model, when the database has new schema changes? |
| A |
To update the data model, open the extraction model editor and select "Data Model" -> "Analyze Database". If necessary, several times for each schema, if there are several.
When the data model is updated, each extraction model will be migrated on loading. Tables and associations that no longer exist after the database changes are silently removed from the extraction models as well.
Associations that are newly added and are relevant to the extraction model (that is: directly or indirectly connected to a subject table) are listed in the "Model Migration Tool" dialog. (There is a button "Migration pending" at the top to open this dialog again after you have closed it).
In the "Model Migration Tool" each new association can be examined and either restricted or - with the "Checked" button - marked as checked. When all associations have been checked or restricted, the migration is finished.
if you save an extraction model before migration is finished, you can continue the migration after loading it again.
|
|
Q |
How do I anonymize the extracted data? |
| A |
It's possible to anonymize the extracted data by defining filters (via
"Edit" menu
"Filter editor...",
or table's context menu)
A filter is an assignment of an SQL expression to a table
column. The column values will be replaced by the result of
the expression when the export file is written.
For example:
In order to substitute the values of the column PERSON.SSN
with the constant value '123', define the filter:
PERSON.SSN := '123'
The filter
PERSON.SSN :=
substr(${old-value}, 1, length(${old-value}) - 3) ||
'***'
replaces the last 3 characters of the SSN with '***'
${old-value} is a synonym for the filtered column.
The filter:
PERSON.SSN := (SELECT SSN
FROM TEST_SSN ORDER BY RAND()
FETCH FIRST 1 ROWS ONLY)
would replace the SSN with a randomly chosen SSN from a table
holding test SSNs (IBM DB2)
|
|
Q |
Is
it possible to avoid the creation of JAILER_* tables in the
database? |
| A |
Set the working-table scope to "local database" ("Data
Export" dialog) to avoid the creation of that tables in your
database. The tables will then be created in a local database
(H2).
For DB2, Oracle and PostgreSQL, it is also possible to create
the tables as temporary tables.
|
|
Q |
I'm getting the message "Table has no primary key". What's
wrong? |
| A |
Jailer cannot handle tables without a primary key.
Exporting data is not possible if the subject table is associated with a table without a primary key. In this case, you should manually define a primary key in the data model of the tool (not in the database!) using the Data Model Editor. Note that a key must be unique.
However, when working with Oracle or PostgreSQL, you can use the rowid respectively the ctid pseudo columns instead of primary keys.
See section "Row identification" in the "Data Export" dialog.
|
|
Q |
How can I safely export rows without their parents?
|
| A |
If a foreign key of a table is nullable, a "null" filter on it (resp. on all columns of a composite foreign key) causes only the foreign key columns of those rows to be filled with "null", whose parent row is not exported as well.
In the same way, only the foreign key columns of those rows are set to "null" when deleting, which are not deleted themselves but their parent.
See filter documentation
|
|
Q |
The GUI is slow, what can I do?
|
| A |
Due to the dynamic nature of the layout algorithm, the
table-association graph is permanently redrawn. It seems that
this consumes too much cpu time on some systems. However,
there is a parameter called "animation step time" which
determines the minimum time (in ms) for one animation step.
Increasing that parameter (Settings->Animation step time)
will reduce the cpu utilization.
|
|
Q |
How do I setup multi-user mode?
|
| A |
Unzip the "jailer-version.zip" file and create an (empty) file ".multiuser" in the directory "jailer".
All model and settings files are then stored in a folder named ".jailer" in the user's home directory.
|
|
Q |
Why do text and buttons on my Full HD, UHD or 4K displays look so small?
|
| A |
Java JRE 8 does not support HiDPI graphics. Therefore it is strongly recommended to use Java JRE 11 (or above).
|


class Phoenix::Timer
- Phoenix::Timer
- Reference
- Object
Overview
Creates a timer that accepts a delay_calc
proc to perform
calculated timeout retries, such as exponential backoff.
reconnect_timer = Phoenix::Timer.new(
->{ connect() },
->(count : UInt32) { [1000_u32, 5000_u32, 10_000_u32].fetch(count - 1) { 10_000_u32 } }
)
reconnect_timer.schedule_timeout # fires after 1000
reconnect_timer.schedule_timeout # fires after 5000
reconnect_timer.reset
reconnect_timer.schedule_timeout # fires after 1000
Defined in:
phoenix/timer.crConstructors
-
.new(callback : -> , delay : UInt32, repeat : Bool = false)
Create a basic timer with a fixed delay
-
.new(callback : -> , delay_calc : UInt32 -> UInt32, repeat : Bool = false)
Create a dynamic timer with a delay based on the count
Instance Method Summary
-
#reset
Cancels any previous
#schedule_timeout
and resets the count -
#schedule_timeout
Cancels any previous
#schedule_timeout
and schedules callback
Constructor Detail
def self.new(callback : -> , delay : UInt32, repeat : Bool = false)
#
Create a basic timer with a fixed delay
def self.new(callback : -> , delay_calc : UInt32 -> UInt32, repeat : Bool = false)
#
Create a dynamic timer with a delay based on the count


{% extends 'templates/partials/base.html' %} {% block scheme %}orange{% endblock %} {% block content %} We’ve got a brand new site on the way. Check back in a couple of days. In the meantime, you can contact us at<EMAIL_ADDRESS>{% endblock %}


Project name is required.
Project name has invalid characters. Please ensure that the user name has only alphanumeric characters.
Environment is required.
Url is required.
Url has invalid characters. Please ensure that the format should be http://[domain]/path(s)/.
Username is required.
Username has invalid characters. Please ensure that the user name has only alphanumeric characters.
Password is required.
Password has invalid characters. Please ensure that the password has only alphanumeric characters.
Server Path is required.
Server Path has invalid characters. Please ensure that the format should be $/[Framework]/[FolderName].
Password has invalid characters. Please ensure that the user name has only alphanumeric characters.


Before Change
def use_s3fs_es(file_path, path, read=True):
s3 = s3fs.S3FileSystem(anon=True)
if read:
with s3.open(path, "rb") as fin:
with open(file_path, "wb") as fout:
for line in fin:
fout.write(line)
else:
with open(file_path, "rb") as fin:
with s3.open(path, "wb") as fout:
for line in fin:
fout.write(line)
def use_smartopen_features(path, features_dict=None, transport_params=None, read=True):
if read:
with open(path, "r", encoding="utf-8", transport_params=transport_params) as f:
features_dict = json.load(f)
After Change
def use_s3fs_es(file_path, path, read=True):
s3 = s3fs.S3FileSystem(anon=True)
if read:
s3.get(path, file_path)
else:
s3.put(file_path, path)


Connect to Trello
Add @WebhookCo in Telegram, and generated code using /getcode command
Copy your user key from Pushover and paste it here.
Go to Rooms > Integrations > Build Your Own!, Create your bot and share bot token & room Id here.