I want to format arguments as one per line, e.g. as follows:
cls.def(
"isHomogeneousElastic",
&SUB::System::isHomogeneousElastic,
"isHomogeneousElastic");
However, clang-format wants to format this as:
cls.def(
"isHomogeneousElastic", &SUB::System::isHomogeneousElastic, "isHomogeneousElastic");
How can I avoid this?
I found this question & answer with the solution of using:
BinPackArguments: false
BinPackParameters: false
ExperimentalAutoDetectBinPacking: false
AllowAllParametersOfDeclarationOnNextLine: false
which works on some parts in my code, but not on this particular example.
I would like to see if they can help me with the creation of a variable, where I can change the labels of the MQTT message that is sent from my IoT devices, in order to make it easier and to select the correct parameters when creating a dashboard. .
Example:
This is the message received to my server.
[{"n": "model", "d": "iot-zigbee1783"}, {"n": "Relay", "ap": true}, {"t": "gateway", "ma": "0035DDf45VAIoT215"}]
What I want is to change the label "d" for "deviceIoT" and "ap" for "door sensor" also if it is possible to change the true or false of the door sensor for open and closed.
You can do this with the help of Thingsboards rule-chain.
There is also an official tutorial for this:
https://thingsboard.io/docs/user-guide/rule-engine-2-0/tutorials/transform-incoming-telemetry/
They use the transformation-rule-node called script to convert temperatures from [°F] to [°C].
While this is not your use case, it shows you how to handle incoming telemetry before it is saved to the database.
You could do a mapping of value-keys like this:
var theCustomizedMessage = {};
theCustomizedMessage['customizedKey'] = msg['originalIncomingKey'];
return {msg: theCustomizedMessage, metadata: metadata, msgType: msgType};
Keep in mind that this might be contra-productive since you have to update the rule-node scripts, when something changes.
As an alternative option you can rename the key labels in the widget configuration. This will not help your dashboard developers. But a documentation document will do :)
I strongly recommend against the replacement of boolean values with strings ('closed', 'opened'). This is a job for the widgets (e.g. their value format functions).
It seems like messing with the configuration, like trying to tune the number of thread readers for vertices & edges, cause a lot of unexplained exceptions, also there is an issue with trying to set the batch size.
It seems to only work with the default settings produced by the executable.
I've got a lot of exception, while trying "to play" with those values,
some of them are
[1] CAS exception of cassandra, something about the inability to create more partition keys.
[2] Cassandra timeout during write query at consistency ONE
and more.
As there is no reference within the documentation about how to solve those issues, I don't know how to continue. It seems like everything there is very delicate and shaky, so any little change causes tons of exceptions.
This is for using graph-loader-6.0.1 and dse 6.0.0 or dse 6.0.1
For example :
com.datastax.dsegraphloader.exception.LoadingException: com.datastax.driver.core.exceptions.InvalidQueryException: Resource limited exceeded on added vertices, properties and edges. Maximum of 100000 allowed. Please split transaction into multiple smaller ones and retry.
This is what I get when I try to use some config.
this is the groovy file for configuration :
// config
config preparation: false
config create_schema: false
config load_new: true
config load_edge_threads: 5
config load_vertex_threads: 5
config batch_size: 5000
// orders
inputfiledir = '/home/dseuser/'
profileInput = File.text(inputfiledir + "soc-pokec-profiles.txt").
delimiter("\t").header('user_id','public','completion_percentage','gender','region','last_login','registration','age',
'body','I_am_working_in_field','spoken_languages','hobbies','I_most_enjoy_good_food','pets','body_type',
'my_eyesight','eye_color','hair_color','hair_type','completed_level_of_education','favourite_color',
'relation_to_smoking','relation_to_alcohol','sign_in_zodiac','on_pokec_i_am_looking_for','love_is_for_me',
'relation_to_casual_sex','my_partner_should_be','marital_status','children','relation_to_children','I_like_movies',
'I_like_watching_movie','I_like_music','I_mostly_like_listening_to_music','the_idea_of_good_evening',
'I_like_specialties_from_kitchen','fun','I_am_going_to_concerts','my_active_sports','my_passive_sports','profession',
'I_like_books','life_style','music','cars','politics','relationships','art_culture','hobbies_interests',
'science_technologies','computers_internet','education','sport','movies','travelling','health','companies_brands',
'holder1','holder2')
relationInput = File.text(inputfiledir + "soc-pokec-relationships.txt").
delimiter("\t").header('auser','buser')
profileInput = profileInput.transform {
if (it['completion_percentage'] == 'null') { it.remove('completion_percentage')};
if (it['gender'] == 'null') { it.remove('gender')};
if (it['last_login'] == 'null') { it.remove('last_login')};
if (it['registration'] == 'null') { it.remove('registration')};
if (it['age'] == 'null') { it.remove('age')};
it
}
load(profileInput).asVertices {
label "user"
key "user_id"
}
load(relationInput).asEdges {
label "relation"
outV "auser", {
label "user"
key "user_id"
}
inV "buser", {
label "user"
key "user_id"
}
}
I tried to use the soc-pokec (social network) from stanford (available in web).
I had to loose most of the config to solve the issue.
Note that there is totally no correlation between the numbers in the exception, and the settings I mad in the config.
I am trying to set searchable attributes so that these can by dynamically controlled by locale. I am attempting to follow this guide from algolia on multi lang support:
https://www.algolia.com/doc/guides/search/multilingual-search/
The example shows setting this value on index:
Algolia.init_index('movies').set_settings({"searchableAttributes"=>["title_eng,title_fr,title_es"]})
but this is not how I am creating my index, maybe I am missing something? I also don't appear to have the set_settings method on the helper.
I am trying to set this via:
helper.setQueryParameter('searchableAttributes', searchable_terms_array)
found towards the bottom of the following coffee script code block
searchable_terms_array = [
'title_de'
'title_en'
'title_fr'
]
restricted_terms_array = [
'title_' + current_locale
]
search = instantsearch(
appId: 'MY-ID'
apiKey: 'MY_KEY'
indexName: 'my_index_' + rails_env
urlSync: {
threshold: 300
getHistoryState: ->
{ turbolinks: true }
}
searchFunction: (helper) ->
query = search.helper.state.query
# Here is my attempt, doesn't seem to work
helper.setQueryParameter('searchableAttributes', searchable_terms_array)
# is there another way to set above line?
helper.setQueryParameter('restrictSearchableAttributes', restricted_terms_array)
videos.helper.setQuery query
videos.helper.search()
helper.search()
return
)
Finally, it may be important to note that I am setting the primary searchable attributes via the Algolia admin console, but assume I am supposed to be setting the additional language related fields to searchable via the API.
searchableAttributes is setting not a query parameter. The JS Helper is a query only layer on top of the client. This means that you can't set the settings of your index using the JS Helper.
What you need to do for multiple language support is to create a replicas per language. Each replica will have a different set of searchable attributes. Then using instantsearch.js or the JS Helper you can switch indices, respectively using the sortBySelector widget or the setIndex method of the helper.
My Problem is the following i wanted to test some functionality that depended on a certain setting in the sfConfig.
Proposed the setting is app_foo and its default is false.
The "standard" way to test is like:
$browser = new sfTestFunctional(new sfBrowser());
$browser->
get('/path_to/index')->
...
end();
BUT it does not work to change the setting like
sfConfig::set('app_foo', true);
$browser = new sfTestFunctional(new sfBrowser());
The sfConfig cannot be overwritten in the test because the sfConfig is reset on the next request.
BUT a field named 'rawConfiguration' in the browser instance is added to the sfConfig for the request. So the solution is to set this array:
$browserEngine = new sfBrowser();
$browser = new sfTestFunctional($browserEngine);
// overwrite an sfConfig parameter in the browser context
$browserEngine->rawConfiguration = array_merge($browserEngine->rawConfiguration, array('app_foo' => true));
Then the action knows the sfConfig::get('app_foo') with the value true.
The samura answer is nice, you also have to know that config files are environement aware so you can do that in your app.yml:
all:
my_setting: "super"
test:
my_setting: "awesome"
This is also working on the database.yml file, allowing you to run functionnal tests in another database