problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
void bdrv_img_create(const char *filename, const char *fmt,
const char *base_filename, const char *base_fmt,
char *options, uint64_t img_size, int flags,
Error **errp, bool quiet)
{
QEMUOptionParameter *param = NULL, *create_options = NULL;
QEMUOptionParameter *backing_fmt, *backing_file, *size;
BlockDriverState *bs = NULL;
BlockDriver *drv, *proto_drv;
BlockDriver *backing_drv = NULL;
int ret = 0;
drv = bdrv_find_format(fmt);
if (!drv) {
error_setg(errp, "Unknown file format '%s'", fmt);
return;
}
proto_drv = bdrv_find_protocol(filename);
if (!proto_drv) {
error_setg(errp, "Unknown protocol '%s'", filename);
return;
}
create_options = append_option_parameters(create_options,
drv->create_options);
create_options = append_option_parameters(create_options,
proto_drv->create_options);
param = parse_option_parameters("", create_options, param);
set_option_parameter_int(param, BLOCK_OPT_SIZE, img_size);
if (options) {
param = parse_option_parameters(options, create_options, param);
if (param == NULL) {
error_setg(errp, "Invalid options for file format '%s'.", fmt);
goto out;
}
}
if (base_filename) {
if (set_option_parameter(param, BLOCK_OPT_BACKING_FILE,
base_filename)) {
error_setg(errp, "Backing file not supported for file format '%s'",
fmt);
goto out;
}
}
if (base_fmt) {
if (set_option_parameter(param, BLOCK_OPT_BACKING_FMT, base_fmt)) {
error_setg(errp, "Backing file format not supported for file "
"format '%s'", fmt);
goto out;
}
}
backing_file = get_option_parameter(param, BLOCK_OPT_BACKING_FILE);
if (backing_file && backing_file->value.s) {
if (!strcmp(filename, backing_file->value.s)) {
error_setg(errp, "Error: Trying to create an image with the "
"same filename as the backing file");
goto out;
}
}
backing_fmt = get_option_parameter(param, BLOCK_OPT_BACKING_FMT);
if (backing_fmt && backing_fmt->value.s) {
backing_drv = bdrv_find_format(backing_fmt->value.s);
if (!backing_drv) {
error_setg(errp, "Unknown backing file format '%s'",
backing_fmt->value.s);
goto out;
}
}
size = get_option_parameter(param, BLOCK_OPT_SIZE);
if (size && size->value.n == -1) {
if (backing_file && backing_file->value.s) {
uint64_t size;
char buf[32];
int back_flags;
back_flags =
flags & ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING);
bs = bdrv_new("");
ret = bdrv_open(bs, backing_file->value.s, NULL, back_flags,
backing_drv);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not open '%s'",
backing_file->value.s);
goto out;
}
bdrv_get_geometry(bs, &size);
size *= 512;
snprintf(buf, sizeof(buf), "%" PRId64, size);
set_option_parameter(param, BLOCK_OPT_SIZE, buf);
} else {
error_setg(errp, "Image creation needs a size parameter");
goto out;
}
}
if (!quiet) {
printf("Formatting '%s', fmt=%s ", filename, fmt);
print_option_parameters(param);
puts("");
}
ret = bdrv_create(drv, filename, param);
if (ret < 0) {
if (ret == -ENOTSUP) {
error_setg(errp,"Formatting or formatting option not supported for "
"file format '%s'", fmt);
} else if (ret == -EFBIG) {
error_setg(errp, "The image size is too large for file format '%s'",
fmt);
} else {
error_setg(errp, "%s: error while creating %s: %s", filename, fmt,
strerror(-ret));
}
}
out:
free_option_parameters(create_options);
free_option_parameters(param);
if (bs) {
bdrv_delete(bs);
}
}
| 1threat |
How to run Python scirpt making a file : #!/usr/bin/env python3
# Script to convert HTML files provided by The Online Plain Text English
# Dictionary (http://www.mso.anu.edu.au/~ralph/OPTED/) into SQLite database
import sys
import sqlite3
from argparse import ArgumentParser, FileType
from bs4 import BeautifulSoup
def parse_args():
parser = ArgumentParser("Create database from HTML dictionary pages")
parser.add_argument("files", metavar="file", nargs="+", type=FileType("rb"))
parser.add_argument("--out", "-o", required=True)
return parser.parse_args()
def create_tables(conn):
conn.execute("DROP TABLE IF EXISTS words")
conn.execute("CREATE TABLE words (id integer primary key, word text, description text)")
conn.commit()
def words(handle):
doc = BeautifulSoup(handle)
for p in doc.find_all("p"):
if len(p.contents) == 4:
word = p.contents[0].string.lower()
definition = p.contents[3].lstrip(") ").replace("\n", " ")
yield word, definition
def insert_words(conn, iter):
conn.executemany("INSERT INTO words VALUES (NULL, ?, ?)", iter)
def main():
args = parse_args()
db = sqlite3.connect(args.out)
create_tables(db)
for handle in args.files:
print("Processing \"{}\"".format(handle.name), file=sys.stderr)
insert_words(db, words(handle))
db.commit()
db.close()
if __name__ == "__main__":
main()
i tried python my_script.py
but it shows this:
usage: Create database from HTML dictionary pages [-h] --out OUT
file [file ...]
Create database from HTML dictionary pages: error: the following arguments are r
equired: file, --out/-o
i dont use python. i just want to run this script and sorry for bad presentation of code I am new at this. | 0debug |
How to create array from certain elements in another array? (python) : I have an array with 7 columns, 52 rows. I want to create an array of just the 4th column but only based a 1 or 0 value from the 7th column. Can someone help? | 0debug |
MATLAB Error! In an assignment A(I) = B, the number of elements in B and I must be the same : I'm new to MATLAB but after some studies and practice I was able to get going and there is this particular model I'm trying to analyze and plot using MATLAB.
Unfortunatley I got stuck on K2 as it brought up this error "***??? In an assignment A(I) = B, the number of elements in B and
I must be the same.***"
I ran the debugger and I found out that J4 alone was a vector while other variables were all scalar.
Please guys how can I resolve this error to have my plot?
Here is the code that I ran.
h1 = 1*10^-6;
h2 = (10:10:1500)*10^-6;
a = 62.5*10^-6;
b = a+h1;
c = b+h2;
alpha_1 = 0.55*10^-6;
alpha_2 = 17.2*10^-6;
alpha_3 = 14.2*10^-6;
zeta = 6.3*10^-6;
P11 = 0.121;
P12 = 0.27;
neff = 1.456;
U1 = 0.17;
U2 = 0.32;
U3 = 0.31;
E1 = 0.74*10^11;
E2 = 1.08*10^11;
E3 = 1.96*10^11;
n = 1;
while(n<=150)
J1(n) = E2*(b^2-a^2)*(1-U1)-E1*a^2*(1-U2)-E1*b^2*(1+U2);
J2(n) = 2*E1*b^2;
J3(n) = E1*E2*(b^2-a^2)*(alpha_2 - alpha_1);
J4(n) = 2*E3*(c(n)^2-b^2)*a^2;
J5(n) = E2*(b^2-a^2)*(1-U3)*b^2+E2*(b^2-a^2)*(1+U3)*c(n)^2-E3*(c(n)^2-b^2)*(1+U2)*a^2-E3*(c(n)^2-b^2)*(1-U2)*b^2;
J6(n) = E2*E3*(c(n)^2 - b^2)*(b^2-a^2)*(alpha_2-alpha_3);
K1(n) = ((alpha_3-alpha_1)*E3*(c(n)^2-b^2)+(alpha_2-alpha_1)*E2*(b^2-a^2))/(E1*a^2+E2*(b^2-a^2)+E3*(c(n)^2-b^2));
K2(n) = (J2*J6-J3*J5)/(J2*J4-J1*J5);
Sr(n) = (neff^2/2)*(P11+P12)*(((1-U1)*K2/E1)-U1*K1);
Sz(n) = (1+P12)*(K1-(2*U2*K2/E1));
St(n) = alpha_1+zeta;
Km(n) = St+Sz+Sr;
n=n+1;
end
plot(h2,Km) | 0debug |
'CREATE PROCEDURE' must be the only statement in the batch (Erro) : <p>I'm creating this table but I'm running into a problem with the first procedure (sp_joseview)</p>
<pre><code>create table josecustomer(
name varchar(50),
address varchar(300),
ssnid int,
balance bigint,
accountnumber bigint
)
insert into josecustomer values('Aman','Canada',10000,5000,100000000)
insert into josecustomer values('Shubham','USA',10001,6000,200000000)
insert into josecustomer values('Himanshu','Australia',10002,2000,300000000)
insert into josecustomer values('Jose','India',10003,3000,400000000)
insert into josecustomer values('Albert','Brazil',10004,4000,500000000)
insert into josecustomer values('Peterson','Germany',10005,7000,600000000)
insert into josecustomer values('Adam','Honkong',10006,8000,700000000)
insert into josecustomer values('William','Paris',10007,9000,800000000)
select * from josecustomer
create proc sp_joseview
as begin
select * from josecustomer
end
go
create proc sp_updatejose
(@accountno bigint,@newbalance bigint)
as begin
update josecustomer
set balance=@newbalance
where accountnumber=@accountno
end
go
</code></pre>
<p>There is a syntax error showing for the first procedure but I can't figure out what that error might be.</p>
| 0debug |
To move, or not to move from r-value ref-qualified method? : <p>In the following C++11+ code which return statement construction should be preferred?</p>
<pre><code>#include <utility>
struct Bar
{
};
struct Foo
{
Bar bar;
Bar get() &&
{
return std::move(bar); // 1
return bar; // 2
}
};
</code></pre>
| 0debug |
How to improve git's diff highlighting? : <p>The output of <code>git diff</code> is optimized for code which tends to be one statement per line whereas text can (if authors like me are too lazy to use line breaks) cause diff output which is very hard to read and more of a "Where's Wally?" search than reading diff output</p>
<p><a href="https://i.stack.imgur.com/R4yLk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/R4yLk.png" alt="enter image description here"></a></p>
<p>whereas highlighting as done on GitLab's or GitHub's web frontend shows the difference immediately</p>
<p><a href="https://i.stack.imgur.com/kPZRP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/kPZRP.png" alt="enter image description here"></a></p>
<p>I'm aware that I'm comparing HTML and plain text (apples and oranges), however it should be possible to improve the <code>git diff</code> output by using different colors or adding marker characters around a change (JUnit uses <code>[]</code> around insertions which isn't great to read, but an example for what I mean) and it would be the first time that there's something I expect to be somewhere available in git that actually was not.</p>
| 0debug |
select checkbox text not changing : BElow is my code. The text is not changing when i select the checkbox.
The text for the checkbox should change but it is not.
IDK
<html>
<head>
<title>OX</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript">
$('#checkbox1').on('change', function () {
window.alert(5 + 6);
if ($('#checkbox1').is(':checked')) {
window.alert(5 + 6);
$("#description").html("Your Checked 1");
} else {
$("#description").html("No check");
}
});
</script>
</head>
<body>
<input type="checkbox" value="0" id="checkbox1" name=""/> Answer one <br/></input>
<span id="description"> Hi Your Text will come here </span>
</body>
</html> | 0debug |
How to update the deprecated python zipline.transforms module? : <p>I wrote a python program using the quantopian zipline package <a href="http://www.zipline.io/beginner-tutorial.html" rel="noreferrer">http://www.zipline.io/beginner-tutorial.html</a>. I recently updated the package and have encountered that the zipline.transforms package is deprecated. I was using two functions from the zipline.transforms package, <code>batch_transform()</code> and <code>MovingAverage</code>. </p>
<p>I haven't been able to find a good post demonstrating how to fix this, other than saying to replace <code>batch_transform</code> with the <code>history()</code> function. However, I am unaware how exactly to replace it. I haven't found a post telling how to fix the MovingAverage deprecation.</p>
<p>Here is my code I am using.</p>
<pre><code>from zipline.algorithm import TradingAlgorithm
from zipline.transforms import batch_transform
from zipline.transforms import MovingAverage
class TradingStrategy(TradingAlgorithm):
def initialize(self, window_length=6):
self.add_transform(
MovingAverage, 'kernel', ['price'], window_length=self.window_length)
@batch_transform
def get_data(data, context):
'''
Collector for some days of historical prices.
'''
daily_prices = data.price[STOCKS + [BENCHMARK]]
return daily_prices
strategy = TradingStrategy()
</code></pre>
<p>Could someone provide an example of how to update the code above? I assume there are many people dealing with the issues given how popular quantopian is.</p>
| 0debug |
static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
AVFrame *frame, const uint8_t *buf, int buf_size)
{
WavpackContext *wc = avctx->priv_data;
ThreadFrame tframe = { .f = frame };
WavpackFrameContext *s;
GetByteContext gb;
void *samples_l = NULL, *samples_r = NULL;
int ret;
int got_terms = 0, got_weights = 0, got_samples = 0,
got_entropy = 0, got_bs = 0, got_float = 0, got_hybrid = 0;
int i, j, id, size, ssize, weights, t;
int bpp, chan = 0, chmask = 0, orig_bpp, sample_rate = 0;
int multiblock;
if (block_no >= wc->fdec_num && wv_alloc_frame_context(wc) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error creating frame decode context\n");
return AVERROR_INVALIDDATA;
}
s = wc->fdec[block_no];
if (!s) {
av_log(avctx, AV_LOG_ERROR, "Context for block %d is not present\n",
block_no);
return AVERROR_INVALIDDATA;
}
memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr));
memset(s->ch, 0, sizeof(s->ch));
s->extra_bits = 0;
s->and = s->or = s->shift = 0;
s->got_extra_bits = 0;
bytestream2_init(&gb, buf, buf_size);
s->samples = bytestream2_get_le32(&gb);
if (s->samples != wc->samples) {
av_log(avctx, AV_LOG_ERROR, "Mismatching number of samples in "
"a sequence: %d and %d\n", wc->samples, s->samples);
return AVERROR_INVALIDDATA;
}
s->frame_flags = bytestream2_get_le32(&gb);
bpp = av_get_bytes_per_sample(avctx->sample_fmt);
orig_bpp = ((s->frame_flags & 0x03) + 1) << 3;
multiblock = (s->frame_flags & WV_SINGLE_BLOCK) != WV_SINGLE_BLOCK;
s->stereo = !(s->frame_flags & WV_MONO);
s->stereo_in = (s->frame_flags & WV_FALSE_STEREO) ? 0 : s->stereo;
s->joint = s->frame_flags & WV_JOINT_STEREO;
s->hybrid = s->frame_flags & WV_HYBRID_MODE;
s->hybrid_bitrate = s->frame_flags & WV_HYBRID_BITRATE;
s->post_shift = bpp * 8 - orig_bpp + ((s->frame_flags >> 13) & 0x1f);
s->hybrid_maxclip = ((1LL << (orig_bpp - 1)) - 1);
s->hybrid_minclip = ((-1LL << (orig_bpp - 1)));
s->CRC = bytestream2_get_le32(&gb);
while (bytestream2_get_bytes_left(&gb)) {
id = bytestream2_get_byte(&gb);
size = bytestream2_get_byte(&gb);
if (id & WP_IDF_LONG) {
size |= (bytestream2_get_byte(&gb)) << 8;
size |= (bytestream2_get_byte(&gb)) << 16;
}
size <<= 1;
ssize = size;
if (id & WP_IDF_ODD)
size--;
if (size < 0) {
av_log(avctx, AV_LOG_ERROR,
"Got incorrect block %02X with size %i\n", id, size);
break;
}
if (bytestream2_get_bytes_left(&gb) < ssize) {
av_log(avctx, AV_LOG_ERROR,
"Block size %i is out of bounds\n", size);
break;
}
switch (id & WP_IDF_MASK) {
case WP_ID_DECTERMS:
if (size > MAX_TERMS) {
av_log(avctx, AV_LOG_ERROR, "Too many decorrelation terms\n");
s->terms = 0;
bytestream2_skip(&gb, ssize);
continue;
}
s->terms = size;
for (i = 0; i < s->terms; i++) {
uint8_t val = bytestream2_get_byte(&gb);
s->decorr[s->terms - i - 1].value = (val & 0x1F) - 5;
s->decorr[s->terms - i - 1].delta = val >> 5;
}
got_terms = 1;
break;
case WP_ID_DECWEIGHTS:
if (!got_terms) {
av_log(avctx, AV_LOG_ERROR, "No decorrelation terms met\n");
continue;
}
weights = size >> s->stereo_in;
if (weights > MAX_TERMS || weights > s->terms) {
av_log(avctx, AV_LOG_ERROR, "Too many decorrelation weights\n");
bytestream2_skip(&gb, ssize);
continue;
}
for (i = 0; i < weights; i++) {
t = (int8_t)bytestream2_get_byte(&gb);
s->decorr[s->terms - i - 1].weightA = t << 3;
if (s->decorr[s->terms - i - 1].weightA > 0)
s->decorr[s->terms - i - 1].weightA +=
(s->decorr[s->terms - i - 1].weightA + 64) >> 7;
if (s->stereo_in) {
t = (int8_t)bytestream2_get_byte(&gb);
s->decorr[s->terms - i - 1].weightB = t << 3;
if (s->decorr[s->terms - i - 1].weightB > 0)
s->decorr[s->terms - i - 1].weightB +=
(s->decorr[s->terms - i - 1].weightB + 64) >> 7;
}
}
got_weights = 1;
break;
case WP_ID_DECSAMPLES:
if (!got_terms) {
av_log(avctx, AV_LOG_ERROR, "No decorrelation terms met\n");
continue;
}
t = 0;
for (i = s->terms - 1; (i >= 0) && (t < size); i--) {
if (s->decorr[i].value > 8) {
s->decorr[i].samplesA[0] =
wp_exp2(bytestream2_get_le16(&gb));
s->decorr[i].samplesA[1] =
wp_exp2(bytestream2_get_le16(&gb));
if (s->stereo_in) {
s->decorr[i].samplesB[0] =
wp_exp2(bytestream2_get_le16(&gb));
s->decorr[i].samplesB[1] =
wp_exp2(bytestream2_get_le16(&gb));
t += 4;
}
t += 4;
} else if (s->decorr[i].value < 0) {
s->decorr[i].samplesA[0] =
wp_exp2(bytestream2_get_le16(&gb));
s->decorr[i].samplesB[0] =
wp_exp2(bytestream2_get_le16(&gb));
t += 4;
} else {
for (j = 0; j < s->decorr[i].value; j++) {
s->decorr[i].samplesA[j] =
wp_exp2(bytestream2_get_le16(&gb));
if (s->stereo_in) {
s->decorr[i].samplesB[j] =
wp_exp2(bytestream2_get_le16(&gb));
}
}
t += s->decorr[i].value * 2 * (s->stereo_in + 1);
}
}
got_samples = 1;
break;
case WP_ID_ENTROPY:
if (size != 6 * (s->stereo_in + 1)) {
av_log(avctx, AV_LOG_ERROR,
"Entropy vars size should be %i, got %i.\n",
6 * (s->stereo_in + 1), size);
bytestream2_skip(&gb, ssize);
continue;
}
for (j = 0; j <= s->stereo_in; j++)
for (i = 0; i < 3; i++) {
s->ch[j].median[i] = wp_exp2(bytestream2_get_le16(&gb));
}
got_entropy = 1;
break;
case WP_ID_HYBRID:
if (s->hybrid_bitrate) {
for (i = 0; i <= s->stereo_in; i++) {
s->ch[i].slow_level = wp_exp2(bytestream2_get_le16(&gb));
size -= 2;
}
}
for (i = 0; i < (s->stereo_in + 1); i++) {
s->ch[i].bitrate_acc = bytestream2_get_le16(&gb) << 16;
size -= 2;
}
if (size > 0) {
for (i = 0; i < (s->stereo_in + 1); i++) {
s->ch[i].bitrate_delta =
wp_exp2((int16_t)bytestream2_get_le16(&gb));
}
} else {
for (i = 0; i < (s->stereo_in + 1); i++)
s->ch[i].bitrate_delta = 0;
}
got_hybrid = 1;
break;
case WP_ID_INT32INFO: {
uint8_t val[4];
if (size != 4) {
av_log(avctx, AV_LOG_ERROR,
"Invalid INT32INFO, size = %i\n",
size);
bytestream2_skip(&gb, ssize - 4);
continue;
}
bytestream2_get_buffer(&gb, val, 4);
if (val[0] > 32) {
av_log(avctx, AV_LOG_ERROR,
"Invalid INT32INFO, extra_bits = %d (> 32)\n", val[0]);
continue;
} else if (val[0]) {
s->extra_bits = val[0];
} else if (val[1]) {
s->shift = val[1];
} else if (val[2]) {
s->and = s->or = 1;
s->shift = val[2];
} else if (val[3]) {
s->and = 1;
s->shift = val[3];
}
if (s->hybrid && bpp == 4 && s->post_shift < 8 && s->shift > 8) {
s->post_shift += 8;
s->shift -= 8;
s->hybrid_maxclip >>= 8;
s->hybrid_minclip >>= 8;
}
break;
}
case WP_ID_FLOATINFO:
if (size != 4) {
av_log(avctx, AV_LOG_ERROR,
"Invalid FLOATINFO, size = %i\n", size);
bytestream2_skip(&gb, ssize);
continue;
}
s->float_flag = bytestream2_get_byte(&gb);
s->float_shift = bytestream2_get_byte(&gb);
s->float_max_exp = bytestream2_get_byte(&gb);
got_float = 1;
bytestream2_skip(&gb, 1);
break;
case WP_ID_DATA:
s->sc.offset = bytestream2_tell(&gb);
s->sc.size = size * 8;
if ((ret = init_get_bits8(&s->gb, gb.buffer, size)) < 0)
return ret;
s->data_size = size * 8;
bytestream2_skip(&gb, size);
got_bs = 1;
break;
case WP_ID_EXTRABITS:
if (size <= 4) {
av_log(avctx, AV_LOG_ERROR, "Invalid EXTRABITS, size = %i\n",
size);
bytestream2_skip(&gb, size);
continue;
}
s->extra_sc.offset = bytestream2_tell(&gb);
s->extra_sc.size = size * 8;
if ((ret = init_get_bits8(&s->gb_extra_bits, gb.buffer, size)) < 0)
return ret;
s->crc_extra_bits = get_bits_long(&s->gb_extra_bits, 32);
bytestream2_skip(&gb, size);
s->got_extra_bits = 1;
break;
case WP_ID_CHANINFO:
if (size <= 1) {
av_log(avctx, AV_LOG_ERROR,
"Insufficient channel information\n");
return AVERROR_INVALIDDATA;
}
chan = bytestream2_get_byte(&gb);
switch (size - 2) {
case 0:
chmask = bytestream2_get_byte(&gb);
break;
case 1:
chmask = bytestream2_get_le16(&gb);
break;
case 2:
chmask = bytestream2_get_le24(&gb);
break;
case 3:
chmask = bytestream2_get_le32(&gb);
break;
case 5:
size = bytestream2_get_byte(&gb);
if (avctx->channels != size)
av_log(avctx, AV_LOG_WARNING, "%i channels signalled"
" instead of %i.\n", size, avctx->channels);
chan |= (bytestream2_get_byte(&gb) & 0xF) << 8;
chmask = bytestream2_get_le16(&gb);
break;
default:
av_log(avctx, AV_LOG_ERROR, "Invalid channel info size %d\n",
size);
chan = avctx->channels;
chmask = avctx->channel_layout;
}
break;
case WP_ID_SAMPLE_RATE:
if (size != 3) {
av_log(avctx, AV_LOG_ERROR, "Invalid custom sample rate.\n");
return AVERROR_INVALIDDATA;
}
sample_rate = bytestream2_get_le24(&gb);
break;
default:
bytestream2_skip(&gb, size);
}
if (id & WP_IDF_ODD)
bytestream2_skip(&gb, 1);
}
if (!got_terms) {
av_log(avctx, AV_LOG_ERROR, "No block with decorrelation terms\n");
return AVERROR_INVALIDDATA;
}
if (!got_weights) {
av_log(avctx, AV_LOG_ERROR, "No block with decorrelation weights\n");
return AVERROR_INVALIDDATA;
}
if (!got_samples) {
av_log(avctx, AV_LOG_ERROR, "No block with decorrelation samples\n");
return AVERROR_INVALIDDATA;
}
if (!got_entropy) {
av_log(avctx, AV_LOG_ERROR, "No block with entropy info\n");
return AVERROR_INVALIDDATA;
}
if (s->hybrid && !got_hybrid) {
av_log(avctx, AV_LOG_ERROR, "Hybrid config not found\n");
return AVERROR_INVALIDDATA;
}
if (!got_bs) {
av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n");
return AVERROR_INVALIDDATA;
}
if (!got_float && avctx->sample_fmt == AV_SAMPLE_FMT_FLTP) {
av_log(avctx, AV_LOG_ERROR, "Float information not found\n");
return AVERROR_INVALIDDATA;
}
if (s->got_extra_bits && avctx->sample_fmt != AV_SAMPLE_FMT_FLTP) {
const int size = get_bits_left(&s->gb_extra_bits);
const int wanted = s->samples * s->extra_bits << s->stereo_in;
if (size < wanted) {
av_log(avctx, AV_LOG_ERROR, "Too small EXTRABITS\n");
s->got_extra_bits = 0;
}
}
if (!wc->ch_offset) {
int sr = (s->frame_flags >> 23) & 0xf;
if (sr == 0xf) {
if (!sample_rate) {
av_log(avctx, AV_LOG_ERROR, "Custom sample rate missing.\n");
return AVERROR_INVALIDDATA;
}
avctx->sample_rate = sample_rate;
} else
avctx->sample_rate = wv_rates[sr];
if (multiblock) {
if (chan)
avctx->channels = chan;
if (chmask)
avctx->channel_layout = chmask;
} else {
avctx->channels = s->stereo ? 2 : 1;
avctx->channel_layout = s->stereo ? AV_CH_LAYOUT_STEREO :
AV_CH_LAYOUT_MONO;
}
frame->nb_samples = s->samples + 1;
if ((ret = ff_thread_get_buffer(avctx, &tframe, 0)) < 0)
return ret;
frame->nb_samples = s->samples;
}
if (wc->ch_offset + s->stereo >= avctx->channels) {
av_log(avctx, AV_LOG_WARNING, "Too many channels coded in a packet.\n");
return (avctx->err_recognition & AV_EF_EXPLODE) ? AVERROR_INVALIDDATA : 0;
}
samples_l = frame->extended_data[wc->ch_offset];
if (s->stereo)
samples_r = frame->extended_data[wc->ch_offset + 1];
wc->ch_offset += 1 + s->stereo;
if (s->stereo_in) {
ret = wv_unpack_stereo(s, &s->gb, samples_l, samples_r, avctx->sample_fmt);
if (ret < 0)
return ret;
} else {
ret = wv_unpack_mono(s, &s->gb, samples_l, avctx->sample_fmt);
if (ret < 0)
return ret;
if (s->stereo)
memcpy(samples_r, samples_l, bpp * s->samples);
}
return 0;
}
| 1threat |
static void null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { }
| 1threat |
static void show_program(WriterContext *w, AVFormatContext *fmt_ctx, AVProgram *program)
{
int i;
writer_print_section_header(w, SECTION_ID_PROGRAM);
print_int("program_id", program->id);
print_int("program_num", program->program_num);
print_int("nb_streams", program->nb_stream_indexes);
print_int("pmt_pid", program->pmt_pid);
print_int("pcr_pid", program->pcr_pid);
print_ts("start_pts", program->start_time);
print_time("start_time", program->start_time, &AV_TIME_BASE_Q);
print_ts("end_pts", program->end_time);
print_time("end_time", program->end_time, &AV_TIME_BASE_Q);
show_tags(w, program->metadata, SECTION_ID_PROGRAM_TAGS);
writer_print_section_header(w, SECTION_ID_PROGRAM_STREAMS);
for (i = 0; i < program->nb_stream_indexes; i++) {
if (selected_streams[program->stream_index[i]])
show_stream(w, fmt_ctx, program->stream_index[i], 1);
}
writer_print_section_footer(w);
writer_print_section_footer(w);
}
| 1threat |
static int usbredir_check_filter(USBRedirDevice *dev)
{
if (dev->interface_info.interface_count == 0) {
ERROR("No interface info for device\n");
goto error;
}
if (dev->filter_rules) {
if (!usbredirparser_peer_has_cap(dev->parser,
usb_redir_cap_connect_device_version)) {
ERROR("Device filter specified and peer does not have the "
"connect_device_version capability\n");
goto error;
}
if (usbredirfilter_check(
dev->filter_rules,
dev->filter_rules_count,
dev->device_info.device_class,
dev->device_info.device_subclass,
dev->device_info.device_protocol,
dev->interface_info.interface_class,
dev->interface_info.interface_subclass,
dev->interface_info.interface_protocol,
dev->interface_info.interface_count,
dev->device_info.vendor_id,
dev->device_info.product_id,
dev->device_info.device_version_bcd,
0) != 0) {
goto error;
}
}
return 0;
error:
usbredir_device_disconnect(dev);
if (usbredirparser_peer_has_cap(dev->parser, usb_redir_cap_filter)) {
usbredirparser_send_filter_reject(dev->parser);
usbredirparser_do_write(dev->parser);
}
return -1;
}
| 1threat |
static void init_proc_e500 (CPUPPCState *env, int version)
{
uint32_t tlbncfg[2];
uint64_t ivor_mask = 0x0000000F0000FFFFULL;
#if !defined(CONFIG_USER_ONLY)
int i;
#endif
gen_tbl(env);
if (version == fsl_e500mc) {
ivor_mask = 0x000003FE0000FFFFULL;
}
gen_spr_BookE(env, ivor_mask);
spr_register(env, SPR_BOOKE_PIR, "PIR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_pir,
0x00000000);
spr_register(env, SPR_BOOKE_SPEFSCR, "SPEFSCR",
&spr_read_spefscr, &spr_write_spefscr,
&spr_read_spefscr, &spr_write_spefscr,
0x00000000);
#if !defined(CONFIG_USER_ONLY)
env->nb_pids = 3;
env->nb_ways = 2;
env->id_tlbs = 0;
switch (version) {
case fsl_e500v1:
tlbncfg[0] = gen_tlbncfg(2, 1, 1, 0, 256);
tlbncfg[1] = gen_tlbncfg(16, 1, 9, TLBnCFG_AVAIL | TLBnCFG_IPROT, 16);
env->dcache_line_size = 32;
env->icache_line_size = 32;
break;
case fsl_e500v2:
tlbncfg[0] = gen_tlbncfg(4, 1, 1, 0, 512);
tlbncfg[1] = gen_tlbncfg(16, 1, 12, TLBnCFG_AVAIL | TLBnCFG_IPROT, 16);
env->dcache_line_size = 32;
env->icache_line_size = 32;
break;
case fsl_e500mc:
tlbncfg[0] = gen_tlbncfg(4, 1, 1, 0, 512);
tlbncfg[1] = gen_tlbncfg(64, 1, 12, TLBnCFG_AVAIL | TLBnCFG_IPROT, 64);
env->dcache_line_size = 64;
env->icache_line_size = 64;
break;
default:
cpu_abort(env, "Unknown CPU: " TARGET_FMT_lx "\n", env->spr[SPR_PVR]);
}
#endif
gen_spr_BookE206(env, 0x000000DF, tlbncfg);
spr_register(env, SPR_HID0, "HID0",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_HID1, "HID1",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_Exxx_BBEAR, "BBEAR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_Exxx_BBTAR, "BBTAR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_Exxx_MCAR, "MCAR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_BOOKE_MCSR, "MCSR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_Exxx_NPIDR, "NPIDR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_Exxx_BUCSR, "BUCSR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_Exxx_L1CFG0, "L1CFG0",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_Exxx_L1CSR0, "L1CSR0",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_e500_l1csr0,
0x00000000);
spr_register(env, SPR_Exxx_L1CSR1, "L1CSR1",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_MMUCSR0, "MMUCSR0",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_booke206_mmucsr0,
0x00000000);
#if !defined(CONFIG_USER_ONLY)
env->nb_tlb = 0;
env->tlb_type = TLB_MAS;
for (i = 0; i < BOOKE206_MAX_TLBN; i++) {
env->nb_tlb += booke206_tlb_size(env, i);
}
#endif
init_excp_e200(env);
ppce500_irq_init(env);
}
| 1threat |
What is the proper way of referencing css and js files with handlebars? : <p>I am currently using express and handlebars for my project. It is my first time of using handlebars and I cannot figure out how to properly reference the position of my css and js files</p>
<p>My current project structure is like below</p>
<pre><code>- test (root)
-views
-js
-some JS files
-css
-some css files
-layout
-main.handlebars
- servers.js (my server)
</code></pre>
<p>so I did following in my main.handlebars layout file</p>
<pre><code><!Doctype html>
<html>
<head>
<title></title>
{{#each css}}
<link rel="stylesheet" href="../css/{{this}}">
{{/each}}
</head>
<body>
{{{body}}}
{{#each js}}
<script src="../js/{{this}}"></script>
{{/each}}
</body>
</html>
</code></pre>
<p>And inside <code>{{this}}</code>, index.css goes in for css and index.js goes in for js.</p>
<p>But this gave <code>Cannot GET 404 http://localhost:8000/js/index.js</code> error. So I thought maybe handlebars look from the root somehow. so I tried</p>
<pre><code><!Doctype html>
<html>
<head>
<title></title>
{{#each css}}
<link rel="stylesheet" href="views/css/{{this}}">
{{/each}}
</head>
<body>
{{{body}}}
{{#each js}}
<script src="views/js/{{this}}"></script>
{{/each}}
</body>
</html>
</code></pre>
<p>But this gave <code>Cannot GET 404 http://localhost:8000/views/js/index.js</code> error when it looks to be the correct position of the file.</p>
<p>What is the correct way of referencing the js and css file in handlebars?</p>
| 0debug |
Vue: Binding radio to boolean : <p>I'm having trouble binding radiobuttons to boolean values in model.</p>
<p>In this example: <a href="https://jsfiddle.net/krillko/npv1snzv/2/" rel="noreferrer">https://jsfiddle.net/krillko/npv1snzv/2/</a></p>
<p>On load, the radio radio button is not checked, and when I try to change them, the 'primary' value in model is becomes empty.</p>
<p>I've tried:</p>
<pre><code>:checked="variation.primary == true"
</code></pre>
<p>but with no effect. </p>
| 0debug |
converting PHP eregi to preg_match, how do I do it? : <p>I am new to regex but I don't have the time right now to learn it,
yet I need to convert eregi("^..?$", $file) to a preg_match() but I
don't know how to do it, can anybody help me?</p>
<p>Also giving me a little understanding of how it works would also be
nice to have :)</p>
<p>The piece of code:</p>
<pre><code>$fileCount = 0;
while ($file = readdir($dh) and $fileCount < 5){
if (eregi("^..?$", $file)) {
continue;
}
$open = "./xml/".$file;
$xml = domxml_open_file($open);
//we need to pull out all the things from this file that we will need to
//build our links
$root = $xml->root();
$stat_array = $root->get_elements_by_tagname("status");
$status = extractText($stat_array);
$ab_array = $root->get_elements_by_tagname("abstract");
$abstract = extractText($ab_array);
$h_array = $root->get_elements_by_tagname("headline");
$headline = extractText($h_array);
if ($status != "live"){
continue;
}
echo "<tr valign=top><td>";
echo "<a href=\"showArticle.php?file=".$file . "\">".$headline . "</a><br>";
echo $abstract;
echo "</td></tr>";
$fileCount++;
}
</code></pre>
| 0debug |
const AVOption *av_opt_next(void *obj, const AVOption *last)
{
AVClass *class = *(AVClass**)obj;
if (!last && class->option && class->option[0].name)
return class->option;
if (last && last[1].name)
return ++last;
return NULL;
}
| 1threat |
static void mips_jazz_init(MemoryRegion *address_space,
MemoryRegion *address_space_io,
ram_addr_t ram_size,
const char *cpu_model,
enum jazz_model_e jazz_model)
{
char *filename;
int bios_size, n;
MIPSCPU *cpu;
CPUMIPSState *env;
qemu_irq *rc4030, *i8259;
rc4030_dma *dmas;
void* rc4030_opaque;
MemoryRegion *rtc = g_new(MemoryRegion, 1);
MemoryRegion *i8042 = g_new(MemoryRegion, 1);
MemoryRegion *dma_dummy = g_new(MemoryRegion, 1);
NICInfo *nd;
DeviceState *dev;
SysBusDevice *sysbus;
ISABus *isa_bus;
ISADevice *pit;
DriveInfo *fds[MAX_FD];
qemu_irq esp_reset, dma_enable;
qemu_irq *cpu_exit_irq;
MemoryRegion *ram = g_new(MemoryRegion, 1);
MemoryRegion *bios = g_new(MemoryRegion, 1);
MemoryRegion *bios2 = g_new(MemoryRegion, 1);
if (cpu_model == NULL) {
#ifdef TARGET_MIPS64
cpu_model = "R4000";
#else
cpu_model = "24Kf";
#endif
}
cpu = cpu_mips_init(cpu_model);
if (cpu == NULL) {
fprintf(stderr, "Unable to find CPU definition\n");
exit(1);
}
env = &cpu->env;
qemu_register_reset(main_cpu_reset, cpu);
memory_region_init_ram(ram, "mips_jazz.ram", ram_size);
vmstate_register_ram_global(ram);
memory_region_add_subregion(address_space, 0, ram);
memory_region_init_ram(bios, "mips_jazz.bios", MAGNUM_BIOS_SIZE);
vmstate_register_ram_global(bios);
memory_region_set_readonly(bios, true);
memory_region_init_alias(bios2, "mips_jazz.bios", bios,
0, MAGNUM_BIOS_SIZE);
memory_region_add_subregion(address_space, 0x1fc00000LL, bios);
memory_region_add_subregion(address_space, 0xfff00000LL, bios2);
if (bios_name == NULL)
bios_name = BIOS_FILENAME;
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename) {
bios_size = load_image_targphys(filename, 0xfff00000LL,
MAGNUM_BIOS_SIZE);
g_free(filename);
} else {
bios_size = -1;
}
if (bios_size < 0 || bios_size > MAGNUM_BIOS_SIZE) {
fprintf(stderr, "qemu: Could not load MIPS bios '%s'\n",
bios_name);
exit(1);
}
cpu_mips_irq_init_cpu(env);
cpu_mips_clock_init(env);
rc4030_opaque = rc4030_init(env->irq[6], env->irq[3], &rc4030, &dmas,
address_space);
memory_region_init_io(dma_dummy, &dma_dummy_ops, NULL, "dummy_dma", 0x1000);
memory_region_add_subregion(address_space, 0x8000d000, dma_dummy);
isa_bus = isa_bus_new(NULL, address_space_io);
i8259 = i8259_init(isa_bus, env->irq[4]);
isa_bus_irqs(isa_bus, i8259);
cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);
DMA_init(0, cpu_exit_irq);
pit = pit_init(isa_bus, 0x40, 0, NULL);
pcspk_init(isa_bus, pit);
isa_mmio_init(0x90000000, 0x01000000);
isa_mem_base = 0x11000000;
switch (jazz_model) {
case JAZZ_MAGNUM:
dev = qdev_create(NULL, "sysbus-g364");
qdev_init_nofail(dev);
sysbus = sysbus_from_qdev(dev);
sysbus_mmio_map(sysbus, 0, 0x60080000);
sysbus_mmio_map(sysbus, 1, 0x40000000);
sysbus_connect_irq(sysbus, 0, rc4030[3]);
{
MemoryRegion *rom_mr = g_new(MemoryRegion, 1);
memory_region_init_ram(rom_mr, "g364fb.rom", 0x80000);
vmstate_register_ram_global(rom_mr);
memory_region_set_readonly(rom_mr, true);
uint8_t *rom = memory_region_get_ram_ptr(rom_mr);
memory_region_add_subregion(address_space, 0x60000000, rom_mr);
rom[0] = 0x10;
}
break;
case JAZZ_PICA61:
isa_vga_mm_init(0x40000000, 0x60000000, 0, get_system_memory());
break;
default:
break;
}
for (n = 0; n < nb_nics; n++) {
nd = &nd_table[n];
if (!nd->model)
nd->model = g_strdup("dp83932");
if (strcmp(nd->model, "dp83932") == 0) {
dp83932_init(nd, 0x80001000, 2, get_system_memory(), rc4030[4],
rc4030_opaque, rc4030_dma_memory_rw);
break;
} else if (strcmp(nd->model, "?") == 0) {
fprintf(stderr, "qemu: Supported NICs: dp83932\n");
exit(1);
} else {
fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd->model);
exit(1);
}
}
esp_init(0x80002000, 0,
rc4030_dma_read, rc4030_dma_write, dmas[0],
rc4030[5], &esp_reset, &dma_enable);
if (drive_get_max_bus(IF_FLOPPY) >= MAX_FD) {
fprintf(stderr, "qemu: too many floppy drives\n");
exit(1);
}
for (n = 0; n < MAX_FD; n++) {
fds[n] = drive_get(IF_FLOPPY, 0, n);
}
fdctrl_init_sysbus(rc4030[1], 0, 0x80003000, fds);
rtc_init(isa_bus, 1980, NULL);
memory_region_init_io(rtc, &rtc_ops, NULL, "rtc", 0x1000);
memory_region_add_subregion(address_space, 0x80004000, rtc);
i8042_mm_init(rc4030[6], rc4030[7], i8042, 0x1000, 0x1);
memory_region_add_subregion(address_space, 0x80005000, i8042);
if (serial_hds[0]) {
serial_mm_init(address_space, 0x80006000, 0, rc4030[8], 8000000/16,
serial_hds[0], DEVICE_NATIVE_ENDIAN);
}
if (serial_hds[1]) {
serial_mm_init(address_space, 0x80007000, 0, rc4030[9], 8000000/16,
serial_hds[1], DEVICE_NATIVE_ENDIAN);
}
if (parallel_hds[0])
parallel_mm_init(address_space, 0x80008000, 0, rc4030[0],
parallel_hds[0]);
audio_init(isa_bus, NULL);
dev = qdev_create(NULL, "ds1225y");
qdev_init_nofail(dev);
sysbus = sysbus_from_qdev(dev);
sysbus_mmio_map(sysbus, 0, 0x80009000);
sysbus_create_simple("jazz-led", 0x8000f000, NULL);
}
| 1threat |
static inline void RENAME(bgr24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
{
int i;
for (i=0; i<width; i++) {
int b= src1[6*i + 0] + src1[6*i + 3];
int g= src1[6*i + 1] + src1[6*i + 4];
int r= src1[6*i + 2] + src1[6*i + 5];
dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);
dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);
}
assert(src1 == src2);
}
| 1threat |
Difference between User and System Installer of Visual Studio Code : <p>Visual Studio code offers User and System Installer but I have not found any description about differences between these two options. </p>
<p>Could someone please shed a light on this for me?</p>
<p>Thank you.</p>
| 0debug |
Beginner encryption program : <p>Been trying to get the encryption to perform the operation and store the value for each of the 4 variables, and then print each of these 4 separate variables. Where am I going wrong? encrypt only wants to work on one of the calculations.</p>
<pre><code>int main(void) {
int a, b, c, d, encrypt;
printf("Enter integer 1:\n");
scanf("%d", &a);
printf("Enter integer 2:\n");
scanf("%d", &b);
printf("Enter integer 3:\n");
scanf("%d", &c);
printf("Enter integer 4:\n");
scanf("%d", &d);
encrypt = (a += 7) % 10, (b +=7) % 10, (c +=7) % 10, (d +=7) % 10;
printf("The encrypted value is: %d%d%d%d\n", encrypt);
//scanf("%d", &encrypt);
return 0;
}
</code></pre>
| 0debug |
What does "create" mean in java : <p>I tried to find it here and over the Web itself but I could not.</p>
<p>I have something like this in code:</p>
<pre><code>private static myClassName create(listOfArguments) {}
</code></pre>
<p>It looks for me like it would be myClassName constructor but normal constructor looks a little bit different. What exactly this <strong>create</strong> mean, and what's it for?</p>
| 0debug |
static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order)
{
int i, tmp, partition, method_type, rice_order;
int rice_bits, rice_esc;
int samples;
method_type = get_bits(&s->gb, 2);
if (method_type > 1) {
av_log(s->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n",
method_type);
return AVERROR_INVALIDDATA;
}
rice_order = get_bits(&s->gb, 4);
samples= s->blocksize >> rice_order;
if (samples << rice_order != s->blocksize) {
av_log(s->avctx, AV_LOG_ERROR, "invalid rice order: %i blocksize %i\n",
rice_order, s->blocksize);
return AVERROR_INVALIDDATA;
}
if (pred_order > samples) {
av_log(s->avctx, AV_LOG_ERROR, "invalid predictor order: %i > %i\n",
pred_order, samples);
return AVERROR_INVALIDDATA;
}
rice_bits = 4 + method_type;
rice_esc = (1 << rice_bits) - 1;
decoded += pred_order;
i= pred_order;
for (partition = 0; partition < (1 << rice_order); partition++) {
tmp = get_bits(&s->gb, rice_bits);
if (tmp == rice_esc) {
tmp = get_bits(&s->gb, 5);
for (; i < samples; i++)
*decoded++ = get_sbits_long(&s->gb, tmp);
} else {
for (; i < samples; i++) {
*decoded++ = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0);
}
}
i= 0;
}
return 0;
}
| 1threat |
Android espresso test pass locally but fails on Firebase Test Lab : <p>I have issue with android espresso test.
Test pass locally but fail on FTL. It's simple test</p>
<p><code>onView(allOf(withId(R.id.text_supercategory_name), withText("Air conditioners"))).
check(matches(withText("Air conditioners")));</code></p>
<p>this test pass locally. On FTL I have error:</p>
<p><code>android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: (with id: blablabla:id/text_product_verdict and with text: is "Air conditioners")</code></p>
<p>I’m not understand whay I see ID which not used in my test <code>id/text_product_verdict</code> … and this ID from another activity …
Activity for test is correct</p>
<p><code>@Rule
public ActivityTestRule<HomeActivity> mActivityTestRule = new ActivityTestRule<>(HomeActivity.class);</code></p>
<p>I checked the video of the failed test on FTL and see a lot of notifications on emulator
<a href="https://i.stack.imgur.com/ubTzt.png" rel="noreferrer">img from FTL</a></p>
<p>I decide that the problem was a sticky notification from Google Hangouts and try run my test with <code>--no-auto-google-login</code> flag. But have the same results. With <code>onView(withText("Air conditioners")).check(matches(isDisplayed()));</code> test pass on FTL.</p>
<p>Is anyone can help with with issue?</p>
| 0debug |
How to set Product price for india in rupees and out of india in dollar? : <p>I developing ecommerce website. Almost i have done. But i have one problem in show product price in dollar. If user open website in india shows product price in rupees and if website access in out of country shows product price in dollar.</p>
<p>I created product detail page and below provide my code: </p>
<pre><code>public function getProductDetail($pro_code,$error_msg){
$showProDetail='';
$result =$this->connect()->query("SELECT * FROM wm_products WHERE pro_code='$pro_code'");
if($result->num_rows>0){
$row = $result->fetch_assoc();
$cate_id = $row['cate_id'];
$image = json_decode($row['pro_img']);
$showProDetail.='
<div class="page product_detail_wrapper">
<div class="panel-body">
<div class="row">
<div class="col-lg-4 col-mg-4 col-sm-4 col-xs-12">
<figure class="thumbnail">
<img src="../uploads/product_images/' .$image[0].'" alt="">
</figure>
</div>
<div class="col-lg-8 col-mg-8 col-sm-8 col-xs-12">
<div class="responsive-table">
<table class="table table-striped">
<tr>
<td><strong>Product Code</strong></td>
<td>:'.$row["pro_code"].'</td>
</tr>
<tr>
<td><strong>Name</strong></td>
<td>:'.ucfirst(str_replace("_", " ", $row["pro_name"])).'</td>
</tr>
<tr>
<td><strong>Price</strong></td>
<td>: Rs.'.$row["pro_price"].'</td>
</tr>
<tr>
<td><strong>Discount</strong></td>
<td>:'.$row["pro_discount"].'</td>
</tr>
<tr>
<td><strong>Available In</strong></td>
<td>:'.$row["pro_weight"].'</td>
</tr>
<tr>
<td><strong>Quantity</strong></td>
<td>:'.$row["pro_quantity"].'</td>
</tr>
<tr>
<td><strong>Short Description</strong></td>
<td>:'.$row["short_disc"].'</td>
</tr>
</table>
</div>
</div>
</div><br>
</div>
</div>';
}
else{
$showProDetail = '<div class="alert alert-danger">Product Detail Not Found</div>';
}
return $showProDetail;
}
</code></pre>
<p>So, How to set Product price for india in rupees and out of india in dollar?</p>
| 0debug |
static void png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type,
uint8_t *src, uint8_t *last, int size, int bpp)
{
int i, p, r, g, b, a;
switch (filter_type) {
case PNG_FILTER_VALUE_NONE:
memcpy(dst, src, size);
break;
case PNG_FILTER_VALUE_SUB:
for (i = 0; i < bpp; i++) {
dst[i] = src[i];
}
if (bpp == 4) {
p = *(int*)dst;
for (; i < size; i += bpp) {
int s = *(int*)(src + i);
p = ((s & 0x7f7f7f7f) + (p & 0x7f7f7f7f)) ^ ((s ^ p) & 0x80808080);
*(int*)(dst + i) = p;
}
} else {
#define OP_SUB(x,s,l) x+s
UNROLL_FILTER(OP_SUB);
}
break;
case PNG_FILTER_VALUE_UP:
dsp->add_bytes_l2(dst, src, last, size);
break;
case PNG_FILTER_VALUE_AVG:
for (i = 0; i < bpp; i++) {
p = (last[i] >> 1);
dst[i] = p + src[i];
}
#define OP_AVG(x,s,l) (((x + l) >> 1) + s) & 0xff
UNROLL_FILTER(OP_AVG);
break;
case PNG_FILTER_VALUE_PAETH:
for (i = 0; i < bpp; i++) {
p = last[i];
dst[i] = p + src[i];
}
if (bpp > 2 && size > 4) {
int w = bpp == 4 ? size : size - 3;
dsp->add_paeth_prediction(dst + i, src + i, last + i, w - i, bpp);
i = w;
}
ff_add_png_paeth_prediction(dst + i, src + i, last + i, size - i, bpp);
break;
}
}
| 1threat |
static void dec_wcsr(DisasContext *dc)
{
int no;
LOG_DIS("wcsr r%d, %d\n", dc->r1, dc->csr);
switch (dc->csr) {
case CSR_IE:
tcg_gen_mov_tl(cpu_ie, cpu_R[dc->r1]);
tcg_gen_movi_tl(cpu_pc, dc->pc + 4);
dc->is_jmp = DISAS_UPDATE;
break;
case CSR_IM:
if (use_icount) {
gen_io_start();
}
gen_helper_wcsr_im(cpu_env, cpu_R[dc->r1]);
tcg_gen_movi_tl(cpu_pc, dc->pc + 4);
if (use_icount) {
gen_io_end();
}
dc->is_jmp = DISAS_UPDATE;
break;
case CSR_IP:
if (use_icount) {
gen_io_start();
}
gen_helper_wcsr_ip(cpu_env, cpu_R[dc->r1]);
tcg_gen_movi_tl(cpu_pc, dc->pc + 4);
if (use_icount) {
gen_io_end();
}
dc->is_jmp = DISAS_UPDATE;
break;
case CSR_ICC:
break;
case CSR_DCC:
break;
case CSR_EBA:
tcg_gen_mov_tl(cpu_eba, cpu_R[dc->r1]);
break;
case CSR_DEBA:
tcg_gen_mov_tl(cpu_deba, cpu_R[dc->r1]);
break;
case CSR_JTX:
gen_helper_wcsr_jtx(cpu_env, cpu_R[dc->r1]);
break;
case CSR_JRX:
gen_helper_wcsr_jrx(cpu_env, cpu_R[dc->r1]);
break;
case CSR_DC:
gen_helper_wcsr_dc(cpu_env, cpu_R[dc->r1]);
break;
case CSR_BP0:
case CSR_BP1:
case CSR_BP2:
case CSR_BP3:
no = dc->csr - CSR_BP0;
if (dc->num_breakpoints <= no) {
qemu_log_mask(LOG_GUEST_ERROR,
"breakpoint #%i is not available\n", no);
t_gen_illegal_insn(dc);
break;
}
gen_helper_wcsr_bp(cpu_env, cpu_R[dc->r1], tcg_const_i32(no));
break;
case CSR_WP0:
case CSR_WP1:
case CSR_WP2:
case CSR_WP3:
no = dc->csr - CSR_WP0;
if (dc->num_watchpoints <= no) {
qemu_log_mask(LOG_GUEST_ERROR,
"watchpoint #%i is not available\n", no);
t_gen_illegal_insn(dc);
break;
}
gen_helper_wcsr_wp(cpu_env, cpu_R[dc->r1], tcg_const_i32(no));
break;
case CSR_CC:
case CSR_CFG:
qemu_log_mask(LOG_GUEST_ERROR, "invalid write access csr=%x\n",
dc->csr);
break;
default:
qemu_log_mask(LOG_GUEST_ERROR, "write_csr: unknown csr=%x\n",
dc->csr);
break;
}
}
| 1threat |
static int parse_playlist(HLSContext *c, const char *url,
struct variant *var, AVIOContext *in)
{
int ret = 0, is_segment = 0, is_variant = 0, bandwidth = 0;
int64_t duration = 0;
enum KeyType key_type = KEY_NONE;
uint8_t iv[16] = "";
int has_iv = 0;
char key[MAX_URL_SIZE] = "";
char line[1024];
const char *ptr;
int close_in = 0;
if (!in) {
AVDictionary *opts = NULL;
close_in = 1;
av_dict_set(&opts, "seekable", "0", 0);
av_dict_set(&opts, "user-agent", c->user_agent, 0);
av_dict_set(&opts, "cookies", c->cookies, 0);
ret = avio_open2(&in, url, AVIO_FLAG_READ,
c->interrupt_callback, &opts);
av_dict_free(&opts);
if (ret < 0)
return ret;
}
read_chomp_line(in, line, sizeof(line));
if (strcmp(line, "#EXTM3U")) {
ret = AVERROR_INVALIDDATA;
goto fail;
}
if (var) {
free_segment_list(var);
var->finished = 0;
}
while (!url_feof(in)) {
read_chomp_line(in, line, sizeof(line));
if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
struct variant_info info = {{0}};
is_variant = 1;
ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args,
&info);
bandwidth = atoi(info.bandwidth);
} else if (av_strstart(line, "#EXT-X-KEY:", &ptr)) {
struct key_info info = {{0}};
ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_key_args,
&info);
key_type = KEY_NONE;
has_iv = 0;
if (!strcmp(info.method, "AES-128"))
key_type = KEY_AES_128;
if (!strncmp(info.iv, "0x", 2) || !strncmp(info.iv, "0X", 2)) {
ff_hex_to_data(iv, info.iv + 2);
has_iv = 1;
}
av_strlcpy(key, info.uri, sizeof(key));
} else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) {
if (!var) {
var = new_variant(c, 0, url, NULL);
if (!var) {
ret = AVERROR(ENOMEM);
goto fail;
}
}
var->target_duration = atoi(ptr) * AV_TIME_BASE;
} else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
if (!var) {
var = new_variant(c, 0, url, NULL);
if (!var) {
ret = AVERROR(ENOMEM);
goto fail;
}
}
var->start_seq_no = atoi(ptr);
} else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) {
if (var)
var->finished = 1;
} else if (av_strstart(line, "#EXTINF:", &ptr)) {
is_segment = 1;
duration = atof(ptr) * AV_TIME_BASE;
} else if (av_strstart(line, "#", NULL)) {
continue;
} else if (line[0]) {
if (is_variant) {
if (!new_variant(c, bandwidth, line, url)) {
ret = AVERROR(ENOMEM);
goto fail;
}
is_variant = 0;
bandwidth = 0;
}
if (is_segment) {
struct segment *seg;
if (!var) {
var = new_variant(c, 0, url, NULL);
if (!var) {
ret = AVERROR(ENOMEM);
goto fail;
}
}
seg = av_malloc(sizeof(struct segment));
if (!seg) {
ret = AVERROR(ENOMEM);
goto fail;
}
seg->duration = duration;
seg->key_type = key_type;
if (has_iv) {
memcpy(seg->iv, iv, sizeof(iv));
} else {
int seq = var->start_seq_no + var->n_segments;
memset(seg->iv, 0, sizeof(seg->iv));
AV_WB32(seg->iv + 12, seq);
}
ff_make_absolute_url(seg->key, sizeof(seg->key), url, key);
ff_make_absolute_url(seg->url, sizeof(seg->url), url, line);
dynarray_add(&var->segments, &var->n_segments, seg);
is_segment = 0;
}
}
}
if (var)
var->last_load_time = av_gettime();
fail:
if (close_in)
avio_close(in);
return ret;
}
| 1threat |
static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt) {
GetByteContext gb;
AVFrame * const p = data;
unsigned int version, w, h, d3d_format, depth, stride, flags;
unsigned int y, v;
uint8_t *ptr;
uint32_t *pal;
int ret;
bytestream2_init(&gb, avpkt->data, avpkt->size);
version = bytestream2_get_le32(&gb);
bytestream2_skip(&gb, 72);
d3d_format = bytestream2_get_le32(&gb);
w = bytestream2_get_le16(&gb);
h = bytestream2_get_le16(&gb);
depth = bytestream2_get_byte(&gb);
bytestream2_skip(&gb, 2);
flags = bytestream2_get_byte(&gb);
if (version < 8 || version > 9) {
av_log(avctx, AV_LOG_ERROR, "texture data version %i is unsupported\n",
version);
return AVERROR_PATCHWELCOME;
}
if (depth == 8) {
avctx->pix_fmt = AV_PIX_FMT_PAL8;
} else if (depth == 16 || depth == 32) {
avctx->pix_fmt = AV_PIX_FMT_RGB32;
} else {
av_log(avctx, AV_LOG_ERROR, "depth of %i is unsupported\n", depth);
return AVERROR_PATCHWELCOME;
}
if ((ret = ff_set_dimensions(avctx, w, h)) < 0)
return ret;
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
return ret;
p->pict_type = AV_PICTURE_TYPE_I;
ptr = p->data[0];
stride = p->linesize[0];
if (depth == 8) {
pal = (uint32_t *) p->data[1];
for (y = 0; y < 256; y++) {
v = bytestream2_get_be32(&gb);
pal[y] = (v >> 8) + (v << 24);
}
if (bytestream2_get_bytes_left(&gb) < w * h)
return AVERROR_INVALIDDATA;
bytestream2_skip(&gb, 4);
for (y=0; y<h; y++) {
bytestream2_get_buffer(&gb, ptr, w);
ptr += stride;
}
} else if (depth == 16) {
bytestream2_skip(&gb, 4);
switch (d3d_format) {
case 0:
if (!(flags & 1))
goto unsupported;
case FF_S3TC_DXT1:
if (bytestream2_get_bytes_left(&gb) < (w/4) * (h/4) * 8)
return AVERROR_INVALIDDATA;
ff_decode_dxt1(&gb, ptr, w, h, stride);
break;
case FF_S3TC_DXT3:
if (bytestream2_get_bytes_left(&gb) < (w/4) * (h/4) * 16)
return AVERROR_INVALIDDATA;
ff_decode_dxt3(&gb, ptr, w, h, stride);
break;
default:
goto unsupported;
}
} else if (depth == 32) {
switch (d3d_format) {
case 0x15:
case 0x16:
if (bytestream2_get_bytes_left(&gb) < h * w * 4)
return AVERROR_INVALIDDATA;
for (y=0; y<h; y++) {
bytestream2_get_buffer(&gb, ptr, w * 4);
ptr += stride;
}
break;
default:
goto unsupported;
}
}
*got_frame = 1;
return avpkt->size;
unsupported:
av_log(avctx, AV_LOG_ERROR, "unsupported d3d format (%08x)\n", d3d_format);
return AVERROR_PATCHWELCOME;
}
| 1threat |
Why didn't Visual Studio warm me about a logical comparison error? : <p>I was dumb and forgot, when making logical comparisons in a portion of my code in Visual Studio to use "==" instead of "=". My program compiled and ran fine, which interested me. Visual Studio seems to catch a lot of errors like syntax, but I'm wondering now why it didn't catch my error in compilation or even before compiling. I've seen other IDEs catch these logical errors before and during compilation. </p>
<p>Is this a compiler issue? Or an IDE specific issue? </p>
<p>I'm just curious. </p>
| 0debug |
Visual Studio hangs when creating Azure App Service : <p>I'm trying to follow a tutorial on Azure deployment. I'm stuck on one of the first steps creating the App Service. It seams that the form tries to find all App Service Plans but can't, so all of Visual Studio hangs. I had to kill it with Task Manager. Any clues on how I can fix this? Do I need to create something at the Azure management console?</p>
<p><a href="https://i.stack.imgur.com/ofRSU.png"><img src="https://i.stack.imgur.com/ofRSU.png" alt="enter image description here"></a></p>
| 0debug |
how to upload image by below code : I am trying to upload image by the below code. I am getting the file name from input file field.
if(isset($_REQUEST['requestsubmit'])){
$field_values_array1 = $_REQUEST['name'];
$field_values_array2 = $_REQUEST['address'];
$field_values_array3 = $_REQUEST['image'];
print_r($field_values_array1);
/*foreach($field_values_array as $k=>$value){}*/
foreach($field_values_array1 as $k=>$value1){}
foreach($field_values_array2 as $k=>$value2){}
foreach($field_values_array3 as $k=>$value3){
//your database query goes here
$insert ="INSERT INTO `infotown_house`.`test` (`id`, `userName`, `cat`, `det`) VALUES (NULL, '".$field_values_array1[$k]."', '".$field_values_array2[$k]."', '".$field_values_array3[$k]."')";
mysql_query($insert); | 0debug |
Can anyone explain what is TraitCollectionDidChange/UITraitCollection in simple term? :
public override void TraitCollectionDidChange(UITraitCollection previousTraitCollection)
base.TraitCollectionDidChange(previousTraitCollection)
What does base.traicollectiondidchange do? | 0debug |
struct omap_dss_s *omap_dss_init(struct omap_target_agent_s *ta,
MemoryRegion *sysmem,
hwaddr l3_base,
qemu_irq irq, qemu_irq drq,
omap_clk fck1, omap_clk fck2, omap_clk ck54m,
omap_clk ick1, omap_clk ick2)
{
struct omap_dss_s *s = (struct omap_dss_s *)
g_malloc0(sizeof(struct omap_dss_s));
s->irq = irq;
s->drq = drq;
omap_dss_reset(s);
memory_region_init_io(&s->iomem_diss1, NULL, &omap_diss_ops, s, "omap.diss1",
omap_l4_region_size(ta, 0));
memory_region_init_io(&s->iomem_disc1, NULL, &omap_disc_ops, s, "omap.disc1",
omap_l4_region_size(ta, 1));
memory_region_init_io(&s->iomem_rfbi1, NULL, &omap_rfbi_ops, s, "omap.rfbi1",
omap_l4_region_size(ta, 2));
memory_region_init_io(&s->iomem_venc1, NULL, &omap_venc_ops, s, "omap.venc1",
omap_l4_region_size(ta, 3));
memory_region_init_io(&s->iomem_im3, NULL, &omap_im3_ops, s,
"omap.im3", 0x1000);
omap_l4_attach(ta, 0, &s->iomem_diss1);
omap_l4_attach(ta, 1, &s->iomem_disc1);
omap_l4_attach(ta, 2, &s->iomem_rfbi1);
omap_l4_attach(ta, 3, &s->iomem_venc1);
memory_region_add_subregion(sysmem, l3_base, &s->iomem_im3);
#if 0
s->state = graphic_console_init(omap_update_display,
omap_invalidate_display, omap_screen_dump, s);
#endif
return s;
}
| 1threat |
jquery click function and change bacground manipulating after : >**suppose inside a document there are 4 label and i want there background >become white when i click but when i click other label , the previous >label back to its default ***without using add class or remove class*****
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/3fwgA.png
<header>
<label for="slide_trigger1">
<i class="fa fa-dot-circle-o" aria-hidden="true"></i>
</label>
<label for="slide_trigger2">
<i class="fa fa-dot-circle-o" aria-hidden="true"></i>
</label>
<label for="slide_trigger3">
<i class="fa fa-dot-circle-o" aria-hidden="true"></i>
</label>
<label for="slide_trigger4">
<i class="fa fa-dot-circle-o" aria-hidden="true"></i>
</label>
</header>
<script>
$(document).ready(function(e){
$('label').click(function(){
$(this).css({"background":"#fff","color":"green","border-radius":"100%" });
});
});
</script> | 0debug |
A regex which separate text and text surrounded by html markup : <p>I have that sort of string:</p>
<pre><code> ____<b> <i> Hi</i> </b> my name is <i>Henry</i> and i'm very <span style=\"background-color: rgb(102, 102, 153);\">stylish</span>
</code></pre>
<p>And I'm searching for a pattern which separate simple text and text with HTML markup, in my exemple I need:</p>
<pre><code>____
<b> <i> Hi</i> </b>
my name is
<i>Henry</i>
and i'm very
<span style=\"background-color: rgb(102, 102, 153);\">stylish</span>
</code></pre>
<p>I've tried with that pattern:</p>
<pre><code>"<[^>]*>][^</]*[\\s]*[<[^>]*>]|[^<[^>]*>][^</]*[\\s]*[^<[^>]*>]"
</code></pre>
<p>But he only work when there isn't a markup which follow one another</p>
| 0debug |
Change the ActiveStorage Controller Path : <p>Is there a way to customize the attachment urls so instead of</p>
<pre><code>/rails/active_storage/representations/
/rails/active_storage/blobs/
</code></pre>
<p>We could have something like this:</p>
<pre><code>/custom_path/representations/
/custom_path/blobs/
</code></pre>
| 0debug |
unable to start activity, android.content.res.Resources$NotFoundException: String resource ID #0x0 : <p>I'm developing an android game, and I'm stuck with this problem.<br />
This is the secondary activity, when I click the button that takes me to the second activity, it shows some errors, I'm trying to figure this out on my on by searching and experimenting by my self, but it didn't work<br />
This is my activity :</p>
<pre><code>package game.esolindo.com.gametest;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MoneyActivity extends ActionBarActivity {
private TextView txtMoney;
private Button btnWork;
private Button btnBuyClothes;
int workMoney = 15;
int buyClothesMoney = 20;
int currentMoney;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_money);
txtMoney = (TextView)findViewById(R.id.txtMoney);
btnWork = (Button)findViewById(R.id.btnWork);
btnWork.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
currentMoney = currentMoney + workMoney;
txtMoney.setText(String.valueOf(currentMoney));
}
});
btnBuyClothes = (Button)findViewById(R.id.btnBuyClothes);
btnBuyClothes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
currentMoney = currentMoney - buyClothesMoney;
txtMoney.setText(String.valueOf(currentMoney));
}
});
txtMoney.setText(currentMoney);
}
}
</code></pre>
<p>This is my xml file :</p>
<pre><code><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="game.esolindo.com.gametest.MoneyActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Money"
android:id="@+id/txtMoneyText"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="0"
android:textSize="50sp"
android:id="@+id/txtMoney"
android:layout_below="@+id/txtMoneyText"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Work"
android:id="@+id/btnWork"
android:layout_marginTop="20dp"
android:layout_below="@+id/txtMoney"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Buy Clothes"
android:id="@+id/btnBuyClothes"
android:layout_below="@+id/btnWork"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</code></pre>
<p></p>
<p>And this is the error message I received :</p>
<pre><code>01-14 04:00:15.927 22640-22640/game.esolindo.com.gametest E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: game.esolindo.com.gametest, PID: 22640
java.lang.RuntimeException: Unable to start activity ComponentInfo{game.esolindo.com.gametest/game.esolindo.com.gametest.MoneyActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x0
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0
at android.content.res.Resources.getText(Resources.java:244)
at android.widget.TextView.setText(TextView.java:3888)
at game.esolindo.com.gametest.MoneyActivity.onCreate(MoneyActivity.java:46)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
</code></pre>
<p>Please help me fix this<br />
Thanks in advance</p>
| 0debug |
static void print_block_info(Monitor *mon, BlockInfo *info,
BlockDeviceInfo *inserted, bool verbose)
{
ImageInfo *image_info;
assert(!info || !info->has_inserted || info->inserted == inserted);
if (info) {
monitor_printf(mon, "%s", info->device);
if (inserted && inserted->has_node_name) {
monitor_printf(mon, " (%s)", inserted->node_name);
}
} else {
assert(inserted);
monitor_printf(mon, "%s",
inserted->has_node_name
? inserted->node_name
: "<anonymous>");
}
if (inserted) {
monitor_printf(mon, ": %s (%s%s%s)\n",
inserted->file,
inserted->drv,
inserted->ro ? ", read-only" : "",
inserted->encrypted ? ", encrypted" : "");
} else {
monitor_printf(mon, ": [not inserted]\n");
}
if (info) {
if (info->has_io_status && info->io_status != BLOCK_DEVICE_IO_STATUS_OK) {
monitor_printf(mon, " I/O status: %s\n",
BlockDeviceIoStatus_lookup[info->io_status]);
}
if (info->removable) {
monitor_printf(mon, " Removable device: %slocked, tray %s\n",
info->locked ? "" : "not ",
info->tray_open ? "open" : "closed");
}
}
if (!inserted) {
return;
}
monitor_printf(mon, " Cache mode: %s%s%s\n",
inserted->cache->writeback ? "writeback" : "writethrough",
inserted->cache->direct ? ", direct" : "",
inserted->cache->no_flush ? ", ignore flushes" : "");
if (inserted->has_backing_file) {
monitor_printf(mon,
" Backing file: %s "
"(chain depth: %" PRId64 ")\n",
inserted->backing_file,
inserted->backing_file_depth);
}
if (inserted->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF) {
monitor_printf(mon, " Detect zeroes: %s\n",
BlockdevDetectZeroesOptions_lookup[inserted->detect_zeroes]);
}
if (inserted->bps || inserted->bps_rd || inserted->bps_wr ||
inserted->iops || inserted->iops_rd || inserted->iops_wr)
{
monitor_printf(mon, " I/O throttling: bps=%" PRId64
" bps_rd=%" PRId64 " bps_wr=%" PRId64
" bps_max=%" PRId64
" bps_rd_max=%" PRId64
" bps_wr_max=%" PRId64
" iops=%" PRId64 " iops_rd=%" PRId64
" iops_wr=%" PRId64
" iops_max=%" PRId64
" iops_rd_max=%" PRId64
" iops_wr_max=%" PRId64
" iops_size=%" PRId64 "\n",
inserted->bps,
inserted->bps_rd,
inserted->bps_wr,
inserted->bps_max,
inserted->bps_rd_max,
inserted->bps_wr_max,
inserted->iops,
inserted->iops_rd,
inserted->iops_wr,
inserted->iops_max,
inserted->iops_rd_max,
inserted->iops_wr_max,
inserted->iops_size);
}
if (verbose && inserted->image) {
monitor_printf(mon, "\nImages:\n");
image_info = inserted->image;
while (1) {
bdrv_image_info_dump((fprintf_function)monitor_printf,
mon, image_info);
if (image_info->has_backing_image) {
image_info = image_info->backing_image;
} else {
break;
}
}
}
}
| 1threat |
R - calculating mean of every 3 values in array using a for loop : <p>Very new to programming - I have an array with dimension 821 and I would like to take the average of every 3 values. Each line represents monthly data and I need the quarterly averages (so every 3 months). I want to do it using for loops for practice but I cannot figure it out. </p>
| 0debug |
How to get alternative routes' directions? Google map android v2 : I'm making an android application that can display google maps' route and alternative routes by declaring alternatives to true. I can also get the directions for the suggested or preferred route. However, I do not know how to get the alternative routes directions or data. I really need help asap. | 0debug |
Mac OS X Mojave Font thinner on Chrome - how to fix? : <p>Every font is thinner on Mac OS X Mojave on Chrome. See references like (<a href="https://www.reddit.com/r/MacOS/comments/8ol061/anyone_else_feel_the_text_is_slightly_less_bold/" rel="noreferrer">here</a> or <a href="https://github.com/Microsoft/vscode/issues/51132" rel="noreferrer">here</a>).</p>
<p>That is my main problem and I need your suggestions what to do. I'm currently developing a website, but now the design looks way off. On Safari it's okay. But should I "wait" until there is a fix? </p>
<p>The reason is that they removed subpixel font aliasing.</p>
<p>What does this mean for a CSS developer?</p>
<p>Is there a fix somehow?</p>
| 0debug |
How to merge two same column datatable cells in one cell with comma sepreated in c#? : I have tow datatable with the same column like:-
input datatable1- Column1 Column2 Column3
Aa Bb Cc
Dd Ee Ff
input datatable2- Column1 Column2 Column3
Gg Hh Ii
Jj Kk Ll
I need output table like:-
Column1 Column2 Column3
Aa,Gg Bb,Hh Cc,Ii
Dd,Jj Ee,Kk Ff,Li
Thanks in advance for help!
| 0debug |
Django: AttributeError: 'NoneType' object has no attribute 'split' : <p>I'm trying to build a static site generator using Django (because its resourceful that way), and right now my problems are dealing with the Django command that is supposed to build my static site content into a directory. Apparently my 'NoneType' object has no attribute 'split', but I dont know what that 'NoneType' object is.</p>
<pre><code>(thisSite) C:\Users\Jaysp_000\thisSite\PROJECTx>python prototype.py build
Traceback (most recent call last):
File "prototype.py", line 31, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\core\management\__init__.py",
line 338, in execute_from_command_line
utility.execute()
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\core\management\__init__.py",
line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\core\management\base.py", lin
e 390, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\core\management\base.py", lin
e 441, in execute
output = self.handle(*args, **options)
File "C:\Users\Jaysp_000\thisSite\PROJECTx\sitebuilder\management\commands\build.py", li
ne 38, in handle
response = this_client_will.get(the_page_url)
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\test\client.py", line 500, in
get
**extra)
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\test\client.py", line 303, in
get
return self.generic('GET', path, secure=secure, **r)
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\test\client.py", line 379, in
generic
return self.request(**r)
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\test\client.py", line 466, in
request
six.reraise(*exc_info)
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\utils\six.py", line 659, in r
eraise
raise value
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\core\handlers\base.py", line
132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\Jaysp_000\thisSite\PROJECTx\sitebuilder\views.py", line 35, in page
return render(request, 'page.html', context)
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\shortcuts.py", line 67, in re
nder
template_name, context, request=request, using=using)
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\template\loader.py", line 99,
in render_to_string
return template.render(context, request)
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\template\backends\django.py",
line 74, in render
return self.template.render(context)
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\template\base.py", line 208,
in render
with context.bind_template(self):
File "C:\Python34\Lib\contextlib.py", line 59, in __enter__
return next(self.gen)
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\template\context.py", line 23
5, in bind_template
updates.update(processor(self.request))
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\template\context_processors.p
y", line 56, in i18n
context_extras['LANGUAGE_BIDI'] = translation.get_language_bidi()
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\utils\translation\__init__.py
", line 177, in get_language_bidi
return _trans.get_language_bidi()
File "C:\Users\Jaysp_000\thisSite\lib\site-packages\django\utils\translation\trans_real.
py", line 263, in get_language_bidi
base_lang = get_language().split('-')[0]
AttributeError: 'NoneType' object has no attribute 'split'
</code></pre>
<p>It seems that my problem lies in my command file, which I call <code>build</code>. The traceback also brings up my <code>views</code> file, which works well on its own (that is, my html files can be properly served on the local server), but I will include it anyway.</p>
<p><strong>build.py</strong></p>
<pre><code>import os, shutil
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.core.urlresolvers import reverse
from django.test.client import Client
def get_pages():
for name in os.listdir(settings.STATIC_PAGES_DIRECTORY):
if name.endswith('.html'):
yield name[:-5]
class Command(BaseCommand):
help = 'Build static site output.'
def handle(self, *args, **options):
"""Request pages and build output."""
if os.path.exists(settings.SITE_OUTPUT_DIRECTORY):
shutil.rmtree(settings.SITE_OUTPUT_DIRECTORY)
os.mkdir(settings.SITE_OUTPUT_DIRECTORY)
os.makedirs(settings.STATIC_ROOT)
call_command('collectstatic', interactive=False, clear=True, verbosity=0)
this_client_will = Client()
for page in get_pages():
the_page_url = reverse('page',kwargs={'slug': page}) # PROBLEM SEEMS TO GENERATE STARTING HERE
response = this_client_will.get(the_page_url)
if page == 'index.html':
output_dir = settings.SITE_OUTPUT_DIRECTORY
else:
output_dir = os.path.join(settings.SITE_OUTPUT_DIRECTORY, page)
os.makedirs(output_dir)
with open(os.path.join(output_dir, 'index.html'), 'wb', encoding='utf8') as f:
f.write(response.content)
</code></pre>
<p><strong>views.py</strong></p>
<pre><code>import os
from django.conf import settings
from django.http import Http404
from django.shortcuts import render
from django.template import Template
from django.utils._os import safe_join
# Create your views here.
def get_page_or_404(name):
"""Returns page content as a Django template or raise 404 error"""
try:
file_path = safe_join(settings.STATIC_PAGES_DIRECTORY, name)
except ValueError:
raise Http404("Page Not Found")
else:
if not os.path.exists(file_path):
raise Http404("Page Not Found")
with open(file_path,"r", encoding='utf8') as f:
the_page = Template(f.read())
return the_page
def page(request, slug='index'):
""" Render the requested page if found """
file_name = '{0}.html'.format(slug)
page = get_page_or_404(file_name)
context = {'slug': slug, 'page': page}
return render(request, 'page.html', context) # THE TRACEBACK POINTS AT THIS LINE, TOO
</code></pre>
<p>and just in case it becomes useful to know, here is my <strong>urls.py</strong>:</p>
<pre><code>from django.conf.urls import include, url
urlpatterns = [
url(r'^page/(?P<slug>[-\w]+)/$', 'sitebuilder.views.page', name='page'),
url(r'^page$', 'sitebuilder.views.page', name='homepage'),
]
</code></pre>
<p>I find this frustrating, primarily because this problem seems to be tied to the reverse() function, as seen in the build module, and I havent had a great time using that function for as long as I can remember, but I dont know if this is really my problem. Can someone help me figure out where my issue is coming from and how to solve it (if you have any tips)? It would be much appreciated.</p>
| 0debug |
removing newlines from messy strings in pandas dataframe cells? : <p>I've used multiple ways of splitting and stripping the strings in my pandas dataframe to remove all the '\n'characters, but for some reason it simply doesn't want to delete the characters that are attached to other words, even though I split them. I have a pandas dataframe with a column that captures text from web pages using Beautifulsoup. The text has been cleaned a bit already by beautifulsoup, but it failed in removing the newlines attached to other characters. My strings look a bit like this:</p>
<p>"hands-on\ndevelopment of games. We will study a variety of software technologies\nrelevant to games including programming languages, scripting\nlanguages, operating systems, file systems, networks, simulation\nengines, and multi-media design systems. We will also study some of\nthe underlying scientific concepts from computer science and related\nfields including"</p>
<p>Is there an easy python way to remove these "\n" characters? </p>
<p>Thanks in advance!</p>
| 0debug |
FragmentManager is already executing transactions. When is it safe to initialise pager after commit? : <p>I have an activity hosting two fragments. The activity starts off showing a loader while it loads an object. The loaded object is then passed to both fragments as arguments via newInstance methods and those fragments are attached.</p>
<pre><code>final FragmentTransaction trans = getSupportFragmentManager().beginTransaction();
trans.replace(R.id.container1, Fragment1.newInstance(loadedObject));
trans.replace(R.id.container2, Fragment2.newInstance(loadedObject));
trans.commit();
</code></pre>
<p>The second fragment contains a android.support.v4.view.ViewPager and tabs. onResume we initialise it like follows</p>
<pre><code>viewPager.setAdapter(adapter);
viewPager.setOffscreenPageLimit(adapter.getCount()); //the count is always < 4
tabLayout.setupWithViewPager(viewPager);
</code></pre>
<p>The problem is android then throws </p>
<blockquote>
<p>java.lang.IllegalStateException: FragmentManager is already executing
transactions</p>
</blockquote>
<p>With this stack trace: <em>(I took <code>android.support</code> out of the package names just for brevity)</em></p>
<blockquote>
<p>v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1620)
at
v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:637)
at
v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:143)
at v4.view.ViewPager.populate(ViewPager.java:1235)
at v4.view.ViewPager.populate(ViewPager.java:1083)
at
v4.view.ViewPager.setOffscreenPageLimit(ViewPager.java:847)</p>
</blockquote>
<p>The data shows if <code>setOffscreenPageLimit(...);</code> is removed. Is there another way to avoid this issue?</p>
<p>When in the lifecycle is the fragment transaction complete so that I can wait to setup my pager?</p>
| 0debug |
Do we really need permissions in android 6? : After all the hassle of searching on google, I have managed to request storage permission, to make my apps "compliant" with the new permission system introduced in android [Marshmallow][1]. But now, I noticed, I actually didn't need to make all that effort as permissions get granted by the system automatically without requesting. (seen while installing ES File Explorer, or my own apps). Do we actually need to request permissions?
PS: I am using a Samsung Galaxy S7
[1]: https://www.android.com/versions/marshmallow-6-0/ | 0debug |
Find the specific number from Array.collect : <p>I want to find out what's the first, the second, and the third result, so that I can do <code>if firstnumber==secondnumber && secondnumber==thirdnumber</code>. How could I find those numbers on the results?</p>
<pre><code>numbers = 3.times.map { Random.new.rand(0..10000) }
prizes = numbers.map do |x|
case x
when 1..3000
[ '7', 10000 ]
when 3001..6000
[ "Cherries", 500 ]
when 6001..10000
[ "Diamond", 400 ]
end
end
puts "Your results are: #{prizes.collect { |p| p[0] }.join(", ")}!
</code></pre>
<p>I tried to use p[0][0], but it gives the first letter instead.</p>
| 0debug |
Opening non-default browser with lite-server in angular2 quick start guide : <p>Having followed the TypeScript version of the <a href="https://angular.io/docs/ts/latest/quickstart.html">Angular 2 Quick Start guide</a>, I was wondering if it is possible, and if so how to configure the lite-server to launch a browser other than the default.</p>
<p>It seems lite-server will take command line args, served to it via <code>yargs.argv</code>. And it seems <code>yargs</code> will attempt to parse command line args based on fairly common standards (i.e. If a token begins with a <code>--</code>, it represents an argument name, otherwise an argument value) to obtain <code>argv</code>. lite-server will attempt to use the <code>open</code> property that it gets from <code>argv</code>, which is ultimately what launches the browser via [one of the of the node packages that launches processes]. node-open? xdg -open? Not sure, not really as important to me right now as long as my assumption (based on looking at several of these process launchers) is correct, that they all optionally take an argument defining the process to launch. If omitted, the default browser would be used since the file type to open is html, which is what happens.</p>
<p>If all that is correct, or at least the gist of it, then it seems I just need to specify <code>--open chrome</code>, for example (assuming chrome is in my <code>PATH</code> - working on a win machine btw), at the end of the <code>lite</code> command defined in <code>package.json</code>.</p>
<p>So something like...</p>
<pre><code>"scripts": {
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"lite:c": "lite-server --open chrome",
"lite:f": "lite-server --open firefox ",
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
},
</code></pre>
<p>I apologize if this seems inane, but I won't be at a computer where I can test this for a few days, and I need to know if I have the answer and can stop researching this :). Thanks!</p>
| 0debug |
static void gen_dmfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
{
const char *rn = "invalid";
if (sel != 0)
check_insn(ctx, ISA_MIPS64);
switch (reg) {
case 0:
switch (sel) {
case 0:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Index));
rn = "Index";
break;
case 1:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mfc0_mvpcontrol(arg, cpu_env);
rn = "MVPControl";
break;
case 2:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mfc0_mvpconf0(arg, cpu_env);
rn = "MVPConf0";
break;
case 3:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mfc0_mvpconf1(arg, cpu_env);
rn = "MVPConf1";
break;
default:
goto cp0_unimplemented;
}
break;
case 1:
switch (sel) {
case 0:
CP0_CHECK(!(ctx->insn_flags & ISA_MIPS32R6));
gen_helper_mfc0_random(arg, cpu_env);
rn = "Random";
break;
case 1:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEControl));
rn = "VPEControl";
break;
case 2:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEConf0));
rn = "VPEConf0";
break;
case 3:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEConf1));
rn = "VPEConf1";
break;
case 4:
CP0_CHECK(ctx->insn_flags & ASE_MT);
tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_YQMask));
rn = "YQMask";
break;
case 5:
CP0_CHECK(ctx->insn_flags & ASE_MT);
tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_VPESchedule));
rn = "VPESchedule";
break;
case 6:
CP0_CHECK(ctx->insn_flags & ASE_MT);
tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_VPEScheFBack));
rn = "VPEScheFBack";
break;
case 7:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_VPEOpt));
rn = "VPEOpt";
break;
default:
goto cp0_unimplemented;
}
break;
case 2:
switch (sel) {
case 0:
tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_EntryLo0));
rn = "EntryLo0";
break;
case 1:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mfc0_tcstatus(arg, cpu_env);
rn = "TCStatus";
break;
case 2:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mfc0_tcbind(arg, cpu_env);
rn = "TCBind";
break;
case 3:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_dmfc0_tcrestart(arg, cpu_env);
rn = "TCRestart";
break;
case 4:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_dmfc0_tchalt(arg, cpu_env);
rn = "TCHalt";
break;
case 5:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_dmfc0_tccontext(arg, cpu_env);
rn = "TCContext";
break;
case 6:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_dmfc0_tcschedule(arg, cpu_env);
rn = "TCSchedule";
break;
case 7:
CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_dmfc0_tcschefback(arg, cpu_env);
rn = "TCScheFBack";
break;
default:
goto cp0_unimplemented;
}
break;
case 3:
switch (sel) {
case 0:
tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_EntryLo1));
rn = "EntryLo1";
break;
default:
goto cp0_unimplemented;
}
break;
case 4:
switch (sel) {
case 0:
tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_Context));
rn = "Context";
break;
case 1:
rn = "ContextConfig";
goto cp0_unimplemented;
case 2:
CP0_CHECK(ctx->ulri);
tcg_gen_ld_tl(arg, cpu_env,
offsetof(CPUMIPSState, active_tc.CP0_UserLocal));
rn = "UserLocal";
break;
default:
goto cp0_unimplemented;
}
break;
case 5:
switch (sel) {
case 0:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_PageMask));
rn = "PageMask";
break;
case 1:
check_insn(ctx, ISA_MIPS32R2);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_PageGrain));
rn = "PageGrain";
break;
default:
goto cp0_unimplemented;
}
break;
case 6:
switch (sel) {
case 0:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Wired));
rn = "Wired";
break;
case 1:
check_insn(ctx, ISA_MIPS32R2);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SRSConf0));
rn = "SRSConf0";
break;
case 2:
check_insn(ctx, ISA_MIPS32R2);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SRSConf1));
rn = "SRSConf1";
break;
case 3:
check_insn(ctx, ISA_MIPS32R2);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SRSConf2));
rn = "SRSConf2";
break;
case 4:
check_insn(ctx, ISA_MIPS32R2);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SRSConf3));
rn = "SRSConf3";
break;
case 5:
check_insn(ctx, ISA_MIPS32R2);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SRSConf4));
rn = "SRSConf4";
break;
default:
goto cp0_unimplemented;
}
break;
case 7:
switch (sel) {
case 0:
check_insn(ctx, ISA_MIPS32R2);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_HWREna));
rn = "HWREna";
break;
default:
goto cp0_unimplemented;
}
break;
case 8:
switch (sel) {
case 0:
tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_BadVAddr));
rn = "BadVAddr";
break;
case 1:
CP0_CHECK(ctx->bi);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_BadInstr));
rn = "BadInstr";
break;
case 2:
CP0_CHECK(ctx->bp);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_BadInstrP));
rn = "BadInstrP";
break;
default:
goto cp0_unimplemented;
}
break;
case 9:
switch (sel) {
case 0:
if (use_icount)
gen_io_start();
gen_helper_mfc0_count(arg, cpu_env);
if (use_icount) {
gen_io_end();
}
ctx->bstate = BS_STOP;
rn = "Count";
break;
default:
goto cp0_unimplemented;
}
break;
case 10:
switch (sel) {
case 0:
tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_EntryHi));
rn = "EntryHi";
break;
default:
goto cp0_unimplemented;
}
break;
case 11:
switch (sel) {
case 0:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Compare));
rn = "Compare";
break;
default:
goto cp0_unimplemented;
}
break;
case 12:
switch (sel) {
case 0:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Status));
rn = "Status";
break;
case 1:
check_insn(ctx, ISA_MIPS32R2);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_IntCtl));
rn = "IntCtl";
break;
case 2:
check_insn(ctx, ISA_MIPS32R2);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SRSCtl));
rn = "SRSCtl";
break;
case 3:
check_insn(ctx, ISA_MIPS32R2);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SRSMap));
rn = "SRSMap";
break;
default:
goto cp0_unimplemented;
}
break;
case 13:
switch (sel) {
case 0:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Cause));
rn = "Cause";
break;
default:
goto cp0_unimplemented;
}
break;
case 14:
switch (sel) {
case 0:
tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_EPC));
rn = "EPC";
break;
default:
goto cp0_unimplemented;
}
break;
case 15:
switch (sel) {
case 0:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_PRid));
rn = "PRid";
break;
case 1:
check_insn(ctx, ISA_MIPS32R2);
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_EBase));
rn = "EBase";
break;
default:
goto cp0_unimplemented;
}
break;
case 16:
switch (sel) {
case 0:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config0));
rn = "Config";
break;
case 1:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config1));
rn = "Config1";
break;
case 2:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config2));
rn = "Config2";
break;
case 3:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config3));
rn = "Config3";
break;
case 4:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config4));
rn = "Config4";
break;
case 5:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config5));
rn = "Config5";
break;
case 6:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config6));
rn = "Config6";
break;
case 7:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config7));
rn = "Config7";
break;
default:
goto cp0_unimplemented;
}
break;
case 17:
switch (sel) {
case 0:
gen_helper_dmfc0_lladdr(arg, cpu_env);
rn = "LLAddr";
break;
default:
goto cp0_unimplemented;
}
break;
case 18:
switch (sel) {
case 0 ... 7:
gen_helper_1e0i(dmfc0_watchlo, arg, sel);
rn = "WatchLo";
break;
default:
goto cp0_unimplemented;
}
break;
case 19:
switch (sel) {
case 0 ... 7:
gen_helper_1e0i(mfc0_watchhi, arg, sel);
rn = "WatchHi";
break;
default:
goto cp0_unimplemented;
}
break;
case 20:
switch (sel) {
case 0:
check_insn(ctx, ISA_MIPS3);
tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_XContext));
rn = "XContext";
break;
default:
goto cp0_unimplemented;
}
break;
case 21:
CP0_CHECK(!(ctx->insn_flags & ISA_MIPS32R6));
switch (sel) {
case 0:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Framemask));
rn = "Framemask";
break;
default:
goto cp0_unimplemented;
}
break;
case 22:
tcg_gen_movi_tl(arg, 0);
rn = "'Diagnostic";
break;
case 23:
switch (sel) {
case 0:
gen_helper_mfc0_debug(arg, cpu_env);
rn = "Debug";
break;
case 1:
rn = "TraceControl";
case 2:
rn = "TraceControl2";
case 3:
rn = "UserTraceData";
case 4:
rn = "TraceBPC";
default:
goto cp0_unimplemented;
}
break;
case 24:
switch (sel) {
case 0:
tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_DEPC));
rn = "DEPC";
break;
default:
goto cp0_unimplemented;
}
break;
case 25:
switch (sel) {
case 0:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Performance0));
rn = "Performance0";
break;
case 1:
rn = "Performance1";
case 2:
rn = "Performance2";
case 3:
rn = "Performance3";
case 4:
rn = "Performance4";
case 5:
rn = "Performance5";
case 6:
rn = "Performance6";
case 7:
rn = "Performance7";
default:
goto cp0_unimplemented;
}
break;
case 26:
tcg_gen_movi_tl(arg, 0);
rn = "ECC";
break;
case 27:
switch (sel) {
case 0 ... 3:
tcg_gen_movi_tl(arg, 0);
rn = "CacheErr";
break;
default:
goto cp0_unimplemented;
}
break;
case 28:
switch (sel) {
case 0:
case 2:
case 4:
case 6:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_TagLo));
rn = "TagLo";
break;
case 1:
case 3:
case 5:
case 7:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_DataLo));
rn = "DataLo";
break;
default:
goto cp0_unimplemented;
}
break;
case 29:
switch (sel) {
case 0:
case 2:
case 4:
case 6:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_TagHi));
rn = "TagHi";
break;
case 1:
case 3:
case 5:
case 7:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_DataHi));
rn = "DataHi";
break;
default:
goto cp0_unimplemented;
}
break;
case 30:
switch (sel) {
case 0:
tcg_gen_ld_tl(arg, cpu_env, offsetof(CPUMIPSState, CP0_ErrorEPC));
rn = "ErrorEPC";
break;
default:
goto cp0_unimplemented;
}
break;
case 31:
switch (sel) {
case 0:
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_DESAVE));
rn = "DESAVE";
break;
case 2 ... 7:
CP0_CHECK(ctx->kscrexist & (1 << sel));
tcg_gen_ld_tl(arg, cpu_env,
offsetof(CPUMIPSState, CP0_KScratch[sel-2]));
rn = "KScratch";
break;
default:
goto cp0_unimplemented;
}
break;
default:
goto cp0_unimplemented;
}
(void)rn;
LOG_DISAS("dmfc0 %s (reg %d sel %d)\n", rn, reg, sel);
return;
cp0_unimplemented:
LOG_DISAS("dmfc0 %s (reg %d sel %d)\n", rn, reg, sel);
gen_mfc0_unimplemented(ctx, arg);
}
| 1threat |
Unresolved external symbol in qt project : <p>Okay so spend 30 min or so having a look at common causes for this issue and I can't see what is wrong. </p>
<p>The error I am getting is unresolved external symbol. The symbol in question being a class called AdventureDocs. The header is as follows.</p>
<pre><code>#ifndef ADVENTUREDOCS_H
#define ADVENTUREDOCS_H
#include <QWidget>
class AdventureDocs : public QWidget
{
Q_OBJECT
public:
AdventureDocs(QObject *parent);
};
#endif // ADVENTUREDOCS_H
</code></pre>
<p>and the cpp</p>
<pre><code>#include "adventuredocs.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QLabel>
#include <QTabWidget>
AdventureDocs::AdventureDocs(QObject *parent): QWidget(parent)
{
QHBoxLayout *hLayout = 0;
QVBoxLayout *vLayout = 0;
QPushButton *button = 0;
QLabel *label = 0;
hLayout = new QHBoxLayout();
Q_ASSERT(hLayout);
vLayout = new QVBoxLayout();
Q_ASSERT(vLayout);
// Set the layout to the widget
setLayout(hLayout);
hLayout->addLayout(vLayout);
// Draw widgets on main page.
label = new QLabel(hLayout);
Q_ASSERT(label);
hLayout->addWidget(label);
label->setText("Adventure Docs");
}
</code></pre>
<p>This is a class not a library or anything smart like that I used add new class in qt creator to add it and that added the header and cpp into the project file as follows.</p>
<pre><code>#-------------------------------------------------
#
# Project created by QtCreator 2016-06-12T11:06:47
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = AdventureDocs
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
adventuredocs.cpp
HEADERS += mainwindow.h \
adventuredocs.h
FORMS += mainwindow.ui
</code></pre>
<p>finally in the mainwindow .cpp where i create an AdventureDocs object is where i get the error.</p>
<pre><code>#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QPushButton>
#include "adventuredocs.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
AdventureDocs *main = 0;
main = new AdventureDocs(this);
if (main != 0)
{
setCentralWidget(main);
}
}
MainWindow::~MainWindow()
{
delete ui;
}
</code></pre>
<p>Can someone point out the bleeding obvious which I am clearly missing thanks.</p>
| 0debug |
Android Firebase Remote Config: Application name is not set. Call Builder#setApplicationName : <p>Whenever I call <code>FirebaseRemoteConfig.getInstance()</code>, I get this warning:</p>
<p><code>W/zze: Application name is not set. Call Builder#setApplicationName.</code></p>
<p>I've updated the json config file from Firebase, but it remains the same. It does not affect any functionality, but I can't help but think something is missing. Any configurations I might be missing somewhere?</p>
| 0debug |
Web form appliction : In my web form white space on the right side how to remove it or resize the panel
I have tried padding and margin also width for panel and container but not working
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<style>
.container {
margin-top: 50px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js" type="text/javascript" ></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" type="text/javascript" ></script>
</head>
<body>
<div class="container" >
<div class="panel panel-primary" >
<div class="panel-heading" >
<h3 class="panel-title ">Personal Infomation</h3>
</div>
<div class="panel-body " >
<br>
<div id="p_info">
<div class="row">
<div class="col-md-6">
<label class="control-label">First Name</label>
<input class="form-control" id="first_name" >
</div>
</div>
<div class="row" >
<div class="col-md-6">
<label class="control-label">Last Name</label>
<input class="form-control" id="last_name" >
</div>
</div>
<div class="row">
<div class="col-md-6">
<label class="control-label">Gender</label>
<select class="form-control field" id="sel1" >
<option disabled selected value> -- select an option -- </option>
<option>Male</option>
<option>Female</option>
</select>
</div>
</div>
<div class="row">
<div class="col-md-6">
<label class="control-label">Date of Birth</label>
<input type="date" name="bdaytime" class="form-control" id="DOB" >
</div>
</div>
<div class="row">
<div class="col-md-6">
<label class="control-label">Place of Birth</label>
<input class="form-control" id="Place" >
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
I want to remove white space on this web from. why would this shows like that
let me know.I want to remove white space on this web from. why would this shows like that
let me know.I want to remove white space on this web from. why would this shows like that
let me know.
[I want to remove marked part][1]
[1]: https://i.stack.imgur.com/6F7QT.png
| 0debug |
Comparing corresponding values of two lines in a file using awk : <pre><code>name1 20160801|76 20160802|67 20160803|49 20160804|35 20160805|55 20160806|76 20160807|77 20160808|70 2016089|50 20160810|75 20160811|97 20160812|90 20160813|87 20160814|99 20160815|113 20160816|83 20160817|57 20160818|158 20160819|61 20160820|46 20160821|1769608 20160822|2580938 20160823|436093 20160824|75 20160825|57 20160826|70 20160827|97 20160828|101 20160829|96 20160830|95 20160831|89
name2 20160801|32413 20160802|37707 20160803|32230 20160804|31711 20160805|32366 20160806|35532 20160807|36961 20160808|45423 2016089|65230 20160810|111078 20160811|74357 20160812|71196 20160813|71748 20160814|77001 20160815|91687 20160816|92076 20160817|89706 20160818|126690 20160819|168587 20160820|207128 20160821|221440 20160822|234594 20160823|200963 20160824|165231 20160825|139600 20160826|145483 20160827|209013 20160828|228550 20160829|223712 20160830|217959 20160831|169106
</code></pre>
<p>I have the line position of two lines in a file say line1 and line2. These lines may be anywhere in the file but I can access the line position using a search keyword based on name(the first word) in each line</p>
<p>20160801 means yyyymmdd and has an associated value separated by |
I need to compare the values associated with each of the date for the given two lines.</p>
<p>I am a newbie in awk. I am not understanding how to compare these two lines at the same time.</p>
| 0debug |
Getting warning "NDK is missing a 'platforms" directory.' with no NDK : <p>I've got a project that only uses the Android SDK, not the NDK, but I'm getting warnings whenever I build with gradle about the NDK:</p>
<p><code>NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /usr/local/opt/android-sdk/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.</code></p>
<p>Seems like a pretty clear warning. I'm not using the ndk, so there is no <code>ndk-bundle</code> in my <code>android-sdk</code>. The issue is that I don't have an <code>ANDROID_NDK_HOME</code> set, and my <code>local.properties</code> file (which appears to be generated by Android Studio) doesn't set the NDK:</p>
<p><code>sdk.dir=/usr/local/opt/android-sdk</code></p>
<p>I do have an ANDROID_HOME environment variable:</p>
<p><code>ANDROID_HOME=/usr/local/opt/android-sdk</code></p>
<p>System is a mac, but we seem to get the same issue in Docker. Anyone know how to get rid of this warning?</p>
| 0debug |
static void ps_decorrelate_c(INTFLOAT (*out)[2], INTFLOAT (*delay)[2],
INTFLOAT (*ap_delay)[PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2],
const INTFLOAT phi_fract[2], const INTFLOAT (*Q_fract)[2],
const INTFLOAT *transient_gain,
INTFLOAT g_decay_slope,
int len)
{
static const INTFLOAT a[] = { Q31(0.65143905753106f),
Q31(0.56471812200776f),
Q31(0.48954165955695f) };
INTFLOAT ag[PS_AP_LINKS];
int m, n;
for (m = 0; m < PS_AP_LINKS; m++)
ag[m] = AAC_MUL30(a[m], g_decay_slope);
for (n = 0; n < len; n++) {
INTFLOAT in_re = AAC_MSUB30(delay[n][0], phi_fract[0], delay[n][1], phi_fract[1]);
INTFLOAT in_im = AAC_MADD30(delay[n][0], phi_fract[1], delay[n][1], phi_fract[0]);
for (m = 0; m < PS_AP_LINKS; m++) {
INTFLOAT a_re = AAC_MUL31(ag[m], in_re);
INTFLOAT a_im = AAC_MUL31(ag[m], in_im);
INTFLOAT link_delay_re = ap_delay[m][n+2-m][0];
INTFLOAT link_delay_im = ap_delay[m][n+2-m][1];
INTFLOAT fractional_delay_re = Q_fract[m][0];
INTFLOAT fractional_delay_im = Q_fract[m][1];
INTFLOAT apd_re = in_re;
INTFLOAT apd_im = in_im;
in_re = AAC_MSUB30(link_delay_re, fractional_delay_re,
link_delay_im, fractional_delay_im);
in_re -= a_re;
in_im = AAC_MADD30(link_delay_re, fractional_delay_im,
link_delay_im, fractional_delay_re);
in_im -= a_im;
ap_delay[m][n+5][0] = apd_re + AAC_MUL31(ag[m], in_re);
ap_delay[m][n+5][1] = apd_im + AAC_MUL31(ag[m], in_im);
}
out[n][0] = AAC_MUL16(transient_gain[n], in_re);
out[n][1] = AAC_MUL16(transient_gain[n], in_im);
}
}
| 1threat |
How to set Text color in JButton : have someone know how to set a part of Text Color in JButton.
For example:
My JButton have a Text:"I Love YOU."
Now ,I want to draw only the word "**Love**" with **RED** color,and word "I" "You" with black color.
Waht should i do for it? | 0debug |
IONIC 3 - Admob Free not displaying Ads when testing is false : <p>I have a problem with Ionic 3 when trying to display ads with Admob Free plugin.
My Ads will only show in test mode (isTesting: true).
If I set it to false or comment the line, no Ads ...</p>
<p>This is my code: </p>
<pre><code>showBannerAd(){
const bannerConfig: AdMobFreeBannerConfig = {
id:'BANNER-ID',
autoShow: true,
isTesting: false
}
this.adMob.banner.config(bannerConfig);
this.adMob.banner.prepare().then(()=>{
//this.adMob.banner.show();
}).catch(err => console.log(err));
}
</code></pre>
<p>If I uncomment the line this.adMob.banner.show() to force the ads, only a black unit appears.</p>
<p>I thought it could be related to my project, so I even started a blank project and the results were the same.</p>
<p>Has anyone fixed before?
Thanks!!! </p>
| 0debug |
python - remove values from a dict : I want to make a function called remove_short_synonyms() which is passed a dict
as a parameter. The keys of the parameter dict are words and the
corresponding values are lists of synonyms. The function removes all the
synonyms which have less than 7 characters from each corresponding list
of synonyms.
If this is the dict:
synonyms_dict = {'beautiful' : ['pretty', 'lovely', 'handsome', 'dazzling', 'splendid', 'magnificent']}
How can I get this as the output?
{beautiful : ['dazzling', 'handsome', 'magnificent', 'splendid']} | 0debug |
static void *rcu_update_perf_test(void *arg)
{
long long n_updates_local = 0;
rcu_register_thread();
*(struct rcu_reader_data **)arg = &rcu_reader;
atomic_inc(&nthreadsrunning);
while (goflag == GOFLAG_INIT) {
g_usleep(1000);
}
while (goflag == GOFLAG_RUN) {
synchronize_rcu();
n_updates_local++;
}
atomic_add(&n_updates, n_updates_local);
rcu_unregister_thread();
return NULL;
}
| 1threat |
A new expression requires () : <p>I am following some Microsoft tutorial and got a code like this but it doesn't work.</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
int[] liczby = new int liczby[] { 5, 6, 7, 8 ,9, 10 };
Console.WriteLine(liczby[5]);
Console.ReadKey();
}
}
}
</code></pre>
| 0debug |
Why I cannot assign event listner to a button? : Here's the code to add event listeners to all the button elements in my html. Why does it not work?
window.onload = function(){
addEvListeners();
// This function is to assign ELs to buttons in my HTML
function addEvListeners(){
var target = document.getElementsByTagName("button");
for (i = 0; i <= target.length - 1; i ++){
target[i].addEventListener("click", function(){model();},false);
}
}
function model(){
return true; // just for placeholder
}
} | 0debug |
static int caf_write_trailer(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
AVCodecContext *enc = s->streams[0]->codec;
if (pb->seekable) {
CAFContext *caf = s->priv_data;
int64_t file_size = avio_tell(pb);
avio_seek(pb, caf->data, SEEK_SET);
avio_wb64(pb, file_size - caf->data - 8);
avio_seek(pb, file_size, SEEK_SET);
if (!enc->block_align) {
ffio_wfourcc(pb, "pakt");
avio_wb64(pb, caf->size_entries_used + 24);
avio_wb64(pb, caf->packets);
avio_wb64(pb, caf->packets * samples_per_packet(enc->codec_id, enc->channels));
avio_wb32(pb, 0);
avio_wb32(pb, 0);
avio_write(pb, caf->pkt_sizes, caf->size_entries_used);
av_freep(&caf->pkt_sizes);
caf->size_buffer_size = 0;
}
avio_flush(pb);
}
return 0;
}
| 1threat |
uint64_t helper_subqv(CPUAlphaState *env, uint64_t op1, uint64_t op2)
{
uint64_t res;
res = op1 - op2;
if (unlikely((op1 ^ op2) & (res ^ op1) & (1ULL << 63))) {
arith_excp(env, GETPC(), EXC_M_IOV, 0);
}
return res;
}
| 1threat |
Can PyCharm sort methods alphabetically? : <p>I'd like my methods in classes sorted in Python files. I do wonder if PyCharm has such option (I couldn't find one).</p>
| 0debug |
static int ehci_state_waitlisthead(EHCIState *ehci, int async)
{
EHCIqh qh;
int i = 0;
int again = 0;
uint32_t entry = ehci->asynclistaddr;
if (async) {
ehci_set_usbsts(ehci, USBSTS_REC);
}
ehci_queues_rip_unused(ehci, async);
for(i = 0; i < MAX_QH; i++) {
get_dwords(ehci, NLPTR_GET(entry), (uint32_t *) &qh,
sizeof(EHCIqh) >> 2);
ehci_trace_qh(NULL, NLPTR_GET(entry), &qh);
if (qh.epchar & QH_EPCHAR_H) {
if (async) {
entry |= (NLPTR_TYPE_QH << 1);
}
ehci_set_fetch_addr(ehci, async, entry);
ehci_set_state(ehci, async, EST_FETCHENTRY);
again = 1;
goto out;
}
entry = qh.next;
if (entry == ehci->asynclistaddr) {
break;
}
}
ehci_set_state(ehci, async, EST_ACTIVE);
out:
return again;
}
| 1threat |
Max pool layer vs Convolution with stride performance : <p>In most of the architectures, conv layers are being followed by a pooling layer (max / avg etc.). As those pooling layers are just selecting the output of previous layer (i.e. conv), can we just use convolution with stride 2 and expect the similar accuracy results with reduced process need? </p>
| 0debug |
window.location.href = 'http://attack.com?user=' + user_input; | 1threat |
GET THE ITEM REF NUMBER ON CLICK OF BUTTON IN li of ul? : I have a list of values in ul , I have a button their too
<ul> <li class="mix" category-1="" data-value="600.35" style="display:block;"><figure><figcaption><h3>TK</h3><span>LHR</span> <span>LHE</span><div class="clear"></div><span>Sat 28May16</span> <span>18:00<span></span><span><i class="fa" fa-clock-o=""></i></span>7361116644561201001 <div class="clear"></div> <div class="price-night"><span>1 Stop</span><span class="price-n">600.35 (£)</span></div>
<button class="info">Buy Now</button></span></figcaption></figure></li>
<li class="mix" category-1="" data-value="600.35" style="display:block;"><figure><figcaption><h3>TK</h3><span>LHR</span> <span>LHE</span><div class="clear"></div><span>Sat 28May16</span> <span>18:00<span></span><span><i class="fa" fa-clock-o=""></i></span>7361116644561201001 <div class="clear"></div> <div class="price-night"><span>1 Stop</span><span class="price-n">600.35 (£)</span></div>
<button class="info">Buy Now</button></span></figcaption></figure></li>
<ul/>
on click of button i want to get the reference number , outvail , invail total of 3 values, i am using ASP.NET so kindly there is any method i can add single function their too oncick call that but how to get the li values of ul | 0debug |
PHP for loop increment by 100000 : <p>I want to loop through <code>$i</code> which starts from 790000000 and echo every 100000 up to 799999999:</p>
<p>790000000
790100000
790200000
790300000
790400000
...</p>
<p>I tried this code but it didn't work:</p>
<pre><code>for ($i=790000000; $i<=800000000; $i+100000) {
echo $i . '<br>';
}
</code></pre>
| 0debug |
remove duplicate colunm from dataframe using scala : I need to remove one column from the dataframe.
Having @ column in the same name.(Need to remove only one and need the other one for further usage).
`input:`
`sno age psk psk`
`1 12 a4 a4`
`output:`
`sno age psk`
`1 12 a4` | 0debug |
def group_tuples(Input):
out = {}
for elem in Input:
try:
out[elem[0]].extend(elem[1:])
except KeyError:
out[elem[0]] = list(elem)
return [tuple(values) for values in out.values()] | 0debug |
When using JavaScript's reduce, how do I skip an iteration? : <p>I am trying to figure out a way to conditionally break out of an iteration when using JavaScript's <code>reduce</code> function. </p>
<p>Given the following code sums an array of integers and will return the number <code>10</code>: </p>
<pre><code>[0, 1, 2, 3, 4].reduce(function(previousValue, currentValue, currentIndex, array) {
return previousValue + currentValue;
});
</code></pre>
<p>How can I do something like this: </p>
<pre><code>[0, 1, 2, 3, 4].reduce(function(previousValue, currentValue, currentIndex, array) {
if(currentValue === "WHATEVER") {
// SKIP or NEXT -- don't include it in the sum
}
return previousValue + currentValue;
});
</code></pre>
| 0debug |
void s390_ipl_prepare_cpu(S390CPU *cpu)
{
S390IPLState *ipl = get_ipl_device();
cpu->env.psw.addr = ipl->start_addr;
cpu->env.psw.mask = IPL_PSW_MASK;
if (!ipl->kernel || ipl->iplb_valid) {
cpu->env.psw.addr = ipl->bios_start_addr;
if (!ipl->iplb_valid) {
ipl->iplb_valid = s390_gen_initial_iplb(ipl);
}
}
if (ipl->netboot) {
if (load_netboot_image(&err) < 0) {
error_report_err(err);
vm_stop(RUN_STATE_INTERNAL_ERROR);
}
ipl->iplb.ccw.netboot_start_addr = ipl->start_addr;
}
} | 1threat |
there is no row position at 2 ..what is the solution to delete values : Console.WriteLine("Enter how many rows you want to delete:");
del = Convert.ToInt16(Console.ReadLine());
try
{
for (int i = 0; i <del; i++)
{
dt.Rows[i].Delete();
dt.AcceptChanges();
}
Console.WriteLine("\n************************************\n");
} | 0debug |
Regex for matching decimals only, not integers : <p>I'm looking for a regex to match decimal numbers only, but to fail on integers.</p>
<p>For example, the following numbers should pass</p>
<pre><code>0.00
1.00
-1.00
3.3
2.22123
</code></pre>
<p>But the following should fail</p>
<pre><code>-1
-3
4
559
</code></pre>
<p>I don't know why this is so hard to find/create, but I'm not having any luck. All available regexes that I found online don't exclude integers.</p>
| 0debug |
void qmp_block_job_resume(const char *device, Error **errp)
{
BlockJob *job = find_block_job(device);
if (!job) {
error_set(errp, QERR_BLOCK_JOB_NOT_ACTIVE, device);
return;
}
trace_qmp_block_job_resume(job);
block_job_resume(job);
}
| 1threat |
'ContentView_Previews' is not a member type of error : <p>'ContentView_Previews' does not compile if ContentView references an external object.</p>
<p>If I remove all references to @ObservedObject, preview compiles.</p>
<pre><code>import SwiftUI
struct ContentView: View {
@ObservedObject var fancyTimer = FancyTimer()
var body: some View {
Text("\(fancyTimer.timerValue)")
.font(.largeTitle)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
import Foundation
import SwiftUI
import Combine
class FancyTimer: ObservableObject {
@Published var timerValue: Int = 0
init() {
Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true)
{ timer in
self.timerValue += 1
}
}
}
</code></pre>
<p>Error is: 'ContentView' is not a member type of 'FancyTimer'</p>
| 0debug |
Cannot find module '@google-cloud/storage' : <p>I am using the GCP console on my browser. I have created a function as following: </p>
<pre><code>function listFiles(bucketName) {
// [START storage_list_files]
// Imports the Google Cloud client library
const Storage = require('@google-cloud/storage');
// Creates a client
const storage = new Storage();
storage
.bucket(bucketName)
.getFiles()
.then(results => {
const files = results[0];
console.log('Files:');
files.forEach(file => {
console.log(file.name);
});
})
.catch(err => {
console.error('ERROR:', err);
});
// [END storage_list_files]
}
exports.helloWorld = function helloWorld (req, res) {
if (req.body.message === undefined) {
// This is an error case, as "message" is required
res.status(400).send('No message defined!');
}
else {
// Everything is ok
console.log(req.body.lat);
console.log(req.body.lon);
listFiles("drive-test-demo");
res.status(200).end();
}
}
</code></pre>
<p>Literally all I am trying to do right now is list the files inside a bucket, if a certain HTTPS trigger comes through.</p>
<p>my package.json file is as follows:</p>
<pre><code>{
"name": "sample-http",
"version": "0.0.1",
"dependencies": {
"@google-cloud/storage": "1.5.1"
}
}
</code></pre>
<p>and I am getting the error "Cannot find module '@google-cloud/storage'" </p>
<p>Most queries I have seen thus far have been resolved by using npm install, but I don't know how to do that considering that my index.js and package.json files are stored in a zip file inside a gcloud bucket. Any advice on how to solve this would be much apreciated. </p>
| 0debug |
static int mp_dacl_removexattr(FsContext *ctx,
const char *path, const char *name)
{
int ret;
char buffer[PATH_MAX];
ret = lremovexattr(rpath(ctx, path, buffer), MAP_ACL_DEFAULT);
if (ret == -1 && errno == ENODATA) {
errno = 0;
ret = 0;
}
return ret;
}
| 1threat |
i is not incremented within JavaScript for loop : <pre><code>for (i = 1; i < this.people.length; i++) {
peoplePicks[i] = this.people[i].chooseAction(peopleChoices[i]);
}
</code></pre>
<p>I have this for loop within my JavaScript program. It runs for ever, even though the length of the array that I am passing to it is 2. when I print the value of i after the statement of the for loop, I get 0. So it seems like i is being decremented by executing the for loop's statement. How can I fix this?</p>
| 0debug |
Javascript - Variables from html div : I have this simple div
<!-- begin snippet: js hide: false -->
<!-- language: lang-html -->
<div id='names'>
name1[John]
name2[Blake]
name3[Sven]
name4[Ellis]
</div>
<!-- end snippet -->
And I want to return this variabels using javascript
<!-- begin snippet: js hide: false -->
<!-- language: lang-js -->
var name1 = "John";
var name2 = "Blake";
var name3 = "Sven";
var name4 = "Ellis";
<!-- end snippet -->
Any help please ..
<br>Thanks! | 0debug |
COMBINATION OF 2 QUERIES BUT NEED TO SUM THEM : I have a question guys. I have to queries that will output 2 columns each. They're from the same table.
Query 1
SELECT MONTH(DateOrdered) AS MONTH,SUM(Downpayment)AS total FROM transaction WHERE YEAR(DateOrdered) = YEAR('2018-12-00') AND Status = 'Ongoing' GROUP BY MONTH(DateOrdered)
MONTH-----total
10------------4590
12------------1497.5
------------------------------
Query 2
SELECT MONTH(DateFinish) AS MONTH,SUM(Total-Downpayment)AS total FROM transaction WHERE YEAR(DateFinish) = YEAR('2018-12-00') AND Status = 'Complete' GROUP BY MONTH(DateFinish)
MONTH--------total
5-----------------1147.5
10----------------1647
12----------------1147.5
---------------------------------
I want to combine the two and SUM The 2 columns named total
For Example
MONTH------------total
5--------------------1147.5
10--------------------6237
12--------------------2645
I hope someone can help. Thanks! | 0debug |
How to return value inside subscribe Angular 4 : <p>I'm new to observables in angular. I have a problem wanting to return a value inside a subscribe method. I have
the following method (<code>getFirebaseData(idForm:string):observable <any[]></code>):</p>
<pre><code>getTotalQuestions(idForm:string){
let totalQuestions:number;
this.getFirebaseData(idForm+"/Metadatos")
.subscribe(items =>
{
items.map(item => {
totalQuestions=item.Total;
console.log(totalQuestions);
});
}
);
console.log(totalQuestions);
return totalQuestions;
}
</code></pre>
<p>the firts <code>console.log(totalQuestions)</code> print <strong>4</strong> but the second <code>console.log(totalQuestions)</code> print <strong>undefined</strong>.
I understand that subscribe is an asynchronous operation and that for that reason the second <code>console.log(totalQuestions)</code> ("In order to write the code") print undefined, but I can not find the way to return the variable after the subscribe method has been completed. Now, if I change the subscribe to map:</p>
<pre><code>getTotalQuestions(idForm:string){
let totalQuestions:number;
this.getFirebaseData(idForm+"/Metadatos")
.subscribe(items =>
{
items.map(item => {
totalQuestions=item.Total;
console.log(totalQuestions);
});
}
);
console.log(totalQuestions);
return totalQuestions;
}
</code></pre>
<p>the firts <code>console.log(totalQuestions)</code> does not print anything and the second <code>console.log(totalQuestions)</code> print undefined. It's something that I do not understand because it happens.</p>
<p>I hope you can help me clarify the concept that I do not understand. Thanks!</p>
| 0debug |
How can i open a file in getName method and get the first record or row : **// second method getName open file and begining in second row??? i dont know why??**
` public int getRank(int auxYear, String auxName, String auxGender){
//FileResource auxFr = new FileResource("/testing/yob" + auxYear + "short.csv");
String resourceName = "/Users/User/Desktop/coursera/week4_babybirths/babybirths/testing/yob" + auxYear + "short.csv";
File auxFile = new File(resourceName);
if(auxFile.exists()){
FileResource auxFr = new FileResource(auxFile);
//FileResource auxFr = new FileResource();
int auxRank = 0;
for (CSVRecord auxRec : auxFr.getCSVParser(false)){
if (auxRec.get(1).contains(auxGender)){
auxRank += 1;
String auxN = auxRec.get(0);
if (auxRec.get(0).contains(auxName)){
return auxRank;
}
}
}
} public String getName(int auxYear, int auxRank, String auxGender){
////FileResource auxFr = new FileResource("/testing/yob" + auxYear + "short.csv");
String resourceName = "/Users/User/Desktop/coursera/week4_babybirths/babybirths/testing/yob" + auxYear + "short.csv";
File auxFile = new File(resourceName);
if (auxFile.exists()){
FileResource auxFr = new FileResource(auxFile);
int auxCount = 0;
for (CSVRecord auxRec : auxFr.getCSVParser()){
String auxStr = auxRec.get(0);
if (auxRec.get(1).contains(auxGender)){
auxCount += 1;
String auxStr1 = auxRec.get(0);
if (auxCount == (auxRank-1)){
return auxRec.get(0);
}
}
}
}
public String yourNameInYear(String auxName, int auxYear, int auxNewYear, String auxGender){
int auxRank = getRank(auxYear, auxName, auxGender);
return getName(auxNewYear, auxRank, auxGender);
}
public void testYourNameInYear(){
String auxName = yourNameInYear("Isabella`enter code here`", 2012, 2014, "F");
System.out.println("Isabella" + " born in " + 2012 + " would be " + auxName + " in " + 2014);
}` **// method YourNameInYear is calling getRank() first this one is open "yob2012short.csv" and later getName() is open another file "yob2014short.csv but is not begining in the first record or row??? I dont know why ????** | 0debug |
The type or namespace name "WebRequestHandler" could not be found : <p>I am trying to use the Dropbox.API code that is listed here:</p>
<p><a href="https://github.com/dropbox/dropbox-sdk-dotnet/tree/master/dropbox-sdk-dotnet/Examples/SimpleTest" rel="noreferrer">https://github.com/dropbox/dropbox-sdk-dotnet/tree/master/dropbox-sdk-dotnet/Examples/SimpleTest</a></p>
<p>I copied their Program.cs into my Program.cs without making other changes to other files in my solution/project.</p>
<p>I am getting </p>
<pre><code>The type or namespace name "WebRequestHandler" could not be found.
</code></pre>
<p><a href="https://i.stack.imgur.com/2NQQl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2NQQl.png" alt="enter image description here"></a></p>
<p>Despite having this using statement:</p>
<pre><code>using System.Net.Http;
</code></pre>
<p>The help text says to add an assembly reference, but I don't know what I would add.</p>
<p>I tried moving the <code>using System.Net.Http</code> to both inside and outside the class.</p>
<p>I am new to C# and .Net development so expect this to be a really newbie problem.</p>
| 0debug |
How to properly step by step install java and javafx in Intellij on Linux? : <p><br> I think I am not alone who doesn't know how to properly download Java and JavaFX on Linux. And how make it works in IntelliJ Idea <br><br>
So my questions are: <br></p>
<ol>
<li>I'm looking for Java JRE or Java SDK?</li>
<li>Must Java and JavaFX be at same version?</li>
<li>How I will connect it with IntelliJ</li>
<li>Do I have to write something like in windows "path variable"?</li>
</ol>
<p><br>
Maybe this is not proper question, because it was answered somewhere else, but I dont undrestand basic things about installation of Java. <br> Thanks everyone.</p>
| 0debug |
how to fetch data from array inside array : I have to fetch value from array inside array. I can fetch values from first array but not able to fetch values from second array.
JSONObject jsono = new JSONObject(res);
JSONArray jarray = jsono.getJSONArray("data");
for (int i = 0; i < jarray.length(); i++) {
JSONObject object = jarray.getJSONObject(i);
JSONArray jarray1 = object.getJSONArray("comments_data");
for (int j = 0; j < jarray1.length(); j++) {
JSONObject object1 = jarray1.getJSONObject(j);
String Namee = object1.getString("username");
String Ratingg = object1.getString("rating");
String Commentt = object1.getString("comment");
Comments comments1 = new Comments();
comments1.setUsername(Namee);
comments1.setRating(Ratingg);
comments1.setComments(Commentt);
comments1.setProfileimage(R.drawable.fav);
commentsList.add(comments1);
}
}
And this is my json.
{
"status": "success",
"msg": " Menu Details",
"data": [
{
"id": "1",
"rest_id": "1",
"menu_rate": "100",
"collection_time": "2:22pm",
"quantity_left": "3",
"food_type": "veg",
"img1": "",
"img2": "",
"img3": "",
"date": "",
"menu_name": "",
"comments_data": [
{
"id": "20",
"user_id": "127",
"res_id": "1",
"comment": "shreyansh s",
"date": "0000-00-00 00:00:00",
"rating": "0.0",
"username": "lucky",
"userimage": "123"
},
{
"id": "19",
"user_id": "126",
"res_id": "1",
"comment": "das",
"date": "0000-00-00 00:00:00",
"rating": "3.0",
"username": "shrey srivastava",
"userimage": "123"
},
{
"id": "18",
"user_id": "126",
"res_id": "1",
"comment": "",
"date": "0000-00-00 00:00:00",
"rating": "3.0",
"username": "shrey srivastava",
"userimage": "123"
},
{
"id": "17",
"user_id": "126",
"res_id": "1",
"comment": "sakjbdkjasbk",
"date": "0000-00-00 00:00:00",
"rating": "3.0",
"username": "shrey srivastava",
"userimage": "123"
},
{
"id": "16",
"user_id": "107",
"res_id": "1",
"comment": "hello",
"date": "0000-00-00 00:00:00",
"rating": "5",
"username": "shreyansh",
"userimage": ""
},
{
"id": "15",
"user_id": "107",
"res_id": "1",
"comment": "hello",
"date": "0000-00-00 00:00:00",
"rating": "5",
"username": "shreyansh",
"userimage": "123"
},
{
"id": "14",
"user_id": "107",
"res_id": "1",
"comment": "hello",
"date": "0000-00-00 00:00:00",
"rating": "5",
"username": "shreyansh",
"userimage": "123"
},
{
"id": "6",
"user_id": "82",
"res_id": "1",
"comment": "good",
"date": "0000-00-00 00:00:00",
"rating": "",
"username": "jaim",
"userimage": "google.com"
}
]
}
]
} | 0debug |
How to read appsettings.json in my _layout.chtml : <p>I cannot seem to figure out how to read values from the appsettings.json in my _Layout.chtml file.</p>
<p>Is it not just available, something like this?
@Configuration["ApplicationInsights:InstrumentationKey"]</p>
<p>I created a new MVC project using razor pages.</p>
<p>fyi, i'm an mvc newbee - code samples help a lot.</p>
| 0debug |
Struggling to set up "network" drives on home p.c. to mimic work environment for software development : <p>I want to mimic my work computer so I can develop with reference to my network drives for my Windows 10 computer at home. </p>
<p>I want S:\ drive to point to some local drive on my computer.</p>
<p>I am following directions to the letter when attempting to create homegroup for windows 10.</p>
<p>When I type HomeGroup under search, I don't see any option, as shown in article below.</p>
<p>Any ideas?</p>
<p><a href="https://support.microsoft.com/en-us/help/17145/windows-homegroup-from-start-to-finish" rel="nofollow noreferrer">https://support.microsoft.com/en-us/help/17145/windows-homegroup-from-start-to-finish</a></p>
<p><a href="https://i.stack.imgur.com/V1Ouf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V1Ouf.png" alt="enter image description here"></a></p>
| 0debug |
bool replay_next_event_is(int event)
{
bool res = false;
if (replay_state.instructions_count != 0) {
assert(replay_data_kind == EVENT_INSTRUCTION);
return event == EVENT_INSTRUCTION;
}
while (true) {
if (event == replay_data_kind) {
res = true;
}
switch (replay_data_kind) {
case EVENT_SHUTDOWN:
replay_finish_event();
qemu_system_shutdown_request();
break;
default:
return res;
}
}
return res;
}
| 1threat |
static void machvirt_init(MachineState *machine)
{
VirtMachineState *vms = VIRT_MACHINE(machine);
VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(machine);
qemu_irq pic[NUM_IRQS];
MemoryRegion *sysmem = get_system_memory();
MemoryRegion *secure_sysmem = NULL;
int n, virt_max_cpus;
MemoryRegion *ram = g_new(MemoryRegion, 1);
const char *cpu_model = machine->cpu_model;
char **cpustr;
ObjectClass *oc;
const char *typename;
CPUClass *cc;
Error *err = NULL;
bool firmware_loaded = bios_name || drive_get(IF_PFLASH, 0, 0);
if (!cpu_model) {
cpu_model = "cortex-a15";
}
if (!vms->gic_version) {
if (!kvm_enabled()) {
error_report("gic-version=host requires KVM");
exit(1);
}
vms->gic_version = kvm_arm_vgic_probe();
if (!vms->gic_version) {
error_report("Unable to determine GIC version supported by host");
exit(1);
}
}
cpustr = g_strsplit(cpu_model, ",", 2);
if (!cpuname_valid(cpustr[0])) {
error_report("mach-virt: CPU %s not supported", cpustr[0]);
exit(1);
}
if (vms->secure && firmware_loaded) {
vms->psci_conduit = QEMU_PSCI_CONDUIT_DISABLED;
} else if (vms->virt) {
vms->psci_conduit = QEMU_PSCI_CONDUIT_SMC;
} else {
vms->psci_conduit = QEMU_PSCI_CONDUIT_HVC;
}
if (vms->gic_version == 3) {
virt_max_cpus = vms->memmap[VIRT_GIC_REDIST].size / 0x20000;
} else {
virt_max_cpus = GIC_NCPU;
}
if (max_cpus > virt_max_cpus) {
error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "
"supported by machine 'mach-virt' (%d)",
max_cpus, virt_max_cpus);
exit(1);
}
vms->smp_cpus = smp_cpus;
if (machine->ram_size > vms->memmap[VIRT_MEM].size) {
error_report("mach-virt: cannot model more than %dGB RAM", RAMLIMIT_GB);
exit(1);
}
if (vms->virt && kvm_enabled()) {
error_report("mach-virt: KVM does not support providing "
"Virtualization extensions to the guest CPU");
exit(1);
}
if (vms->secure) {
if (kvm_enabled()) {
error_report("mach-virt: KVM does not support Security extensions");
exit(1);
}
secure_sysmem = g_new(MemoryRegion, 1);
memory_region_init(secure_sysmem, OBJECT(machine), "secure-memory",
UINT64_MAX);
memory_region_add_subregion_overlap(secure_sysmem, 0, sysmem, -1);
}
create_fdt(vms);
oc = cpu_class_by_name(TYPE_ARM_CPU, cpustr[0]);
if (!oc) {
error_report("Unable to find CPU definition");
exit(1);
}
typename = object_class_get_name(oc);
cc = CPU_CLASS(oc);
cc->parse_features(typename, cpustr[1], &err);
g_strfreev(cpustr);
if (err) {
error_report_err(err);
exit(1);
}
for (n = 0; n < smp_cpus; n++) {
Object *cpuobj = object_new(typename);
object_property_set_int(cpuobj, virt_cpu_mp_affinity(vms, n),
"mp-affinity", NULL);
if (!vms->secure) {
object_property_set_bool(cpuobj, false, "has_el3", NULL);
}
if (!vms->virt && object_property_find(cpuobj, "has_el2", NULL)) {
object_property_set_bool(cpuobj, false, "has_el2", NULL);
}
if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED) {
object_property_set_int(cpuobj, vms->psci_conduit,
"psci-conduit", NULL);
if (n > 0) {
object_property_set_bool(cpuobj, true,
"start-powered-off", NULL);
}
}
if (vmc->no_pmu && object_property_find(cpuobj, "pmu", NULL)) {
object_property_set_bool(cpuobj, false, "pmu", NULL);
}
if (object_property_find(cpuobj, "reset-cbar", NULL)) {
object_property_set_int(cpuobj, vms->memmap[VIRT_CPUPERIPHS].base,
"reset-cbar", &error_abort);
}
object_property_set_link(cpuobj, OBJECT(sysmem), "memory",
&error_abort);
if (vms->secure) {
object_property_set_link(cpuobj, OBJECT(secure_sysmem),
"secure-memory", &error_abort);
}
object_property_set_bool(cpuobj, true, "realized", NULL);
object_unref(cpuobj);
}
fdt_add_timer_nodes(vms);
fdt_add_cpu_nodes(vms);
fdt_add_psci_node(vms);
memory_region_allocate_system_memory(ram, NULL, "mach-virt.ram",
machine->ram_size);
memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base, ram);
create_flash(vms, sysmem, secure_sysmem ? secure_sysmem : sysmem);
create_gic(vms, pic);
fdt_add_pmu_nodes(vms);
create_uart(vms, pic, VIRT_UART, sysmem, serial_hds[0]);
if (vms->secure) {
create_secure_ram(vms, secure_sysmem);
create_uart(vms, pic, VIRT_SECURE_UART, secure_sysmem, serial_hds[1]);
}
create_rtc(vms, pic);
create_pcie(vms, pic);
create_gpio(vms, pic);
create_virtio_devices(vms, pic);
vms->fw_cfg = create_fw_cfg(vms, &address_space_memory);
rom_set_fw(vms->fw_cfg);
vms->machine_done.notify = virt_machine_done;
qemu_add_machine_init_done_notifier(&vms->machine_done);
vms->bootinfo.ram_size = machine->ram_size;
vms->bootinfo.kernel_filename = machine->kernel_filename;
vms->bootinfo.kernel_cmdline = machine->kernel_cmdline;
vms->bootinfo.initrd_filename = machine->initrd_filename;
vms->bootinfo.nb_cpus = smp_cpus;
vms->bootinfo.board_id = -1;
vms->bootinfo.loader_start = vms->memmap[VIRT_MEM].base;
vms->bootinfo.get_dtb = machvirt_dtb;
vms->bootinfo.firmware_loaded = firmware_loaded;
arm_load_kernel(ARM_CPU(first_cpu), &vms->bootinfo);
create_platform_bus(vms, pic);
}
| 1threat |
Can I select part of the street in Google Maps API? : I need to be able select/delete/update some parts of the streets on Google map(as on picture bellow).
This selected parts must be saved on server and there is must be counter of selected distance.
There is possible solution of this problem in Google Maps API?
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/bJK8x.png | 0debug |
static int ppce500_load_device_tree(MachineState *machine,
PPCE500Params *params,
hwaddr addr,
hwaddr initrd_base,
hwaddr initrd_size,
hwaddr kernel_base,
hwaddr kernel_size,
bool dry_run)
{
CPUPPCState *env = first_cpu->env_ptr;
int ret = -1;
uint64_t mem_reg_property[] = { 0, cpu_to_be64(machine->ram_size) };
int fdt_size;
void *fdt;
uint8_t hypercall[16];
uint32_t clock_freq = 400000000;
uint32_t tb_freq = 400000000;
int i;
char compatible_sb[] = "fsl,mpc8544-immr\0simple-bus";
char soc[128];
char mpic[128];
uint32_t mpic_ph;
uint32_t msi_ph;
char gutil[128];
char pci[128];
char msi[128];
uint32_t *pci_map = NULL;
int len;
uint32_t pci_ranges[14] =
{
0x2000000, 0x0, params->pci_mmio_bus_base,
params->pci_mmio_base >> 32, params->pci_mmio_base,
0x0, 0x20000000,
0x1000000, 0x0, 0x0,
params->pci_pio_base >> 32, params->pci_pio_base,
0x0, 0x10000,
};
QemuOpts *machine_opts = qemu_get_machine_opts();
const char *dtb_file = qemu_opt_get(machine_opts, "dtb");
const char *toplevel_compat = qemu_opt_get(machine_opts, "dt_compatible");
if (dtb_file) {
char *filename;
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_file);
if (!filename) {
goto out;
}
fdt = load_device_tree(filename, &fdt_size);
if (!fdt) {
goto out;
}
goto done;
}
fdt = create_device_tree(&fdt_size);
if (fdt == NULL) {
goto out;
}
qemu_fdt_setprop_cell(fdt, "/", "#address-cells", 2);
qemu_fdt_setprop_cell(fdt, "/", "#size-cells", 2);
qemu_fdt_add_subnode(fdt, "/memory");
qemu_fdt_setprop_string(fdt, "/memory", "device_type", "memory");
qemu_fdt_setprop(fdt, "/memory", "reg", mem_reg_property,
sizeof(mem_reg_property));
qemu_fdt_add_subnode(fdt, "/chosen");
if (initrd_size) {
ret = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-start",
initrd_base);
if (ret < 0) {
fprintf(stderr, "couldn't set /chosen/linux,initrd-start\n");
}
ret = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end",
(initrd_base + initrd_size));
if (ret < 0) {
fprintf(stderr, "couldn't set /chosen/linux,initrd-end\n");
}
}
if (kernel_base != -1ULL) {
qemu_fdt_setprop_cells(fdt, "/chosen", "qemu,boot-kernel",
kernel_base >> 32, kernel_base,
kernel_size >> 32, kernel_size);
}
ret = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs",
machine->kernel_cmdline);
if (ret < 0)
fprintf(stderr, "couldn't set /chosen/bootargs\n");
if (kvm_enabled()) {
clock_freq = kvmppc_get_clockfreq();
tb_freq = kvmppc_get_tbfreq();
qemu_fdt_add_subnode(fdt, "/hypervisor");
qemu_fdt_setprop_string(fdt, "/hypervisor", "compatible",
"linux,kvm");
kvmppc_get_hypercall(env, hypercall, sizeof(hypercall));
qemu_fdt_setprop(fdt, "/hypervisor", "hcall-instructions",
hypercall, sizeof(hypercall));
if (kvmppc_get_hasidle(env)) {
qemu_fdt_setprop(fdt, "/hypervisor", "has-idle", NULL, 0);
}
}
qemu_fdt_add_subnode(fdt, "/cpus");
qemu_fdt_setprop_cell(fdt, "/cpus", "#address-cells", 1);
qemu_fdt_setprop_cell(fdt, "/cpus", "#size-cells", 0);
for (i = smp_cpus - 1; i >= 0; i--) {
CPUState *cpu;
PowerPCCPU *pcpu;
char cpu_name[128];
uint64_t cpu_release_addr = params->spin_base + (i * 0x20);
cpu = qemu_get_cpu(i);
if (cpu == NULL) {
continue;
}
env = cpu->env_ptr;
pcpu = POWERPC_CPU(cpu);
snprintf(cpu_name, sizeof(cpu_name), "/cpus/PowerPC,8544@%x",
ppc_get_vcpu_dt_id(pcpu));
qemu_fdt_add_subnode(fdt, cpu_name);
qemu_fdt_setprop_cell(fdt, cpu_name, "clock-frequency", clock_freq);
qemu_fdt_setprop_cell(fdt, cpu_name, "timebase-frequency", tb_freq);
qemu_fdt_setprop_string(fdt, cpu_name, "device_type", "cpu");
qemu_fdt_setprop_cell(fdt, cpu_name, "reg",
ppc_get_vcpu_dt_id(pcpu));
qemu_fdt_setprop_cell(fdt, cpu_name, "d-cache-line-size",
env->dcache_line_size);
qemu_fdt_setprop_cell(fdt, cpu_name, "i-cache-line-size",
env->icache_line_size);
qemu_fdt_setprop_cell(fdt, cpu_name, "d-cache-size", 0x8000);
qemu_fdt_setprop_cell(fdt, cpu_name, "i-cache-size", 0x8000);
qemu_fdt_setprop_cell(fdt, cpu_name, "bus-frequency", 0);
if (cpu->cpu_index) {
qemu_fdt_setprop_string(fdt, cpu_name, "status", "disabled");
qemu_fdt_setprop_string(fdt, cpu_name, "enable-method",
"spin-table");
qemu_fdt_setprop_u64(fdt, cpu_name, "cpu-release-addr",
cpu_release_addr);
} else {
qemu_fdt_setprop_string(fdt, cpu_name, "status", "okay");
}
}
qemu_fdt_add_subnode(fdt, "/aliases");
snprintf(soc, sizeof(soc), "/soc@%"PRIx64, params->ccsrbar_base);
qemu_fdt_add_subnode(fdt, soc);
qemu_fdt_setprop_string(fdt, soc, "device_type", "soc");
qemu_fdt_setprop(fdt, soc, "compatible", compatible_sb,
sizeof(compatible_sb));
qemu_fdt_setprop_cell(fdt, soc, "#address-cells", 1);
qemu_fdt_setprop_cell(fdt, soc, "#size-cells", 1);
qemu_fdt_setprop_cells(fdt, soc, "ranges", 0x0,
params->ccsrbar_base >> 32, params->ccsrbar_base,
MPC8544_CCSRBAR_SIZE);
qemu_fdt_setprop_cell(fdt, soc, "bus-frequency", 0);
snprintf(mpic, sizeof(mpic), "%s/pic@%llx", soc, MPC8544_MPIC_REGS_OFFSET);
qemu_fdt_add_subnode(fdt, mpic);
qemu_fdt_setprop_string(fdt, mpic, "device_type", "open-pic");
qemu_fdt_setprop_string(fdt, mpic, "compatible", "fsl,mpic");
qemu_fdt_setprop_cells(fdt, mpic, "reg", MPC8544_MPIC_REGS_OFFSET,
0x40000);
qemu_fdt_setprop_cell(fdt, mpic, "#address-cells", 0);
qemu_fdt_setprop_cell(fdt, mpic, "#interrupt-cells", 2);
mpic_ph = qemu_fdt_alloc_phandle(fdt);
qemu_fdt_setprop_cell(fdt, mpic, "phandle", mpic_ph);
qemu_fdt_setprop_cell(fdt, mpic, "linux,phandle", mpic_ph);
qemu_fdt_setprop(fdt, mpic, "interrupt-controller", NULL, 0);
if (serial_hds[1]) {
dt_serial_create(fdt, MPC8544_SERIAL1_REGS_OFFSET,
soc, mpic, "serial1", 1, false);
}
if (serial_hds[0]) {
dt_serial_create(fdt, MPC8544_SERIAL0_REGS_OFFSET,
soc, mpic, "serial0", 0, true);
}
snprintf(gutil, sizeof(gutil), "%s/global-utilities@%llx", soc,
MPC8544_UTIL_OFFSET);
qemu_fdt_add_subnode(fdt, gutil);
qemu_fdt_setprop_string(fdt, gutil, "compatible", "fsl,mpc8544-guts");
qemu_fdt_setprop_cells(fdt, gutil, "reg", MPC8544_UTIL_OFFSET, 0x1000);
qemu_fdt_setprop(fdt, gutil, "fsl,has-rstcr", NULL, 0);
snprintf(msi, sizeof(msi), "/%s/msi@%llx", soc, MPC8544_MSI_REGS_OFFSET);
qemu_fdt_add_subnode(fdt, msi);
qemu_fdt_setprop_string(fdt, msi, "compatible", "fsl,mpic-msi");
qemu_fdt_setprop_cells(fdt, msi, "reg", MPC8544_MSI_REGS_OFFSET, 0x200);
msi_ph = qemu_fdt_alloc_phandle(fdt);
qemu_fdt_setprop_cells(fdt, msi, "msi-available-ranges", 0x0, 0x100);
qemu_fdt_setprop_phandle(fdt, msi, "interrupt-parent", mpic);
qemu_fdt_setprop_cells(fdt, msi, "interrupts",
0xe0, 0x0,
0xe1, 0x0,
0xe2, 0x0,
0xe3, 0x0,
0xe4, 0x0,
0xe5, 0x0,
0xe6, 0x0,
0xe7, 0x0);
qemu_fdt_setprop_cell(fdt, msi, "phandle", msi_ph);
qemu_fdt_setprop_cell(fdt, msi, "linux,phandle", msi_ph);
snprintf(pci, sizeof(pci), "/pci@%llx",
params->ccsrbar_base + MPC8544_PCI_REGS_OFFSET);
qemu_fdt_add_subnode(fdt, pci);
qemu_fdt_setprop_cell(fdt, pci, "cell-index", 0);
qemu_fdt_setprop_string(fdt, pci, "compatible", "fsl,mpc8540-pci");
qemu_fdt_setprop_string(fdt, pci, "device_type", "pci");
qemu_fdt_setprop_cells(fdt, pci, "interrupt-map-mask", 0xf800, 0x0,
0x0, 0x7);
pci_map = pci_map_create(fdt, qemu_fdt_get_phandle(fdt, mpic),
params->pci_first_slot, params->pci_nr_slots,
&len);
qemu_fdt_setprop(fdt, pci, "interrupt-map", pci_map, len);
qemu_fdt_setprop_phandle(fdt, pci, "interrupt-parent", mpic);
qemu_fdt_setprop_cells(fdt, pci, "interrupts", 24, 2);
qemu_fdt_setprop_cells(fdt, pci, "bus-range", 0, 255);
for (i = 0; i < 14; i++) {
pci_ranges[i] = cpu_to_be32(pci_ranges[i]);
}
qemu_fdt_setprop_cell(fdt, pci, "fsl,msi", msi_ph);
qemu_fdt_setprop(fdt, pci, "ranges", pci_ranges, sizeof(pci_ranges));
qemu_fdt_setprop_cells(fdt, pci, "reg",
(params->ccsrbar_base + MPC8544_PCI_REGS_OFFSET) >> 32,
(params->ccsrbar_base + MPC8544_PCI_REGS_OFFSET),
0, 0x1000);
qemu_fdt_setprop_cell(fdt, pci, "clock-frequency", 66666666);
qemu_fdt_setprop_cell(fdt, pci, "#interrupt-cells", 1);
qemu_fdt_setprop_cell(fdt, pci, "#size-cells", 2);
qemu_fdt_setprop_cell(fdt, pci, "#address-cells", 3);
qemu_fdt_setprop_string(fdt, "/aliases", "pci0", pci);
if (params->has_mpc8xxx_gpio) {
create_dt_mpc8xxx_gpio(fdt, soc, mpic);
}
if (params->has_platform_bus) {
platform_bus_create_devtree(params, fdt, mpic);
}
params->fixup_devtree(params, fdt);
if (toplevel_compat) {
qemu_fdt_setprop(fdt, "/", "compatible", toplevel_compat,
strlen(toplevel_compat) + 1);
}
done:
if (!dry_run) {
qemu_fdt_dumpdtb(fdt, fdt_size);
cpu_physical_memory_write(addr, fdt, fdt_size);
}
ret = fdt_size;
out:
g_free(pci_map);
return ret;
} | 1threat |
ReactJS - calling two different function from onKeyDown event, not invoking : Please find my code below, that am trying to invoking two different function with onKeyDown event in ReactJS application.
But its not invoking any of those function. But, its working fine with one function call.
<td><input name="product_quantity" type="text" onKeyDown={ (event) => { this.props.handleInputNumber; this.handleQuantity; } } value={ this.state.item.product_quantity } className="form-control" /></td>
| 0debug |
Regex to test an expression : <p>I have this expression:</p>
<pre><code>/width*$/.test(oldStyle)
</code></pre>
<p>And oldStyle has this inside of it:</p>
<pre><code>width:90%;height:inherit;padding-left:20px;
</code></pre>
<p>The expression should return true as i have tested it in a online JavaScript regex expression tool.</p>
<p>Why is this returning false?</p>
<p>Can i use this expression the way i have coded?</p>
| 0debug |
Copying data and pasting it to specific range : <p>I am not being able to paste my data into specific cells in sheet2. </p>
<p>Like I have some data on sheet1 on the range of D:F and I want to paste it to the range of A:C on the last row. I need the code to adjust the range.</p>
| 0debug |
START_TEST(qlist_append_test)
{
QInt *qi;
QList *qlist;
QListEntry *entry;
qi = qint_from_int(42);
qlist = qlist_new();
qlist_append(qlist, qi);
entry = QTAILQ_FIRST(&qlist->head);
fail_unless(entry != NULL);
fail_unless(entry->value == QOBJECT(qi));
QDECREF(qi);
g_free(entry);
g_free(qlist);
}
| 1threat |
Swift 3 silently allows shadowing a parameter : <p>I'm switching to Swift, and I'm really not happy that the following code compiles without a warning:</p>
<pre><code>func f(_ x: inout Int?) {
var x: Int? // <-- this declaration should produce a warning
x = 105
if x! < 1000 {}
}
var a: Int? = 3
f(&a)
print("\(a)")
</code></pre>
<p>and, of course, outputs <code>Optional(3)</code> upon execution.</p>
<p>In this example, the <code>x</code> local variable shadows the <code>x</code> function parameter.</p>
<p>Turning on the <code>Hidden Local Variables</code> warning (<code>GCC_WARN_SHADOW</code>) in the project settings doesn't cause a warning to be produced either.</p>
<p><strong>Question:</strong> How should I proceed to make the Swift 3 compiler warn me about such shadowing?</p>
| 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.