In the below example would the queryable #q be evaluated a second time?
local(max = 10, m = 5)
local(q = with n in 1 to 10 select #n+#m)
#q // 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
if(true) => {
#q // is it invoke here like the above?
}
I suspect not, but if that's the case is it #q->asString that invokes the query?
I think you're right. Here's a simple test calling a counter thread object that increments on each call.
define test_count => thread {
data private val = 0
public asstring => {
.val += 1
return .val
}
}
local(max = 10, m = 5)
test_count
local(q = with n in 1 to 10 select #n+#m + integer(test_count -> asstring))
'<br />'
test_count
'<br />'
#q
'<br />'
test_count
'<br />'
if(true) => {
#q
}
'<br />'
test_count
Result ->
1
2
9, 11, 13, 15, 17, 19, 21, 23, 25, 27
13
14
The second call for #q is never processed. You can however force it to run by outputting it.
Related
Doing this:
// JSON
{
"intlDateTime": "On the {{val, datetime}}",
}
i18next.t('intlDateTime', { val: new Date(Date.UTC(2012, 11, 20, 3, 0, 0)) });
// --> On the 12/20/2012
without interpolation escape to false
ends with a display of / instead of "/"
How can we use date format and avoid xss attacks at the same time ?
To solve the wrong display, I need to write:
{t('lastModified', {
val: new Date(Date.UTC(2012, 11, 20, 3, 0, 0)),
interpolation: { escapeValue: false },
})}
which I would like to avoid.
I have this current data structure on my firebase
{
"bible-operators": [{
"op-id": 0,
"op-name": "Anonymous",
"bcv": 101001001,
"op-version": 1,
"pass": "none",
"setting1": 1,
"setting2": 2,
"setting3": 3,
"setting4": 4,
"setting5": 5,
"setting6": 6,
"setting7": 7,
"bg": 1
}, ... {
"op-id": 4,
"op-name": "Test User 4",
"bcv": 101001001,
"op-version": 1,
"pass": "pass4",
"setting1": 1,
"setting2": 2,
"setting3": 3,
"setting4": 4,
"setting5": 5,
"setting6": 6,
"setting7": 7,
"bg": 1
}]
}
I tried to make test update using this function
function update(op_id, nuname, nuversion, nubcv, nupass) {
firebase.database().ref('operators/' + op_id).set({
"op-name": nuname,
"op-version": nuversion,
pass: nupass,
bcv : nubcv
});
}
My expected result is to update the provided new data but retain the others that has no updates. However, after calling update, all non provided data were deleted from the database. setting1-7 and bg.
How can I run the update without losing data that has no new data provided?
Thanks
The function firebase.database().ref('bible-operators/' + op_id).set() replace the document, you have to use update() instead of set().
try it:
firebase.database().ref('bible-operators/' + op_id).update({
"op-name": nuname,
"op-version": nuversion,
pass: nupass,
bcv : nubcv
});
I need to register a custom error code while creating custom driver for Siebel CTI. As per its document, following errors are predefined (enum from scapi.h):
enum SCErrorCode
{
SC_EC_OK = 0,
SC_EC_ERROR = 1,
SC_EC_CMD_NOT_SUPPORTED = 2,
SC_EC_MEDIA_TYPE_NOT_SUPPORTED = 3,
SC_EC_INVALID_HANDLE = 4,
SC_EC_OUT_OF_MEMORY = 5,
SC_EC_NETWORK_ERROR = 6,
SC_EC_LIB_LOAD_ERR = 7, /* Unable to load driver DLL */
SC_EC_FUNC_NOT_RESOLVED = 8, /* Unable to resolve function address */
SC_EC_DRIVER_CREATION_ERR = 9,
SC_EC_DRIVER_RELEASE_ERR = 10,
SC_EC_SERVICE_CREATION_ERR = 11,
SC_EC_SERVICE_RELEASE_ERR = 12,
SC_EC_INVALID_ITEM_TRACKING_ID = 13,
SC_EC_CLIENT_INTERFACE_ERR = 14, /* Failed on invoking ISC_CLIENT_HANDLE function */
SC_EC_SENDMSG_FAILED_RETRY = 15, /* SC_CT_SENDMESSAGE failed, please resend again later */
SC_EC_IMPOBJ_CREATE_ERR = 16, /* Unable to create the underlying implementation object */
SC_EC_INVALID_LICENSE = 17,
SC_EC_WORK_ITEM_WRONG_STATE = 18, /* Work item is at wrong state for the operation */
SC_EC_DRIVER_SPECIFIC = 1000
};
Siebel Administration guide page 270 says:
SCErrorCode:
The values enumerated by SCErrorCode specify predefined error codes. The error codes from 0 to 1000 are reserved.
How can I add/register a custom error code? Or is there any way to specify driver specific error message using SC_EC_DRIVER_SPECIFIC error.
I am creating a MVC application, and the user's have asked that on the datetimepicker if the values could be switched to intervals of 6.
So on this part of the datetimepicker:
Is there a way to change the values to 00, 06, 12, 18, etc?
Any help is appreciated.
I found it!
The original datetimepicker was based off of this:
fillMinutes = function () {
var table = widget.find('.timepicker-minutes table'),
currentMinute = viewDate.clone().startOf('h'),
html = [],
row = $('<tr>'),
step = options.stepping === 1 ? 5 : options.stepping;
while (viewDate.isSame(currentMinute, 'h')) {
if (currentMinute.minute() % (step * 4) === 0) {
row = $('<tr>');
html.push(row);
}
row.append('<td data-action="selectMinute" class="minute' + (!isValid(currentMinute, 'm') ? ' disabled' : '') + '">' + currentMinute.format('mm') + '</td>');
currentMinute.add(step, 'm');
}
table.empty().append(html);
},
so I changed the step = options.stepping === 1 ? 5 : options.stepping; to:
step = options.stepping === 1 ? 6 : options.stepping;
Im trying to understand if there is a feature in ractivejs , for descending sorting , and ascending .
I couldnt find anyhting in the documentation .
No - Ractive purposely avoids being a 'kitchen sink' utility library. But it's very easy to add an ascending or descending helper:
var helpers = Ractive.defaults.data;
// assuming a and b are numbers...
helpers.ascending = function ( a, b ) {
return a - b;
};
helpers.descending = function ( a, b ) {
return b - a;
};
ractive = new Ractive({
el: 'body',
template: '' +
'<p>ascending: {{ numbers.slice().sort(ascending) }}</p>' +
'<p>descending: {{ numbers.slice().sort(descending) }}</p>'
},
data: {
numbers: [ 9, 4, 6, 2, 4, 1, 10, 2, 7, 8 ]
}
});
Note that you could also put the ascending and descending functions directly on the data object, if that's preferable.
Here's a JSFiddle to demonstrate: http://jsfiddle.net/rich_harris/nszt3150/