problem
stringlengths
26
131k
labels
class label
2 classes
image not showing inside webpage, but works outside : <p>Please take a look at this URL </p> <p><a href="http://www.viewpromocode.com/product/redmi-3s-prime-silver-32-gb-4/#" rel="nofollow">http://www.viewpromocode.com/product/redmi-3s-prime-silver-32-gb-4/</a></p> <p>It has a broken image in it, but if you open the image in another tab, it work !! </p> <p>why ?</p> <p>I am using the following image compression script. It is even generating correct thumbnails, but the it is loading inside the webpage.</p> <p><a href="https://github.com/whizzzkid/phpimageresize" rel="nofollow">https://github.com/whizzzkid/phpimageresize</a></p>
0debug
Fatal error: Call to a member function fetch_assoc() on a non-object in directoryhere/database.php on line 13 : <p>I am getting Fatal error: Call to a member function fetch_assoc() on a non-object in directoryhere/database.php on line 13</p> <p>Here is the code in database.php file</p> <pre><code>&lt;?php $db = @new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE); if($db-&gt;connect_error){ die("&lt;h3&gt;Could not connect to the MySQL server.&lt;br /&gt;Please be sure that the MySQL details are correct.&lt;/h3&gt;"); } function html($string) { return htmlentities(stripslashes($string), ENT_QUOTES, "UTF-8"); } $config = $db-&gt;query("SELECT * FROM config"); $config = $config-&gt;fetch_assoc(); ?&gt; </code></pre> <p>Tell me how can I get rid of this? PHP Version - 5.5.38 I am trying to install this uptime checker script.</p>
0debug
import re def replace_max_specialchar(text,n): return (re.sub("[ ,.]", ":", text, n))
0debug
static int create_shared_memory_BAR(IVShmemState *s, int fd, uint8_t attr, Error **errp) { void * ptr; ptr = mmap(0, s->ivshmem_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); if (ptr == MAP_FAILED) { error_setg_errno(errp, errno, "Failed to mmap shared memory"); return -1; } s->shm_fd = fd; memory_region_init_ram_ptr(&s->ivshmem, OBJECT(s), "ivshmem.bar2", s->ivshmem_size, ptr); vmstate_register_ram(&s->ivshmem, DEVICE(s)); memory_region_add_subregion(&s->bar, 0, &s->ivshmem); pci_register_bar(PCI_DEVICE(s), 2, attr, &s->bar); return 0; }
1threat
Simple password-prompr in C : I'm trying to make a simple user and password autentication in C. I was told to never use gets() when getting input and I should use fgets() instead. But I'm not sure of how the fgets() works or why is giving me this input. Here is the code. #include <stdio.h> #include <string.h> int login(char *user, char *passwd){ int enter = 0; char p[6]; char u[6]; printf("User: "); fgets(u, sizeof u, stdin); printf("Pass: "); fgets(p, sizeof p, stdin); printf("%s\n", p); if (strcmp(user, u) == 0 && strcmp(passwd, p) == 0){ enter = 1; } return entrar; } int main(){ char user[] = "admin"; char passwd[] = "12345"; if (login(user, passwd)){ puts("--ACCESS GRANTED--"); } else{ puts("--Wrong pass or user--"); } return 0; } Ouput >User: admin >Pass: >--Wrong pass or user-- It doesn't even let me enter the password after I press enter.
0debug
static void usb_hid_changed(HIDState *hs) { USBHIDState *us = container_of(hs, USBHIDState, hid); us->changed = 1; if (us->datain) { us->datain(us->datain_opaque); } usb_wakeup(&us->dev); }
1threat
static bool cuda_cmd_set_time(CUDAState *s, const uint8_t *in_data, int in_len, uint8_t *out_data, int *out_len) { uint32_t ti; if (in_len != 4) { return false; } ti = (((uint32_t)in_data[1]) << 24) + (((uint32_t)in_data[2]) << 16) + (((uint32_t)in_data[3]) << 8) + in_data[4]; s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / NANOSECONDS_PER_SECOND); return true; }
1threat
Cannot read property 'required' of null : <p>In the template I have a form, which one part of it has to do with rendering the list of courses:</p> <pre><code>&lt;form #f="ngForm" (ngSubmit)="submit(f)"&gt; &lt;div class="form-group"&gt; &lt;label for="courseCategory"&gt; Category &lt;/label&gt; &lt;select required ngModel name="courseCategory" #courseCategory="ngModel" id="courseCategory" class="form-control"&gt; &lt;option value=""&gt;&lt;/option&gt; &lt;option *ngFor="let category of categories" [value]="category.id"&gt; // line 16 {{category.name}} &lt;/option&gt; &lt;/select&gt; &lt;div class="alert alert-danger" *ngIf="courseCategory.touched &amp;&amp; courseCategory.errors.required"&gt; Course category is required &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>In the browser when I select a category and press TAB (to move away from the drop-down list), I get this error on Console:</p> <blockquote> <p>CourseComponent.html:16 ERROR TypeError: Cannot read property 'required' of null at Object.eval [as updateDirectives] (CourseComponent.html:20)</p> </blockquote> <p>Can you help me finding out what causes this error?</p> <p>Bootstrap 3.3.7 is already installed in the VS Code.</p>
0debug
Laravel eloquent where date is equal or greater than DateTime : <p>I'm trying to fetch relational data from a model where the date column is higher or equal to the current time.</p> <p>The date column is formated as this: Y-m-d H:i:s</p> <p>What I'm trying to do is to grab all rows where the Y-m-d H:i:s is in the future. </p> <p>Example: lets assume the date is 2017-06-01 and the time is 09:00:00 Then i would like got all rows where the date is in the future, and the time is in the future. </p> <p>Currently my code looks like this, and it's almost working but it doesn't grab the rows where the date is the current day.</p> <pre><code>public function customerCardFollowups() { return $this -&gt; hasMany('App\CustomerCardFollowup', 'user_id') -&gt; whereDate('date', '&gt;', Carbon::now('Europe/Stockholm')) -&gt; orderBy('date', 'asc') -&gt; take(20); } </code></pre> <p>What am I doing wrong? Thanks in advance.</p>
0debug
i am trying to pass values to an array in another class : <p>i am trying to pass values to an array in another class this is an example of what i am trying to do in detail:</p> <pre><code>public class CustomString { private string[] StringToAppend; public string[] StringToAppend1 { get { return StringToAppend; } set { StringToAppend = value; } } public Class Form1:Form { CustomString strng1 = new CustomString(); strng1.StringToAppend1 = {"sssf","vfdr";} //Fails to compile Here </code></pre> <p>}</p>
0debug
Copy Database to a new Server : Is it possible to copy a Database to a new Server? I just want to have the database on a new server because i need to make some tests.
0debug
static inline void cris_alu_m_alloc_temps(TCGv *t) { t[0] = tcg_temp_new(TCG_TYPE_TL); t[1] = tcg_temp_new(TCG_TYPE_TL); }
1threat
Enabling HSTS in AWS ELB application load balacer : <p>We like to enable HSTS to our IIS deployed web application.</p> <p>We have SSL terminating ELB Application load balancer. We have enabled the URL rewrite module in IIS and configured the x-Forward-Proto tag to decide and enable HSTS header in the response. </p> <p>Presently, ALB does not appear to pass custom headers from IIS to the ALB, to the end-user. We wanted to see if there is a way to enable HSTS either at ALB level where it can accept custom headers or if it can be set at IIS level and ALB can pass through the HSTS headers to the browser?</p>
0debug
static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st) { RTSPState *rt = s->priv_data; AVFormatContext *rtpctx = rtsp_st->transport_priv; uint8_t *buf, *ptr; int size; uint8_t *interleave_header, *interleaved_packet; size = avio_close_dyn_buf(rtpctx->pb, &buf); ptr = buf; while (size > 4) { uint32_t packet_len = AV_RB32(ptr); int id; interleaved_packet = interleave_header = ptr; ptr += 4; size -= 4; if (packet_len > size || packet_len < 2) break; if (ptr[1] >= RTCP_SR && ptr[1] <= RTCP_APP) id = rtsp_st->interleaved_max; else id = rtsp_st->interleaved_min; interleave_header[0] = '$'; interleave_header[1] = id; AV_WB16(interleave_header + 2, packet_len); url_write(rt->rtsp_hd_out, interleaved_packet, 4 + packet_len); ptr += packet_len; size -= packet_len; } av_free(buf); url_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE); return 0; }
1threat
Java Spring RestTemplate sets unwanted headers : <p>I want to use a service that responds to a rest api. However, when I send a request with the Accept-Charset header set to a long value, that service breaks. An apparently easy solution would be to just set this header explicitly: <code>"Accept-Charset": "utf-8"</code>. However this just does not seem to work:</p> <pre><code> String requestBody = "{\"message\": \"I am very frustrated.\"}"; RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); ArrayList&lt;Charset&gt; acceptCharset = new ArrayList&lt;&gt;(); acceptCharset.add(StandardCharsets.UTF_8); headers.setAcceptCharset(acceptCharset); log.info(headers.toString()); ResponseEntity&lt;String&gt; res = restTemplate.exchange("http://httpbin.org/post", HttpMethod.POST, new HttpEntity&lt;&gt;(requestBody, headers), String.class); String httpbin = res.getBody(); log.info("httpbin result: " + httpbin); </code></pre> <p>This returns this result:</p> <pre><code>-&gt; {Accept-Charset=[utf-8]} -&gt; INFO httpbin result: { "args": {}, "data": "{\"message\": \"I am very frustrated.\"}", "files": {}, "form": {}, "headers": { "Accept": "text/plain, application/json, application/*+json, */*", "Accept-Charset": "big5, big5-hkscs, cesu-8, euc-jp, euc-kr, gb18030, gb2312, gbk, ibm-thai, ibm00858, ibm01140, ibm01141, ibm01142, ibm01143, ibm01144, ibm01145, ibm01146, ibm01147, ibm01148, ibm01149, ibm037, ibm1026, ibm1047, ibm273, ibm277, ibm278, ibm280, ibm284, ibm285, ibm290, ibm297, ibm420, ibm424, ibm437, ibm500, ibm775, ibm850, ibm852, ibm855, ibm857, ibm860, ibm861, ibm862, ibm863, ibm864, ibm865, ibm866, ibm868, ibm869, ibm870, ibm871, ibm918, iso-2022-cn, iso-2022-jp, iso-2022-jp-2, iso-2022-kr, iso-8859-1, iso-8859-13, iso-8859-15, iso-8859-2, iso-8859-3, iso-8859-4, iso-8859-5, iso-8859-6, iso-8859-7, iso-8859-8, iso-8859-9, jis_x0201, jis_x0212-1990, koi8-r, koi8-u, shift_jis, tis-620, us-ascii, utf-16, utf-16be, utf-16le, utf-32, utf-32be, utf-32le, utf-8, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258, windows-31j, x-big5-hkscs-2001, x-big5-solaris, x-compound_text, x-euc-jp-linux, x-euc-tw, x-eucjp-open, x-ibm1006, x-ibm1025, x-ibm1046, x-ibm1097, x-ibm1098, x-ibm1112, x-ibm1122, x-ibm1123, x-ibm1124, x-ibm1166, x-ibm1364, x-ibm1381, x-ibm1383, x-ibm300, x-ibm33722, x-ibm737, x-ibm833, x-ibm834, x-ibm856, x-ibm874, x-ibm875, x-ibm921, x-ibm922, x-ibm930, x-ibm933, x-ibm935, x-ibm937, x-ibm939, x-ibm942, x-ibm942c, x-ibm943, x-ibm943c, x-ibm948, x-ibm949, x-ibm949c, x-ibm950, x-ibm964, x-ibm970, x-iscii91, x-iso-2022-cn-cns, x-iso-2022-cn-gb, x-iso-8859-11, x-jis0208, x-jisautodetect, x-johab, x-macarabic, x-maccentraleurope, x-maccroatian, x-maccyrillic, x-macdingbat, x-macgreek, x-machebrew, x-maciceland, x-macroman, x-macromania, x-macsymbol, x-macthai, x-macturkish, x-macukraine, x-ms932_0213, x-ms950-hkscs, x-ms950-hkscs-xp, x-mswin-936, x-pck, x-sjis_0213, x-utf-16le-bom, x-utf-32be-bom, x-utf-32le-bom, x-windows-50220, x-windows-50221, x-windows-874, x-windows-949, x-windows-950, x-windows-iso2022jp", "Connection": "close", "Content-Length": "36", "Content-Type": "text/plain;charset=ISO-8859-1", "Host": "httpbin.org", "User-Agent": "Java/1.8.0_131" }, "json": { "message": "I am very frustrated." }, "origin": "###.###.###.###", "url": "http://httpbin.org/post" } </code></pre> <p>How can I override this default header?</p>
0debug
static void init_ppc_proc(PowerPCCPU *cpu) { PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); CPUPPCState *env = &cpu->env; #if !defined(CONFIG_USER_ONLY) int i; env->irq_inputs = NULL; for (i = 0; i < POWERPC_EXCP_NB; i++) env->excp_vectors[i] = (target_ulong)(-1ULL); env->ivor_mask = 0x00000000; env->ivpr_mask = 0x00000000; env->nb_BATs = 0; env->nb_tlb = 0; env->nb_ways = 0; env->tlb_type = TLB_NONE; #endif gen_spr_generic(env); spr_register(env, SPR_PVR, "PVR", #if defined(CONFIG_LINUX_USER) &spr_read_generic, #else SPR_NOACCESS, #endif SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, pcc->pvr); if (pcc->svr != POWERPC_SVR_NONE) { if (pcc->svr & POWERPC_SVR_E500) { spr_register(env, SPR_E500_SVR, "SVR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, pcc->svr & ~POWERPC_SVR_E500); } else { spr_register(env, SPR_SVR, "SVR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, pcc->svr); } } (*pcc->init_proc)(env); if (env->msr_mask & (1 << 25)) { switch (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) { case POWERPC_FLAG_SPE: case POWERPC_FLAG_VRE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n"); exit(1); } if (env->msr_mask & (1 << 17)) { switch (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) { case POWERPC_FLAG_TGPR: case POWERPC_FLAG_CE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n"); exit(1); } if (env->msr_mask & (1 << 10)) { switch (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE | POWERPC_FLAG_UBLE)) { case POWERPC_FLAG_SE: case POWERPC_FLAG_DWE: case POWERPC_FLAG_UBLE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or " "POWERPC_FLAG_UBLE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE | POWERPC_FLAG_UBLE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor " "POWERPC_FLAG_UBLE\n"); exit(1); } if (env->msr_mask & (1 << 9)) { switch (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) { case POWERPC_FLAG_BE: case POWERPC_FLAG_DE: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n"); exit(1); } if (env->msr_mask & (1 << 2)) { switch (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) { case POWERPC_FLAG_PX: case POWERPC_FLAG_PMM: break; default: fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n"); exit(1); } } else if (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) { fprintf(stderr, "PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n"); exit(1); } if ((env->flags & (POWERPC_FLAG_RTC_CLK | POWERPC_FLAG_BUS_CLK)) == 0) { fprintf(stderr, "PowerPC flags inconsistency\n" "Should define the time-base and decrementer clock source\n"); exit(1); } #if !defined(CONFIG_USER_ONLY) if (env->nb_tlb != 0) { int nb_tlb = env->nb_tlb; if (env->id_tlbs != 0) nb_tlb *= 2; switch (env->tlb_type) { case TLB_6XX: env->tlb.tlb6 = g_malloc0(nb_tlb * sizeof(ppc6xx_tlb_t)); break; case TLB_EMB: env->tlb.tlbe = g_malloc0(nb_tlb * sizeof(ppcemb_tlb_t)); break; case TLB_MAS: env->tlb.tlbm = g_malloc0(nb_tlb * sizeof(ppcmas_tlb_t)); break; } env->tlb_per_way = env->nb_tlb / env->nb_ways; } if (env->irq_inputs == NULL) { fprintf(stderr, "WARNING: no internal IRQ controller registered.\n" " Attempt QEMU to crash very soon !\n"); } #endif if (env->check_pow == NULL) { fprintf(stderr, "WARNING: no power management check handler " "registered.\n" " Attempt QEMU to crash very soon !\n"); } }
1threat
static int qtrle_decode_init(AVCodecContext *avctx) { QtrleContext *s = avctx->priv_data; s->avctx = avctx; switch (avctx->bits_per_sample) { case 1: case 2: case 4: case 8: case 33: case 34: case 36: case 40: avctx->pix_fmt = PIX_FMT_PAL8; break; case 16: avctx->pix_fmt = PIX_FMT_RGB555; break; case 24: avctx->pix_fmt = PIX_FMT_RGB24; break; case 32: avctx->pix_fmt = PIX_FMT_RGB32; break; default: av_log (avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n", avctx->bits_per_sample); break; } dsputil_init(&s->dsp, avctx); s->frame.data[0] = NULL; return 0; }
1threat
NoReturn vs. None in "void" functions - type annotations in Python 3.6 : <p>Python 3.6 supports type annotation, like:</p> <pre><code>def foo() -&gt; int: return 42 </code></pre> <p>But what is expected to use when a function hasn't return anything? <a href="https://www.python.org/dev/peps/pep-0484/" rel="noreferrer">PEP484</a> examples mostly use <code>None</code> as a return type, but there is also <code>NoReturn</code> type from <code>typing</code> package.</p> <p>So, the question is what is preferable to use and what is considered a best practice:</p> <pre><code>def foo() -&gt; None: #do smth </code></pre> <p>or</p> <pre><code>from typing import NoReturn def foo() -&gt; NoReturn: #do smth </code></pre>
0debug
jquery-1.10.2.js causing page loading Error : (used this to import one html page to other)"jquery-1.10.2.js" causing page loading Error that is when i load page or refresh HTML appears then page will load.How to resolve this error? can anyone help me with this. It's been more than a week i'm working over this issue.
0debug
Is the arguments object supposed to be an iterable in ES6? : <p>In ES6, I was trying to use the <code>arguments</code> object as an iterable when passed to the <code>Set</code> constructor. It works fine in IE11 and in Chrome 47. It does not work in Firefox 43 (throws a <code>TypeError: arguments is not iterable</code>). I've looked through the ES6 spec and cannot really find a definition of whether the <code>arguments</code> object should be an iterable or not.</p> <p>Here's an example of what I was trying to do:</p> <pre><code>function destroyer(arr) { var removes = new Set(arguments); return arr.filter(function(item) { return !removes.has(item); }); } // remove items 2, 3, 5 from the passed in array var result = destroyer([3, 5, 1, 2, 2], 2, 3, 5); log(result); </code></pre> <p>FYI, I know there are various work-arounds for this code such as copying the arguments object into a real array or using rest arguments. This question is about whether the <code>arguments</code> object is supposed to be an <code>iterable</code> or not in ES6 that can be used anywhere iterables are expected.</p>
0debug
Does TypeScript have type definitions for InputEvent? : <p>Is there any node <code>@types/*</code> module or anything that can provide type definition for <code>InputEvent</code>?</p> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/InputEvent" rel="noreferrer">Read here for more info</a> on <code>InputEvent</code>.</p>
0debug
Swift: Localization in Storyboard - Labels not added to Main.strings? : <p>When I try to localize my app and I create a new Main.strings file for the target language, everything I have created in interface builder (labels, buttons, ...) is added to the new Main.strings files (base and language versions) and I can localize the text accordingly.</p> <p>But when I later add a label or a button to a ViewController in interface builder, it is not automatically added to the Main.strings files for the base and language version.</p> <p>So, how can I find out what the ObjectID for the button/label is so that I can add it to the strings files? </p> <p>Or is there another way to force Xcode to add newly added labels and buttons to those files automatically?</p>
0debug
void ff_put_h264_qpel8_mc00_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { copy_width8_msa(src, stride, dst, stride, 8); }
1threat
Does the location of placing my <script> in html matter? Why does this code only work in one example? (code attached) : <p>This doesn't work:</p> <pre><code> &lt;h2&gt;Dinosaurs are cool.&lt;/h2&gt; &lt;script&gt; document.querySelector('.change-text').addEventListener('click', function () { document.querySelector('h2').innerText = 'I AM A DINOSAUR!!!'; }); &lt;/script&gt; &lt;button class='change-text'&gt;Change Text&lt;/button&gt; </code></pre> <p>But this does:</p> <pre><code> &lt;h2&gt;Dinosaurs are cool.&lt;/h2&gt; &lt;button class='change-text'&gt;Change Text&lt;/button&gt; &lt;script&gt; document.querySelector('.change-text').addEventListener('click', function () { document.querySelector('h2').innerText = 'I AM A DINOSAUR!!!'; }); &lt;/script&gt; </code></pre> <p>Any idea why? I've been told to link my javascript's at the top of the head, and that doesn't make this work either. </p> <p>I'd love some help, thank you so much =)</p>
0debug
void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, int (*compare)(AVFormatContext *, AVPacket *, AVPacket *)) { AVPacketList **next_point, *this_pktl; this_pktl = av_mallocz(sizeof(AVPacketList)); this_pktl->pkt= *pkt; pkt->destruct= NULL; av_dup_packet(&this_pktl->pkt); if(s->streams[pkt->stream_index]->last_in_packet_buffer){ next_point = &(s->streams[pkt->stream_index]->last_in_packet_buffer->next); }else next_point = &s->packet_buffer; if(*next_point){ if(compare(s, &s->packet_buffer_end->pkt, pkt)){ while(!compare(s, &(*next_point)->pkt, pkt)){ next_point= &(*next_point)->next; } goto next_non_null; }else{ next_point = &(s->packet_buffer_end->next); } } assert(!*next_point); s->packet_buffer_end= this_pktl; next_non_null: this_pktl->next= *next_point; s->streams[pkt->stream_index]->last_in_packet_buffer= *next_point= this_pktl; }
1threat
static void loadvm_postcopy_handle_run_bh(void *opaque) { Error *local_err = NULL; MigrationIncomingState *mis = opaque; cpu_synchronize_all_post_init(); qemu_announce_self(); bdrv_invalidate_cache_all(&local_err); if (local_err) { error_report_err(local_err); } trace_loadvm_postcopy_handle_run_cpu_sync(); cpu_synchronize_all_post_init(); trace_loadvm_postcopy_handle_run_vmstart(); if (autostart) { vm_start(); } else { runstate_set(RUN_STATE_PAUSED); } qemu_bh_delete(mis->bh); }
1threat
static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) { int i; int index_a = qp + h->slice_alpha_c0_offset; int alpha = (alpha_table+52)[index_a]; int beta = (beta_table+52)[qp + h->slice_beta_offset]; for( i = 0; i < 4; i++, pix += stride) { const int bS_index = i*bsi; if( bS[bS_index] == 0 ) { continue; } if( bS[bS_index] < 4 ) { const int tc = (tc0_table+52)[index_a][bS[bS_index]] + 1; const int p0 = pix[-1]; const int p1 = pix[-2]; const int q0 = pix[0]; const int q1 = pix[1]; if( FFABS( p0 - q0 ) < alpha && FFABS( p1 - p0 ) < beta && FFABS( q1 - q0 ) < beta ) { const int i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); pix[-1] = av_clip_uint8( p0 + i_delta ); pix[0] = av_clip_uint8( q0 - i_delta ); tprintf(h->s.avctx, "filter_mb_mbaff_edgecv i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d, tc:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, tc, bS[bS_index], pix[-3], p1, p0, q0, q1, pix[2], p1, pix[-1], pix[0], q1); } }else{ const int p0 = pix[-1]; const int p1 = pix[-2]; const int q0 = pix[0]; const int q1 = pix[1]; if( FFABS( p0 - q0 ) < alpha && FFABS( p1 - p0 ) < beta && FFABS( q1 - q0 ) < beta ) { pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2; pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; tprintf(h->s.avctx, "filter_mb_mbaff_edgecv i:%d\n# bS:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x, %02x, %02x]\n", i, pix[-3], p1, p0, q0, q1, pix[2], pix[-3], pix[-2], pix[-1], pix[0], pix[1], pix[2]); } } } }
1threat
Writing an arrays inside an array in python : <p>I need to create empty arrays inside an array in order to fill each one of them differently in a loop later on but I couldn't figure out the correct syntax. I tried something like this:</p> <pre><code> verilerimiz = [arrayname1[], arrayname2[], arrayname3[], arrayname4[], arrayname5[]] </code></pre> <p>Bu it gives a syntax error. I really appreciate some help.</p>
0debug
I own vote am getting a Runtime error 6 'overflow' message on the following code please solve it : Sub yahoo() Dim n As Integer Range("A:a").AutoFilter Field:=1, Criteria1:="*yahoo*" n = Range("a:a").SpecialCells(xlCellTypeVisible).SpecialCells(xlCellTypeConstants).Count Range("c1") = n End Sub
0debug
can somebody help me understand this more. javascript selection : var select = document.getElementById('select'); var opsArray= select.options; select.onchange = userSelection; function userSelection(){ var i = select.selectedIndex; document.location.assign('projects/' + opsArray[i].value + '/'); } so i know that when the user select the page they want it will go there. what i want is for somebody to enplane this to me, this is the part of JavaScript that i am confused with. so if i just had a block menu instead of a select menu, how will this code go with that. well basically how do that "userSlection/opsArray[i].value" work......i know how to do this in html ""folder/aboutpage/this.index"". but how do that code above work?? thanks in avances.
0debug
c++ Making a random number/letter generator, something wrong in the code : im trying to make a wordlist generator that generates random letters and numbers, however Im having an error where it only gets the first word in the list right, the rest only displays 2 letters/numbers, there is no error in the compiler, at this point it feels like i´ve tried everything without any luck. Here is the code: #include <iostream> #include <sstream> #include <string> #include <fstream> #include <windows.h> #include <ctime> using namespace std; static const char alphanum[] = "0123456789" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // chars we need for generation int stringLength = sizeof(alphanum) - 1; char genRandom(){ return alphanum[rand() % stringLength]; } int main(){ // WORD LISTS LENGTH int WordListTotalLength; int WordListThisLength = 0; cout << " How many words should be added?" << endl; cin >> WordListTotalLength; // WORD LISTS LENGTH ENDS HERE SetConsoleTitle("LetterNumberGenerator"); srand(time(0)); std::string Str; int length = 0; cout << "Enter the length of each word:" << endl; cin >> length; length = length - 1; for(unsigned int i = 0; i < length; ++i){ Str += genRandom(); } ofstream myfile; myfile.open("OutputWordlist.txt"); while (WordListThisLength < WordListTotalLength) { myfile <<Str + genRandom(); myfile << "\n" ; genRandom(); Str = genRandom(); WordListThisLength = WordListThisLength +1; } myfile.close(); cout << "Generation is finished." << endl; cout << endl; system("PAUSE"); return 0; } But all I get from the "OutputWordlist.txt" is the following: if inputing that i want 5 words in total, with 10 letters or numbers on each line i end up with this: N5VKP15QAW EN YK 48 OK And sorry if my post is a bit blurry, this is my first time posting. Any help or suggestions would be very appreciated!
0debug
Creating a Responsive Layout : <p>I am trying to create a responsive webpage using bootstrap,but I'm confused on how to start.Can anyone help me to move into the right direction?<br/><br/> Here is my code<br/> <a href="https://jsfiddle.net/c30a7bd2/" rel="nofollow noreferrer">https://jsfiddle.net/c30a7bd2/</a><br/><code>It should be responsive for all the devices.</code></p>
0debug
static SocketAddressLegacy *sd_server_config(QDict *options, Error **errp) { QDict *server = NULL; QObject *crumpled_server = NULL; Visitor *iv = NULL; SocketAddress *saddr_flat = NULL; SocketAddressLegacy *saddr = NULL; Error *local_err = NULL; qdict_extract_subqdict(options, &server, "server."); crumpled_server = qdict_crumple(server, errp); if (!crumpled_server) { goto done; } iv = qobject_input_visitor_new(crumpled_server); visit_type_SocketAddress(iv, NULL, &saddr_flat, &local_err); if (local_err) { error_propagate(errp, local_err); goto done; } saddr = socket_address_crumple(saddr_flat); done: qapi_free_SocketAddress(saddr_flat); visit_free(iv); qobject_decref(crumpled_server); QDECREF(server); return saddr; }
1threat
vmxnet3_init_msi(VMXNET3State *s) { PCIDevice *d = PCI_DEVICE(s); int res; res = msi_init(d, VMXNET3_MSI_OFFSET, VMXNET3_MSI_NUM_VECTORS, VMXNET3_USE_64BIT, VMXNET3_PER_VECTOR_MASK); if (0 > res) { VMW_WRPRN("Failed to initialize MSI, error %d", res); s->msi_used = false; } else { s->msi_used = true; } return s->msi_used; }
1threat
static void rtas_power_off(sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { if (nargs != 2 || nret != 1) { rtas_st(rets, 0, -3); return; } qemu_system_shutdown_request(); rtas_st(rets, 0, 0); }
1threat
static void bonito_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->init = bonito_initfn; k->vendor_id = 0xdf53; k->device_id = 0x00d5; k->revision = 0x01; k->class_id = PCI_CLASS_BRIDGE_HOST; dc->desc = "Host bridge"; dc->no_user = 1; dc->vmsd = &vmstate_bonito; }
1threat
Doubts in generating a MATLAB 3D plot : Could someone clarify the doubt I have in generating a 3D plot in Matlab. My outputs are as follows. Please guide me how to achieve 3D plot. I get y for each value of x (x ranges like 0:0.1:1.4). Say this is for a particular value of z. In the next step, I vary z and after a lot of math, similarly, for a range of x, I get y values. Now for the different set of z, i have x and y values. Summarily, The results are like pages of a book. each page (nothing but z) consists of the range of x and its corresponding y. I would like to create a 3D plot. I have gone through the examples online but that's not what I am actually looking. Any suggestions will be helpful and are highly appreciated.
0debug
static void quantize_all(DCAEncContext *c) { int sample, band, ch; for (sample = 0; sample < SUBBAND_SAMPLES; sample++) for (band = 0; band < 32; band++) for (ch = 0; ch < c->fullband_channels; ch++) c->quantized[sample][band][ch] = quantize_value(c->subband[sample][band][ch], c->quant[band][ch]); }
1threat
static FlatView *address_space_get_flatview(AddressSpace *as) { FlatView *view; qemu_mutex_lock(&flat_view_mutex); view = as->current_map; flatview_ref(view); qemu_mutex_unlock(&flat_view_mutex); return view; }
1threat
MIPS program that executes a statement : i just started learning MIPS, and i want to know how write a mips program that executes ```s=(a+b)-(c+101) ```where a,b,c are user provided integer inputs ,and s is computed and printed as an output ?
0debug
static int check(AVIOContext *pb, int64_t pos, uint32_t *ret_header) { int64_t ret = avio_seek(pb, pos, SEEK_SET); uint8_t header_buf[4]; unsigned header; MPADecodeHeader sd; if (ret < 0) return CHECK_SEEK_FAILED; ret = avio_read(pb, &header_buf[0], 4); if (ret < 0) return CHECK_SEEK_FAILED; header = AV_RB32(&header_buf[0]); if (ff_mpa_check_header(header) < 0) return CHECK_WRONG_HEADER; if (avpriv_mpegaudio_decode_header(&sd, header) == 1) return CHECK_WRONG_HEADER; if (ret_header) *ret_header = header; return sd.frame_size; }
1threat
Load redux store initial state in Detox Testing : <p><strong>Problem</strong><br><br> We have a quite complex application and we don't want in each test case to go through the whole process to get to specific screen to test it, alternatively we just want to jump to specific one with some state stored in redux store.</p> <hr> <p><strong>What I've tried</strong><br><br> I made multiple initial states which loads specific screen so I can test it directly and for each run of detox test I load different mocha.opts to select this portion of test cases and used 'react-native-config' so I can load different state in each run so for example for loading a screen I will do the following:</p> <ol> <li>Create initialState for redux store that has all the details of the screen I'm currently testing.</li> <li>Create mocha.opts to run only this test case by specifying the -f flag in it.</li> <li>Create .env.test.screenX file which will tell the store which initial state to load according to which ENVFILE I select.</li> <li>Create different configuration to each screen in detox so it can load the correct mocha opts through the detox CLI.</li> <li>each time I run the command ENVFILE=env.test.screenX react-native run-ios so the project would be built using this configuration and I can then run the detox test -c .</li> </ol> <hr> <p><strong>Question</strong><br><br></p> <p>My method is so complex and require alot of setup and overhead to run test for each screen so I was wondering if any one had the same issue and how could I solve it? In general how can I deal with the react native thread in detox?</p>
0debug
More efficient jquery coding : <p>What is more efficient between these two sets, and why. Thanks :)</p> <pre><code>&lt;button data-target="1" class="target-buttons'&gt;Target&lt;/button&gt; $(document).on('click', '.target-buttons', function() { alert($(this).data('target')); }); &lt;button onclick="alertTarget('1')" class="target-buttons"&gt;Target&lt;/button&gt; function alertTarget(value) { alert(value); } </code></pre> <p>Thanks very much!</p>
0debug
How to eliminate character with regex? : <p>I have a text data like these event_date=2020-01-05 how to eliminate all characters except the two last digit/date with regex?</p>
0debug
How to create a post-init container in Kubernetes? : <p>I'm trying to create a redis cluster on K8s. I need a sidecar container to create the cluster after the required number of redis containers are online.</p> <p>I've got 2 containers, <code>redis</code> and a sidecar. I'm running them in a <code>statefulset</code> with 6 replicas. I need the sidecar container to run just once for each replica then terminate. It's doing that, but K8s keeps rerunning the sidecar. </p> <p>I've tried setting a <code>restartPolicy</code> at the container level, but it's invalid. It seems K8s only supports this at the pod level. I can't use this though because I want the <code>redis</code> container to be restarted, just not the sidecar.</p> <p>Is there anything like a <code>post-init container</code>? My sidecar needs to run <strong>after</strong> the main <code>redis</code> container to make it join the cluster. So an <code>init container</code> is no use.</p> <p>What's the best way to solve this with K8s 1.6?</p>
0debug
How do I completely break out of my while loop? : I'm having trouble breaking out of the while loop in my code completely. Here's my attempt: while continue_enter == True: while True: try: enter_result_selection = int(input("What test would you like to enter results for? Please enter a number - Reading Test: 1 Writing Test: 2 Numeracy Test: 3 Digital Literacy Test: 4 All Tests: 5 - ")) if enter_result_selection == 1: name = input("Please enter the name of the student you would like to enter results for: ") result_enterer_name = input("Please enter your name: ") while True: try: student_result_reading = int(input("Enter {}'s percentile for the reading test (%): ".format(name))) break except ValueError: print("This input is invalid. Please enter a percentage ranging from 0 - 100%") elif enter_result_selection == 2: name = input("Please enter the name of the student you would like to enter results for: ") result_enterer_name = input("Please enter your name: ") while True: try: student_result_writing = int(input("Enter {}'s percentile for the writing test (%): ".format(name))) break except ValueError: print("This input is invalid. Please enter a percentage ranging from 0 - 100%") elif enter_result_selection == 3: name = input("Please enter the name of the student you would like to enter results for: ") result_enterer_name = input("Please enter your name: ") while True: try: student_result_numeracy = int(input("Enter {}'s percentile for the numeracy test (%): ".format(name))) break except ValueError: print("This input is invalid. Please enter a percentage ranging from 0 - 100%") elif enter_result_selection == 4: name = input("Please enter the name of the student you would like to enter results for: ") result_enterer_name = input("Please enter your name: ") while True: try: student_result_digtialliteracy = int(input("Enter {}'s percentile for the digtial literacy test (%): ".format(name))) break except ValueError: print("This input is invalid. Please enter a percentage ranging from 0 - 100%") elif enter_result_selection == 5: name = input("Please enter the name of the student you would like to enter results for: ") result_enterer_name = input("Please enter your name: ") while True: try: student_result_reading = int(input("Enter {}'s percentile for the reading test (%): ".format(name))) student_result_writing = int(input("Enter {}'s percentile for the writing test (%): ".format(name))) student_result_numeracy = int(input("Enter {}'s percentile for the numeracy test (%): ".format(name))) student_result_digtialliteracy = int(input("Enter {}'s percentile for the digtial literacy test (%): ".format(name))) break except ValueError: print("This input is invalid. Please enter a percentage ranging from 0 - 100%") else: print("Sorry, this is an invalid number. Please only enter numbers ranging from the values 1 - 5.") break except ValueError: print("Sorry, your input was invalid. Please enter a number and try again.") while continue_enter == True or continue_enter == False: ask_continue_enter = input("Would you like to enter results for another student? ") if ask_continue_enter.lower() == "yes" or ask_continue_enter.lower() == "y": continue_enter == True break elif ask_continue_enter.lower() == "no" or ask_continue_enter.lower() == "n": continue_enter == False break else: print("Sorry, this is an invalid input. Please enter with 'Yes' or 'No'") if continue_enter == True: continue elif continue_enter == False: break Any Help is appreciated :)
0debug
How to format this date string format "2018-03-30T14:36:10.093" into Date in Swift : <p>I'm trying to get the Date object for this string format "2018-03-30T14:36:10.093" in Swift, but I don't get it. It is not ISO8601 because of that point after the number 10.</p> <p>Any solutions?</p>
0debug
getting error when trying to add data into database : Hi I am trying to add a contributor and getting this error "The SqlParameter is already contained by another SqlParameterCollection. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentException: The SqlParameter is already contained by another SqlParameterCollection. Source Error: Line 195: //@returnInventoryId AS int OUTPUT Line 196: Line 197: var recordsAffected = dbFFS.Database.ExecuteSqlCommand( Line 198: "sp_InsertOrUpdateContributor @electionId, @candidateId, @contributorId, @eligibleForRebate, @lastName, @firstName, @middleName, @fullName, @contributorTypeAbbr, @streetNo, @streetName, @unit, @city, @province, @country, @postalCode, @mailingAddress1, @mailingAddress2, @mailingAddress3, @mailingAddress4, @homePhone, @workPhone, @cellPhone, @emailAddress, @notes, @returnInventoryId OUT ", Line 199: param1, param2, param3, param4, param2, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param18, param19, param20, param21, param22, param23, param24, param25, param15, param15, pOutput);" This is my code: My controller: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> public ActionResult Edit(ffsContributor model) { FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value); //0 Username | 1 Fullname | 2 User Id | 3 Login Type | 4 Election Id string[] UserData = ticket.UserData.Split('|'); if (UserData[3] != "candidate") { FormsAuthentication.SignOut(); return RedirectToAction("Index", "Home"); } int candidateid = Convert.ToInt32(UserData[2]); int electionID = Convert.ToInt32(UserData[4]); model = dbFFSSave(electionID, candidateid, model); //check inventory request is the same with the model return View(model); } public ActionResult Add() { FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value); //0 Username | 1 Fullname | 2 User Id | 3 Login Type | 4 Election Id string[] UserData = ticket.UserData.Split('|'); if (UserData[3] != "candidate") { FormsAuthentication.SignOut(); return RedirectToAction("Index", "Home"); } int candidateid = Convert.ToInt32(UserData[2]); int electionID = Convert.ToInt32(UserData[4]); ffsContributor model = new ffsContributor { CandidateId = candidateid, ContributorId = 0 }; model.DropDownList = DbFFSGetOffices(electionID, candidateid); return View(model); } private Models.ffsContributor dbFFSSave(int electionId, int candidateID, Models.ffsContributor model) { SqlParameter param1 = new SqlParameter("@electionId", electionId); SqlParameter param2 = new SqlParameter("@candidateId", model.CandidateId); //SqlParameter param3 = new SqlParameter("@contributorId", model.ContributorId); SqlParameter param4 = new SqlParameter("@eligibleForRebate", model.EligibleForRebate); SqlParameter param5 = new SqlParameter("@lastName", model.LastName); SqlParameter param6 = new SqlParameter("@firstName", model.FirstName); SqlParameter param7 = new SqlParameter("@middleName", model.MiddleName); SqlParameter param8 = new SqlParameter("@fullName", model.FullName); SqlParameter param9 = new SqlParameter("@contributorTypeAbbr", model.ContributorTypeAbbr); SqlParameter param10 = new SqlParameter("@streetNo", model.StreetNo); SqlParameter param11 = new SqlParameter("@streetName", model.StreetName); SqlParameter param12 = new SqlParameter("@unit", model.Unit); SqlParameter param13 = new SqlParameter("@streetName", model.StreetName); SqlParameter param14 = new SqlParameter("@city", model.City); SqlParameter param15 = new SqlParameter("@province", model.Province); SqlParameter param16 = new SqlParameter("@postalCode", model.PostalCode); SqlParameter param18 = new SqlParameter("@mailingAddress1", model.MailingAddress1); SqlParameter param19 = new SqlParameter("@mailingAddress2", model.MailingAddress2); SqlParameter param20 = new SqlParameter("@mailingAddress3", model.MailingAddress3); SqlParameter param21 = new SqlParameter("@mailingAddress4", model.MailingAddress4); SqlParameter param22 = new SqlParameter("@homePhone", model.HomePhone); SqlParameter param23 = new SqlParameter("@workPhone", model.WorkPhone); SqlParameter param24 = new SqlParameter("@emailAddress", model.EmailAddress); SqlParameter param25 = new SqlParameter("@notes", model.Notes); SqlParameter param3 = new SqlParameter("@contributorId", DBNull.Value); //if (model.ContributorId < 0) //{ // param5.Value = model.ContributorId; //} var pOutput = new SqlParameter("@returnContributorId", System.Data.SqlDbType.Int) { Direction = System.Data.ParameterDirection.Output }; //@returnInventoryId AS int OUTPUT var recordsAffected = dbFFS.Database.ExecuteSqlCommand( "sp_InsertOrUpdateContributor @electionId, @candidateId, @contributorId, @eligibleForRebate, @lastName, @firstName, @middleName, @fullName, @contributorTypeAbbr, @streetNo, @streetName, @unit, @city, @province, @country, @postalCode, @mailingAddress1, @mailingAddress2, @mailingAddress3, @mailingAddress4, @homePhone, @workPhone, @cellPhone, @emailAddress, @notes, @returnInventoryId OUT ", param1, param2, param3, param4, param2, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param18, param19, param20, param21, param22, param23, param24, param25, param15, param15, pOutput); model.DropDownList = DbFFSGetOffices(electionId, candidateID); return model; } My cshtml file: @using (Html.BeginForm("Edit", "ffsContributors")) { @Html.HiddenFor(m => m.ContributorId) @Html.TextBoxFor(m => m.FullName, new { @placeholder = "FullName" }) @Html.TextBoxFor(m => m.EmailAddress, new { @placeholder = "EmailAddress" }) @Html.TextBoxFor(m => m.WorkPhone, new { @placeholder = "WorkPhone" }) @Html.TextBoxFor(m => m.HomePhone, new { @placeholder = "HomePhone" }) // @Html.DropDownListFor(m => m.CellPhone, Model.DropDownList) <input type="submit" value="Save" /> } <!-- end snippet -->
0debug
i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, qemu_irq sci_irq, qemu_irq cmos_s3, qemu_irq smi_irq, int kvm_enabled) { PCIDevice *dev; PIIX4PMState *s; dev = pci_create(bus, devfn, "PIIX4_PM"); qdev_prop_set_uint32(&dev->qdev, "smb_io_base", smb_io_base); s = DO_UPCAST(PIIX4PMState, dev, dev); s->irq = sci_irq; acpi_pm1_cnt_init(&s->ar, cmos_s3); s->smi_irq = smi_irq; s->kvm_enabled = kvm_enabled; qdev_init_nofail(&dev->qdev); return s->smb.smbus; }
1threat
Remove line break from text file not working : I'm attempting to remove a carriage return from a java string, but not having much luck so far. Here's what I currently have code wise. You can have a look at the desired strings needed below compared to what I'm getting. public static void main(String[] args) { String tempString = ""; String tempStringTwo = ""; String [] convertedLines = new String [100]; int counter = 0; int tempcount = 0; File file = new File("input.txt"); if (!file.exists()) { System.out.println(args[0] + " does not exist."); return; } if (!(file.isFile() && file.canRead())) { System.out.println(file.getName() + " cannot be read from."); return; } try { FileInputStream fis = new FileInputStream(file); char current; while (fis.available() > 0) { // Filesystem still available to read bytes from file current = (char) fis.read(); tempString = tempString + current; int character = (int) current; if (character==13) { // found a line break in the file, need to ignore it. //tempString = tempString.replace("\n"," ").replace("\r"," "); tempString = tempString.replaceAll("\\r|\\n", " "); //tempString = tempString.substring(0,tempString.length()-1); //System.out.println(tempString); } if (character==46) { // found a period //System.out.println("Found a period."); convertedLines[counter] = tempString; tempString = ""; counter++; tempcount = counter; } } } catch (IOException e) { e.printStackTrace(); } System.out.println("------------------------------------------------"); for (int z=0;z<tempcount;z++){ System.out.println(convertedLines[z]); } } Here's my current output... ------------------------------------------------ The quick brown fox jumps over the lazy dogs. Now is the time for all good men to come to the aid of their country. All your base are belong to us. Here's what I need... ----------------------------------------------------- The quick brown fox jumps over the lazy dogs. Now is the time for all good men to come to the aid of their country. All your base are belong to us.
0debug
Does rabbitmq support binding a single queue to multi exchanges? : <p>I know that an exchange can bind multi queues in rabbitmq, does it support binding a single queue to multi exchanges?</p>
0debug
VirtualBox Cannot register the hard disk already exists : <p>I created a virtual disk file <em>VM_1_Ubuntu.vdi</em>. Then I moved it into another folder. I tried to update VM settings (right click on virtual machine -> settings -> Storage -> Controller SATA tab, <em>VM_1_Ubuntu.vdi</em> path). I wanted to set a new path.</p> <p>It says Cannot register the hard disk already exists</p>
0debug
how to use mysql one fiel AND : My simple question about mysql This is my code `SELECT t_id_tags.id_post, t_id_tags.id_tag FROM t_id_tags WHERE id_tag IN (860, 945)` I'm like this `SELECT t_id_tags.id_post, t_id_tags.id_tag FROM t_id_tags WHERE id_tag = 860 AND id_tag = 945` is possible ? tnx
0debug
static GSList *gd_vc_vte_init(GtkDisplayState *s, VirtualConsole *vc, CharDriverState *chr, int idx, GSList *group, GtkWidget *view_menu) { char buffer[32]; GtkWidget *box; GtkWidget *scrollbar; GtkAdjustment *vadjustment; VirtualConsole *tmp_vc = chr->opaque; vc->s = s; vc->vte.echo = tmp_vc->vte.echo; vc->vte.chr = chr; chr->opaque = vc; g_free(tmp_vc); snprintf(buffer, sizeof(buffer), "vc%d", idx); vc->label = g_strdup_printf("%s", vc->vte.chr->label ? vc->vte.chr->label : buffer); group = gd_vc_menu_init(s, vc, idx, group, view_menu); vc->vte.terminal = vte_terminal_new(); g_signal_connect(vc->vte.terminal, "commit", G_CALLBACK(gd_vc_in), vc); #if VTE_CHECK_VERSION(0, 40, 0) vte_terminal_set_encoding(VTE_TERMINAL(vc->vte.terminal), "UTF-8", NULL); #else vte_terminal_set_encoding(VTE_TERMINAL(vc->vte.terminal), "UTF-8"); #endif vte_terminal_set_scrollback_lines(VTE_TERMINAL(vc->vte.terminal), -1); vte_terminal_set_size(VTE_TERMINAL(vc->vte.terminal), VC_TERM_X_MIN, VC_TERM_Y_MIN); #if VTE_CHECK_VERSION(0, 28, 0) && GTK_CHECK_VERSION(3, 0, 0) vadjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE(vc->vte.terminal)); #else vadjustment = vte_terminal_get_adjustment(VTE_TERMINAL(vc->vte.terminal)); #endif #if GTK_CHECK_VERSION(3, 0, 0) box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2); scrollbar = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, vadjustment); #else box = gtk_hbox_new(false, 2); scrollbar = gtk_vscrollbar_new(vadjustment); #endif gtk_box_pack_start(GTK_BOX(box), vc->vte.terminal, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), scrollbar, FALSE, FALSE, 0); vc->vte.box = box; vc->vte.scrollbar = scrollbar; g_signal_connect(vadjustment, "changed", G_CALLBACK(gd_vc_adjustment_changed), vc); vc->type = GD_VC_VTE; vc->tab_item = box; vc->focus = vc->vte.terminal; gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook), vc->tab_item, gtk_label_new(vc->label)); qemu_chr_be_generic_open(vc->vte.chr); if (vc->vte.chr->init) { vc->vte.chr->init(vc->vte.chr); } return group; }
1threat
main( int argc, char *argv[] ) { GMainLoop *loop; GIOChannel *channel_stdin; char *qemu_host; char *qemu_port; VSCMsgHeader mhHeader; VCardEmulOptions *command_line_options = NULL; char *cert_names[MAX_CERTS]; char *emul_args = NULL; int cert_count = 0; int c, sock; if (socket_init() != 0) return 1; while ((c = getopt(argc, argv, "c:e:pd:")) != -1) { switch (c) { case 'c': if (cert_count >= MAX_CERTS) { printf("too many certificates (max = %d)\n", MAX_CERTS); exit(5); } cert_names[cert_count++] = optarg; break; case 'e': emul_args = optarg; break; case 'p': print_usage(); exit(4); break; case 'd': verbose = get_id_from_string(optarg, 1); break; } } if (argc - optind != 2) { print_usage(); exit(4); } if (cert_count > 0) { char *new_args; int len, i; if (emul_args == NULL) { emul_args = (char *)"db=\"/etc/pki/nssdb\""; } #define SOFT_STRING ",soft=(,Virtual Reader,CAC,," len = strlen(emul_args) + strlen(SOFT_STRING) + 2; for (i = 0; i < cert_count; i++) { len += strlen(cert_names[i])+1; } new_args = g_malloc(len); strcpy(new_args, emul_args); strcat(new_args, SOFT_STRING); for (i = 0; i < cert_count; i++) { strcat(new_args, cert_names[i]); strcat(new_args, ","); } strcat(new_args, ")"); emul_args = new_args; } if (emul_args) { command_line_options = vcard_emul_options(emul_args); } qemu_host = g_strdup(argv[argc - 2]); qemu_port = g_strdup(argv[argc - 1]); sock = connect_to_qemu(qemu_host, qemu_port); if (sock == -1) { fprintf(stderr, "error opening socket, exiting.\n"); exit(5); } socket_to_send = g_byte_array_new(); qemu_mutex_init(&socket_to_send_lock); qemu_mutex_init(&pending_reader_lock); qemu_cond_init(&pending_reader_condition); vcard_emul_init(command_line_options); loop = g_main_loop_new(NULL, true); printf("> "); fflush(stdout); #ifdef _WIN32 channel_stdin = g_io_channel_win32_new_fd(STDIN_FILENO); #else channel_stdin = g_io_channel_unix_new(STDIN_FILENO); #endif g_io_add_watch(channel_stdin, G_IO_IN, do_command, NULL); #ifdef _WIN32 channel_socket = g_io_channel_win32_new_socket(sock); #else channel_socket = g_io_channel_unix_new(sock); #endif g_io_channel_set_encoding(channel_socket, NULL, NULL); g_io_channel_set_buffered(channel_socket, FALSE); VSCMsgInit init = { .version = htonl(VSCARD_VERSION), .magic = VSCARD_MAGIC, .capabilities = {0} }; send_msg(VSC_Init, mhHeader.reader_id, &init, sizeof(init)); g_main_loop_run(loop); g_main_loop_unref(loop); g_io_channel_unref(channel_stdin); g_io_channel_unref(channel_socket); g_byte_array_unref(socket_to_send); closesocket(sock); return 0; }
1threat
static void pc_init1(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model, int pci_enabled) { char *filename; int ret, linux_boot, i; ram_addr_t ram_addr, bios_offset, option_rom_offset; ram_addr_t below_4g_mem_size, above_4g_mem_size = 0; int bios_size, isa_bios_size; PCIBus *pci_bus; ISADevice *isa_dev; int piix3_devfn = -1; CPUState *env; qemu_irq *cpu_irq; qemu_irq *isa_irq; qemu_irq *i8259; IsaIrqState *isa_irq_state; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DriveInfo *fd[MAX_FD]; int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled; void *fw_cfg; if (ram_size >= 0xe0000000 ) { above_4g_mem_size = ram_size - 0xe0000000; below_4g_mem_size = 0xe0000000; } else { below_4g_mem_size = ram_size; } linux_boot = (kernel_filename != NULL); if (cpu_model == NULL) { #ifdef TARGET_X86_64 cpu_model = "qemu64"; #else cpu_model = "qemu32"; #endif } for (i = 0; i < smp_cpus; i++) { env = pc_new_cpu(cpu_model); } vmport_init(); ram_addr = qemu_ram_alloc(0xa0000); cpu_register_physical_memory(0, 0xa0000, ram_addr); ram_addr = qemu_ram_alloc(0x100000 - 0xa0000); ram_addr = qemu_ram_alloc(below_4g_mem_size - 0x100000); cpu_register_physical_memory(0x100000, below_4g_mem_size - 0x100000, ram_addr); if (above_4g_mem_size > 0) { #if TARGET_PHYS_ADDR_BITS == 32 hw_error("To much RAM for 32-bit physical address"); #else ram_addr = qemu_ram_alloc(above_4g_mem_size); cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size, ram_addr); #endif } if (bios_name == NULL) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = get_image_size(filename); } else { bios_size = -1; } if (bios_size <= 0 || (bios_size % 65536) != 0) { goto bios_error; } bios_offset = qemu_ram_alloc(bios_size); ret = load_image(filename, qemu_get_ram_ptr(bios_offset)); if (ret != bios_size) { bios_error: fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name); exit(1); } if (filename) { qemu_free(filename); } isa_bios_size = bios_size; if (isa_bios_size > (128 * 1024)) isa_bios_size = 128 * 1024; cpu_register_physical_memory(0x100000 - isa_bios_size, isa_bios_size, (bios_offset + bios_size - isa_bios_size) | IO_MEM_ROM); option_rom_offset = qemu_ram_alloc(PC_ROM_SIZE); cpu_register_physical_memory(PC_ROM_MIN_VGA, PC_ROM_SIZE, option_rom_offset); if (using_vga) { if (cirrus_vga_enabled) { rom_add_vga(VGABIOS_CIRRUS_FILENAME); } else { rom_add_vga(VGABIOS_FILENAME); } } cpu_register_physical_memory((uint32_t)(-bios_size), bios_size, bios_offset | IO_MEM_ROM); fw_cfg = bochs_bios_init(); if (linux_boot) { load_linux(fw_cfg, kernel_filename, initrd_filename, kernel_cmdline, below_4g_mem_size); } for (i = 0; i < nb_option_roms; i++) { rom_add_option(option_rom[i]); } for (i = 0; i < nb_nics; i++) { char nic_oprom[1024]; const char *model = nd_table[i].model; if (!nd_table[i].bootable) continue; if (model == NULL) model = "e1000"; snprintf(nic_oprom, sizeof(nic_oprom), "pxe-%s.bin", model); rom_add_option(nic_oprom); } cpu_irq = qemu_allocate_irqs(pic_irq_request, NULL, 1); i8259 = i8259_init(cpu_irq[0]); isa_irq_state = qemu_mallocz(sizeof(*isa_irq_state)); isa_irq_state->i8259 = i8259; isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24); if (pci_enabled) { pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq); } else { pci_bus = NULL; isa_bus_new(NULL); } isa_bus_irqs(isa_irq); ferr_irq = isa_reserve_irq(13); register_ioport_write(0x80, 1, 1, ioport80_write, NULL); register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL); if (cirrus_vga_enabled) { if (pci_enabled) { pci_cirrus_vga_init(pci_bus); } else { isa_cirrus_vga_init(); } } else if (vmsvga_enabled) { if (pci_enabled) pci_vmsvga_init(pci_bus); else fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__); } else if (std_vga_enabled) { if (pci_enabled) { pci_vga_init(pci_bus, 0, 0); } else { isa_vga_init(); } } rtc_state = rtc_init(2000); qemu_register_boot_set(pc_boot_set, rtc_state); register_ioport_read(0x92, 1, 1, ioport92_read, NULL); register_ioport_write(0x92, 1, 1, ioport92_write, NULL); if (pci_enabled) { isa_irq_state->ioapic = ioapic_init(); } pit = pit_init(0x40, isa_reserve_irq(0)); pcspk_init(pit); if (!no_hpet) { hpet_init(isa_irq); } for(i = 0; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { serial_isa_init(i, serial_hds[i]); } } for(i = 0; i < MAX_PARALLEL_PORTS; i++) { if (parallel_hds[i]) { parallel_init(i, parallel_hds[i]); } } for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) pc_init_ne2k_isa(nd); else pci_nic_init_nofail(nd, "e1000", NULL); } if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) { fprintf(stderr, "qemu: too many IDE bus\n"); exit(1); } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); } if (pci_enabled) { pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1); } else { for(i = 0; i < MAX_IDE_BUS; i++) { isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); } } isa_dev = isa_create_simple("i8042"); DMA_init(0); #ifdef HAS_AUDIO audio_init(pci_enabled ? pci_bus : NULL, isa_irq); #endif for(i = 0; i < MAX_FD; i++) { fd[i] = drive_get(IF_FLOPPY, 0, i); } floppy_controller = fdctrl_init_isa(fd); cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd); if (pci_enabled && usb_enabled) { usb_uhci_piix3_init(pci_bus, piix3_devfn + 2); } if (pci_enabled && acpi_enabled) { uint8_t *eeprom_buf = qemu_mallocz(8 * 256); i2c_bus *smbus; smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, isa_reserve_irq(9)); for (i = 0; i < 8; i++) { DeviceState *eeprom; eeprom = qdev_create((BusState *)smbus, "smbus-eeprom"); qdev_prop_set_uint8(eeprom, "address", 0x50 + i); qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256)); qdev_init(eeprom); } piix4_acpi_system_hot_add_init(pci_bus); } if (i440fx_state) { i440fx_init_memory_mappings(i440fx_state); } if (pci_enabled) { int max_bus; int bus; max_bus = drive_get_max_bus(IF_SCSI); for (bus = 0; bus <= max_bus; bus++) { pci_create_simple(pci_bus, -1, "lsi53c895a"); } } if (pci_enabled) { for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) { if (virtcon_hds[i]) { pci_create_simple(pci_bus, -1, "virtio-console-pci"); } } } }
1threat
select int culomn and compare it with Json array culomn : this is row in option culomn in table oc_cart 20,228,27,229 why no result found when value is 228 but result found when value is 20 like below : select 1 from dual where 228 in (select option as option from oc_cart) and result found when i change value to 20 like select 1 from dual where 20in (select option as option from oc_cart) *option culomn structure type is TEXT
0debug
LRU.sh: line 121: syntax error near unexpected token `fi' : When ever i run the bash script i encountered this problem. ./LRU.sh: line 121: syntax error near unexpected token `fi' i have no idea why. Kindly need your help.Below is my code. #!/bin/bash declare -i numOfPageRRef=0 declare -i numOfFrames=$1 declare -i a=0 declare -i k=0 declare -i c=0 declare -i q declare -i c1=0 OIFS=$IFS IFS=',' read line < Input2.csv for val in $line do pageRef[$numOfPageRRef]=$val ((numOfPageRRef++)) done #echo ${pageRef[@]} q[$k]=${pageRef[$k]} #chck here echo ${q[$k]} ((c++)) ((k++)) for((i=1;i<numOfPageRRef;i++)) do c1=0 for((j=0;j<numOfFrames;j++)) do if (( ${pageRef[$i]} -ne ${q[$j]} )) then ((c1++)) fi done if (( c1 -eq numOfFrames )) then ((c++)) if (( k -lt numOfFrames )) ;then q[$k]=${pageRef[$i]} ((k++)) for((j=0;j<numOfFrames;j++)) do echo ${q[$j]} done else for((r=0;r<numOfFrames;r++)) do c2[r]=0 for((j=i-1;j<numOfPageRRef;j--)) do if (( ${q[$r]} -ne ${p[$j]} )) then ((c2[r]++)) else break fi done done for((r=0;r<numOfFrames;r++)) do t4=${c2[r]} b[$r]=$t4 for((r=0;r<numOfFrames;r++)) do for((j=r;j<numOfFrames;j++)) do if (( ${b[$r} -lt ${b[$j]} )) then t=${b[r]} t2=${b[j]} b[$r]=$t2 b[$j]=$t fi done done for((r=0;r<numOfFrames;r++)) do if (( ${c2[$r]} -eq ${b[0]} )) then t3=${p[$i]} q[$r]=$t3 fi echo ${q[$r]} done #echo fi fi done echo "The no of page fault is $c" kindly need you help to rectified the problem.
0debug
My bruteforce machine (built with java using selenium and web-driver) is way too fast that it does not login properly even with correct login info : <p>I am building a brute-force machine with Java using selenium and web-driver. The program basically asks the user for URL of the website login page, inspect element selector for username, password, and login button, and it would automatically input the passwords and click on the login button automatically at a very fast speed. </p> <p>However because of its high speed, the program cannot actually go to the logged in account (when you put correct login info), because another password would be inputted into the box before the web has the chance to load the next page and show us that the password was correct. For this, even when I have correct login info, the program is not able to recognize and tell the users that one of the passwords was correct.</p> <p>This doesn't happen when I add a give a time gap (create a lag) between each login attempts, using codes such as <code>Thread.sleep(2000)</code> but I don't really want to do this because the point of a brute force machine is to try as many login attempts, and at a high speed. </p> <p>How can I fix this issue? Is there any inspect element "value" that would change to "true" (or something like that) if the login info is correct? Even if the web is incapable of actually logging into the page due to the high speed of login attempts, I would like my java program to tell the users what the correct password found was.</p>
0debug
static void msix_mmio_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { PCIDevice *dev = opaque; unsigned int offset = addr & (MSIX_PAGE_SIZE - 1) & ~0x3; int vector = offset / PCI_MSIX_ENTRY_SIZE; pci_set_long(dev->msix_table_page + offset, val); msix_handle_mask_update(dev, vector);
1threat
check whether a List<string> contains an element in another List<string> : <p>I have a list with sentences. I have another List with particular words. I want the sentences from the list, if the sentence have at least one words from the list below. That sentence should be selected and stored in a variable. </p> <pre><code> List&lt;string&gt; features = new List&lt;string&gt;(new string[] { "battery", "screen", "audio" }); </code></pre>
0debug
Xcodebuild - Skip Finished requesting crash reports. Continuing with testing : <p>I'm running a CI machine with the Xcode.</p> <p>The tests are triggered using <code>fastlane gym</code>. I see this line in the output:</p> <blockquote> <p>2019-05-27 16:04:28.417 xcodebuild[54605:1482269] [MT] IDETestOperationsObserverDebug: (A72DBEA3-D13E-487E-9D04-5600243FF617) Finished requesting crash reports. Continuing with testing.</p> </blockquote> <p>This operation takes some time (about a minute) to complete. As far, as I understand, the Xcode requests crash reports from Apple to show in the "Organizer" window.</p> <p>Since this is a CI machine, the crash reports will never be viewed on it and this step could be skipped completely how can I skip it?</p>
0debug
static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies) { AVDictionary *new_params = NULL; AVDictionaryEntry *e, *cookie_entry; char *eql, *name; if (parse_set_cookie(p, &new_params)) return -1; cookie_entry = av_dict_get(new_params, "", NULL, AV_DICT_IGNORE_SUFFIX); if (!cookie_entry || !cookie_entry->value) { return -1; } if ((e = av_dict_get(new_params, "expires", NULL, 0)) && e->value) { struct tm new_tm = {0}; if (!parse_set_cookie_expiry_time(e->value, &new_tm)) { AVDictionaryEntry *e2; if (av_timegm(&new_tm) < av_gettime() / 1000000) { return -1; } e2 = av_dict_get(*cookies, cookie_entry->key, NULL, 0); if (e2 && e2->value) { AVDictionary *old_params = NULL; if (!parse_set_cookie(p, &old_params)) { e2 = av_dict_get(old_params, "expires", NULL, 0); if (e2 && e2->value) { struct tm old_tm = {0}; if (!parse_set_cookie_expiry_time(e->value, &old_tm)) { if (av_timegm(&new_tm) < av_timegm(&old_tm)) { av_dict_free(&old_params); return -1; } } } } av_dict_free(&old_params); } } } if (!(eql = strchr(p, '='))) return AVERROR(EINVAL); if (!(name = av_strndup(p, eql - p))) return AVERROR(ENOMEM); av_dict_set(cookies, name, eql, AV_DICT_DONT_STRDUP_KEY); return 0; }
1threat
static int mov_write_sidx_tag(AVIOContext *pb, MOVTrack *track, int ref_size, int total_sidx_size) { int64_t pos = avio_tell(pb), offset_pos, end_pos; int64_t presentation_time, duration, offset; int starts_with_SAP, i, entries; if (track->entry) { entries = 1; presentation_time = track->start_dts + track->frag_start + track->cluster[0].cts; duration = track->end_pts - (track->cluster[0].dts + track->cluster[0].cts); starts_with_SAP = track->cluster[0].flags & MOV_SYNC_SAMPLE; if (presentation_time < 0) { duration += presentation_time; presentation_time = 0; } } else { entries = track->nb_frag_info; presentation_time = track->frag_info[0].time; } avio_wb32(pb, 0); ffio_wfourcc(pb, "sidx"); avio_w8(pb, 1); avio_wb24(pb, 0); avio_wb32(pb, track->track_id); avio_wb32(pb, track->timescale); avio_wb64(pb, presentation_time); offset_pos = avio_tell(pb); avio_wb64(pb, 0); avio_wb16(pb, 0); avio_wb16(pb, entries); for (i = 0; i < entries; i++) { if (!track->entry) { if (i > 1 && track->frag_info[i].offset != track->frag_info[i - 1].offset + track->frag_info[i - 1].size) { av_log(NULL, AV_LOG_ERROR, "Non-consecutive fragments, writing incorrect sidx\n"); } duration = track->frag_info[i].duration; ref_size = track->frag_info[i].size; starts_with_SAP = 1; } avio_wb32(pb, (0 << 31) | (ref_size & 0x7fffffff)); avio_wb32(pb, duration); avio_wb32(pb, (starts_with_SAP << 31) | (0 << 28) | 0); } end_pos = avio_tell(pb); offset = pos + total_sidx_size - end_pos; avio_seek(pb, offset_pos, SEEK_SET); avio_wb64(pb, offset); avio_seek(pb, end_pos, SEEK_SET); return update_size(pb, pos); }
1threat
What's wrong with this code to plot dataframe data? : <p>I have a panda dataframe <code>df</code>. It looks something like this;</p> <pre><code> Name Date Attr1 Attr1 Attr2 Sales Joe 26-12-2007 1.000000 1.000000 1.000000 52214 Joe 27-12-2007 0.975380 0.983405 0.960474 78870 Joe 28-12-2007 0.959963 0.962608 0.953732 65745 Joe 31-12-2007 0.940175 0.979434 0.951174 83813 </code></pre> <p>I want to plot <code>Attr1</code> column. Here is my python code.</p> <pre><code>import matplotlib.pyplot as plt df['Attr1'].plot(figsize=(16, 12)) plt.legend() </code></pre> <p>No plot appears after running the code. What is wrong with it? I am open to new code to plot <code>Attr1</code> data.</p> <p>I am using python v3.6</p>
0debug
Just input a number in cpp : <p>I'm need to create id just number. For example: 12345678 If user inputs fail( contain char), delete char immediately. For example: 123a =>input gain! Please help me!</p>
0debug
static inline void cris_ftag_d(unsigned int x) { register unsigned int v asm("$r10") = x; asm ("ftagd\t[%0]\n" : : "r" (v) ); }
1threat
static void rx_init_frame(eTSEC *etsec, const uint8_t *buf, size_t size) { uint32_t fcb_size = 0; uint8_t prsdep = (etsec->regs[RCTRL].value >> RCTRL_PRSDEP_OFFSET) & RCTRL_PRSDEP_MASK; if (prsdep != 0) { fcb_size = 8 + ((etsec->regs[RCTRL].value >> 16) & 0x1F); etsec->rx_fcb_size = fcb_size; memset(etsec->rx_fcb, 0x0, sizeof(etsec->rx_fcb)); } else { etsec->rx_fcb_size = 0; } if (etsec->rx_buffer != NULL) { g_free(etsec->rx_buffer); } etsec->rx_buffer = (uint8_t *)buf; etsec->rx_buffer_len = size; etsec->rx_padding = 4; etsec->rx_first_in_frame = 1; etsec->rx_remaining_data = etsec->rx_buffer_len; RING_DEBUG("%s: rx_buffer_len:%u rx_padding+crc:%u\n", __func__, etsec->rx_buffer_len, etsec->rx_padding); }
1threat
static void decode_opc(CPUMIPSState *env, DisasContext *ctx) { int32_t offset; int rs, rt, rd, sa; uint32_t op, op1; int16_t imm; if (ctx->pc & 0x3) { env->CP0_BadVAddr = ctx->pc; generate_exception_err(ctx, EXCP_AdEL, EXCP_INST_NOTAVAIL); return; } if ((ctx->hflags & MIPS_HFLAG_BMASK_BASE) == MIPS_HFLAG_BL) { TCGLabel *l1 = gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_NE, bcond, 0, l1); tcg_gen_movi_i32(hflags, ctx->hflags & ~MIPS_HFLAG_BMASK); gen_goto_tb(ctx, 1, ctx->pc + 4); gen_set_label(l1); } op = MASK_OP_MAJOR(ctx->opcode); rs = (ctx->opcode >> 21) & 0x1f; rt = (ctx->opcode >> 16) & 0x1f; rd = (ctx->opcode >> 11) & 0x1f; sa = (ctx->opcode >> 6) & 0x1f; imm = (int16_t)ctx->opcode; switch (op) { case OPC_SPECIAL: decode_opc_special(env, ctx); break; case OPC_SPECIAL2: decode_opc_special2_legacy(env, ctx); break; case OPC_SPECIAL3: decode_opc_special3(env, ctx); break; case OPC_REGIMM: op1 = MASK_REGIMM(ctx->opcode); switch (op1) { case OPC_BLTZL: case OPC_BGEZL: case OPC_BLTZALL: case OPC_BGEZALL: check_insn(ctx, ISA_MIPS2); check_insn_opc_removed(ctx, ISA_MIPS32R6); case OPC_BLTZ: case OPC_BGEZ: gen_compute_branch(ctx, op1, 4, rs, -1, imm << 2, 4); break; case OPC_BLTZAL: case OPC_BGEZAL: if (ctx->insn_flags & ISA_MIPS32R6) { if (rs == 0) { gen_compute_branch(ctx, op1, 4, 0, -1, imm << 2, 4); } else { generate_exception_end(ctx, EXCP_RI); } } else { gen_compute_branch(ctx, op1, 4, rs, -1, imm << 2, 4); } break; case OPC_TGEI ... OPC_TEQI: case OPC_TNEI: check_insn(ctx, ISA_MIPS2); check_insn_opc_removed(ctx, ISA_MIPS32R6); gen_trap(ctx, op1, rs, -1, imm); break; case OPC_SIGRIE: check_insn(ctx, ISA_MIPS32R6); generate_exception_end(ctx, EXCP_RI); break; case OPC_SYNCI: check_insn(ctx, ISA_MIPS32R2); ctx->bstate = BS_STOP; break; case OPC_BPOSGE32: #if defined(TARGET_MIPS64) case OPC_BPOSGE64: #endif check_dsp(ctx); gen_compute_branch(ctx, op1, 4, -1, -2, (int32_t)imm << 2, 4); break; #if defined(TARGET_MIPS64) case OPC_DAHI: check_insn(ctx, ISA_MIPS32R6); check_mips_64(ctx); if (rs != 0) { tcg_gen_addi_tl(cpu_gpr[rs], cpu_gpr[rs], (int64_t)imm << 32); } break; case OPC_DATI: check_insn(ctx, ISA_MIPS32R6); check_mips_64(ctx); if (rs != 0) { tcg_gen_addi_tl(cpu_gpr[rs], cpu_gpr[rs], (int64_t)imm << 48); } break; #endif default: MIPS_INVAL("regimm"); generate_exception_end(ctx, EXCP_RI); break; } break; case OPC_CP0: check_cp0_enabled(ctx); op1 = MASK_CP0(ctx->opcode); switch (op1) { case OPC_MFC0: case OPC_MTC0: case OPC_MFTR: case OPC_MTTR: case OPC_MFHC0: case OPC_MTHC0: #if defined(TARGET_MIPS64) case OPC_DMFC0: case OPC_DMTC0: #endif #ifndef CONFIG_USER_ONLY gen_cp0(env, ctx, op1, rt, rd); #endif break; case OPC_C0_FIRST ... OPC_C0_LAST: #ifndef CONFIG_USER_ONLY gen_cp0(env, ctx, MASK_C0(ctx->opcode), rt, rd); #endif break; case OPC_MFMC0: #ifndef CONFIG_USER_ONLY { uint32_t op2; TCGv t0 = tcg_temp_new(); op2 = MASK_MFMC0(ctx->opcode); switch (op2) { case OPC_DMT: check_insn(ctx, ASE_MT); gen_helper_dmt(t0); gen_store_gpr(t0, rt); break; case OPC_EMT: check_insn(ctx, ASE_MT); gen_helper_emt(t0); gen_store_gpr(t0, rt); break; case OPC_DVPE: check_insn(ctx, ASE_MT); gen_helper_dvpe(t0, cpu_env); gen_store_gpr(t0, rt); break; case OPC_EVPE: check_insn(ctx, ASE_MT); gen_helper_evpe(t0, cpu_env); gen_store_gpr(t0, rt); break; case OPC_DVP: check_insn(ctx, ISA_MIPS32R6); if (ctx->vp) { gen_helper_dvp(t0, cpu_env); gen_store_gpr(t0, rt); } break; case OPC_EVP: check_insn(ctx, ISA_MIPS32R6); if (ctx->vp) { gen_helper_evp(t0, cpu_env); gen_store_gpr(t0, rt); } break; case OPC_DI: check_insn(ctx, ISA_MIPS32R2); save_cpu_state(ctx, 1); gen_helper_di(t0, cpu_env); gen_store_gpr(t0, rt); ctx->bstate = BS_STOP; break; case OPC_EI: check_insn(ctx, ISA_MIPS32R2); save_cpu_state(ctx, 1); gen_helper_ei(t0, cpu_env); gen_store_gpr(t0, rt); ctx->bstate = BS_STOP; break; default: MIPS_INVAL("mfmc0"); generate_exception_end(ctx, EXCP_RI); break; } tcg_temp_free(t0); } #endif break; case OPC_RDPGPR: check_insn(ctx, ISA_MIPS32R2); gen_load_srsgpr(rt, rd); break; case OPC_WRPGPR: check_insn(ctx, ISA_MIPS32R2); gen_store_srsgpr(rt, rd); break; default: MIPS_INVAL("cp0"); generate_exception_end(ctx, EXCP_RI); break; } break; case OPC_BOVC: if (ctx->insn_flags & ISA_MIPS32R6) { gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { gen_arith_imm(ctx, op, rt, rs, imm); } break; case OPC_ADDIU: gen_arith_imm(ctx, op, rt, rs, imm); break; case OPC_SLTI: case OPC_SLTIU: gen_slt_imm(ctx, op, rt, rs, imm); break; case OPC_ANDI: case OPC_LUI: case OPC_ORI: case OPC_XORI: gen_logic_imm(ctx, op, rt, rs, imm); break; case OPC_J ... OPC_JAL: offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2; gen_compute_branch(ctx, op, 4, rs, rt, offset, 4); break; case OPC_BLEZC: if (ctx->insn_flags & ISA_MIPS32R6) { if (rt == 0) { generate_exception_end(ctx, EXCP_RI); break; } gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); } break; case OPC_BGTZC: if (ctx->insn_flags & ISA_MIPS32R6) { if (rt == 0) { generate_exception_end(ctx, EXCP_RI); break; } gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); } break; case OPC_BLEZALC: if (rt == 0) { gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); } else { check_insn(ctx, ISA_MIPS32R6); gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } break; case OPC_BGTZALC: if (rt == 0) { gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); } else { check_insn(ctx, ISA_MIPS32R6); gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } break; case OPC_BEQL: case OPC_BNEL: check_insn(ctx, ISA_MIPS2); check_insn_opc_removed(ctx, ISA_MIPS32R6); case OPC_BEQ: case OPC_BNE: gen_compute_branch(ctx, op, 4, rs, rt, imm << 2, 4); break; case OPC_LL: check_insn(ctx, ISA_MIPS2); case OPC_LWL: case OPC_LWR: check_insn_opc_removed(ctx, ISA_MIPS32R6); case OPC_LB ... OPC_LH: case OPC_LW ... OPC_LHU: gen_ld(ctx, op, rt, rs, imm); break; case OPC_SWL: case OPC_SWR: check_insn_opc_removed(ctx, ISA_MIPS32R6); case OPC_SB ... OPC_SH: case OPC_SW: gen_st(ctx, op, rt, rs, imm); break; case OPC_SC: check_insn(ctx, ISA_MIPS2); check_insn_opc_removed(ctx, ISA_MIPS32R6); gen_st_cond(ctx, op, rt, rs, imm); break; case OPC_CACHE: check_insn_opc_removed(ctx, ISA_MIPS32R6); check_cp0_enabled(ctx); check_insn(ctx, ISA_MIPS3 | ISA_MIPS32); if (ctx->hflags & MIPS_HFLAG_ITC_CACHE) { gen_cache_operation(ctx, rt, rs, imm); } break; case OPC_PREF: check_insn_opc_removed(ctx, ISA_MIPS32R6); check_insn(ctx, ISA_MIPS4 | ISA_MIPS32); break; case OPC_LWC1: case OPC_LDC1: case OPC_SWC1: case OPC_SDC1: gen_cop1_ldst(ctx, op, rt, rs, imm); break; case OPC_CP1: op1 = MASK_CP1(ctx->opcode); switch (op1) { case OPC_MFHC1: case OPC_MTHC1: check_cp1_enabled(ctx); check_insn(ctx, ISA_MIPS32R2); case OPC_MFC1: case OPC_CFC1: case OPC_MTC1: case OPC_CTC1: check_cp1_enabled(ctx); gen_cp1(ctx, op1, rt, rd); break; #if defined(TARGET_MIPS64) case OPC_DMFC1: case OPC_DMTC1: check_cp1_enabled(ctx); check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_cp1(ctx, op1, rt, rd); break; #endif case OPC_BC1EQZ: check_cp1_enabled(ctx); if (ctx->insn_flags & ISA_MIPS32R6) { gen_compute_branch1_r6(ctx, MASK_CP1(ctx->opcode), rt, imm << 2, 4); } else { check_cop1x(ctx); check_insn(ctx, ASE_MIPS3D); gen_compute_branch1(ctx, MASK_BC1(ctx->opcode), (rt >> 2) & 0x7, imm << 2); } break; case OPC_BC1NEZ: check_cp1_enabled(ctx); check_insn(ctx, ISA_MIPS32R6); gen_compute_branch1_r6(ctx, MASK_CP1(ctx->opcode), rt, imm << 2, 4); break; case OPC_BC1ANY4: check_cp1_enabled(ctx); check_insn_opc_removed(ctx, ISA_MIPS32R6); check_cop1x(ctx); check_insn(ctx, ASE_MIPS3D); case OPC_BC1: check_cp1_enabled(ctx); check_insn_opc_removed(ctx, ISA_MIPS32R6); gen_compute_branch1(ctx, MASK_BC1(ctx->opcode), (rt >> 2) & 0x7, imm << 2); break; case OPC_PS_FMT: check_ps(ctx); case OPC_S_FMT: case OPC_D_FMT: check_cp1_enabled(ctx); gen_farith(ctx, ctx->opcode & FOP(0x3f, 0x1f), rt, rd, sa, (imm >> 8) & 0x7); break; case OPC_W_FMT: case OPC_L_FMT: { int r6_op = ctx->opcode & FOP(0x3f, 0x1f); check_cp1_enabled(ctx); if (ctx->insn_flags & ISA_MIPS32R6) { switch (r6_op) { case R6_OPC_CMP_AF_S: case R6_OPC_CMP_UN_S: case R6_OPC_CMP_EQ_S: case R6_OPC_CMP_UEQ_S: case R6_OPC_CMP_LT_S: case R6_OPC_CMP_ULT_S: case R6_OPC_CMP_LE_S: case R6_OPC_CMP_ULE_S: case R6_OPC_CMP_SAF_S: case R6_OPC_CMP_SUN_S: case R6_OPC_CMP_SEQ_S: case R6_OPC_CMP_SEUQ_S: case R6_OPC_CMP_SLT_S: case R6_OPC_CMP_SULT_S: case R6_OPC_CMP_SLE_S: case R6_OPC_CMP_SULE_S: case R6_OPC_CMP_OR_S: case R6_OPC_CMP_UNE_S: case R6_OPC_CMP_NE_S: case R6_OPC_CMP_SOR_S: case R6_OPC_CMP_SUNE_S: case R6_OPC_CMP_SNE_S: gen_r6_cmp_s(ctx, ctx->opcode & 0x1f, rt, rd, sa); break; case R6_OPC_CMP_AF_D: case R6_OPC_CMP_UN_D: case R6_OPC_CMP_EQ_D: case R6_OPC_CMP_UEQ_D: case R6_OPC_CMP_LT_D: case R6_OPC_CMP_ULT_D: case R6_OPC_CMP_LE_D: case R6_OPC_CMP_ULE_D: case R6_OPC_CMP_SAF_D: case R6_OPC_CMP_SUN_D: case R6_OPC_CMP_SEQ_D: case R6_OPC_CMP_SEUQ_D: case R6_OPC_CMP_SLT_D: case R6_OPC_CMP_SULT_D: case R6_OPC_CMP_SLE_D: case R6_OPC_CMP_SULE_D: case R6_OPC_CMP_OR_D: case R6_OPC_CMP_UNE_D: case R6_OPC_CMP_NE_D: case R6_OPC_CMP_SOR_D: case R6_OPC_CMP_SUNE_D: case R6_OPC_CMP_SNE_D: gen_r6_cmp_d(ctx, ctx->opcode & 0x1f, rt, rd, sa); break; default: gen_farith(ctx, ctx->opcode & FOP(0x3f, 0x1f), rt, rd, sa, (imm >> 8) & 0x7); break; } } else { gen_farith(ctx, ctx->opcode & FOP(0x3f, 0x1f), rt, rd, sa, (imm >> 8) & 0x7); } break; } case OPC_BZ_V: case OPC_BNZ_V: case OPC_BZ_B: case OPC_BZ_H: case OPC_BZ_W: case OPC_BZ_D: case OPC_BNZ_B: case OPC_BNZ_H: case OPC_BNZ_W: case OPC_BNZ_D: check_insn(ctx, ASE_MSA); gen_msa_branch(env, ctx, op1); break; default: MIPS_INVAL("cp1"); generate_exception_end(ctx, EXCP_RI); break; } break; case OPC_BC: case OPC_BALC: if (ctx->insn_flags & ISA_MIPS32R6) { gen_compute_compact_branch(ctx, op, 0, 0, sextract32(ctx->opcode << 2, 0, 28)); } else { generate_exception_err(ctx, EXCP_CpU, 2); } break; case OPC_BEQZC: case OPC_BNEZC: if (ctx->insn_flags & ISA_MIPS32R6) { if (rs != 0) { gen_compute_compact_branch(ctx, op, rs, 0, sextract32(ctx->opcode << 2, 0, 23)); } else { gen_compute_compact_branch(ctx, op, 0, rt, imm); } } else { generate_exception_err(ctx, EXCP_CpU, 2); } break; case OPC_CP2: check_insn(ctx, INSN_LOONGSON2F); gen_loongson_multimedia(ctx, sa, rd, rt); break; case OPC_CP3: check_insn_opc_removed(ctx, ISA_MIPS32R6); if (ctx->CP0_Config1 & (1 << CP0C1_FP)) { check_cp1_enabled(ctx); op1 = MASK_CP3(ctx->opcode); switch (op1) { case OPC_LUXC1: case OPC_SUXC1: check_insn(ctx, ISA_MIPS5 | ISA_MIPS32R2); case OPC_LWXC1: case OPC_LDXC1: case OPC_SWXC1: case OPC_SDXC1: check_insn(ctx, ISA_MIPS4 | ISA_MIPS32R2); gen_flt3_ldst(ctx, op1, sa, rd, rs, rt); break; case OPC_PREFX: check_insn(ctx, ISA_MIPS4 | ISA_MIPS32R2); break; case OPC_ALNV_PS: check_insn(ctx, ISA_MIPS5 | ISA_MIPS32R2); case OPC_MADD_S: case OPC_MADD_D: case OPC_MADD_PS: case OPC_MSUB_S: case OPC_MSUB_D: case OPC_MSUB_PS: case OPC_NMADD_S: case OPC_NMADD_D: case OPC_NMADD_PS: case OPC_NMSUB_S: case OPC_NMSUB_D: case OPC_NMSUB_PS: check_insn(ctx, ISA_MIPS4 | ISA_MIPS32R2); gen_flt3_arith(ctx, op1, sa, rs, rd, rt); break; default: MIPS_INVAL("cp3"); generate_exception_end(ctx, EXCP_RI); break; } } else { generate_exception_err(ctx, EXCP_CpU, 1); } break; #if defined(TARGET_MIPS64) case OPC_LDL ... OPC_LDR: case OPC_LLD: check_insn_opc_removed(ctx, ISA_MIPS32R6); case OPC_LWU: case OPC_LD: check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_ld(ctx, op, rt, rs, imm); break; case OPC_SDL ... OPC_SDR: check_insn_opc_removed(ctx, ISA_MIPS32R6); case OPC_SD: check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_st(ctx, op, rt, rs, imm); break; case OPC_SCD: check_insn_opc_removed(ctx, ISA_MIPS32R6); check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_st_cond(ctx, op, rt, rs, imm); break; case OPC_BNVC: if (ctx->insn_flags & ISA_MIPS32R6) { gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_arith_imm(ctx, op, rt, rs, imm); } break; case OPC_DADDIU: check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); gen_arith_imm(ctx, op, rt, rs, imm); break; #else case OPC_BNVC: if (ctx->insn_flags & ISA_MIPS32R6) { gen_compute_compact_branch(ctx, op, rs, rt, imm << 2); } else { MIPS_INVAL("major opcode"); generate_exception_end(ctx, EXCP_RI); } break; #endif case OPC_DAUI: if (ctx->insn_flags & ISA_MIPS32R6) { #if defined(TARGET_MIPS64) check_mips_64(ctx); if (rs == 0) { generate_exception(ctx, EXCP_RI); } else if (rt != 0) { TCGv t0 = tcg_temp_new(); gen_load_gpr(t0, rs); tcg_gen_addi_tl(cpu_gpr[rt], t0, imm << 16); tcg_temp_free(t0); } #else generate_exception_end(ctx, EXCP_RI); MIPS_INVAL("major opcode"); #endif } else { check_insn(ctx, ASE_MIPS16 | ASE_MICROMIPS); offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2; gen_compute_branch(ctx, op, 4, rs, rt, offset, 4); } break; case OPC_MSA: gen_msa(env, ctx); break; case OPC_PCREL: check_insn(ctx, ISA_MIPS32R6); gen_pcrel(ctx, ctx->opcode, ctx->pc, rs); break; default: MIPS_INVAL("major opcode"); generate_exception_end(ctx, EXCP_RI); break; } }
1threat
Why do I get different results from Python Interpreter and a calculator? : I have the following formula: > SZT = SZ0 + (((SZ1 - SZ0) / (WMZ1 - WMZ0)) * (WMZT - WMZ0)) Example: 86266 + (((168480 - 86266) / (703786 - 510531)) * (703765.0 - 510531)) When I use the python interpreter for this calculation, I got this result: [Calculation in Python Interpreter][1] When I use a calculator (Google for example) I got this result: [Calculation on Google][2] I assume the second is the right result. What's wrong about the calculation in Python? [1]: https://i.stack.imgur.com/k6ZHI.jpg [2]: https://www.google.de/search?q=86266%20%2B%20(%20(%20(168480%20-%2086266)%20%2F%20(703786%20-%20510531)%20)%20*%20(703765-510531)%20)&rlz=1C1CHBD_deDE715DE715&oq=86266%20%2B%20(%20(%20(168480%20-%2086266)%20%2F%20(703786%20-%20510531)%20)%20*%20(703765-510531)%20)&aqs=chrome..69i57.711j0j8&sourceid=chrome&ie=UTF
0debug
Keras replacing input layer : <p>The code that I have (that I can't change) uses the Resnet with <code>my_input_tensor</code> as the input_tensor.</p> <pre><code>model1 = keras.applications.resnet50.ResNet50(input_tensor=my_input_tensor, weights='imagenet') </code></pre> <p>Investigating the <a href="https://github.com/keras-team/keras/blob/master/keras/applications/resnet50.py" rel="noreferrer">source code</a>, ResNet50 function creates a new keras Input Layer with <code>my_input_tensor</code> and then create the rest of the model. This is the behavior that I want to copy with my own model. I load my model from h5 file.</p> <pre><code>model2 = keras.models.load_model('my_model.h5') </code></pre> <p>Since this model already has an Input Layer, I want to replace it with a new Input Layer defined with <code>my_input_tensor</code>.</p> <p>How can I replace an input layer?</p>
0debug
int kvm_vcpu_ioctl(CPUState *env, int type, ...) { int ret; void *arg; va_list ap; va_start(ap, type); arg = va_arg(ap, void *); va_end(ap); ret = ioctl(env->kvm_fd, type, arg); if (ret == -1) ret = -errno; return ret; }
1threat
C#, Having an issue with a pyramid of buttons : If you're from the USA, and you've ever been to a Cracker Barrel, then you've probably played the board game where you have to jump pegs until you only have one left. It's similar to Chinese checkers, with just a pyramid, or a triangle. I created this in C# on Visual Studio. I have a form that makes the buttons and adds them to the form, and i have a "TheBoard" class that has all of the rules for how jumping works on the form. In my form, I also have a button clicker method that needs to run all of this, but I seem to have hit a brick wall. I can't figure out the logic behind getting it to accept a second click, in order to move through the whole if statements in the board class. My parameter for the move method in the board class takes an int x, which is the button you click on as a parameter. I feel like I'm missing the second half. Can someone please save me? *Gist of board class:https://gist.github.com/anonymous/9a1bb364e2b2a0bb7d0bacbdb37d166b *Gist of form1 class:https://gist.github.com/anonymous/94e89599c7df6bf5a2084a1790bebd4d
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
How to switch layouts in Angular2 : <p>What is the best practices way of using two entirely different layouts in the same Angular2 application? For example in my /login route I want to have a very simple box horizontally and vertically centered, for every other route I want my full template with header, content and footer.</p>
0debug
static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) { Error *local_err = NULL; BDRVSheepdogState *s = bs->opaque; int ret, fd; uint32_t new_vid; SheepdogInode *inode; unsigned int datalen; DPRINTF("sn_info: name %s id_str %s s: name %s vm_state_size %" PRId64 " " "is_snapshot %d\n", sn_info->name, sn_info->id_str, s->name, sn_info->vm_state_size, s->is_snapshot); if (s->is_snapshot) { error_report("You can't create a snapshot of a snapshot VDI, " "%s (%" PRIu32 ").", s->name, s->inode.vdi_id); return -EINVAL; } DPRINTF("%s %s\n", sn_info->name, sn_info->id_str); s->inode.vm_state_size = sn_info->vm_state_size; s->inode.vm_clock_nsec = sn_info->vm_clock_nsec; strncpy(s->inode.tag, sn_info->name, sizeof(s->inode.tag)); datalen = SD_INODE_SIZE - sizeof(s->inode.data_vdi_id); 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 cleanup; } ret = write_object(fd, (char *)&s->inode, vid_to_vdi_oid(s->inode.vdi_id), s->inode.nr_copies, datalen, 0, false, s->cache_flags); if (ret < 0) { error_report("failed to write snapshot's inode."); goto cleanup; } ret = do_sd_create(s, &new_vid, 1, &local_err); if (ret < 0) { error_report("%s", error_get_pretty(local_err));; error_free(local_err); error_report("failed to create inode for snapshot. %s", strerror(errno)); goto cleanup; } inode = (SheepdogInode *)g_malloc(datalen); ret = read_object(fd, (char *)inode, vid_to_vdi_oid(new_vid), s->inode.nr_copies, datalen, 0, s->cache_flags); if (ret < 0) { error_report("failed to read new inode info. %s", strerror(errno)); goto cleanup; } memcpy(&s->inode, inode, datalen); DPRINTF("s->inode: name %s snap_id %x oid %x\n", s->inode.name, s->inode.snap_id, s->inode.vdi_id); cleanup: closesocket(fd); return ret; }
1threat
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
Im not getting the else output : Im new on python, and while i was testing a few things i tried this idea, but i can't get it works ` parx = input("Write your parX: ") pary = input("Write your parY: ") while pary != 0 and parx != 0: cociente = int(parx) / int(pary) print ("Su cociente es: ",cociente) parx = input("Write your parX: ") pary = input("Write your parY: ") else: print("your ordered pair is not divisible") ` i expect the output of the else , but it only shows an error when i write 0,0 on my variables, i want that when i enter 0 0 the program says " your ordered pair is not divisible" the error says: " File "Ejercicio2PDF3.py", line 6, in <module> ZeroDivisionError: division by zero"
0debug
The class file for a new Thread and the class file for main are the same : <p>I have a program called Main.java, shown as below. After compilation of this program, there will be two .class file: Main.class and Main$1.class. My problem is the two .class files are exactly the same. </p> <p>Anyone knows what is wrong? </p> <p>I wan to instrument some codes in the run() method of the new thread, but I cannot find the instructions of codes in the run() method of a new thread. </p> <pre><code>public class Main{ public static void main(String...args){ Thread t=new Thread(){ @Override public void run(){ System.out.println("xxxx"); } }; t.start(); } } </code></pre>
0debug
BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name) { BusState *bus; char *buf; int i,len; bus = qemu_mallocz(info->size); bus->info = info; bus->parent = parent; if (name) { bus->name = qemu_strdup(name); } else if (parent && parent->id) { len = strlen(parent->id) + 16; buf = qemu_malloc(len); snprintf(buf, len, "%s.%d", parent->id, parent->num_child_bus); bus->name = buf; } else { len = strlen(info->name) + 16; buf = qemu_malloc(len); len = snprintf(buf, len, "%s.%d", info->name, parent ? parent->num_child_bus : 0); for (i = 0; i < len; i++) buf[i] = qemu_tolower(buf[i]); bus->name = buf; } LIST_INIT(&bus->children); if (parent) { LIST_INSERT_HEAD(&parent->child_bus, bus, sibling); parent->num_child_bus++; } return bus; }
1threat
what does if(index(i,$2)==1 indicate : Jus come across an awk script awk 'BEGIN {OFS=FS} NR==FNR {a[$1]=($2" "$3);next} {for (i in a) if(index(i,$12)==1) print $0,a[$12]}' in this script what does if(index(i,$12)==1 means. Is it indicating true/false condition on just numerical equal to 1.
0debug
static int send_full_color_rect(VncState *vs, int w, int h) { int stream = 0; size_t bytes; vnc_write_u8(vs, stream << 4); if (vs->tight_pixel24) { tight_pack24(vs, vs->tight.buffer, w * h, &vs->tight.offset); bytes = 3; } else { bytes = vs->clientds.pf.bytes_per_pixel; } bytes = tight_compress_data(vs, stream, w * h * bytes, tight_conf[vs->tight_compression].raw_zlib_level, Z_DEFAULT_STRATEGY); return (bytes >= 0); }
1threat
PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, ISABus **isa_bus, qemu_irq *pic, MemoryRegion *address_space_mem, MemoryRegion *address_space_io, ram_addr_t ram_size, hwaddr pci_hole_start, hwaddr pci_hole_size, ram_addr_t above_4g_mem_size, MemoryRegion *pci_address_space, MemoryRegion *ram_memory) { DeviceState *dev; PCIBus *b; PCIDevice *d; PCIHostState *s; PIIX3State *piix3; PCII440FXState *f; unsigned i; I440FXState *i440fx; dev = qdev_create(NULL, TYPE_I440FX_PCI_HOST_BRIDGE); s = PCI_HOST_BRIDGE(dev); b = pci_bus_new(dev, NULL, pci_address_space, address_space_io, 0, TYPE_PCI_BUS); s->bus = b; object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev), NULL); qdev_init_nofail(dev); d = pci_create_simple(b, 0, TYPE_I440FX_PCI_DEVICE); *pi440fx_state = I440FX_PCI_DEVICE(d); f = *pi440fx_state; f->system_memory = address_space_mem; f->pci_address_space = pci_address_space; f->ram_memory = ram_memory; i440fx = I440FX_PCI_HOST_BRIDGE(dev); if (ram_size <= 0x80000000) { i440fx->pci_info.w32.begin = 0x80000000; } else if (ram_size <= 0xc0000000) { i440fx->pci_info.w32.begin = 0xc0000000; } else { i440fx->pci_info.w32.begin = 0xe0000000; } memory_region_init_alias(&f->pci_hole, OBJECT(d), "pci-hole", f->pci_address_space, pci_hole_start, pci_hole_size); memory_region_add_subregion(f->system_memory, pci_hole_start, &f->pci_hole); pc_init_pci64_hole(&i440fx->pci_info, 0x100000000ULL + above_4g_mem_size, i440fx->pci_hole64_size); memory_region_init_alias(&f->pci_hole_64bit, OBJECT(d), "pci-hole64", f->pci_address_space, i440fx->pci_info.w64.begin, i440fx->pci_hole64_size); if (i440fx->pci_hole64_size) { memory_region_add_subregion(f->system_memory, i440fx->pci_info.w64.begin, &f->pci_hole_64bit); } memory_region_init_alias(&f->smram_region, OBJECT(d), "smram-region", f->pci_address_space, 0xa0000, 0x20000); memory_region_add_subregion_overlap(f->system_memory, 0xa0000, &f->smram_region, 1); memory_region_set_enabled(&f->smram_region, false); init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space, &f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE); for (i = 0; i < 12; ++i) { init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space, &f->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); } if (xen_enabled()) { piix3 = DO_UPCAST(PIIX3State, dev, pci_create_simple_multifunction(b, -1, true, "PIIX3-xen")); pci_bus_irqs(b, xen_piix3_set_irq, xen_pci_slot_get_pirq, piix3, XEN_PIIX_NUM_PIRQS); } else { piix3 = DO_UPCAST(PIIX3State, dev, pci_create_simple_multifunction(b, -1, true, "PIIX3")); pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3, PIIX_NUM_PIRQS); pci_bus_set_route_irq_fn(b, piix3_route_intx_pin_to_irq); } piix3->pic = pic; *isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); *piix3_devfn = piix3->dev.devfn; ram_size = ram_size / 8 / 1024 / 1024; if (ram_size > 255) { ram_size = 255; } d->config[0x57] = ram_size; i440fx_update_memory_mappings(f); return b; }
1threat
loop taking some time and resulting wrong value; first n prime : <p>I'm trying to write a method that gives the collection of first n prime numbers. I googled and many of my code is similar to the ones I found online. but my loop takes long time and print 2, 0 Here's my code </p> <pre><code>public static boolean isPrime(int numb) { if(numb &lt; 0) { return false; } for(int i = 2; i &lt; numb; i++) { if((numb % i) != 0) { return false; } } return true; } public static int[] firstPrimeNumbers(int n) { int[] pNumbs = new int[n]; int count = 0; int number = 2; while(count != n) { if(isPrime(number)) { pNumbs[count] = number; count++; } number++; } return pNumbs; } public static void main(String[] args) { int[] a = firstPrimeNumbers(2); for(int x: a) { System.out.println(x); } } </code></pre>
0debug
get the group expression portion of a matching expression [not a duplicate, please read carefully] : this is a repost [get the group expression portion of a matching expression][1], which was erroneously, but undestandingly marked as duplicate. what i am trying to obtain is the portion of the regular expression, not the portion of the matching string. contents of previous post: given the var `expression = /(a.)|(b.)|(c.)/;`, to match the `var value = "axx"`, i would like to be able to get the portion of `expression` that matched the `value`, in this case, `(a.)` [1]: http://stackoverflow.com/questions/36574566/get-the-group-expression-portion-of-a-matching-expression
0debug
Password box doesn't display since updated to php 7 : <p>My web hosting have now decided to use PHP 7 and I'm having issues with some of my pages , managed to fix most but this one is a head scratcher for me. The password box doesn't show but the others box in the same page do? so I can't type the password to register</p> <p>I've noticed the height is defined differently and not sure how to get around it if this is the issue</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?PHP require_once("./include/membersite_config.php"); if(isset($_POST['submitted'])) { if($fgmembersite-&gt;RegisterUser()) { $fgmembersite-&gt;RedirectToURL("thank-you.html"); } } ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"&gt; &lt;head&gt; &lt;meta http-equiv='Content-Type' content='text/html; charset=utf-8' /&gt; &lt;title&gt;Contact us&lt;/title&gt; &lt;link rel="STYLESHEET" type="text/css" href="style/fg_membersite.css" /&gt; &lt;script type='text/javascript' src='scripts/gen_validatorv31.js'&gt;&lt;/script&gt; &lt;link rel="STYLESHEET" type="text/css" href="style/pwdwidget.css" /&gt; &lt;script src="scripts/pwdwidget.js" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;!-- Form Code Start --&gt; &lt;div id='fg_membersite'&gt; &lt;form id='register' action='&lt;?php echo $fgmembersite-&gt;GetSelfScript(); ?&gt;' method='post' accept-charset='UTF-8'&gt; &lt;fieldset&gt; &lt;legend&gt;Register&lt;/legend&gt; &lt;input type='hidden' name='submitted' id='submitted' value='1' /&gt; &lt;div class='short_explanation'&gt;* required fields&lt;/div&gt; &lt;input type='text' class='spmhidip' name='&lt;?php echo $fgmembersite-&gt;GetSpamTrapInputName(); ?&gt;' /&gt; &lt;div&gt;&lt;span class='error'&gt;&lt;?php echo $fgmembersite-&gt;GetErrorMessage(); ?&gt;&lt;/span&gt;&lt;/div&gt; &lt;div class='container'&gt; &lt;label for='name'&gt;Your Full Name*: &lt;/label&gt;&lt;br/&gt; &lt;input type='text' name='name' id='name' value='&lt;?php echo $fgmembersite-&gt;SafeDisplay(' name ') ?&gt;' maxlength="50" /&gt;&lt;br/&gt; &lt;span id='register_name_errorloc' class='error'&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class='container'&gt; &lt;label for='email'&gt;Email Address*:&lt;/label&gt;&lt;br/&gt; &lt;input type='text' name='email' id='email' value='&lt;?php echo $fgmembersite-&gt;SafeDisplay(' email ') ?&gt;' maxlength="50" /&gt;&lt;br/&gt; &lt;span id='register_email_errorloc' class='error'&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class='container'&gt; &lt;label for='username'&gt;UserName*:&lt;/label&gt;&lt;br/&gt; &lt;input type='text' name='username' id='username' value='&lt;?php echo $fgmembersite-&gt;SafeDisplay(' username ') ?&gt;' maxlength="50" /&gt;&lt;br/&gt; &lt;span id='register_username_errorloc' class='error'&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class='container' style='height:80px;'&gt; &lt;label for='password'&gt;Password*:&lt;/label&gt;&lt;br/&gt; &lt;div class='pwdwidgetdiv' id='thepwddiv'&gt;&lt;/div&gt; &lt;noscript&gt; &lt;input type='password' name='password' id='password' maxlength="50" /&gt; &lt;/noscript&gt; &lt;div id='register_password_errorloc' class='error' style='clear:both'&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class='container'&gt; &lt;input type='submit' name='Submit' value='Submit' /&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;!-- client-side Form Validations: Uses the excellent form validation script from JavaScript-coder.com--&gt; &lt;script type='text/javascript'&gt; // &lt;![CDATA[ var pwdwidget = new PasswordWidget('thepwddiv', 'password'); pwdwidget.MakePWDWidget(); var frmvalidator = new Validator("register"); frmvalidator.EnableOnPageErrorDisplay(); frmvalidator.EnableMsgsTogether(); frmvalidator.addValidation("name", "req", "Please provide your name"); frmvalidator.addValidation("email", "req", "Please provide your email address"); frmvalidator.addValidation("email", "email", "Please provide a valid email address"); frmvalidator.addValidation("username", "req", "Please provide a username"); frmvalidator.addValidation("password", "req", "Please provide a password"); // ]]&gt; &lt;/script&gt; &lt;!-- Form Code End (see html-form-guide.com for more info.) --&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p>
0debug
How to extract bias weights in Keras sequential model? : <p>I'm running a simple feed-forward network using <em>Keras</em> . Having just one hidden layer I would like to make some inference regarding the relevance of each input to each output and I would like to extract the weights. </p> <p>This is the model: </p> <pre><code>def build_model(input_dim, output_dim): n_output_layer_1 = 150 n_output = output_dim model = Sequential() model.add(Dense(n_output_layer_1, input_dim=input_dim, activation='relu')) model.add(Dropout(0.25)) model.add(Dense(n_output)) </code></pre> <p>To extract the weight I wrote: </p> <pre><code>for layer in model.layers: weights = layer.get_weights() weights = np.array(weights[0]) #this is hidden to output first = model.layers[0].get_weights() #input to hidden first = np.array(first[0]) </code></pre> <p>Unfortunately I don't get the biases columns in the matrices, which I know Keras automatically puts in it. </p> <p><strong>Do you know how to retrieve the biases weights?</strong></p> <p>Thank you in advance for your help !</p>
0debug
Detecting multiple keypresses in c# : <p>This is my program:</p> <pre><code> private void Form1_KeyDown(object sender, KeyEventArgs e) { points++; textbox1.Text = points.ToString(); textbox1.Refresh(); } </code></pre> <p>I want the program to increase a variable everytime a key is pressed, it doesn't matter which one.</p> <p>Right now my progam doesn't even start the event when i press a key, so i don't know what to do.</p>
0debug
int arm_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs, int cpuid, void *opaque) { struct arm_note note; CPUARMState *env = &ARM_CPU(cs)->env; DumpState *s = opaque; int ret, i; arm_note_init(&note, s, "CORE", 5, NT_PRSTATUS, sizeof(note.prstatus)); note.prstatus.pr_pid = cpu_to_dump32(s, cpuid); for (i = 0; i < 16; ++i) { note.prstatus.pr_reg.regs[i] = cpu_to_dump32(s, env->regs[i]); } note.prstatus.pr_reg.regs[16] = cpu_to_dump32(s, cpsr_read(env)); ret = f(&note, ARM_PRSTATUS_NOTE_SIZE, s); if (ret < 0) { return -1; } return 0; }
1threat
Generate and Sign Certificate Request using pure .net Framework : <p>I am trying to use pure .net code to create a certificate request and create a certificate from the certificate request against an existing CA certificate I have available (either in the Windows Certificate store or as a separate file).</p> <p>I know that I have the classes <code>X509Certificate</code> and <code>X509Certificate2</code> available to load certificates and get access to their information, but I don't see any classes or functionality within the <code>System.Security.Cryptography</code> namespace that could be used to create a certificate request or to sign such a certificate request to create a new signed certificate.</p> <p>And that although the <a href="https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.pkcs" rel="noreferrer">documentation on the <code>System.Security.Cryptography.Pkcs</code> namespace</a> says: </p> <blockquote> <p>The System.Security.Cryptography.Pkcs namespace provides programming elements for Public Key Cryptography Standards (PKCS), including methods for signing data, exchanging keys, <strong>requesting certificates</strong>, public key encryption and decryption, and other security functions.</p> </blockquote> <p>So, how can I create a certificate request and sign that request to create a new X509 certificate using only pure .net classes from <code>System.Security.Cryptography</code>?</p> <hr> <p>Note:</p> <ul> <li>I don't want to use an external executable like openssl or MakeCert</li> <li>I don't want to use BouncyCastle</li> <li>I don't want to use Windows <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa374863(v=vs.85).aspx" rel="noreferrer">Certificate Enrollment API</a> </li> <li>I don't want to use the native Win32 API functions</li> </ul>
0debug
void helper_fcmpo(CPUPPCState *env, uint64_t arg1, uint64_t arg2, uint32_t crfD) { CPU_DoubleU farg1, farg2; uint32_t ret = 0; farg1.ll = arg1; farg2.ll = arg2; if (unlikely(float64_is_any_nan(farg1.d) || float64_is_any_nan(farg2.d))) { ret = 0x01UL; } else if (float64_lt(farg1.d, farg2.d, &env->fp_status)) { ret = 0x08UL; } else if (!float64_le(farg1.d, farg2.d, &env->fp_status)) { ret = 0x04UL; } else { ret = 0x02UL; } env->fpscr &= ~(0x0F << FPSCR_FPRF); env->fpscr |= ret << FPSCR_FPRF; env->crf[crfD] = ret; if (unlikely(ret == 0x01UL)) { if (float64_is_signaling_nan(farg1.d) || float64_is_signaling_nan(farg2.d)) { fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN | POWERPC_EXCP_FP_VXVC); } else { fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXVC); } } }
1threat
FWCfgState *fw_cfg_init_mem(hwaddr ctl_addr, hwaddr data_addr) { DeviceState *dev; SysBusDevice *sbd; dev = qdev_create(NULL, TYPE_FW_CFG_MEM); qdev_prop_set_uint32(dev, "data_width", fw_cfg_data_mem_ops.valid.max_access_size); fw_cfg_init1(dev); sbd = SYS_BUS_DEVICE(dev); sysbus_mmio_map(sbd, 0, ctl_addr); sysbus_mmio_map(sbd, 1, data_addr); return FW_CFG(dev); }
1threat
START_TEST(qdict_new_test) { QDict *qdict; qdict = qdict_new(); fail_unless(qdict != NULL); fail_unless(qdict_size(qdict) == 0); fail_unless(qdict->base.refcnt == 1); fail_unless(qobject_type(QOBJECT(qdict)) == QTYPE_QDICT); free(qdict); }
1threat
For a database, what number does it start with, 0, or 1? : <p>I am making a phpMyAdmin database for my website, and have something called "rank". I want there to be three ranks. For where it says "Length/Values" should I put 3 or 2? Is it like in Java where it starts with a 0 (i.e. an array of 3 is 0, 1, 2)?</p> <p>And a follow up, if I put in 3, will it auto make it 0, 1, 2? Or is it 1, 2, 3?</p>
0debug
static int parse_args(int argc, char **argv) { const char *r; int optind; struct qemu_argument *arginfo; for (arginfo = arg_table; arginfo->handle_opt != NULL; arginfo++) { if (arginfo->env == NULL) { continue; } r = getenv(arginfo->env); if (r != NULL) { arginfo->handle_opt(r); } } optind = 1; for (;;) { if (optind >= argc) { break; } r = argv[optind]; if (r[0] != '-') { break; } optind++; r++; if (!strcmp(r, "-")) { break; } for (arginfo = arg_table; arginfo->handle_opt != NULL; arginfo++) { if (!strcmp(r, arginfo->argv)) { if (optind >= argc) { usage(); } arginfo->handle_opt(argv[optind]); if (arginfo->has_arg) { optind++; } break; } } if (arginfo->handle_opt == NULL) { usage(); } } if (optind >= argc) { usage(); } filename = argv[optind]; exec_path = argv[optind]; return optind; }
1threat
chnage body color when slider change : I am using bootstrap 4 slider. I want to change background color of body when first item is active in the bootstrap slider. and if any other item is active then body color will normal.
0debug
Android Jetpack Navigation How to handle the Toolbar and BottomNavBar content : <p>I am a bit confused on how the Navigation component fits in the app behavior. It all looks nice and shiny in tutorials where you don't do things too complex but when implementing in real app, things seem different.</p> <p><strong>Before Navigation</strong></p> <p>Before implementing navigation I had to manually run fragment transactions. In order to do this, my fragment would implement an interface <code>onFragmentAction</code> which passed a <code>bundle</code> to the main <code>Activity</code> and in the activity based on the actions, replace the current fragment with another one.</p> <p>The second part that needs handling is the top toolbar and the <code>BottomAppBar</code>. For instance <code>BottomAppBar</code> needs to have the <code>FAB</code> aligned differently on some fragments or hidden in others. Also the top <code>ToolBar</code> needs to be expanded on some or collapsed on others. To do this, I listened to <code>FragmentManager.OnBackStackChangedListener</code> and based on the fragment tag <code>getSupportFragmentManager().getBackStackEntryAt(size - 1).getName()</code> change the layout accordingly.</p> <p><strong>With Navigation</strong></p> <p>The first part seems to be easy to do: pass params and start new fragments. But I have no idea if navigation can handle the toolbars management or I need to keep managing it from my Activity. </p>
0debug
void subch_device_save(SubchDev *s, QEMUFile *f) { int i; qemu_put_byte(f, s->cssid); qemu_put_byte(f, s->ssid); qemu_put_be16(f, s->schid); qemu_put_be16(f, s->devno); qemu_put_byte(f, s->thinint_active); qemu_put_be32(f, s->curr_status.pmcw.intparm); qemu_put_be16(f, s->curr_status.pmcw.flags); qemu_put_be16(f, s->curr_status.pmcw.devno); qemu_put_byte(f, s->curr_status.pmcw.lpm); qemu_put_byte(f, s->curr_status.pmcw.pnom); qemu_put_byte(f, s->curr_status.pmcw.lpum); qemu_put_byte(f, s->curr_status.pmcw.pim); qemu_put_be16(f, s->curr_status.pmcw.mbi); qemu_put_byte(f, s->curr_status.pmcw.pom); qemu_put_byte(f, s->curr_status.pmcw.pam); qemu_put_buffer(f, s->curr_status.pmcw.chpid, 8); qemu_put_be32(f, s->curr_status.pmcw.chars); qemu_put_be16(f, s->curr_status.scsw.flags); qemu_put_be16(f, s->curr_status.scsw.ctrl); qemu_put_be32(f, s->curr_status.scsw.cpa); qemu_put_byte(f, s->curr_status.scsw.dstat); qemu_put_byte(f, s->curr_status.scsw.cstat); qemu_put_be16(f, s->curr_status.scsw.count); qemu_put_be64(f, s->curr_status.mba); qemu_put_buffer(f, s->curr_status.mda, 4); qemu_put_buffer(f, s->sense_data, 32); qemu_put_be64(f, s->channel_prog); qemu_put_byte(f, s->last_cmd.cmd_code); qemu_put_byte(f, s->last_cmd.flags); qemu_put_be16(f, s->last_cmd.count); qemu_put_be32(f, s->last_cmd.cda); qemu_put_byte(f, s->last_cmd_valid); qemu_put_byte(f, s->id.reserved); qemu_put_be16(f, s->id.cu_type); qemu_put_byte(f, s->id.cu_model); qemu_put_be16(f, s->id.dev_type); qemu_put_byte(f, s->id.dev_model); qemu_put_byte(f, s->id.unused); for (i = 0; i < ARRAY_SIZE(s->id.ciw); i++) { qemu_put_byte(f, s->id.ciw[i].type); qemu_put_byte(f, s->id.ciw[i].command); qemu_put_be16(f, s->id.ciw[i].count); } qemu_put_byte(f, s->ccw_fmt_1); qemu_put_byte(f, s->ccw_no_data_cnt); }
1threat
static int encode_packets(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile, int tileno) { int compno, reslevelno, ret; Jpeg2000CodingStyle *codsty = &s->codsty; Jpeg2000QuantStyle *qntsty = &s->qntsty; av_log(s->avctx, AV_LOG_DEBUG, "tier2\n"); for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){ for (compno = 0; compno < s->ncomponents; compno++){ int precno; Jpeg2000ResLevel *reslevel = s->tile[tileno].comp[compno].reslevel + reslevelno; for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++){ if (ret = encode_packet(s, reslevel, precno, qntsty->expn + (reslevelno ? 3*reslevelno-2 : 0), qntsty->nguardbits)) return ret; } } } av_log(s->avctx, AV_LOG_DEBUG, "after tier2\n"); return 0; }
1threat
Bash script strange issue with labels : I am not very familiar with bash so I'm gonna ask you about strange problem I just got. I have a script with: IF "%USER_COUNTRY%"=="ie" IF NOT "%POS_TYPE%" == "ipos" ( GOTO IE_Start) and below I have some labels: :PT_Start ECHO Start PT rem for PT Num Lock must be activated before POS start .\native\klocks.exe +n IF NOT EXIST c:\C3 GOTO NO_C3 pushd c:\C3\ tskill /V /A c3_net cmd /c START /min c3_net.exe GOTO C3_DONE :NO_C3 ECHO C3 not present in C:\C3\ ECHO start without C3 :C3_DONE popd GOTO Start_Now :IE_Start ECHO Start IE IF NOT EXIST c:\C3 GOTO NO_C3_RPM pushd c:\C3\ tskill /V /A c3_rpm_net cmd /c START c3_rpm_net.exe GOTO RPM_C3_DONE :NO_C3_RPM ECHO C3 not present in C:\C3\ ECHO start without C3 :RPM_C3_DONE popd GOTO Start_Now :PL_Start ECHO Start PL pushd c:\AModule\ cmd /c START Forcom.AModule.exe echo "AModule ist gestartet" popd GOTO Start_Now I am getting: > The system cannot find the batch label specified - IE_Start Script is run under windows but it was saves on unix so it has LF line-end signs. I am telling this because there are few ways to fix that problem but I don't understand why. I noticed that following fixes the problem: 1) Changing line-end signs to CR LF (windows specific) 2) Moving IE_Start label and it's part of code before PT_Start 3) removing /min from cmd /c START /min c3_net.exe 4) changing line from point 3) to cmd /c START /min C:\C3\c3_net.exe (this file doesn't exist anyway) What's going on?
0debug