problem
stringlengths
26
131k
labels
class label
2 classes
Splitting a string arrays into two different arrays : <p>It's required to split each string from networkList array into <code>addresses</code> and <code>ports</code> arrays.</p> <pre><code>string[] networkList = { "127.0.0.1:8000", "127.0.0.1:8888", "8.8.8.8:80" }; string[] addresses, ports; </code></pre> <p>I'm really sorry of asking so dumby question, but I couldn't find a good function to do this. I know there are few that could help.</p>
0debug
Do I cast the result of new? : In the answers to the question https://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc was covered that I do not need and should not cast the returned `void` pointer of `malloc()`. But how is it about the `new` operator in C++? _____________________________ Is there an explicit reason to do: ```` int *p_rt = new int; ```` instead of ```` int *p_rt = (*int) new int; ```` Or can I do the cast?
0debug
SwiftUI @State var initialization issue : <p>I would like to initialise the value of an <code>@State</code> var in SwiftUI trough the <code>init()</code> method of a <code>Struct</code>, so it can take the proper text from a prepared dictionary for manipulation purposes in a TextField. The source code looks like this:</p> <pre><code>struct StateFromOutside: View { let list = [ "a": "Letter A", "b": "Letter B", // ... ] @State var fullText: String = "" init(letter: String) { self.fullText = list[letter]! } var body: some View { TextField($fullText) } } </code></pre> <p>Unfortunately the execution fails with the error <code>Thread 1: Fatal error: Accessing State&lt;String&gt; outside View.body</code></p> <p>How can I resolve the situation? Thank you very much in advance!</p>
0debug
def Extract(lst): return [item[0] for item in lst]
0debug
BrowserRouter vs Router with history.push() : <p>I am trying to understand the difference between <code>BrowserRouter</code> and <code>Router</code> of the <code>react-router-dom</code> (v5) package and what difference it makes for my example below.</p> <p>The documentation says:</p> <blockquote> <p><strong>BrowserRouter</strong> A that uses the HTML5 history API (pushState, replaceState and the popstate event) to keep your UI in sync with the URL.</p> </blockquote> <p>Source: <a href="https://reacttraining.com/react-router/web/api/BrowserRouter" rel="noreferrer">https://reacttraining.com/react-router/web/api/BrowserRouter</a></p> <blockquote> <p><strong>Router</strong> The common low-level interface for all router components. Typically apps will use one of the high-level routers instead: BrowserRouter, HashRouter, MemoryRouter, NativeRouter, StaticRouter</p> </blockquote> <p>Source: <a href="https://reacttraining.com/react-router/web/api/Router" rel="noreferrer">https://reacttraining.com/react-router/web/api/Router</a></p> <p>From what I understand is that I should be using <strong>BrowserRouter</strong> for my HTML5 browser apps and I have been doing this so far.</p> <p><strong>history.push(...) example:</strong></p> <p>I am trying to perform a <code>history.push('/myNewRoute')</code> within a thunk:</p> <pre class="lang-js prettyprint-override"><code>import history as './history'; ... export function someAsyncAction(input) { return dispatch =&gt; { fetch(`${API_URL}/someUrl`, { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify({ input }), }).then(() =&gt; { history.push('/myNewRoute'); }).catch((err) =&gt; { dispatch(setError(err)); }) }; }; </code></pre> <p><code>history</code> is defined as this module:</p> <pre class="lang-js prettyprint-override"><code>import { createBrowserHistory } from 'history'; export default createBrowserHistory(); </code></pre> <p>and the <code>history</code> is also passed to my router:</p> <pre class="lang-js prettyprint-override"><code>import { BrowserRouter as Router } from 'react-router-dom'; import history as './history'; ... const App = () =&gt; ( &lt;Router history={history}&gt; ... &lt;/Router&gt; ); </code></pre> <p><strong>Problem:</strong> <code>history.push()</code> will update the URL in the browser bar but not render the component behind the route.</p> <p>If I import <code>Router</code> instead of <code>BrowserRouter</code>, it works:</p> <pre class="lang-js prettyprint-override"><code>// Does not work: import { BrowserRouter as Router } from 'react-router-dom'; // Does work: import { Router } from 'react-router-dom'; </code></pre>
0debug
how to generate apk file from source in my app programmatically : I have a project to create app like apk creator lite.I want to know How can I create apk file from my android app using java programmatically.I have search alot about this But could not found any straight forward way. basically task is that I have required Apk Name,Icon Url,WebView Url and Version in editText Now I want to create apk from my app as user provided input Data. Please Help me it's urgent <3 :(. I am very confused about it :(
0debug
Android Studio com.google.wireless.android.sdk.stats.IntellijIndexingStats : <p>I having a problem building my android project.</p> <p>I somehow ended up with this exception and i cant figure out what it is.</p> <pre><code>Error:Internal error: (java.lang.ClassNotFoundException) com.google.wireless.android.sdk.stats.IntellijIndexingStats$Index java.lang.ClassNotFoundException: com.google.wireless.android.sdk.stats.IntellijIndexingStats$Index at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at com.intellij.util.indexing.counters.IndexCounters.&lt;clinit&gt;(IndexCounters.java:34) at com.intellij.util.indexing.impl.MapReduceIndex.&lt;init&gt;(MapReduceIndex.java:85) at org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex$CompilerMapReduceIndex.&lt;init&gt;(CompilerReferenceIndex.java:232) at org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex.&lt;init&gt;(CompilerReferenceIndex.java:79) at org.jetbrains.jps.backwardRefs.JavaCompilerBackwardReferenceIndex.&lt;init&gt;(JavaCompilerBackwardReferenceIndex.java:12) at org.jetbrains.jps.backwardRefs.JavaBackwardReferenceIndexWriter.initialize(JavaBackwardReferenceIndexWriter.java:79) at org.jetbrains.jps.incremental.java.JavaBuilder.buildStarted(JavaBuilder.java:148) at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:363) at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178) at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:139) at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:302) at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:135) at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:228) at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) </code></pre> <p>Im running <code>android studio 3.5</code> as i read that it should have solved the problem but im still gitting it.</p>
0debug
Pyspark dataframe LIKE operator : <p>What is the equivalent in Pyspark for LIKE operator? For example I would like to do:</p> <pre><code>SELECT * FROM table WHERE column LIKE "*somestring*"; </code></pre> <p>looking for something easy like this (but this is not working):</p> <pre><code>df.select('column').where(col('column').like("*s*")).show() </code></pre>
0debug
how to add tooltip(image )in javafx : How to add tooltip (i button in image) in javafx.[![enter image description here][1]][1] [1]: http://i.stack.imgur.com/gNKQq.png
0debug
iOS different constraints for different devices : <p>I have a ViewController designed for iPhone SE</p> <p><a href="https://i.stack.imgur.com/smK62.png" rel="noreferrer"><img src="https://i.stack.imgur.com/smK62.png" alt="enter image description here"></a></p> <p>As you can see I also have a constraint <code>Align Top to: Safe Area Equals 75</code></p> <p>The question is, is it possible to change this value for iPhone 8 and iPhone 8 Plus? For example:</p> <ul> <li>SE = 75 </li> <li>8 = 85 </li> <li>8 Plus = 105</li> </ul>
0debug
void ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) { void (*filter_samples)(AVFilterLink *, AVFilterBufferRef *); AVFilterPad *dst = link->dstpad; FF_DPRINTF_START(NULL, filter_samples); ff_dlog_link(NULL, link, 1); if (!(filter_samples = dst->filter_samples)) filter_samples = ff_default_filter_samples; if ((dst->min_perms & samplesref->perms) != dst->min_perms || dst->rej_perms & samplesref->perms) { int i, planar = av_sample_fmt_is_planar(samplesref->format); int planes = !planar ? 1: av_get_channel_layout_nb_channels(samplesref->audio->channel_layout); av_log(link->dst, AV_LOG_DEBUG, "Copying audio data in avfilter (have perms %x, need %x, reject %x)\n", samplesref->perms, link->dstpad->min_perms, link->dstpad->rej_perms); link->cur_buf = ff_default_get_audio_buffer(link, dst->min_perms, samplesref->audio->nb_samples); link->cur_buf->pts = samplesref->pts; link->cur_buf->audio->sample_rate = samplesref->audio->sample_rate; for (i = 0; i < planes; i++) memcpy(link->cur_buf->extended_data[i], samplesref->extended_data[i], samplesref->linesize[0]); avfilter_unref_buffer(samplesref); } else link->cur_buf = samplesref; filter_samples(link, link->cur_buf); }
1threat
Uncaught TypeError: Cannot read property 'top' of undefined while tray to click send button : I apologize if this question has already been answered. I've tried to search for solutions but could not find any that suited my code. I'm still new to jQuery. I have many different of castigators on my website while trying to add new ad post [here is the link][1] All other category work fine, Except: Category: Job » IT / telecom / computers when i tray to send i get an error: [Google chrome console log][2] Can someone tell me whats wrong? [1]: https://yala.xyz/add/ [2]: https://i.stack.imgur.com/bLivu.png
0debug
static int bmp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AVFrame *p = data; unsigned int fsize, hsize; int width, height; unsigned int depth; BiCompression comp; unsigned int ihsize; int i, j, n, linesize, ret; uint32_t rgb[3] = {0}; uint32_t alpha = 0; uint8_t *ptr; int dsize; const uint8_t *buf0 = buf; GetByteContext gb; if (buf_size < 14) { av_log(avctx, AV_LOG_ERROR, "buf size too small (%d)\n", buf_size); return AVERROR_INVALIDDATA; } if (bytestream_get_byte(&buf) != 'B' || bytestream_get_byte(&buf) != 'M') { av_log(avctx, AV_LOG_ERROR, "bad magic number\n"); return AVERROR_INVALIDDATA; } fsize = bytestream_get_le32(&buf); if (buf_size < fsize) { av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %u), trying to decode anyway\n", buf_size, fsize); fsize = buf_size; } buf += 2; buf += 2; hsize = bytestream_get_le32(&buf); ihsize = bytestream_get_le32(&buf); if (ihsize + 14LL > hsize) { av_log(avctx, AV_LOG_ERROR, "invalid header size %u\n", hsize); return AVERROR_INVALIDDATA; } if (fsize == 14 || fsize == ihsize + 14) fsize = buf_size - 2; if (fsize <= hsize) { av_log(avctx, AV_LOG_ERROR, "Declared file size is less than header size (%u < %u)\n", fsize, hsize); return AVERROR_INVALIDDATA; } switch (ihsize) { case 40: case 56: v3 case 64: case 108: v4 case 124: v5 width = bytestream_get_le32(&buf); height = bytestream_get_le32(&buf); break; case 12: width = bytestream_get_le16(&buf); height = bytestream_get_le16(&buf); break; default: avpriv_report_missing_feature(avctx, "Information header size %u", ihsize); return AVERROR_PATCHWELCOME; } if (bytestream_get_le16(&buf) != 1) { av_log(avctx, AV_LOG_ERROR, "invalid BMP header\n"); return AVERROR_INVALIDDATA; } depth = bytestream_get_le16(&buf); if (ihsize >= 40) comp = bytestream_get_le32(&buf); else comp = BMP_RGB; if (comp != BMP_RGB && comp != BMP_BITFIELDS && comp != BMP_RLE4 && comp != BMP_RLE8) { av_log(avctx, AV_LOG_ERROR, "BMP coding %d not supported\n", comp); return AVERROR_INVALIDDATA; } if (comp == BMP_BITFIELDS) { buf += 20; rgb[0] = bytestream_get_le32(&buf); rgb[1] = bytestream_get_le32(&buf); rgb[2] = bytestream_get_le32(&buf); if (ihsize > 40) alpha = bytestream_get_le32(&buf); } avctx->width = width; avctx->height = height > 0 ? height : -(unsigned)height; avctx->pix_fmt = AV_PIX_FMT_NONE; switch (depth) { case 32: if (comp == BMP_BITFIELDS) { if (rgb[0] == 0xFF000000 && rgb[1] == 0x00FF0000 && rgb[2] == 0x0000FF00) avctx->pix_fmt = alpha ? AV_PIX_FMT_ABGR : AV_PIX_FMT_0BGR; else if (rgb[0] == 0x00FF0000 && rgb[1] == 0x0000FF00 && rgb[2] == 0x000000FF) avctx->pix_fmt = alpha ? AV_PIX_FMT_BGRA : AV_PIX_FMT_BGR0; else if (rgb[0] == 0x0000FF00 && rgb[1] == 0x00FF0000 && rgb[2] == 0xFF000000) avctx->pix_fmt = alpha ? AV_PIX_FMT_ARGB : AV_PIX_FMT_0RGB; else if (rgb[0] == 0x000000FF && rgb[1] == 0x0000FF00 && rgb[2] == 0x00FF0000) avctx->pix_fmt = alpha ? AV_PIX_FMT_RGBA : AV_PIX_FMT_RGB0; else { av_log(avctx, AV_LOG_ERROR, "Unknown bitfields " "%0"PRIX32" %0"PRIX32" %0"PRIX32"\n", rgb[0], rgb[1], rgb[2]); return AVERROR(EINVAL); } } else { avctx->pix_fmt = AV_PIX_FMT_BGRA; } break; case 24: avctx->pix_fmt = AV_PIX_FMT_BGR24; break; case 16: if (comp == BMP_RGB) avctx->pix_fmt = AV_PIX_FMT_RGB555; else if (comp == BMP_BITFIELDS) { if (rgb[0] == 0xF800 && rgb[1] == 0x07E0 && rgb[2] == 0x001F) avctx->pix_fmt = AV_PIX_FMT_RGB565; else if (rgb[0] == 0x7C00 && rgb[1] == 0x03E0 && rgb[2] == 0x001F) avctx->pix_fmt = AV_PIX_FMT_RGB555; else if (rgb[0] == 0x0F00 && rgb[1] == 0x00F0 && rgb[2] == 0x000F) avctx->pix_fmt = AV_PIX_FMT_RGB444; else { av_log(avctx, AV_LOG_ERROR, "Unknown bitfields %0"PRIX32" %0"PRIX32" %0"PRIX32"\n", rgb[0], rgb[1], rgb[2]); return AVERROR(EINVAL); } } break; case 8: if (hsize - ihsize - 14 > 0) avctx->pix_fmt = AV_PIX_FMT_PAL8; else avctx->pix_fmt = AV_PIX_FMT_GRAY8; break; case 1: case 4: if (hsize - ihsize - 14 > 0) { avctx->pix_fmt = AV_PIX_FMT_PAL8; } else { av_log(avctx, AV_LOG_ERROR, "Unknown palette for %u-colour BMP\n", 1 << depth); return AVERROR_INVALIDDATA; } break; default: av_log(avctx, AV_LOG_ERROR, "depth %u not supported\n", depth); return AVERROR_INVALIDDATA; } if (avctx->pix_fmt == AV_PIX_FMT_NONE) { av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n"); return AVERROR_INVALIDDATA; } if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; buf = buf0 + hsize; dsize = buf_size - hsize; n = ((avctx->width * depth + 31) / 8) & ~3; if (n * avctx->height > dsize && comp != BMP_RLE4 && comp != BMP_RLE8) { n = (avctx->width * depth + 7) / 8; if (n * avctx->height > dsize) { av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d)\n", dsize, n * avctx->height); return AVERROR_INVALIDDATA; } av_log(avctx, AV_LOG_ERROR, "data size too small, assuming missing line alignment\n"); } if (comp == BMP_RLE4 || comp == BMP_RLE8) memset(p->data[0], 0, avctx->height * p->linesize[0]); if (height > 0) { ptr = p->data[0] + (avctx->height - 1) * p->linesize[0]; linesize = -p->linesize[0]; } else { ptr = p->data[0]; linesize = p->linesize[0]; } if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { int colors = 1 << depth; memset(p->data[1], 0, 1024); if (ihsize >= 36) { int t; buf = buf0 + 46; t = bytestream_get_le32(&buf); if (t < 0 || t > (1 << depth)) { av_log(avctx, AV_LOG_ERROR, "Incorrect number of colors - %X for bitdepth %u\n", t, depth); } else if (t) { colors = t; } } else { colors = FFMIN(256, (hsize-ihsize-14) / 3); } buf = buf0 + 14 + ihsize; if ((hsize-ihsize-14) < (colors << 2)) { if ((hsize-ihsize-14) < colors * 3) { av_log(avctx, AV_LOG_ERROR, "palette doesn't fit in packet\n"); return AVERROR_INVALIDDATA; } for (i = 0; i < colors; i++) ((uint32_t*)p->data[1])[i] = (0xFFU<<24) | bytestream_get_le24(&buf); } else { for (i = 0; i < colors; i++) ((uint32_t*)p->data[1])[i] = 0xFFU << 24 | bytestream_get_le32(&buf); } buf = buf0 + hsize; } if (comp == BMP_RLE4 || comp == BMP_RLE8) { if (comp == BMP_RLE8 && height < 0) { p->data[0] += p->linesize[0] * (avctx->height - 1); p->linesize[0] = -p->linesize[0]; } bytestream2_init(&gb, buf, dsize); ff_msrle_decode(avctx, p, depth, &gb); if (height < 0) { p->data[0] += p->linesize[0] * (avctx->height - 1); p->linesize[0] = -p->linesize[0]; } } else { switch (depth) { case 1: for (i = 0; i < avctx->height; i++) { int j; for (j = 0; j < n; j++) { ptr[j*8+0] = buf[j] >> 7; ptr[j*8+1] = (buf[j] >> 6) & 1; ptr[j*8+2] = (buf[j] >> 5) & 1; ptr[j*8+3] = (buf[j] >> 4) & 1; ptr[j*8+4] = (buf[j] >> 3) & 1; ptr[j*8+5] = (buf[j] >> 2) & 1; ptr[j*8+6] = (buf[j] >> 1) & 1; ptr[j*8+7] = buf[j] & 1; } buf += n; ptr += linesize; } break; case 8: case 24: case 32: for (i = 0; i < avctx->height; i++) { memcpy(ptr, buf, n); buf += n; ptr += linesize; } break; case 4: for (i = 0; i < avctx->height; i++) { int j; for (j = 0; j < n; j++) { ptr[j*2+0] = (buf[j] >> 4) & 0xF; ptr[j*2+1] = buf[j] & 0xF; } buf += n; ptr += linesize; } break; case 16: for (i = 0; i < avctx->height; i++) { const uint16_t *src = (const uint16_t *) buf; uint16_t *dst = (uint16_t *) ptr; for (j = 0; j < avctx->width; j++) *dst++ = av_le2ne16(*src++); buf += n; ptr += linesize; } break; default: av_log(avctx, AV_LOG_ERROR, "BMP decoder is broken\n"); return AVERROR_INVALIDDATA; } } if (avctx->pix_fmt == AV_PIX_FMT_BGRA) { for (i = 0; i < avctx->height; i++) { int j; uint8_t *ptr = p->data[0] + p->linesize[0]*i + 3; for (j = 0; j < avctx->width; j++) { if (ptr[4*j]) break; } if (j < avctx->width) break; } if (i == avctx->height) avctx->pix_fmt = p->format = AV_PIX_FMT_BGR0; } *got_frame = 1; return buf_size; }
1threat
int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) { int i, ret; Picture *pic; s->mb_skipped = 0; if (!ff_thread_can_start_frame(avctx)) { av_log(avctx, AV_LOG_ERROR, "Attempt to start a frame outside SETUP state\n"); return -1; } if (s->pict_type != AV_PICTURE_TYPE_B && s->last_picture_ptr && s->last_picture_ptr != s->next_picture_ptr && s->last_picture_ptr->f->buf[0]) { ff_mpeg_unref_picture(s, s->last_picture_ptr); } for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (&s->picture[i] != s->last_picture_ptr && &s->picture[i] != s->next_picture_ptr && s->picture[i].reference && !s->picture[i].needs_realloc) { if (!(avctx->active_thread_type & FF_THREAD_FRAME)) av_log(avctx, AV_LOG_ERROR, "releasing zombie picture\n"); ff_mpeg_unref_picture(s, &s->picture[i]); } } ff_mpeg_unref_picture(s, &s->current_picture); release_unused_pictures(s); if (s->current_picture_ptr && s->current_picture_ptr->f->buf[0] == NULL) { pic = s->current_picture_ptr; } else { i = ff_find_unused_picture(s, 0); if (i < 0) { av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n"); return i; } pic = &s->picture[i]; } pic->reference = 0; if (!s->droppable) { if (s->pict_type != AV_PICTURE_TYPE_B) pic->reference = 3; } pic->f->coded_picture_number = s->coded_picture_number++; if (ff_alloc_picture(s, pic, 0) < 0) return -1; s->current_picture_ptr = pic; s->current_picture_ptr->f->top_field_first = s->top_field_first; if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO || s->codec_id == AV_CODEC_ID_MPEG2VIDEO) { if (s->picture_structure != PICT_FRAME) s->current_picture_ptr->f->top_field_first = (s->picture_structure == PICT_TOP_FIELD) == s->first_field; } s->current_picture_ptr->f->interlaced_frame = !s->progressive_frame && !s->progressive_sequence; s->current_picture_ptr->field_picture = s->picture_structure != PICT_FRAME; s->current_picture_ptr->f->pict_type = s->pict_type; s->current_picture_ptr->f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; if ((ret = ff_mpeg_ref_picture(s, &s->current_picture, s->current_picture_ptr)) < 0) return ret; if (s->pict_type != AV_PICTURE_TYPE_B) { s->last_picture_ptr = s->next_picture_ptr; if (!s->droppable) s->next_picture_ptr = s->current_picture_ptr; } av_dlog(s->avctx, "L%p N%p C%p L%p N%p C%p type:%d drop:%d\n", s->last_picture_ptr, s->next_picture_ptr,s->current_picture_ptr, s->last_picture_ptr ? s->last_picture_ptr->f->data[0] : NULL, s->next_picture_ptr ? s->next_picture_ptr->f->data[0] : NULL, s->current_picture_ptr ? s->current_picture_ptr->f->data[0] : NULL, s->pict_type, s->droppable); if ((s->last_picture_ptr == NULL || s->last_picture_ptr->f->buf[0] == NULL) && (s->pict_type != AV_PICTURE_TYPE_I || s->picture_structure != PICT_FRAME)) { int h_chroma_shift, v_chroma_shift; av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); if (s->pict_type == AV_PICTURE_TYPE_B && s->next_picture_ptr && s->next_picture_ptr->f->buf[0]) av_log(avctx, AV_LOG_DEBUG, "allocating dummy last picture for B frame\n"); else if (s->pict_type != AV_PICTURE_TYPE_I) av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n"); else if (s->picture_structure != PICT_FRAME) av_log(avctx, AV_LOG_DEBUG, "allocate dummy last picture for field based first keyframe\n"); i = ff_find_unused_picture(s, 0); if (i < 0) { av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n"); return i; } s->last_picture_ptr = &s->picture[i]; s->last_picture_ptr->reference = 3; s->last_picture_ptr->f->key_frame = 0; s->last_picture_ptr->f->pict_type = AV_PICTURE_TYPE_P; if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 0) { s->last_picture_ptr = NULL; return -1; } if (!avctx->hwaccel) { for(i=0; i<avctx->height; i++) memset(s->last_picture_ptr->f->data[0] + s->last_picture_ptr->f->linesize[0]*i, 0x80, avctx->width); for(i=0; i<FF_CEIL_RSHIFT(avctx->height, v_chroma_shift); i++) { memset(s->last_picture_ptr->f->data[1] + s->last_picture_ptr->f->linesize[1]*i, 0x80, FF_CEIL_RSHIFT(avctx->width, h_chroma_shift)); memset(s->last_picture_ptr->f->data[2] + s->last_picture_ptr->f->linesize[2]*i, 0x80, FF_CEIL_RSHIFT(avctx->width, h_chroma_shift)); } if(s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == AV_CODEC_ID_H263){ for(i=0; i<avctx->height; i++) memset(s->last_picture_ptr->f->data[0] + s->last_picture_ptr->f->linesize[0]*i, 16, avctx->width); } } ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 0); ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 1); } if ((s->next_picture_ptr == NULL || s->next_picture_ptr->f->buf[0] == NULL) && s->pict_type == AV_PICTURE_TYPE_B) { i = ff_find_unused_picture(s, 0); if (i < 0) { av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n"); return i; } s->next_picture_ptr = &s->picture[i]; s->next_picture_ptr->reference = 3; s->next_picture_ptr->f->key_frame = 0; s->next_picture_ptr->f->pict_type = AV_PICTURE_TYPE_P; if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) { s->next_picture_ptr = NULL; return -1; } ff_thread_report_progress(&s->next_picture_ptr->tf, INT_MAX, 0); ff_thread_report_progress(&s->next_picture_ptr->tf, INT_MAX, 1); } #if 0 memset(s->last_picture.f->data, 0, sizeof(s->last_picture.f->data)); memset(s->next_picture.f->data, 0, sizeof(s->next_picture.f->data)); #endif if (s->last_picture_ptr) { ff_mpeg_unref_picture(s, &s->last_picture); if (s->last_picture_ptr->f->buf[0] && (ret = ff_mpeg_ref_picture(s, &s->last_picture, s->last_picture_ptr)) < 0) return ret; } if (s->next_picture_ptr) { ff_mpeg_unref_picture(s, &s->next_picture); if (s->next_picture_ptr->f->buf[0] && (ret = ff_mpeg_ref_picture(s, &s->next_picture, s->next_picture_ptr)) < 0) return ret; } av_assert0(s->pict_type == AV_PICTURE_TYPE_I || (s->last_picture_ptr && s->last_picture_ptr->f->buf[0])); if (s->picture_structure!= PICT_FRAME) { int i; for (i = 0; i < 4; i++) { if (s->picture_structure == PICT_BOTTOM_FIELD) { s->current_picture.f->data[i] += s->current_picture.f->linesize[i]; } s->current_picture.f->linesize[i] *= 2; s->last_picture.f->linesize[i] *= 2; s->next_picture.f->linesize[i] *= 2; } } s->err_recognition = avctx->err_recognition; if (s->mpeg_quant || s->codec_id == AV_CODEC_ID_MPEG2VIDEO) { s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra; s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter; } else if (s->out_format == FMT_H263 || s->out_format == FMT_H261) { s->dct_unquantize_intra = s->dct_unquantize_h263_intra; s->dct_unquantize_inter = s->dct_unquantize_h263_inter; } else { s->dct_unquantize_intra = s->dct_unquantize_mpeg1_intra; s->dct_unquantize_inter = s->dct_unquantize_mpeg1_inter; } return 0; }
1threat
static void mirror_complete(BlockJob *job, Error **errp) { MirrorBlockJob *s = container_of(job, MirrorBlockJob, common); Error *local_err = NULL; int ret; ret = bdrv_open_backing_file(s->target, NULL, &local_err); if (ret < 0) { error_propagate(errp, local_err); return; } if (!s->synced) { error_setg(errp, QERR_BLOCK_JOB_NOT_READY, bdrv_get_device_name(job->bs)); return; } if (s->replaces) { AioContext *replace_aio_context; s->to_replace = check_to_replace_node(s->replaces, &local_err); if (!s->to_replace) { error_propagate(errp, local_err); return; } replace_aio_context = bdrv_get_aio_context(s->to_replace); aio_context_acquire(replace_aio_context); error_setg(&s->replace_blocker, "block device is in use by block-job-complete"); bdrv_op_block_all(s->to_replace, s->replace_blocker); bdrv_ref(s->to_replace); aio_context_release(replace_aio_context); } s->should_complete = true; block_job_enter(&s->common); }
1threat
Coordinator layout with nested scrolling not working for add more than 12 grids ? : I am using the below link example material grid for create the app [http://www.viralandroid.com/2016/05/android-material-design-gridview.html][1] all of them works perfectly , but i am added more than 12 grids means its not scrolling its stuck with that. Its one scrolls upto 12th grid not more than grid will be shows How can i solve can any one guide me.. [1]: http://www.viralandroid.com/2016/05/android-material-design-gridview.html
0debug
how to check if today is between two dates in Twig? : <p>I'd like to check if today's date is between two dates from the database. Here's my code.</p> <pre><code>{% if today &lt; room.price_start_date and today &gt; room.price_end_date %} &lt;a href="{{'/'|app}}/book/{{room.id}}"&gt;&lt;button type="button" class="btn btn-default btn-xs"&gt;Book this room&lt;/button&gt;&lt;/a&gt; {% else %} &lt;a href="{{'/'|app}}/contact"&gt;&lt;button type="button" class="btn btn-default btn-xs"&gt;Book this room&lt;/button&gt;&lt;/a&gt; {% endif %} </code></pre> <p>The <code>today</code> variable gets its value from this code:</p> <pre><code>$todayDate = date('Y-m-d'); $this['today'] = date('Y-m-d', strtotime($todayDate)); </code></pre> <p>The <code>price_start_date</code> and <code>price_end_date</code> I get them from database and their columns' type is <code>Date</code></p> <p>Any idea how to check if <code>today</code> is between <code>room.price_start_date</code> and <code>room.price_end_date</code> in Twig?</p>
0debug
Type conversion in C (demotion) : <p>Can someone please explain this: "When the destination is some form of unsigned integer and the assigned value is an integer, the extra bits that make the value too big are ignored." I'm not getting what "destination type" and assigned value mean.</p>
0debug
React-Native Offline Bundle - Images not showing : <p>I have a React-Native app I'm trying to deploy in Release mode to my phone. I can bundle the app to the phone. Database, Video and audio assets are all in there but no images are showing in the UI. </p> <p>I have done the following to 'bundle' my app:</p> <ol> <li>in the project folder in Terminal run <code>react-native bundle --platfrom ios --dev false --entry-file index.ios.js --bundle-output main.jsbundle</code></li> <li>Drag the reference to the <code>main.jsbundle</code> file into XCode under <code>myapp</code> folder</li> <li>In XCode, open <code>AppDelegate.m</code> and uncomment <code>jsCodeLocation = [[NSBundle mainBundle]…</code></li> <li>Open <code>Product &gt; Scheme &gt; Edit Scheme</code> then change <code>Build Configuration</code> to <code>Release</code></li> <li>Select <code>myapp</code> under the project navigator and then: under <code>TARGETS: myappTests</code> > <code>Build Phases</code> > <code>Link Binary With Libraries</code> press <code>+</code> select <code>Workspace</code> > <code>libReact.a</code> and <code>Add</code></li> </ol> <p>When I try and compile in XCode with the <code>../node_modules/react-native/packager/react-native-xcode.sh</code> setting in <code>myapp &gt; targets &gt; myapp &gt; Bundle React Native code and images</code> it fails with <code>error code 1</code>. </p> <p>I've seen LOADS of posts on this and I've tried:</p> <ul> <li>to check <code>Run script only when installing</code>- the app then installs but with no images</li> <li>adding <code>source ~/.bash_profile</code> to react-native-xcode.sh - the app build fails</li> </ul> <p>Any help would be greatly appreciated! </p>
0debug
i can't understand this piece of code. kindly any one help me for meaning of this piece of code. what is done bye this code : public static function is_isegment_nz_nc($string) { return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string); }
0debug
static void do_audio_out(AVFormatContext *s, AVOutputStream *ost, AVInputStream *ist, unsigned char *buf, int size) { uint8_t *buftmp; int64_t audio_out_size, audio_buf_size; int64_t allocated_for_size= size; int size_out, frame_bytes, ret; AVCodecContext *enc= ost->st->codec; AVCodecContext *dec= ist->st->codec; int osize= av_get_bits_per_sample_format(enc->sample_fmt)/8; int isize= av_get_bits_per_sample_format(dec->sample_fmt)/8; const int coded_bps = av_get_bits_per_sample(enc->codec->id); need_realloc: audio_buf_size= (allocated_for_size + isize*dec->channels - 1) / (isize*dec->channels); audio_buf_size= (audio_buf_size*enc->sample_rate + dec->sample_rate) / dec->sample_rate; audio_buf_size= audio_buf_size*2 + 10000; audio_buf_size= FFMAX(audio_buf_size, enc->frame_size); audio_buf_size*= osize*enc->channels; audio_out_size= FFMAX(audio_buf_size, enc->frame_size * osize * enc->channels); if(coded_bps > 8*osize) audio_out_size= audio_out_size * coded_bps / (8*osize); audio_out_size += FF_MIN_BUFFER_SIZE; if(audio_out_size > INT_MAX || audio_buf_size > INT_MAX){ fprintf(stderr, "Buffer sizes too large\n"); ffmpeg_exit(1); } av_fast_malloc(&audio_buf, &allocated_audio_buf_size, audio_buf_size); av_fast_malloc(&audio_out, &allocated_audio_out_size, audio_out_size); if (!audio_buf || !audio_out){ fprintf(stderr, "Out of memory in do_audio_out\n"); ffmpeg_exit(1); } if (enc->channels != dec->channels) ost->audio_resample = 1; if (ost->audio_resample && !ost->resample) { if (dec->sample_fmt != SAMPLE_FMT_S16) fprintf(stderr, "Warning, using s16 intermediate sample format for resampling\n"); ost->resample = av_audio_resample_init(enc->channels, dec->channels, enc->sample_rate, dec->sample_rate, enc->sample_fmt, dec->sample_fmt, 16, 10, 0, 0.8); if (!ost->resample) { fprintf(stderr, "Can not resample %d channels @ %d Hz to %d channels @ %d Hz\n", dec->channels, dec->sample_rate, enc->channels, enc->sample_rate); ffmpeg_exit(1); } } #define MAKE_SFMT_PAIR(a,b) ((a)+SAMPLE_FMT_NB*(b)) if (!ost->audio_resample && dec->sample_fmt!=enc->sample_fmt && MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt)!=ost->reformat_pair) { if (ost->reformat_ctx) av_audio_convert_free(ost->reformat_ctx); ost->reformat_ctx = av_audio_convert_alloc(enc->sample_fmt, 1, dec->sample_fmt, 1, NULL, 0); if (!ost->reformat_ctx) { fprintf(stderr, "Cannot convert %s sample format to %s sample format\n", avcodec_get_sample_fmt_name(dec->sample_fmt), avcodec_get_sample_fmt_name(enc->sample_fmt)); ffmpeg_exit(1); } ost->reformat_pair=MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt); } if(audio_sync_method){ double delta = get_sync_ipts(ost) * enc->sample_rate - ost->sync_opts - av_fifo_size(ost->fifo)/(enc->channels * 2); double idelta= delta*dec->sample_rate / enc->sample_rate; int byte_delta= ((int)idelta)*2*dec->channels; if(fabs(delta) > 50){ if(ist->is_start || fabs(delta) > audio_drift_threshold*enc->sample_rate){ if(byte_delta < 0){ byte_delta= FFMAX(byte_delta, -size); size += byte_delta; buf -= byte_delta; if(verbose > 2) fprintf(stderr, "discarding %d audio samples\n", (int)-delta); if(!size) return; ist->is_start=0; }else{ static uint8_t *input_tmp= NULL; input_tmp= av_realloc(input_tmp, byte_delta + size); if(byte_delta > allocated_for_size - size){ allocated_for_size= byte_delta + (int64_t)size; goto need_realloc; } ist->is_start=0; memset(input_tmp, 0, byte_delta); memcpy(input_tmp + byte_delta, buf, size); buf= input_tmp; size += byte_delta; if(verbose > 2) fprintf(stderr, "adding %d audio samples of silence\n", (int)delta); } }else if(audio_sync_method>1){ int comp= av_clip(delta, -audio_sync_method, audio_sync_method); assert(ost->audio_resample); if(verbose > 2) fprintf(stderr, "compensating audio timestamp drift:%f compensation:%d in:%d\n", delta, comp, enc->sample_rate); av_resample_compensate(*(struct AVResampleContext**)ost->resample, comp, enc->sample_rate); } } }else ost->sync_opts= lrintf(get_sync_ipts(ost) * enc->sample_rate) - av_fifo_size(ost->fifo)/(enc->channels * 2); if (ost->audio_resample) { buftmp = audio_buf; size_out = audio_resample(ost->resample, (short *)buftmp, (short *)buf, size / (dec->channels * isize)); size_out = size_out * enc->channels * osize; } else { buftmp = buf; size_out = size; } if (!ost->audio_resample && dec->sample_fmt!=enc->sample_fmt) { const void *ibuf[6]= {buftmp}; void *obuf[6]= {audio_buf}; int istride[6]= {isize}; int ostride[6]= {osize}; int len= size_out/istride[0]; if (av_audio_convert(ost->reformat_ctx, obuf, ostride, ibuf, istride, len)<0) { printf("av_audio_convert() failed\n"); if (exit_on_error) ffmpeg_exit(1); return; } buftmp = audio_buf; size_out = len*osize; } if (enc->frame_size > 1) { if (av_fifo_realloc2(ost->fifo, av_fifo_size(ost->fifo) + size_out) < 0) { fprintf(stderr, "av_fifo_realloc2() failed\n"); ffmpeg_exit(1); } av_fifo_generic_write(ost->fifo, buftmp, size_out, NULL); frame_bytes = enc->frame_size * osize * enc->channels; while (av_fifo_size(ost->fifo) >= frame_bytes) { AVPacket pkt; av_init_packet(&pkt); av_fifo_generic_read(ost->fifo, audio_buf, frame_bytes, NULL); ret = avcodec_encode_audio(enc, audio_out, audio_out_size, (short *)audio_buf); if (ret < 0) { fprintf(stderr, "Audio encoding failed\n"); ffmpeg_exit(1); } audio_size += ret; pkt.stream_index= ost->index; pkt.data= audio_out; pkt.size= ret; if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); pkt.flags |= AV_PKT_FLAG_KEY; write_frame(s, &pkt, enc, bitstream_filters[ost->file_index][pkt.stream_index]); ost->sync_opts += enc->frame_size; } } else { AVPacket pkt; av_init_packet(&pkt); ost->sync_opts += size_out / (osize * enc->channels); size_out /= osize; if (coded_bps) size_out = size_out*coded_bps/8; if(size_out > audio_out_size){ fprintf(stderr, "Internal error, buffer size too small\n"); ffmpeg_exit(1); } ret = avcodec_encode_audio(enc, audio_out, size_out, (short *)buftmp); if (ret < 0) { fprintf(stderr, "Audio encoding failed\n"); ffmpeg_exit(1); } audio_size += ret; pkt.stream_index= ost->index; pkt.data= audio_out; pkt.size= ret; if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); pkt.flags |= AV_PKT_FLAG_KEY; write_frame(s, &pkt, enc, bitstream_filters[ost->file_index][pkt.stream_index]); } }
1threat
int monitor_read_block_device_key(Monitor *mon, const char *device, BlockCompletionFunc *completion_cb, void *opaque) { Error *err = NULL; BlockBackend *blk; blk = blk_by_name(device); if (!blk) { monitor_printf(mon, "Device not found %s\n", device); return -1; } if (!blk_bs(blk)) { monitor_printf(mon, "Device '%s' has no medium\n", device); return -1; } bdrv_add_key(blk_bs(blk), NULL, &err); if (err) { error_free(err); return monitor_read_bdrv_key_start(mon, blk_bs(blk), completion_cb, opaque); } if (completion_cb) { completion_cb(opaque, 0); } return 0; }
1threat
Angular 4, convert http response observable to object observable : <p>I'm new to the concepts of observables and need some help with a conversion.<br> I have a service which returns an <code>Observable&lt;Response&gt;</code> from a Http request, but I need to convert it do an <code>Observable&lt;PriceTag&gt;</code> to use it on a <code>DataSource</code> inside the connect method.<br> Is there anyway to do this?</p> <p>This is the method from my service:</p> <pre><code>getPriceTags(): Observable&lt;Response&gt; { // Set the request headers const headers = new Headers({ 'Content-Type': 'application/json' }); // Returns the request observable return this.http.post(Constants.WEBSERVICE_ADDRESS + "/priceTag", null, {headers: headers}); } </code></pre> <p>And here is the DataSource class where I need to return it as an <code>Observable&lt;PriceTag&gt;</code>:</p> <pre><code>export class PriceTagDataSource extends DataSource&lt;PriceTag&gt; { constructor (private priceTagService: PriceTagService) { super(); } connect(): Observable&lt;PriceTag&gt; { // Here I retrieve the Observable&lt;Response&gt; from my service const respObs = this.priceTagService.getPriceTags(); // Now I need to return a Observable&lt;PriceTag&gt; } disconnect() {} } </code></pre> <p>Here's an example from the response from my request:</p> <pre><code>{ // This object is used to check if the query on the server was sucessful "query": { "sucessful": true }, // These are my PriceTags "tags": [ { "id": "1", "name": "MAIN" }, { "id": "2", "name": "CARD" } ] } </code></pre>
0debug
Mailing code giving an error : <p>I am new to php &amp; have tried out some code in php for sending mail to user by some simple means, i am facing some issues as code giving a error..!! please help me.</p> <p><strong>php</strong></p> <pre><code>$to = ' '". $_SESSION['email'] ."' '; $subject = 'Your vault number'; $message = 'Your vault number is '". $_SESSION['vault_no'] ."' '; $headers = 'From: innovation@miisky.com' . "\r\n" . 'Reply-To: innovation@miisky.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); </code></pre>
0debug
autoComplete TextField in iOS using Objective C : I want to implement autoComplete TextField in my app using Objective C, I have a SQLite table in my app, so i want to search names of user by their initial and display while user types in textField. Please help me.
0debug
How to display local image in markdown : <p>I try the following in markdown, but seems doesn't work, anyone know how to display a local image in markdown ? I don't want to setup a webserver for that. Thanks</p> <pre><code>![image](files/Users/jzhang/Desktop/Isolated.png) </code></pre>
0debug
What programming language would I need to create a sign in and login form? : <p>What programming language would I need to create a sign in and login form? Can I use only php to do that? I'm new to this area. So, any link referring to the procedure would be helpful.</p> <p>Thanks in advance.</p>
0debug
static void pc_compat_2_0(MachineState *machine) { smbios_legacy_mode = true; has_reserved_memory = false; }
1threat
static int dirac_unpack_prediction_parameters(DiracContext *s) { static const uint8_t default_blen[] = { 4, 12, 16, 24 }; static const uint8_t default_bsep[] = { 4, 8, 12, 16 }; GetBitContext *gb = &s->gb; unsigned idx, ref; align_get_bits(gb); idx = svq3_get_ue_golomb(gb); if (idx > 4) { av_log(s->avctx, AV_LOG_ERROR, "Block prediction index too high\n"); return -1; } if (idx == 0) { s->plane[0].xblen = svq3_get_ue_golomb(gb); s->plane[0].yblen = svq3_get_ue_golomb(gb); s->plane[0].xbsep = svq3_get_ue_golomb(gb); s->plane[0].ybsep = svq3_get_ue_golomb(gb); } else { s->plane[0].xblen = default_blen[idx-1]; s->plane[0].yblen = default_blen[idx-1]; s->plane[0].xbsep = default_bsep[idx-1]; s->plane[0].ybsep = default_bsep[idx-1]; } if (s->plane[0].xbsep < s->plane[0].xblen/2 || s->plane[0].ybsep < s->plane[0].yblen/2) { av_log(s->avctx, AV_LOG_ERROR, "Block separation too small\n"); return -1; } if (s->plane[0].xbsep > s->plane[0].xblen || s->plane[0].ybsep > s->plane[0].yblen) { av_log(s->avctx, AV_LOG_ERROR, "Block seperation greater than size\n"); return -1; } if (FFMAX(s->plane[0].xblen, s->plane[0].yblen) > MAX_BLOCKSIZE) { av_log(s->avctx, AV_LOG_ERROR, "Unsupported large block size\n"); return -1; } s->mv_precision = svq3_get_ue_golomb(gb); if (s->mv_precision > 3) { av_log(s->avctx, AV_LOG_ERROR, "MV precision finer than eighth-pel\n"); return -1; } s->globalmc_flag = get_bits1(gb); if (s->globalmc_flag) { memset(s->globalmc, 0, sizeof(s->globalmc)); for (ref = 0; ref < s->num_refs; ref++) { if (get_bits1(gb)) { s->globalmc[ref].pan_tilt[0] = dirac_get_se_golomb(gb); s->globalmc[ref].pan_tilt[1] = dirac_get_se_golomb(gb); } if (get_bits1(gb)) { s->globalmc[ref].zrs_exp = svq3_get_ue_golomb(gb); s->globalmc[ref].zrs[0][0] = dirac_get_se_golomb(gb); s->globalmc[ref].zrs[0][1] = dirac_get_se_golomb(gb); s->globalmc[ref].zrs[1][0] = dirac_get_se_golomb(gb); s->globalmc[ref].zrs[1][1] = dirac_get_se_golomb(gb); } else { s->globalmc[ref].zrs[0][0] = 1; s->globalmc[ref].zrs[1][1] = 1; } if (get_bits1(gb)) { s->globalmc[ref].perspective_exp = svq3_get_ue_golomb(gb); s->globalmc[ref].perspective[0] = dirac_get_se_golomb(gb); s->globalmc[ref].perspective[1] = dirac_get_se_golomb(gb); } } } if (svq3_get_ue_golomb(gb)) { av_log(s->avctx, AV_LOG_ERROR, "Unknown picture prediction mode\n"); return -1; } s->weight_log2denom = 1; s->weight[0] = 1; s->weight[1] = 1; if (get_bits1(gb)) { s->weight_log2denom = svq3_get_ue_golomb(gb); s->weight[0] = dirac_get_se_golomb(gb); if (s->num_refs == 2) s->weight[1] = dirac_get_se_golomb(gb); } return 0; }
1threat
static void nvdimm_dsm_set_label_data(NVDIMMDevice *nvdimm, NvdimmDsmIn *in, hwaddr dsm_mem_addr) { NVDIMMClass *nvc = NVDIMM_GET_CLASS(nvdimm); NvdimmFuncSetLabelDataIn *set_label_data; uint32_t status; set_label_data = (NvdimmFuncSetLabelDataIn *)in->arg3; le32_to_cpus(&set_label_data->offset); le32_to_cpus(&set_label_data->length); nvdimm_debug("Write Label Data: offset %#x length %#x.\n", set_label_data->offset, set_label_data->length); status = nvdimm_rw_label_data_check(nvdimm, set_label_data->offset, set_label_data->length); if (status != 0 ) { nvdimm_dsm_no_payload(status, dsm_mem_addr); return; } assert(offsetof(NvdimmDsmIn, arg3) + sizeof(*set_label_data) + set_label_data->length <= 4096); nvc->write_label_data(nvdimm, set_label_data->in_buf, set_label_data->length, set_label_data->offset); nvdimm_dsm_no_payload(0 , dsm_mem_addr); }
1threat
Call class to add two numbers in Java : <p>I just started Java and have no idea how to call the class and use the correct variables. I have a Calculator.java file where I have methods to read 2 int , add them or multiply them. (paste them at the end)</p> <p>Calculator.java</p> <pre><code>class Calculator { int x; int y; public setNumbers(int x, int y) { System.out.print("Input the first number: "); return x = in.nextInt(); System.out.print("Input the second number: "); return y = in.nextInt(); } public addNumbers(){ return x + y; } public multiplyNumbers(){ return x * y; } } </code></pre> <p>CalculatorApp.java</p> <pre><code>class CalculatorApp extends Calculator { public int pr() { return pr(); } public static void main(String[] args) { int choice; System.out.println("Please choose one of the following options: \n[1] - Set numbers \n[2] - Add Numbers \n[3] - Multiply numbers \nYour choice is: "); choice = in.nextInt(); switch (choice) { case 1: setNumbers(); break; case 2: addNumbers(); break; case 3: multiplyNumbers(); break; } } } </code></pre> <p>Errors:</p> <pre><code> .\Calculator.java:6: error: invalid method declaration; return type required public setNumbers(int x, int y) { ^ .\Calculator.java:15: error: invalid method declaration; return type required public addNumbers(){ ^ .\Calculator.java:21: error: invalid method declaration; return type required public multiplyNumbers(){ ^ .\Calculator.java:9: error: incompatible types: unexpected return value return x = in.nextInt(); ^ .\Calculator.java:9: error: cannot find symbol return x = in.nextInt(); ^ symbol: variable in location: class Calculator .\Calculator.java:11: error: incompatible types: unexpected return value return y = in.nextInt(); ^ .\Calculator.java:11: error: cannot find symbol return y = in.nextInt(); ^ symbol: variable in location: class Calculator .\Calculator.java:17: error: incompatible types: unexpected return value return x + y; ^ .\Calculator.java:23: error: incompatible types: unexpected return value return x * y; ^ CalculatorApp.java:12: error: cannot find symbol choice = in.nextInt(); ^ symbol: variable in location: class CalculatorApp CalculatorApp.java:16: error: cannot find symbol case 1: setNumbers(); ^ symbol: method setNumbers() location: class CalculatorApp CalculatorApp.java:19: error: cannot find symbol case 2: addNumbers(); ^ symbol: method addNumbers() location: class CalculatorApp CalculatorApp.java:22: error: cannot find symbol case 3: multiplyNumbers(); ^ symbol: method multiplyNumbers() location: class CalculatorApp 13 errors </code></pre>
0debug
static QEMUFile *qemu_fopen_bdrv(BlockDriverState *bs, int64_t offset, int is_writable) { QEMUFile *f; f = qemu_mallocz(sizeof(QEMUFile)); if (!f) return NULL; f->is_file = 0; f->bs = bs; f->is_writable = is_writable; f->base_offset = offset; return f; }
1threat
How to declare a 3-Dimensional Array with very big size in C? : <p>I'm trying to create a 3 Dimensional array <strong>S[ ][ ][ ]</strong>...</p> <p>when the size is small for example:</p> <pre><code> m=40; int S[m][m][m]; memset(S, 0, sizeof(S[1][1][1])*m * m * m); //initialize all the array with 0// for (i=1 ; i&lt;=m ; i++ ) { k=1; for (j=1 ; j&lt;=n ; j++ ) { if(statement) { //if statment true i put in S array a value// S[i][i][k]=j; k++;} </code></pre> <p>it works fine(for small size like S[ 40 ][ 40 ][ 40 ]... When the size is big, for example:</p> <pre><code> m=1500; int S[m][m][m]; memset(S, 0, sizeof(S[1][1][1])*m * m * m); .... .... </code></pre> <p>My program stop working probably for memory usage or something like, that i don't know for sure...Any idea?</p> <p>Thanks.</p>
0debug
Linux chat server with c# : <p>I am quite new in programming so i'm looking for some advice. Basically I learn C# on win8 until last week, when i started to show some interest in Linux Distros...and of course i installed it too.I really like this OS but it's a bit strange for me after win, by the way i'm sedulous in learning booth linux and programming.</p> <p>My question is that...I would like to write a simple chat program that could communicate with a win7 client(Gf) and that sounds cool except linux is not windows :D. So I would like to know...What should i do? Change to Python or etc?Is it possible to make it in C#?I just need some "pointer" to select the best option of"route". :D</p>
0debug
How to sort by date for the data coming from the API in Angular 4 : This is the JSON data i am fetching from POSTMAN. I want it to be ordered in a nearest to todays date. I tried many angular pipes but unfortunately nothings working. any help would be great [ { "messageId": "09ca0609-bde7-4360-9d3f-04d6878f874c", "broadcastOn": "2018-02-08T11:06:05.000Z", "message": "{"title":"Server Side Test 2","text":"Different Message again","image":"https://api.adorable.io/avatars/285/abott@adorable.png","url":"https://www.google.co.in"}" }, { "messageId": "0a5b4d0c-051e-4955-bd33-4d40c65ce8f7", "broadcastOn": "2018-02-08T10:36:27.000Z", "message": "{"title":"Broadcast","text":"Broadcast","image":"https://api.adorable.io/avatars/285/abott@adorable.png","url":"https://www.google.co.in"}" }, { "messageId": "0a98a3f3-aa30-4e82-825a-c8c7efcef741", "broadcastOn": "2018-02-08T11:45:00.000Z", "message": "{"title":"Me sending the message","text":"Me sending the message","image":"https://api.adorable.io/avatars/285/abott@adorable.png","url":"https://www.google.co.in"}" }, { "messageId": "0cb4e30f-756a-4730-a533-594ddcd45335", "broadcastOn": "2018-02-08T11:01:57.000Z", "message": "{"title":"Server Side Test","text":"Different Message","image":"https://api.adorable.io/avatars/285/abott@adorable.png","url":"https://www.google.co.in"}" } ]
0debug
Round a Number in JavaScript after a Calculation with Math.round : I don't get `Math.round(num * 100) / 100` to work. I use normal jQuery and i don't get it... Thankful for every help. Thanks! This scripts convert a length, its work perfect <script> var meters = document.getElementsByClassName("num"); for (var i = 0; i < meters.length; i++) { meters[i].innerHTML = parseInt(meters[i].innerHTML) * 3.2808399; } </script> <p class="num">12</p> <p class="num">7</p>
0debug
Can AWS Athena update or insert data stored in S3? : <p>The document just says that it is a query service but not explicitly states that it can or cannot perform data update.</p> <p>If Athena cannot do insert or update, is there any other aws service which can do like a normal DB?</p>
0debug
Ruby thinks an integer I'm passing as an argument is a method : I am trying to write a simple function in ruby but keep getting this error: undefined method `b' for main:Object (NoMethodError). Here is the code I have written can anyone tell me why I keep getting this. def get_sum(a,b) if a == b do return a end else total = 0 for num in a...b total += num end return total end end This is obviously something really simple but would like to know why it is happening. Thanks in advance.
0debug
Using retryWhen to update tokens based on http error code : <p>I found this example on <a href="http://sapandiwakar.in/refresh-oauth-tokens-using-moya-rxswift/" rel="noreferrer">How to refresh oauth token using moya and rxswift</a> which I had to alter slightly to get to compile. This code works 80% for my scenario. The problem with it is that it will run for all http errors, and not just 401 errors. What I want is to have all my other http errors passed on as errors, so that I can handle them else where and not swallow them here.</p> <p>With this code, if I get a <code>HttpStatus 500</code>, it will run the authentication code 3 times which is obviously not what I want.</p> <p>Ive tried to alter this code to handle only handle <code>401</code> errors, but it seem that no matter what I do I can't get the code to compile. It's always complaining about wrong return type, <code>"Cannot convert return expression of type Observable&lt;Response&gt; to return type Observable&lt;Response&gt;"</code> which makes no sense to me..</p> <p>What I want: handle 401, but stop on all other errors</p> <pre><code>import RxSwift import KeychainAccess import Moya public extension ObservableType where E == Response { /// Tries to refresh auth token on 401 errors and retry the request. /// If the refresh fails, the signal errors. public func retryWithAuthIfNeeded() -&gt; Observable&lt;E&gt; { return self.retryWhen { (e: Observable&lt;ErrorType&gt;) in return Observable.zip(e, Observable.range(start: 1, count: 3), resultSelector: { $1 }) .flatMap { i in return AuthProvider.sharedInstance.request( .LoginFacebookUser( accessToken: AuthenticationManager.defaultInstance().getLoginTokenFromKeyChain(), useFaceBookLogin: AuthenticationManager.defaultInstance().isFacebookLogin()) ) .filterSuccessfulStatusCodes() .mapObject(Accesstoken.self) .catchError { error in log.debug("ReAuth error: \(error)") if case Error.StatusCode(let response) = error { if response.statusCode == 401 { // Force logout after failed attempt log.debug("401:, force user logout") NSNotificationCenter.defaultCenter().postNotificationName(Constants.Notifications.userNotAuthenticated, object: nil, userInfo: nil) } } return Observable.error(error) }.flatMapLatest({ token -&gt; Observable&lt;Accesstoken&gt; in AuthenticationManager.defaultInstance().storeServiceTokenInKeychain(token) return Observable.just(token) }) } } } } </code></pre>
0debug
Hi. try running yarn install. I do not know what this error is : try running **yarn install**. I do not know what this error is. [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
0debug
conversion failed when converting date and/or time from character string sql server 2012 in dynamic query : select * from abc where ((@abcStartDate_From IS NULL and @abcStartDate_To IS NULL )OR ((StartDate > @LicenseStartDate_From) and ( @abcStartDate_To is NULL)) OR (DATEADD(d, 0, DATEDIFF(d, 0, StartDate)) BETWEEN @abcStartDate_From and @abcStartDate_To ) ) note :- startdate and parameters are datetime . I want to write dynamic query but got error "conversion failed when converting date and/or time from character string " Could anyone help me to comeout from this issues.
0debug
static uint64_t itc_tag_read(void *opaque, hwaddr addr, unsigned size) { MIPSITUState *tag = (MIPSITUState *)opaque; uint64_t index = addr >> 3; uint64_t ret = 0; switch (index) { case 0 ... ITC_ADDRESSMAP_NUM: ret = tag->ITCAddressMap[index]; break; default: qemu_log_mask(LOG_GUEST_ERROR, "Read 0x%" PRIx64 "\n", addr); break; } return ret; }
1threat
What are the benefits of cfn-init over userdata? : <p>My CloudFormation template has gotten pretty long. One reason is because my <code>AWS::CloudFormation::Init</code> section has gotten pretty huge. This is a very small sample of what I have:</p> <pre><code>"ConfigDisk": { "commands": { "01formatFS": { "command": "/sbin/mkfs.ext4 /dev/xvdf" }, "02mountFS": { "command": "/bin/mount /dev/xvdf /var/lib/jenkins" }, "03changePerms": { "command": "/bin/chown jenkins:jenkins /var/lib/jenkins" }, "04updateFStab": { "command": "/bin/echo /dev/xvdf /var/lib/jenkins ext4 defaults 1 1 &gt;&gt; /etc/fstab" } } }, </code></pre> <p>Wouldn't it be better to just put this into the userdata section as a bunch of commands?</p> <pre><code>/sbin/mkfs.ext4 /dev/xvdf /bin/mount /dev/xvdf /var/lib/jenkins /bin/chown jenkins:jenkins /var/lib/jenkins /bin/echo /dev/xvdf /var/lib/jenkins ext4 defaults 1 1 &gt;&gt; /etc/fstab </code></pre> <p>What are the benefits of leaving this in the Init over userdata?</p>
0debug
Replace " " with [ ] in Javascript : I used a php variable into Javascript like this- var Coordinates = <?php echo json_encode($coords); ?>; And now I want to stringify it so I used var JSON_Coordinates = JSON.stringify(Coordinates); the result is ["-98.47442960102632,38.51861967935271","-98.46128420909388,38.17510666712973","-97.91584295178713,38.17274814619617", -"97.91882439611877,38.51683243137235", "-98.47442960102632,38.51861967935271"] But I want It to be like this- [[-98.47442960102632,38.51861967935271],[-98.46128420909388,38.17510666712973],[-97.91584295178713,38.17274814619617], [-97.91882439611877,38.51683243137235], [-98.47442960102632,38.51861967935271]] So how to replace " " with [ ]? Thanks!
0debug
target_ulong cpu_get_phys_page_debug(CPUState *env, target_ulong addr) { uint8_t *pde_ptr, *pte_ptr; uint32_t pde, pte, paddr, page_offset, page_size; if (!(env->cr[0] & CR0_PG_MASK)) { pte = addr; page_size = 4096; } else { pde_ptr = phys_ram_base + (((env->cr[3] & ~0xfff) + ((addr >> 20) & ~3)) & a20_mask); pde = ldl_raw(pde_ptr); if (!(pde & PG_PRESENT_MASK)) return -1; if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) { pte = pde & ~0x003ff000; page_size = 4096 * 1024; } else { pte_ptr = phys_ram_base + (((pde & ~0xfff) + ((addr >> 10) & 0xffc)) & a20_mask); pte = ldl_raw(pte_ptr); if (!(pte & PG_PRESENT_MASK)) return -1; page_size = 4096; } } pte = pte & a20_mask; page_offset = (addr & TARGET_PAGE_MASK) & (page_size - 1); paddr = (pte & TARGET_PAGE_MASK) + page_offset; return paddr; }
1threat
Disable default constructor in Rust? : <p>Say I define my own type in a Rust library, like so:</p> <pre><code>struct Date { year: u16, month: u8, day: u8 } impl Date { fn new(y: u16, m: u8, d: u8) -&gt; Date { // Do some validation here first Date { year: y, month: m, day: d } } } </code></pre> <p>Is there a way to <strong>require</strong> users to use the <code>Date::new</code> constructor? In other words, can I somehow prohibit users from creating their own Date struct with the default constructor like so:</p> <pre><code>let d = Date { 2017, 7, 10 }; </code></pre> <p>I ask because it seems to be a detrimental flaw if you cannot force developers to run their arguments through a battery of validation before setting the members of a struct. (Although, maybe there is some other pattern that I should use in Rust, like validating data when they are used rather than when they are created; feel free to comment on that.)</p>
0debug
First row occurrence of each value : <p>I have two varaibles a and amount sorted by a</p> <pre><code>a amount 112 12000 112 15000 113 14000 114 18000 114 17000 115 19000 115 17000 </code></pre> <p>I want the first row occurrence of each value in a variable</p> <pre><code>output a amount 112 12000 113 14000 114 18000 115 19000 </code></pre>
0debug
undefined variable on ceodeigniter : Hı, I have a project in which is develop in codeigniter. the project is like this; -root --controller ---Slider.php --models ---My_data.php --views ---slider_view.php ---giris.php the Slider.php code is : public function manset_al(){ $title['title']='manşet listesi'; $this->load->model('My_data'); $data['manset']= $this->My_data->get_manset(); $this->load->view('slider_view' ,$data); } My_data.php code is; public function get_manset() { // $sorgu = // mysql_query("select * from manset, haberler // where manset.onay='1' and manset.link=haberler.id and haberler.onay='1' // order by haberler.id desc"); $this->db->select('*'); $this->db->from('manset as man, haberler as hab'); $this->db->where('man.link=hab.id'); $this->db->where('hab.onay=1'); $query = $this->db->get(); if ($query->num_rows() > 0) { return $query->result(); } else { return $query->result(); } and the slider_view.php code is: foreach($manset as $row){ $baslik =$row->baslik; $icerik =$row->icerik; $link =$row->link; $img_path =$row->img_path; $giris =$row->giris; $cikis =$row->cikis; echo ' <div> <a href="?pid='.$link.'"> <img data-u="image" src="'.$img_path.'"/></a> <div data-u="thumb"> <a href="?pid='.$link.'"> <h5 style="color:white; margin:10px;">'.$baslik.' </h5> </a></div> </div>'; } now when ı called http//example.com/index.php/Slider/manset_al every think is ok, the slider is running. But when ı get the slider in giris.php with this code; $this->load->view('slider_view'); it's not run and say: undefined variable manset; how can ı fix it? Thank you.
0debug
static uint32_t pxa2xx_gpio_read(void *opaque, target_phys_addr_t offset) { struct pxa2xx_gpio_info_s *s = (struct pxa2xx_gpio_info_s *) opaque; uint32_t ret; int bank; offset -= s->base; if (offset >= 0x200) return 0; bank = pxa2xx_gpio_regs[offset].bank; switch (pxa2xx_gpio_regs[offset].reg) { case GPDR: return s->dir[bank]; case GRER: return s->rising[bank]; case GFER: return s->falling[bank]; case GAFR_L: return s->gafr[bank * 2]; case GAFR_U: return s->gafr[bank * 2 + 1]; case GPLR: ret = (s->olevel[bank] & s->dir[bank]) | (s->ilevel[bank] & ~s->dir[bank]); if (s->read_notify) s->read_notify(s->opaque); return ret; case GEDR: return s->status[bank]; default: cpu_abort(cpu_single_env, "%s: Bad offset " REG_FMT "\n", __FUNCTION__, offset); } return 0; }
1threat
void *av_malloc(size_t size) { void *ptr = NULL; #if CONFIG_MEMALIGN_HACK long diff; #endif if (size > (max_alloc_size - 32)) return NULL; #if CONFIG_MEMALIGN_HACK ptr = malloc(size + ALIGN); if (!ptr) return ptr; diff = ((~(long)ptr)&(ALIGN - 1)) + 1; ptr = (char *)ptr + diff; ((char *)ptr)[-1] = diff; #elif HAVE_POSIX_MEMALIGN if (size) if (posix_memalign(&ptr, ALIGN, size)) ptr = NULL; #elif HAVE_ALIGNED_MALLOC ptr = _aligned_malloc(size, ALIGN); #elif HAVE_MEMALIGN #ifndef __DJGPP__ ptr = memalign(ALIGN, size); #else ptr = memalign(size, ALIGN); #endif #else ptr = malloc(size); #endif if(!ptr && !size) { size = 1; ptr= av_malloc(1); } #if CONFIG_MEMORY_POISONING if (ptr) memset(ptr, 0x2a, size); #endif return ptr; }
1threat
mysql_upgrade failed - innodb tables doesn't exist? : <p>I am upgrading my mysql-5.5 docker container database to mysql-5.6 docker container. I was able to fix all other problems. Finally my server is running with 5.6. But when i run mysql_upgrade i am getting the following error.</p> <p>ERROR:</p> <pre><code>root@17aa74cbc5e2# mysql_upgrade -uroot -password Warning: Using a password on the command line interface can be insecure. Looking for 'mysql' as: mysql Looking for 'mysqlcheck' as: mysqlcheck Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' Warning: Using a password on the command line interface can be insecure. Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' Warning: Using a password on the command line interface can be insecure. mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK mysql.general_log OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK mysql.help_topic OK mysql.innodb_index_stats Error : Table 'mysql.innodb_index_stats' doesn't exist status : Operation failed mysql.innodb_table_stats Error : Table 'mysql.innodb_table_stats' doesn't exist status : Operation failed mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK mysql.servers OK mysql.slave_master_info Error : Table 'mysql.slave_master_info' doesn't exist status : Operation failed mysql.slave_relay_log_info Error : Table 'mysql.slave_relay_log_info' doesn't exist status : Operation failed mysql.slave_worker_info Error : Table 'mysql.slave_worker_info' doesn't exist status : Operation failed mysql.slow_log OK mysql.tables_priv OK mysql.time_zone OK mysql.time_zone_leap_second OK mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK Repairing tables mysql.innodb_index_stats Error : Table 'mysql.innodb_index_stats' doesn't exist status : Operation failed mysql.innodb_table_stats Error : Table 'mysql.innodb_table_stats' doesn't exist status : Operation failed mysql.slave_master_info Error : Table 'mysql.slave_master_info' doesn't exist status : Operation failed mysql.slave_relay_log_info Error : Table 'mysql.slave_relay_log_info' doesn't exist status : Operation failed mysql.slave_worker_info Error : Table 'mysql.slave_worker_info' doesn't exist status : Operation failed Running 'mysql_fix_privilege_tables'... Warning: Using a password on the command line interface can be insecure. ERROR 1146 (42S02) at line 62: Table 'mysql.innodb_table_stats' doesn't exist ERROR 1243 (HY000) at line 63: Unknown prepared statement handler (stmt) given to EXECUTE ERROR 1243 (HY000) at line 64: Unknown prepared statement handler (stmt) given to DEALLOCATE PREPARE ERROR 1146 (42S02) at line 66: Table 'mysql.innodb_index_stats' doesn't exist ERROR 1243 (HY000) at line 67: Unknown prepared statement handler (stmt) given to EXECUTE ERROR 1243 (HY000) at line 68: Unknown prepared statement handler (stmt) given to DEALLOCATE PREPARE ERROR 1146 (42S02) at line 81: Table 'mysql.slave_relay_log_info' doesn't exist ERROR 1243 (HY000) at line 82: Unknown prepared statement handler (stmt) given to EXECUTE ERROR 1243 (HY000) at line 83: Unknown prepared statement handler (stmt) given to DEALLOCATE PREPARE ERROR 1146 (42S02) at line 110: Table 'mysql.slave_master_info' doesn't exist ERROR 1243 (HY000) at line 111: Unknown prepared statement handler (stmt) given to EXECUTE ERROR 1243 (HY000) at line 112: Unknown prepared statement handler (stmt) given to DEALLOCATE PREPARE ERROR 1146 (42S02) at line 128: Table 'mysql.slave_worker_info' doesn't exist ERROR 1243 (HY000) at line 129: Unknown prepared statement handler (stmt) given to EXECUTE ERROR 1243 (HY000) at line 130: Unknown prepared statement handler (stmt) given to DEALLOCATE PREPARE ERROR 1146 (42S02) at line 1896: Table 'mysql.slave_master_info' doesn't exist ERROR 1146 (42S02) at line 1897: Table 'mysql.slave_master_info' doesn't exist ERROR 1146 (42S02) at line 1898: Table 'mysql.slave_master_info' doesn't exist ERROR 1146 (42S02) at line 1899: Table 'mysql.slave_worker_info' doesn't exist ERROR 1146 (42S02) at line 1900: Table 'mysql.slave_relay_log_info' doesn't exist ERROR 1146 (42S02) at line 1904: Table 'mysql.innodb_table_stats' doesn't exist ERROR 1146 (42S02) at line 1908: Table 'mysql.innodb_index_stats' doesn't exist FATAL ERROR: Upgrade failed </code></pre>
0debug
static void piix3_set_irq(void *opaque, int irq_num, int level) { int i, pic_irq, pic_level; PIIX3State *piix3 = opaque; pic_irq = piix3->dev.config[0x60 + irq_num]; if (pic_irq < 16) { pic_level = 0; for (i = 0; i < 4; i++) { if (pic_irq == piix3->dev.config[0x60 + i]) { pic_level |= pci_bus_get_irq_level(piix3->dev.bus, i); } } qemu_set_irq(piix3->pic[pic_irq], pic_level); } }
1threat
void MPV_common_end(MpegEncContext *s) { int i; if (s->motion_val) free(s->motion_val); if (s->h263_pred) { free(s->dc_val[0]); free(s->ac_val[0]); free(s->coded_block); free(s->mbintra_table); } if (s->mbskip_table) free(s->mbskip_table); for(i=0;i<3;i++) { free(s->last_picture_base[i]); free(s->next_picture_base[i]); if (s->has_b_frames) free(s->aux_picture_base[i]); } s->context_initialized = 0; }
1threat
compiler cannot compile inheritance c++ : <p>Suppose i have a header which contain these two classes </p> <pre><code>class A:public class B{ // code }; class B { protected: A a_object; }; </code></pre> <p>when the compiler compiles this include file,when it comes to Class A ,it sees class A inherits from B but it doesn't reach to Class B definition.So it gives an error. and if i reverse the order of both classes,it gives error due to a_object as it doesn't see Class A definition. </p> <p>So how to solve this problem? and assume that i restricted to this include file to have class A and B definitions.</p> <p>Thanks</p>
0debug
build_header(BIOSLinker *linker, GArray *table_data, AcpiTableHeader *h, const char *sig, int len, uint8_t rev, const char *oem_id, const char *oem_table_id) { memcpy(&h->signature, sig, 4); h->length = cpu_to_le32(len); h->revision = rev; if (oem_id) { strncpy((char *)h->oem_id, oem_id, sizeof h->oem_id); } else { memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6); } if (oem_table_id) { strncpy((char *)h->oem_table_id, oem_table_id, sizeof(h->oem_table_id)); } else { memcpy(h->oem_table_id, ACPI_BUILD_APPNAME4, 4); memcpy(h->oem_table_id + 4, sig, 4); } h->oem_revision = cpu_to_le32(1); memcpy(h->asl_compiler_id, ACPI_BUILD_APPNAME4, 4); h->asl_compiler_revision = cpu_to_le32(1); h->checksum = 0; bios_linker_loader_add_checksum(linker, ACPI_BUILD_TABLE_FILE, h, len, &h->checksum); }
1threat
SQL server 2016 installation freeze : <p>Hope someone can help me here . I have no further information other than that at a later stage in setup the whole process hangs showing install_confignonrc_cpu64<br> I am unable to cancel out of it even , the only way was to kill it . Is there any solution for that ? </p>
0debug
Combining PHP-fpm with nginx in one dockerfile : <p>I have a need to combine the php-fpm with nginx in one dockerfile for production deployment. </p> <p>So is it better to :</p> <p>(1) Start the dockerfile using php:7.1.8-fpm and then install nginx image layer on top of it ? </p> <p>(2) Or do you recommend using nginx image and then installing php-fpm using apt-get ?</p> <p>PS: I do not have a docker-compose build option for production deployment. On my development environment, I already use docker-compose and build multi-container app easily from two images. Our organization devops do not support docker-compose based deployment for prod environment.</p>
0debug
Xcode 11 beta 6 behind Xcode 11 beta 7 download link? : <p>I have tried to download several times Xcode beta version which should be Xcode 11 beta 7 with iOS 13.1 beta support. I am downloading it from this link: <a href="https://download.developer.apple.com/Developer_Tools/Xcode_11_Beta_7/Xcode_11_Beta_7.xip" rel="noreferrer">https://download.developer.apple.com/Developer_Tools/Xcode_11_Beta_7/Xcode_11_Beta_7.xip</a></p> <p>Also, when unpacking, it's obviously saying that it's unpacking Xcode 11 beta 7:</p> <p><a href="https://i.stack.imgur.com/GYJbo.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GYJbo.png" alt="enter image description here"></a></p> <p>But after unpacking it (on 27th of August around 23:05), I am seeing following:</p> <p><a href="https://i.stack.imgur.com/ZSw17.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZSw17.png" alt="enter image description here"></a></p> <p>And when I start Xcode I see this:</p> <p><a href="https://i.stack.imgur.com/AkFVy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/AkFVy.png" alt="enter image description here"></a></p> <p>Any ideas what might be happening?</p> <p>Thanks in advance for any kind of answer.</p>
0debug
How to model common information for Rails application : <p>I'm a bit new in rails development I'm modeling a website with few resources and so far so good. But here is my question:</p> <p>I would like to allow the admin users to manage information show in most of the pages: Application name, telephone number, address, default email and this kind of things.</p> <p>My current idea is make a model Property with name and value, but somehow I'm not convinced about this approach because I'll need to access the database to get this values for every request.</p> <p>Thanks everyone for your time! :D</p>
0debug
Xcode 8.2 returning hundreds of errors when including SwiftyJSON.swift : I am learning swift at the moment and recently tried to use SwiftyJSON to parse JSON data. However, following a tutorial, when I dragged the SwiftyJSON.swift file into my project window, it immediately shows 100+ errors in the SwiftyJSON file. Because of this, I am unable to use SwiftyJSON in my projects and can't gather data from the web. I am using Xcode 8.2 and learning Swift 3.0. Has anyone else had this problem, and have a solution to it? Sorry if this is a really dumb question by the way.
0debug
Interface vs Implementation in C++. What does this mean? : <p>I am learning the concepts of inheritance, especially about access-specifiers, here I am confused about the <code>protected</code> access specifier. The members under protected can be accessible by the base class member functions and derived class member functions. There is a chance of messing up <code>implementation</code> of base class if we declare protected as access specifier. Its always better to declare data members under <code>private</code> rather than protected as only the <code>interface</code> is exposed and not the <code>implementation</code> section. We are declaring only the variables in the private section of a class and how it becomes <code>implementation</code>? Implementation will be done in the <code>member functions</code> right? The terms are confusing, can anyone clarify and explain me the terms?</p>
0debug
What's the different between those css selectors? : <pre><code>element element div p Selects all &lt;p&gt; elements inside &lt;div&gt; elements 1 element&gt;element div &gt; p Selects all &lt;p&gt; elements where the parent is a &lt;div&gt; element 2 element+element div + p Selects all &lt;p&gt; elements that are placed immediately after &lt;div&gt; elements 2 element1~element2 p ~ ul Selects every &lt;ul&gt; element that are preceded by a &lt;p&gt; element </code></pre> <p>When I see the course of w3schools, it explain those four selectors by that, but I am very confusing for the explain especially the first term and the second term, it looks like the same thing, anybody can give simple examples to explain what's different for those four selectors?</p>
0debug
static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx, const uint8_t *buf, int buf_size) { const uint8_t *buf_ptr = buf, *bs_hdr; uint32_t frame_num, word2, check_sum, data_size; uint32_t y_offset, u_offset, v_offset, starts[3], ends[3]; uint16_t height, width; int i, j; frame_num = bytestream_get_le32(&buf_ptr); word2 = bytestream_get_le32(&buf_ptr); check_sum = bytestream_get_le32(&buf_ptr); data_size = bytestream_get_le32(&buf_ptr); if ((frame_num ^ word2 ^ data_size ^ OS_HDR_ID) != check_sum) { av_log(avctx, AV_LOG_ERROR, "OS header checksum mismatch!\n"); return AVERROR_INVALIDDATA; } bs_hdr = buf_ptr; if (bytestream_get_le16(&buf_ptr) != 32) { av_log(avctx, AV_LOG_ERROR, "Unsupported codec version!\n"); return AVERROR_INVALIDDATA; } ctx->frame_num = frame_num; ctx->frame_flags = bytestream_get_le16(&buf_ptr); ctx->data_size = (bytestream_get_le32(&buf_ptr) + 7) >> 3; ctx->cb_offset = *buf_ptr++; if (ctx->data_size == 16) return 4; if (ctx->data_size > buf_size) ctx->data_size = buf_size; buf_ptr += 3; height = bytestream_get_le16(&buf_ptr); width = bytestream_get_le16(&buf_ptr); if (av_image_check_size(width, height, 0, avctx)) return AVERROR_INVALIDDATA; if (width != ctx->width || height != ctx->height) { av_dlog(avctx, "Frame dimensions changed!\n"); ctx->width = width; ctx->height = height; free_frame_buffers(ctx); allocate_frame_buffers(ctx, avctx); avcodec_set_dimensions(avctx, width, height); } y_offset = bytestream_get_le32(&buf_ptr); v_offset = bytestream_get_le32(&buf_ptr); u_offset = bytestream_get_le32(&buf_ptr); starts[0] = y_offset; starts[1] = v_offset; starts[2] = u_offset; for (j = 0; j < 3; j++) { ends[j] = ctx->data_size; for (i = 2; i >= 0; i--) if (starts[i] < ends[j] && starts[i] > starts[j]) ends[j] = starts[i]; } ctx->y_data_size = ends[0] - starts[0]; ctx->v_data_size = ends[1] - starts[1]; ctx->u_data_size = ends[2] - starts[2]; if (FFMAX3(y_offset, v_offset, u_offset) >= ctx->data_size - 16 || FFMIN3(ctx->y_data_size, ctx->v_data_size, ctx->u_data_size) <= 0) { av_log(avctx, AV_LOG_ERROR, "One of the y/u/v offsets is invalid\n"); return AVERROR_INVALIDDATA; } ctx->y_data_ptr = bs_hdr + y_offset; ctx->v_data_ptr = bs_hdr + v_offset; ctx->u_data_ptr = bs_hdr + u_offset; ctx->alt_quant = buf_ptr + sizeof(uint32_t); if (ctx->data_size == 16) { av_log(avctx, AV_LOG_DEBUG, "Sync frame encountered!\n"); return 16; } if (ctx->frame_flags & BS_8BIT_PEL) { av_log_ask_for_sample(avctx, "8-bit pixel format\n"); return AVERROR_PATCHWELCOME; } if (ctx->frame_flags & BS_MV_X_HALF || ctx->frame_flags & BS_MV_Y_HALF) { av_log_ask_for_sample(avctx, "halfpel motion vectors\n"); return AVERROR_PATCHWELCOME; } return 0; }
1threat
CORS security with mobile apps : <p>We need to keep our API server security with CORS restriction : </p> <pre><code>Access-Control-Allow-Origin : http://myonlinesite.com </code></pre> <p>But we also needs this API to be accessible for our mobile apps (Android+iOs).</p> <p>All the solutions I found tell me to allow all origin : <code>*</code> , but this would be a big security failure for our API.</p> <p>We are building our apps with Cordova, which WebView serves local files and therefore sends : <code>origin: null</code> , for all its http(s) requests. So we are thinking about adding <code>null</code> to the allowed origin. It's better, since it will block every other website attempting to fetch our API, but it will allow any mobile apps to fetch it...</p> <p>Is there any more interesting solution for this ?</p> <p>Thank you!</p>
0debug
readline doesn't stop line reading after rl.close() emit in nodejs : <p>I have the following file I want to read line by line and stop reading it once I have found "nameserver 8.8.8.8".</p> <pre><code>nameserver 8.8.8.8 nameserver 45.65.85.3 nameserver 40.98.3.3 </code></pre> <p>I am using nodejs and the readline module to do so</p> <pre><code>const readline = require('readline'); const fs = require('fs'); function check_resolv_nameserver(){ // flag indicates whether namerserver_line was found or not var nameserver_flag = false; const rl = readline.createInterface({ input: fs.createReadStream('file_to_read.conf') }); rl.on('line', (line) =&gt; { console.log(`Line from file: ${line}`); if (line === 'nameserver 8.8.8.8'){ console.log('Found the right file. Reading lines should stop here.'); nameserver_flag = true; rl.close(); } }); rl.on('close', function(){ if (nameserver_flag === true){ console.log('Found nameserver 8.8.8.8'); } else { console.log('Could not find nameserver 8.8.8.8'); } }); } check_resolv_nameserver(); </code></pre> <p>Since I emit a close event with rl.close() as soon as I read the first match, I would expect my Code to read only the first line and then stop reading further. But instead my output looks like this</p> <pre><code>Line from file: nameserver 8.8.8.8 Found the right file. Reading lines should stop here. Found nameserver 8.8.8.8 Line from file: nameserver 45.65.85.3 Line from file: nameserver 40.98.3.3 </code></pre> <p>How can I make readline stop after first match and let me proceed with a something else?</p>
0debug
Running some code on a certain iteration in a loop : <p>I have a loop in my java program and I want to run some test code every say 10th iteration in the loop. How do I do this ??? </p>
0debug
does make_unique value initializes char array : <p>For example -</p> <pre><code>#include &lt;memory&gt; int main(){ const auto bufSize = 1024; auto buffer = std::make_unique&lt;char[]&gt;(bufSize); } </code></pre> <p>Is the buffer here already filled with <code>'\0'</code> characters or will I have to manually fill it to avoid garbage values.</p> <p>And what would be the possible way to do this, will <code>std::memset(&amp;buffer.get(), 0, bufSize)</code> suffice?</p>
0debug
'NoneType' object has no attribute '__getitem__' - Tkinter : <p>I've taken a look through the existing questions, but I haven't been able to find a solution so far.</p> <p>I'm new to the Python programming language and have started playing around with Tk, but keep receiving the following error message when trying to either 'get' a value (from a checkbox) or change a value of a label:</p> <p>'NoneType' object has no attribute '<strong>getitem</strong>'</p> <p>Below is an example of my code in which I receive the error when clicking a button</p> <pre><code>from Tkinter import * the_window = Tk() the_window.title('Button Change Colour') def change_to_red(): colour_area['text']='Red' colour_area = Label(the_window, bg='Grey', text = 'test', width = 40, height = 5).grid(row = 1, column = 1, padx = 5, pady = 5) red_button = Button(the_window, text='Red', width = 5, command = change_to_red).grid(row = 2, column = 1) the_window.mainloop() </code></pre> <p>I'm sure it's something small/silly, but would appreciate your help nonetheless! :)</p>
0debug
static void vnc_client_cache_auth(VncState *client) { if (!client->info) { return; } #ifdef CONFIG_VNC_TLS if (client->tls.session && client->tls.dname) { client->info->has_x509_dname = true; client->info->x509_dname = g_strdup(client->tls.dname); } #endif #ifdef CONFIG_VNC_SASL if (client->sasl.conn && client->sasl.username) { client->info->has_sasl_username = true; client->info->sasl_username = g_strdup(client->sasl.username); } #endif }
1threat
OP(zerof64) { set_opf64(PARAM1, 0); FORCE_RET(); }
1threat
How to set OkHttpClient for glide : <p>I am using Glide to load images, the issue I'm facing is that when i run app on slow internet connection I'm getting <code>SocketTimeOutException</code>. So to solve this issue i want to use a custom <code>OkHttpClient</code> so that I can change the timeout of HttpClient this is the code i have. </p> <pre><code>public class MyGlideModule implements GlideModule { @Override public void applyOptions(Context context, GlideBuilder builder) { } @Override public void registerComponents(Context context, Glide glide) { OkHttpClient client = new OkHttpClient(); client.setConnectTimeout(15, TimeUnit.SECONDS); client.setReadTimeout(15,TimeUnit.SECONDS); OkHttpUrlLoader.Factory factory = new OkHttpUrlLoader.Factory(client); glide.register(GlideUrl.class, InputStream.class, factory); } } </code></pre> <p>but <code>OkHttpUrlLoader</code> is not there any more in Glide API. So i was wondering how can set the OkHttpClient for Glide </p>
0debug
static uint32_t mipid_txrx(void *opaque, uint32_t cmd, int len) { struct mipid_s *s = (struct mipid_s *) opaque; uint8_t ret; if (len > 9) { hw_error("%s: FIXME: bad SPI word width %i\n", __FUNCTION__, len); } if (s->p >= ARRAY_SIZE(s->resp)) { ret = 0; } else { ret = s->resp[s->p++]; } if (s->pm-- > 0) { s->param[s->pm] = cmd; } else { s->cmd = cmd; } switch (s->cmd) { case 0x00: break; case 0x01: mipid_reset(s); break; case 0x02: s->booster = 0; break; case 0x03: s->booster = 1; break; case 0x04: s->p = 0; s->resp[0] = (s->id >> 16) & 0xff; s->resp[1] = (s->id >> 8) & 0xff; s->resp[2] = (s->id >> 0) & 0xff; break; case 0x06: case 0x07: case 0x08: s->p = 0; s->resp[0] = 0x01; break; case 0x09: s->p = 0; s->resp[0] = s->booster << 7; s->resp[1] = (5 << 4) | (s->partial << 2) | (s->sleep << 1) | s->normal; s->resp[2] = (s->vscr << 7) | (s->invert << 5) | (s->onoff << 2) | (s->te << 1) | (s->gamma >> 2); s->resp[3] = s->gamma << 6; break; case 0x0a: s->p = 0; s->resp[0] = (s->onoff << 2) | (s->normal << 3) | (s->sleep << 4) | (s->partial << 5) | (s->sleep << 6) | (s->booster << 7); break; case 0x0b: s->p = 0; s->resp[0] = 0; break; case 0x0c: s->p = 0; s->resp[0] = 5; break; case 0x0d: s->p = 0; s->resp[0] = (s->invert << 5) | (s->vscr << 7) | s->gamma; break; case 0x0e: s->p = 0; s->resp[0] = s->te << 7; break; case 0x0f: s->p = 0; s->resp[0] = s->selfcheck; break; case 0x10: s->sleep = 1; break; case 0x11: s->sleep = 0; s->selfcheck ^= 1 << 6; break; case 0x12: s->partial = 1; s->normal = 0; s->vscr = 0; break; case 0x13: s->partial = 0; s->normal = 1; s->vscr = 0; break; case 0x20: s->invert = 0; break; case 0x21: s->invert = 1; break; case 0x22: case 0x23: goto bad_cmd; case 0x25: if (s->pm < 0) { s->pm = 1; } goto bad_cmd; case 0x26: if (!s->pm) { s->gamma = ctz32(s->param[0] & 0xf); if (s->gamma == 32) { s->gamma = -1; } } else if (s->pm < 0) { s->pm = 1; } break; case 0x28: s->onoff = 0; break; case 0x29: s->onoff = 1; break; case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x30: case 0x33: goto bad_cmd; case 0x34: s->te = 0; break; case 0x35: if (!s->pm) { s->te = 1; } else if (s->pm < 0) { s->pm = 1; } break; case 0x36: goto bad_cmd; case 0x37: s->partial = 0; s->normal = 0; s->vscr = 1; break; case 0x38: case 0x39: case 0x3a: goto bad_cmd; case 0xb0: case 0xb1: if (s->pm < 0) { s->pm = 2; } break; case 0xb4: break; case 0xb5: case 0xb6: case 0xb7: case 0xb8: case 0xba: case 0xbb: goto bad_cmd; case 0xbd: s->p = 0; s->resp[0] = 0; s->resp[1] = 1; break; case 0xc2: if (s->pm < 0) { s->pm = 2; } break; case 0xc6: case 0xc7: case 0xd0: case 0xd1: case 0xd4: case 0xd5: goto bad_cmd; case 0xda: s->p = 0; s->resp[0] = (s->id >> 16) & 0xff; break; case 0xdb: s->p = 0; s->resp[0] = (s->id >> 8) & 0xff; break; case 0xdc: s->p = 0; s->resp[0] = (s->id >> 0) & 0xff; break; default: bad_cmd: qemu_log_mask(LOG_GUEST_ERROR, "%s: unknown command %02x\n", __func__, s->cmd); break; } return ret; }
1threat
void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int stride) { int i; pixel *dst = (pixel*)_dst; dctcoef *block = (dctcoef*)_block; stride >>= sizeof(pixel)-1; block[0] += 1 << 5; for(i=0; i<4; i++){ const int z0= block[i + 4*0] + block[i + 4*2]; const int z1= block[i + 4*0] - block[i + 4*2]; const int z2= (block[i + 4*1]>>1) - block[i + 4*3]; const int z3= block[i + 4*1] + (block[i + 4*3]>>1); block[i + 4*0]= z0 + z3; block[i + 4*1]= z1 + z2; block[i + 4*2]= z1 - z2; block[i + 4*3]= z0 - z3; } for(i=0; i<4; i++){ const int z0= block[0 + 4*i] + block[2 + 4*i]; const int z1= block[0 + 4*i] - block[2 + 4*i]; const int z2= (block[1 + 4*i]>>1) - block[3 + 4*i]; const int z3= block[1 + 4*i] + (block[3 + 4*i]>>1); dst[i + 0*stride]= av_clip_pixel(dst[i + 0*stride] + ((z0 + z3) >> 6)); dst[i + 1*stride]= av_clip_pixel(dst[i + 1*stride] + ((z1 + z2) >> 6)); dst[i + 2*stride]= av_clip_pixel(dst[i + 2*stride] + ((z1 - z2) >> 6)); dst[i + 3*stride]= av_clip_pixel(dst[i + 3*stride] + ((z0 - z3) >> 6)); } memset(block, 0, 16 * sizeof(dctcoef)); }
1threat
How to select nth item inside select element in cypress : <p>say I have the HTML:</p> <pre><code>&lt;select name="subject" data-testid="contact-us-subject-field"&gt; &lt;option value="What is this regarding?"&gt;What is this regarding?&lt;/option&gt; &lt;option value="Partnerships"&gt;Partnerships&lt;/option&gt; &lt;option value="Careers"&gt;Careers&lt;/option&gt; &lt;option value="Press"&gt;Press&lt;/option&gt; &lt;option value="Other"&gt;Other&lt;/option&gt; &lt;/select&gt; </code></pre> <p>Selecting an option with a known value, such as 'Careers' is as easy as:</p> <pre><code>cy.get('[data-testid="contact-us-subject-field"]').select('Careers'); </code></pre> <p>How do I select the nth option in this field, <em>regardless</em> of its value?</p>
0debug
ContentCachingResponseWrapper Produces Empty Response : <p>I'm trying to implement filter for logging requests and responses in <code>Spring MVC</code> application. I use the following code:</p> <pre><code>@Component public class LoggingFilter extends OncePerRequestFilter { private static final Logger LOGGER = LoggerFactory.getLogger(LoggingFilter.class); @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { ContentCachingRequestWrapper requestWrapper = new ContentCachingRequestWrapper(request); ContentCachingResponseWrapper responseWrapper = new ContentCachingResponseWrapper(response); LOGGER.debug(REQUEST_MESSAGE_FORMAT, requestWrapper.getRequestURI(), requestWrapper.getMethod(), requestWrapper.getContentType(), new ServletServerHttpRequest(requestWrapper).getHeaders(), IOUtils.toString(requestWrapper.getInputStream(), UTF_8)); filterChain.doFilter(requestWrapper, responseWrapper); LOGGER.debug(RESPONSE_MESSAGE_FORMAT, responseWrapper.getStatus(), responseWrapper.getContentType(), new ServletServerHttpResponse(responseWrapper).getHeaders(), IOUtils.toString(responseWrapper.getContentInputStream(), UTF_8)); } } </code></pre> <p>So, I get my request and respone logged as expected. Here are the logs:</p> <pre><code>2016-10-08 19:10:11.212 DEBUG 11072 --- [qtp108982313-19] by.kolodyuk.logging.LoggingFilter ---------------------------- ID: 1 URI: /resources/1 Http-Method: GET Content-Type: null Headers: {User-Agent=[curl/7.41.0], Accept=[*/*], Host=[localhost:9015]} Body: -------------------------------------- 2016-10-08 19:10:11.277 DEBUG 11072 --- [qtp108982313-19] by.kolodyuk.logging.LoggingFilter ---------------------------- ID: 1 Response-Code: 200 Content-Type: application/json;charset=UTF-8 Headers: {} Body: {"id":"1"} -------------------------------------- </code></pre> <p>However, the empty response is returned. Here's the output from <code>curl</code>:</p> <pre><code>$ curl http://localhost:9015/resources/1 --verbose * Trying ::1... * Connected to localhost (::1) port 9015 (#0) &gt; GET /resources/1 HTTP/1.1 &gt; User-Agent: curl/7.41.0 &gt; Host: localhost:9015 &gt; Accept: */* &gt; &lt; HTTP/1.1 200 OK &lt; Date: Sat, 08 Oct 2016 17:10:11 GMT &lt; Content-Type: application/json;charset=UTF-8 &lt; Content-Length: 0 &lt; * Connection #0 to host localhost left intact </code></pre> <p>Any ideas?</p> <p>Thanks</p>
0debug
static void virtser_port_device_realize(DeviceState *dev, Error **errp) { VirtIOSerialPort *port = VIRTIO_SERIAL_PORT(dev); VirtIOSerialPortClass *vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port); VirtIOSerialBus *bus = VIRTIO_SERIAL_BUS(qdev_get_parent_bus(dev)); int max_nr_ports; bool plugging_port0; Error *err = NULL; port->vser = bus->vser; port->bh = qemu_bh_new(flush_queued_data_bh, port); assert(vsc->have_data); plugging_port0 = vsc->is_console && !find_port_by_id(port->vser, 0); if (find_port_by_id(port->vser, port->id)) { error_setg(errp, "virtio-serial-bus: A port already exists at id %u", port->id); return; } if (port->name != NULL && find_port_by_name(port->name)) { error_setg(errp, "virtio-serial-bus: A port already exists by name %s", port->name); return; } if (port->id == VIRTIO_CONSOLE_BAD_ID) { if (plugging_port0) { port->id = 0; } else { port->id = find_free_port_id(port->vser); if (port->id == VIRTIO_CONSOLE_BAD_ID) { error_setg(errp, "virtio-serial-bus: Maximum port limit for " "this device reached"); return; } } } max_nr_ports = port->vser->serial.max_virtserial_ports; if (port->id >= max_nr_ports) { error_setg(errp, "virtio-serial-bus: Out-of-range port id specified, " "max. allowed: %u", max_nr_ports - 1); return; } vsc->realize(dev, &err); if (err != NULL) { error_propagate(errp, err); return; } port->elem.out_num = 0; }
1threat
App wont run when apk is shared with friend : Android app is working fine on Emulator and even on Device when i connect it using USB Cable. When i generate apk file and shared with others, the app wont work. It crashes after the Splash Screen is launched. Here is my app/build.gradle apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion '25.0.0' useLibrary 'org.apache.http.legacy' defaultConfig { applicationId 'com.test' minSdkVersion 15 targetSdkVersion 22 versionCode 2 versionName "1.1" multiDexEnabled true def serverPropertiesFile = rootProject.file("server.properties") // Initialize a new Properties() object called keystoreProperties. def serverProperties = new Properties() // Load your keystore.properties file into the serverProperties object. serverProperties.load(new FileInputStream(serverPropertiesFile)) buildConfigField("String", "HOST", serverProperties['SERVER_URL']) } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { debuggable true } } productFlavors { } lintOptions { abortOnError false } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.github.bumptech.glide:glide:3.7.0' compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.nineoldandroids:library:2.4.0' compile 'com.daimajia.swipelayout:library:1.2.0@aar' compile 'com.daimajia.androidanimations:library:1.1.2@aar' compile 'com.google.android.gms:play-services-maps:10.0.1' compile 'com.google.android.gms:play-services-gcm:10.0.1' compile 'com.mcxiaoke.volley:library:1.0.19' compile 'com.google.code.gson:gson:2.8.2' compile 'com.android.support:recyclerview-v7:25.3.1' compile 'com.android.support.constraint:constraint-layout:1.0.2' testCompile 'junit:junit:4.12' } Help would be appreciated
0debug
How to pass basic auth credentials in API call for a Flutter mobile application? : <p>I'm working on a simple Flutter mobile app that needs to call out to an API that uses Basic Auth.</p> <p>I can hit the API in Postman using email &amp; password credentials and it encodes the email &amp; password in Base64 (I assume with a ":" separating) before performing the request.</p> <p>I'm not sure how to do this in Flutter / Dart...</p> <p>I've tinkered with the http package and tried to do the Base64 encoding... but I just get back errors from the server.</p> <p>Can anyone provide some guidance or an example for a basic auth request?</p>
0debug
Dynamic programming21 : I want to ask this question , because now it is many days that i am bothered by it but couldnt come to an optimised solution for this problem,[here is my code][1] lli solve(lli n,lli i,lli c) My solution is O(N^3) and it should pass the test cases(N=300),but still time limit exceeds for it, please i really need help!!! [Here is the problem link][2] [1]: https://ideone.com/CMewEj [2]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1254
0debug
if it's start of the month...do this? : <p>I want my code to empty a specific text file, when it is the beginning of each month. I have this code but it doesn't seem to work, do I have something wrong with the syntax maybe?</p> <pre><code>public void monthlyCleanse(File f){ LocalDate localDate = LocalDate.now(); String d = DateTimeFormatter.ofPattern("dd").format(localDate); System.out.println(d); if(d.equals("01")){ "filename.txt".replace(toString().valueOf(f), ""); } } </code></pre> <p>As you can see I am changing the format to only show the day of the month, then I am checking if that day equals "01" then do something...which is to empty a text file. </p> <p>Then i am calling it here...</p> <pre><code> monthlyCleanse(new File("filename.txt")); </code></pre> <p>How can i make sure that this file is emptied?</p>
0debug
Do help me handle the error in the sql command please : GOOD DAY PLEASE I AM TRYING TO EXECUTE THIS SQL COMMAND TO CREATE A TABLE CRETE TABLE NEWS ( ID INT(128) NOT NULL AUTO_INCREMENT, TITLE VARCHAR(128),NOT NULL, SLUG VARCHAR(128) NOT NULL, TEXTS_S TEXT NOT NULL, PRIMARY (ID), ); )
0debug
Python writing general script using open('file', 'r') : I am writing a script where I first read a file using `with open('file', 'r') as file`, do some operation, and then write it to a new file using `with open(`newfile`, 'w') as newfile`. My question is, what do I need to change in the script to make it general for a number of files, so that I can just call the script with the file name from the terminal like `python3 script.py file.ext`? Also, is there a way to write the output back into the original file using this method? Any help is greatly appreciated!
0debug
static void inner_add_yblock_bw_16_obmc_32_mmx(const uint8_t *obmc, const long obmc_stride, uint8_t * * block, int b_w, long b_h, int src_x, int src_y, long src_stride, slice_buffer * sb, int add, uint8_t * dst8){ snow_inner_add_yblock_mmx_header snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "0", "0") snow_inner_add_yblock_mmx_accum("2", "16", "0") snow_inner_add_yblock_mmx_accum("1", "512", "0") snow_inner_add_yblock_mmx_accum("0", "528", "0") snow_inner_add_yblock_mmx_mix("0", "0") snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "8", "8") snow_inner_add_yblock_mmx_accum("2", "24", "8") snow_inner_add_yblock_mmx_accum("1", "520", "8") snow_inner_add_yblock_mmx_accum("0", "536", "8") snow_inner_add_yblock_mmx_mix("32", "8") snow_inner_add_yblock_mmx_end("32") }
1threat
static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, const char *model, const char *name, const char *ifname, const char *script, const char *downscript, const char *vhostfdname, int vnet_hdr, int fd, Error **errp) { Error *err = NULL; TAPState *s = net_tap_fd_init(peer, model, name, fd, vnet_hdr); int vhostfd; tap_set_sndbuf(s->fd, tap, &err); if (err) { error_propagate(errp, err); return; } if (tap->has_fd || tap->has_fds) { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "fd=%d", fd); } else if (tap->has_helper) { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s", tap->helper); } else { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "ifname=%s,script=%s,downscript=%s", ifname, script, downscript); if (strcmp(downscript, "no") != 0) { snprintf(s->down_script, sizeof(s->down_script), "%s", downscript); snprintf(s->down_script_arg, sizeof(s->down_script_arg), "%s", ifname); } } if (tap->has_vhost ? tap->vhost : vhostfdname || (tap->has_vhostforce && tap->vhostforce)) { VhostNetOptions options; options.backend_type = VHOST_BACKEND_TYPE_KERNEL; options.net_backend = &s->nc; if (tap->has_vhostfd || tap->has_vhostfds) { vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err); if (vhostfd == -1) { error_propagate(errp, err); return; } } else { vhostfd = open("/dev/vhost-net", O_RDWR); if (vhostfd < 0) { error_setg_errno(errp, errno, "tap: open vhost char device failed"); return; } } options.opaque = (void *)(uintptr_t)vhostfd; s->vhost_net = vhost_net_init(&options); if (!s->vhost_net) { error_setg(errp, "vhost-net requested but could not be initialized"); return; } } else if (tap->has_vhostfd || tap->has_vhostfds) { error_setg(errp, "vhostfd= is not valid without vhost"); } }
1threat
static int check_refblocks(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix, bool *rebuild, uint16_t **refcount_table, int64_t *nb_clusters) { BDRVQcowState *s = bs->opaque; int64_t i, size; int ret; for(i = 0; i < s->refcount_table_size; i++) { uint64_t offset, cluster; offset = s->refcount_table[i]; cluster = offset >> s->cluster_bits; if (offset_into_cluster(s, offset)) { fprintf(stderr, "ERROR refcount block %" PRId64 " is not " "cluster aligned; refcount table entry corrupted\n", i); res->corruptions++; *rebuild = true; continue; } if (cluster >= *nb_clusters) { fprintf(stderr, "%s refcount block %" PRId64 " is outside image\n", fix & BDRV_FIX_ERRORS ? "Repairing" : "ERROR", i); if (fix & BDRV_FIX_ERRORS) { int64_t new_nb_clusters; if (offset > INT64_MAX - s->cluster_size) { ret = -EINVAL; goto resize_fail; } ret = bdrv_truncate(bs->file, offset + s->cluster_size); if (ret < 0) { goto resize_fail; } size = bdrv_getlength(bs->file); if (size < 0) { ret = size; goto resize_fail; } new_nb_clusters = size_to_clusters(s, size); assert(new_nb_clusters >= *nb_clusters); ret = realloc_refcount_array(s, refcount_table, nb_clusters, new_nb_clusters); if (ret < 0) { res->check_errors++; return ret; } if (cluster >= *nb_clusters) { ret = -EINVAL; goto resize_fail; } res->corruptions_fixed++; ret = inc_refcounts(bs, res, refcount_table, nb_clusters, offset, s->cluster_size); if (ret < 0) { return ret; } continue; resize_fail: res->corruptions++; *rebuild = true; fprintf(stderr, "ERROR could not resize image: %s\n", strerror(-ret)); } else { res->corruptions++; } continue; } if (offset != 0) { ret = inc_refcounts(bs, res, refcount_table, nb_clusters, offset, s->cluster_size); if (ret < 0) { return ret; } if ((*refcount_table)[cluster] != 1) { fprintf(stderr, "ERROR refcount block %" PRId64 " refcount=%d\n", i, (*refcount_table)[cluster]); res->corruptions++; *rebuild = true; } } } return 0; }
1threat
static void bdrv_inherited_options(int *child_flags, QDict *child_options, int parent_flags, QDict *parent_options) { int flags = parent_flags; flags |= BDRV_O_PROTOCOL; qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_DIRECT); qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_NO_FLUSH); qdict_copy_default(child_options, parent_options, BDRV_OPT_READ_ONLY); flags |= BDRV_O_UNMAP; flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | BDRV_O_COPY_ON_READ | BDRV_O_NO_IO); *child_flags = flags; }
1threat
Embedding react-boilerplate in Rails 5.1 : <p>Has anyone tried integrating <a href="https://github.com/react-boilerplate/react-boilerplate" rel="noreferrer">react-boilerplate</a> into a Ruby on Rails 5.1 app? It looks like the <a href="https://medium.com/@hpux/rails-5-1-loves-javascript-a1d84d5318b" rel="noreferrer">5.1 approach to embedding React components in views</a> is fairly simple. Rails 5.1 is using <a href="https://github.com/rails/webpacker" rel="noreferrer">webpacker</a> which has its approach to mixing Ruby configuration with Webpack. It doesn't seem very straightforward, but does anyone have any techniques for accomplishing this?</p>
0debug
i am unable to install java8 on my ubuntu gcp machine : i have tried with the commands • sudo add-apt-repository ppa:webupd8team/java • sudo apt-get update • sudo apt install oracle-java8-installer but after i could see java was not installed on my ubuntu machine.it hits the error like unable to locate package oracle-java8-installer sudo apt install oracle-java8-installer reading package lists...done Building dependency tree Reading state information...Done E:Unable to locate package oracle-java8-installer Hoe should i resolve this can someone tell me briefly to solve this.
0debug
MAKE_ACCESSORS(AVVDPAUContext, vdpau_hwaccel, AVVDPAU_Render2, render2) int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, int level) { VDPAUHWContext *hwctx = avctx->hwaccel_context; VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data; VdpVideoSurfaceQueryCapabilities *surface_query_caps; VdpDecoderQueryCapabilities *decoder_query_caps; VdpDecoderCreate *create; void *func; VdpStatus status; VdpBool supported; uint32_t max_level, max_mb, max_width, max_height; uint32_t width = (avctx->coded_width + 1) & ~1; uint32_t height = (avctx->coded_height + 3) & ~3; vdctx->width = UINT32_MAX; vdctx->height = UINT32_MAX; hwctx->reset = 0; if (!hwctx) { vdctx->device = VDP_INVALID_HANDLE; av_log(avctx, AV_LOG_WARNING, "hwaccel_context has not been setup by the user application, cannot initialize\n"); return 0; } if (hwctx->context.decoder != VDP_INVALID_HANDLE) { vdctx->decoder = hwctx->context.decoder; vdctx->render = hwctx->context.render; vdctx->device = VDP_INVALID_HANDLE; return 0; } vdctx->device = hwctx->device; vdctx->get_proc_address = hwctx->get_proc_address; if (level < 0) return AVERROR(ENOTSUP); status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES, &func); if (status != VDP_STATUS_OK) return vdpau_error(status); else surface_query_caps = func; status = surface_query_caps(vdctx->device, VDP_CHROMA_TYPE_420, &supported, &max_width, &max_height); if (status != VDP_STATUS_OK) return vdpau_error(status); if (supported != VDP_TRUE || max_width < width || max_height < height) return AVERROR(ENOTSUP); status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES, &func); if (status != VDP_STATUS_OK) return vdpau_error(status); else decoder_query_caps = func; status = decoder_query_caps(vdctx->device, profile, &supported, &max_level, &max_mb, &max_width, &max_height); if (status != VDP_STATUS_OK) return vdpau_error(status); if (supported != VDP_TRUE || max_level < level || max_width < width || max_height < height) return AVERROR(ENOTSUP); status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_CREATE, &func); if (status != VDP_STATUS_OK) return vdpau_error(status); else create = func; status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_RENDER, &func); if (status != VDP_STATUS_OK) return vdpau_error(status); else vdctx->render = func; status = create(vdctx->device, profile, width, height, avctx->refs, &vdctx->decoder); if (status == VDP_STATUS_OK) { vdctx->width = avctx->coded_width; vdctx->height = avctx->coded_height; } return vdpau_error(status); }
1threat
C++ Programming, having trouble programming finding velocity and distance : <p>Hey I'm a beginner taking an intro to C++ class, and this is my first assignment. I posted this a couple of days ago but I still am somewhat lost. I have to use the formulas: d=v0*t + 1/2*g<em>t^2, and v= v0 + g</em>t. where v0 stays constant at 0 and g also stays constant at 9.807 m/s^2. I keep getting one error which is "expected unqualified-id before "{" token" on the first { and cannot seem to fix them, and im sure this code is incorrect, so can you help me figure this out?</p> <pre><code>#include &lt;cstdlib&gt; #include &lt;iostream&gt; #include &lt;math.h&gt; using namespace std; const float GRAVITY = 9.807, INITIALVELOCITY = 0; int seconds; { cout &lt;&lt; "Please enter the time in seconds." &lt;&lt; endl; cin &gt;&gt; seconds; } //end function Time int main(int argc, char *argv[]) { float distance, velocity, seconds; void getSeconds (void); cout.setf (ios::fixed,ios::floatfield); cin &gt;&gt; seconds; while (seconds &gt; 0) { distance = INITIALVELOCITY * seconds + (0.5 * GRAVITY * pow(seconds, 2)); velocity = INITIALVELOCITY + (GRAVITY * seconds); cout.precision (0); cout &lt;&lt; endl &lt;&lt; "WHEN THE TIME IS" &lt;&lt; seconds &lt;&lt; "SECONDS THE DISTANCE" "TRAVELED IS" &lt;&lt; distance &lt;&lt; "METERS THE VELOCITY IS" &lt;&lt; velocity &lt;&lt; "METERS PER SECOND."; cout. precision(1); cout&lt;&lt; seconds &lt;&lt; distance &lt;&lt; velocity &lt;&lt; endl &lt;&lt; endl; } system ("PAUSE"); return EXIT_SUCCESS; } //end main </code></pre>
0debug
void backup_start(const char *job_id, BlockDriverState *bs, BlockDriverState *target, int64_t speed, MirrorSyncMode sync_mode, BdrvDirtyBitmap *sync_bitmap, bool compress, BlockdevOnError on_source_error, BlockdevOnError on_target_error, int creation_flags, BlockCompletionFunc *cb, void *opaque, BlockJobTxn *txn, Error **errp) { int64_t len; BlockDriverInfo bdi; BackupBlockJob *job = NULL; int ret; assert(bs); assert(target); if (bs == target) { error_setg(errp, "Source and target cannot be the same"); return; } if (!bdrv_is_inserted(bs)) { error_setg(errp, "Device is not inserted: %s", bdrv_get_device_name(bs)); return; } if (!bdrv_is_inserted(target)) { error_setg(errp, "Device is not inserted: %s", bdrv_get_device_name(target)); return; } if (compress && target->drv->bdrv_co_pwritev_compressed == NULL) { error_setg(errp, "Compression is not supported for this drive %s", bdrv_get_device_name(target)); return; } if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) { return; } if (bdrv_op_is_blocked(target, BLOCK_OP_TYPE_BACKUP_TARGET, errp)) { return; } if (sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) { if (!sync_bitmap) { error_setg(errp, "must provide a valid bitmap name for " "\"incremental\" sync mode"); return; } if (bdrv_dirty_bitmap_create_successor(bs, sync_bitmap, errp) < 0) { return; } } else if (sync_bitmap) { error_setg(errp, "a sync_bitmap was provided to backup_run, " "but received an incompatible sync_mode (%s)", MirrorSyncMode_lookup[sync_mode]); return; } len = bdrv_getlength(bs); if (len < 0) { error_setg_errno(errp, -len, "unable to get length for '%s'", bdrv_get_device_name(bs)); goto error; } job = block_job_create(job_id, &backup_job_driver, bs, speed, creation_flags, cb, opaque, errp); if (!job) { goto error; } job->target = blk_new(); blk_insert_bs(job->target, target); job->on_source_error = on_source_error; job->on_target_error = on_target_error; job->sync_mode = sync_mode; job->sync_bitmap = sync_mode == MIRROR_SYNC_MODE_INCREMENTAL ? sync_bitmap : NULL; job->compress = compress; ret = bdrv_get_info(target, &bdi); if (ret < 0 && !target->backing) { error_setg_errno(errp, -ret, "Couldn't determine the cluster size of the target image, " "which has no backing file"); error_append_hint(errp, "Aborting, since this may create an unusable destination image\n"); goto error; } else if (ret < 0 && target->backing) { job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT; } else { job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size); } block_job_add_bdrv(&job->common, target); job->common.len = len; job->common.co = qemu_coroutine_create(backup_run, job); block_job_txn_add_job(txn, &job->common); qemu_coroutine_enter(job->common.co); return; error: if (sync_bitmap) { bdrv_reclaim_dirty_bitmap(bs, sync_bitmap, NULL); } if (job) { blk_unref(job->target); block_job_unref(&job->common); } }
1threat
static int nic_can_receive(NetClientState *nc) { EEPRO100State *s = qemu_get_nic_opaque(nc); TRACE(RXTX, logout("%p\n", s)); return get_ru_state(s) == ru_ready; #if 0 return !eepro100_buffer_full(s); #endif }
1threat
static void dbdma_end(DBDMA_io *io) { DBDMA_channel *ch = io->channel; dbdma_cmd *current = &ch->current; if (conditional_wait(ch)) goto wait; current->xfer_status = cpu_to_le16(be32_to_cpu(ch->regs[DBDMA_STATUS])); current->res_count = cpu_to_le16(be32_to_cpu(io->len)); dbdma_cmdptr_save(ch); if (io->is_last) ch->regs[DBDMA_STATUS] &= cpu_to_be32(~FLUSH); conditional_interrupt(ch); conditional_branch(ch); wait: ch->processing = 0; if ((ch->regs[DBDMA_STATUS] & cpu_to_be32(RUN)) && (ch->regs[DBDMA_STATUS] & cpu_to_be32(ACTIVE))) channel_run(ch); }
1threat
static inline void dv_decode_video_segment(DVVideoDecodeContext *s, UINT8 *buf_ptr1, const UINT16 *mb_pos_ptr) { int quant, dc, dct_mode, class1, j; int mb_index, mb_x, mb_y, v, last_index; DCTELEM *block, *block1; int c_offset, bits_left; UINT8 *y_ptr; BlockInfo mb_data[5 * 6], *mb, *mb1; void (*idct_put)(UINT8 *dest, int line_size, DCTELEM *block); UINT8 *buf_ptr; PutBitContext pb, vs_pb; UINT8 mb_bit_buffer[80 + 4]; int mb_bit_count; UINT8 vs_bit_buffer[5 * 80 + 4]; int vs_bit_count; memset(s->block, 0, sizeof(s->block)); buf_ptr = buf_ptr1; block1 = &s->block[0][0]; mb1 = mb_data; init_put_bits(&vs_pb, vs_bit_buffer, 5 * 80, NULL, NULL); vs_bit_count = 0; for(mb_index = 0; mb_index < 5; mb_index++) { quant = buf_ptr[3] & 0x0f; buf_ptr += 4; init_put_bits(&pb, mb_bit_buffer, 80, NULL, NULL); mb_bit_count = 0; mb = mb1; block = block1; for(j = 0;j < 6; j++) { init_get_bits(&s->gb, buf_ptr, 14); dc = get_bits(&s->gb, 9); dc = (dc << (32 - 9)) >> (32 - 9); dct_mode = get_bits1(&s->gb); mb->dct_mode = dct_mode; mb->scan_table = s->dv_zigzag[dct_mode]; class1 = get_bits(&s->gb, 2); mb->shift_offset = (class1 == 3); mb->shift_table = s->dv_shift[dct_mode] [quant + dv_quant_offset[class1]]; dc = dc << 2; dc += 1024; block[0] = dc; last_index = block_sizes[j]; buf_ptr += last_index >> 3; mb->pos = 0; mb->partial_bit_count = 0; dv_decode_ac(s, mb, block, last_index); bits_left = last_index - s->gb.index; if (mb->eob_reached) { mb->partial_bit_count = 0; mb_bit_count += bits_left; bit_copy(&pb, &s->gb, bits_left); } else { mb->partial_bit_count = bits_left; mb->partial_bit_buffer = get_bits(&s->gb, bits_left); } block += 64; mb++; } flush_put_bits(&pb); #ifdef VLC_DEBUG printf("***pass 2 size=%d\n", mb_bit_count); #endif block = block1; mb = mb1; init_get_bits(&s->gb, mb_bit_buffer, 80); for(j = 0;j < 6; j++) { if (!mb->eob_reached && s->gb.index < mb_bit_count) { dv_decode_ac(s, mb, block, mb_bit_count); if (!mb->eob_reached) { bits_left = mb_bit_count - s->gb.index; if (bits_left > 0) { mb->partial_bit_count += bits_left; mb->partial_bit_buffer = (mb->partial_bit_buffer << bits_left) | get_bits(&s->gb, bits_left); } goto next_mb; } } block += 64; mb++; } bits_left = mb_bit_count - s->gb.index; vs_bit_count += bits_left; bit_copy(&vs_pb, &s->gb, bits_left); next_mb: mb1 += 6; block1 += 6 * 64; } flush_put_bits(&vs_pb); #ifdef VLC_DEBUG printf("***pass 3 size=%d\n", vs_bit_count); #endif block = &s->block[0][0]; mb = mb_data; init_get_bits(&s->gb, vs_bit_buffer, 5 * 80); for(mb_index = 0; mb_index < 5; mb_index++) { for(j = 0;j < 6; j++) { if (!mb->eob_reached) { #ifdef VLC_DEBUG printf("start %d:%d\n", mb_index, j); #endif dv_decode_ac(s, mb, block, vs_bit_count); } block += 64; mb++; } } block = &s->block[0][0]; mb = mb_data; for(mb_index = 0; mb_index < 5; mb_index++) { v = *mb_pos_ptr++; mb_x = v & 0xff; mb_y = v >> 8; y_ptr = s->current_picture[0] + (mb_y * s->linesize[0] * 8) + (mb_x * 8); if (s->sampling_411) c_offset = (mb_y * s->linesize[1] * 8) + ((mb_x >> 2) * 8); else c_offset = ((mb_y >> 1) * s->linesize[1] * 8) + ((mb_x >> 1) * 8); for(j = 0;j < 6; j++) { idct_put = s->idct_put[mb->dct_mode]; if (j < 4) { if (s->sampling_411 && mb_x < (704 / 8)) { idct_put(y_ptr + (j * 8), s->linesize[0], block); } else { idct_put(y_ptr + ((j & 1) * 8) + ((j >> 1) * 8 * s->linesize[0]), s->linesize[0], block); } } else { if (s->sampling_411 && mb_x >= (704 / 8)) { uint8_t pixels[64], *c_ptr, *c_ptr1, *ptr; int y, linesize; idct_put(pixels, 8, block); linesize = s->linesize[6 - j]; c_ptr = s->current_picture[6 - j] + c_offset; ptr = pixels; for(y = 0;y < 8; y++) { c_ptr1 = c_ptr + linesize; c_ptr1[0] = c_ptr[0] = (ptr[0] + ptr[1]) >> 1; c_ptr1[1] = c_ptr[1] = (ptr[2] + ptr[3]) >> 1; c_ptr1[2] = c_ptr[2] = (ptr[4] + ptr[5]) >> 1; c_ptr1[3] = c_ptr[3] = (ptr[6] + ptr[7]) >> 1; c_ptr += linesize * 2; ptr += 8; } } else { idct_put(s->current_picture[6 - j] + c_offset, s->linesize[6 - j], block); } } block += 64; mb++; } } }
1threat
Weird issue in C : <p>thanks for your help. <br>I'm trying to similate a simplified version of ARM, and I have a very weird error in c <a href="http://pastebin.com/3XRdngty" rel="nofollow noreferrer">http://pastebin.com/3XRdngty</a> .<br> I don't understant why in the function executer_code(), the for doesn't work ...<br> I mean it should be looping untill the variable "i" is equal to the variable nombre_instruction, <br>but it turns out that the variable "nombre_instruction" is the right value the first time it goes in<br> the for, but the second time it doesn't go in the for because its value changed to 0,<br> I search on the internet if someone has the same kind of error, <br>and i didn't find anything.<br>I reread my code but still I cannot figure out why it does this, 3 hours has passed already. And thank you again for you help :)</p>
0debug
from collections import Counter def count_variable(a,b,c,d): c = Counter(p=a, q=b, r=c, s=d) return list(c.elements())
0debug
Storing a string list in a new csv file : I am new to Python and somehow can't quite get this simple task to run. I have generated a randomization of some images I would like to later present to each participant in my experiment. The randomization assigns each participant a particular order for a list of images to be presented. I end up, for example, with a list that looks like this (for one participant): str_all = ['01_2.jpg', '06_2.jpg', '08_1.jpg', '04_2.jpg', '10_1.jpg', '07_2.jpg', '02_1.jpg', '05_2.jpg', '09_1.jpg', '03_1.jpg'] For each participant this list is different. Before a new randomization is generated for a new participant to get a new "str_all" list, I would like to store the string elements in a way that I can use them to retrieve those images later. I created manually with Excel a new csv file called list_stim.csv. I would like to have each list in one row (each row = one participant) but don't know if this is the best way to place each. I tried doing this but it did not work: with open('list_stim.csv', 'w') as fp: wr = csv.writer(fp, delimiter=',') wr.writerows([str_all[i]]) wr.writerow("\n") Any advice? Thank you!
0debug
static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy) { int i; dst->key_frame = src->key_frame; dst->pict_type = src->pict_type; dst->sample_aspect_ratio = src->sample_aspect_ratio; dst->pts = src->pts; dst->repeat_pict = src->repeat_pict; dst->interlaced_frame = src->interlaced_frame; dst->top_field_first = src->top_field_first; dst->palette_has_changed = src->palette_has_changed; dst->sample_rate = src->sample_rate; dst->opaque = src->opaque; #if FF_API_PKT_PTS FF_DISABLE_DEPRECATION_WARNINGS dst->pkt_pts = src->pkt_pts; FF_ENABLE_DEPRECATION_WARNINGS #endif dst->pkt_dts = src->pkt_dts; dst->pkt_pos = src->pkt_pos; dst->pkt_size = src->pkt_size; dst->pkt_duration = src->pkt_duration; dst->reordered_opaque = src->reordered_opaque; dst->quality = src->quality; dst->best_effort_timestamp = src->best_effort_timestamp; dst->coded_picture_number = src->coded_picture_number; dst->display_picture_number = src->display_picture_number; dst->flags = src->flags; dst->decode_error_flags = src->decode_error_flags; dst->color_primaries = src->color_primaries; dst->color_trc = src->color_trc; dst->colorspace = src->colorspace; dst->color_range = src->color_range; dst->chroma_location = src->chroma_location; av_dict_copy(&dst->metadata, src->metadata, 0); #if FF_API_ERROR_FRAME FF_DISABLE_DEPRECATION_WARNINGS memcpy(dst->error, src->error, sizeof(dst->error)); FF_ENABLE_DEPRECATION_WARNINGS #endif for (i = 0; i < src->nb_side_data; i++) { const AVFrameSideData *sd_src = src->side_data[i]; AVFrameSideData *sd_dst; if ( sd_src->type == AV_FRAME_DATA_PANSCAN && (src->width != dst->width || src->height != dst->height)) continue; if (force_copy) { sd_dst = av_frame_new_side_data(dst, sd_src->type, sd_src->size); if (!sd_dst) { wipe_side_data(dst); return AVERROR(ENOMEM); memcpy(sd_dst->data, sd_src->data, sd_src->size); } else { sd_dst = av_frame_new_side_data(dst, sd_src->type, 0); if (!sd_dst) { wipe_side_data(dst); return AVERROR(ENOMEM); if (sd_src->buf) { sd_dst->buf = av_buffer_ref(sd_src->buf); if (!sd_dst->buf) { wipe_side_data(dst); return AVERROR(ENOMEM); sd_dst->data = sd_dst->buf->data; sd_dst->size = sd_dst->buf->size; av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0); #if FF_API_FRAME_QP FF_DISABLE_DEPRECATION_WARNINGS dst->qscale_table = NULL; dst->qstride = 0; dst->qscale_type = 0; av_buffer_unref(&dst->qp_table_buf); if (src->qp_table_buf) { dst->qp_table_buf = av_buffer_ref(src->qp_table_buf); if (dst->qp_table_buf) { dst->qscale_table = dst->qp_table_buf->data; dst->qstride = src->qstride; dst->qscale_type = src->qscale_type; FF_ENABLE_DEPRECATION_WARNINGS #endif return 0;
1threat
need more information on double data type in vbs : <p>I could see double is storing 15 digits in VBS, But in msdn documentation it's given as "-1.79769313486231E308" please clarify</p> <p><a href="https://msdn.microsoft.com/en-in/library/aa263420(v=vs.60).aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-in/library/aa263420(v=vs.60).aspx</a></p>
0debug
void test_fenv(void) { struct __attribute__((packed)) { uint16_t fpuc; uint16_t dummy1; uint16_t fpus; uint16_t dummy2; uint16_t fptag; uint16_t dummy3; uint32_t ignored[4]; long double fpregs[8]; } float_env32; struct __attribute__((packed)) { uint16_t fpuc; uint16_t fpus; uint16_t fptag; uint16_t ignored[4]; long double fpregs[8]; } float_env16; double dtab[8]; double rtab[8]; int i; for(i=0;i<8;i++) dtab[i] = i + 1; TEST_ENV(&float_env16, "data16 fnstenv", "data16 fldenv"); TEST_ENV(&float_env16, "data16 fnsave", "data16 frstor"); TEST_ENV(&float_env32, "fnstenv", "fldenv"); TEST_ENV(&float_env32, "fnsave", "frstor"); for(i=0;i<5;i++) asm volatile ("fldl %0" : : "m" (dtab[i])); asm volatile("ffree %st(2)"); asm volatile ("fnstenv %0\n" : : "m" (float_env32)); asm volatile ("fninit"); printf("fptag=%04x\n", float_env32.fptag); }
1threat