problem
stringlengths
26
131k
labels
class label
2 classes
static int net_init_nic(const NetClientOptions *opts, const char *name, NetClientState *peer, Error **errp) { int idx; NICInfo *nd; const NetLegacyNicOptions *nic; assert(opts->kind == NET_CLIENT_OPTIONS_KIND_NIC); nic = opts->nic; idx = nic_get_free_idx(); if (idx == -1 || nb_nics >= MAX_NICS) { error_report("Too Many NICs"); return -1; } nd = &nd_table[idx]; memset(nd, 0, sizeof(*nd)); if (nic->has_netdev) { nd->netdev = qemu_find_netdev(nic->netdev); if (!nd->netdev) { error_report("netdev '%s' not found", nic->netdev); return -1; } } else { assert(peer); nd->netdev = peer; } nd->name = g_strdup(name); if (nic->has_model) { nd->model = g_strdup(nic->model); } if (nic->has_addr) { nd->devaddr = g_strdup(nic->addr); } if (nic->has_macaddr && net_parse_macaddr(nd->macaddr.a, nic->macaddr) < 0) { error_report("invalid syntax for ethernet address"); return -1; } if (nic->has_macaddr && is_multicast_ether_addr(nd->macaddr.a)) { error_report("NIC cannot have multicast MAC address (odd 1st byte)"); return -1; } qemu_macaddr_default_if_unset(&nd->macaddr); if (nic->has_vectors) { if (nic->vectors > 0x7ffffff) { error_report("invalid # of vectors: %"PRIu32, nic->vectors); return -1; } nd->nvectors = nic->vectors; } else { nd->nvectors = DEV_NVECTORS_UNSPECIFIED; } nd->used = 1; nb_nics++; return idx; }
1threat
In Android activity lifecycle, do onStop() and onDestroy() always called? Why? : <p>In Android activity lifecycle, do onStop() and onDestroy() always called? Why? Moreover, please named the state definitely called in activity lifecycle? Many thanks</p>
0debug
I am working on selenium 3, and i am having an issue to cater for dropdown....Is there a solution for selenium 3 to select from a dropdown? : public static void main(String[] args) throws IOException { WebDriver driver = new FirefoxDriver(); String baseUrl = "http://newtours.demoaut.com"; driver.manage().window().maximize(); driver.get(baseUrl); driver.findElement(By.name("userName")).sendKeys("rubric2016"); driver.findElement(By.name("password")).sendKeys("rubric2016"); driver.findElement(By.name("login")).click(); **Select dropdown = new Select(driver.findElement(By.name(“fromMonth"))); dropdown.selectByVisibleText(“March");** } }
0debug
how to easily convert a java map to concurrentMap? : Is there any way to convert java8 `Map<K,V>` to `ConcurrentMap<K,V>` ? other then iterating manually all entities?
0debug
Use Laravel seed and sql files to populate database : <p>I got several .sql files of countries, states and cities of the world from github. How can I run them with Laravel's seed files to populate those tables in my database?</p>
0debug
PHP Social Algoritm : First of all sorry for my bad English. I have these parameters for my post link. 1) FB Likes (ex: 372) 2) Tweets (ex: 25) 3) Pinterest Pins (ex: 533) 4) Post likes (on my website) (ex: 13) I want to showing ratings by these datas from 0 to 100 (Example: 73.3). But I haven't any idea for rating algorithm. How can I doing this?
0debug
static void pc_machine_set_nvdimm(Object *obj, bool value, Error **errp) { PCMachineState *pcms = PC_MACHINE(obj); pcms->nvdimm = value; }
1threat
void av_register_all(void) { static int initialized; if (initialized) return; initialized = 1; avcodec_register_all(); REGISTER_MUXER (A64, a64); REGISTER_DEMUXER (AAC, aac); REGISTER_MUXDEMUX (AC3, ac3); REGISTER_MUXER (ADTS, adts); REGISTER_DEMUXER (AEA, aea); REGISTER_MUXDEMUX (AIFF, aiff); REGISTER_MUXDEMUX (AMR, amr); REGISTER_DEMUXER (ANM, anm); REGISTER_DEMUXER (APC, apc); REGISTER_DEMUXER (APE, ape); REGISTER_DEMUXER (APPLEHTTP, applehttp); REGISTER_MUXDEMUX (ASF, asf); REGISTER_MUXDEMUX (ASS, ass); REGISTER_MUXER (ASF_STREAM, asf_stream); REGISTER_MUXDEMUX (AU, au); REGISTER_MUXDEMUX (AVI, avi); REGISTER_DEMUXER (AVISYNTH, avisynth); REGISTER_MUXER (AVM2, avm2); REGISTER_DEMUXER (AVS, avs); REGISTER_DEMUXER (BETHSOFTVID, bethsoftvid); REGISTER_DEMUXER (BFI, bfi); REGISTER_DEMUXER (BINK, bink); REGISTER_DEMUXER (C93, c93); REGISTER_DEMUXER (CAF, caf); REGISTER_MUXDEMUX (CAVSVIDEO, cavsvideo); REGISTER_DEMUXER (CDG, cdg); REGISTER_MUXER (CRC, crc); REGISTER_MUXDEMUX (DAUD, daud); REGISTER_DEMUXER (DFA, dfa); REGISTER_MUXDEMUX (DIRAC, dirac); REGISTER_MUXDEMUX (DNXHD, dnxhd); REGISTER_DEMUXER (DSICIN, dsicin); REGISTER_MUXDEMUX (DTS, dts); REGISTER_MUXDEMUX (DV, dv); REGISTER_DEMUXER (DXA, dxa); REGISTER_DEMUXER (EA, ea); REGISTER_DEMUXER (EA_CDATA, ea_cdata); REGISTER_MUXDEMUX (EAC3, eac3); REGISTER_MUXDEMUX (FFM, ffm); REGISTER_MUXDEMUX (FFMETADATA, ffmetadata); REGISTER_MUXDEMUX (FILMSTRIP, filmstrip); REGISTER_MUXDEMUX (FLAC, flac); REGISTER_DEMUXER (FLIC, flic); REGISTER_MUXDEMUX (FLV, flv); REGISTER_DEMUXER (FOURXM, fourxm); REGISTER_MUXER (FRAMECRC, framecrc); REGISTER_MUXER (FRAMEMD5, framemd5); REGISTER_MUXDEMUX (G722, g722); REGISTER_MUXER (GIF, gif); REGISTER_DEMUXER (GSM, gsm); REGISTER_MUXDEMUX (GXF, gxf); REGISTER_MUXDEMUX (H261, h261); REGISTER_MUXDEMUX (H263, h263); REGISTER_MUXDEMUX (H264, h264); REGISTER_DEMUXER (IDCIN, idcin); REGISTER_DEMUXER (IFF, iff); REGISTER_MUXDEMUX (IMAGE2, image2); REGISTER_MUXDEMUX (IMAGE2PIPE, image2pipe); REGISTER_DEMUXER (INGENIENT, ingenient); REGISTER_DEMUXER (IPMOVIE, ipmovie); REGISTER_MUXER (IPOD, ipod); REGISTER_DEMUXER (ISS, iss); REGISTER_DEMUXER (IV8, iv8); REGISTER_MUXDEMUX (IVF, ivf); REGISTER_DEMUXER (JV, jv); REGISTER_MUXER (LATM, latm); REGISTER_DEMUXER (LMLM4, lmlm4); REGISTER_DEMUXER (LXF, lxf); REGISTER_MUXDEMUX (M4V, m4v); REGISTER_MUXER (MD5, md5); REGISTER_MUXDEMUX (MATROSKA, matroska); REGISTER_MUXER (MATROSKA_AUDIO, matroska_audio); REGISTER_MUXDEMUX (MJPEG, mjpeg); REGISTER_MUXDEMUX (MLP, mlp); REGISTER_DEMUXER (MM, mm); REGISTER_MUXDEMUX (MMF, mmf); REGISTER_MUXDEMUX (MOV, mov); REGISTER_MUXER (MP2, mp2); REGISTER_MUXDEMUX (MP3, mp3); REGISTER_MUXER (MP4, mp4); REGISTER_DEMUXER (MPC, mpc); REGISTER_DEMUXER (MPC8, mpc8); REGISTER_MUXER (MPEG1SYSTEM, mpeg1system); REGISTER_MUXER (MPEG1VCD, mpeg1vcd); REGISTER_MUXER (MPEG1VIDEO, mpeg1video); REGISTER_MUXER (MPEG2DVD, mpeg2dvd); REGISTER_MUXER (MPEG2SVCD, mpeg2svcd); REGISTER_MUXER (MPEG2VIDEO, mpeg2video); REGISTER_MUXER (MPEG2VOB, mpeg2vob); REGISTER_DEMUXER (MPEGPS, mpegps); REGISTER_MUXDEMUX (MPEGTS, mpegts); REGISTER_DEMUXER (MPEGTSRAW, mpegtsraw); REGISTER_DEMUXER (MPEGVIDEO, mpegvideo); REGISTER_MUXER (MPJPEG, mpjpeg); REGISTER_DEMUXER (MSNWC_TCP, msnwc_tcp); REGISTER_DEMUXER (MTV, mtv); REGISTER_DEMUXER (MVI, mvi); REGISTER_MUXDEMUX (MXF, mxf); REGISTER_MUXER (MXF_D10, mxf_d10); REGISTER_DEMUXER (MXG, mxg); REGISTER_DEMUXER (NC, nc); REGISTER_DEMUXER (NSV, nsv); REGISTER_MUXER (NULL, null); REGISTER_MUXDEMUX (NUT, nut); REGISTER_DEMUXER (NUV, nuv); REGISTER_MUXDEMUX (OGG, ogg); REGISTER_DEMUXER (OMA, oma); REGISTER_MUXDEMUX (PCM_ALAW, pcm_alaw); REGISTER_MUXDEMUX (PCM_MULAW, pcm_mulaw); REGISTER_MUXDEMUX (PCM_F64BE, pcm_f64be); REGISTER_MUXDEMUX (PCM_F64LE, pcm_f64le); REGISTER_MUXDEMUX (PCM_F32BE, pcm_f32be); REGISTER_MUXDEMUX (PCM_F32LE, pcm_f32le); REGISTER_MUXDEMUX (PCM_S32BE, pcm_s32be); REGISTER_MUXDEMUX (PCM_S32LE, pcm_s32le); REGISTER_MUXDEMUX (PCM_S24BE, pcm_s24be); REGISTER_MUXDEMUX (PCM_S24LE, pcm_s24le); REGISTER_MUXDEMUX (PCM_S16BE, pcm_s16be); REGISTER_MUXDEMUX (PCM_S16LE, pcm_s16le); REGISTER_MUXDEMUX (PCM_S8, pcm_s8); REGISTER_MUXDEMUX (PCM_U32BE, pcm_u32be); REGISTER_MUXDEMUX (PCM_U32LE, pcm_u32le); REGISTER_MUXDEMUX (PCM_U24BE, pcm_u24be); REGISTER_MUXDEMUX (PCM_U24LE, pcm_u24le); REGISTER_MUXDEMUX (PCM_U16BE, pcm_u16be); REGISTER_MUXDEMUX (PCM_U16LE, pcm_u16le); REGISTER_MUXDEMUX (PCM_U8, pcm_u8); REGISTER_MUXER (PSP, psp); REGISTER_DEMUXER (PVA, pva); REGISTER_DEMUXER (QCP, qcp); REGISTER_DEMUXER (R3D, r3d); REGISTER_MUXDEMUX (RAWVIDEO, rawvideo); REGISTER_DEMUXER (RL2, rl2); REGISTER_MUXDEMUX (RM, rm); REGISTER_MUXDEMUX (ROQ, roq); REGISTER_DEMUXER (RPL, rpl); REGISTER_MUXDEMUX (RSO, rso); REGISTER_MUXDEMUX (RTP, rtp); REGISTER_MUXDEMUX (RTSP, rtsp); REGISTER_MUXDEMUX (SAP, sap); REGISTER_DEMUXER (SDP, sdp); #if CONFIG_RTPDEC av_register_rtp_dynamic_payload_handlers(); av_register_rdt_dynamic_payload_handlers(); #endif REGISTER_DEMUXER (SEGAFILM, segafilm); REGISTER_DEMUXER (SHORTEN, shorten); REGISTER_DEMUXER (SIFF, siff); REGISTER_DEMUXER (SMACKER, smacker); REGISTER_DEMUXER (SOL, sol); REGISTER_MUXDEMUX (SOX, sox); REGISTER_MUXDEMUX (SPDIF, spdif); REGISTER_MUXDEMUX (SRT, srt); REGISTER_DEMUXER (STR, str); REGISTER_MUXDEMUX (SWF, swf); REGISTER_MUXER (TG2, tg2); REGISTER_MUXER (TGP, tgp); REGISTER_DEMUXER (THP, thp); REGISTER_DEMUXER (TIERTEXSEQ, tiertexseq); REGISTER_DEMUXER (TMV, tmv); REGISTER_MUXDEMUX (TRUEHD, truehd); REGISTER_DEMUXER (TTA, tta); REGISTER_DEMUXER (TXD, txd); REGISTER_DEMUXER (TTY, tty); REGISTER_DEMUXER (VC1, vc1); REGISTER_MUXDEMUX (VC1T, vc1t); REGISTER_DEMUXER (VMD, vmd); REGISTER_MUXDEMUX (VOC, voc); REGISTER_DEMUXER (VQF, vqf); REGISTER_DEMUXER (W64, w64); REGISTER_MUXDEMUX (WAV, wav); REGISTER_DEMUXER (WC3, wc3); REGISTER_MUXER (WEBM, webm); REGISTER_DEMUXER (WSAUD, wsaud); REGISTER_DEMUXER (WSVQA, wsvqa); REGISTER_DEMUXER (WTV, wtv); REGISTER_DEMUXER (WV, wv); REGISTER_DEMUXER (XA, xa); REGISTER_DEMUXER (XMV, xmv); REGISTER_DEMUXER (XWMA, xwma); REGISTER_DEMUXER (YOP, yop); REGISTER_MUXDEMUX (YUV4MPEGPIPE, yuv4mpegpipe); REGISTER_MUXDEMUX (LIBNUT, libnut); REGISTER_PROTOCOL (APPLEHTTP, applehttp); REGISTER_PROTOCOL (CONCAT, concat); REGISTER_PROTOCOL (CRYPTO, crypto); REGISTER_PROTOCOL (FILE, file); REGISTER_PROTOCOL (GOPHER, gopher); REGISTER_PROTOCOL (HTTP, http); REGISTER_PROTOCOL (MMSH, mmsh); REGISTER_PROTOCOL (MMST, mmst); REGISTER_PROTOCOL (MD5, md5); REGISTER_PROTOCOL (PIPE, pipe); REGISTER_PROTOCOL (RTMP, rtmp); #if CONFIG_LIBRTMP REGISTER_PROTOCOL (RTMP, rtmpt); REGISTER_PROTOCOL (RTMP, rtmpe); REGISTER_PROTOCOL (RTMP, rtmpte); REGISTER_PROTOCOL (RTMP, rtmps); #endif REGISTER_PROTOCOL (RTP, rtp); REGISTER_PROTOCOL (TCP, tcp); REGISTER_PROTOCOL (UDP, udp); }
1threat
static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size) { uint8_t *dest = dst; const uint8_t *s = src; const uint8_t *end; #if COMPILE_TEMPLATE_MMX const uint8_t *mm_end; #endif end = s + src_size; #if COMPILE_TEMPLATE_MMX __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); mm_end = end - 23; __asm__ volatile("movq %0, %%mm7"::"m"(mask32a):"memory"); while (s < mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movd %1, %%mm0 \n\t" "punpckldq 3%1, %%mm0 \n\t" "movd 6%1, %%mm1 \n\t" "punpckldq 9%1, %%mm1 \n\t" "movd 12%1, %%mm2 \n\t" "punpckldq 15%1, %%mm2 \n\t" "movd 18%1, %%mm3 \n\t" "punpckldq 21%1, %%mm3 \n\t" "por %%mm7, %%mm0 \n\t" "por %%mm7, %%mm1 \n\t" "por %%mm7, %%mm2 \n\t" "por %%mm7, %%mm3 \n\t" MOVNTQ" %%mm0, %0 \n\t" MOVNTQ" %%mm1, 8%0 \n\t" MOVNTQ" %%mm2, 16%0 \n\t" MOVNTQ" %%mm3, 24%0" :"=m"(*dest) :"m"(*s) :"memory"); dest += 32; s += 24; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); #endif while (s < end) { #if HAVE_BIGENDIAN *dest++ = 255; *dest++ = s[2]; *dest++ = s[1]; *dest++ = s[0]; s+=3; #else *dest++ = *s++; *dest++ = *s++; *dest++ = *s++; *dest++ = 255; #endif } }
1threat
static uint64_t get_fourcc(AVIOContext *bc) { unsigned int len = ffio_read_varlen(bc); if (len == 2) return avio_rl16(bc); else if (len == 4) return avio_rl32(bc); else return -1; }
1threat
how to use python-numpy-brodcasting : I have a trouble with python broadcasting there is two numpy list x = np.array([1,2,3],[4,5,6]) y = np.array([0,1,1]) I'd like to calculate x : [[1,2,3], [4,5,6]] to x : [[1 - y[0],2-y[1],3-y[2]],[4 - y[0],5-y[1],6-y[2]]] that is, x : [[0,-3,-3], [3,0,0]] at one time. Please, let me know how to do that.
0debug
How to query data expiration time in mysql php : <p>In my Database I have products that i saved with the expiration timestamp in the format eg. <strong>2018-22-08</strong>. Please how do I select all products that will expire in less than 4 days.</p> <p>I have tried</p> <pre><code>SELECT * FROM table WHERE expiration_timestamp = DATE_ADD(CURDATE(), INTERVAL 4 DAY) </code></pre>
0debug
Sorting code doesnt work when i increase number of elements : Im trying to write strand sort algorithm. Its work when sorting 6-7 elements. But when i increase number of elements gives anything. Here is codes. And if any idea for improving tell me. -//It looks like your post is mostly code; please add some more details. #include <stdio.h> void fonk(int *,int *,int); int main(){ int a[] = {6,9,8,10000,9,8,9,8},b[sizeof(a)/sizeof(int)],c; fonk(a,b,sizeof(a)/sizeof(int)); for(int k = 0; k < sizeof(a)/sizeof(int); k++) printf("%d ",b[k]); return 0; } void fonk(int *ip,int *op,int indissayisi){//sorting func if(indissayisi != 0){ int sub[indissayisi]; int t = 1,missindice =1,tyitutan,b=0; sub[t-1] = *ip; *ip = 0; for(int k = 1; k-1 < indissayisi; k++){//getting sub list and changing indices of rest of *ip if(sub[t-1] <= *(ip+k)){//transfer ip to sub sub[t] = *(ip+k); t++; *(ip+k) = 0; missindice++; } else{ *(ip+k-missindice) = *(ip+k);//change indice } } int t2=t; tyitutan = indissayisi-t; if(*(op+indissayisi) == 0){//transfering sub to op first time for(int l = 0; l < t; l++,t2--){ *(op+indissayisi-t2) = sub[l]; } } else{ for(int l = 0; l < t; l++,t2--){ //transfering and sorting if(sub[l]<*(op+indissayisi+b)){ *(op+indissayisi-t2) = sub[l]; } else{ *(op+indissayisi-t2) = *(op+indissayisi+b); b++; l--; } } } fonk(ip,op,tyitutan); } }
0debug
Apache Commons CSV absoulte file path : Each time i give full file path to the FileReader, **FileNotFoundException** is encountered. But just giving the file name after copying the file in the same directory in which program is residing, makes the program execute fine. // Doesn't work FileReader in = new FileReader(files_path +"\\"+ "fileName.csv"); Iterable<CSVRecord> records = CSVFormat.EXCEL.parse(in); for (CSVRecord record : records) { System.out.println(record.get(7)); } //Works FileReader in = new FileReader("fileName.csv"); Iterable<CSVRecord> records = CSVFormat.EXCEL.parse(in); for (CSVRecord record : records) { System.out.println(record.get(7)); }
0debug
static pxa2xx_timer_info *pxa2xx_timer_init(target_phys_addr_t base, qemu_irq *irqs) { int i; int iomemtype; pxa2xx_timer_info *s; s = (pxa2xx_timer_info *) qemu_mallocz(sizeof(pxa2xx_timer_info)); s->irq_enabled = 0; s->oldclock = 0; s->clock = 0; s->lastload = qemu_get_clock(vm_clock); s->reset3 = 0; for (i = 0; i < 4; i ++) { s->timer[i].value = 0; s->timer[i].irq = irqs[i]; s->timer[i].info = s; s->timer[i].num = i; s->timer[i].level = 0; s->timer[i].qtimer = qemu_new_timer(vm_clock, pxa2xx_timer_tick, &s->timer[i]); } iomemtype = cpu_register_io_memory(pxa2xx_timer_readfn, pxa2xx_timer_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(base, 0x00001000, iomemtype); register_savevm(NULL, "pxa2xx_timer", 0, 0, pxa2xx_timer_save, pxa2xx_timer_load, s); return s; }
1threat
static void qemu_aio_wait_all(void) { while (qemu_aio_wait()) { } }
1threat
static void stream_set_speed(BlockJob *job, int64_t speed, Error **errp) { StreamBlockJob *s = container_of(job, StreamBlockJob, common); if (speed < 0) { error_set(errp, QERR_INVALID_PARAMETER, "speed"); return; } ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE); }
1threat
Symfony Url Generator producing different URLs from the same Route before and after login : <p>I currently using Symfony Kernel and Routing within a custom framework and I have run into a curious problem. Using the same Route:</p> <pre><code>$collection-&gt;add('article_edit', new Route('/articles/edit/{alias}', array( '_controller' =&gt; 'AppBundle:Article:edit' ))); </code></pre> <p>Using this Url Generator code</p> <pre><code>$url = $this-&gt;generateUrl('article_edit',array('alias' =&gt; 'test')); </code></pre> <p>Before login, the Url Generator produces</p> <blockquote> <p>/articles/edit/test</p> </blockquote> <p>And after login, it produces</p> <blockquote> <p><a href="http://localhost/testsite/articles/edit/test">http://localhost/testsite/articles/edit/test</a></p> </blockquote> <p>Without anything being changed, what could be happening here since I want the same result consistently.</p> <p>Thanks</p>
0debug
'git apply' failed with code 1: patch does not apply error in SourceTree on Stage Hunk : <p>When I attempt to stage a hunk or some lines, I get the following error in SourceTree on OS X:</p> <p><a href="https://i.stack.imgur.com/9f3rS.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9f3rS.png" alt="git apply failed with code 1 patch failed"></a></p> <p>Staging entire files works fine. The path of this repo lives on a Windows virtual machine running in Parallels.</p> <p>I suspect a whitespace or newline issue. How do I make this work without reverting to hg-git?</p>
0debug
static struct addrinfo *inet_parse_connect_opts(QemuOpts *opts, Error **errp) { struct addrinfo ai, *res; int rc; const char *addr; const char *port; memset(&ai, 0, sizeof(ai)); ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG; ai.ai_family = PF_UNSPEC; ai.ai_socktype = SOCK_STREAM; addr = qemu_opt_get(opts, "host"); port = qemu_opt_get(opts, "port"); if (addr == NULL || port == NULL) { error_setg(errp, "host and/or port not specified"); return NULL; } if (qemu_opt_get_bool(opts, "ipv4", 0)) { ai.ai_family = PF_INET; } if (qemu_opt_get_bool(opts, "ipv6", 0)) { ai.ai_family = PF_INET6; } rc = getaddrinfo(addr, port, &ai, &res); if (rc != 0) { error_setg(errp, "address resolution failed for %s:%s: %s", addr, port, gai_strerror(rc)); return NULL; } return res; }
1threat
static int vncws_start_tls_handshake(struct VncState *vs) { int ret = gnutls_handshake(vs->tls.session); if (ret < 0) { if (!gnutls_error_is_fatal(ret)) { VNC_DEBUG("Handshake interrupted (blocking)\n"); if (!gnutls_record_get_direction(vs->tls.session)) { qemu_set_fd_handler(vs->csock, vncws_tls_handshake_io, NULL, vs); qemu_set_fd_handler(vs->csock, NULL, vncws_tls_handshake_io, vs); return 0; VNC_DEBUG("Handshake failed %s\n", gnutls_strerror(ret)); VNC_DEBUG("Handshake done, switching to TLS data mode\n"); qemu_set_fd_handler2(vs->csock, NULL, vncws_handshake_read, NULL, vs); return 0;
1threat
Is there a way to “compile” a list of VBA functions into a DLL file? : <p>We have some customized VBA functions in a script inside an app (not Excel) and they are called by other scripts in this app. We are sharing the scripts but would rather not expose the single script with the functions. The app only calls an embedded macro or a dll, so I’m thinking somewhat “compile” these functions into a dll file, and the project is small so we try to avoid buying stuffs. Maybe transfer into VB.Net? Any idea is welcome!</p>
0debug
int av_open_input_stream(AVFormatContext **ic_ptr, AVIOContext *pb, const char *filename, AVInputFormat *fmt, AVFormatParameters *ap) { int err; AVDictionary *opts; AVFormatContext *ic; AVFormatParameters default_ap; if(!ap){ ap=&default_ap; memset(ap, 0, sizeof(default_ap)); } opts = convert_format_parameters(ap); if(!ap->prealloced_context) ic = avformat_alloc_context(); else ic = *ic_ptr; if (!ic) { err = AVERROR(ENOMEM); goto fail; } if (pb && fmt && fmt->flags & AVFMT_NOFILE) av_log(ic, AV_LOG_WARNING, "Custom AVIOContext makes no sense and " "will be ignored with AVFMT_NOFILE format.\n"); else ic->pb = pb; err = avformat_open_input(&ic, filename, fmt, &opts); ic->pb = ic->pb ? ic->pb : pb; *ic_ptr = ic; fail: av_dict_free(&opts); return err; }
1threat
int v9fs_co_mknod(V9fsState *s, V9fsString *path, uid_t uid, gid_t gid, dev_t dev, mode_t mode) { int err; FsCred cred; cred_init(&cred); cred.fc_uid = uid; cred.fc_gid = gid; cred.fc_mode = mode; cred.fc_rdev = dev; v9fs_co_run_in_worker( { err = s->ops->mknod(&s->ctx, path->data, &cred); if (err < 0) { err = -errno; } }); return err; }
1threat
CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s)) { const char *p; CharDriverState *chr; QemuOpts *opts; if (strstart(filename, "chardev:", &p)) { return qemu_chr_find(p); } opts = qemu_chr_parse_compat(label, filename); if (!opts) return NULL; chr = qemu_chr_open_opts(opts, init); if (chr && qemu_opt_get_bool(opts, "mux", 0)) { monitor_init(chr, MONITOR_USE_READLINE); } return chr; }
1threat
Hive query manipulation for non-business days (weekends & holidays) : I've a query regarding some tweaking my Hive query in the requirement defined below; couldn't get my head around on this. Case: The data gets generated only on business days i.e., weekdays & non-holidays dates. This data I load in Hive. The source & target, both are HDFS. Stringent process: The data should be replicated for every day. So, for Saturday & Sunday, I'll copy the same data of Friday. Same is the case for public holidays. Current process: As of now I'm executing it manually to load weekends' data. Requirement: I need to automate this in the query itself. Any suggestions?
0debug
Why template is not rendered after receiving new data from serve? : I have request to server: this.userService.loadPupils(GlobalModel.getSelectedPeriod().schoolId, this.filter.schoolStudyPeriod, this.pagination.from, this.pagination.to, filters) .subscribe(data => { this.fltUsers = []; this.fltUsers = data; console.log(this.fltUsers); }); In console.log I get two elements (objects) in array `this.fltUsers`. Then my template is: <tr *ngFor="let s of fltUsers; let i = index; let isOdd=odd; let isEven=even"> </tr> But I can not see these rows on the page. [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/B8YHV.png
0debug
static void do_interrupt_protected(int intno, int is_int, int error_code, unsigned int next_eip, int is_hw) { SegmentCache *dt; uint8_t *ptr, *ssp; int type, dpl, selector, ss_dpl, cpl, sp_mask; int has_error_code, new_stack, shift; uint32_t e1, e2, offset, ss, esp, ss_e1, ss_e2; uint32_t old_eip; has_error_code = 0; if (!is_int && !is_hw) { switch(intno) { case 8: case 10: case 11: case 12: case 13: case 14: case 17: has_error_code = 1; break; } } dt = &env->idt; if (intno * 8 + 7 > dt->limit) raise_exception_err(EXCP0D_GPF, intno * 8 + 2); ptr = dt->base + intno * 8; e1 = ldl_kernel(ptr); e2 = ldl_kernel(ptr + 4); type = (e2 >> DESC_TYPE_SHIFT) & 0x1f; switch(type) { case 5: if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, intno * 8 + 2); switch_tss(intno * 8, e1, e2, SWITCH_TSS_CALL); if (has_error_code) { int mask; shift = (env->segs[R_CS].flags >> DESC_B_SHIFT) & 1; if (env->segs[R_SS].flags & DESC_B_MASK) mask = 0xffffffff; else mask = 0xffff; esp = (env->regs[R_ESP] - (2 << shift)) & mask; ssp = env->segs[R_SS].base + esp; if (shift) stl_kernel(ssp, error_code); else stw_kernel(ssp, error_code); env->regs[R_ESP] = (esp & mask) | (env->regs[R_ESP] & ~mask); } return; case 6: case 7: case 14: case 15: break; default: raise_exception_err(EXCP0D_GPF, intno * 8 + 2); break; } dpl = (e2 >> DESC_DPL_SHIFT) & 3; cpl = env->hflags & HF_CPL_MASK; if (is_int && dpl < cpl) raise_exception_err(EXCP0D_GPF, intno * 8 + 2); if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, intno * 8 + 2); selector = e1 >> 16; offset = (e2 & 0xffff0000) | (e1 & 0x0000ffff); if ((selector & 0xfffc) == 0) raise_exception_err(EXCP0D_GPF, 0); if (load_segment(&e1, &e2, selector) != 0) raise_exception_err(EXCP0D_GPF, selector & 0xfffc); if (!(e2 & DESC_S_MASK) || !(e2 & (DESC_CS_MASK))) raise_exception_err(EXCP0D_GPF, selector & 0xfffc); dpl = (e2 >> DESC_DPL_SHIFT) & 3; if (dpl > cpl) raise_exception_err(EXCP0D_GPF, selector & 0xfffc); if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, selector & 0xfffc); if (!(e2 & DESC_C_MASK) && dpl < cpl) { get_ss_esp_from_tss(&ss, &esp, dpl); if ((ss & 0xfffc) == 0) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if ((ss & 3) != dpl) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (load_segment(&ss_e1, &ss_e2, ss) != 0) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); ss_dpl = (ss_e2 >> DESC_DPL_SHIFT) & 3; if (ss_dpl != dpl) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (!(ss_e2 & DESC_S_MASK) || (ss_e2 & DESC_CS_MASK) || !(ss_e2 & DESC_W_MASK)) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (!(ss_e2 & DESC_P_MASK)) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); new_stack = 1; sp_mask = get_sp_mask(ss_e2); ssp = get_seg_base(ss_e1, ss_e2); } else if ((e2 & DESC_C_MASK) || dpl == cpl) { new_stack = 0; sp_mask = get_sp_mask(env->segs[R_SS].flags); ssp = env->segs[R_SS].base; esp = ESP; } else { raise_exception_err(EXCP0D_GPF, selector & 0xfffc); new_stack = 0; sp_mask = 0; ssp = NULL; esp = 0; } shift = type >> 3; #if 0 push_size = 6 + (new_stack << 2) + (has_error_code << 1); if (env->eflags & VM_MASK) push_size += 8; push_size <<= shift; #endif if (is_int) old_eip = next_eip; else old_eip = env->eip; if (shift == 1) { if (env->eflags & VM_MASK) { PUSHL(ssp, esp, sp_mask, env->segs[R_GS].selector); PUSHL(ssp, esp, sp_mask, env->segs[R_FS].selector); PUSHL(ssp, esp, sp_mask, env->segs[R_DS].selector); PUSHL(ssp, esp, sp_mask, env->segs[R_ES].selector); } if (new_stack) { PUSHL(ssp, esp, sp_mask, env->segs[R_SS].selector); PUSHL(ssp, esp, sp_mask, ESP); } PUSHL(ssp, esp, sp_mask, compute_eflags()); PUSHL(ssp, esp, sp_mask, env->segs[R_CS].selector); PUSHL(ssp, esp, sp_mask, old_eip); if (has_error_code) { PUSHL(ssp, esp, sp_mask, error_code); } } else { if (new_stack) { PUSHW(ssp, esp, sp_mask, env->segs[R_SS].selector); PUSHW(ssp, esp, sp_mask, ESP); } PUSHW(ssp, esp, sp_mask, compute_eflags()); PUSHW(ssp, esp, sp_mask, env->segs[R_CS].selector); PUSHW(ssp, esp, sp_mask, old_eip); if (has_error_code) { PUSHW(ssp, esp, sp_mask, error_code); } } if (new_stack) { ss = (ss & ~3) | dpl; cpu_x86_load_seg_cache(env, R_SS, ss, ssp, get_seg_limit(ss_e1, ss_e2), ss_e2); } ESP = (ESP & ~sp_mask) | (esp & sp_mask); selector = (selector & ~3) | dpl; cpu_x86_load_seg_cache(env, R_CS, selector, get_seg_base(e1, e2), get_seg_limit(e1, e2), e2); cpu_x86_set_cpl(env, dpl); env->eip = offset; if ((type & 1) == 0) { env->eflags &= ~IF_MASK; } env->eflags &= ~(TF_MASK | VM_MASK | RF_MASK | NT_MASK); }
1threat
bool cpu_exec_all(void) { int r; qemu_clock_warp(vm_clock); if (next_cpu == NULL) { next_cpu = first_cpu; } for (; next_cpu != NULL && !exit_request; next_cpu = next_cpu->next_cpu) { CPUState *env = next_cpu; qemu_clock_enable(vm_clock, (env->singlestep_enabled & SSTEP_NOTIMER) == 0); #ifndef CONFIG_IOTHREAD if (qemu_alarm_pending()) { break; } #endif if (cpu_can_run(env)) { if (kvm_enabled()) { r = kvm_cpu_exec(env); qemu_kvm_eat_signals(env); } else { r = tcg_cpu_exec(env); } if (r == EXCP_DEBUG) { cpu_handle_guest_debug(env); break; } } else if (env->stop || env->stopped) { break; } } exit_request = 0; return !all_cpu_threads_idle(); }
1threat
PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus, const char *default_model, const char *default_devaddr) { Error *err = NULL; PCIDevice *res; if (qemu_show_nic_models(nd->model, pci_nic_models)) exit(0); res = pci_nic_init(nd, rootbus, default_model, default_devaddr, &err); if (!res) { error_report_err(err); exit(1); } return res; }
1threat
How to grab a single image from RTSP stream using FFMPEG : <p>I have seen several other related questions but they all seem to be related to grabbing a still shot every X number of seconds. How can I grab 1 image when the command is run.</p> <p>I was trying</p> <pre><code>ffmpeg -y -i rtsp://admin:admin@192.168.10.113:554/live -f image2 -updatefirst 1 do.jpg </code></pre>
0debug
Can I program a Raspberry Pi with Python over SSH? : <p>So, I know Python, and I've been thinking of getting a Raspberry Pi, as I heard that you can program it with Python. The thing is, I don't have an extra HDMI monitor at hand, but only a Windows 10 laptop (besides, what use would an R-Pi be if you want to use it in a project, when it has to be plugged in to a monitor, mouse etc.?), so I found an alternative called SSH. After watching a few tutorials, I'm positive that I'll be able to set up an R-Pi wirelessly with ease. However, it still hasn't become clear to me, how I would be able to program an R-Pi with Python over SSH. </p> <p>My initial goal with the R-Pi is to program it with Python, to do things like from saying "hello world", to controlling the GPIO ports, all without external hardware (except that laptop), but I haven't found anything on the internet that suits my needs. Now, my question is, how do I do such, and to what extent will I be able to control my Pi with Python through another computer?</p> <p>Thank you in advance for the help! </p>
0debug
static int draw_glyphs(DrawTextContext *s, AVFrame *frame, int width, int height, const uint8_t rgbcolor[4], const uint8_t yuvcolor[4], int x, int y) { char *text = HAVE_LOCALTIME_R ? s->expanded_text : s->text; uint32_t code = 0; int i; uint8_t *p; Glyph *glyph = NULL; for (i = 0, p = text; *p; i++) { Glyph dummy = { 0 }; GET_UTF8(code, *p++, continue;); if (code == '\n' || code == '\r' || code == '\t') continue; dummy.code = code; glyph = av_tree_find(s->glyphs, &dummy, (void *)glyph_cmp, NULL); if (glyph->bitmap.pixel_mode != FT_PIXEL_MODE_MONO && glyph->bitmap.pixel_mode != FT_PIXEL_MODE_GRAY) return AVERROR(EINVAL); if (s->is_packed_rgb) { draw_glyph_rgb(frame, &glyph->bitmap, s->positions[i].x+x, s->positions[i].y+y, width, height, s->pixel_step[0], rgbcolor, s->rgba_map, s->alpha); } else { draw_glyph_yuv(frame, &glyph->bitmap, s->positions[i].x+x, s->positions[i].y+y, width, height, yuvcolor, s->hsub, s->vsub, s->alpha); } } return 0; }
1threat
static int mov_probe(AVProbeData *p) { unsigned int offset; uint32_t tag; int score = 0; offset = 0; for (;;) { if ((offset + 8) > (unsigned int)p->buf_size) return score; tag = AV_RL32(p->buf + offset + 4); switch(tag) { case MKTAG('j','P',' ',' '): case MKTAG('m','o','o','v'): case MKTAG('m','d','a','t'): case MKTAG('p','n','o','t'): case MKTAG('u','d','t','a'): case MKTAG('f','t','y','p'): return AVPROBE_SCORE_MAX; case MKTAG('e','d','i','w'): case MKTAG('w','i','d','e'): case MKTAG('f','r','e','e'): case MKTAG('j','u','n','k'): case MKTAG('p','i','c','t'): return AVPROBE_SCORE_MAX - 5; case MKTAG(0x82,0x82,0x7f,0x7d): case MKTAG('s','k','i','p'): case MKTAG('u','u','i','d'): case MKTAG('p','r','f','l'): offset = AV_RB32(p->buf+offset) + offset; score = AVPROBE_SCORE_MAX - 50; break; default: return score; } } }
1threat
def parallelogram_area(b,h): area=b*h return area
0debug
the model object is returning null : <p>I am using dotnet core 2.1.the problem is that when my database has values and I am querying it, it returns the value in the UserInteractions model but It says that the User Object is null. although it is not null. my models and query are as below:</p> <pre><code>public class UserInteractions { public int Id { get; set; } public int? UserId { get; set; } [ForeignKey ("UserId")] public User user { get; set; } public int? TargetId { get; set; } [ForeignKey ("TargetId")] public User target { get; set; } public int NumberOfMusicMedia { get; set; } public int VolumeOfMusicMedia { get; set; } public int NumberOfImageMedia { get; set; } public int VolumeOfImageMedia { get; set; } public int NumberOfVideoMedia { get; set; } public int VolumeOfVideoMedia { get; set; } public int NumberOfDocumentMedia { get; set; } public int VolumeOfDocumentMedia { get; set; } public bool IsMuted { get; set; } } public class User { [Key] public int Id { get; set; } public string Phone { get; set; } public string Name { get; set; } public string UserName { get; set; } } </code></pre> <p>this is my query:</p> <pre><code>var mediaInfo = _db.UserInteractions.FirstOrDefault (o =&gt; o.UserId == 2); User inf = mediaInfo.target; </code></pre> <p>it says that inf is null, but it should not be null</p>
0debug
How to fix this code ? PHP PDO : Hi all how to fix this code ?? ` function userExists($pdow, $login) { $userQuery = "SELECT * FROM login u WHERE login=:user;"; $stmt = $pdow->prepare($userQuery); $stmt->execute(array(':user' => $login)); return !!$stmt->fetch(PDO::FETCH_ASSOC); } $login = 'user'; $exists = userExists($pdow, $login); if('$login') $user= var_dump((bool) 'Exists'); { echo "Login exsists!"; }` I have two problems whit my code. First error: Error with communique 'login exsists!'. I see this echo all the time in browser. sequent error: If i get communique 'login exsists!' my code still writes data to base.
0debug
devise confirmable radio button : I am using devise gem, I used :confirmable to let the user confirm his account so the email will come to him after he signed up and if he open the link it will confirm immediately.. What I want is to send the user email after he signed up to show him his account then to give him option if to confirm it or not something like radio button Here is my codes in the user model devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable before_create :confirm_email def confirm_email UserMailer.registration_confirmation(self).deliver end in the mailier default :from => 'info@eccsbc.com' def registration_confirmation(user) @user = user mail :to => 'nour@khatib.ca' ,:subject =>"New member please confirm" end in the user_mailier tempalate <%= link_to 'Confirm my account', confirmation_url(@user, :confirmation_token => @user.confirmation_token) %>
0debug
static void update_error_limit(WavpackFrameContext *ctx) { int i, br[2], sl[2]; for (i = 0; i <= ctx->stereo_in; i++) { ctx->ch[i].bitrate_acc += ctx->ch[i].bitrate_delta; br[i] = ctx->ch[i].bitrate_acc >> 16; sl[i] = LEVEL_DECAY(ctx->ch[i].slow_level); } if (ctx->stereo_in && ctx->hybrid_bitrate) { int balance = (sl[1] - sl[0] + br[1] + 1) >> 1; if (balance > br[0]) { br[1] = br[0] << 1; br[0] = 0; } else if (-balance > br[0]) { br[0] <<= 1; br[1] = 0; } else { br[1] = br[0] + balance; br[0] = br[0] - balance; } } for (i = 0; i <= ctx->stereo_in; i++) { if (ctx->hybrid_bitrate) { if (sl[i] - br[i] > -0x100) ctx->ch[i].error_limit = wp_exp2(sl[i] - br[i] + 0x100); else ctx->ch[i].error_limit = 0; } else { ctx->ch[i].error_limit = wp_exp2(br[i]); } } }
1threat
Please Help me understand Map and Lambda in python in this code : I dont understand the purpose of (*p) in this code can someone please help. I am new to this. from multiprocessing.pool import ThreadPool pool=ThreadPool() def mul(x,y): print x*y out=[4,5,6] pool.map(lambda p: (lambda i, prediction: mul(prediction, i))(*p), enumerate(out))
0debug
Error response from daemon: driver failed programming external connectivity on endpoint modest_aryabhata : <p>I'm going through <a href="https://nodejs.org/en/docs/guides/nodejs-docker-webapp/" rel="noreferrer">this tutorial</a></p> <p>making docker image with: <code>docker build -t myapp_back .</code></p> <p>and then want to run container with: <code>docker run -p 3000:3000 -d myapp_back</code></p> <p>it's simlpe node/express app</p> <p>But I'm getting an error:</p> <blockquote> <p>C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: driver failed programming external connectivity on endpoint wizardly_wescoff (a7c53e0d168f915f900e3d67ec72805c2f8e4f5e595f6ae3c7fed8e097886a8b): Error starting userland proxy: mkdir /port/tcp:0.0.0.0:3000:tcp:172.17.0.2:3000: input/output error.</p> </blockquote> <p>What's wrong?</p> <p>my dockerfile:</p> <pre><code>FROM node:carbon WORKDIR /usr/src/app COPY package*.json ./ RUN npm install COPY . . EXPOSE 3000 CMD ['npm', 'start'] </code></pre> <p>and start in package.json:</p> <pre><code>"start": "nodemon src/app.js --exec babel-node" </code></pre>
0debug
static void tcg_out_movcond32(TCGContext *s, TCGCond cond, TCGArg dest, TCGArg c1, TCGArg c2, int const_c2, TCGArg v1) { tcg_out_cmp(s, c1, c2, const_c2, 0); if (have_cmov) { tcg_out_modrm(s, OPC_CMOVCC | tcg_cond_to_jcc[cond], dest, v1); } else { int over = gen_new_label(); tcg_out_jxx(s, tcg_cond_to_jcc[tcg_invert_cond(cond)], over, 1); tcg_out_mov(s, TCG_TYPE_I32, dest, v1); tcg_out_label(s, over, s->code_ptr); } }
1threat
static void dec_scall(DisasContext *dc) { TCGv t0; int l1; if (dc->imm5 == 7) { LOG_DIS("scall\n"); } else if (dc->imm5 == 2) { LOG_DIS("break\n"); } else { cpu_abort(dc->env, "invalid opcode\n"); } t0 = tcg_temp_new(); l1 = gen_new_label(); if (dc->imm5 == 7) { tcg_gen_movi_tl(cpu_pc, dc->pc); t_gen_raise_exception(dc, EXCP_SYSTEMCALL); } else { tcg_gen_movi_tl(cpu_pc, dc->pc); t_gen_raise_exception(dc, EXCP_BREAKPOINT); } }
1threat
Returning all rows from a database using json string : so i'm trying to retrieve all the values stored in a database where it matches the sensor name. The code runs however, it only outputs the final value in the database. public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setStatus(HttpServletResponse.SC_OK); String info = request.getParameter("getdata"); // Do we want info or to enter data on current sensor? // if request for info isn't here, record the current sensor name/value from the parameters // if (info == null){ String sensorNameStr = request.getParameter("sensorname"); String sensorValueStr = request.getParameter("sensorvalue"); // if (!(sensorNameStr==null) && !(sensorValueStr==null)) { // returnMessage = updateSensorTable(sensorNameStr, sensorValueStr); // } // else returnMessage = "bad data"; // // PrintWriter out = response.getWriter(); // System.out.println("DEBUG: Return response for receiving data "+ returnMessage); // out.print(returnMessage); // out.close(); String noDataAvailable = "No data for sensor name "+sensorNameStr; String selectSQL = "select sensorvalue from sensorUsage where "+ " sensorname = '" + sensorNameStr + "' order by TimeInserted asc"; String retrievedSensorData = noDataAvailable; try { PreparedStatement pst = conn.prepareStatement(selectSQL); ResultSet rs = pst.executeQuery(); while (rs.next()) { retrievedSensorData = rs.getString(1); System.out.println("DEBUG: Retrieved : "+ retrievedSensorData); } } catch (SQLException ex) { System.out.println("Error in SQL " + ex.getMessage()); } System.out.println("DEBUG: Final retrieved value : " + retrievedSensorData); response.setContentType("application/json"); String json = "{\"sensor\": {\"" + sensorNameStr + "\": \"" + retrievedSensorData + "\"}}"; PrintWriter out = response.getWriter(); System.out.println("DEBUG: json return: "+json); out.print(json); out.close(); } Do i have to create a for loop so all values are returned and outputted on a webpage? as thats how am viewing the data without manually going into the server. Also, if i do this, is it possible to only receive the last few inserted sensor values? Help will be appreciated!
0debug
How to achive Cassandra O'rraly Architect Certification : About the Architect Certification aviable for version 2.x at O'rraly, in what manner the questions on this certification varies from the other two available (Administrator and Developer) Do you suggest some additional material to study for this specific certification?
0debug
static void char_socket_class_init(ObjectClass *oc, void *data) { ChardevClass *cc = CHARDEV_CLASS(oc); cc->parse = qemu_chr_parse_socket; cc->open = qmp_chardev_open_socket; cc->chr_wait_connected = tcp_chr_wait_connected; cc->chr_write = tcp_chr_write; cc->chr_sync_read = tcp_chr_sync_read; cc->chr_disconnect = tcp_chr_disconnect; cc->get_msgfds = tcp_get_msgfds; cc->set_msgfds = tcp_set_msgfds; cc->chr_add_client = tcp_chr_add_client; cc->chr_add_watch = tcp_chr_add_watch; cc->chr_update_read_handler = tcp_chr_update_read_handler; object_class_property_add(oc, "addr", "SocketAddressLegacy", char_socket_get_addr, NULL, NULL, NULL, &error_abort); object_class_property_add_bool(oc, "connected", char_socket_get_connected, NULL, &error_abort); }
1threat
Using HashMap in Java to make a morse code : <p>so i am learning how to use the HashMap object. My question is, if I use the scanner object to ask a user for a String and I save that to a String variable. How can I take that String and "compare" it to my HashMap. </p> <p>For example if a user inputs "abc". </p> <p>My HashMap has ("a","abra") ("b","blastoise") ("c","charizard")</p> <p>I want to print to System.out.println the result -- abra blastoise charizard instead of abc.</p> <p>I will share my code that i have now but i am stuck with the next step and i hope that i am being clear with my question. </p> <pre><code> public static void main(String[] args) { Scanner sc = new Scanner(System.in); String keyboard = ""; HashMap hm = new HashMap(); hm.put("A","Abra"); hm.put("B", "Blastoise"); hm.put("C", "Charizard"); hm.put("D", "Dewgong"); keyboard = sc.nextLine(); </code></pre> <p>Thank you in advanced :)</p>
0debug
static int qemu_rdma_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, int size) { QEMUFileRDMA *r = opaque; QEMUFile *f = r->file; RDMAContext *rdma = r->rdma; size_t remaining = size; uint8_t * data = (void *) buf; int ret; CHECK_ERROR_STATE(); ret = qemu_rdma_write_flush(f, rdma); if (ret < 0) { rdma->error_state = ret; return ret; } while (remaining) { RDMAControlHeader head; r->len = MIN(remaining, RDMA_SEND_INCREMENT); remaining -= r->len; head.len = r->len; head.type = RDMA_CONTROL_QEMU_FILE; ret = qemu_rdma_exchange_send(rdma, &head, data, NULL, NULL, NULL); if (ret < 0) { rdma->error_state = ret; return ret; } data += r->len; } return size; }
1threat
static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, int16_t *block, int n) { int level, i, j, run; RLTable *rl = &ff_rl_mpeg1; uint8_t * const scantable = s->intra_scantable.permutated; const int qscale = s->qscale; { OPEN_READER(re, &s->gb); i = -1; UPDATE_CACHE(re, &s->gb); if (((int32_t)GET_CACHE(re, &s->gb)) < 0) { level = (3 * qscale) >> 1; level = (level - 1) | 1; if (GET_CACHE(re, &s->gb) & 0x40000000) level = -level; block[0] = level; i++; SKIP_BITS(re, &s->gb, 2); if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) goto end; } for (;;) { GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if (level != 0) { i += run; j = scantable[i]; level = ((level * 2 + 1) * qscale) >> 1; level = (level - 1) | 1; level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1); } else { run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6); UPDATE_CACHE(re, &s->gb); level = SHOW_SBITS(re, &s->gb, 8); SKIP_BITS(re, &s->gb, 8); if (level == -128) { level = SHOW_UBITS(re, &s->gb, 8) - 256; SKIP_BITS(re, &s->gb, 8); } else if (level == 0) { level = SHOW_UBITS(re, &s->gb, 8) ; SKIP_BITS(re, &s->gb, 8); } i += run; j = scantable[i]; if (level < 0) { level = -level; level = ((level * 2 + 1) * qscale) >> 1; level = (level - 1) | 1; level = -level; } else { level = ((level * 2 + 1) * qscale) >> 1; level = (level - 1) | 1; } } block[j] = level; if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) break; UPDATE_CACHE(re, &s->gb); } end: LAST_SKIP_BITS(re, &s->gb, 2); CLOSE_READER(re, &s->gb); } s->block_last_index[n] = i; return 0; }
1threat
How does `alias sudo="sudo "` work? : <p>Looking at ways to pass current user's aliases to a <code>sudo</code> command, I found the following <a href="https://wiki.archlinux.org/index.php/Sudo#Passing_aliases" rel="noreferrer">on ArchWiki</a>:</p> <blockquote> <h3>Passing aliases</h3> <p>If you use a lot of aliases, you might have noticed that they do not carry over to the root account when using sudo. However, there is an easy way to make them work. Simply add the following to your <code>~/.bashrc</code> or <code>/etc/bash.bashrc</code>:</p> <p><code>alias sudo='sudo '</code></p> </blockquote> <p>I don't get why this works. If the shell does not care how many spaces are between two commands, how can this have any effect?</p> <p>When manually adding a space, I see no difference:</p> <pre><code>$ alias e=echo $ sudo e foo sudo: e: command not found $ sudo e foo # Manual space addition sudo: e: command not found # Fail $ alias sudo="sudo " # Now with alias $ sudo e foo foo # Succeeds, but why? </code></pre> <p>Visibly aliasing sudo to sudo + space somehow allows passing aliases. This works on <code>zsh</code>, <code>bash</code> and <code>sh</code>, so it is not a shell-specific behavior. </p> <h2>How does this alias work?</h2>
0debug
static int unix_connect_saddr(UnixSocketAddress *saddr, NonBlockingConnectHandler *callback, void *opaque, Error **errp) { struct sockaddr_un un; ConnectState *connect_state = NULL; int sock, rc; if (saddr->path == NULL) { error_setg(errp, "unix connect: no path specified"); return -1; } sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (sock < 0) { error_setg_errno(errp, errno, "Failed to create socket"); return -1; } if (callback != NULL) { connect_state = g_malloc0(sizeof(*connect_state)); connect_state->callback = callback; connect_state->opaque = opaque; qemu_set_nonblock(sock); } memset(&un, 0, sizeof(un)); un.sun_family = AF_UNIX; snprintf(un.sun_path, sizeof(un.sun_path), "%s", saddr->path); do { rc = 0; if (connect(sock, (struct sockaddr *) &un, sizeof(un)) < 0) { rc = -errno; } } while (rc == -EINTR); if (connect_state != NULL && QEMU_SOCKET_RC_INPROGRESS(rc)) { connect_state->fd = sock; qemu_set_fd_handler(sock, NULL, wait_for_connect, connect_state); return sock; } else if (rc >= 0) { if (callback != NULL) { callback(sock, NULL, opaque); } } if (rc < 0) { error_setg_errno(errp, -rc, "Failed to connect socket"); close(sock); sock = -1; } g_free(connect_state); return sock; }
1threat
How to print assert statment without the "&&"? : I am printing my assert statement in the following manner: assert(i==0 && i is not zero); Output: Assertion 'i==0 && i is not zero' failed. What I want to be printed: Output: 'i==0, i is not zero failed.
0debug
static void encode_block(NellyMoserEncodeContext *s, unsigned char *output, int output_size) { PutBitContext pb; int i, j, band, block, best_idx, power_idx = 0; float power_val, coeff, coeff_sum; float pows[NELLY_FILL_LEN]; int bits[NELLY_BUF_LEN], idx_table[NELLY_BANDS]; float cand[NELLY_BANDS]; apply_mdct(s); init_put_bits(&pb, output, output_size * 8); i = 0; for (band = 0; band < NELLY_BANDS; band++) { coeff_sum = 0; for (j = 0; j < ff_nelly_band_sizes_table[band]; i++, j++) { coeff_sum += s->mdct_out[i ] * s->mdct_out[i ] + s->mdct_out[i + NELLY_BUF_LEN] * s->mdct_out[i + NELLY_BUF_LEN]; } cand[band] = log(FFMAX(1.0, coeff_sum / (ff_nelly_band_sizes_table[band] << 7))) * 1024.0 / M_LN2; } if (s->avctx->trellis) { get_exponent_dynamic(s, cand, idx_table); } else { get_exponent_greedy(s, cand, idx_table); } i = 0; for (band = 0; band < NELLY_BANDS; band++) { if (band) { power_idx += ff_nelly_delta_table[idx_table[band]]; put_bits(&pb, 5, idx_table[band]); } else { power_idx = ff_nelly_init_table[idx_table[0]]; put_bits(&pb, 6, idx_table[0]); } power_val = pow_table[power_idx & 0x7FF] / (1 << ((power_idx >> 11) + POW_TABLE_OFFSET)); for (j = 0; j < ff_nelly_band_sizes_table[band]; i++, j++) { s->mdct_out[i] *= power_val; s->mdct_out[i + NELLY_BUF_LEN] *= power_val; pows[i] = power_idx; } } ff_nelly_get_sample_bits(pows, bits); for (block = 0; block < 2; block++) { for (i = 0; i < NELLY_FILL_LEN; i++) { if (bits[i] > 0) { const float *table = ff_nelly_dequantization_table + (1 << bits[i]) - 1; coeff = s->mdct_out[block * NELLY_BUF_LEN + i]; best_idx = quant_lut[av_clip ( coeff * quant_lut_mul[bits[i]] + quant_lut_add[bits[i]], quant_lut_offset[bits[i]], quant_lut_offset[bits[i]+1] - 1 )]; if (fabs(coeff - table[best_idx]) > fabs(coeff - table[best_idx + 1])) best_idx++; put_bits(&pb, bits[i], best_idx); } } if (!block) put_bits(&pb, NELLY_HEADER_BITS + NELLY_DETAIL_BITS - put_bits_count(&pb), 0); } flush_put_bits(&pb); memset(put_bits_ptr(&pb), 0, output + output_size - put_bits_ptr(&pb)); }
1threat
How do i change colour of menu elements while scrolling? : I want to change the colour of menu elements while scrolling page for the following template.I followed some method but its not dynamic.How do i change it to dynamic? [I attached the link of webpage][1] [1]: https://codepen.io/bharathkumar_sriram/pen/XRQpRo
0debug
How can I aggregate metrics per day in a Grafana table? : <p>I am charting data with a Grafana table, and I want to aggregate all data points from a single day into one row in the table. As you can see below my current setup is displaying the values on a per / minute basis. </p> <p><a href="https://i.stack.imgur.com/Mbi0G.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Mbi0G.png" alt="Grafana Table"></a></p> <p><strong>Question:</strong> How can I make a Grafana table that displays values aggregated by day?</p> <pre><code>| Day | ReCaptcha | T &amp; C | |-------------------|------------|-------| | February 21, 2017 | 9,001 | 8,999 | | February 20, 2017 | 42 | 17 | | February 19, 2017 | ... | ... | </code></pre>
0debug
static inline abi_ulong do_shmat(int shmid, abi_ulong shmaddr, int shmflg) { abi_long raddr; void *host_raddr; struct shmid_ds shm_info; int i,ret; ret = get_errno(shmctl(shmid, IPC_STAT, &shm_info)); if (is_error(ret)) { return ret; } mmap_lock(); if (shmaddr) host_raddr = shmat(shmid, (void *)g2h(shmaddr), shmflg); else { abi_ulong mmap_start; mmap_start = mmap_find_vma(0, shm_info.shm_segsz); if (mmap_start == -1) { errno = ENOMEM; host_raddr = (void *)-1; } else host_raddr = shmat(shmid, g2h(mmap_start), shmflg | SHM_REMAP); } if (host_raddr == (void *)-1) { mmap_unlock(); return get_errno((long)host_raddr); } raddr=h2g((unsigned long)host_raddr); page_set_flags(raddr, raddr + shm_info.shm_segsz, PAGE_VALID | PAGE_READ | ((shmflg & SHM_RDONLY)? 0 : PAGE_WRITE)); for (i = 0; i < N_SHM_REGIONS; i++) { if (!shm_regions[i].in_use) { shm_regions[i].in_use = true; shm_regions[i].start = raddr; shm_regions[i].size = shm_info.shm_segsz; break; } } mmap_unlock(); return raddr; }
1threat
Set variable with entry widget before calling a function : <p>I have written a function, which needs two variables (start, end). Now I'm trying to build a GUI around this function. I want to set two variables with an entry widget and a button which starts the function. </p> <pre><code>start = StringVar() end = StringVar() Label(root, text="Begin").grid(row=0) Label(root, text="End").grid(row=1) e1 = Entry(root, textvariable=start) e2 = Entry(root, textvariable=end) e1.grid(row=0, column=1) e2.grid(row=1, column=1) b1 = Button(root, text="Test_Button", command=getshift()) b1.grid(row=2, column=1) </code></pre> <p>When I run the code, the error is always that start and end are not defined.</p>
0debug
Instant run issue on Android Studio 2.2 : <p>I have updated my android studio to 2.2, Since then I get this strange issue when running the studio gives me error Instant Run requires that the platform corresponding to your target device (Android 1.0) is installed. I am using Note 4 on android 6.0.1. Why is this error happening ? </p> <p><a href="https://i.stack.imgur.com/cHF51.jpg"><img src="https://i.stack.imgur.com/cHF51.jpg" alt="Instant run issue"></a></p>
0debug
static int cirrus_bitblt_videotovideo_copy(CirrusVGAState * s) { if (blit_is_unsafe(s)) return 0; cirrus_do_copy(s, s->cirrus_blt_dstaddr - s->vga.start_addr, s->cirrus_blt_srcaddr - s->vga.start_addr, s->cirrus_blt_width, s->cirrus_blt_height); return 1; }
1threat
SQL Join creating duplication in output : <p>SO i Have a query which, due to my database requires a lot of tables to function. Unfortunately, this is an older database, which is a little problematic to navigate.</p> <p>This query, originally checked whether a Membership was to be 40 or 50 years in length which was easily solved. However, Now I have to see whether a an attribute telling me whether they are reinstated members which would invalidate this timeline is present.</p> <p>I have managed to get show and exclude records, but the the error I believe I have made, is in using an outer join as I was attempting to check multiple records in the joined table for this condition, which has lead several cases to duplication as multiple different attributes can be contained in the same column</p> <p>I am just trying to make sense of this currently, but believe I have used the incorrect join because where an individual has a different attribute from this result it returns an additional record. </p> <p>My question is which Join should I be using, or should in this instance I be looking at writing a sub query within the where condition</p>
0debug
static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst1, uint8_t *dst2, int width, int height, int srcStride1, int srcStride2, int dstStride1, int dstStride2) { x86_reg y; int x,w,h; w=width/2; h=height/2; __asm__ volatile( PREFETCH" %0 \n\t" PREFETCH" %1 \n\t" ::"m"(*(src1+srcStride1)),"m"(*(src2+srcStride2)):"memory"); for (y=0;y<h;y++) { const uint8_t* s1=src1+srcStride1*(y>>1); uint8_t* d=dst1+dstStride1*y; x=0; for (;x<w-31;x+=32) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movq %1, %%mm0 \n\t" "movq 8%1, %%mm2 \n\t" "movq 16%1, %%mm4 \n\t" "movq 24%1, %%mm6 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "movq %%mm4, %%mm5 \n\t" "movq %%mm6, %%mm7 \n\t" "punpcklbw %%mm0, %%mm0 \n\t" "punpckhbw %%mm1, %%mm1 \n\t" "punpcklbw %%mm2, %%mm2 \n\t" "punpckhbw %%mm3, %%mm3 \n\t" "punpcklbw %%mm4, %%mm4 \n\t" "punpckhbw %%mm5, %%mm5 \n\t" "punpcklbw %%mm6, %%mm6 \n\t" "punpckhbw %%mm7, %%mm7 \n\t" MOVNTQ" %%mm0, %0 \n\t" MOVNTQ" %%mm1, 8%0 \n\t" MOVNTQ" %%mm2, 16%0 \n\t" MOVNTQ" %%mm3, 24%0 \n\t" MOVNTQ" %%mm4, 32%0 \n\t" MOVNTQ" %%mm5, 40%0 \n\t" MOVNTQ" %%mm6, 48%0 \n\t" MOVNTQ" %%mm7, 56%0" :"=m"(d[2*x]) :"m"(s1[x]) :"memory"); } for (;x<w;x++) d[2*x]=d[2*x+1]=s1[x]; } for (y=0;y<h;y++) { const uint8_t* s2=src2+srcStride2*(y>>1); uint8_t* d=dst2+dstStride2*y; x=0; for (;x<w-31;x+=32) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movq %1, %%mm0 \n\t" "movq 8%1, %%mm2 \n\t" "movq 16%1, %%mm4 \n\t" "movq 24%1, %%mm6 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "movq %%mm4, %%mm5 \n\t" "movq %%mm6, %%mm7 \n\t" "punpcklbw %%mm0, %%mm0 \n\t" "punpckhbw %%mm1, %%mm1 \n\t" "punpcklbw %%mm2, %%mm2 \n\t" "punpckhbw %%mm3, %%mm3 \n\t" "punpcklbw %%mm4, %%mm4 \n\t" "punpckhbw %%mm5, %%mm5 \n\t" "punpcklbw %%mm6, %%mm6 \n\t" "punpckhbw %%mm7, %%mm7 \n\t" MOVNTQ" %%mm0, %0 \n\t" MOVNTQ" %%mm1, 8%0 \n\t" MOVNTQ" %%mm2, 16%0 \n\t" MOVNTQ" %%mm3, 24%0 \n\t" MOVNTQ" %%mm4, 32%0 \n\t" MOVNTQ" %%mm5, 40%0 \n\t" MOVNTQ" %%mm6, 48%0 \n\t" MOVNTQ" %%mm7, 56%0" :"=m"(d[2*x]) :"m"(s2[x]) :"memory"); } for (;x<w;x++) d[2*x]=d[2*x+1]=s2[x]; } __asm__( EMMS" \n\t" SFENCE" \n\t" ::: "memory" ); }
1threat
petalogix_ml605_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; MemoryRegion *address_space_mem = get_system_memory(); DeviceState *dev, *dma, *eth0; Object *ds, *cs; MicroBlazeCPU *cpu; SysBusDevice *busdev; DriveInfo *dinfo; int i; MemoryRegion *phys_lmb_bram = g_new(MemoryRegion, 1); MemoryRegion *phys_ram = g_new(MemoryRegion, 1); qemu_irq irq[32]; cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU)); object_property_set_bool(OBJECT(cpu), true, "realized", &error_abort); memory_region_init_ram(phys_lmb_bram, NULL, "petalogix_ml605.lmb_bram", LMB_BRAM_SIZE, &error_abort); vmstate_register_ram_global(phys_lmb_bram); memory_region_add_subregion(address_space_mem, 0x00000000, phys_lmb_bram); memory_region_init_ram(phys_ram, NULL, "petalogix_ml605.ram", ram_size, &error_abort); vmstate_register_ram_global(phys_ram); memory_region_add_subregion(address_space_mem, MEMORY_BASEADDR, phys_ram); dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi01_register(FLASH_BASEADDR, NULL, "petalogix_ml605.flash", FLASH_SIZE, dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, (64 * 1024), FLASH_SIZE >> 16, 2, 0x89, 0x18, 0x0000, 0x0, 0); dev = qdev_create(NULL, "xlnx.xps-intc"); qdev_prop_set_uint32(dev, "kind-of-intr", 1 << TIMER_IRQ); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, INTC_BASEADDR); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, qdev_get_gpio_in(DEVICE(cpu), MB_CPU_IRQ)); for (i = 0; i < 32; i++) { irq[i] = qdev_get_gpio_in(dev, i); } serial_mm_init(address_space_mem, UART16550_BASEADDR + 0x1000, 2, irq[UART16550_IRQ], 115200, serial_hds[0], DEVICE_LITTLE_ENDIAN); dev = qdev_create(NULL, "xlnx.xps-timer"); qdev_prop_set_uint32(dev, "one-timer-only", 0); qdev_prop_set_uint32(dev, "clock-frequency", 100 * 1000000); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, TIMER_BASEADDR); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[TIMER_IRQ]); qemu_check_nic_model(&nd_table[0], "xlnx.axi-ethernet"); eth0 = qdev_create(NULL, "xlnx.axi-ethernet"); dma = qdev_create(NULL, "xlnx.axi-dma"); object_property_add_child(qdev_get_machine(), "xilinx-eth", OBJECT(eth0), NULL); object_property_add_child(qdev_get_machine(), "xilinx-dma", OBJECT(dma), NULL); ds = object_property_get_link(OBJECT(dma), "axistream-connected-target", NULL); cs = object_property_get_link(OBJECT(dma), "axistream-control-connected-target", NULL); qdev_set_nic_properties(eth0, &nd_table[0]); qdev_prop_set_uint32(eth0, "rxmem", 0x1000); qdev_prop_set_uint32(eth0, "txmem", 0x1000); object_property_set_link(OBJECT(eth0), OBJECT(ds), "axistream-connected", &error_abort); object_property_set_link(OBJECT(eth0), OBJECT(cs), "axistream-control-connected", &error_abort); qdev_init_nofail(eth0); sysbus_mmio_map(SYS_BUS_DEVICE(eth0), 0, AXIENET_BASEADDR); sysbus_connect_irq(SYS_BUS_DEVICE(eth0), 0, irq[AXIENET_IRQ]); ds = object_property_get_link(OBJECT(eth0), "axistream-connected-target", NULL); cs = object_property_get_link(OBJECT(eth0), "axistream-control-connected-target", NULL); qdev_prop_set_uint32(dma, "freqhz", 100 * 1000000); object_property_set_link(OBJECT(dma), OBJECT(ds), "axistream-connected", &error_abort); object_property_set_link(OBJECT(dma), OBJECT(cs), "axistream-control-connected", &error_abort); qdev_init_nofail(dma); sysbus_mmio_map(SYS_BUS_DEVICE(dma), 0, AXIDMA_BASEADDR); sysbus_connect_irq(SYS_BUS_DEVICE(dma), 0, irq[AXIDMA_IRQ0]); sysbus_connect_irq(SYS_BUS_DEVICE(dma), 1, irq[AXIDMA_IRQ1]); { SSIBus *spi; dev = qdev_create(NULL, "xlnx.xps-spi"); qdev_prop_set_uint8(dev, "num-ss-bits", NUM_SPI_FLASHES); qdev_init_nofail(dev); busdev = SYS_BUS_DEVICE(dev); sysbus_mmio_map(busdev, 0, SPI_BASEADDR); sysbus_connect_irq(busdev, 0, irq[SPI_IRQ]); spi = (SSIBus *)qdev_get_child_bus(dev, "spi"); for (i = 0; i < NUM_SPI_FLASHES; i++) { qemu_irq cs_line; dev = ssi_create_slave(spi, "n25q128"); cs_line = qdev_get_gpio_in_named(dev, SSI_GPIO_CS, 0); sysbus_connect_irq(busdev, i+1, cs_line); } } microblaze_load_kernel(cpu, MEMORY_BASEADDR, ram_size, machine->initrd_filename, BINARY_DEVICE_TREE_FILE, machine_cpu_reset); }
1threat
static void rtc_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = rtc_realizefn; dc->no_user = 1; dc->vmsd = &vmstate_rtc; dc->props = mc146818rtc_properties; }
1threat
How to make string accessible to all forms : I have a form called "AddFile" and I have a textbox "tbPassword" and button "btnOkay" in it. What Im trying to do is (on a click of a button) make the text of this textbox a string so i can use it across all Forms and add it in ListView, so it displays the text written in "tbPassword" in ListView.
0debug
void rng_backend_open(RngBackend *s, Error **errp) { object_property_set_bool(OBJECT(s), true, "opened", errp); }
1threat
VueJS: trigger input file from button : <p>I need to build a custom file uploader to upload a image profile but I don't want to use the original design of input file but hide it and show a button only to upload the picture.</p> <p>And I know how to trigger the input file when a different button is clicked with jQuery and with AngularJS but I cannot find the way to do the same with VueJS, do you have any idea?</p> <p>Kind regards!</p>
0debug
R: How to recode multiple values in dplyr? : <p>How can I make the following changes for multiple or all variables?</p> <ul> <li>change "yes" to 1</li> <li>change "no" to 0</li> <li>keep NAs</li> </ul> <p>I tried recode but it seems not to be appliable to dataframes.</p>
0debug
Why this jQuery is not working? : Why can't I get the index of `hdjs` inside `jdks`? `jdks` is a jQuery object with all `id^=name` blocks having errors in them. `hdjs` is a block with an ID starting by "name" which has an error in it. So why am I getting `-1` when console.logging? Thanks all! <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> function $errorObjectFunction() { return $("div[id^=office_name]").map(function() { if ($(this).find(":first-child").hasClass("error") == true || $(this).find(".field_error").length > 0) { return $(this) } }); } var $self = $("#self"); var jdks = $errorObjectFunction(); var hdjs = $self.parent().parent().parent(); console.log("index: " + jdks.index(hdjs)); <!-- language: lang-html --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="name1"> <div class="fourteen wide field error"> <input id="OfficeName1"></input> <div class="dropdown"></div> </div> </div> <div id="name2"> <div class="fourteen wide field"> <input id="OfficeName1"></input> <div class="dropdown field_error"></div> </div> </div> <div id="name3"> <div class="fourteen wide field error"> <input id="OfficeName1"></input> <div class="dropdown field_error"></div> </div> </div> <div id="name4"> <div class="fourteen wide field error"> <input id="OfficeName1"></input> <div class="dropdown field_error"> <input id="self"></input> </div> </div> </div> <div id="name5"> <div class="fourteen wide field"> <input id="OfficeName1"></input> <div class="dropdown"></div> </div> </div> <div id="name6"> <div class="fourteen wide field error"> <input id="OfficeName1"></input> <div class="dropdown field_error"></div> </div> </div> <!-- end snippet -->
0debug
static void superio_ioport_writeb(void *opaque, uint32_t addr, uint32_t data) { int can_write; SuperIOConfig *superio_conf = opaque; DPRINTF("superio_ioport_writeb address 0x%x val 0x%x \n", addr, data); if (addr == 0x3f0) { superio_conf->index = data & 0xff; } else { switch (superio_conf->index) { case 0x00 ... 0xdf: case 0xe4: case 0xe5: case 0xe9 ... 0xed: case 0xf3: case 0xf5: case 0xf7: case 0xf9 ... 0xfb: case 0xfd ... 0xff: can_write = 0; break; default: can_write = 1; if (can_write) { switch (superio_conf->index) { case 0xe7: if ((data & 0xff) != 0xfe) { DPRINTF("chage uart 1 base. unsupported yet \n"); } break; case 0xe8: if ((data & 0xff) != 0xbe) { DPRINTF("chage uart 2 base. unsupported yet \n"); } break; default: superio_conf->config[superio_conf->index] = data & 0xff; } } } superio_conf->config[superio_conf->index] = data & 0xff; } }
1threat
When offline, how to manage data? IOS : <p>I would like to know what are the best practices regarding, Modeling data when no network connection available, if the app you are building is cloud computing based, but still you want to be able to have basic functionality and I guess some persistent data?</p> <p>PD: I am kind of new to IOS development</p>
0debug
Hash function for sorting 100 or more integar numbers : <p>I searched the problem but not satisfied, so that I want to ask a question. If I want to sort suppose 100 numbers using hash table what hash function may help me.I sorted 10 numbers(by bucketsort) through the table, of whats length was 10. Without increasing the table length how could I still imply bucket sort there.X%10 will not help me any more?. So how could I still sort my numbers.</p>
0debug
void destroy_bdrvs(dev_match_fn *match_fn, void *arg) { DriveInfo *dinfo; struct BlockDriverState *bs; TAILQ_FOREACH(dinfo, &drives, next) { bs = dinfo->bdrv; if (bs) { if (bs->private && match_fn(bs->private, arg)) { drive_uninit(bs); bdrv_delete(bs); } } } }
1threat
How to convert a textView text into a char variable? (Java) : So I'm trying to convert a textView text that will be entered by the user into a char variable, but i can't seem to make it work. Also, did'nt manage find anything useful so decided to just ask in here. Thanks in adavance!
0debug
static void test_io(void) { #ifndef _WIN32 int sv[2]; int r; unsigned i, j, k, s, t; fd_set fds; unsigned niov; struct iovec *iov, *siov; unsigned char *buf; size_t sz; iov_random(&iov, &niov); sz = iov_size(iov, niov); buf = g_malloc(sz); for (i = 0; i < sz; ++i) { buf[i] = i & 255; } iov_from_buf(iov, niov, 0, buf, sz); siov = g_memdup(iov, sizeof(*iov) * niov); if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) < 0) { perror("socketpair"); exit(1); } FD_ZERO(&fds); t = 0; if (fork() == 0) { close(sv[0]); FD_SET(sv[1], &fds); fcntl(sv[1], F_SETFL, O_RDWR|O_NONBLOCK); r = g_test_rand_int_range(sz / 2, sz); setsockopt(sv[1], SOL_SOCKET, SO_SNDBUF, &r, sizeof(r)); for (i = 0; i <= sz; ++i) { for (j = i; j <= sz; ++j) { k = i; do { s = g_test_rand_int_range(0, j - k + 1); r = iov_send(sv[1], iov, niov, k, s); g_assert(memcmp(iov, siov, sizeof(*iov)*niov) == 0); if (r >= 0) { k += r; t += r; usleep(g_test_rand_int_range(0, 30)); } else if (errno == EAGAIN) { select(sv[1]+1, NULL, &fds, NULL, NULL); continue; } else { perror("send"); exit(1); } } while(k < j); } } iov_free(iov, niov); g_free(buf); g_free(siov); exit(0); } else { close(sv[1]); FD_SET(sv[0], &fds); fcntl(sv[0], F_SETFL, O_RDWR|O_NONBLOCK); r = g_test_rand_int_range(sz / 2, sz); setsockopt(sv[0], SOL_SOCKET, SO_RCVBUF, &r, sizeof(r)); usleep(500000); for (i = 0; i <= sz; ++i) { for (j = i; j <= sz; ++j) { k = i; iov_memset(iov, niov, 0, 0xff, -1); do { s = g_test_rand_int_range(0, j - k + 1); r = iov_recv(sv[0], iov, niov, k, s); g_assert(memcmp(iov, siov, sizeof(*iov)*niov) == 0); if (r > 0) { k += r; t += r; } else if (!r) { if (s) { break; } } else if (errno == EAGAIN) { select(sv[0]+1, &fds, NULL, NULL, NULL); continue; } else { perror("recv"); exit(1); } } while(k < j); test_iov_bytes(iov, niov, i, j - i); } } iov_free(iov, niov); g_free(buf); g_free(siov); } #endif }
1threat
POWER BI - Divide a cell in a reference row by a specific cell : Create a measure that divides each cell of a main diagonal one row below. As example, A1= A1/A2 B2= B2/B3, C3= C3/C4, D4= D4/D5 and so on. [As it is shown, in the image green circle divided by red circle][1]. [1]: https://i.stack.imgur.com/9sXXO.png
0debug
static void channel_load_d(struct fs_dma_ctrl *ctrl, int c) { target_phys_addr_t addr = channel_reg(ctrl, c, RW_SAVED_DATA); D(printf("%s ch=%d addr=" TARGET_FMT_plx "\n", __func__, c, addr)); cpu_physical_memory_read (addr, (void *) &ctrl->channels[c].current_d, sizeof ctrl->channels[c].current_d); D(dump_d(c, &ctrl->channels[c].current_d)); ctrl->channels[c].regs[RW_DATA] = addr; }
1threat
error TS2314: Generic type 'Promise<T>' requires 1 type argument(s) : <p>I have used Promise and observables logic to fetch data from server using "get". It was working till yesterday. SUddenly it starts throwing the above error. Please help me finding the error. I am getting "Generic type 'Promise' requires 1 type argument(s)" error.</p> <pre><code>@Injectable() export class myBlogService{ // Property to hold root server URL i.e host private serverUrl:string = "app/data.json" constructor(private http:Http) {} // check function in service to check control is coming to service check(){ alert("getting clicked from service"); } // get function to get data from server // basically blog datas get(): Promise { return this.http.get(this.serverUrl) .map(response =&gt; response.json()) } } /** * * My Components * */ @Component({ selector: 'my-app', providers: [myBlogService], styleUrls: ['app/css/app.css'], template: ` &lt;h1 (click)= check()&gt;My First Angular 2 App&lt;/h1&gt; &lt;button (click)=get()&gt;Get My Name&lt;/button&gt; &lt;h1&gt;{{getResponse.name}}&lt;/h1&gt; ` }) export class myBlogApp { // Property to hold blog data public getResponse = {"name": "", "age": ""}; constructor(protected myblogservice:myBlogService){} // check function to check control is going to service check() { this.myblogservice.check(); } // get function calls service get function which return data from server get(){ this.myblogservice.get().subscribe(data =&gt; { this.getResponse = data; }); } } /** * * NgModule Declaration * */ @NgModule({ imports: [ BrowserModule, HttpModule ], declarations: [ myBlogApp ], providers: [ ], bootstrap: [ myBlogApp ] }) export class app{} /** * * App engine entry point * */ const platform = platformBrowserDynamic(); platform.bootstrapModule(app); </code></pre> <p>When "promise: " is given, still it gives issue like "error TS2339: Property 'subscribe' does not exist on type 'Promise'".</p> <p>I tried different solution but no luck yet.</p>
0debug
How do truncate a decimal in PHP? The right side of a decimal : <p>I see that there are methods that truncate the left side of a decimal. For example, 3.5 would be 3 if using functions such as floor() in PHP. Is there a function that truncates the right side of the decimal? For example, 3.5 would just be .5.</p>
0debug
How To Move Files Via Batch File But If File Already Exist Move Elsewhere : Hello I am trying to Move Files to a particular folder (destination folder) but I do not want to overwrite any files instead if the file already exist in that particular folder (destination folder) then move that file in another folder (overflow folder) but keep folder structure. I tired with Xcopy, Robo Copy, but It appear it cant be done like that, this is the script I use to move files but not overwrite robocopy "C:\DummySourcePath\" "C:\DummyDestantionPath\" /E /XC /XN /XO
0debug
Get average of numbers : I am supposed to calculate the double of three numbers and get its average. I am required to use the following two methods, no changing them: getNumbers(); which only gets the user inputs. no returns, no arguments. getAverage(); which calculate the average of the three double numbers. returns the average, and has no argument. My question is everytime I run it on CMD, it shows that method does not work and will not print an output. For me to enter three numbers, and get its average at the end. If someone can give me advice as to what I am doing wrong, it will be greatly appreciated. import java.util.Scanner; public class ComputeAverage{ double firstNum; double secondNum; double thirdNum; double sum; double average; public void getNumbers(){ Scanner keyboard = new Scanner(System.in); System.out.println("Enter your first number: "); double firstNum = keyboard.nextDouble(); System.out.println("Enter your second number: "); double secondNum = keyboard.nextDouble(); System.out.println("Enter your third number: "); double thirdNum = keyboard.nextDouble(); Test.println("The average is: " + average); } public double getAverage(double firstNum, double secondNum, double thirdNum){ double average = firstNum + secondNum + thirdNum / 3; return average; } }
0debug
How to get variable from herf using php : This code for getting order_no when click on link, I can't implement any javascript on this page because its work like template and its not the page appear in browser, any way its working fine but if i click on the link and open modal it shows the same order_no, I have to refresh page or open in new tab to get order_no. sorry for my english, wish you got what i mean <td align='center' span style="font-weight:bold;"><a href ="edit.php?id=<?php echo $f_customer['order_no']?>" data-toggle = "modal" data-target = "#action"><?php echo $f_customer['order_no']?></a></td> **edit.php** <?php require_once 'config.php'; $q_edit_student = $conn->query("SELECT * FROM `orders` WHERE `order_no` = '$_REQUEST[id]'") or die(mysqli_error()); $f_edit_student = $q_edit_student->fetch_array(); ?> <div class = "modal-content "> <div class = "modal-body"> <div class="form-group col-xs-4 col-md-4"> <label for="name" class="control-label">Order Number</label> <input type = "text" name = "order_no" id="order_no" value = "<?php echo $_REQUEST['id']?>"tabindex="1" class="form-control" autofocus /> </div>
0debug
arduini no such file or directory : in arduino ide 1.8.7 i pasted an old progect into the directory "sketch_system1", my .ino file is sketch_system1.ino, all the headers and c++ file are into the same directory as .ino file. When I try to compile I get this error: Arduino:1.8.7 (Linux), Scheda:"Arduino/Genuino Uno" sketch_system1:1:23: error: LumSensor.h: No such file or directory compilation terminated. exit status 1 LumSensor.h: No such file or directory Questo report potrebbe essere più ricco di informazioni abilitando l'opzione "Mostra un output dettagliato durante la compilazione" in "File -> Impostazioni"
0debug
How can I check if this file name is created or not in c# : <p>I'm trying to create a method that checks if this file ( todayfile.txt) is created if not I need it to create it. Here is what I thinking of :</p> <pre><code>private void ReadWater() { try { StreamReader inputFile; // I want to check if there is a file named ( Todayfile.txt ) if (// if this file ( Todayfile.txt) is founded) { // Do this } else // if there is no file in this nmae ( Todayfile.text ) { // create a new file } } catch (Exception ex) { } } </code></pre>
0debug
static inline uint64_t v4l2_get_pts(V4L2Buffer *avbuf) { V4L2m2mContext *s = buf_to_m2mctx(avbuf); AVRational v4l2_timebase = { 1, USEC_PER_SEC }; int64_t v4l2_pts; v4l2_pts = avbuf->buf.timestamp.tv_sec * USEC_PER_SEC + avbuf->buf.timestamp.tv_usec; return av_rescale_q(v4l2_pts, v4l2_timebase, s->avctx->time_base); }
1threat
Obtain a php var in another page in the current page : I would create an ajax code that load a php page every x seconds and it obtain a specific php var in the loaded page and assign the value of the obtained var to a javascript var, sorry for my bad english.
0debug
static inline uint32_t celt_icwrsi(uint32_t N, const int *y) { int i, idx = 0, sum = 0; for (i = N - 1; i >= 0; i--) { const uint32_t i_s = CELT_PVQ_U(N - i, sum + FFABS(y[i]) + 1); idx += CELT_PVQ_U(N - i, sum) + (y[i] < 0)*i_s; sum += FFABS(y[i]); } return idx; }
1threat
how to return value controller to view model using codeigniter? : Excuse me, i still learn about codeigniter's new. i wanna ask what i have a simple query in view model like this below : <h4 align="center"><?php echo '<b>'.strtoupper($data_mapel['nama_mapel']).'&nbsp; ('.$data_subjek_data['nama_subjek'].')</b>'; ?> </h4> then, in controller model like this below : public function view_soal($id_mapel,$id_paket){ // needed data $data['data_subjek'] = $this->master->get_all_data('tb_subjek')->result(); $id_subjek = $this->input->post('subjek'); $where = array('id_mapel'=>$id_mapel,'id_subjek'=>$id_subjek); $data['data_mapel'] = $this->master->find_data(array('id_mapel'=>$id_mapel),'tb_mapel')->row_array(); $data['data_subjek_data'] = $this->master->find_data(array('id'=>$id_subjek),'tb_subjek')->row_array(); //get data paket $where_paket = array('id'=>$id_paket); $data['data_paket'] = $this->master->find_data($where_paket,'tb_paket')->row_array(); //get data view $data['data_view'] = $this->db->query("select a.*,b.nama_tema from tb_pertanyaan a inner join tb_tema b on a.id_tema = b.id_tema where a.id_tema IN(select id_tema from detil_paket where id_paket ='$id_paket')")->result(); $data['add_link'] = 'training'; $data['view_file'] = $this->training.'view_soal'; $this->load->view('template/media',$data); } when i want to return value about data_subjek_data to view model and can be displayed, what should i do?
0debug
Extending multiple recommended configurations in ESLint : <p><strong>The Story:</strong></p> <p>Currently, we are <em>extending the recommended ESLint configuration</em>:</p> <pre><code>{ "extends": "eslint:recommended", ... "plugins": [ "angular", "jasmine", "protractor" ], "rules": { "no-multiple-empty-lines": 2, "no-trailing-spaces": 2, "jasmine/valid-expect": 2 } } </code></pre> <p>And also using <code>angular</code>, <code>jasmine</code> and <code>protractor</code> ESLint plugins which also ship with <em>their own recommended configurations</em> (default rule strictness levels and default rule parameters). </p> <p><strong>The Question:</strong></p> <p>How can we use all the recommended configurations at the same time - the one that ESLint and all the used plugins ship with?</p> <hr> <p>Tried the following:</p> <pre><code>{ "extends": [ "eslint:recommended", "plugin:protractor/recommended", "plugin:jasmine/recommended", "plugin:angular/recommended" ], ... } </code></pre> <p>but got the following error:</p> <blockquote> <p>Cannot read property 'recommended' of undefined</p> </blockquote>
0debug
Javascript global variable naming conflicts : <p>A newbie learning javascript :)</p> <p>This is my html page and the associated js code</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; A Basic Function &lt;/title&gt; &lt;link rel="stylesheet" href="css/c03.css" /&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Travelworth&lt;/h1&gt; &lt;div id="message"&gt;Welcome to our site!&lt;/div&gt; &lt;script src="js/basic-function.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>basic-function.js</strong></p> <pre><code>var msg="A New Message"; //Line 1 var msg="A Second Message";//Line 2 function updatemessage() { var e = document.getElementById('message'); e.textContent = msg; } updatemessage(); </code></pre> <p><strong>Q1:-</strong></p> <p>This webpage displays the message from the Line2 instead of Line1.</p> <p>I am guessing this is because the "msg" variable declared in Line 2 is considered the "latest" and the interpreter has proceeded with that.</p> <p>Is my assumption right ?</p> <p><strong>Q2:-</strong></p> <p>If that is the case, then there will be instances where a webpage may utilize multiple js files written by different people.</p> <p>How the naming conflict will be handled on global variables between these two different js files referenced in the same webpage ?</p> <p>Can someone explain ?</p>
0debug
Sonarqube, "String contains no format specifiers" when logging constant String message : <p>SonarQube complains about "<em>String contains no format specifiers</em>." when using <code>org.slf4j.Logger</code>, in particular method "<code>public void debug(String msg)</code>". For example </p> <pre><code> log.info("message"); </code></pre> <p>It refers to this rule : <a href="https://wiki.sei.cmu.edu/confluence/display/c/FIO47-C.+Use+valid+format+strings" rel="noreferrer">https://wiki.sei.cmu.edu/confluence/display/c/FIO47-C.+Use+valid+format+strings</a></p> <p>However, in this rule, we can find the following quote :</p> <blockquote> <p>Each conversion specification is introduced by the % character followed (in order) by</p> <p>Zero or more flags (in any order), which modify the meaning of the conversion specification</p> </blockquote> <p>Is it me that miss something, or is this rule not well implemented? Any experience with that ?</p>
0debug
Catch all routes for Flask : <p>I'm using Flask with React. I'd like to create a catch all route similar to something like this (although this doesn't work):</p> <pre><code>@app.route('*') def get(): return render_template('index.html') </code></pre> <p>Since my app will use React and it's using the index.html to mount my React components, I'd like for every route request to point to my index.html page in templates. Is there a way to do this (or is using a redirect the best way)?</p>
0debug
void kvmppc_hash64_free_pteg(uint64_t token) { struct kvm_get_htab_buf *htab_buf; htab_buf = container_of((void *)(uintptr_t) token, struct kvm_get_htab_buf, hpte); g_free(htab_buf); return; }
1threat
static int rv20_decode_picture_header(MpegEncContext *s) { int seq, mb_pos, i; if(s->avctx->sub_id == 0x30202002 || s->avctx->sub_id == 0x30203002){ if (get_bits(&s->gb, 3)){ av_log(s->avctx, AV_LOG_ERROR, "unknown triplet set\n"); return -1; } } i= get_bits(&s->gb, 2); switch(i){ case 0: s->pict_type= I_TYPE; break; case 1: s->pict_type= I_TYPE; break; case 2: s->pict_type= P_TYPE; break; case 3: s->pict_type= B_TYPE; break; default: av_log(s->avctx, AV_LOG_ERROR, "unknown frame type\n"); return -1; } if (get_bits(&s->gb, 1)){ av_log(s->avctx, AV_LOG_ERROR, "unknown bit set\n"); return -1; } s->qscale = get_bits(&s->gb, 5); if(s->qscale==0){ av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n"); return -1; } if(s->avctx->sub_id == 0x30203002){ if (get_bits(&s->gb, 1)){ av_log(s->avctx, AV_LOG_ERROR, "unknown bit2 set\n"); return -1; } } if(s->avctx->has_b_frames){ if (get_bits(&s->gb, 1)){ av_log(s->avctx, AV_LOG_ERROR, "unknown bit3 set\n"); return -1; } seq= get_bits(&s->gb, 15); }else seq= get_bits(&s->gb, 8)*128; seq |= s->time &~0x7FFF; if(seq - s->time > 0x4000) seq -= 0x8000; if(seq - s->time < -0x4000) seq += 0x8000; if(seq != s->time){ if(s->pict_type!=B_TYPE){ s->time= seq; s->pp_time= s->time - s->last_non_b_time; s->last_non_b_time= s->time; }else{ s->time= seq; s->pb_time= s->pp_time - (s->last_non_b_time - s->time); if(s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time<=0){ printf("messed up order, seeking?, skiping current b frame\n"); return FRAME_SKIPED; } } } mb_pos= ff_h263_decode_mba(s); s->no_rounding= get_bits1(&s->gb); s->f_code = 1; s->unrestricted_mv = 1; s->h263_aic= s->pict_type == I_TYPE; s->modified_quant=1; s->loop_filter=1; if(s->avctx->debug & FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n", seq, s->mb_x, s->mb_y, s->pict_type, s->qscale, s->no_rounding); } assert(s->pict_type != B_TYPE || !s->low_delay); return s->mb_width*s->mb_height - mb_pos; }
1threat
I am getting an identifier expected error. What can I do? : I get this error message saying identifier expected newIntArray3 = addValues(StackA.pop(), StackB.pop()); Can someone help me with this please? <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> while (!StackA.empty() && !StackB.empty()) { int[] newIntArray3 = new int[4]; @SuppressWarnings("unchecked") newIntArray3 = addValues(StackA.pop(), StackB.pop()); int i=0; while (i<=3); StackC.push(newIntArray3); i++; } System.out.println("result: " + StackC.pop() + StackC.pop() + StackC.pop() + StackC.pop()); } public void addValues() { int x , y = 0; int addValues = 0; addValues = x+y; System.out.println(addValues); }} <!-- end snippet -->
0debug
count html table rows using PHP : I need to display the num of the row (tr) using php, but i don't know how to do because i using quotes ... Thanks for yours answers aaaaaaaaaaaaaaaaaaaaa $data['formation'] = ' <div class="table-responsive"> <table class="table table-bordered" style="width: auto !important;"> <thead style="font-weight: bold;"> <tr> <td>N</td> <td>Intitulé</td> <td>Organisme</td> <td>Date</td> <td>Durée (en heures)</td> <td>Eval. à chaud / à froid</td> <td>Dispositif utilisé</td> </tr> </thead> <tbody class="table-striped"> <tr> <td> **HERE NUM OF THE ROW** </td> <td> <input type="text" class="form-control" name="form_intitule" id="form_intitule" readonly> </td> <td> <input type="text" class="form-control" name="form_organisme" id="form_organisme" readonly> </td> <td> <input type="text" class="form-control" name="form_date" id="form_date" readonly> </td> <td> <input type="text" class="form-control" name="form_duree" id="form_duree" readonly> </td> <td></td> <td></td> </tr> </tbody> </table> </div>'; }
0debug
Proguard - do not obfuscate Kotlin data classes : <p>In my project I use <a href="http://ryanharter.com/blog/2016/03/22/autovalue/" rel="noreferrer">AutoValue</a> for my old model classes. I started using Kotlin and I want to use <a href="https://kotlinlang.org/docs/reference/data-classes.html" rel="noreferrer">Data Classes</a> instead of AutoValue. I want to disable the obfuscation for all <strong>Data classes</strong> in my <strong>Data layer</strong> but to keep obfuscating the other classes in the package.</p> <p>Is there a way to do this?</p> <p>I would expect to have something like this in my <strong>Proguard</strong> file:</p> <pre><code>-keepclassmembers data class example.data_layer.** { *; } </code></pre>
0debug
static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs, BdrvTrackedRequest *req, int64_t offset, unsigned int bytes, int64_t align, QEMUIOVector *qiov, int flags) { BlockDriver *drv = bs->drv; bool waited; int ret; int64_t start_sector = offset >> BDRV_SECTOR_BITS; int64_t end_sector = DIV_ROUND_UP(offset + bytes, BDRV_SECTOR_SIZE); uint64_t bytes_remaining = bytes; int max_transfer; assert(is_power_of_2(align)); assert((offset & (align - 1)) == 0); assert((bytes & (align - 1)) == 0); assert(!qiov || bytes == qiov->size); assert((bs->open_flags & BDRV_O_NO_IO) == 0); assert(!(flags & ~BDRV_REQ_MASK)); max_transfer = QEMU_ALIGN_DOWN(MIN_NON_ZERO(bs->bl.max_transfer, INT_MAX), align); waited = wait_serialising_requests(req); assert(!waited || !req->serialising); assert(req->overlap_offset <= offset); assert(offset + bytes <= req->overlap_offset + req->overlap_bytes); ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req); if (!ret && bs->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF && !(flags & BDRV_REQ_ZERO_WRITE) && drv->bdrv_co_pwrite_zeroes && qemu_iovec_is_zero(qiov)) { flags |= BDRV_REQ_ZERO_WRITE; if (bs->detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP) { flags |= BDRV_REQ_MAY_UNMAP; } } if (ret < 0) { } else if (flags & BDRV_REQ_ZERO_WRITE) { bdrv_debug_event(bs, BLKDBG_PWRITEV_ZERO); ret = bdrv_co_do_pwrite_zeroes(bs, offset, bytes, flags); } else if (flags & BDRV_REQ_WRITE_COMPRESSED) { ret = bdrv_driver_pwritev_compressed(bs, offset, bytes, qiov); } else if (bytes <= max_transfer) { bdrv_debug_event(bs, BLKDBG_PWRITEV); ret = bdrv_driver_pwritev(bs, offset, bytes, qiov, flags); } else { bdrv_debug_event(bs, BLKDBG_PWRITEV); while (bytes_remaining) { int num = MIN(bytes_remaining, max_transfer); QEMUIOVector local_qiov; int local_flags = flags; assert(num); if (num < bytes_remaining && (flags & BDRV_REQ_FUA) && !(bs->supported_write_flags & BDRV_REQ_FUA)) { local_flags &= ~BDRV_REQ_FUA; } qemu_iovec_init(&local_qiov, qiov->niov); qemu_iovec_concat(&local_qiov, qiov, bytes - bytes_remaining, num); ret = bdrv_driver_pwritev(bs, offset + bytes - bytes_remaining, num, &local_qiov, local_flags); qemu_iovec_destroy(&local_qiov); if (ret < 0) { break; } bytes_remaining -= num; } } bdrv_debug_event(bs, BLKDBG_PWRITEV_DONE); ++bs->write_gen; bdrv_set_dirty(bs, start_sector, end_sector - start_sector); if (bs->wr_highest_offset < offset + bytes) { bs->wr_highest_offset = offset + bytes; } if (ret >= 0) { bs->total_sectors = MAX(bs->total_sectors, end_sector); ret = 0; } return ret; }
1threat
constexpr constructor gives a different result when evaluated at compile time by GCC : <p>The constructor uses a function taking a reference and returning by value while repeatedly modifying a data member:</p> <pre><code>constexpr int vv(int x) {return x;} constexpr int &amp; rr(int &amp; x) {return x;} constexpr int rv(int &amp; x) {return x;} constexpr struct S { int x {0}; template&lt;typename F&gt; constexpr S(F f) {x = f(x) + 1; x = f(x) + 1;} } s(rv); // s.x is 1 if function rv is used, 2 otherwise. static_assert(s.x == 2, ""); </code></pre> <p>It is only the function <code>rv</code> which gives the unexpected result when used in the constructor. If <code>vv</code> or <code>rr</code> is passed instead then <code>s.x</code> is 2 as expected.</p> <p>I noticed the behavior on GCC 5.4.1 ARM and it appears to be the same in all versions of GCC that support C++14. Clang gives the expected result of 2 in all cases. Neither GCC nor Clang give any warnings with Wall and Wextra enabled.</p> <p>Is this example valid C++14 and a bug in GCC? I read the list of restrictions on constant expressions in the standard and see nothing obvious it violates but I'm not sure I understand all the technical details.</p>
0debug
I am getting this error: Parse error: syntax error, unexpected 'else' (T_ELSE) in C:\wamp\www. I an having trouble finding the source. : Hope someone with fresh eyes can help.Thanks-R <?php /*CHECKS IF SUBMIT BUTTOM IS CLICKED---SECURITY(Button type in signup.php file)--*/ if (isset($_POST['submit'])) { /*INCLUDE DATABASE FILE--*/ include_once 'dbh.inc.php'; /*CREATE A VARIABLE--(CALLED FIRST)--(IS THE FIRST INPUT INSIDE THE SIGNUP FORM) (allows for code to be converted to text) [[Cannot input code into box}}--*/ $first = mysqli_real_escape_string($conn, $_POST['first']); $last = mysqli_real_escape_string($conn, $_POST['last']); $email = mysqli_real_escape_string($conn, $_POST['email']); $uid = mysqli_real_escape_string($conn, $_POST['uid']); $pwd = mysqli_real_escape_string($conn, $_POST['pwd']); //ERROR HANDLERS //CHECK FOR EMPTY FIELDS---(double pipes means or in php) if (empty($first) || empty($last) || empty($email) || empty($uid) || empty($pwd)) { header("Location: ../signup.php?signup=empty"); exit(); } else { //CHECK IF INPUT CHARACTERS ARE VALID if (!preg_match("/^[a-zA-Z]*$/", $first) || !preg_match("/^[a-zA-Z]*$/", $last)) { header("Location: ../signup.php?signup=invalid"); exit(); } else { //CHECK IF EMAIL IS VALID if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { header("Location: ../signup.php?signup=email"); exit(); } else { $sql = "SELECT * FROM users WHERE user_uid='$uid'"; $result = mysqli_query($conn, $sql); $resultCheck = mysqli_num_rows($result); if ($resultCheck > 0){ header("Location: ../signup.php?signup=usertaken"); exit(); } else { //HASHING PASSWORD--- $hashedPwd = password_hash($pwd, PASSWORD_DEFAULT); //INSERT USER INTO DATABASE $sql= "INSERT INTO users (user_first, user_last, user_email, user_uid, user_pwd) VALUES ('$first','$last', '$email', '$uid','$hashedPwd' );"; mysqli_query($conn, $sql); header("Location: ../signup.php?signup=success"); exit(); } } } } else{ /*COLON MUST NOT HAVE SPACE BETWEEN LOCATION---SPACE BETWEEN ../---(TAKES BACK A DIRECTORY)--PREVENTS GOING TO URL TO ACCESS FILE PAGE.--TAKES USER BACK TO SIGNUP PAGE*/ header("Location: ../signup.php"); /*exit--closes off script from running--(IF ANYTHING AFTER EXIT FUNCTION)*/ exit(); }
0debug
int nbd_client_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { NBDRequest request = { .type = NBD_CMD_READ, .from = offset, .len = bytes, }; assert(bytes <= NBD_MAX_BUFFER_SIZE); assert(!flags); return nbd_co_request(bs, &request, qiov); }
1threat