problem
stringlengths
26
131k
labels
class label
2 classes
Unable to display datetime correctly in iOS/Safari using ionic2/angular2 : <p>Hi im facing a weird issue here im getting dynamic data in that im also getting the date and time and im displaying it in html using date pipe in chrome/android it is working good but when i check ios/Safari it is showing time difference</p> <p>below is my json data im consuming </p> <pre><code>FromCurrentDate: "2018-01-05T00:00:00" FromPreviousDate: "2018-01-04T00:00:00" ToCurrentDate: "2018-01-05T14:00:53.137" ToPreviousDate: "2018-01-04T14:00:53.137" </code></pre> <p>im displaying the date like this and in chrome/android it is displaying like this<a href="https://i.stack.imgur.com/IuU7K.png" rel="noreferrer"><img src="https://i.stack.imgur.com/IuU7K.png" alt=""></a></p> <p><a href="https://i.stack.imgur.com/aEyby.png" rel="noreferrer"><img src="https://i.stack.imgur.com/aEyby.png" alt=""></a></p> <p>in Ios/safari it is displaying like this in the template im using the code below</p> <pre><code>Currrent {{singleTable[0].FromCurrentDate|date: 'dd/MM/yyyy,h:mm:ss a'}} to {{singleTable[0].ToCurrentDate|date: 'dd/MM/yyyy,h:mm:ss a'}} </code></pre> <p>how can i solve this time difference issue?</p>
0debug
OkHTTPClient Proxy authentication how to? : <p><strong>Question:</strong> How do I add a authorization proxy to OkHTTP.</p> <p>I know that OkHTTP's builder <a href="http://square.github.io/okhttp/3.x/okhttp/" rel="noreferrer">does support proxies</a> although I am having a hard time setting one up.</p> <pre><code>/** * Given a Url and a base64 encoded password return the contents of a website. * @param urlString * @param password * @return JSON */ public String getURLJson(String urlString, String password) { OkHttpClient client = new OkHttpClient.Builder() .connectTimeout(60, TimeUnit.SECONDS) .writeTimeout(60, TimeUnit.SECONDS) .readTimeout(60, TimeUnit.SECONDS) .build(); Request request = new Request.Builder() .url(urlString) .get() .addHeader("authorization", "Basic " + password) .addHeader("cache-control", "no-cache") .build(); Response response = null; try { response = client.newCall(request).execute(); String string = response.body().string(); response.body().close(); return string; } catch (IOException e) { System.err.println("Failed scraping"); e.printStackTrace(); } return "failed"; } </code></pre> <p>I have the IP / port / username / password. </p> <p>Although I do not know how to turn those into a <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/Proxy.html" rel="noreferrer"><code>Proxy proxy</code></a> which can then be used in client.SetProxy().</p> <p>It seems overly complicated and I simply can't seem to figure it out. Any help would be appreciated.</p>
0debug
How do I get what the Friday date is, looking out 2 weeks from the present date : I really need your help with this, What I would like to accomplish is being able to return the date value of what the Friday date will be, with a 2-week time span between the present date and the Friday. var present_date = Thursday, November 23, 2017 var result_date = Friday, December 8, 2017
0debug
Pygame.Surface driving me crazy : <p>I can get all my images to come up if I only do image.load('').convert_alpha(). When i try getting alittle more control, Surface just kills me, I dont know what to do any more. I need help, please!!</p> <pre><code>import pygame, sys pygame.init() white = ((250,250,250)) black = ((0,0,0)) w = 800 h = 600 moveX = 0 moveY = 0 screen = pygame.display.set_mode((w,h)) pygame.display.set_caption('Paws') background = pygame.image.load('C:/PythonImg/10121.jpg').convert() clock = pygame.time.Clock() Phil = pygame.image.load('C:/PythonImg/Phil_blob.png').convert_alpha() Philpos = pygame.rect.Rect(0, 0, 400,300) def Phil((Philpos), Phil): screen.blit(Phil, (Philpos)) while pygame.display.get_init(): pygame.event.pump() for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.display.get_init() == False if event.type == pygame.KEYDOWN: if event.key == pygame.K_LEFT: moveX = -10 elif event.key == pygame.K_RIGHT: moveX = 10 elif event.key == pygame.K_UP: moveY = -10 elif event.key == pygame.K_DOWN: moveY = 10 if event.type == pygame.KEYUP: moveX = 0 moveY = 0 Philpos.move_ip(moveX, moveY) Philpos.clamp_ip(screen.get_rect()) screen.fill(black) screen.blit(background, (0,0)) Phil(Philpos, Phil) pygame.display.update() clock.tick(30) pygame.QUIT() quit() </code></pre> <p>Hears my latest error</p> <pre><code>Traceback (most recent call last): File "C:\Python27\Paws.py", line 57, in &lt;module&gt; Phil(Philpos, Phil) File "C:\Python27\Paws.py", line 28, in Phil screen.blit(Phil, (Philpos)) TypeError: argument 1 must be pygame.Surface, not function </code></pre>
0debug
Does SQL server execute a with statement if it is not used? : I'm trying to debug a query that is performing slowly. It has several `with` statements which are `left joined`. When I remove the joins, it speeds up considerably. Is it safe to assume there is an issue with the joins, or does it skip the `with` if the `with` variables are never called?
0debug
Charset on Linux server with Git : <p>We have some trouble with special signs in our (javascript) application like €.</p> <p>The files looks correct when we open they on our development pc's but when pulled on our production server the sign is showing up like <code>€</code>. In the browser but also in the file itselfs.</p> <p>I guess it is something with the charset or locale setting on the server, but when executing <code>locale</code> I see that it's set to UTF-8 already.</p> <pre><code>LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.utf-8" LC_NUMERIC="en_US.utf-8" LC_TIME="en_US.utf-8" LC_COLLATE="en_US.utf-8" LC_MONETARY="en_US.utf-8" LC_MESSAGES="en_US.utf-8" LC_PAPER="en_US.utf-8" LC_NAME="en_US.utf-8" LC_ADDRESS="en_US.utf-8" LC_TELEPHONE="en_US.utf-8" LC_MEASUREMENT="en_US.utf-8" LC_IDENTIFICATION="en_US.utf-8" LC_ALL=en_US.utf-8 </code></pre> <p>What can be the issue here? </p>
0debug
:after going over my text with background : <p>I am doing a menu for a restaurant, they want to have an orange line on the last line of the menu that leads to the price. Everything is done only the orange line gets OVER by text that has a background.</p> <p>Here's the link:</p> <p><a href="http://abbababba.gosuuftw.com" rel="nofollow">http://abbababba.gosuuftw.com</a></p> <p>Thank you!</p>
0debug
CharDriverState *qemu_chr_alloc(ChardevCommon *backend, Error **errp) { CharDriverState *chr = g_malloc0(sizeof(CharDriverState)); qemu_mutex_init(&chr->chr_write_lock); chr->mux_idx = -1; if (backend->has_logfile) { int flags = O_WRONLY | O_CREAT; if (backend->has_logappend && backend->logappend) { flags |= O_APPEND; } else { flags |= O_TRUNC; } chr->logfd = qemu_open(backend->logfile, flags, 0666); if (chr->logfd < 0) { error_setg_errno(errp, errno, "Unable to open logfile %s", backend->logfile); g_free(chr); return NULL; } } else { chr->logfd = -1; } return chr; }
1threat
Resizing containers in bootstrap : I am new to bootstrap and i would like to find out how do i automatically resize my image to fit it into the container. And i would like to have a blank background for my container. Currently it is like this <div class="row"> <div class="col-md-3"> <div class="panel panel-primary"> <div class="panel-heading"> <div class="row"> <img src ="haha.png"/> </div> </div> </div> </div> [![enter image description here][1]][1] I plugged the whole code from some template form and i was playing around with it. I would like to have a container where i could fit the image inside automatically resizing the image. [1]: http://i.stack.imgur.com/s16WB.png
0debug
static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_t pos) { VideoPicture *vp; double frame_delay, pts = pts1; if (pts != 0) { is->video_clock = pts; } else { pts = is->video_clock; frame_delay = av_q2d(is->video_st->codec->time_base); frame_delay += src_frame->repeat_pict * (frame_delay * 0.5); is->video_clock += frame_delay; #if defined(DEBUG_SYNC) && 0 printf("frame_type=%c clock=%0.3f pts=%0.3f\n", av_get_picture_type_char(src_frame->pict_type), pts, pts1); #endif SDL_LockMutex(is->pictq_mutex); if(is->pictq_size>=VIDEO_PICTURE_QUEUE_SIZE && !is->refresh) is->skip_frames= FFMAX(1.0 - FRAME_SKIP_FACTOR, is->skip_frames * (1.0-FRAME_SKIP_FACTOR)); while (is->pictq_size >= VIDEO_PICTURE_QUEUE_SIZE && !is->videoq.abort_request) { SDL_UnlockMutex(is->pictq_mutex); if (is->videoq.abort_request) return -1; vp = &is->pictq[is->pictq_windex]; vp->duration = frame_delay; if (!vp->bmp || #if CONFIG_AVFILTER vp->width != is->out_video_filter->inputs[0]->w || vp->height != is->out_video_filter->inputs[0]->h) { #else vp->width != is->video_st->codec->width || vp->height != is->video_st->codec->height) { #endif SDL_Event event; vp->allocated = 0; event.type = FF_ALLOC_EVENT; event.user.data1 = is; SDL_PushEvent(&event); SDL_LockMutex(is->pictq_mutex); while (!vp->allocated && !is->videoq.abort_request) { SDL_UnlockMutex(is->pictq_mutex); if (is->videoq.abort_request) return -1; if (vp->bmp) { AVPicture pict; #if CONFIG_AVFILTER if(vp->picref) avfilter_unref_buffer(vp->picref); vp->picref = src_frame->opaque; #endif SDL_LockYUVOverlay (vp->bmp); memset(&pict,0,sizeof(AVPicture)); pict.data[0] = vp->bmp->pixels[0]; pict.data[1] = vp->bmp->pixels[2]; pict.data[2] = vp->bmp->pixels[1]; pict.linesize[0] = vp->bmp->pitches[0]; pict.linesize[1] = vp->bmp->pitches[2]; pict.linesize[2] = vp->bmp->pitches[1]; #if CONFIG_AVFILTER av_picture_copy(&pict, (AVPicture *)src_frame, vp->pix_fmt, vp->width, vp->height); #else sws_flags = av_get_int(sws_opts, "sws_flags", NULL); is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx, vp->width, vp->height, vp->pix_fmt, vp->width, vp->height, PIX_FMT_YUV420P, sws_flags, NULL, NULL, NULL); if (is->img_convert_ctx == NULL) { fprintf(stderr, "Cannot initialize the conversion context\n"); exit(1); sws_scale(is->img_convert_ctx, src_frame->data, src_frame->linesize, 0, vp->height, pict.data, pict.linesize); #endif SDL_UnlockYUVOverlay(vp->bmp); vp->pts = pts; vp->pos = pos; if (++is->pictq_windex == VIDEO_PICTURE_QUEUE_SIZE) is->pictq_windex = 0; SDL_LockMutex(is->pictq_mutex); vp->target_clock= compute_target_time(vp->pts, is); is->pictq_size++; SDL_UnlockMutex(is->pictq_mutex); return 0;
1threat
MKSCALE16(scale16be, AV_RB16, AV_WB16) MKSCALE16(scale16le, AV_RL16, AV_WL16) static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const AVPixFmtDescriptor *desc; RawVideoContext *context = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int linesize_align = 4; int stride; int res, len; int need_copy; AVFrame *frame = data; if (avctx->width <= 0) { av_log(avctx, AV_LOG_ERROR, "width is not set\n"); return AVERROR_INVALIDDATA; } if (avctx->height <= 0) { av_log(avctx, AV_LOG_ERROR, "height is not set\n"); return AVERROR_INVALIDDATA; } if (context->is_nut_mono) stride = avctx->width / 8 + (avctx->width & 7 ? 1 : 0); else if (context->is_nut_pal8) stride = avctx->width; else stride = avpkt->size / avctx->height; av_log(avctx, AV_LOG_DEBUG, "PACKET SIZE: %d, STRIDE: %d\n", avpkt->size, stride); if (stride == 0 || avpkt->size < stride * avctx->height) { av_log(avctx, AV_LOG_ERROR, "Packet too small (%d)\n", avpkt->size); return AVERROR_INVALIDDATA; } desc = av_pix_fmt_desc_get(avctx->pix_fmt); if ((avctx->bits_per_coded_sample == 8 || avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2 || avctx->bits_per_coded_sample == 1 || (avctx->bits_per_coded_sample == 0 && (context->is_nut_pal8 || context->is_mono)) ) && (context->is_mono || context->is_pal8) && (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' ') || context->is_nut_mono || context->is_nut_pal8)) { context->is_1_2_4_8_bpp = 1; if (context->is_mono) { int row_bytes = avctx->width / 8 + (avctx->width & 7 ? 1 : 0); context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(row_bytes, 16) * 8, avctx->height, 1); } else context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(avctx->width, 16), avctx->height, 1); } else { context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 && avctx->bits_per_coded_sample && avctx->bits_per_coded_sample < 16; context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1); } if (context->frame_size < 0) return context->frame_size; need_copy = !avpkt->buf || context->is_1_2_4_8_bpp || context->is_yuv2 || context->is_lt_16bpp; frame->pict_type = AV_PICTURE_TYPE_I; frame->key_frame = 1; res = ff_decode_frame_props(avctx, frame); if (res < 0) return res; av_frame_set_pkt_pos (frame, avctx->internal->pkt->pos); av_frame_set_pkt_duration(frame, avctx->internal->pkt->duration); if (context->tff >= 0) { frame->interlaced_frame = 1; frame->top_field_first = context->tff; } if ((res = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0) return res; if (need_copy) frame->buf[0] = av_buffer_alloc(FFMAX(context->frame_size, buf_size)); else frame->buf[0] = av_buffer_ref(avpkt->buf); if (!frame->buf[0]) return AVERROR(ENOMEM); if (context->is_1_2_4_8_bpp) { int i, j, row_pix = 0; uint8_t *dst = frame->buf[0]->data; buf_size = context->frame_size - (context->is_pal8 ? AVPALETTE_SIZE : 0); if (avctx->bits_per_coded_sample == 8 || context->is_nut_pal8 || context->is_mono) { int pix_per_byte = context->is_mono ? 8 : 1; for (i = 0, j = 0; j < buf_size && i<avpkt->size; i++, j++) { dst[j] = buf[i]; row_pix += pix_per_byte; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 16 - (j % 16) - 1; row_pix = 0; } } } else if (avctx->bits_per_coded_sample == 4) { for (i = 0, j = 0; 2 * j + 1 < buf_size && i<avpkt->size; i++, j++) { dst[2 * j + 0] = buf[i] >> 4; dst[2 * j + 1] = buf[i] & 15; row_pix += 2; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 8 - (j % 8) - 1; row_pix = 0; } } } else if (avctx->bits_per_coded_sample == 2) { for (i = 0, j = 0; 4 * j + 3 < buf_size && i<avpkt->size; i++, j++) { dst[4 * j + 0] = buf[i] >> 6; dst[4 * j + 1] = buf[i] >> 4 & 3; dst[4 * j + 2] = buf[i] >> 2 & 3; dst[4 * j + 3] = buf[i] & 3; row_pix += 4; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 4 - (j % 4) - 1; row_pix = 0; } } } else { av_assert0(avctx->bits_per_coded_sample == 1); for (i = 0, j = 0; 8 * j + 7 < buf_size && i<avpkt->size; i++, j++) { dst[8 * j + 0] = buf[i] >> 7; dst[8 * j + 1] = buf[i] >> 6 & 1; dst[8 * j + 2] = buf[i] >> 5 & 1; dst[8 * j + 3] = buf[i] >> 4 & 1; dst[8 * j + 4] = buf[i] >> 3 & 1; dst[8 * j + 5] = buf[i] >> 2 & 1; dst[8 * j + 6] = buf[i] >> 1 & 1; dst[8 * j + 7] = buf[i] & 1; row_pix += 8; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 2 - (j % 2) - 1; row_pix = 0; } } } linesize_align = 16; buf = dst; } else if (context->is_lt_16bpp) { uint8_t *dst = frame->buf[0]->data; int packed = (avctx->codec_tag & 0xFFFFFF) == MKTAG('B','I','T', 0); int swap = avctx->codec_tag >> 24; if (packed && swap) { av_fast_padded_malloc(&context->bitstream_buf, &context->bitstream_buf_size, buf_size); if (!context->bitstream_buf) return AVERROR(ENOMEM); if (swap == 16) context->bbdsp.bswap16_buf(context->bitstream_buf, (const uint16_t*)buf, buf_size / 2); else if (swap == 32) context->bbdsp.bswap_buf(context->bitstream_buf, (const uint32_t*)buf, buf_size / 4); else return AVERROR_INVALIDDATA; buf = context->bitstream_buf; } if (desc->flags & AV_PIX_FMT_FLAG_BE) scale16be(avctx, dst, buf, buf_size, packed); else scale16le(avctx, dst, buf, buf_size, packed); buf = dst; } else if (need_copy) { memcpy(frame->buf[0]->data, buf, buf_size); buf = frame->buf[0]->data; } if (avctx->codec_tag == MKTAG('A', 'V', '1', 'x') || avctx->codec_tag == MKTAG('A', 'V', 'u', 'p')) buf += buf_size - context->frame_size; len = context->frame_size - (avctx->pix_fmt==AV_PIX_FMT_PAL8 ? AVPALETTE_SIZE : 0); if (buf_size < len && ((avctx->codec_tag & 0xFFFFFF) != MKTAG('B','I','T', 0) || !need_copy)) { av_log(avctx, AV_LOG_ERROR, "Invalid buffer size, packet size %d < expected frame_size %d\n", buf_size, len); av_buffer_unref(&frame->buf[0]); return AVERROR(EINVAL); } if ((res = av_image_fill_arrays(frame->data, frame->linesize, buf, avctx->pix_fmt, avctx->width, avctx->height, 1)) < 0) { av_buffer_unref(&frame->buf[0]); return res; } if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); int ret; if (!context->palette) context->palette = av_buffer_alloc(AVPALETTE_SIZE); if (!context->palette) { av_buffer_unref(&frame->buf[0]); return AVERROR(ENOMEM); } ret = av_buffer_make_writable(&context->palette); if (ret < 0) { av_buffer_unref(&frame->buf[0]); return ret; } if (pal) { memcpy(context->palette->data, pal, AVPALETTE_SIZE); frame->palette_has_changed = 1; } else if (context->is_nut_pal8) { int vid_size = avctx->width * avctx->height; int pal_size = avpkt->size - vid_size; if (avpkt->size > vid_size && pal_size <= AVPALETTE_SIZE) { pal = avpkt->data + vid_size; memcpy(context->palette->data, pal, pal_size); frame->palette_has_changed = 1; } } } if ((avctx->pix_fmt==AV_PIX_FMT_RGB24 || avctx->pix_fmt==AV_PIX_FMT_BGR24 || avctx->pix_fmt==AV_PIX_FMT_GRAY8 || avctx->pix_fmt==AV_PIX_FMT_RGB555LE || avctx->pix_fmt==AV_PIX_FMT_RGB555BE || avctx->pix_fmt==AV_PIX_FMT_RGB565LE || avctx->pix_fmt==AV_PIX_FMT_MONOWHITE || avctx->pix_fmt==AV_PIX_FMT_MONOBLACK || avctx->pix_fmt==AV_PIX_FMT_PAL8) && FFALIGN(frame->linesize[0], linesize_align) * avctx->height <= buf_size) frame->linesize[0] = FFALIGN(frame->linesize[0], linesize_align); if (avctx->pix_fmt == AV_PIX_FMT_NV12 && avctx->codec_tag == MKTAG('N', 'V', '1', '2') && FFALIGN(frame->linesize[0], linesize_align) * avctx->height + FFALIGN(frame->linesize[1], linesize_align) * ((avctx->height + 1) / 2) <= buf_size) { int la0 = FFALIGN(frame->linesize[0], linesize_align); frame->data[1] += (la0 - frame->linesize[0]) * avctx->height; frame->linesize[0] = la0; frame->linesize[1] = FFALIGN(frame->linesize[1], linesize_align); } if ((avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) || (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)) { frame->buf[1] = av_buffer_ref(context->palette); if (!frame->buf[1]) { av_buffer_unref(&frame->buf[0]); return AVERROR(ENOMEM); } frame->data[1] = frame->buf[1]->data; } if (avctx->pix_fmt == AV_PIX_FMT_BGR24 && ((frame->linesize[0] + 3) & ~3) * avctx->height <= buf_size) frame->linesize[0] = (frame->linesize[0] + 3) & ~3; if (context->flip) flip(avctx, frame); if (avctx->codec_tag == MKTAG('Y', 'V', '1', '2') || avctx->codec_tag == MKTAG('Y', 'V', '1', '6') || avctx->codec_tag == MKTAG('Y', 'V', '2', '4') || avctx->codec_tag == MKTAG('Y', 'V', 'U', '9')) FFSWAP(uint8_t *, frame->data[1], frame->data[2]); if (avctx->codec_tag == AV_RL32("I420") && (avctx->width+1)*(avctx->height+1) * 3/2 == buf_size) { frame->data[1] = frame->data[1] + (avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height; frame->data[2] = frame->data[2] + ((avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height)*5/4; } if (avctx->codec_tag == AV_RL32("yuv2") && avctx->pix_fmt == AV_PIX_FMT_YUYV422) { int x, y; uint8_t *line = frame->data[0]; for (y = 0; y < avctx->height; y++) { for (x = 0; x < avctx->width; x++) line[2 * x + 1] ^= 0x80; line += frame->linesize[0]; } } if (avctx->codec_tag == AV_RL32("b64a") && avctx->pix_fmt == AV_PIX_FMT_RGBA64BE) { uint8_t *dst = frame->data[0]; uint64_t v; int x; for (x = 0; x >> 3 < avctx->width * avctx->height; x += 8) { v = AV_RB64(&dst[x]); AV_WB64(&dst[x], v << 16 | v >> 48); } } if (avctx->field_order > AV_FIELD_PROGRESSIVE) { frame->interlaced_frame = 1; if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB) frame->top_field_first = 1; } *got_frame = 1; return buf_size; }
1threat
Truncate table not working with SQL server sqlalchemy engine and pandas : <p>I can successfully query and insert data using sqlalchemy and pandas:</p> <pre><code>from sqlalchemy import create_engine import pandas as pd engine = create_engine('mssql://myserver/mydb?driver=SQL+Server+Native+Client+11.0?trusted_connection=yes') </code></pre> <p>Read tempy table:</p> <pre><code>sql_command = """ select top 100 * from tempy """ df = pd.read_sql(sql_command, engine) print df tempID tempValue 0 1 2 </code></pre> <p>Append new data:</p> <pre><code>df_append = pd.DataFrame( [[4,6]] , columns=['tempID','tempValue']) df_append.to_sql(name='tempy', con=engine, if_exists = 'append', index=False) df = pd.read_sql(sql_command, engine) print df tempID tempValue 0 1 2 1 4 6 </code></pre> <p><em>Try</em> to truncate data:</p> <pre><code>connection = engine.connect() connection.execute( '''TRUNCATE TABLE tempy''' ) connection.close() </code></pre> <p>Read table again, but truncate failed:</p> <pre><code>df = pd.read_sql(sql_command, engine) print df tempID tempValue 0 1 2 1 4 6 </code></pre>
0debug
C++ Why int r = (int, int, int); doesn't give error and r has the value of the last integer? : I faced this question, r always has the las integer between the (). What is the output of the following program? #include<isotream> using namespace std; main() { int i = 1, j = 2, k = 3, r; r = (i, j, k); cout<<r<<endl; } A - 1 B - 2 C - 3 D - Compile Error What I wanna know is why it is happening.
0debug
google play store insufficient storage lenovo A5000 : <p>every time i try to download app or update apps from google store ,said"insufficient storage" but i have 11GB of space in my memory card and my phone is lenovo A5000 .<a href="http://i.stack.imgur.com/VMuIc.png" rel="nofollow">enter image description here</a></p>
0debug
Jenkins gives me blank page : <p>I am getting this error when i start jenkins, which I believe is causing the jenkins to not work. Jenkins page comes up blank. I think the scm-sync-configuration is causing this to happen. It there anyway to workaround this or disable this plugin?</p> <pre><code>Running from: /Applications/Jenkins/jenkins.war webroot: $user.home/.jenkins Feb 08, 2016 12:30:13 PM winstone.Logger logInternal INFO: Beginning extraction from war file Feb 08, 2016 12:30:13 PM org.eclipse.jetty.util.log.JavaUtilLog info INFO: jetty-winstone-2.9 Feb 08, 2016 12:30:14 PM org.eclipse.jetty.util.log.JavaUtilLog info INFO: NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet Jenkins home directory: /Users/sss/.jenkins found at: $user.home/.jenkins Feb 08, 2016 12:30:16 PM org.eclipse.jetty.util.log.JavaUtilLog info INFO: Started SelectChannelConnector@0.0.0.0:8080 Feb 08, 2016 12:30:16 PM winstone.Logger logInternal INFO: Winstone Servlet Engine v2.0 running: controlPort=disabled Feb 08, 2016 12:30:16 PM jenkins.InitReactorRunner$1 onAttained INFO: Started initialization Feb 08, 2016 12:30:16 PM jenkins.InitReactorRunner$1 onAttained INFO: Listed all plugins Feb 08, 2016 12:30:17 PM hudson.plugins.scm_sync_configuration.SCMManipulator scmConfigurationSettledUp INFO: Creating scmRepository connection data .. Feb 08, 2016 12:30:17 PM hudson.plugins.scm_sync_configuration.scms.ScmSyncSubversionSCM extractScmCredentials INFO: Extracting SVN Credentials for url : https://svn.aaa.com/ Feb 08, 2016 12:30:17 PM jenkins.InitReactorRunner$1 onTaskFailed SEVERE: Failed Loading plugin scm-sync-configuration java.io.IOException: Failed to initialize at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:441) at hudson.PluginManager$2$1$1.run(PluginManager.java:384) at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282) at jenkins.model.Jenkins$8.runTask(Jenkins.java:913) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NullPointerException at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:57) at sun.reflect.UnsafeQualifiedObjectFieldAccessorImpl.get(UnsafeQualifiedObjectFieldAccessorImpl.java:38) at java.lang.reflect.Field.get(Field.java:393) at hudson.plugins.scm_sync_configuration.scms.ScmSyncSubversionSCM.extractScmCredentials(ScmSyncSubversionSCM.java:59) at hudson.plugins.scm_sync_configuration.scms.SCM.getConfiguredRepository(SCM.java:66) at hudson.plugins.scm_sync_configuration.SCMManipulator.scmConfigurationSettledUp(SCMManipulator.java:57) at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness.initializeRepository(ScmSyncConfigurationBusiness.java:72) at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness.init(ScmSyncConfigurationBusiness.java:67) at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationPlugin.initialInit(ScmSyncConfigurationPlugin.java:174) at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationPlugin.start(ScmSyncConfigurationPlugin.java:157) at hudson.ClassicPluginStrategy.startPlugin(ClassicPluginStrategy.java:449) at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:438) ... 9 more Feb 08, 2016 12:30:17 PM jenkins.InitReactorRunner$1 onAttained INFO: Prepared all plugins Feb 08, 2016 12:30:17 PM jenkins.InitReactorRunner$1 onAttained INFO: Started all plugins Feb 08, 2016 12:30:17 PM jenkins.InitReactorRunner$1 onAttained INFO: Augmented all extensions Feb 08, 2016 12:30:20 PM jenkins.InitReactorRunner$1 onAttained INFO: Loaded all jobs Feb 08, 2016 12:30:20 PM hudson.model.AsyncPeriodicWork$1 run INFO: Started Download metadata Feb 08, 2016 12:30:20 PM hudson.model.AsyncPeriodicWork$1 run INFO: Finished Download metadata. 2 ms Feb 08, 2016 12:30:21 PM org.jenkinsci.main.modules.sshd.SSHD start INFO: Started SSHD at port 49295 Feb 08, 2016 12:30:21 PM jenkins.InitReactorRunner$1 onAttained INFO: Completed initialization Feb 08, 2016 12:30:21 PM hudson.UDPBroadcastThread run INFO: Cannot listen to UDP port 33,848, skipping: java.net.SocketException: Can't assign requested address Feb 08, 2016 12:30:21 PM jenkins.InitReactorRunner$1 onAttained INFO: Started initialization Feb 08, 2016 12:30:21 PM jenkins.InitReactorRunner$1 onAttained INFO: Listed all plugins Feb 08, 2016 12:30:21 PM jenkins.InitReactorRunner$1 onAttained INFO: Prepared all plugins Feb 08, 2016 12:30:21 PM jenkins.InitReactorRunner$1 onAttained INFO: Started all plugins Feb 08, 2016 12:30:21 PM jenkins.InitReactorRunner$1 onAttained INFO: Augmented all extensions Feb 08, 2016 12:30:21 PM jenkins.InitReactorRunner$1 onAttained INFO: Loaded all jobs Feb 08, 2016 12:30:21 PM jenkins.InitReactorRunner$1 onAttained INFO: Completed initialization Feb 08, 2016 12:30:21 PM hudson.WebAppMain$3 run INFO: Jenkins is fully up and running </code></pre>
0debug
Retrieving Data from PHP table : <p>I have data in MYSQL database and I want to display a record per page on my website. How would I do this?</p> <p>The URL would correspond to each record</p> <p>Thank you!</p>
0debug
Ruby Gem: Uninitialized constant FactoryBot : <p>Working on a Ruby gem and trying to use FactoryBot inside with RSpec.</p> <p>I have this in <code>support/factory_bot.rb</code>:</p> <pre><code>RSpec.configure do |config| config.include FactoryBot::Syntax::Methods config.before(:suite) do FactoryBot.find_definitions end end </code></pre> <p>and in <code>spec_helper.rb</code>:</p> <pre><code>require 'support/factory_bot' </code></pre> <p>When I try to run the spec rake task, I get this error:</p> <pre><code>support/factory_bot.rb:2:in `block in &lt;top (required)&gt;': uninitialized constant FactoryBot (NameError) </code></pre> <p>What am I missing? This used to work fine when I was using the old factory_girl gem, but it has broken with the rename to factory_bot. Thanks!!</p>
0debug
Serialization encryption c# : <p>I use Serialize function to save an object to hard disk by the following code:</p> <pre><code>using (FileStream fs = new FileStream(fileName, FileMode.Create)) new BinaryFormatter().Serialize(fs, myObject); </code></pre> <p>Then I reload it again when I need it:</p> <pre><code>using(FileStream fs = new FileStream(fileName, FileMode.Open)) myObject = (Templates)new BinaryFormatter().Deserialize(fs); </code></pre> <p>I'm searching an easy way to encrypt the file I save to protect it and also fast way because the time factor in saving and reading the file is very important.</p> <p>Any suggestions please, thank you in advance!</p>
0debug
How to achieve replacement using regualr expression? : $test="111222333345555"; How to replace the digit of same repeated digits to 't'? That is how to get the `"11t22t333t34555t"` using regualr expression?
0debug
How to get notification authorization status in swift 3? : <p>How can I check UNUserNotificationCenter for current authorization status in iOS 11? I've been looking for a while and found some code but it's not in swift 3 and some of functions were deprecated in iOS 10. Can anyone help?</p>
0debug
Not able to add image to sqlite : The Code is shown below , I am not able to understand how can I take image from gallery in ImageHolder like I have done for saving name, phone, date. What should I do for adding image from a button to SQlite table and then retrieve to a custom listview. I have created the column_4_image This is my SQLiteHelper.java @Override public void onCreate(SQLiteDatabase database) { String CREATE_TABLE="CREATE TABLE IF NOT EXISTS "+TABLE_NAME+" (" +Table_Column_ID+" INTEGER PRIMARY KEY, " +Table_Column_1_Name+" VARCHAR, " +Table_Column_2_PhoneNumber +" VARCHAR, " +Table_Column_3_Date+" VARCHAR," +Table_Column_4_Image+"BLOB)"; database.execSQL(CREATE_TABLE); } This is my addDataActivity.java public void SQLiteTableBuild(){ sqLiteDatabaseObj.execSQL("CREATE TABLE IF NOT EXISTS " +SQLiteHelper.TABLE_NAME+"(id " +SQLiteHelper.Table_Column_ID +" PRIMARY KEY AUTOINCREMENT NOT NULL, " +SQLiteHelper.Table_Column_1_Name+" VARCHAR, " +SQLiteHelper.Table_Column_2_PhoneNumber+" VARCHAR, " +SQLiteHelper.Table_Column_3_Date+" VARCHAR, " +SQLiteHelper.Table_Column_4_Image+"BLOB);"); } public void CheckEditTextStatus(){ NameHolder = editTextName.getText().toString() ; NumberHolder = editTextPhoneNumber.getText().toString(); DateHolder = editTextDate.getText().toString(); EditTextEmptyHold = !(TextUtils.isEmpty(NameHolder) || TextUtils.isEmpty(NumberHolder) || TextUtils.isEmpty(DateHolder)); } public void InsertDataIntoSQLiteDatabase(){ if(EditTextEmptyHold) { SQLiteDataBaseQueryHolder = "INSERT INTO "+SQLiteHelper.TABLE_NAME+" (name,phone_number,date) VALUES('"+NameHolder+"', '"+NumberHolder+"','"+DateHolder+"');"; sqLiteDatabaseObj.execSQL(SQLiteDataBaseQueryHolder); sqLiteDatabaseObj.close(); Toast.makeText(activity_add_data.this,"Data Inserted Successfully", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(activity_add_data.this,"Please Fill All The Required Fields.", Toast.LENGTH_SHORT).show(); } } this is my activityListDisplay.java private void ShowSQLiteDBdata() { sqLiteDatabase = sqLiteHelper.getWritableDatabase(); cursor = sqLiteDatabase.rawQuery("SELECT * FROM "+SQLiteHelper.TABLE_NAME+"", null); ID_Array.clear(); NAME_Array.clear(); PHONE_NUMBER_Array.clear(); DATE_Array.clear(); if (cursor.moveToFirst()) { do { ID_Array.add(cursor.getString(cursor.getColumnIndex(SQLiteHelper.Table_Column_ID))); //Inserting Column ID into Array to Use at ListView Click Listener Method. ListViewClickItemArray.add(cursor.getString(cursor.getColumnIndex(SQLiteHelper.Table_Column_ID))); ListViewLongClickItemArray.add(cursor.getString(cursor.getColumnIndex(SQLiteHelper.Table_Column_ID))); NAME_Array.add(cursor.getString(cursor.getColumnIndex(SQLiteHelper.Table_Column_1_Name))); PHONE_NUMBER_Array.add(cursor.getString(cursor.getColumnIndex(SQLiteHelper.Table_Column_2_PhoneNumber))); DATE_Array.add(cursor.getString(cursor.getColumnIndex(SQLiteHelper.Table_Column_3_Date))); } while (cursor.moveToNext()); } //for reversing list Collections.reverse(ID_Array); Collections.reverse(NAME_Array); Collections.reverse(PHONE_NUMBER_Array); Collections.reverse(DATE_Array); listAdapter = new ListAdapter(activity_list_display.this, ID_Array, NAME_Array, PHONE_NUMBER_Array, DATE_Array ); LISTVIEW.setAdapter(listAdapter); cursor.close(); }
0debug
RecyclerView dont call OnCreateViewHolder, OnBindViewHolder, GetItemCount() : <p>in this code, I used breakpoints on each line of <strong>RecyclerView Class</strong> but the only constructor of this class is called, no more function(OnCreateViewHolder, OnBindViewHolder, GetItemCount(), etc) is being called<a href="https://i.stack.imgur.com/1Z3k2.png" rel="nofollow noreferrer">enter image description here</a>. Images from LogCat has also been uploaded...</p> <p><strong>MainActivity</strong></p> <pre><code>package com.example.admin.recyclerview; import android.provider.ContactsContract; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { RecyclerView recyclerView; RecyclerView.Adapter adapter; RecyclerView.LayoutManager layoutManager; String[] titles; String[] description; int[] images = {R.drawable.facebook, R.drawable.instagram, R.drawable.twitter, R.drawable.google}; ArrayList&lt;DataProvider&gt; arrayList = new ArrayList&lt;DataProvider&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); recyclerView = findViewById(R.id.recyclerView); titles = getResources().getStringArray(R.array.titles); description = getResources().getStringArray(R.array.description); int i = 0; for(String name : titles){ DataProvider dataProvider = new DataProvider(images[i], titles[i], description[i]); arrayList.add(dataProvider); i++; } adapter = new RecyclerAdapter(arrayList); recyclerView.setHasFixedSize(true); layoutManager = new LinearLayoutManager(this); recyclerView.setAdapter(adapter); } } </code></pre> <p><strong>RecyclerView Class</strong></p> <pre><code>package com.example.admin.recyclerview; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; public class RecyclerAdapter extends RecyclerView.Adapter&lt;RecyclerAdapter.RecyclerViewHolder&gt; { private ArrayList&lt;DataProvider&gt; arrayList = new ArrayList&lt;DataProvider&gt;(); public RecyclerAdapter(ArrayList&lt;DataProvider&gt; arrayList){ this.arrayList = arrayList; } @Override public RecyclerViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.row_layout, viewGroup, false); return new RecyclerViewHolder(view); } @Override public void onBindViewHolder(RecyclerViewHolder recyclerViewHolder, int i) { DataProvider dataProvider = arrayList.get(i); recyclerViewHolder.imageView.setImageResource(dataProvider.getImage_res()); recyclerViewHolder.title.setText(dataProvider.getTitle()); recyclerViewHolder.description.setText(dataProvider.getDescription()); } @Override public int getItemCount() { return arrayList.size(); } public static class RecyclerViewHolder extends RecyclerView.ViewHolder{ ImageView imageView; TextView title; TextView description; public RecyclerViewHolder(@NonNull View itemView) { super(itemView); imageView = itemView.findViewById(R.id.icon); title = itemView.findViewById(R.id.title); description = itemView.findViewById(R.id.description); } } } </code></pre> <p><strong>DataProvider</strong></p> <pre><code>package com.example.admin.recyclerview; public class DataProvider { private int image_res; private String title; private String description; public DataProvider(int image_res, String title, String description) { this.image_res = image_res; this.title = title; this.description = description; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getImage_res() { return image_res; } public void setImage_res(int image_res) { this.image_res = image_res; } } </code></pre>
0debug
static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, int coded, int mquant, int codingset) { GetBitContext *gb = &v->s.gb; MpegEncContext *s = &v->s; int dc_pred_dir = 0; int i; int16_t *dc_val; int16_t *ac_val, *ac_val2; int dcdiff; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int a_avail = v->a_avail, c_avail = v->c_avail; int use_pred = s->ac_pred; int scale; int q1, q2 = 0; s->dsp.clear_block(block); mquant = (mquant < 1) ? 0 : ((mquant > 31) ? 31 : mquant); s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; if (n < 4) { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } else { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } if (dcdiff < 0) { av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); return -1; } if (dcdiff) { if (dcdiff == 119 ) { if (mquant == 1) dcdiff = get_bits(gb, 10); else if (mquant == 2) dcdiff = get_bits(gb, 9); else dcdiff = get_bits(gb, 8); } else { if (mquant == 1) dcdiff = (dcdiff << 2) + get_bits(gb, 2) - 3; else if (mquant == 2) dcdiff = (dcdiff << 1) + get_bits1(gb) - 1; } if (get_bits1(gb)) dcdiff = -dcdiff; } dcdiff += vc1_pred_dc(&v->s, v->overlap, mquant, n, a_avail, c_avail, &dc_val, &dc_pred_dir); *dc_val = dcdiff; if (n < 4) { block[0] = dcdiff * s->y_dc_scale; } else { block[0] = dcdiff * s->c_dc_scale; } i = 1; if (!a_avail) dc_pred_dir = 1; if (!c_avail) dc_pred_dir = 0; if (!a_avail && !c_avail) use_pred = 0; ac_val = s->ac_val[0][0] + s->block_index[n] * 16; ac_val2 = ac_val; scale = mquant * 2 + v->halfpq; if (dc_pred_dir) ac_val -= 16; else ac_val -= 16 * s->block_wrap[n]; q1 = s->current_picture.f.qscale_table[mb_pos]; if (dc_pred_dir && c_avail && mb_pos) q2 = s->current_picture.f.qscale_table[mb_pos - 1]; if (!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.f.qscale_table[mb_pos - s->mb_stride]; if ( dc_pred_dir && n == 1) q2 = q1; if (!dc_pred_dir && n == 2) q2 = q1; if (n == 3) q2 = q1; if (coded) { int last = 0, skip, value; int k; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); i += skip; if (i > 63) break; if (v->fcm == PROGRESSIVE) block[v->zz_8x8[0][i++]] = value; else { if (use_pred && (v->fcm == ILACE_FRAME)) { if (!dc_pred_dir) block[v->zz_8x8[2][i++]] = value; else block[v->zz_8x8[3][i++]] = value; } else { block[v->zzi_8x8[i++]] = value; } } } if (use_pred) { if (q2 && q1 != q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; if (q1 < 1) return AVERROR_INVALIDDATA; if (dc_pred_dir) { for (k = 1; k < 8; k++) block[k << v->left_blk_sh] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } else { for (k = 1; k < 8; k++) block[k << v->top_blk_sh] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } else { if (dc_pred_dir) { for (k = 1; k < 8; k++) block[k << v->left_blk_sh] += ac_val[k]; } else { for (k = 1; k < 8; k++) block[k << v->top_blk_sh] += ac_val[k + 8]; } } } for (k = 1; k < 8; k++) { ac_val2[k ] = block[k << v->left_blk_sh]; ac_val2[k + 8] = block[k << v->top_blk_sh]; } for (k = 1; k < 64; k++) if (block[k]) { block[k] *= scale; if (!v->pquantizer) block[k] += (block[k] < 0) ? -mquant : mquant; } if (use_pred) i = 63; } else { int k; memset(ac_val2, 0, 16 * 2); if (dc_pred_dir) { if (use_pred) { memcpy(ac_val2, ac_val, 8 * 2); if (q2 && q1 != q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; if (q1 < 1) return AVERROR_INVALIDDATA; for (k = 1; k < 8; k++) ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } } else { if (use_pred) { memcpy(ac_val2 + 8, ac_val + 8, 8 * 2); if (q2 && q1 != q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; if (q1 < 1) return AVERROR_INVALIDDATA; for (k = 1; k < 8; k++) ac_val2[k + 8] = (ac_val2[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } } if (use_pred) { if (dc_pred_dir) { for (k = 1; k < 8; k++) { block[k << v->left_blk_sh] = ac_val2[k] * scale; if (!v->pquantizer && block[k << v->left_blk_sh]) block[k << v->left_blk_sh] += (block[k << v->left_blk_sh] < 0) ? -mquant : mquant; } } else { for (k = 1; k < 8; k++) { block[k << v->top_blk_sh] = ac_val2[k + 8] * scale; if (!v->pquantizer && block[k << v->top_blk_sh]) block[k << v->top_blk_sh] += (block[k << v->top_blk_sh] < 0) ? -mquant : mquant; } } i = 63; } } s->block_last_index[n] = i; return 0; }
1threat
Where Store an array with Symfony : I have an array that I need in my Controller, actually I write this: `$myArray = array('key'=>'value', key1'=>'value1', key'=>'value', key'=>'value'key'=>'value'....);` But It's not good to keep it like that, Do you know where can I "store" and call It when I need it ? Many Thanks
0debug
New Programmer :3 : Module Module1 Sub Main() Dim A, B, C As Integer Console.WriteLine("Quadratic Equation calculator") Console.WriteLine(" AX^2 + BX + C") Console.WriteLine("Enter A") Console.Read() = A Console.WriteLine("Enter B") Console.Read() = B Console.WriteLine("Enter C") Console.Read() = C 'ax^2 + bx + c = 0 'enter a,b and c 'set ac as variable 'set b as variable 'find number that multiplies for ac and adds for b 'put them in (X+ )(x+ ) End Sub End Module OK, to im pretty damn new to programming and have not idea why this is showing a "Error 1 Expression is a value and therefore cannot be the target of an assignment", error. p.s. im trying to write a code that solves quadratics using VB
0debug
Can clang-format break my code? : <p>As <code>clang-format</code> is a tool to only reformat code, is it possible that such formatting can break working code or at least change how it works? Is there some kind of contract that it will/can not change how code works?</p> <p>We have a lot of code that we want to format with <code>clang-format</code>. This means, many lines of code will change. Not having to review every single line of code that only changed due to a <code>clang-format</code> would be a big simplification of this process.</p> <p>I would say that <code>clang-format</code> will not change how code works. On the other hand I am not 100% sure, if this can be guaranteed.</p>
0debug
how to delete all lines after a certain string in a file and then add some more lines using python : <p>I want to delete all the lines in a file smart.txt and then add some strings of my own. smart.txt contains alot of lines.</p> <p>I tried</p> <pre><code>import sys import os output=[] f= open(smart.txt, 'r') for line in f: output.append(line) if '*** P R O P E R T I E S ***' in line: break f=open(smart.txt, 'w') [f.write(data) for data in output] f.write('*** Inclusions ***\n ') f.write('*** Permanent ***\n ') f.close() </code></pre> <p>I am getting an error</p> <pre><code>f= open(smart.txt, 'r') NameError: name 'smart' is not defined </code></pre> <p>cannot figure out because smart.txt is present in the same directory.</p> <p>Any suggestions?</p>
0debug
How to get the base directory in visual studio code snippet? : <p>I am trying to get the file current directory in a snippet for visual studio code.</p> <p><a href="https://code.visualstudio.com/docs/editor/userdefinedsnippets#_variables" rel="noreferrer">VSCode has a variable</a>: <code>TM_DIRECTORY</code>, which is the <strong>fullpath</strong>.</p> <p>eg:</p> <pre><code>{folder: "$TM_DIRECTORY"} </code></pre> <p>would be replaced by</p> <pre><code>{folder: "/Volumes/my-project-path/ParentFolder/MyFolder"} </code></pre> <p>But I want only <code>MyFolder</code>.</p> <p>Normally, we can use a <a href="https://code.visualstudio.com/docs/editor/userdefinedsnippets#_variable-transforms" rel="noreferrer">transform as indicated in the docs</a>. Sublime Text works in the same way. But for as much as I try, the snippet simply outputs the whole regex.</p> <p>Could someone answer with the magical variable/transform? :)</p>
0debug
Bring View on top of Modal using zIndex style with React-Native : <p><code>zIndex</code> has been introduced recently to React-Native to change the position of a <code>View</code> in the stack of layers.</p> <p>Although, I'm not able to bring a <code>View</code> on top of a <code>Modal</code> component.</p> <p>My code looks like this:</p> <pre><code>render() { return ( &lt;View&gt; &lt;Modal visible&gt; {props.children} &lt;/Modal&gt; &lt;View style={{ zIndex: 1000 }}&gt; &lt;Text&gt;Loading...&lt;/Text&gt; &lt;/View&gt; &lt;/View&gt; ); } </code></pre> <p>I guess I could stop using <code>&lt;Modal&gt;</code> and create a regular animated <code>&lt;View&gt;</code> that would behave like the <code>Modal</code>, but I'd rather find another solution.</p> <p>Any idea?</p>
0debug
Avoid heroku server from sleeping : <p>I got a website hosted on a <a href="http://heroku.com" rel="noreferrer">Heroku</a> server (<em>i'm a new to Heroku btw</em>), and as it's under the free package, it sleeps after <strong>30m of inactivity</strong>, and to put it in action again when a user hits it, it takes around 7 secs to <code>npm run start</code> successfully.</p> <p>I'm thinking of run a nodejs job or something that open the website every 29m so that the server never sleeps, initially, I got something like this:</p> <pre><code>(function wakeup() { require('open')('https://mywebsite.herokuapp.com', (err) =&gt; { if (err) throw err; console.log('Woke up!'); setTimeout(wakeup, 1740000); //29m }); })() </code></pre> <p><em>N.B.: That just opens it in a browser, but not handling closing it.</em></p> <ul> <li>First, is it legal to do this workaround?</li> <li>Second, if yes, what's the best approach to implement this?</li> </ul>
0debug
What is the difference between enterAnim & popEnterAnim & exitAnim & popExitAnim? : <p>What is the difference between animation tags in latest Navigation Architecture Component? I got confused with <code>enterAnim</code> &amp; <code>popEnterAnim</code>. Similarly, <code>exitAnim</code> &amp; <code>popExitAnim</code>.</p> <p>Any visual expansions is more than welcomed.</p>
0debug
Python "ValueError: I/O operation on closed file." in nested loop : I'm trying to create an link scraper which worked so far. I only had problems when I was copying multiple lines, then it never stoped inserting these lines. So I wanted to split the mutliple lines into single lines but after creating the for loop which is iterating over the multilines I always get this error: ValueError: I/O operation on closed file. import pyperclip import datetime while True: with open("text.txt", "r+") as textfile: text = str(pyperclip.paste()) liste = text.split("\r\n") for element in liste: for line in textfile: if element in line: break else: now = datetime.datetime.now() textfile.write(str(now.day) + "." + str(now.month) + "." + str(now.year) + " " + str(now. hour) + ":" + str(now.minute) + " | ") textfile.write(element + "\n") textfile.close() print(element)
0debug
static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *data_end) { int size; char buf[1024]; if (data >= data_end) return; switch (*data++) { case AMF_DATA_TYPE_NUMBER: av_log(ctx, AV_LOG_DEBUG, " number %g\n", av_int2double(AV_RB64(data))); return; case AMF_DATA_TYPE_BOOL: av_log(ctx, AV_LOG_DEBUG, " bool %d\n", *data); return; case AMF_DATA_TYPE_STRING: case AMF_DATA_TYPE_LONG_STRING: if (data[-1] == AMF_DATA_TYPE_STRING) { size = bytestream_get_be16(&data); } else { size = bytestream_get_be32(&data); } size = FFMIN(size, 1023); memcpy(buf, data, size); buf[size] = 0; av_log(ctx, AV_LOG_DEBUG, " string '%s'\n", buf); return; case AMF_DATA_TYPE_NULL: av_log(ctx, AV_LOG_DEBUG, " NULL\n"); return; case AMF_DATA_TYPE_ARRAY: data += 4; case AMF_DATA_TYPE_OBJECT: av_log(ctx, AV_LOG_DEBUG, " {\n"); for (;;) { int size = bytestream_get_be16(&data); int t; memcpy(buf, data, size); buf[size] = 0; if (!size) { av_log(ctx, AV_LOG_DEBUG, " }\n"); data++; break; } if (size < 0 || size >= data_end - data) return; data += size; av_log(ctx, AV_LOG_DEBUG, " %s: ", buf); ff_amf_tag_contents(ctx, data, data_end); t = ff_amf_tag_size(data, data_end); if (t < 0 || t >= data_end - data) return; data += t; } return; case AMF_DATA_TYPE_OBJECT_END: av_log(ctx, AV_LOG_DEBUG, " }\n"); return; default: return; } }
1threat
How do I debug node.js errors when my code is nowhere in the stack trace? : <p>And actually, I don't fully understand <em>why</em> my code is not in the stack trace, if node is single threaded. Maybe I'm fundamentally misunderstanding, something, but why does my application sometimes die with a stack trace that doesn't have anything I've written in it?</p> <p>I'm writing a pretty simple proxy server using node/express. As an example, I was periodically getting this "socket hangup error":</p> <pre><code>Error: socket hang up at createHangUpError (_http_client.js:250:15) at Socket.socketOnEnd (_http_client.js:342:23) at emitNone (events.js:91:20) at Socket.emit (events.js:185:7) at endReadableNT (_stream_readable.js:926:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) code: 'ECONNRESET' } </code></pre> <p>And since none of the javascript files in the stack trace are mine, I had no idea where this was coming from. It was basically trial and error, trying to catch errors and adding .on style error-handlers until I found the right place.</p> <p>I feel like I'm fundamentally missing something - what I should I be doing differently in order to debug errors like this? How do I know where to handle it if I can't see what (in my code) is causing it? How do I know whether I should be using a try/catch block, or something like <code>request.on('error') {...}</code>?</p>
0debug
static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags) { int isv34, tlen, unsync; char tag[5]; int64_t next, end = avio_tell(s->pb) + len; int taghdrlen; const char *reason = NULL; AVIOContext pb; unsigned char *buffer = NULL; int buffer_size = 0; switch (version) { case 2: if (flags & 0x40) { reason = "compression"; goto error; } isv34 = 0; taghdrlen = 6; break; case 3: case 4: isv34 = 1; taghdrlen = 10; break; default: reason = "version"; goto error; } unsync = flags & 0x80; if (isv34 && flags & 0x40) avio_skip(s->pb, get_size(s->pb, 4)); while (len >= taghdrlen) { unsigned int tflags; int tunsync = 0; if (isv34) { avio_read(s->pb, tag, 4); tag[4] = 0; if(version==3){ tlen = avio_rb32(s->pb); }else tlen = get_size(s->pb, 4); tflags = avio_rb16(s->pb); tunsync = tflags & ID3v2_FLAG_UNSYNCH; } else { avio_read(s->pb, tag, 3); tag[3] = 0; tlen = avio_rb24(s->pb); } len -= taghdrlen + tlen; if (len < 0) break; next = avio_tell(s->pb) + tlen; if (tflags & ID3v2_FLAG_DATALEN) { avio_rb32(s->pb); tlen -= 4; } if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) { av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag); avio_skip(s->pb, tlen); } else if (tag[0] == 'T') { if (unsync || tunsync) { int i, j; av_fast_malloc(&buffer, &buffer_size, tlen); for (i = 0, j = 0; i < tlen; i++, j++) { buffer[j] = avio_r8(s->pb); if (j > 0 && !buffer[j] && buffer[j - 1] == 0xff) { j--; } } ffio_init_context(&pb, buffer, j, 0, NULL, NULL, NULL, NULL); read_ttag(s, &pb, j, tag); } else { read_ttag(s, s->pb, tlen, tag); } } else if (!tag[0]) { if (tag[1]) av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding"); avio_skip(s->pb, tlen); break; } avio_seek(s->pb, next, SEEK_SET); } if (version == 4 && flags & 0x10) end += 10; error: if (reason) av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason); avio_seek(s->pb, end, SEEK_SET); av_free(buffer); return; }
1threat
static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, TCGv_i64 addr, int size, int is_pair) { TCGLabel *fail_label = gen_new_label(); TCGLabel *done_label = gen_new_label(); TCGv_i64 tmp; tcg_gen_brcond_i64(TCG_COND_NE, addr, cpu_exclusive_addr, fail_label); tmp = tcg_temp_new_i64(); if (is_pair) { if (size == 2) { if (s->be_data == MO_LE) { tcg_gen_concat32_i64(tmp, cpu_reg(s, rt), cpu_reg(s, rt2)); } else { tcg_gen_concat32_i64(tmp, cpu_reg(s, rt2), cpu_reg(s, rt)); } tcg_gen_atomic_cmpxchg_i64(tmp, cpu_exclusive_addr, cpu_exclusive_val, tmp, get_mem_index(s), MO_64 | MO_ALIGN | s->be_data); tcg_gen_setcond_i64(TCG_COND_NE, tmp, tmp, cpu_exclusive_val); } else if (s->be_data == MO_LE) { gen_helper_paired_cmpxchg64_le(tmp, cpu_env, cpu_exclusive_addr, cpu_reg(s, rt), cpu_reg(s, rt2)); } else { gen_helper_paired_cmpxchg64_be(tmp, cpu_env, cpu_exclusive_addr, cpu_reg(s, rt), cpu_reg(s, rt2)); } } else { tcg_gen_atomic_cmpxchg_i64(tmp, cpu_exclusive_addr, cpu_exclusive_val, cpu_reg(s, rt), get_mem_index(s), size | MO_ALIGN | s->be_data); tcg_gen_setcond_i64(TCG_COND_NE, tmp, tmp, cpu_exclusive_val); } tcg_gen_mov_i64(cpu_reg(s, rd), tmp); tcg_temp_free_i64(tmp); tcg_gen_br(done_label); gen_set_label(fail_label); tcg_gen_movi_i64(cpu_reg(s, rd), 1); gen_set_label(done_label); tcg_gen_movi_i64(cpu_exclusive_addr, -1); }
1threat
Python & Pandas - Group by day and count for each day : <p>I am new on pandas and for now i don't get how to arrange my time serie, take a look at it :</p> <pre><code>date &amp; time of connection 19/06/2017 12:39 19/06/2017 12:40 19/06/2017 13:11 20/06/2017 12:02 20/06/2017 12:04 21/06/2017 09:32 21/06/2017 18:23 21/06/2017 18:51 21/06/2017 19:08 21/06/2017 19:50 22/06/2017 13:22 22/06/2017 13:41 22/06/2017 18:01 23/06/2017 16:18 23/06/2017 17:00 23/06/2017 19:25 23/06/2017 20:58 23/06/2017 21:03 23/06/2017 21:05 </code></pre> <p>This is a sample of a dataset of 130 k raws,I tried : <code>df.groupby('date &amp; time of connection')['date &amp; time of connection'].apply(list)</code></p> <p>Not enough i guess</p> <p>I think i should :</p> <ul> <li>Create a dictionnary with index from dd/mm/yyyy to dd/mm/yyyy </li> <li>Convert "date &amp; time of connection" type dateTime to Date</li> <li>Group and count Date of "date &amp; time of connection"</li> <li>Put the numbers i count inside the dictionary ?</li> </ul> <p>What do you think about my logic ? Do you know some tutos ? Thank you very much</p>
0debug
As i am Got the XML data and how i can save the XML Data in Objective C : As an New to the iOS Developement in Xcode 7. Below i have some questions please clarify my doubt 1. I need to Store the XML Data from an URL 2. And Split the XML data each line and store it in the Objective C 3. Below i mention my XML data <EstablishmentName>La Parrilla Colombian Steakhouse &amp; Bar</EstablishmentName> <BusinessName>La Parrilla Colombian Steakhouse &amp; Bar</BusinessName> <OpenTime>PT8H31M</OpenTime> <ClosingTime>PT18H50M</ClosingTime> <Floor>12 th floor</Floor> <Building>EST Buliding</Building>
0debug
Does aria-label prevent the inner content being read out by assistive devices? : <p>The <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute" rel="noreferrer">MDN docs</a> say you should use <code>aria-label</code> like this:</p> <pre><code>&lt;button aria-label="Close" onclick="myDialog.close()"&gt;X&lt;/button&gt; </code></pre> <p>I don't have access to a screenreader, but I've seen comments on Stack Overflow suggesting that an <code>aria-label</code> does not <em>replace</em> the inner content, it only <em>prefixes</em> it. So in the above case it would read out "Close X", which is obviously not ideal.</p> <p>Is this true? If so, what's the solution? I'm guessing it would make sense to wrap the inner content with an <code>[aria-hidden=true]</code> element, like this:</p> <pre><code>&lt;button aria-label="Close" onclick="myDialog.close()"&gt;&lt;span aria-hidden="true"&gt;X&lt;/span&gt;&lt;/button&gt; </code></pre> <p>...but I'm cautious because I can't test it on a real screenreader.</p>
0debug
C# "Dragging" variable to another class? : I want to "Transfer" a variable called password (example: hello123) to another class and or method. Is there a way to do this? I have heard you can only to it with strings and int but is it really no way around this?
0debug
static int synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int length, int sb_min, int sb_max) { int sb, j, k, n, ch, run, channels; int joined_stereo, zero_encoding, chs; int type34_first; float type34_div = 0; float type34_predictor; float samples[10], sign_bits[16]; if (length == 0) { for (sb=sb_min; sb < sb_max; sb++) build_sb_samples_from_noise (q, sb); return 0; } for (sb = sb_min; sb < sb_max; sb++) { FIX_NOISE_IDX(q->noise_idx); channels = q->nb_channels; if (q->nb_channels <= 1 || sb < 12) joined_stereo = 0; else if (sb >= 24) joined_stereo = 1; else joined_stereo = (BITS_LEFT(length,gb) >= 1) ? get_bits1 (gb) : 0; if (joined_stereo) { if (BITS_LEFT(length,gb) >= 16) for (j = 0; j < 16; j++) sign_bits[j] = get_bits1 (gb); for (j = 0; j < 64; j++) if (q->coding_method[1][sb][j] > q->coding_method[0][sb][j]) q->coding_method[0][sb][j] = q->coding_method[1][sb][j]; fix_coding_method_array(sb, q->nb_channels, q->coding_method); channels = 1; } for (ch = 0; ch < channels; ch++) { zero_encoding = (BITS_LEFT(length,gb) >= 1) ? get_bits1(gb) : 0; type34_predictor = 0.0; type34_first = 1; for (j = 0; j < 128; ) { switch (q->coding_method[ch][sb][j / 2]) { case 8: if (BITS_LEFT(length,gb) >= 10) { if (zero_encoding) { for (k = 0; k < 5; k++) { if ((j + 2 * k) >= 128) break; samples[2 * k] = get_bits1(gb) ? dequant_1bit[joined_stereo][2 * get_bits1(gb)] : 0; } } else { n = get_bits(gb, 8); for (k = 0; k < 5; k++) samples[2 * k] = dequant_1bit[joined_stereo][random_dequant_index[n][k]]; } for (k = 0; k < 5; k++) samples[2 * k + 1] = SB_DITHERING_NOISE(sb,q->noise_idx); } else { for (k = 0; k < 10; k++) samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 10; break; case 10: if (BITS_LEFT(length,gb) >= 1) { float f = 0.81; if (get_bits1(gb)) f = -f; f -= noise_samples[((sb + 1) * (j +5 * ch + 1)) & 127] * 9.0 / 40.0; samples[0] = f; } else { samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 1; break; case 16: if (BITS_LEFT(length,gb) >= 10) { if (zero_encoding) { for (k = 0; k < 5; k++) { if ((j + k) >= 128) break; samples[k] = (get_bits1(gb) == 0) ? 0 : dequant_1bit[joined_stereo][2 * get_bits1(gb)]; } } else { n = get_bits (gb, 8); for (k = 0; k < 5; k++) samples[k] = dequant_1bit[joined_stereo][random_dequant_index[n][k]]; } } else { for (k = 0; k < 5; k++) samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 5; break; case 24: if (BITS_LEFT(length,gb) >= 7) { n = get_bits(gb, 7); for (k = 0; k < 3; k++) samples[k] = (random_dequant_type24[n][k] - 2.0) * 0.5; } else { for (k = 0; k < 3; k++) samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 3; break; case 30: if (BITS_LEFT(length,gb) >= 4) samples[0] = type30_dequant[qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1)]; else samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); run = 1; break; case 34: if (BITS_LEFT(length,gb) >= 7) { if (type34_first) { type34_div = (float)(1 << get_bits(gb, 2)); samples[0] = ((float)get_bits(gb, 5) - 16.0) / 15.0; type34_predictor = samples[0]; type34_first = 0; } else { unsigned v = qdm2_get_vlc(gb, &vlc_tab_type34, 0, 1); if (v >= FF_ARRAY_ELEMS(type34_delta)) return AVERROR_INVALIDDATA; samples[0] = type34_delta[v] / type34_div + type34_predictor; type34_predictor = samples[0]; } } else { samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 1; break; default: samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); run = 1; break; } if (joined_stereo) { float tmp[10][MPA_MAX_CHANNELS]; for (k = 0; k < run; k++) { tmp[k][0] = samples[k]; tmp[k][1] = (sign_bits[(j + k) / 8]) ? -samples[k] : samples[k]; } for (chs = 0; chs < q->nb_channels; chs++) for (k = 0; k < run; k++) if ((j + k) < 128) q->sb_samples[chs][j + k][sb] = q->tone_level[chs][sb][((j + k)/2)] * tmp[k][chs]; } else { for (k = 0; k < run; k++) if ((j + k) < 128) q->sb_samples[ch][j + k][sb] = q->tone_level[ch][sb][(j + k)/2] * samples[k]; } j += run; } } } return 0; }
1threat
document.write('<script src="evil.js"></script>');
1threat
how to show select option value in mysql : hello I create database 2 table 1 vn_rent 2 amount_cus from insert to vn_rent i user code this select option value <?php session_start(); //PUT THIS HEADER ON TOP OF EACH UNIQUE PAGE if(!isset($_SESSION['id_user'])){ header("location:index.php"); header("Content-type: text/html; charset=utf-8"); } include_once('config/dbconnect.php'); $id_user = $_SESSION['id_user']; $rn_first_name = $_POST['rn_first_name']; $rn_last_name = $_POST['rn_last_name']; $rn_gostart = $_POST['rn_gostart']; $rn_endstart = $_POST['rn_endstart']; $time_gostart = $_POST['time_gostart']; $time_endstart = $_POST['time_endstart']; $rn_tel = $_POST['rn_tel']; $rn_amount = $_POST['rn_amount']; $rn_svan = $_POST['rn_svan']; $rn_destination = $_POST['rn_destination']; $id_invoice = $_POST['id_invoice']; $Status = $_POST['Status']; $vn_dtial = $_POST['vn_dtial']; $rn_place = $_POST['rn_place']; $id_vn_order = $_POST['id_vn_order']; $travel_id = $_POST['travel_id']; $province_id = $_POST['province_id']; $am_id = $_POST['am_id']; $date = "$rn_gostart"; //กำหนดค้นวันที่ $result = mysqli_query($con,"select * from vn_rent where rn_gostart = '$date'"); $ckd = mysqli_num_rows($result); if($ckd >= 3){ $msg = "<div class='alert alert-danger'> <span class='glyphicon glyphicon-info-sign'></span> &nbsp; วันที่จองเต็มแล้ว </div>"; }else{ $sql = "INSERT INTO vn_rent (id_user,rn_first_name,rn_last_name,rn_gostart,rn_endstart,time_gostart,time_endstart,rn_tel,rn_amount,rn_svan,Status,vn_dtial,rn_place,rn_destination,travel_id,province_id,am_id) VALUES ('$id_user', '$rn_first_name',' $rn_last_name ','$rn_gostart','$rn_endstart','$time_gostart','$time_endstart','$rn_tel','$rn_amount','$rn_svan','$Status','$vn_dtial','$rn_place','$rn_destination','$travel_id','$province_id','$am_id')"; //คำสั่ง insert 2 ตาราง if ($con->query($sql) === TRUE) { $id_van = $con->insert_id; $con->query("INSERT INTO invoice (id_user, id_vn_order,id_van) VALUE($id_user, $id_vn_order, $id_van)"); $id_invoice = $con->insert_id; $con->query("UPDATE vn_rent SET id_invoice = '$id_invoice' WHERE id_van = $id_van"); $msg = "<div class='alert alert-success'> <span class='glyphicon glyphicon-info-sign'></span> &nbsp; s] จองรถตู้สำเร็จ โปรดรอการตอบรับทาง Email ! </div>"; } else { echo "Error: " . $sql . "<br>" . $con->error; } } $con->close(); /* $sql = "INSERT INTO vn_rent (id_user,rn_first_name,rn_last_name,rn_dstart,rn_estart,rn_tel,rn_amount,rn_svan,Status,vn_dtial,rn_place,rn_destination) VALUES ('$id_user', '$rn_first_name',' $rn_last_name ','$rn_dstart','$rn_estart','$rn_tel','$rn_amount','$rn_svan','$Status','$vn_dtial','$rn_place','$rn_destination')"; $sql1="INSERT INTO invoice (id_invoice,id_van,id_user,id_vn_order) VALUES ('$id_invoice', '$id_van',' $id_user ','$id_vn_order')"; if($con->multi_query($sql)) { $msg = "<div class='alert alert-success'> <span class='glyphicon glyphicon-info-sign'></span> &nbsp; s] จองรถตู้สำเร็จ โปรดรอการตอบรับทาง Email ! </div>"; } else { $msg = "<div class='alert alert-danger'> <span class='glyphicon glyphicon-info-sign'></span> &nbsp; error while registering ! </div>"; } $con->close();*/ ?> Simple Select table amount_cus insert to vn_rent <?php include "config.php"; $query = "SELECT * FROM amount_cus"; $result = mysqli_query($mysqli, $query); ?> <select class="select-search" name="am_id"> <?php while ($line = mysqli_fetch_array($result, MYSQL_ASSOC)) { ?> <option value="<?php echo $line['am_id'];?>"> <?php echo $line['am_text'];?> </option> <?php } ?> </select> [IMaGE from vn_rent][1] [amount_cus][2] OK I'm sorry i'm not good english What I will do is. I will make changes, but the problem is, I do it to extract data from tables and lists amount_cus selected first. And along with other data [1]: http://i.stack.imgur.com/Jfemx.png [2]: http://i.stack.imgur.com/HJa3r.png
0debug
Is it possible to insert an image without using a filepath src? : <p>Assume that I have an image stored as a variable, from a form, in the form of <code>var someImage = document.getElementById("input1").files[0]</code>. How would I insert this image saved to a variable into an HTML document, without using filepaths?</p>
0debug
document.getElementById('input').innerHTML = user_input;
1threat
static void update_refcount_discard(BlockDriverState *bs, uint64_t offset, uint64_t length) { BDRVQcowState *s = bs->opaque; Qcow2DiscardRegion *d, *p, *next; QTAILQ_FOREACH(d, &s->discards, next) { uint64_t new_start = MIN(offset, d->offset); uint64_t new_end = MAX(offset + length, d->offset + d->bytes); if (new_end - new_start <= length + d->bytes) { assert(d->bytes + length == new_end - new_start); d->offset = new_start; d->bytes = new_end - new_start; goto found; } } d = g_malloc(sizeof(*d)); *d = (Qcow2DiscardRegion) { .bs = bs, .offset = offset, .bytes = length, }; QTAILQ_INSERT_TAIL(&s->discards, d, next); found: QTAILQ_FOREACH_SAFE(p, &s->discards, next, next) { if (p == d || p->offset > d->offset + d->bytes || d->offset > p->offset + p->bytes) { continue; } assert(p->offset == d->offset + d->bytes || d->offset == p->offset + p->bytes); QTAILQ_REMOVE(&s->discards, p, next); d->offset = MIN(d->offset, p->offset); d->bytes += p->bytes; } }
1threat
Java embedded database with about 500 million of records : <p>In my Java application I need to use some kind of embedded DB (SQL or NoSQL doesn't matter), which is able to hold about 500 millions of records (mostly single table, but splittion to more tables is not an issue). The number of records is the key part. The task is simple: check if such string is in DB if not insert it. Also the DB will not be under heavy load. I've been thinking about Derby, H2, Hypersonic DB, HSQLDB or ... . Could you suggest?</p> <p>Thanks</p> <p>Pat</p>
0debug
Whats the idea behind task clean on gradle android projects : <p>When I create a new project on android studio I see in <code>gradle.build</code>:</p> <pre><code>task clean(type: Delete) { delete rootProject.buildDir } </code></pre> <p>Whats the idea behind it? </p>
0debug
Woocommerce show product published date on shop page : <p>I'm looking for solution to display products published date on shop page.</p> <p>I would very greatful for any help.</p>
0debug
def diameter_circle(r): diameter=2*r return diameter
0debug
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque) { Parser p; p.const_values = const_values; p.opaque = opaque; return eval_expr(&p, e); }
1threat
Fastlane: proper way to add a device to provisioning? : <p>I am using fastlane to handle provisioning.</p> <p>This is what I did:</p> <pre><code>match nuke development match nuke distribution </code></pre> <p>then in a lane I have this for each bundleId I need to provision for:</p> <pre><code>match(type: "development", app_identifier: "com.myCompany.myApp", force_for_new_devices: true) </code></pre> <p>When I want to download the provisioning I have a lane that does this:</p> <pre><code>match(type: "development", app_identifier: "com.myCompany.myApp", readonly: true) </code></pre> <p>All this lets me work and build fine on devices that were ALREADY in the portal at the time of nuke.</p> <p>How do I update provisioning correctly if I want to add a device?</p> <p>I tried this:</p> <pre><code>match development --force_for_new_devices true -a com.myCompany.myApp </code></pre> <p>It does not work.</p> <p>I get this error:</p> <pre><code>Provisioning profile '82afbd5b-9f19-4c78-b3ac-56a3565ce3f2' is not available on the Developer Portal </code></pre> <p>The only thing that works every time I have to add a device is to nuke everything and start fresh.</p> <p>What's the proper way to add a device without having to nuke??</p> <p>I am using xcode8, I disabled the automatic provisioning like suggested by fastlane.</p>
0debug
Is there a way to detect horizontal scroll only without triggering a browser reflow : <p>You can detect a browser scroll event on an arbitrary element with:</p> <pre><code>element.addEventListener('scroll', function (event) { // do something }); </code></pre> <p>I would like to be able to differentiate between vertical scrolling and horizontal scrolling and execute actions for them independently. </p> <p>I'm currently doing this by stashing the values of element.scrollTop, and element.scrollLeft, and then comparing them inside the event listener. E.g. </p> <pre><code>var scrollLeft, scrollTop; element.addEventListener('scroll', function (event) { if (scrollLeft !== element.scrollLeft) { // horizontally scrolled scrollLeft = element.scrollLeft; } if (scrollTop !== element.scrollTop) { // vertically scrolled scrollTop = element.scrollTop; } }); </code></pre> <p>This works fine, however from <a href="https://gist.github.com/paulirish/5d52fb081b3570c81e3a" rel="noreferrer">https://gist.github.com/paulirish/5d52fb081b3570c81e3a</a> I read that reading the scrollLeft or scrollTop values causes a reflow. </p> <p>Is there a better way to do this without causing a browser reflow on scroll?</p>
0debug
How to display programmable exactly what time? I need that part code : <p>It is necessary to create an analog clock.How to display programmable exactly what time? I need that part code.Thank you</p>
0debug
Multi thread approach vs Akka actor model : <p>I'm new to akka actor. I have read the akka offical documents and still don't understand how actor works compare to threading model.</p> <p>Let's take a simple example like this. I have a traditional HttpServer , which have 10 threads in the thread pools . When 20 requests are coming at the same time , the HttpServer will delegate all 10 threads in the thread pool to handle the first 10 requests and the others will be queued in the network interface to wait for the thread to pick up.</p> <p>How will an actor-based HttpServer react to the same problem?. Will all of the requests are queued in front of a delegated actors to process them in a sequential order and send the messages to other actor?. If so, this is the point that I don't understand how can actor provide better performance than threading model, because only 1 actor process 20 requests in a sequential order can not faster than 10 thread process 20 requests concurrently.</p> <p>What I am trying to understand is that how actor react when multiple requests are coming together at the same time? , not how actor process and queue the message in the mail box , it's already showed up a lot in the documents. Can someone simulate the steps how actor work in this example?</p>
0debug
How search for method in VSCode? : <p>Is there's any functionality simillar to CTRL+R of sublime in VSCode?</p> <p><a href="https://i.stack.imgur.com/1Gawc.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/1Gawc.gif" alt="Sublime search method functionality"></a></p>
0debug
int ff_dca_xll_decode_audio(DCAContext *s, AVFrame *frame) { int seg, chset_i; struct coding_params { int seg_type; int rice_code_flag[16]; int pancAuxABIT[16]; int pancABIT0[16]; int pancABIT[16]; int nSamplPart0[16]; } param_state[16]; GetBitContext *gb = &s->xll_navi.gb; int *history; av_fast_malloc(&s->xll_sample_buf, &s->xll_sample_buf_size, (s->xll_smpl_in_seg + DCA_XLL_AORDER_MAX) * s->xll_channels * sizeof(*s->xll_sample_buf)); if (!s->xll_sample_buf) return AVERROR(ENOMEM); history = s->xll_sample_buf + s->xll_smpl_in_seg * s->xll_channels; for (seg = 0; seg < s->xll_segments; seg++) { unsigned in_channel; for (chset_i = in_channel = 0; chset_i < s->xll_nch_sets; chset_i++) { int end_pos = get_bits_count(gb) + 8 * s->xll_navi.chset_size[0][seg][chset_i]; int i, j; struct coding_params *params = &param_state[chset_i]; int use_seg_state_code_param; XllChSetSubHeader *chset = &s->xll_chsets[chset_i]; if (in_channel >= s->avctx->channels) goto next_chset; if (s->avctx->sample_rate != chset->sampling_frequency) { av_log(s->avctx, AV_LOG_WARNING, "XLL: unexpected chset sample rate %d, expected %d\n", chset->sampling_frequency, s->avctx->sample_rate); goto next_chset; } if (seg != 0) use_seg_state_code_param = get_bits(gb, 1); else use_seg_state_code_param = 0; if (!use_seg_state_code_param) { int num_param_sets, i; unsigned bits4ABIT; params->seg_type = get_bits(gb, 1); num_param_sets = params->seg_type ? 1 : chset->channels; if (chset->bit_width > 16) { bits4ABIT = 5; } else { if (chset->bit_width > 8) bits4ABIT = 4; else bits4ABIT = 3; if (s->xll_nch_sets > 1) bits4ABIT++; } for (i = 0; i < num_param_sets; i++) { params->rice_code_flag[i] = get_bits(gb, 1); if (!params->seg_type && params->rice_code_flag[i] && get_bits(gb, 1)) params->pancAuxABIT[i] = get_bits(gb, bits4ABIT) + 1; else params->pancAuxABIT[i] = 0; } for (i = 0; i < num_param_sets; i++) { if (!seg) { params->pancABIT0[i] = get_bits(gb, bits4ABIT); if (params->rice_code_flag[i] == 0 && params->pancABIT0[i] > 0) params->pancABIT0[i]++; if (params->seg_type == 0) params->nSamplPart0[i] = chset->adapt_order[0][i]; else params->nSamplPart0[i] = chset->adapt_order_max[0]; } else params->nSamplPart0[i] = 0; params->pancABIT[i] = get_bits(gb, bits4ABIT); if (params->rice_code_flag[i] == 0 && params->pancABIT[i] > 0) params->pancABIT[i]++; } } for (i = 0; i < chset->channels; i++) { int param_index = params->seg_type ? 0 : i; int bits = params->pancABIT0[param_index]; int part0 = params->nSamplPart0[param_index]; int *sample_buf = s->xll_sample_buf + (in_channel + i) * s->xll_smpl_in_seg; if (!params->rice_code_flag[param_index]) { if (bits) for (j = 0; j < part0; j++) sample_buf[j] = get_bits_sm(gb, bits); else memset(sample_buf, 0, part0 * sizeof(sample_buf[0])); bits = params->pancABIT[param_index]; if (bits) for (j = part0; j < s->xll_smpl_in_seg; j++) sample_buf[j] = get_bits_sm(gb, bits); else memset(sample_buf + part0, 0, (s->xll_smpl_in_seg - part0) * sizeof(sample_buf[0])); } else { int aux_bits = params->pancAuxABIT[param_index]; for (j = 0; j < part0; j++) { int t = get_unary(gb, 1, 33) << bits; if (bits) t |= get_bits(gb, bits); sample_buf[j] = (t & 1) ? -(t >> 1) - 1 : (t >> 1); } bits = params->pancABIT[param_index]; memset(sample_buf + part0, 0, (s->xll_smpl_in_seg - part0) * sizeof(sample_buf[0])); if (aux_bits > 0) { int count = get_bits(gb, s->xll_log_smpl_in_seg); av_log(s->avctx, AV_LOG_DEBUG, "aux count %d (bits %d)\n", count, s->xll_log_smpl_in_seg); for (j = 0; j < count; j++) sample_buf[get_bits(gb, s->xll_log_smpl_in_seg)] = 1; } for (j = part0; j < s->xll_smpl_in_seg; j++) { if (!sample_buf[j]) { int t = get_unary(gb, 1, 33); if (bits) t = (t << bits) | get_bits(gb, bits); sample_buf[j] = (t & 1) ? -(t >> 1) - 1 : (t >> 1); } else sample_buf[j] = get_bits_sm(gb, aux_bits); } } } for (i = 0; i < chset->channels; i++) { unsigned adapt_order = chset->adapt_order[0][i]; int *sample_buf = s->xll_sample_buf + (in_channel + i) * s->xll_smpl_in_seg; int *prev = history + (in_channel + i) * DCA_XLL_AORDER_MAX; if (!adapt_order) { unsigned order; for (order = chset->fixed_order[0][i]; order > 0; order--) { unsigned j; for (j = 1; j < s->xll_smpl_in_seg; j++) sample_buf[j] += sample_buf[j - 1]; } } else dca_xll_inv_adapt_pred(sample_buf, s->xll_smpl_in_seg, adapt_order, seg ? prev : NULL, chset->lpc_refl_coeffs_q_ind[0][i]); memcpy(prev, sample_buf + s->xll_smpl_in_seg - DCA_XLL_AORDER_MAX, DCA_XLL_AORDER_MAX * sizeof(*prev)); } for (i = 1; i < chset->channels; i += 2) { int coeff = chset->pw_ch_pairs_coeffs[0][i / 2]; if (coeff != 0) { int *sample_buf = s->xll_sample_buf + (in_channel + i) * s->xll_smpl_in_seg; int *prev = sample_buf - s->xll_smpl_in_seg; unsigned j; for (j = 0; j < s->xll_smpl_in_seg; j++) sample_buf[j] += ((int64_t) coeff * prev[j] + 4) >> 3; } } if (s->xll_scalable_lsb) { int lsb_start = end_pos - 8 * chset->lsb_fsize[0] - 8 * (s->xll_banddata_crc & 2); int done; i = get_bits_count(gb); if (i > lsb_start) { av_log(s->avctx, AV_LOG_ERROR, "chset data lsb exceeds NAVI size, end_pos %d, lsb_start %d, pos %d\n", end_pos, lsb_start, i); return AVERROR_INVALIDDATA; } if (i < lsb_start) skip_bits_long(gb, lsb_start - i); for (i = done = 0; i < chset->channels; i++) { int bits = chset->scalable_lsbs[0][i]; if (bits > 0) { unsigned pi = chset->orig_chan_order_inv[0][i]; int *sample_buf = s->xll_sample_buf + (in_channel + pi) * s->xll_smpl_in_seg; int adj = chset->bit_width_adj_per_ch[0][i]; int msb_shift = bits; unsigned j; if (adj > 0) msb_shift += adj - 1; for (j = 0; j < s->xll_smpl_in_seg; j++) sample_buf[j] = (sample_buf[j] << msb_shift) + (get_bits(gb, bits) << adj); done += bits * s->xll_smpl_in_seg; } } if (done > 8 * chset->lsb_fsize[0]) { av_log(s->avctx, AV_LOG_ERROR, "chset lsb exceeds lsb_size\n"); return AVERROR_INVALIDDATA; } } for (i = 0; i < chset->channels; i++) { int *sample_buf = s->xll_sample_buf + (in_channel + i) * s->xll_smpl_in_seg; int shift = 1 - chset->bit_resolution; int out_channel = chset->orig_chan_order[0][i]; float *out; if (chset->ch_mask_enabled && (chset->ch_mask & 7) == 7 && out_channel < 3) out_channel = out_channel ? out_channel - 1 : 2; out_channel += in_channel; if (out_channel >= s->avctx->channels) continue; out = (float *) frame->extended_data[out_channel]; out += seg * s->xll_smpl_in_seg; if ((chset->residual_encode >> i) & 1) { for (j = 0; j < s->xll_smpl_in_seg; j++) out[j] = ldexpf(sample_buf[j], shift); } else { for (j = 0; j < s->xll_smpl_in_seg; j++) out[j] += ldexpf(sample_buf[j], shift); } } if (chset->downmix_coeff_code_embedded && !chset->primary_ch_set && chset->hier_chset) { unsigned mix_channel; for (mix_channel = 0; mix_channel < in_channel; mix_channel++) { float *mix_buf; const int *col; float coeff; unsigned row; if (chset->ch_mask_enabled && (chset->ch_mask & 7) == 7 && mix_channel < 3) mix_buf = (float *) frame->extended_data[mix_channel ? mix_channel - 1 : 2]; else mix_buf = (float *) frame->extended_data[mix_channel]; mix_buf += seg * s->xll_smpl_in_seg; col = &chset->downmix_coeffs[mix_channel * (chset->channels + 1)]; coeff = ldexpf(col[0], -16); for (j = 0; j < s->xll_smpl_in_seg; j++) mix_buf[j] *= coeff; for (row = 0; row < chset->channels && in_channel + row < s->avctx->channels; row++) if (col[row + 1]) { const float *new_channel = (const float *) frame->extended_data[in_channel + row]; new_channel += seg * s->xll_smpl_in_seg; coeff = ldexpf(col[row + 1], -15); for (j = 0; j < s->xll_smpl_in_seg; j++) mix_buf[j] -= coeff * new_channel[j]; } } } next_chset: in_channel += chset->channels; i = get_bits_count(gb); if (i > end_pos) { av_log(s->avctx, AV_LOG_ERROR, "chset data exceeds NAVI size\n"); return AVERROR_INVALIDDATA; } if (i < end_pos) skip_bits_long(gb, end_pos - i); } } return 0; }
1threat
How to stop people from viewing my HTML and CSS : <p>I want to send a link to a client with some work I am doing for them but they are rather informed about IT and that would lead me to think that they know how to copy and paste some HTML and CSS. How would I go about stopping them from seeing the HTML, CSS and JS of the page I want to send them?</p>
0debug
void bdrv_set_boot_sector(BlockDriverState *bs, const uint8_t *data, int size) { bs->boot_sector_enabled = 1; if (size > 512) size = 512; memcpy(bs->boot_sector_data, data, size); memset(bs->boot_sector_data + size, 0, 512 - size); }
1threat
static void handle_sync(DisasContext *s, uint32_t insn, unsigned int op1, unsigned int op2, unsigned int crm) { if (op1 != 3) { unallocated_encoding(s); return; } switch (op2) { case 2: gen_clrex(s, insn); return; case 4: case 5: case 6: return; default: unallocated_encoding(s); return; } }
1threat
How do I center the ActionBar title in Android Studio without creating a custom layout? : I want to center the `ActionBar` title text in my app... What's the easiest way to center this with the default layout for action bars (not a custom layout)? Thanks. Base API for my app is 16. Please don't rate this post down... It's really a simple question.
0debug
static void vnc_write_pixels_generic(VncState *vs, void *pixels1, int size) { uint8_t buf[4]; if (vs->depth == 4) { uint32_t *pixels = pixels1; int n, i; n = size >> 2; for(i = 0; i < n; i++) { vnc_convert_pixel(vs, buf, pixels[i]); vnc_write(vs, buf, vs->pix_bpp); } } else if (vs->depth == 2) { uint16_t *pixels = pixels1; int n, i; n = size >> 1; for(i = 0; i < n; i++) { vnc_convert_pixel(vs, buf, pixels[i]); vnc_write(vs, buf, vs->pix_bpp); } } else if (vs->depth == 1) { uint8_t *pixels = pixels1; int n, i; n = size; for(i = 0; i < n; i++) { vnc_convert_pixel(vs, buf, pixels[i]); vnc_write(vs, buf, vs->pix_bpp); } } else { fprintf(stderr, "vnc_write_pixels_generic: VncState color depth not supported\n"); } }
1threat
static int inc_refcounts(BlockDriverState *bs, BdrvCheckResult *res, uint16_t **refcount_table, int64_t *refcount_table_size, int64_t offset, int64_t size) { BDRVQcowState *s = bs->opaque; uint64_t start, last, cluster_offset, k; int ret; if (size <= 0) { return 0; } start = start_of_cluster(s, offset); last = start_of_cluster(s, offset + size - 1); for(cluster_offset = start; cluster_offset <= last; cluster_offset += s->cluster_size) { k = cluster_offset >> s->cluster_bits; if (k >= *refcount_table_size) { ret = realloc_refcount_array(s, refcount_table, refcount_table_size, k + 1); if (ret < 0) { res->check_errors++; return ret; } } if (++(*refcount_table)[k] == 0) { fprintf(stderr, "ERROR: overflow cluster offset=0x%" PRIx64 "\n", cluster_offset); res->corruptions++; } } return 0; }
1threat
Json Decode Bit2check.com API response : I have API of this site. I wanted to check emails registered on paypal. After supplying email address to the API i get this response. {"Paypal":"Linked"} I just want to grab the "Linked" part. Any help will be appreciated. Thank you
0debug
Owin middleware VS WebAPI DelegatingHandler : <p>I'm reading around articles and checking exmaples and I see Owin Middlewares are used the same as WebAPI DelegatingHandler: logging incoming requests, validating headers and so on. </p> <p>My only understanding is that Owin Middleware comes before DelegatingHandlers in the pipeline. So if you create an Owin middleware for let's say Authorization of users, you're able to deny a forbidden request faster, at a lower level.</p> <p>Is there any difference in the two, or any advantages/disadvantages using either of them? </p>
0debug
how to use the trackpad to scroll in nano using iterm2, the way it works in terminal.app? : <p>I am used to editing in nano, and with terminal.app it's easy to quickly move up and down the file using the scroll gesture. I am trying out iTerm2, but now the scroll gesture just makes iTerm scroll upward in history, the nano work area scrolling off the bottom. in Terminal, scrolling in nano simulates moving the cursor up and down, and results in a nice ability to move through the file. How can I get iTerm2 to do this also?</p>
0debug
Why does std::string_view create a dangling view in a ternary expression? : <p>Consider a method that returns a <code>std::string_view</code> either from a method that returns a <code>const std::string&amp;</code> or from an empty string. To my surprise, writing the method this way results in a dangling string view:</p> <pre><code>const std::string&amp; otherMethod(); std::string_view myMethod(bool bla) { return bla ? otherMethod() : ""; // Dangling view! } </code></pre> <p><a href="https://godbolt.org/z/1Hu_p2" rel="noreferrer">https://godbolt.org/z/1Hu_p2</a></p> <p>It seems that the compiler first puts a temporary <code>std::string</code> copy of the result of <code>otherMethod()</code> on the stack and then returns a view of this temporary copy instead of just returning a view of the reference. First I thought about a comipler bug, but both G++ and clang do this.</p> <p>The fix is easy: Wrapping <code>otherMethod</code> into an explicit construction of <code>string_view</code> solves the issue:</p> <pre><code>std::string_view myMethod(bool bla) { return bla ? std::string_view(otherMethod()) : ""; // Works as intended! } </code></pre> <p><a href="https://godbolt.org/z/Q-sEkr" rel="noreferrer">https://godbolt.org/z/Q-sEkr</a></p> <p>Why is this the case? Why does the original code create an implicit copy without warning?</p>
0debug
static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size, int parse_extradata) { MpegEncContext *const s = &h->s; AVCodecContext *const avctx = s->avctx; H264Context *hx; int buf_index; int context_count; int next_avc; int pass = !(avctx->active_thread_type & FF_THREAD_FRAME); int nals_needed = 0; int nal_index; int idr_cleared=0; int first_slice = 0; h->nal_unit_type= 0; if(!s->slice_context_count) s->slice_context_count= 1; h->max_contexts = s->slice_context_count; if (!(s->flags2 & CODEC_FLAG2_CHUNKS)) { h->current_slice = 0; if (!s->first_field) s->current_picture_ptr = NULL; ff_h264_reset_sei(h); } if (h->nal_length_size == 4) { if (buf_size > 8 && AV_RB32(buf) == 1 && AV_RB32(buf+5) > (unsigned)buf_size) { h->is_avc = 0; }else if(buf_size > 3 && AV_RB32(buf) > 1 && AV_RB32(buf) <= (unsigned)buf_size) h->is_avc = 1; } for (; pass <= 1; pass++) { buf_index = 0; context_count = 0; next_avc = h->is_avc ? 0 : buf_size; nal_index = 0; for (;;) { int consumed; int dst_length; int bit_length; const uint8_t *ptr; int i, nalsize = 0; int err; if (buf_index >= next_avc) { if (buf_index >= buf_size - h->nal_length_size) break; nalsize = 0; for (i = 0; i < h->nal_length_size; i++) nalsize = (nalsize << 8) | buf[buf_index++]; if (nalsize <= 0 || nalsize > buf_size - buf_index) { av_log(h->s.avctx, AV_LOG_ERROR, "AVC: nal size %d\n", nalsize); break; } next_avc = buf_index + nalsize; } else { for (; buf_index + 3 < next_avc; buf_index++) if (buf[buf_index] == 0 && buf[buf_index + 1] == 0 && buf[buf_index + 2] == 1) break; if (buf_index + 3 >= buf_size) { buf_index = buf_size; break; } buf_index += 3; if (buf_index >= next_avc) continue; } hx = h->thread_context[context_count]; ptr = ff_h264_decode_nal(hx, buf + buf_index, &dst_length, &consumed, next_avc - buf_index); if (ptr == NULL || dst_length < 0) { buf_index = -1; goto end; } i = buf_index + consumed; if ((s->workaround_bugs & FF_BUG_AUTODETECT) && i + 3 < next_avc && buf[i] == 0x00 && buf[i + 1] == 0x00 && buf[i + 2] == 0x01 && buf[i + 3] == 0xE0) s->workaround_bugs |= FF_BUG_TRUNCATED; if (!(s->workaround_bugs & FF_BUG_TRUNCATED)) while(dst_length > 0 && ptr[dst_length - 1] == 0) dst_length--; bit_length = !dst_length ? 0 : (8 * dst_length - decode_rbsp_trailing(h, ptr + dst_length - 1)); if (s->avctx->debug & FF_DEBUG_STARTCODE) av_log(h->s.avctx, AV_LOG_DEBUG, "NAL %d/%d at %d/%d length %d pass %d\n", hx->nal_unit_type, hx->nal_ref_idc, buf_index, buf_size, dst_length, pass); if (h->is_avc && (nalsize != consumed) && nalsize) av_log(h->s.avctx, AV_LOG_DEBUG, "AVC: Consumed only %d bytes instead of %d\n", consumed, nalsize); buf_index += consumed; nal_index++; if (pass == 0) { switch (hx->nal_unit_type) { case NAL_SPS: case NAL_PPS: nals_needed = nal_index; break; case NAL_DPA: case NAL_IDR_SLICE: case NAL_SLICE: init_get_bits(&hx->s.gb, ptr, bit_length); if (!get_ue_golomb(&hx->s.gb) || !first_slice) nals_needed = nal_index; if (!first_slice) first_slice = hx->nal_unit_type; } continue; } if (!first_slice) switch (hx->nal_unit_type) { case NAL_DPA: case NAL_IDR_SLICE: case NAL_SLICE: first_slice = hx->nal_unit_type; } if (avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0) continue; again: if (parse_extradata && HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME) && (hx->nal_unit_type != NAL_PPS && hx->nal_unit_type != NAL_SPS)) { av_log(avctx, AV_LOG_INFO, "Ignoring NAL unit %d during " "extradata parsing\n", hx->nal_unit_type); hx->nal_unit_type = NAL_FF_IGNORE; } err = 0; if (h->decoding_extradata) { switch (hx->nal_unit_type) { case NAL_IDR_SLICE: case NAL_SLICE: case NAL_DPA: case NAL_DPB: case NAL_DPC: case NAL_AUXILIARY_SLICE: av_log(h->s.avctx, AV_LOG_WARNING, "Ignoring NAL %d in global header\n", hx->nal_unit_type); hx->nal_unit_type = NAL_FILLER_DATA; } } switch (hx->nal_unit_type) { case NAL_IDR_SLICE: if (first_slice != NAL_IDR_SLICE) { av_log(h->s.avctx, AV_LOG_ERROR, "Invalid mix of idr and non-idr slices\n"); buf_index = -1; goto end; } if(!idr_cleared) idr(h); idr_cleared = 1; case NAL_SLICE: init_get_bits(&hx->s.gb, ptr, bit_length); hx->intra_gb_ptr = hx->inter_gb_ptr = &hx->s.gb; hx->s.data_partitioning = 0; if ((err = decode_slice_header(hx, h))) break; if (h->sei_recovery_frame_cnt >= 0 && (h->frame_num != h->sei_recovery_frame_cnt || hx->slice_type_nos != AV_PICTURE_TYPE_I)) h->valid_recovery_point = 1; if ( h->sei_recovery_frame_cnt >= 0 && ( h->recovery_frame<0 || ((h->recovery_frame - h->frame_num) & ((1 << h->sps.log2_max_frame_num)-1)) > h->sei_recovery_frame_cnt)) { h->recovery_frame = (h->frame_num + h->sei_recovery_frame_cnt) % (1 << h->sps.log2_max_frame_num); if (!h->valid_recovery_point) h->recovery_frame = h->frame_num; } s->current_picture_ptr->f.key_frame |= (hx->nal_unit_type == NAL_IDR_SLICE); if (h->recovery_frame == h->frame_num) { s->current_picture_ptr->sync |= 1; h->recovery_frame = -1; } h->sync |= !!s->current_picture_ptr->f.key_frame; h->sync |= 3*!!(s->flags2 & CODEC_FLAG2_SHOW_ALL); s->current_picture_ptr->sync |= h->sync; if (h->current_slice == 1) { if (!(s->flags2 & CODEC_FLAG2_CHUNKS)) decode_postinit(h, nal_index >= nals_needed); if (s->avctx->hwaccel && s->avctx->hwaccel->start_frame(s->avctx, NULL, 0) < 0) return -1; if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_h264_picture_start(s); } if (hx->redundant_pic_count == 0 && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos != AV_PICTURE_TYPE_B) && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos == AV_PICTURE_TYPE_I) && avctx->skip_frame < AVDISCARD_ALL) { if (avctx->hwaccel) { if (avctx->hwaccel->decode_slice(avctx, &buf[buf_index - consumed], consumed) < 0) return -1; } else if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) { static const uint8_t start_code[] = { 0x00, 0x00, 0x01 }; ff_vdpau_add_data_chunk(s, start_code, sizeof(start_code)); ff_vdpau_add_data_chunk(s, &buf[buf_index - consumed], consumed); } else context_count++; } break; case NAL_DPA: init_get_bits(&hx->s.gb, ptr, bit_length); hx->intra_gb_ptr = hx->inter_gb_ptr = NULL; if ((err = decode_slice_header(hx, h)) < 0) break; hx->s.data_partitioning = 1; break; case NAL_DPB: init_get_bits(&hx->intra_gb, ptr, bit_length); hx->intra_gb_ptr = &hx->intra_gb; break; case NAL_DPC: init_get_bits(&hx->inter_gb, ptr, bit_length); hx->inter_gb_ptr = &hx->inter_gb; av_log(h->s.avctx, AV_LOG_ERROR, "Partitioned H.264 support is incomplete\n"); break; if (hx->redundant_pic_count == 0 && hx->intra_gb_ptr && hx->s.data_partitioning && s->current_picture_ptr && s->context_initialized && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos != AV_PICTURE_TYPE_B) && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos == AV_PICTURE_TYPE_I) && avctx->skip_frame < AVDISCARD_ALL) context_count++; break; case NAL_SEI: init_get_bits(&s->gb, ptr, bit_length); ff_h264_decode_sei(h); break; case NAL_SPS: init_get_bits(&s->gb, ptr, bit_length); if (ff_h264_decode_seq_parameter_set(h) < 0 && (h->is_avc ? (nalsize != consumed) && nalsize : 1)) { av_log(h->s.avctx, AV_LOG_DEBUG, "SPS decoding failure, trying again with the complete NAL\n"); if (h->is_avc) av_assert0(next_avc - buf_index + consumed == nalsize); if ((next_avc - buf_index + consumed - 1) >= INT_MAX/8) break; init_get_bits(&s->gb, &buf[buf_index + 1 - consumed], 8*(next_avc - buf_index + consumed - 1)); ff_h264_decode_seq_parameter_set(h); } break; case NAL_PPS: init_get_bits(&s->gb, ptr, bit_length); ff_h264_decode_picture_parameter_set(h, bit_length); break; case NAL_AUD: case NAL_END_SEQUENCE: case NAL_END_STREAM: case NAL_FILLER_DATA: case NAL_SPS_EXT: case NAL_AUXILIARY_SLICE: break; case NAL_FF_IGNORE: break; default: av_log(avctx, AV_LOG_DEBUG, "Unknown NAL code: %d (%d bits)\n", hx->nal_unit_type, bit_length); } if (context_count == h->max_contexts) { execute_decode_slices(h, context_count); context_count = 0; } if (err < 0) av_log(h->s.avctx, AV_LOG_ERROR, "decode_slice_header error\n"); else if (err == 1) { h->nal_unit_type = hx->nal_unit_type; h->nal_ref_idc = hx->nal_ref_idc; hx = h; goto again; } } } if (context_count) execute_decode_slices(h, context_count); end: if (s->current_picture_ptr && s->current_picture_ptr->owner2 == s && !s->droppable) { ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, s->picture_structure == PICT_BOTTOM_FIELD); } return buf_index; }
1threat
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt) { GetBitContext gb; VimaContext *vima = avctx->priv_data; int16_t pcm_data[2]; uint32_t samples; int8_t channel_hint[2]; int ret, chan, channels = 1; init_get_bits(&gb, pkt->data, pkt->size * 8); if (pkt->size < 13) return AVERROR_INVALIDDATA; samples = get_bits_long(&gb, 32); if (samples == 0xffffffff) { skip_bits_long(&gb, 32); samples = get_bits_long(&gb, 32); } if (samples > pkt->size * 2) return AVERROR_INVALIDDATA; channel_hint[0] = get_sbits(&gb, 8); if (channel_hint[0] & 0x80) { channel_hint[0] = ~channel_hint[0]; channels = 2; } avctx->channels = channels; avctx->channel_layout = (channels == 2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; pcm_data[0] = get_sbits(&gb, 16); if (channels > 1) { channel_hint[1] = get_sbits(&gb, 8); pcm_data[1] = get_sbits(&gb, 16); } vima->frame.nb_samples = samples; if ((ret = avctx->get_buffer(avctx, &vima->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } for (chan = 0; chan < channels; chan++) { uint16_t *dest = (uint16_t*)vima->frame.data[0] + chan; int step_index = channel_hint[chan]; int output = pcm_data[chan]; int sample; for (sample = 0; sample < samples; sample++) { int lookup_size, lookup, highbit, lowbits; step_index = av_clip(step_index, 0, 88); lookup_size = size_table[step_index]; lookup = get_bits(&gb, lookup_size); highbit = 1 << (lookup_size - 1); lowbits = highbit - 1; if (lookup & highbit) lookup ^= highbit; else highbit = 0; if (lookup == lowbits) { output = get_sbits(&gb, 16); } else { int predict_index, diff; predict_index = (lookup << (7 - lookup_size)) | (step_index << 6); predict_index = av_clip(predict_index, 0, 5785); diff = vima->predict_table[predict_index]; if (lookup) diff += ff_adpcm_step_table[step_index] >> (lookup_size - 1); if (highbit) diff = -diff; output = av_clip_int16(output + diff); } *dest = output; dest += channels; step_index += step_index_tables[lookup_size - 2][lookup]; } } *got_frame_ptr = 1; *(AVFrame *)data = vima->frame; return pkt->size; }
1threat
Laravel 5.5 with MySQL 8.0.11: 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER' : <p>I've just installed MySQL <code>8.0.11</code>, transfered my app's database into it and changed the laravel database settings to use the new one. Now everytime I try to login I get the following error:</p> <pre><code>ERROR 1231 (42000): Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER' </code></pre> <p>I tried to set <code>NO_AUTO_CREATE_USER</code> manually:</p> <pre><code>set global sql_mode="..., NO_AUTO_CREATE_USER, ..."; </code></pre> <p>But I get the same error. How could I solve the problem and run laravel <code>5.5</code> with MySQL <code>8.0.11</code>?</p>
0debug
C++ vector default into a members parameters : <p>New to low level coding, coming from php, how do you properly define a member default parameters with a vector ?</p> <pre><code> A(int x = 0, std::string y, std::vector&lt;std::string&gt; z = {0{"ScreenName","ID"}, ... } ){ switch(x){ case 0: CreateNewPlayer(z["ScreenName"], z["ID"]); break; default: /* log function*/ break; } } } </code></pre>
0debug
[Python]Hello I have a error regarding selenium driver : Hello I tried to click on a radio button with the help of selenium driver in python and it does not works . This is HTML CODE : <input aria-flowto="aria8" aria-label="private key" type="radio" ng-model="walletType" value="pasteprivkey" class="ng-pristine ng-valid ng-empty ng-touched" name="200"> This is my line of code : browser.find_elements_by_xpath("input[type='radio'][value='pasteprivkey']").click() And I get this error : [Error][1] [1]: https://i.stack.imgur.com/mxWws.png Someone can help me please ? I also tried to copy xpath with inspect element and I get this weird thing : `/html/body/section[1]/div[1]/main/article[1]/div[2]/wallet-decrypt-drtv/article/section[1]/label[9]/input`
0debug
connecting java application to mysql(wamp) : this is my first post to This blog ..... Well I am trying to make a chat messenger in netbeans with java as front end and mysql in wamp and I'm stuck at point where i want to display the registered users in jTextArea as shown [chat messenger frame][1] [1]: http://i.stack.imgur.com/8PO2c.png Also i want to add that my database is connected to the appication Do tell me if more information is required .....Thank you in advance
0debug
What does enable_testing() do in cmake? : <p>I see that to add my google tests(for my cpp project), I need to make a call to enable_testing() in the root source directory. Can someone explain what this really does? Also why would cmake not make this default?</p> <p>This is all I could get from the documentation.</p> <blockquote> <p>Enables testing for this directory and below. See also the add_test() command. Note that ctest expects to find a test file in the build directory root. Therefore, this command should be in the source directory root.</p> </blockquote>
0debug
Is forward<T> the same as forward<T&&>? : <p>Looking at <a href="https://en.cppreference.com/w/cpp/utility/forward" rel="noreferrer">the documentation for <code>std::forward</code></a>,</p> <pre><code>template&lt; class T &gt; constexpr T&amp;&amp; forward( typename std::remove_reference&lt;T&gt;::type&amp; t ) noexcept; template&lt; class T &gt; constexpr T&amp;&amp; forward( typename std::remove_reference&lt;T&gt;::type&amp;&amp; t ) noexcept; </code></pre> <p>Both functions return <code>T&amp;&amp;</code>, which (correct me if I'm wrong) <a href="https://stackoverflow.com/questions/41360880/why-an-rvalue-reference-is-turned-into-lvalue-reference-by-a-universal-reference">collapses</a> to</p> <ul> <li><code>T&amp;</code> if <code>T</code> is an lvalue reference</li> <li><code>T&amp;&amp;</code> if <code>T</code> is an rvalue reference, or if <code>T</code> is not a reference</li> </ul> <p>For an arbitrary type <code>T</code> which may be a reference, does reference collapsing always cause <code>forward&lt;T&gt;</code> to do the same as <code>forward&lt;T&amp;&amp;&gt;</code>?</p> <p>If so, is there any reason to use <code>forward&lt;T&amp;&amp;&gt;</code>?</p>
0debug
Cant connect to maven central repository : I am trying to do mvn clean install on my new project(because I want to download all dependencies) and I am having problem with it. Failed to execute goal on project Event: Could not resolve dependencies for project com.event:Event:war:1.0-SNAPSHOT: Failed to collect dependencies at org.springframework:spring-context:jar:5.0.0.M3: Failed to read artifact descriptor for org.springframework:spring-context:jar:5.0.0.M3: Could not transfer artifact org.springframework:spring-context:pom:5.0.0.M3 from/to central (https://repo.maven.apache.org/maven2): Connect to 172.16.0.3:8080 [/172.16.0.3] failed: Connection timed out: connect -> I was looking for answer and find that I should check if I am behind some proxy or maybe to specify maven repository or maybe some IDE problem. But I am not behind proxy and my settings.xml dont have any proxy config and I was trying to start mvn clean install from command line so there should not be IDE problems. Also, I am trying to download from central repo so i found that for central repo there should be no problem. Thank you in advance. :) My pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.event</groupId> <artifactId>Event</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>Event Maven Webapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>5.0.0.M3</version> </dependency> </dependencies> <build> <finalName>Event</finalName> </build> </project>
0debug
Hiw to improve MFC fprint writing performance? : I’m writting an MFC GUI program that plots graphs in real time whe it receives new data. It comes 30 data per a second. I’m adding a new fuction where writing a text file using fopen and fprint every time it receives new data. So, it creates 30 new text files per a second. Because of the writting function, the problem is that the program looks pause, not updating the graphs in real-time. when I turn off the writting function, it works well. How can I resolve the problem? I appreciate your help in advance. Thanks!
0debug
Javascript count id element in input field : [Please see the image. I am using jquery. I also write down the correct index][1] [1]: https://i.stack.imgur.com/R8ebF.png
0debug
Google cloud speech api : i am trying to create script in python which converts audio files to text. I found the module google cloud speech which can easily do it for me. I found out that you need to create credentials(api key) for using their services. i tried to create credentials and it said that i have to create a billing account which requires credit card.So, how does it work,is that free, do i have to pay to get my script work?
0debug
How to host material icons offline? : <p>My apologies if this is a very simple question, but how do you use google material icons without a </p> <pre><code>&lt;link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"&gt; </code></pre> <p>?</p> <p>I would like my app to be able to display the icons even when the user does not have an internet connection</p>
0debug
Fail to connect Mongoose to Atlas : <p>I'm always connecting to the "admin" DB, which is a <a href="https://jira.mongodb.org/browse/NODE-1286" rel="noreferrer">fixed bug</a>.</p> <p>Using Mongoose 5.0.6 MongoDb 3.6 and trying to connect to Atlas.</p> <ol> <li>My question, what driver Mongoose 5.0.6 depend on?</li> <li>How can I find out when Mongoose will have that fix?</li> <li>On a different direction, is there a way to connect with MongoDB then use this connection with Mongoose?</li> </ol> <p>Cheers</p>
0debug
static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) { struct video_data *s = s1->priv_data; AVStream *st; int width, height; int res, frame_rate, frame_rate_base; uint32_t desired_format, capabilities; const char *video_device; if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) { av_log(s1, AV_LOG_ERROR, "Missing/Wrong parameters\n"); return -1; } width = ap->width; height = ap->height; frame_rate = ap->time_base.den; frame_rate_base = ap->time_base.num; if((unsigned)width > 32767 || (unsigned)height > 32767) { av_log(s1, AV_LOG_ERROR, "Wrong size %dx%d\n", width, height); return -1; } st = av_new_stream(s1, 0); if (!st) { return -ENOMEM; } av_set_pts_info(st, 64, 1, 1000000); s->width = width; s->height = height; s->frame_rate = frame_rate; s->frame_rate_base = frame_rate_base; video_device = ap->device; if (!video_device) { video_device = "/dev/video"; } capabilities = 0; s->fd = device_open(video_device, &capabilities); if (s->fd < 0) { av_free(st); return AVERROR_IO; } av_log(s1, AV_LOG_ERROR, "[%d]Capabilities: %x\n", s->fd, capabilities); desired_format = fmt_ff2v4l(ap->pix_fmt); if (desired_format == 0 || (device_init(s->fd, &width, &height, desired_format) < 0)) { int i, done; done = 0; i = 0; while (!done) { desired_format = fmt_conversion_table[i].v4l2_fmt; if (device_init(s->fd, &width, &height, desired_format) < 0) { desired_format = 0; i++; } else { done = 1; } if (i == sizeof(fmt_conversion_table) / sizeof(struct fmt_map)) { done = 1; } } } if (desired_format == 0) { av_log(s1, AV_LOG_ERROR, "Cannot find a proper format.\n"); close(s->fd); av_free(st); return AVERROR_IO; } s->frame_format = desired_format; st->codec->pix_fmt = fmt_v4l2ff(desired_format); s->frame_size = avpicture_get_size(st->codec->pix_fmt, width, height); if (capabilities & V4L2_CAP_STREAMING) { s->io_method = io_mmap; res = mmap_init(s); res = mmap_start(s); } else { s->io_method = io_read; res = read_init(s); } if (res < 0) { close(s->fd); av_free(st); return AVERROR_IO; } s->top_field_first = first_field(s->fd); st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_RAWVIDEO; st->codec->width = width; st->codec->height = height; st->codec->time_base.den = frame_rate; st->codec->time_base.num = frame_rate_base; st->codec->bit_rate = s->frame_size * 1/av_q2d(st->codec->time_base) * 8; return 0; }
1threat
def check_Concat(str1,str2): N = len(str1) M = len(str2) if (N % M != 0): return False for i in range(N): if (str1[i] != str2[i % M]): return False return True
0debug
adding a new font in adapter class using " getContext().getAssets() ", crashes my application : public class CustomAdapter extends ArrayAdapter<String> { int images[]; public CustomAdapter(@NonNull Context context, String[] names, int pics[]) { super(context, R.layout.face_list, names); this.images = pics; } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { LayoutInflater myInflater = LayoutInflater.from(getContext()); View listDisplay = myInflater.inflate(R.layout.face_list, parent, false); ImageView face = listDisplay.findViewById(R.id.face); TextView name = listDisplay.findViewById(R.id.name); Typeface chawpFont = Typeface.createFromAsset(listDisplay.getContext().getAssets(),"chawp.tff"); name.setTypeface(chawpFont); String participant_name = (String) getItem(position); int participant_pic = images[position]; face.setImageResource(participant_pic); name.setText(participant_name); return listDisplay; } }
0debug
static void ff_h264_idct8_add4_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ int i; for(i=0; i<16; i+=4){ int nnz = nnzc[ scan8[i] ]; if(nnz){ if(nnz==1 && block[i*16]) ff_h264_idct8_dc_add_mmx2(dst + block_offset[i], block + i*16, stride); else ff_h264_idct8_add_sse2 (dst + block_offset[i], block + i*16, stride); } } }
1threat
What's the use of mapDispatchToProps when we can just use this.props.dispatch to dispatch action : <p>I've been using <code>@connect</code> annotation for some time and decide to switch to <code>mapStateToProps</code> and <code>mapDispatchToProps</code>.</p> <p>I can <code>mapStateToProps</code> to map store to component's props fine but wondering what's the point of <code>mapDispatchToProps</code> when I can just call <code>this.props.dispatch( xxx )</code> anywhere. </p> <p>I also see some react repos and they also do not use <code>mapDispatchToProps</code> </p> <ul> <li><a href="https://github.com/Hashnode/mern-starter" rel="noreferrer">https://github.com/Hashnode/mern-starter</a></li> <li><a href="https://github.com/andrewngu/sound-redux" rel="noreferrer">https://github.com/andrewngu/sound-redux</a></li> </ul> <p>Sorry if it sounds like a beginner question.</p>
0debug
static int transcode(OutputFile *output_files, int nb_output_files, InputFile *input_files, int nb_input_files) { int ret, i; AVFormatContext *is, *os; OutputStream *ost; InputStream *ist; uint8_t *no_packet; int no_packet_count = 0; int64_t timer_start; int key; if (!(no_packet = av_mallocz(nb_input_files))) exit_program(1); ret = transcode_init(output_files, nb_output_files, input_files, nb_input_files); if (ret < 0) goto fail; if (!using_stdin) { av_log(NULL, AV_LOG_INFO, "Press [q] to stop, [?] for help\n"); } timer_start = av_gettime(); for (; received_sigterm == 0;) { int file_index, ist_index; AVPacket pkt; int64_t ipts_min; double opts_min; int64_t cur_time= av_gettime(); ipts_min = INT64_MAX; opts_min = 1e100; if (!using_stdin) { static int64_t last_time; if (received_nb_signals) break; if(cur_time - last_time >= 100000 && !run_as_daemon){ key = read_key(); last_time = cur_time; }else key = -1; if (key == 'q') break; if (key == '+') av_log_set_level(av_log_get_level()+10); if (key == '-') av_log_set_level(av_log_get_level()-10); if (key == 's') qp_hist ^= 1; if (key == 'h'){ if (do_hex_dump){ do_hex_dump = do_pkt_dump = 0; } else if(do_pkt_dump){ do_hex_dump = 1; } else do_pkt_dump = 1; av_log_set_level(AV_LOG_DEBUG); } #if CONFIG_AVFILTER if (key == 'c' || key == 'C'){ char buf[4096], target[64], command[256], arg[256] = {0}; double time; int k, n = 0; fprintf(stderr, "\nEnter command: <target> <time> <command>[ <argument>]\n"); i = 0; while ((k = read_key()) != '\n' && k != '\r' && i < sizeof(buf)-1) if (k > 0) buf[i++] = k; buf[i] = 0; if (k > 0 && (n = sscanf(buf, "%63[^ ] %lf %255[^ ] %255[^\n]", target, &time, command, arg)) >= 3) { av_log(NULL, AV_LOG_DEBUG, "Processing command target:%s time:%f command:%s arg:%s", target, time, command, arg); for (i = 0; i < nb_output_streams; i++) { ost = &output_streams[i]; if (ost->graph) { if (time < 0) { ret = avfilter_graph_send_command(ost->graph, target, command, arg, buf, sizeof(buf), key == 'c' ? AVFILTER_CMD_FLAG_ONE : 0); fprintf(stderr, "Command reply for stream %d: ret:%d res:%s\n", i, ret, buf); } else { ret = avfilter_graph_queue_command(ost->graph, target, command, arg, 0, time); } } } } else { av_log(NULL, AV_LOG_ERROR, "Parse error, at least 3 arguments were expected, " "only %d given in string '%s'\n", n, buf); } } #endif if (key == 'd' || key == 'D'){ int debug=0; if(key == 'D') { debug = input_streams[0].st->codec->debug<<1; if(!debug) debug = 1; while(debug & (FF_DEBUG_DCT_COEFF|FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) debug += debug; }else if(scanf("%d", &debug)!=1) fprintf(stderr,"error parsing debug value\n"); for(i=0;i<nb_input_streams;i++) { input_streams[i].st->codec->debug = debug; } for(i=0;i<nb_output_streams;i++) { ost = &output_streams[i]; ost->st->codec->debug = debug; } if(debug) av_log_set_level(AV_LOG_DEBUG); fprintf(stderr,"debug=%d\n", debug); } if (key == '?'){ fprintf(stderr, "key function\n" "? show this help\n" "+ increase verbosity\n" "- decrease verbosity\n" "c Send command to filtergraph\n" "D cycle through available debug modes\n" "h dump packets/hex press to cycle through the 3 states\n" "q quit\n" "s Show QP histogram\n" ); } } file_index = -1; for (i = 0; i < nb_output_streams; i++) { OutputFile *of; int64_t ipts; double opts; ost = &output_streams[i]; of = &output_files[ost->file_index]; os = output_files[ost->file_index].ctx; ist = &input_streams[ost->source_index]; if (ost->is_past_recording_time || no_packet[ist->file_index] || (os->pb && avio_tell(os->pb) >= of->limit_filesize)) continue; opts = ost->st->pts.val * av_q2d(ost->st->time_base); ipts = ist->pts; if (!input_files[ist->file_index].eof_reached) { if (ipts < ipts_min) { ipts_min = ipts; if (input_sync) file_index = ist->file_index; } if (opts < opts_min) { opts_min = opts; if (!input_sync) file_index = ist->file_index; } } if (ost->frame_number >= ost->max_frames) { int j; for (j = 0; j < of->ctx->nb_streams; j++) output_streams[of->ost_index + j].is_past_recording_time = 1; continue; } } if (file_index < 0) { if (no_packet_count) { no_packet_count = 0; memset(no_packet, 0, nb_input_files); usleep(10000); continue; } break; } is = input_files[file_index].ctx; ret = av_read_frame(is, &pkt); if (ret == AVERROR(EAGAIN)) { no_packet[file_index] = 1; no_packet_count++; continue; } if (ret < 0) { input_files[file_index].eof_reached = 1; if (opt_shortest) break; else continue; } no_packet_count = 0; memset(no_packet, 0, nb_input_files); if (do_pkt_dump) { av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump, is->streams[pkt.stream_index]); } if (pkt.stream_index >= input_files[file_index].nb_streams) goto discard_packet; ist_index = input_files[file_index].ist_index + pkt.stream_index; ist = &input_streams[ist_index]; if (ist->discard) goto discard_packet; if (pkt.dts != AV_NOPTS_VALUE) pkt.dts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base); if (pkt.pts != AV_NOPTS_VALUE) pkt.pts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base); if (pkt.pts != AV_NOPTS_VALUE) pkt.pts *= ist->ts_scale; if (pkt.dts != AV_NOPTS_VALUE) pkt.dts *= ist->ts_scale; if (pkt.dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE && (is->iformat->flags & AVFMT_TS_DISCONT)) { int64_t pkt_dts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q); int64_t delta = pkt_dts - ist->next_dts; if((delta < -1LL*dts_delta_threshold*AV_TIME_BASE || (delta > 1LL*dts_delta_threshold*AV_TIME_BASE && ist->st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) || pkt_dts+1<ist->pts)&& !copy_ts){ input_files[ist->file_index].ts_offset -= delta; av_log(NULL, AV_LOG_DEBUG, "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n", delta, input_files[ist->file_index].ts_offset); pkt.dts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); if (pkt.pts != AV_NOPTS_VALUE) pkt.pts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); } } if (output_packet(ist, output_streams, nb_output_streams, &pkt) < 0) { av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d\n", ist->file_index, ist->st->index); if (exit_on_error) exit_program(1); av_free_packet(&pkt); continue; } discard_packet: av_free_packet(&pkt); print_report(output_files, output_streams, nb_output_streams, 0, timer_start, cur_time); } for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->decoding_needed) { output_packet(ist, output_streams, nb_output_streams, NULL); } } flush_encoders(output_streams, nb_output_streams); term_exit(); for (i = 0; i < nb_output_files; i++) { os = output_files[i].ctx; av_write_trailer(os); } print_report(output_files, output_streams, nb_output_streams, 1, timer_start, av_gettime()); for (i = 0; i < nb_output_streams; i++) { ost = &output_streams[i]; if (ost->encoding_needed) { av_freep(&ost->st->codec->stats_in); avcodec_close(ost->st->codec); } #if CONFIG_AVFILTER avfilter_graph_free(&ost->graph); #endif } for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->decoding_needed) { avcodec_close(ist->st->codec); } } ret = 0; fail: av_freep(&no_packet); if (output_streams) { for (i = 0; i < nb_output_streams; i++) { ost = &output_streams[i]; if (ost) { if (ost->stream_copy) av_freep(&ost->st->codec->extradata); if (ost->logfile) { fclose(ost->logfile); ost->logfile = NULL; } av_fifo_free(ost->fifo); av_freep(&ost->st->codec->subtitle_header); av_free(ost->resample_frame.data[0]); av_free(ost->forced_kf_pts); if (ost->video_resample) sws_freeContext(ost->img_resample_ctx); swr_free(&ost->swr); av_dict_free(&ost->opts); } } } return ret; }
1threat
`Authorization Token has expired` issue AWS-CLI on MacOS Sierra : <p>I'm trying to push a docker image to the AWS ECR repository using the aws-cli.</p> <ul> <li>I just run the <code>get-login</code> command</li> <li>execute the output (which returns <code>login succeeded</code>) </li> <li>then try to push a docker image then I get the message:<br> <code>denied: Your Authorization Token has expired. Please run 'aws ecr get-login' to fetch a new one.</code></li> </ul> <p>I don't know whats going wrong, I'm pushing to the right repo, the time on my mac is correct. This was working before, but since I reinstalled my mac and upgraded to macOS Sierra it's not working anymore, so probably related to that.</p> <p>My <code>aws --version</code> output:</p> <p><code>aws-cli/1.11.34 Python/2.7.10 Darwin/16.3.0 botocore/1.4.91</code></p> <p>The complete output of the commands I run:</p> <pre><code>$ aws ecr get-login --region eu-west-1 docker login -u AWS -p AQECAHh....b6Wk -e none https://1234567890.dkr.ecr.eu-west-1.amazonaws.com $ docker login -u AWS -p AQECAHh....b6Wk -e none https://1234567890.dkr.ecr.eu-west-1.amazonaws.com Flag --email has been deprecated, will be removed in 1.13. Login Succeeded $ docker push 1234567890.dkr.ecr.eu-west-1.amazonaws.com/service-web:latest The push refers to a repository [1234567890.dkr.ecr.eu-west-1.amazonaws.com/service-web] c1f87971dfa9: Preparing 2eb644aea3de: Preparing 9c8843ffe48e: Preparing 39bb58d049d4: Preparing f053bc969599: Preparing 7169084246b8: Waiting bb134a1936fd: Waiting 184e76848a1c: Waiting 75c8fcf65748: Waiting eb9b9ee1ea58: Waiting f4bf35723edd: Waiting ddffe1a64b3c: Waiting fd1a1154db16: Waiting b542e946067a: Waiting d49ed2a5e1ed: Waiting bb39b980367a: Waiting 25b8358d062f: Waiting 997eee521fc7: Waiting 50b5447183a8: Waiting 4339b5cb0e1d: Waiting 3dbd4a53b21b: Waiting 2bec16216500: Waiting b9fd8e264df6: Waiting b6ca02dfe5e6: Waiting denied: Your Authorization Token has expired. Please run 'aws ecr get-login' to fetch a new one. </code></pre>
0debug
Click function now working as when called from a function : I had function as below being called when I click on a radio button "foo" and it works as expected when I clicked $("#foo").live("click",function() { if ($('input:radio[name=foo]:checked').val() == 'foo') { $.each(oneArray, function(key,value){ $("#foo1").append($("<option></option>") .attr("value",key) .text(value)); }); $.each(twoArray, function(key,value){ $("#foo2").append($("<option></option>") .attr("value",key) .text(value)); }); } }); But it didn't worked when i did the following checkFoo(){ $("#foo").click(); } Please correct me if I am doing anything wrong .
0debug
how to get rid of NaN value in R : <p>I have a variable in R. I am going to do PCA analysis. but I have a lot of NaN values. do you guys know how to get rid of them?</p> <p>my data looks like this:</p> <pre><code> 11819 11820 11821 s1 1.1547005 NaN 1.1547005 s2 -0.5773503 NaN -0.5773503 s4 -0.5773503 NaN -0.5773503 </code></pre> <p>11819, 11820 and 11821 are col names and s1, s2 and s4 are row names. thanks</p>
0debug
static void set_algorythm( OPL_CH *CH) { INT32 *carrier = &outd[0]; CH->connect1 = CH->CON ? carrier : &feedback2; CH->connect2 = carrier; }
1threat
What do you use Apache Kafka for? : <p>I would like to ask if my understanding of Kafka is correct.</p> <p>For really really big data stream, conventional database is not adequate so people use things such as Hadoop or Storm. Kafka sits on top of said databases and provide ...directions where the real time data should go?</p>
0debug
Is there a merge/comparison tool like VisualStudio but for the Mac? : <p>I would like to find a tool like VisualStudio but for the Mac. Specifically what I need is to be able to go "back in time" in Git repos to perform side by side file comparisons of code. I know with VS you can do this, is there anything out there for the Mac that will do the same thing? I'm writing in Ruby on Rails if that makes a difference.</p>
0debug
awk or sed: how to modify based on previous and next lines : <p>I have a file like below</p> <pre><code>* jhasjdhjh sample1 * oioieoirer sample2 * jsdhfjhdf * ppppppp sample3 * iouiuiouo </code></pre> <p>I want it to be</p> <pre><code>* jhasjdhjh * sample * oioieoirer * sampel2 * jsdhfjhdf * ppppppp * sample3 * iouiuiouo </code></pre> <p>So sample1, sample2 we want to add <code>*</code> (space asteric space) since the above line and below line have <code>*</code> (asteric space)</p> <p>sample3 we want to add * (5 spaces and asteric) because the previous line has (space and asteric)</p> <p>So I have to check the previous line and the next line based on their asteric and then i have to decide what to put on the current line.</p>
0debug
int audio_available(void) { #ifdef HAS_AUDIO return 1; #else return 0; #endif }
1threat
static int vmdk_write_compressed(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors) { BDRVVmdkState *s = bs->opaque; if (s->num_extents == 1 && s->extents[0].compressed) { Coroutine *co; AioContext *aio_context = bdrv_get_aio_context(bs); VmdkWriteCompressedCo data = { .bs = bs, .sector_num = sector_num, .buf = buf, .nb_sectors = nb_sectors, .ret = -EINPROGRESS, }; co = qemu_coroutine_create(vmdk_co_write_compressed); qemu_coroutine_enter(co, &data); while (data.ret == -EINPROGRESS) { aio_poll(aio_context, true); } return data.ret; } else { return -ENOTSUP; } }
1threat
Sort Divs by ID's name with JQuery : I'm having a strange error here, I'm trying to sort divs by its ID's name. You can take a look here: `https://jsfiddle.net/veeco/t3wu9tss/3/` It looks works... but we're wrong... if we add new ID like the example here: `https://jsfiddle.net/veeco/t3wu9tss/4/` The sort got broken. I don't know why ? it seem strange, can anyone give insight ? Thanks
0debug
PostgreSQL Hint: You will need to rewrite or cast the expression. column "state" is of type status but expression is of type character varying : <p>I am trying to create a SQL statement using java. The problem is I am using</p> <pre><code> stmt.setString(9, ev.getState().status()); </code></pre> <p>for a variable I am trying to insert into a SQL column of type status </p> <pre><code> CREATE TYPE STATUS AS ENUM ('APPROVED', 'CLOSED','STARTED', 'WAITING'); </code></pre> <p>It is throwing me an exception of </p> <pre><code>column "state" is of type status but expression is of type character varying Hint: You will need to rewrite or cast the expression. </code></pre> <p>Did I make a mistake or do I actually need to cast the value in sql? If yes, how does one cast in this situation?</p> <p>Full Statement:</p> <pre><code> PreparedStatement stmt = conn.prepareStatement("INSERT INTO Event (EventNum, EventName, startHour, endHour, startMin, endMin, startDate, endDate, State, depName) VALUES (?, ?, ?, ?, ?, ?, ?::date, ?::date, ?, ?)"); stmt.setInt(1, ev.getEventNum()); stmt.setString(2, ev.getName()); stmt.setInt(3, ev.getStartHour()); stmt.setInt(4, ev.getEndHour()); stmt.setInt(5, ev.getStartMinute()); stmt.setInt(6, ev.getEndMinute()); stmt.setString(7, ev.getStartYear() + "-" + ev.getStartMonth() + "-" + ev.getStartDate()); stmt.setString(8, ev.getEndYear() + "-" + ev.getEndMonth() + "-" + ev.getEndDate()); stmt.setString(9, ev.getState().status()); stmt.setString(10, ev.getDepartment()); stmt.executeUpdate(); </code></pre>
0debug
How to write a LocalDate list to a file in java? : <p>I'm trying to write a LocalDate list to an output file, i've got <code>List&lt;LocalDate&gt; fechas</code> but when i try this code:</p> <pre><code>FileWriter writer = new FileWriter("output.txt"); for(LocalDate str: fechas) { writer.write(str); } writer.close(); </code></pre> <p>it doesn't compile</p>
0debug
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat