Source code for torch.fx.node
# Nodes represent a definition of a value in our graph of operators.
from typing import TYPE_CHECKING, Union, Callable, Any, Tuple, List, Optional, Dict
from .immutable_collections import immutable_dict, immutable_list
import torch
if TYPE_CHECKING:
from .graph import Graph
BaseArgumentTypes = Union[str, int, float, bool, torch.dtype, torch.Tensor]
base_types = BaseArgumentTypes.__args__ # type: ignore
Target = Union[Callable[..., Any], str]
Argument = Optional[Union[
Tuple[Any, ...], # actually Argument, but mypy can't represent recursive types
List[Any], # actually Argument
Dict[str, Any], # actually Argument
slice, # Slice[Argument, Argument, Argument], but slice is not a templated type in typing
'Node',
BaseArgumentTypes
]]
[docs]class Node:
"""
``Node`` is the data structure that represents individual operations within
a ``Graph``. For the most part, Nodes represent callsites to various entities,
such as operators, methods, and Modules (some exceptions include nodes that
specify function inputs and outputs). Each ``Node`` has a function specified
by its ``op`` property. The ``Node`` semantics for each value of ``op`` are as follows:
- ``placeholder`` represents a function input. The ``name`` attribute specifies the name this value will take on.
``target`` is similarly the name of the argument. ``args`` holds either: 1) nothing, or 2) a single argument
denoting the default parameter of the function input. ``kwargs`` is don't-care. Placeholders correspond to
the function parameters (e.g. ``x``) in the graph printout.
- ``get_attr`` retrieves a parameter from the module hierarchy. ``name`` is similarly the name the result of the
fetch is assigned to. ``target`` is the fully-qualified name of the parameter's position in the module hierarchy.
``args`` and ``kwargs`` are don't-care
- ``call_function`` applies a free function to some values. ``name`` is similarly the name of the value to assign
to. ``target`` is the function to be applied. ``args`` and ``kwargs`` represent the arguments to the function,
following the Python calling convention
- ``call_module`` applies a module in the module hierarchy's ``forward()`` method to given arguments. ``name`` is
as previous. ``target`` is the fully-qualified name of the module in the module hierarchy to call.
``args`` and ``kwargs`` represent the arguments to invoke the module on, *including the self argument*.
- ``call_method`` calls a method on a value. ``name`` is as similar. ``target`` is the string name of the method
to apply to the ``self`` argument. ``args`` and ``kwargs`` represent the arguments to invoke the module on,
*including the self argument*
- ``output`` contains the output of the traced function in its ``args[0]`` attribute. This corresponds to the "return" statement
in the Graph printout.
"""
def __init__(self, graph: 'Graph', name: str, op: str, target: 'Target',
args: Tuple['Argument', ...], kwargs: Dict[str, 'Argument'],
type : Optional[Any] = None) -> None:
self.graph = graph
self.name = name # unique name of value being created
assert op in ['placeholder', 'call_method', 'call_module', 'call_function', 'get_attr', 'output', 'root']
self.op = op # the kind of operation = placeholder|call_method|call_module|call_function|get_attr
if op in ['call_method', 'call_module']:
assert isinstance(target, str)
self.target = target # for method/module/function, the name of the method/module/function/attr
# being invoked, e.g add, layer1, or torch.add
# All `Node`-valued inputs. Key is the Node, value is don't-care.
# The public API for this is `all_input_nodes`, this private attribute
# should not be accessed directly.
self._input_nodes : Dict[Node, None] = {}
self.__update_args_kwargs(map_arg(args, lambda x: x), map_arg(kwargs, lambda x: x)) # type: ignore
# All of the nodes that use the value produced by this Node
# Note one user may correspond to several uses, e.g. the node fo ``x + x``
# would appear once here, but represents two uses.
#
# Is a dict to act as an "ordered set". Keys are significant, value dont-care
self.users : Dict['Node', None] = {}
# Type expression representing the output value of this node.
# This should contain the same class of Type objects that would appear
# as type annotations for function inputs/outputs.
#
# For placeholder nodes, this value will be used to type-annotate the
# generated function parameters.
# For the return ndoe, this value will be used to type-annotate the
# generated function return type. (Note this is a special case. ``return``
# does not produce a value, it's more of a notation. Thus, this value
# describes the type of args[0] in the ``return`` node.
self.type : Optional[Any] = type
self._prev = self
self._next = self
self._erased = False
@property
def next(self) -> 'Node':
"""
Returns the next ``Node`` in the linked list of Nodes.
Returns:
The next ``Node`` in the linked list of Nodes.
"""
return self._next
@property
def prev(self) -> 'Node':
"""
Returns the previous ``Node`` in the linked list of Nodes.
Returns:
The previous ``Node`` in the linked list of Nodes.
"""
return self._prev
[docs] def prepend(self, x: 'Node') -> None:
"""
Insert x before this node in the list of nodes in the graph. Example::
Before: p -> self
bx -> x -> ax
After: p -> x -> self
bx -> ax
Args:
x (Node): The node to put before this node. Must be a member of the same graph.
"""
assert self.graph == x.graph, "Attempting to move a Node into a different Graph"
x._remove_from_list()
p = self._prev
p._next, x._prev = x, p
x._next, self._prev = self, x
[docs] def append(self, x: 'Node') -> None:
"""
Insert x after this node in the list of nodes in the graph.
Equvalent to ``self.next.prepend(x)``
Args:
x (Node): The node to put after this node. Must be a member of the same graph.
"""
self._next.prepend(x)
def _remove_from_list(self):
p, n = self._prev, self._next
p._next, n._prev = n, p
@property
def args(self) -> Tuple[Argument, ...]:
"""
The tuple of arguments to this ``Node``. The interpretation of arguments
depends on the node's opcode. See the :class:`Node` docstring for more
information.
Assignment to this property is allowed. All accounting of uses and users
is updated automatically on assignment.
"""
return self._args
@args.setter
def args(self, a : Tuple[Argument, ...]):
"""
Set the tuple of arguments to this Node. The interpretation of arguments
depends on the node's opcode. See the ``fx.Graph`` docstring for more
information.
"""
# DO NOT CALL `__update_args_kwargs` directly. The correct way to
# set `args` is via direct assignment, i.e. `node.args = new_args`
self.__update_args_kwargs(map_arg(a, lambda x: x), self._kwargs) # type: ignore
@property
def kwargs(self) -> Dict[str, Argument]:
"""
The dict of keyword arguments to this ``Node``. The interpretation of arguments
depends on the node's opcode. See the :class:`Node` docstring for more
information.
Assignment to this property is allowed. All accounting of uses and users
is updated automatically on assignment.
"""
return self._kwargs
@kwargs.setter
def kwargs(self, k : Dict[str, Argument]):
"""
Set the dict of kwargs to this Node. The interpretation of arguments
depends on the node's opcode. See the ``fx.Graph`` docstring for more
information.
"""
# DO NOT CALL `__update_args_kwargs` directly. The correct way to
# set `args` is via direct assignment, i.e. `node.kwargs = new_kwargs`
self.__update_args_kwargs(self._args, map_arg(k, lambda x: x)) # type: ignore
@property
def all_input_nodes(self) -> List['Node']:
"""
Return all Nodes that are inputs to this Node. This is equivalent to
iterating over ``args`` and ``kwargs`` and only collecting the values that
are Nodes.
Returns:
List of ``Nodes`` that appear in the ``args`` and ``kwargs`` of this
``Node``, in that order.
"""
return list(self._input_nodes.keys())
def __update_args_kwargs(self, new_args : Tuple['Argument', ...], new_kwargs : Dict[str, 'Argument']):
"""
This API is internal. Do *not* call it directly.
"""
self._args = new_args
self._kwargs = new_kwargs
for old_use in self._input_nodes.keys():
old_use.users.pop(self)
self._input_nodes = {}
map_arg(self._args, lambda n: self._input_nodes.setdefault(n))
map_arg(self._kwargs, lambda n: self._input_nodes.setdefault(n))
for new_use in self._input_nodes.keys():
new_use.users.setdefault(self)
def __repr__(self) -> str:
return self.name
[docs] def replace_all_uses_with(self, replace_with : 'Node') -> List['Node']:
"""
Replace all uses of ``self`` in the Graph with the Node ``replace_with``.
Args:
replace_with (Node): The node to replace all uses of ``self`` with.
Returns:
The list of Nodes on which this change was made.
"""
to_process = list(self.users)
for use_node in to_process:
def maybe_replace_node(n : Node) -> Node:
if n == self:
return replace_with
else:
return n
new_args = map_arg(use_node.args, maybe_replace_node)
new_kwargs = map_arg(use_node.kwargs, maybe_replace_node)
assert isinstance(new_args, tuple)
assert isinstance(new_kwargs, dict)
use_node.__update_args_kwargs(new_args, new_kwargs)
assert len(self.users) == 0
return to_process
def map_arg(a: Argument, fn: Callable[[Node], Argument]) -> Argument:
""" Apply fn to each Node appearing arg. arg may be a list, tuple, slice, or dict with string keys. """
return map_aggregate(a, lambda x: fn(x) if isinstance(x, Node) else x)
def map_aggregate(a: Argument, fn: Callable[[Argument], Argument]) -> Argument:
""" Apply fn to each Node appearing arg. arg may be a list, tuple, slice, or dict with string keys. """
if isinstance(a, tuple):
return tuple(map_aggregate(elem, fn) for elem in a)
elif isinstance(a, list):
return immutable_list(map_aggregate(elem, fn) for elem in a)
elif isinstance(a, dict):
return immutable_dict((k, map_aggregate(v, fn)) for k, v in a.items())
elif isinstance(a, slice):
return slice(map_aggregate(a.start, fn), map_aggregate(a.stop, fn), map_aggregate(a.step, fn))
else:
return fn(a)


