I'm facing a problem described as follows :
Example :
Giving a path :
[0]------[1]------[2]------[3]------[4]
give the minimum dominatig set of this path : the solution would be [1] and [3]
The path in my program is described as an Adjacency list ,so :
[0]--> [1]
[1]--> [0];[2]
[2]--> [1];3]
[3]--> [2];4]
[4]--> [3]
What would be the idea to get the list of those elements from the Adjacency list?
Related
Based on the ImageView.imshow documentation here:
https://github.com/JuliaImages/ImageView.jl
it looks like it should be possible to change the zoom rectangle of an imshow viewer programmatically, however I have not been able to find a concrete example of how to do this and I'm not sure how to create an object of the correct type to send to the signal.
If I do this:
guidict = imshow( videog )
zr = guidict["roi"]["zoomregion"]
zr
I get:
10: "input-21" = ZoomRegion{RInt64}(XY(1..640, 1..480), XY(1..640, 1..480)) ZoomRegion{RInt64}
Aside from the complexity of the types, I don't understand why the zoom region should need to be specified twice as it is here.
In any case if I do:
push!( zr, ZoomRegion{RInt64}( XY(200..280, 280..360), XY(200:280, 280..360) ) )
(where I'm trying to set the zoom to 200:280 in X and 280:360 in Y)
I get the following error:
ERROR: promotion of types UnitRange{Int64} and IntervalSets.Interval{:closed,:closed,Int64} failed to change any arguments
Stacktrace:
[1] error(::String, ::String, ::String) at ./error.jl:42
[2] sametype_error(::Tuple{UnitRange{Int64},IntervalSets.Interval{:closed,:closed,Int64}}) at ./promotion.jl:308
[3] not_sametype(::Tuple{UnitRange{Int64},IntervalSets.Interval{:closed,:closed,Int64}}, ::Tuple{UnitRange{Int64},IntervalSets.Interval{:closed,:closed,Int64}}) at ./promotion.jl:302
[4] promote at ./promotion.jl:285 [inlined]
[5] XY(::UnitRange{Int64}, ::IntervalSets.Interval{:closed,:closed,Int64}) at /home/flynn/.julia/packages/GtkReactive/2h7NX/src/graphics_interaction.jl:93
[6] top-level scope at none:0
Does anyone have a concrete example of how to do this ?
The zoom region is made of two components, full view and current view. When you're pushing to the signal you are only moving the current view [which handles the zooming].
You can use unit ranges when pushing, like this
push!(zr, (200:280, 280:360))
To reset back to the full view you just need to then do this
push!(zr, zr.value.fullview)
This should be trivial but I can't for the life of me figure out how to do this: I am trying to read an attribute value from a NetCDF4 file in R. Now, my NetCDF4 file (uploaded here) is fairly complex, i.e. it contains nested groups.
I would like to extract the value of the attribute called gml:posList from the group METADATA/EOP_METADATA/om:featureOfInterest/eop:multiExtentOf/gml:surfaceMembers/gml:exterior using R. I am not sure if it matters in this context, but this group does not contain any variables, only metadata attributes.
I have tried the following
library(ncdf4)
fid = nc_open('S5P_NRTI_L2__NO2____20180728T130136_20180728T130636_04089_01_010100_20180728T140302.nc')
ncatt_get(fid, varid=0, attname='METADATA/EOP_METADATA/om:featureOfInterest/eop:multiExtentOf/gml:surfaceMembers/gml:exterior/gml:posList', verbose=TRUE)
but this returns
[1] "ncatt_get: entering"
[1] "ncatt_get: is a global att"
[1] "ncatt_get: calling ncatt_get_inner for a global att"
[1] "ncatt_get_inner: entering with ncid= 65536 varid= -1 attname= METADATA/EOP_METADATA/om:featureOfInterest/eop:multiExtentOf/gml:surfaceMembers/gml:exterior/gml:posList"
[1] "ncatt_get_inner: about to call R_nc4_inq_att"
[1] "ncatt_get_inner: R_nc4_inq_att returned with error= -43 type= -1"
$`hasatt`
[1] FALSE
$value
[1] 0
presumably indicating that it cannot find the attribute and I assume that I got the path wrong somehow.
So my question is, how do I need to specify the path to an attribute that is a) in a nested group and b) not linked to a specific variable, such that ncatt_get() can find the attribute and return its value?
By the way, just for reference, in Matlab the command
test = ncreadatt(file, 'METADATA/EOP_METADATA/om:featureOfInterest/eop:multiExtentOf/gml:surfaceMembers/gml:exterior', 'gml:posList')
works fine, so I know it's not an issue with the file.
Any hints would be highly appreciated!
I'm using RNeo4j package together with igraph to calculate betweenness centrality and write back to Neo4j database.
It can calculate perfectly without any problem connecting with Neo4j. After I'd got vector named with id of its node and contained its betweenness centrality value, I tried to update only one node and I got problem with 'updateProp' method.
The error I got is this.
Error in UseMethod("updateProp") :
no applicable method for 'updateProp' applied to an object of class "list"
And this is some part of my code that stuck.
...
bet <- betweenness(g)
alice = getLabeledNodes(neo4j, "User", id = as.integer(names(bet[1])))
# returned valid node
# following line got the mentioned error.
alice = updateProp(alice,betweenness_centrality = as.numeric(bet[[1]]))
I also tried other way like this without any luck.
(Also hardcoded the value to be 0 but it didn't work either)
newProp = list(betweenness_centrality = bet[[1]])
alice = updateProp(alice,newProp)
p.s. for my reference website http://rpackages.ianhowson.com/cran/RNeo4j/man/updateProp.html .
Thank you in advance.
updateProp expects the first argument to be a node. You're passing it a list. It should work if you access the first node of that list.
bet <- betweenness(g)
alice = getLabeledNodes(neo4j, "User", id = as.integer(names(bet[1])))
alice = alice[[1]]
# returned valid node
# following line got the mentioned error.
alice = updateProp(alice, betweenness_centrality = as.numeric(bet[[1]]))
I'd like to create a variable in QMAKESPEC file, based on the other variables, like below (see also comments inline):
# some project-related paths
PROJECT_ABC_ROOT_PATH=$HOME/dev/project_one
PROJECT_XYZ_ROOT_PATH=$HOME/dev/project_two
# variable below is used to select one from the paths above
PROJ_NAME=ABC
# [1] this gives "projec_one" path properly
CURRENT_PATH=$${PROJECT_ABC_ROOT_PATH}
# [2] this doesn't work
CURRENT_PATH=$${PROJECT_$${PROJ_NAME}_ROOT_PATH}
Can anyone give advice on how could I correct version [2] please?
Try the following :
# some project-related paths
PROJECT_ABC_ROOT_PATH=$HOME/dev/project_one
PROJECT_XYZ_ROOT_PATH=$HOME/dev/project_two
# variable below is used to select one from the paths above
PROJ_NAME=ABC
CURRENT_PATH=$$eval(PROJECT_$${PROJ_NAME}_ROOT_PATH)
I'm trying to port the code from flipbook component in Flex to Air 1.5.1, it gave this error
1137: Incorrect number of arguments. Expected no more than 0.
delta = new Vector(new Point(x,_pointOfOriginalGrab.y),new Point(x+10,_pointOfOriginalGrab.y+1));
How do I make it work in Air?
From the Flex documentation, it looks like Vector constructor accepts a length for it's first argument and fixed for its second argument. You can rewrite you code as this:
delta = new Vector();
delta.push(new Point(x,_pointOfOriginalGrab.y));
delta.push(new Point(x+10,_pointOfOriginalGrab.y+1));
Here's the documentation page:
Vector Documentation