problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
EF Core and SqlAzureExecutionStrategy : <p>I've tried to have a search for anything related to a SqlAzureExecutionStrategy for EF core and came up empty handed.</p>
<p>Does anyone have any information around the need for setting an execution strategy when using EF Core and SQL Azure?</p>
| 0debug
|
static int do_vm_stop(RunState state)
{
int ret = 0;
if (runstate_is_running()) {
cpu_disable_ticks();
pause_all_vcpus();
runstate_set(state);
vm_state_notify(0, state);
qapi_event_send_stop(&error_abort);
}
bdrv_drain_all();
ret = blk_flush_all();
return ret;
}
| 1threat
|
How To use CallKit in Objective C : <p>I am Go through with the WWDC CallKit session and I am comfortable with the Concept of it, But don't know how to start. </p>
<p>Also, I have Following the Sample Code for the CallKit by Apple Developers i.e SpeakerBox. But this one is in Swift.</p>
<p>Need suggestion!!</p>
<p>Thanks in Advance</p>
| 0debug
|
static int virtio_net_init_pci(PCIDevice *pci_dev)
{
VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
VirtIODevice *vdev;
vdev = virtio_net_init(&pci_dev->qdev, &proxy->nic, &proxy->net);
vdev->nvectors = proxy->nvectors;
virtio_init_pci(proxy, vdev,
PCI_VENDOR_ID_REDHAT_QUMRANET,
PCI_DEVICE_ID_VIRTIO_NET,
PCI_CLASS_NETWORK_ETHERNET,
0x00);
proxy->nvectors = vdev->nvectors;
return 0;
}
| 1threat
|
static void test_dma_fragmented(void)
{
AHCIQState *ahci;
AHCICommand *cmd;
uint8_t px;
size_t bufsize = 4096;
unsigned char *tx = g_malloc(bufsize);
unsigned char *rx = g_malloc0(bufsize);
uint64_t ptr;
ahci = ahci_boot_and_enable();
px = ahci_port_select(ahci);
ahci_port_clear(ahci, px);
generate_pattern(tx, bufsize, AHCI_SECTOR_SIZE);
ptr = guest_alloc(ahci->parent->alloc, bufsize);
g_assert(ptr);
memwrite(ptr, tx, bufsize);
cmd = ahci_command_create(CMD_WRITE_DMA);
ahci_command_adjust(cmd, 0, ptr, bufsize, 32);
ahci_command_commit(ahci, cmd, px);
ahci_command_issue(ahci, cmd);
ahci_command_verify(ahci, cmd);
g_free(cmd);
cmd = ahci_command_create(CMD_READ_DMA);
ahci_command_adjust(cmd, 0, ptr, bufsize, 32);
ahci_command_commit(ahci, cmd, px);
ahci_command_issue(ahci, cmd);
ahci_command_verify(ahci, cmd);
g_free(cmd);
memread(ptr, rx, bufsize);
guest_free(ahci->parent->alloc, ptr);
g_assert_cmphex(memcmp(tx, rx, bufsize), ==, 0);
ahci_shutdown(ahci);
g_free(rx);
g_free(tx);
}
| 1threat
|
How to integrate Alfresco with my website such that both share same login page? : <p>Currently i am working on an ERP system such that it contain 2 module. First module is on php and mysql and second module is <a href="https://www.alfresco.com/" rel="nofollow noreferrer">Alfresco</a>. I just want to have a common login page for both module.</p>
| 0debug
|
restTemplate.getforobject(),exchange(),entity() .is there any pros and cons for each method? : <p>i have used both entity(),exchange(),getforObject(), and all seems to be working fine . but not sure which is the perfect method for different scenarios.. please give more info about each methods like pros and cons,where to use where not to use.</p>
| 0debug
|
ios obj-с button is not visible on iPhone 8 Plus : Started to test my game on various devices. Every device works well except iPhone 8 Plus. On any other device and the Simulator (even simulated iPhone 8 Plus) the button is visible, but on iPhone 8 Plus it's not. I don't have a clue why this is happening.
1st pic shows Simulator 8 Plus screen, 2nd pic shows device screen. (They have different languages though but that's doesn't matter, I tried both.)
Thanks in advance for your help.
Here's the code:
proceedButton = [[SelectionButton alloc] initWithFrame:CGRectMake([[UIScreen mainScreen] bounds].size.width / 2.0 - 60.00, [[ScreenSize sharedSize] yValue] + 10.0 + [[ScreenSize sharedSize] gameFieldSize], 120.0, [[ScreenSize sharedSize] opButtonSize]) andText:NSLocalizedString(@"DONEKey", @"Done")];
[proceedButton addTarget:self action:@selector(createPlayer) forControlEvents:UIControlEventTouchUpInside];
[proceedButton addTarget:self action:@selector(changePathColor:) forControlEvents:UIControlEventTouchDown];
[self.view addSubview:proceedButton];
[![On Simulator][1]][1]
[![On device][2]][2]
[1]: https://i.stack.imgur.com/jGzQv.png
[2]: https://i.stack.imgur.com/4LdGJ.jpg
| 0debug
|
sql server database copy data and update 1 column : have existing table [dba.Text] and all the data in the table has to stay in there, the only thing i want is to copy all data with the year 2017 and change it to 2018. I tried to make it in excel to show what i mean
[How the table should look like][1]
[1]: https://i.stack.imgur.com/lQIJv.png
Hope someone can lead me in the right direction :)
| 0debug
|
static inline uint32_t ucf64_stoi(float32 s)
{
union {
uint32_t i;
float32 s;
} v;
v.s = s;
return v.i;
}
| 1threat
|
static void slavio_serial_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
{
SerialState *ser = opaque;
ChannelState *s;
uint32_t saddr;
int newreg, channel;
val &= 0xff;
saddr = (addr & 3) >> 1;
channel = (addr & SERIAL_MAXADDR) >> 2;
s = &ser->chn[channel];
switch (saddr) {
case 0:
SER_DPRINTF("Write channel %c, reg[%d] = %2.2x\n", CHN_C(s), s->reg, val & 0xff);
newreg = 0;
switch (s->reg) {
case 0:
newreg = val & 7;
val &= 0x38;
switch (val) {
case 8:
newreg |= 0x8;
break;
case 0x28:
clr_txint(s);
break;
case 0x38:
if (s->rxint_under_svc)
clr_rxint(s);
else if (s->txint_under_svc)
clr_txint(s);
break;
default:
break;
}
break;
case 1 ... 3:
case 6 ... 8:
case 10 ... 11:
case 14 ... 15:
s->wregs[s->reg] = val;
break;
case 4:
case 5:
case 12:
case 13:
s->wregs[s->reg] = val;
slavio_serial_update_parameters(s);
break;
case 9:
switch (val & 0xc0) {
case 0:
default:
break;
case 0x40:
slavio_serial_reset_chn(&ser->chn[1]);
return;
case 0x80:
slavio_serial_reset_chn(&ser->chn[0]);
return;
case 0xc0:
slavio_serial_reset(ser);
return;
}
break;
default:
break;
}
if (s->reg == 0)
s->reg = newreg;
else
s->reg = 0;
break;
case 1:
SER_DPRINTF("Write channel %c, ch %d\n", CHN_C(s), val);
if (s->wregs[5] & 8) {
s->tx = val;
if (s->chr)
qemu_chr_write(s->chr, &s->tx, 1);
else if (s->type == kbd) {
handle_kbd_command(s, val);
}
s->rregs[0] |= 4;
s->rregs[1] |= 1;
set_txint(s);
}
break;
default:
break;
}
}
| 1threat
|
Angular 4 : get error message in subscribe : <p>In the service, there is this code :</p>
<pre><code> getUser(id){
return this.http.get('http:..../' + id)
.map(res => res.json());
}
</code></pre>
<p>In the component : </p>
<pre><code>this.myService.getUser(this.id).subscribe((customer) => {
console.log(customer);
this.customer = customer,
(err) => console.log(err)
});
</code></pre>
<p>When it's the 'customer' exist, no problem I get all the information about the customer.</p>
<p>When the id does not exist, the web api return 'BadRequest' with a message. How can I get this message ? the status ?</p>
<p>Thanks,</p>
| 0debug
|
static uint32_t superio_ioport_readb(void *opaque, uint32_t addr)
{
SuperIOConfig *superio_conf = opaque;
DPRINTF("superio_ioport_readb address 0x%x \n", addr);
return (superio_conf->config[superio_conf->index]);
}
| 1threat
|
Fragment lifecycle with fragment transactions : I have 2 fragments. Fragment 1 is loaded on the start of the app. using drawer navigation and fragment manager I add Fragment 2 on top of it.
1. What is the state of fragment 1 at this point?
2. How do i refresh Fragment 1 when back button on Fragment 2 is pressed and Fragment 1 is shown?
| 0debug
|
PHP regex to replace words starting with @ end ending with 2 spaces : <p>In PHP, how do I strip all double spaces directly behind a word starting with an @ (at) symbol?</p>
<p>Example input:</p>
<pre><code>This is an @example input.
</code></pre>
<p>Example output:</p>
<pre><code>This is an @example output.
</code></pre>
| 0debug
|
static int fbdev_write_packet(AVFormatContext *h, AVPacket *pkt)
{
FBDevContext *fbdev = h->priv_data;
uint8_t *pin, *pout;
enum AVPixelFormat fb_pix_fmt;
int disp_height;
int bytes_to_copy;
AVCodecContext *codec_ctx = h->streams[fbdev->index]->codec;
enum AVPixelFormat video_pix_fmt = codec_ctx->pix_fmt;
int video_width = codec_ctx->width;
int video_height = codec_ctx->height;
int bytes_per_pixel = ((codec_ctx->bits_per_coded_sample + 7) >> 3);
int src_line_size = video_width * bytes_per_pixel;
int i;
if (fbdev->index != pkt->stream_index)
return 0;
if (ioctl(fbdev->fd, FBIOGET_VSCREENINFO, &fbdev->varinfo) < 0)
av_log(h, AV_LOG_WARNING,
"Error refreshing variable info: %s\n", av_err2str(AVERROR(errno)));
fb_pix_fmt = ff_get_pixfmt_from_fb_varinfo(&fbdev->varinfo);
if (fb_pix_fmt != video_pix_fmt) {
av_log(h, AV_LOG_ERROR, "Pixel format %s is not supported, use %s\n",
av_get_pix_fmt_name(video_pix_fmt), av_get_pix_fmt_name(fb_pix_fmt));
return AVERROR(EINVAL);
}
disp_height = FFMIN(fbdev->varinfo.yres, video_height);
bytes_to_copy = FFMIN(fbdev->varinfo.xres, video_width) * bytes_per_pixel;
pin = pkt->data;
pout = fbdev->data +
bytes_per_pixel * fbdev->varinfo.xoffset +
fbdev->varinfo.yoffset * fbdev->fixinfo.line_length;
if (fbdev->xoffset) {
if (fbdev->xoffset < 0) {
if (-fbdev->xoffset >= video_width)
return 0;
bytes_to_copy += fbdev->xoffset * bytes_per_pixel;
pin -= fbdev->xoffset * bytes_per_pixel;
} else {
int diff = (video_width + fbdev->xoffset) - fbdev->varinfo.xres;
if (diff > 0) {
if (diff >= video_width)
return 0;
bytes_to_copy -= diff * bytes_per_pixel;
}
pout += bytes_per_pixel * fbdev->xoffset;
}
}
if (fbdev->yoffset) {
if (fbdev->yoffset < 0) {
if (-fbdev->yoffset >= video_height)
return 0;
disp_height += fbdev->yoffset;
pin -= fbdev->yoffset * src_line_size;
} else {
int diff = (video_height + fbdev->yoffset) - fbdev->varinfo.yres;
if (diff > 0) {
if (diff >= video_height)
return 0;
disp_height -= diff;
}
pout += fbdev->yoffset * fbdev->fixinfo.line_length;
}
}
for (i = 0; i < disp_height; i++) {
memcpy(pout, pin, bytes_to_copy);
pout += fbdev->fixinfo.line_length;
pin += src_line_size;
}
return 0;
}
| 1threat
|
What will be the decimal value in register r23 after the execution of each of the following independent sequences of instructions. : What will be the decimal value in register r23 (if interpreted as a two’s complement number) after the execution of each of the following independent sequences of instructions?
sec(opcode) 1001 0100 0000 1000
clr(opcode) 0010 01Dd dddd DDDD (DDDDD=ddddd)
ror(opcode) 1001 010d dddd 0111
sec
clr r23
ror r23
Answer: -128
Can someone tell me how to get the -128 (with clear explanation) from the instructions above?
| 0debug
|
laravel Eloquent model update event is not fired : <p>Merry Christmas guys!</p>
<p>I am new to Laravel. Just had a beginner's question, when I am trying to use service provider and model event to log the update information.</p>
<p>Was following the online doc: <a href="https://laravel.com/docs/5.3/eloquent#events" rel="noreferrer">https://laravel.com/docs/5.3/eloquent#events</a></p>
<p>After put all code together, I find that the model event only fire when create the use but never log anything when I edit the user. </p>
<p>Did I miss anything? Feel like the $user didn't get assigned properly. Where is it from? from other service provider? </p>
<p>Any explanation or hint will be appreciated!</p>
<pre><code><?php
namespace App\Providers;
use App\User;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
User::creating(function ($user) {
Log::info('event creating');
});
User::created(function ($user) {
Log::info('event created');
});
User::updating(function ($user) {
Log::info('event updating');
});
User::updated(function ($user) {
Log::info('event updated');
});
User::saving(function ($user) {
Log::info('event saving');
});
User::saved(function ($user) {
Log::info('event saved');
});
User::deleting(function ($user) {
Log::info('event deleting');
});
User::deleted(function ($user) {
Log::info('event deleted');
});
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
//
}
}
</code></pre>
| 0debug
|
static int aa_read_header(AVFormatContext *s)
{
int i, j, idx, largest_idx = -1;
uint32_t nkey, nval, toc_size, npairs, header_seed, start;
char key[128], val[128], codec_name[64] = {0};
uint8_t output[24], dst[8], src[8];
int64_t largest_size = -1, current_size = -1;
struct toc_entry {
uint32_t offset;
uint32_t size;
} TOC[MAX_TOC_ENTRIES];
uint32_t header_key_part[4];
uint8_t header_key[16];
AADemuxContext *c = s->priv_data;
AVIOContext *pb = s->pb;
AVStream *st;
avio_skip(pb, 4);
avio_skip(pb, 4);
toc_size = avio_rb32(pb);
avio_skip(pb, 4);
if (toc_size > MAX_TOC_ENTRIES)
return AVERROR_INVALIDDATA;
for (i = 0; i < toc_size; i++) {
avio_skip(pb, 4);
TOC[i].offset = avio_rb32(pb);
TOC[i].size = avio_rb32(pb);
}
avio_skip(pb, 24);
npairs = avio_rb32(pb);
if (npairs > MAX_DICTIONARY_ENTRIES)
return AVERROR_INVALIDDATA;
for (i = 0; i < npairs; i++) {
memset(val, 0, sizeof(val));
memset(key, 0, sizeof(key));
avio_skip(pb, 1);
nkey = avio_rb32(pb);
nval = avio_rb32(pb);
if (nkey > sizeof(key)) {
avio_skip(pb, nkey);
} else {
avio_read(pb, key, nkey);
}
if (nval > sizeof(val)) {
avio_skip(pb, nval);
} else {
avio_read(pb, val, nval);
}
if (!strcmp(key, "codec")) {
av_log(s, AV_LOG_DEBUG, "Codec is <%s>\n", val);
strncpy(codec_name, val, sizeof(codec_name) - 1);
}
if (!strcmp(key, "HeaderSeed")) {
av_log(s, AV_LOG_DEBUG, "HeaderSeed is <%s>\n", val);
header_seed = atoi(val);
}
if (!strcmp(key, "HeaderKey")) {
av_log(s, AV_LOG_DEBUG, "HeaderKey is <%s>\n", val);
sscanf(val, "%u%u%u%u", &header_key_part[0], &header_key_part[1], &header_key_part[2], &header_key_part[3]);
for (idx = 0; idx < 4; idx++) {
AV_WB32(&header_key[idx * 4], header_key_part[idx]);
}
av_log(s, AV_LOG_DEBUG, "Processed HeaderKey is ");
for (i = 0; i < 16; i++)
av_log(s, AV_LOG_DEBUG, "%02x", header_key[i]);
av_log(s, AV_LOG_DEBUG, "\n");
}
}
if (c->aa_fixed_key_len != 16) {
av_log(s, AV_LOG_ERROR, "aa_fixed_key value needs to be 16 bytes!\n");
return AVERROR(EINVAL);
}
if ((c->codec_second_size = get_second_size(codec_name)) == -1) {
av_log(s, AV_LOG_ERROR, "unknown codec <%s>!\n", codec_name);
return AVERROR(EINVAL);
}
c->tea_ctx = av_tea_alloc();
if (!c->tea_ctx)
return AVERROR(ENOMEM);
av_tea_init(c->tea_ctx, c->aa_fixed_key, 16);
output[0] = output[1] = 0;
memcpy(output + 2, header_key, 16);
idx = 0;
for (i = 0; i < 3; i++) {
AV_WB32(src, header_seed);
AV_WB32(src + 4, header_seed + 1);
header_seed += 2;
av_tea_crypt(c->tea_ctx, dst, src, 1, NULL, 0);
for (j = 0; j < TEA_BLOCK_SIZE && idx < 18; j+=1, idx+=1) {
output[idx] = output[idx] ^ dst[j];
}
}
memcpy(c->file_key, output + 2, 16);
av_log(s, AV_LOG_DEBUG, "File key is ");
for (i = 0; i < 16; i++)
av_log(s, AV_LOG_DEBUG, "%02x", c->file_key[i]);
av_log(s, AV_LOG_DEBUG, "\n");
st = avformat_new_stream(s, NULL);
if (!st) {
av_freep(&c->tea_ctx);
return AVERROR(ENOMEM);
}
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
if (!strcmp(codec_name, "mp332")) {
st->codec->codec_id = AV_CODEC_ID_MP3;
st->codec->sample_rate = 22050;
st->need_parsing = AVSTREAM_PARSE_FULL_RAW;
st->start_time = 0;
} else if (!strcmp(codec_name, "acelp85")) {
st->codec->codec_id = AV_CODEC_ID_SIPR;
st->codec->block_align = 19;
st->codec->channels = 1;
st->codec->sample_rate = 8500;
} else if (!strcmp(codec_name, "acelp16")) {
st->codec->codec_id = AV_CODEC_ID_SIPR;
st->codec->block_align = 20;
st->codec->channels = 1;
st->codec->sample_rate = 16000;
}
for (i = 1; i < toc_size; i++) {
current_size = TOC[i].size;
if (current_size > largest_size) {
largest_idx = i;
largest_size = current_size;
}
}
start = TOC[largest_idx].offset;
avio_seek(pb, start, SEEK_SET);
c->current_chapter_size = 0;
return 0;
}
| 1threat
|
1. Write a Python function to ask the user to input a sentence (read the body for clarification) : Write a python function to ask the user to input a sentence.
If the sentence begins with a vowel,
Return the sentence as it is to be printed.
If the sentence does not begin with a vowel,
Change the first letter to a capital letter and return the sentence to be printed.
| 0debug
|
static int doTest(uint8_t *ref[4], int refStride[4], int w, int h, int srcFormat, int dstFormat,
int srcW, int srcH, int dstW, int dstH, int flags){
uint8_t *src[4] = {0};
uint8_t *dst[4] = {0};
uint8_t *out[4] = {0};
int srcStride[4], dstStride[4];
int i;
uint64_t ssdY, ssdU, ssdV, ssdA=0;
struct SwsContext *srcContext = NULL, *dstContext = NULL,
*outContext = NULL;
int res;
res = 0;
for (i=0; i<4; i++){
if (srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24)
srcStride[i]= srcW*3;
else if (srcFormat==PIX_FMT_RGB48BE || srcFormat==PIX_FMT_RGB48LE)
srcStride[i]= srcW*6;
else
srcStride[i]= srcW*4;
if (dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24)
dstStride[i]= dstW*3;
else if (dstFormat==PIX_FMT_RGB48BE || dstFormat==PIX_FMT_RGB48LE)
dstStride[i]= dstW*6;
else
dstStride[i]= dstW*4;
src[i]= (uint8_t*) malloc(srcStride[i]*srcH);
dst[i]= (uint8_t*) malloc(dstStride[i]*dstH);
out[i]= (uint8_t*) malloc(refStride[i]*h);
if (!src[i] || !dst[i] || !out[i]) {
perror("Malloc");
res = -1;
goto end;
}
}
srcContext= sws_getContext(w, h, PIX_FMT_YUVA420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL);
if (!srcContext) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(PIX_FMT_YUVA420P),
sws_format_name(srcFormat));
res = -1;
goto end;
}
dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL);
if (!dstContext) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(srcFormat),
sws_format_name(dstFormat));
res = -1;
goto end;
}
outContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUVA420P, flags, NULL, NULL, NULL);
if (!outContext) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(dstFormat),
sws_format_name(PIX_FMT_YUVA420P));
res = -1;
goto end;
}
sws_scale(srcContext, ref, refStride, 0, h , src, srcStride);
sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride);
sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride);
ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h);
ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1);
ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1);
if (isALPHA(srcFormat) && isALPHA(dstFormat))
ssdA= getSSD(ref[3], out[3], refStride[3], refStride[3], w, h);
if (srcFormat == PIX_FMT_GRAY8 || dstFormat==PIX_FMT_GRAY8) ssdU=ssdV=0;
ssdY/= w*h;
ssdU/= w*h/4;
ssdV/= w*h/4;
ssdA/= w*h;
printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5"PRId64",%5"PRId64",%5"PRId64",%5"PRId64"\n",
sws_format_name(srcFormat), srcW, srcH,
sws_format_name(dstFormat), dstW, dstH,
flags, ssdY, ssdU, ssdV, ssdA);
fflush(stdout);
end:
sws_freeContext(srcContext);
sws_freeContext(dstContext);
sws_freeContext(outContext);
for (i=0; i<4; i++){
free(src[i]);
free(dst[i]);
free(out[i]);
}
return res;
}
| 1threat
|
static int ioreq_runio_qemu_sync(struct ioreq *ioreq)
{
struct XenBlkDev *blkdev = ioreq->blkdev;
int i, rc, len = 0;
off_t pos;
if (ioreq->req.nr_segments && ioreq_map(ioreq) == -1)
goto err;
if (ioreq->presync)
bdrv_flush(blkdev->bs);
switch (ioreq->req.operation) {
case BLKIF_OP_READ:
pos = ioreq->start;
for (i = 0; i < ioreq->v.niov; i++) {
rc = bdrv_read(blkdev->bs, pos / BLOCK_SIZE,
ioreq->v.iov[i].iov_base,
ioreq->v.iov[i].iov_len / BLOCK_SIZE);
if (rc != 0) {
xen_be_printf(&blkdev->xendev, 0, "rd I/O error (%p, len %zd)\n",
ioreq->v.iov[i].iov_base,
ioreq->v.iov[i].iov_len);
goto err;
}
len += ioreq->v.iov[i].iov_len;
pos += ioreq->v.iov[i].iov_len;
}
break;
case BLKIF_OP_WRITE:
case BLKIF_OP_WRITE_BARRIER:
if (!ioreq->req.nr_segments)
break;
pos = ioreq->start;
for (i = 0; i < ioreq->v.niov; i++) {
rc = bdrv_write(blkdev->bs, pos / BLOCK_SIZE,
ioreq->v.iov[i].iov_base,
ioreq->v.iov[i].iov_len / BLOCK_SIZE);
if (rc != 0) {
xen_be_printf(&blkdev->xendev, 0, "wr I/O error (%p, len %zd)\n",
ioreq->v.iov[i].iov_base,
ioreq->v.iov[i].iov_len);
goto err;
}
len += ioreq->v.iov[i].iov_len;
pos += ioreq->v.iov[i].iov_len;
}
break;
default:
goto err;
}
if (ioreq->postsync)
bdrv_flush(blkdev->bs);
ioreq->status = BLKIF_RSP_OKAY;
ioreq_unmap(ioreq);
ioreq_finish(ioreq);
return 0;
err:
ioreq->status = BLKIF_RSP_ERROR;
return -1;
}
| 1threat
|
one if statement returns none : one if statement should return a string, however it turns out none.
I have tried to set a String variable output to store the expected string in the if statement.
public static String starString(int n){
if(n<0){
String output = "";
return output = "IllegalArgumentException";
}else{
String stars = "";
for(int i = 0; i < Math.pow(2, n); i++){
stars += "*";
}
return stars;
}
}
I expect starString(-1)
exp. exception:IllegalArgumentException
the error message: none
| 0debug
|
Firebase login failed : <p>I'm having troubles trying to migrate to new firebase console.
I'm doing exactly what is on this link: <a href="https://firebase.google.com/support/guides/firebase-web#import_your_project_to_the_firebase_console_numbered" rel="noreferrer">https://firebase.google.com/support/guides/firebase-web#import_your_project_to_the_firebase_console_numbered</a></p>
<p>And this is what happened in the step 2:
<strong><em>Firebase login failed
The Firebase CLI login request was rejected or an error occurred. Please run firebase login again or contact support if you continue to have difficulty logging in.</em></strong></p>
<p>Any ideas? Thanks since now.</p>
| 0debug
|
static av_cold int hnm_decode_init(AVCodecContext *avctx)
{
Hnm4VideoContext *hnm = avctx->priv_data;
if (avctx->extradata_size < 1) {
av_log(avctx, AV_LOG_ERROR,
"Extradata missing, decoder requires version number\n");
return AVERROR_INVALIDDATA;
}
hnm->version = avctx->extradata[0];
avctx->pix_fmt = AV_PIX_FMT_PAL8;
hnm->width = avctx->width;
hnm->height = avctx->height;
hnm->buffer1 = av_mallocz(avctx->width * avctx->height);
hnm->buffer2 = av_mallocz(avctx->width * avctx->height);
hnm->processed = av_mallocz(avctx->width * avctx->height);
if (!hnm->buffer1 || !hnm->buffer2 || !hnm->processed) {
av_log(avctx, AV_LOG_ERROR, "av_mallocz() failed\n");
av_freep(&hnm->buffer1);
av_freep(&hnm->buffer2);
av_freep(&hnm->processed);
return AVERROR(ENOMEM);
}
hnm->current = hnm->buffer1;
hnm->previous = hnm->buffer2;
return 0;
}
| 1threat
|
how to passa a variable in javascript : i am tryng to pass a variable to the javascript but its not working ...
my code :
var namealert = key;
$("#alerta").append("<div class='alert_item clearfix'><a href='#' id='delete_alert' onclick='localStorage.removeItem('" +namealert+ "'');'><img width='15px' style='margin-right:10px;opacity: 0.5;' src='img/error.png'></a><div class='date'>"+obj['0']+"</div><br><div class='title'>"+obj['1']+"</div><br><div class='msg'>"+obj['2']+"</div><br><a href='#' id='candidatar' onclick='candidatar()'><img width='100px' style='margin-right:10px;opacity: 0.8;' src='img/disponivel.png'></a></div>");
i get the dom out put :
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/7W2Rf.png
and i need it to be localStorage.removeItem('alerts_1481117090');
| 0debug
|
How to program HTML to create consistent columns for text? : <p>I’m trying to make it so that the pages of my book can fit into 2 specific column sizes for all the text such that I can click through the pages. Is there any way I can automate it so it detects where exactly in the page it needs to stop and move onto the next? </p>
| 0debug
|
static void unterminated_array(void)
{
QObject *obj = qobject_from_json("[32", NULL);
g_assert(obj == NULL);
}
| 1threat
|
static void spapr_tce_table_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->vmsd = &vmstate_spapr_tce_table;
dc->init = spapr_tce_table_realize;
dc->reset = spapr_tce_reset;
QLIST_INIT(&spapr_tce_tables);
spapr_register_hypercall(H_PUT_TCE, h_put_tce);
}
| 1threat
|
static void baum_chr_open(Chardev *chr,
ChardevBackend *backend,
bool *be_opened,
Error **errp)
{
BaumChardev *baum = BAUM_CHARDEV(chr);
brlapi_handle_t *handle;
handle = g_malloc0(brlapi_getHandleSize());
baum->brlapi = handle;
baum->brlapi_fd = brlapi__openConnection(handle, NULL, NULL);
if (baum->brlapi_fd == -1) {
error_setg(errp, "brlapi__openConnection: %s",
brlapi_strerror(brlapi_error_location()));
g_free(handle);
return;
}
baum->deferred_init = 0;
baum->cellCount_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, baum_cellCount_timer_cb, baum);
qemu_set_fd_handler(baum->brlapi_fd, baum_chr_read, NULL, baum);
}
| 1threat
|
Need to serialize/deserialize dataset using protobuf in c# : The dataset contains values from SP execution. Is there any possible to create [ProtoMember] dynamically using TypeBuilder??
| 0debug
|
Whats the symbol for numbers in dart? : I want this to be true for all numbers. I don't want to type this for all numbers of course.
if (overs == 0.6) {
overs = 1.0;
}
I want that if for example 1.6, is reached, it should be converted to 2. I want this to be true for all numbers.
| 0debug
|
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
| 1threat
|
Difference between drawable and drawable-v24 in android studio : <p>I am new to android studio, was earlier using eclipse. I want to know difference between drawable and drawable-v24 in android studio.</p>
| 0debug
|
Where should the android service calls and calls to GoogleAPIClient be written while using MVP pattern in android? : <p>I am trying to implement <strong>MVP pattern</strong> in my android project by referring to this link : <a href="https://github.com/jpotts18/android-mvp" rel="noreferrer">https://github.com/jpotts18/android-mvp</a></p>
<p>I have successfully implemented the <strong>view / presenter / interactor</strong> classes. I am not clear on </p>
<ul>
<li><strong>Where to put the <code>service</code> call code?</strong></li>
</ul>
<blockquote>
<p>Since i cannot get the context inside the presenter or interactor
class, I am not able to put the <code>service</code> call there</p>
</blockquote>
<ul>
<li><strong>Where to implement the <code>GoogleApiClient</code> class?</strong></li>
</ul>
<blockquote>
<p>Since <code>GoogleApiClient</code> also requires context to run, it also cannot be
implemented inside the presenter or interactor without a context</p>
</blockquote>
| 0debug
|
document.write('<script src="evil.js"></script>');
| 1threat
|
count the no. of employee group by department and fill the counting in respecting experience column : I have two tables employee and department,Employee table schema(Eid,Ename,DOJ,Sal,Dept ID) and Department schema(Dept id,Dname).So what i want in output is count the no. of employee by each department and according to experience.
O/P->
dept 0-5yrs 5-10yrs 10-15yrs above15yrs
HR 4 9
Account 2 3 1
like this..
| 0debug
|
Parse JSON in Map, android : <p>How i can to get this JSON <a href="http://api.fixer.io/latest" rel="nofollow noreferrer">http://api.fixer.io/latest</a> through java code and write mas "rates" in map?</p>
| 0debug
|
Why +[] or +"" equal to 0 in javascript : <p>I know in javascript, <code>Array</code> does not support <code>+</code> operation, so <code>+[]</code> would be convert to <code>+ [].toString()</code>, but I can't figure out why <code>+""</code> is equal to zero.</p>
| 0debug
|
static int64_t alloc_refcount_block(BlockDriverState *bs, int64_t cluster_index)
{
BDRVQcowState *s = bs->opaque;
unsigned int refcount_table_index;
int ret;
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC);
refcount_table_index = cluster_index >> (s->cluster_bits - REFCOUNT_SHIFT);
if (refcount_table_index < s->refcount_table_size) {
uint64_t refcount_block_offset =
s->refcount_table[refcount_table_index];
if (refcount_block_offset) {
if (refcount_block_offset != s->refcount_block_cache_offset) {
ret = load_refcount_block(bs, refcount_block_offset);
if (ret < 0) {
return ret;
}
}
return refcount_block_offset;
}
}
if (cache_refcount_updates) {
ret = write_refcount_block(bs);
if (ret < 0) {
return ret;
}
}
uint64_t new_block = alloc_clusters_noref(bs, s->cluster_size);
memset(s->refcount_block_cache, 0, s->cluster_size);
s->refcount_block_cache_offset = new_block;
#ifdef DEBUG_ALLOC2
fprintf(stderr, "qcow2: Allocate refcount block %d for %" PRIx64
" at %" PRIx64 "\n",
refcount_table_index, cluster_index << s->cluster_bits, new_block);
#endif
if (in_same_refcount_block(s, new_block, cluster_index << s->cluster_bits)) {
int block_index = (new_block >> s->cluster_bits) &
((1 << (s->cluster_bits - REFCOUNT_SHIFT)) - 1);
s->refcount_block_cache[block_index] = cpu_to_be16(1);
} else {
ret = update_refcount(bs, new_block, s->cluster_size, 1);
if (ret < 0) {
goto fail_block;
}
}
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE);
ret = bdrv_pwrite(bs->file, new_block, s->refcount_block_cache,
s->cluster_size);
if (ret < 0) {
goto fail_block;
}
if (refcount_table_index < s->refcount_table_size) {
uint64_t data64 = cpu_to_be64(new_block);
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_HOOKUP);
ret = bdrv_pwrite(bs->file,
s->refcount_table_offset + refcount_table_index * sizeof(uint64_t),
&data64, sizeof(data64));
if (ret < 0) {
goto fail_block;
}
s->refcount_table[refcount_table_index] = new_block;
return new_block;
}
BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_GROW);
uint64_t refcount_block_clusters = 1 << (s->cluster_bits - REFCOUNT_SHIFT);
uint64_t blocks_used = (s->free_cluster_index +
refcount_block_clusters - 1) / refcount_block_clusters;
uint64_t table_size = next_refcount_table_size(s, blocks_used + 1);
uint64_t last_table_size;
uint64_t blocks_clusters;
do {
uint64_t table_clusters = size_to_clusters(s, table_size);
blocks_clusters = 1 +
((table_clusters + refcount_block_clusters - 1)
/ refcount_block_clusters);
uint64_t meta_clusters = table_clusters + blocks_clusters;
last_table_size = table_size;
table_size = next_refcount_table_size(s, blocks_used +
((meta_clusters + refcount_block_clusters - 1)
/ refcount_block_clusters));
} while (last_table_size != table_size);
#ifdef DEBUG_ALLOC2
fprintf(stderr, "qcow2: Grow refcount table %" PRId32 " => %" PRId64 "\n",
s->refcount_table_size, table_size);
#endif
uint64_t meta_offset = (blocks_used * refcount_block_clusters) *
s->cluster_size;
uint64_t table_offset = meta_offset + blocks_clusters * s->cluster_size;
uint16_t *new_blocks = qemu_mallocz(blocks_clusters * s->cluster_size);
uint64_t *new_table = qemu_mallocz(table_size * sizeof(uint64_t));
assert(meta_offset >= (s->free_cluster_index * s->cluster_size));
memcpy(new_table, s->refcount_table,
s->refcount_table_size * sizeof(uint64_t));
new_table[refcount_table_index] = new_block;
int i;
for (i = 0; i < blocks_clusters; i++) {
new_table[blocks_used + i] = meta_offset + (i * s->cluster_size);
}
uint64_t table_clusters = size_to_clusters(s, table_size * sizeof(uint64_t));
int block = 0;
for (i = 0; i < table_clusters + blocks_clusters; i++) {
new_blocks[block++] = cpu_to_be16(1);
}
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE_BLOCKS);
ret = bdrv_pwrite(bs->file, meta_offset, new_blocks,
blocks_clusters * s->cluster_size);
qemu_free(new_blocks);
if (ret < 0) {
goto fail_table;
}
for(i = 0; i < table_size; i++) {
cpu_to_be64s(&new_table[i]);
}
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE_TABLE);
ret = bdrv_pwrite(bs->file, table_offset, new_table,
table_size * sizeof(uint64_t));
if (ret < 0) {
goto fail_table;
}
for(i = 0; i < table_size; i++) {
cpu_to_be64s(&new_table[i]);
}
uint8_t data[12];
cpu_to_be64w((uint64_t*)data, table_offset);
cpu_to_be32w((uint32_t*)(data + 8), table_clusters);
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_SWITCH_TABLE);
ret = bdrv_pwrite(bs->file, offsetof(QCowHeader, refcount_table_offset),
data, sizeof(data));
if (ret < 0) {
goto fail_table;
}
uint64_t old_table_offset = s->refcount_table_offset;
uint64_t old_table_size = s->refcount_table_size;
qemu_free(s->refcount_table);
s->refcount_table = new_table;
s->refcount_table_size = table_size;
s->refcount_table_offset = table_offset;
uint64_t old_free_cluster_index = s->free_cluster_index;
qcow2_free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t));
s->free_cluster_index = old_free_cluster_index;
ret = load_refcount_block(bs, new_block);
if (ret < 0) {
goto fail_block;
}
return new_block;
fail_table:
qemu_free(new_table);
fail_block:
s->refcount_block_cache_offset = 0;
return ret;
}
| 1threat
|
SAP - dynamic selections required field : Need to define one dynamic selection field as required.
On variant atteibutes screen assignment there is not required field option on dynamic selections, only protect field available.
(I use a starting variant while running tcode).
Any idea how to implement this?
| 0debug
|
static void build_pci_bus_state_init(AcpiBuildPciBusHotplugState *state,
AcpiBuildPciBusHotplugState *parent,
bool pcihp_bridge_en)
{
state->parent = parent;
state->device_table = build_alloc_array();
state->notify_table = build_alloc_array();
state->pcihp_bridge_en = pcihp_bridge_en;
}
| 1threat
|
Are there any good APIs to search for books via ISBN? : <p>I am working on an iOS app and I have a list of ISBNs. I want to pull up book cover image, title, author, and other nice-to-haves if available, like reviews, price, etc. I tried using the Google Books API, but newer books are not listed in their service. I need a service that has up-to-date ISBNs, particularly for University textbooks in the United States.</p>
<p>For example, the following ISBN returns 0 results via the Google Books API (and others I tried):
<a href="https://www.googleapis.com/books/v1/volumes?q=isbn:9780134092669" rel="noreferrer">https://www.googleapis.com/books/v1/volumes?q=isbn:9780134092669</a></p>
<p>But a book does exist with that ISBN:
<a href="http://www.isbnsearch.org/isbn/9780134092669" rel="noreferrer">http://www.isbnsearch.org/isbn/9780134092669</a> </p>
<p>My question is: are there any good APIs that I can use, free or otherwise, to search for books via ISBN? The only thing I can find is the Amazon Product Advertising API, which is complete overkill.</p>
| 0debug
|
A bug in short c++ code, and I think it's due to the deconstruct function of class. But I cannot find : <p>I think the bug is related to the delete dynamic array manipulation. But I'm not sure in detail.</p>
<p>I'm now studying c++ myself, so I'm a totally freshhand. This is a small exercise from a book and I'm trying to solve it. The "main()" function part is what it originally is so I'm only allowed to code about the class "Array2"</p>
<p>Thanks in advance! </p>
<pre><code> #include <iostream>
#include <cstring>
using namespace std;
class Array2
{
int row, col;
int **a;
public:
Array2(int s1=1, int s2=1)
{
row = s1;
col = s2;
a = new int *[row];
for (int i = 0; i < row; i++)
{
a[i] = new int[col];
}
};
Array2(Array2 & b)
{
a = b.a;
}
~Array2()
{
for (int i = 0; i < row; i++)
{
delete[] a[i];
}
delete[] a;
}
int * operator [] (int i)
{
return a[i];
}
int operator () (int s1, int s2)
{
return a[s1][s2];
}
};
int main() {
Array2 a(3, 4);
int i, j;
for (i = 0; i < 3; ++i)
for (j = 0; j < 4; j++)
a[i][j] = i * 4 + j;
for (i = 0; i < 3; ++i) {
for (j = 0; j < 4; j++) {
cout << a(i, j) << ",";
}
cout << endl;
}
cout << "next" << endl;
Array2 b; b = a;
for (i = 0; i < 3; ++i) {
for (j = 0; j < 4; j++) {
cout << b[i][j] << ",";
}
cout << endl;
}
return 0;
}**
</code></pre>
| 0debug
|
How to iterate and access elements on a List<> in C# : <p>I'm having trouble figuring just exactly how to access and iterate through a List<> of a class and output the values within the class itself. Essentially what I'm trying to do is:
<code>Console.WriteLine(Football.team, Football.year, etc)</code>
for a long list of teams that I have imported form a <code>.csv</code> file.</p>
<p>Please go easy as I'm a newbie at C# programming.</p>
<pre><code>public static void Main(string[] args)
{ // Bring in values from .csv file
List<Football> values = File.ReadAllLines("/Users/wheelK/Documents/football.csv")
.Skip(1)
.Select(v => Football.FromCsv(v))
.ToList();
}
public class Football
{
public string team;
public int year;
public int wins;
public int losses;
public int ties;
}
</code></pre>
| 0debug
|
how can I achieve this randomly arranged images kind look? : <p>I came across this page <a href="https://pepecph.com/" rel="nofollow noreferrer">https://pepecph.com/</a> and thought the effect where pictures just show up randomly on the screen was pretty cool. </p>
<p>I wonder what are some ways to achieve this effect. Should we divide the screen using css grid and assign some of the grid items to be the image elements? I am not good at css and I hope someone can give me some examples to show this is possible. </p>
| 0debug
|
static void alloc_picture(VideoState *is)
{
VideoPicture *vp;
int64_t bufferdiff;
vp = &is->pictq[is->pictq_windex];
if (vp->bmp)
SDL_FreeYUVOverlay(vp->bmp);
video_open(is, 0, vp);
vp->bmp = SDL_CreateYUVOverlay(vp->width, vp->height,
SDL_YV12_OVERLAY,
screen);
bufferdiff = vp->bmp ? FFMAX(vp->bmp->pixels[0], vp->bmp->pixels[1]) - FFMIN(vp->bmp->pixels[0], vp->bmp->pixels[1]) : 0;
if (!vp->bmp || vp->bmp->pitches[0] < vp->width || bufferdiff < vp->height * vp->bmp->pitches[0]) {
av_log(NULL, AV_LOG_FATAL,
"Error: the video system does not support an image\n"
"size of %dx%d pixels. Try using -lowres or -vf \"scale=w:h\"\n"
"to reduce the image size.\n", vp->width, vp->height );
do_exit(is);
}
SDL_LockMutex(is->pictq_mutex);
vp->allocated = 1;
SDL_CondSignal(is->pictq_cond);
SDL_UnlockMutex(is->pictq_mutex);
}
| 1threat
|
php extract standalone numbers from a line : <p>I want to extract standalone numbers from this line</p>
<pre><code>4000123456789000/01/20/202/sssss/500 address/400 city/366
</code></pre>
<p>to have this result</p>
<pre><code>4000123456789000/01/20/202/366
</code></pre>
<p>the problem that the codes gives me this result</p>
<pre><code>4000123456789000/01/20/202/500/400/366
</code></pre>
<p>I don't want the numbers which have the text along with it and I don't want to remove the delimiter </p>
| 0debug
|
Adding text to txt file for each file name with string concatenation in Powershell : i need to do fill a txt in a context directory opened with shift + right click, like the following code:
$dir=Get-Location; gci $dir | ForEach-Object {$temp=$_.Name; ";"+$temp > test.txt}
Thanks
| 0debug
|
Import CSS from node_modules using Gulp-SASS : <p>I want to import a CSS-file from my <code>node_modules</code> using SASS. </p>
<pre class="lang-css prettyprint-override"><code>@import 'normalize.css/normalize';
</code></pre>
<p>This is how my <code>gulpfile.js</code> handles my SASS:</p>
<pre class="lang-js prettyprint-override"><code>const
gulp = require('gulp'),
sass = require('gulp-sass');
gulp.task('sass', function () {
return gulp.src(['source/assets/css/**.scss', '!source/assets/css/**/_*.[scss|sass'])
.pipe(sass())
.pipe(gulp.dest('output/assets/css'));
});
</code></pre>
<p>SASS compiler will not import the css from node_modules. Instead, this will throw an error.</p>
<pre class="lang-none prettyprint-override"><code>Error: File to import not found or unreadable: normalize.css/normalize.
</code></pre>
| 0debug
|
static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor)
{
QEMUCursor *c;
uint8_t *image, *mask;
size_t size;
c = cursor_alloc(cursor->header.width, cursor->header.height);
c->hot_x = cursor->header.hot_spot_x;
c->hot_y = cursor->header.hot_spot_y;
switch (cursor->header.type) {
case SPICE_CURSOR_TYPE_ALPHA:
size = sizeof(uint32_t) * cursor->header.width * cursor->header.height;
memcpy(c->data, cursor->chunk.data, size);
if (qxl->debug > 2) {
cursor_print_ascii_art(c, "qxl/alpha");
}
break;
case SPICE_CURSOR_TYPE_MONO:
mask = cursor->chunk.data;
image = mask + cursor_get_mono_bpl(c) * c->width;
cursor_set_mono(c, 0xffffff, 0x000000, image, 1, mask);
if (qxl->debug > 2) {
cursor_print_ascii_art(c, "qxl/mono");
}
break;
default:
fprintf(stderr, "%s: not implemented: type %d\n",
__FUNCTION__, cursor->header.type);
goto fail;
}
return c;
fail:
cursor_put(c);
return NULL;
}
| 1threat
|
Sending a variable in python payload - http client : <p>I'm trying to send a variable in python using a payload created by postman, I tried using {{}} and it
didn't work for me, the place where I need the variable is indicated as VARIABLE_SPOT, please let me know what I did wrong in order to send a variable and not a text.</p>
<pre><code>payload = "{\r\n \"some_key\": \"VARIABLE_SPOT\",\r\n }
</code></pre>
| 0debug
|
static int migrate_fd_close(void *opaque)
{
MigrationState *s = opaque;
if (s->mon) {
monitor_resume(s->mon);
}
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
return s->close(s);
}
| 1threat
|
Adding lines from a file into 2D array Java : <p>I'm having trouble trying to write the syntax in Java to do what I want to do with this file</p>
<p>What i'm doing is reading in a file and I want to add specific lines of the file to elements of a 2D array, I have written some pseudo code below to help understand what im trying to do </p>
<pre><code> try
{
FileInputStream fStream = new FileInputStream(fileName);
DataInputStream inStream = new DataInputStream(fStream);
BufferedReader brRead = new BufferedReader (new InputStreamReader(inStream));
String line;
while ((line = brRead.readLine()) !=null)
{
//Lines 1-3
//{
// Add line 1 into element 0,0 of my array
// Add line 2 into element 0,1 of my array
// Add line 3 into element 0,2 of my array
//}
//Lines 4-10
//{
// Add line 4 into element 1,0 of my array
// Add line 5 into element 1,1 of my array
// ect..
//}
}
}
catch (Exception e)
{
}
}
</code></pre>
| 0debug
|
av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact)
{
if (bpp == 8) {
ff_vp9dsp_init_8(dsp);
} else if (bpp == 10) {
ff_vp9dsp_init_10(dsp);
} else {
av_assert0(bpp == 12);
ff_vp9dsp_init_12(dsp);
}
if (ARCH_X86) ff_vp9dsp_init_x86(dsp, bpp, bitexact);
if (ARCH_MIPS) ff_vp9dsp_init_mips(dsp, bpp);
}
| 1threat
|
SMTP AUTH extension not supported by server : <p>Using python I want to send email from my app but it shows the error</p>
<pre><code>SMTP AUTH extension not supported by server
</code></pre>
<p>Code for the program,</p>
<pre><code>import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
fromaddr = "test1@example.com"
toaddr = "test2@example.com"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = "Test Mail"
body = "Test mail from python"
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.example.com', 25)
server.ehlo()
server.starttls()
server.ehlo()
server.login(fromaddr, "password")
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
</code></pre>
<p>Telnet Output:</p>
<pre><code>ehlo test1.example.com
250-hidden
250-HELP
250-SIZE 104857600
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-STARTTLS
250 OK
</code></pre>
<p>I need to authenticate and send mail from app.</p>
| 0debug
|
static void mtree_print_mr(fprintf_function mon_printf, void *f,
const MemoryRegion *mr, unsigned int level,
target_phys_addr_t base,
MemoryRegionListHead *alias_print_queue)
{
MemoryRegionList *new_ml, *ml, *next_ml;
MemoryRegionListHead submr_print_queue;
const MemoryRegion *submr;
unsigned int i;
if (!mr) {
return;
}
for (i = 0; i < level; i++) {
mon_printf(f, " ");
}
if (mr->alias) {
MemoryRegionList *ml;
bool found = false;
QTAILQ_FOREACH(ml, alias_print_queue, queue) {
if (ml->mr == mr->alias && !ml->printed) {
found = true;
}
}
if (!found) {
ml = g_new(MemoryRegionList, 1);
ml->mr = mr->alias;
ml->printed = false;
QTAILQ_INSERT_TAIL(alias_print_queue, ml, queue);
}
mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d): alias %s @%s "
TARGET_FMT_plx "-" TARGET_FMT_plx "\n",
base + mr->addr,
base + mr->addr
+ (target_phys_addr_t)int128_get64(mr->size) - 1,
mr->priority,
mr->name,
mr->alias->name,
mr->alias_offset,
mr->alias_offset
+ (target_phys_addr_t)int128_get64(mr->size) - 1);
} else {
mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d): %s\n",
base + mr->addr,
base + mr->addr
+ (target_phys_addr_t)int128_get64(mr->size) - 1,
mr->priority,
mr->name);
}
QTAILQ_INIT(&submr_print_queue);
QTAILQ_FOREACH(submr, &mr->subregions, subregions_link) {
new_ml = g_new(MemoryRegionList, 1);
new_ml->mr = submr;
QTAILQ_FOREACH(ml, &submr_print_queue, queue) {
if (new_ml->mr->addr < ml->mr->addr ||
(new_ml->mr->addr == ml->mr->addr &&
new_ml->mr->priority > ml->mr->priority)) {
QTAILQ_INSERT_BEFORE(ml, new_ml, queue);
new_ml = NULL;
break;
}
}
if (new_ml) {
QTAILQ_INSERT_TAIL(&submr_print_queue, new_ml, queue);
}
}
QTAILQ_FOREACH(ml, &submr_print_queue, queue) {
mtree_print_mr(mon_printf, f, ml->mr, level + 1, base + mr->addr,
alias_print_queue);
}
QTAILQ_FOREACH_SAFE(next_ml, &submr_print_queue, queue, ml) {
g_free(ml);
}
}
| 1threat
|
static bool virtqueue_map_desc(VirtIODevice *vdev, unsigned int *p_num_sg,
hwaddr *addr, struct iovec *iov,
unsigned int max_num_sg, bool is_write,
hwaddr pa, size_t sz)
{
bool ok = false;
unsigned num_sg = *p_num_sg;
assert(num_sg <= max_num_sg);
if (!sz) {
virtio_error(vdev, "virtio: zero sized buffers are not allowed");
goto out;
}
while (sz) {
hwaddr len = sz;
if (num_sg == max_num_sg) {
virtio_error(vdev, "virtio: too many write descriptors in "
"indirect table");
goto out;
}
iov[num_sg].iov_base = cpu_physical_memory_map(pa, &len, is_write);
if (!iov[num_sg].iov_base) {
virtio_error(vdev, "virtio: bogus descriptor or out of resources");
goto out;
}
iov[num_sg].iov_len = len;
addr[num_sg] = pa;
sz -= len;
pa += len;
num_sg++;
}
ok = true;
out:
*p_num_sg = num_sg;
return ok;
}
| 1threat
|
static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
{
UHCIState *s = opaque;
addr &= 0x1f;
trace_usb_uhci_mmio_writew(addr, val);
switch(addr) {
case 0x00:
if ((val & UHCI_CMD_RS) && !(s->cmd & UHCI_CMD_RS)) {
trace_usb_uhci_schedule_start();
s->expire_time = qemu_get_clock_ns(vm_clock) +
(get_ticks_per_sec() / FRAME_TIMER_FREQ);
qemu_mod_timer(s->frame_timer, qemu_get_clock_ns(vm_clock));
s->status &= ~UHCI_STS_HCHALTED;
} else if (!(val & UHCI_CMD_RS)) {
s->status |= UHCI_STS_HCHALTED;
}
if (val & UHCI_CMD_GRESET) {
UHCIPort *port;
int i;
for(i = 0; i < NB_PORTS; i++) {
port = &s->ports[i];
usb_device_reset(port->port.dev);
}
uhci_reset(s);
return;
}
if (val & UHCI_CMD_HCRESET) {
uhci_reset(s);
return;
}
s->cmd = val;
break;
case 0x02:
s->status &= ~val;
if (val & UHCI_STS_USBINT)
s->status2 = 0;
uhci_update_irq(s);
break;
case 0x04:
s->intr = val;
uhci_update_irq(s);
break;
case 0x06:
if (s->status & UHCI_STS_HCHALTED)
s->frnum = val & 0x7ff;
break;
case 0x10 ... 0x1f:
{
UHCIPort *port;
USBDevice *dev;
int n;
n = (addr >> 1) & 7;
if (n >= NB_PORTS)
return;
port = &s->ports[n];
dev = port->port.dev;
if (dev && dev->attached) {
if ( (val & UHCI_PORT_RESET) &&
!(port->ctrl & UHCI_PORT_RESET) ) {
usb_device_reset(dev);
}
}
port->ctrl &= UHCI_PORT_READ_ONLY;
if (!(port->ctrl & UHCI_PORT_CCS)) {
val &= ~UHCI_PORT_EN;
}
port->ctrl |= (val & ~UHCI_PORT_READ_ONLY);
port->ctrl &= ~(val & UHCI_PORT_WRITE_CLEAR);
}
break;
}
}
| 1threat
|
std::make_unique<T> vs reset(new T) : <p>I want to ask a question about memory leaks in constructor. Let's consider a class:</p>
<pre><code> class Foo
{
public:
Foo(){ throw 500;}
};
</code></pre>
<p>What is the difference between </p>
<pre><code>std::unique_ptr<Foo> l_ptr = std::make_unique<Foo>();
</code></pre>
<p>and </p>
<pre><code>std::unique_ptr<Foo> l_ptr;
l_ptr.reset(new Foo());
</code></pre>
<p>In my opinion a solution with make_unique should protect me from memory leak but in both situations I got the same valgrind result:</p>
<pre><code>$ valgrind --leak-check=full ./a.out
==17611== Memcheck, a memory error detector
==17611== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==17611== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==17611== Command: ./a.out
==17611==
terminate called after throwing an instance of 'int'
==17611==
==17611== Process terminating with default action of signal 6 (SIGABRT)
==17611== at 0x5407418: raise (raise.c:54)
==17611== by 0x5409019: abort (abort.c:89)
==17611== by 0x4EC984C: __gnu_cxx::__verbose_terminate_handler() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==17611== by 0x4EC76B5: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==17611== by 0x4EC7700: std::terminate() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==17611== by 0x4EC7918: __cxa_throw (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==17611== by 0x40097B: Foo::Foo() (in /home/rungo/Repositories/test/a.out)
==17611== by 0x4008DC: main (in /home/rungo/Repositories/test/a.out)
==17611==
==17611== HEAP SUMMARY:
==17611== in use at exit: 72,837 bytes in 3 blocks
==17611== total heap usage: 4 allocs, 1 frees, 72,841 bytes allocated
==17611==
==17611== 132 bytes in 1 blocks are possibly lost in loss record 2 of 3
==17611== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17611== by 0x4EC641F: __cxa_allocate_exception (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==17611== by 0x400963: Foo::Foo() (in /home/rungo/Repositories/test/a.out)
==17611== by 0x4008DC: main (in /home/rungo/Repositories/test/a.out)
==17611==
==17611== LEAK SUMMARY:
==17611== definitely lost: 0 bytes in 0 blocks
==17611== indirectly lost: 0 bytes in 0 blocks
==17611== possibly lost: 132 bytes in 1 blocks
==17611== still reachable: 72,705 bytes in 2 blocks
==17611== suppressed: 0 bytes in 0 blocks
==17611== Reachable blocks (those to which a pointer was found) are not shown.
==17611== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==17611==
==17611== For counts of detected and suppressed errors, rerun with: -v
==17611== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
[1] 17611 abort (core dumped) valgrind --leak-check=full ./a.out
</code></pre>
<p>It is the same when I use clang++ and g++.
I found here: <a href="https://isocpp.org/wiki/faq/exceptions#ctors-can-throw" rel="noreferrer">https://isocpp.org/wiki/faq/exceptions#ctors-can-throw</a> the sentence: </p>
<blockquote>
<p>Note: if a constructor finishes by throwing an exception, the memory associated with the object itself is cleaned up — there is no memory leak.</p>
</blockquote>
<p>My question is why we have a leak in this situation and why make_unique is not preventing a leak (doeas it means that there is no dofference between make_unique and reset(new ...)?</p>
| 0debug
|
Jquery delete everything except url in a string : I'm new to Jquery and I want to delete everything in this string except for the url(http://momio.me/temporary//assets/cat_9_2.png")
<div class="game1-sprite noBounceEffect trans_on" style="left: 135px; top: 202px; background-size: 86px; background-image: url("filesystem:http://momio.me/temporary//assets/cat_9_2.png"); background-repeat: no-repeat; background-position: 20% 90%;">
<div class="game1-door open"></div>
<span class="whiteText"></span>
</div>
| 0debug
|
Unknown error in c++ program : <p>I have a c++ program which opens an url depending in what the user inputs.</p>
<p>Here's the code:</p>
<pre><code>#include <iostream>
#include <string>
using namespace std;
int main(){
int i = 1;
string google = "https://www.google.com/search?q=";
string input;
getline(cin, input);
string changeSpace(string input)
{
for (int i = 0; i < text.length(); i++)
{
if (text[i] == ' ')
text[i] = '+';
}
return text;
}
input = changeSpace(input);
cout << input << endl;
string url = string(google + input);
system(string("start " + url).c_str());
cout << url << endl;
}
</code></pre>
<p>The error is here:</p>
<pre><code>string changeSpace(string input)
{
</code></pre>
<p>In the bracket it says it expected a " ; "</p>
<p>And I don't know why ocurrs that error, it may be a simple mistake, but I don't know it.</p>
<p>Please help me.</p>
| 0debug
|
void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input)
{
x86_reg j, k;
long n = s->mdct_size;
long n2 = n >> 1;
long n4 = n >> 2;
long n8 = n >> 3;
const uint16_t *revtab = s->revtab;
const FFTSample *tcos = s->tcos;
const FFTSample *tsin = s->tsin;
const FFTSample *in1, *in2;
FFTComplex *z = (FFTComplex *)output;
in1 = input;
in2 = input + n2 - 1;
#ifdef EMULATE_3DNOWEXT
__asm__ volatile("movd %0, %%mm7" ::"r"(1<<31));
#endif
for(k = 0; k < n4; k++) {
__asm__ volatile(
"movd %0, %%mm0 \n"
"movd %2, %%mm1 \n"
"punpckldq %1, %%mm0 \n"
"punpckldq %3, %%mm1 \n"
"movq %%mm0, %%mm2 \n"
PSWAPD( %%mm1, %%mm3 )
"pfmul %%mm1, %%mm0 \n"
"pfmul %%mm3, %%mm2 \n"
#ifdef EMULATE_3DNOWEXT
"movq %%mm0, %%mm1 \n"
"punpckhdq %%mm2, %%mm0 \n"
"punpckldq %%mm2, %%mm1 \n"
"pxor %%mm7, %%mm0 \n"
"pfadd %%mm1, %%mm0 \n"
#else
"pfpnacc %%mm2, %%mm0 \n"
#endif
::"m"(in2[-2*k]), "m"(in1[2*k]),
"m"(tcos[k]), "m"(tsin[k])
);
__asm__ volatile(
"movq %%mm0, %0 \n\t"
:"=m"(z[revtab[k]])
);
}
ff_fft_dispatch_3dn2(z, s->nbits);
#define CMUL(j,mm0,mm1)\
"movq (%2,"#j",2), %%mm6 \n"\
"movq 8(%2,"#j",2), "#mm0"\n"\
"movq %%mm6, "#mm1"\n"\
"movq "#mm0",%%mm7 \n"\
"pfmul (%3,"#j"), %%mm6 \n"\
"pfmul (%4,"#j"), "#mm0"\n"\
"pfmul (%4,"#j"), "#mm1"\n"\
"pfmul (%3,"#j"), %%mm7 \n"\
"pfsub %%mm6, "#mm0"\n"\
"pfadd %%mm7, "#mm1"\n"
j = -n2;
k = n2-8;
__asm__ volatile(
"1: \n"
CMUL(%0, %%mm0, %%mm1)
CMUL(%1, %%mm2, %%mm3)
"movd %%mm0, (%2,%0,2) \n"
"movd %%mm1,12(%2,%1,2) \n"
"movd %%mm2, (%2,%1,2) \n"
"movd %%mm3,12(%2,%0,2) \n"
"psrlq $32, %%mm0 \n"
"psrlq $32, %%mm1 \n"
"psrlq $32, %%mm2 \n"
"psrlq $32, %%mm3 \n"
"movd %%mm0, 8(%2,%0,2) \n"
"movd %%mm1, 4(%2,%1,2) \n"
"movd %%mm2, 8(%2,%1,2) \n"
"movd %%mm3, 4(%2,%0,2) \n"
"sub $8, %1 \n"
"add $8, %0 \n"
"jl 1b \n"
:"+r"(j), "+r"(k)
:"r"(z+n8), "r"(tcos+n8), "r"(tsin+n8)
:"memory"
);
__asm__ volatile("femms");
}
| 1threat
|
How to get user attributes (username, email, etc.) using cognito identity id : <p>I have AWS Cognito Identity Pool that is configured with Cognito User Pool as an authentication provider.</p>
<p>Assume I have identity ID of an identity in Cognito Identity Pool (e.g. us-east-1:XXaXcXXa-XXXX-XXXX-XXX-XXXXXXXXXXXX) where this identity has a linked login to a user in Cognito User Pool.</p>
<p>Using identity ID, how can I get the linked user details (email, phone, username)?</p>
| 0debug
|
static int alloc_scratch_buffers(H264SliceContext *sl, int linesize)
{
const H264Context *h = sl->h264;
int alloc_size = FFALIGN(FFABS(linesize) + 32, 32);
av_fast_malloc(&sl->bipred_scratchpad, &sl->bipred_scratchpad_allocated, 16 * 6 * alloc_size);
av_fast_malloc(&sl->edge_emu_buffer, &sl->edge_emu_buffer_allocated, alloc_size * 2 * 21);
av_fast_malloc(&sl->top_borders[0], &sl->top_borders_allocated[0],
h->mb_width * 16 * 3 * sizeof(uint8_t) * 2);
av_fast_malloc(&sl->top_borders[1], &sl->top_borders_allocated[1],
h->mb_width * 16 * 3 * sizeof(uint8_t) * 2);
if (!sl->bipred_scratchpad || !sl->edge_emu_buffer ||
!sl->top_borders[0] || !sl->top_borders[1]) {
av_freep(&sl->bipred_scratchpad);
av_freep(&sl->edge_emu_buffer);
av_freep(&sl->top_borders[0]);
av_freep(&sl->top_borders[1]);
sl->bipred_scratchpad_allocated = 0;
sl->edge_emu_buffer_allocated = 0;
sl->top_borders_allocated[0] = 0;
sl->top_borders_allocated[1] = 0;
return AVERROR(ENOMEM);
}
return 0;
}
| 1threat
|
MemTxResult gicv3_redist_write(void *opaque, hwaddr offset, uint64_t data,
unsigned size, MemTxAttrs attrs)
{
GICv3State *s = opaque;
GICv3CPUState *cs;
MemTxResult r;
int cpuidx;
cpuidx = offset / 0x20000;
offset %= 0x20000;
assert(cpuidx < s->num_cpu);
cs = &s->cpu[cpuidx];
switch (size) {
case 1:
r = gicr_writeb(cs, offset, data, attrs);
break;
case 4:
r = gicr_writel(cs, offset, data, attrs);
break;
case 8:
r = gicr_writell(cs, offset, data, attrs);
break;
default:
r = MEMTX_ERROR;
break;
}
if (r == MEMTX_ERROR) {
qemu_log_mask(LOG_GUEST_ERROR,
"%s: invalid guest write at offset " TARGET_FMT_plx
"size %u\n", __func__, offset, size);
trace_gicv3_redist_badwrite(gicv3_redist_affid(cs), offset, data,
size, attrs.secure);
} else {
trace_gicv3_redist_write(gicv3_redist_affid(cs), offset, data,
size, attrs.secure);
}
return r;
}
| 1threat
|
Obtaining the full info about fields of the case class in Scala : <p>Consider the following class and method:</p>
<pre><code>case class User(id: Long, name: String) {
private var foo = "Foo" // shouldn't be printed
val bar = "bar" // also shouldn't be printed
}
case class Message(id: Long, userId: Long, text: String)
def printInfo[E](o: E)(implicit tt: TypeTag[E]) = {
}
</code></pre>
<p>I want to make this method print the name, type and value for each of the field for any case class, i.e.</p>
<pre><code>printInfo(User(1, "usr1")) // prints something like "(id, Long, 1), (name, String)"
printInfo(Message(1, 1, "Hello World")) // prints "(id, Long, 1), (userId, Long, 1), (text, String, "Hello World")"
</code></pre>
<p>Adding some custom annotations for fields is also considerable.</p>
| 0debug
|
static uint64_t cg3_reg_read(void *opaque, hwaddr addr, unsigned size)
{
CG3State *s = opaque;
int val;
switch (addr) {
case CG3_REG_BT458_ADDR:
case CG3_REG_BT458_COLMAP:
val = 0;
break;
case CG3_REG_FBC_CTRL:
val = s->regs[0];
break;
case CG3_REG_FBC_STATUS:
val = s->regs[1] | CG3_SR_1152_900_76_B | CG3_SR_ID_COLOR;
break;
case CG3_REG_FBC_CURSTART ... CG3_REG_SIZE:
val = s->regs[addr - 0x10];
break;
default:
qemu_log_mask(LOG_UNIMP,
"cg3: Unimplemented register read "
"reg 0x%" HWADDR_PRIx " size 0x%x\n",
addr, size);
val = 0;
break;
}
DPRINTF("read %02x from reg %" HWADDR_PRIx "\n", val, addr);
return val;
}
| 1threat
|
static void sr_1d97_int(int32_t *p, int i0, int i1)
{
int i;
if (i1 <= i0 + 1) {
if (i0 == 1)
p[1] = (p[1] * I_LFTG_K + (1<<16)) >> 17;
else
p[0] = (p[0] * I_LFTG_X + (1<<15)) >> 16;
return;
}
extend97_int(p, i0, i1);
for (i = (i0 >> 1) - 1; i < (i1 >> 1) + 2; i++)
p[2 * i] -= (I_LFTG_DELTA * (p[2 * i - 1] + p[2 * i + 1]) + (1 << 15)) >> 16;
for (i = (i0 >> 1) - 1; i < (i1 >> 1) + 1; i++)
p[2 * i + 1] -= (I_LFTG_GAMMA * (p[2 * i] + p[2 * i + 2]) + (1 << 15)) >> 16;
for (i = (i0 >> 1); i < (i1 >> 1) + 1; i++)
p[2 * i] += (I_LFTG_BETA * (p[2 * i - 1] + p[2 * i + 1]) + (1 << 15)) >> 16;
for (i = (i0 >> 1); i < (i1 >> 1); i++)
p[2 * i + 1] += (I_LFTG_ALPHA * (p[2 * i] + p[2 * i + 2]) + (1 << 15)) >> 16;
}
| 1threat
|
" textarea " multilines PHP/ HTML : I am using php and html codes in same file for contact form.
When I write multilines in html form (textarea):
(name="TBody" cols="100" rows="10" class="largertextarea" required="required" placeholder="Leave A Message Here"),
the php received the information and put all of them in same line :
$body = $_POST["TBody"];
$msgbody = "- Message is about:" . "<br>" . $body;
For example :
Hi,
Hope all are fine.
Bye.
What I receive in email is like this :
Hi, Hope all are fine. Bye.
So, how can I put them in multilines ?
Thanks in advance for your help.
| 0debug
|
static void fw_cfg_bootsplash(FWCfgState *s)
{
int boot_splash_time = -1;
const char *boot_splash_filename = NULL;
char *p;
char *filename, *file_data;
gsize file_size;
int file_type;
const char *temp;
QemuOptsList *plist = qemu_find_opts("boot-opts");
QemuOpts *opts = QTAILQ_FIRST(&plist->head);
if (opts != NULL) {
temp = qemu_opt_get(opts, "splash");
if (temp != NULL) {
boot_splash_filename = temp;
}
temp = qemu_opt_get(opts, "splash-time");
if (temp != NULL) {
p = (char *)temp;
boot_splash_time = strtol(p, (char **)&p, 10);
}
}
if (boot_splash_time >= 0) {
if (boot_splash_time > 0xffff) {
error_report("splash time is big than 65535, force it to 65535.");
boot_splash_time = 0xffff;
}
qemu_extra_params_fw[0] = (uint8_t)(boot_splash_time & 0xff);
qemu_extra_params_fw[1] = (uint8_t)((boot_splash_time >> 8) & 0xff);
fw_cfg_add_file(s, "etc/boot-menu-wait", qemu_extra_params_fw, 2);
}
if (boot_splash_filename != NULL) {
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, boot_splash_filename);
if (filename == NULL) {
error_report("failed to find file '%s'.", boot_splash_filename);
return;
}
file_data = read_splashfile(filename, &file_size, &file_type);
if (file_data == NULL) {
g_free(filename);
return;
}
if (boot_splash_filedata != NULL) {
g_free(boot_splash_filedata);
}
boot_splash_filedata = (uint8_t *)file_data;
boot_splash_filedata_size = file_size;
if (file_type == JPG_FILE) {
fw_cfg_add_file(s, "bootsplash.jpg",
boot_splash_filedata, boot_splash_filedata_size);
} else {
fw_cfg_add_file(s, "bootsplash.bmp",
boot_splash_filedata, boot_splash_filedata_size);
}
g_free(filename);
}
}
| 1threat
|
extract int digits and float number from a python string : I have a string for example
ex. str1 = "'107.8X98x3.75'"
[107.8, 98, 3.75]
ex. str2 = 'L=130.5mm;L=90mm'
[130.5, 90]
ex. str3 = '圓278.5x15t 304'
[278.5, 15, 304]
Thanks. I know how to extract by int and float, but I don't want to miss which the numbers appear.
| 0debug
|
Date input calculate your birth date in PHP : <p>How to Create a page in PHP with a date input field. In this field you choose A (birth) date. And also A submit button. With this button you give the browser dialog Age in years, months and days prelative to the system date.</p>
| 0debug
|
c# Wait until co routine is finished before executing code : <p>Hi im trying to implement saving/loading from sql database into my game.
i have it all working apart from the fact that i need to hit load twice for it to load the data. </p>
<p>the code to set the data finishes before i have a chance to set it.</p>
<pre><code>public void loadData()
{
GetComponent<SavingLoading>().Load(GameObject.Find("LoginSystem").GetComponent<LoginSystem>().Username);
if (GetComponent<SavingLoading>().LoadedData != "")
{
string[] Data = GetComponent<SavingLoading>().LoadedData.Split(',');
Level = Convert.ToInt32(Data[0]);
CurrentXp = Convert.ToInt32(Data[1]);
currentHealth = Convert.ToInt32(Data[2]);
maxHealth = Convert.ToInt32(Data[3]);
Vector3 LoadedPos = new Vector3(Convert.ToSingle(Data[4]), Convert.ToSingle(Data[5]), Convert.ToSingle(Data[6]));
transform.position = LoadedPos;
}
}
</code></pre>
<p>Theese functions are in another script.</p>
<pre><code>public void Load(string name)
{
StartCoroutine(LoadCall(name));
}
IEnumerator LoadCall(string name)
{
WWWForm form = new WWWForm();
form.AddField("name", name);
WWW www = new WWW(LoadPhP, form);
yield return www;
string _return = www.text;
LoadedData = _return;
}
</code></pre>
<p>how can i go about only updating the data if there is data present? without having to press the load button twice.</p>
| 0debug
|
Why the javascript console does not throw error on creating object recursively? : <pre><code>var main = function() {
this.first = this;
}
console.log(new main().first);
</code></pre>
<p>The code is here :
Object is creating recursively ,I didnot understand why the console not throwing any error.
Please tell me if there is any concept behind this.</p>
| 0debug
|
xcode10 button to create mad lips story will not run, i am new to Xcode : i am just starting out with Xcode 10 and cannot get this button to work for my mad libs creation. this is just for fun but i would love to know how to fix it. please look over my code to see why the "create story" button is not active thank you so much
//
// ViewController.swift
// Field Button Fun
//
// Created by Audrey Chao on 8/3/16.
// Copyright © 2016 Maddie Chao. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var thePlace: UITextField!
@IBOutlet weak var theVerb: UITextField!
@IBOutlet weak var theNumber: UITextField!
@IBOutlet weak var theTemplate: UITextView!
@IBOutlet weak var theStory: UITextView!
@IBAction func createStory(sender: AnyObject) {
theStory.text = theTemplate.text
theStory.text = theStory.text.stringByReplacingOccurrencesOfString("<place>", withString: thePlace.text!)
theStory.text = theStory.text.stringByReplacingOccurrencesOfString("<verb>", withString: theVerb.text!)
theStory.text = theStory.text.stringByReplacingOccurrencesOfString("<number>", withString: theNumber.text!)
}
override func viewDidLoad() {
super.viewDidLoad()
//thePlace.resignFirstResponder()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| 0debug
|
(Foundation) Change columns ordering in desktop view : can anyone tell me how to re-order foundation grid. So here's the code:
<div class="row">
<div class="small-12 large-12 large-push-12 columns">
Mobile top. Desktop bottom.
</div>
<div class="small-12 large-12 large-pull-12 columns">
Mobile bottom. Desktop top.
</div>
</div>
So, the problem is, in desktop layout, the large-push-12 and large-pull-12 aren't working and the grid isn't re-ordered. is there anything that i'm missing?
| 0debug
|
In "Boys dance, girls dance, he dances, she dances" how to find the number of "dance" only and not "dances" (python)?)" : <p>In line,</p>
<pre><code>Boys dance, girls dance, he dances, she dances
</code></pre>
<p>how to count the number of times <code>dance</code> occurs without counting the number of times <code>dances</code> occurs (using a Python program)?</p>
<p>A method is</p>
<pre><code>>>> var = "Boys dance, girls dance, he dances, she dances"
>>> count1 = var.count("dance")
>>> count2 = var.count("dances")
>>> count = count1 - count2
>>> count
2
>>>
</code></pre>
<p>But it is too lengthy.</p>
<p>Is any one line method available? </p>
| 0debug
|
Facebook API Error: "User does not have sufficient administrative permission for this action on this page." : <p>I'm using a Facebook app (in development mode) to generate a page access token so that my personal web app can schedule/edit/delete posts on a Facebook fan page.</p>
<p>I'm using the Graph Explorer to generate the token while logged in as the <strong>admin</strong> of the fan page. </p>
<p>When I use that token, I'm able to GET a list of the scheduled posts, but whenever I try to edit or delete a post, I get this error: </p>
<p><em>"User does not have sufficient administrative permission for this action on this page."</em></p>
<p>Here is the debug of the token: </p>
<p><a href="https://i.stack.imgur.com/VdX8T.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/VdX8T.jpg" alt="enter image description here"></a></p>
<p>Any ideas on how to fix this? </p>
| 0debug
|
static inline void xchg_mb_border(H264Context *h, uint8_t *src_y,
uint8_t *src_cb, uint8_t *src_cr,
int linesize, int uvlinesize,
int xchg, int simple, int pixel_shift){
MpegEncContext * const s = &h->s;
int deblock_left;
int deblock_top;
int top_idx = 1;
uint8_t *top_border_m1;
uint8_t *top_border;
if(!simple && FRAME_MBAFF){
if(s->mb_y&1){
if(!MB_MBAFF)
return;
}else{
top_idx = MB_MBAFF ? 0 : 1;
}
}
if(h->deblocking_filter == 2) {
deblock_left = h->left_type[0];
deblock_top = h->top_type;
} else {
deblock_left = (s->mb_x > 0);
deblock_top = (s->mb_y > !!MB_FIELD);
}
src_y -= linesize + 1 + pixel_shift;
src_cb -= uvlinesize + 1 + pixel_shift;
src_cr -= uvlinesize + 1 + pixel_shift;
top_border_m1 = h->top_borders[top_idx][s->mb_x-1];
top_border = h->top_borders[top_idx][s->mb_x];
#define XCHG(a,b,xchg)\
if (pixel_shift) {\
if (xchg) {\
AV_SWAP64(b+0,a+0);\
AV_SWAP64(b+8,a+8);\
} else {\
AV_COPY128(b,a); \
}\
} else \
if (xchg) AV_SWAP64(b,a);\
else AV_COPY64(b,a);
if(deblock_top){
if(deblock_left){
XCHG(top_border_m1 + (8 << pixel_shift), src_y - (7 << pixel_shift), 1);
}
XCHG(top_border + (0 << pixel_shift), src_y + (1 << pixel_shift), xchg);
XCHG(top_border + (8 << pixel_shift), src_y + (9 << pixel_shift), 1);
if(s->mb_x+1 < s->mb_width){
XCHG(h->top_borders[top_idx][s->mb_x+1], src_y + (17 << pixel_shift), 1);
}
}
if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
if(deblock_top){
if(deblock_left){
XCHG(top_border_m1 + (16 << pixel_shift), src_cb - (7 << pixel_shift), 1);
XCHG(top_border_m1 + (24 << pixel_shift), src_cr - (7 << pixel_shift), 1);
}
XCHG(top_border + (16 << pixel_shift), src_cb+1+pixel_shift, 1);
XCHG(top_border + (24 << pixel_shift), src_cr+1+pixel_shift, 1);
}
}
}
| 1threat
|
What is the best way to call into Swift from C? : <p>Calling into C from Swift is pretty simple, however I'm looking into making a bi-directional wrapper in C, so my C has to call Swift functions.</p>
<p>Right now, I can do this by declaring function pointers in C, and having my C functions call them after the Swift side has set them up to call code in Swift.</p>
<p>My C header file:</p>
<pre><code>typedef void (*callback_t)(void);
void callBackIntoSwift( callback_t cb );
</code></pre>
<p>My C implementation file:</p>
<pre><code>#include "stuff.h"
#include <stdio.h>
void callBackIntoSwift( callback_t cb )
{
printf( "Will call back into Swift\n" );
cb();
printf( "Did call back into Swift\n" );
}
</code></pre>
<p>After including my C header file in the bridging header, I can do the following on the Swift side:</p>
<pre><code>let cb: callback_t = {
someKindOfSwiftFunction()
}
callBackIntoSwift( cb )
</code></pre>
<p>Or even:</p>
<pre><code>callBackIntoSwift {
someKindOfSwiftFunction()
}
</code></pre>
<p>Is there a better way to do this, where function pointers and callbacks are not needed? I'd like to let the C-side call <code>someKindOfSwiftFunction</code> directly … but when I try to apply <code>@convention (c)</code> to function declarations I get the message that the attribute can only be applied to types, and not declarations.</p>
<p>Any ideas or codebases in e.g. Github I can take a look at?</p>
| 0debug
|
static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
{
AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0];
ShowWavesContext *showwaves = ctx->priv;
const int nb_samples = insamples->audio->nb_samples;
AVFilterBufferRef *outpicref = showwaves->outpicref;
int linesize = outpicref ? outpicref->linesize[0] : 0;
int16_t *p = (int16_t *)insamples->data[0];
int nb_channels = av_get_channel_layout_nb_channels(insamples->audio->channel_layout);
int i, j, h;
const int n = showwaves->n;
const int x = 255 / (nb_channels * n);
for (i = 0; i < nb_samples; i++) {
if (showwaves->buf_idx == 0 && showwaves->sample_count_mod == 0) {
showwaves->outpicref = outpicref =
ff_get_video_buffer(outlink, AV_PERM_WRITE|AV_PERM_ALIGN,
outlink->w, outlink->h);
outpicref->video->w = outlink->w;
outpicref->video->h = outlink->h;
outpicref->pts = insamples->pts +
av_rescale_q((p - (int16_t *)insamples->data[0]) / nb_channels,
(AVRational){ 1, inlink->sample_rate },
outlink->time_base);
outlink->out_buf = outpicref;
linesize = outpicref->linesize[0];
memset(outpicref->data[0], 0, showwaves->h*linesize);
}
for (j = 0; j < nb_channels; j++) {
h = showwaves->h/2 - av_rescale(*p++, showwaves->h/2, MAX_INT16);
if (h >= 0 && h < outlink->h)
*(outpicref->data[0] + showwaves->buf_idx + h * linesize) += x;
}
showwaves->sample_count_mod++;
if (showwaves->sample_count_mod == n) {
showwaves->sample_count_mod = 0;
showwaves->buf_idx++;
}
if (showwaves->buf_idx == showwaves->w)
push_frame(outlink);
}
avfilter_unref_buffer(insamples);
return 0;
}
| 1threat
|
static void open_help(void)
{
printf(
"\n"
" opens a new file in the requested mode\n"
"\n"
" Example:\n"
" 'open -Cn /tmp/data' - creates/opens data file read-write and uncached\n"
"\n"
" Opens a file for subsequent use by all of the other qemu-io commands.\n"
" -r, -- open file read-only\n"
" -s, -- use snapshot file\n"
" -n, -- disable host cache\n"
" -o, -- options to be given to the block driver"
"\n");
}
| 1threat
|
static QObject *parse_literal(JSONParserContext *ctxt)
{
QObject *token, *obj;
JSONParserContext saved_ctxt = parser_context_save(ctxt);
token = parser_context_pop_token(ctxt);
if (token == NULL) {
goto out;
}
switch (token_get_type(token)) {
case JSON_STRING:
obj = QOBJECT(qstring_from_escaped_str(ctxt, token));
break;
case JSON_INTEGER:
obj = QOBJECT(qint_from_int(strtoll(token_get_value(token), NULL, 10)));
break;
case JSON_FLOAT:
obj = QOBJECT(qfloat_from_double(strtod(token_get_value(token), NULL)));
break;
default:
goto out;
}
return obj;
out:
parser_context_restore(ctxt, saved_ctxt);
return NULL;
}
| 1threat
|
Css hover not working with jquery : Hello ladies and gentlemen this social media footer downloaded from codepen working perfect on its own.When applied on jquery page hover effect is not workign at all.
Bellow you can viw my code,I wish to make hover property of social buttons to become visible again. !important; property found in other posts here also not working Please let me know a solution that could help tha case...
thank you again in advance
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
.social {
display: inline-block;
width: 70px;
height: 70px;
margin: 0 10px;
line-height: 70px;
font-family: Entypo;
font-size: 35px;
text-align: center;
color: #999;
border-radius: 50%;
background: #eee;
overflow: hidden;
transition: color .3s;}
.social:hover {
color: #000 !important;
cursor:pointer;
}
.social {
box-shadow: rgb(210, 210, 210) 1px 1px,
rgb(210, 210, 210) 2px 2px,
rgb(211, 211, 211) 3px 3px,
rgb(211, 211, 211) 4px 4px,
rgb(211, 211, 211) 5px 5px,
rgb(212, 212, 212) 6px 6px,
rgb(212, 212, 212) 7px 7px,
rgb(212, 212, 212) 8px 8px,
rgb(213, 213, 213) 9px 9px,
rgb(213, 213, 213) 10px 10px,
rgb(214, 214, 214) 11px 11px,
rgb(214, 214, 214) 12px 12px,
rgb(214, 214, 214) 13px 13px,
rgb(215, 215, 215) 14px 14px,
rgb(215, 215, 215) 15px 15px,
rgb(215, 215, 215) 16px 16px,
rgb(216, 216, 216) 17px 17px,
rgb(216, 216, 216) 18px 18px,
rgb(216, 216, 216) 19px 19px,
rgb(217, 217, 217) 20px 20px,
rgb(217, 217, 217) 21px 21px,
rgb(218, 218, 218) 22px 22px,
rgb(218, 218, 218) 23px 23px,
rgb(218, 218, 218) 24px 24px,
rgb(219, 219, 219) 25px 25px,
rgb(219, 219, 219) 26px 26px,
rgb(219, 219, 219) 27px 27px,
rgb(220, 220, 220) 28px 28px,
rgb(220, 220, 220) 29px 29px,
rgb(221, 221, 221) 30px 30px;
text-shadow: rgb(226, 226, 226) 1px 1px,
rgb(227, 227, 227) 2px 2px,
rgb(227, 227, 227) 3px 3px,
rgb(228, 228, 228) 4px 4px,
rgb(229, 229, 229) 5px 5px,
rgb(229, 229, 229) 6px 6px,
rgb(230, 230, 230) 7px 7px,
rgb(230, 230, 230) 8px 8px,
rgb(231, 231, 231) 9px 9px,
rgb(232, 232, 232) 10px 10px,
rgb(232, 232, 232) 11px 11px,
rgb(233, 233, 233) 12px 12px,
rgb(233, 233, 233) 13px 13px,
rgb(234, 234, 234) 14px 14px,
rgb(235, 235, 235) 15px 15px,
rgb(235, 235, 235) 16px 16px,
rgb(236, 236, 236) 17px 17px,
rgb(236, 236, 236) 18px 18px,
rgb(237, 237, 237) 19px 19px,
rgb(238, 238, 238) 20px 20px;
}
<!-- language: lang-html -->
<div class="footer">
<div class="social"></div>
<div class="social"></div>
<div class="social">🎬</div>
<div class="social">📷</div>
</div>
<!-- end snippet -->
| 0debug
|
java: Reading in multiple integers from the scanner and assigning each integer to a different variable? : I have to read in integers and the scanner has to continue to scan them in until 0 is entered. Then all of those numbers have to be saved to different variables. Then the variables have to be compared and the following has to occur:
-Find the smallest integer
-Find how many integers are even
-Find the sum of the negative integers
I have this so far:
public static void main (String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Enter integers");
do
{
}
while (in.nextInt() !=0);
}
I am lost on what to do next.
| 0debug
|
static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length)
{
int x, y;
const int width = f->avctx->width;
const int height = f->avctx->height;
uint16_t *src = (uint16_t *)f->last_picture.data[0];
uint16_t *dst = (uint16_t *)f->current_picture.data[0];
const int stride = f->current_picture.linesize[0] >> 1;
unsigned int bitstream_size, bytestream_size, wordstream_size, extra,
bytestream_offset, wordstream_offset;
if (f->version > 1) {
extra = 20;
if (length < extra)
return -1;
bitstream_size = AV_RL32(buf + 8);
wordstream_size = AV_RL32(buf + 12);
bytestream_size = AV_RL32(buf + 16);
} else {
extra = 0;
bitstream_size = AV_RL16(buf - 4);
wordstream_size = AV_RL16(buf - 2);
bytestream_size = FFMAX(length - bitstream_size - wordstream_size, 0);
}
if (bitstream_size > length ||
bytestream_size > length - bitstream_size ||
wordstream_size > length - bytestream_size - bitstream_size ||
extra > length - bytestream_size - bitstream_size - wordstream_size) {
av_log(f->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n", bitstream_size, bytestream_size, wordstream_size,
bitstream_size+ bytestream_size+ wordstream_size - length);
return -1;
}
av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size,
bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!f->bitstream_buffer)
return AVERROR(ENOMEM);
f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)(buf + extra),
bitstream_size / 4);
memset((uint8_t*)f->bitstream_buffer + bitstream_size,
0, FF_INPUT_BUFFER_PADDING_SIZE);
init_get_bits(&f->gb, f->bitstream_buffer, 8 * bitstream_size);
wordstream_offset = extra + bitstream_size;
bytestream_offset = extra + bitstream_size + wordstream_size;
bytestream2_init(&f->g2, buf + wordstream_offset,
length - wordstream_offset);
bytestream2_init(&f->g, buf + bytestream_offset,
length - bytestream_offset);
init_mv(f);
for (y = 0; y < height; y += 8) {
for (x = 0; x < width; x += 8)
decode_p_block(f, dst + x, src + x, 3, 3, stride);
src += 8 * stride;
dst += 8 * stride;
}
return 0;
}
| 1threat
|
static void openpic_msi_write(void *opaque, hwaddr addr, uint64_t val,
unsigned size)
{
OpenPICState *opp = opaque;
int idx = opp->irq_msi;
int srs, ibs;
DPRINTF("%s: addr " TARGET_FMT_plx " <= %08x\n", __func__, addr, val);
if (addr & 0xF) {
return;
}
switch (addr) {
case MSIIR_OFFSET:
srs = val >> MSIIR_SRS_SHIFT;
idx += srs;
ibs = (val & MSIIR_IBS_MASK) >> MSIIR_IBS_SHIFT;
opp->msi[srs].msir |= 1 << ibs;
openpic_set_irq(opp, idx, 1);
break;
default:
break;
}
}
| 1threat
|
Is it possible to use a NoSQL for Identity Server 4? : <p>I'm trying to integrate a NoSql data store into Identity Server 4 such as Cosmos DB. I was wondering if someone out there has done something similar and/or if it's possible.</p>
| 0debug
|
Email Validation in Registrraion Form in javascript : <p>I have One Register-form for creating Account.In Email Field How Can i Check Enter Email is Real Email Id or Fake Email Id without Sent Any Email.And Also when User Leave The Field Validation will be start.Any idea please Share me....</p>
| 0debug
|
Django vs JS Frameworks : <p>How powerful are the frontend features of Django compared to heavy JS frameworks like React and Vue.js? If I plan to develop a bold web app with including a CRM module, and for an example with a Kanban Board, is that something achievable with Django alone or would I need another JS framework to back it up?</p>
| 0debug
|
why datepicker is lost after window.print : I have to print part of my page by `window.print()`.
Here is the code:
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
I know that copy innerHTML and pasting it after print command can cause lost of event listener. But it can be overcome by a `$('body').on` attachment. But as I am novice to jquery, I do not know how can I use this jquery on method in case of datepicker attachment. So, everytime I print part of my webpage using this type of javascript print method, datepicker is lost and it is not attaching in the desired input fields.
Please visit my site to check the situation:
[http://infomamun.xyz][1]
and click on the `#dob` or other input fields to see the workable datepicker. Then please press `Print` button and cancel or done the print job. After that you can see that there is no datepicker attached on click of `#dob` and other input fields of the table.
How to resolve this issue?
[NB: please don't recommend css print system, I have to use this method. Also, please don't downvote my Question. I am very novice to jquery]
[1]: http://infomamun.xyz
| 0debug
|
Is 'return' necessary in the last line of JS function? : <p>what's the best practice of finishing the JS function if it doesn't return anything?</p>
<pre><code>function (a) {if (a) {setTimeout()} return;}
</code></pre>
<p>In this case 'return' is unnecessary but I leave it for readability purposes. I also tried to google if this is a way to micro-optimize JS but wasn't able to find anything.</p>
| 0debug
|
static void setup_frame(int sig, struct target_sigaction *ka,
target_sigset_t *set, CPUAlphaState *env)
{
abi_ulong frame_addr, r26;
struct target_sigframe *frame;
int err = 0;
frame_addr = get_sigframe(ka, env, sizeof(*frame));
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) {
goto give_sigsegv;
}
err |= setup_sigcontext(&frame->sc, env, frame_addr, set);
if (ka->sa_restorer) {
r26 = ka->sa_restorer;
} else {
__put_user(INSN_MOV_R30_R16, &frame->retcode[0]);
__put_user(INSN_LDI_R0 + TARGET_NR_sigreturn,
&frame->retcode[1]);
__put_user(INSN_CALLSYS, &frame->retcode[2]);
r26 = frame_addr;
}
unlock_user_struct(frame, frame_addr, 1);
if (err) {
give_sigsegv:
if (sig == TARGET_SIGSEGV) {
ka->_sa_handler = TARGET_SIG_DFL;
}
force_sig(TARGET_SIGSEGV);
}
env->ir[IR_RA] = r26;
env->ir[IR_PV] = env->pc = ka->_sa_handler;
env->ir[IR_A0] = sig;
env->ir[IR_A1] = 0;
env->ir[IR_A2] = frame_addr + offsetof(struct target_sigframe, sc);
env->ir[IR_SP] = frame_addr;
}
| 1threat
|
I am developing the website in wordpress and i wants to change the active state in main menu of my website.But i am stuck : i am using HTML5 Blank custom post.
Below is the wordpress code for menu. wp_nav_menu(array('theme_location'=>'primary','container_class'=>'Top Nav' ,'container_id'=> 'bs-example-navbar-collapse-1','menu_class'=> 'nav navbar-nav text-uppercase nav-menu'))
i am not getting where to add css properties to make changes in menu.
I just simply wants to change active state of menu links. like when someone visit about us page.The about us link text remains white.
| 0debug
|
ImportError: No module named rest_framework_jwt.views : <p>I am using ubuntu anb Django(python 2.7.12)</p>
<p>I am trying to run python manage.py migrate but an error shows up</p>
<pre><code>from rest_framework_jwt.views import obtain_jwt_token
ImportError: No module named rest_framework_jwt.views
</code></pre>
<p>I have alread install rest like this:</p>
<pre><code>pip install djangorestframework
</code></pre>
<p>Any idea about the error?</p>
| 0debug
|
static int tta_read_header(AVFormatContext *s)
{
TTAContext *c = s->priv_data;
AVStream *st;
int i, channels, bps, samplerate;
uint64_t framepos, start_offset;
uint32_t datalen;
if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX))
ff_id3v1_read(s);
start_offset = avio_tell(s->pb);
if (avio_rl32(s->pb) != AV_RL32("TTA1"))
return -1;
avio_skip(s->pb, 2);
channels = avio_rl16(s->pb);
bps = avio_rl16(s->pb);
samplerate = avio_rl32(s->pb);
if(samplerate <= 0 || samplerate > 1000000){
av_log(s, AV_LOG_ERROR, "nonsense samplerate\n");
return -1;
}
datalen = avio_rl32(s->pb);
if (!datalen) {
av_log(s, AV_LOG_ERROR, "invalid datalen\n");
return AVERROR_INVALIDDATA;
}
avio_skip(s->pb, 4);
c->frame_size = samplerate * 256 / 245;
c->last_frame_size = datalen % c->frame_size;
if (!c->last_frame_size)
c->last_frame_size = c->frame_size;
c->totalframes = datalen / c->frame_size + (c->last_frame_size < c->frame_size);
c->currentframe = 0;
if(c->totalframes >= UINT_MAX/sizeof(uint32_t) || c->totalframes <= 0){
av_log(s, AV_LOG_ERROR, "totalframes %d invalid\n", c->totalframes);
return -1;
}
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
avpriv_set_pts_info(st, 64, 1, samplerate);
st->start_time = 0;
st->duration = datalen;
framepos = avio_tell(s->pb) + 4*c->totalframes + 4;
for (i = 0; i < c->totalframes; i++) {
uint32_t size = avio_rl32(s->pb);
av_add_index_entry(st, framepos, i * c->frame_size, size, 0,
AVINDEX_KEYFRAME);
framepos += size;
}
avio_skip(s->pb, 4);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = AV_CODEC_ID_TTA;
st->codec->channels = channels;
st->codec->sample_rate = samplerate;
st->codec->bits_per_coded_sample = bps;
st->codec->extradata_size = avio_tell(s->pb) - start_offset;
if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){
av_log(s, AV_LOG_ERROR, "extradata_size too large\n");
return -1;
}
st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata) {
st->codec->extradata_size = 0;
return AVERROR(ENOMEM);
}
avio_seek(s->pb, start_offset, SEEK_SET);
avio_read(s->pb, st->codec->extradata, st->codec->extradata_size);
return 0;
}
| 1threat
|
static void usbredir_device_disconnect(void *priv)
{
USBRedirDevice *dev = priv;
int i;
qemu_del_timer(dev->attach_timer);
if (dev->dev.attached) {
usb_device_detach(&dev->dev);
dev->next_attach_time = qemu_get_clock_ms(vm_clock) + 200;
}
usbredir_cleanup_device_queues(dev);
memset(dev->endpoint, 0, sizeof(dev->endpoint));
for (i = 0; i < MAX_ENDPOINTS; i++) {
QTAILQ_INIT(&dev->endpoint[i].bufpq);
}
usb_ep_init(&dev->dev);
dev->interface_info.interface_count = 0;
}
| 1threat
|
To get results in edittext in Android studio : I wanna know is there any chance to get our result in an edittext not in textview without using any button.. That is when we place cursor on the edittext field, the result we wanna print should be in the field. Is there anyone who could help vth this.?
| 0debug
|
TestFlight: Complete test information is required to submit a build for external testing : <p>My app is in internal testing on iTunes Connect, but I cannot promote it to external testing. It tells me that the test information is incomplete. </p>
<p>I have tried all sorts of things, including reading <a href="https://help.apple.com/itunes-connect/developer/#/deva50a6ab41" rel="noreferrer">this doc</a> and <a href="https://help.apple.com/itunes-connect/developer/#/devdc42b26b8" rel="noreferrer">this doc</a> on Apple and re-entering all the information again. Playing with the <a href="https://webcache.googleusercontent.com/search?q=cache:kbEIQaCpGS0J:https://forums.developer.apple.com/thread/22799%20&cd=3&hl=en&ct=clnk&gl=ca" rel="noreferrer">language specifier</a>. </p>
<p>This is maddening, because this exact information worked for a previous build.</p>
<p><a href="https://i.stack.imgur.com/IuQxf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/IuQxf.png" alt="enter image description here"></a></p>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.