Grepper code extension not showing suggestions and add answer option - cross-origin-read-blocking

As i cleaned up my computer and reinstalled chrome latest version and when i tried using grepper code extension it was not working. It was not showing any answers and not even letting me add a new answer. I tried researching for a while but couldn't find a solution to it.
Then i tried opening it inside the firefox and it was working perfectly and i can even see suggestions and even add new answers.
Then When i checked inside my console log i found some errors while doing a google search and the errors were related to the grepper cross origin issue. I am attaching the screenshot of the issue that occurred

I solved this error by allowing the cross origin access using the following extension :
https://chrome.google.com/webstore/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf?hl=en
and then just reloading the page the errors were gone and you can also check if it is working or not inside the test panel of the extension :
https://webbrowsertools.com/test-cors/
I am attaching some screenshots that will define my solution.

/* #api */
define([
'jquery',
'mageUtils'
], function ($, utils) {
'use strict';
var types = [
{
title: 'Visa',
type: 'VI',
pattern: '^4\\d*$',
gaps: [4, 8, 12],
lengths: [16],
code: {
name: 'CVV',
size: 3
}
},
{
title: 'MasterCard',
type: 'MC',
pattern: '^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$',
gaps: [4, 8, 12],
lengths: [16],
code: {
name: 'CVC',
size: 3
}
},
{
title: 'American Express',
type: 'AE',
pattern: '^3([47]\\d*)?$',
isAmex: true,
gaps: [4, 10],
lengths: [15],
code: {
name: 'CID',
size: 4
}
},
{
title: 'Diners',
type: 'DN',
pattern: '^(3(0[0-5]|095|6|[8-9]))\\d*$',
gaps: [4, 10],
lengths: [14, 16, 17, 18, 19],
code: {
name: 'CVV',
size: 3
}
},
{
title: 'Discover',
type: 'DI',
pattern: '^(6011(0|[2-4]|74|7[7-9]|8[6-9]|9)|6(4[4-9]|5))\\d*$',
gaps: [4, 8, 12],
lengths: [16, 17, 18, 19],
code: {
name: 'CID',
size: 3
}
},
{
title: 'JCB',
type: 'JCB',
pattern: '^35(2[8-9]|[3-8])\\d*$',
gaps: [4, 8, 12],
lengths: [16, 17, 18, 19],
code: {
name: 'CVV',
size: 3
}
},
{
title: 'UnionPay',
type: 'UN',
pattern: '^(622(1(2[6-9]|[3-9])|[3-8]|9([[0-1]|2[0-5]))|62[4-6]|628([2-8]))\\d*?$',
gaps: [4, 8, 12],
lengths: [16, 17, 18, 19],
code: {
name: 'CVN',
size: 3
}
},
{
title: 'Maestro International',
type: 'MI',
pattern: '^(5(0|[6-9])|63|67(?!59|6770|6774))\\d*$',
gaps: [4, 8, 12],
lengths: [12, 13, 14, 15, 16, 17, 18, 19],
code: {
name: 'CVC',
size: 3
}
},
{
title: 'Maestro Domestic',
type: 'MD',
pattern: '^6759(?!24|38|40|6[3-9]|70|76)|676770|676774\\d*$',
gaps: [4, 8, 12],
lengths: [12, 13, 14, 15, 16, 17, 18, 19],
code: {
name: 'CVC',
size: 3
}
},
{
title: 'Hipercard',
type: 'HC',
pattern: '^((606282)|(637095)|(637568)|(637599)|(637609)|(637612))\\d*$',
gaps: [4, 8, 12],
lengths: [13, 16],
code: {
name: 'CVC',
size: 3
}
},
{
title: 'Elo',
type: 'ELO',
pattern: '^((509091)|(636368)|(636297)|(504175)|(438935)|(40117[8-9])|(45763[1-2])|' +
'(457393)|(431274)|(50990[0-2])|(5099[7-9][0-9])|(50996[4-9])|(509[1-8][0-9][0-9])|' +
'(5090(0[0-2]|0[4-9]|1[2-9]|[24589][0-9]|3[1-9]|6[0-46-9]|7[0-24-9]))|' +
'(5067(0[0-24-8]|1[0-24-9]|2[014-9]|3[0-379]|4[0-9]|5[0-3]|6[0-5]|7[0-8]))|' +
'(6504(0[5-9]|1[0-9]|2[0-9]|3[0-9]))|' +
'(6504(8[5-9]|9[0-9])|6505(0[0-9]|1[0-9]|2[0-9]|3[0-8]))|' +
'(6505(4[1-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-8]))|' +
'(6507(0[0-9]|1[0-8]))|(65072[0-7])|(6509(0[1-9]|1[0-9]|20))|' +
'(6516(5[2-9]|6[0-9]|7[0-9]))|(6550(0[0-9]|1[0-9]))|' +
'(6550(2[1-9]|3[0-9]|4[0-9]|5[0-8])))\\d*$',
gaps: [4, 8, 12],
lengths: [16],
code: {
name: 'CVC',
size: 3
}
},
{
title: 'Aura',
type: 'AU',
pattern: '^5078\\d*$',
gaps: [4, 8, 12],
lengths: [19],
code: {
name: 'CVC',
size: 3
}
}
];
return {
/**
* #param {*} cardNumber
* #return {Array}
*/
getCardTypes: function (cardNumber) {
var i, value,
result = [];
if (utils.isEmpty(cardNumber)) {
return result;
}
if (cardNumber === '') {
return $.extend(true, {}, types);
}
for (i = 0; i < types.length; i++) {
value = types[i];

Related

page length not showing after adding export option in DataTables Library

page length not showing after adding export option in DataTables Library.
dom: 'Bfrtip',
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]], // page length options
buttons: [
{
extend: 'copy',
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
}
},
https://nimb.ws/OlUrQ6
Bfrtip to lBfrtip
dom: 'lBfrtip',
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]], // page length options
buttons: [
{
extend: 'copy',
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
}
},

How to allow Duplicate Tick Labels in Plotly?

I observed that while providing duplicate ticklabels (with an aim to mention the class of categorical variable), plotly creates a unique set and displays only the non-repeated tick labels. Is there a way to by-pass this feature and allow duplicate tick-labels?
var data = [
{
z: [[1, 20, 30, 50, 1], [20, 1, 60, 80, 30], [30, 60, 1, -10, 20]],
x: ['Healthy', 'Healthy', 'Moderate', 'Diseased', 'Diseased'],
y: ['Morning', 'Afternoon', 'Evening'],
type: 'heatmap'
}
];
Plotly.newPlot('myDiv', data);
Following is the jsfiddle depicting the issue:
https://jsfiddle.net/mam8sgwx/
Set the layout with ticktext:
var layout = {
xaxis: {
tickmode: "array",
ticktext: ['Healthy', 'Healthy', 'Moderate', 'Diseased', 'Diseased'],
tickvals: [0, 1, 2, 3, 4]
}
}
Here is the demo:
var data = [{
z: [
[1, 20, 30, 50, 1],
[20, 1, 60, 80, 30],
[30, 60, 1, -10, 20]
],
y: ['Morning', 'Afternoon', 'Evening'],
type: 'heatmap'
}];
var layout = {
xaxis: {
tickmode: "array",
ticktext: ['Healthy', 'Healthy', 'Moderate', 'Diseased', 'Diseased'],
tickvals: [0, 1, 2, 3, 4]
}
}
Plotly.newPlot('myDiv', data, layout);
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<body>
<div id="myDiv"></div>

kendo chart categoryAxis

I`m beginner using kendo stacked chart.
this is my categoryAxis.
categoryAxis: {
categories: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
majorGridLines: {
visible: true
},
visible: true
},
chartArea: {
height : 200
},
tooltip: {
visible: true,
format: "{0}",
template: "#= series.name #: #= value #",
color: "white"
}
but, 0 index tooltip shows 'd'.
what is the problem ?
tooltip image
From your image you are using a shared tooltip, so try defining your tooltip like this:
tooltip: {
visible: true,
sharedTemplate: "<div>#: category #</div> # for (var i = 0; i < points.length; i++) { # <div>#: points[i].series.name# : #: points[i].value #</div> # } #",
color: "white",
shared: true
}

RethinkDB: How to get data from dictionary field and transform them to lists

I have objects that have a following structure:
[
{
'record': 1,
'tags': [1, 2],
'data': {
'1': 10,
'2': 15
}
},
...
{
'record': 1,
'tags': [3, 4, 5],
'data': {
'1': 100,
'2': 150
}
}
]
How can I get distinct lists of data: [10, ..., 100] and [15, ..., 150] to process each of them?
Thanks
If all data have same key, I proposed this map-reduce process.
.map(function(doc) {
return doc('data').keys().map(function(key) {
return [key, [doc('data')(key)]]
}).coerceTo('object')
})
.reduce(function(left, right) {
return left.keys().map(function(key) {
return [key, left(key).setUnion(right(key))]
})
.coerceTo('object')
})
With your data set, we have:
r.expr(
[
{
'record': 1,
'tags': [1, 2],
'data': {
'1': 10,
'2': 15
}
},
{
'record': 1,
'tags': [1, 2],
'data': {
'1': 19,
'2': 100
}
},
{
'record': 1,
'tags': [3, 4, 5],
'data': {
'1': 100,
'2': 150
}
}
]
)
.map(function(doc) {
return doc('data').keys().map(function(key) {
return [key, [doc('data')(key)]]
}).coerceTo('object')
})
.reduce(function(left, right) {
return left.keys().map(function(key) {
return [key, left(key).setUnion(right(key))]
})
.coerceTo('object')
})
Which produces:
{
"1": [10, 19, 100],
"2": [15, 100, 150]
}
You can call values on an object to get an array of values from it: https://www.rethinkdb.com/api/javascript/#values
If not all of the indexes are present as keys, you could write something like r.range(obj.keys().max()).map(function(i) { return obj(i.coerceTo('string')).default(nil); }).
If the data fields could be any string, something like this could work:
r.db('test')
.table('test')
.getAll(1, {index: 'record'})
.getField('data')
.concatMap(r.row.coerceTo('array'))
.group(r.row(0))
.concatMap([r.row(1)])
.ungroup()
Otherwise, mlucy's suggestion might be used to make it more efficient.
EDIT: on further experimentation, I could not get obj.keys() to be faster than group.

How to create a 3D matrix of values in VB.NET?

In 2D I write:
Dim matr2D(,) As Integer = { {10, 20, 30}, {11, 21, 31}, {12, 22, 32} }.
In 3D?
Found:
Dim matr3D(, ,) As Integer = { { { 1, 2, 3 }, { 4, 5, 6 } }, { { 7, 8, 9 }, { 10, 11, 12 } } }
https://msdn.microsoft.com/it-it/library/2yd9wwz4.aspx

Resources