when does binding occur for Compile load and Run - wpf

I need to figure out the following:
Using keywords “compile”, “load”, and “run”, describe three different variable bindings in the table below. For each binding (a), (b) and (c), describe a situation for which this kind of binding occurs. (a situation corresponds to a variable in a particular location in a given programming language).
---------------------------------------------------------------------
xxxxxx | Name | Address | Type | value | Lifetime | scope |
--------------------------------------------------------------------
compile
load
run

Not sure about the details you require, but binding occurs when InitializeComponent() is executed in the xaml file

Related

Object name as variable in Logtalk

Is this possible to get the name of an object as a variable? I’m trying to make a database where each object represents each person. I’ve got objects with [name/1, surname/1], but when I ask e.g.
X::name(john).
it gives me an error. Ofc there is no problem to get the atom by using this method:
object_id::name(X).
The ::/2 message sending control construct indeed requires a bound first argument at call time. But you can enumerate existing objects using the current_object/1 built-in predicate:
| ?- current_object(Person), Person::name(john).
...
However, this solution may also result in errors as we will be enumerating all objects by backtracking and not all of them will understand a name/1 message. A better solution is thus to only enumerate objects that understand the name/1 message. Assuming that all objects representing a person implement (directly or through inheritance) a person_protocol, we can use the conforms_to_protocol/2 built-in predicate:
| ?- conforms_to_protocol(Person, person_protocol),
Person::name(john).
...
See https://logtalk.org/manuals/refman/predicates/conforms_to_protocol_2_3.html for details.

How to model a HTML table with column per component in React?

React components are awesome when we know how to separate the concern.
However, I find this case really hard to abstract.
| A | B | C |
| A.a | B.a | C.a |
| A.b | B.b | C.b |
| A.c | B.c | C.c |
I have the API that return 1 column per request, eg: [A.a, A.b, A.c]
so normally I will like A, B, C to be a React Component
and render it to it's parent component
However, in this case I cannot easily do that because of the html structure flavor tr per component, not per column.
Does anyone have any idea about this?
Iterate differently, iterate the properties! Use a "RowRenderer" component that loops through all the properties .a, .b, .c given that you know those beforehand. Per property, use a "CellRenderer" that takes an object like A, B, C and the iteration's property-name, and render the cell.

Gremlin / Bulbflow: How to select nodes based on their edges and related vertice's properties