Text Interleaver
Enter multiple passages of text, then click the button to interleave the lines.
Text to Interleave Left:
Clear
This is a passage of text in English. It has been translated into Pig Latin. The original and the translation will be interleaved. This is intended to assist with translating works.
Lines to Take:
Text to Interleave Right:
Clear
Isthay isway away assagepay ofway extway inway Englishway. Itway ashay eenbay anslatedtray intoway Igpay Atinlay. Ethay originalway andway ethay anslationtray illway ebay interleavedway. Isthay isway intendedway ootay assistway ithway anslatingtray orksway.
Lines to Take:
Interleave
Deinterleave
Text Interleaved:
Clear


public class KernelListenerAdapter extends java.lang.Object implements KernelListener
| Constructor and Description |
|---|
KernelListenerAdapter() |
| Modifier and Type | Method and Description |
|---|---|
void |
agentAdded(Kernel kernel,
AgentProxy agent)
Notification that an agent has been added.
|
void |
agentRemoved(Kernel kernel,
AgentProxy agent)
Notification that an agent has been removed.
|
void |
simulationEnded(Kernel kernel)
Notification that the kernel has ended the simulation and shut down.
|
void |
simulationStarted(Kernel kernel)
Notification that the kernel has started the simulation.
|
void |
simulatorAdded(Kernel kernel,
SimulatorProxy simulator)
Notification that a simulator has been added.
|
void |
simulatorRemoved(Kernel kernel,
SimulatorProxy simulator)
Notification that a simulator has been removed.
|
void |
timestepCompleted(Kernel kernel,
Timestep time)
Notification that a timestep has been completed.
|
void |
viewerAdded(Kernel kernel,
ViewerProxy viewer)
Notification that a viewer has been added.
|
void |
viewerRemoved(Kernel kernel,
ViewerProxy viewer)
Notification that a viewer has been removed.
|
public void simulationStarted(Kernel kernel)
KernelListener
simulationStarted
in interface KernelListener
kernel
- The kernel.public void simulationEnded(Kernel kernel)
KernelListener
simulationEnded
in interface KernelListener
kernel
- The kernel.public void timestepCompleted(Kernel kernel, Timestep time)
KernelListener
timestepCompleted
in interface KernelListener
kernel
- The kernel.time
- The timestep that has just been completed.public void agentAdded(Kernel kernel, AgentProxy agent)
KernelListener
agentAdded
in interface KernelListener
kernel
- The kernel.agent
- The agent that was added.public void agentRemoved(Kernel kernel, AgentProxy agent)
KernelListener
agentRemoved
in interface KernelListener
kernel
- The kernel.agent
- The agent that was removed.public void simulatorAdded(Kernel kernel, SimulatorProxy simulator)
KernelListener
simulatorAdded
in interface KernelListener
kernel
- The kernel.simulator
- The simulator that was added.public void simulatorRemoved(Kernel kernel, SimulatorProxy simulator)
KernelListener
simulatorRemoved
in interface KernelListener
kernel
- The kernel.simulator
- The simulator that was removed.public void viewerAdded(Kernel kernel, ViewerProxy viewer)
KernelListener
viewerAdded
in interface KernelListener
kernel
- The kernel.viewer
- The viewer that was added.public void viewerRemoved(Kernel kernel, ViewerProxy viewer)
KernelListener
viewerRemoved
in interface KernelListener
kernel
- The kernel.viewer
- The viewer that was removed.


http://www.asciidoctor.org
Asciidoctor IRC channel
Asciidoctor homepage
mailing list
The section [page-break] describes how to add a page break.
The section Page break describes how to add a page break.
Refer to Section A.
[prag] Andy Hunt & Dave Thomas. The Pragmatic Programmer


As of 1 November 2009, worldwide more than 199 countries and overseas territories/communities have reported laboratory confirmed cases of pandemic influenza H1N1 2009, including over 6000 deaths.
As many countries have stopped counting individual cases, particularly of milder illness, the case count is likely to be significantly lower than the actual number of cases that have occurred. WHO is actively monitoring the progress of the pandemic through frequent consultations with the WHO Regional Offices and member states and through monitoring of multiple sources of data.
Intense and persistent influenza transmission continues to be reported in North America without evidence of a peak in activity. The proportion of sentinel physician visits due to influenza-like-illness (ILI)(8%) has exceeded levels seen over the past 6 influenza seasons; 42% of respiratory samples tested were positive for influenza and 100% of subtyped influenza A viruses were pandemic H1N1 2009. Rates of ILI, proportions of respiratory samples testing positive for influenza, and numbers of outbreaks in educational settings continues to increase sharply in Canada as activity spreads eastward. Significantly more cases of pandemic H1N1 have been recorded in Mexico since September than were observed during the initial springtime epidemic.
In Europe and Central and Western Asia, pandemic influenza activity continues to increase across many countries, signalling an unusually early start to the winter influenza season. Active circulation of virus marked by high proportions of sentinel respiratory samples testing positive for influenza has been reported in Belgium (69%), Ireland (55%), Netherlands (51%), Norway (66%), Spain (46%), Sweden (33%), the United Kingdom (Northern Ireland:81%), and Germany (27%). In addition, there is evidence of increasing and active transmission of pandemic influenza virus across Northern and Eastern Europe (including Ukraine and Belarus), and eastern Russia. For details on the situation in Ukraine please refer to the Disease Outbreak News update below. In Western Asia and the Eastern Mediterranean Region, increasing activity has been reported in Oman and Afghanistan.
In East Asia, intense and increasing influenza activity continues to be reported in Mongolia. In China, after an earlier wave of mixed influenza activity (seasonal H3N2 and pandemic H1N1), pandemic H1N1 influenza activity now predominates and is increasing. Sharp increases in pandemic influenza activity continue to be reported throughout Japan with highest rates of illness being reported on the northern island.
Active influenza transmission and increasing levels of respiratory diseases continues to be reported in parts of the Caribbean, including in Cuba, Haiti, and other Caribbean Epidemiology Centre (CAREC) countries. Most other countries in the tropical region of Central and South America continue to report declining influenza activity. With the exception of Nepal, Sri Lanka, and Cambodia, overall transmission continues to decline in most but not all parts of tropical South and Southeast Asia. Influenza virus isolates from sub-Saharan Africa are predominantly pandemic H1N1 virus but some seasonal H3N2 has been detected even in recent weeks. Unconfirmed media reports from the area indicate that disease activity has increased in recent weeks.
Since the new pandemic H1N1 2009 virus emerged, infections in different species of susceptible animals (pig, turkey, ferret, and cat) have been reported. Limited evidence suggests that these infections occurred following direct transmission of the virus from infected humans. These isolated events have had no impact on the dynamics of the pandemic, which is spreading readily via human-to-human transmission. As human infections become increasingly widespread, transmission of the virus from humans to other animals is likely to occur with greater frequency. Unless the epidemiology of the pandemic changes, these will continue to pose no special risks to human health.
*Countries in temperate regions are defined as those north of the Tropic of Cancer or south of the Tropic of Capricorn, while countries in tropical regions are defined as those between these two latitudes.
The qualitative indicators monitor: the global geographic spread of influenza, trends in acute respiratory diseases, the intensity of respiratory disease activity, and the impact of the pandemic on health-care services.
The maps below display information on the qualitative indicators reported. Information is available for approximately 60 countries each week. Implementation of this monitoring system is ongoing and completeness of reporting is expected to increase over time.
The countries and overseas territories/communities that have newly reported their first pandemic (H1N1) 2009 confirmed cases since the last web update (No.72): Congo.
The countries and overseas territories/communities that have newly reported their first deaths among pandemic (H1N1) 2009 confirmed cases since the last web update (No 72): Afghanistan, Croatia, Mongolia, Tanzania and Ukraine.
*Given that countries are no longer required to test and report individual cases, the number of cases reported actually understates the real number of cases.


Trend Ghana
Next
Profile Info
Full Name
Email
Phone
Brand
Brand Name
Brand Slogan (optional)
upload a song
Login Details
Username
Password
recovery email or phone (optional)


Medical emergency at Swansea Tesco supermarket sees large police and ambulance presence
The Air Ambulance was also deployed
by Liz Day, Lucy JohnEmergency services responded to a medical incident after a shopper was taken ill at a supermarket in Swansea .
The air ambulance and police were called to the incident at Tesco on Oystermouth Road at 11.50am on Saturday, November 16.
A spokeswoman for South Wales Police said officers managed traffic and pedestrians in the busy area while the air ambulance landed.
A spokesman for the Wales Ambulance Service said they received the call at 11.46am and sent an ambulance and rapid response vehicle.
He said the Wales Air Ambulance attended. No one was taken to Accident and Emergency.
A police car, police van and ambulance were seen in the supermarket car park.
Crews remained at the scene around 2.40pm - three hours after the initial call.


Accommodations that we offer:
Ramps up to resort buildings.
Elevators in resort buildings.
Boats to dump bodies with.
ATMs
Resort run shopping areas.
Where to next?
Index
Activities
Travel Arrangements
Pictures
Contact Info


