problem
stringlengths
26
131k
labels
class label
2 classes
static int kvm_has_msr_hsave_pa(CPUState *env) { kvm_supported_msrs(env); return has_msr_hsave_pa; }
1threat
is there a function to find out how to get precise numbers represented in float format? : ok, 2^32, 2^32+1, 2^32+2 isn't precise when stored as a float however, 2^64 is, is there function out that i can feed it a number and it tell me if a float will store it precisely. the only reason i am interested in floats is because i want to store very long digit numbers in as few bytes as possible. 2^64 is 20 digits. i found this article, but i'm not sure if it applies since it talks about doubles and i know python does things differently? https://stackoverflow.com/questions/4610999/how-to-calculate-double-float- precision
0debug
static void test_visitor_in_errors(TestInputVisitorData *data, const void *unused) { TestStruct *p = NULL; Error *err = NULL; Visitor *v; strList *q = NULL; UserDefTwo *r = NULL; WrapAlternate *s = NULL; v = visitor_input_test_init(data, "{ 'integer': false, 'boolean': 'foo', " "'string': -42 }"); visit_type_TestStruct(v, NULL, &p, &err); g_assert(!p); v = visitor_input_test_init(data, "[ '1', '2', false, '3' ]"); visit_type_strList(v, NULL, &q, &err); assert(!q); }
1threat
Inserting Response data inside data into table using Angular JS ng-repeat : I have a response as given below Response : response: {"json": {"response": {"servicetype":"", "functiontype":"", "statuscode":"0", "statusmessage":"Success", "data":[{"graphtype":"piechart", "xlabel":"state", "ylabel":"count", "s1":"contact", "s2":"User", "data":["Total Contacts: 1 Users: 20", [{"x":"Karnataka","s1":"1","s2":"15","lat":"12.9716","long":"77.5946"}, {"x":"New Delhi","s1":"0","s2":"5","lat":"28.6139","long":"77.2090"}]]}]}}} I need to insert table row name , table data name dynamically using ng-repeat. My table shoud look like. State Contact User Karnatka 1 15 New Delhi 0 5
0debug
How can I dynamically render a variable name in dot notation? : <p>I am not sure how to accurately describe this issue, but the code should suffice. This code is in React.js, but I think it is a JavaScript question more than anything. I have a variable initialization: </p> <pre><code>const key = this.state.key; </code></pre> <p>This will evaluate to one of three strings...title, author, or year. How can I use this variable in the following block?</p> <pre><code>let filteredBooks = books.filter( (book) =&gt; { return book.key.toString().toLowerCase().indexOf(this.state.query) !== -1; } ); </code></pre> <p>Book has properties title, author, and year... that I want to query, and I would rather not switch through the possible values of key(only 3 right now), in case I want to scale with more properties for the book object later. How can I dynamically reference key, and render it on the fly to either title, author, year, or any other property that key might be. (key is not a property of book). I have tried book.eval(key), but this throws an "undefined is not a function" compilation error at eval(key). Once again, I am using React.js but I am thinking this is a general Javascript question. Thanks!</p>
0debug
Finding the area of a rectangle and a square javascript : I would like your help with my assignment. I need to find the area and perimeter of a square and rectangle. I was able to get the area and perimeter of a rectangle, i do not know how to include that in a case or switch Please find below my code. import java.io.InputStream; import java.io.StringReader; import java.util.Scanner; class shape { public static void main(String args[]) { double length = 0; double width = 0; double perimeter = 0; double area = 0; Scanner sc = new Scanner(System.in); System.out.println("Enter length of rectangle"); length = sc.nextDouble(); System.out.println("Enter width of rectangle"); width = sc.nextDouble(); area = length * width; perimeter = 2*(length+width); System.out.println("Area of rectangle is : "+area); System.out.println("Perimeter of rectangle is : "+perimeter); } }
0debug
What happens when you run ng serve? : <p>I've been using <a href="https://github.com/angular/angular-cli">Angular-CLI</a> for the last little while. It comes with a number of commands including <code>ng serve</code> which spins up a server at <code>localhost:4200</code>.</p> <p>I'm used to using Grunt and Gulp which can be configured to suit my needs. I wanted to configure Angular-CLI's server but then I realized I didn't know what it was or how to configure it. Grepping the project for <code>serve</code> hasn't unearthed anything that seems useful.</p> <p>So, what exactly does <code>ng serve</code> do?</p>
0debug
Eclipse can't find or load main class : <p>Ahhhhhh! I was messing with Eclipse trying to run C programs and after giving up along the way I screwed up everyone of my Java projects.The error message states <a href="https://i.stack.imgur.com/uf8Nx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uf8Nx.png" alt="enter image description here"></a></p> <p>So, after alot of research and searching around, it looked like I needed to add my classpath and project files back into the build path, which I did <a href="https://i.stack.imgur.com/FZJh4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FZJh4.png" alt="enter image description here"></a></p> <p>Please tell me I didn't just ruin everyone of my Java projects. Any help would be so much appreciated, thanks!</p>
0debug
static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; return paio_submit(bs, s->hfile, sector_num, qiov, nb_sectors, cb, opaque, QEMU_AIO_WRITE); }
1threat
static int tusb6010_init(SysBusDevice *dev) { TUSBState *s = FROM_SYSBUS(TUSBState, dev); qemu_irq *musb_irqs; int i; s->otg_timer = qemu_new_timer_ns(vm_clock, tusb_otg_tick, s); s->pwr_timer = qemu_new_timer_ns(vm_clock, tusb_power_tick, s); memory_region_init_io(&s->iomem[1], &tusb_async_ops, s, "tusb-async", UINT32_MAX); sysbus_init_mmio_region(dev, &s->iomem[0]); sysbus_init_mmio_region(dev, &s->iomem[1]); sysbus_init_irq(dev, &s->irq); qdev_init_gpio_in(&dev->qdev, tusb6010_irq, musb_irq_max + 1); musb_irqs = g_new0(qemu_irq, musb_irq_max); for (i = 0; i < musb_irq_max; i++) { musb_irqs[i] = qdev_get_gpio_in(&dev->qdev, i + 1); } s->musb = musb_init(musb_irqs); return 0; }
1threat
are element id's avoided in modern web dev? : <p>I seem to remember reading or someone telling me that modern web dev practices tend to avoid assigning id's to elements in lieu of classes or data-attributes. Is this correct or am I possibly misinterpreting this practice based on my experience in one particular scenario?</p>
0debug
def tuple_modulo(test_tup1, test_tup2): res = tuple(ele1 % ele2 for ele1, ele2 in zip(test_tup1, test_tup2)) return (res)
0debug
Why is length of array still same after realloc? : <p>This is part of my code :</p> <pre><code>array = (int *) malloc(5*sizeof(int)); </code></pre> <p>it is initialised and has some values, I am skipping this step here for more clearance.</p> <pre><code>memmove(array, array + 1, 4*sizeof(int)); array = realloc(array, 4*sizeof(int)); </code></pre> <p>What i wanted to accomplish here is to remove first member of array and to move whole array one step to the left. Still when I try to check length of array using :</p> <pre><code>strlen(array); </code></pre> <p>I get value 5. It seems like realloc doesn't work properly, because when I also try to print fifth element of an array, which should be after realloc out of arrays range, it prints value which i previously gave to it. How is it possible? </p> <p>Can somebody point me out where am I making mistake and what am I missing? </p>
0debug
SignalR Core not generating(mapping) Client methods : <p>The SignalR Core is generating Hub proxies script, but not adding the "client" methods. <em>(No errors in server or client - only not working)</em></p> <p>Generated JS from <code>&lt;script src="http://localhost/signalr/hubs"&gt;</code></p> <pre><code>proxies['messageHub'] = this.createHubProxy('messageHub'); proxies['messageHub'].client = { }; proxies['messageHub'].server = { handleMessage: function (receivedString) { return proxies['messageHub'].invoke.apply(proxies['messageHub'], $.merge(["HandleMessage"], $.makeArray(arguments))); } }; </code></pre> <p>Here's the Hub in Server Side:</p> <pre><code>public class MessageHub : Hub { public void HandleMessage(string receivedString) { var responseString = string.Empty; MessageHandler.HandleMessage(receivedString, ref responseString); Clients.All.sendMessage(responseString); } } </code></pre> <p>The <strong>sendMessage</strong> methos should be included in the messageHub client proxies in the JS file. <em>$.connection.messageHub.client.sendMessage is undefined</em></p> <p>Only the <strong>handleMessage</strong> for server proxies was created (and working).</p> <p>Here's my StartUp.cs inclusions for SignalR:</p> <p>ConfigureServices:</p> <pre><code>services.AddMvc(options =&gt; { options.Filters.Add(new RoleFilterAttribute()); }).AddJsonOptions(options =&gt; options.SerializerSettings.ContractResolver = new DefaultContractResolver()); services.AddSignalR(options =&gt; options.Hubs.EnableDetailedErrors = true) </code></pre> <p>Configure:</p> <pre><code>app.UseWebSockets(); app.UseSignalR(); </code></pre> <p>project.json:</p> <pre><code>"Microsoft.AspNetCore.Mvc": "1.0.0-*", "Microsoft.AspNetCore.WebSockets": "1.0.0", "Microsoft.AspNetCore.SignalR.Server": "0.2.0-*", </code></pre> <p><strong>SOME ADDITIONAL TENTATIVES:</strong></p> <p>1 - Change method case in Server Side to see if it's mapped:</p> <pre><code>Clients.All.SendMessage(responseString); </code></pre> <p>Did not work!</p> <p>2 - Change the client side to dynamic mapping:</p> <pre><code>var connection = $.hubConnection('http://localhost/'); var proxy = connection.createHubProxy('messageHub'); connection.start({ withCredentials: false }).done(function () { console.log("CONNECTED") }); proxy.on("sendMessage", function (result) {console.log(result);}); proxy.invoke("handleMessage", msg).done(function(result)console.log(result);}); </code></pre> <p>Again only the handleMessage (server) worked.</p>
0debug
I am writing a function, and then evaluating if the function returns truthy or falsey : I am writing a function which returns the greater number out of two given numbers, then I want to evaluate if given two numbers the greater number is indeed the correct output. However I keep getting false, I have tried the following code or some small variations on it. ```javascript function maxNumber(n1, n2) { if (n1 > n2) { console.log(n1);} else { console.log(n2); } } function testMaxNumber() { console.log(maxNumber (0, 10)===10); }; testMaxNumber(); ``` > 10 (this part is what I expected, the second log outputs > false//I expect true
0debug
Python check if element of array contains string : <p>I have an array that has 1 element. This element contains: print(results_read[0])</p> <pre><code>[(u'n04019541', u'puck', 0.57829314), (u'n02974003', u'car_wheel', 0.24903433), (u'n03483316', u'hand_blower', 0.025689969), (u'n02910353', u'buckle', 0.015434729), (u'n04542943', u'waffle_iron', 0.012205523)] </code></pre> <p>How can I check if it contains 'car_wheel'? I tried:</p> <pre><code>if 'car_wheel' in results_read: print('yes') else: print('no') </code></pre> <p>Is there any other way to do this?</p>
0debug
Many CDNjs vs one minified local js : <pre><code>&lt;script src="//cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.3.1/jquery.inputmask.bundle.min.js"&gt;&lt;/script&gt; &lt;script src="//cdnjs.cloudflare.com/ajax/libs/numeral.js/1.5.3/numeral.min.js"&gt;&lt;/script&gt; &lt;script src="//cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.0/spin.min.js"&gt;&lt;/script&gt; &lt;script src="//cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.0/ladda.min.js"&gt;&lt;/script&gt; &lt;script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"&gt;&lt;/script&gt; &lt;script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-modal/2.2.6/js/bootstrap-modalmanager.min.js"&gt;&lt;/script&gt; &lt;script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-modal/2.2.6/js/bootstrap-modal.min.js"&gt;&lt;/script&gt; </code></pre> <p>vs</p> <pre><code>&lt;script src="/myMin.js"&gt; </code></pre> <p>(myMin.js will contain all js file concatenated together and minified) What is the best for performance? I am using cdnjs because it solves the problem of people in other region downloading the js file directly from my server. For example, people in Asia don't have to download my js file from USA server, which is a huge performance issue. <code>cdnjs</code> helps me with scattering js file all over the globe. Since cdnjs is downloaded asynchronously so when will <code>myMin.js</code> be preferred?</p>
0debug
static uint32_t drc_set_usable(sPAPRDRConnector *drc) { if (!drc->dev) { return RTAS_OUT_NO_SUCH_INDICATOR; } if (drc->awaiting_release && drc->awaiting_allocation) { return RTAS_OUT_NO_SUCH_INDICATOR; } drc->allocation_state = SPAPR_DR_ALLOCATION_STATE_USABLE; drc->awaiting_allocation = false; return RTAS_OUT_SUCCESS; }
1threat
How to change tab width in git diff? : <p>The standard spacing for a tab is 8 characters.</p> <p>I prefer to view that as 4 characters in my editors and console. I can easily change this default behavior on console with the <code>tabs</code> command:</p> <pre><code>tabs -4 </code></pre> <p>However, when using <code>git diff</code> or <code>git show</code> it displays in the default 8 character tab whitespace.</p> <p>How can I get <code>git diff</code> to render tabs as 4 character spaces?</p>
0debug
int event_notifier_init(EventNotifier *e, int active) { #ifdef CONFIG_EVENTFD int fd = eventfd(!!active, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) return -errno; e->fd = fd; return 0; #else return -ENOSYS; #endif }
1threat
MySQL UPDATE query with two WHERE caluses not working? : I have the following query that isnt working for some reason: UPDATE accounts SET displayname = 'test', member = '5' WHERE username = 'testuser' AND password = 'testpass'; However, this works fine: UPDATE accounts SET displayname = 'test', member = '5' WHERE username = 'testuser'; How do I update based on two where clauses?
0debug
How does one make programs with string equality in Python? : <p>Obviously, I've just started trying to make some random programs, and do not know much. A program I have tried to write is the following:</p> <pre><code>print('Please print your name') myName = input() if myName == 'No' print('Fine, be that way') </code></pre> <p>There is an error in the third line, and am not really sure why. How would I correct this?</p>
0debug
static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size) { VirtIOGPU *g = opaque; struct virtio_gpu_simple_resource *res; struct virtio_gpu_scanout *scanout; uint32_t resource_id, pformat; int i; g->hostmem = 0; resource_id = qemu_get_be32(f); while (resource_id != 0) { res = g_new0(struct virtio_gpu_simple_resource, 1); res->resource_id = resource_id; res->width = qemu_get_be32(f); res->height = qemu_get_be32(f); res->format = qemu_get_be32(f); res->iov_cnt = qemu_get_be32(f); pformat = get_pixman_format(res->format); if (!pformat) { return -EINVAL; res->image = pixman_image_create_bits(pformat, res->width, res->height, NULL, 0); if (!res->image) { return -EINVAL; res->hostmem = PIXMAN_FORMAT_BPP(pformat) * res->width * res->height; res->addrs = g_new(uint64_t, res->iov_cnt); res->iov = g_new(struct iovec, res->iov_cnt); for (i = 0; i < res->iov_cnt; i++) { res->addrs[i] = qemu_get_be64(f); res->iov[i].iov_len = qemu_get_be32(f); qemu_get_buffer(f, (void *)pixman_image_get_data(res->image), pixman_image_get_stride(res->image) * res->height); for (i = 0; i < res->iov_cnt; i++) { hwaddr len = res->iov[i].iov_len; res->iov[i].iov_base = cpu_physical_memory_map(res->addrs[i], &len, 1); if (!res->iov[i].iov_base || len != res->iov[i].iov_len) { return -EINVAL; QTAILQ_INSERT_HEAD(&g->reslist, res, next); g->hostmem += res->hostmem; resource_id = qemu_get_be32(f); vmstate_load_state(f, &vmstate_virtio_gpu_scanouts, g, 1); for (i = 0; i < g->conf.max_outputs; i++) { scanout = &g->scanout[i]; if (!scanout->resource_id) { continue; res = virtio_gpu_find_resource(g, scanout->resource_id); if (!res) { return -EINVAL; scanout->ds = qemu_create_displaysurface_pixman(res->image); if (!scanout->ds) { return -EINVAL; dpy_gfx_replace_surface(scanout->con, scanout->ds); dpy_gfx_update(scanout->con, 0, 0, scanout->width, scanout->height); update_cursor(g, &scanout->cursor); res->scanout_bitmask |= (1 << i); return 0;
1threat
Where is `git add` in Visual Studio Code? : <p>In Visual Studio Code, <code>Cmd-Shift-P</code> gives me the command palette. There are many Git commands listed in the palette, but the only result for "add" is "Add file to .gitignore". This is not what I want. I want the equivalent of <code>git add $CURRENT_FILE</code>. Such a command is provided, for example, by <a href="https://atom.io/packages/git-plus" rel="noreferrer">the git-plus extension to Atom</a>. What is its equivalent in Visual Studio Code?</p>
0debug
How to create new window linked to previous? - python : <p>I am creating very simply building game. I want to click on button in tkinter, which open a new window. In this window you would choose type of building, which you use in previous window, so both windows should be linked in this way. Do you now ho to simply create this type of window? Thank you. </p>
0debug
Why are Java Optionals immutable? : <p>I'd like to understand why Java 8 Optionals were designed to be immutable. Is it just for thread-safety?</p>
0debug
static int oggvorbis_encode_frame(AVCodecContext *avctx, unsigned char *packets, int buf_size, void *data) { OggVorbisContext *s = avctx->priv_data; ogg_packet op; float *audio = data; int pkt_size; if (data) { const int samples = avctx->frame_size; float **buffer; int c, channels = s->vi.channels; buffer = vorbis_analysis_buffer(&s->vd, samples); for (c = 0; c < channels; c++) { int i; int co = (channels > 8) ? c : ff_vorbis_encoding_channel_layout_offsets[channels - 1][c]; for (i = 0; i < samples; i++) buffer[c][i] = audio[i * channels + co]; } vorbis_analysis_wrote(&s->vd, samples); } else { if (!s->eof) vorbis_analysis_wrote(&s->vd, 0); s->eof = 1; } while (vorbis_analysis_blockout(&s->vd, &s->vb) == 1) { vorbis_analysis(&s->vb, NULL); vorbis_bitrate_addblock(&s->vb); while (vorbis_bitrate_flushpacket(&s->vd, &op)) { if (op.bytes == 1 && op.e_o_s) continue; if (s->buffer_index + sizeof(ogg_packet) + op.bytes > BUFFER_SIZE) { av_log(avctx, AV_LOG_ERROR, "libvorbis: buffer overflow."); return -1; } memcpy(s->buffer + s->buffer_index, &op, sizeof(ogg_packet)); s->buffer_index += sizeof(ogg_packet); memcpy(s->buffer + s->buffer_index, op.packet, op.bytes); s->buffer_index += op.bytes; } } pkt_size = 0; if (s->buffer_index) { ogg_packet *op2 = (ogg_packet *)s->buffer; op2->packet = s->buffer + sizeof(ogg_packet); pkt_size = op2->bytes; avctx->coded_frame->pts = ff_samples_to_time_base(avctx, op2->granulepos); if (pkt_size > buf_size) { av_log(avctx, AV_LOG_ERROR, "libvorbis: buffer overflow."); return -1; } memcpy(packets, op2->packet, pkt_size); s->buffer_index -= pkt_size + sizeof(ogg_packet); memmove(s->buffer, s->buffer + pkt_size + sizeof(ogg_packet), s->buffer_index); } return pkt_size; }
1threat
int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt, int is_vp7) { VP8Context *s = avctx->priv_data; int ret, i, referenced, num_jobs; enum AVDiscard skip_thresh; VP8Frame *av_uninit(curframe), *prev_frame; if (is_vp7) ret = vp7_decode_frame_header(s, avpkt->data, avpkt->size); else ret = vp8_decode_frame_header(s, avpkt->data, avpkt->size); if (ret < 0) goto err; prev_frame = s->framep[VP56_FRAME_CURRENT]; referenced = s->update_last || s->update_golden == VP56_FRAME_CURRENT || s->update_altref == VP56_FRAME_CURRENT; skip_thresh = !referenced ? AVDISCARD_NONREF : !s->keyframe ? AVDISCARD_NONKEY : AVDISCARD_ALL; if (avctx->skip_frame >= skip_thresh) { s->invisible = 1; memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4); goto skip_decode; } s->deblock_filter = s->filter.level && avctx->skip_loop_filter < skip_thresh; for (i = 0; i < 5; i++) if (s->frames[i].tf.f->data[0] && &s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) vp8_release_frame(s, &s->frames[i]); curframe = s->framep[VP56_FRAME_CURRENT] = vp8_find_free_buffer(s); if (!s->colorspace) avctx->colorspace = AVCOL_SPC_BT470BG; if (s->fullrange) avctx->color_range = AVCOL_RANGE_JPEG; else avctx->color_range = AVCOL_RANGE_MPEG; if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] || !s->framep[VP56_FRAME_GOLDEN] || !s->framep[VP56_FRAME_GOLDEN2])) { av_log(avctx, AV_LOG_WARNING, "Discarding interframe without a prior keyframe!\n"); ret = AVERROR_INVALIDDATA; goto err; } curframe->tf.f->key_frame = s->keyframe; curframe->tf.f->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; if ((ret = vp8_alloc_frame(s, curframe, referenced)) < 0) goto err; if (s->update_altref != VP56_FRAME_NONE) s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref]; else s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[VP56_FRAME_GOLDEN2]; if (s->update_golden != VP56_FRAME_NONE) s->next_framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden]; else s->next_framep[VP56_FRAME_GOLDEN] = s->framep[VP56_FRAME_GOLDEN]; if (s->update_last) s->next_framep[VP56_FRAME_PREVIOUS] = curframe; else s->next_framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_PREVIOUS]; s->next_framep[VP56_FRAME_CURRENT] = curframe; if (avctx->codec->update_thread_context) ff_thread_finish_setup(avctx); s->linesize = curframe->tf.f->linesize[0]; s->uvlinesize = curframe->tf.f->linesize[1]; memset(s->top_nnz, 0, s->mb_width * sizeof(*s->top_nnz)); if (!s->mb_layout) memset(s->macroblocks + s->mb_height * 2 - 1, 0, (s->mb_width + 1) * sizeof(*s->macroblocks)); if (!s->mb_layout && s->keyframe) memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width * 4); memset(s->ref_count, 0, sizeof(s->ref_count)); if (s->mb_layout == 1) { if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map) ff_thread_await_progress(&prev_frame->tf, 1, 0); if (is_vp7) vp7_decode_mv_mb_modes(avctx, curframe, prev_frame); else vp8_decode_mv_mb_modes(avctx, curframe, prev_frame); } if (avctx->active_thread_type == FF_THREAD_FRAME) num_jobs = 1; else num_jobs = FFMIN(s->num_coeff_partitions, avctx->thread_count); s->num_jobs = num_jobs; s->curframe = curframe; s->prev_frame = prev_frame; s->mv_min.y = -MARGIN; s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; for (i = 0; i < MAX_THREADS; i++) { VP8ThreadData *td = &s->thread_data[i]; atomic_init(&td->thread_mb_pos, 0); atomic_init(&td->wait_mb_pos, INT_MAX); } if (is_vp7) avctx->execute2(avctx, vp7_decode_mb_row_sliced, s->thread_data, NULL, num_jobs); else avctx->execute2(avctx, vp8_decode_mb_row_sliced, s->thread_data, NULL, num_jobs); ff_thread_report_progress(&curframe->tf, INT_MAX, 0); memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4); skip_decode: if (!s->update_probabilities) s->prob[0] = s->prob[1]; if (!s->invisible) { if ((ret = av_frame_ref(data, curframe->tf.f)) < 0) return ret; *got_frame = 1; } return avpkt->size; err: memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4); return ret; }
1threat
I want to code a calendar but there comes an value error and I dont know how to debug my code : I want to code a calendar with two lists in the first are the dates and in the second are the events. I want that you have to input a date if its in the calendar list I want my code to search where it is in the list. Then my code should search what is in the events list at the same location and print the Event. Thanks for every anser. p.s. I code with python since a few weeks so I am still a noob calendar = ['01.02.2019', '02.02.2019'] termine = ['15:20 playing football', '17:30 playing basketball'] date = str(input('Date: ')) if (date in calendar): print ('found'); esindices = [i for i, x in enumerate(calendar) if x == date] print (esindices) print(events[int(esindices)]) Date: 01.02.2019 found [0] --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-17-00e8535c4c6c> in <module> 8 esindices = [i for i, x in enumerate(calendar) if x == date] 9 print (esindices) ---> 10 print(events[int(esindices)]) NameError: name 'events' is not defined This is the Error which comes and I dont know how to solve this.
0debug
How to add a fragment to an Activity without a container : <p>Is that possible I can add a fragment view on the activity view without specifying "fragment" view component in activity's layout xml file? Which function should I look for?</p>
0debug
static void qemu_input_transform_abs_rotate(InputEvent *evt) { InputMoveEvent *move = evt->u.abs; switch (graphic_rotate) { case 90: if (move->axis == INPUT_AXIS_X) { move->axis = INPUT_AXIS_Y; } else if (move->axis == INPUT_AXIS_Y) { move->axis = INPUT_AXIS_X; move->value = INPUT_EVENT_ABS_SIZE - 1 - move->value; } break; case 180: move->value = INPUT_EVENT_ABS_SIZE - 1 - move->value; break; case 270: if (move->axis == INPUT_AXIS_X) { move->axis = INPUT_AXIS_Y; move->value = INPUT_EVENT_ABS_SIZE - 1 - move->value; } else if (move->axis == INPUT_AXIS_Y) { move->axis = INPUT_AXIS_X; } break; } }
1threat
How to serve an angular2 app in a node.js server : <p>I'm building a web app using Angular2, to create the project I'm using Angular2 CLI webpack. Angular2 app uses other external packages also (Eg: Firebase). In addition to that, I need to create a REST API running on node.js</p> <p>How can I serve both of Angular2 app and REST API using node.js server</p>
0debug
void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, int mb_x, int mb_y) { AVCodecContext *avctx = s->avctx; int x, y, mode, nnz, tr; if (!(avctx->flags & CODEC_FLAG_EMU_EDGE && !mb_y) && (s->deblock_filter || !mb_y)) xchg_mb_border(s->top_border[mb_x+1], dst[0], dst[1], dst[2], s->linesize, s->uvlinesize, mb_x, mb_y, s->mb_width, s->filter.simple, 1); if (mb->mode < MODE_I4x4) { if (avctx->flags & CODEC_FLAG_EMU_EDGE) { mode = check_intra_pred8x8_mode_emuedge(mb->mode, mb_x, mb_y); } else { mode = check_intra_pred8x8_mode(mb->mode, mb_x, mb_y); } s->hpc.pred16x16[mode](dst[0], s->linesize); } else { uint8_t *ptr = dst[0]; uint8_t *intra4x4 = s->intra4x4_pred_mode_mb; uint8_t tr_top[4] = { 127, 127, 127, 127 }; uint8_t *tr_right = ptr - s->linesize + 16; if (mb_x == s->mb_width-1) { tr = tr_right[-1]*0x01010101; tr_right = (uint8_t *)&tr; } if (mb->skip) AV_ZERO128(s->non_zero_count_cache); for (y = 0; y < 4; y++) { uint8_t *topright = ptr + 4 - s->linesize; for (x = 0; x < 4; x++) { int copy = 0, linesize = s->linesize; uint8_t *dst = ptr+4*x; DECLARE_ALIGNED(4, uint8_t, copy_dst)[5*8]; if ((y == 0 || x == 3) && mb_y == 0 && avctx->flags & CODEC_FLAG_EMU_EDGE) { topright = tr_top; } else if (x == 3) topright = tr_right; if (avctx->flags & CODEC_FLAG_EMU_EDGE) { mode = check_intra_pred4x4_mode_emuedge(intra4x4[x], mb_x + x, mb_y + y, &copy); if (copy) { dst = copy_dst + 12; linesize = 8; if (!(mb_y + y)) { copy_dst[3] = 127U; * (uint32_t *) (copy_dst + 4) = 127U * 0x01010101U; } else { * (uint32_t *) (copy_dst + 4) = * (uint32_t *) (ptr+4*x-s->linesize); if (!(mb_x + x)) { copy_dst[3] = 129U; } else { copy_dst[3] = ptr[4*x-s->linesize-1]; } } if (!(mb_x + x)) { copy_dst[11] = copy_dst[19] = copy_dst[27] = copy_dst[35] = 129U; } else { copy_dst[11] = ptr[4*x -1]; copy_dst[19] = ptr[4*x+s->linesize -1]; copy_dst[27] = ptr[4*x+s->linesize*2-1]; copy_dst[35] = ptr[4*x+s->linesize*3-1]; } } } else { mode = intra4x4[x]; } s->hpc.pred4x4[mode](dst, topright, linesize); if (copy) { * (uint32_t *) (ptr+4*x) = * (uint32_t *) (copy_dst + 12); * (uint32_t *) (ptr+4*x+s->linesize) = * (uint32_t *) (copy_dst + 20); * (uint32_t *) (ptr+4*x+s->linesize*2) = * (uint32_t *) (copy_dst + 28); * (uint32_t *) (ptr+4*x+s->linesize*3) = * (uint32_t *) (copy_dst + 36); } nnz = s->non_zero_count_cache[y][x]; if (nnz) { if (nnz == 1) s->vp8dsp.vp8_idct_dc_add(ptr+4*x, s->block[y][x], s->linesize); else s->vp8dsp.vp8_idct_add(ptr+4*x, s->block[y][x], s->linesize); } topright += 4; } ptr += 4*s->linesize; intra4x4 += 4; } } if (avctx->flags & CODEC_FLAG_EMU_EDGE) { mode = check_intra_pred8x8_mode_emuedge(s->chroma_pred_mode, mb_x, mb_y); } else { mode = check_intra_pred8x8_mode(s->chroma_pred_mode, mb_x, mb_y); } s->hpc.pred8x8[mode](dst[1], s->uvlinesize); s->hpc.pred8x8[mode](dst[2], s->uvlinesize); if (!(avctx->flags & CODEC_FLAG_EMU_EDGE && !mb_y) && (s->deblock_filter || !mb_y)) xchg_mb_border(s->top_border[mb_x+1], dst[0], dst[1], dst[2], s->linesize, s->uvlinesize, mb_x, mb_y, s->mb_width, s->filter.simple, 0); }
1threat
long do_sigreturn(CPUMIPSState *regs) { struct sigframe *frame; abi_ulong frame_addr; sigset_t blocked; target_sigset_t target_set; int i; #if defined(DEBUG_SIGNAL) fprintf(stderr, "do_sigreturn\n"); #endif frame_addr = regs->active_tc.gpr[29]; if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) goto badframe; for(i = 0; i < TARGET_NSIG_WORDS; i++) { if(__get_user(target_set.sig[i], &frame->sf_mask.sig[i])) goto badframe; } target_to_host_sigset_internal(&blocked, &target_set); do_sigprocmask(SIG_SETMASK, &blocked, NULL); restore_sigcontext(regs, &frame->sf_sc); #if 0 __asm__ __volatile__( "move\t$29, %0\n\t" "j\tsyscall_exit" : :"r" (&regs)); #endif regs->active_tc.PC = regs->CP0_EPC; mips_set_hflags_isa_mode_from_pc(regs); regs->CP0_EPC = 0; return -TARGET_QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); return 0; }
1threat
Why Debug.Writeline is printing my message in reverse : <p>I write something like this:</p> <pre><code>Debug.WriteLine("RefKey value was {0}", refKey); </code></pre> <p>And then in output window I see:</p> <p><strong>200002V0dH: refInterfaceKey was {0}</strong></p> <p>Why is it kind of printing it right to left? </p>
0debug
static int uart_can_receive(void *opaque) { UartState *s = (UartState *)opaque; return RX_FIFO_SIZE - s->rx_count; }
1threat
Docker - No route to host : <p>When i try and connect to a port from within my container to another container, i am <strong>unsuccessful</strong> and get,</p> <pre><code>root@ac1590a59fe5:/opt/f5massupgrade# curl -v https://172.17.0.1:6379 * Rebuilt URL to: https://172.17.0.1:6379/ * Hostname was NOT found in DNS cache * Trying 172.17.0.1... * connect to 172.17.0.1 port 6379 failed: No route to host * Failed to connect to 172.17.0.1 port 6379: No route to host * Closing connection 0 </code></pre> <p>From the docker host I am <strong>successful</strong>,</p> <pre><code>[root@docker-host ~]# curl -v https://172.17.0.1:6379/0 * About to connect() to 172.17.0.1 port 6379 (#0) * Trying 172.17.0.1... * Connected to 172.17.0.1 (172.17.0.1) port 6379 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none </code></pre> <p>If i check the <strong>iptables</strong> I can see the issue,</p> <pre><code>[root@docker-host ~]# iptables -S INPUT -P INPUT ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -i docker0 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited </code></pre> <p>So I <strong>add</strong> the following and it all works well,</p> <pre><code>iptables -I INPUT 4 -i docker0 -j ACCEPT </code></pre> <p>Am i missing something here?</p> <pre><code>[root@docker-host ~]# docker version Client: Version: 1.9.1 API version: 1.21 Package version: docker-common-1.9.1-40.el7.centos.x86_64 Go version: go1.4.2 Git commit: ab77bde/1.9.1 Built: OS/Arch: linux/amd64 Server: Version: 1.9.1 API version: 1.21 Package version: docker-common-1.9.1-40.el7.centos.x86_64 Go version: go1.4.2 Git commit: ab77bde/1.9.1 Built: OS/Arch: linux/amd64 </code></pre> <p>Thanks,</p>
0debug
I'm trying to do exponent in c, but this is what is get : <p>I'm trying to do a example of exponent en " DEV C++ " compilator and I can't get the output </p> <p>this is the code :</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;math.h&gt; int main (void) { double base, exponent, result; printf("La base:\n"); scanf("%lf",&amp;base); printf("El exponente:\n"); scanf("%lf",&amp;exponent); result = pow(base, exponent); printf("%.1lf^%.1lf = %.21f", base, exponent, result); return 0; } </code></pre> <p>and i get this :</p> <p><a href="https://i.stack.imgur.com/BQ4Ps.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BQ4Ps.png" alt="exponent"></a></p> <p>what could be the problem ?</p> <p>Sincerilly, NIN.</p>
0debug
static int yop_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { YopDecContext *yop = s->priv_data; int64_t frame_pos, pos_min, pos_max; int frame_count; av_free_packet(&yop->video_packet); if (!stream_index) return -1; pos_min = s->data_offset; pos_max = avio_size(s->pb) - yop->frame_size; frame_count = (pos_max - pos_min) / yop->frame_size; timestamp = FFMAX(0, FFMIN(frame_count, timestamp)); frame_pos = timestamp * yop->frame_size + pos_min; yop->odd_frame = timestamp & 1; avio_seek(s->pb, frame_pos, SEEK_SET); return 0; }
1threat
static void avc_loopfilter_luma_inter_edge_hor_msa(uint8_t *data, uint8_t bs0, uint8_t bs1, uint8_t bs2, uint8_t bs3, uint8_t tc0, uint8_t tc1, uint8_t tc2, uint8_t tc3, uint8_t alpha_in, uint8_t beta_in, uint32_t image_width) { v16u8 p2_asub_p0, u8_q2asub_q0; v16u8 alpha, beta, is_less_than, is_less_than_beta; v16u8 p1, p0, q0, q1; v8i16 p1_r = { 0 }; v8i16 p0_r, q0_r, q1_r = { 0 }; v8i16 p1_l = { 0 }; v8i16 p0_l, q0_l, q1_l = { 0 }; v16u8 p2_org, p1_org, p0_org, q0_org, q1_org, q2_org; v8i16 p2_org_r, p1_org_r, p0_org_r, q0_org_r, q1_org_r, q2_org_r; v8i16 p2_org_l, p1_org_l, p0_org_l, q0_org_l, q1_org_l, q2_org_l; v16i8 zero = { 0 }; v16u8 tmp_vec; v16u8 bs = { 0 }; v16i8 tc = { 0 }; tmp_vec = (v16u8) __msa_fill_b(bs0); bs = (v16u8) __msa_insve_w((v4i32) bs, 0, (v4i32) tmp_vec); tmp_vec = (v16u8) __msa_fill_b(bs1); bs = (v16u8) __msa_insve_w((v4i32) bs, 1, (v4i32) tmp_vec); tmp_vec = (v16u8) __msa_fill_b(bs2); bs = (v16u8) __msa_insve_w((v4i32) bs, 2, (v4i32) tmp_vec); tmp_vec = (v16u8) __msa_fill_b(bs3); bs = (v16u8) __msa_insve_w((v4i32) bs, 3, (v4i32) tmp_vec); if (!__msa_test_bz_v(bs)) { tmp_vec = (v16u8) __msa_fill_b(tc0); tc = (v16i8) __msa_insve_w((v4i32) tc, 0, (v4i32) tmp_vec); tmp_vec = (v16u8) __msa_fill_b(tc1); tc = (v16i8) __msa_insve_w((v4i32) tc, 1, (v4i32) tmp_vec); tmp_vec = (v16u8) __msa_fill_b(tc2); tc = (v16i8) __msa_insve_w((v4i32) tc, 2, (v4i32) tmp_vec); tmp_vec = (v16u8) __msa_fill_b(tc3); tc = (v16i8) __msa_insve_w((v4i32) tc, 3, (v4i32) tmp_vec); alpha = (v16u8) __msa_fill_b(alpha_in); beta = (v16u8) __msa_fill_b(beta_in); p2_org = LOAD_UB(data - (3 * image_width)); p1_org = LOAD_UB(data - (image_width << 1)); p0_org = LOAD_UB(data - image_width); q0_org = LOAD_UB(data); q1_org = LOAD_UB(data + image_width); { v16u8 p0_asub_q0, p1_asub_p0, q1_asub_q0; v16u8 is_less_than_alpha, is_bs_greater_than0; is_bs_greater_than0 = ((v16u8) zero < bs); p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org); p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org); q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org); is_less_than_alpha = (p0_asub_q0 < alpha); is_less_than_beta = (p1_asub_p0 < beta); is_less_than = is_less_than_beta & is_less_than_alpha; is_less_than_beta = (q1_asub_q0 < beta); is_less_than = is_less_than_beta & is_less_than; is_less_than = is_less_than & is_bs_greater_than0; } if (!__msa_test_bz_v(is_less_than)) { v16i8 sign_negate_tc, negate_tc; v8i16 negate_tc_r, i16_negatetc_l, tc_l, tc_r; q2_org = LOAD_UB(data + (2 * image_width)); negate_tc = zero - tc; sign_negate_tc = __msa_clti_s_b(negate_tc, 0); negate_tc_r = (v8i16) __msa_ilvr_b(sign_negate_tc, negate_tc); i16_negatetc_l = (v8i16) __msa_ilvl_b(sign_negate_tc, negate_tc); tc_r = (v8i16) __msa_ilvr_b(zero, tc); tc_l = (v8i16) __msa_ilvl_b(zero, tc); p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org); p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org); q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org); p1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p1_org); p0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p0_org); q0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q0_org); p2_asub_p0 = __msa_asub_u_b(p2_org, p0_org); is_less_than_beta = (p2_asub_p0 < beta); is_less_than_beta = is_less_than_beta & is_less_than; { v8u16 is_less_than_beta_r, is_less_than_beta_l; is_less_than_beta_r = (v8u16) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8); if (!__msa_test_bz_v((v16u8) is_less_than_beta_r)) { p2_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p2_org); AVC_LOOP_FILTER_P1_OR_Q1(p0_org_r, q0_org_r, p1_org_r, p2_org_r, negate_tc_r, tc_r, p1_r); } is_less_than_beta_l = (v8u16) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8); if (!__msa_test_bz_v((v16u8) is_less_than_beta_l)) { p2_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p2_org); AVC_LOOP_FILTER_P1_OR_Q1(p0_org_l, q0_org_l, p1_org_l, p2_org_l, i16_negatetc_l, tc_l, p1_l); } } if (!__msa_test_bz_v(is_less_than_beta)) { p1 = (v16u8) __msa_pckev_b((v16i8) p1_l, (v16i8) p1_r); p1_org = __msa_bmnz_v(p1_org, p1, is_less_than_beta); STORE_UB(p1_org, data - (2 * image_width)); is_less_than_beta = __msa_andi_b(is_less_than_beta, 1); tc = tc + (v16i8) is_less_than_beta; } u8_q2asub_q0 = __msa_asub_u_b(q2_org, q0_org); is_less_than_beta = (u8_q2asub_q0 < beta); is_less_than_beta = is_less_than_beta & is_less_than; { v8u16 is_less_than_beta_r, is_less_than_beta_l; is_less_than_beta_r = (v8u16) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8); q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org); if (!__msa_test_bz_v((v16u8) is_less_than_beta_r)) { q2_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q2_org); AVC_LOOP_FILTER_P1_OR_Q1(p0_org_r, q0_org_r, q1_org_r, q2_org_r, negate_tc_r, tc_r, q1_r); } is_less_than_beta_l = (v8u16) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8); q1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q1_org); if (!__msa_test_bz_v((v16u8) is_less_than_beta_l)) { q2_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q2_org); AVC_LOOP_FILTER_P1_OR_Q1(p0_org_l, q0_org_l, q1_org_l, q2_org_l, i16_negatetc_l, tc_l, q1_l); } } if (!__msa_test_bz_v(is_less_than_beta)) { q1 = (v16u8) __msa_pckev_b((v16i8) q1_l, (v16i8) q1_r); q1_org = __msa_bmnz_v(q1_org, q1, is_less_than_beta); STORE_UB(q1_org, data + image_width); is_less_than_beta = __msa_andi_b(is_less_than_beta, 1); tc = tc + (v16i8) is_less_than_beta; } { v16i8 negate_thresh, sign_negate_thresh; v8i16 threshold_r, threshold_l; v8i16 negate_thresh_l, negate_thresh_r; negate_thresh = zero - tc; sign_negate_thresh = __msa_clti_s_b(negate_thresh, 0); threshold_r = (v8i16) __msa_ilvr_b(zero, tc); negate_thresh_r = (v8i16) __msa_ilvr_b(sign_negate_thresh, negate_thresh); AVC_LOOP_FILTER_P0Q0(q0_org_r, p0_org_r, p1_org_r, q1_org_r, negate_thresh_r, threshold_r, p0_r, q0_r); threshold_l = (v8i16) __msa_ilvl_b(zero, tc); negate_thresh_l = (v8i16) __msa_ilvl_b(sign_negate_thresh, negate_thresh); AVC_LOOP_FILTER_P0Q0(q0_org_l, p0_org_l, p1_org_l, q1_org_l, negate_thresh_l, threshold_l, p0_l, q0_l); } p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r); q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r); p0_org = __msa_bmnz_v(p0_org, p0, is_less_than); q0_org = __msa_bmnz_v(q0_org, q0, is_less_than); STORE_UB(p0_org, (data - image_width)); STORE_UB(q0_org, data); } } }
1threat
How to disregard the NaN data point in numpy array and generate the normalized data in Python? : <p>Say I have a numpy array that has some float('nan'), I don't want to impute those data now and I want to first normalize those and keep the NaN data at the original space, is there any way I can do that?</p> <p>Previously I used <code>normalize</code> function in <code>sklearn.Preprocessing</code>, but that function seems can't take any NaN contained array as input.</p>
0debug
How to assign case statement that has alias to variable using sql server : In my code below I'm trying to assign the results of a CASE statement to a variable. I got that working but my problem is that my CASE statement has an alias for the column name but I'm getting an "incorrect syntax near 'AS'". I am needing to SUM my variables to get a GRAND TOTAL in that column as well. I am working in SQL Server 2014. I could not find a solution and was hoping that someone can provide some direction/help. Thanks in advance. Here is my SQL code: SELECT DISTINCT a1.SCHYEAR, a1.LocationName as LOCATIONNAME, a1.GRADE, a1.[RACE/ETHNICITY], @504Count=( CASE WHEN a1.StudentPermID IN (SELECT DISTINCT t4.Permnum FROM #504 t4) THEN COUNT(a1.StudentPermID) END AS '504'), @Non504SPEDCount =( CASE WHEN a1.STID NOT IN (SELECT DISTINCT t1.STID FROM #speds t1) THEN COUNT(a1.STID) WHEN a1.StudentPermID NOT IN (SELECT DISTINCT t3.Permnum FROM #504 t3) THEN COUNT(a1.StudentPermID) END AS 'Non-504/Non-SPED'), @SPEDCount=( CASE WHEN a1.STID IN (SELECT DISTINCT t2.STID FROM #speds t2) THEN COUNT(a1.STID) END AS 'SPED'), a1.STID, a1.StudentPermID as PERMNUM, COUNT('504'), COUNT('Non-SPED'), COUNT('SPED'), SUM(@504Count + @Non504SPEDCount + @SPEDCount) AS 'Grand Total' FROM #allStudents a1 GROUP BY a1.SCHYEAR, a1.LocationName, a1.GRADE, a1.[RACE/ETHNICITY], a1.STID, a1.StudentPermID ORDER BY a1.SCHYEAR, a1.LocationName, a1.GRADE, a1.[RACE/ETHNICITY], a1.STID, a1.StudentPermID
0debug
static uint64_t omap_clkm_read(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque; if (size != 2) { return omap_badwidth_read16(opaque, addr); } switch (addr) { case 0x00: return s->clkm.arm_ckctl; case 0x04: return s->clkm.arm_idlect1; case 0x08: return s->clkm.arm_idlect2; case 0x0c: return s->clkm.arm_ewupct; case 0x10: return s->clkm.arm_rstct1; case 0x14: return s->clkm.arm_rstct2; case 0x18: return (s->clkm.clocking_scheme << 11) | s->clkm.cold_start; case 0x1c: return s->clkm.arm_ckout1; case 0x20: break; } OMAP_BAD_REG(addr); return 0; }
1threat
Best way to test a method that works with streams : <p>I got this method </p> <pre><code> void sort(InputStream in, OutputStream out, Comparator&lt;?&gt; comparator) throws IOException; </code></pre> <p>that sorts the input stream (XML data) in the output stream (same format) according to the provided comparator.</p> <p>Since I am a beginner with Junit, how would you test this method? It would be great if you can provide some code snippet.</p>
0debug
C# class error...please help? thanks : "Member names cant be in the same as their enclosing type". How would i re-arrange this code to make it run? using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace works { class Enemy : Character { Character Hero = new Character(); Character Enemy = new Character(); public override void Die() { Console.WriteLine("[0] has killed the enemy!", mST_Name); } public override void TakeDamage() { Enemy.mIN_HitPoints -= Hero.mIN_Strength; Console.WriteLine("Your enemy has been hit and has {0} HP left!", mIN_HitPoints); if (mIN_HitPoints == 0) { Die(); } } } } The point of this code is to simulate a RPG style game. Thanks for the help :)
0debug
Font awesome icon name : <p>Does anyone know name of this icon in fontawesome(ignore color)?</p> <p><a href="https://i.stack.imgur.com/Z2xAg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z2xAg.png" alt="enter image description here"></a></p>
0debug
wait.until(ExpectedConditions) doesnt work any more in selenium : <p>So far I used 2.45.0 version of selenium and all my waits were done in this way:</p> <pre><code>WebDriverWait wait = new WebDriverWait(webKitUtility.getWebDriver(), 5); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("role"))); </code></pre> <p>But I updated selenium to 3.1.0 and I am getting the error:</p> <p>"The method until(Predicate) in the type FluentWait is not applicable for the arguments (ExpectedCondition)"</p> <p>I see that from 2.45.0 to 3.1.0 some things are deprecated. I am trying to investigate what is the best way to do it now, but I am not sure. Most of the things I'm finding on google are old information explaining the same way I was using so far.</p>
0debug
How to display username after login in C# : <pre><code> if (!IsPostBack) { if (Session["UserName"] != null) { this.lblWelcomeMessage.Text = string.Format("Welcome {0}", Session["UserName"].ToString()); } } </code></pre> <blockquote> <p>I want to add username after longin..How will i display username</p> </blockquote>
0debug
Split an array into columns in javascript : <p>I want to reduce array so I have its' values in 'columns' where the first value lives in the first column, the second one in the second, etc. until it wraps, so that for example the fourth value is in the first of three columns.</p> <pre><code>&gt;&gt; [1, 2, 3, 4, 5, 6, 7].in_columns(3) =&gt; [[1, 4, 7], [2, 5], [3, 6]] </code></pre>
0debug
Why my groupby work says "invalid syntax" : <p><a href="https://i.stack.imgur.com/IsAy6.png" rel="nofollow noreferrer">groupby</a></p> <p>Hello, i try to find the mean of a data of groupby a dataframe. However, it shows my work has invalid syntax and please somebody help me.</p>
0debug
Implement Cloneable using Scala : <p>How to use cloneable interface in Scala to clone the class object?</p> <p>This code will tell, how cloneable works in Scala and it worked for me.</p> <pre><code> class CloneableClass extends scala.Cloneable { def myMethod: Unit = println("Inside :"+this.getClass) override def clone(): CloneableClass =super.clone().asInstanceOf[this.type] } class CloneableDemo { val cc = new CloneableClass val cc1 = cc.clone() cc1.myMethod } object CloneObject extends App { val cd = new CloneableDemo } Output: Inside : class CloneableClass </code></pre>
0debug
I want to create a loader with still image in between the loader circle : <blockquote> <p>I want to create a loader with still image in between the loader circle. in this code the image is rotating along with loader i want the image to be still not rotating.</p> </blockquote> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt; .loader { border: 16px solid #f3f3f3; border-radius: 50%; border-top: 16px solid #3498db; width: 120px; height: 120px; -webkit-animation: spin 2s linear infinite; animation: spin 2s linear infinite; } @-webkit-keyframes spin { 0% { -webkit-transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); } } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;h2&gt;Loader with image&lt;/h2&gt; &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The -webkit- and -ms- prefixes are for browsers that do not support animation and transform properties.&lt;/p&gt; &lt;div class="loader"&gt; &lt;img id="drawerUserImage" class="img-circle" src="https://cdn2.iconfinder.com/data/icons/picol-vector/32/view-128.png"/&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p>
0debug
How to draw groups of bar plots, grouped by year in R? : I want to graph data that looks like this: [![enter image description here][1]][1] And I want the x axis to be helpnot, and I want the why to be the actual number of count. I want the X axis split into two groups. How do I do this? I have this which is close... but year is split on top of each bar and in groups by year. How do I fix this? This is what I have: ggplot(data = helpnotComparison, aes(x=helpnot, y=count, fill = year)) + geom_bar(stat='identity') That produces me this: [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/p5UEM.png [2]: https://i.stack.imgur.com/2JE18.png
0debug
C Compiling Error while printing : I am a noob at C. My code: #include <stdio.h> int main() { int M, N, O, P; printf("Enter the value of M\n"); scanf("%d", &M); N = 3*M^2; O = M + N; P = M + M; printf("The value of %d \n", M + %d \n", M equals %d \n", P %d \n", N %d \n", O); return 0; } The error: > test.c: In function 'main': > test.c:9: error: expected expression before '%' token > test.c:9: error: stray '\' in program > test.c:9: error: stray '\' in program I can't figure out how to properly print the values of M,N,O,P and test alongside with it. And have been searching for a while too. Please let me know if you see the problem. Thanks. Shahriar
0debug
static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output) { AVFrame *decoded_frame, *f; void *buffer_to_free = NULL; int i, ret = 0, err = 0, resample_changed; int64_t best_effort_timestamp; AVRational *frame_sample_aspect; if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc())) return AVERROR(ENOMEM); if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc())) return AVERROR(ENOMEM); decoded_frame = ist->decoded_frame; pkt->dts = av_rescale_q(ist->dts, AV_TIME_BASE_Q, ist->st->time_base); update_benchmark(NULL); ret = avcodec_decode_video2(ist->st->codec, decoded_frame, got_output, pkt); update_benchmark("decode_video %d.%d", ist->file_index, ist->st->index); if (!*got_output || ret < 0) { if (!pkt->size) { for (i = 0; i < ist->nb_filters; i++) #if 1 av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0); #else av_buffersrc_add_frame(ist->filters[i]->filter, NULL); #endif } return ret; } if(ist->top_field_first>=0) decoded_frame->top_field_first = ist->top_field_first; best_effort_timestamp= av_frame_get_best_effort_timestamp(decoded_frame); if(best_effort_timestamp != AV_NOPTS_VALUE) ist->next_pts = ist->pts = av_rescale_q(decoded_frame->pts = best_effort_timestamp, ist->st->time_base, AV_TIME_BASE_Q); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "decoder -> ist_index:%d type:video " "frame_pts:%s frame_pts_time:%s best_effort_ts:%"PRId64" best_effort_ts_time:%s keyframe:%d frame_type:%d \n", ist->st->index, av_ts2str(decoded_frame->pts), av_ts2timestr(decoded_frame->pts, &ist->st->time_base), best_effort_timestamp, av_ts2timestr(best_effort_timestamp, &ist->st->time_base), decoded_frame->key_frame, decoded_frame->pict_type); } pkt->size = 0; #if FF_API_DEINTERLACE pre_process_video_frame(ist, (AVPicture *)decoded_frame, &buffer_to_free); #endif rate_emu_sleep(ist); if (ist->st->sample_aspect_ratio.num) decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio; resample_changed = ist->resample_width != decoded_frame->width || ist->resample_height != decoded_frame->height || ist->resample_pix_fmt != decoded_frame->format; if (resample_changed) { av_log(NULL, AV_LOG_INFO, "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n", ist->file_index, ist->st->index, ist->resample_width, ist->resample_height, av_get_pix_fmt_name(ist->resample_pix_fmt), decoded_frame->width, decoded_frame->height, av_get_pix_fmt_name(decoded_frame->format)); ist->resample_width = decoded_frame->width; ist->resample_height = decoded_frame->height; ist->resample_pix_fmt = decoded_frame->format; for (i = 0; i < nb_filtergraphs; i++) { if (ist_in_filtergraph(filtergraphs[i], ist) && ist->reinit_filters && configure_filtergraph(filtergraphs[i]) < 0) { av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\n"); exit(1); } } } frame_sample_aspect= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, "sample_aspect_ratio"); for (i = 0; i < ist->nb_filters; i++) { if (!frame_sample_aspect->num) *frame_sample_aspect = ist->st->sample_aspect_ratio; if (i < ist->nb_filters - 1) { f = ist->filter_frame; err = av_frame_ref(f, decoded_frame); if (err < 0) break; } else f = decoded_frame; if(av_buffersrc_add_frame_flags(ist->filters[i]->filter, f, AV_BUFFERSRC_FLAG_PUSH)<0) { av_log(NULL, AV_LOG_FATAL, "Failed to inject frame into filter network\n"); exit(1); } } av_frame_unref(ist->filter_frame); av_frame_unref(decoded_frame); av_free(buffer_to_free); return err < 0 ? err : ret; }
1threat
How can I make an implementation of pure virtual function in derived class be another pure virtual function? : <p>Consider</p> <pre><code>class A { protected: virtual void function() =0; } class B: public class A { protected: virtual void function() { blah blah blah }; } </code></pre> <p>I want to make function() in class B also a pure virtual function. That is, derived classes of B must make another implementation of function(). How can I perform this task?</p>
0debug
static int qmp_async_cmd_handler(Monitor *mon, const mon_cmd_t *cmd, const QDict *params) { return cmd->mhandler.cmd_async(mon, params, qmp_monitor_complete, mon); }
1threat
How to get return value from callback function in Node : <p>The <code>get_customers()</code> function queries the database for the <code>playlists</code> records and logs to the console each row. But the <code>data</code> array is returned as an empty list array. How to return the data from the get_playlists function? </p> <pre><code>...result undefined </code></pre> <pre><code>const sqlite3 = require('sqlite3').verbose(); let db = new sqlite3.Database('mydb.db', (err) =&gt; { if (err) { console.error(err.message); } console.log('Connected to the database.'); }); function get_playlists(db){ let sql = `SELECT DISTINCT Name name FROM playlists ORDER BY name`; let data = [] db.all(sql, [], (err, rows) =&gt; { if (err) { throw err; } rows.forEach((row) =&gt; { console.log(row.name); data.push(row.name); }); return data }); } result = get_playlists(db) console.log('...result', result); db.close(); </code></pre>
0debug
WinForm "read and validate" a string : Hi im a newe on c# i get the error that "not all code paths return a value" appreciate the help why, or how i should write it. private string ReadDescription(out bool success) { success = false; if (txtDescription.Text == "") { GiveMessage("Ivalid description"); success = false; } else success = true; //here is were the method is going. private ShoppingItem ReadInput(out bool success) { success = false; ShoppingItem item = new ShoppingItem(); item.Descritption = ReadDescription(out success); //<---- if (!success) return null; item.Amount = ReadAmount(out success); if (!success) return null; item.Unit = ReaUnit(out success); if (!success) return item; }
0debug
How to work around jsx-a11y/no-static-element-interactions restriction? : <p>I used the following jsx to construct an entry in a FAQ table:</p> <pre><code> &lt;li key={faqKey} className={styles.entry} onClick={handleExpandFn}&gt; &lt;div&gt; &lt;span className={`icon-next ${questionClassname}`} /&gt; &lt;span className={styles['question-text']}&gt;{faqEntry.question}&lt;/span&gt; &lt;/div&gt; {faqEntry.answer} &lt;/li&gt; </code></pre> <p>The idea is that when a user click on the entry, it will toggle the open state of the entry. In the other word, when a user clicks on an open FAQ entry, it will close it. Otherwise it will open it.</p> <p>However the <code>li</code> tag triggers this eslint violation: <code>Visible, non-interactive elements should not have mouse or keyboard event listeners jsx-a11y/no-static-element-interactions</code></p> <p>Unfortunately I don't think there is alternative way to the above html markup. Since it is jsx, it also does not allow override such as <code>// eslint-disable-line jsx-a11y/no-static-element-interactions</code> (The inline comment will be printed out to the web page)</p> <p>So how I can work around it? Happy to use different jsx markup or jsx eslint override </p>
0debug
Control if inside an array there is a value : I started few times ago coding JavaScript and now I want to check if an Array contains a value. I tried to use var accountList = [3,4]; function isInArray(value, array){ return array.indexOf(value); } if(isInArray(4, accountList) > -1){ document.getElementById("pp").innerHTML = "found"; }` but it doesn't work. I'll want to use this for check if an input is inside and Array, I use the "3,4" value just for try this method. Someone can help me? :) P.s: I'm sorry for any error but I'm not english!
0debug
Uncaught TypeError: URL is not a constructor using WHATWG URL object support for electron : <p>I am trying to read a file using WHATWG URL object support <a href="https://nodejs.org/api/fs.html#fs_whatwg_url_object_support" rel="noreferrer">here</a></p> <p>and I am getting this error: Uncaught TypeError: URL is not a constructor</p> <p>here is my code:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var fs = require("fs"); const { URL } = require('url'); var dbPath = 'file://192.168.5.2/db/db.sqlite'; const fileUrl = new URL(dbPath);</code></pre> </div> </div> </p>
0debug
CSS Fix div to bottom of parent element : I need to fix child element to bottom of its parent element, in my case I have "Back Button" and need it to bottom of scrollable content so I cannot use `position: absolute` and `bottom: 0`, but I can add `position: fixed` with `bottom: 0`, but problem is that it is at bottom of window not parent element. Summary: Fixed button at the bottom of crollable content somewhere on the page [![enter image description here][1]][1] [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/6VYnK.png [2]: https://i.stack.imgur.com/Vkbyx.png
0debug
struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta, BlockBackend *blk, qemu_irq irq, qemu_irq dma[], omap_clk fclk, omap_clk iclk) { struct omap_mmc_s *s = (struct omap_mmc_s *) g_malloc0(sizeof(struct omap_mmc_s)); s->irq = irq; s->dma = dma; s->clk = fclk; s->lines = 4; s->rev = 2; omap_mmc_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_mmc_ops, s, "omap.mmc", omap_l4_region_size(ta, 0)); omap_l4_attach(ta, 0, &s->iomem); s->card = sd_init(blk, false); if (s->card == NULL) { exit(1); } s->cdet = qemu_allocate_irq(omap_mmc_cover_cb, s, 0); sd_set_cb(s->card, NULL, s->cdet); return s; }
1threat
Using meta programming to add lines if a certain method is called : I'm writing a program and was wondering if there was a way for me to do the following thing with metaprogramming in ruby? I want it so that whenever a method is called and the method is at the end of another method, that the method call is surrounded by a pair of lines. So the following method: def my_method do_some_stuff x = 1+1 metaprogram_method end Would be transformed into: def my_method do_some_stuff x = 1+1 metaprogram_line_1 metaprogram_method metaprogram_line_2 end I'm pretty new to ruby, and very new to metaprogramming so any help would be appreciated.
0debug
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_WKWebView", referenced from: : <p>Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_WKWebView", referenced from: ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)</p> <p><a href="https://i.stack.imgur.com/8zDF9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8zDF9.png" alt="enter image description here"></a></p> <p>Any help is appreciated!</p>
0debug
callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time) { AVFormatContext *s = priv_data; struct dshow_ctx *ctx = s->priv_data; AVPacketList **ppktl, *pktl_next; WaitForSingleObject(ctx->mutex, INFINITE); if(shall_we_drop(s)) goto fail; pktl_next = av_mallocz(sizeof(AVPacketList)); if(!pktl_next) goto fail; if(av_new_packet(&pktl_next->pkt, buf_size) < 0) { av_free(pktl_next); goto fail; } pktl_next->pkt.stream_index = index; pktl_next->pkt.pts = time; memcpy(pktl_next->pkt.data, buf, buf_size); for(ppktl = &ctx->pktl ; *ppktl ; ppktl = &(*ppktl)->next); *ppktl = pktl_next; ctx->curbufsize += buf_size; SetEvent(ctx->event); ReleaseMutex(ctx->mutex); return; fail: ReleaseMutex(ctx->mutex); return; }
1threat
what is multiple recursive in java : <p>I am trying to understand what 'multiple recursive in java' is I know that it's an activation of a method can cause more than one recursive activation of the same method. But I can't still quite understand. Please show me some code examples in java (if possible) that is easy to digest </p> <p>Thank you so much.</p>
0debug
WARNING: API 'variant.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()' : <p>I just upadated kotlin to 1.3.30 and I now get this error when syncing gradle:</p> <blockquote> <p>WARNING: API 'variant.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'. It will be removed at the end of 2019. For more information, see <a href="https://d.android.com/r/tools/task-configuration-avoidance" rel="noreferrer">https://d.android.com/r/tools/task-configuration-avoidance</a>. To determine what is calling variant.getPackageLibrary(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace. Affected Modules: hydatabase</p> </blockquote> <p>Here is my <code>build.gradle</code>:</p> <pre><code>apply plugin: 'com.squareup.sqldelight' apply plugin: 'kotlin-multiplatform' apply plugin: 'com.android.library' android { compileSdkVersion 28 defaultConfig { minSdkVersion 19 } lintOptions { abortOnError false } } sqldelight { Database { packageName = "com.company.hydatabase" } } kotlin { targets { fromPreset(presets.jvm, 'jvm') fromPreset(presets.android, 'android') } sourceSets { commonMain.dependencies { api 'org.jetbrains.kotlin:kotlin-stdlib-common' } jvmMain.dependencies { api 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' // ICU4J: Use DecimalFormat // Get rid of this when minSDKLevel = API 24 - Nougat (7.0) // https://developer.android.com/guide/topics/resources/internationalization.html api 'com.ibm.icu:icu4j:60.2' } androidMain.dependencies { implementation 'org.jetbrains.kotlin:kotlin-stdlib' api "com.squareup.sqldelight:android-driver:1.1.1" } androidMain.dependsOn jvmMain } } task copyDatabase(type: Copy) { from "${rootProject.file('hyappcommon/Databases/').path}" into "${rootProject.file('hydatabase/src/main/assets/databases/').path}" include '**/*.sqlite' } preBuild.dependsOn(copyDatabase) // workaround for https://youtrack.jetbrains.com/issue/KT-27170 configurations { compileClasspath } </code></pre>
0debug
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in line 2 : <pre><code>$query2 = mysql_query("SELECT *from order where reservation_id = '$reservation_id' "); //query for getting the order_id $row = mysql_fetch_assoc($query2); //this is the line that warns echo $row['order_id']; // the value of order id </code></pre> <p>// anyone knows how to solve this? i keep getting warning on mysql_fetch_assoc()</p>
0debug
static inline void s_zero(int cur_diff, struct G722Band *band) { int s_zero = 0; #define ACCUM(k, x, d) do { \ int tmp = x; \ band->zero_mem[k] = ((band->zero_mem[k] * 255) >> 8) + \ d*((band->diff_mem[k]^cur_diff) < 0 ? -128 : 128); \ band->diff_mem[k] = tmp; \ s_zero += (tmp * band->zero_mem[k]) >> 15; \ } while (0) if (cur_diff) { ACCUM(5, band->diff_mem[4], 1); ACCUM(4, band->diff_mem[3], 1); ACCUM(3, band->diff_mem[2], 1); ACCUM(2, band->diff_mem[1], 1); ACCUM(1, band->diff_mem[0], 1); ACCUM(0, cur_diff << 1, 1); } else { ACCUM(5, band->diff_mem[4], 0); ACCUM(4, band->diff_mem[3], 0); ACCUM(3, band->diff_mem[2], 0); ACCUM(2, band->diff_mem[1], 0); ACCUM(1, band->diff_mem[0], 0); ACCUM(0, cur_diff << 1, 0); } #undef ACCUM band->s_zero = s_zero; }
1threat
django rest framework - backward serialization to avoid prefetch_related : <p>I have two models, <code>Item</code> and <code>ItemGroup</code>:</p> <pre><code>class ItemGroup(models.Model): group_name = models.CharField(max_length=50) # fields.. class Item(models.Model): item_name = models.CharField(max_length=50) item_group = models.ForeignKey(ItemGroup, on_delete=models.CASCADE) # other fields.. </code></pre> <p>I want to write a serializer that will fetch all item groups with their item list as a nested array.</p> <p>So I want this output:</p> <pre><code>[ {group_name: "item group name", "items": [... list of items ..] }, ... ] </code></pre> <p>As I see, I should write this with django rest framework:</p> <pre><code>class ItemGroupSerializer(serializers.ModelSerializer): class Meta: model = ItemGroup fields = ('item_set', 'group_name') </code></pre> <p>Means, I have to write a serializer for <code>ItemGroup</code> (not for <code>Item</code>). To avoid many queries I pass this queryset:</p> <pre><code>ItemGroup.objects.filter(**filters).prefetch_related('item_set') </code></pre> <p>The problem that I see is, for a large dataset, <code>prefetch_related</code> results in an extra query with a VERY large sql <code>IN</code> clause, which I could avoid with the query on the Item objects instead:</p> <pre><code>Item.objects.filter(**filters).select_related('item_group') </code></pre> <p>Which results in a JOIN which is way better.</p> <p>Is it possible to query <code>Item</code> instead of <code>ItemGroup</code>, and yet to have the same serialization output? </p>
0debug
What does this shorthand mean in JavaScript? : <p>In this code, what does 'q--' mean in the while loop? </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>getTotal: function () { var q = this.getItemCount(), p = 0; while (q--) { p += basket[q].price; } return p; }</code></pre> </div> </div> </p> <p>Is this JS shorthand? Is there an online tool that converts shorthand JavaScript into longhand? Also, why are vars q and p declared this way instead of defining them this way: </p> <p>var q = this.getItemCount(); var p = 0;</p>
0debug
static void copy_parameter_set(void **to, void **from, int count, int size) { int i; for (i = 0; i < count; i++) { if (to[i] && !from[i]) av_freep(&to[i]); else if (from[i] && !to[i]) to[i] = av_malloc(size); if (from[i]) memcpy(to[i], from[i], size); } }
1threat
static abi_long do_sendrecvmsg(int fd, abi_ulong target_msg, int flags, int send) { abi_long ret, len; struct target_msghdr *msgp; struct msghdr msg; int count; struct iovec *vec; abi_ulong target_vec; if (!lock_user_struct(send ? VERIFY_READ : VERIFY_WRITE, msgp, target_msg, send ? 1 : 0)) return -TARGET_EFAULT; if (msgp->msg_name) { msg.msg_namelen = tswap32(msgp->msg_namelen); msg.msg_name = alloca(msg.msg_namelen); ret = target_to_host_sockaddr(msg.msg_name, tswapal(msgp->msg_name), msg.msg_namelen); if (ret) { unlock_user_struct(msgp, target_msg, send ? 0 : 1); return ret; } } else { msg.msg_name = NULL; msg.msg_namelen = 0; } msg.msg_controllen = 2 * tswapal(msgp->msg_controllen); msg.msg_control = alloca(msg.msg_controllen); msg.msg_flags = tswap32(msgp->msg_flags); count = tswapal(msgp->msg_iovlen); vec = alloca(count * sizeof(struct iovec)); target_vec = tswapal(msgp->msg_iov); lock_iovec(send ? VERIFY_READ : VERIFY_WRITE, vec, target_vec, count, send); msg.msg_iovlen = count; msg.msg_iov = vec; if (send) { ret = target_to_host_cmsg(&msg, msgp); if (ret == 0) ret = get_errno(sendmsg(fd, &msg, flags)); } else { ret = get_errno(recvmsg(fd, &msg, flags)); if (!is_error(ret)) { len = ret; ret = host_to_target_cmsg(msgp, &msg); if (!is_error(ret)) { msgp->msg_namelen = tswap32(msg.msg_namelen); if (msg.msg_name != NULL) { ret = host_to_target_sockaddr(tswapal(msgp->msg_name), msg.msg_name, msg.msg_namelen); if (ret) { goto out; } } ret = len; } } } out: unlock_iovec(vec, target_vec, count, !send); unlock_user_struct(msgp, target_msg, send ? 0 : 1); return ret; }
1threat
c# formating CSV : I have some variables with strings in my program which I need to put to CSV file. for example. var1 = "abc"; var2 = "bbb"; var3 = " -vvv -xxx -zzz -ccc -ddd "; // Var 3 is a multiline string, need it to be put in one cell CSV file: Col1 Col2 Col3 (1 cell) abc bbb -vvv -xxx -zzz -ccc -ddd Then in next row: var1(newVal) var2(newVal) var3(newVal)
0debug
Horizontal UIScrollview in ios : How to create horizontal UIScrollview in ios as look like in image.[![ with center it is auto select[1]][1] [1]: http://i.stack.imgur.com/qo9qg.png
0debug
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt) { BinkContext * const c = avctx->priv_data; GetBitContext gb; int plane, plane_idx, ret; int bits_count = pkt->size << 3; if (c->version > 'b') { if(c->pic->data[0]) avctx->release_buffer(avctx, c->pic); if ((ret = ff_get_buffer(avctx, c->pic)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } } else { if ((ret = avctx->reget_buffer(avctx, c->pic)) < 0) { av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } } init_get_bits(&gb, pkt->data, bits_count); if (c->has_alpha) { if (c->version >= 'i') skip_bits_long(&gb, 32); if ((ret = bink_decode_plane(c, &gb, 3, 0)) < 0) return ret; } if (c->version >= 'i') skip_bits_long(&gb, 32); for (plane = 0; plane < 3; plane++) { plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3); if (c->version > 'b') { if ((ret = bink_decode_plane(c, &gb, plane_idx, !!plane)) < 0) return ret; } else { if ((ret = binkb_decode_plane(c, &gb, plane_idx, !pkt->pts, !!plane)) < 0) return ret; } if (get_bits_count(&gb) >= bits_count) break; } emms_c(); *got_frame = 1; *(AVFrame*)data = *c->pic; if (c->version > 'b') FFSWAP(AVFrame*, c->pic, c->last); return pkt->size; }
1threat
iOS/Swift how update Table View in Real Time : <p>I need to to fetch realtime news from API, and then show them in a <code>UITableView</code>, news must disappear 5 seconds after their arrival.</p> <p>I am new in Swift, I know that UITableView has <code>reloadData()</code> that is meant to update the data in the table, I suppose I should use this method.</p> <p>My idea is to call the Api every 5 seconds, but how it works update/animation for making disappearing the news and adding new ones in the table?</p>
0debug
Is it require app in our device for geofencing and what are requirements? : For Beacons, It is working BLE,So it requires bluetooth on. But why it requires location service on.Is it possible to without using location services in physical web to push notification from beacons just by using BLE range ? For Geofencing, I dont want to create a new app for geofencing.Is it possible without app in the device to geofencing. Please help me. Advance thanks...
0debug
bool qemu_file_mode_is_not_valid(const char *mode) { if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 'b' || mode[2] != 0) { fprintf(stderr, "qemu_fopen: Argument validity check failed\n"); return true; } return false; }
1threat
How to create onChange event to display separate HTML select tag? : <p>I have question on onChange event. </p> <p>I have these HTML code</p> <p><strong>code.html</strong></p> <pre><code>&lt;label&gt;Morning&lt;/label&gt; &lt;select name="timeA" required=""&gt; &lt;option value=""&gt;Select Time From&lt;/option&gt; &lt;option value="0800"&gt;8:00 AM&lt;/option&gt; &lt;option value="0900"&gt;9:00 AM&lt;/option&gt; &lt;option value="1000"&gt;10:00 AM&lt;/option&gt; &lt;option value="1100"&gt;11:00 AM&lt;/option&gt; &lt;/select&gt; &lt;label&gt;Afternoon&lt;/label&gt; &lt;select name="timeB" required=""&gt; &lt;option value=""&gt;Select Time From&lt;/option&gt; &lt;option value="1200"&gt;12:00 PM&lt;/option&gt; &lt;option value="1300"&gt;1:00 PM&lt;/option&gt; &lt;option value="1400"&gt;2:00 PM&lt;/option&gt; &lt;option value="1500"&gt;3:00 PM&lt;/option&gt; &lt;/select&gt; </code></pre> <p>My goal is to allow user to select between morning or afternoon using radio button or other alternative. </p> <p>if the user select radiobutton morning, only select "timeA" shows and "timeB" will hidden. </p> <p>if the user select radiobutton afternoon, only select "timeB" shows and "timeA" will hidden. </p> <p>Please help me. thanks. </p>
0debug
psycopg2 could not translate host name : <p>My airflow server periodically fails. When I check the gunicorn logs, the error before all works shutting down looks like this:</p> <p><code> OperationalError: (psycopg2.OperationalError) could not translate host name "my-airflow-db.l9zijaslosu.us-east-1.rds.amazonaws.com" to address: Name or service not known (Background on this error at: http://sqlalche.me/e/e3q8) </code></p> <p>I immediately verify that the host name is correct and the database is accepting requests from other tools.</p> <p>If I restart the Ariflow webserver, the the server operates correctly for 4-5 days, and then the same error occurs.</p> <p>This issue has been asked before but is typically resolve by telling other developers to not use localhost or postrgres host names. My host name is a fully qualified host name on AWS's domain. It seems exceedingly unlikely that this is a DNS error on Amazon's part.</p>
0debug
tf.nn.conv2d vs tf.layers.conv2d : <p>Is there any advantage in using <code>tf.nn.*</code> over <code>tf.layers.*</code>?</p> <p>Most of the examples in the doc use <code>tf.nn.conv2d</code>, for instance, but it is not clear why they do so.</p>
0debug
Keras - 1D Convolution How it works : <p>From this example: <a href="https://github.com/fchollet/keras/blob/master/examples/imdb_cnn.py" rel="noreferrer">https://github.com/fchollet/keras/blob/master/examples/imdb_cnn.py</a></p> <p>comes this snippet below. The embedding layer outputs a 400 x 50 matrix for each example in a batch. My question is how does the 1D convolution work? How does it work across the 400 x 50 matrix?</p> <pre><code># we start off with an efficient embedding layer which maps # our vocab indices into embedding_dims dimensions model.add(Embedding(max_features, embedding_dims, input_length=maxlen, dropout=0.2)) # we add a Convolution1D, which will learn nb_filter # word group filters of size filter_length: model.add(Convolution1D(nb_filter=nb_filter, filter_length=filter_length, border_mode='valid', activation='relu', subsample_length=1)) </code></pre>
0debug
interpolation on shell script bash : I have a data file containing values of longitudes and latitudes (displayed on two columns) measured by a GPS along a profile at regular intervals. at a certain point on my profile, the GPS stopped working, hence in my data i have zeros instead of values of longitudes and latitudes. I want to interpolate between this fields to get values of longitudes and latitudes instead of zeros. to be more clear here is a simple example of how my file looks like. 12 7 14 8 0 0 0 0 20 11 22 12 i want to interpolate where i got zeros. i am working on bash and i have no idea on how to do it
0debug
Spring inject without autowire annotation : <p>I find some answer: <a href="https://stackoverflow.com/a/21218921/2754014">https://stackoverflow.com/a/21218921/2754014</a> about Dependency Injection. There isn't any annotation like <code>@Autowired</code>, <code>@Inject</code> or <code>@Resource</code>. let's assume that there isn't any XML configuration for this example <code>TwoInjectionStyles</code> bean (except simple <code>&lt;context:component-scan base-package="com.example" /&gt;</code>.</p> <p>Is it correct to inject without specify annotation?</p>
0debug
Ho to use BETWEEN condition using using main query and sub quries : Here i am using `JOIN` in 3 tables and getting the count.and also `mysql` query working perfect , now my question is i want to add one `BETWEEN` condition in my main query, here [SQL FIDDLE][1] you can check my table schema .**trip_details** table i have one column called `tripDate` using this column only i have to use `BETWEEN` condition in main query [1]: http://sqlfiddle.com/#!9/99a87c > MYSQL SELECT COUNT(T.tripId) as Escort_Count, ( SELECT COUNT(*) FROM ( SELECT a.allocationId FROM trip_details a INNER JOIN cab_allocation c ON a.allocationId = c.allocationId WHERE c.`allocationType` = 'Adhoc Trip' GROUP BY a.allocationId ) AS Ad ) AS Adhoc_Trip_Count, (SELECT COUNT(id) FROM trip_details) as Total_Count FROM ( SELECT a.tripId FROM trip_details a INNER JOIN escort_allocation b ON a.allocationId = b.allocationId GROUP BY a.allocationId ) AS T
0debug
void OPPROTO op_addl_EDI_T0(void) { EDI = (uint32_t)(EDI + T0); }
1threat
Javascript how to merge two different array of object : <p>I would like to merge two different array of objects to one, as follows: </p> <p>Array 1:</p> <pre><code>[ { id: 1, fullName: '...', districtName: '...', cityName: '...', placeName: '...', geoLat: '...', geoLong: '...' }, { id: 2, fullName: '...', districtName: '...', cityName: '...', placeName: '...', geoLat: '...', geoLong: '...' }, ] </code></pre> <p>Array 2:</p> <pre><code>[ { a:'...', b:'...', c:'...', }, { d:'...', e:'...', f:'...', } ] </code></pre> <p>Array 1 and array 2 have same length. I would like to merge them correspondely, as follows: </p> <pre><code>[ { id: 1, fullName: '...', districtName: '...', cityName: '...', placeName: '...', geoLat: '...', geoLong: '...', a:'...', b: '...', c: '...' }, { id: 2, fullName: '...', districtName: '...', cityName: '...', placeName: '...', geoLat: '...', geoLong: '...', d:'...', e: '...', f: '...' }, ] </code></pre> <p>How would I do this? I've thought about using map, but that way I can only iterate through one array. I have to iterate both array and merge them. </p> <p>Any suggestions are helpful. Thank you</p>
0debug
How to Fix Jsoup nullpointerexception in android studio 2019 : <p>I am creating an app in which i want to scrape google data with the help of jsoup and show it to text view in android studio.</p> <p>But after doing some coding with the help of jsoup i am getting following error:</p> <pre><code>E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 Process: com.example.yasht.cricketapp, PID: 11929 java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:325) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.jsoup.nodes.Element.text()' on a null object reference at com.example.yasht.cricketapp.Bottomnav.score_scrape.doInBackground(score_scrape.java:30) at com.example.yasht.cricketapp.Bottomnav.score_scrape.doInBackground(score_scrape.java:13) at android.os.AsyncTask$2.call(AsyncTask.java:305) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)  at java.lang.Thread.run(Thread.java:761)  </code></pre> <p>this is my jsoup code with async task :</p> <pre><code> public class score_scrape extends AsyncTask&lt;Void,Void,Void&gt; { String words; TextView score; public score_scrape( TextView score){ this.score =score; } @Override protected Void doInBackground(Void... voids) { try { Document doc = Jsoup.connect("https://www.google.com/search?q=india+vs+australia+3rd+odi+live+score").get(); Element element = doc.select("div[imspo_mh_cricket__score-major]").first(); words = element.text(); } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); score.setText(words); } } </code></pre> <p>I am using async task method which is declared i my main activity.</p> <p>Comment for any further information.</p>
0debug
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
show a div in pop without click event in java script : I want show pop up on event when it click rather to onclick function. basically its a calender when selected day I want to show div as pop up. even i can able to show the div as initially set to none but want in pop up
0debug
def check_Even_Parity(x): parity = 0 while (x != 0): x = x & (x - 1) parity += 1 if (parity % 2 == 0): return True else: return False
0debug
C# How to find how much of numbers are Entered? : <p>How to find how much of numbers are Entered ? </p> <pre><code> static void Main(string[] args) { string x; double t, s = 1; while ((x = Console.ReadLine()) != null) { } </code></pre>
0debug
Can I use Android 8.0 Adaptive Icons for a Flutter app? : <p>How can I use an Adaptive Icon for my Flutter app on Android 8.0 and up? The Create Image Asset dialog in Android Studio says "Project must be built with SDK 26 or later to use adaptive icons", even though <a href="https://github.com/piggehperson/flip_flutter/blob/master/android/app/build.gradle" rel="noreferrer">my android build.gradle</a> has CompileSDKVersion set to 27. If I define the icon in XML, it doesn't work, it seems to just use the regular legacy app icon.</p>
0debug
static int mpc7_decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MPCContext *c = avctx->priv_data; GetBitContext gb; uint8_t *bits; int i, ch, t; int mb = -1; Band *bands = c->bands; int off; int bits_used, bits_avail; memset(bands, 0, sizeof(bands)); if(buf_size <= 4){ av_log(avctx, AV_LOG_ERROR, "Too small buffer passed (%i bytes)\n", buf_size); } bits = av_malloc(((buf_size - 1) & ~3) + FF_INPUT_BUFFER_PADDING_SIZE); c->dsp.bswap_buf((uint32_t*)bits, (const uint32_t*)(buf + 4), (buf_size - 4) >> 2); init_get_bits(&gb, bits, (buf_size - 4)* 8); skip_bits(&gb, buf[0]); for(i = 0; i <= c->maxbands; i++){ for(ch = 0; ch < 2; ch++){ if(i) t = get_vlc2(&gb, hdr_vlc.table, MPC7_HDR_BITS, 1) - 5; if(!i || (t == 4)) bands[i].res[ch] = get_bits(&gb, 4); else bands[i].res[ch] = bands[i-1].res[ch] + t; } if(bands[i].res[0] || bands[i].res[1]){ mb = i; if(c->MSS) bands[i].msf = get_bits1(&gb); } } for(i = 0; i <= mb; i++) for(ch = 0; ch < 2; ch++) if(bands[i].res[ch]) bands[i].scfi[ch] = get_vlc2(&gb, scfi_vlc.table, MPC7_SCFI_BITS, 1); for(i = 0; i <= mb; i++){ for(ch = 0; ch < 2; ch++){ if(bands[i].res[ch]){ bands[i].scf_idx[ch][2] = c->oldDSCF[ch][i]; bands[i].scf_idx[ch][0] = get_scale_idx(&gb, bands[i].scf_idx[ch][2]); switch(bands[i].scfi[ch]){ case 0: bands[i].scf_idx[ch][1] = get_scale_idx(&gb, bands[i].scf_idx[ch][0]); bands[i].scf_idx[ch][2] = get_scale_idx(&gb, bands[i].scf_idx[ch][1]); break; case 1: bands[i].scf_idx[ch][1] = get_scale_idx(&gb, bands[i].scf_idx[ch][0]); bands[i].scf_idx[ch][2] = bands[i].scf_idx[ch][1]; break; case 2: bands[i].scf_idx[ch][1] = bands[i].scf_idx[ch][0]; bands[i].scf_idx[ch][2] = get_scale_idx(&gb, bands[i].scf_idx[ch][1]); break; case 3: bands[i].scf_idx[ch][2] = bands[i].scf_idx[ch][1] = bands[i].scf_idx[ch][0]; break; } c->oldDSCF[ch][i] = bands[i].scf_idx[ch][2]; } } } memset(c->Q, 0, sizeof(c->Q)); off = 0; for(i = 0; i < BANDS; i++, off += SAMPLES_PER_BAND) for(ch = 0; ch < 2; ch++) idx_to_quant(c, &gb, bands[i].res[ch], c->Q[ch] + off); ff_mpc_dequantize_and_synth(c, mb, data); av_free(bits); bits_used = get_bits_count(&gb); bits_avail = (buf_size - 4) * 8; if(!buf[1] && ((bits_avail < bits_used) || (bits_used + 32 <= bits_avail))){ av_log(NULL,0, "Error decoding frame: used %i of %i bits\n", bits_used, bits_avail); return -1; } if(c->frames_to_skip){ c->frames_to_skip--; *data_size = 0; return buf_size; } *data_size = (buf[1] ? c->lastframelen : MPC_FRAME_SIZE) * 4; return buf_size; }
1threat
static void tcg_reg_alloc_op(TCGContext *s, const TCGOpDef *def, TCGOpcode opc, const TCGArg *args, uint16_t dead_args, uint8_t sync_args) { TCGRegSet allocated_regs; int i, k, nb_iargs, nb_oargs, reg; TCGArg arg; const TCGArgConstraint *arg_ct; TCGTemp *ts; TCGArg new_args[TCG_MAX_OP_ARGS]; int const_args[TCG_MAX_OP_ARGS]; nb_oargs = def->nb_oargs; nb_iargs = def->nb_iargs; memcpy(new_args + nb_oargs + nb_iargs, args + nb_oargs + nb_iargs, sizeof(TCGArg) * def->nb_cargs); tcg_regset_set(allocated_regs, s->reserved_regs); for(k = 0; k < nb_iargs; k++) { i = def->sorted_args[nb_oargs + k]; arg = args[i]; arg_ct = &def->args_ct[i]; ts = &s->temps[arg]; if (ts->val_type == TEMP_VAL_MEM) { reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs); tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset); ts->val_type = TEMP_VAL_REG; ts->reg = reg; ts->mem_coherent = 1; s->reg_to_temp[reg] = arg; } else if (ts->val_type == TEMP_VAL_CONST) { if (tcg_target_const_match(ts->val, ts->type, arg_ct)) { const_args[i] = 1; new_args[i] = ts->val; goto iarg_end; } else { reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs); tcg_out_movi(s, ts->type, reg, ts->val); ts->val_type = TEMP_VAL_REG; ts->reg = reg; ts->mem_coherent = 0; s->reg_to_temp[reg] = arg; } } assert(ts->val_type == TEMP_VAL_REG); if (arg_ct->ct & TCG_CT_IALIAS) { if (ts->fixed_reg) { if (arg != args[arg_ct->alias_index]) goto allocate_in_reg; } else { if (!IS_DEAD_ARG(i)) { goto allocate_in_reg; } int k2, i2; for (k2 = 0 ; k2 < k ; k2++) { i2 = def->sorted_args[nb_oargs + k2]; if ((def->args_ct[i2].ct & TCG_CT_IALIAS) && (new_args[i2] == ts->reg)) { goto allocate_in_reg; } } } } reg = ts->reg; if (tcg_regset_test_reg(arg_ct->u.regs, reg)) { } else { allocate_in_reg: reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs); tcg_out_mov(s, ts->type, reg, ts->reg); } new_args[i] = reg; const_args[i] = 0; tcg_regset_set_reg(allocated_regs, reg); iarg_end: ; } for (i = nb_oargs; i < nb_oargs + nb_iargs; i++) { if (IS_DEAD_ARG(i)) { temp_dead(s, args[i]); } } if (def->flags & TCG_OPF_BB_END) { tcg_reg_alloc_bb_end(s, allocated_regs); } else { if (def->flags & TCG_OPF_CALL_CLOBBER) { for(reg = 0; reg < TCG_TARGET_NB_REGS; reg++) { if (tcg_regset_test_reg(tcg_target_call_clobber_regs, reg)) { tcg_reg_free(s, reg); } } } if (def->flags & TCG_OPF_SIDE_EFFECTS) { sync_globals(s, allocated_regs); } tcg_regset_set(allocated_regs, s->reserved_regs); for(k = 0; k < nb_oargs; k++) { i = def->sorted_args[k]; arg = args[i]; arg_ct = &def->args_ct[i]; ts = &s->temps[arg]; if (arg_ct->ct & TCG_CT_ALIAS) { reg = new_args[arg_ct->alias_index]; } else { reg = ts->reg; if (ts->fixed_reg && tcg_regset_test_reg(arg_ct->u.regs, reg)) { goto oarg_end; } reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs); } tcg_regset_set_reg(allocated_regs, reg); if (!ts->fixed_reg) { if (ts->val_type == TEMP_VAL_REG) { s->reg_to_temp[ts->reg] = -1; } ts->val_type = TEMP_VAL_REG; ts->reg = reg; ts->mem_coherent = 0; s->reg_to_temp[reg] = arg; } oarg_end: new_args[i] = reg; } } tcg_out_op(s, opc, new_args, const_args); for(i = 0; i < nb_oargs; i++) { ts = &s->temps[args[i]]; reg = new_args[i]; if (ts->fixed_reg && ts->reg != reg) { tcg_out_mov(s, ts->type, ts->reg, reg); } if (NEED_SYNC_ARG(i)) { tcg_reg_sync(s, reg); } if (IS_DEAD_ARG(i)) { temp_dead(s, args[i]); } } }
1threat
Docker issue: /bin/sh: pip: not found : <p>So my dockerfile is :</p> <pre><code>FROM iron/python:2.7 WORKDIR /app ADD . /app RUN pip install --upgrade pip RUN pip install -r ./requirements.txt </code></pre> <p>Recently though when I build my image with: <code>docker build --no-cache -t &lt;image name&gt;:&lt;tag&gt;</code></p> <p>I run into the issue of:</p> <pre><code>Step 4/6 : RUN pip install --upgrade pip ---&gt; Running in 00c781a53487 /bin/sh: pip: not found The command '/bin/sh -c pip install --upgrade pip' returned a non-zero code: 127 </code></pre> <p>was there any changes to docker that might have caused this? Because last week this was all fine and there were no issues building the image with the same exact code. </p>
0debug
className in <Field> in Redux Form : <p>I've created a redux-form and i want to add className to each Field to customize them with css. The code for each field is:</p> <pre><code>&lt;Form onSubmit={handleSubmit(requestAccountsFilter)}&gt; &lt;FormGroup row&gt; &lt;Field id="symbol" name="symbol" type="text" component={inputField} placeholder="Enter Product Here" /&gt; &lt;Field id="side" name="side" component={inputField} type="select"&gt; &lt;option value={null}&gt;Any&lt;/option&gt; &lt;option value="Buy"&gt;Buy&lt;/option&gt; &lt;option value="Sell"&gt;Sell&lt;/option&gt; &lt;/Field&gt; &lt;Field id="status" name="status" component={inputField} type="select"&gt; &lt;option value={null}&gt;Any&lt;/option&gt; &lt;option value="Working"&gt;Working&lt;/option&gt; &lt;option value="Completed"&gt;Completed&lt;/option&gt; &lt;/Field&gt; &lt;Button name="submit-btn" className="filter-submit-btn" color="danger" type="submit"&gt; Submit &lt;/Button&gt; &lt;/FormGroup&gt; &lt;/Form&gt; </code></pre> <p>I've added a className tag but i see that neither the placeholder i've added is shown nor the className. How can i customize each field?</p>
0debug