problem
stringlengths
26
131k
labels
class label
2 classes
void do_POWER_dozo (void) { if (Ts1 > Ts0) { T2 = T0; T0 = T1 - T0; if (((~T2) ^ T1 ^ (-1)) & ((~T2) ^ T0) & (1 << 31)) { xer_so = 1; xer_ov = 1; } else { xer_ov = 0; } } else { T0 = 0; xer_ov = 0; } }
1threat
static void blkverify_refresh_filename(BlockDriverState *bs, QDict *options) { BDRVBlkverifyState *s = bs->opaque; bdrv_refresh_filename(s->test_file->bs); if (bs->file->bs->full_open_options && s->test_file->bs->full_open_options) { QDict *opts = qdict_new(); qdict_put_str(opts, "driver", "blkverify"); QINCREF(bs->file->bs->full_open_options); qdict_put(opts, "raw", bs->file->bs->full_open_options); QINCREF(s->test_file->bs->full_open_options); qdict_put(opts, "test", s->test_file->bs->full_open_options); bs->full_open_options = opts; } if (bs->file->bs->exact_filename[0] && s->test_file->bs->exact_filename[0]) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "blkverify:%s:%s", bs->file->bs->exact_filename, s->test_file->bs->exact_filename); } }
1threat
static void monitor_command_cb(Monitor *mon, const char *cmdline, void *opaque) { monitor_suspend(mon); handle_user_command(mon, cmdline); monitor_resume(mon); }
1threat
Python error that shouldn't be happening : <p>my friend is getting an error that should not be happening. He added a variable to the top of his file, and can't access the variable from a function in his script without getting an error. </p> <p>this is his code:</p> <pre><code>numbers = [23, 5, 12, 94, 5 , 43, 23, 59, 10, 59, 31] largest = 0 def find_largest(x): for num in x: if num &gt; largest: largest = num return largest max_number = find_largest(numbers) print(max_number) </code></pre> <p>this is the error</p> <pre><code>error message: Traceback (most recent call last): File "largestElement.py", line 10, in &lt;module&gt; max_number = find_largest(numbers) File "largestElement.py", line 6, in find_largest if num &gt; largest: UnboundLocalError: local variable 'largest' referenced before assignment </code></pre> <p>why is this happening? when we move the variable definition to the function scope it works, but when we put the variable definition in the top of the script, he gets a called before reference error. Also, the numbers array doesn't have an issue and we are using it in the same way. </p> <p>Could it maybe be something wrong with his conda environment?</p>
0debug
I wanna to Create two Carousel beside each other, How Can I do that? (I've searched whole day but I couldn't find anything) : [How can I create two Carousel beside each other?][1] [1]: https://i.stack.imgur.com/Dv7PB.png How can I create two Carousel beside each other? It seems Its impossible mission but because Im beginner I hope there is a simple solution. Ive searched whole day but It seems there is no one to try this kind of stuff <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <div class="row"> <div class="col-md-2"></div> <div class="col-md-8"> <div id="Carousel" class="carousel slide"> <ol class="carousel-indicators"> <li data-target="#Carousel" data-slide-to="0" class="active"></li> <li data-target="#Carousel" data-slide-to="1"></li> </ol> <!-- Carousel items --> <div class="carousel-inner"> <div class="item active"> <div class="row"> <div class="col-md-6"><a href="images/one.jpeg" target="_blank" class="thumbnail"><img src="images/two.jpeg" class="img-responsive" alt="Image" style="max-width:100%;"></a></div> <div class="col-md-6"><a href="https://a2ua.com/picture/picture-002.jpg" target="_blank" class="thumbnail"><img src="https://a2ua.com/picture/picture-002.jpg" alt="Image" style="max-width:100%;"></a></div> </div><!--.row--> </div><!--.item--> <div class="item"> <div class="row"> <div class="col-md-6"><a href="https://a2ua.com/picture/picture-002.jpg" target="_blank" class="thumbnail"><img src="https://a2ua.com/picture/picture-002.jpg" class="img-responsive" alt="Image" alt="Image" style="max-width:100%;"></a></div> <div class="col-md-6"><a href="https://a2ua.com/picture/picture-002.jpg" target="_blank" class="thumbnail"><img src="https://a2ua.com/picture/picture-002.jpg" class="img-responsive" alt="Image" style="max-width:100%;"></a></div> </div><!--.row--> </div><!--.item--> </div><!--.carousel-inner--> <a data-slide="prev" href="#Carousel" class="left carousel-control black-link">‹</a> <a data-slide="next" href="#Carousel" class="right carousel-control black-link">›</a> </div><!--.Carousel--> </div> <!--.col-md-8--> </div> <!--.row--> <div class="row"> <div class="col-md-2"></div> <div class="col-md-8"> <div id="Carousel2" class="carousel slide"> <ol class="carousel-indicators"> <li data-target="#Carousel" data-slide-to="0" class="active"></li> <li data-target="#Carousel" data-slide-to="1"></li> </ol> <!-- Carousel items --> <div class="carousel-inner"> <div class="item active"> <div class="row"> <div class="col-md-6"><a href="images/one.jpeg" target="_blank" class="thumbnail"><img src="images/two.jpeg" class="img-responsive" alt="Image" style="max-width:100%;"></a></div> <div class="col-md-6"><a href="https://a2ua.com/picture/picture-002.jpg" target="_blank" class="thumbnail"><img src="https://a2ua.com/picture/picture-002.jpg" alt="Image" style="max-width:100%;"></a></div> </div><!--.row--> </div><!--.item--> <div class="item"> <div class="row"> <div class="col-md-6"><a href="https://a2ua.com/picture/picture-002.jpg" target="_blank" class="thumbnail"><img src="https://a2ua.com/picture/picture-002.jpg" class="img-responsive" alt="Image" alt="Image" style="max-width:100%;"></a></div> <div class="col-md-6"><a href="https://a2ua.com/picture/picture-002.jpg" target="_blank" class="thumbnail"><img src="https://a2ua.com/picture/picture-002.jpg" class="img-responsive" alt="Image" style="max-width:100%;"></a></div> </div><!--.row--> </div><!--.item--> </div><!--.carousel-inner--> <a data-slide="prev" href="#Carousel" class="left carousel-control black-link">‹</a> <a data-slide="next" href="#Carousel" class="right carousel-control black-link">›</a> </div><!--.Carousel--> </div> <!--.col-md-8--> </div> <!--.row--> and maybe I choose incorrect word to search <!-- end snippet -->
0debug
static void tcp_wait_for_connect(void *opaque) { MigrationState *s = opaque; int val, ret; socklen_t valsize = sizeof(val); DPRINTF("connect completed\n"); do { ret = getsockopt(s->fd, SOL_SOCKET, SO_ERROR, (void *) &val, &valsize); } while (ret == -1 && (socket_error()) == EINTR); if (ret < 0) { migrate_fd_error(s); return; } qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); if (val == 0) migrate_fd_connect(s); else { DPRINTF("error connecting %d\n", val); migrate_fd_error(s); } }
1threat
static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out) { char *pix_fmts; OutputStream *ost = ofilter->ost; OutputFile *of = output_files[ost->file_index]; AVFilterContext *last_filter = out->filter_ctx; int pad_idx = out->pad_idx; int ret; char name[255]; snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("buffersink"), name, NULL, NULL, fg->graph); if (ret < 0) return ret; if (!hw_device_ctx && (ofilter->width || ofilter->height)) { char args[255]; AVFilterContext *filter; snprintf(args, sizeof(args), "%d:%d:0x%X", ofilter->width, ofilter->height, (unsigned)ost->sws_flags); snprintf(name, sizeof(name), "scaler for output stream %d:%d", ost->file_index, ost->index); if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), name, args, NULL, fg->graph)) < 0) return ret; if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) return ret; last_filter = filter; pad_idx = 0; } if ((pix_fmts = choose_pix_fmts(ofilter))) { AVFilterContext *filter; snprintf(name, sizeof(name), "pixel format for output stream %d:%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("format"), "format", pix_fmts, NULL, fg->graph); av_freep(&pix_fmts); if (ret < 0) return ret; if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) return ret; last_filter = filter; pad_idx = 0; } if (ost->frame_rate.num) { AVFilterContext *fps; char args[255]; snprintf(args, sizeof(args), "fps=%d/%d", ost->frame_rate.num, ost->frame_rate.den); snprintf(name, sizeof(name), "fps for output stream %d:%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&fps, avfilter_get_by_name("fps"), name, args, NULL, fg->graph); if (ret < 0) return ret; ret = avfilter_link(last_filter, pad_idx, fps, 0); if (ret < 0) return ret; last_filter = fps; pad_idx = 0; } snprintf(name, sizeof(name), "trim for output stream %d:%d", ost->file_index, ost->index); ret = insert_trim(of->start_time, of->recording_time, &last_filter, &pad_idx, name); if (ret < 0) return ret; if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0) return ret; return 0; }
1threat
static int ehci_state_fetchqtd(EHCIQueue *q, int async) { int again = 0; get_dwords(NLPTR_GET(q->qtdaddr),(uint32_t *) &q->qtd, sizeof(EHCIqtd) >> 2); ehci_trace_qtd(q, NLPTR_GET(q->qtdaddr), &q->qtd); if (q->qtd.token & QTD_TOKEN_ACTIVE) { ehci_set_state(q->ehci, async, EST_EXECUTE); again = 1; } else { ehci_set_state(q->ehci, async, EST_HORIZONTALQH); again = 1; } return again; }
1threat
def remove_tuple(test_tup): res = tuple(set(test_tup)) return (res)
0debug
static int xio3130_downstream_initfn(PCIDevice *d) { PCIEPort *p = PCIE_PORT(d); PCIESlot *s = PCIE_SLOT(d); int rc; pci_bridge_initfn(d, TYPE_PCIE_BUS); pcie_port_init_reg(d); rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT); if (rc < 0) { goto err_bridge; } rc = pci_bridge_ssvid_init(d, XIO3130_SSVID_OFFSET, XIO3130_SSVID_SVID, XIO3130_SSVID_SSID); if (rc < 0) { goto err_bridge; } rc = pcie_cap_init(d, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_DOWNSTREAM, p->port); if (rc < 0) { goto err_msi; } pcie_cap_flr_init(d); pcie_cap_deverr_init(d); pcie_cap_slot_init(d, s->slot); pcie_cap_arifwd_init(d); pcie_chassis_create(s->chassis); rc = pcie_chassis_add_slot(s); if (rc < 0) { goto err_pcie_cap; } rc = pcie_aer_init(d, XIO3130_AER_OFFSET, PCI_ERR_SIZEOF); if (rc < 0) { goto err; } return 0; err: pcie_chassis_del_slot(s); err_pcie_cap: pcie_cap_exit(d); err_msi: msi_uninit(d); err_bridge: pci_bridge_exitfn(d); return rc; }
1threat
static void opt_frame_aspect_ratio(const char *arg) { int x = 0, y = 0; double ar = 0; const char *p; char *end; p = strchr(arg, ':'); if (p) { x = strtol(arg, &end, 10); if (end == p) y = strtol(end+1, &end, 10); if (x > 0 && y > 0) ar = (double)x / (double)y; } else ar = strtod(arg, NULL); if (!ar) { fprintf(stderr, "Incorrect aspect ratio specification.\n"); ffmpeg_exit(1); } frame_aspect_ratio = ar; x = vfilters ? strlen(vfilters) : 0; vfilters = av_realloc(vfilters, x+100); snprintf(vfilters+x, x+100, "%csetdar=%f\n", x?',':' ', ar); }
1threat
How Do I Click On the Hyper Link Text Automatically Using Auto Hot Key Script : I am new to auto hot key scripting can any one help me out how do i click on the hyper link text using Auto hot key script My requirement is : Right click on the desktop --> In Screen Resolution Screen ---> Advanced Settings , So i want to click on the Advanced Settings link automatically when i run the auto hot key script . Please do find the below Image [enter image description here][1] [1]: https://i.stack.imgur.com/lsKoL.png
0debug
alert('Hello ' + user_input);
1threat
Upload image with HttpClient : <h1>Problem</h1> <p>I try to upload an image with angular's <a href="https://angular.io/api/common/http/HttpClient" rel="noreferrer"><code>HttpClient</code></a> to API <code>Content-Type: multipart/form-data</code> (angular v4+). Is it supported? How to do it?</p> <p>The upload works with <code>XMLHttpRequest</code> when using module like <a href="https://github.com/ogix/ng2-fancy-image-uploader" rel="noreferrer"><code>ng2-fancy-image-uploader</code></a>. I would prefer to use a custom method with <code>HttpClient</code> which i could put into a http service together with other methods for accessing API.</p> <h1>Here is what i have tried so far:</h1> <h2>model.service.ts</h2> <pre class="lang-ts prettyprint-override"><code>import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http'; import 'rxjs/add/operator/toPromise'; @Injectable() export class ModelService { constructor(private http: HttpClient) { } public async updateAvatar(file: File): Promise&lt;void&gt; { // headers const headers = new HttpHeaders() .append('Content-Type', 'multipart/form-data'); const formData: FormData = new FormData(); formData.append('avatar', file, file.name); const response: HttpResponse = await this.http .patch('https://example.com/avatar', formData, { headers, observe: 'response' }) .toPromise(); console.log(response.status); } } </code></pre> <h2>avatar-uploader.component.ts</h2> <pre class="lang-ts prettyprint-override"><code>import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; import { ModelService } from './path/to/model.service'; @Component({ selector: 'app-avatar-uploader', template: '&lt;input type="file" #fileInput (changes)="uploadAvatar()"&gt;' }) export class AvatarUploaderComponent implements OnInit { @ViewChild('fileInput') fileInputElement: ElementRef; constructor() { } ngOnInit() { } public async uploadAvatar() { const file: File = this.fileInputElement.nativeElement.files[0]; await this.model.updateAvatar(file); } } </code></pre> <p>This version sends a request to (express) API, but <code>multer</code> (a library for parsing <code>multipart/form-data</code> requests) fails to parse the request.</p> <p>So i guess i either use the <code>HttpClient</code> incorrectly, or it doesn't support <code>multipart/form-data</code> requests.</p> <p>I guess one could send base64 encoded file or use <code>XmlHttpRequest</code>, but i ask specifically about <code>HttpClient</code>'s ability to do it.</p>
0debug
sql query: Incorrect syntax near the keyword 'GROUP' : I am writing an sql query but keep getting syntax error: Incorrect syntax near the keyword 'GROUP'. What could be causing this issue? see query below:
0debug
somthing wrong with tables libgdx android : public class MyGdxGame extends ApplicationAdapter { SpriteBatch batch; Texture img; Stage stage; @Override public void create () { stage=new Stage(); batch = new SpriteBatch(); Image mg=new Image(new Texture("badlogic.jpg")); Table table=new Table(); table.add(); table.add(mg); table.add(); stage.addActor(table); } @Override public void render () { Gdx.gl.glClearColor(1, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); batch.end(); stage.draw(); } @Override public void dispose () { batch.dispose(); }} can any body please tell me why is that my image is not showing or whats wrong with this code thanks no problem it works but i cant see my image
0debug
def circle_circumference(r): perimeter=2*3.1415*r return perimeter
0debug
Maven compile fails on unneeded dependency of dependency : I am attempting to compile my maven project, and I am depending on another project (which is a jar file). For some reason, when I attempt to compile I get the following error which seems to be that my project can not access the required dependencies of the project I'm depending on, even though I don't use any of those dependencies. Here is the error http://hastebin.com/pebolozuxi.sql I know that I can easily depend on that required dependency to solve the issue, however I don't see why that would be necessary so I wish to solve this issue without taking that route, if possible. Thanks!
0debug
Invalid index 0, size is 0 for a list in Android : My problem is java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 private List<List<Restaurant.Menu>> menus = new ArrayList<>(); menus.get(0).get(0).setMenuName("asasdasd"); I created a setter for error but it still has a problem. I need to add approximately 100 menu name, 1000 foodName and 1000 foodPrize. How can I solve it ? public class Restaurant { @SerializedName("cacheVersion") @Expose public String cacheVersion; @SerializedName("id") @Expose public Integer id; @SerializedName("name") @Expose public String name; @SerializedName("desc") @Expose public String desc; @SerializedName("phones") @Expose public List<String> phones = null; @SerializedName("menus") @Expose public List<Menu> menus = null; @SerializedName("image") @Expose public String image; public class Menu { @SerializedName("name") @Expose public String name; @SerializedName("foods") @Expose public List<Food> foods = null; public void setMenuName(String namex) { this.name = namex; } } public class Food { @SerializedName("name") @Expose public String name; @SerializedName("desc") @Expose public String desc; @SerializedName("price") @Expose public String price; } }
0debug
static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, int fd, int is_connected) { NetSocketState *s; s = qemu_mallocz(sizeof(NetSocketState)); if (!s) return NULL; s->fd = fd; s->vc = qemu_new_vlan_client(vlan, net_socket_receive, s); snprintf(s->vc->info_str, sizeof(s->vc->info_str), "socket: fd=%d", fd); if (is_connected) { net_socket_connect(s); } else { qemu_set_fd_handler(s->fd, NULL, net_socket_connect, s); } return s; }
1threat
Make current h1/h2 sticky with Javascript : <p>I'd like to make a long website with lots of text more convinient by making the h1 or h2 element that would have just gone out of view (when scrolling down) sticky at the top until the next headline is about to go out of view and become sticky.</p> <p>I believe I've seen this on some websites, but I don't know how to call it and can't find an example.</p> <p>I'm using Bootstrap and JQuery, so a solution that works with either of them would be perfect.</p>
0debug
When does code in a service worker outside of an event handler run? : <p>(I am paraphrasing question asked by Rich Harris in the "<a href="https://gist.github.com/Rich-Harris/fd6c3c73e6e707e312d7c5d7d0f3b2f9">Stuff I wish I'd known sooner about service workers</a>" gist.)</p> <p>If I have code in my service worker that runs outside an event handler, when does it run?</p> <p>And, closely related to that, what is the difference between putting inside an <code>install</code> handler and putting it outside an event handler entirely?</p>
0debug
I want to make a spoiler function which can be used multiple times in a WordPress post : <div id="my-spoiler"> <div id= "my-spoiler-title" role= "button" onclick= "(document.getElementById('1') .style.display=document.getElementById('1').style.display=='none' ? '' : 'none')"> Spoiler Title </div> <div class="my-spoiler-content" id="1" style= "display:none"> Hidden Content </div> </div> I use this code But to use this multiple times in a post, I have to create unique "id" every time like "id=1", "id=2'.... Is there any way to call child div without any "id" and achieve the results. I want to use this function for my Quiz type post. when initially answer is hidden and when user touch the spoiler title than answers is visible. I done CSS part of this function and all things work properly if I use unique "id" for every question. I don't want to use any plugin or short code type plugin. Thanks in advance.
0debug
static void gen_mftr(CPUMIPSState *env, DisasContext *ctx, int rt, int rd, int u, int sel, int h) { int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC); TCGv t0 = tcg_temp_local_new(); if ((env->CP0_VPEConf0 & (1 << CP0VPEC0_MVP)) == 0 && ((env->tcs[other_tc].CP0_TCBind & (0xf << CP0TCBd_CurVPE)) != (env->active_tc.CP0_TCBind & (0xf << CP0TCBd_CurVPE)))) tcg_gen_movi_tl(t0, -1); else if ((env->CP0_VPEControl & (0xff << CP0VPECo_TargTC)) > (env->mvp->CP0_MVPConf0 & (0xff << CP0MVPC0_PTC))) tcg_gen_movi_tl(t0, -1); else if (u == 0) { switch (rt) { case 1: switch (sel) { case 1: gen_helper_mftc0_vpecontrol(t0, cpu_env); break; case 2: gen_helper_mftc0_vpeconf0(t0, cpu_env); break; default: goto die; break; } break; case 2: switch (sel) { case 1: gen_helper_mftc0_tcstatus(t0, cpu_env); break; case 2: gen_helper_mftc0_tcbind(t0, cpu_env); break; case 3: gen_helper_mftc0_tcrestart(t0, cpu_env); break; case 4: gen_helper_mftc0_tchalt(t0, cpu_env); break; case 5: gen_helper_mftc0_tccontext(t0, cpu_env); break; case 6: gen_helper_mftc0_tcschedule(t0, cpu_env); break; case 7: gen_helper_mftc0_tcschefback(t0, cpu_env); break; default: gen_mfc0(ctx, t0, rt, sel); break; } break; case 10: switch (sel) { case 0: gen_helper_mftc0_entryhi(t0, cpu_env); break; default: gen_mfc0(ctx, t0, rt, sel); break; } case 12: switch (sel) { case 0: gen_helper_mftc0_status(t0, cpu_env); break; default: gen_mfc0(ctx, t0, rt, sel); break; } case 13: switch (sel) { case 0: gen_helper_mftc0_cause(t0, cpu_env); break; default: goto die; break; } break; case 14: switch (sel) { case 0: gen_helper_mftc0_epc(t0, cpu_env); break; default: goto die; break; } break; case 15: switch (sel) { case 1: gen_helper_mftc0_ebase(t0, cpu_env); break; default: goto die; break; } break; case 16: switch (sel) { case 0 ... 7: gen_helper_mftc0_configx(t0, cpu_env, tcg_const_tl(sel)); break; default: goto die; break; } break; case 23: switch (sel) { case 0: gen_helper_mftc0_debug(t0, cpu_env); break; default: gen_mfc0(ctx, t0, rt, sel); break; } break; default: gen_mfc0(ctx, t0, rt, sel); } } else switch (sel) { case 0: gen_helper_1e0i(mftgpr, t0, rt); break; case 1: switch (rt) { case 0: gen_helper_1e0i(mftlo, t0, 0); break; case 1: gen_helper_1e0i(mfthi, t0, 0); break; case 2: gen_helper_1e0i(mftacx, t0, 0); break; case 4: gen_helper_1e0i(mftlo, t0, 1); break; case 5: gen_helper_1e0i(mfthi, t0, 1); break; case 6: gen_helper_1e0i(mftacx, t0, 1); break; case 8: gen_helper_1e0i(mftlo, t0, 2); break; case 9: gen_helper_1e0i(mfthi, t0, 2); break; case 10: gen_helper_1e0i(mftacx, t0, 2); break; case 12: gen_helper_1e0i(mftlo, t0, 3); break; case 13: gen_helper_1e0i(mfthi, t0, 3); break; case 14: gen_helper_1e0i(mftacx, t0, 3); break; case 16: gen_helper_mftdsp(t0, cpu_env); break; default: goto die; } break; case 2: if (h == 0) { TCGv_i32 fp0 = tcg_temp_new_i32(); gen_load_fpr32(fp0, rt); tcg_gen_ext_i32_tl(t0, fp0); tcg_temp_free_i32(fp0); } else { TCGv_i32 fp0 = tcg_temp_new_i32(); gen_load_fpr32h(fp0, rt); tcg_gen_ext_i32_tl(t0, fp0); tcg_temp_free_i32(fp0); } break; case 3: gen_helper_1e0i(cfc1, t0, rt); break; case 4: case 5: default: goto die; } LOG_DISAS("mftr (reg %d u %d sel %d h %d)\n", rt, u, sel, h); gen_store_gpr(t0, rd); tcg_temp_free(t0); return; die: tcg_temp_free(t0); LOG_DISAS("mftr (reg %d u %d sel %d h %d)\n", rt, u, sel, h); generate_exception(ctx, EXCP_RI); }
1threat
static void rtas_stop_self(PowerPCCPU *cpu, sPAPRMachineState *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { CPUState *cs = CPU(cpu); CPUPPCState *env = &cpu->env; cs->halted = 1; qemu_cpu_kick(cs); env->msr = 0; env->spr[SPR_LPCR] &= ~pcc->lpcr_pm; }
1threat
I want to hide all notifications of other apps when my Android app is in foreground. Is this possible? How? : <p>I am creating an educational app where school students can appear for 5 mins quick exams. Most of the time they are using their parent's mobile phone.</p> <p>Now what I want is that when a student is giving the exam, no notification should come from any other app such as WhatsApp, FB or Gmail. </p> <p>Is this possible? How? </p>
0debug
int pci_add_capability(PCIDevice *pdev, uint8_t cap_id, uint8_t offset, uint8_t size, Error **errp) { uint8_t *config; int i, overlapping_cap; if (!offset) { offset = pci_find_space(pdev, size); assert(offset); } else { for (i = offset; i < offset + size; i++) { overlapping_cap = pci_find_capability_at_offset(pdev, i); if (overlapping_cap) { error_setg(errp, "%s:%02x:%02x.%x " "Attempt to add PCI capability %x at offset " "%x overlaps existing capability %x at offset %x", pci_root_bus_path(pdev), pci_bus_num(pdev->bus), PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), cap_id, offset, overlapping_cap, i); return -EINVAL; } } } config = pdev->config + offset; config[PCI_CAP_LIST_ID] = cap_id; config[PCI_CAP_LIST_NEXT] = pdev->config[PCI_CAPABILITY_LIST]; pdev->config[PCI_CAPABILITY_LIST] = offset; pdev->config[PCI_STATUS] |= PCI_STATUS_CAP_LIST; memset(pdev->used + offset, 0xFF, QEMU_ALIGN_UP(size, 4)); memset(pdev->wmask + offset, 0, size); memset(pdev->cmask + offset, 0xFF, size); return offset; }
1threat
React native: how to get file size, mime type and extension? : <p>I know <a href="https://github.com/johanneslumpe/react-native-fs" rel="noreferrer">react-native-fs</a> and <a href="https://github.com/wkh237/react-native-fetch-blob" rel="noreferrer">react-native-fetch-blob</a>, but I'm missing simple helper functions like <code>getFileInfo(file)</code>.</p> <p><strong>Desired pseudo code:</strong></p> <pre><code>let fileInfo = getFileInfo('path/to/my/file.txt'); console.log('file size: ' + fileInfo.size); console.log('mime type: ' + fileInfo.type); console.log('extension: ' + fileInfo.extension); </code></pre> <p>What's the proper way to get the file size, mime type and extension?</p> <p>Thanks in advance!</p>
0debug
Using multiple indicies to grab values from 2D MATLAB array without returning all combinations : <p>I am trying to get a few values from a 2D matrix</p> <p>Consider the starting matrix:</p> <pre><code>&gt;&gt; test = randi(10,10) test = 10 4 8 7 10 4 2 8 4 1 6 5 6 5 5 2 10 4 7 6 7 2 5 4 1 1 3 7 6 1 1 3 3 9 9 5 10 4 6 9 9 1 8 4 7 2 3 7 3 10 8 10 3 9 4 8 4 1 3 1 2 7 1 8 10 4 1 10 5 10 6 10 8 9 3 9 7 9 3 1 4 2 7 6 7 8 2 8 9 7 6 10 8 7 7 6 1 9 10 8 </code></pre> <p>What I want to do is grab elements (1,4);(2,5);and(3,6) only</p> <p>So I try </p> <pre><code>test([1,2,3],[4,5,6]) </code></pre> <p>but that returns all combinations of the two indicies!</p> <pre><code>ans = 6 3 1 1 2 4 8 4 8 </code></pre> <p>Without this intermediate step, how do I do what I want in one line? There must be a way.</p> <p>I cannot use the intermediate step because in actuality, my matrix is very large and so are my indices lengths so I will run out of memory.</p>
0debug
Binary Search refactor : <p>I've received this test last night.</p> <pre><code>` int binaryS(int[] A, int X) { int N = A.length; if (N == 0) { return -1; } int l = 0; int r = N - 1; while (l &lt; r) { int m = (l + r) / 2; if (A[m] &gt; X) { r = m - 1; } else { l = m; } } if (A[l] == X) { return l; } return -1; }` </code></pre> <p>And I have to debugg/refactor the code. <strong>Condition:</strong> "You can modify only three lines".</p> <p>Can anyone help me?</p>
0debug
PHP - Difficulties Writing New Line : <p>I am encountering difficulties with writing to a new line in a basic text file. All the other text (including the comma) appears just fine, but no new line (no space or anything either). I would greatly appreciate any direction.</p> <pre><code>&lt;?php session_start(); $user = $_SESSION['store']; function format($input) { $input = trim($input); $input = stripcslashes($input); $input = htmlspecialchars($input); return $input; } $file = "messages/reminder.txt"; $image; $secFreqLabel; $freqLabel; $uploadDirectory = "corpImages/"; if(!file_exists($file)) { $temp = fopen($file, "w"); // create file fclose($temp); } $con = new PDO("sqlite:bk.db"); if($_SERVER['REQUEST_METHOD'] == "POST") { $secFreqLabel = 'reminder.jpg'; $freqLabel = 'reminderHourly.jpg'; $thirdFreqLabel = 'reminderThree.jpg'; $fourthFreqLabel = 'reminderFour.jpg'; $freqUploadFile = $uploadDirectory . $freqLabel; $secFreqUploadFile = $uploadDirectory . $secFreqLabel; $thirdFreqUploadFile = $uploadDirectory . $thirdFreqLabel; $fourthFreqUploadFile = $uploadDirectory . $fourthFreqLabel; $statement = $con-&gt;prepare("INSERT INTO slides (image, label) VALUES (:image, :label)"); if(!empty($_FILES['freqImage'])) { $con-&gt;exec("DELETE FROM slides where label = 'reminder.jpg'"); } if(!empty($_FILES['secFreqImage'])) { $con-&gt;exec("DELETE FROM slides where label = 'reminderHourly.jpg'"); } if(!empty($_FILES['thirdFreqImage'])) { $con-&gt;exec("DELETE FROM slides where label = 'reminderThree.jpg'"); } if(!empty($_FILES['fourthFreqImage'])) { $con-&gt;exec("DELETE FROM slides where label = 'reminderFour.jpg'"); } $image = file_get_contents($_FILES['freqImage']['tmp_name']); move_uploaded_file($_FILES['freqImage']['tmp_name'], $freqUploadFile); $statement-&gt;bindParam(":label", $freqLabel); $statement-&gt;bindParam(":image", $image); $statement-&gt;execute(); $image = file_get_contents($_FILES['secFreqImage']['tmp_name']); move_uploaded_file($_FILES['secFreqImage']['tmp_name'], $secFreqUploadFile); $statement-&gt;bindParam(":label", $secFreqLabel); $statement-&gt;bindParam(":image", $image); $statement-&gt;execute(); $image = file_get_contents($_FILES['thirdFreqImage']['tmp_name']); move_uploaded_file($_FILES['thirdFreqImage']['tmp_name'], $thirdFreqUploadFile); $statement-&gt;bindParam(":label", $thirdFreqLabel); $statement-&gt;bindParam(":image", $image); $statement-&gt;execute(); $image = file_get_contents($_FILES['fourthFreqImage']['tmp_name']); move_uploaded_file($_FILES['fourthFreqImage']['tmp_name'], $fourthFreqUploadFile); $statement-&gt;bindParam(":label", $fourthFreqLabel); $statement-&gt;bindParam(":image", $image); $statement-&gt;execute(); $text = format($_POST['freq']) . "," . format($_POST['freqMessage']) . "\n" . format($_POST['secFreq']) . "," . format($_POST['secFreqMessage']) . "\n" . format($_POST['thirdFreq']) . "," . format($_POST['thirdFreqMessage']) . "\n" . format($_POST['fourthFreq']) . "," . format($_POST['fourthFreqMessage']); $writer = fopen($file, "w"); fwrite($writer, $text); fclose($writer); touch("update.txt"); } $handler = fopen($file, "r"); $firstReminder = fgetcsv($handler, ","); $secondReminder = fgetcsv($handler, ","); $thirdReminder = fgetcsv($handler, ","); $fourthReminder = fgetcsv($handler, ","); fclose($handler); ?&gt; </code></pre>
0debug
ts An async function or method in ES5/ES3 requires the 'Promise' constructor : <p>Hello I'm Using async/await in my TypeScript Project, But I Get this log:</p> <p><em>[ts] An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your <code>--lib</code> option.</em></p> <p>How Can I Solve That?</p>
0debug
Android JSON Parsing Get Gujarati Character Using Web Service : Get Gujarati Character Using Web Service in Android JSON Parsing I Got Gujarati Word Like this if Gujarati Word like અપૂર્વ than shows like 1st rounded circle in image Please help me to solution this question [enter image description here][1] [1]: https://i.stack.imgur.com/Djh71.png Code : public class GetProductData extends AsyncTask<String, String, JSONObject> { //private ProgressDialog p_dialog; JSONArray jArray; @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); /*p_dialog = new ProgressDialog(con); p_dialog.setMessage("Please Wait ..."); p_dialog.setIndeterminate(false); p_dialog.setCancelable(false); p_dialog.show();*/ } @Override protected JSONObject doInBackground(String... params) { jArray = JSONParser.GetProductData(); Log.d("TAG", "JSON ARRAY FOR DEVICE ID : " + jArray); String msg = "Nothing Happened..."; try { if (jArray != null) { Key = jArray.getJSONObject(0).getString("Key").toString(); if (Key.equals("1")) { db.deleteAllProductDetails(); for (int i = 1; i < jArray.length(); i++) { Log.d("ADADADADTAG","CategoryName ::: "+jArray.getJSONObject(i).getString("CategoryName")); Log.d("ADADADADTAG","SubCategoryName ::: "+jArray.getJSONObject(i).getString("SubCategoryName").toString().trim()); Log.d("ADADADADTAG","ProductName ::: "+jArray.getJSONObject(i).getString("ProductName")); db.insertProductDetails( jArray.getJSONObject(i).getString("ProductId").toString().trim(), jArray.getJSONObject(i).getString("CategoryId").toString().trim(), jArray.getJSONObject(i).getString("CategoryName").toString().trim(), jArray.getJSONObject(i).getString("CategoryImageUrl").toString().trim(), jArray.getJSONObject(i).getString("SubCategoryId").toString().trim(), jArray.getJSONObject(i).getString("SubCategoryName").toString().trim(), jArray.getJSONObject(i).getString("SubCategoryImageUrl").toString().trim(), jArray.getJSONObject(i).getString("ProductName").toString().trim(), jArray.getJSONObject(i).getString("ProductImageUrl").toString().trim(), jArray.getJSONObject(i).getString("ProductCode").toString().trim(), jArray.getJSONObject(i).getString("ProductPrice").toString().trim(), jArray.getJSONObject(i).getString("ProductUnit").toString().trim(), jArray.getJSONObject(i).getString("ProductSmallDesc").toString().trim(), jArray.getJSONObject(i).getString("CategoryStatus").toString().trim(), jArray.getJSONObject(i).getString("SubCategoryStatus").toString().trim(), jArray.getJSONObject(i).getString("ProductStatus").toString().trim() ); } } } else { } } catch (Exception e) { // TODO: handle exception Log.e("TAG", "Warn :" + e.getLocalizedMessage()); Log.e("TAG", "Warn :" + e.getMessage()); } return null; } @Override protected void onPostExecute(JSONObject json) { // TODO Auto-generated method stub super.onPostExecute(json); // p_dialog.dismiss(); if (jArray != null) { if (Key.equals("1")) { Cursor cGetAllProductDetails = db.getAllProductDetails(); //Toast.makeText(con,"Count ::: "+cGetAllProductDetails.getCount(),Toast.LENGTH_LONG).show(); preferences = con.getSharedPreferences(IsLogin,Context.MODE_PRIVATE); if(preferences.getBoolean(IsLogin,false)) { Intent i = new Intent(con, DashboardActivityEnglishWithLogin.class); startActivity(i); overridePendingTransition(R.anim.left_in, R.anim.left_out); finish(); } else { Intent i = new Intent(con, DashboardActivityEnglishWithoutLogin.class); startActivity(i); overridePendingTransition(R.anim.left_in, R.anim.left_out); finish(); } } else if (Key.equals("0")) { } else { } } } } public static JSONArray GetProductData() { // TODO Auto-generated method stub try { init(); url = SITE_URL + "GetProductData"; Log.d("TAG", url); httpPost = new HttpPost(url.toString()); Log.d("TAG", "HTTP POST"+httpPost); pairs = new ArrayList<NameValuePair>(); httpPost.setEntity(new UrlEncodedFormEntity(pairs, HTTP.UTF_8)); Log.d("TAG", "HTTP POST"+httpPost); httpResponse = httpClient.execute(httpPost); Log.d("TAG", "HTTP RESPONSE"+httpResponse); httpEntity = httpResponse.getEntity(); inputStream = httpEntity.getContent(); /* Convert response to string */ result = getResult(inputStream); Log.d("TAG","RESULT : "+ result); jsonArray = new JSONArray(result); Log.d("TAG", "JSON ARRAY : "+ jsonArray); } catch (ClientProtocolException e) { Log.e("TAG", "Error in Client Protocol : " + e.toString()); } catch (JSONException e) { Log.e("TAG", "Error Parsing data " + e.toString()); } catch (Exception e) { Log.e("TAG", "Error in HTTP Connection : " + e.toString()); } return jsonArray; }
0debug
Why req.query.name return undefined? : <p>I tried to get a parameter in my nodeJS server url like this : localhost/?name=Vincent</p> <p>So, I wrote this code :</p> <pre><code>var request = require('request'); var http = require('http'); http.createServer(fybctuib (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); console.log(req.query.name) // or juste req.query </code></pre> <p>etc.</p> <p>And I have undefined in my log when I go on localhost ... Could you help me, please ? Thank you.</p>
0debug
Regex between two times : <p>I have a file with a few million lines in them. </p> <p>Every line starts like this:</p> <pre><code>2016/04/05 11:20:43.293 </code></pre> <p>I would like a regex (or other option?) to get all the lines that fall between two times. (for example between 11:20 and 11:25)</p> <p>Also, if it's possible to match one or more words in those lines, that would be helpfull as well. However, perhaps a regex isn't the best way to go then? </p>
0debug
Parse HTML string in Angular 2 and extract and update values : <p>I just started working on an Angular project but am a bit stuck. I have a component that receives an HTML string from a (trusted) external source. I want to extract and update values from this string, and dispay it in my component.</p> <p>Now displaying the string is easily done with the following code:</p> <pre><code>&lt;div [innerHTML]="displayString"&gt;&lt;/div&gt; </code></pre> <p>My input string has some <code>&lt;span&gt;</code> elements with the <code>data-card-text</code> element attached as identifier. Is it possible to extract this value, and update it whenever my component wants?</p> <p><em>Example:</em> <code>let displayString:string = "&lt;svg&gt;&lt;text data-card-text&gt;Value I want to update&lt;/text&gt;&lt;/svg&gt;"</code></p> <p>Are operations like these even possible in Angular 2?</p>
0debug
1. Why do we need to override the method public boolean equals(Object ob) in any class? : <ol> <li><p>Why do we need to override the method public boolean equals(Object ob) in any class?</p></li> <li><p>Is public boolean equals(Object ob) is same as public boolean equals(Circle ob)?</p></li> </ol>
0debug
How to preview HTML file in C# : <p>How i can preview simple HTML file (C:\Users\Test\Desktop\test.txt) in C#?</p> <p>Simple HTML Code;</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;style&gt; body { background:blue; } &lt;/style&gt; &lt;script&gt; alert("test js"); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;buton&gt;test&lt;buton&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
0debug
void remove_migration_state_change_notifier(Notifier *notify) { notifier_remove(notify); }
1threat
static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab) { Error *local_err = NULL; BDRVSheepdogState *s = bs->opaque; SheepdogReq req; int fd, nr = 1024, ret, max = BITS_TO_LONGS(SD_NR_VDIS) * sizeof(long); QEMUSnapshotInfo *sn_tab = NULL; unsigned wlen, rlen; int found = 0; static SheepdogInode inode; unsigned long *vdi_inuse; unsigned int start_nr; uint64_t hval; uint32_t vid; vdi_inuse = g_malloc(max); fd = connect_to_sdog(s, &local_err); if (fd < 0) { error_report("%s", error_get_pretty(local_err));; error_free(local_err); ret = fd; goto out; } rlen = max; wlen = 0; memset(&req, 0, sizeof(req)); req.opcode = SD_OP_READ_VDIS; req.data_length = max; ret = do_req(fd, s->aio_context, (SheepdogReq *)&req, vdi_inuse, &wlen, &rlen); closesocket(fd); if (ret) { goto out; } sn_tab = g_malloc0(nr * sizeof(*sn_tab)); hval = fnv_64a_buf(s->name, strlen(s->name), FNV1A_64_INIT); start_nr = hval & (SD_NR_VDIS - 1); fd = connect_to_sdog(s, &local_err); if (fd < 0) { error_report("%s", error_get_pretty(local_err));; error_free(local_err); ret = fd; goto out; } for (vid = start_nr; found < nr; vid = (vid + 1) % SD_NR_VDIS) { if (!test_bit(vid, vdi_inuse)) { break; } ret = read_object(fd, s->aio_context, (char *)&inode, vid_to_vdi_oid(vid), 0, SD_INODE_SIZE - sizeof(inode.data_vdi_id), 0, s->cache_flags); if (ret) { continue; } if (!strcmp(inode.name, s->name) && is_snapshot(&inode)) { sn_tab[found].date_sec = inode.snap_ctime >> 32; sn_tab[found].date_nsec = inode.snap_ctime & 0xffffffff; sn_tab[found].vm_state_size = inode.vm_state_size; sn_tab[found].vm_clock_nsec = inode.vm_clock_nsec; snprintf(sn_tab[found].id_str, sizeof(sn_tab[found].id_str), "%" PRIu32, inode.snap_id); pstrcpy(sn_tab[found].name, MIN(sizeof(sn_tab[found].name), sizeof(inode.tag)), inode.tag); found++; } } closesocket(fd); out: *psn_tab = sn_tab; g_free(vdi_inuse); if (ret < 0) { return ret; } return found; }
1threat
static int wsaud_read_packet(AVFormatContext *s, AVPacket *pkt) { AVIOContext *pb = s->pb; unsigned char preamble[AUD_CHUNK_PREAMBLE_SIZE]; unsigned int chunk_size; int ret = 0; AVStream *st = s->streams[0]; if (avio_read(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) != AUD_CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); if (AV_RL32(&preamble[4]) != AUD_CHUNK_SIGNATURE) chunk_size = AV_RL16(&preamble[0]); if (st->codecpar->codec_id == AV_CODEC_ID_WESTWOOD_SND1) { int out_size = AV_RL16(&preamble[2]); if ((ret = av_new_packet(pkt, chunk_size + 4)) < 0) return ret; if ((ret = avio_read(pb, &pkt->data[4], chunk_size)) != chunk_size) return ret < 0 ? ret : AVERROR(EIO); AV_WL16(&pkt->data[0], out_size); AV_WL16(&pkt->data[2], chunk_size); pkt->duration = out_size; } else { ret = av_get_packet(pb, pkt, chunk_size); if (ret != chunk_size) return AVERROR(EIO); pkt->duration = (chunk_size * 2) / st->codecpar->channels; pkt->stream_index = st->index; return ret;
1threat
android trying to add a TextView dynamically : I am trying to add a TextView widget dynamically in the code but it keeps crashing in the setText() line: TextView tv = new TextView(MainActivity.this); tv.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); tv.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); tv.setText("YOU: " + ET_message.getText().toString()); //this line crashes ll = (LinearLayout) findViewById(R.id.LL); ll.addView(tv); does anybody know why? It's supposed to be the easiest line here.
0debug
I wan to generate a random even number between min and max using this function. what do i need to change in this function : I have this function which gives me a random number between mi and max excluding the numbers in notthis. How do I change it to give me a number that is an even number. <!-- begin snippet: js hide: false --> <!-- language: lang-js --> function getrandomnumber(min,max,notthis) { var num=min+Math.floor((max-min+1)*Math.random()); var j=notthis.indexOf(num) while (j!=-1) { num=min+Math.floor((max-min+1)*Math.random()); j=notthis.indexOf(num) } return num; } a=getrandomnumber(0,100,"0,10,20") document.write(a) <!-- end snippet -->
0debug
static void vc1_h_overlap_c(uint8_t* src, int stride) { int i; int a, b, c, d; int d1, d2; int rnd = 1; for(i = 0; i < 8; i++) { a = src[-2]; b = src[-1]; c = src[0]; d = src[1]; d1 = (a - d + 3 + rnd) >> 3; d2 = (a - d + b - c + 4 - rnd) >> 3; src[-2] = a - d1; src[-1] = b - d2; src[0] = c + d2; src[1] = d + d1; src += stride; rnd = !rnd; } }
1threat
How to access WebAssembly linear memory from C/C++ : <p>I'm writing a small C program intended to be compiled to wasm w/ <code>emcc</code> and run in a web browser. Because wasm exported functions can only accept simple number values as parameter inputs and return values, I need to share memory between the JavaScript API and the compiled WebAssembly code in order to access more complex data types like strings or <code>char</code> arrays. The problem is that I can't for the life of me figure out how to access <a href="https://developer.mozilla.org/en-US/docs/WebAssembly/Using_the_JavaScript_API" rel="noreferrer">WebAssembly linear memory</a> from inside of my C program.</p> <p>My ultimate goal is to be able to read strings initialized in JavaScript inside of my C program, and then also read strings that are modified/initialized in my C program back in the web browser's JavaScript code.</p> <p>Here is a basic example of what I'm trying to do:</p> <p>main.js </p> <pre><code>const importObject = { 'env': { 'memoryBase': 0, 'tableBase': 0, 'memory': new WebAssembly.Memory({initial: 256}), 'table': new WebAssembly.Table({initial: 0, element: 'anyfunc'}) } } // using the fetchAndInstantiate util function from // https://github.com/mdn/webassembly-examples/blob/master/wasm-utils.js fetchAndInstantiate('example.wasm', importObject).then(instance =&gt; { // call the compiled webassembly main function instance.exports._main() console.log(importObject.env.memory) }) </code></pre> <p>example.c</p> <pre class="lang-js prettyprint-override"><code>int main() { // somehow access importObject.env.memory // so that I can write a string to it return 0; } </code></pre> <p><a href="https://stackoverflow.com/questions/41353389/how-can-i-return-a-javascript-string-from-a-webassembly-function">This question</a> gets me part of the way there, however, I still don't understand how to read/write from the WebAssembly memory buffer in my C code.</p>
0debug
static void virtio_crypto_dataq_bh(void *opaque) { VirtIOCryptoQueue *q = opaque; VirtIOCrypto *vcrypto = q->vcrypto; VirtIODevice *vdev = VIRTIO_DEVICE(vcrypto); if (!vdev->vm_running) { return; } if (unlikely(!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK))) { return; } virtio_crypto_handle_dataq(vdev, q->dataq); virtio_queue_set_notification(q->dataq, 1); }
1threat
static void vncws_send_handshake_response(VncState *vs, const char* key) { char combined_key[WS_CLIENT_KEY_LEN + WS_GUID_LEN + 1]; char hash[SHA1_DIGEST_LEN]; size_t hash_size = SHA1_DIGEST_LEN; char *accept = NULL, *response = NULL; gnutls_datum_t in; g_strlcpy(combined_key, key, WS_CLIENT_KEY_LEN + 1); g_strlcat(combined_key, WS_GUID, WS_CLIENT_KEY_LEN + WS_GUID_LEN + 1); in.data = (void *)combined_key; in.size = WS_CLIENT_KEY_LEN + WS_GUID_LEN; if (gnutls_fingerprint(GNUTLS_DIG_SHA1, &in, hash, &hash_size) == GNUTLS_E_SUCCESS) { accept = g_base64_encode((guchar *)hash, SHA1_DIGEST_LEN); } if (accept == NULL) { VNC_DEBUG("Hashing Websocket combined key failed\n"); vnc_client_error(vs); return; } response = g_strdup_printf(WS_HANDSHAKE, accept); vnc_write(vs, response, strlen(response)); vnc_flush(vs); g_free(accept); g_free(response); vs->encode_ws = 1; vnc_init_state(vs); }
1threat
static int get_scale_factor(H264SliceContext *sl, int poc, int poc1, int i) { int poc0 = sl->ref_list[0][i].poc; int td = av_clip_int8(poc1 - poc0); if (td == 0 || sl->ref_list[0][i].parent->long_ref) { return 256; } else { int tb = av_clip_int8(poc - poc0); int tx = (16384 + (FFABS(td) >> 1)) / td; return av_clip_intp2((tb * tx + 32) >> 6, 10); } }
1threat
What is a replacement for a deprecated JaCoCo extension in Gradle? : <p>I'm using <code>Robolectric</code> and <code>JaCoCo</code> together. My code coverage reports do not work without the following lines of code in gradle script:</p> <pre><code> testOptions { unitTests.all { jacoco { includeNoLocationClasses = true } } } </code></pre> <p>But in the recent version of Gradle the JaCoCo extension, that I use here, is marked as deprecated. I could not find any replacement for it. So, where should I apply the <code>includeNoLocationClasses = true</code> option?</p>
0debug
No name was provided for external module : <p>I created a data library, then tried to include the data library into another created library. Built fine, but received - "No name was provided for external module 'my-data' in output.globals – guessing 'myData'". What am I missing?</p> <p>Complete steps to re-create.</p> <ul> <li>ng new test-project --create=application=false</li> <li>cd test-project</li> <li>npm audit fix</li> <li>ng g library my-data</li> <li>ng g library my-core</li> <li>ng g application address-book</li> <li>ng build my-data</li> <li>Then in my-core.module add import { MyDataModule } from 'my-data';</li> <li>Then in my-core.module add imports: [MyDataModule]</li> <li>ng build my-core</li> </ul> <p>my-core.module.ts</p> <pre><code>import { NgModule } from '@angular/core'; import { MyCoreComponent } from './my-core.component'; import { MyDataModule } from 'my-data'; @NgModule({ declarations: [MyCoreComponent], imports: [MyDataModule], exports: [MyCoreComponent] }) export class MyCoreModule { } </code></pre> <ul> <li>After build get "No name was provided for external module 'my-data' in output.globals – guessing 'myData'"</li> </ul>
0debug
static int wv_read_packet(AVFormatContext *s, AVPacket *pkt) { WVContext *wc = s->priv_data; int ret, samples; if (url_feof(&s->pb)) return -EIO; if(wc->block_parsed){ if(wv_read_block_header(s, &s->pb) < 0) return -1; } samples = LE_32(wc->extra); if(samples * 2 * wc->chan > AVCODEC_MAX_AUDIO_FRAME_SIZE){ av_log(s, AV_LOG_ERROR, "Packet size is too big to be handled in lavc!\n"); return -EIO; } if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE) < 0) return AVERROR_NOMEM; memcpy(pkt->data, wc->extra, WV_EXTRA_SIZE); ret = get_buffer(&s->pb, pkt->data + WV_EXTRA_SIZE, wc->blksize); if(ret != wc->blksize){ av_free_packet(pkt); return AVERROR_IO; } pkt->stream_index = 0; wc->block_parsed = 1; pkt->size = ret + WV_EXTRA_SIZE; return 0; }
1threat
How to control knitr kable scientific notation? : <p>I have a data frame like this:</p> <pre><code>&gt; summary variable value 1 var1 5.810390e-06 2 var2 5.018182e-06 3 var3 5.414286e-06 4 var4 3.000779e+02 5 var5 -2.105123e+01 6 var6 8.224229e-01 </code></pre> <p>I want to print it in a word document using knitr/kable. Thus I used the following function:</p> <pre><code>knitr::kable(summary, row.names = FALSE, col.names = c("Variable", "Mean")) </code></pre> <p>But the result is not satisfying:</p> <p><a href="https://i.stack.imgur.com/3YxQs.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3YxQs.png" alt="enter image description here"></a></p> <p>I'm OK with variables 4 to 6, but variables 1 to 3 are really not easy to read this way... Is there a way to control this format?</p>
0debug
ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, va_list ap) { V9fsState *s = pdu->s; V9fsVirtioState *v = container_of(s, V9fsVirtioState, state); VirtQueueElement *elem = &v->elems[pdu->idx]; return v9fs_iov_vunmarshal(elem->out_sg, elem->out_num, offset, 1, fmt, ap); }
1threat
How can I enable Server GC in .NET Core? : <p>I have a .NET Core app (<em>MyApp.exe</em>) developed in <strong>VS2017</strong> running on the <strong>1.0.4</strong> version of the <em>SDK</em>. I have tried adding an <code>App.config</code> with the following entries:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;configuration&gt; &lt;runtime&gt; &lt;gcServer enabled="true"/&gt; &lt;/runtime&gt; &lt;/configuration&gt; </code></pre> <p>Which on build is renamed to: <code>MyApp.config</code>.</p> <p>But this does not change the <em>GC</em> mode; Any ideas?</p>
0debug
void s390_virtio_irq(S390CPU *cpu, int config_change, uint64_t token) { if (kvm_enabled()) { kvm_s390_virtio_irq(cpu, config_change, token); } else { cpu_inject_ext(cpu, EXT_VIRTIO, config_change, token); } }
1threat
Python: How to replace first number before a space in each line in a text file : My file look like the following: 12.32 1:34 2:49 5:21 29:98 13.53 1:23 2:82 5:23 29:45 51.92 1:23 2:54 5:54 29:63 12.42 1:34 2:43 5:32 29:32 I am trying to replace every first number in each line by another number. What would be a good method? I tried pointing to the number by with open('file.txt', 'r') as file: line = file.readline() line[0] but it just gives me first character, not the entire number. Thank you so much!
0debug
static int svq1_decode_block_non_intra(GetBitContext *bitbuf, uint8_t *pixels, int pitch) { uint32_t bit_cache; uint8_t *list[63]; uint32_t *dst; const uint32_t *codebook; int entries[6]; int i, j, m, n; int mean, stages; int x, y, width, height, level; uint32_t n1, n2, n3, n4; list[0] = pixels; for (i = 0, m = 1, n = 1, level = 5; i < n; i++) { SVQ1_PROCESS_VECTOR(); dst = (uint32_t *)list[i]; width = 1 << ((4 + level) / 2); height = 1 << ((3 + level) / 2); stages = get_vlc2(bitbuf, svq1_inter_multistage[level].table, 3, 2) - 1; if (stages == -1) continue; if ((stages > 0) && (level >= 4)) { av_dlog(NULL, "Error (svq1_decode_block_non_intra): invalid vector: stages=%i level=%i\n", stages, level); return AVERROR_INVALIDDATA; } mean = get_vlc2(bitbuf, svq1_inter_mean.table, 9, 3) - 256; SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_inter_codebooks); for (y = 0; y < height; y++) { for (x = 0; x < width / 4; x++, codebook++) { n3 = dst[x]; n1 = n4 + ((n3 & 0xFF00FF00) >> 8); n2 = n4 + (n3 & 0x00FF00FF); SVQ1_ADD_CODEBOOK() dst[x] = n1 << 8 | n2; } dst += pitch / 4; } } return 0; }
1threat
write to dynamic array : I created a dynamic array using pointers and successfully opened a text file to read the number of integers into an int pointer. Now I am trying to store the items from the text file sequentially into the array. *x = 0; do { file >> *temp; intArray[*x] = *temp; *x = *x + 1; cout << donationsArray[*x]; } while (*x < *arraySize); The above uses cout to show me test output, which only produces a memory address. (the same memory address repeatedly for all the array positions) -842150451 What am I doing wrong here?
0debug
factorial using increement for loop gives garbage value : <pre><code>#include&lt;iostream&gt; using namespace std; int main() { int fact; for(int i=1; i&lt;=fact; i++) { fact = fact*i; } cout&lt;&lt;fact; } </code></pre> <p>Output : garbage value.</p> <p>Please anyone tell me why using increment for loop gives me this but not decrement for loop.</p>
0debug
Enable http2 on Nginx on Windows : <p>I am using <code>nginx</code> version <code>1.10.3</code> on windows 7. I want to enable <code>http2</code>. I have added the following in the config file:</p> <pre><code> server { listen 443 http2 ssl proxy_protocol; } </code></pre> <p>When I start nginx server, I get the following error:</p> <pre><code>2017/02/15 14:34:33 [emerg] 8948#6892: the "http2" parameter requires ngx_http_v2_module in C:\Develop\Application\nginx-1.10.3/conf/nginx.conf:64 </code></pre> <p>Line number 64 is the same as the line specified above.</p> <p>How can I install <code>ngx_http_v2_module</code> on Windows?</p>
0debug
static void test_qemu_strtoul_trailing(void) { const char *str = "123xxx"; char f = 'X'; const char *endptr = &f; unsigned long res = 999; int err; err = qemu_strtoul(str, &endptr, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, 123); g_assert(endptr == str + 3); }
1threat
Error Handling in Swift 3 : <p>I'm migrating my code over to Swift 3 and see a bunch of the same warnings with my do/try/catch blocks. I want to check if an assignment doesn't return nil and then print something out to the console if it doesn't work. The catch block says it "is unreachable because no errors are thrown in 'do' block". I would want to catch all errors with one catch block.</p> <pre><code>let xmlString: String? do{ //Warning for line below: "no calls to throwing function occurs within 'try' expression try xmlString = String(contentsOfURL: accessURL, encoding: String.Encoding.utf8) var xmlDict = XMLDictionaryParser.sharedInstance().dictionary(with: xmlString) if let models = xmlDict?["Cygnet"] { self.cygnets = models as! NSArray } //Warning for line below: "catch block is unreachable because no errors are thrown in 'do' block } catch { print("error getting xml string") } </code></pre> <p>How would I write a proper try catch block that would handle assignment errors?</p>
0debug
set active link with jquery in multipage page : i know its not the first question. i try from http://stackoverflow.com/questions/14039968/jquery-make-a-link-in-active-status. but its not working, when i click to go different page the 'a' didnt have class active. here my link. any suggestion thanks. <nav class="main-navi"> <ul> <li> <a href="index.html"> Home <span class="dot"></span> <span class="corner"></span> </a> </li> <li> <a href="portfolio.html"> Portfolio <span class="dot"></span> <span class="corner"></span> </a> </li> <li> <a href="about.html"> About <span class="dot"></span> <span class="corner"></span> </a> </li> <li> <a class="" href="service.html"> services <span class="dot"></span> <span class="corner"></span> </a> </li> <li> <a href="blog.html"> Blog <span class="dot"></span> <span class="corner"></span> </a> </li> <li> <a href="contact.html"> contacts <span class="dot"></span> <span class="corner"></span> </a> </li> </ul> <em id="showHideMenu" class="show-hide-menu fa fa-bars" href="#"></em> </nav> <script> jQuery(function($){ $('.main-navi a').filter(function(){ return $(this).attr('href').toLowerCase() === window.location.pathname.toLowerCase(); }).addClass('active'); }); </script>
0debug
av_cold void ff_vp8dsp_init_neon(VP8DSPContext *dsp) { dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_neon; dsp->vp8_idct_add = ff_vp8_idct_add_neon; dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_neon; dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_neon; dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_neon; dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_neon; dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_neon; dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_neon; dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_neon; dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_neon; dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_neon; dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_neon; dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_neon; dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_neon; dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_neon; dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_neon; dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_neon; dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_neon; dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_neon; dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_neon; dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_neon; dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_neon; dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_neon; dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_neon; dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_neon; dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_neon; dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_neon; dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_neon; dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_neon; dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_neon; dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_neon; dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_neon; dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_neon; dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_neon; dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_neon; dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_neon; dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_neon; dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_neon; dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_neon; dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_neon; dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_neon; dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_neon; dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_neon; dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_neon; dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_neon; dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_neon; dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_neon; dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_neon; }
1threat
In Vue.js, how can I emit multiple value from child to parent while parent's v-on pass another parameter? : <p>This is a code example.</p> <pre class="lang-js prettyprint-override"><code>Vue.component('button-counter', { template: '&lt;button v-on:click="emit_event"&gt;button&lt;/button&gt;', methods: { emit_event: function () { this.$emit('change', 'v1', 'v2', 'v3') // Here I emit multiple value } }, }) new Vue({ el: '#parent', data: { args: "" }, methods: { change: function (...args) { this.args = args console.log(args) } } }) </code></pre> <pre class="lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.3.3/vue.common.js"&gt;&lt;/script&gt; &lt;div id="parent"&gt; {{ args }} &lt;br /&gt; &lt;button-counter v-on:change="change(1234, $event)"&gt;&lt;/button-counter&gt; &lt;/div&gt; </code></pre> <p>From the parent component, I want to get parameter pass by change() (in this example, 1234), but also every value emitted by child component. I try to use $event to catch the values child emit, however $event is only set up to the first value child emit (int this example, 'v1')</p> <p>Is there any way to do that? I know I can emit an array to catch multiple value. But some library just emit multiple value.</p> <p>This is the codepen for above example. <a href="https://codepen.io/anon/pen/MmLEqX?editors=1011" rel="noreferrer">https://codepen.io/anon/pen/MmLEqX?editors=1011</a></p>
0debug
Send dynamically div image to client mail : <p>i am using html2canvas with barcode to make a dynamically image to specific div with the below function </p> <pre><code>$(function() { $("#btnSave").click(function() { html2canvas($('#printableArea'), { onrendered: function(canvas) { var img = canvas.toDataURL() window.open(img); } }); }); }); </code></pre> <p>The image opens into new winodw in base64 My problem is that i want to send the image to client mail for printing. The image changes for each client accordingly and is specific </p> <p>my php file is </p> <pre><code>&lt;?php include("auth.php"); //message $message = $_POST['msg']; $username =$_REQUEST['username']; $surname =$_REQUEST['surname']; $name= $_REQUEST['name']; //mail body - image position, background, font color, font size... $body = "Dear $surname $name Thank you for your Pre-registration for Global. Please print the attached e-ticket with your personal barcode and bring it to the reception of the exhibition. This barcode includes data about you which is required during registration. Having this barcode will considerably speed up the registration process Organizing committee.\n". $body = "Print e-ticket (http://panosmoustis.netai.net/barcodeimage/E-ticket_2016.pdf) .\n". $headers='MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html;charset=iso-8859-1' . "\r\n"; $headers .= 'From: &lt;http://panosmoustis.netai.net/&gt;' . "\r\n"; $to = $_POST['mail']; $subject = "EXPRESS REGISTRATION (Global)"; //mail function $email = mail($to, $subject, $body, $headers); if(!$email) { echo "Error sending email"; } else { echo "Your email was sent successfully."; } ?&gt; </code></pre> <p>thank you</p>
0debug
Python Error: __init__() takes at least 6 arguments (6 given) : So I have searched every one of these questions but I didn't find anything helping me. I'm still relatively new to Python and I have this class for a simple dialogue box displaying some text: class DialogueBox(object): def __init__(self, text, font, size, wh, pos="center", padding=20): self.text = text self.font = font self.size = size self.width = wh[0] self.height = wh[1] self.image = pygame.image.load("img/dialogue_box_background.png") self.image = pygame.transform.scale(self.image, (self.width, self.height)) if pos == "center": self.pos[0] = screensize[0] - (self.width / 2) self.pos[1] = screensize[1] - (self.height / 2) else: self.pos = pos self.textpos = tuple(self.pos[0] + (padding / 2), self.pos[1] + (padding / 2)) self.rect = pygame.Rect(self.pos[0], self.pos[1], self.width, self.height) self.textfont = pygame.font.Font(font,size) self.textsurf = self.textfont.render(text, 1, (255,255,255)) if self.textsurf.get_width() > (width - padding): self.mode = "long" else: self.mode = "short" def draw(self): screen.blit(self.image, self.pos) if self.mode == "short": textfunc(self.text, self.font, (self.textpos[0] + (self.width / 2), self.textpos[1] + (self.height / 2), (255,255,255))) else: blit_text(screen, self.text, self.textpos, self.textfont, pygame.Color("white")) I am 100% aware that the indentation of class DialgueBox(object): is wrong here, it is correct in my code. Stackoverflow just messed with my indentation for some reason and I didn't want to put 4 spaces in front of every line of code of the class. Just ignore it. Anyway, I then do opts_rsto_box = DialogueBox(curlang["cfdial"][0],genfont,(100,100)) and get the error Traceback (most recent call last): File "D:\Programmieren\SpaceStrategieGame\p.py", line 191, in <module> update_rects() File "D:\Programmieren\SpaceStrategieGame\p.py", line 182, in update_rects opts_rsto_box = DialogueBox(curlang["cfdial"][0],genfont,(100,100)) TypeError: __init__() takes at least 5 arguments (4 given) which is pretty weird because the class has only 4 required arguments. Really sorry if this is a stupid question but I don't understand why I get this error.
0debug
Database Management system - Natural join : Consider that the relation R(A,B,C) contains 200 tuples and relation S(A,D,E) contains 100 tuples, then the maximum number of tuples possible in a natural join of R and S. Select one: A. 300 B. 200 C. 100 D. 20000 It will be great if the answer is provided with some explanation. Thanks in advance.
0debug
how to create wordpress shortcode by this code : Sir, I have this code to show all post of category and thumbnail for 1st post of them. <?php $recent = new WP_Query(); ?> <?php $recent->query( 'cat=1&showposts=5' ); ?> <?php $is_first_post = true; ?> <?php while( $recent->have_posts() ) : $recent->the_post(); ?> <ul> <li> <?php if ( $is_first_post && has_post_thumbnail() ) { the_post_thumbnail(); $is_first_post = false; } ?> <a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a> </li> </ul> <?php endwhile; ?> but i want show this using shortcode.which using category & post number but i can not make shortcode.please help me.
0debug
Compilation Error for DEC Alpha CC compiler : I'm trying to compile source code, that from 2001, in Ubuntu 18.04.2 LTS. But, I got the errors below and actually don't know how I have to change the compiling code. Can you help me for compiling this code? Suggested compilation part from the program SUGGESTED COMPILATION COMMAND LINE (FOR A DEC-ALPHA CC-COMPILER): cc -lm -fast -tune host -arch host -assume whole_program \ -o mol_volume mol_volume.c When I tried this code, errors; cc: error: host: No such file or directory cc: error: host: No such file or directory cc: error: whole_program: No such file or directory cc: error: unrecognized command line option ‘-fast’; did you mean ‘-Ofast’? cc: error: unrecognized command line option ‘-tune’; did you mean ‘-mtune=’? cc: error: unrecognized command line option ‘-arch’; did you mean ‘-march=’? cc: error: unrecognized command line option ‘-assume’; did you mean ‘-msse’? Then, I changed `-fast`, `-tune`, `-arch`, `-assume` flags with `-Ofast`, `-mtune=native`, `-march=native`, `-msse` then add the path the for the directory part of the errors. cc -lm -Ofast -mtune=native -march=native -msse /mypath/ -o mol_volume mol_volume.c Then, I got that error; mol_volume.c: In function ‘main’: mol_volume.c:235:10: warning: implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration] while( gets(s) ) { ^~~~ fgets mol_volume.c:311:26: warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=] printf("WARNING: the %i-th atom of the pdb file %s has an unknown chemical type %s.\n", ~^ %li i+1, pdb_name, atom_type); ~~~ /usr/bin/ld: cannot find .: File format not recognized collect2: error: ld returned 1 exit status You can access the source code via this link; [Source Code][1] Thank you. ***My PC info:*** **Operation System**: Ubuntu 18.04.2 LTS **Kernel ver.:** 4.15.0-50-generic **GCC ver.:** 7.4.0 [1]: http://www.ks.uiuc.edu/Development/MDTools/molvolume/
0debug
static void gen_exception_internal_insn(DisasContext *s, int offset, int excp) { gen_set_condexec(s); gen_set_pc_im(s, s->pc - offset); gen_exception_internal(excp); s->is_jmp = DISAS_JUMP; }
1threat
Run python-script from CMD - windows : <p>I want to run my python script without the <code>python</code> keyword at the beginning.</p> <p>Example : I don't want <code>python script.py</code>.</p> <p>I want <code>script.py</code></p> <p>The problem is that when I run it how I want the script opens in a text editor, and it doesn't run in the console...</p> <p>Why?</p>
0debug
import math def surfacearea_sphere(r): surfacearea=4*math.pi*r*r return surfacearea
0debug
I am doing Navigation Drawable in Android Studio. I have error named cannot find symbol class actionbar and toolbar : I am making Sliding Menu in Navigation Drawable in Android Studio. But while adding toolbar and actionbar I get errors (`cannot find symbol class`). MainPageActivity.java import android.Manifest; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ImageView; import android.widget.ListView; public class MainPageActivity extends Activity { //slider_menu için *******************************************************/////////// private DrawerLayout mDrawerLayout; /////////////////************************ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mainpage); ///// ********************** toolbar -************************* mDrawerLayout = findViewById(R.id.drawer_layout); NavigationView navigationView = findViewById(R.id.nav_view); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionbar = getSupportActionBar(); actionbar.setDisplayHomeAsUpEnabled(true); actionbar.setHomeAsUpIndicator(R.drawable.ic_menu); navigationView.setNavigationItemSelectedListener( new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { // set item as selected to persist highlight menuItem.setChecked(true); // close drawer when item is tapped mDrawerLayout.closeDrawers(); // Add code here to update the UI based on the item selected // For example, swap UI fragments here return true; } }); /// **************************** Listen open and close slider menu button ****************************** mDrawerLayout.addDrawerListener( new DrawerLayout.DrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { // Respond when the drawer's position changes } @Override public void onDrawerOpened(View drawerView) { // Respond when the drawer is opened } @Override public void onDrawerClosed(View drawerView) { // Respond when the drawer is closed } @Override public void onDrawerStateChanged(int newState) { // Respond when the drawer motion state changes } } ); //**********************************************//////////////////// ListView list; final String[] web = { getString(R.string.mainpage_acil), getString(R.string.mainpage_bildirim), getString(R.string.mainpage_isguveligi), }; Integer[] imageId = { R.drawable.mainpage_acil_icon_p, R.drawable.mainpage_bildirim_icon_p, R.drawable.mainpage_isguvenligi_icon_p, }; CustomListMainPage adapter = new CustomListMainPage(MainPageActivity.this, web, imageId); list = (ListView) findViewById(R.id.list); list.setAdapter(adapter); list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //Toast.makeText(MainPageActivity.this, "You Clicked at " + web[+position], Toast.LENGTH_SHORT).show(); Log.v("Pozisyon", String.valueOf(position)); Intent intentPos; ImageView imageView= (ImageView) view.findViewById(R.id.img); boolean flag=false; /// Renk değiştirme buraya tekrar bak*************** switch (position) { case 0 : //Toast.makeText(MainPageActivity.this, "You Clicked at " + web[+position], Toast.LENGTH_SHORT).show(); imageView.setImageResource(R.drawable.mainpage_acil_icon_p); intentPos=new Intent(MainPageActivity.this,EmergencyActivity.class); startActivity(intentPos); break; case 1 : imageView.setImageResource(R.drawable.mainpage_bildirim_icon_p); intentPos=new Intent(MainPageActivity.this,NotificationPage.class); startActivity(intentPos); break; case 2 : imageView.setImageResource(R.drawable.mainpage_isguvenligi_icon_p); intentPos=new Intent(MainPageActivity.this,JobSecurityActivity.class); startActivity(intentPos); break; default : System.out.println("Hatali secim! 1, 2 ya da 3'e basiniz."); break; } } }); } //slider_menu buton ayarları için *******************************************************/////////// @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: mDrawerLayout.openDrawer(GravityCompat.START); return true; } return super.onOptionsItemSelected(item); } //slider_menu buton ayarları için *******************************************************/////////// } I will also add my `build.gradle`. apply plugin: 'com.android.application' android { compileSdkVersion 27 defaultConfig { applicationId "com.example.gokhan.emasapps" minSdkVersion 19 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" manifestPlaceholders = [HOCKEYAPP_APP_ID: "fcf64fa85c66428282796d0b1ed78ff1"] } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { jcenter() maven { url "https://dl.bintray.com/drummer-aidan/maven" } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') //noinspection GradleCompatible implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:design:27.1.1' implementation 'com.android.support:support-v4:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' implementation 'com.afollestad:material-camera:0.4.4' implementation 'net.hockeyapp.android:HockeySDK:5.1.0' } `activity_mainpage.xml` <?xml version="1.0" encoding="utf-8"?> <!-- Use DrawerLayout as root container for activity --> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" app:menu="@menu/menu_main" app:headerLayout="@layout/nav_header" android:orientation="vertical" android:background="#000000"> !-- Layout to contain contents of main body of screen (drawer will slide over this) --> <FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" > <!-- Toolbar için ***********************************************--> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" android:theme="@style/ThemeOverlay.AppCompat.ActionBar" /> <!-- Toolbar için *****************************************--> <!-- Container for contents of drawer - use NavigationView to make configuration easier --> <android.support.design.widget.NavigationView android:id="@+id/nav_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" android:fitsSystemWindows="true" /> </FrameLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightSum="60" android:alpha=".85" android:background="@drawable/mainpage_background" android:layout_marginBottom="10dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="40" android:orientation="vertical"> <TextView android:id="@+id/textView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="EMAS" android:textAlignment="center" android:textColor="@color/colorWhite" android:textSize="18sp" android:textStyle="bold" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dip" android:orientation="vertical" android:layout_weight="20"> <include layout="@layout/mainpage_inner_part" /> </LinearLayout> </LinearLayout> </android.support.v4.widget.DrawerLayout> Maybe I have problem in layout or only about gradle of app. I have tried appcombat.v4 and appcombatv7 versions for import. But problem didn't change. Please help me to solve this problem.
0debug
Calculating summations : <p><a href="http://i.stack.imgur.com/YkWea.png" rel="nofollow">Link to question</a></p> <p>I am struggling so answer the following question. I think the reason I am not doing it correctly is because i starts at 0 rather than 1, but I am not sure how to do it.</p>
0debug
Download all files in a path on Jupyter notebook server : <p>As a user in a class that runs Jupyter notebooks for assignments, I have access to the assignments via the web interface. I assume the assignments are stored somewhere in my personal space on the server, and so I should be able to download them. How can I download all files that are in my personal user space? (e.g., <code>wget</code>)</p> <p>Here's the path structure:</p> <p><code>https://urltoserver/user/username</code></p> <p>There are several directories: assignments, data, etc.</p> <p><code>https://urltoserver/user/username/assignments</code></p> <p><code>https://urltoserver/user/username/data</code></p> <p><code>...</code></p> <p>I want to download all the folders (recursively). Just enough that I can launch whatever I see online locally. If there are some forbidden folders, then ok, skip those and download the rest.</p> <p>Please specify the command exactly as I couldn't figure it out myself (I tried <code>wget</code>)</p>
0debug
void qemu_aio_ref(void *p) { BlockAIOCB *acb = p; acb->refcnt++; }
1threat
How to get debug information when developing tick script for kapacitor? : <p>I am wondering if during tickscript development, there is any opportunity to dump the stream state after passing through the processing node (log to the file, stdout)?</p>
0debug
UWP: How to resize an Image : <p>I have a JPEG image stored in a Byte[] that I want to resize. This is my code:</p> <pre><code>public async Task&lt;byte[]&gt; ResizeImage(byte[] imageData, int reqWidth, int reqHeight, int quality) { var memStream = new MemoryStream(imageData); IRandomAccessStream imageStream = memStream.AsRandomAccessStream(); var decoder = await BitmapDecoder.CreateAsync(imageStream); if (decoder.PixelHeight &gt; reqHeight || decoder.PixelWidth &gt; reqWidth) { using (imageStream) { var resizedStream = new InMemoryRandomAccessStream(); BitmapEncoder encoder = await BitmapEncoder.CreateForTranscodingAsync(resizedStream, decoder); double widthRatio = (double) reqWidth/decoder.PixelWidth; double heightRatio = (double) reqHeight/decoder.PixelHeight; double scaleRatio = Math.Min(widthRatio, heightRatio); if (reqWidth == 0) scaleRatio = heightRatio; if (reqHeight == 0) scaleRatio = widthRatio; uint aspectHeight = (uint) Math.Floor(decoder.PixelHeight*scaleRatio); uint aspectWidth = (uint) Math.Floor(decoder.PixelWidth*scaleRatio); encoder.BitmapTransform.InterpolationMode = BitmapInterpolationMode.Linear; encoder.BitmapTransform.ScaledHeight = aspectHeight; encoder.BitmapTransform.ScaledWidth = aspectWidth; await encoder.FlushAsync(); resizedStream.Seek(0); var outBuffer = new byte[resizedStream.Size]; uint x = await resizedStream.WriteAsync(outBuffer.AsBuffer()); return outBuffer; } } return imageData; } </code></pre> <p>The problem is that outBuffer just contains zeros although the correct number of Bytes have been written.</p>
0debug
Spring Cloud Feign: Is Feign efficient enough compared with RestTemplate? : <p>I quickly browsed the source code of Feign, I found that Feign uses JDK's <code>HttpUrlConnection</code> to issue HTTP request and close it when request finished without using a connection pool. I doubt the efficiency of this kind of manner. Then I read the document of Spring's <code>RestTemplate</code> which says <code>RestTemplate</code> can switch to Apache Http Client or OKHttp to send HTTP request:</p> <blockquote> <p>Note: by default the RestTemplate relies on standard JDK facilities to establish HTTP connections. You can switch to use a different HTTP library such as Apache HttpComponents, Netty, and OkHttp through the HttpAccessor.setRequestFactory(org.springframework.http.client.ClientHttpRequestFactory) property.</p> </blockquote> <p>Does it mean RestTemplate is better than Feign at the view of performance?</p>
0debug
int rom_add_vga(const char *file) { if (!rom_enable_driver_roms) return 0; return rom_add_file(file, "vgaroms", file, 0); }
1threat
i want to restore my project in my yesterday file in Xcode, how can i do that? : i am a beginner in the iOS development, now i am trying to debug my code as we know, Xcode is autosaving. i am debugging a chunk of code right now, but i am messed up, somehow it didn't work properly, i have tried using control + Z to get back, but it still didn't work. i want to back to my yesterday xcode project file, but the problem is, i have not made any backup, and i have not made local repository. can get my previous version file back? does it work if i use git reset ? git reset Thanks
0debug
static int blk_send_response_one(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; int send_notify = 0; int have_requests = 0; blkif_response_t resp; void *dst; resp.id = ioreq->req.id; resp.operation = ioreq->req.operation; resp.status = ioreq->status; switch (blkdev->protocol) { case BLKIF_PROTOCOL_NATIVE: dst = RING_GET_RESPONSE(&blkdev->rings.native, blkdev->rings.native.rsp_prod_pvt); break; case BLKIF_PROTOCOL_X86_32: dst = RING_GET_RESPONSE(&blkdev->rings.x86_32_part, blkdev->rings.x86_32_part.rsp_prod_pvt); break; case BLKIF_PROTOCOL_X86_64: dst = RING_GET_RESPONSE(&blkdev->rings.x86_64_part, blkdev->rings.x86_64_part.rsp_prod_pvt); break; default: dst = NULL; } memcpy(dst, &resp, sizeof(resp)); blkdev->rings.common.rsp_prod_pvt++; RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blkdev->rings.common, send_notify); if (blkdev->rings.common.rsp_prod_pvt == blkdev->rings.common.req_cons) { RING_FINAL_CHECK_FOR_REQUESTS(&blkdev->rings.common, have_requests); } else if (RING_HAS_UNCONSUMED_REQUESTS(&blkdev->rings.common)) { have_requests = 1; } if (have_requests) { blkdev->more_work++; } return send_notify; }
1threat
ASP.NET Core Singleton instance vs Transient instance performance : <p>In ASP.NET Core Dependency Injection, I just wonder if registering <code>Singleton</code> instances will improve performance better than registering <code>Transient</code> instances or not?</p> <p>In my thinking, for <code>Singleton</code> instance, it just cost once time for creating new object and dependent objects. For <code>Transient</code> instance, this cost will be repeat for each service request. So <code>Singleton</code> seems to be better. But how much performance gaining we have when using <code>Singleton</code> over <code>Transient</code>? Thank you in advanced!</p>
0debug
How to convert Spark RDD to pandas dataframe in ipython? : <p>I have a <code>RDD</code> and I want to convert it to <code>pandas</code> <code>dataframe</code>. I know that to convert and <code>RDD</code> to a normal <code>dataframe</code> we can do</p> <pre><code>df = rdd1.toDF() </code></pre> <p>But I want to convert the <code>RDD</code> to <code>pandas</code> <code>dataframe</code> and not a normal <code>dataframe</code>. How can I do it?</p>
0debug
Python: My for loop gets a syntax error after 1 cycle inside of loop : I am in a low-level coding class, and I have to create a program where the user enters an integer. The program then runs a series of loops to determine the smallest and largest values of the series entered by the user as well as the count of even and odd numbers entered by the user, while also keeping a running total of all integers that have been entered. A blank line entered tells the program to stop and outputs the previously stated information. As the question states, I am not sure how to fix the syntax error after the program enters the loop and runs one cycle. Here is the code so far: counte=0 counto=0 sum=0 num=(input("Enter an integer (blank line to quit):")) max=0 min=0 value=0 if(num==''): print("No input values were provided.\nQuitting the program!!!") while (num!=''): value=int(input("Enter an integer (blank line to quit):")) if(num%2==0): counte+=1 else: counto+=1 sum+=value if(value>max): max=value if(value<min): min=value num=int(input("Enter an integer (blank line to quit:")) print("The smallest value is",min, "and the larges value is",max,".") print("The user entered",counte,"even, and",counto,"odd values.") print("The cumulative total is",total,".") The syntax error that I am returned when running the program is: Traceback (most recent call last): File "*sensitive information*", line 12, in <module> if(num%2==0): TypeError: not all arguments converted during string formatting
0debug
Tests Failed: 0 passed, 1 failed - Junit : [enter image description here][1] [1]: https://i.stack.imgur.com/HJil2.jpg My code is below: @Test public void testTrans() { AccountDao accountDao = new AccountDao(); accountDao.trans(); System.out.printf("test trans()"); } When I using Junit to test the method, occurs the issue, this below is Event Log information: > 2017/2/15 > 上午10:08 All files are up-to-date > 上午10:08 Tests Failed: 0 passed, 1 failed
0debug
Converting date between timezones swift : <p>I have a date stored on my online server database which is in <code>GMT</code>. I load the date and convert it to the user's timezone using the following code : </p> <pre><code> if let messagedate = oneitem["timestamp"] as? String { let dateFormatter = NSDateFormatter() dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" let date = dateFormatter.dateFromString(messagedate) let source_timezone = NSTimeZone(abbreviation: "GMT") let local_timezone = NSTimeZone.systemTimeZone() let source_EDT_offset = source_timezone?.secondsFromGMTForDate(date!) let destination_EDT_offset = local_timezone.secondsFromGMTForDate(date!) let time_interval : NSTimeInterval = Double(destination_EDT_offset - source_EDT_offset!) let final_date = NSDate(timeInterval: time_interval, sinceDate: date!) curr_item.date = final_date } </code></pre> <p>Now I need to convert the date back to <code>GMT</code> in order to communicate it to the server, however I'm not sure how to convert it back to <code>GMT</code>.</p>
0debug
static int nbd_negotiate_handle_info(NBDClient *client, uint32_t length, uint32_t opt, uint16_t myflags, Error **errp) { int rc; char name[NBD_MAX_NAME_SIZE + 1]; NBDExport *exp; uint16_t requests; uint16_t request; uint32_t namelen; bool sendname = false; bool blocksize = false; uint32_t sizes[3]; char buf[sizeof(uint64_t) + sizeof(uint16_t)]; const char *msg; if (length < sizeof(namelen) + sizeof(requests)) { msg = "overall request too short"; if (nbd_read(client->ioc, &namelen, sizeof(namelen), errp) < 0) { return -EIO; be32_to_cpus(&namelen); length -= sizeof(namelen); if (namelen > length - sizeof(requests) || (length - namelen) % 2) { msg = "name length is incorrect"; if (nbd_read(client->ioc, name, namelen, errp) < 0) { return -EIO; name[namelen] = '\0'; length -= namelen; trace_nbd_negotiate_handle_export_name_request(name); if (nbd_read(client->ioc, &requests, sizeof(requests), errp) < 0) { return -EIO; be16_to_cpus(&requests); length -= sizeof(requests); trace_nbd_negotiate_handle_info_requests(requests); if (requests != length / sizeof(request)) { msg = "incorrect number of requests for overall length"; while (requests--) { if (nbd_read(client->ioc, &request, sizeof(request), errp) < 0) { return -EIO; be16_to_cpus(&request); length -= sizeof(request); trace_nbd_negotiate_handle_info_request(request, nbd_info_lookup(request)); switch (request) { case NBD_INFO_NAME: sendname = true; break; case NBD_INFO_BLOCK_SIZE: blocksize = true; break; assert(length == 0); exp = nbd_export_find(name); if (!exp) { return nbd_negotiate_send_rep_err(client->ioc, NBD_REP_ERR_UNKNOWN, opt, errp, "export '%s' not present", name); if (sendname) { rc = nbd_negotiate_send_info(client, opt, NBD_INFO_NAME, namelen, name, errp); if (rc < 0) { return rc; if (exp->description) { size_t len = strlen(exp->description); rc = nbd_negotiate_send_info(client, opt, NBD_INFO_DESCRIPTION, len, exp->description, errp); if (rc < 0) { return rc; sizes[0] = (opt == NBD_OPT_INFO || blocksize) ? BDRV_SECTOR_SIZE : 1; sizes[1] = 4096; sizes[2] = MIN(blk_get_max_transfer(exp->blk), NBD_MAX_BUFFER_SIZE); trace_nbd_negotiate_handle_info_block_size(sizes[0], sizes[1], sizes[2]); cpu_to_be32s(&sizes[0]); cpu_to_be32s(&sizes[1]); cpu_to_be32s(&sizes[2]); rc = nbd_negotiate_send_info(client, opt, NBD_INFO_BLOCK_SIZE, sizeof(sizes), sizes, errp); if (rc < 0) { return rc; trace_nbd_negotiate_new_style_size_flags(exp->size, exp->nbdflags | myflags); stq_be_p(buf, exp->size); stw_be_p(buf + 8, exp->nbdflags | myflags); rc = nbd_negotiate_send_info(client, opt, NBD_INFO_EXPORT, sizeof(buf), buf, errp); if (rc < 0) { return rc; if (opt == NBD_OPT_INFO && !blocksize) { return nbd_negotiate_send_rep_err(client->ioc, NBD_REP_ERR_BLOCK_SIZE_REQD, opt, errp, "request NBD_INFO_BLOCK_SIZE to " "use this export"); rc = nbd_negotiate_send_rep(client->ioc, NBD_REP_ACK, opt, errp); if (rc < 0) { return rc; if (opt == NBD_OPT_GO) { client->exp = exp; QTAILQ_INSERT_TAIL(&client->exp->clients, client, next); nbd_export_get(client->exp); rc = 1; return rc; invalid: if (nbd_drop(client->ioc, length, errp) < 0) { return -EIO; return nbd_negotiate_send_rep_err(client->ioc, NBD_REP_ERR_INVALID, opt, errp, "%s", msg);
1threat
gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb, int search_pc) { uint16_t *gen_opc_end; uint32_t pc_start; int j, lj; struct DisasContext ctx; struct DisasContext *dc = &ctx; uint32_t next_page_start, org_flags; target_ulong npc; int num_insns; int max_insns; qemu_log_try_set_file(stderr); pc_start = tb->pc; dc->env = env; dc->tb = tb; org_flags = dc->synced_flags = dc->tb_flags = tb->flags; gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; dc->is_jmp = DISAS_NEXT; dc->jmp = 0; dc->delayed_branch = !!(dc->tb_flags & D_FLAG); if (dc->delayed_branch) { dc->jmp = JMP_INDIRECT; } dc->pc = pc_start; dc->singlestep_enabled = env->singlestep_enabled; dc->cpustate_changed = 0; dc->abort_at_next_insn = 0; dc->nr_nops = 0; if (pc_start & 3) cpu_abort(env, "Microblaze: unaligned PC=%x\n", pc_start); if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { #if !SIM_COMPAT qemu_log("--------------\n"); log_cpu_state(env, 0); #endif } next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; lj = -1; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) max_insns = CF_COUNT_MASK; gen_icount_start(); do { #if SIM_COMPAT if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { tcg_gen_movi_tl(cpu_SR[SR_PC], dc->pc); gen_helper_debug(); } #endif check_breakpoint(env, dc); if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (lj < j) { lj++; while (lj < j) tcg_ctx.gen_opc_instr_start[lj++] = 0; } tcg_ctx.gen_opc_pc[lj] = dc->pc; tcg_ctx.gen_opc_instr_start[lj] = 1; tcg_ctx.gen_opc_icount[lj] = num_insns; } LOG_DIS("%8.8x:\t", dc->pc); if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) gen_io_start(); dc->clear_imm = 1; decode(dc, cpu_ldl_code(env, dc->pc)); if (dc->clear_imm) dc->tb_flags &= ~IMM_FLAG; dc->pc += 4; num_insns++; if (dc->delayed_branch) { dc->delayed_branch--; if (!dc->delayed_branch) { if (dc->tb_flags & DRTI_FLAG) do_rti(dc); if (dc->tb_flags & DRTB_FLAG) do_rtb(dc); if (dc->tb_flags & DRTE_FLAG) do_rte(dc); dc->tb_flags &= ~D_FLAG; if (dc->jmp == JMP_INDIRECT) { eval_cond_jmp(dc, env_btarget, tcg_const_tl(dc->pc)); dc->is_jmp = DISAS_JUMP; } else if (dc->jmp == JMP_DIRECT) { t_sync_flags(dc); gen_goto_tb(dc, 0, dc->jmp_pc); dc->is_jmp = DISAS_TB_JUMP; } else if (dc->jmp == JMP_DIRECT_CC) { int l1; t_sync_flags(dc); l1 = gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_NE, env_btaken, 0, l1); gen_goto_tb(dc, 1, dc->pc); gen_set_label(l1); gen_goto_tb(dc, 0, dc->jmp_pc); dc->is_jmp = DISAS_TB_JUMP; } break; } } if (env->singlestep_enabled) break; } while (!dc->is_jmp && !dc->cpustate_changed && tcg_ctx.gen_opc_ptr < gen_opc_end && !singlestep && (dc->pc < next_page_start) && num_insns < max_insns); npc = dc->pc; if (dc->jmp == JMP_DIRECT || dc->jmp == JMP_DIRECT_CC) { if (dc->tb_flags & D_FLAG) { dc->is_jmp = DISAS_UPDATE; tcg_gen_movi_tl(cpu_SR[SR_PC], npc); sync_jmpstate(dc); } else npc = dc->jmp_pc; } if (tb->cflags & CF_LAST_IO) gen_io_end(); if (dc->is_jmp == DISAS_NEXT && (dc->cpustate_changed || org_flags != dc->tb_flags)) { dc->is_jmp = DISAS_UPDATE; tcg_gen_movi_tl(cpu_SR[SR_PC], npc); } t_sync_flags(dc); if (unlikely(env->singlestep_enabled)) { TCGv_i32 tmp = tcg_const_i32(EXCP_DEBUG); if (dc->is_jmp != DISAS_JUMP) { tcg_gen_movi_tl(cpu_SR[SR_PC], npc); } gen_helper_raise_exception(cpu_env, tmp); tcg_temp_free_i32(tmp); } else { switch(dc->is_jmp) { case DISAS_NEXT: gen_goto_tb(dc, 1, npc); break; default: case DISAS_JUMP: case DISAS_UPDATE: tcg_gen_exit_tb(0); break; case DISAS_TB_JUMP: break; } } gen_icount_end(tb, num_insns); *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; while (lj <= j) tcg_ctx.gen_opc_instr_start[lj++] = 0; } else { tb->size = dc->pc - pc_start; tb->icount = num_insns; } #ifdef DEBUG_DISAS #if !SIM_COMPAT if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("\n"); #if DISAS_GNU log_target_disas(env, pc_start, dc->pc - pc_start, 0); #endif qemu_log("\nisize=%d osize=%td\n", dc->pc - pc_start, tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf); } #endif #endif assert(!dc->abort_at_next_insn); }
1threat
How can we creat new char at c#.Net console : How can we creat new char for using into Console in order to we creat a simple game with it,for example we can import some char of char map app to console and my queastion is how can we creat specific own char.another my question is how can we clear a special position of console not whloe console buffer.
0debug
GOTO COMMAND NOT WORKING IF RUN BATCH FILE FROM C DRIVE OR DESKTOP : I have small batch file to upgrade my program, if run this batch file from any drive it works correctly but only from C drive its not working properly. I'm working on Windows 8.1 I'm trying this command @ECHO OFF IF EXIST C:\TWA\DRV.TXT GOTO TST1 DIR *.EXE /P PAUSE :TST1 DIR ASHOK.ZIP PAUSE PLEASE LET ME THE SOLUTION REGARDS GIRISH
0debug
static int flac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AVFrame *frame = data; ThreadFrame tframe = { .f = data }; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; FLACContext *s = avctx->priv_data; int bytes_read = 0; int ret; *got_frame_ptr = 0; if (s->max_framesize == 0) { s->max_framesize = ff_flac_get_max_frame_size(s->max_blocksize ? s->max_blocksize : FLAC_MAX_BLOCKSIZE, FLAC_MAX_CHANNELS, 32); } if (buf_size > 5 && !memcmp(buf, "\177FLAC", 5)) { av_log(s->avctx, AV_LOG_DEBUG, "skiping flac header packet 1\n"); return buf_size; } if (buf_size > 0 && (*buf & 0x7F) == FLAC_METADATA_TYPE_VORBIS_COMMENT) { av_log(s->avctx, AV_LOG_DEBUG, "skiping vorbis comment\n"); return buf_size; } if (buf_size < FLAC_MIN_FRAME_SIZE) return buf_size; if (AV_RB32(buf) == MKBETAG('f','L','a','C')) { if (!s->got_streaminfo && (ret = parse_streaminfo(s, buf, buf_size))) { av_log(s->avctx, AV_LOG_ERROR, "invalid header\n"); return ret; } return get_metadata_size(buf, buf_size); } if ((ret = init_get_bits8(&s->gb, buf, buf_size)) < 0) return ret; if ((ret = decode_frame(s)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "decode_frame() failed\n"); return ret; } bytes_read = get_bits_count(&s->gb)/8; if ((s->avctx->err_recognition & AV_EF_CRCCHECK) && av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf, bytes_read)) { av_log(s->avctx, AV_LOG_ERROR, "CRC error at PTS %"PRId64"\n", avpkt->pts); if (s->avctx->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } frame->nb_samples = s->blocksize; if ((ret = ff_thread_get_buffer(avctx, &tframe, 0)) < 0) return ret; s->dsp.decorrelate[s->ch_mode](frame->data, s->decoded, s->channels, s->blocksize, s->sample_shift); if (bytes_read > buf_size) { av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", bytes_read - buf_size); return AVERROR_INVALIDDATA; } if (bytes_read < buf_size) { av_log(s->avctx, AV_LOG_DEBUG, "underread: %d orig size: %d\n", buf_size - bytes_read, buf_size); } *got_frame_ptr = 1; return bytes_read; }
1threat
static av_always_inline void mc_chroma_scaled(VP9Context *s, vp9_scaled_mc_func smc, vp9_mc_func (*mc)[2], uint8_t *dst_u, uint8_t *dst_v, ptrdiff_t dst_stride, const uint8_t *ref_u, ptrdiff_t src_stride_u, const uint8_t *ref_v, ptrdiff_t src_stride_v, ThreadFrame *ref_frame, ptrdiff_t y, ptrdiff_t x, const VP56mv *in_mv, int px, int py, int pw, int ph, int bw, int bh, int w, int h, int bytesperpixel, const uint16_t *scale, const uint8_t *step) { if (s->s.frames[CUR_FRAME].tf.f->width == ref_frame->f->width && s->s.frames[CUR_FRAME].tf.f->height == ref_frame->f->height) { mc_chroma_unscaled(s, mc, dst_u, dst_v, dst_stride, ref_u, src_stride_u, ref_v, src_stride_v, ref_frame, y, x, in_mv, bw, bh, w, h, bytesperpixel); } else { int mx, my; int refbw_m1, refbh_m1; int th; VP56mv mv; if (s->ss_h) { mv.x = av_clip(in_mv->x, -(x + pw - px + 4) * 16, (s->cols * 4 - x + px + 3) * 16); mx = scale_mv(mv.x, 0) + (scale_mv(x * 16, 0) & ~15) + (scale_mv(x * 32, 0) & 15); } else { mv.x = av_clip(in_mv->x, -(x + pw - px + 4) * 8, (s->cols * 8 - x + px + 3) * 8); mx = scale_mv(mv.x * 2, 0) + scale_mv(x * 16, 0); } if (s->ss_v) { mv.y = av_clip(in_mv->y, -(y + ph - py + 4) * 16, (s->rows * 4 - y + py + 3) * 16); my = scale_mv(mv.y, 1) + (scale_mv(y * 16, 1) & ~15) + (scale_mv(y * 32, 1) & 15); } else { mv.y = av_clip(in_mv->y, -(y + ph - py + 4) * 8, (s->rows * 8 - y + py + 3) * 8); my = scale_mv(mv.y * 2, 1) + scale_mv(y * 16, 1); } #undef scale_mv y = my >> 4; x = mx >> 4; ref_u += y * src_stride_u + x * bytesperpixel; ref_v += y * src_stride_v + x * bytesperpixel; mx &= 15; my &= 15; refbw_m1 = ((bw - 1) * step[0] + mx) >> 4; refbh_m1 = ((bh - 1) * step[1] + my) >> 4; th = (y + refbh_m1 + 4 + 7) >> (6 - s->ss_v); ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0); if (x < 3 || y < 3 || x + 4 >= w - refbw_m1 || y + 4 >= h - refbh_m1) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ref_u - 3 * src_stride_u - 3 * bytesperpixel, 288, src_stride_u, refbw_m1 + 8, refbh_m1 + 8, x - 3, y - 3, w, h); ref_u = s->edge_emu_buffer + 3 * 288 + 3 * bytesperpixel; smc(dst_u, dst_stride, ref_u, 288, bh, mx, my, step[0], step[1]); s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ref_v - 3 * src_stride_v - 3 * bytesperpixel, 288, src_stride_v, refbw_m1 + 8, refbh_m1 + 8, x - 3, y - 3, w, h); ref_v = s->edge_emu_buffer + 3 * 288 + 3 * bytesperpixel; smc(dst_v, dst_stride, ref_v, 288, bh, mx, my, step[0], step[1]); } else { smc(dst_u, dst_stride, ref_u, src_stride_u, bh, mx, my, step[0], step[1]); smc(dst_v, dst_stride, ref_v, src_stride_v, bh, mx, my, step[0], step[1]); } } }
1threat
No missing such but OR 00906 missing left parenthisis : CREATE TABLE TEST.BSTXTEST (PDBC_PFX CHAR NOT NULL, BSBS_TYPE CHAR NOT NULL, BSTX_SEQ_NO NUMBER NOT NULL, BSTX_TEXT RAW NOT NULL, BSTX_LOCK_TOKEN NUMBER NOT NULL, ATXR_SOURCE_ID TIMESTAMP NOT NULL, BSTXTEXT VARCHAR2(500) NOT NULL, LENTEXT NUMBER NOT NULL)
0debug
SUMIF INDEX MATCH-please hhh : I am trying to look up and sum up values on a another excel sheet where the sum up values are with certain criterias in a row. Example below where criteria 1=date in Column D, criteria 2= "SUB" or "RED" in column F. I am not sure whey my formula does not work at the sum stage, pleas help help help.... [enter image description here][1] [enter image description here][2] [1]: https://i.stack.imgur.com/CA39Z.png [2]: https://i.stack.imgur.com/TiPzL.png
0debug
void spapr_events_fdt_skel(void *fdt, uint32_t epow_irq) { uint32_t epow_irq_ranges[] = {cpu_to_be32(epow_irq), cpu_to_be32(1)}; uint32_t epow_interrupts[] = {cpu_to_be32(epow_irq), 0}; _FDT((fdt_begin_node(fdt, "event-sources"))); _FDT((fdt_property(fdt, "interrupt-controller", NULL, 0))); _FDT((fdt_property_cell(fdt, "#interrupt-cells", 2))); _FDT((fdt_property(fdt, "interrupt-ranges", epow_irq_ranges, sizeof(epow_irq_ranges)))); _FDT((fdt_begin_node(fdt, "epow-events"))); _FDT((fdt_property(fdt, "interrupts", epow_interrupts, sizeof(epow_interrupts)))); _FDT((fdt_end_node(fdt))); _FDT((fdt_end_node(fdt))); }
1threat
Parse error: syntax error, unexpected '{', expecting function (T_FUNCTION) or const (T_CONST) in session.php on line 37 : <p>I don't know why but all of the sudden I started getting this error. I marked the line 37 in it. I am using xampp server. and below the full error line which I am getting. "Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting end of file in C:\xampp\htdocs\gallery\admin\includes\functions.php on line 19".</p> <p>Please help me out in this.</p> <pre><code>&lt;?php class Session { private $signed_in = false; public $user_id; function __construct(){ session_start(); $this-&gt;check_the_login(); } public function is_signed_in() { return $this-&gt;signed_in; } public function login($user){ $this-&gt;user_id = $_SESSION["user_id"] = $user-&gt;id; $this-&gt;signed_in = true; } public function logout(){ unser($_SESSION["user_id"]); unser($this-&gt;user_id); $this-&gt;signed_in = false; } private function check_the_login(); { // This is line 37 if (isset($_SESSION["user_id"])) { $this-&gt;user_id = $_SESSION["user_id"]; $this-&gt;signed_in = true; }else { unset($this-&gt;user_id); $this-&gt;signed_in = false; } } } $session = new Session(); ?&gt; </code></pre>
0debug
Awk & bash: syntax error near unexpected token `(' : <p>When I paste this command into the terminal (ubuntu 18.04):</p> <pre><code>cat file.txt | awk -F, BEGIN { OFS = FS } {if ($2 == "") $2 = last2; else last2 = $2 print} </code></pre> <p>I get:</p> <pre><code>bash: syntax error near unexpected token `(' </code></pre> <p>How to fix this?</p>
0debug
int net_handle_fd_param(Monitor *mon, const char *param) { if (!qemu_isdigit(param[0])) { int fd; fd = monitor_get_fd(mon, param); if (fd == -1) { error_report("No file descriptor named %s found", param); return -1; } return fd; } else { return strtol(param, NULL, 0); } }
1threat