Leaflet: removeLayer by id do not work - leaflet

I am trying to remove element from map:
Work code:
var x = L.imageOverlay(fullURL, xbounds).addTo(Window.map);
Window.map.removeLayer(x);
Do not work:
var x = L.imageOverlay(fullURL, xbounds).addTo(Window.map);
Window.map.removeLayer(1);
By the docs it have method for removing elements by IDs

Actually, map.removeLayer() accepts only a layer (as in your first code).
It is layerGroup.removeLayer() that can also accept an ID.
This "ID" is automatically defined by Leaflet, and you can retrieve it using L.stamp(layer).
var layerGroup = L.layerGroup().addTo(map)
var x = L.marker(coordinates).addTo(layerGroup);
var x_id = L.stamp(x); // Retrieve the x layer ID
layerGroup.removeLayer(x_id);
Demo: https://jsfiddle.net/3v7hd2vx/65/

Related

Dartap Search Criteria

I'm using dartdap to query ldap for certain records.
Dartap v0.6.2 https://pub.dev/packages/dartdap
Dart SDK v.2.17.1
I can connect successfully to ldap, but I can't figure out how to pass search criteria. Let's say I want to retrieve records for cn (common name) containing Joe, cn=Joe*. How would I pass cn=Joe* to dartapp?
The following is a snippet from the credentials and connection section.
var filter = Filter.present('objectClass');
var attrs = ['dn', 'cn', 'objectClass']; //define returned attributes, but where do I pass a filter?
Future example() async {
var host = 'hostname';
var bindDN = 'user#domain';
var password = 'password';````
I found a way to filter. In case anyone else has the same issue, the following works:
// original
var filter = Filter.present('objectClass');
// change to
var filter = Filter.substring('cn', 'Joe*');

How to combine several maps into a single map in flutter dart?

How can I combine 2 or more maps in dart into 1 map? for example, I have something like:
var firstMap = {"1":"2"};
var secondMap = {"1":"2"};
var thirdMap = {"1":"2"};
I want: maps within a map
var finalMap = { {"1":"2"}, {"1":"2"}, {"1":"2"} };
As we know that map is "key and Value " combination what i think try to use list not map.

How to return all entries from specific date in log.nsf

I need to return all entries (collection) from a specific date from the miscellaneus view in log.nsf using SSJS.
The views first category is "text" and the second category is a "date".
I tried to use the methods getAllEntriesByKey(vector) or createViewNavFromCategory(vector) but I got kind of stuck as the categorized columns contain different data types.
how can I do that?
Here is one thing I tried
var logdb = sessionAsSigner.getDatabase("domino01/....","log.nsf");
var logView = logdb.getView("MiscEvents")
var v = new java.util.Vector()
var nav = logView.createViewNavFromCategory("domino01/...\\2019-02-15")
return nav.getCount()
and here is another
var logdb = sessionAsSigner.getDatabase("domino01/...","log.nsf");
var logView = logdb.getView("MiscEvents")
var v = new java.util.Vector()
v.add("domino01/...")
v.add(session.createDateTime("Today").getDateOnly())
var nav = logView.getAllEntriesByKey(v)
return nav.getCount()
Just remove the getDateOnly call from your 2nd example code.
v.add(session.createDateTime("Today"))

Constraining more than one IntVarArray

I'm working with several IntVarArray-s in a model in a way that there are cross-dependencies between their elements. Is this the correct way to use them as parameter for the MakePhase method?
var nr = 10;
var fLoc = s.MakeIntVarArray(nr, 0, 1);
var gLoc = s.MakeIntVarArray(nr, 0, 1);
// ... create other arrays
// ... constrain the arrays
// collect them
var decisions = new IntVarVector();
decisions.AddRange(fLoc);
decisions.AddRange(gLoc
//... add other arrays to decisions
// call MakePhase
solver.MakePhase(decisions, ...);
Yes this works.
Please make sure that either the order is the right one, or choose a variable selection strategy that is dynamic like CHOOSE_MIN_SIZE_LOWEST_MIN.

In linq-to-entities, how to return objects with a filtered list of children?

I have the following model
The first step is to select all the ProductionBlock with
var blocks = context.ProductionBlocks;
How can I combine the ProductionLog that has no end time with the ProductionBlock?
I tried to do it using a reverse lookup like
var blocks = context
.ProductionLogs
.Include("FK_ProductionLog_ProductionBlock")
.Where(log => log.EndTime == null).Select(log => log.ProductionBlock)
.Union(context.ProductionBlocks);
But the blocks don't contains any ProductionLogs. How can I achieve that?
Let me know if i am off base, but you would want.
var logs = (
from pl in context.ProductionLogs.Include("ProductionBlock")
where pl.EndTime == null
select pl);
You would then have a list of logs and blocks.
var blocks = logs.SelectMany(x=>x.ProductionBlock)