Sorry for the long post, but I want to avoid any misunderstanding about what I'm looking for :)
I am currently discovering graph databases, and experimenting a bit with bulbflow/neo4j.
Thus, I am trying to use gremlin for most of my requests, but I do not know if the request I want is even feasible or not. I may even be wrong about trying to use a graph db for such a use case, so don't mind telling me whether you think I'm on the right path or not.
First, let me provide a bit of context:
I work on an early-stage open-source project, which is a compiler for a DSL language generating C code. We are currently planning to re-write the whole thing in python for many many reasons (the language, re-designing, opening to a community and such...). The compiler includes what I'll call a cache of the compiled interfaces and templates. The interfaces describe the templates, and each template is associated to a configuration (a list of typed values associated to variables described by the interfaces).
The aim of the request I'm wishing to build is to select a single template implementation depending on an input configuration (actually used in the generation mechanism of the compiler). In the end, I want to be able to request directly through gremlin (if possible at all) a single element I'm looking for in order to provide unicity for the elements that can be found within this "cache". Currently, I manually match this configuration in the python code, but I want to know if it is feasible to do it directly within gremlin.
-
So let's define a sample graph for my use-case:
We have three types of vertices:
Def (Definition), contains a String property called "signature", which is actually the signature of the template defined by this node.
Impl (Implementation), containing two properties which are pathes to the original source and pre-compiled files.
Var (variable), containing a String property which is the signature of the variable.
Then, a few kind of edges:
Def -> impl_by -> Impl (multiple implementations can exist for a definition, does not contain any property)
Impl -> select_by -> Var (Implementations may be selected through a constraint over a configuration variable's value, each edge of this type contains actually three properties: type, value, and constraint - a comparison operator -)
The selected_by edge (or relationship, following bulflow's vocabulary) describes a selection constraint, and thus has the following properties:
val (value associated to the variable for the origin implementation)
op (comparison operator telling which kind of comparison to make for the constraint to be valid or not)
This translates as a graph such as (I'll omit the types from the selected_by edges in this graph):
-- select_by { value="John", op="="} ---------
| \
(1)--Impl--- select_by { value=12, op=">"} ------ \
| \ \
| \ |- Var("name")
| |- select_by { value="Peter", op="="} -----------/
Def (2)--Impl-- \/
| |- select_by { value=15, op="<"} ---- /\
| \ / \
| |-/----|--- Var("ver")
(3)--Impl--- select_by { value="Kat", op="!="} ------/ /
| /
|--- select_by { value=9, op=">"} ---------/
What I want to do is to select one (or more) Impl depending on their relationship with the Vars. Let's say I have a configuration as follows:
Config 1:
variable="name", value="Peter"
variable="ver", value=16
This would select Impl(3) Since Peter != Kat AND 16 > 9, but not Impl(1) since Peter != John nor Impl(2) since 16 !< 15.
I was blocked on multiple levels, so I was starting to wonder if this was even feasible:
I could not find how to give such arguments (the configuration) to a gremlin script
I could not find how to select the Impl based on conditions over the outgoing edges.
I hope this wasn't too confusing.
Cheers, and thanks !
EDIT:
I managed to make part of my request work, by using repeatedly backtracking and filters. The request (X being the starting vertex, VALUE the value I want to match, and NAME the name of the variable to be matched) looks like this:
Basis of the request:
g.v(X).out('impl').as('implem')
Repeat this part for each couple VALUE/NAME:
.out('select_by').filter{it.value=='VAL‌​UE'}
.inV('select_by').filter{it.name=='NAME'}
.back('implem')
The only thing currently missing is that I do not know how to use the select_by edge's 'op' property to determine how to build the filter to use. For instance, thre are cases where I want to match exactly the configuration (and thus, as in this request, I ignore the 'op' property), but there are cases where I want to take the 'op' property into account, and use the associated comparator in the filters.
Is there any way to do that ? (Or should I post another question?)

Selenium IDE - Typing values stored in an array into a textbox?

There's a webpage I'm trying to test that has multiple textboxes. I've gotten to the point where I can retrieve all the values in every textbox and store them into an array, but I'm stuck on how to type those same values into the textboxes again.
Here's what I have so far in Selenium:
Larger view: http://i.stack.imgur.com/rb93k.png
The stored variable 'count' is simply the number of rows in the table, and isn't causing a problem. The part I've circled in red is where the problem comes in.
When I run this test, instead of typing the value stored in the array at that index, it simply types:
This continues all the way until the end.
The variable 'i' is properly inserted, but for some reason instead of grabbing that value, it simply types it into the textbox.
Does anyone know how I can get the correct value in the array?
Below is the problematic line:
type | javascript{this.browserbot.getUserWindow().getTestingHooks('TextBoxValue_' + storedVars['i'])} | ${textBoxArray[${i}]} |
i'm using Selenium library through Robot Tests Framework. I'm not using any IDE, just using HTML to make test cases and defining new keywords.
When ever i want to access a list variable item, i just use the following sintaxe
#{list_variable_name}[0]
note that ${variable_name} is to access a single value variable or the reference to the list variable. If we want to access a list item we need to use # instead of $.
If i understand your situation right,
#{textBoxArray}[${i}] should work for you.
Try also
${textBoxArray}[${i}] because it seems that your are simply misplaycing the last }.
More details at
http://robotframework.googlecode.com/svn/tags/robotframework-2.5.4/doc/userguide/RobotFrameworkUserGuide.html#list-variables
I think you need to replace your circled reference to ${textBoxArray[${i}] with
javascript{storedVars['textBoxArray['+storedVars['j']+']']}
Read this blog post for more information, especially the section about 'Setting and getting variables'.
Quoting from the article, consider
store | 10 | x
This obviously sets x=10. There are a couple of ways to reference it:
${x} or storedVars['x']. They're not the same.
In particular
You can't assign anything to ${x}.
You can insert one more command before your problematic line:
getEval | storedVars['text'] = storedVars['textBoxArray'][storedVars['i']];
And change problematic line to:
type | javascript{this.browserbot.getUserWindow().getTestingHooks('TextBoxValue_' + storedVars['i'])} | ${text}
Also it will be probably helpful to declare your array in the beginning of the test:
storeEval | new Array() | textBoxArray

Displaying a dynamic data structure in Silverlight DataGrid

I have a data structure like this:
MyDataStructure{
string Name{get;set}
string Title{get;set;}
IDictionary<string, bool> Values{get;set;}
}
I want to display items from an array of this structure in a data grid type of display
Name | Title | {Values[0].Name} | {Values[1].Name} | ... | {Values[N].Name}
Any suggestions?
I think that you could find something from question (here) I was having the same issue few days ago. Briefly I have found only two solutions:
using reflection to "transform" your Dictionary to a runtime generated class with the properties taken from the Dictionary itself (the properties name will be taken, for examle from key value)
using a Dynamic Language (such IronPython) to do the same thing described before but in a simplier way (I haven't tested it yet)
I don't know right now if this will be fixed in SL3. Right now seems to not be possible to bind using "position".
If you find any other solution is well accepted :)
Giorgio

Resources