Symfony : RedirectToRoute or GenerateUrl - redirect

All in subject ^^
What's the best for redirect :
RedirectToRoute('my_route', [my_params]);
or
RedirectResponse($this->generateUrl('my_route', [my_params]);
and why ?
I did not find a good answer in doc

It is exactly the same.
The first is only meant to be easier to use ...
See this note :
http://symfony.com/blog/new-in-symfony-2-6-new-shortcut-methods-for-controllers

Related

OR-Tool - What is objectiveValue of Assignment model

in this example the printSolution has the log:
logger.info("Objective : " + solution.objectiveValue());
So what does it mean the objectiveValue? how it is affect to solution found? also how to edit that value? the log output the number but i dont understand
Thanks
Basically, it will be the sum of arc cost used by the fleet.
This is the value, the routing solver will try to minimize as much as possible.
You should take a look at https://groups.google.com/g/or-tools-discuss/c/YCUNTmWr8Us/m/tA1OlIfVAQAJ to know how you can add more "value" to this objective.

RKI_COVID19/FeatureServer - how to use that?

I am looking for a rest way to get more information out of a COVID19 map.
I noticed that arcgis provides plenty of topics and tutorials for developers.
I just don't know which tutorials are helping me to understand the FeatureServer.
I had two questions, can I query the below table with the rest api?
Like finding out what fields are in it, and what data.
If I have access to a serviceItemId - can I do anything useful with it?
"tables" : [
{
"id" : 0,
"name" : "RKI_COVID19",
"parentLayerId" : -1,
"defaultVisibility" : true,
"subLayerIds" : null,
"minScale" : 0,
"maxScale" : 0
}
]
Now I know how the query works.
https://developers.arcgis.com/rest/services-reference/query-related-records-feature-service-.htm
I found answers to what I was looking for.
Try this to access all data (query=1=1) in formatted son (pjson):
https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_COVID19/FeatureServer/0/query?where=1%3D1&outFields=*&f=pjson
Or have a look at this notebook that implements the data retrieval from there:
https://github.com/starschema/COVID-19-data/blob/master/notebooks/RKI_GER_COVID19_DASHBOARD.ipynb

PHP (AuraPHP router) - routing with more than one optional parameters

i have got a little problem in my auraphp router. For example i have this URL : oleje/134/motorove-oleje-pro-automobily/
But i can have this URl also : oleje/134/motorove-oleje-pro-automobily/oleje-shell
The "oleje-shell" part of URL is optional and i need to put behind this part one more optional parameter called "per_page". So i need something like : oleje/134/motorove-oleje-pro-automobily/35 or : oleje/134/motorove-oleje-pro-automobily/oleje-shell/35.
I hope, you got it.
Thanks for help.
2 options are coming to my mind.
Optional Params
$router->add('archive', '/oleje/134/motorove-oleje-pro-automobily{/oleje,number}');
Wild card Params
$router->add('wild_post', '/oleje/134/motorove-oleje-pro-automobily/')
->setWildcard('other');
// this matches, with the following values
$route = $router->match('/oleje/134/motorove-oleje-pro-automobily/oleje-shell/35', $_SERVER);
// $route->params['other'] = array('oleje-shell', '35')
In both cases you may want to check whether the one you got is string or number.
Hope that help!

Drools: Variables can not be used inside bindings

I get the error
Variables can not be used inside bindings
on the following Drools-Rule Code
rule "minGapsBetweenAppointments"
when
$leftAssignment : AppointmentRequest(feasibleAppointment != null)
$totalValue : Number( ) from accumulate(
AppointmentRequest(feasibleAppointment != null,
$leftAssignment.requestId != requestId,
$quality : this.getOccupiedSurroundingsValue($leftAssignment)),
sum( $quality )
) // ERROR LINE
then
scoreHolder.addSoftConstraintMatch(kcontext, $totalValue.intValue());
end
Although i found this post from another question, it's not helping me much, as I need to call function getOccupiedSurroundingsValue for all other AppointmentRequests, as they're related.
Any help appreciated.
That code should work. There's nothing wrong with it as far as I can see.
Double check if you it's exactly the same as the code you're executing it. I use similar code in my examples and those work.
If it's OK, then it might be a bug in Drools Expert.
There are 2 ways to proceed:
The easy way: repost this question on the drools mailing list, maybe Edson or Wolfgang sees something I don't. Post a jira if no one sees a user-mistake.
The fastest way to solve your problem: create a new test in MiscTest that proves your case and submit it as pull request. Either you find out what you're doing wrong or you prove without a shadow of a doubt there's a bug we need to fix asap :)

MongoDB $ne Explanation

The official MongoDB api wrote very little about $ne
http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24ne
So when I encountered something like
db.papers.update({"authors cited" : {"$ne" : "Richie"}},
... {$push : {"authors cited" : "Richie"}})
I have no choice but to become utterly confused. Can someone please explain it to me?
This would add "Richie" to the list of authors cited for a paper that does not already have "Richie" as an author.
An alternative would be to use $addToSet.
But then how would I know whether {"authors cited" : {"$ne" : "Richie"}} means the elements in the list corresponding to "author cited", vs the value corresponding to "author cited"?
That is a bit confusing. Generally (I am sure there are exceptions, but those should be documented), all selectors target the individual values for multi-values fields. In Mongo this is called "multikeys" .
Note that this led me to assume initially that your query would target all papers that have at least one author who is not Richie. Then I checked and this turned out to be wrong. +1 for your question, because this really needs to be documented better.