problem
stringlengths
26
131k
labels
class label
2 classes
static int queue_picture(VideoState *is, AVFrame *src_frame, double pts) { VideoPicture *vp; int dst_pix_fmt; AVPicture pict; static struct SwsContext *img_convert_ctx; SDL_LockMutex(is->pictq_mutex); while (is->pictq_size >= VIDEO_PICTURE_QUEUE_SIZE && !is->videoq.abort_request) { SDL_CondWait(is->pictq_cond, is->pictq_mutex); } SDL_UnlockMutex(is->pictq_mutex); if (is->videoq.abort_request) return -1; vp = &is->pictq[is->pictq_windex]; if (!vp->bmp || vp->width != is->video_st->codec->width || vp->height != is->video_st->codec->height) { SDL_Event event; vp->allocated = 0; event.type = FF_ALLOC_EVENT; event.user.data1 = is; SDL_PushEvent(&event); SDL_LockMutex(is->pictq_mutex); while (!vp->allocated && !is->videoq.abort_request) { SDL_CondWait(is->pictq_cond, is->pictq_mutex); } SDL_UnlockMutex(is->pictq_mutex); if (is->videoq.abort_request) return -1; } if (vp->bmp) { SDL_LockYUVOverlay (vp->bmp); dst_pix_fmt = PIX_FMT_YUV420P; pict.data[0] = vp->bmp->pixels[0]; pict.data[1] = vp->bmp->pixels[2]; pict.data[2] = vp->bmp->pixels[1]; pict.linesize[0] = vp->bmp->pitches[0]; pict.linesize[1] = vp->bmp->pitches[2]; pict.linesize[2] = vp->bmp->pitches[1]; sws_flags = av_get_int(sws_opts, "sws_flags", NULL); img_convert_ctx = sws_getCachedContext(img_convert_ctx, is->video_st->codec->width, is->video_st->codec->height, is->video_st->codec->pix_fmt, is->video_st->codec->width, is->video_st->codec->height, dst_pix_fmt, sws_flags, NULL, NULL, NULL); if (img_convert_ctx == NULL) { fprintf(stderr, "Cannot initialize the conversion context\n"); exit(1); } sws_scale(img_convert_ctx, src_frame->data, src_frame->linesize, 0, is->video_st->codec->height, pict.data, pict.linesize); SDL_UnlockYUVOverlay(vp->bmp); vp->pts = pts; if (++is->pictq_windex == VIDEO_PICTURE_QUEUE_SIZE) is->pictq_windex = 0; SDL_LockMutex(is->pictq_mutex); is->pictq_size++; SDL_UnlockMutex(is->pictq_mutex); } return 0; }
1threat
int inet_nonblocking_connect(const char *str, bool *in_progress, Error **errp) { QemuOpts *opts; int sock = -1; opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); if (inet_parse(opts, str) == 0) { sock = inet_connect_opts(opts, false, in_progress, errp); } else { error_set(errp, QERR_SOCKET_CREATE_FAILED); } qemu_opts_del(opts); return sock; }
1threat
pgAdmin 4 v3.0 Query Tool Initialize Error : <p>I recently got a new laptop and downloaded pgAdmin 4 v3.0. Before now, I had been running pgAdmin 4 v2.0 with no issues. However, now whenever I try to open the Query Tool (just by going through the drop down Tools menu), I receive the error message "Query Tool Initialize Error". The Query Tool worked for two or three queries after the initial error message, but has been returning the error message whenever selected in the days since then. I am able to create and edit tables and views, but only by right clicking the icons on the left-hand side of the screen. I tried uninstalling and reinstalling pgAdmin to no effect. </p> <p>Has anyone encountered this issue before?</p> <p><a href="https://i.stack.imgur.com/9GIjv.png" rel="noreferrer">Query Tool Initialize Error</a></p>
0debug
React router Switch behavior : <p>(<code>react-router-dom</code> version: 4.1.1)</p> <p>I have working routes set up, but I'm a bit confused about why the <code>&lt;Switch&gt;</code> was necessary:</p> <p>index.js</p> <pre><code>import React from 'react'; import { HashRouter, Route, Switch } from 'react-router-dom'; import App from './components/App.jsx'; import FridgePage from './components/FridgePage.jsx'; ReactDOM.render( &lt;HashRouter&gt; &lt;Switch&gt; &lt;Route exact path="/" component={App} /&gt; &lt;Route path="/fridge" component={FridgePage} /&gt; &lt;/Switch&gt; &lt;/HashRouter&gt;, document.getElementById('root') ) </code></pre> <p>App.jsx</p> <pre><code>import Header from './Header.jsx'; import {Link} from 'react-router-dom'; export default class App extends React.Component { render() { console.log(this.props); return ( &lt;div&gt; &lt;h1&gt;Herbnew&lt;/h1&gt; &lt;Link to="fridge"&gt;Fridge&lt;/Link&gt; {this.props.children} &lt;/div&gt; ); } } </code></pre> <p>FridgePage.jsx</p> <pre><code>import React from 'react'; export default class FridgePage extends React.Component { render() { return ( &lt;div&gt; &lt;h1&gt;Fridge&lt;/h1&gt; You finally found the fridge! &lt;/div&gt; ); } } </code></pre> <p>I used to have a <code>div</code> wrapping the routes instead of a <code>Switch</code>. In that case, I see the <code>App</code> rendered and try to click the Fridge link, but nothing happens (the <code>FridgePage</code> isn't rendered), and no error is output into the console.</p> <p>As I understand it, the only thing the <code>Switch</code> does is exclusively render the first route it matches, and the common problem as a result of omitting it is rendering both pages at once. If my <code>"/"</code> route is exact, then even without the Switch, the Fridge should be the only route that matches, right? Why does it not render at all?</p>
0debug
static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm) { pcibus_t start = d->pci.io_regions[QXL_RAM_RANGE_INDEX].addr; pcibus_t end = d->pci.io_regions[QXL_RAM_RANGE_INDEX].size + start; QXLMode *mode = d->modes->modes + modenr; uint64_t devmem = d->pci.io_regions[QXL_RAM_RANGE_INDEX].addr; QXLMemSlot slot = { .mem_start = start, .mem_end = end }; QXLSurfaceCreate surface = { .width = mode->x_res, .height = mode->y_res, .stride = -mode->x_res * 4, .format = SPICE_SURFACE_FMT_32_xRGB, .flags = loadvm ? QXL_SURF_FLAG_KEEP_DATA : 0, .mouse_mode = true, .mem = devmem + d->shadow_rom.draw_area_offset, }; trace_qxl_set_mode(d->id, modenr, mode->x_res, mode->y_res, mode->bits, devmem); if (!loadvm) { qxl_hard_reset(d, 0); } d->guest_slots[0].slot = slot; qxl_add_memslot(d, 0, devmem, QXL_SYNC); d->guest_primary.surface = surface; qxl_create_guest_primary(d, 0, QXL_SYNC); d->mode = QXL_MODE_COMPAT; d->cmdflags = QXL_COMMAND_FLAG_COMPAT; #ifdef QXL_COMMAND_FLAG_COMPAT_16BPP if (mode->bits == 16) { d->cmdflags |= QXL_COMMAND_FLAG_COMPAT_16BPP; } #endif d->shadow_rom.mode = cpu_to_le32(modenr); d->rom->mode = cpu_to_le32(modenr); qxl_rom_set_dirty(d); }
1threat
Convert number to a binary code in JavaScript? : <p>What function or method converts number (2354) to binary code (001011001010)? Thanks</p>
0debug
static inline int onenand_prog_spare(OneNANDState *s, int sec, int secn, void *src) { int result = 0; if (secn > 0) { const uint8_t *sp = (const uint8_t *)src; uint8_t *dp = 0, *dpp = 0; if (s->blk_cur) { dp = g_malloc(512); if (!dp || blk_read(s->blk_cur, s->secs_cur + (sec >> 5), dp, 1) < 0) { result = 1; } else { dpp = dp + ((sec & 31) << 4); } } else { if (sec + secn > s->secs_cur) { result = 1; } else { dpp = s->current + (s->secs_cur << 9) + (sec << 4); } } if (!result) { uint32_t i; for (i = 0; i < (secn << 4); i++) { dpp[i] &= sp[i]; } if (s->blk_cur) { result = blk_write(s->blk_cur, s->secs_cur + (sec >> 5), dp, 1) < 0; } } g_free(dp); } return result; }
1threat
void main_loop_wait(int timeout) { IOHandlerRecord *ioh; fd_set rfds, wfds, xfds; int ret, nfds; struct timeval tv; qemu_bh_update_timeout(&timeout); host_main_loop_wait(&timeout); nfds = -1; FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (ioh->deleted) continue; if (ioh->fd_read && (!ioh->fd_read_poll || ioh->fd_read_poll(ioh->opaque) != 0)) { FD_SET(ioh->fd, &rfds); if (ioh->fd > nfds) nfds = ioh->fd; } if (ioh->fd_write) { FD_SET(ioh->fd, &wfds); if (ioh->fd > nfds) nfds = ioh->fd; } } tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; slirp_select_fill(&nfds, &rfds, &wfds, &xfds); qemu_mutex_unlock_iothread(); ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv); qemu_mutex_lock_iothread(); if (ret > 0) { IOHandlerRecord **pioh; for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) { ioh->fd_read(ioh->opaque); } if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) { ioh->fd_write(ioh->opaque); } } pioh = &first_io_handler; while (*pioh) { ioh = *pioh; if (ioh->deleted) { *pioh = ioh->next; qemu_free(ioh); } else pioh = &ioh->next; } } slirp_select_poll(&rfds, &wfds, &xfds, (ret < 0)); if (alarm_timer->flags & ALARM_FLAG_EXPIRED) { alarm_timer->flags &= ~ALARM_FLAG_EXPIRED; qemu_rearm_alarm_timer(alarm_timer); } if (vm_running) { if (!cur_cpu || likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER))) qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL], qemu_get_clock(vm_clock)); } qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME], qemu_get_clock(rt_clock)); qemu_bh_poll(); }
1threat
Adding x86 and x64 libraries to NuGet package : <p>I have made a library which depends on CEFsharp which requires to build the library for specific platforms. So no AnyCPU support.</p> <p>Now I want to pack this into a NuGet. As far as I understand you have to put these files into the build folder and have a <code>.targets</code> file which picks the correct dll to reference. So I ended up with a NuGet package looking like this:</p> <pre><code>lib monodroid MyLib.dll xamarin.ios10 MyLib.dll net45 MyLib.dll (x86) build net45 x86 MyLib.dll (x86) x64 MyLib.dll (x64) MyLib.targets </code></pre> <p>I put the following inside of the <code>.targets</code> file:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt; &lt;Target Name="PlatformCheck" BeforeTargets="InjectReference" Condition="(('$(Platform)' != 'x86') AND ('$(Platform)' != 'x64'))"&gt; &lt;Error Text="$(MSBuildThisFileName) does not work correctly on '$(Platform)' platform. You need to specify platform (x86 or x64)." /&gt; &lt;/Target&gt; &lt;Target Name="InjectReference" BeforeTargets="ResolveAssemblyReferences"&gt; &lt;ItemGroup Condition="'$(Platform)' == 'x86' or '$(Platform)' == 'x64'"&gt; &lt;Reference Include="MyLib"&gt; &lt;HintPath&gt;$(MSBuildThisFileDirectory)$(Platform)\MyLib.dll&lt;/HintPath&gt; &lt;/Reference&gt; &lt;/ItemGroup&gt; &lt;/Target&gt; &lt;/Project&gt; </code></pre> <p>So far so good. Now to the problem. When adding this NuGet to a new WPF project, I see the reference to the library appearing in the <code>.csproj</code> file like:</p> <pre><code>&lt;Reference Include="MyLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d64412599724c860, processorArchitecture=x86"&gt; &lt;HintPath&gt;..\packages\MyLib.0.0.1\lib\net45\MyLib.dll&lt;/HintPath&gt; &lt;Private&gt;True&lt;/Private&gt; &lt;/Reference&gt; </code></pre> <p>Although I don't see anything mentioned about the <code>.targets</code> file. Is this still the way to do it with NuGet 3? Did I do something wrong? Currently this fails at runtime when running x64 because of the reference to the x86 lib.</p>
0debug
What is a webView exactly? : <p>I'm setting up a new business app that I want to get some infomation and a page from a website. I don't know how to get a webView to work and I can't find any tutorials that show how to use one. Can someone please show me how to activate a webView?</p>
0debug
Java constructor has to automatically generate and id value for the object : <p>I've a question. I'm looking for idea for constructors which has to automatically generate an id value for the instances. I've searched many pages for that but I couldn't find the right idea. Maybe you have got any ways to do it ? Thanks in advance!</p>
0debug
java - How to get external storages path? : I want to get sdcard and internal storage location on my android app. i am using this code.. String sdcard = Environment.getExternalStorageDirectory().toString(); it return 'storage/sdcard0'. and this code also return same String sdcard = System.getenv("EXTERNAL_STORAGE"); and I am trying to get phone memory path with this code: String internalpath = System.getenv("SECONDARY_STORAGE"); it returns 'storage/emulated/0' . on my android 4.4.2 that I want. but in a android 6.0 it returns 'null'. please give me a solution to get the internal storage path like 'storage/emulated/0'. thanks in advance.
0debug
How to create input name field with string-variable schema in Vue Js? : <p>I use VueJs, i need to extract javascript variable to generate hidden fields.</p> <p>But i need to set the name by the index of the variable.</p> <p>I want to use zig-zag naming schema.</p> <p>like,</p> <pre><code> &lt;input type="text" name="segment[{index}][field_name]" :value="{value}"&gt; </code></pre> <p><strong>Javascript Variable:</strong></p> <pre><code> var test_template = { 0: { nb: 2 }, 1: { nb: 1 }, 2: { nb: 4 } }; </code></pre> <p><strong>Foreach with Variable to Generate Hidden Fields :</strong></p> <pre><code> &lt;div v-for="(a,index) in test_template" class="row"&gt; &lt;input type="hidden" :name="segment[index][nb]" :value="a.nb"&gt; &lt;/div&gt; </code></pre> <p>Here, <strong>:name</strong> is a dynamic instance for access vuejs values. <strong>index</strong> is vuejs variable but "<strong>segment</strong>" is not a vuejs variable, its actually a string.</p> <p>But i need this schema to generate array of inputs.</p> <p>Is this possible ?</p> <p>Or Any other solutions are there ?</p> <p>Thanks in Advance !</p>
0debug
responsive image and four buttons : I would like to make my footer exactly as same as the picture I've attached below : https://imgur.com/a/eXlKgHq I want to add 1 image and 4 buttons. They must be in the same position as shown in the picture and everything must be responsive. thank you in advance Lorem ipsum dolor sit amet, admodum pertinax intellegebat duo id, et ludus utamur contentiones sit. No vix quod luptatum, dicat eleifend ad per, ei nostro vulputate vel. Per solum ceteros in. Ad mei mucius recteque definiebas. Te wisi verterem mei, solet sapientem consequat ius id. Vel abhorreant voluptatum ad. Eros autem feugiat has ad. Ius mucius democritum ex. Tota feugait at duo, ius nominavi quaerendum delicatissimi eu, has ex congue timeam aperiam. Ea intellegat deterruisset quo, pri ut tollit labore facete, sea enim debet argumentum ei.
0debug
static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res, uint16_t *refcount_table, int64_t refcount_table_size, int64_t l2_offset, int flags) { BDRVQcowState *s = bs->opaque; uint64_t *l2_table, l2_entry; uint64_t next_contiguous_offset = 0; int i, l2_size, nb_csectors; l2_size = s->l2_size * sizeof(uint64_t); l2_table = g_malloc(l2_size); if (bdrv_pread(bs->file, l2_offset, l2_table, l2_size) != l2_size) goto fail; for(i = 0; i < s->l2_size; i++) { l2_entry = be64_to_cpu(l2_table[i]); switch (qcow2_get_cluster_type(l2_entry)) { case QCOW2_CLUSTER_COMPRESSED: if (l2_entry & QCOW_OFLAG_COPIED) { fprintf(stderr, "ERROR: cluster %" PRId64 ": " "copied flag must never be set for compressed " "clusters\n", l2_entry >> s->cluster_bits); l2_entry &= ~QCOW_OFLAG_COPIED; res->corruptions++; } nb_csectors = ((l2_entry >> s->csize_shift) & s->csize_mask) + 1; l2_entry &= s->cluster_offset_mask; inc_refcounts(bs, res, refcount_table, refcount_table_size, l2_entry & ~511, nb_csectors * 512); if (flags & CHECK_FRAG_INFO) { res->bfi.allocated_clusters++; res->bfi.compressed_clusters++; res->bfi.fragmented_clusters++; } break; case QCOW2_CLUSTER_ZERO: if ((l2_entry & L2E_OFFSET_MASK) == 0) { break; } case QCOW2_CLUSTER_NORMAL: { uint64_t offset = l2_entry & L2E_OFFSET_MASK; if (flags & CHECK_FRAG_INFO) { res->bfi.allocated_clusters++; if (next_contiguous_offset && offset != next_contiguous_offset) { res->bfi.fragmented_clusters++; } next_contiguous_offset = offset + s->cluster_size; } inc_refcounts(bs, res, refcount_table,refcount_table_size, offset, s->cluster_size); if (offset_into_cluster(s, offset)) { fprintf(stderr, "ERROR offset=%" PRIx64 ": Cluster is not " "properly aligned; L2 entry corrupted.\n", offset); res->corruptions++; } break; } case QCOW2_CLUSTER_UNALLOCATED: break; default: abort(); } } g_free(l2_table); return 0; fail: fprintf(stderr, "ERROR: I/O error in check_refcounts_l2\n"); g_free(l2_table); return -EIO; }
1threat
CustomTabs shows ERR_UNKNOWN_URL_SCHEME after 302 Redirect : <p>I'm trying to implement OAuth2 login flow using Custom Tabs, but after login has been successful a 302 Redirect is retrieved with url as the following: "my.app:/oauth2/code?xxx".</p> <p>Now I have declared redirect URI in AndroidManifest to listen to this, but ERR_UNKNOWN_URL_SCHEME is seen :/</p> <pre><code>&lt;intent-filter&gt; &lt;data android:host="oauth2" android:scheme="my.app" android:pathPrefix="/code" /&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;category android:name="android.intent.category.BROWSABLE" /&gt; &lt;/intent-filter&gt; </code></pre> <p>I've tried different url-schemes to listen to, but none seems to be triggered to open my app.</p>
0debug
AWS API Gateway - Remove Stage Name From URI : <p>The stage name is added to the url when I deploy the API. Let's say the stage name is "test", then the generated URL for the resource includes the stage name. Something like: <a href="https://abcabc.execute-api.us-east-1.amazonaws.com/test/my/path" rel="noreferrer">https://abcabc.execute-api.us-east-1.amazonaws.com/test/my/path</a></p> <p>I would like to remove the stage name in the URL. How can I do it?</p>
0debug
static void new_subtitle_stream(AVFormatContext *oc, int file_idx) { AVStream *st; OutputStream *ost; AVCodec *codec=NULL; AVCodecContext *subtitle_enc; enum CodecID codec_id = CODEC_ID_NONE; if(!subtitle_stream_copy){ if (subtitle_codec_name) { codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1, avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance); codec = avcodec_find_encoder_by_name(subtitle_codec_name); } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_SUBTITLE); codec = avcodec_find_encoder(codec_id); } } ost = new_output_stream(oc, file_idx, codec); st = ost->st; subtitle_enc = st->codec; ost->bitstream_filters = subtitle_bitstream_filters; subtitle_bitstream_filters= NULL; subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE; if(subtitle_codec_tag) subtitle_enc->codec_tag= subtitle_codec_tag; if (oc->oformat->flags & AVFMT_GLOBALHEADER) { subtitle_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; } if (subtitle_stream_copy) { st->stream_copy = 1; } else { subtitle_enc->codec_id = codec_id; set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec); } if (subtitle_language) { av_dict_set(&st->metadata, "language", subtitle_language, 0); av_freep(&subtitle_language); } subtitle_disable = 0; av_freep(&subtitle_codec_name); subtitle_stream_copy = 0; }
1threat
void *qpci_legacy_iomap(QPCIDevice *dev, uint16_t addr) { return (void *)(uintptr_t)addr; }
1threat
Trying to understand function prototypes : <p>I'm going through K&amp;R and I'm on the functions chapter, and I have a quick question:</p> <p>Do I always have to declare functions as prototypes? What decides what kind of arguments will be in the prototype? Can it just be two variables in the function definition?</p> <p>Thanks!</p>
0debug
static bool qvirtio_pci_get_queue_isr_status(QVirtioDevice *d, QVirtQueue *vq) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; QVirtQueuePCI *vqpci = (QVirtQueuePCI *)vq; uint32_t data; if (dev->pdev->msix_enabled) { g_assert_cmpint(vqpci->msix_entry, !=, -1); if (qpci_msix_masked(dev->pdev, vqpci->msix_entry)) { return qpci_msix_pending(dev->pdev, vqpci->msix_entry); } else { data = readl(vqpci->msix_addr); writel(vqpci->msix_addr, 0); return data == vqpci->msix_data; } } else { return qpci_io_readb(dev->pdev, dev->addr + QVIRTIO_PCI_ISR_STATUS) & 1; } }
1threat
angular 2 - how to hide nav bar in some components : <p>I am created nav bar separately in nav.component.html ,how to hide nav bar in some components like login.component.</p> <blockquote> <p>nav.component.html</p> </blockquote> <pre><code>&lt;nav class="navbar navbar-default navbar-fixed-top navClass"&gt; &lt;div class="container-fluid"&gt; &lt;div class="navbar-header"&gt; &lt;button type="button" class="navbar-toggle collapsed" (click)="toggleState()"&gt; &lt;span class="sr-only"&gt;Toggle navigation&lt;/span&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;/button&gt; &lt;/div&gt; &lt;div class="collapse navbar-collapse" [ngClass]="{ 'in': isIn }"&gt; enter code here &lt;ul class="nav navbar-nav"&gt; &lt;li class="active"&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;about&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/nav&gt; </code></pre>
0debug
static void qpa_fini_in (HWVoiceIn *hw) { void *ret; PAVoiceIn *pa = (PAVoiceIn *) hw; audio_pt_lock (&pa->pt, AUDIO_FUNC); pa->done = 1; audio_pt_unlock_and_signal (&pa->pt, AUDIO_FUNC); audio_pt_join (&pa->pt, &ret, AUDIO_FUNC); if (pa->s) { pa_simple_free (pa->s); pa->s = NULL; } audio_pt_fini (&pa->pt, AUDIO_FUNC); g_free (pa->pcm_buf); pa->pcm_buf = NULL; }
1threat
static bool vexpress_cfgctrl_write(arm_sysctl_state *s, unsigned int dcc, unsigned int function, unsigned int site, unsigned int position, unsigned int device, uint32_t val) { if (dcc != 0 || position != 0 || (site != SYS_CFG_SITE_MB && site != SYS_CFG_SITE_DB1)) { goto cfgctrl_unimp; } switch (function) { case SYS_CFG_OSC: if (site == SYS_CFG_SITE_MB && device < sizeof(s->mb_clock)) { s->mb_clock[device] = val; return true; } if (site == SYS_CFG_SITE_DB1 && device < s->db_num_clocks) { s->db_clock[device] = val; return true; } break; case SYS_CFG_MUXFPGA: if (site == SYS_CFG_SITE_MB && device == 0) { qemu_log_mask(LOG_UNIMP, "arm_sysctl: selection of video output " "not supported, ignoring\n"); return true; } break; case SYS_CFG_SHUTDOWN: if (site == SYS_CFG_SITE_MB && device == 0) { qemu_system_shutdown_request(); return true; } break; case SYS_CFG_REBOOT: if (site == SYS_CFG_SITE_MB && device == 0) { qemu_system_reset_request(); return true; } break; case SYS_CFG_DVIMODE: if (site == SYS_CFG_SITE_MB && device == 0) { return true; } default: break; } cfgctrl_unimp: qemu_log_mask(LOG_UNIMP, "arm_sysctl: Unimplemented SYS_CFGCTRL write of function " "0x%x DCC 0x%x site 0x%x position 0x%x device 0x%x\n", function, dcc, site, position, device); return false; }
1threat
Capture and Store Google Places Data : I need to make a job that summarize amount of business in one specific region (district, city, province or country). I would like to use the Google Places API, but this returns only until 60 places. In one city, for example, it can there are more que 30,000 places register in Google Maps. I need this places for summarize per type (restaurant, coffee, hotel, school, etc...) I also know that there is the term of use which says that no one is allowed to store any information of Google places in personal Database. How can I start this job, a little clue where to start already help me.
0debug
quick java question, how to make code silent : <p>I have to run this code against a tester and it needs to be silent(if that makes sense) since is going against a lot of data if it printed everything my computer would crash.</p> <p>I have no idea how to make it return silent values.</p> <pre><code>public static void uniqueCharacters(String test){ String temp = ""; for (int i = 0; i &lt; test.length(); i++){ char current = test.charAt(i); if (temp.indexOf(current) &lt; 0){ temp = temp + current; } else { temp = temp.replace(String.valueOf(current), ""); } } System.out.println(temp + " "); } //// here's the tester I'm using @Test public void testUniqueCharacters() { Random rng = new Random(SEED); CRC32 check = new CRC32(); for(int i = 0; i &lt; RUNS; i++) { int len = rng.nextInt(100) + (2 &lt;&lt; rng.nextInt(5)); String s = buildString(rng, len); String res = P2J2.uniqueCharacters(s); check.update(res.getBytes()); } assertEquals(3756363171L, check.getValue()); } </code></pre>
0debug
how can i improve seo for my website? : when i do the SEO for my Wordpress website,i generate the sitemap and submit it on search console,161 url generate in sitemap but when result comes of sitemap it only indexed 1 page ,what is this problem and how can i solve this
0debug
xml parsing and spliting in scala : I want to split a **sub xml from mail xml** with the help of the node name can some one help? sample.xml <div> <a>A <b>B <c>C</c> </b> <d>D</d> </a> </div> I want to split the sub xml that contains B using scala?please help
0debug
kafka consumer polling timeout : <p>I am working with Kafka and trying to consume data from it. From the below line, I can poll the data from Kafka.</p> <pre><code> while (true) { ConsumerRecords&lt;byte[], &lt;byte[]&gt; records = consumer.poll(Long.MAX_VALUE); for (ConsumerRecord&lt;byte[], &lt;byte[]&gt; record : records) { // retrieve data } } </code></pre> <p>My question is what is the benefit I am getting by providing <code>Long.MAX_VALUE</code> as the timeout as compared to if I provide <code>200</code> as the timeout. What is the best practice for the system that will be running production.</p> <p>Can anyone explain me the difference of high timeout vs low timeout and which should be use in production system?</p>
0debug
Efficient way of parsing string : <p>How would you turn a string that looks like this</p> <p><code>7.11,8,9:00,9:15,14:30,15:00</code></p> <p>into this dictionary entry </p> <p><code>{7.11 : [8, (9:00, 9:15), (14:30, 15:00)]}</code>?</p> <p>Suppose that the number of time pairs (such as <code>9:00,9:15</code> and <code>14:30,15:00</code> is unknown and you want to have them all as tuple pairs.</p>
0debug
static void setup_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUM68KState *env) { struct target_sigframe *frame; abi_ulong frame_addr; abi_ulong retcode_addr; abi_ulong sc_addr; int err = 0; int i; frame_addr = get_sigframe(ka, env, sizeof *frame); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) goto give_sigsegv; __put_user(sig, &frame->sig); sc_addr = frame_addr + offsetof(struct target_sigframe, sc); __put_user(sc_addr, &frame->psc); err |= setup_sigcontext(&frame->sc, env, set->sig[0]); if (err) goto give_sigsegv; for(i = 1; i < TARGET_NSIG_WORDS; i++) { if (__put_user(set->sig[i], &frame->extramask[i - 1])) goto give_sigsegv; } retcode_addr = frame_addr + offsetof(struct target_sigframe, retcode); __put_user(retcode_addr, &frame->pretcode); __put_user(0x70004e40 + (TARGET_NR_sigreturn << 16), (long *)(frame->retcode)); if (err) goto give_sigsegv; env->aregs[7] = frame_addr; env->pc = ka->_sa_handler; unlock_user_struct(frame, frame_addr, 1); return; give_sigsegv: unlock_user_struct(frame, frame_addr, 1); force_sig(TARGET_SIGSEGV); }
1threat
Object initializtion in C++ : Good evening! I've seen the following code snippet: `test()` function output is 6 #include <iostream> using namespace std; int z = 0; class A{ public: int a = 2; A(){ a = 1; z++; } A(const A& aa){ a = 3; z += 2; } A& f(){return *this;} }; void test(){ {A a, b(a), c(A().f());} cout << z; } int main() { test(); return 0; } I understand what happens in all lines except object `c` initialization: `c(A().f())`? I'd would be glad, if you explain me this line?
0debug
def is_num_keith(x): terms = [] temp = x n = 0 while (temp > 0): terms.append(temp % 10) temp = int(temp / 10) n+=1 terms.reverse() next_term = 0 i = n while (next_term < x): next_term = 0 for j in range(1,n+1): next_term += terms[i - j] terms.append(next_term) i+=1 return (next_term == x)
0debug
Scala Non-Tail Recursive Solution : <p>I have this tail-recursive function that returns true if any element in the list is a <code>Boolean</code> value.</p> <pre><code>def anyBoolTailRec[A](test: A=&gt; Boolean, a: List[A]): Boolean = a match { case Nil =&gt; false case h :: t if(!test(h)) =&gt; anyBoolTailRec(test, t) case _ =&gt; true } </code></pre> <p>The test parameter is just a function to check the values type:</p> <pre><code>def isBool(i: Any) = i match { case _: Boolean =&gt; true case _ =&gt; false } </code></pre> <p>The function is called like this:</p> <pre><code>anyBoolTailRec(isBool, List(1, 2, "hi", "test", false)) &gt;&gt;&gt; true </code></pre> <p><strong>Question:</strong> How can I turn this tail recursive solution into a non-tail recursive solution? Since we're returning Booleans I'm not sure how to do it.</p> <p><em>Note:</em> I am aware tail-recursive solutions are better in Scala.</p>
0debug
Variable initialization in Delphi 10 Rio : <p>My company has been using Delphi for decades, and our core program was made in a quite old version. It has about 1.3 million lines of code.</p> <p>After upgrading to Delphi 10 Rio, a major problem occured. Where our local function variables used to be initialized with a default value (integer would be 0, boolean would be false), it seems they no longer are. Now all my variables get a random value as they are created, so an integer gets something like 408796 as it's value.</p> <p>I suppose this isn't an issue with new development, but I am sure you can see the problem in our large code base. We have never manually assigned default values to these variables as it worked fine. Object variables, however, have always had this problem. All properties get random values, so we have adressed that as we went. But now our program completely breaks, as all counters etc. are starting at high values instead of 0. And running through the entire project to fix this would take months.</p> <p>Is there perhaps a compiler option to change this? Seems very backwards that they would have changed this intentionally, as it would be pretty stupid. Why remove functionality that all developers expect? I had actually expected it to go the other way, that object variables would no longer need manual default values, and that they maybe implemented a garbage collector. But is seems Delphi has seriously regressed?</p> <p>If there is some option to fix this, PLEASE let me know.</p>
0debug
void helper_rfmci(CPUPPCState *env) { do_rfi(env, env->spr[SPR_BOOKE_MCSRR0], SPR_BOOKE_MCSRR1, ~((target_ulong)0x3FFF0000), 0); }
1threat
what is mathematics behind featuretools? : In order to use properly, it is important to understand the algorithmic/mathematical basis for featuretools, are there some papers, patents, comparison with other tools?
0debug
How to prevent YouTube js calls from slowing down page load : <p>I am using <a href="https://gtmetrix.com" rel="noreferrer">https://gtmetrix.com</a> to diagnose issues with my page speed. </p> <p>The <a href="http://www.problemio.com/udemy/white-labeling-or-buying-udemy-courses.html" rel="noreferrer">page in question</a> has one embedded YouTube video and GTMetrix is saying that this video's JS calls are slowing down page load speed.</p> <p>This is the call being made:</p> <pre><code>&lt;iframe width="640" height="360" src="https://www.youtube.com/embed/PgcokT0AWHo" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt; </code></pre>
0debug
Why does the expression 'a'>'b' return false in Python? : <p>print('a'>'b') Returns False similar to this print('a'>'A') Returns True</p>
0debug
Equivalent of angular.equals in angular2 : <p>I am working on migration of angular 1 project to angular 2 . In angular 1 project I was using angular.equals for object comparison <code>angular.equals($ctrl.obj1, $ctrl.newObj);</code> , I searched online for equivalent method in angular 2 but could not find any matching result. </p>
0debug
static int ftp_conn_control_block_control(void *data) { FTPContext *s = data; return s->conn_control_block_flag; }
1threat
How do I hide the VR Mode / Goggles icon for A-Frame? : <p>In the bottom right corner, by default, is a Goggles icon that when clicked, enters VR or fullscreen (if no headset). How do I hide this so I can add my own UI, or disable VR altogether?</p> <p><img src="https://i.imgur.com/xhbdEJ4.jpg" alt=""></p>
0debug
How can I `npm link` a typescript dependency with peer dependencies? : <p>I have a React/Redux typescript project A. My team decided to split out some of the React components and Redux code into an NPM module, so I created another React/Redux TS project B.</p> <p>Initially, when I tried to install B from A, I got errors due to type redeclarations, since both A and B depend on the same type declarations files (react, redux, etc). So I moved all of B's @types dependencies to be peer dependencies. This allows me to properly install B from A.</p> <p>However, for development purposes, I would like to <code>npm link</code> to B from A, so I don't constantly have to recompile and reinstall B. But because <code>npm link</code> creates a symlink, it points to the entire B project, including the type definitions that I need to avoid.</p> <p>Does anyone know how to solve this conundrum? </p>
0debug
How to save a string in a text file and use it in my code later [Python]? : <p>The user is supposed to enter a string and I will save it in an text document. So far all is working, but the next step would be to read the string out and use it later on in my code. Can someone explain me how to do this? I am kinda new to python.</p> <p>Here is what I got so far:</p> <pre><code>import datetime now = datetime.datetime.now() _prename_human = "" _prename_human = input("test") text_file = open("save.txt", "w") text_file.write("prenameHuman: %s" % _prename_human) text_file.close() text_file = open("save.txt", "r") readFile = text_file.read() text_file.close() </code></pre>
0debug
static void xics_kvm_cpu_setup(XICSState *xics, PowerPCCPU *cpu) { CPUState *cs; ICPState *ss; KVMXICSState *xicskvm = XICS_SPAPR_KVM(xics); cs = CPU(cpu); ss = &xics->ss[cs->cpu_index]; assert(cs->cpu_index < xics->nr_servers); if (xicskvm->kernel_xics_fd == -1) { abort(); } if (ss->cap_irq_xics_enabled) { return; } if (xicskvm->kernel_xics_fd != -1) { int ret; ret = kvm_vcpu_enable_cap(cs, KVM_CAP_IRQ_XICS, 0, xicskvm->kernel_xics_fd, kvm_arch_vcpu_id(cs)); if (ret < 0) { error_report("Unable to connect CPU%ld to kernel XICS: %s", kvm_arch_vcpu_id(cs), strerror(errno)); exit(1); } ss->cap_irq_xics_enabled = true; } }
1threat
static int hq_decode_block(HQContext *c, GetBitContext *gb, int16_t block[64], int qsel, int is_chroma, int is_hqa) { const int32_t *q; int val, pos = 1; memset(block, 0, 64 * sizeof(*block)); if (!is_hqa) { block[0] = get_sbits(gb, 9) << 6; q = ff_hq_quants[qsel][is_chroma][get_bits(gb, 2)]; } else { q = ff_hq_quants[qsel][is_chroma][get_bits(gb, 2)]; block[0] = get_sbits(gb, 9) << 6; } for (;;) { val = get_vlc2(gb, c->hq_ac_vlc.table, 9, 2); pos += ff_hq_ac_skips[val]; if (pos >= 64) break; block[ff_zigzag_direct[pos]] = (ff_hq_ac_syms[val] * q[pos]) >> 12; pos++; } return 0; }
1threat
av_cold int ff_vaapi_encode_close(AVCodecContext *avctx) { VAAPIEncodeContext *ctx = avctx->priv_data; VAAPIEncodePicture *pic, *next; for (pic = ctx->pic_start; pic; pic = next) { next = pic->next; vaapi_encode_free(avctx, pic); } if (ctx->va_context != VA_INVALID_ID) vaDestroyContext(ctx->hwctx->display, ctx->va_context); if (ctx->va_config != VA_INVALID_ID) vaDestroyConfig(ctx->hwctx->display, ctx->va_config); if (ctx->codec->close) ctx->codec->close(avctx); av_freep(&ctx->codec_sequence_params); av_freep(&ctx->codec_picture_params); av_buffer_unref(&ctx->recon_frames_ref); av_buffer_unref(&ctx->input_frames_ref); av_buffer_unref(&ctx->device_ref); av_freep(&ctx->priv_data); return 0; }
1threat
How to use a Ternary Operator with multiple condition in flutter dart? : <p>how to use ternary if else with two or more condition using "OR" and "AND" like</p> <pre><code> if(foo == 1 || foo == 2) { do something } { else do something } </code></pre> <p>i want to use it like </p> <pre><code> foo == 1 || foo == 2 ? doSomething : doSomething </code></pre>
0debug
static int decode_exponents(AC3DecodeContext *ctx) { ac3_audio_block *ab = &ctx->audio_block; int i; uint8_t *exps; uint8_t *dexps; if (ab->flags & AC3_AB_CPLINU && ab->cplexpstr != AC3_EXPSTR_REUSE) if (_decode_exponents(ab->cplexpstr, ab->ncplgrps, ab->cplabsexp, ab->cplexps, ab->dcplexps + ab->cplstrtmant)) return -1; for (i = 0; i < ctx->bsi.nfchans; i++) if (ab->chexpstr[i] != AC3_EXPSTR_REUSE) { exps = ab->exps[i]; dexps = ab->dexps[i]; if (_decode_exponents(ab->chexpstr[i], ab->nchgrps[i], exps[0], exps + 1, dexps + 1)) return -1; } if (ctx->bsi.flags & AC3_BSI_LFEON && ab->lfeexpstr != AC3_EXPSTR_REUSE) if (_decode_exponents(ab->lfeexpstr, 2, ab->lfeexps[0], ab->lfeexps + 1, ab->dlfeexps)) return -1; return 0; }
1threat
order fill in ggplott2 after reorder x : I reordered my plot in ggplott2: KR %>% ggplot(aes(x= reorder(categories, -n), n, fill = categories, order = categories)) + geom_bar(stat = "identity") + (axis.title.x=element_blank(), axis.text.x=element_blank(), axis.ticks.x=element_blank()) Now I want, that `fill` has the same order as `x`. I tried it with `order` but it doesn't work. str(KR) Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 20 obs. of 2 variables: $ categories: chr "Food" "Nightlife" "Bars" "American (Traditional)" ... $ n : int 8576 6334 6067 5312 5250 5229 5220 4118 3868 3673 ...
0debug
static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename) { int i, err; AVFormatContext *ic = avformat_alloc_context(); ic->interrupt_callback = int_cb; err = avformat_open_input(&ic, filename, NULL, NULL); if (err < 0) return err; for(i=0;i<ic->nb_streams;i++) { AVStream *st; OutputStream *ost; AVCodec *codec; const char *enc_config; codec = avcodec_find_encoder(ic->streams[i]->codecpar->codec_id); if (!codec) { av_log(s, AV_LOG_ERROR, "no encoder found for codec id %i\n", ic->streams[i]->codecpar->codec_id); return AVERROR(EINVAL); } if (codec->type == AVMEDIA_TYPE_AUDIO) opt_audio_codec(o, "c:a", codec->name); else if (codec->type == AVMEDIA_TYPE_VIDEO) opt_video_codec(o, "c:v", codec->name); ost = new_output_stream(o, s, codec->type, -1); st = ost->st; avcodec_get_context_defaults3(st->codec, codec); enc_config = av_stream_get_recommended_encoder_configuration(ic->streams[i]); if (enc_config) { AVDictionary *opts = NULL; av_dict_parse_string(&opts, enc_config, "=", ",", 0); av_opt_set_dict2(st->codec, &opts, AV_OPT_SEARCH_CHILDREN); av_dict_free(&opts); } if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy) choose_sample_fmt(st, codec); else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy) choose_pixel_fmt(st, st->codec, codec, st->codecpar->format); avcodec_copy_context(ost->enc_ctx, st->codec); if (enc_config) av_dict_parse_string(&ost->encoder_opts, enc_config, "=", ",", 0); } avformat_close_input(&ic); return err; }
1threat
can Clustering be used for predictive Analytics? : <p>Im still not sure how clustering can be used for predictive analytics? can someone tell me how to predict the future from extracting clusters?</p>
0debug
static void qemu_chr_fire_open_event(void *opaque) { CharDriverState *s = opaque; qemu_chr_be_event(s, CHR_EVENT_OPENED); qemu_free_timer(s->open_timer); s->open_timer = NULL; }
1threat
Unable to create a stage in AWS API Gateway : <p>I want to create a new stage in AWS Api Gateway, but for some reason deployment list is empty. I tried checking all the sections, but could not find a section where I can add/create a deployment item.</p> <p>Any ideas how to resolve this?</p> <p><a href="https://i.stack.imgur.com/qJaIU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qJaIU.png" alt="enter image description here"></a></p>
0debug
Array from preg_match_all : The code what working: $url = 'http://www.google.com/search?hl=en&tbo=d&site=&source=hp&q=upoznavanje'; $html = file_get_html($url); preg_match_all('/(?<="><cite>).*?(?=<\/cite><div\ class=)/', $html, $output); foreach ($output[0] as $link) { $link ."<br>" ; } But when i put echo $output[0] i get 0, or $output[1] nothing var_dump works and print_r array is there, but how to take unique value of each - but not with foreach ?
0debug
Kubernetes: list all pods and its nodes : <p>I have 3 nodes, running all kinds of pods. I would like to jave a list of nodes and pods, for an example:</p> <pre><code>NODE1 POD1 NODE1 POD2 NODE2 POD3 NODE3 POD4 </code></pre> <p>How can this please be achieved?</p> <p>Thanks.</p>
0debug
static av_cold int adpcm_decode_init(AVCodecContext * avctx) { ADPCMDecodeContext *c = avctx->priv_data; unsigned int min_channels = 1; unsigned int max_channels = 2; switch(avctx->codec->id) { case AV_CODEC_ID_ADPCM_DTK: case AV_CODEC_ID_ADPCM_EA: min_channels = 2; break; case AV_CODEC_ID_ADPCM_AFC: case AV_CODEC_ID_ADPCM_EA_R1: case AV_CODEC_ID_ADPCM_EA_R2: case AV_CODEC_ID_ADPCM_EA_R3: case AV_CODEC_ID_ADPCM_EA_XAS: max_channels = 6; break; case AV_CODEC_ID_ADPCM_THP: case AV_CODEC_ID_ADPCM_THP_LE: max_channels = 10; break; } if (avctx->channels < min_channels || avctx->channels > max_channels) { av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); return AVERROR(EINVAL); } switch(avctx->codec->id) { case AV_CODEC_ID_ADPCM_CT: c->status[0].step = c->status[1].step = 511; break; case AV_CODEC_ID_ADPCM_IMA_WAV: if (avctx->bits_per_coded_sample < 2 || avctx->bits_per_coded_sample > 5) return AVERROR_INVALIDDATA; break; case AV_CODEC_ID_ADPCM_IMA_APC: if (avctx->extradata && avctx->extradata_size >= 8) { c->status[0].predictor = AV_RL32(avctx->extradata); c->status[1].predictor = AV_RL32(avctx->extradata + 4); } break; case AV_CODEC_ID_ADPCM_IMA_WS: if (avctx->extradata && avctx->extradata_size >= 2) c->vqa_version = AV_RL16(avctx->extradata); break; default: break; } switch(avctx->codec->id) { case AV_CODEC_ID_ADPCM_IMA_QT: case AV_CODEC_ID_ADPCM_IMA_WAV: case AV_CODEC_ID_ADPCM_4XM: case AV_CODEC_ID_ADPCM_XA: case AV_CODEC_ID_ADPCM_EA_R1: case AV_CODEC_ID_ADPCM_EA_R2: case AV_CODEC_ID_ADPCM_EA_R3: case AV_CODEC_ID_ADPCM_EA_XAS: case AV_CODEC_ID_ADPCM_THP: case AV_CODEC_ID_ADPCM_THP_LE: case AV_CODEC_ID_ADPCM_AFC: case AV_CODEC_ID_ADPCM_DTK: avctx->sample_fmt = AV_SAMPLE_FMT_S16P; break; case AV_CODEC_ID_ADPCM_IMA_WS: avctx->sample_fmt = c->vqa_version == 3 ? AV_SAMPLE_FMT_S16P : AV_SAMPLE_FMT_S16; break; default: avctx->sample_fmt = AV_SAMPLE_FMT_S16; } return 0; }
1threat
int cpu_watchpoint_insert(CPUState *env, target_ulong addr, target_ulong len, int flags, CPUWatchpoint **watchpoint) { target_ulong len_mask = ~(len - 1); CPUWatchpoint *wp; if ((len != 1 && len != 2 && len != 4 && len != 8) || (addr & ~len_mask)) { fprintf(stderr, "qemu: tried to set invalid watchpoint at " TARGET_FMT_lx ", len=" TARGET_FMT_lu "\n", addr, len); return -EINVAL; } wp = qemu_malloc(sizeof(*wp)); wp->vaddr = addr; wp->len_mask = len_mask; wp->flags = flags; if (flags & BP_GDB) TAILQ_INSERT_HEAD(&env->watchpoints, wp, entry); else TAILQ_INSERT_TAIL(&env->watchpoints, wp, entry); tlb_flush_page(env, addr); if (watchpoint) *watchpoint = wp; return 0; }
1threat
void ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number) { int full_frame= 0; avpriv_align_put_bits(&s->pb); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, (s->pict_type == AV_PICTURE_TYPE_P)); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 5, s->qscale); if (s->pict_type == AV_PICTURE_TYPE_I) { } if(!full_frame){ put_bits(&s->pb, 6, 0); put_bits(&s->pb, 6, 0); put_bits(&s->pb, 12, s->mb_width * s->mb_height); } put_bits(&s->pb, 3, 0); }
1threat
Failed to implement a search widget : <p>I'm trying to implement a search widget in my app . I found a useful tutorial from <a href="http://developer.android.com/intl/es/training/search/setup.html" rel="nofollow">here</a>.</p> <p><a href="http://i.stack.imgur.com/T6bEp.png" rel="nofollow">My Activity A</a></p> <p>But my app crashed.</p> <p><strong>Activity A</strong></p> <pre><code> @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.create_menu, menu); // Associate searchable configuration with the SearchView SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); searchView.setSearchableInfo( searchManager.getSearchableInfo(getComponentName())); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. switch (item.getItemId()) { case R.id.add: // create new file View menuItemView = findViewById(R.id.add); PopupMenu po = new PopupMenu(HomePage.this, menuItemView); //for drop-down menu po.getMenuInflater().inflate(R.menu.popup_menu, po.getMenu()); po.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { // Toast.makeText(MainActivity.this, "You Clicked : " + item.getTitle(), Toast.LENGTH_SHORT).show(); if ("Create New File".equals(item.getTitle())) { Intent intent = new Intent(HomePage.this, Information.class); // go to Information class startActivity(intent); } else if ("Edit File".equals(item.getTitle())) { Intent intent = new Intent(HomePage.this, Edit.class); startActivity(intent); } return true; } }); po.show(); //showing popup menu } return super.onOptionsItemSelected(item); } </code></pre> <p><strong>searchable in xml folder</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="@string/app_name" android:hint="Search by date" /&gt; </code></pre> <p><strong>create_menu</strong></p> <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"&gt; &lt;item android:id="@+id/search" android:title="Search by date" android:icon="@mipmap/search" app:showAsAction="collapseActionView|ifRoom" android:actionViewClass="android.widget.SearchView" /&gt; &lt;item android:icon="@mipmap/menu" android:id="@+id/add" android:orderInCategory="100" android:title="Main Menu" app:showAsAction="always" /&gt; &lt;/menu&gt; </code></pre> <p>declare this in mainfest</p> <pre><code> &lt;meta-data android:name="android.app.searchable" android:resource="@xml/searchable" /&gt; </code></pre> <p><strong>Error LogCat</strong></p> <pre><code>01-18 18:31:09.298 9215-9215/com.example.project.myapplication E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example.project.myapplication, PID: 9215 java.lang.NullPointerException at com.example.project.myapplication.GUI.HomePage.onCreateOptionsMenu(HomePage.java:104) at android.app.Activity.onCreatePanelMenu(Activity.java:2646) at android.support.v4.app.FragmentActivity.onCreatePanelMenu(FragmentActivity.java:298) at android.support.v7.internal.view.WindowCallbackWrapper.onCreatePanelMenu(WindowCallback </code></pre> <p>This is the line where error pointed to <code>searchView.setSearchableInfo(</code></p>
0debug
Error Duplicate Const Declaration in Switch Case Statement : <p>I have the following code and I get the error 'Duplicate Declaration query_url'.</p> <pre><code> switch(condition) { case 'complex': const query_url = `something`; break; default: const query_url = `something`; break; } </code></pre> <p>I understand that query_url is getting declared twice which isn't right. But i don't know how to resolve this. Can someone please help on what should be the correct way to make this work?</p>
0debug
static int push_samples(AVFilterLink *outlink) { ASNSContext *asns = outlink->src->priv; AVFrame *outsamples = NULL; int ret, nb_out_samples, nb_pad_samples; if (asns->pad) { nb_out_samples = av_audio_fifo_size(asns->fifo) ? asns->nb_out_samples : 0; nb_pad_samples = nb_out_samples - FFMIN(nb_out_samples, av_audio_fifo_size(asns->fifo)); } else { nb_out_samples = FFMIN(asns->nb_out_samples, av_audio_fifo_size(asns->fifo)); nb_pad_samples = 0; } if (!nb_out_samples) return 0; outsamples = ff_get_audio_buffer(outlink, nb_out_samples); av_assert0(outsamples); av_audio_fifo_read(asns->fifo, (void **)outsamples->extended_data, nb_out_samples); if (nb_pad_samples) av_samples_set_silence(outsamples->extended_data, nb_out_samples - nb_pad_samples, nb_pad_samples, av_get_channel_layout_nb_channels(outlink->channel_layout), outlink->format); outsamples->nb_samples = nb_out_samples; outsamples->channel_layout = outlink->channel_layout; outsamples->sample_rate = outlink->sample_rate; outsamples->pts = asns->next_out_pts; if (asns->next_out_pts != AV_NOPTS_VALUE) asns->next_out_pts += nb_out_samples; ret = ff_filter_frame(outlink, outsamples); if (ret < 0) return ret; asns->req_fullfilled = 1; return nb_out_samples; }
1threat
static int read_data(void *opaque, uint8_t *buf, int buf_size) { struct playlist *v = opaque; HLSContext *c = v->parent->priv_data; int ret, i; int just_opened = 0; if (!v->needed) return AVERROR_EOF; restart: if (!v->input) { int64_t reload_interval = default_reload_interval(v); reload: if (!v->finished && av_gettime() - v->last_load_time >= reload_interval) { if ((ret = parse_playlist(c, v->url, v, NULL)) < 0) { av_log(v->parent, AV_LOG_WARNING, "Failed to reload playlist %d\n", v->index); return ret; } reload_interval = v->target_duration / 2; } if (v->cur_seq_no < v->start_seq_no) { av_log(NULL, AV_LOG_WARNING, "skipping %d segments ahead, expired from playlists\n", v->start_seq_no - v->cur_seq_no); v->cur_seq_no = v->start_seq_no; } if (v->cur_seq_no >= v->start_seq_no + v->n_segments) { if (v->finished) return AVERROR_EOF; while (av_gettime() - v->last_load_time < reload_interval) { if (ff_check_interrupt(c->interrupt_callback)) return AVERROR_EXIT; av_usleep(100*1000); } goto reload; } ret = open_input(c, v); if (ret < 0) { av_log(v->parent, AV_LOG_WARNING, "Failed to open segment of playlist %d\n", v->index); return ret; } just_opened = 1; } ret = read_from_url(v, buf, buf_size, READ_NORMAL); if (ret > 0) { if (just_opened && v->is_id3_timestamped != 0) { intercept_id3(v, buf, buf_size, &ret); } return ret; } ffurl_close(v->input); v->input = NULL; v->cur_seq_no++; c->end_of_segment = 1; c->cur_seq_no = v->cur_seq_no; if (v->ctx && v->ctx->nb_streams && v->parent->nb_streams >= v->stream_offset + v->ctx->nb_streams) { v->needed = 0; for (i = v->stream_offset; i < v->stream_offset + v->ctx->nb_streams; i++) { if (v->parent->streams[i]->discard < AVDISCARD_ALL) v->needed = 1; } } if (!v->needed) { av_log(v->parent, AV_LOG_INFO, "No longer receiving playlist %d\n", v->index); return AVERROR_EOF; } goto restart; }
1threat
can I loop some data json with nested value in golang : i got a problem when nested data json in golang, when I got a new data json ORDER_TRX_H_ID the result must looping with new ORDER_TRX_H_ID, but my result always show last data. u can try my code [https://play.golang.org/p/aHUoYZlEQs4][1] [1]: https://play.golang.org/p/aHUoYZlEQs4 My result always show last data { "DTM_CRT": "2019-08-28T16:25:15.757Z", "ORDER_TRX_H_ID": "1", "QUESTION": { "ALAMAT_KTP": "Bogor", "FULLNAME": "Fariz" }, "QUICK_DATA_H_ID": "1" } my expected result { "DTM_CRT": "2019-08-28T16:25:15.757Z", "ORDER_TRX_H_ID": "1", "QUESTION": { "ALAMAT_KTP": "jalandisana", "FULLNAME": "RUBEN" }, "QUICK_DATA_H_ID": "1" }, { "DTM_CRT": "2019-08-28T16:25:15.757Z", "ORDER_TRX_H_ID": "2", "QUESTION": { "ALAMAT_KTP": "Bogor", "FULLNAME": "Fariz" }, "QUICK_DATA_H_ID": "2" }
0debug
static void spapr_machine_2_3_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); mc->name = "pseries-2.3"; mc->desc = "pSeries Logical Partition (PAPR compliant) v2.3"; mc->alias = "pseries"; mc->is_default = 1; }
1threat
static int cpu_post_load(void *opaque, int version_id) { PowerPCCPU *cpu = opaque; CPUPPCState *env = &cpu->env; int i; target_ulong msr; #if defined(TARGET_PPC64) if (cpu->compat_pvr) { Error *local_err = NULL; ppc_set_compat(cpu, cpu->compat_pvr, &local_err); if (local_err) { error_report_err(local_err); error_free(local_err); return -1; } } else #endif { if (!pvr_match(cpu, env->spr[SPR_PVR])) { return -1; } } env->lr = env->spr[SPR_LR]; env->ctr = env->spr[SPR_CTR]; cpu_write_xer(env, env->spr[SPR_XER]); #if defined(TARGET_PPC64) env->cfar = env->spr[SPR_CFAR]; #endif env->spe_fscr = env->spr[SPR_BOOKE_SPEFSCR]; for (i = 0; (i < 4) && (i < env->nb_BATs); i++) { env->DBAT[0][i] = env->spr[SPR_DBAT0U + 2*i]; env->DBAT[1][i] = env->spr[SPR_DBAT0U + 2*i + 1]; env->IBAT[0][i] = env->spr[SPR_IBAT0U + 2*i]; env->IBAT[1][i] = env->spr[SPR_IBAT0U + 2*i + 1]; } for (i = 0; (i < 4) && ((i+4) < env->nb_BATs); i++) { env->DBAT[0][i+4] = env->spr[SPR_DBAT4U + 2*i]; env->DBAT[1][i+4] = env->spr[SPR_DBAT4U + 2*i + 1]; env->IBAT[0][i+4] = env->spr[SPR_IBAT4U + 2*i]; env->IBAT[1][i+4] = env->spr[SPR_IBAT4U + 2*i + 1]; } if (!cpu->vhyp) { ppc_store_sdr1(env, env->spr[SPR_SDR1]); } msr = env->msr; env->msr ^= ~((1ULL << MSR_TGPR) | MSR_HVB); ppc_store_msr(env, msr); hreg_compute_mem_idx(env); return 0; }
1threat
Add all items in model class : I need to add all items in the arraylist **Logcat:** E/BUSINESS_STR: fuflfilled E/itemsaArrayList: [com.model.CommonListItems@307c24ff, com.model.CommonListItems@307c24ff] **Code:** if(BUSINESS_STR != null){ Log.e("BUSINESS_STR", "" + BUSINESS_STR); CommonListItems commonListItems = new CommonListItems(); for(int i = 0; i <= 1 ; i++) { commonListItems.setName("My Business"); commonListItems.setName("Search Business"); commonListItems.setImage(String.valueOf(R.drawable.business_icon)); commonListItems.setImage(String.valueOf(R.drawable.search_business_icon)); itemsaArrayList.add(commonListItems); } tvTitle.setText("Business"); } Finally it is adding the last item Search Business twice.I need to add My business first and then search business.
0debug
static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice) { VAAPIEncodeContext *ctx = avctx->priv_data; VAEncSequenceParameterBufferH264 *vseq = ctx->codec_sequence_params; VAEncPictureParameterBufferH264 *vpic = pic->codec_picture_params; VAEncSliceParameterBufferH264 *vslice = slice->codec_slice_params; VAAPIEncodeH264Context *priv = ctx->priv_data; VAAPIEncodeH264Slice *pslice; VAAPIEncodeH264MiscSliceParams *mslice; int i; slice->priv_data = av_mallocz(sizeof(*pslice)); if (!slice->priv_data) return AVERROR(ENOMEM); pslice = slice->priv_data; mslice = &pslice->misc_slice_params; if (pic->type == PICTURE_TYPE_IDR) mslice->nal_unit_type = H264_NAL_IDR_SLICE; else mslice->nal_unit_type = H264_NAL_SLICE; switch (pic->type) { case PICTURE_TYPE_IDR: vslice->slice_type = SLICE_TYPE_I; mslice->nal_ref_idc = 3; break; case PICTURE_TYPE_I: vslice->slice_type = SLICE_TYPE_I; mslice->nal_ref_idc = 2; break; case PICTURE_TYPE_P: vslice->slice_type = SLICE_TYPE_P; mslice->nal_ref_idc = 1; break; case PICTURE_TYPE_B: vslice->slice_type = SLICE_TYPE_B; mslice->nal_ref_idc = 0; break; default: av_assert0(0 && "invalid picture type"); } vslice->macroblock_address = 0; vslice->num_macroblocks = priv->mb_width * priv->mb_height; vslice->macroblock_info = VA_INVALID_ID; vslice->pic_parameter_set_id = vpic->pic_parameter_set_id; vslice->idr_pic_id = priv->idr_pic_count++; vslice->pic_order_cnt_lsb = pic->display_order & ((1 << (4 + vseq->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4)) - 1); for (i = 0; i < FF_ARRAY_ELEMS(vslice->RefPicList0); i++) { vslice->RefPicList0[i].picture_id = VA_INVALID_ID; vslice->RefPicList0[i].flags = VA_PICTURE_H264_INVALID; vslice->RefPicList1[i].picture_id = VA_INVALID_ID; vslice->RefPicList1[i].flags = VA_PICTURE_H264_INVALID; } av_assert0(pic->nb_refs <= 2); if (pic->nb_refs >= 1) { av_assert0(pic->type == PICTURE_TYPE_P || pic->type == PICTURE_TYPE_B); vslice->num_ref_idx_l0_active_minus1 = 0; vslice->RefPicList0[0] = vpic->ReferenceFrames[0]; } if (pic->nb_refs >= 2) { av_assert0(pic->type == PICTURE_TYPE_B); vslice->num_ref_idx_l1_active_minus1 = 0; vslice->RefPicList1[0] = vpic->ReferenceFrames[1]; } if (pic->type == PICTURE_TYPE_B) vslice->slice_qp_delta = priv->fixed_qp_b - vpic->pic_init_qp; else if (pic->type == PICTURE_TYPE_P) vslice->slice_qp_delta = priv->fixed_qp_p - vpic->pic_init_qp; else vslice->slice_qp_delta = priv->fixed_qp_idr - vpic->pic_init_qp; vslice->direct_spatial_mv_pred_flag = 1; return 0; }
1threat
struct pxa2xx_state_s *pxa255_init(unsigned int sdram_size, DisplayState *ds) { struct pxa2xx_state_s *s; struct pxa2xx_ssp_s *ssp; int iomemtype, i; s = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s)); s->env = cpu_init(); cpu_arm_set_model(s->env, "pxa255"); register_savevm("cpu", 0, 0, cpu_save, cpu_load, s->env); cpu_register_physical_memory(PXA2XX_SDRAM_BASE, sdram_size, qemu_ram_alloc(sdram_size) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, PXA2XX_INTERNAL_SIZE, qemu_ram_alloc(PXA2XX_INTERNAL_SIZE) | IO_MEM_RAM); s->pic = pxa2xx_pic_init(0x40d00000, s->env); s->dma = pxa255_dma_init(0x40000000, s->pic[PXA2XX_PIC_DMA]); pxa25x_timer_init(0x40a00000, &s->pic[PXA2XX_PIC_OST_0]); s->gpio = pxa2xx_gpio_init(0x40e00000, s->env, s->pic, 85); s->mmc = pxa2xx_mmci_init(0x41100000, s->pic[PXA2XX_PIC_MMC], s->dma); for (i = 0; pxa255_serial[i].io_base; i ++) if (serial_hds[i]) serial_mm_init(pxa255_serial[i].io_base, 2, s->pic[pxa255_serial[i].irqn], serial_hds[i], 1); else break; if (serial_hds[i]) s->fir = pxa2xx_fir_init(0x40800000, s->pic[PXA2XX_PIC_ICP], s->dma, serial_hds[i]); if (ds) s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD], ds); s->cm_base = 0x41300000; s->cm_regs[CCCR >> 4] = 0x02000210; s->clkcfg = 0x00000009; iomemtype = cpu_register_io_memory(0, pxa2xx_cm_readfn, pxa2xx_cm_writefn, s); cpu_register_physical_memory(s->cm_base, 0xfff, iomemtype); register_savevm("pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, s); cpu_arm_set_cp_io(s->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, s); s->mm_base = 0x48000000; s->mm_regs[MDMRS >> 2] = 0x00020002; s->mm_regs[MDREFR >> 2] = 0x03ca4000; s->mm_regs[MECR >> 2] = 0x00000001; iomemtype = cpu_register_io_memory(0, pxa2xx_mm_readfn, pxa2xx_mm_writefn, s); cpu_register_physical_memory(s->mm_base, 0xfff, iomemtype); register_savevm("pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, s); s->pm_base = 0x40f00000; iomemtype = cpu_register_io_memory(0, pxa2xx_pm_readfn, pxa2xx_pm_writefn, s); cpu_register_physical_memory(s->pm_base, 0xff, iomemtype); register_savevm("pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, s); for (i = 0; pxa255_ssp[i].io_base; i ++); s->ssp = (struct pxa2xx_ssp_s **) qemu_mallocz(sizeof(struct pxa2xx_ssp_s *) * i); ssp = (struct pxa2xx_ssp_s *) qemu_mallocz(sizeof(struct pxa2xx_ssp_s) * i); for (i = 0; pxa255_ssp[i].io_base; i ++) { s->ssp[i] = &ssp[i]; ssp[i].base = pxa255_ssp[i].io_base; ssp[i].irq = s->pic[pxa255_ssp[i].irqn]; iomemtype = cpu_register_io_memory(0, pxa2xx_ssp_readfn, pxa2xx_ssp_writefn, &ssp[i]); cpu_register_physical_memory(ssp[i].base, 0xfff, iomemtype); register_savevm("pxa2xx_ssp", i, 0, pxa2xx_ssp_save, pxa2xx_ssp_load, s); } if (usb_enabled) { usb_ohci_init_pxa(0x4c000000, 3, -1, s->pic[PXA2XX_PIC_USBH1]); } s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); s->rtc_base = 0x40900000; iomemtype = cpu_register_io_memory(0, pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, s); cpu_register_physical_memory(s->rtc_base, 0xfff, iomemtype); pxa2xx_rtc_init(s); register_savevm("pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, s); s->i2c[0] = pxa2xx_i2c_init(0x40301600, s->pic[PXA2XX_PIC_I2C], 0xffff); s->i2c[1] = pxa2xx_i2c_init(0x40f00100, s->pic[PXA2XX_PIC_PWRI2C], 0xff); s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma); pxa2xx_gpio_handler_set(s->gpio, 1, pxa2xx_reset, s); return s; }
1threat
static BlockAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockCompletionFunc *cb, void *opaque, int is_write) { BlockAIOCBSync *acb; acb = qemu_aio_get(&bdrv_em_aiocb_info, bs, cb, opaque); acb->is_write = is_write; acb->qiov = qiov; acb->bounce = qemu_try_blockalign(bs, qiov->size); acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_aio_bh_cb, acb); if (acb->bounce == NULL) { acb->ret = -ENOMEM; } else if (is_write) { qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); acb->ret = bs->drv->bdrv_write(bs, sector_num, acb->bounce, nb_sectors); } else { acb->ret = bs->drv->bdrv_read(bs, sector_num, acb->bounce, nb_sectors); } qemu_bh_schedule(acb->bh); return &acb->common; }
1threat
Get current date time from server and convert it into a specific local time in c# : <p>Hi have been dealing and searching information in several forums but cannot resolve my problem. I'm working on a task that needs to be executed at 2 pm Central Time, what I want to do is to get the time zone of the server and convert it from 2 pm Central Time to the server time. For example if server time is on EST the time would be 3 pm, if server time is on PST time would be 12 pm and so on any guidance would be appreciate it.</p> <p>Thanks</p>
0debug
How do I make an element display for some time then fade away and when i refresh my page it doesn't show? : <p>I have a log in in page where by when I i log in it takes me to my homepage which has a <code>&lt;div class="alert alert-success</code>> message. I want this message to show for like 5 seconds then it fades out. How do I do that?? Also when i refresh my page I don't want the message to show again unless i log out then log in again. </p> <p>this is some of the code: &times; <strong>success!</strong> Login successfull! This is supposed to show when i have successfully logged in.</p>
0debug
static int do_break(CPUMIPSState *env, target_siginfo_t *info, unsigned int code) { int ret = -1; switch (code) { case BRK_OVERFLOW: case BRK_DIVZERO: info->si_signo = TARGET_SIGFPE; info->si_code = (code == BRK_OVERFLOW) ? FPE_INTOVF : FPE_INTDIV; break; default: break; } return ret; }
1threat
what is the difference between .NET Framework Develop Pack and .net core? : <p>I have navigate to <a href="https://www.microsoft.com/net/download/windows" rel="nofollow noreferrer">https://www.microsoft.com/net/download/windows</a> to download .net core SDK , then i saw there is 3 build apps </p> <ol> <li>.Net Core</li> <li>Visual Studio</li> <li>.NET Framework Develop Pack</li> </ol> <p>Can anyone explain what is the difference between 1st one and 3rd one ?</p>
0debug
void cpu_exec_step_atomic(CPUState *cpu) { start_exclusive(); parallel_cpus = false; cpu_exec_step(cpu); parallel_cpus = true; end_exclusive(); }
1threat
Bootstrap 4 - Not breaking like in Bootstrap 3 : If I execute the following in bootstrap 3, then everything works as expected. But it does not break correctly in bootstrap 4. Please execute the examples below, the first runs with BS4 then last with BS3. I expect it to look like in BS3. <div id="orange_containers" class=""> <div class="row no-gutters"> <div class="col-sm-6"> <div class="col-sm-3"> <div class="icon"> A </div> </div> <div class="col-sm-9"> <div class="text"> <h4>Test</h4> <p> I'm speaking with myself, number one, because I have a very good brain and I've said a lot of things. If Trump Ipsum weren’t my own words, perhaps I’d be dating it. </p> </div> </div> </div> <div class="col-sm-6"> <div class="col-sm-3"> <div class="icon"> B </div> </div> <div class="col-sm-9"> <div class="text"> <h4>Test</h4> <p> The other thing with Lorem Ipsum is that you have to take out its family. We have so many things that we have to do better... and certainly ipsum is one of them. We are going to make placeholder text great again. Greater than ever before. </p> </div> </div> </div> </div> </div> [Try Bootstrap 4 Example in Bootply][1] Same Example but Bootstrap 3: https://www.bootply.com/i8pRUcI7nz [1]: https://www.bootply.com/CL6AQWfRcz
0debug
void bdrv_delete(BlockDriverState *bs) { assert(!bs->peer); bdrv_make_anon(bs); bdrv_close(bs); if (bs->file != NULL) { bdrv_delete(bs->file); } assert(bs != bs_snapshots); g_free(bs); }
1threat
How can I make a good use of didFinishLaunchingWithOptions in Appdelegate (xcode,swift) : I want to extract some data from the server or database, now im confusing if i have to put the extracting code in didFinishLaunchingWithOptions() function or put the code in viewdidload() function in the first viewcontroller. what's the execution efficiency of both methods? Thanks.
0debug
static void fix_bitshift(ShortenContext *s, int32_t *buffer) { int i; if (s->bitshift != 0) for (i = 0; i < s->blocksize; i++) buffer[s->nwrap + i] <<= s->bitshift; }
1threat
C# windows form, track user login : <p>I have three forms, signup ,login and after they have logged the dashboard will display their last edit on a text editor in C#. The project is an offline user login system, and not using any ASP. </p> <p>I am thinking how to pass data after the user logs in in, so the form can retrieve and show data of that particular user. Everything is stored in a text file.</p>
0debug
How to invoke a NSwag client method that needs bearer token on request header? : <p>I didn't get exactly how NSwag interact with IdentityServerX bearer tokens and adds it request header conventionally? My host api application implements IdentityServer3 with LDAP auth, so as far as i understand; if any host needs to a token for authentication then any client must send it on request header. So how can i deal with it while working NSwag clients ?</p> <p>Any idea appreciated. Thanks.</p>
0debug
Unable to get request body in flask api using request.form from axios request : <p>I have written a flask api which recieves post request params using request.form. API performs perfectly in postman but fails in axios request.</p>
0debug
Python, bringing two list elements together : <p>I have a list like this:</p> <pre><code>['PHE', '45', 'HIS', '46', 'HIS', '46', 'HIS', '46', 'HIS', '46', 'HIS', '46'] </code></pre> <p>I want it to turn into</p> <pre><code>['PHE 45', 'HIS '46', 'HIS '46'] # it goes on like that </code></pre> <p>how can I merge consecutive list elements to eachother?</p>
0debug
void helper_fxrstor(CPUX86State *env, target_ulong ptr, int data64) { int i, fpus, fptag, nb_xmm_regs; floatx80 tmp; target_ulong addr; if (ptr & 0xf) { raise_exception(env, EXCP0D_GPF); } env->fpuc = cpu_lduw_data(env, ptr); fpus = cpu_lduw_data(env, ptr + 2); fptag = cpu_lduw_data(env, ptr + 4); env->fpstt = (fpus >> 11) & 7; env->fpus = fpus & ~0x3800; fptag ^= 0xff; for (i = 0; i < 8; i++) { env->fptags[i] = ((fptag >> i) & 1); } addr = ptr + 0x20; for (i = 0; i < 8; i++) { tmp = helper_fldt(env, addr); ST(i) = tmp; addr += 16; } if (env->cr[4] & CR4_OSFXSR_MASK) { env->mxcsr = cpu_ldl_data(env, ptr + 0x18); if (env->hflags & HF_CS64_MASK) { nb_xmm_regs = 16; } else { nb_xmm_regs = 8; } addr = ptr + 0xa0; if (!(env->efer & MSR_EFER_FFXSR) || (env->hflags & HF_CPL_MASK) || !(env->hflags & HF_LMA_MASK)) { for (i = 0; i < nb_xmm_regs; i++) { env->xmm_regs[i].XMM_Q(0) = cpu_ldq_data(env, addr); env->xmm_regs[i].XMM_Q(1) = cpu_ldq_data(env, addr + 8); addr += 16; } } } }
1threat
Python Class property question about how check if the name is isalpha() in the setter? : can anyone help me out with this requirement? I have been trying to fix it, but not succefful. I would really appreciate if someone can help me out thanks. name: property returns capitalized name and setter checks the name isalpha() and if true store the name in the object otherwise store ‘Unknown’ eid: property returns eid zero filled up to 4 spaces and setter will assign ‘9999’ if length is zero, otherwise store the eid. here is my code. class Employee: def __init__(self, name, eid): self.name = name self.eid = eid def set_name(self, name): if name.isalpha(): self.__name = name else: self.__name = 'Unknown' def set_eid(self, eid): if self.eid.isalpha(): self.eid = eid else: self.eid = "9999" def get_name(self): return self.name def get_eid(self): return self.eid def __str__(self): return "%s: %s " % (self.eid, self.name) def main(): empName = input('Name') eid = input('Id') employeeInfo = Employee(empName, eid) print(employeeInfo.__str__()) main()
0debug
Error: stat_count() in ggplot2 : <p>In many of my programs I have been using ggplot2 to render charts. I have loaded them on shinyapps.io and they are working absolutely fine. However, when I try to run the program on my machine, i am getting the following error:</p> <pre><code>Error : stat_count() must not be used with a y aesthetic. </code></pre> <p>The following is the example code:</p> <pre><code>ggplot(hashtg, aes(x=reorder(hashtag, Freq), y = Freq, fill = hashtag)) + geom_bar(stat="identity") + geom_bar(width = 0.4) + xlab("Hashtags Used") + ylab("Number of responses") + geom_text(aes(label=Freq), hjust = 1, colour = "white" ) </code></pre> <p>The actual code has many arguments of bar graph such as title, theme &amp; annotation, but I guess they would not hamper the output. I am using aggregated data where <code>Freq</code> in the code is the frequency of a particular term. When I searched for help, I repeated get instructions to use <code>stat = "identity"</code> for a bar plot. </p> <p>Any help would be highly appreciated.</p> <p>The session info is as follows:</p> <pre><code>R version 3.2.0 (2015-04-16) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.10.3 (Yosemite) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] wordcloud_2.5 RColorBrewer_1.1-2 SnowballC_0.5.1 ggplot2_2.0.0 plyr_1.8.3 [6] chron_2.3-47 RCurl_1.95-4.7 bitops_1.0-6 ROAuth_0.9.6 RJSONIO_1.3-0 [11] twitteR_1.1.9 base64enc_0.1-3 tm_0.6-2 NLP_0.1-8 stringr_1.0.0 [16] shinydashboard_0.5.1 shinyIncubator_0.2.2 shiny_0.12.2 loaded via a namespace (and not attached): [1] Rcpp_0.12.1 tools_3.2.0 digest_0.6.8 bit_1.1-12 jsonlite_0.9.17 gtable_0.1.2 [7] DBI_0.3.1 rstudioapi_0.3.1 curl_0.9.3 parallel_3.2.0 httr_1.0.0 bit64_0.9-5 [13] grid_3.2.0 R6_2.1.1 magrittr_1.5 scales_0.3.0 htmltools_0.2.6 colorspace_1.2-6 [19] mime_0.4 xtable_1.7-4 httpuv_1.3.3 labeling_0.3 stringi_0.5-5 munsell_0.4.2 [25] slam_0.1-32 rjson_0.2.15 rstudio_0.98.1103 </code></pre> <p>To reiterate, the same code works without a trouble in shinyapps.io.</p>
0debug
How to stop AndroidStudio from overwriting .idea/codeStyles/Project.xml : <p>In our project, we have committed .idea/codeStyles/Project.xml to source control with the goal of enforcing a common style among all contributors to the project without affecting the style of other projects. </p> <p>However, Android Studio appears to be making unwanted changes to this file. </p> <p>Pulling down the latest code from git and then simply opening Android Studio and then checking <code>git status</code> produces:</p> <pre><code>Changes not staged for commit: (use "git add &lt;file&gt;..." to update what will be committed) (use "git checkout -- &lt;file&gt;..." to discard changes in working directory) modified: my-project/.idea/codeStyles/Project.xml no changes added to commit (use "git add" and/or "git commit -a") </code></pre> <p>The changes it is making look like this: <a href="https://i.stack.imgur.com/kpfnk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/kpfnk.png" alt="enter image description here"></a></p> <p>As you can see it is removing some XML-formatting settings. </p> <p>I am running Android Studio 3.5, but I can't guarantee that everyone else is, and we would like to keep the project agnostic with respect to IDE-version. </p> <p>Is there a way to prevent Android Studio from changing these settings? Is there a more recommended way to achieve uniform code-style?</p>
0debug
Docker swarm: 'build' configuration in docker compose file ignored during stack deployment : <p>We have created a docker compose file with multiple services. The images for these services are built in runtime using 'build' configuration option. The corresponding Dockerfile(s) are given in the respective directories.</p> <p>Sample docker compose file...</p> <pre><code>version: '3' services: db2server: build: ./db2server ports: - "50005:50000" command: ["db2start"] appruntime: build: ./appruntime depends_on: - db2server </code></pre> <p>This docker compose file works with <code>docker-compose</code> command.</p> <ul> <li>The images are built in runtime from the Dockerfile(s) present in <code>db2server</code> &amp; <code>appruntime</code> directories</li> <li>These images get deployed in the host machine</li> </ul> <p>But when we try to deploy this in a docker swarm, the following error is thrown...</p> <blockquote> <p>docker stack deploy -c /home/docker/docker-compose.yml app</p> </blockquote> <pre><code>Ignoring unsupported options: build Creating network app_default Creating service app_db2server failed to create service app_db2server: Error response from daemon: rpc error: code = InvalidArgument desc = ContainerSpec: image reference must be provided </code></pre> <p>Looks like the 'build' configuration option is ignored during stack deployment in docker swarm.</p> <p>How can we deploy these services (with build option) defined in docker compose file in a docker swarm.</p>
0debug
static int buffered_rate_limit(void *opaque) { MigrationState *s = opaque; int ret; ret = qemu_file_get_error(s->file); if (ret) { return ret; } if (s->bytes_xfer > s->xfer_limit) { return 1; } return 0; }
1threat
alert('Hello ' + user_input);
1threat
int kvm_arch_remove_hw_breakpoint(target_ulong addr, target_ulong len, int type) { int n; n = find_hw_breakpoint(addr, (type == GDB_BREAKPOINT_HW) ? 1 : len, type); if (n < 0) return -ENOENT; nb_hw_breakpoint--; hw_breakpoint[n] = hw_breakpoint[nb_hw_breakpoint]; return 0; }
1threat
static void gic_dist_writel(void *opaque, target_phys_addr_t offset, uint32_t value) { GICState *s = (GICState *)opaque; if (offset == 0xf00) { int cpu; int irq; int mask; cpu = gic_get_current_cpu(s); irq = value & 0x3ff; switch ((value >> 24) & 3) { case 0: mask = (value >> 16) & ALL_CPU_MASK; break; case 1: mask = ALL_CPU_MASK ^ (1 << cpu); break; case 2: mask = 1 << cpu; break; default: DPRINTF("Bad Soft Int target filter\n"); mask = ALL_CPU_MASK; break; } GIC_SET_PENDING(irq, mask); gic_update(s); return; } gic_dist_writew(opaque, offset, value & 0xffff); gic_dist_writew(opaque, offset + 2, value >> 16); }
1threat
Tooltip on click of a button : <p>I'm using <a href="https://clipboardjs.com/" rel="noreferrer">clipboard.js</a> to copy some text from a <code>textarea</code>, and that's working fine, but I want to show a tooltip saying "Copied!" if it was successfully copied like they do in the example given on their website. </p> <p>Here's an example of it working without showing a tooltip: <a href="https://jsfiddle.net/5j50jnhj/" rel="noreferrer">https://jsfiddle.net/5j50jnhj/</a></p>
0debug
Angular2 How to navigate to certain section of the page identified with an id attribute : <p>How to navigate to certain section of the page identified with an id attribute? </p> <p>Example:</p> <p>I need to navigate to "structure" paragraph on my page</p> <pre><code>&lt;div id="info"&gt; &lt;h3&gt;Info&lt;/h3&gt; &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&lt;/p&gt; &lt;/div&gt; &lt;div id="structure"&gt; &lt;h3&gt;Structure&lt;/h3&gt; &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&lt;/p&gt; &lt;/div&gt; </code></pre> <p>And I have a following navigation structure:</p> <pre><code>&lt;li&gt; &lt;ul materialize="collapsible" class="collapsible" data-collapsible="accordion"&gt; &lt;li&gt;&lt;a routerLink="policies" class="collapsible-header"&gt;Policies&lt;/a&gt; &lt;div class="collapsible-body"&gt; &lt;ul&gt; &lt;li&gt;&lt;a &gt;Info&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a &gt;Structure&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a &gt;Something Else&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; </code></pre> <p>It is my understanding that in Angular1.0 I simply could've navigate to the page section using something like: ui-sref="policies({'#':'structure'})" or href="#structure" or ui-sref="policies" href="#structure"...</p> <p>How can I do it in Angular2? I looked at the Fragment example in the <a href="https://angular.io/docs/ts/latest/guide/router.html" rel="noreferrer">docs</a>: Query Parameters and Fragments section and I am finding they example to be very confusing and a bit overkill for such a potentially simple task</p>
0debug
How can I show only outline for a Font Awesome icon? : <p>I am working with the tag icon from FA <a href="http://fontawesome.io/icon/tag/" rel="noreferrer">http://fontawesome.io/icon/tag/</a> and what I wish to do is to display only the outline (red) of it and make the inside transparent. <code>fa-tag-o</code> does not work. I've also tried <code>fa-tag-empty</code> and CSS like </p> <pre><code>.fa{ color: transparent; -webkit-text-stroke-width: 1px; -webkit-text-stroke-color: red; } </code></pre> <p>but nothing seems to work. Is there any possible way I can do this?</p> <p>Thanks in advance</p>
0debug
int match_ext(const char *filename, const char *extensions) { const char *ext, *p; char ext1[32], *q; if(!filename) return 0; ext = strrchr(filename, '.'); if (ext) { ext++; p = extensions; for(;;) { q = ext1; while (*p != '\0' && *p != ',') *q++ = *p++; *q = '\0'; if (!strcasecmp(ext1, ext)) return 1; if (*p == '\0') break; p++; } } return 0; }
1threat
Reading the Microsoft Exchange Email in c# : Iam getting the exception "The Autodiscover service couldn't be located." The version number of Microsoft Exchange is showing up as 14.3.266.4001,Hence am using ExchangeVersion.Exchange2010_SP2.Is it the correct Exchange Version? ExchangeService exchange = null; exchange = new ExchangeService(ExchangeVersion.Exchange2010_SP2); exchange.Credentials = new WebCredentials("deepak.kothari", "*****", "domain.com"); exchange.AutodiscoverUrl("deepak.kothari@domain.com"); Console.WriteLine("Connected to Exchange Server : " + exchange.Url.Host); Please help me resolve the above exception. Note : Iam working virtual machine.And iam trying to access the Microsoft exchange which is residing in another machine. Let me know if i can use any other library which is freely available for the above purpose in case?
0debug
Tracing the history of an email chain : <p>I don't know if this is possible or not, so before i get too far down the rabbit hole I wanted to ask the community.</p> <p>I have an email that was sent by person "a", to person "b", "c" and "d". This email was then forwarded from either b,c or d to a person "e" Finally person e has replied to that email to person a, but has deleted the text in the email that shows who sent the email to person e.</p> <p>I can see in the message header from person e, the "in-reply-to" message ID isnt the message ID of the original email from person a, and has an extra reference in the header which will be the email from the mystery recipient that forwarded this to person e.</p> <p>The question is, is there any way or recovering or tracing who this unknown individual was?</p>
0debug
static int ds1338_send(I2CSlave *i2c, uint8_t data) { DS1338State *s = FROM_I2C_SLAVE(DS1338State, i2c); if (s->addr_byte) { s->ptr = data; s->addr_byte = 0; return 0; } s->nvram[s->ptr - 8] = data; if (data < 8) { qemu_get_timedate(&s->now, s->offset); switch(data) { case 0: s->now.tm_sec = from_bcd(data & 0x7f); break; case 1: s->now.tm_min = from_bcd(data & 0x7f); break; case 2: if (data & 0x40) { if (data & 0x20) { data = from_bcd(data & 0x4f) + 11; } else { data = from_bcd(data & 0x1f) - 1; } } else { data = from_bcd(data); } s->now.tm_hour = data; break; case 3: s->now.tm_wday = from_bcd(data & 7) - 1; break; case 4: s->now.tm_mday = from_bcd(data & 0x3f); break; case 5: s->now.tm_mon = from_bcd(data & 0x1f) - 1; break; case 6: s->now.tm_year = from_bcd(data) + 100; break; case 7: break; } s->offset = qemu_timedate_diff(&s->now); } s->ptr = (s->ptr + 1) & 0xff; return 0; }
1threat
null pointer exception from copying a growing inner array and outer array : this is my first question and I have done as much research as I can into similar questions about 2d arrays and null pointer exceptions but have not found an answer that resembles my situation. My program is supposed to be very basic: take an input "image" file of integer values and "soften" those values by taking the average of values around each. I'm having trouble with the initial process of copying the file into a 2 dimensional array with while loops, though the loops don't seem to be the problem as I have tried "do While" loops already. I initially tried using Arrays.copyOf to copy the arrays but that initially gave me the NPE so i tried writing my own static methods to do the job because I read somewhere that Arrays.copyOf only works for one dimensional arrays. thanks for any help you can offer, Cheers public class ex7_imageSmoother { public static void main ( String[] args ) throws IOException { // build utility object(s) Scanner ScUser = new Scanner( System.in ); // ph for ascii art System.out.println( "\n\nAre your ready to Soften some \"hard\" files?" ); ////..repeat program by prompt String stRepeat1; do { // get hard file name to be softened System.out.print( "\n\nWhat file would you like to soften? " ); String StHardName = ScUser.nextLine().trim(); File FiHardIn = new File ( StHardName ); Scanner ScHardIn = new Scanner( FiHardIn ); //-- build 2d "Hard" array // array will be of at least one cell int[][] AyHardImg = { { 0 } } ; int iRowCount = 0; //// for every line in the file; i.e. check that there is a next line while (ScHardIn.hasNextLine() ) { // create a string that can be read through by scanner for every line of the file String StInLine = ScHardIn.nextLine(); // build scanner to read through each row Scanner ScInLine = new Scanner( StInLine ); // use static method to copy array; make larger on further iterations AyHardImg = smCopyArrayOuter( AyHardImg, iRowCount ); int iColCount = 0; //// for every integer in the row while ( ScInLine.hasNextInt() ) { // create temporary array in an attempt to circumvent NPE int[] temp = new int[ AyHardImg[ iRowCount ].length ]; // ...--... this line creates the NPE!! // copy into temp array all values from inner array of 2d array for (int i = 0; i < AyHardImg[ iRowCount ].length; i++) { temp[ i ] = AyHardImg[ iRowCount ][ i ]; } // copy array and make larger on further iteration temp = smCopyArrayInner( temp, iColCount ); // use temp array to copy into 2d inner array; included is commented out previous attempt without temp array AyHardImg[ iRowCount ] = temp; //= smCopyArray( AyHardImg[ iRowCount ], iColCount ); AyHardImg[ iRowCount ][ iColCount ] = ScInLine.nextInt(); iColCount++; } iRowCount++; ScInLine.close(); } // test algorithm works as intended by printing hard array to screen for ( int i = 0; i < AyHardImg.length; i++ ) { for ( int j = 0; j < AyHardImg[i].length; j++ ) { System.out.print ( AyHardImg[ i ][ j ] + " " ); } System.out.println(); } ScHardIn.close(); // get user response to repeat program System.out.print( "Would you like to soften another file (y/n)? " ); stRepeat1 = ScUser.nextLine().trim().toLowerCase(); } while ( stRepeat1.equals( "y" ) ); } /*----- * copies inner array, hopefully to solve null * pointer exception *------------------*/ public static int[] smCopyArrayInner( int[] AyX, int growth ) { int[] AyY = new int[ AyX.length +growth ]; for ( int i = 0; i < AyX.length; i++ ) { AyY[ i ] = AyX[ i ]; } return AyY; } /*----- * copies outer array, hopefully to solve null * pointer exception *------------------*/ public static int[][] smCopyArrayOuter( int[][] AyX, int growth ) { int[][] AyY = new int[ AyX.length +growth ][]; for ( int i = 0; i < AyX.length; i++ ) { AyY[ i ] = AyX[ i ]; } return AyY; } }
0debug