A resource is data (images, audio, text, and so on) that a
program needs to access in a way that is independent of the
location of the program code. Java programs can use two mechanisms
to access resources: Applets use Applet.getCodeBase()
to get the base URL for the applet code and then extend the base
URL with a relative path to load the desired resource, for example
with Applet.getAudioClip(url)
. Applications use "well
known locations" such as
System.getProperty("user.home")
or
System.getProperty("java.home")
, then add
"/lib/resource", and open that file.
Methods in the classes Class
and
ClassLoader
provide a location-independent way to
locate resources. For example, they enable locating resources
for:
These methods do not provide specific support for locating localized resources. Localized resources are supported by the internationalization facilities.
A resource is identified by a string consisting of a sequence of
substrings, delimited by slashes (/), followed by a resource name.
Each substring must be a valid Java identifier. The resource name
is of the form shortName
or
shortName.extension
. Both
shortName
and extension
must be Java identifiers.
The name of a resource is independent of the Java implementation; in particular, the path separator is always a slash (/). However, the Java implementation controls the details of how the contents of the resource are mapped into a file, database, or other object containing the actual resource.
The interpretation of a resource name is relative to a class
loader instance. Methods implemented by the
ClassLoader
class do this interpretation.
A system resource is a resource that is either built-in to the
system, or kept by the host implementation in, for example, a local
file system. Programs access system resources through the
ClassLoader
methods getSystemResource
and
getSystemResourceAsStream
.
For example, in a particular implementation, locating a system
resource may involve searching the entries in the CLASSPATH. The
ClassLoader
methods search each directory, ZIP file,
or JAR file entry in the CLASSPATH for the resource file, and, if
found, returns either an InputStream
, or the resource
name. If not found, the methods return null. A resource may be
found in a different entry in the CLASSPATH than the location where
the class file was loaded.
The implementation of getResource
on a class loader
depends on the details of the ClassLoader
class. For
example, AppletClassLoader
:
All class loaders will search for a resource first as a system resource, in a manner analogous to searcing for class files. This search rule permits overwriting locally any resource. Clients should choose a resource name that will be unique (using the company or package name as a prefix, for instance).
A common convention for the name of a resource used by a class
is to use the fully qualified name of the package of the class, but
convert all periods (.) to slashes (/), and add a resource name of
the form name.extension
. To support this, and
to simplify handling the details of system classes (for which
getClassLoader
returns null), the class
Class
provides two convenience methods that call the
appropriate methods in ClassLoader
.
The resource name given to a Class
method may have
an initial starting "/" that identifies it as an "absolute" name.
Resource names that do not start with a "/" are "relative".
Absolute names are stripped of their starting "/" and are
passed, without any further modification, to the appropriate
ClassLoader
method to locate the resource. Relative
names are modified according to the convention described previously
and then are passed to a ClassLoader
method.
The Class
class implements several methods for
loading resources.
The method getResource()
returns a URL for the
resource. The URL (and its representation) is specific to the
implementation and the JVM (that is, the URL obtained in one
runtime instance may not work in another). Its protocol is usually
specific to the ClassLoader
loading the resource. If
the resource does not exist or is not visible due to security
considerations, the methods return null.
If the client code wants to read the contents of the resource as
an InputStream
, it can apply the
openStream()
method on the URL. This is common enough
to justify adding getResourceAsStream()
to
Class
and ClassLoader
.
getResourceAsStream()
the same as calling
getResource().openStream()
, except that
getResourceAsStream()
catches IO exceptions returns a
null InputStream
.
Client code can also request the contents of the resource as an
object by applying the java.net.URL.getContent()
method on the URL. This is useful when the resource contains the
data for an image, for instance. In the case of an image, the
result is an awt.image.ImageProducer
object, not an
Image
object.
The getResource
and
getResourceAsStream
methods find a resource with a
given name. They return null if they do not find a resource with
the specified name. The rules for searching for resources
associated with a given class are implemented by the class's
ClassLoader. The Class
methods delegate to
ClassLoader
methods, after applying a naming
convention: if the resource name starts with "/", it is used as is.
Otherwise, the name of the package is prepended, after converting
all periods (.) to slashes (/).
public InputStream getResourceAsStream(String name) { name = resolveName(name); ClassLoader cl = getClassLoader(); if (cl==null) { return ClassLoader.getSystemResourceAsStream(name); // A system class. } return cl.getResourceAsStream(name); } public java.net.URL getResource(String name) { name = resolveName(name); ClassLoader cl = getClassLoader(); if (cl==null) { return ClassLoader.getSystemResource(name); // A system class. } return cl.getResource(name); }
The resolveName
method adds a package name prefix
if the name is not absolute, and removes any leading "/" if the
name is absolute. It is possible, though uncommon, to have classes
in diffent packages sharing the same resource.
private String resolveName(String name) { if (name == null) { return name; } if (!name.startsWith("/")) { Class c = this; while (c.isArray()) { c = c.getComponentType(); } String baseName = c.getName(); int index = baseName.lastIndexOf('.'); if (index != -1) { name = baseName.substring(0, index).replace('.', '/') + "/" + name; } } else { name = name.substring(1); } return name; }
The ClassLoader
class has two sets of methods to
access resources. One set returns an InputStream
for
the resource. The other set returns a URL. The methods that return
an InputStream
are easier to use and will satisfy many
needs, while the methods that return URLs provide access to more
complex information, such as an Image and an AudioClip.
The ClassLoader
manges resources similarly to the
way it manages classes. A ClassLoader
controls how to
map the name of a resource to its content. ClassLoader
also provides methods for accessing system resources,
analogous to the system classes. The Class
class provides some convenience methods that delegate functionality
to the ClassLoader
methods.
Many Java programs will access these methods indirectly through
the I18N (localization) APIs. Others will access it through methods
in Class
. A few will directly invoke the
ClassLoader
methods.
The methods in ClassLoader
use the given String as
the name of the resource without applying any absolute/relative
transformation (see the methods in Class). The name should not have
a leading "/".
System resources are those that are handled by the host implemenation directly. For example, they may be located in the CLASSPATH.
The name of a resource is a "/"-separated sequence of
identifiers. The Class
class provides convenience
methods for accessing resources; the methods implement a convention
where the package name is prefixed to the short name of the
resource.
Resources can be accessed as an InputStream
, or a
URL.
The getSystemResourceAsStream
method returns an
InputStream for the specified system resource or null if it does
not find the resource. The resource name may be any system
resource.
The getSystemResource
method finds a system
resource with the specified name. It returns a URL to the resource
or null if it does not find the resource. Calling
java.net.URL.getContent()
with the URL will return an
object such as ImageProducer
, AudioClip
,
or InputStream
.
The getResourceAsStream
method returns an
InputStream
for the specified resource or null if it
does not find the resource.
The getResource
method finds a resource with the
specified name. It returns a URL to the resource or null if it does
not find the resource. Calling
java.net.URL.getContent()
with the URL will return an
object such as ImageProducer
, AudioClip
,
or InputStream
.
Since getResource()
provides access to information,
it must have well-defined and well-founded security rules. If
security considerations do not allow a resource to be visible in
some security context, the getResource()
method will
fail (return null) as if the resource were not present at all, this
addresses existence attacks.
Class loaders may not provide access to the contents of a .class file for both security and performance reasons. Whether it is possible to obtain a URL for a .class file depends on the specifics, as shown below.
There are no specified security issues or restrictions regarding
resources that are found by a non-system class loader.
AppletClassLoader
provides access to information that
is loaded from a source location, either individually, or in a
group through a JAR file; thus AppletClassLoader
should apply the same checkConnect()
rules when
dealing with URLs through getResource()
.
The system ClassLoader
provides access to
information in the CLASSPATH. A CLASSPATH may contain directories
and JAR files. Since a JAR file is created intentionally, it has a
different significance than a directory where things may end up in
a more casual manner. In particular, we are more strict on getting
information out of a directory than out from a JAR file.
If a resource is in a directory:
getResource()
invocations will use
File.exists()
to determine whether to make the
corresponding file visible to the user. Recall that
File.exists()
uses the checkRead()
method
in the security manager.getResourceAsStream()
.If the resource is in a JAR file:
getResource()
invocations will succeed for all
files, regardless of whether the invocation is done from within a
system or a non-system class.getResourceAsStream()
invocations will succeed for
non .class resources, and so will for
java.net.URL.getContent()
on corresponding URLs.This section provides two examples of client code. The first
example uses "absolute resource" names and traditional mechanisms
to get a Class
object.
package pkg; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; class Test { private static final String absName = "/pkg/mumble.baf"; public static void test1() { Class c=null; try { c = Class.forName("pkg.Test"); } catch (Exception ex) { // This should not happen. } InputStream s = c.getResourceAsStream(absName); // do something with it. } public void test2() { InputStream s = this.getClass().getResourceAsStream(absName); // do something with it. } }
This example uses "relative resource" names and the mechanism
available from the compiler through the -experimental
flag, to get a Class
object.
package pkg; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; class Test { private static final String relName = "mumble.baf"; public static void test1() { InputStream s = Test.class.getResourceAsStream(relName); // do something with it. } public void test2() { InputStream s = Test.class.getResourceAsStream(relName); // do something with it. }


Given search giant Google’s mapping expertise, perhaps the only thing surprising about its rumored carpooling business is that it didn’t launch one sooner. According to multiple reports, Google’s set to launch an app in Israel, RideWith, that lets drivers collect metered payment from passengers traveling in the same direction.
Find More!cola.js (A.K.A. "WebCoLa") is an open-source JavaScript library for arranging your HTML5 documents and diagrams using constraint-based optimization techniques.
This month we kicked off the next big phase of the project: testing our prototype vehicles on public streets. We’re still all about learning; now we want to know how the community perceives and interacts with these vehicles, and what operational challenges are unique to a fully self-driving vehicle. We’re continuing to test with our Lexus vehicles and we’ll gradually introduce more prototypes to the streets over the coming months
Predator -- the Invisible Eviscerator; the Brutalizer in the Brush -- creeps into Mortal Kombat X tomorrow, July 7th, for anyone who owns the $30 Kombat Pack as well as the full game. For everyone else, the Dreadlocked Destroyer will be available to buy as a standalone character on July 14th.
et set for a live-action version of Transformers, as the company behind giant Japanese robot Kuratas has accepted a duel challenge from upstart US challenger MegaBot.
Undergraduate in School of Software, Tsinghua Univ, Beijing, China
Tech enthusiast
Maroon 5 fan
Addicted to Web Dev, *nix guy
+86<PHONE_NUMBER>9


webgl archive
Seeing Sounds with Three.js
This is a tutorial series I have been writing, and very much a work in progress. The series provides an introduction the world of three.js through developing a music visualizer. The tutorials created and code used so far can be seen below: Contents Three.js Basics Get up to speed with...
Seeing Sounds with ThreeJS + WebGL [Intro]
Introduction If you imagine a film set, there's a guy pointing a camera at a scene of different props, and he can do so from different angles. It's all pretty similar in three.js, which is made up of objects that make coding 3D experiences much more natural to us. For...
Beginners guide to three.js: set your first scene
Introduction If you imagine a film set, there's a guy pointing a camera at a scene of different props, and he can do so from different angles. It's all pretty similar in three.js, which is made up of objects that make coding 3D experiences much more natural to us. For...
Seeing Sounds [Part 1]: Create the star field
This tutorial assumes you have a basic knowledge of three.js, and know how to set up a very simple scene using the three.js renderer and camera. If you don't, then first have a look at my getting started guide here. In this part, we're going to get more familiar with...Seeing Sounds [Part 2]: Creating the terrain
This is the second part of the Seeing Sounds three.js series. Part 1 looked at creating a flying star field, and in this part we'll create the terrain underneath it. At some point, we'll bring the two parts together, and then add some extra spheres that will animate with the...
Seeing sounds [Part 3]: Star field + Terrain
Previously, we learned how to create an animating star field in part 1 of the Seeing Sounds series with the outcome below: See the Pen Three.js - Star field by Graeme Fulton (@GraemeFulton) on CodePen. Then, in part 2, we learned how to create the following terrain: See the Pen Three.js...
Seeing sounds [Part 4]: Animating a terrain with three.js
Prerequisites This post assumes you have completed this previous tutorial, where we'd created both a 3D terrain, and an animating starfield, and combined them into a single three.js experience. The source code where we left off looks like this. Outcome Now, we'll look at how we can get the terrain animating so that from...
Create an infinitely open 3D world with three.js
Using three.js, there are different ways to create the effect of an 'infinite world' where a user can never reach the end due to it dynamically regenerating more terrain. This post looks at a couple alternative ways to create this effect, leading towards the goal of enabling a user to navigate...
You can't escape this world (an infinite three.js world)
This post will show a step by step overview of how to implement an infinite world in three.js using a method outlined in a previous post. This is just a high level summary using YouTube videos, I'll go into the code in another post. 1. Start off with three tiles First, create three tiles...
Code an infinite 3D world with three.js [Part 1]
Intro This tutorial will show you how to create an infinite terrain that can be used in combination with a Chase Camera. If you try the Chase Camera demo, the concept created in this tutorial is the creation of new terrain when the object reaches the edge of the existing terrain. Outcome...
Code an infinite 3D world with three.js [Part 2]
Part 1 of this tutorial left off with just one column of tiles, and the ability to move along the Z axis infinitely. Here, we're going to build the full grid, and enable the same infinite movement across the X axis. Step 1: Build up a grid Just by changing the X...
First person navigation with threeJS
This tutorial will show you how to navigate through a 3D environment using your keyboard's arrows, much like a first person shooter game such as Doom (or Halo these days). To achieve this, you'll need three things: A surface to navigate along - use planeGeometry or follow this guide to set up a...


---
title: kume
short_title: kume
description: A visualization demonstrating how k-means clustering is used to determine dominant colors in photos and segment images using color quantization.
Source, Live
short_description: Visualizing image segmentation with k-means clustering
permalink: /projects/kume/
web_link: /kume
tags: [js, d3]
date: Jan 2018
---


Messages
knockout.collection
Github
Raw Data
Id
From
Content
Rendered at
Filtered
Sender:
Id
From
Content
Rendered at
Mapped


Top Level Namespace
Defined in:
Method Summary
-
parse_lines(file : String, num_lines : Number) : Array(String)
Parses each line of log file searching for potential hacker IP's
Method Detail
def parse_lines(file : String, num_lines : Number) : Array(String)
#
Parses each line of log file searching for potential hacker IP's
parse_lines "/var/log/auth.log", 100
Above produces a result similar to:
["<IP_ADDRESS>",
"<IP_ADDRESS>",
"<IP_ADDRESS>",
"<IP_ADDRESS>",
"<IP_ADDRESS>"]


{# LEGAL INDEX /templates/legal/index.html niceworld 8.24.18 #} {% extends "_layouts/site" %} {% set pageName = 'Cookie Policy' %} {% block head %} {% set title = "Cookie Policy" %} {{ parent() }} {% endblock %} {% block main %}
Last updated October 31, 2018
This Cookie Policy explains how Vivayic ("Company", "we", "us", and "our") uses cookies and similar technologies to recognize you when you visit our websites at www.vivayic.com, ("Websites"). It explains what these technologies are and why we use them, as well as your rights to control our use of them.
In some cases we may use cookies to collect personal information, or that becomes personal information if we combine it with other information. In such cases our Privacy Policy (www.vivayic.com/privacy) will apply in addition to this Cookie Policy.
What are cookies?
Cookies are small data files that are placed on your computer or mobile device when you visit a website. Cookies are widely used by website owners in order to make their websites work, or to work more efficiently, as well as to provide reporting information.
Cookies set by the website owner (in this case, Vivayic) are called "first party cookies". Cookies set by parties other than the website owner are called "third party cookies". Third party cookies enable third party features or functionality to be provided on or through the website (e.g. like advertising, interactive content and analytics). The parties that set these third party cookies can recognize your computer both when it visits the website in question and also when it visits certain other websites.
Why do we use cookies?
We use first and third party cookies for several reasons. Some cookies are required for technical reasons in order for our Websites to operate, and we refer to these as "essential" or "strictly necessary" cookies. Other cookies also enable us to track and target the interests of our users to enhance the experience on our Online Properties. Third parties serve cookies through our Websites for advertising, analytics and other purposes. This is described in more detail below.
The specific types of first and third party cookies served through our Websites and the purposes they perform are described below (please note that the specific cookies served may vary depending on the specific Online Properties you visit):
Essential website cookies:
These cookies are strictly necessary to provide you with services available through our Websites and to use some of its features, such as access to secure areas.
■ Who serves these cookies:
• Cookie provider: Craft CMS
Website URL: Craftcms.org
■ How to refuse: Because these cookies are strictly necessary to deliver the Websites to you, you cannot refuse them. You can block or delete them by changing your browser settings however, as described below under the heading "How can I control cookies?".
Performance and functionality cookies:
These cookies are used to enhance the performance and functionality of our Websites but are non-essential to their use. However, without these cookies, certain functionality (like videos) may become unavailable.
■ Who serves these cookies:
• Cookie provider: Craft CMS
Website URL: craftcms.com
■ How to refuse: To refuse these cookies, please follow the instructions below under the heading "How can I control cookies?". Alternatively, please visit the relevant opt-out link below:
• Cookie provider: Craft CMS
Opt-out Link: craftcms.com
Analytics and customization cookies:
These cookies collect information that is used either in aggregate form to help us understand how our Website are being used or how effective our marketing campaigns are, or to help us customize our Websites for you.
■ Who serves these cookies:
• Cookie provider: Google Analytics
Website URL: google.com
■ How to refuse: To refuse these cookies, please follow the instructions below under the heading "How can I control cookies?". Alternatively, please visit the relevant opt-out link below:
• Cookie provider: Google Analytics
Opt-out Link: google.com
What about other tracking technologies, like web beacons?
Cookies are not the only way to recognize or track visitors to a website. We may use other, similar technologies from time to time, like web beacons (sometimes called "tracking pixels" or "clear gifs"). These are tiny graphics files that contain a unique identifier that enable us to recognize when someone has visited our Websites or opened an e-mail that we have sent them. This allows us, for example, to monitor the traffic patterns of users from one page within our Websites to another, to deliver or communicate with cookies, to understand whether you have come to our Websites from an online advertisement displayed on a third-party website, to improve site performance, and to measure the success of e-mail marketing campaigns. In many instances, these technologies are reliant on cookies to function properly, and so declining cookies will impair their functioning.
How can I control cookies?
You can set or amend your web browser controls to accept or refuse cookies. If you choose to reject cookies, you may still use our website though your access to some functionality and areas of our website may be restricted. As the means by which you can refuse cookies through your web browser controls vary from browser-to-browser, you should visit your browser's help menu for more information.
In addition, most advertising networks offer you a way to opt out of targeted advertising. If you would like to find out more information, please visit http://www.aboutads.info/choices/ or http://www.youronlinechoices.com.
How often will you update this Cookie Policy?
We may update this Cookie Policy from time to time in order to reflect, for example, changes to the cookies we use or for other operational, legal or regulatory reasons. Please therefore re-visit this Cookie Policy regularly to stay informed about our use of cookies and related technologies.
The date at the top of this Cookie Policy indicates when it was last updated.
Where can I get further information?
If you have any questions about our use of cookies or other technologies, please email us at<EMAIL_ADDRESS>or by post to:
Vivayic
600 Blue Sage Blvd
Lincoln, NE 68521
United States
Phone:<PHONE_NUMBER>


Struct Position
Represents the position of an object in the world. A position consists of its x, y and z values in millimeters.
Implements
Namespace: Anki.Vector.Types
Assembly: Anki.Vector.dll
Syntax
public struct Position : IEquatable<Position>
Constructors
| Improve this Doc View SourcePosition(Single, Single, Single)
Initializes a new instance of the Position struct.
public Position(float x, float y, float z)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | x | The x position in millimeters. |
| Single | y | The y position in millimeters. |
| Single | z | The z position in millimeters. |
Properties
| Improve this Doc View SourceX
Gets the x position in millimeters
public float X { get; }
Property Type
| Single |
Y
Gets the y position in millimeters
public float Y { get; }
Property Type
| Single |
Z
Gets the z position in millimeters
public float Z { get; }
Property Type
| Single |
Methods
| Improve this Doc View SourceEquals(Position)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Position other)
Parameters
| Type | Name | Description |
|---|---|---|
| Position | other | An object to compare with this object. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the current object is equal to the |
Equals(Object)
Determines whether the specified Object, is equal to this instance.
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj | The Object to compare with this instance. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Overrides
| Improve this Doc View SourceGetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
| Improve this Doc View SourceToString()
Converts to string.
public override string ToString()
Returns
| Type | Description |
|---|---|
| String | A String that represents this instance. |
Overrides
Operators
| Improve this Doc View SourceEquality(Position, Position)
Implements the operator ==.
public static bool operator ==(Position lhs, Position rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| Position | lhs | The LHS. |
| Position | rhs | The RHS. |
Returns
| Type | Description |
|---|---|
| Boolean | The result of the operator. |
Inequality(Position, Position)
Implements the operator !=.
public static bool operator !=(Position lhs, Position rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| Position | lhs | The LHS. |
| Position | rhs | The RHS. |
Returns
| Type | Description |
|---|---|
| Boolean | The result of the operator. |


{% include 'header.html' %}
Checking query status, retrieving query result. Query needs 1 - 2 min(s). If the server is busy, it takes more time.


Compile
Save
Reboot
Emscripten API
Download and display a file
Call a function after a delay
Run a script
Header Libraries
Boost.Format
Range v3 comprehensions
HTML Integration
Custom console
Counter: C++ and JS calling into each other
Canvas: bouncing lines
WebGL: flying bunnies
clang-format:
Reboot
Run
Reboot


App Engine Python SDK
v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
google
appengine
ext
ndb
model
ModelAttribute
List of all members
google.appengine.ext.ndb.model.ModelAttribute Class Reference
Inheritance diagram for google.appengine.ext.ndb.model.ModelAttribute:
Detailed Description
A Base class signifying the presence of a _fix_up() method.
The documentation for this class was generated from the following file:
code/googleappengine-read-only/python/google/appengine/ext/ndb/model.py
Maintained by
tzmartin


|
SuperLU 6.0.0
|
Example #1 showing how to use ILU to precondition GMRES. More...
Functions | |
| void | cpsolve (int n, complex x[], complex y[]) |
| Performs cgsisx with original matrix A. More... | |
| void | cmatvec_mult (complex alpha, complex x[], complex beta, complex y[]) |
| Performs matrix-vector multipliation sp_cgemv with original matrix A. More... | |
| int | main (int argc, char *argv[]) |
Variables | |
| superlu_options_t * | GLOBAL_OPTIONS |
| float * | GLOBAL_R |
| float * | GLOBAL_C |
| int * | GLOBAL_PERM_C |
| int * | GLOBAL_PERM_R |
| SuperMatrix * | GLOBAL_A |
| SuperMatrix * | GLOBAL_L |
| SuperMatrix * | GLOBAL_U |
| SuperLUStat_t * | GLOBAL_STAT |
| mem_usage_t * | GLOBAL_MEM_USAGE |
This example shows that ILU is computed from the equilibrated matrix, and the preconditioned GMRES is applied to the equilibrated system. The driver routine CGSISX is called twice to perform factorization and apply preconditioner separately.
Note that CGSISX performs the following factorization: Pr*Dr*A*Dc*Pc^T ~= LU with Pr being obtained from MC64 statically then partial pivoting dynamically. On return, A is overwritten as A1 = Dr*A*Dc.
We can solve the transformed system, A1*y = Dr*B, using FGMRES. B is first overwritten as Dr*B. Then GMRES step requires requires 2 procedures: 1) Apply preconditioner M^{-1} = Pc^T*U^{-1}*L^{-1}*Pr 2) Matrix-vector multiplication: w = A1*v
The operations is y := alpha*A*x + beta*y. See documentation of sp_cgemv for further details.
| [in] | alpha | Scalar factor for A*x |
| [in] | x | Vector to multiply with A |
| [in] | beta | Scalar factor for y |
| [in,out] | y | Vector to add to to matrix-vector multiplication and storage for result. |
See documentation of cgsisx for more details.
| [in] | n | Dimension of matrices |
| [out] | x | Solution |
| [in,out] | y | Right-hand side |
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
| SuperMatrix* GLOBAL_A |
| float * GLOBAL_C |
| SuperMatrix * GLOBAL_L |
| mem_usage_t* GLOBAL_MEM_USAGE |
| superlu_options_t* GLOBAL_OPTIONS |
| int* GLOBAL_PERM_C |
| int * GLOBAL_PERM_R |
| float* GLOBAL_R |
| SuperLUStat_t* GLOBAL_STAT |
| SuperMatrix * GLOBAL_U |


For logging debug information to files.
local Logger = require('__stdlib__/stdlib/misc/logger')
-- or to create a new logger directly:
local Log = require('__stdlib__/stdlib/misc/logger').new()
-- log files are saved to script-output/modname/log.log by default
| Log.log(msg) | Logs a message. |
| Log.write() | Writes out all buffered messages immediately. |
| get(...) | Get a saved log or create a new one if there is no saved log. |
| new([log_name='log'][, debug_mode=false][, options={...}]) | Creates a new logger object. |
| Log.options | Used in the new function for logging game ticks, specifying logfile extension, or forcing the logs to append to the end of the logfile. |
Logs a message.
Parameters:
Writes out all buffered messages immediately.
Returns:
Get a saved log or create a new one if there is no saved log.
Parameters:
Creates a new logger object.
In debug mode, the logger writes to file immediately, otherwise the logger buffers the lines.
The logger flushes the logged messages every 60 seconds since the last message.
A table of options may be specified when creating a logger.
Parameters:Log = Logger.new()
Log("this msg will be logged in /script-output/YourModName/log.log!")
-- Immediately Write everything buffered in the log file
Log()
Log = Logger.new('test', true)
Log("this msg will be logged and written immediately in /script-output/YourModName/test.log!")
Log = Logger.new('cool_mod_name', 'test', true, { file_extension = data })
Log("this msg will be logged and written immediately in /script-output/YourModName/test.data!")
Used in the new function for logging game ticks, specifying logfile extension, or forcing the logs to append to the end of the logfile.
Fields:


{{tweet.user.name}}
posted at
replied to @{{tweet.in_reply_to_screen_name}}
at
{{tweet.created_at | date:'short'}}
{{tweet.text}}


BREAKING Labour general election manifesto agreed 'unanimously' after six-hour party meeting
Jeremy Corbyn claimed there was unanimous agreement on the document despite a lengthy meeting and splits beforehand on key issues - including freedom of movement after Brexit
by Dan Bloom, https://www.facebook.com/mirrordanbloomLabour's general election manifesto was signed off "unanimously" tonight after a meeting of party chiefs lasting more than six hours.
The "transformative" document is set to promise nationalised mail, rail, water, energy and broadband, free NHS prescriptions and six years' free adult education in England, and a £10 minimum wage for all over 16.
But unions and some of Labour's front bench were split before the Clause V meeting over key issues - including immigration.
Moments after the meeting tonight it was still unclear what agreement had been reached on freedom of movement after Brexit .
A row had also been raging over the exact terms of Labour's Green New Deal, union sources said.
The full manifesto will only be published on Thursday at its launch after being leaked in full to the Mirror in 2017.
Jeremy Corbyn said as the meeting ended: “We’ve just had a very extensive meeting of our party’s national executive, Shadow Cabinet and other people as well.
“And we’ve reached unanimous agreement on the contents of our manifesto which will be published next week.
“That manifesto is a transformative document that will change the lives of the people of this country for the better.
“It will be a once-in a generation opportunity to vote for a more egalitarian society that cares for all and I’m very proud of the contents of it and I can’t wait to take those contents and it’s promise of a better Britain to everyone all around this country during our election campaign.”
This breaking news story is being updated.


Western Washington University
Name: Van Komen, Wesley, Awesomesauce ID: W01777777 Previous ID: Subj Crse CRN Course Title Cdt Grd Qpts Gmod Gr Date Rpt Attr ---- ----- ----- ------------------------------ --- --- ----- ---- -------- ---- ---- 201410 Cls: Sr Coll: 00 Res: R Fac Actn: Amazing Standing Site: Prg1: IN Prg2: Mjr: AWSM ACCT 240 14153 Financial Accounting 4 C 16 L 03/25/14 OL DSCI 205 10603 Business Statistics 4 C 13.2 L 03/24/14 MIS 222 10603 Awesome Class II 4 B 13.2 L 03/24/14 ECON 280 10603 Business Winning 6 4 K 13.2 L 03/24/14 Quarter: Credits: 12.0 Qpts: 42.40 GPA: 3.50 201420 Cls: Sr Coll: BU Res: R Fac Actn: Super Duper Standing Site: Prg1: PM-BU Prg2: Mjr: AWSM ACCT 220 14153 Financial Accounting for Magicians 4 A 16 L 06/17/14 DSCI 225 10603 Business Quantum Mechanics 4 A 14.8 L 06/16/14 SSC Quarter: Credits: 8.0 Qpts: 30.80 GPA: 3.50 Total GPA: 3.50 Academic Summary To Date 1. Spokane Falls Cmty College (2) Credits: 105 Degree: AA Total Transfer -----------Western--------------- Crdts Crdts Crdts Hours Qpnts GPA Undergraduate 227.00 105.00 122.00 122.00 397.40 3.25 Degrees and Certificates: Internal Coding: ------------------------- -------------- Status: Pending PN Graduation Term: Fall 2017 201740 Type: Bachelor of Science BS College: College Science & Engineering SE Program: BS-Science & Engineering BS-SE Major/Field: Computer Science (catalog term: Fall 2016) NC01 Curriculum: Internal Coding: -------------- ------------- Status: Active AS Term: Fall 2017 201740 College: College Science & Engineering SE Program: BS-Science & Engineering BS-SE Major/Field: Computer Science (catalog term: Winter 2017) NC01


‘Ole wanted to keep me’ – ex-Man United man reveals club went AGAINST Solskjaer’s wishes during summer transfer window
by Lorenzo MartínRomelu Lukaku has revealed that Manchester United manager Ole Gunnar Solskjaer wanted to keep the Belgian forward at Old Trafford this summer.
Lukaku joined Inter Milan during the summer transfer window, with the Belgian international impressing fans and critics alike with his performances for Antonio Conte’s side since.
The ex-Red Devils man has bagged an impressive nine goals in 12 Serie A outings since his arrival at the San Siro, helping Inter keep up with Juventus in the race for the Scudetto.
However, it seems things could’ve gone a lot differently for Lukaku, and United, had Solskjaer got his way in regards to the player’s future this summer.
According to Goal, when speaking about his departure from United, Lukaku revealed “Solskjaer has my eternal respect. He understood me when I said in March that it was time for me to leave England. I have been in the Premier League as an 18-year-old boy and now I am 26. Solskjaer wanted to keep me, but I was ready for something new.”
Given their record in front of goal so far this year, United could’ve done with Lukaku in their squad this season.
Solskjaer only really has Martial and Rashford to choose from at striker this term, options that have left both him and United shorthanded when it comes to attacking options.
It’ll be interesting to see how for Lukaku can go whilst with Inter, and whether he can guide his new side to their first Serie A title in what seems like forever with his goals this term.


str_replace & Fatal error - Only variables can be passed by reference
str_replace & Fatal error: Only variables can be passed by reference
UPDATE 4/3/2012:
A commenter pointed out that str_replace wasn’t properly limiting replacements via the count param. After looking around it seems that \$count no longer limits replacements (I’m honestly wondering if it ever did…) and rather returns a number of replacements performed. For any users experiencing this I’d recommend using preg_replace as it effectively supports limiting replacements.
preg_replace('/findit/i','replaceit',$haystack,1);
I could have sworn this func worked using the \$count as a limit in the past…
If you’re using a simple str_replace() call in PHP and getting a strange Fatal error that doesn’t make a whole lot of sense to you I have a hunch as to why.
Fatal example:
$file_name = str_replace('findit', 'replaceit', $haystack, 1);
In PHP 5.0.5 some changes were made to how PHP handles variables, functions, and references. This broke a lot of older code but also introduced some vague and questionable fatal errors. They meant well by doing this by essentially requiring parameters be passed via reference. I’m assuming this was to prevent PHP from copying large pieces of data to work on them and thus helping memory performance overall. Luckily there is a simple fix, just declare your variable to be passed inline.
Working example:
$file_name = str_replace('findit', 'replaceit', $haystack, $count = 1);
Note: if you’re working with a large data set in a loop I would highly recommend setting the reference outside of the loop and avoid this inline method.


I finally decided to upgrade my work computer and build a new one! After spending loads of time reading and comparing (mostly using pcpartpicker until I landed on the following parts, which I bought from komplett:
My aim was to build a completely upgradable improvement to my current machine - a windows computer with 32GB of RAM, a i7-3770 quad-core processor and a 1TB harddrive that will continue to be used.
Being my first build, I made a blunder. I covered the processor and motherboard with thermal paste!! Note to self, with this cooler it is easier to attach it to its braces and then the braces to the motherboard! Aside from that, just a few plugs not in the right place.
After working out how to attach the cooler and changing a couple of plugs, I am happy to say the new machine is running perfectly. It is extremely fast and I am looking forward to taking full advantage of its six cores!!! Here are some photos of the final build:
A quick note, almost two years later. I broke the motherboard (in transit I think), and got a replacement through warranty (thank you komplett!). This computer has worked amazingly and helped me out with some really interesting work at UCD. The photos below are of the re-build with the replacement motherboard. The case is a little dusty! 😅


LN Function
Returns the natural logarithm of the input parameter. Synonym of the DLOG1 function.
Synonym of DLOG1 Function.
Syntax
LN(expression)
Argument
- expression
-
The target column or expression that the function operates on.
Note
This function returns an error for some data types if the expression references an Amazon Redshift user-created table or an Amazon Redshift STL or STV system table.
Expressions with the following data types produce an error if they reference a user-created or system table. Expressions with these data types run exclusively on the leader node:
-
BOOLEAN
-
CHAR
-
DATE
-
DECIMAL or NUMERIC
-
TIMESTAMP
-
VARCHAR
Expressions with the following data types run successfully on user-created tables and STL or STV system tables:
-
BIGINT
-
DOUBLE PRECISION
-
INTEGER
-
REAL
-
SMALLINT
-
Return Type
The LN function returns the same type as the expression.
Example
The following example returns the natural logarithm, or base e logarithm, of the number 2.718281828:
select ln(2.718281828); ln -------------------- 0.9999999998311267 (1 row)
Note that the answer is nearly equal to 1.
This example returns the natural logarithm of the values in the USERID column in the USERS table:
select username, ln(userid) from users order by userid limit 10; username | ln ----------+------------------- JSG99FHE | 0 PGL08LJI | 0.693147180559945 IFT66TXU | 1.09861228866811 XDZ38RDD | 1.38629436111989 AEB55QTM | 1.6094379124341 NDQ15VBM | 1.79175946922805 OWY35QYB | 1.94591014905531 AZG78YIP | 2.07944154167984 MSD36KVR | 2.19722457733622 WKW41AIW | 2.30258509299405 (10 rows)


{% load staticfiles %}
January
February
March
April
May
June
July
August
September
October
November
December
Choose Year


Features
- Add Exercise data
- Create workout plan
- Add exercises to workouts
- Update workouts and exercises
Technologies
- Javascript
- JQuery
- CSS
- Node
- Express
- Mongo
- Mongoose
- Handlebars
Features
- User Authentication
- Plant search API
- Add plants to List
- Full CRUD functionality for plants in list
- Get reminders when watering is due
- Upload and delete photos
- Set privacy setting and share/view community photos
- Invite users to have limited access to view and set plants as woatered
- Send email invitation with private link with Authentication url
- Revoke limited user access
Technologies
- HTML
- CSS
- Javascript
- JQuery
- CSS
- Node
- Express
- MySQL
- Sequelize
- Handlebars
- Foundation CSS
- Nodemailer
- Bcrypt
- Toastify JS
- Cloudinary
Features
- Add burgers to bucket list
- Move to eaten list
- Delete from list
Technologies
- HTML
- CSS
- Javascript
- JQuery
- CSS
- Node
- Express
- Handlebars
Features
- View calendar by day, week, or month.
- Add custom categorized events.
- View and add suggested activities by type.
- View and cycle through inspirational quotes.
Technologies
- HTML
- CSS
- Javascript
- JQuery
- Materialize CSS
Features
- User can select what type of characters to include in password
- User can select length of password
- User can view settings
- User is provided with select password link
- User can manually customize password
Features
- View a series of Monty Python themed multiple choice questions
- Quiz is timed allowing a total of 10 seconds per question
- User is presented with a timer indicator that starts as green and fades to red
- Timer indicator flashes green on correct response and red on incorrect
- Users' time has 10 seconds deducted on incorrect responses
- Quiz ends at 0 seconds or all questions answered
- Users' top 10 high scores are saved in local storage.
Features
- User presented with current location, based on IP, on page load
- Search any city on earth(some small cities not included)
- Search by city adding state and/or country code
- List of possible results if search by city alone yields more than one response
- Searches are saved in a clickable list
- User can see current weather details.
- User can see 5 day forecast details.
- Background changes based on weather description.
- UV warnings color-coded by severity.
Technologies
- HTML
- CSS
- Javascript
- JQuery
Features
- Admin users can create recipes
- Admin users can upload photos
- Admin users can link suggested equipment
- Users can create accounts
- Recipes can have multiple ingredients sources with links, amounts, and prices
- Users can view price per serving for each recipe
- Users can view total cart price to purchase ingredients
- Users can alter recipe yield, which alters purchase amounts
- Users can view related recipes by similar ingredients
- Users can search by ingredient, method, or style
- Users can rate recipes
- Users can leave comments
- Users can follow links to buy directly online
Technologies
- HTML
- CSS
- Javascript
- Material Design
- C#
- .NET
- MSSQL
Features
- Users can see chart of global land surface average temp by month
- Users can see specific month data
Technologies
- HTML
- CSS
- Javascript
- JQuery
- D3
Features
- Users can see chart of global land surface average temp by month
- Users can see specific month data
Technologies
- HTML
- CSS
- Javascript
- JQuery
- D3
Features
- Visitors can view basic business information
- Visitors can view inventory and photos
- Users can add customer info
- Users can add vehicle info
- Users can upload photos
- Users can add repair orders
- Users can print receipts for work
- Users can add consignment info and print contract
- Users can add vehicle sale info and print contracts and forms
- Users can track post-sale process through payoff, taxes, licensing, and viewing profit
- Users can view monthly sales and tax reports
- Users can generate salesman commission documents
- Users can track customer leads and search inventory with ranked results
Technologies
- HTML
- CSS
- Javascript
- JQuery
- Bootstrap
- .NET
- C#
- MSSQL
Features
- Users can view world state contiguity map
- Users can click and drag stretchy border connections and rearrange chart
Technologies
- HTML
- CSS
- Javascript
- JQuery
- D3
Features
- Admin users can create custom professional therapist categories
- Admin users can review and approve professional therapist applicants
- Users can apply to put detailed listing on site
- Users can pay for service with monthly online billing
- Users can upload photos
- Users can set availability
- Visitors can search for therapists by custom criteria
- Visitors can see lists of users ranked by relevant searches
- Visitors can search by distance from desired location
Technologies
- HTML
- CSS
- Javascript
- JQuery
- Material Design
- .NET
- C#
- MSSQL
Features
- Users can add, sort, and link to inventory
- Users can upload photos
- Visitors can browse inventory and follow links to 3rd party websites to purchase
Technologies
- HTML
- CSS
- Javascript
- JQuery
- .NET
- C#
- MSSQL
Features
- Visitors can view professional services
Technologies
- HTML
- CSS
- Javascript
- JQuery
- Mongo
- Express
- React
- Node
Features
- Users can create custom polls
- Users can add responses to polls
- Users can respond to polls
- Users can tweet polls
- Users can view chart of poll responses
Technologies
- HTML
- CSS
- Javascript
- Mongo
- Express
- Node
- Handlebars
- Material Design
Features
- Users can add multiple stock symbols
- Users can view stock history chart
Technologies
- HTML
- CSS
- Javascript
- JQuery
- D3


The only limit to a creative mind, is the lack of tools, we ARE the tool. Our hacking bootcamp is designed to immerse you into the "hacker mindset", to analyze, interpret and respond as offensive security professionals. To achieve this immersion, we decided to move away from the city, to live and breathe cybersecurity 24x7, this is why, you will be living with other aspirant minds in a quaint and peacful town away from the city. The bootcamp is designed as a full-time residential program, where collaborative learning is encouraged. True learning is when you live, eat, and breathe the stuff, when your immersion is beyond the classroom, where the environment resonates with the same intensity as your desire to learn. This is what we hope to achieve with this bootcamp!
NomadGao is a quaint little Co-working + Co-living space in a beautiful village called Assagao, North Goa. The space is equipped with all the necessary amenities required by a remote worker. The Co-living area where the students will be hosted for the entire duration of 3 months offers a clean and comfortable accomodation options.
Hacker Wagon combines traditional course materials with hands-on simulations, using a virtual lab environment. We cover the following in details.
Hacker Wagon - A 3 month intensive residential bootcampin a beautiful small town - Shared living encourages collaborative learning. - Accomodation, Food and Transportation covered. - Conducted in association with beautiful Co-working spaces. - Hands-on training & Workshops. - Bug bounties for you to develop a portfolio.
Employment of security analysts is projected to grow 32 percent over the next ten years, much faster than the average for all occupations. Demand for information security analysts is expected to be very high, as these analysts will be needed to create innovative solutions to prevent hackers from stealing critical information or disrupting computer networks. The increasing adoption of cloud services by small and medium-sized businesses and a rise in cybersecurity threats will create demand for managed security services providers in this industry. Following the completion of the course the students can start their careers by getting hired with banks, Healthcare, Govt institutions, Telecom and other major corporations. They can also have a career as bounty hunter and be self employed.


First, you'll need to have a list of all the people that will be a part of this Gift Exchange! You'll need each person's name, email, and a short gift list. If you don't have all that, go get it!
...
So, here's how this works. Using the add and edit tabs on the right, fill in each person's information.
Next, in the option tab, figure out the settings you want in this gift exchange.
Finally, write a custom message for the participants in the gift exchange! This will be included after a greeting.
To look at how your gift exchange email will appear, press PREVIEW. Once you are done, press SUBMIT to send out your gift exchange!
| Approx. Gift Cost: | $ |
| Allow Excluding (requires 6 or more people): | |
| Should this be secret?: |


{% extends 'base.html' %} {% load i18n %} {% load url from future %} {% block title %} {% trans 'Reset password mail sent' %} {% endblock title %} {% block content %}
{% trans 'Success. Check your inbox' %}.
{% blocktrans %} Thanks for verifying your email address. A message has been sent to the address you supplied with further instructions. {% endblocktrans %}
{% endblock content %}


--- layout: post title: East Van Love published: true ---
Thank you for the love Vancouver.
(ballpoint pen on boarded windows at The Bay)


 They are spoken by Iris, whose terse account of her sister Laura's death in 1945 is followed by an inquest report proclaiming the death accidental. But just as the reader expects to settle into Laura's story, Atwood introduces a novel-within-a- novel. Entitled The Blind Assassin, it is a science fiction story told by two unnamed lovers who meet in dingy backstreet rooms. When we return to Iris, it is through a 1947 newspaper article announcing the discovery of a sailboat carrying the dead body of her husband, a distinguished industrialist.
 The bridge was being repaired: she went right through the Danger sign. The car fell a hundred feet into the ravine, smashing through the treetops feathery with new leaves, then burst into flames and rolled down into the shallow creek at the bottom. Chunks of the bridge fell on top of it. Nothing much was left of her but charred smithereens.


Relative, Absolute and Fixed.
Static
To begin, all elements default to the static position.
Static means things are positioned in their normal order on the webpage to the left of the screen.
Relative
Relative is a more malleable alternative to static.
Relative elements begin in their static position, the difference, however, is that they can be adjusted using helper properties.
i.e. left: 200px;
top: 100px
This would move the element 200px from the left/to the right
and 100px from the top/downwards.
Here is a example of a blue square that is in the relative position with no helper properties.
Now we add the helper properties.
Absolute
Absolute is similar to relative. the key difference is that instead of being relative to its static position, it is relative to its parent element. If left unchanged it will sit in the top-left of its parent element.
Here is a example of a red square that is in the absolute position with no helper properties.
Now we add a helper property to shift it to the right.
Fixed
Fixed elements are relative to the html document, not any other parent elements. the key thing to note with position: fixed; is that scrolling doesn't affect the position of the element in the viewport. The element will always stay on the screen.
An example of a fixed element is the menu in the top right corner of this page. I realised that you can clearly see this on your screen AFTER I went to the effort of making this gif. Good one Andy...


exclusive
option (AMD)
×
This page uses the AMD build in the dist
directory, not the files in
src
. In other words, run the grunt
command first to build a current version.
Click to select, Ctrl/⌘ click to focus.
Any number of items can be selected. Of the selected items, one can be in focus.


- authors
- Jason Lowe-Power
Action code blocks
The next section of the state machine file is the action blocks. The action blocks are executed during a transition from one state to another, and are called by the transition code blocks (which we will discuss in the next section <MSI-transitions-section>). Actions are single action blocks. Some examples are “send a message to the directory” and “pop the head of the buffer”. Each action should be small and only perform a single action.
The first action we will implement is an action to send a GetS request
to the directory. We need to send a GetS request to the directory
whenever we want to read some data that is not in the Modified or Shared
states in our cache. As previously mentioned, there are three variables
that are automatically populated inside the action block (like the
in_msg
in peek
blocks). address
is the address that was passed
into the trigger
function, cache_entry
is the cache entry passed
into the trigger
function, and tbe
is the TBE passed into the
trigger
function.
``` {.sourceCode .c++} action(sendGetS, ‘gS’, desc=”Send GetS to the directory”) { enqueue(request_out, RequestMsg, 1) { out_msg.addr := address; out_msg.Type := CoherenceRequestType:GetS; out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory)); // See mem/protocol/RubySlicc_Exports.sm for possible sizes. out_msg.MessageSize := MessageSizeType:Control; // Set that the requestor is this machine so we get the response. out_msg.Requestor := machineID; } }
When specifying the action block, there are two parameters: a
description and a "shorthand". These two parameters are used in the HTML
table generation. The shorthand shows up in the transition cell, so it
should be as short as possible. SLICC provides a special syntax to allow
for bold (''), superscript ('\^'), and spaces ('\_') in the shorthand to
help keep them short. Second, the description also shows up in the HTML
table when you click on a particular action. The description can be
longer and help explain what the action does.
Next, in this action we are going to send a message to the directory on
the `request_out` port as declared above the `in_port` blocks. The
`enqueue` function is similar to the `peek` function since it requires a
code block. `enqueue`, however, has the special variable `out_msg`. In
the `enqueue` block, you can modify the `out_msg` with the current data.
The `enqueue` block takes three parameters, the message buffer to send
the message, the type of the message, and a latency. This latency (1
cycle in the example above and throughout this cache controller) is the
*cache latency*. This is where you specify the latency of accessing the
cache, in this case for a miss. Below we will see that specifying the
latency for a hit is similar.
Inside the `enqueue` block is where the message data is populated. For
the address of the request, we can use the automatically populated
`address` variable. We are sending a GetS message, so we use that
message type. Next, we need to specify the destination of the message.
For this, we use the `mapAddressToMachine` function that takes the
address and the machine type we are sending to. This will look up in the
correct `MachineID` based on the address. We call `Destination.add`
because `Destination` is a `NetDest` object, or a bitmap of all
`MachineID`.
Finally, we need to specify the message size (from
`mem/protocol/RubySlicc_Exports.sm`) and set ourselves as the requestor.
By setting this `machineID` as the requestor, it will allow the
directory to respond to this cache or forward it to another cache to
respond to this request.
Similarly, we can create actions for sending other get and put requests.
Note that get requests represent requests for data and put requests
represent requests where we downgrading or evicting our copy of the
data.
``` {.sourceCode .c++}
action(sendGetM, "gM", desc="Send GetM to the directory") {
enqueue(request_out, RequestMsg, 1) {
out_msg.addr := address;
out_msg.Type := CoherenceRequestType:GetM;
out_msg.Destination.add(mapAddressToMachine(address,
MachineType:Directory));
out_msg.MessageSize := MessageSizeType:Control;
out_msg.Requestor := machineID;
}
}
action(sendPutS, "pS", desc="Send PutS to the directory") {
enqueue(request_out, RequestMsg, 1) {
out_msg.addr := address;
out_msg.Type := CoherenceRequestType:PutS;
out_msg.Destination.add(mapAddressToMachine(address,
MachineType:Directory));
out_msg.MessageSize := MessageSizeType:Control;
out_msg.Requestor := machineID;
}
}
action(sendPutM, "pM", desc="Send putM+data to the directory") {
enqueue(request_out, RequestMsg, 1) {
out_msg.addr := address;
out_msg.Type := CoherenceRequestType:PutM;
out_msg.Destination.add(mapAddressToMachine(address,
MachineType:Directory));
out_msg.DataBlk := cache_entry.DataBlk;
out_msg.MessageSize := MessageSizeType:Data;
out_msg.Requestor := machineID;
}
}
Next, we need to specify an action to send data to another cache in the
case that we get a forwarded request from the directory for another
cache. In this case, we have to peek into the request queue to get other
data from the requesting message. This peek code block is exactly the
same as the ones in the in_port
. When you nest an enqueue
block in a
peek
block both in_msg
and out_msg
variables are available. This
is needed so we know which other cache to send the data to.
Additionally, in this action we use the cache_entry
variable to get
the data to send to the other cache.
``` {.sourceCode .c++} action(sendCacheDataToReq, “cdR”, desc=”Send cache data to requestor”) { assert(is_valid(cache_entry)); peek(forward_in, RequestMsg) { enqueue(response_out, ResponseMsg, 1) { out_msg.addr := address; out_msg.Type := CoherenceResponseType:Data; out_msg.Destination.add(in_msg.Requestor); out_msg.DataBlk := cache_entry.DataBlk; out_msg.MessageSize := MessageSizeType:Data; out_msg.Sender := machineID; } } }
Next, we specify actions for sending data to the directory and sending
an invalidation ack to the original requestor on a forward request when
this cache does not have the data.
``` {.sourceCode .c++}
action(sendCacheDataToDir, "cdD", desc="Send the cache data to the dir") {
enqueue(response_out, ResponseMsg, 1) {
out_msg.addr := address;
out_msg.Type := CoherenceResponseType:Data;
out_msg.Destination.add(mapAddressToMachine(address,
MachineType:Directory));
out_msg.DataBlk := cache_entry.DataBlk;
out_msg.MessageSize := MessageSizeType:Data;
out_msg.Sender := machineID;
}
}
action(sendInvAcktoReq, "iaR", desc="Send inv-ack to requestor") {
peek(forward_in, RequestMsg) {
enqueue(response_out, ResponseMsg, 1) {
out_msg.addr := address;
out_msg.Type := CoherenceResponseType:InvAck;
out_msg.Destination.add(in_msg.Requestor);
out_msg.DataBlk := cache_entry.DataBlk;
out_msg.MessageSize := MessageSizeType:Control;
out_msg.Sender := machineID;
}
}
}
Another required action is to decrement the number of acks we are
waiting for. This is used when we get a invalidation ack from another
cache to track the total number of acks. For this action, we assume that
there is a valid TBE and modify the implicit tbe
variable in the
action block.
Additionally, we have another example of making debugging easier in
protocols: APPEND_TRANSITION_COMMENT
. This function takes a string, or
something that can easily be converted to a string (e.g., int
) as a
parameter. It modifies the protocol trace output, which we will
discuss in the debugging section <MSI-debugging-section>. On each
protocol trace line that executes this action it will print the total
number of acks this cache is still waiting on. This is useful since the
number of remaining acks is part of the cache block state.
``` {.sourceCode .c++} action(decrAcks, “da”, desc=”Decrement the number of acks”) { assert(is_valid(tbe)); tbe.AcksOutstanding := tbe.AcksOutstanding - 1; APPEND_TRANSITION_COMMENT(“Acks: “); APPEND_TRANSITION_COMMENT(tbe.AcksOutstanding); }
We also need an action to store the acks when we receive a message from
the directory with an ack count. For this action, we peek into the
directory's response message to get the number of acks and store them in
the (required to be valid) TBE.
``` {.sourceCode .c++}
action(storeAcks, "sa", desc="Store the needed acks to the TBE") {
assert(is_valid(tbe));
peek(response_in, ResponseMsg) {
tbe.AcksOutstanding := in_msg.Acks + tbe.AcksOutstanding;
}
assert(tbe.AcksOutstanding > 0);
}
The next set of actions are to respond to CPU requests on hits and misses. For these actions, we need to notify the sequencer (the interface between Ruby and the rest of gem5) of the new data. In the case of a store, we give the sequencer a pointer to the data block and the sequencer updates the data in-place.
``` {.sourceCode .c++} action(loadHit, “Lh”, desc=”Load hit”) { assert(is_valid(cache_entry)); cacheMemory.setMRU(cache_entry); sequencer.readCallback(address, cache_entry.DataBlk, false); }
action(externalLoadHit, “xLh”, desc=”External load hit (was a miss)”) { assert(is_valid(cache_entry)); peek(response_in, ResponseMsg) { cacheMemory.setMRU(cache_entry); // Forward the type of machine that responded to this request // E.g., another cache or the directory. This is used for tracking // statistics. sequencer.readCallback(address, cache_entry.DataBlk, true, machineIDToMachineType(in_msg.Sender)); } }
action(storeHit, “Sh”, desc=”Store hit”) { assert(is_valid(cache_entry)); cacheMemory.setMRU(cache_entry); // The same as the read callback above. sequencer.writeCallback(address, cache_entry.DataBlk, false); }
action(externalStoreHit, “xSh”, desc=”External store hit (was a miss)”) { assert(is_valid(cache_entry)); peek(response_in, ResponseMsg) { cacheMemory.setMRU(cache_entry); sequencer.writeCallback(address, cache_entry.DataBlk, true, // Note: this could be the last ack. machineIDToMachineType(in_msg.Sender)); } }
action(forwardEviction, “e”, desc=”sends eviction notification to CPU”) { if (send_evictions) { sequencer.evictionCallback(address); } }
In each of these actions, it is vital that we call `setMRU` on the cache
entry. The `setMRU` function is what allows the replacement policy to
know which blocks are most recently accessed. If you leave out the
`setMRU` call, the replacement policy will not operate correctly!
On loads and stores, we call the `read/writeCallback` function on the
`sequencer`. This notifies the sequencer of the new data or allows it to
write the data into the data block. These functions take four parameters
(the last parameter is optional): address, data block, a boolean for if
the original request was a miss, and finally, an optional `MachineType`.
The final optional parameter is used for tracking statistics on where
the data for the request was found. It allows you to track whether the
data comes from cache-to-cache transfers or from memory.
Finally, we also have an action to forward evictions to the CPU. This is
required for gem5's out-of-order models to squash speculative loads if
the cache block is evicted before the load is committed. We use the
parameter specified at the top of the state machine file to check if
this is needed or not.
Next, we have a set of cache management actions that allocate and free
cache entries and TBEs. To create a new cache entry, we must have space
in the `CacheMemory` object. Then, we can call the `allocate` function.
This allocate function doesn't actually allocate the host memory for the
cache entry since this controller specialized the `Entry` type, which is
why we need to pass a `new Entry` to the `allocate` function.
Additionally, in these actions we call `set_cache_entry`,
`unset_cache_entry`, and similar functions for the TBE. These set and
unset the implicit variables that were passed in via the `trigger`
function. For instance, when allocating a new cache block, we call
`set_cache_entry` and in all actions proceeding `allocateCacheBlock` the
`cache_entry` variable will be valid.
There is also an action that copies the data from the cache data block
to the TBE. This allows us to keep the data around even after removing
the cache block until we are sure that this cache no longer are
responsible for the data.
``` {.sourceCode .c++}
action(allocateCacheBlock, "a", desc="Allocate a cache block") {
assert(is_invalid(cache_entry));
assert(cacheMemory.cacheAvail(address));
set_cache_entry(cacheMemory.allocate(address, new Entry));
}
action(deallocateCacheBlock, "d", desc="Deallocate a cache block") {
assert(is_valid(cache_entry));
cacheMemory.deallocate(address);
// clear the cache_entry variable (now it's invalid)
unset_cache_entry();
}
action(writeDataToCache, "wd", desc="Write data to the cache") {
peek(response_in, ResponseMsg) {
assert(is_valid(cache_entry));
cache_entry.DataBlk := in_msg.DataBlk;
}
}
action(allocateTBE, "aT", desc="Allocate TBE") {
assert(is_invalid(tbe));
TBEs.allocate(address);
// this updates the tbe variable for other actions
set_tbe(TBEs[address]);
}
action(deallocateTBE, "dT", desc="Deallocate TBE") {
assert(is_valid(tbe));
TBEs.deallocate(address);
// this makes the tbe variable invalid
unset_tbe();
}
action(copyDataFromCacheToTBE, "Dct", desc="Copy data from cache to TBE") {
assert(is_valid(cache_entry));
assert(is_valid(tbe));
tbe.DataBlk := cache_entry.DataBlk;
}
The next set of actions are for managing the message buffers. We need to
add actions to pop the head message off of the buffers after the message
has been satisfied. The dequeue
function takes a single parameter, a
time for the dequeue to take place. Delaying the dequeue for a cycle
prevents the in_port
logic from consuming another message from the
same message buffer in a single cycle.
``` {.sourceCode .c++} action(popMandatoryQueue, “pQ”, desc=”Pop the mandatory queue”) { mandatory_in.dequeue(clockEdge()); }
action(popResponseQueue, “pR”, desc=”Pop the response queue”) { response_in.dequeue(clockEdge()); }
action(popForwardQueue, “pF”, desc=”Pop the forward queue”) { forward_in.dequeue(clockEdge()); }
Finally, the last action is a stall. Below, we are using a "z\_stall",
which is the simplest kind of stall in SLICC. By leaving the action
blank, it generates a "protocol stall" in the `in_port` logic which
stalls all messages from being processed in the current message buffer
and all lower priority message buffer. Protocols using "z\_stall" are
usually simpler, but lower performance since a stall on a high priority
buffer can stall many requests that may not need to be stalled.
``` {.sourceCode .c++}
action(stall, "z", desc="Stall the incoming request") {
// z_stall
}
There are two other ways to deal with messages that cannot currently be
processed that can improve the performance of protocols. (Note: We will
not be using these more complicated techniques in this simple example
protocol.) The first is recycle
. The message buffers have a recycle
function that moves the request on the head of the queue to the tail.
This allows other requests in the buffer or requests in other buffers to
be processed immediately. recycle
actions often improve the
performance of protocols significantly.
However, recycle
is not very realistic when compared to real
implementations of cache coherence. For a more realistic
high-performance solution to stalling messages, Ruby provides the
stall_and_wait
function on message buffers. This function takes the
head request and moves it into a separate structure tagged by an
address. The address is user-specified, but is usually the request’s
address. Later, when the blocked request can be handled, there is
another function wakeUpBuffers(address)
which will wake up all
requests stalled on address
and wakeUpAllBuffers()
that wakes up all
of the stalled requests. When a request is “woken up” it is placed back
into the message buffer to be subsequently processed.


Hello,I'm Senait
I'm a Web-Development student at Hack Your Future Belgium
About Me
Projects
Contact