problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
How to access "this" inside a parametic function on addevent listerner : I have been trying to access the "cloneN.querySelector('.defaultDBIcon')" element(div element) inside a function "makeD". I want to send two parameters for the function. Any idea how should I access this function?
cloneN.querySelector('.def').addEventListener("click",makeD(response,this));
#javascript | 0debug |
fdctrl_t *sun4m_fdctrl_init (qemu_irq irq, target_phys_addr_t io_base,
BlockDriverState **fds)
{
fdctrl_t *fdctrl;
fdctrl = fdctrl_init(irq, 0, 1, io_base, fds);
fdctrl->sun4m = 1;
return fdctrl;
}
| 1threat |
static void utf8_string(void)
{
static const struct {
const char *json_in;
const char *utf8_out;
const char *json_out;
const char *utf8_in;
} test_cases[] = {
{
"\"Falsches \xC3\x9C" "ben von Xylophonmusik qu\xC3\xA4lt"
" jeden gr\xC3\xB6\xC3\x9F" "eren Zwerg.\"",
"Falsches \xC3\x9C" "ben von Xylophonmusik qu\xC3\xA4lt"
" jeden gr\xC3\xB6\xC3\x9F" "eren Zwerg.",
"\"Falsches \\u00DCben von Xylophonmusik qu\\u00E4lt"
" jeden gr\\u00F6\\u00DFeren Zwerg.\"",
},
{
"\"\xCE\xBA\xE1\xBD\xB9\xCF\x83\xCE\xBC\xCE\xB5\"",
"\xCE\xBA\xE1\xBD\xB9\xCF\x83\xCE\xBC\xCE\xB5",
"\"\\u03BA\\u1F79\\u03C3\\u03BC\\u03B5\"",
},
{
"\"\\u0000\"",
"",
"\"\"",
},
{
"\"\xC2\x80\"",
"\xC2\x80",
"\"\\u0080\"",
},
{
"\"\xE0\xA0\x80\"",
"\xE0\xA0\x80",
"\"\\u0800\"",
},
{
"\"\xF0\x90\x80\x80\"",
"\xF0\x90\x80\x80",
"\"\\u0400\\uFFFF\"",
},
{
"\"\xF8\x88\x80\x80\x80\"",
NULL,
"\"\\u8200\\uFFFF\\uFFFF\"",
"\xF8\x88\x80\x80\x80",
},
{
"\"\xFC\x84\x80\x80\x80\x80\"",
NULL,
"\"\\uC100\\uFFFF\\uFFFF\\uFFFF\"",
"\xFC\x84\x80\x80\x80\x80",
},
{
"\"\x7F\"",
"\x7F",
"\"\177\"",
},
{
"\"\xDF\xBF\"",
"\xDF\xBF",
"\"\\u07FF\"",
},
{
"\"\xEF\xBF\xBF\"",
"\xEF\xBF\xBF",
"\"\\uFFFF\"",
},
{
"\"\xF7\xBF\xBF\xBF\"",
NULL,
"\"\\u7FFF\\uFFFF\"",
"\xF7\xBF\xBF\xBF",
},
{
"\"\xFB\xBF\xBF\xBF\xBF\"",
NULL,
"\"\\uBFFF\\uFFFF\\uFFFF\"",
"\xFB\xBF\xBF\xBF\xBF",
},
{
"\"\xFD\xBF\xBF\xBF\xBF\xBF\"",
NULL,
"\"\\uDFFF\\uFFFF\\uFFFF\\uFFFF\"",
"\xFD\xBF\xBF\xBF\xBF\xBF",
},
{
"\"\xED\x9F\xBF\"",
"\xED\x9F\xBF",
"\"\\uD7FF\"",
},
{
"\"\xEE\x80\x80\"",
"\xEE\x80\x80",
"\"\\uE000\"",
},
{
"\"\xEF\xBF\xBD\"",
"\xEF\xBF\xBD",
"\"\\uFFFD\"",
},
{
"\"\xF4\x8F\xBF\xBF\"",
"\xF4\x8F\xBF\xBF",
"\"\\u43FF\\uFFFF\"",
},
{
"\"\xF4\x90\x80\x80\"",
"\xF4\x90\x80\x80",
"\"\\u4400\\uFFFF\"",
},
{
"\"\x80\"",
"\x80",
"\"\\uFFFF\"",
},
{
"\"\xBF\"",
"\xBF",
"\"\\uFFFF\"",
},
{
"\"\x80\xBF\"",
"\x80\xBF",
"\"\\uFFFF\\uFFFF\"",
},
{
"\"\x80\xBF\x80\"",
"\x80\xBF\x80",
"\"\\uFFFF\\uFFFF\\uFFFF\"",
},
{
"\"\x80\xBF\x80\xBF\"",
"\x80\xBF\x80\xBF",
"\"\\uFFFF\\uFFFF\\uFFFF\\uFFFF\"",
},
{
"\"\x80\xBF\x80\xBF\x80\"",
"\x80\xBF\x80\xBF\x80",
"\"\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\"",
},
{
"\"\x80\xBF\x80\xBF\x80\xBF\"",
"\x80\xBF\x80\xBF\x80\xBF",
"\"\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\"",
},
{
"\"\x80\xBF\x80\xBF\x80\xBF\x80\"",
"\x80\xBF\x80\xBF\x80\xBF\x80",
"\"\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\"",
},
{
"\"\x80\x81\x82\x83\x84\x85\x86\x87"
"\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F"
"\x90\x91\x92\x93\x94\x95\x96\x97"
"\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F"
"\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7"
"\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF"
"\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7"
"\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\"",
"\x80\x81\x82\x83\x84\x85\x86\x87"
"\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F"
"\x90\x91\x92\x93\x94\x95\x96\x97"
"\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F"
"\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7"
"\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF"
"\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7"
"\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF",
"\"\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF"
"\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF"
"\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF"
"\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF"
"\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF"
"\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF"
"\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF"
"\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\\uFFFF\""
},
{
"\"\xC0 \xC1 \xC2 \xC3 \xC4 \xC5 \xC6 \xC7 "
"\xC8 \xC9 \xCA \xCB \xCC \xCD \xCE \xCF "
"\xD0 \xD1 \xD2 \xD3 \xD4 \xD5 \xD6 \xD7 "
"\xD8 \xD9 \xDA \xDB \xDC \xDD \xDE \xDF \"",
NULL,
"\"\\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF "
"\\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF "
"\\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF "
"\\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \"",
"\xC0 \xC1 \xC2 \xC3 \xC4 \xC5 \xC6 \xC7 "
"\xC8 \xC9 \xCA \xCB \xCC \xCD \xCE \xCF "
"\xD0 \xD1 \xD2 \xD3 \xD4 \xD5 \xD6 \xD7 "
"\xD8 \xD9 \xDA \xDB \xDC \xDD \xDE \xDF ",
},
{
"\"\xE0 \xE1 \xE2 \xE3 \xE4 \xE5 \xE6 \xE7 "
"\xE8 \xE9 \xEA \xEB \xEC \xED \xEE \xEF \"",
"\xE0 \xE1 \xE2 \xE3 \xE4 \xE5 \xE6 \xE7 "
"\xE8 \xE9 \xEA \xEB \xEC \xED \xEE \xEF ",
"\"\\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF "
"\\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \"",
},
{
"\"\xF0 \xF1 \xF2 \xF3 \xF4 \xF5 \xF6 \xF7 \"",
NULL,
"\"\\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \\uFFFF \"",
"\xF0 \xF1 \xF2 \xF3 \xF4 \xF5 \xF6 \xF7 ",
},
{
"\"\xF8 \xF9 \xFA \xFB \"",
NULL,
"\"\\uFFFF \\uFFFF \\uFFFF \\uFFFF \"",
"\xF8 \xF9 \xFA \xFB ",
},
{
"\"\xFC \xFD \"",
NULL,
"\"\\uFFFF \\uFFFF \"",
"\xFC \xFD ",
},
{
"\"\xC0\"",
NULL,
"\"\\uFFFF\"",
"\xC0",
},
{
"\"\xE0\x80\"",
"\xE0\x80",
"\"\\uFFFF\\uFFFF\"",
},
{
"\"\xF0\x80\x80\"",
"\xF0\x80\x80",
"\"\\u0000\"",
},
{
"\"\xF8\x80\x80\x80\"",
NULL,
"\"\\u8000\\uFFFF\"",
"\xF8\x80\x80\x80",
},
{
"\"\xFC\x80\x80\x80\x80\"",
NULL,
"\"\\uC000\\uFFFF\\uFFFF\"",
"\xFC\x80\x80\x80\x80",
},
{
"\"\xDF\"",
"\xDF",
"\"\\uFFFF\"",
},
{
"\"\xEF\xBF\"",
"\xEF\xBF",
"\"\\uFFFF\\uFFFF\"",
},
{
"\"\xF7\xBF\xBF\"",
NULL,
"\"\\u7FFF\"",
"\xF7\xBF\xBF",
},
{
"\"\xFB\xBF\xBF\xBF\"",
NULL,
"\"\\uBFFF\\uFFFF\"",
"\xFB\xBF\xBF\xBF",
},
{
"\"\xFD\xBF\xBF\xBF\xBF\"",
NULL,
"\"\\uDFFF\\uFFFF\\uFFFF\"",
"\xFD\xBF\xBF\xBF\xBF",
},
{
"\"\xC0\xE0\x80\xF0\x80\x80\xF8\x80\x80\x80\xFC\x80\x80\x80\x80"
"\xDF\xEF\xBF\xF7\xBF\xBF\xFB\xBF\xBF\xBF\xFD\xBF\xBF\xBF\xBF\"",
NULL,
"\"\\u0020\\uFFFF\\u0000\\u8000\\uFFFF\\uC000\\uFFFF\\uFFFF"
"\\u07EF\\uFFFF\\u7FFF\\uBFFF\\uFFFF\\uDFFF\\uFFFF\\uFFFF\"",
"\xC0\xE0\x80\xF0\x80\x80\xF8\x80\x80\x80\xFC\x80\x80\x80\x80"
"\xDF\xEF\xBF\xF7\xBF\xBF\xFB\xBF\xBF\xBF\xFD\xBF\xBF\xBF\xBF",
},
{
"\"\xFE\"",
NULL,
"\"\\uFFFF\"",
"\xFE",
},
{
"\"\xFF\"",
NULL,
"\"\\uFFFF\"",
"\xFF",
},
{
"\"\xFE\xFE\xFF\xFF\"",
NULL,
"\"\\uEFBF\\uFFFF\"",
"\xFE\xFE\xFF\xFF",
},
{
"\"\xC0\xAF\"",
NULL,
"\"\\u002F\"",
"\xC0\xAF",
},
{
"\"\xE0\x80\xAF\"",
"\xE0\x80\xAF",
"\"\\u002F\"",
},
{
"\"\xF0\x80\x80\xAF\"",
"\xF0\x80\x80\xAF",
"\"\\u0000\\uFFFF\""
},
{
"\"\xF8\x80\x80\x80\xAF\"",
NULL,
"\"\\u8000\\uFFFF\\uFFFF\"",
"\xF8\x80\x80\x80\xAF",
},
{
"\"\xFC\x80\x80\x80\x80\xAF\"",
NULL,
"\"\\uC000\\uFFFF\\uFFFF\\uFFFF\"",
"\xFC\x80\x80\x80\x80\xAF",
},
{
"\"\xC1\xBF\"",
NULL,
"\"\\u007F\"",
"\xC1\xBF",
},
{
"\"\xE0\x9F\xBF\"",
"\xE0\x9F\xBF",
"\"\\u07FF\"",
},
{
"\"\xF0\x8F\xBF\xBF\"",
"\xF0\x8F\xBF\xBF",
"\"\\u03FF\\uFFFF\"",
},
{
"\"\xF8\x87\xBF\xBF\xBF\"",
NULL,
"\"\\u81FF\\uFFFF\\uFFFF\"",
"\xF8\x87\xBF\xBF\xBF",
},
{
"\"\xFC\x83\xBF\xBF\xBF\xBF\"",
NULL,
"\"\\uC0FF\\uFFFF\\uFFFF\\uFFFF\"",
"\xFC\x83\xBF\xBF\xBF\xBF",
},
{
"\"\xC0\x80\"",
NULL,
"\"\\u0000\"",
"\xC0\x80",
},
{
"\"\xE0\x80\x80\"",
"\xE0\x80\x80",
"\"\\u0000\"",
},
{
"\"\xF0\x80\x80\x80\"",
"\xF0\x80\x80\x80",
"\"\\u0000\\uFFFF\"",
},
{
"\"\xF8\x80\x80\x80\x80\"",
NULL,
"\"\\u8000\\uFFFF\\uFFFF\"",
"\xF8\x80\x80\x80\x80",
},
{
"\"\xFC\x80\x80\x80\x80\x80\"",
NULL,
"\"\\uC000\\uFFFF\\uFFFF\\uFFFF\"",
"\xFC\x80\x80\x80\x80\x80",
},
{
"\"\xED\xA0\x80\"",
"\xED\xA0\x80",
"\"\\uD800\"",
},
{
"\"\xED\xAD\xBF\"",
"\xED\xAD\xBF",
"\"\\uDB7F\"",
},
{
"\"\xED\xAE\x80\"",
"\xED\xAE\x80",
"\"\\uDB80\"",
},
{
"\"\xED\xAF\xBF\"",
"\xED\xAF\xBF",
"\"\\uDBFF\"",
},
{
"\"\xED\xB0\x80\"",
"\xED\xB0\x80",
"\"\\uDC00\"",
},
{
"\"\xED\xBE\x80\"",
"\xED\xBE\x80",
"\"\\uDF80\"",
},
{
"\"\xED\xBF\xBF\"",
"\xED\xBF\xBF",
"\"\\uDFFF\"",
},
{
"\"\xED\xA0\x80\xED\xB0\x80\"",
"\xED\xA0\x80\xED\xB0\x80",
"\"\\uD800\\uDC00\"",
},
{
"\"\xED\xA0\x80\xED\xBF\xBF\"",
"\xED\xA0\x80\xED\xBF\xBF",
"\"\\uD800\\uDFFF\"",
},
{
"\"\xED\xAD\xBF\xED\xB0\x80\"",
"\xED\xAD\xBF\xED\xB0\x80",
"\"\\uDB7F\\uDC00\"",
},
{
"\"\xED\xAD\xBF\xED\xBF\xBF\"",
"\xED\xAD\xBF\xED\xBF\xBF",
"\"\\uDB7F\\uDFFF\"",
},
{
"\"\xED\xAE\x80\xED\xB0\x80\"",
"\xED\xAE\x80\xED\xB0\x80",
"\"\\uDB80\\uDC00\"",
},
{
"\"\xED\xAE\x80\xED\xBF\xBF\"",
"\xED\xAE\x80\xED\xBF\xBF",
"\"\\uDB80\\uDFFF\"",
},
{
"\"\xED\xAF\xBF\xED\xB0\x80\"",
"\xED\xAF\xBF\xED\xB0\x80",
"\"\\uDBFF\\uDC00\"",
},
{
"\"\xED\xAF\xBF\xED\xBF\xBF\"",
"\xED\xAF\xBF\xED\xBF\xBF",
"\"\\uDBFF\\uDFFF\"",
},
{
"\"\xEF\xBF\xBE\"",
"\xEF\xBF\xBE",
"\"\\uFFFE\"",
},
{
"\"\xEF\xBF\xBF\"",
"\xEF\xBF\xBF",
"\"\\uFFFF\"",
},
{}
};
int i;
QObject *obj;
QString *str;
const char *json_in, *utf8_out, *utf8_in, *json_out;
for (i = 0; test_cases[i].json_in; i++) {
json_in = test_cases[i].json_in;
utf8_out = test_cases[i].utf8_out;
utf8_in = test_cases[i].utf8_in ?: test_cases[i].utf8_out;
json_out = test_cases[i].json_out ?: test_cases[i].json_in;
obj = qobject_from_json(json_in);
if (utf8_out) {
g_assert(obj);
g_assert(qobject_type(obj) == QTYPE_QSTRING);
str = qobject_to_qstring(obj);
g_assert_cmpstr(qstring_get_str(str), ==, utf8_out);
} else {
g_assert(!obj);
}
qobject_decref(obj);
obj = QOBJECT(qstring_from_str(utf8_in));
str = qobject_to_json(obj);
if (json_out) {
g_assert(str);
g_assert_cmpstr(qstring_get_str(str), ==, json_out);
} else {
g_assert(!str);
}
QDECREF(str);
qobject_decref(obj);
if (0 && json_out != json_in) {
obj = qobject_from_json(json_out);
g_assert(obj);
g_assert(qobject_type(obj) == QTYPE_QSTRING);
str = qobject_to_qstring(obj);
g_assert_cmpstr(qstring_get_str(str), ==, utf8_out);
}
}
}
| 1threat |
When I install twisted, it miss some mudule : I install twisted with pip, but it miss the _win32stdio.py and _pollingfile.py.
So I copy it into my dir. But I don't why? | 0debug |
static int receive_filter(VirtIONet *n, const uint8_t *buf, int size)
{
static const uint8_t bcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
static const uint8_t vlan[] = {0x81, 0x00};
uint8_t *ptr = (uint8_t *)buf;
int i;
if (n->promisc)
return 1;
if (!memcmp(&ptr[12], vlan, sizeof(vlan))) {
int vid = be16_to_cpup((uint16_t *)(ptr + 14)) & 0xfff;
if (!(n->vlans[vid >> 5] & (1U << (vid & 0x1f))))
return 0;
}
if (ptr[0] & 1) {
if (!memcmp(ptr, bcast, sizeof(bcast))) {
return 1;
} else if (n->allmulti) {
return 1;
}
} else {
if (!memcmp(ptr, n->mac, ETH_ALEN)) {
return 1;
}
}
for (i = 0; i < n->mac_table.in_use; i++) {
if (!memcmp(ptr, &n->mac_table.macs[i * ETH_ALEN], ETH_ALEN))
return 1;
}
return 0;
}
| 1threat |
Is there a universally accepted value for a (float) NAN : <p>Is a (float) #NAN ("Not A Number") universally assigned the value of 0x7F A0 00 00 or is it different with different compilers?</p>
| 0debug |
Data not updating in mysql table when using PDO UPDATE : <p>I think I have all the syntax correct here but for some reason my table will not update when this code is executed. Does anyone know why? </p>
<p>Here is the code of my php page:</p>
<pre><code><?php
include_once("connexionMysql.php");
if(isset($_GET['valider'])){
$titreIci=$_GET['titre'];
$idIci=(int)$_GET['id'];
$preparedStatement = $bdd->prepare("UPDATE AY_albums SET titre=':titreIci' WHERE id=':idIci'");
$preparedStatement->bindValue(':titreIci', $titreIci);
$preparedStatement->bindValue(':idIci', $idIci);
$preparedStatement->execute();
}
header("Location: pageDaccueilAdmin.php");
?>
</code></pre>
| 0debug |
How can i solve this issue "show product quantity in stock respect to size" in WooCommerce : <p>i have install <strong>woocommerce plugin</strong> and wanted to show product quantity with respect to size in this way on product page like <strong>large:15 and small:13 in stock</strong>
wordpress version is 4.4.2
so please guide me how can i do this</p>
| 0debug |
Python3: How to make dictionary from list using 'dict' and 'zip'? : <p>I'm learning Python3. I can't solve a problem... Please help me.
I could <strong>input 2 different strings</strong>(One is consisted with <strong>string</strong> another is consisted with <strong>float</strong>).
I'd like to make a dictionary from 2 different lists.
I made first one for <strong>key</strong>, another is for <strong>value</strong>.</p>
<pre><code>input1 = list(map(str, input().split()))
input2 = list(map(float, input().split()))
# output = dict(zip(input1), (input2))
output = dict((input1, input2) for (input1[i], input2[i]) in range(0, len(input2)))
print(output)
</code></pre>
<p><em>Don't care too much that comment(#)</em>
I found a post may help my probelm from stack overflow.
<a href="https://stackoverflow.com/questions/1747817/create-a-dictionary-with-list-comprehension-in-python">Create a dictionary with list comprehension in Python</a></p>
<p>I did my best but I coudn't solve this...(New one below # comment, It is what I tried to reading that post)</p>
<p>Thanks to read my question!</p>
| 0debug |
How to see few fields in the view but later clicking on the record should show all fields : My HANA table consists of 20 fields but I want my view to display only 5 fields for each record in my browser through an xml view.But again, when I click on the particular row on browser, I should be able to see all 20 field for that record.How will that be possible? Please help | 0debug |
How to create a Window Message in C# : For JavaScript, to create a window alert, the code is window.alert("..."), but what is the code for this in C#? I thought it was MessageBox.Show("..."), but it isn't. Please and thank you. | 0debug |
import re
regex = '''^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(
25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(
25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(
25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)$'''
def check_IP(Ip):
if(re.search(regex, Ip)):
return ("Valid IP address")
else:
return ("Invalid IP address") | 0debug |
static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, int discard) {
AviSynthContext *avs = s->priv_data;
AVS_VideoFrame *frame;
unsigned char *dst_p;
const unsigned char *src_p;
int n, i, plane, rowsize, planeheight, pitch, bits;
const char *error;
if (avs->curr_frame >= avs->vi->num_frames)
return AVERROR_EOF;
n = avs->curr_frame++;
if (discard)
return 0;
pkt->pts = n;
pkt->dts = n;
pkt->duration = 1;
if (avs_is_yv24(avs->vi)) {
bits = 24;
} else if (avs_is_yv16(avs->vi)) {
bits = 16;
} else if (avs_is_yv411(avs->vi)) {
bits = 12;
} else if (avs_is_y8(avs->vi)) {
bits = 8;
bits = avs_bits_per_pixel(avs->vi);
pkt->size = (((int64_t)avs->vi->width * (int64_t)avs->vi->height) * bits) / 8;
if (!pkt->size)
pkt->data = av_malloc(pkt->size);
if (!pkt->data)
frame = avs_library->avs_get_frame(avs->clip, n);
error = avs_library->avs_clip_get_error(avs->clip);
if (error) {
av_log(s, AV_LOG_ERROR, "%s\n", error);
dst_p = pkt->data;
for (i = 0; i < avs->n_planes; i++) {
plane = avs->planes[i];
src_p = avs_get_read_ptr_p(frame, plane);
rowsize = avs_get_row_size_p(frame, plane);
planeheight = avs_get_height_p(frame, plane);
pitch = avs_get_pitch_p(frame, plane);
if (avs_is_rgb24(avs->vi) || avs_is_rgb(avs->vi)) {
src_p = src_p + (planeheight - 1) * pitch;
pitch = -pitch;
dst_p += rowsize * planeheight;
avs_library->avs_release_video_frame(frame);
return 0;
| 1threat |
av_cold void ff_vorbisdsp_init_x86(VorbisDSPContext *dsp)
{
#if HAVE_YASM
int cpu_flags = av_get_cpu_flags();
#if ARCH_X86_32
if (cpu_flags & AV_CPU_FLAG_3DNOW)
dsp->vorbis_inverse_coupling = ff_vorbis_inverse_coupling_3dnow;
#endif
if (cpu_flags & AV_CPU_FLAG_SSE)
dsp->vorbis_inverse_coupling = ff_vorbis_inverse_coupling_sse;
#endif
}
| 1threat |
keytool error: java.lang.Exception: Only one command is allowed: both -exportcert and -list were specified : <pre><code>Book-Pro:main vy$ keytool -exportcert -list -v \
> -alias androiddebugkey -keystore ~/.android/debug.keystore
keytool error: java.lang.Exception: Only one command is allowed: both
-exportcert and -list were specified.
</code></pre>
<p>I am trying to create a SHA1 on MBP for an android Firebase project.
I pull the command from the Firebase console as described...
<a href="https://developers.google.com/android/guides/client-auth" rel="noreferrer">https://developers.google.com/android/guides/client-auth</a></p>
<p>keytool -exportcert -list -v \
-alias androiddebugkey -keystore ~/.android/debug.keystore</p>
<p>and I get an error.
keytool error: java.lang.Exception: Only one command is allowed: both
-exportcert and -list were specified.</p>
<p>I have tried hand typing this thinking that perhaps there is a problem with the browser. I installed new JDK... not sure what is going wrong here. assistance please</p>
| 0debug |
why target is not working here : first i make index page containing frame and i name the all frame as nasa google you tube etc .
then on search page
<input id="main_category_lan1" value="test" />
<a href="javascript: void(0)" onmouseover="window.open('http://nasasearch.nasa.gov/search?utf8=%E2%9C%93&affiliate=nasa&query='+document.getElementById('main_category_lan1').value)",target="nasa" >s</a>
<a href="javascript: void(0)" onmouseover="window.open('https://www.youtube.com/results?search_query=lecture '+document.getElementById('main_category_lan1').value)",target="google" >e</a>
but this is not working ,every time it open in new tab ,also i want to open both the pages bye a single button .
what should i do ?
thank you | 0debug |
uint64_t helper_tick_get_count(void *opaque)
{
#if !defined(CONFIG_USER_ONLY)
return cpu_tick_get_count(opaque);
#else
return 0;
#endif
}
| 1threat |
static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int elementid,
unsigned int uid, ebml_master *tags)
{
MatroskaMuxContext *mkv = s->priv_data;
ebml_master tag, targets;
AVDictionaryEntry *t = NULL;
int ret;
if (!tags->pos) {
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, avio_tell(s->pb));
if (ret < 0) return ret;
*tags = start_ebml_master(s->pb, MATROSKA_ID_TAGS, 0);
}
tag = start_ebml_master(s->pb, MATROSKA_ID_TAG, 0);
targets = start_ebml_master(s->pb, MATROSKA_ID_TAGTARGETS, 0);
if (elementid)
put_ebml_uint(s->pb, elementid, uid);
end_ebml_master(s->pb, targets);
while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX)))
if (av_strcasecmp(t->key, "title") &&
av_strcasecmp(t->key, "encoding_tool"))
mkv_write_simpletag(s->pb, t);
end_ebml_master(s->pb, tag);
return 0;
}
| 1threat |
How to fix declare var error: unexpected token on typescript : <p>I'm trying to call an imported function in the JS file (see src="https://cdns.gigya.com/JS/gigya.js?apiKey=3_sVidf29tz") from the ts file by using "declare var gigya;" but I get an error: unexpected token</p>
<p>What am I missing?</p>
<p><strong>My code:</strong>
JS login.component.html</p>
<pre><code><body onload="callScreenSet()">
<div id="screen-set"></div>
</body>
</code></pre>
<p>index.html</p>
<pre><code><!doctype html>
<html>
<head>
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0">
<title>LanguageApp</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href="/styles.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" lang="javascript" src="https://cdns.gigya.com/JS/gigya.js?apiKey=3_sVidf29tz"></script>
</head>
<body>
<app-root>Loading...</app-root>
</body>
</html>
</code></pre>
<p>login.component.ts</p>
<pre><code>import { Component, OnInit, AfterContentInit } from '@angular/core';
import any = jasmine.any;
@Component({
selector: 'app-root',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
declare var gigya;
export class LoginComponent implements OnInit {
private _screenSet: string = 'Default-RegistrationLogin';
private _containerID:string = 'screenSet';
constructor(private srvLogin: LoginService) {}
ngOnInit() {}
public callScreenSet():void
{
gigya.accounts.showScreenSet({screenSet: this._screenSet,containerID: this._containerID});
}
}
</code></pre>
<p>package.json</p>
<pre><code>{
"name": "language-app",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/router": "3.2.1",
"auth0-lock": "^10.14.0",
"core-js": "^2.4.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
},
"devDependencies": {
"@angular/compiler-cli": "2.2.1",
"@types/jasmine": "2.5.38",
"@types/lodash": "4.14.50",
"@types/node": "^6.0.70",
"angular-cli": "1.0.0-beta.21",
"codelyzer": "~1.0.0-beta.3",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.9",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "~2.0.3",
"webdriver-manager": "10.2.5"
}
}
</code></pre>
<p>Thanks</p>
| 0debug |
How does git flow handle hotfix to older release or point release of older release : <p>How does git flow handle a hotfix after master has move far beyond that release?</p>
<p><strong>Scenario</strong></p>
<ol>
<li>Work for 1.0 performed on develop, stabilized on releases/v1.0 release branch and pushed to master in fast-forward merge with tag v1.0 pointing to tip of master and tip of stabilization branch</li>
<li>Releases 1.1 - 3.2 take place in much the same fashion.</li>
<li><p>We need to hotfix a bug in 1.0</p>
<ul>
<li>branch from v1.0 tag</li>
<li>perform fix</li>
<li>merge to where? </li>
</ul></li>
</ol>
<p>Master is far in the future and any merge wouldn't be a fast forward and for fun, let's say would conflict.</p>
<p>Would I merge to release stabilization branch and make new tag? Is that what subsequent hotfixes would use as their starting point?</p>
<p><a href="https://i.stack.imgur.com/kF7Uf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/kF7Uf.png" alt="Git Flow Example"></a></p>
| 0debug |
Can't find Android 9.0 (Pie) API 28 ARM System Images : <p>Are there anywhere Android 9.0 (Pie) API 28 ARM System images (ARM, not x86 Intel) for AVD Manager? Thanks.</p>
<p>Unofficial? Beta? Alpha? Any?</p>
| 0debug |
Use vs Import vs Require vs Require-extension in Chicken Scheme : <p>I'm a little hazy on the differences between <code>(use)</code> and <code>(import)</code> in Chicken. Similarly, how do <code>(load)</code>, <code>(require)</code> and <code>(require-extension)</code> differ?</p>
<p>These things don't seem to be mentioned much on the website.</p>
| 0debug |
Why can't I assign a value to the class member variable in a bool function that returns const? C++ : <pre><code>bool Car::isEnoughFuel(int miles) const
{
drivableMiles = fuelGauge.getCurrentFuel() * MPG; // Error here
bool status = true;
if (miles > drivableMiles)
status = false;
return status;
}
</code></pre>
<p>Error: Expression must be a modifiable lvalue.</p>
| 0debug |
static int vsink_query_formats(AVFilterContext *ctx)
{
BufferSinkContext *buf = ctx->priv;
AVFilterFormats *formats = NULL;
unsigned i;
int ret;
CHECK_LIST_SIZE(pixel_fmts)
if (buf->pixel_fmts_size) {
for (i = 0; i < NB_ITEMS(buf->pixel_fmts); i++)
if ((ret = ff_add_format(&formats, buf->pixel_fmts[i])) < 0)
return ret;
ff_set_common_formats(ctx, formats);
} else {
ff_default_query_formats(ctx);
}
return 0;
}
| 1threat |
After Angular 6 update, ng build --prod yields "Error: Expected to find an ngsw-config.json configuration file" : <p>The update went fine, but now when I build, I get the following error.</p>
<blockquote>
<p>Error: Expected to find an ngsw-config.json configuration file in the
/Users/nathanielmay/Code/firebaseTest folder. Either provide one or
disable Service Worker in your angular.json configuration file.</p>
</blockquote>
<p>I looked in my <code>angular.json</code> and found that on this line:</p>
<pre><code>"ngswConfigPath": "/src/ngsw-config.json",
</code></pre>
<blockquote>
<p>Property ngswConfigPath is not allowed.</p>
</blockquote>
<p>I can't find an api for the new angular.json, but it seems as if I need to specify the path in a different way. </p>
<p><code>ng update @angular/pwa</code> didn't work either.</p>
<p>How can I resolve this error?</p>
| 0debug |
how to add a required positional argument to a python file using this code? : this code works great however I am having trouble with the variable called "time". therefor it is throwing an error saying - File "C:\Users\7\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
TypeError: customDraw() missing 1 required positional argument: 'time'
I have tried everyway I could think of to best define time in terms of the code I have for example below
import win32api, win32con, win32gui, win32ui, timer, threading
windowText = 'Ecclesiastes'
hWindow = 0
def main():
hInstance = win32api.GetModuleHandle()
className = 'MyWindowClassName'
wndClass = win32gui.WNDCLASS()
wndClass.style = win32con.CS_HREDRAW | win32con.CS_VREDRAW
wndClass.lpfnWndProc = wndProc
wndClass.hInstance = hInstance
wndClass.hIcon = win32gui.LoadIcon(0, win32con.IDI_APPLICATION)
wndClass.hCursor = win32gui.LoadCursor(None, win32con.IDC_ARROW)
wndClass.hbrBackground = win32gui.GetStockObject(win32con.WHITE_BRUSH)
wndClass.lpszClassName = className
wndClassAtom = win32gui.RegisterClass(wndClass)
exStyle = win32con.WS_EX_COMPOSITED | win32con.WS_EX_LAYERED | win32con.WS_EX_NOACTIVATE | win32con.WS_EX_TOPMOST | win32con.WS_EX_TRANSPARENT
style = win32con.WS_DISABLED | win32con.WS_POPUP | win32con.WS_VISIBLE
hWindow = win32gui.CreateWindowEx(
exStyle,
wndClassAtom,
None,
style,
0, # x
0, # y
win32api.GetSystemMetrics(win32con.SM_CXSCREEN), # width
win32api.GetSystemMetrics(win32con.SM_CYSCREEN), # height
None, # hWndParent
None, # hMenu
hInstance,
None # lpParam
)
win32gui.SetLayeredWindowAttributes(hWindow, 0x00ffffff, 255, win32con.LWA_COLORKEY | win32con.LWA_ALPHA) ####### COLOR
win32gui.SetWindowPos(hWindow, win32con.HWND_TOPMOST, 0, 0, 0, 0,
win32con.SWP_NOACTIVATE | win32con.SWP_NOMOVE | win32con.SWP_NOSIZE | win32con.SWP_SHOWWINDOW)
thr = threading.Thread(target=customDraw, args=(hWindow,))
thr.setDaemon(False)
thr.start()
win32gui.ShowWindow(hWindow, win32con.SW_SHOWNORMAL)
win32gui.UpdateWindow(hWindow)
timer.set_timer(10000, customDraw)
win32gui.PumpMessages()
counter = 0
def customDraw(timer_id, time):
global hWindow
global counter
global windowText
if counter > 1589:
counter = 0
text = ["1:1 The words of the Preacher, the son of David, king in Jerusalem.",
"12:14 For God shall bring every work into judgment, with every secret thing, whether it be good, or whether it be evil. ",]
windowText = text[counter]
counter = counter + 1
win32gui.InvalidateRect(hWindow, None, True)
def wndProc(hWnd, message, wParam, lParam):
if message == win32con.WM_PAINT:
hdc, paintStruct = win32gui.BeginPaint(hWnd)
dpiScale = win32ui.GetDeviceCaps(hdc, win32con.LOGPIXELSX) / 60.0
fontSize = 18
lf = win32gui.LOGFONT()
lf.lfFaceName = "Comic Sans"
lf.lfHeight = int(round(dpiScale * fontSize))
hf = win32gui.CreateFontIndirect(lf)
win32gui.SelectObject(hdc, hf)
rect = win32gui.GetClientRect(hWnd)
win32gui.DrawText(hdc, windowText, -1, rect,
win32con.DT_LEFT | win32con.DT_BOTTOM | win32con.DT_SINGLELINE
)
win32gui.EndPaint(hWnd, paintStruct)
return 0
elif message == win32con.WM_DESTROY:
print('Being destroyed')
win32gui.PostQuitMessage(0)
return 0
else:
return win32gui.DefWindowProc(hWnd, message, wParam, lParam)
calrect = win32gui.DrawText(hdc, text, -1, rect, textformat | win32con.DT_CALCRECT);
rect.top = rect.bottom - calcrect.bottom;
win32gui.DrawText(hDC, text, -1, rect, textformat)
if __name__ == '__main__':
main()
I expected all of this code I have put together would run the file without any errors but I keep getting the following message > Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\7\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "C:\Users\7\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
TypeError: customDraw() missing 1 required positional argument: 'time'
I cannot for the life of me get rid of the error. and the worst part is the error window/terminal must stay open for the code to continue running. I am trying to finish this script without errors so that theres no bugs down the line relating to this bugaboo. but sheesh its killing me. | 0debug |
Returning a promise in an async function in TypeScript : <p>It's my understanding that these two functions will have the same behavior in JavaScript:</p>
<pre><code>const whatever1 = (): Promise<number> => {
return new Promise((resolve) => {
resolve(4);
});
};
const whatever2 = async (): Promise<number> => {
return new Promise((resolve) => {
resolve(4);
});
};
</code></pre>
<p>But TypeScript seems to not like the second one, it says:</p>
<pre><code>Type '{}' is not assignable to type 'number'.
</code></pre>
<p>Is this a bug in TypeScript, or am I misunderstanding something about async functions?</p>
| 0debug |
static unsigned int dec_bound_r(DisasContext *dc)
{
TCGv l0;
int size = memsize_zz(dc);
DIS(fprintf (logfile, "bound.%c $r%u, $r%u\n",
memsize_char(size), dc->op1, dc->op2));
cris_cc_mask(dc, CC_MASK_NZ);
l0 = tcg_temp_local_new(TCG_TYPE_TL);
dec_prep_move_r(dc, dc->op1, dc->op2, size, 0, l0);
cris_alu(dc, CC_OP_BOUND, cpu_R[dc->op2], cpu_R[dc->op2], l0, 4);
tcg_temp_free(l0);
return 2;
}
| 1threat |
static const MemoryRegionPortio *find_portio(MemoryRegion *mr, uint64_t offset,
unsigned width, bool write)
{
const MemoryRegionPortio *mrp;
for (mrp = mr->ops->old_portio; mrp->size; ++mrp) {
if (offset >= mrp->offset && offset < mrp->offset + mrp->len
&& width == mrp->size
&& (write ? (bool)mrp->write : (bool)mrp->read)) {
return mrp;
}
}
return NULL;
}
| 1threat |
how to subtract arrays of integer in ruby : I have got four arrays of int in ruby:
- num_defect[1..10]
- num_fixes[1..10]
- num_blocks[1..10]
- num_ext_defects[1..10]
For a reporting (using chartjs), I want to display the number of open defects, which is num_defects - num_fixes - num_blocks - num_ext_defects
I tried
num_defect.map { |i| i - num_fixes[i] - num_blocks[i] - num_ext_defects[i] }
but ruby does not like it "nil can't be coerced into Fixnum"
Any help greatly appreciated.
Bernhard | 0debug |
Performance and reliability when using multiple Docker containers VS standard Node cluster : <h1>Performance and reliability when using multiple Docker containers VS standard Node cluster</h1>
<p>Hi, I have a question regarding the performance, reliability and growth potential of two setups that I've encountered. I'm far from Docker or cluster expert, so any advise or tip would be really appreciated.</p>
<h2>The app</h2>
<p>Typical <a href="https://meanjs.org/" rel="noreferrer">MEAN stack web application</a> running on <code>Node v6.9.4</code>. Nothing fancy, standard setup.</p>
<h2>The problem and possible solutions that I've found</h2>
<p>a) Standard Linux server with NGINX (reverse proxy) and NodeJS</p>
<p>b) Standard Linux server with NGINX (reverse proxy) and NodeJS
Cluster. <a href="https://nodejs.org/dist/latest-v6.x/docs/api/cluster.html#cluster_cluster" rel="noreferrer">Using Node's Cluster module</a></p>
<p>c) "Dockerized" NodeJS app cloned 3 times (3 containers) using NGINX's load balancer. <a href="http://anandmanisankar.com/posts/docker-container-nginx-node-redis-example/" rel="noreferrer">Credit for the idea goes to Anand Sankar</a></p>
<pre><code>// Example nginx load balance config
server app1:8000 weight=10 max_fails=3 fail_timeout=30s;
server app2:8000 weight=10 max_fails=3 fail_timeout=30s;
server app3:8000 weight=10 max_fails=3 fail_timeout=30s;
// Example docker-compose.yml
version: '2'
services:
nginx:
build: docker/definitions/nginx
links:
- app1:app1
- app2:app2
- app3:app3
ports:
- "80:80"
app1:
build: app/.
app2:
build: app/.
app3:
build: app/.
</code></pre>
<p>d) All together. "Dockerized" NodeJS app (multiple containers) with Cluster configured inside and on top of the 3 containers - NGINX's load balancer.</p>
<p><strong>If I get this correctly, having 3 x NodeJS containers running the app, where each of these app replicas support the NodeJS clustering, should lead to incredible performance.</strong></p>
<p>3 x containers x 4 workers, should mean 12 nodes to handle all requests/responses. If that's correct, the only drawback would be the more powerful, in terms of hardware, machine to support this.</p>
<p>Anyway, my logic may be totally wrong, so I'm <strong>looking for any comments or feedback on that!</strong></p>
<h2>Goal</h2>
<p>My goal is to have production ready, stable environments, which are ready to take some load. We're not speaking about thousands of concurrent connections at the same time, etc. Keeping the infrastructure scalable and flexible is a big "+".</p>
<hr>
<p>Hopefully, the question makes sense. Sorry for the long post, but I wanted to keep it clear. </p>
<p>Thank you!</p>
| 0debug |
why main function run first in c/c++? : <p>Why main() function run first of all then other functions what if we want another function run first then main function in c or c++.
Can anyone explain logic behind it.thanks.</p>
| 0debug |
at ClaudiaYoga.com I get trim() expects parameter 1 to be string, array given in BUT CANNOT EVEN LOGIN : I get the warning on top of the page Warning [ClaudiaYoga.com]
: trim() expects parameter 1 to be string, array given in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php on line 92
But the worst part is **I CANNOT LOGIN!!!**
When I try to login it gives me this:
Warning: trim() expects parameter 1 to be string, array given in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php on line 92
Warning: Cannot modify header information - headers already sent by (output started at /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php:92) in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-login.php on line 387
Warning: Cannot modify header information - headers already sent by (output started at /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php:92) in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-login.php on line 400
Warning: Cannot modify header information - headers already sent by (output started at /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php:92) in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/pluggable.php on line 955
Warning: Cannot modify header information - headers already sent by (output started at /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php:92) in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/pluggable.php on line 956
Warning: Cannot modify header information - headers already sent by (output started at /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php:92) in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/pluggable.php on line 957
Warning: Cannot modify header information - headers already sent by (output started at /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/shortcodes.php:92) in /home/content/p3pnexwpnas08_data03/52/2510952/html/wp-includes/pluggable.php on line 1228 | 0debug |
Less file not found : <p>I am most probably doing something really stupid but I just can't figure it out. It just keeps saying file not found. I tried using crunch and the same error. The file is right there and I am positive the location is right. <a href="https://i.stack.imgur.com/0ivc8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0ivc8.png" alt="enter image description here"></a></p>
| 0debug |
jenkins archive artifacts - what's the format? : <p>I can't seem to figure out how to use the basic archive artifacts statement. What I want is to archive an entire subtree but naming it doesn't seem to work. Nor does directory/** nor directory/**/</p>
<p>I've read the ant doc but it doesn't make much sense to me.</p>
<p>How do I specify a subtree? Or... where can I find a meaningful description of whatever goes in that field?</p>
| 0debug |
static int submit_stats(AVCodecContext *avctx)
{
#ifdef TH_ENCCTL_2PASS_IN
TheoraContext *h = avctx->priv_data;
int bytes;
if (!avctx->stats_in) {
av_log(avctx, AV_LOG_ERROR, "No statsfile for second pass\n");
return AVERROR(EINVAL);
h->stats_size = strlen(avctx->stats_in) * 3/4;
h->stats = av_malloc(h->stats_size);
h->stats_size = av_base64_decode(h->stats, avctx->stats_in, h->stats_size);
while (h->stats_size - h->stats_offset > 0) {
bytes = th_encode_ctl(h->t_state, TH_ENCCTL_2PASS_IN,
h->stats + h->stats_offset,
h->stats_size - h->stats_offset);
if (bytes < 0) {
av_log(avctx, AV_LOG_ERROR, "Error submitting stats\n");
return AVERROR_EXTERNAL;
if (!bytes)
return 0;
h->stats_offset += bytes;
return 0;
#else
av_log(avctx, AV_LOG_ERROR, "libtheora too old to support 2pass\n");
return AVERROR(ENOSUP);
#endif
| 1threat |
Java Method Implementation : <p>I'm required to implement methods into a simple program to familiarize myself with them in Java.</p>
<p>My code so far is:</p>
<pre><code>import java.util.*;
public class Lab5a
{
public static void main(String args[])
{
double[] a = {1, 0, 0};
double[] b = {0, 1, 1};
double[] c = {1, 1, 1};
double[] d = {0, 0, 1};
double ab = Math.sqrt (
(a[0]-b[0])*(a[0]-b[0]) +
(a[1]-b[1])*(a[1]-b[1]) +
(a[2]-b[2])*(a[2]-b[2]) );
double ac = Math.sqrt (
(a[0]-c[0])*(a[0]-c[0]) +
(a[1]-c[1])*(a[1]-c[1]) +
(a[2]-c[2])*(a[2]-c[2]) );
double ad = Math.sqrt (
(a[0]-d[0])*(a[0]-d[0]) +
(a[1]-d[1])*(a[1]-d[1]) +
(a[2]-d[2])*(a[2]-d[2]) );
System.out.println("ab=" + ab + ", ac=" + ac + ", ad=" + ad);
}
}
</code></pre>
<p>And my instructions are to: </p>
<pre><code>Next, copy the class to Lab5b.java, and replace the individual distance calculations by calls to a single
public static method that computes the distance between two points passed in as parameters. Also, implement
the method. Your method should have a signature something like the following:
public static double distance(double[] a, double[] b)
</code></pre>
<p>I am very much new to Java and am struggling to understand what exactly the statement means.</p>
| 0debug |
static int register_insn (opc_handler_t **ppc_opcodes, opcode_t *insn)
{
if (insn->opc2 != 0xFF) {
if (insn->opc3 != 0xFF) {
if (register_dblind_insn(ppc_opcodes, insn->opc1, insn->opc2,
insn->opc3, &insn->handler) < 0)
return -1;
} else {
if (register_ind_insn(ppc_opcodes, insn->opc1,
insn->opc2, &insn->handler) < 0)
return -1;
}
} else {
if (register_direct_insn(ppc_opcodes, insn->opc1, &insn->handler) < 0)
return -1;
}
return 0;
}
| 1threat |
static int udp_write(URLContext *h, const uint8_t *buf, int size)
{
UDPContext *s = h->priv_data;
int ret;
for(;;) {
if (!s->is_connected) {
ret = sendto (s->udp_fd, buf, size, 0,
(struct sockaddr *) &s->dest_addr,
s->dest_addr_len);
} else
ret = send(s->udp_fd, buf, size, 0);
if (ret < 0) {
if (ff_neterrno() != AVERROR(EINTR) &&
ff_neterrno() != AVERROR(EAGAIN))
return ff_neterrno();
} else {
break;
}
}
return size;
}
| 1threat |
Firefox fullscreen video append DOM elements : <p>no matter how I put elements in DOM as an overlay on html5 video (statically or dynamically), those elements in Firefox are not visible, although the z-index is set to 2147483647, opacity 1 and display block.</p>
<p>See 2 similar answers, working in Chrome, but not in FF:</p>
<p><a href="https://stackoverflow.com/questions/16234740/overlay-on-html5-fullscreen-video">Overlay on HTML5 Fullscreen Video</a></p>
<p><a href="https://stackoverflow.com/questions/18578244/displaying-elements-other-than-fullscreen-element-html5-fullscreen-api">Displaying elements other than fullscreen element (HTML5 fullscreen API)</a></p>
| 0debug |
How to detect change in model for input field from directive in angular2 : <p>I have this code for a textarea, it is working great with the ngModel and updating live, however i would like my-custom-directive to know when the model bound to this textarea is changing.</p>
<p>How can i detect a model change for this textarea in the my-custom-directive?</p>
<pre><code> <textarea my-custom-directive class="green" [(ngModel)]="customertext"></textarea>
</code></pre>
| 0debug |
What will be output and explanation? : <p>Below code return boolean false value. Any explanation for this ?</p>
<pre><code>String str = "Bee";
String str2 = "Bee";
System.out.println("==" + str == str2);
</code></pre>
<p>Actual Result : false</p>
| 0debug |
MigrationParameters *qmp_query_migrate_parameters(Error **errp)
{
MigrationParameters *params;
MigrationState *s = migrate_get_current();
params = g_malloc0(sizeof(*params));
params->compress_level = s->parameters.compress_level;
params->compress_threads = s->parameters.compress_threads;
params->decompress_threads = s->parameters.decompress_threads;
params->cpu_throttle_initial = s->parameters.cpu_throttle_initial;
params->cpu_throttle_increment = s->parameters.cpu_throttle_increment;
return params;
} | 1threat |
Question on pytorch super multiple inheritance : I am new to pytorch, and I am really confused about the super function and multiple inheritance.
Here is the toy Code:
```
class A():
def __init__(self):
print('Call class A')
print('Leave class A')
class C(A):
def __init__(self):
print('Call class C')
A.__init__(self)
print('Leave class C')
class D(A):
def __init__(self):
print('Call class D')
#A.__init__(self)
super(D,self).__init__()
print('Leave class D')
class B(A):
def __init__(self):
print('Call class B')
super(B,self).__init__()
print('Leave class B')
class E(C,B,D):
def __init__(self):
print('Call class E')
B.__init__(self)
#C.__init__(self)
#D.__init__(self)
print('Leave class E')
```
Then the output is:
```
Call class E
Call class B
Call class D
Call class A
Leave class A
Leave class D
Leave class B
Leave class E
(<class '__main__.E'>, <class '__main__.C'>, <class '__main__.B'>, <class '__main__.D'>, <class '__main__.A'>, <class 'object'>)
```
where ```__init__``` of Class D is called. However, if I change class E to:
```
class E(B,C,D):
def __init__(self):
print('Call class E')
B.__init__(self)
#C.__init__(self)
#D.__init__(self)
print('Leave class E')
```
where the order of B,C,D is changed, then the output is:
```
Call class E
Call class B
Call class C
Call class A
Leave class A
Leave class C
Leave class B
Leave class E
(<class '__main__.E'>, <class '__main__.B'>, <class '__main__.C'>, <class '__main__.D'>, <class '__main__.A'>, <class 'object'>)
```
then the ```__init__``` of class D will not be called, but class C's, although class does not use ```super``` function.
Does someone know:
1. In the first code, why ```__init__``` of class D is also called?
2. In the second code, why ```__init__``` of class C is called and ```__init__``` of class D is not?
Thank you! | 0debug |
how to retrieving data from mysql and output json php? : <p>i Have this code to retrieving data from mysql and output json from php</p>
<pre><code><?php
header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf-8');
include 'system/config.php';
$db=mysql_connect($DB_HOST, $DB_USER, $DB_PASS) or die('Could not connect');
mysql_select_db($DB_NAME, $db) or die('');
$result = mysql_query("SELECT * from users") or die('Could not query');
if(mysql_num_rows($result)){
echo '{"Data":[';
$first = true;
$row=mysql_fetch_assoc($result);
while($row=mysql_fetch_row($result)){
// cast results to specific data types
if($first) {
$first = false;
} else {
echo ',';
}
echo json_encode($row);
}
echo ']}';
} else {
echo '[]';
}
mysql_close($db);
?>
</code></pre>
<p>What i need to do exactly like that to split every user with new data line</p>
<pre><code> {
"data":[ {
"user_id":"1",
"user_name":"ahmed",
"user_rank":"admin",
"color":"blue",
"user_avatar":"default_avatar.png",
"user_age":"30",
"user_email":"root@root.com",
"trending_datetime":"0000-00-00 00:00:00",
},
"data":[ {
"user_id":"2",
"user_name":"ahmed2",
"user_rank":"user",
"color":"green",
"user_avatar":"default_avatar.png",
"user_age":"40",
"user_email":"ahmed2@root.com",
"trending_datetime":"0000-00-00 00:00:00",
}
}
</code></pre>
<p>But is showing like that and i know there is something missing..am still learning</p>
<pre><code>
{
"Data": [["5", "lucifer", "user5_37994384.png"], ["7", "Ahmed", "default_avatar.png"], ["10", "Viona", "default_avatar.png"], ["11", "Dream", "default_avatar.png"], ["12", "Zanos", "default_avatar.png"], ["13", "Dean.Winchester", "default_avatar.png"], ["19", "sama", "default_avatar.png"], ["33", "demo", "default_avatar.png"], ["34", "super", "default_avatar.png"], ["42", "tazooo", "default_avatar.png"], ["44", "devil", "default_avatar.png"]]
}
</code></pre>
<p>Thanks for help</p>
| 0debug |
How can I create two separate bundles with vue-cli 3? : <p>I want to build two separate vue apps that will be served on two different routes in an express application: a ‘public’ vue app and an ‘admin’ vue app. These two apps have their own router and store but they share a lot of custom components.
How can I edit the default webpack template to make it output two separate bundles based of my two different entry points (‘public’ and ‘admin’)?
The goal would be to end up with a setup more or less like this:</p>
<pre><code>my-app/
+- ...
+- dist/
| +- admin/ Admin bundle and files
| +- public/ Public bundle and files
+- src/
| +- components/ Shared components
| +- admin/ Entry point, router, store... for the admin app
| +- public/ Entry point, router, store... for the public app
+- ...
</code></pre>
<p>Must by available 2 dev servers <a href="http://localhost:8080/admin" rel="noreferrer">http://localhost:8080/admin</a> and <a href="http://localhost:8080/public" rel="noreferrer">http://localhost:8080/public</a>
Each project must be in own folder in dist, and own public</p>
<p>What i have today:
created file vue.config.js in root directory
With:</p>
<pre><code>module.exports = {
// tweak internal webpack configuration.
// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
chainWebpack: config => {
// If you wish to remove the standard entry point
config.entryPoints.delete('app')
// then add your own
config.entry('admin')
.add('./src/admin/index.js')
.end()
.entry('public')
.add('./src/public/index.js')
.end()
}
}
</code></pre>
| 0debug |
void curses_display_init(DisplayState *ds, int full_screen)
{
#ifndef _WIN32
if (!isatty(1)) {
fprintf(stderr, "We need a terminal output\n");
exit(1);
}
#endif
curses_setup();
curses_keyboard_setup();
atexit(curses_atexit);
#ifndef _WIN32
signal(SIGINT, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
#if defined(SIGWINCH) && defined(KEY_RESIZE)
signal(SIGWINCH, curses_winch_handler);
#endif
#endif
ds->data = (void *) screen;
ds->linesize = 0;
ds->depth = 0;
ds->width = 640;
ds->height = 400;
ds->dpy_update = curses_update;
ds->dpy_resize = curses_resize;
ds->dpy_refresh = curses_refresh;
ds->dpy_text_cursor = curses_cursor_position;
invalidate = 1;
curses_resize(ds, 80, 25);
}
| 1threat |
React Router with React 16.6 Suspense "Invalid prop `component` of type `object` supplied to `Route`, expected `function`." : <p>I'm using the latest version (16.6) of React with <code>react-router</code> (4.3.1) and trying to use code splitting using <code>React.Suspense</code>.</p>
<p>Although my routing is working and the code did split into several bundles loaded dynamically, I'm getting a warning about not returning a function, but an object to <code>Route</code>. My code:</p>
<pre><code>import React, { lazy, Suspense } from 'react';
import { Switch, Route, withRouter } from 'react-router-dom';
import Loading from 'common/Loading';
const Prime = lazy(() => import('modules/Prime'));
const Demo = lazy(() => import('modules/Demo'));
const App = () => (
<Suspense fallback={<Loading>Loading...</Loading>}>
<Switch>
<Route path="/" component={Prime} exact />
<Route path="/demo" component={Demo} />
</Switch>
</Suspense>
);
export default withRouter(App);
</code></pre>
<p>The console warning is as follows:
<code>Warning: Failed prop type: Invalid prop `component` of type `object` supplied to `Route`, expected `function`.</code></p>
<p>A normal import would return a function, but the dynamic import with <code>lazy()</code> is returning an object. </p>
<p>Any fixes for this?</p>
| 0debug |
python : How to store result in for loop : I am trying to create a report using python where for loop iterates for each location but once i run this code it only gives data for last location.How can i store result from this loop.
import inflect
import pandas as pd
add_sum_data=pd.read_excel("~Add_Summary_17062018.xlsx")
location_code=add_sum_data.iloc[0:,0]
for GO in location_code:
ag_row_data = add_sum_data.loc[add_sum_data["location"]== GO] | 0debug |
Refine my t-sql query to increase performance : Created a sql query to summarize some data.
It is slow, so I thought I'd ask for some help.
Table is a log table that has : loc,tag,entrytime,exittime,visits,entrywt,exitwt.
My test log has 700,000 records in it. The entrytime and exittime are epoch values.
I know my query is inefficient as it rips through the table 4 times.
select loc,edate,tag,
(Select COUNT(*) from mylog as ml where mvlog.loc = ml.loc and mvlog.edate = CONVERT(date, DATEADD(ss, ml.entrytime,'19700101')) and mvlog.tag = ml.tag) as visits,
(Select SUM(entrywt - exitwt) from mylog as ml2 where mvlog.loc = ml2.loc and mvlog.edate = CONVERT(date, DATEADD(ss, ml2.entrytime,'19700101')) and mvlog.tag = ml2.tag) as consumed,
(Select SUM(exittime - entrytime) from mylog as ml3 where mvlog.loc = ml3.loc and mvlog.edate = CONVERT(date, DATEADD(ss, ml3.entrytime,'19700101')) and mvlog.tag = ml3.tag) as occupancy
from eventlogV as mvlog with (INDEX(pt_index))
index pt_index is fields tag and loc.
When I run this query, it completes in roughly 30 seconds. Since my query is inefficient, I am sure it can be better.
any ideas appreciated. | 0debug |
bat script to trim characters after a particular length from 1st word of every line : I have text file like below
Input sample text file
-------------------------------
<Line1> 69273ww01/080-100 1021/00 11123
<Line2> 80381ew20/937-134 1372/92 12737298323
<Line3> 02ws88749/263-379 2836/39 121
<Line4> 4793de592/343-283 7384/49 233792740562263
Required output text file
-------------------------------
<Line1> 69273ww01/080-100 1021/00 111
<Line2> 80381ew20/937-134 1372/92 127
<Line3> 02ws88749/263-379 2836/39 121
<Line4> 4793de592/343-283 7384/49 233
I want to trim characters after a particular length (30) from 1st word of every line
Could any one help me who write a batch script. for the above requirement. | 0debug |
Error saying Conversion failed when converting date and/or time from character string. : SELECT CONVERT(DATETIME,(RIGHT(b.dob,4)+'-'+SUBSTRING(b.dob,3,2) +'-'+LEFT (b.dob, 2)),111) FROM [Load].[123_Qualification] AS b
The Dob is a nvarchar field,and i want it to convert to DateTime Format, but I am getting an error saying that Conversion failed when converting date and/or time from character string. | 0debug |
static void init_pipe_signaling(PCIQXLDevice *d)
{
if (pipe(d->pipe) < 0) {
dprint(d, 1, "%s: pipe creation failed\n", __FUNCTION__);
return;
}
#ifdef CONFIG_IOTHREAD
fcntl(d->pipe[0], F_SETFL, O_NONBLOCK);
#else
fcntl(d->pipe[0], F_SETFL, O_NONBLOCK );
#endif
fcntl(d->pipe[1], F_SETFL, O_NONBLOCK);
fcntl(d->pipe[0], F_SETOWN, getpid());
d->main = pthread_self();
qemu_set_fd_handler(d->pipe[0], pipe_read, NULL, d);
}
| 1threat |
How to know what company protect a website? : <p><a href="https://www.genecards.org" rel="nofollow noreferrer">https://www.genecards.org</a> is protected by cloudflare. But this is not clear from the HTML webpages on genecards.org. Is there a systematically to figure out this kind of information for a number of websites? Thanks.</p>
| 0debug |
Firebase email verification goes to spam folder : <p>I made a mobile app and used Firebase for backend and authentication. When I use firebase's built in email verification, the email always goes to the junk folder / spam. </p>
<p>Does anyone know how to fix this?</p>
| 0debug |
How can I get a reference to an element that has a common class on click? : <p>If I have the following html structure:</p>
<p><code><div class ='wrapper'></div></code></p>
<p><code><div class ='wrapper'></div></code> <em>I want to get this element</em></p>
<p><code><div class ='wrapper'></div></code></p>
<p>I tried doing something like this:</p>
<pre><code>$(document).on('click', 'wrapper', ()=>{
var element = $(this); //not sure how to do this
});
</code></pre>
<p>How can I get a reference to the clicked element so I can used it for things like <code>$(element).siblings()</code> and <code>next()</code>, etc.</p>
<p>The method that I tried to use, selects all the elements with that class, i want to get only the element clicked on, Is there a way I can do that ?</p>
| 0debug |
What is wrong with the syntax of this code? : <pre><code>with open('list.txt') as f:
print " ".join(line.strip() for line in f)
</code></pre>
<p><a href="https://i.stack.imgur.com/aebFH.png" rel="nofollow noreferrer">Though the code seems to be correct, but facing syntax error !</a></p>
| 0debug |
Wordpress REST API (wp-api) 404 Error : <p>I have been using the Wordpress REST plugin WP-API for months now while developing locally with XAMPP. I recently migrated my site to an EC2 instance and everything is working fine <strong>except</strong> I now get a 404 with the following message whenever I try to access any endpoint on the API:</p>
<blockquote>
<p>The requested URL /wordpress/wp-json/ was not found on this server</p>
</blockquote>
<p><strong>Pretty permalinks are enabled</strong> with the following structure <code>http://.../wordpress/sample-post/</code> which works fine when navigating to a specific post in the browser.</p>
<p>Here are some details about my setup:</p>
<ul>
<li>Wordpress 4.4.1
<ul>
<li><strong>Not a Multisite</strong></li>
</ul></li>
<li>WP REST API plugin 2.0-beta9</li>
<li>Apache 2.2.22</li>
<li>Ubuntu 12.04.5</li>
</ul>
<p>Any help would be greatly appreciated as I have gone through SO and the WP Support forums for several hours and am out of ideas. Thank you!</p>
| 0debug |
Is there a way to dispatch actions between two namespaced vuex modules? : <p>Is it possible to dispatch an action between namespaced modules?</p>
<p>E.g. I have vuex modules "gameboard" and "notification". Each are namespaced. I would like to dispatch an action from the gameboard to the notification module. </p>
<p>I thought I could use the module name in the dispatch action name like this:</p>
<pre><code>// store/modules/gameboard.js
const actions = {
myaction ({dispatch}) {
...
dispatch('notification/triggerSelfDismissingNotifcation', {...})
}
}
// store/modules/notification.js
const actions = {
triggerSelfDismissingNotification (context, payload) {
...
}
}
</code></pre>
<p>But when I try to do this I get errors that make me thing vuex is trying to dispatch an action within my gameboard module:</p>
<blockquote>
<p>[vuex] unknown local action type: notification/triggerSelfDismissingNotification, global type: gameboard/notification/triggerSelfDismissingNotification</p>
</blockquote>
<p>Is there a way of dispatching from vuex module to module or do I need to create some kind of a bridge in the root vuex instance?</p>
| 0debug |
Did not get value as per My ID get all database data : Hii I want Edit my form so i want data as per passed id which i selected but i did Not get data as per my requirement.
==>JSON Eroor Screen Shot **https://imgur.com/a/vD2fKpK**
==> Ajax Code
var url = document.URL;
var id = url.substring(url.lastIndexOf('=') + 1);
$.ajax({
method:"post",
data:id,
url: 'get.php',
success: function (data) {
console.log(data);
data = $.parseJSON(data);
}
});
$(function () {
$('#datetimepicker1').datetimepicker();
});
});
==> get.php
if(isset($_POST['data'])) {
$getUsers = $connect->prepare("SELECT * FROM registration WHERE
id='".$_POST['data']."'");
$getUsers->execute();
$users = $getUsers->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($users);
} | 0debug |
Spring boot 2 embed tomcat 9.0.26 can not load jks file stream closed : <p>I try to use SSL on spring boot 2.2.0 with embeded tomcat 9.0.26 but
tomcat can not load JKS file stream closed.</p>
<p>Here is application properties:</p>
<pre><code>server.port=443
server.ssl.key-store-type=JKS
server.ssl.key-store=C:\\Keystore\\mykey.jks
server.ssl.key-store-password=cccc
server.ssl.key-alias=*.mydomain.com
</code></pre>
<blockquote>
<p>Exception:</p>
<p>org.springframework.boot.web.server.WebServerException: Unable to
start embedded Tomcat server
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:215)
~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:297)
~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163)
~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT]
at eu.soluma.app.SolumaTdvApplication.main(SolumaTdvApplication.java:34)
~[classes!/:0.0.1-SNAPSHOT]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
~[SolumaTDV-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
~[SolumaTDV-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
~[SolumaTDV-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
~[SolumaTDV-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT] Caused by:
java.lang.IllegalArgumentException:
standardService.connector.startFailed
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:231)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:278)
~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:197)
~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT]
... 18 common frames omitted Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1008)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:227)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
... 20 common frames omitted Caused by: java.lang.IllegalArgumentException: Stream closed
at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:99)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:71)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:218)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1124)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1210)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:585)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1005)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
... 22 common frames omitted Caused by: java.io.IOException: Stream closed
at java.base/java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:176)
~[na:na]
at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:342)
~[na:na]
at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:252)
~[na:na]
at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:271)
~[na:na]
at java.base/java.security.DigestInputStream.read(DigestInputStream.java:125)
~[na:na]
at java.base/java.io.DataInputStream.readInt(DataInputStream.java:392)
~[na:na]
at java.base/sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:659)
~[na:na]
at java.base/sun.security.util.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:222)
~[na:na]
at java.base/java.security.KeyStore.load(KeyStore.java:1472) ~[na:na]
at org.apache.tomcat.util.security.KeyStoreUtil.load(KeyStoreUtil.java:69)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
at org.apache.tomcat.util.net.SSLUtilBase.getStore(SSLUtilBase.java:217)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
at org.apache.tomcat.util.net.SSLHostConfigCertificate.getCertificateKeystore(SSLHostConfigCertificate.java:206)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
at org.apache.tomcat.util.net.SSLUtilBase.getKeyManagers(SSLUtilBase.java:283)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
at org.apache.tomcat.util.net.SSLUtilBase.createSSLContext(SSLUtilBase.java:247)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:97)
~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
... 28 common frames omitted</p>
</blockquote>
| 0debug |
Arrow Function syntax not working with webpack? : <p>I'm making an app on react-redux. I'm using webpack for bundling and babel for transpiling. When I am try to use arrow function in my code. It gives me error as :</p>
<pre><code>Module build failed: SyntaxError: Unexpected token (34:15)
};
> handleSubmit = (event) => {
^
event.preventDefault();
this.props.dispatch(actions.addTodo(this.state.inputText));
</code></pre>
<p>My webpack configuration file looks like as follows :</p>
<pre><code>module.exports = {
devtool: 'inline-source-map',
entry: [
'webpack-hot-middleware/client',
'./client/client.js'
],
output: {
path: require('path').resolve('./dist'),
filename: 'bundle.js',
publicPath: '/'
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['react', 'es2015', 'react-hmre']
}
}
]
}
};
</code></pre>
<p>and I'm using following babel packages in my package.json :</p>
<pre><code> "babel-cli": "^6.6.5",
"babel-core": "^6.4.5",
"babel-loader": "^6.2.2",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-react-hmre": "^1.1.1",
</code></pre>
<p>What would have gone wrong?</p>
| 0debug |
foreach loop 1000 items multiple times : <p>In javascript I have an array of something like 500,000 items.</p>
<p>I want to send to server 1000 items multiple times.</p>
<p>Seems that I need to use the <code>Slice Function</code>.</p>
<p>How can I do it send 1000 items each time and the last time send the last items. either if it less than 1000 items.</p>
| 0debug |
detect if pressing a mouse button and wich WinForm c# : I don't want to click on a button or the form, I just want to know if user is pressing the left mouse button while the cursor is in the form.
I've tried this:
private void PlayForm_KeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.LButton)
{
...
}
}
but it doesn't work.
I also tried `PlayForm_Click()` but it works only when the click is on the 'canvas' if there's something else on top it won't work
| 0debug |
how can i converte all columns from my excel file using pandas : I want to convert all columns (59 columns) from my excel file to a dataframe, specifying the types.
Some columns are string, others dates, other int and more.
I know I can use converter in a read_excel method.
but I have a lot of columns and I don't want write converter={'column1': type1, 'column2': type2, ..., 'column59': type59}
my code is:
import numpy as np
import pandas as pd
import recordlinkage
import xrld
fileName = 'C:/Users/Tito/Desktop/banco ZIKA4.xlsx'
strcols = [0, 5, 31, 36, 37, 38, 39, 40, 41, 45]
datecols = [3, 4, 29, 30, 32, 48, 50, 51, 52, 53, 54, 55]
intcols = [33, 43, 59]
booleancols = [6, ..., 28]
df = pd.read_excel(fileName, sheet_name=0, true_values=['s'], false_values=['n'], converters={strcols: str, intcols: np.int, booleancols: np.bool, datecols: pd.to_datetime})
print(df.iat[1, 31], df.iat[1, 32], df.iat[1, 33])
| 0debug |
java how to parse xml and save data into mysql database : <p>I have a question.</p>
<p>I want to parse XML file using SAX or JAXB and save the parsed file into a database using java, any help please.</p>
| 0debug |
Get connection strings in ARM : <p>I'm creating an Azure Resource Manager template that instantiates multiple resources.</p>
<p>I'd like to be able to capture the primary connection strings of
Redis , AzureWebJobsDashboard, AzureWebJobsStorage and AzureWebJobsServiceBus.</p>
| 0debug |
db.execute('SELECT * FROM employees WHERE id = ' + user_input) | 1threat |
Facebook login in JWT : <p>I have developed token based spring security using JWT referring this project in git <a href="https://github.com/szerhusenBC/jwt-spring-security-demo" rel="noreferrer">https://github.com/szerhusenBC/jwt-spring-security-demo</a>. Now I need to get facebook login in my application. For social login, I found another web page <a href="https://ole.michelsen.dk/blog/social-signin-spa-jwt-server.html" rel="noreferrer">https://ole.michelsen.dk/blog/social-signin-spa-jwt-server.html</a> which explains how the social login must be carried out. </p>
<p>In the normal login, my JWT project creates a token based on username, password, expiry date and time of creation. Everytime the token comes, all values from above fields are retrieved and compared to authenticate the token and then served. I've two questions: </p>
<ol>
<li>In the social login, there will be no password created. A token will be received from the facebook(my frontend does this). I have to verify if the token is valid or not. How am I supposed to do it in JWT?</li>
<li>After verifying as per the article I'm supposed to create my own token for future reference. Now, there is no password in facebook login. How do I create the token? </li>
</ol>
<p>Let me know if there are any good site available for social login using JWT in spring boot applictaion. </p>
| 0debug |
How to properly close the database connection in a lambda function? : <p>In my lambda function, I tried to close the mongo connection as soon as I send a callback. But it has a problem.</p>
<ul>
<li>When I send a request, the function performs its duties, send the callback and close the database connection.</li>
<li>When the second request is sent, the function times out.</li>
<li>When I remove the <code>db.close()</code> things work perfectly.</li>
</ul>
<p>I think lambda re-use the connection for all the functions because I open the connection in the top of the handler:</p>
<pre><code>// Connect to database
mongoose.connect(process.env.DATABASE_URL);
const handleCreateUser = async (event, context, callback) => {
// eslint-disable-next-line no-param-reassign
context.callbackWaitsForEmptyEventLoop = false;
const data = JSON.parse(event.body);
const { user, userProfile } = data;
await createUser({ callback, user, userProfile });
};
</code></pre>
<p>Any idea what how to fix this? Do we really have to close the connection at this point?</p>
| 0debug |
SQL Code exceeds maximum recursion depth : I am new to python and I am doing testing.
when I run following code, error message "RecursionError: maximum recursion depth exceeded"
names = ['G','K']
class test(object):
def __init__(self, names):
self.players = []
for name in names:
player = test(name)
self.players.append(player)
print(self.players)
G = test(names)
can anyone tell me what went wrong and how to solve it?
Thank you very much!!! | 0debug |
Click to show & Click to call php, javascript : i need to create function on php so when user click on Button, will show phone Number After mobile number shown , must be clickable so we can call via mobile
i have tried to implement some codes but it didn't work
<div class="category-list-title">
<h5><a href="javascript:void(0)" class="number" data-last="<?php echo get_post_meta($pid, '_carspot_poster_contact', true ); ?>"><span><?php echo esc_html__('Click to View', 'carspot' ); ?></span></a></h5>
</div> | 0debug |
def count_Num(n):
if (n == 1):
return 1
count = pow(2,n - 2)
return count | 0debug |
Pandas random sample with remove : <p>I'm aware of <code>DataFrame.sample()</code>, but how can I do this and also remove the sample from the dataset? (<em>Note: AFAIK this has nothing to do with sampling with replacement</em>)</p>
<p>For example here is <strong>the essence</strong> of what I want to achieve, this does not actually work:</p>
<pre><code>len(df) # 1000
df_subset = df.sample(300)
len(df_subset) # 300
df = df.remove(df_subset)
len(df) # 700
</code></pre>
| 0debug |
static int oss_ctl_out (HWVoiceOut *hw, int cmd, ...)
{
int trig;
OSSVoiceOut *oss = (OSSVoiceOut *) hw;
switch (cmd) {
case VOICE_ENABLE:
{
va_list ap;
int poll_mode;
va_start (ap, cmd);
poll_mode = va_arg (ap, int);
va_end (ap);
ldebug ("enabling voice\n");
if (poll_mode && oss_poll_out (hw)) {
poll_mode = 0;
}
hw->poll_mode = poll_mode;
if (!oss->mmapped) {
return 0;
}
audio_pcm_info_clear_buf (&hw->info, oss->pcm_buf, hw->samples);
trig = PCM_ENABLE_OUTPUT;
if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {
oss_logerr (
errno,
"SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed\n"
);
return -1;
}
}
break;
case VOICE_DISABLE:
if (hw->poll_mode) {
qemu_set_fd_handler (oss->fd, NULL, NULL, NULL);
hw->poll_mode = 0;
}
if (!oss->mmapped) {
return 0;
}
ldebug ("disabling voice\n");
trig = 0;
if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {
oss_logerr (errno, "SNDCTL_DSP_SETTRIGGER 0 failed\n");
return -1;
}
break;
}
return 0;
}
| 1threat |
static void host_signal_handler(int host_signum, siginfo_t *info,
void *puc)
{
CPUArchState *env = thread_cpu->env_ptr;
int sig;
target_siginfo_t tinfo;
if ((host_signum == SIGSEGV || host_signum == SIGBUS)
&& info->si_code > 0) {
if (cpu_signal_handler(host_signum, info, puc))
return;
}
sig = host_to_target_signal(host_signum);
if (sig < 1 || sig > TARGET_NSIG)
return;
trace_user_host_signal(env, host_signum, sig);
host_to_target_siginfo_noswap(&tinfo, info);
if (queue_signal(env, sig, &tinfo) == 1) {
cpu_exit(thread_cpu);
}
} | 1threat |
React-native: scrollview inside of panResponder : <p>I am using a ScrollView inside of a PanResponder. On Android it works fine but on iOS the ScrollView will not scroll. I did some investigation and here are some facts:</p>
<ol>
<li><p>If I put a break point in <code>PanResponder.onMoveShouldSetPanResponder()</code>, before I step over, the scrollView will scroll as normal but once I release the break point, the scrollView stops working.</p></li>
<li><p>If I modify ScrollResponder.js, and return true in <code>scrollResponderHandleStartShouldSetResponderCapture()</code> - it used to return false at runtime; and return false in <code>scrollResponderHandleTerminationRequest()</code>, the scrollView works OK but of course, since it swallows the event the outer <code>PanResponder</code> will not get the event.</p></li>
</ol>
<p>So the questions are:</p>
<ol>
<li>I want to make the scrollview to work, and <strong>not</strong> to swallow the event. Any one know what's the approach?</li>
<li>How the responding system works on iOS? The react-native responder system doc does not explain that to me.</li>
</ol>
| 0debug |
iOS 10: How to debug a Today Widget - "Unable to load" message : <p>It seems to me that whenever a Today Widget crashes for any reason it displays the "Unable to load" message (as on the attached screen).</p>
<p>When this happens nothing kicks off in the debugger, nothing appears on the Console. It seems to me like searching for a needle in the haystack. Is it possibl to debug the "Unable to load" message in Xcode in any way?</p>
<p>Xcode version: 8.2</p>
<p>iOS Simulator: 10.2</p>
<p><a href="https://i.stack.imgur.com/tz4Zp.png"><img src="https://i.stack.imgur.com/tz4Zp.png" alt="Unable to load"></a></p>
| 0debug |
I am new in selenium.i am having issue with below mention code : When i run this script then an error message is occur.
Element info: {Using=xpath, value=html/body/table/tbody/tr[2]/td[1]/div/div[1]/fieldset/div/div[17]}
**it is my selenium code.
fd.findElement(By.xpath("html/body/table/tbody/tr[2]/td[1]/div/div[1]/fieldset/div/div[17]")).click();
Here is the developer code.
code<div id="ui-id-5" class="ui-accordion-header ui-state-default ui-corner-all ui-accordion-icons ui-state-hover" role="tab" aria-controls="ui-id-6" aria-selected="false" aria-expanded="false" tabindex="-1">
<span class="ui-accordion-header-icon ui-icon ui-icon-triangle-1-e"/>
Education Institution
</div>.
| 0debug |
static bool gen_wsr_ccompare(DisasContext *dc, uint32_t sr, TCGv_i32 v)
{
uint32_t id = sr - CCOMPARE;
bool ret = false;
if (id < dc->config->nccompare) {
uint32_t int_bit = 1 << dc->config->timerint[id];
TCGv_i32 tmp = tcg_const_i32(id);
tcg_gen_mov_i32(cpu_SR[sr], v);
tcg_gen_andi_i32(cpu_SR[INTSET], cpu_SR[INTSET], ~int_bit);
if (dc->tb->cflags & CF_USE_ICOUNT) {
gen_io_start();
}
gen_helper_update_ccompare(cpu_env, tmp);
if (dc->tb->cflags & CF_USE_ICOUNT) {
gen_io_end();
gen_jumpi_check_loop_end(dc, 0);
ret = true;
}
tcg_temp_free(tmp);
}
return ret;
}
| 1threat |
static int ffat_decode(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
ATDecodeContext *at = avctx->priv_data;
AVFrame *frame = data;
int pkt_size = avpkt->size;
AVPacket filtered_packet = {0};
OSStatus ret;
AudioBufferList out_buffers;
if (avctx->codec_id == AV_CODEC_ID_AAC && avpkt->size > 2 &&
(AV_RB16(avpkt->data) & 0xfff0) == 0xfff0) {
AVPacket filter_pkt = {0};
if (!at->bsf) {
const AVBitStreamFilter *bsf = av_bsf_get_by_name("aac_adtstoasc");
if(!bsf)
return AVERROR_BSF_NOT_FOUND;
if ((ret = av_bsf_alloc(bsf, &at->bsf)))
return ret;
if (((ret = avcodec_parameters_from_context(at->bsf->par_in, avctx)) < 0) ||
((ret = av_bsf_init(at->bsf)) < 0)) {
av_bsf_free(&at->bsf);
return ret;
}
}
if ((ret = av_packet_ref(&filter_pkt, avpkt)) < 0)
return ret;
if ((ret = av_bsf_send_packet(at->bsf, &filter_pkt)) < 0) {
av_packet_unref(&filter_pkt);
return ret;
}
if ((ret = av_bsf_receive_packet(at->bsf, &filtered_packet)) < 0)
return ret;
at->extradata = at->bsf->par_out->extradata;
at->extradata_size = at->bsf->par_out->extradata_size;
avpkt = &filtered_packet;
}
if (!at->converter) {
if ((ret = ffat_create_decoder(avctx, avpkt)) < 0) {
av_packet_unref(&filtered_packet);
return ret;
}
}
out_buffers = (AudioBufferList){
.mNumberBuffers = 1,
.mBuffers = {
{
.mNumberChannels = avctx->channels,
.mDataByteSize = av_get_bytes_per_sample(avctx->sample_fmt) * avctx->frame_size
* avctx->channels,
}
}
};
av_packet_unref(&at->new_in_pkt);
if (avpkt->size) {
if (filtered_packet.data) {
at->new_in_pkt = filtered_packet;
} else if ((ret = av_packet_ref(&at->new_in_pkt, avpkt)) < 0) {
return ret;
}
} else {
at->eof = 1;
}
frame->sample_rate = avctx->sample_rate;
frame->nb_samples = avctx->frame_size;
out_buffers.mBuffers[0].mData = at->decoded_data;
ret = AudioConverterFillComplexBuffer(at->converter, ffat_decode_callback, avctx,
&frame->nb_samples, &out_buffers, NULL);
if ((!ret || ret == 1) && frame->nb_samples) {
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
ffat_copy_samples(avctx, frame);
*got_frame_ptr = 1;
if (at->last_pts != AV_NOPTS_VALUE) {
frame->pts = at->last_pts;
#if FF_API_PKT_PTS
FF_DISABLE_DEPRECATION_WARNINGS
frame->pkt_pts = at->last_pts;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
at->last_pts = avpkt->pts;
}
} else if (ret && ret != 1) {
av_log(avctx, AV_LOG_WARNING, "Decode error: %i\n", ret);
} else {
at->last_pts = avpkt->pts;
}
return pkt_size;
}
| 1threat |
static void vfio_enable_msi(VFIODevice *vdev)
{
int ret, i;
vfio_disable_interrupts(vdev);
vdev->nr_vectors = msi_nr_vectors_allocated(&vdev->pdev);
retry:
vdev->msi_vectors = g_malloc0(vdev->nr_vectors * sizeof(VFIOMSIVector));
for (i = 0; i < vdev->nr_vectors; i++) {
VFIOMSIVector *vector = &vdev->msi_vectors[i];
vector->vdev = vdev;
vector->use = true;
if (event_notifier_init(&vector->interrupt, 0)) {
error_report("vfio: Error: event_notifier_init failed");
}
vector->msg = msi_get_message(&vdev->pdev, i);
vector->virq = kvm_irqchip_add_msi_route(kvm_state, vector->msg);
if (vector->virq < 0 ||
kvm_irqchip_add_irqfd_notifier(kvm_state, &vector->interrupt,
NULL, vector->virq) < 0) {
qemu_set_fd_handler(event_notifier_get_fd(&vector->interrupt),
vfio_msi_interrupt, NULL, vector);
}
}
ret = vfio_enable_vectors(vdev, false);
if (ret) {
if (ret < 0) {
error_report("vfio: Error: Failed to setup MSI fds: %m");
} else if (ret != vdev->nr_vectors) {
error_report("vfio: Error: Failed to enable %d "
"MSI vectors, retry with %d", vdev->nr_vectors, ret);
}
for (i = 0; i < vdev->nr_vectors; i++) {
VFIOMSIVector *vector = &vdev->msi_vectors[i];
if (vector->virq >= 0) {
kvm_irqchip_remove_irqfd_notifier(kvm_state, &vector->interrupt,
vector->virq);
kvm_irqchip_release_virq(kvm_state, vector->virq);
vector->virq = -1;
} else {
qemu_set_fd_handler(event_notifier_get_fd(&vector->interrupt),
NULL, NULL, NULL);
}
event_notifier_cleanup(&vector->interrupt);
}
g_free(vdev->msi_vectors);
if (ret > 0 && ret != vdev->nr_vectors) {
vdev->nr_vectors = ret;
goto retry;
}
vdev->nr_vectors = 0;
return;
}
vdev->interrupt = VFIO_INT_MSI;
DPRINTF("%s(%04x:%02x:%02x.%x) Enabled %d MSI vectors\n", __func__,
vdev->host.domain, vdev->host.bus, vdev->host.slot,
vdev->host.function, vdev->nr_vectors);
}
| 1threat |
void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, DCTELEM *_block, int stride){
int i;
INIT_CLIP
pixel *dst = (pixel*)_dst;
dctcoef *block = (dctcoef*)_block;
stride /= sizeof(pixel);
block[0] += 32;
for( i = 0; i < 8; i++ )
{
const int a0 = block[i+0*8] + block[i+4*8];
const int a2 = block[i+0*8] - block[i+4*8];
const int a4 = (block[i+2*8]>>1) - block[i+6*8];
const int a6 = (block[i+6*8]>>1) + block[i+2*8];
const int b0 = a0 + a6;
const int b2 = a2 + a4;
const int b4 = a2 - a4;
const int b6 = a0 - a6;
const int a1 = -block[i+3*8] + block[i+5*8] - block[i+7*8] - (block[i+7*8]>>1);
const int a3 = block[i+1*8] + block[i+7*8] - block[i+3*8] - (block[i+3*8]>>1);
const int a5 = -block[i+1*8] + block[i+7*8] + block[i+5*8] + (block[i+5*8]>>1);
const int a7 = block[i+3*8] + block[i+5*8] + block[i+1*8] + (block[i+1*8]>>1);
const int b1 = (a7>>2) + a1;
const int b3 = a3 + (a5>>2);
const int b5 = (a3>>2) - a5;
const int b7 = a7 - (a1>>2);
block[i+0*8] = b0 + b7;
block[i+7*8] = b0 - b7;
block[i+1*8] = b2 + b5;
block[i+6*8] = b2 - b5;
block[i+2*8] = b4 + b3;
block[i+5*8] = b4 - b3;
block[i+3*8] = b6 + b1;
block[i+4*8] = b6 - b1;
}
for( i = 0; i < 8; i++ )
{
const int a0 = block[0+i*8] + block[4+i*8];
const int a2 = block[0+i*8] - block[4+i*8];
const int a4 = (block[2+i*8]>>1) - block[6+i*8];
const int a6 = (block[6+i*8]>>1) + block[2+i*8];
const int b0 = a0 + a6;
const int b2 = a2 + a4;
const int b4 = a2 - a4;
const int b6 = a0 - a6;
const int a1 = -block[3+i*8] + block[5+i*8] - block[7+i*8] - (block[7+i*8]>>1);
const int a3 = block[1+i*8] + block[7+i*8] - block[3+i*8] - (block[3+i*8]>>1);
const int a5 = -block[1+i*8] + block[7+i*8] + block[5+i*8] + (block[5+i*8]>>1);
const int a7 = block[3+i*8] + block[5+i*8] + block[1+i*8] + (block[1+i*8]>>1);
const int b1 = (a7>>2) + a1;
const int b3 = a3 + (a5>>2);
const int b5 = (a3>>2) - a5;
const int b7 = a7 - (a1>>2);
dst[i + 0*stride] = CLIP( dst[i + 0*stride] + ((b0 + b7) >> 6) );
dst[i + 1*stride] = CLIP( dst[i + 1*stride] + ((b2 + b5) >> 6) );
dst[i + 2*stride] = CLIP( dst[i + 2*stride] + ((b4 + b3) >> 6) );
dst[i + 3*stride] = CLIP( dst[i + 3*stride] + ((b6 + b1) >> 6) );
dst[i + 4*stride] = CLIP( dst[i + 4*stride] + ((b6 - b1) >> 6) );
dst[i + 5*stride] = CLIP( dst[i + 5*stride] + ((b4 - b3) >> 6) );
dst[i + 6*stride] = CLIP( dst[i + 6*stride] + ((b2 - b5) >> 6) );
dst[i + 7*stride] = CLIP( dst[i + 7*stride] + ((b0 - b7) >> 6) );
}
}
| 1threat |
static int delta_decode(int8_t *dst, const uint8_t *src, int src_size,
int8_t val, const int8_t *table)
{
int n = src_size;
int8_t *dst0 = dst;
while (n--) {
uint8_t d = *src++;
val = av_clip(val + table[d & 0x0f], -127, 128);
*dst++ = val;
val = av_clip(val + table[d >> 4] , -127, 128);
*dst++ = val;
}
return dst-dst0;
}
| 1threat |
C# Console Application - : <p>So when I reach the end of the program where it chooses if a Pokemon appears out of nowhere it repeats the same Pokemon again and again.
e.g. I encounter Mr.Mime
I defeat Mr.Mime
I am safe
I am safe
I encounter Mr.Mime
I die
I encounter Mr.Mime
I die
I am safe
I encounter Mr.Mime
I defeat Mr.Mime</p>
<p>How would I stop this?</p>
<p>My Code:</p>
<pre><code>using System;
using System.Linq;
using System.Threading;
public class Program
{
public static void Main()
{
// Due to dotnetfiddle.net limitations I cannot store the pokémons data to a file
Console.WriteLine("---------------------------------------------------------------------------------------------------------------------");
Console.WriteLine("| Hello there! Welcome to the world of pokémon! My name is Oak! People call me the pokémon Prof! |");
Console.WriteLine("|This world is inhabited by creatures called pokémon! For some people, pokémon are pets. Others use them for fights.|");
Console.WriteLine("| Myself...I study pokémon as a profession. |");
Console.WriteLine("---------------------------------------------------------------------------------------------------------------------");
Console.WriteLine(" | Would you like to start (S)? |");
Console.WriteLine(" | |");
Console.WriteLine(" -------------------------------------------------------------------------------");
String fog = Console.ReadLine();
String [] random = {"Pidgeot", "Jigglypuff", "Beedrill", "Caterpie", "Squirtle", "Charizard", "Charmander", "Bulbasaur", "Rattata", "Diglett", "Meowth", "Psyduck", "Dugtrio", "Magnemite", "Mr. Mime", "Gyarados", "Magikarp", "Onix", "Drowzee"};
String [] gen = {"♂", "♀"};
String [] name = {"Charmander", "Bulbasaur", "Squirtle"};
if (fog == "s" || fog == "S" || fog == "start" || fog == "Start")
{
Random rnd = new Random();
int HP = rnd.Next(20, 20);
int Atk = rnd.Next(20, 20);
int Def = rnd.Next(20, 20);
int Lvl = rnd.Next(5, 5);
int PN = rnd.Next(1, 721);
Console.WriteLine("You have chosen to generate a pokémon's!");
Console.WriteLine(" Your pokémon's Name is: " + name[new Random().Next(0, name.Length)]);
Console.WriteLine(" Your pokémon's ㏋ is: " + HP);
Console.WriteLine(" Your pokémon's Attack is: " + Atk);
Console.WriteLine(" Your pokémon's Defense is: " + Def);
Console.WriteLine(" Your pokémon's Lvl is: " + Lvl);
Console.WriteLine(" Your pokémon's Gender is: " + gen[new Random().Next(0, gen.Length)]);
Console.WriteLine(" Your pokémon's Pokédex number is: " + PN);
Console.Write("Loading");
for(int i = 0; i < 10; i++)
{
Console.Write(".");
Thread.Sleep(200);
}
Console.WriteLine(" ");
Console.WriteLine("---------------------------------------------------------------------------------------------------------------------");
Console.WriteLine("| You exit the proffesors lab to journey into the world of pokemon |");
Console.WriteLine("| Throughout your journey you may encounter wild pokemon that wish to fight and trainers |");
Console.WriteLine("| |");
Console.WriteLine("---------------------------------------------------------------------------------------------------------------------");
Console.WriteLine("So your journey begins... 30 paces to the gym type (s)"); // Loop 30 times with random chance of battleing
string lf = Console.ReadLine();
if (lf == "s" || lf == "S" || lf == "start" || lf == "Start")
Enumerable.Repeat<Action>(() =>
{
int Find = rnd.Next(1, 3);
if (Find == 1)
{
Console.WriteLine("You Encountered a pokémon");
int HP2 = rnd.Next(1, 100);
int Atk2 = rnd.Next(1, 60);
int Def2 = rnd.Next(1, 40);
int Lvl2 = rnd.Next(1, 100);
int PN2 = rnd.Next(1, 721);
if (Atk >= Def2)
{
Console.WriteLine("You defeated " + random[new Random().Next(0, random.Length)]);
}
else
{
Console.WriteLine("Your pokémon died... Luckily a stranger appeared out of nowhere and revivded it for you so you can continue to battle");
}
}
else
{
Console.WriteLine("You are safe this time");
}
}, 30).ToList().ForEach(x => x());
}
else
{
Console.WriteLine("Sorry to see you go so soon. I hope to meey you one day ~Oak");
}
}
}
</code></pre>
| 0debug |
Need a function to reverse an array in C# : <p>I need to create a function that receives an array items and reverses the order of items in the array and returns it. </p>
<p>Basically if I have an array ['cat', 'dog', 'bird', 'worm'] the function should return an array of ['worm','bird','dog','cat']. </p>
<p>So far I get lost in the function language... I have this.</p>
<pre><code> //Split a string into an array of substring
string avengersNames = "Thor;Iron Man;Spider-Man;Hulk;Hawk Eye";
//Creat an array to hold substring
string[] heroArray = avengersNames.Split(';');
foreach (string hero in heroArray)
{
Console.WriteLine(hero);
}
//Parameter is Array of items
//At a loss when trying to incorporate an array into this function.
public static string[] heroList = new string[5];
{
}
</code></pre>
| 0debug |
What is BOM,DOM,Document and window : There are many question i saw on these concept still i have some doubts that's why asking specifically
What is Browser object Model is this any object in javascript if it is how to access that object and what kind of properties it has
someone please clarify exact definition of each
For example window is a global object created by Javascript engine
We can access it by
window
when we say window we get following properties in console
window
Window {speechSynthesis: SpeechSynthesis, caches: CacheStorage, localStorage: Storage, sessionStorage: Storage, webkitStorageInfo: DeprecatedStorageInfo…}
Similar way what is BOM and DOM
| 0debug |
static void flush_buffered(AVFormatContext *s1, int last)
{
RTPMuxContext *s = s1->priv_data;
if (s->buf_ptr != s->buf) {
if (s->buffered_nals == 1)
ff_rtp_send_data(s1, s->buf + 4, s->buf_ptr - s->buf - 4, last);
else
ff_rtp_send_data(s1, s->buf, s->buf_ptr - s->buf, last);
}
s->buf_ptr = s->buf;
s->buffered_nals = 0;
}
| 1threat |
JavaScript Boolean Values : <p>Am I setting up the boolean values right? Because it's not working for me. Basically, on my website, I only want one alert message popping up (starting with the earliest pop up to the later one) until all fields have been checked.</p>
<hr>
<p>Example:</p>
<p>1) Validate Pizza Size (user selected a pizza size)</p>
<p>2) Validate Toppings (user did not select a pizza size)</p>
<p>3) Validate Text Area (user did not select a pizza size)</p>
<p>Result: Only pop up #2 comes up stating "Select Jalapeno!" and not pop up #3 (if that makes any sense)</p>
<hr>
<p>Here is my JavaScript:</p>
<p><a href="http://pastebin.com/6c2cxU5X" rel="nofollow">http://pastebin.com/6c2cxU5X</a></p>
| 0debug |
Split using regex with (#something) in c# : i want to split above string using regex in c# <br/>
Input :<br/>
"some1 Text (#One) some2 other (#something) some3 Text"
Expected Output:<br/>
some1 Text<br/>
some2 other<br/>
some3 Text | 0debug |
static int qemu_rdma_get_buffer(void *opaque, uint8_t *buf,
int64_t pos, int size)
{
QEMUFileRDMA *r = opaque;
RDMAContext *rdma = r->rdma;
RDMAControlHeader head;
int ret = 0;
CHECK_ERROR_STATE();
r->len = qemu_rdma_fill(r->rdma, buf, size, 0);
if (r->len) {
return r->len;
}
ret = qemu_rdma_exchange_recv(rdma, &head, RDMA_CONTROL_QEMU_FILE);
if (ret < 0) {
rdma->error_state = ret;
return ret;
}
return qemu_rdma_fill(r->rdma, buf, size, 0);
}
| 1threat |
Select first 200 vectors in R Studio : sorry if this is a total newbie question but I am new to R Studio (and coding in general).
I'm trying to plot a linear regression by selecting only the first 200 vector values of my data set (it has 400). How do I do this? Thanks for your help in advance. | 0debug |
db.execute('SELECT * FROM employees WHERE id = ' + user_input) | 1threat |
static void disas_pc_rel_adr(DisasContext *s, uint32_t insn)
{
unsigned int page, rd;
uint64_t base;
int64_t offset;
page = extract32(insn, 31, 1);
offset = ((int64_t)sextract32(insn, 5, 19) << 2) | extract32(insn, 29, 2);
rd = extract32(insn, 0, 5);
base = s->pc - 4;
if (page) {
base &= ~0xfff;
offset <<= 12;
}
tcg_gen_movi_i64(cpu_reg(s, rd), base + offset);
}
| 1threat |
Monad laws expressed in terms of join instead of bind? : <p>The monad laws are traditionally described in terms of <code>>>=</code> and <code>pure</code>:</p>
<pre><code>pure a >>= k = k a
m >>= pure = m
m >>= (\x -> k x >>= h) = (m >>= k) >>= h
</code></pre>
<p>However, monads can also be defined in terms of <code>join</code> instead of <code>>>=</code>. I would like to come up with a formulation of the monad laws in terms of <code>join</code>.</p>
<p>Using <code>x >>= f = join (fmap f x)</code>, it’s easy to rewrite the existing monad laws to eliminate <code>>>=</code>. Simplifying the results slightly with the help of the applicative laws, the first two laws are quite pleasantly expressed:</p>
<pre><code>join . pure = id
join . fmap pure = id
</code></pre>
<p>The intuition for these laws is easy, too, since clearly, introducing an extra “layer” with <code>pure</code> should be a no-op when combined with <code>join</code>. The third law, however, is not nearly so nice. It ends up looking like this:</p>
<pre><code> join (fmap (\x -> join (fmap h (k x))) m)
= join (fmap h (join (fmap k m)))
</code></pre>
<p>This does not pleasantly reduce using the applicative laws, and it’s much harder to understand without staring at it for a while. It certainly doesn’t have the same easy intuition.</p>
<p>Is there an equivalent, alternative formulation of the monad laws in terms of <code>join</code> that is easier to understand? Alternatively, is there any way to simplify the above law, or to make it easier to grok? The version with <code>>>=</code> is already less nice than the one expressed with Kleisli composition, but the version with <code>join</code> is nearly unreadable.</p>
| 0debug |
$"...{}..." string literals in C#? : <p>I want to know why this code works correctly in C# (at least with Visual Studio 2015).
Where can I found information about string literals starting with $ in C#?</p>
<pre><code>class Program
{
static void Main(string[] args)
{
var name = "José";
var age = 40;
Console.WriteLine($"Hello {name}, you have {age} years");
}
}
</code></pre>
| 0debug |
Unable to list target platforms. Please make sure the android sdk path is correct : <p>I am trying to build old unity version(v_4.6.3) project. but i have got a error. already i have got successful result, but current my sdk is updated with latest version.</p>
<p><a href="http://screencast.com/t/u7lNiyoc" rel="noreferrer">http://screencast.com/t/u7lNiyoc</a></p>
<p>Here is my unity error log.</p>
<blockquote>
<pre><code>Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
C:\Program Files\Java\jdk1.8.0_66\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="E:/Temp/sdk\tools" -Dfile.encoding=UTF8 -jar "C:/Program Files (x86)/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -
stderr[
Exception in thread "main" java.lang.NoClassDefFoundError: com/android/utils/ILogger
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at SDKMain.main(SDKMain.java:128)
Caused by: java.lang.ClassNotFoundException: com.android.utils.ILogger
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
]
stdout[
]
</code></pre>
</blockquote>
<p>How can i fix this issues. Thank you for advances. Kind Regards.</p>
| 0debug |
static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
const uint8_t *buf_end = buf + buf_size;
DPCMContext *s = avctx->priv_data;
int out = 0, ret;
int predictor[2];
int ch = 0;
int stereo = s->channels - 1;
int16_t *output_samples;
switch(avctx->codec->id) {
case CODEC_ID_ROQ_DPCM:
out = buf_size - 8;
break;
case CODEC_ID_INTERPLAY_DPCM:
out = buf_size - 6 - s->channels;
break;
case CODEC_ID_XAN_DPCM:
out = buf_size - 2 * s->channels;
break;
case CODEC_ID_SOL_DPCM:
if (avctx->codec_tag != 3)
out = buf_size * 2;
else
out = buf_size;
break;
}
if (out <= 0) {
av_log(avctx, AV_LOG_ERROR, "packet is too small\n");
return AVERROR(EINVAL);
}
s->frame.nb_samples = out / s->channels;
if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
output_samples = (int16_t *)s->frame.data[0];
switch(avctx->codec->id) {
case CODEC_ID_ROQ_DPCM:
buf += 6;
if (stereo) {
predictor[1] = (int16_t)(bytestream_get_byte(&buf) << 8);
predictor[0] = (int16_t)(bytestream_get_byte(&buf) << 8);
} else {
predictor[0] = (int16_t)bytestream_get_le16(&buf);
}
while (buf < buf_end) {
predictor[ch] += s->roq_square_array[*buf++];
predictor[ch] = av_clip_int16(predictor[ch]);
*output_samples++ = predictor[ch];
ch ^= stereo;
}
break;
case CODEC_ID_INTERPLAY_DPCM:
buf += 6;
for (ch = 0; ch < s->channels; ch++) {
predictor[ch] = (int16_t)bytestream_get_le16(&buf);
*output_samples++ = predictor[ch];
}
ch = 0;
while (buf < buf_end) {
predictor[ch] += interplay_delta_table[*buf++];
predictor[ch] = av_clip_int16(predictor[ch]);
*output_samples++ = predictor[ch];
ch ^= stereo;
}
break;
case CODEC_ID_XAN_DPCM:
{
int shift[2] = { 4, 4 };
for (ch = 0; ch < s->channels; ch++)
predictor[ch] = (int16_t)bytestream_get_le16(&buf);
ch = 0;
while (buf < buf_end) {
uint8_t n = *buf++;
int16_t diff = (n & 0xFC) << 8;
if ((n & 0x03) == 3)
shift[ch]++;
else
shift[ch] -= (2 * (n & 3));
if (shift[ch] < 0)
shift[ch] = 0;
diff >>= shift[ch];
predictor[ch] += diff;
predictor[ch] = av_clip_int16(predictor[ch]);
*output_samples++ = predictor[ch];
ch ^= stereo;
}
break;
}
case CODEC_ID_SOL_DPCM:
if (avctx->codec_tag != 3) {
uint8_t *output_samples_u8 = data;
while (buf < buf_end) {
uint8_t n = *buf++;
s->sample[0] += s->sol_table[n >> 4];
s->sample[0] = av_clip_uint8(s->sample[0]);
*output_samples_u8++ = s->sample[0];
s->sample[stereo] += s->sol_table[n & 0x0F];
s->sample[stereo] = av_clip_uint8(s->sample[stereo]);
*output_samples_u8++ = s->sample[stereo];
}
} else {
while (buf < buf_end) {
uint8_t n = *buf++;
if (n & 0x80) s->sample[ch] -= sol_table_16[n & 0x7F];
else s->sample[ch] += sol_table_16[n & 0x7F];
s->sample[ch] = av_clip_int16(s->sample[ch]);
*output_samples++ = s->sample[ch];
ch ^= stereo;
}
}
break;
}
*got_frame_ptr = 1;
*(AVFrame *)data = s->frame;
return buf_size;
}
| 1threat |
How to modify an apk to hide from launcher? : <p>I want to modify an apk as hidden application. please give possible solutions.</p>
| 0debug |
C++ FizzBuzz multi thread consumer producer : I have the FizzBuzz question with couple of threads (producer and consumer)
I found this solution online : https://gist.github.com/masudak/5098917
But i am worried with a specific case,of a bad context switch , where 'isStop'
is true but not all producers finished adding their numbers to queue.
Is it a real issue? or am i msissing something?
public static AtomicInteger counter = new AtomicInteger(0);
public static ConcurrentLinkedQueue<Integer> queue = new ConcurrentLinkedQueue<Integer>();
public static volatile boolean isStop = false;
public static class Producer implements Runnable{
@Override
public void run() {
while ( true ) {
Integer counterValue = counter.incrementAndGet();
if (counterValue <= 100) {
queue.add(counterValue);
} else {
isStop = true;
break;
}
}
}
}
public static class Consumer implements Runnable{
@Override
public void run() {
while ( true ) {
Integer counterValue = queue.poll();
if ( counterValue == null ){
if(isStop){
break;
}
continue;
}
fizzBuzz(counterValue);
}
}
private void fizzBuzz(Integer value){
if( value % 15 == 0 ){
System.out.println("FizzBuzz:" + value);
} else if( value % 3 == 0 ){
System.out.println("Fizz:" + value);
} else if( value % 5 == 0 ){
System.out.println("Buzz:" + value );
}else {
System.out.println(value);
}
}
}
} | 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.