problem
stringlengths
26
131k
labels
class label
2 classes
how to click on this html section ? : i have one question. Can write script on python3 ho can be clik on this. <a data-href="/twistyourself/rate/2074/fde3342f6097f6f62ead217d788344d3" data-callback="tyRated" title="Vote" class="love section-gallery__vote">vote</a> If yes, how to resolve that `fde3342f6097f6f62ead217d788344d3` it change every refresch page to new string of characters and letters.
0debug
Application and User Authentication using ASP.NET Core : <p>Can anyone point me to some good documentation or provide good information on the best way to implement authentication and authorisation for an ASP.NET Core REST API.I need to authenticating and authorising the app first and then authenticate and authorise the user. </p> <p>Ideally I want to be able restrict the controller method that an authenticated app and/or user can access. </p> <p>I am thinking of using <a href="https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server" rel="noreferrer">AspNet.Security.OpenIdConnect.Serverenter</a> for the App authentication but I am not sure then how best to perform the user authentication. Maybe reuse the OpenIdConnect authentication on a different endpoint for users with a different header to contain the user token.</p> <p>Once authenticated I am thinking of just using roles base security to restrict which controllers methods can be accessed.</p> <p>Is this the correct route to solving this problem?</p>
0debug
How to print results from for loop in one list : <p>Below code is for loop to print many lists</p> <pre><code>for file in dir: res = p.Probability(base + i + "/" + file) print(i + ": " + ": " + str(res)) print(res) #docum = [] #docum.append(res) print(docum) </code></pre> <p>for loop result will be:</p> <pre><code>[['hello',123]['hi',456]] [['hello',123]['hi',456]] [['hello',123]['hi',456]] [['hello',123]['hi',456]] [['hello',123]['hi',456]] </code></pre> <p>but I want to print as a one list</p> <pre><code>[['hello',123]['hi',456],['hello',123]['hi',456],['hello',123]['hi',456]] </code></pre> <p>how can I do that. I tried many things but still not working. I am new to python. and one more help how to separate hi and hello. like: </p> <pre><code> hi hello 456 123 456 123 456 123 </code></pre> <p>I am doing school project for my class 11th. I struck in this and I am new to coding</p>
0debug
LocationServices.SettingsApi deprecated : <p>My code is:</p> <pre><code>if (mGoogleApiClient == null &amp;&amp; checkGooglePlayService()) { Log.d(Utils.TAG_DEV + TAG, "Building GoogleApiClient"); mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); mLocationRequest.setInterval(UPDATE_INTERVAL_IN_MILLISECONDS); mLocationRequest.setFastestInterval(FASTEST_UPDATE_INTERVAL_IN_MILLISECONDS); mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder(); builder.addLocationRequest(mLocationRequest); builder.setAlwaysShow(true); mLocationSettingsRequest = builder.build(); PendingResult&lt;LocationSettingsResult&gt; result = LocationServices.SettingsApi.checkLocationSettings( mGoogleApiClient, mLocationSettingsRequest ); result.setResultCallback(this); } </code></pre> <p>but unfortunately the LocationServices.SettingsApi is deprecated. How can I replace deprecated code with the new one?</p> <p>I found reading docs that the solution can be to use SettingsClient but couldn't figure how to do it.</p> <p>Any ideea what to do to can update my code?</p>
0debug
void qpci_msix_disable(QPCIDevice *dev) { uint8_t addr; uint16_t val; g_assert(dev->msix_enabled); addr = qpci_find_capability(dev, PCI_CAP_ID_MSIX); g_assert_cmphex(addr, !=, 0); val = qpci_config_readw(dev, addr + PCI_MSIX_FLAGS); qpci_config_writew(dev, addr + PCI_MSIX_FLAGS, val & ~PCI_MSIX_FLAGS_ENABLE); qpci_iounmap(dev, dev->msix_table_bar); qpci_iounmap(dev, dev->msix_pba_bar); dev->msix_enabled = 0; dev->msix_table_off = 0; dev->msix_pba_off = 0; }
1threat
Sort a Generic List with orderby or sort : <p>I have a Generic List with this structure:</p> <pre><code> public class Emoticon { public int id { get; set; } public string code { get; set; } public string emoticon_set { get; set; } } public class Emoticons { public List&lt;Emoticon&gt; emoticons { get; set; } } </code></pre> <p>The List is <code>Emoticons twitch_emoticons</code>. No i want to sort the list by the ID. can anyone help me?</p>
0debug
void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb) { uint32_t type; struct iovec *in_iov = req->elem->in_sg; struct iovec *iov = req->elem->out_sg; unsigned in_num = req->elem->in_num; unsigned out_num = req->elem->out_num; if (req->elem->out_num < 1 || req->elem->in_num < 1) { error_report("virtio-blk missing headers"); exit(1); } if (unlikely(iov_to_buf(iov, out_num, 0, &req->out, sizeof(req->out)) != sizeof(req->out))) { error_report("virtio-blk request outhdr too short"); exit(1); } iov_discard_front(&iov, &out_num, sizeof(req->out)); if (in_num < 1 || in_iov[in_num - 1].iov_len < sizeof(struct virtio_blk_inhdr)) { error_report("virtio-blk request inhdr too short"); exit(1); } req->in = (void *)in_iov[in_num - 1].iov_base + in_iov[in_num - 1].iov_len - sizeof(struct virtio_blk_inhdr); iov_discard_back(in_iov, &in_num, sizeof(struct virtio_blk_inhdr)); type = virtio_ldl_p(VIRTIO_DEVICE(req->dev), &req->out.type); if (type & VIRTIO_BLK_T_FLUSH) { virtio_blk_handle_flush(req, mrb); } else if (type & VIRTIO_BLK_T_SCSI_CMD) { virtio_blk_handle_scsi(req); } else if (type & VIRTIO_BLK_T_GET_ID) { VirtIOBlock *s = req->dev; strncpy(req->elem->in_sg[0].iov_base, s->blk.serial ? s->blk.serial : "", MIN(req->elem->in_sg[0].iov_len, VIRTIO_BLK_ID_BYTES)); virtio_blk_req_complete(req, VIRTIO_BLK_S_OK); virtio_blk_free_request(req); } else if (type & VIRTIO_BLK_T_OUT) { qemu_iovec_init_external(&req->qiov, &req->elem->out_sg[1], req->elem->out_num - 1); virtio_blk_handle_write(req, mrb); } else if (type == VIRTIO_BLK_T_IN || type == VIRTIO_BLK_T_BARRIER) { qemu_iovec_init_external(&req->qiov, &req->elem->in_sg[0], req->elem->in_num - 1); virtio_blk_handle_read(req); } else { virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP); virtio_blk_free_request(req); } }
1threat
Run a database migration command when deploying a Docker container to AWS : <p>Please bear with me. Pretty new to Docker.</p> <p>I'm deploying Docker containers (detached) to an AWS EC2 registry using <a href="https://aws.amazon.com/codedeploy/" rel="noreferrer">CodeDeploy</a>. On deploy, the following command is run after setting some environmental variables etc:</p> <pre><code>exec docker run -d ${PORTS} -v cache-${CACHE_VOLUME} --env-file $(dirname $0)/docker.env --tty "${IMAGE}:${TAG}" </code></pre> <p>The container runs an image located and tagged in EC2 Container Service. No problems so far.</p> <p>Since this is a PHP application (specifically a Symfony2 application) I would normally need to issue the following command to execute database migrations on deployment:</p> <pre><code> php app/console doctrine:migrations:migrate --no-interaction </code></pre> <p>Now, is there any to run this command during "docker run..." while keeping the container running, or do I need to run another container specifically for this command?</p> <p>Many thanks!</p>
0debug
static int mpegvideo_probe(AVProbeData *p) { uint32_t code= -1; int pic=0, seq=0, slice=0, pspack=0, vpes=0, apes=0, res=0, sicle=0; int i; uint32_t last = 0; for(i=0; i<p->buf_size; i++){ code = (code<<8) + p->buf[i]; if ((code & 0xffffff00) == 0x100) { switch(code){ case SEQ_START_CODE: seq++; break; case PICTURE_START_CODE: pic++; break; case PACK_START_CODE: pspack++; break; case 0x1b6: res++; break; } if (code >= SLICE_START_CODE && code <= 0x1af) { if (last >= SLICE_START_CODE && last <= 0x1af) { if (code >= last) slice++; else sicle++; }else{ if (code == SLICE_START_CODE) slice++; else sicle++; } } if ((code & 0x1f0) == VIDEO_ID) vpes++; else if((code & 0x1e0) == AUDIO_ID) apes++; last = code; } } if(seq && seq*9<=pic*10 && pic*9<=slice*10 && !pspack && !apes && !res && slice > sicle) { if(vpes) return AVPROBE_SCORE_EXTENSION / 4; else return pic>1 ? AVPROBE_SCORE_EXTENSION + 1 : AVPROBE_SCORE_EXTENSION / 2; } return 0; }
1threat
static int avi_sync(AVFormatContext *s, int exit_early) { AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; int n; unsigned int d[8]; unsigned int size; int64_t i, sync; start_sync: memset(d, -1, sizeof(d)); for (i = sync = avio_tell(pb); !avio_feof(pb); i++) { int j; for (j = 0; j < 7; j++) d[j] = d[j + 1]; d[7] = avio_r8(pb); size = d[4] + (d[5] << 8) + (d[6] << 16) + (d[7] << 24); n = get_stream_idx(d + 2); ff_tlog(s, "%X %X %X %X %X %X %X %X %"PRId64" %u %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n); if (i*(avi->io_fsize>0) + (uint64_t)size > avi->fsize || d[0] > 127) continue; if ((d[0] == 'i' && d[1] == 'x' && n < s->nb_streams) || (d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') || (d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1') || (d[0] == 'i' && d[1] == 'n' && d[2] == 'd' && d[3] == 'x')) { avio_skip(pb, size); goto start_sync; } if (d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T') { avio_skip(pb, 4); goto start_sync; } n = get_stream_idx(d); if (!((i - avi->last_pkt_pos) & 1) && get_stream_idx(d + 1) < s->nb_streams) continue; if (d[2] == 'i' && d[3] == 'x' && n < s->nb_streams) { avio_skip(pb, size); goto start_sync; } if (avi->dv_demux && n != 0) continue; if (n < s->nb_streams) { AVStream *st; AVIStream *ast; st = s->streams[n]; ast = st->priv_data; if (!ast) { av_log(s, AV_LOG_WARNING, "Skipping foreign stream %d packet\n", n); continue; } if (s->nb_streams >= 2) { AVStream *st1 = s->streams[1]; AVIStream *ast1 = st1->priv_data; if ( d[2] == 'w' && d[3] == 'b' && n == 0 && st ->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st1->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && ast->prefix == 'd'*256+'c' && (d[2]*256+d[3] == ast1->prefix || !ast1->prefix_count) ) { n = 1; st = st1; ast = ast1; av_log(s, AV_LOG_WARNING, "Invalid stream + prefix combination, assuming audio.\n"); } } if (!avi->dv_demux && ((st->discard >= AVDISCARD_DEFAULT && size == 0) || st->discard >= AVDISCARD_ALL)) { if (!exit_early) { ast->frame_offset += get_duration(ast, size); avio_skip(pb, size); goto start_sync; } } if (d[2] == 'p' && d[3] == 'c' && size <= 4 * 256 + 4) { int k = avio_r8(pb); int last = (k + avio_r8(pb) - 1) & 0xFF; avio_rl16(pb); for (; k <= last; k++) ast->pal[k] = 0xFFU<<24 | avio_rb32(pb)>>8; ast->has_pal = 1; goto start_sync; } else if (((ast->prefix_count < 5 || sync + 9 > i) && d[2] < 128 && d[3] < 128) || d[2] * 256 + d[3] == ast->prefix ) { if (exit_early) return 0; if (d[2] * 256 + d[3] == ast->prefix) ast->prefix_count++; else { ast->prefix = d[2] * 256 + d[3]; ast->prefix_count = 0; } avi->stream_index = n; ast->packet_size = size + 8; ast->remaining = size; if (size) { uint64_t pos = avio_tell(pb) - 8; if (!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos) { av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME); } } return 0; } } } if (pb->error) return pb->error; return AVERROR_EOF; }
1threat
void op_addo (void) { target_ulong tmp; tmp = T0; T0 += T1; if ((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31)) { CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW); } RETURN(); }
1threat
static void s390_cpu_plug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { gchar *name; S390CPU *cpu = S390_CPU(dev); CPUState *cs = CPU(dev); name = g_strdup_printf("cpu[%i]", cpu->env.cpu_num); object_property_set_link(OBJECT(hotplug_dev), OBJECT(cs), name, errp); g_free(name); }
1threat
Typescript has unions, so are enums redundant? : <p>Ever since TypeScript introduced unions types, I wonder if there is any reason to declare an enum type. Consider the following enum type declaration:</p> <pre><code>enum X { A, B, C } var x:X = X.A; </code></pre> <p>and a similar union type declaration:</p> <pre><code>type X: "A" | "B" | "C" var x:X = "A"; </code></pre> <p>If they basically serve the same purpose, and unions are more powerful and expressive, then why are enums necessary?</p>
0debug
clearInterval in React : <p>I'm new at React and I was trying to create a simple stopwatch with a start and stop buttons. I'm banging my head against the wall to try to clearInterval with an onClick event on Stop button. I would declare a variable for the setInterval and then would clear it using the clearInterval. Unfortunately it is not working. Any tips? Thank you in advance.</p> <pre><code>import React, { Component } from 'react'; class App extends Component { constructor(props){ super(props); this.state = {time:0} this.startHandler = this.startHandler.bind(this); } getSeconds(time){ return `0${time%60}`.slice(-2); } getMinutes(time){ return Math.floor(time/60); } startHandler() { setInterval(()=&gt;{ this.setState({time:this.state.time + 1}); },1000) } stopHandler() { //HOW TO CLEAR INTERVAL HERE???? } render () { return ( &lt;div&gt; &lt;h1&gt;{this.getMinutes(this.state.time)}:{this.getSeconds(this.state.time)}&lt;/h1&gt; &lt;button onClick = {this.startHandler}&gt;START&lt;/button&gt; &lt;button onClick = {this.stopHandler}&gt;STOP&lt;/button&gt; &lt;button&gt;RESET&lt;/button&gt; &lt;/div&gt; ); } } export default App; </code></pre>
0debug
window.location.href = 'http://attack.com?user=' + user_input;
1threat
How to open cps (current population survey data) in R : <p>I have a project using CPS data from the NBER, specifically Jan2016 cps file. However, I am having a very difficult time trying to download it and read it into R or stata (I primarily use R). Downloading the data from the web comes as a zip file. I unzip it and it comes into a .dat file. Reading the data in R produces, what looks like binary code (I know its not, but looks like it). Has anyone had to do this? Thanks for your time and help!</p>
0debug
static void gxf_read_index(AVFormatContext *s, int pkt_len) { AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; uint32_t fields_per_map = avio_rl32(pb); uint32_t map_cnt = avio_rl32(pb); int i; pkt_len -= 8; if (s->flags & AVFMT_FLAG_IGNIDX) { avio_skip(pb, pkt_len); return; } if (map_cnt > 1000) { av_log(s, AV_LOG_ERROR, "too many index entries %u (%x)\n", map_cnt, map_cnt); map_cnt = 1000; } if (pkt_len < 4 * map_cnt) { av_log(s, AV_LOG_ERROR, "invalid index length\n"); avio_skip(pb, pkt_len); return; } pkt_len -= 4 * map_cnt; av_add_index_entry(st, 0, 0, 0, 0, 0); for (i = 0; i < map_cnt; i++) av_add_index_entry(st, (uint64_t)avio_rl32(pb) * 1024, i * (uint64_t)fields_per_map + 1, 0, 0, 0); avio_skip(pb, pkt_len); }
1threat
static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset, size_t size) { int64_t len; if (!bdrv_is_inserted(bs)) return -ENOMEDIUM; if (bs->growable) return 0; len = bdrv_getlength(bs); if ((offset + size) > len) return -EIO; return 0; }
1threat
void kvm_arch_remove_all_hw_breakpoints(void) { }
1threat
Custom Listview/Recyclerview in android : I want to implement custom listview in android that has row from smaller to bigger text as below.[![enter image description here][1]][1] [1]: https://i.stack.imgur.com/vugJ9.jpeg If not listview/recyclerview then what other component of android can i use? Any help will be appreciated.
0debug
php am I expecting something thats impossible? : <p>I am a beginner so please be patient with me. I have a website and a database and im looking to achieve the following...</p> <p>A user loads example.com, whilst loading the html page an embedded php script grabs some data from an sql db, prints the data into the page and the user gets shown an sql value within the loaded html page. How is this possible?</p> <p>I have searched all over the net but keep getting examples that echo onto a php page, not an html page. Thanks in advance.</p>
0debug
React: How to run "react-scripts start" with a different root? : <p>For special reasons I want to share the package.json file between two folders <code>web</code> (the react app) and <code>mobile</code>:</p> <pre><code>▸ mobile/ ▸ node_modules/ ▾ web/ ▸ public/ ▸ src/ README.md package-lock.json package.json yarn.lock </code></pre> <p>In my package.json file I've added this: <code>"web-start": "react-scripts start",</code> under scripts. However, when I run it in the root folder (<code>/Users/edmund/Documents/src/banana-client</code>) I get this:</p> <pre><code>➜ banana-client git:(master) ✗ yarn web-start yarn web-start v0.24.6 $ react-scripts start web Could not find a required file. Name: index.html Searched in: /Users/edmund/Documents/src/banana-client/public error Command failed with exit code 1. </code></pre> <p>Is there a way I can add a root directory?</p>
0debug
Genymotion - /usr/lib64/libX11.so.6: undefined symbol: xcb_wait_for_reply64 : <p>I installed Genymotion on openSUSE Leap 42.1 and don't have success to execute. I'm getting the following error:</p> <pre><code>genymotion/genymotion: symbol lookup error: /usr/lib64/libX11.so.6: undefined symbol: xcb_wait_for_reply64 </code></pre> <p>I have no idea what may have caused the problem. Anyone else seen this?</p>
0debug
static void blkdebug_refresh_filename(BlockDriverState *bs, QDict *options) { BDRVBlkdebugState *s = bs->opaque; QDict *opts; const QDictEntry *e; bool force_json = false; for (e = qdict_first(options); e; e = qdict_next(options, e)) { if (strcmp(qdict_entry_key(e), "config") && strcmp(qdict_entry_key(e), "x-image")) { force_json = true; break; } } if (force_json && !bs->file->bs->full_open_options) { return; } if (!force_json && bs->file->bs->exact_filename[0]) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "blkdebug:%s:%s", s->config_file ?: "", bs->file->bs->exact_filename); } opts = qdict_new(); qdict_put_str(opts, "driver", "blkdebug"); QINCREF(bs->file->bs->full_open_options); qdict_put(opts, "image", bs->file->bs->full_open_options); for (e = qdict_first(options); e; e = qdict_next(options, e)) { if (strcmp(qdict_entry_key(e), "x-image")) { qobject_incref(qdict_entry_value(e)); qdict_put_obj(opts, qdict_entry_key(e), qdict_entry_value(e)); } } bs->full_open_options = opts; }
1threat
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
CSS Selector with min-height : <p>Is it possible in CSS3 to create a selector like this?</p> <pre><code>#id(min-height: 300px) { ... } </code></pre> <p>If yes, how can I do it?</p>
0debug
how to redirect home page if invoked login url after once logged in using spring boot security? : Below is my code : @Override protected void configure(HttpSecurity security)throws Exception{ security.csrf().disable(); security .authorizeRequests() .antMatchers("/", "/login","/forgotpassword","/resources/**").permitAll() .anyRequest().authenticated() .and() .formLogin().loginPage("/login").defaultSuccessUrl("/dashboard", true) .permitAll() .and().logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")).logoutSuccessUrl("/login"); }
0debug
need help for fix code in html for oage format : hello i need my page to look like this [this what im trying to do][1] but thats what i got [enter image description here][2] thats the whole page i hope i can get a help with it i have a problem with layout and color of navigation and the picture up is at the top left i tried to work at it and took hours and i cant reach any result with it [1]: https://i.stack.imgur.com/I8pt1.jpg [2]: https://i.stack.imgur.com/7r0HH.jpg <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"/> <title>Digital Cloud</title> <style type="text/css"> #container{ width: 800px; height: 700px; background-color: white; margin-left: auto; margin-right: auto; position: fixed; top: 20%; left: 30%; } #logo{ margin-top:15px; width: 200px; height: 200px; } #ending{ float: right; text-align: center; margin: 120px; } #navigation{ background-color: #3c99dc; float:left; margin-left: 5px; margin-bottom: 15px; font-size: 20px; width: 190px; height: 50px; text-align: center; } #content{ text-align: center; } #text{ float: left; margin-bottom: 10px; } img{ width: 260px; height: 150px; float: left; } #texting{ width: 258px; height: 200px; float: left; margin-left: 6px; margin-bottom: 7px; margin-left: 3px; } #description{ text-align: center; font-size: 14px; } </style> </head> <body> <div id="logo"> <h1><img src="images/logo.jpeg" alt="logo" /></h1> </div> <div id="container"> <div id="navigation"> <div id="nav01"> <nav> <a href="#"> Business </a></nav> </div> </div> <div id="navigation"> <div id="nav01"> <nav> <a href="#"> Pricing </a></nav> </div> </div> <div id="navigation"> <div id="nav01"> <nav> <a href="#"> Community </a> </nav> </div> </div> <div id="navigation"> <div id="nav01"> <nav> <a href="#"> Help </a> </nav> </div> </div> <div id="content"> <h1>Droplets</h1> <p>We rent out easy-to-deploy and resizable cloud servers.</p> <h2>Deploy in 55 seconds</h2> </div> <div id="textimg"> <div id="texting"> <h3>1. Select an image or app</h3> <p><img src="images/image.jpeg" alt="Representative picture of server's image" /></p> <div id="description"> <p>Choose from our library of distros and apps, or create a Droplet from a snapshot.</p> </div> </div> <div id="texting"> <h3>2. Choose a size</h3> <p><img src="images/size.jpeg" alt="Representative picture of server's size" /></p> <div id="description"> <p>Select a Droplet size based on the resources you need. You can resize at any time from the control panel.</p> </div></div> <div id="texting"> <h3>3. Select a region</h3> <p><img src="images/region.jpeg" alt="Representative picture of server's region" /></p> <div id="description"> <p>Deploy your Droplet to any of our datacenter locations around the world.</p> </div> </div> </div> <div id="ending"> <em>48,087,734 DROPLETS LAUNCHED</em> <em>&copy; COPYRIGHT 2017 DIGITAL CLOUD INC.</em> </div> </body> </html> <!-- end snippet -->
0debug
How to rename the coefficients in the summary() of a lm in R? : <p>I have many interaction terms, and I want to have the name of these coefficients, which will be output to LaTeX, not be so cumbersome.</p> <p>I do not want to generate all the interactions in my data frame beforehand, that is a big nuisance. </p>
0debug
How can I fix when logging out from user page I am getting logged out from admin page aswell? : <p>I am creating a website with user login and admin login but the problem is when I logout if I logout from user page or admin page it logouts from the other page too the reason is because when I logout I use <code>session_destroy()</code>but how can I fix this problem should I do something else instead of <code>session_destroy()</code> ? </p>
0debug
ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq, DriveInfo *hd0, DriveInfo *hd1) { DeviceState *dev; ISADevice *isadev; ISAIDEState *s; isadev = isa_create(bus, TYPE_ISA_IDE); dev = DEVICE(isadev); qdev_prop_set_uint32(dev, "iobase", iobase); qdev_prop_set_uint32(dev, "iobase2", iobase2); qdev_prop_set_uint32(dev, "irq", isairq); if (qdev_init(dev) < 0) { return NULL; } s = ISA_IDE(dev); if (hd0) { ide_create_drive(&s->bus, 0, hd0); } if (hd1) { ide_create_drive(&s->bus, 1, hd1); } return isadev; }
1threat
qcrypto_tls_creds_x509_unload(QCryptoTLSCredsX509 *creds) { if (creds->data) { gnutls_certificate_free_credentials(creds->data); creds->data = NULL;
1threat
How should I tokenize broken URL's and incomplete words given in a text? : I have a text file containing broken url's like > http > images5fanpopcomimagephotos29000000ichigowallpaperkurosakiichigo290694271024768jpg and > https > smediacacheak0pinimgcomoriginals1219ed1219ed717fc2bfce372759bba2fe1cfegif and words like nt (for not), s (for is). I am confused as to how to form tokens for these strings or words. Can someone suggest a solution ? Sorry for the bad formatting !!
0debug
Compare dates between start date and end date with two dataframe in python : I have two data frames. Both are different shapes. First Dataframe:- ``` start_date end_date id 01 15/03/19 15:30 31/03/19 15:30 11 02 31/03/19 15:30 15/04/19 15:30 12 03 15/04/19 15:30 30/04/19 15:30 13 ``` Second data frame:- ``` item_id puchase_at amount 0 100 15/03/19 15:33 149 1 200 8/04/19 15:47 4600 2 300 17/04/19 15:31 8200 3 400 20/04/19 16:00 350 ``` I want the expected output:- ``` item_id purchase_at amount id 0 100 15/03/19 15:33 149 11 1 200 8/04/19 15:47 4600 12 2 300 17/04/19 15:31 8200 13 3 400 20/04/19 16:00 350 13 ``` how to get it expected output?
0debug
static bool xen_host_pci_dev_is_virtfn(XenHostPCIDevice *d) { char path[PATH_MAX]; struct stat buf; if (xen_host_pci_sysfs_path(d, "physfn", path, sizeof (path))) { return false; } return !stat(path, &buf); }
1threat
Scraping searchable online dictionary : <p>and thanks in advance! I was hoping someone might be able to point me in the right direction as to how to scrape a searchable online database. Here is the url: <a href="https://hord.ca/projects/eow/" rel="nofollow noreferrer">https://hord.ca/projects/eow/</a>. If possible, I'd like to be able to access all of the data from the site's database, I'm just not sure how to access it using bs4... Maybe bs4 isn't the answer here though. Still a relatively new Pythonista, any help is greatly appreciated!</p>
0debug
How to disable Firebase/Core debug messages in iOS : <p>I get several debug messages from Firebase - quite chatty:</p> <pre><code>2016-10-20 22:18:33.576 Sitch[1190] &lt;Debug&gt; [Firebase/Core][I-COR000019] Clearcut post completed </code></pre> <p>I don't see any way to quiet them. FIRAnalytics only shows INFO and more severe but Firebase/Core seems to have debug enabled by default?</p> <p>This is the cocoapods build - from podfile.lock:</p> <pre><code>FirebaseCore (3.4.3): GoogleInterchangeUtilities (~&gt; 1.2) GoogleUtilities (~&gt; 1.2) </code></pre>
0debug
Bokeh: Models must be owned by only a single document : <p>I'm working with <a href="http://bokeh.pydata.org" rel="noreferrer">Bokeh</a> 0.12.2 in a Jupyter notebook and it frequently throws exceptions about "Models must be owned by only a single document":</p> <pre><code>--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) &lt;ipython-input-23-f50ac7abda5e&gt; in &lt;module&gt;() 2 ea.legend.label_text_font_size = '10pt' 3 ----&gt; 4 show(column([co2, co, nox, o3])) C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\io.py in show(obj, browser, new, notebook_handle) 308 ''' 309 if obj not in _state.document.roots: --&gt; 310 _state.document.add_root(obj) 311 return _show_with_state(obj, _state, browser, new, notebook_handle=notebook_handle) 312 C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\document.py in add_root(self, model) 443 self._roots.append(model) 444 finally: --&gt; 445 self._pop_all_models_freeze() 446 self._trigger_on_change(RootAddedEvent(self, model)) 447 C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\document.py in _pop_all_models_freeze(self) 343 self._all_models_freeze_count -= 1 344 if self._all_models_freeze_count == 0: --&gt; 345 self._recompute_all_models() 346 347 def _invalidate_all_models(self): C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\document.py in _recompute_all_models(self) 367 d._detach_document() 368 for a in to_attach: --&gt; 369 a._attach_document(self) 370 self._all_models = recomputed 371 self._all_models_by_name = recomputed_by_name C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\model.py in _attach_document(self, doc) 89 '''This should only be called by the Document implementation to set the document field''' 90 if self._document is not None and self._document is not doc: ---&gt; 91 raise RuntimeError("Models must be owned by only a single document, %r is already in a doc" % (self)) 92 doc.theme.apply_to_model(self) 93 self._document = doc RuntimeError: Models must be owned by only a single document, &lt;bokeh.models.tickers.DaysTicker object at 0x00000000042540B8&gt; is already in a doc </code></pre> <p>The trigger is always calling <code>show(...)</code> (although never the first time after kernel start-up, only subsequent calls). </p> <p>Based on the docs, I thought <code>reset_output()</code> would return my notebook to an operable state but the exception persists. Through trial-and-error, I've determined it's necessary to also re-define everything being passing to <code>show()</code>. That makes interactive work cumbersome and error-prone.</p> <p>[<a href="http://bokeh.pydata.org/en/latest/docs/reference/io.html#bokeh.io.reset_output" rel="noreferrer">Ref</a>]:</p> <blockquote> <p><strong>reset_output(state=None)</strong></p> <p>&emsp;&emsp;Clear the default state of all output modes.</p> <p>&emsp;&emsp;<strong>Returns:</strong> None</p> </blockquote> <hr> <ul> <li><p>Am I right about <code>reset_output()</code> -- is it supposed to resolve the situation causing this exception?</p></li> <li><p>Else, how do I avoid this kind of exception?</p></li> </ul>
0debug
static int32_t scsi_send_command(SCSIRequest *req, uint8_t *cmd) { SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev, req->dev); SCSIGenericReq *r = DO_UPCAST(SCSIGenericReq, req, req); int ret; scsi_req_enqueue(req); if (cmd[0] != REQUEST_SENSE && (req->lun != s->lun || (cmd[1] >> 5) != s->lun)) { DPRINTF("Unimplemented LUN %d\n", req->lun ? req->lun : cmd[1] >> 5); s->sensebuf[0] = 0x70; s->sensebuf[1] = 0x00; s->sensebuf[2] = ILLEGAL_REQUEST; s->sensebuf[3] = 0x00; s->sensebuf[4] = 0x00; s->sensebuf[5] = 0x00; s->sensebuf[6] = 0x00; s->senselen = 7; s->driver_status = SG_ERR_DRIVER_SENSE; r->req.status = CHECK_CONDITION; scsi_req_complete(&r->req); return 0; } if (-1 == scsi_req_parse(&r->req, cmd)) { BADF("Unsupported command length, command %x\n", cmd[0]); scsi_req_dequeue(&r->req); scsi_req_unref(&r->req); return 0; } scsi_req_fixup(&r->req); DPRINTF("Command: lun=%d tag=0x%x len %zd data=0x%02x", lun, tag, r->req.cmd.xfer, cmd[0]); #ifdef DEBUG_SCSI { int i; for (i = 1; i < r->req.cmd.len; i++) { printf(" 0x%02x", cmd[i]); } printf("\n"); } #endif if (r->req.cmd.xfer == 0) { if (r->buf != NULL) qemu_free(r->buf); r->buflen = 0; r->buf = NULL; ret = execute_command(s->bs, r, SG_DXFER_NONE, scsi_command_complete); if (ret == -1) { scsi_command_complete(r, -EINVAL); } return 0; } if (r->buflen != r->req.cmd.xfer) { if (r->buf != NULL) qemu_free(r->buf); r->buf = qemu_malloc(r->req.cmd.xfer); r->buflen = r->req.cmd.xfer; } memset(r->buf, 0, r->buflen); r->len = r->req.cmd.xfer; if (r->req.cmd.mode == SCSI_XFER_TO_DEV) { r->len = 0; return -r->req.cmd.xfer; } else { return r->req.cmd.xfer; } }
1threat
Why we use const and & in this function declaration? : <p>I am new to C++. Wondering what is const and &amp; in the function doing and its meaning.</p> <pre><code>MatrixXd CalculateJacobian(const VectorXd&amp; x_state) { //blah blah } </code></pre>
0debug
Can two android application running on different machines have same database : I have two android applications running on different machines data between them has to be same which is stored in there sqlite database. What i need to do is just same as pos machines in big stores or stores like KFC or Mc Donalds . If a store has stock of 4 quantity and machine a sells 4 quantity second machine should not be able to sell it. Please help me.
0debug
Assert Statement for ternary operator in Rhino mocks? : <pre><code>x(string)= y(string) != ? y : string.empty </code></pre> <p>How to get 100% code coverage for above line using Assert statement</p> <p>We've tried using: Assert.AreEqual(Actualvalue,ExpectedValue); but we are missing code coverage somewhere</p>
0debug
static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c) { #if HAVE_7REGS && (TEMPLATE_PP_MMXEXT || TEMPLATE_PP_3DNOW) DECLARE_ALIGNED(8, uint64_t, tmp)[3]; __asm__ volatile( "pxor %%mm6, %%mm6 \n\t" "pcmpeqb %%mm7, %%mm7 \n\t" "movq %2, %%mm0 \n\t" "punpcklbw %%mm6, %%mm0 \n\t" "psrlw $1, %%mm0 \n\t" "psubw %%mm7, %%mm0 \n\t" "packuswb %%mm0, %%mm0 \n\t" "movq %%mm0, %3 \n\t" "lea (%0, %1), %%"REG_a" \n\t" "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t" #undef REAL_FIND_MIN_MAX #undef FIND_MIN_MAX #if TEMPLATE_PP_MMXEXT #define REAL_FIND_MIN_MAX(addr)\ "movq " #addr ", %%mm0 \n\t"\ "pminub %%mm0, %%mm7 \n\t"\ "pmaxub %%mm0, %%mm6 \n\t" #else #define REAL_FIND_MIN_MAX(addr)\ "movq " #addr ", %%mm0 \n\t"\ "movq %%mm7, %%mm1 \n\t"\ "psubusb %%mm0, %%mm6 \n\t"\ "paddb %%mm0, %%mm6 \n\t"\ "psubusb %%mm0, %%mm1 \n\t"\ "psubb %%mm1, %%mm7 \n\t" #endif #define FIND_MIN_MAX(addr) REAL_FIND_MIN_MAX(addr) FIND_MIN_MAX((%%REGa)) FIND_MIN_MAX((%%REGa, %1)) FIND_MIN_MAX((%%REGa, %1, 2)) FIND_MIN_MAX((%0, %1, 4)) FIND_MIN_MAX((%%REGd)) FIND_MIN_MAX((%%REGd, %1)) FIND_MIN_MAX((%%REGd, %1, 2)) FIND_MIN_MAX((%0, %1, 8)) "movq %%mm7, %%mm4 \n\t" "psrlq $8, %%mm7 \n\t" #if TEMPLATE_PP_MMXEXT "pminub %%mm4, %%mm7 \n\t" "pshufw $0xF9, %%mm7, %%mm4 \n\t" "pminub %%mm4, %%mm7 \n\t" "pshufw $0xFE, %%mm7, %%mm4 \n\t" "pminub %%mm4, %%mm7 \n\t" #else "movq %%mm7, %%mm1 \n\t" "psubusb %%mm4, %%mm1 \n\t" "psubb %%mm1, %%mm7 \n\t" "movq %%mm7, %%mm4 \n\t" "psrlq $16, %%mm7 \n\t" "movq %%mm7, %%mm1 \n\t" "psubusb %%mm4, %%mm1 \n\t" "psubb %%mm1, %%mm7 \n\t" "movq %%mm7, %%mm4 \n\t" "psrlq $32, %%mm7 \n\t" "movq %%mm7, %%mm1 \n\t" "psubusb %%mm4, %%mm1 \n\t" "psubb %%mm1, %%mm7 \n\t" #endif "movq %%mm6, %%mm4 \n\t" "psrlq $8, %%mm6 \n\t" #if TEMPLATE_PP_MMXEXT "pmaxub %%mm4, %%mm6 \n\t" "pshufw $0xF9, %%mm6, %%mm4 \n\t" "pmaxub %%mm4, %%mm6 \n\t" "pshufw $0xFE, %%mm6, %%mm4 \n\t" "pmaxub %%mm4, %%mm6 \n\t" #else "psubusb %%mm4, %%mm6 \n\t" "paddb %%mm4, %%mm6 \n\t" "movq %%mm6, %%mm4 \n\t" "psrlq $16, %%mm6 \n\t" "psubusb %%mm4, %%mm6 \n\t" "paddb %%mm4, %%mm6 \n\t" "movq %%mm6, %%mm4 \n\t" "psrlq $32, %%mm6 \n\t" "psubusb %%mm4, %%mm6 \n\t" "paddb %%mm4, %%mm6 \n\t" #endif "movq %%mm6, %%mm0 \n\t" "psubb %%mm7, %%mm6 \n\t" - min "push %4 \n\t" "movd %%mm6, %k4 \n\t" "cmpb "MANGLE(deringThreshold)", %b4 \n\t" "pop %4 \n\t" " jb 1f \n\t" PAVGB(%%mm0, %%mm7) "punpcklbw %%mm7, %%mm7 \n\t" "punpcklbw %%mm7, %%mm7 \n\t" "punpcklbw %%mm7, %%mm7 \n\t" "movq %%mm7, (%4) \n\t" "movq (%0), %%mm0 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "psllq $8, %%mm1 \n\t" "psrlq $8, %%mm2 \n\t" "movd -4(%0), %%mm3 \n\t" "movd 8(%0), %%mm4 \n\t" "psrlq $24, %%mm3 \n\t" "psllq $56, %%mm4 \n\t" "por %%mm3, %%mm1 \n\t" "por %%mm4, %%mm2 \n\t" "movq %%mm1, %%mm3 \n\t" PAVGB(%%mm2, %%mm1) PAVGB(%%mm0, %%mm1) "psubusb %%mm7, %%mm0 \n\t" "psubusb %%mm7, %%mm2 \n\t" "psubusb %%mm7, %%mm3 \n\t" "pcmpeqb "MANGLE(b00)", %%mm0 \n\t" > a ? 0 : -1 "pcmpeqb "MANGLE(b00)", %%mm2 \n\t" > a ? 0 : -1 "pcmpeqb "MANGLE(b00)", %%mm3 \n\t" > a ? 0 : -1 "paddb %%mm2, %%mm0 \n\t" "paddb %%mm3, %%mm0 \n\t" "movq (%%"REG_a"), %%mm2 \n\t" "movq %%mm2, %%mm3 \n\t" "movq %%mm2, %%mm4 \n\t" "psllq $8, %%mm3 \n\t" "psrlq $8, %%mm4 \n\t" "movd -4(%%"REG_a"), %%mm5 \n\t" "movd 8(%%"REG_a"), %%mm6 \n\t" "psrlq $24, %%mm5 \n\t" "psllq $56, %%mm6 \n\t" "por %%mm5, %%mm3 \n\t" "por %%mm6, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" PAVGB(%%mm4, %%mm3) PAVGB(%%mm2, %%mm3) "psubusb %%mm7, %%mm2 \n\t" "psubusb %%mm7, %%mm4 \n\t" "psubusb %%mm7, %%mm5 \n\t" "pcmpeqb "MANGLE(b00)", %%mm2 \n\t" > a ? 0 : -1 "pcmpeqb "MANGLE(b00)", %%mm4 \n\t" > a ? 0 : -1 "pcmpeqb "MANGLE(b00)", %%mm5 \n\t" > a ? 0 : -1 "paddb %%mm4, %%mm2 \n\t" "paddb %%mm5, %%mm2 \n\t" #define REAL_DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) \ "movq " #src ", " #sx " \n\t" \ "movq " #sx ", " #lx " \n\t" \ "movq " #sx ", " #t0 " \n\t" \ "psllq $8, " #lx " \n\t"\ "psrlq $8, " #t0 " \n\t"\ "movd -4" #src ", " #t1 " \n\t"\ "psrlq $24, " #t1 " \n\t"\ "por " #t1 ", " #lx " \n\t" \ "movd 8" #src ", " #t1 " \n\t"\ "psllq $56, " #t1 " \n\t"\ "por " #t1 ", " #t0 " \n\t" \ "movq " #lx ", " #t1 " \n\t" \ PAVGB(t0, lx) \ PAVGB(sx, lx) \ PAVGB(lx, pplx) \ "movq " #lx ", 8(%4) \n\t"\ "movq (%4), " #lx " \n\t"\ "psubusb " #lx ", " #t1 " \n\t"\ "psubusb " #lx ", " #t0 " \n\t"\ "psubusb " #lx ", " #sx " \n\t"\ "movq "MANGLE(b00)", " #lx " \n\t"\ "pcmpeqb " #lx ", " #t1 " \n\t" \ "pcmpeqb " #lx ", " #t0 " \n\t" \ "pcmpeqb " #lx ", " #sx " \n\t" \ "paddb " #t1 ", " #t0 " \n\t"\ "paddb " #t0 ", " #sx " \n\t"\ \ PAVGB(plx, pplx) \ "movq " #dst ", " #t0 " \n\t" \ "movq " #t0 ", " #t1 " \n\t" \ "psubusb %3, " #t0 " \n\t"\ "paddusb %3, " #t1 " \n\t"\ PMAXUB(t0, pplx)\ PMINUB(t1, pplx, t0)\ "paddb " #sx ", " #ppsx " \n\t"\ "paddb " #psx ", " #ppsx " \n\t"\ "#paddb "MANGLE(b02)", " #ppsx " \n\t"\ "pand "MANGLE(b08)", " #ppsx " \n\t"\ "pcmpeqb " #lx ", " #ppsx " \n\t"\ "pand " #ppsx ", " #pplx " \n\t"\ "pandn " #dst ", " #ppsx " \n\t"\ "por " #pplx ", " #ppsx " \n\t"\ "movq " #ppsx ", " #dst " \n\t"\ "movq 8(%4), " #lx " \n\t" #define DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) \ REAL_DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) DERING_CORE((%%REGa) ,(%%REGa, %1) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7) DERING_CORE((%%REGa, %1) ,(%%REGa, %1, 2),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7) DERING_CORE((%%REGa, %1, 2),(%0, %1, 4) ,%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7) DERING_CORE((%0, %1, 4) ,(%%REGd) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7) DERING_CORE((%%REGd) ,(%%REGd, %1) ,%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7) DERING_CORE((%%REGd, %1) ,(%%REGd, %1, 2),%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7) DERING_CORE((%%REGd, %1, 2),(%0, %1, 8) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7) DERING_CORE((%0, %1, 8) ,(%%REGd, %1, 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7) "1: \n\t" : : "r" (src), "r" ((x86_reg)stride), "m" (c->pQPb), "m"(c->pQPb2), "q"(tmp) : "%"REG_a, "%"REG_d ); #else int y; int min=255; int max=0; int avg; uint8_t *p; int s[10]; const int QP2= c->QP/2 + 1; src --; for(y=1; y<9; y++){ int x; p= src + stride*y; for(x=1; x<9; x++){ p++; if(*p > max) max= *p; if(*p < min) min= *p; } } avg= (min + max + 1)>>1; if(max - min <deringThreshold) return; for(y=0; y<10; y++){ int t = 0; if(src[stride*y + 0] > avg) t+= 1; if(src[stride*y + 1] > avg) t+= 2; if(src[stride*y + 2] > avg) t+= 4; if(src[stride*y + 3] > avg) t+= 8; if(src[stride*y + 4] > avg) t+= 16; if(src[stride*y + 5] > avg) t+= 32; if(src[stride*y + 6] > avg) t+= 64; if(src[stride*y + 7] > avg) t+= 128; if(src[stride*y + 8] > avg) t+= 256; if(src[stride*y + 9] > avg) t+= 512; t |= (~t)<<16; t &= (t<<1) & (t>>1); s[y] = t; } for(y=1; y<9; y++){ int t = s[y-1] & s[y] & s[y+1]; t|= t>>16; s[y-1]= t; } for(y=1; y<9; y++){ int x; int t = s[y-1]; p= src + stride*y; for(x=1; x<9; x++){ p++; if(t & (1<<x)){ int f= (*(p-stride-1)) + 2*(*(p-stride)) + (*(p-stride+1)) +2*(*(p -1)) + 4*(*p ) + 2*(*(p +1)) +(*(p+stride-1)) + 2*(*(p+stride)) + (*(p+stride+1)); f= (f + 8)>>4; #ifdef DEBUG_DERING_THRESHOLD __asm__ volatile("emms\n\t":); { static long long numPixels=0; if(x!=1 && x!=8 && y!=1 && y!=8) numPixels++; if(max-min < 20){ static int numSkipped=0; static int errorSum=0; static int worstQP=0; static int worstRange=0; static int worstDiff=0; int diff= (f - *p); int absDiff= FFABS(diff); int error= diff*diff; if(x==1 || x==8 || y==1 || y==8) continue; numSkipped++; if(absDiff > worstDiff){ worstDiff= absDiff; worstQP= QP; worstRange= max-min; } errorSum+= error; if(1024LL*1024LL*1024LL % numSkipped == 0){ av_log(c, AV_LOG_INFO, "sum:%1.3f, skip:%d, wQP:%d, " "wRange:%d, wDiff:%d, relSkip:%1.3f\n", (float)errorSum/numSkipped, numSkipped, worstQP, worstRange, worstDiff, (float)numSkipped/numPixels); } } } #endif if (*p + QP2 < f) *p= *p + QP2; else if(*p - QP2 > f) *p= *p - QP2; else *p=f; } } } #ifdef DEBUG_DERING_THRESHOLD if(max-min < 20){ for(y=1; y<9; y++){ int x; int t = 0; p= src + stride*y; for(x=1; x<9; x++){ p++; *p = FFMIN(*p + 20, 255); } } } #endif #endif }
1threat
Use a lambda as a parameter for a C++ function : <p>I would like to use a lambda as a parameter for a C++ function, but I don't know which type to specify in the function declaration. What I would like to do is this:</p> <pre><code>void myFunction(WhatToPutHere lambda){ //some things } </code></pre> <p>I have tried <code>void myFunction(auto lambda)</code> and <code>void myFunction(void lambda)</code> but none of these codes compiled. In case it matters, the lambda doesn't return anything.</p> <p>How can I use a lambda as a parameter in a C++ function?</p>
0debug
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
document.getElementById('input').innerHTML = user_input;
1threat
Removing raws based on a vector : Given a matrix (m), I want to remove from it the subjects given by a changing vector, I am trying to do a loop but it does only remove the first input: m= matrix(1:4,10,3); changing_vector = c(2,1) or c(1,4) # etc.. for(j in 1:length(changing_vector )) { a = subData[(subData$subject== changing_vector [j]),] } Someone know why it does not work? Do you propose any other way to do it? Thanks in advance for your help, G.
0debug
difference of lenght - JTextField/date : I have an error type difference of lenght. Why? {private void txtMoisActionPerformed(ActionEvent e) { java.util.Date date1 = jDateChooserDateDebut.getDate(); java.util.Date date2 = jDateChooserDateFin.getDate(); long CONST_DURATION_OF_DAY = 1000l * 60 * 60 * 24; long diff = Math.abs(date2.getTime() - date1.getTime()); long numberOfMonths = diff/CONST_DURATION_OF_DAY; txtMois.setText() = this.numberOfMonts; affiche ("txtMois" + numberOfMonths); }
0debug
Matching line items for bank reconcilition : I am preparing bank reconciliation file to match the negative value with a positive one. in below table there are negative values which need to be reconciled/match with the positive one. for example A4 (5076) is the sum of negative value A2+A6+A8 (-5076) which are reconciling each other and making zero. i want a excel coding which reconcile all the positive values with the negative values. please help A B 1 -5425 2 -4125 3 -2632 4 5076 5 -222 6 -906 7 8279 8 -45 9 -254 10 -542
0debug
alert('Hello ' + user_input);
1threat
What is difference between hadoop and hdfs command line tools? : <p>I see that <code>hadoop</code> and <code>hdfs</code> command line tools can perform identical operations. For example I can run <code>example.jar</code> using</p> <pre><code>hadoop jar example.jar </code></pre> <p>And the same using</p> <pre><code>hdfs -jar example.jar </code></pre> <p>What is difference between these two command line tools?</p>
0debug
Get Json data with POST request from website API : <p>How can I get Json information from a website API in javascript?</p> <p>I need to get quotes text from this website <a href="http://forismatic.com/en/api/" rel="nofollow noreferrer">http://forismatic.com/en/api/</a> to put in my quotes generator page. I think I kinda of get how to great GET requests, but from my understanding this API requires POST requests.</p> <p>If you have any idea, could you also direct me to the explanation of the code you've written, because I'd also like to understand the underlying logic.</p> <p>Thanks!</p>
0debug
SQL DOESNT ALLOWE ME TO INSERT DATA : creating table and inserting data into a table and now it giving me an error SQL Error: ORA-02291: integrity constraint (S21403051.SYS_C007300) violated - parent key not found 02291. 00000 - "integrity constraint (%s.%s) violated - parent key not found" *Cause: CREATE TABLE CUSTOMER( CUSTOMER_ID VARCHAR(10) PRIMARY KEY, FIRST_NAME VARCHAR(10), SURNAME VARCHAR(15), CUSTOMER_TEL VARCHAR(12), CUSTOMER_EMAIL VARCHAR(30) ) INSERT INTO CUSTOMER_CRUISES VALUES ( 'CRUISE_1', 'CUST_102', 'EMP_51'); INSERT INTO CUSTOMER_CRUISES VALUES ( 'CRUISE_3','CUST_101','EMP_51'); INSERT INTO CUSTOMER_CRUISES VALUES ( 'CRUISE_3','CUST_101','EMP_53'); INSERT INTO CUSTOMER_CRUISES VALUES ( 'CRUISE_5','CUST_103','EMP_54'); INSERT INTO CUSTOMER_CRUISES VALUES ( 'CRUISE_5','CUST_107','EMP_54'); INSERT INTO CUSTOMER_CRUISES VALUES ( 'CRUISE_1', 'CUST_106','EMP_55'); INSERT INTO CUSTOMER_CRUISES VALUES ( 'CRUISE_1','CUST_108','EMP_55'); INSERT INTO CUSTOMER_CRUISES VALUES ( 'CRUISE_5','CUST_104','EMP_51'); INSERT INTO CUSTOMER_CRUISES VALUES ( 'CRUISE_3','CUST_109','EMP_51'); INSERT INTO CUSTOMER_CRUISES VALUES ( 'CRUISE_2','CUST_1010','EMP_52'); INSERT INTO CUSTOMER_CRUISES VALUES ( 'CRUISE_2','CUST_1010','EMP_55'); INSERT INTO CUSTOMER_CRUISES VALUES ( 'CRUISE_5','CUST_101','EMP_51'); INSERT INTO CUSTOMER_CRUISES VALUES ( 'CRUISE_5','CUST_103','EMP_51'); IT GIVE ME ERROR SQL Error: ORA-02291: integrity constraint (S21403051.SYS_C007300) violated - parent key not found 02291. 00000 - "integrity constraint (%s.%s) violated - parent key not found" *Cause:
0debug
JAVA. I'm moving jar file to other PC then the program not showing image : JAVA. I'm finished project, done compilation. Runing the Jar file, program is working. If I'm moving jar file to other PC then the program not showing image and not showing information from txt files. I thinking this is from wrang path's. Can you help me? This some code: FileInputStream fr2 = new FileInputStream("C:\\Users\\Nickolskiy\\IdeaProjects\\DeutcheCard\\src\\com\\2.txt"); BufferedReader br2 = new BufferedReader (new InputStreamReader(fr2, "Cp1251"));
0debug
How to make Back Color transperent ON VB.Net : i've got a weird problem i've tried make Transparent color in vb.net but i cannot using following code: Me.BackColor = System.Drawing.Color.Transparent But any other color is working fine for example: Me.BackColor = System.Drawing.Color.Lime but when tring set it in properties to transparent i get following error from debugger: http://prntscr.com/f54sbb any help guys?
0debug
pass PHP variable to javascript value : <p>I want to display my PHP variable to JavaScript value Here is my PHP and javascript code. </p> <pre><code>&lt;?php $text = "Rates are subject to change without prior notice"; ?&gt; &lt;script&gt; $('#typewriter').typewriter({ prefix : "*** ", text : ["Rates are subject to change without prior notice"], typeDelay : 50, waitingTime : 1500, blinkSpeed : 200 }); &lt;/script&gt; </code></pre> <p>inside the text parameter i want to pass my PHP variable.</p>
0debug
Angular2 Lazy Loading Service being Instantiated Twice : <p>I just switched my application over to be lazy-loaded today.<br> I have a <code>SharedModule</code> that exports a bunch of services. In my <code>AppModule</code>, I import <code>SharedModule</code> because <code>AppComponent</code> needs access to a few of the shared services. </p> <p>In another module <code>FinalReturnModule</code>, I import <code>SharedModule</code>. In one of my services, I put a <code>console.log('hi')</code> in the constructor. </p> <p>When the app first loads, I get <code>hi</code> to the console. Whenever I navigate to a page within the <code>FinalReturnModule</code> I get <code>hi</code> again. Obviously, since there are two instances, nothing's working correctly since the modules aren't able to communicate. </p> <p>How can I stop the service from being instantiated twice? </p> <p>EDIT: Background, the app is built using angular-cli.</p> <p>Current versions:</p> <pre><code>angular-cli: 1.0.0-beta.24 node: 6.9.1 os: win32 ia32 @angular/common: 2.4.1 @angular/compiler: 2.4.1 @angular/core: 2.4.1 @angular/forms: 2.4.1 @angular/http: 2.4.1 @angular/platform-browser: 2.4.1 @angular/platform-browser-dynamic: 2.4.1 @angular/router: 3.1.1 @angular/compiler-cli: 2.4.1 </code></pre>
0debug
Nodejs worker threads shared object/store : <p>So, I was reading some stuff regarding nodejs and I was amazed when I came across <a href="https://nodejs.org/api/worker_threads.html" rel="noreferrer">Worker Threads</a>. </p> <p>Having threads in my opinion is a great plus especially if you combine it with shared memory access. As you might think already -> <code>SharedArrayBuffer</code>... </p> <p>Yeap that's what I thought. So The first thing that came into my mind was to give it a little test and try to implement a simple <code>store</code> (a simple object for now) that would be shared among the threads.</p> <p>The question is, (unless I'm missing something here) how can you make an object accessible from n threads with the use of <code>SharedArrayBuffer</code>? </p> <p>I know that for a simple <code>Uint32Array</code> is doable, but regarding the object what can be done? </p> <p>At first I thought to convert it to a <code>Uint32Array</code> as you may see bellow, but even looking at the damn source code makes me wanna cry...</p> <pre><code>const { Worker, isMainThread, workerData } = require('worker_threads'); const store = { ks109: { title: 'some title 1', description: 'some desciption 1', keywords: ['one', 'two'] }, ks110: { title: 'some title 2', description: 'some desciption 2', keywords: ['three', 'four'] }, ks111: { title: 'some title 3', description: 'some desciption 3', keywords: ['five', 'six'] } } const shareObject = (obj) =&gt; { let OString = JSON.stringify(obj); let SABuffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * OString.length); let sArray = new Int32Array(SABuffer); for (let i = 0; i &lt; OString.length; i++) { sArray[i] = OString.charCodeAt(i); } return sArray; } if (isMainThread) { const sharedStore = shareObject(store); console.log('[Main][Data Before]:', sharedStore.slice(-10)); let w = new Worker(__filename, { workerData: sharedStore }); w.on('message', (msg) =&gt; { console.log(`[Main][Thread message]: ${msg}`); }); w.on('error', (err) =&gt; { console.error(`[Main][Thread error] ${err.message}`); }); w.on('exit', (code) =&gt; { if (code !== 0) { console.error(`[Main][Thread unexpected exit]: ${code}`); } }); setInterval(() =&gt; { // At some point you ll see a value change, // it's 'six' becoming 'sax' (big time!) console.log('[Main][Data Check]:', sharedStore.slice(-10)); }, 1000); } else { let str = String.fromCharCode.apply(this, workerData); let obj = JSON.parse(str); obj.ks111.keywords[1] = 'sax'; // big time! let OString = JSON.stringify(obj); for (let i = 0; i &lt; OString.length; i++) { workerData[i] = OString.charCodeAt(i); } } </code></pre> <p>In conclusion, shared object among threads in nodejs 10.5.0, is it possible? how?</p>
0debug
how do i put a condition on one of the columns in sql in android studio? : I have a column named expense and I want the user to input expense and for a month that expense to get added in the expense column of the database and then whenever I output the user expense it displays the whole sum of expenses that user has entered on button click. please help me with the code I'm a noob.
0debug
void ff_rfps_calculate(AVFormatContext *ic) { int i, j; for (i = 0; i < ic->nb_streams; i++) { AVStream *st = ic->streams[i]; if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO) continue; if (tb_unreliable(st->codec) && st->info->duration_count > 15 && st->info->duration_gcd > FFMAX(1, st->time_base.den/(500LL*st->time_base.num)) && !st->r_frame_rate.num) av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * st->info->duration_gcd, INT_MAX); if (st->info->duration_count>1 && !st->r_frame_rate.num && tb_unreliable(st->codec)) { int num = 0; double best_error= 0.01; AVRational ref_rate = st->r_frame_rate.num ? st->r_frame_rate : av_inv_q(st->time_base); for (j= 0; j<MAX_STD_TIMEBASES; j++) { int k; if (st->info->codec_info_duration && st->info->codec_info_duration*av_q2d(st->time_base) < (1001*12.0)/get_std_framerate(j)) continue; if (!st->info->codec_info_duration && 1.0 < (1001*12.0)/get_std_framerate(j)) continue; if (av_q2d(st->time_base) * st->info->rfps_duration_sum / st->info->duration_count < (1001*12.0 * 0.8)/get_std_framerate(j)) continue; for (k= 0; k<2; k++) { int n = st->info->duration_count; double a= st->info->duration_error[k][0][j] / n; double error= st->info->duration_error[k][1][j]/n - a*a; if (error < best_error && best_error> 0.000000001) { best_error= error; num = get_std_framerate(j); } if (error < 0.02) av_log(ic, AV_LOG_DEBUG, "rfps: %f %f\n", get_std_framerate(j) / 12.0/1001, error); } } if (num && (!ref_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(ref_rate))) av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX); } if ( !st->avg_frame_rate.num && st->r_frame_rate.num && st->info->rfps_duration_sum && st->info->codec_info_duration <= 0 && st->info->duration_count > 2 && fabs(1.0 / (av_q2d(st->r_frame_rate) * av_q2d(st->time_base)) - st->info->rfps_duration_sum / (double)st->info->duration_count) <= 1.0 ) { av_log(ic, AV_LOG_DEBUG, "Setting avg frame rate based on r frame rate\n"); st->avg_frame_rate = st->r_frame_rate; } av_freep(&st->info->duration_error); st->info->last_dts = AV_NOPTS_VALUE; st->info->duration_count = 0; st->info->rfps_duration_sum = 0; } }
1threat
void OPPROTO op_subfo (void) { do_subfo(); RETURN(); }
1threat
Black overlay with see through text/image : <p>I would like to achieve the following effect: <a href="https://wildebeest.com.au/" rel="nofollow noreferrer">https://wildebeest.com.au/</a> <a href="https://i.stack.imgur.com/RRuQj.jpg" rel="nofollow noreferrer">enter image description here</a> It is a video background (which i already have) with an black overlay and see through text or image, when hovering over the text/image the video reveals.</p> <p>I have no clue how to make this , i can make a black overlay but not the see through text or hover. I am using wordpress with the divi theme/builder.</p> <p>thank you.</p>
0debug
static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeCmd *cmd) { NvmeCQueue *cq; NvmeCreateCq *c = (NvmeCreateCq *)cmd; uint16_t cqid = le16_to_cpu(c->cqid); uint16_t vector = le16_to_cpu(c->irq_vector); uint16_t qsize = le16_to_cpu(c->qsize); uint16_t qflags = le16_to_cpu(c->cq_flags); uint64_t prp1 = le64_to_cpu(c->prp1); if (!cqid || !nvme_check_cqid(n, cqid)) { return NVME_INVALID_CQID | NVME_DNR; } if (!qsize || qsize > NVME_CAP_MQES(n->bar.cap)) { return NVME_MAX_QSIZE_EXCEEDED | NVME_DNR; } if (!prp1) { return NVME_INVALID_FIELD | NVME_DNR; } if (vector > n->num_queues) { return NVME_INVALID_IRQ_VECTOR | NVME_DNR; } if (!(NVME_CQ_FLAGS_PC(qflags))) { return NVME_INVALID_FIELD | NVME_DNR; } cq = g_malloc0(sizeof(*cq)); nvme_init_cq(cq, n, prp1, cqid, vector, qsize + 1, NVME_CQ_FLAGS_IEN(qflags)); return NVME_SUCCESS; }
1threat
I have to change pseudo code to python 2x please help me convert my pseudo code : Over Produced Management System Add memory library module Prompt; 1)search for item, 2)add over produced item If search for item Prompt input item number If item number in database print available quantity Else print “None available” Else if add over produced item Prompt input item number If item number in database Prompt “how many” Add quantity to inventory Else if item number not in inventory Add item to inventory with quantity
0debug
static void qxl_log_cmd_draw_compat(PCIQXLDevice *qxl, QXLCompatDrawable *draw, int group_id) { fprintf(stderr, ": type %s effect %s", qxl_name(qxl_draw_type, draw->type), qxl_name(qxl_draw_effect, draw->effect)); if (draw->bitmap_offset) { fprintf(stderr, ": bitmap %d", draw->bitmap_offset); qxl_log_rect(&draw->bitmap_area); } switch (draw->type) { case QXL_DRAW_COPY: qxl_log_cmd_draw_copy(qxl, &draw->u.copy, group_id); break; } }
1threat
What is the difference between display:grid and display:inline-grid? : <p>What is the difference between <code>display:grid;</code> and <code>display:inline-grid;</code>?</p> <p>They both have the same effect in this code. Which one is better to use, in this code?</p> <pre><code>&lt;body&gt; &lt;main&gt; &lt;p&gt;box1&lt;/p&gt; &lt;p&gt;box2&lt;/p&gt; &lt;p&gt;box3&lt;/p&gt; &lt;p&gt;box4&lt;/p&gt; &lt;/main&gt; &lt;/body&gt; </code></pre> <hr> <pre><code>* { margin: 0px; padding: 0px; border: 0px; box-sizing: border-box; } main { display: grid; /* Not there */ grid-template-columns: repeat(4, 1fr); grid-template-rows: 100px; grid-gap: 20px; } p { background-color: #eee; /* In there */ display: grid; /* inline-grid */ place-items: center; } </code></pre>
0debug
what is segmantion fault and why this programme showing segmantion fault : #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char c[1000]; int tnum,a,b,d; char *n; scanf("%d",&tnum); while(tnum!=0) { scanf("%[^\n]s",c); n = strtok(c," "); a= atoi(n); n = strtok(NULL," "); b=atoi(n); n = strtok(NULL," "); d = atoi(n); printf("%d\n", a*b*d); tnum--; } return 0; } here i try to get token from a string ,separating by space. But i m getting Segmantion fault. if i run this programme without while loop. it is fine..but why..please can anyone explain?
0debug
Error in a selection sort c++ : I have this action for order array in sort selection method, but this code dont order my array correctly void selectionsort(int* b,int size) { int i, k,menor,posmenor; for(i=0;i<size-1;i++) { posmenor=i; menor=b[i]; for(k=i+1;k<size;k++) { if(b[k]<menor) { menor=b[k]; posmenor=k; } } b[posmenor]=b[i]; b[i]=menor; } } I Dont found the error. Im newbie in c++ Thanks for help.
0debug
com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server : <p>I am very new to the microservices and trying to run the code from link: <a href="https://dzone.com/articles/advanced-microservices-security-with-spring-and-oa" rel="noreferrer">https://dzone.com/articles/advanced-microservices-security-with-spring-and-oa</a> . When I simply run the code I see the following error comes. </p> <p>What is the issue ?</p> <pre><code>com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:111) ~[eureka-client-1.4.12.jar:1.4.12] at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134) ~[eureka-client-1.4.12.jar:1.4.12] at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137) ~[eureka-client-1.4.12.jar:1.4.12] at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77) ~[eureka-client-1.4.12.jar:1.4.12] at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134) ~[eureka-client-1.4.12.jar:1.4.12] at com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry(DiscoveryClient.java:1030) [eureka-client-1.4.12.jar:1.4.12] at com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.java:944) [eureka-client-1.4.12.jar:1.4.12] at com.netflix.discovery.DiscoveryClient.refreshRegistry(DiscoveryClient.java:1468) [eureka-client-1.4.12.jar:1.4.12] at com.netflix.discovery.DiscoveryClient$CacheRefreshThread.run(DiscoveryClient.java:1435) [eureka-client-1.4.12.jar:1.4.12] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.8.0_144] at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_144] at java.lang.Thread.run(Unknown Source) [na:1.8.0_144] 2017-09-09 18:53:11.909 ERROR 16268 --- [tbeatExecutor-0] c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error </code></pre> <p>I have not installed anything special on to the system. Please let me know what do I need to install? </p> <p><a href="https://i.stack.imgur.com/8oWl2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8oWl2.png" alt="enter image description here"></a></p>
0debug
Can't Find Namespace in VS 2017 SDK Docs? : <p>I have the following in a T4 template, (Snippet is from an old tutorial): </p> <pre><code>&lt;#@ import namespace = "Microsoft.VisualStudio.TextTemplating" #&gt; &lt;#+ Engine _engine = new Engine(); #&gt; </code></pre> <p>I can see that the Engine type is part of the Microsoft.VisualStudio.TextTemplating.15.0 Assembly. I'm using VS 2017. When I look through the API's for the Visual Studio 2017 I can't find the namespace... </p> <p>I did find this: <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.texttemplating.engine?view=visualstudiosdk-2015&amp;viewFallbackFrom=visualstudiosdk-2017" rel="nofollow noreferrer">VS 2015 Documentation</a>... Is the Doc for VS2017 not-up to date or am I using something I really shouldn't? Save me from my misery!</p>
0debug
Combining two properties of a object in javascript : <p>I have a object array in javascript. Example:</p> <pre><code>objArr = [{"FirstName":"John","LastName":"Doe","Age":35},{"FirstName":"Jane","LastName":"Doe","Age":32}] </code></pre> <p>I want to create an object array like this</p> <pre><code>newObjArr=[{"Name":"John Doe","Age":35},{"Name":"Jane Doe","Age":32}] </code></pre> <p>How should I do this?</p>
0debug
Getting OVER QUERY LIMIT after one request with geocode : <p>I'm using the ggmap's geocode to find the latitude and longitude of different cities. It worked completely fine yesterday but I get an OVER QUERY LIMIT after only one request today.</p> <p>In fact if I just load the library and run geocode it throws the OVER QUERY LIMIT error:</p> <pre><code>&gt; library(ggmap) &gt; geocode("Paris") Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=Paris&amp;sensor=false lon lat 1 NA NA Warning message: geocode failed with status OVER_QUERY_LIMIT, location = "Paris" </code></pre> <p>I checked different topics on stackoverflow but nobody seems to have the same problem. I tried to see if I was over the 2500 limit (very unlikely but I'm new to coding so maybe I did something wrong...) and geocodeQueryCheck() reads 2498 but then again it resets every time I run library(ggmap).</p> <p>It worked once fifteen minutes ago when I rebooted Rstudio but now it doesn't work anymore, I'm completely lost!</p> <p>Does anyone have any idea what might be the problem?</p> <p>PS: I'm new to stackoverflow so if you have any remark on anything please tell me!</p>
0debug
missing ) after argument list. What am I doing wrong? : <p>multiplayerpiano.com</p> <p>Can I mix JavaScript and jQuery at once?</p> <pre><code>$(document).on("mousemove".function(evt) { if (ebsprite.start = true) { ebsprite.stop()} )} </code></pre>
0debug
find and replace all periods that are not followed by punctuation or a space : <p>I'm trying to format user input using PHP, and am frequently running into issues where there are not spaces between sentences (i.e. after a closing period). This creates problems, as this user input gets professionally printed. If we miss these during a manual QC process, it costs the company money, as it has to be fixed and reprinted.</p> <p>I need to develop a way to search for all periods in a given text string, determine if it's immediately followed by a letter or number, and if so, insert a space after the period. If the period is followed by other punctuation (i.e. a quotation mark, another period as in an ellipsis) or is followed by a space, I want to leave it alone.</p>
0debug
How to create synthetic customer data in python : <p>I have some customer data with me -</p> <pre><code>Name | Age | Gender | Phone Number | Email Id | abc. | 25 | M. | 234 567 890 | example.com| </code></pre> <p>There are 60k rows of data like this and multiple tables. How can I make synthetic data for this dataset using python ?</p> <p>I have no knowledge about this. Any suggestions would be helpful. Thanks!</p>
0debug
How can I sort through JSON in Python : I'm trying to sort through some JSON I get from a webpage and set specific attributes of part of the JSON to variables. Here is an example of the JSON {"name":"Duffle Bag","id":172614...}, {"name":"Backpack","id":172607...} I want to sort through the JSON based on the name, and then pull the id associated with it.
0debug
Match Price with different Currency : Just start learning VBA I want to match the product price with the currency to get a new price No Name Quantity Price Product Currency OrderID Currency $ 1 Tim 5 5 A HKD RX12 HKD 1 2 Alan 6 5 A HKD PR22 USD 7.8 3 Alan 2 6 B USD PR22 CAN 6 4 Bob 3 5 A HKD ED45 5 Bob 8 8 C CAN ED45 6 Tim 10 6 B USD AS63 7 Rose 12 8 C CAN LM36 8 Cathy 15 6 B USD JI48 9 Rose 2 5 A HKD HG54 10 Tim 8 6 B USD VB87 Sub NP() Dim NP, i As Integer NP = Range("L2:L11").Value For i = 1 To 10 P = Cells(4, i) curr = Cells(6, i) If curr = "HKD" Then NP = Range("J2").Value * P ElseIf curr = "USD" Then NP = Range("J3").Value * P Else NP = Range("J4").Value * P End If Next i End Sub
0debug
static int aac_parse_packet(AVFormatContext *ctx, PayloadContext *data, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags) { int ret; if (rtp_parse_mp4_au(data, buf)) return -1; buf += data->au_headers_length_bytes + 2; len -= data->au_headers_length_bytes + 2; if ((ret = av_new_packet(pkt, data->au_headers[0].size)) < 0) return ret; memcpy(pkt->data, buf, data->au_headers[0].size); pkt->stream_index = st->index; return 0; }
1threat
static int count_contiguous_free_clusters(uint64_t nb_clusters, uint64_t *l2_table) { int i; for (i = 0; i < nb_clusters; i++) { int type = qcow2_get_cluster_type(be64_to_cpu(l2_table[i])); if (type != QCOW2_CLUSTER_UNALLOCATED) { break; } } return i; }
1threat
Access - Dmax with multiple criteria : I have an issue in Dmax code which i couldnt fix, please help me to rectify. Max_Rev = DMax("[Rev#]", "SCR_Run", "[JobNumber]=" & Me.JobNumber & "AND [Department]=" & Me.Department) Thanks. Muralidaran.
0debug
static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc) { VirtIONet *n = qemu_get_nic_opaque(nc); VirtIODevice *vdev = VIRTIO_DEVICE(n); RxFilterInfo *info; strList *str_list, *entry; int i; info = g_malloc0(sizeof(*info)); info->name = g_strdup(nc->name); info->promiscuous = n->promisc; if (n->nouni) { info->unicast = RX_STATE_NONE; } else if (n->alluni) { info->unicast = RX_STATE_ALL; } else { info->unicast = RX_STATE_NORMAL; } if (n->nomulti) { info->multicast = RX_STATE_NONE; } else if (n->allmulti) { info->multicast = RX_STATE_ALL; } else { info->multicast = RX_STATE_NORMAL; } info->broadcast_allowed = n->nobcast; info->multicast_overflow = n->mac_table.multi_overflow; info->unicast_overflow = n->mac_table.uni_overflow; info->main_mac = mac_strdup_printf(n->mac); str_list = NULL; for (i = 0; i < n->mac_table.first_multi; i++) { entry = g_malloc0(sizeof(*entry)); entry->value = mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN); entry->next = str_list; str_list = entry; } info->unicast_table = str_list; str_list = NULL; for (i = n->mac_table.first_multi; i < n->mac_table.in_use; i++) { entry = g_malloc0(sizeof(*entry)); entry->value = mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN); entry->next = str_list; str_list = entry; } info->multicast_table = str_list; info->vlan_table = get_vlan_table(n); if (!((1 << VIRTIO_NET_F_CTRL_VLAN) & vdev->guest_features)) { info->vlan = RX_STATE_ALL; } else if (!info->vlan_table) { info->vlan = RX_STATE_NONE; } else { info->vlan = RX_STATE_NORMAL; } nc->rxfilter_notify_enabled = 1; return info; }
1threat
How do I query multiple images with gatsby-image? : <p>I have 16 images that I want to render out onto a website in a grid format.</p> <p>I'm using the following plugins for this:</p> <ul> <li><code>gatsby-image</code></li> <li><code>gatsby-source-filesystem</code></li> <li><code>gatsby-plugin-sharp</code></li> <li><code>gatsby-transformer-sharp</code></li> </ul> <p>I read the documentation and as for as I know, it only demonstrated how to query for one single image.</p> <p>e.g.</p> <pre><code>import React from "react" import { graphql } from "gatsby" import Img from "gatsby-image" export default ({ data }) =&gt; ( &lt;div&gt; &lt;h1&gt;Hello gatsby-image&lt;/h1&gt; &lt;Img fixed={data.file.childImageSharp.fixed} /&gt; &lt;/div&gt; ) export const query = graphql` query { file(relativePath: { eq: "blog/avatars/kyle-mathews.jpeg" }) { childImageSharp { # Specify the image processing specifications right in the query. # Makes it trivial to update as your page's design changes. fixed(width: 125, height: 125) { ...GatsbyImageSharpFixed } } } } ` </code></pre> <p>But how would I go about this if I had 16 images? Writing 16 separate queries seem rather cumbersome and would be difficult to read in the future.</p> <p>I saw this code in the docs referencing multiple images, but I have trouble trying to access the images themselves.</p> <p>e.g.</p> <pre><code>export const squareImage = graphql` fragment squareImage on File { childImageSharp { fluid(maxWidth: 200, maxHeight: 200) { ...GatsbyImageSharpFluid } } } ` export const query = graphql` query { image1: file(relativePath: { eq: "images/image1.jpg" }) { ...squareImage } image2: file(relativePath: { eq: "images/image2.jpg" }) { ...squareImage } image3: file(relativePath: { eq: "images/image3.jpg" }) { ...squareImage } } ` </code></pre> <p>My folder structure is as follows:</p> <p>---package.json</p> <p>---src </p> <p>------images</p> <p>---------the 16 images</p> <p>------pages</p> <p>---------the page where I want to render the 16 images in</p> <p>etc.</p> <p>Thank you.</p>
0debug
How to check if all values of a given array are unique : <p>I need to write a function in JavaScript which would return a boolean after checking if all values of a given array are unique. Examples</p> <pre><code>[1,2,3,4] true [1,2,1,4] false, since the array has value '1' twice </code></pre>
0debug
Ensure template parameter is an enum class : <p>Is there a way to ensure a template parameter is an enum-class type?</p> <p>I know <code>type_traits</code> has <code>std::is_enum</code>, but I don't want it to match regular enums, just enum_classes.</p> <p>Example of the wanted effect:</p> <pre><code>enum class EnumClass {}; enum Enum {}; class Class {}; template &lt;typename T&gt; void Example() { static_assert(/* T is EnumClass */, "`T` must be an enum class"); } Example&lt;EnumClass&gt;(); // Ok Example&lt;Enum&gt;(); // Error Example&lt;Class&gt;(); // Error </code></pre> <p>I am using C++11, and unfortunately cannot go any higher (though I'd be curious to know the solution anyway, even if it involves newer standards).</p> <p>Is it possible?</p>
0debug
While submit job with pyspark, how to access static files upload with --files argument? : <p>for example, i have a folder:</p> <pre><code>/ - test.py - test.yml </code></pre> <p>and the job is submited to spark cluster with:</p> <p><code>gcloud beta dataproc jobs submit pyspark --files=test.yml "test.py"</code></p> <p>in the <code>test.py</code>, I want to access the static file I uploaded.</p> <pre><code>with open('test.yml') as test_file: logging.info(test_file.read()) </code></pre> <p>but got the following exception:</p> <pre><code>IOError: [Errno 2] No such file or directory: 'test.yml' </code></pre> <p>How to access the file I uploaded?</p>
0debug
static void bw_io_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { switch (size) { case 1: cpu_outb(addr, val); break; case 2: cpu_outw(addr, val); break; case 4: cpu_outl(addr, val); break; default: abort(); } }
1threat
What Does Eject do in Create React App? : <p>I think it has something to do with using webpack directly and therefore gives more flexibility. But I'm not completely sure if someone can explain what "ejecting" means. Also what are the ramifications of ejecting a create react app? Is it bad to do this, or?</p>
0debug
How can I get Radio to work on flutter when using dynamic object? : I'm new to flutter and I have issues with Radio. I got it to work perfectly when using the "regular" method: int _groupValue=-1; ... ... child: Align( alignment: Alignment.center, child: Column( children: <Widget>[ RadioListTile(activeColor: Colors.black, groupValue: _groupValue, value: 1, onChanged: (value) { setState(() { _groupValue=value; }); }, title: Text("a"), ), RadioListTile(activeColor: Colors.black, groupValue: _groupValue, value: 2, onChanged: (value) { setState(() { _groupValue=value; }); }, title: Text("b"), ), ], ), ), Since i'm using data from API to create the radio buttons i've changed this code to this: child: Align( alignment: Alignment.center, child: children: radioListView ), ), and on click of a button i call async method to download the data from the API and like this : void getApiData() async { ... ... ... setState() { var radioListView = List<RadioListTile>(); for (Map<String, dynamic> c in apidata)) { radioListView.add(new RadioListTile( groupValue: _groupValue, value: c['option_value'], title: c['title'], onChanged: (value) { setState(() { _groupValue=value; }); ), )); } } } using the first code it works but using the second code i just get to see the items but nothing happens when i click on the radio buttons (although the onchanged does triggers because i tried to print the value and it's fine) what am I doing wrong ?
0debug
static int libquvi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { LibQuviContext *qc = s->priv_data; return av_seek_frame(qc->fmtctx, stream_index, timestamp, flags); }
1threat
What is the equivalent of string in C++ : In Python, there is a type string, which i'm sure most of you will know, just asking what is the equivalent of string in c++
0debug
Store button response : <p>I have two buttons on my screen (1 and 2). I want to be able to store which button is clicked on in a variable and add 5 (if button 1) or subtract 5 (if button 2)to a total score. How do I store which button has been clicked on?</p>
0debug
void qmp_memchar_write(const char *device, int64_t size, const char *data, bool has_format, enum DataFormat format, Error **errp) { CharDriverState *chr; guchar *write_data; int ret; gsize write_count; chr = qemu_chr_find(device); if (!chr) { error_set(errp, QERR_DEVICE_NOT_FOUND, device); return; } if (qemu_is_chr(chr, "memory")) { error_setg(errp,"%s is not memory char device", device); return; } write_count = (gsize)size; if (has_format && (format == DATA_FORMAT_BASE64)) { write_data = g_base64_decode(data, &write_count); } else { write_data = (uint8_t *)data; } ret = cirmem_chr_write(chr, write_data, write_count); if (ret < 0) { error_setg(errp, "Failed to write to device %s", device); return; } }
1threat
int qemu_chr_fe_get_msgfd(CharDriverState *s) { int fd; return (qemu_chr_fe_get_msgfds(s, &fd, 1) >= 0) ? fd : -1; }
1threat
app crashing on adding firebase cloud store : <p>App crashes after flutter build apk and installs into the emulator. I integrated the google services json, and added dependencies in the gradle files as mentioned in the firebase integration doc.</p> <p>I am using using cloud_firestore: ^0.12.9</p> <p>It shows DEX error..</p>
0debug
void s390x_cpu_timer(void *opaque) { S390CPU *cpu = opaque; CPUS390XState *env = &cpu->env; env->pending_int |= INTERRUPT_CPUTIMER; cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD); }
1threat
Why my php code turns to comment? : <p>im tried to write php to my html file, im using wampserver, but when i add php in html it's turns to comment why ? Pls help.</p> <pre><code>&lt;?php echo "hello" ?&gt; </code></pre> <p><strong>turns to comment</strong></p> <pre><code>&lt;--?php echo "hello" ?--&gt; </code></pre>
0debug
static int nbd_handle_list(NBDClient *client, uint32_t length) { int csock; NBDExport *exp; csock = client->sock; if (length) { return nbd_send_rep(csock, NBD_REP_ERR_INVALID, NBD_OPT_LIST); QTAILQ_FOREACH(exp, &exports, next) { if (nbd_send_rep_list(csock, exp)) { return -EINVAL; return nbd_send_rep(csock, NBD_REP_ACK, NBD_OPT_LIST);
1threat
helo translate python code to javascript : I need help to translate this python code to an other language. I would like to convert this python code to javascript: Original code (python) : data = list("\x01\x03\x19 @ \x06\x01\x03\x01\x02\x01\x03\x01\x03\x18\x01\x03\x01\x03\x07\x01\x03\x01\x03\x01\x02\x01\x03\x01\x03\x01\x02\x01\x03\x0eAdministrateur \x01\x03\x01\x03\x01\x03\x01\x03\x17\xb4G\xff\xff\xff\xff\xff\x01\x03\x80\x01\x03 \x01\x03\x08\x04\x86N\x84\x8a\n\x90\x90\x90t\x8e\x80\x01\x03\x01\x02\x01\x03\x01\x03\x01\x02\x01\x03\x04#\xb90\xb22\x99\x18\x18\x10\x01\x03\x01\x03\x01\x03\x01\x03\x0b\xdaC\x0c5\x08:\x98\x01\x03\xc0\x01\x030\x01\x03\x0c\x01\x03C'BE\x05HHH:G\x01\x03\x00") result = "" for id, char in enumerate(data): result+= ord(char)+" " // output // "1 3 25 32 64 32 6 1 3 1 2 1 3 1 3 24 1 3 1 3 7 1 3 1 3 1 2 1 3 1 3 1 2 1 3 14 65 100 109 105 110 105 115 116 114 97 116 101 117 114 32 1 3 1 3 1 3 1 3 23 180 71 255 255 255 255 255 1 3 128 1 3 32 1 3 8 4 134 78 132 138 10 144 144 144 116 142 128 1 3 1 2 1 3 1 3 1 2 1 3 4 35 185 48 178 50 153 24 24 16 1 3 1 3 1 3 1 3 11 218 67 12 53 8 58 152 1 3 192 1 3 48 1 3 12 1 3 67 39 66 69 5 72 72 72 58 71 1 3 0 " // notice at the beggin -> "1 3 25 32 64" I tried (Javascript) : var data = "\x01\x03\x19 @ \x06\x01\x03\x01\x02\x01\x03\x01\x03\x18\x01\x03\x01\x03\x07\x01\x03\x01\x03\x01\x02\x01\x03\x01\x03\x01\x02\x01\x03\x0eAdministrateur \x01\x03\x01\x03\x01\x03\x01\x03\x17\xb4G\xff\xff\xff\xff\xff\x01\x03\x80\x01\x03 \x01\x03\x08\x04\x86N\x84\x8a\n\x90\x90\x90t\x8e\x80\x01\x03\x01\x02\x01\x03\x01\x03\x01\x02\x01\x03\x04#\xb90\xb22\x99\x18\x18\x10\x01\x03\x01\x03\x01\x03\x01\x03\x0b\xdaC\x0c5\x08:\x98\x01\x03\xc0\x01\x030\x01\x03\x0c\x01\x03C'BE\x05HHH:G\x01\x03\x00" data = data.replace("\x02", ""); data = data.replace("\x03", ""); data = data.split('') var result = ""; data.forEach(function(char, id) { result += char.charCodeAt(0) + " "; }); console.trace(result); // output // "1 25 32 64 32 6 1 3 1 1 3 1 3 24 1 3 1 3 7 1 3 1 3 1 2 1 3 1 3 1 2 1 3 14 65 100 109 105 110 105 115 116 114 97 116 101 117 114 32 1 3 1 3 1 3 1 3 23 180 71 255 255 255 255 255 1 3 128 1 3 32 1 3 8 4 134 78 132 138 10 144 144 144 116 142 128 1 3 1 2 1 3 1 3 1 2 1 3 4 35 185 48 178 50 153 24 24 16 1 3 1 3 1 3 1 3 11 218 67 12 53 8 58 152 1 3 192 1 3 48 1 3 12 1 3 67 39 66 69 5 72 72 72 58 71 1 3 0 " "1 3 25 32 64 32 6 1 3 1 1 3 1 3 24 1 3 1 3 7 1 3 1 3 1 2 1 3 1 3 1 2 1 3 14 65 100 109 105 110 105 115 116 114 97 116 101 117 114 32 1 3 1 3 1 3 1 3 23 180 71 255 255 255 255 255 1 3 128 1 3 32 1 3 8 4 134 78 132 138 10 144 144 144 116 142 128 1 3 1 2 1 3 1 3 1 2 1 3 4 35 185 48 178 50 153 24 24 16 1 3 1 3 1 3 1 3 11 218 67 12 53 8 58 152 1 3 192 1 3 48 1 3 12 1 3 67 39 66 69 5 72 72 72 58 71 1 3 0 " // notice et the begin -> "1 25 32 64" Thank to help me.
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
Jenkins: GitHub hook trigger for GITScm polling : <p>I try to configure Jenkins. I want a simple behavior: trigger a build on new pull request.</p> <p>So, I created a job and configured it, but I checked the checkbox for: <a href="https://i.stack.imgur.com/QFrZk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/QFrZk.png" alt="enter image description here"></a></p> <p>And as you can see nothing is dropped down.</p> <p>If I click the question mark on the right side, I see:</p> <blockquote> <p>If jenkins will receive PUSH GitHub hook from repo defined in Git SCM section it will trigger Git SCM polling logic. So polling logic in fact belongs to Git SCM.</p> </blockquote> <p>But where is the "Git SCM section"?</p>
0debug