I use .prettierrc with settings:
{
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"bracketSpacing": true,
"printWidth": 100,
"trailingComma": "none",
"arrowParens": "avoid",
"bracketSameLine": false
}
And he puts extra brackets like this in my Vue file:
#updateQuery="val => (query = val)"
But I need in:
#updateQuery="val => query = val"
What to do?
In an arrow function if you are making an assignment prettier will fix it like so:
val => (query = val)
There's nothing wrong with it.
You can find more info here https://github.com/prettier/prettier/pull/1326
Related
Using express-validator version 5.3.0.
I love the new syntax and I want to validate that a query parameter is valid. That parameter can be an array (as in repeat parameter).
The issue I have is that when only 1 element is passed, the framework seems to just consider it a string and the error message(s) is(are) a bit cumbersome.
with this configuration:
checkSchema([
{
foo: {
in: 'query',
isAlphanumeric: true,
optional: true,
errorMessage: 'Invalid foo'
}
}])
with the url http://server/api?foo=bar&foo=not bar I get the following error:
{
"location": "query",
"param": "foo[1]",
"value": "not bar",
"msg": "Invalid foo"
}
which seems correct.
However with the url http://server/api?foo=not bar I get the following error:
{
"location": "query",
"param": "foo[3]",
"value": " ",
"msg": "Invalid foo"
}
It's not a huge deal, but the foo[3] param is a bit misleading as technically is either just foo or foo[0].
I tried with isArray: true like below, but no luck:
foo: {
in: 'query',
isArray: true,
isAlphanumeric: true,
optional: true,
errorMessage: 'Invalid foo',
},
But that seems to actually ignore the second foo parameter (because technically a string is an array of characters?).
And with the single parameter version foo=no bar it shows the error message twice (I assume because the validator fails for both isArray and isAlphanumeric?)
Alright, so, it looks like express-validator was updated since then and now provides a toArray sanitizer.
So now, I can write the following:
checkSchema([
{
foo: {
in: 'query',
optional: true,
toArray: true,
},
'foo.*': {
in: 'query',
isAlphanumeric: true,
optional: true,
errorMessage: 'Invalid foo'
}
}])
And as an added bonus, it will now always convert queries with 1 parameter to an array of 1 value.
I need to apply custom filtering function in my datatable. For this, I need to set "bFilter": true. But I don't need search box. How can I do that?
var holiday_filter = $('#holiday_table').DataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bSort": false,
"bInfo": false,
"order": [[0, 'desc']],
//"aLengthMenu": [5, 10, 20, 30],
'iDisplayLength': 4,
"bAutoWidth": false
});
Use dom option (default value lfrtip) without f which represents filtering input.
For example:
var holiday_filter = $('#holiday_table').DataTable({
// ... skipped ...
'dom': 'lrtip'
});
I want SMO to not script the views so I do this
var transfer = new Transfer(database)
{
CopyAllTables = true,
CopyAllDefaults = false,
CopyAllStoredProcedures = true,
CopyAllDatabaseTriggers = true,
CopyAllObjects = false,
CopyAllPartitionFunctions = false,
CopyAllPartitionSchemes = false,
CopyAllRoles = false,
CopyAllRules = true,
CopyAllSchemas = true,
CopyAllSqlAssemblies = false,
CopyAllSynonyms = false,
CopyAllUserDefinedAggregates = true,
CopyAllUserDefinedDataTypes = true,
CopyAllUserDefinedFunctions = true,
CopyAllUserDefinedTypes = true,
CopyAllUsers = false,
CopyAllViews = false,
Options =
{
WithDependencies = true,
DriAll = true,
Triggers = true,
Indexes = true,
SchemaQualifyForeignKeysReferences = true,
ExtendedProperties = true,
IncludeDatabaseRoleMemberships = false,
Permissions = true,
IncludeDatabaseContext = true
},
PreserveDbo = true,
};
transfer.ScriptTransfer()
but the views are still scripted.
I really want to be able to use transfer as it seems to be the only way to get the objects scripted in dependency order without writing more code. I set
"CopyAllObjects = false" because I thought maybe that was causing the rest of the options that I had set to be ignored, but it didn't seem to do any good.
My goal here is to script out the views separately because I have a database server with views that depend on each other and will need to use dependencywalker on the views in all databases to script them in dependency order.
Please help?
I didn't exactly fix it but ended up filtering out any lines with "create view" in them. so I just call
transfer.ScriptTransfer().Cast<string>().ToList()
unless I am missing something, a lot of these flags (like CopyAllUsers) in the options SMO seems to only honor when it feels like it. :( it's a shame when some options looks exactly like what I need but do not work.
I have tried every option I can think of in configuring both DataTables (capital D) and yadcf but cannot seem to get the select drop down list to list in case-insensitive order.
Setup:
var dTable=$('#bTable').DataTable({
"traditional": false,
"pageLength": 1000,
"jQueryUI": true,
"stateSave": true,
"stateDuration": 60 * 60 * 24,
"processing": true,
"stateLoadParams": function (settings, data) {
lastSearch=data.search.search;
},
"ordering": true,
"processing": true,
"paging": false,
"info": false,
"autoWidth": false,
})
yadcf.init(dTable,[
{column_number : 3, column_data_type: "text", filter_match_mode: "exact", sort_as: "alphaNum", filter_container_id: "hs_clu", filter_reset_button_text: false, style_class: "select-style", filter_default_label: "All"},
],
{ cumulative_filtering: true }
);
When I click on the column header the column data is sorted properly as:
nbmps01
nbmps02
nbmps800
Network-1
Network-2
Network-3
NTPROV
NTSYM
NTWKTRANS
NVAM-CXMT
My dropdown select list is in this order and doesn't seem to be proper:
NTPROV
NTSYM
NTWKTRANS
NVAM-CXMT
Network-1
Network-2
Network-3
nbmps01
nbmps02
nbmps800
I have am at my wits end on this after 2 days of fiddling with it. Does anyone out there have any ideas and are willing to share.
Any help is very much appreciated.
I have improved the alpha numeric sorting in yadcf 0.9.1.beta.5 , now it works as expected.
use sort_as: "alphaNum"
Here is a working jsfiddle link
I create a line chart using dojo. Recently, I have been applying multiple axis on the chart. But there was a problem here. It is applied to multiple axes in one place I have raised the issue of overlapping tick value. and do not change the properties of leftBottom, is there a way to adjust the shaft position? For example, x: 10, y: 20?
my code
var axisXRef = {labels : labelsample, titleOrientation : "away", stroke : {}, natural : true};
var axisYRef = {vertical : true, stroke : {}};
var chart = new Chart("chartNode");
chart.addPlot("lines", { type: Lines, tension: 3 ,min:0});
chart.addPlot("stacklines", { type: StackedLines, tension: 3 ,hAxis:"x",vAxis:"y1"});
chart.addPlot("areas", { type: Areas, tension: 3,hAxis:"x",vAxis:"y2" });
chart.custom.axisX = lang.clone(axisXRef);
chart.custom.axisY = lang.clone(axisYRef);
chart.addAxis("x", chart.custom.axisX);
chart.addAxis("y", chart.custom.axisY);
chart.addAxis("y1", {
vertical: true,
min : 50,
max:70,
leftBottom:true,
majorLabels: true, majorTicks: true, majorTick: {color:"red",length:50},
minorLabels: true, minorTicks:true, minorTick:{color:"red",length:50},
microTicks: true, microTick:{color:"red",length:50},
fixUpper: "major",
fixLower:"minor"
});
chart.addAxis("y2", {
vertical: true,
min : 0,
max:49,
leftBottom:true,
majorLabels: true, majorTicks: true, majorTick: {color:"blue",length:25},
minorLabels: true, minorTicks:true, minorTick:{color:"blue",length:25},
microTicks: true, microTick:{color:"blue",length:25},
fixUpper: "major",
fixLower:"minor"
});
Unfortunately Dojo charting only supports two axis per direction both axis being on different side of the chart. In other words you can't have two axis both on the left side of the chart. You have to have one right side using leftBottom: false property.