problem
stringlengths
26
131k
labels
class label
2 classes
static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) { VFIOGuestIOMMU *giommu = container_of(n, VFIOGuestIOMMU, n); VFIOContainer *container = giommu->container; hwaddr iova = iotlb->iova + giommu->iommu_offset; MemoryRegion *mr; hwaddr xlat; hwaddr len = iotlb->addr_mask + 1; void *vaddr; int ret; trace_vfio_iommu_map_notify(iotlb->perm == IOMMU_NONE ? "UNMAP" : "MAP", iova, iova + iotlb->addr_mask); if (iotlb->target_as != &address_space_memory) { error_report("Wrong target AS \"%s\", only system memory is allowed", iotlb->target_as->name ? iotlb->target_as->name : "none"); return; } rcu_read_lock(); mr = address_space_translate(&address_space_memory, iotlb->translated_addr, &xlat, &len, iotlb->perm & IOMMU_WO); if (!memory_region_is_ram(mr)) { error_report("iommu map to non memory area %"HWADDR_PRIx"", xlat); goto out; } if (len & iotlb->addr_mask) { error_report("iommu has granularity incompatible with target AS"); goto out; } if ((iotlb->perm & IOMMU_RW) != IOMMU_NONE) { vaddr = memory_region_get_ram_ptr(mr) + xlat; ret = vfio_dma_map(container, iova, iotlb->addr_mask + 1, vaddr, !(iotlb->perm & IOMMU_WO) || mr->readonly); if (ret) { error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", " "0x%"HWADDR_PRIx", %p) = %d (%m)", container, iova, iotlb->addr_mask + 1, vaddr, ret); } } else { ret = vfio_dma_unmap(container, iova, iotlb->addr_mask + 1); if (ret) { error_report("vfio_dma_unmap(%p, 0x%"HWADDR_PRIx", " "0x%"HWADDR_PRIx") = %d (%m)", container, iova, iotlb->addr_mask + 1, ret); } } out: rcu_read_unlock(); }
1threat
Parameter that's a list of interface{} : <p>I'm trying to create a function that prints out the <code>len</code> of a list passed into it, regardless of the type of the list. My naive way of doing this was: </p> <pre><code>func printLength(lis []interface{}) { fmt.Printf("Length: %d", len(lis)) } </code></pre> <p>However, when trying to use it via</p> <pre><code>func main() { strs := []string{"Hello,", "World!"} printLength(strs) } </code></pre> <p>It complains saying</p> <pre><code>cannot use strs (type []string) as type []interface {} in argument to printLength </code></pre> <p>But, a <code>string</code> can be used as a <code>interface{}</code>, so why can't a <code>[]string</code> be used as a <code>[]interface{}</code>?</p>
0debug
Multi level object data manipulation PHP : I have a multi-level object data with a structure similar to the window below. I am trying to * sum all the direct package values for the top users or say `parents`, only * sum all the nested indirect package values from the `children` tree. The final result is expected to be similar to: `[{"sum_direct": 600},{"sum_indirect": 3000}]` <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> { "users": [{ "user_id": 2, "ref_id": 1, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": [{ "user_id": 58, "ref_id": 2, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 }, { "user_id": 59, "ref_id": 2, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 }, { "user_id": 111, "ref_id": 2, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 }, { "user_id": 116, "ref_id": 2, "package": [{ "name": "Diamond" }, { "direct": 1000 }, { "indirect": 500 } ], "children": 0 }, { "user_id": 119, "ref_id": 2, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 } ] }, { ... }, { "user_id": 100, "ref_id": 1, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": [{ "user_id": 101, "ref_id": 100, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 }, { "user_id": 102, "ref_id": 100, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 }, { "user_id": 103, "ref_id": 100, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 }, { "user_id": 104, "ref_id": 100, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 }, { "user_id": 105, "ref_id": 100, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 }, { "user_id": 106, "ref_id": 100, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 }, { "user_id": 107, "ref_id": 100, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 }, { "user_id": 108, "ref_id": 100, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 }, { "user_id": 109, "ref_id": 100, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 }, { "user_id": 110, "ref_id": 100, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 }, { "user_id": 117, "ref_id": 100, "package": [{ "name": "Diamond" }, { "direct": 1000 }, { "indirect": 500 } ], "children": 0 }, { "user_id": 129, "ref_id": 100, "package": [{ "name": "Diamond" }, { "direct": 1000 }, { "indirect": 500 } ], "children": 0 }, { "user_id": 130, "ref_id": 100, "package": [{ "name": "Basic" }, { "direct": 200 }, { "indirect": 100 } ], "children": 0 } ] } ] } <!-- end snippet --> Complete data at [users.json][1] [1]: https://github.com/bishoplee/mlu/edit/master/users.json
0debug
static void patch_instruction(VAPICROMState *s, CPUX86State *env, target_ulong ip) { target_phys_addr_t paddr; VAPICHandlers *handlers; uint8_t opcode[2]; uint32_t imm32; if (smp_cpus == 1) { handlers = &s->rom_state.up; } else { handlers = &s->rom_state.mp; } pause_all_vcpus(); cpu_memory_rw_debug(env, ip, opcode, sizeof(opcode), 0); switch (opcode[0]) { case 0x89: patch_byte(env, ip, 0x50 + modrm_reg(opcode[1])); patch_call(s, env, ip + 1, handlers->set_tpr); break; case 0x8b: patch_byte(env, ip, 0x90); patch_call(s, env, ip + 1, handlers->get_tpr[modrm_reg(opcode[1])]); break; case 0xa1: patch_call(s, env, ip, handlers->get_tpr[0]); break; case 0xa3: patch_call(s, env, ip, handlers->set_tpr_eax); break; case 0xc7: patch_byte(env, ip, 0x68); cpu_memory_rw_debug(env, ip + 6, (void *)&imm32, sizeof(imm32), 0); cpu_memory_rw_debug(env, ip + 1, (void *)&imm32, sizeof(imm32), 1); patch_call(s, env, ip + 5, handlers->set_tpr); break; case 0xff: patch_byte(env, ip, 0x50); patch_call(s, env, ip + 1, handlers->get_tpr_stack); break; default: abort(); } resume_all_vcpus(); paddr = cpu_get_phys_page_debug(env, ip); paddr += ip & ~TARGET_PAGE_MASK; tb_invalidate_phys_page_range(paddr, paddr + 1, 1); }
1threat
Need to parse a text file line by line with a certain search string using powershell : <p>I need to parse a text file line by line with a certain search string and if that string is not found in any line, then code should output that entire line to separate text file.</p>
0debug
How to install zookeeper as service on CentOS 7 : <p>I am trying to install zookeeper on CentOS 7 using <code>yum install zookeeper</code> or <code>yum install zookeeperd</code> but it throws: <code>There is no zookeeper package available.</code> </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 (RTP_PT_IS_RTCP(ptr[1])) 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); ffurl_write(rt->rtsp_hd_out, interleaved_packet, 4 + packet_len); ptr += packet_len; size -= packet_len; } av_free(buf); ffio_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE); return 0; }
1threat
static int hls_read_packet(AVFormatContext *s, AVPacket *pkt) { HLSContext *c = s->priv_data; int ret, i, minvariant = -1; if (c->first_packet) { recheck_discard_flags(s, 1); c->first_packet = 0; } start: c->end_of_segment = 0; for (i = 0; i < c->n_variants; i++) { struct variant *var = c->variants[i]; if (var->needed && !var->pkt.data) { while (1) { int64_t ts_diff; AVStream *st; ret = av_read_frame(var->ctx, &var->pkt); if (ret < 0) { if (!url_feof(&var->pb)) return ret; reset_packet(&var->pkt); break; } else { if (c->first_timestamp == AV_NOPTS_VALUE) c->first_timestamp = var->pkt.dts; } if (c->seek_timestamp == AV_NOPTS_VALUE) break; if (var->pkt.dts == AV_NOPTS_VALUE) { c->seek_timestamp = AV_NOPTS_VALUE; break; } st = var->ctx->streams[var->pkt.stream_index]; ts_diff = av_rescale_rnd(var->pkt.dts, AV_TIME_BASE, st->time_base.den, AV_ROUND_DOWN) - c->seek_timestamp; if (ts_diff >= 0 && (c->seek_flags & AVSEEK_FLAG_ANY || var->pkt.flags & AV_PKT_FLAG_KEY)) { c->seek_timestamp = AV_NOPTS_VALUE; break; } } } if (var->pkt.data) { struct variant *minvar = c->variants[minvariant]; if (minvariant < 0 || av_compare_ts(var->pkt.dts, var->ctx->streams[var->pkt.stream_index]->time_base, minvar->pkt.dts, minvar->ctx->streams[minvar->pkt.stream_index]->time_base) > 0) minvariant = i; } } if (c->end_of_segment) { if (recheck_discard_flags(s, 0)) goto start; } if (minvariant >= 0) { *pkt = c->variants[minvariant]->pkt; pkt->stream_index += c->variants[minvariant]->stream_offset; reset_packet(&c->variants[minvariant]->pkt); return 0; } return AVERROR_EOF; }
1threat
Application crashes only in release version : <p>When you run the application in <strong>debug</strong> mode the app can't crash. But when generates the .apk file <strong>release</strong> the app crash. <strong>This error does not happen on all phones</strong>, in just a few that have the android 6.</p> <p>The logcat shows that the problem is a <strong>NullPointerException</strong> in the class (<strong>android.support.v4.widget.drawerlayout</strong>). How can a NullPointerException launches only on release apk?</p> <p>We already disable proguard, minify and shrinkResources. Didn't resolve this bug.</p> <p>Here some logs:</p> <pre><code>Attempt to invoke virtual method 'int android.view.WindowInsets.getSystemWindowInsetLeft()' on a null object reference at android.support.v4.widget.i.a(Unknown Source) at android.support.v4.widget.DrawerLayout$d.a(Unknown Source) at android.support.v4.widget.DrawerLayout.onMeasure(Unknown Source) at android.view.View.measure(View.java:18799) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.support.v7.widget.ContentFrameLayout.onMeasure(Unknown Source) at android.view.View.measure(View.java:18799) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951) </code></pre>
0debug
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
i need to get id when i have another tag a : i have my code is <a class="btn btn-outline-primary" id="1" href="<?php echo site_url(); ?>/InchatroomController/LikeMessage/1" style=""> </a> <a class="btn btn-outline-primary" id="2" href="<?php echo site_url(); ?>/InchatroomController/LikeMessage/2" style=""> </a> <a class="btn btn-outline-primary" id="3" href="<?php echo site_url(); ?>/InchatroomController/LikeMessage/3" style=""> </a> <a class="btn btn-outline-primary" id="4" href="<?php echo site_url(); ?>/InchatroomController/LikeMessage/4" style=""> </a> and id = n i need to know how to write jquery ajax go to InchatroomController/LikeMessage/id" don't refresh page or how can i get id tag a when i click
0debug
void vncws_tls_handshake_io(void *opaque) { VncState *vs = (VncState *)opaque; if (!vs->tls.session) { VNC_DEBUG("TLS Websocket setup\n"); if (vnc_tls_client_setup(vs, vs->vd->tls.x509cert != NULL) < 0) { return; } } VNC_DEBUG("Handshake IO continue\n"); vncws_start_tls_handshake(vs); }
1threat
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
How to show the disk usage of each subdirectory in Linux? : <p>I have a directory, <code>/var/lib/docker</code>, which contains several subdirectories:</p> <pre><code>/var/lib/docker$ sudo ls aufs containers image network plugins swarm tmp trust volumes </code></pre> <p>I'd like to find out how big each directory is. However, using the <code>du</code> command as follows,</p> <pre><code>/var/lib/docker$ sudo du -csh . 15G . 15G total </code></pre> <p>I don't see the 'breakdown' for each directory. In the examples I've seen in <a href="http://www.tecmint.com/check-linux-disk-usage-of-files-and-directories/" rel="noreferrer">http://www.tecmint.com/check-linux-disk-usage-of-files-and-directories/</a>, however, it seems that I should see it. How might I obtain this overview to see which directory is taking up the most space?</p>
0debug
Python 3: If we have imported urllib and/or urllib3, do we need to also import requests lib independently? : In a course I'm taking, we have the following code: [![enter image description here][1]][1] You can see we are importing the `requests` library, but at the same time it is inside `urllib3` as a module/package. Doing some research I've found that Python comes with the `urllib` package, that comes with the `request` module. On the other hand, `requests` is a module inside `urllib3`, but it is a library on its own. `urllib` and `urllib2` are standard Python librares, but `urllib3` is a completely separated library with a confusing name. A portion of it has been included in the standard library and `requests` depends on it, but it is not a newer version of `urllib`/`urllib2`; the library that actually wants to improve is `httplib` (ref: [Github](https://github.com/urllib3/urllib3/issues/1065)). <blockquote>"Under the hood, *requests* uses *urllib3* to do most of the http heavy lifting. When used properly, it should be mostly the same unless you need more advanced configuration" </blockquote> (ref: [Stackexchange](https://stackoverflow.com/questions/36937110/what-is-the-practical-difference-between-these-two-ways-of-making-web-connection)): I got to these conclussions but I'm still confused. If I import `urllib`, do I still need to import `requests`? What if I import `urllib3`? Also, should it be imported separatedly, as in the depicted code, or should I import it `from` one of the mentioned libraries? [1]: https://i.stack.imgur.com/gspd3.png
0debug
Is it possible to use dotenv in a react project? : <p>I am trying to set some environment variables (for making API calls to dev/prod endpoints, keys depending on dev/prod, etc.) and I'm wondering if using dotenv will work.</p> <p>I've installed dotenv, and I am using webpack.</p> <p>My webpack entry is <code>main.js</code>, so in this file I've put <code>require('dotenv').config()</code></p> <p>Then, in my webpack config, I've put this:</p> <pre><code> new webpack.EnvironmentPlugin([ 'NODE_ENV', '__DEV_BASE_URL__' //base url for dev api endpoints ]) </code></pre> <p>However, it is still undefined. How can I do this correctly? </p>
0debug
Docker image fails to create netlink handle : <p>Can anyone help me make sense of the below error and others like it? I've Googled around, but nothing makes sense for my context. I download my Docker Image, but the container refuses to start. The namespace referenced is not always 26, but could be anything from 20-29. I am launching my Docker container onto an EC2 instance and pulling the image from AWS ECR. The error is persistent no matter if I re-launch the instance completely or restart docker. </p> <pre><code>docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:334: running prestart hook 0 caused \"error running hook: exit status 1, stdout: , stderr: time=\\\"2017-05- 11T21:00:18Z\\\" level=fatal msg=\\\"failed to create a netlink handle: failed to set into network namespace 26 while creating netlink socket: invalid argument\\\" \\n\"". </code></pre>
0debug
Spring boot autowiring an interface with multiple implementations : <p>In normal Spring, when we want to autowire an interface, we define it's implementation in Spring context file. What about Spring boot? how can we achieve this? currently we only autowire classes that are not interfaces. Another part of this question is about using a class in a Junit class inside a Spring boot project. If we want to use a CalendarUtil for example, if we autowire CalendarUtil, it will throw a null pointer exception. What can we do in this case? I just initialized using "new" for now...</p>
0debug
int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, AVPacket *pkt, const AVFrame *frame, int *got_packet) { mfxBitstream bs = { { { 0 } } }; mfxFrameSurface1 *surf = NULL; mfxSyncPoint sync = NULL; int ret; if (frame) { ret = submit_frame(q, frame, &surf); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error submitting the frame for encoding.\n"); return ret; } } ret = ff_alloc_packet(pkt, q->packet_size); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error allocating the output packet\n"); return ret; } bs.Data = pkt->data; bs.MaxLength = pkt->size; do { ret = MFXVideoENCODE_EncodeFrameAsync(q->session, NULL, surf, &bs, &sync); if (ret == MFX_WRN_DEVICE_BUSY) av_usleep(1); } while (ret > 0); if (ret < 0) return (ret == MFX_ERR_MORE_DATA) ? 0 : ff_qsv_error(ret); if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && frame->interlaced_frame) print_interlace_msg(avctx, q); if (sync) { MFXVideoCORE_SyncOperation(q->session, sync, 60000); if (bs.FrameType & MFX_FRAMETYPE_I || bs.FrameType & MFX_FRAMETYPE_xI) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; else if (bs.FrameType & MFX_FRAMETYPE_P || bs.FrameType & MFX_FRAMETYPE_xP) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P; else if (bs.FrameType & MFX_FRAMETYPE_B || bs.FrameType & MFX_FRAMETYPE_xB) avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B; pkt->dts = av_rescale_q(bs.DecodeTimeStamp, (AVRational){1, 90000}, avctx->time_base); pkt->pts = av_rescale_q(bs.TimeStamp, (AVRational){1, 90000}, avctx->time_base); pkt->size = bs.DataLength; if (bs.FrameType & MFX_FRAMETYPE_IDR || bs.FrameType & MFX_FRAMETYPE_xIDR) pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; } return 0; }
1threat
vue.js: always load a settings.scss file in every vue style section : <p>I find myself repeating this same pattern in every .vue file, in order to use variables, etc.:</p> <pre><code>&lt;style lang="scss"&gt; @import "../styles/settings.scss"; .someclass { color: $some-variable; } &lt;/style&gt; </code></pre> <p>or if it's nested in a folder I have to remember to be careful with the path:</p> <pre><code>&lt;style lang="scss"&gt; @import "../../styles/settings.scss"; &lt;/style&gt; </code></pre> <p>Is there a way to globally import that <code>settings.scss</code> file in every .vue file I create? I looked in the docs and didn't see it, but maybe I missed it, or maybe this is something I need to leverage webpack to do?</p>
0debug
Javascript: How to only invoke a function that's called from within another function when a specific div is NOT clicked? : I am calling campusInfo(id) a few places in my code. Inside campusInfo(id) function I am calling campusInfo_2(HouseID). One of the instances where I am calling campusInfo(id) is on the onclick of a div. In this case I don't want campusInfo_2(HouseID) invoked. Here is the campusInfo(id) javascript function which calls campusInfo_2(HouseID) //campus information function campusInfo(id) { fetch(`https://api/` + id) .then(r => r.json()) .then(r => { const mapClassToResponse = { '.campus-name': 'name', '.program-levels-values:eq(4)': 'annualTuition' }; var HouseID = r['Houses'][0]['HouseID']; Object.keys(mapClassToResponse).map(k => { $(k).html(r[mapClassToResponse[k]]); }); //formatting numbers to have commas $(".program-levels-values:eq(4)").digits(); $(".campus-number:eq(0)").digits(); $(".campus-number:eq(1)").digits(); //program-levels $(r.programLevels).each(function (index, item) { $('.program-levels-values:eq(0)').append(item.programLevel + ' '); }); //institution control if (r.isInstitutionControlPublic == false) { $('.program-levels-values:eq(2)').html('Private'); } else { $('.program-levels-values:eq(2)').html('Public'); } campusInfo_2(HouseID); }).catch(console.log); }; Here is the div where I don't want campusInfo_2(HouseID) being invoked <div class="other-school" onclick="campusInfo(10)"><label class="other-schools-list">Portland State University</label</div> Here is what I tried thus far but it was saying in console that the element was undefined. if(document.getElementsByClassName('other-school').clicked == false) { campusInfo_2(HouseID); }
0debug
ItemSource/DataSource for Text Blocks : Im using dapper to retrieve some data from a database using a list. I've been able to do it with a ListBox with ``` private void UpdateBinding() { displayLastNameLB.ItemsSource = people; displayLastNameLB.DisplayMemberPath = "FullInfo"; } ``` and now I want to display it onto a TextBlock but I cant find how. What would be the text block equivalent of `ItemSource` and `DisplayMemberPath`? Heres the full code. ``` public partial class MainWindow : Window { List<Person> people = new List<Person>(); public MainWindow() { InitializeComponent(); UpdateBinding(); } private void UpdateBinding() { displayLastNameLB.ItemsSource = people; displayLastNameLB.DisplayMemberPath = "FullInfo"; } private void Search_Click(object sender, RoutedEventArgs e) { DataAccess db = new DataAccess(); people = db.GetPeople(lastNameTB.Text); UpdateBinding(); } } ``` **The Person List** ``` public class Person { public string FirstName { get; set; } public string LastName { get; set; } public string Email { get; set; } public string PhoneNumber { get; set; } public string FullInfo { get { return $"{ FirstName } { LastName } ({ PhoneNumber })"; } } public string FirstNameOnly { get { return $"{ FirstName }"; } } } ```
0debug
SQL Table to nested xml file : Action Action2 Name Action3 Batch add PL Steve add 1 add PL Steve add 3 add PL Steve add 4 add PL Steve add 5 add PL Steve add 1 add PL Steve add 3 add PL Steve add 4 add PL Steve add 5 [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/QKikY.png
0debug
Turn Array objects into JSON using javascript or jquery : <p>I have dynamic data coming into my website like this:</p> <pre><code>[{ "itemOne": { "url": "www", "name": "Bob" }, "itemTwo": { "url": "www", "name": "fred" } }] </code></pre> <p>Using jQuery or Javascript, I would like to turn this data into JSON, so it would be structured like this:</p> <pre><code>"products": { "itemOne": { "url": pageUrl, "name": productName }, "itemTwo": { "url": pageUrl, "name": productName, } } </code></pre> <p>Is this possible? If so, how would I go about it?</p>
0debug
LiveData observing in Fragment : <p>As of 2019, I'm trying to follow a best practice on where to start observing <code>LiveData</code> in Fragments and if I should pass <code>this</code> or <code>viewLifecycleOwner</code> as a parameter to the <code>observe()</code> method.</p> <ul> <li><p>According to this <a href="https://developer.android.com/topic/libraries/architecture/livedata" rel="noreferrer">Google official documentation</a>, I should observe in <code>onActivityCreated()</code> passing <code>this</code> (the fragment) as parameter.</p></li> <li><p>According to this <a href="https://github.com/googlesamples/android-architecture-components/blob/master/GithubBrowserSample/app/src/main/java/com/android/example/github/ui/user/UserFragment.kt" rel="noreferrer">Google sample</a>, I should observe in <code>onViewCreated()</code> passing <code>viewLifecycleOwner</code> as parameter.</p></li> <li><p>According to this <a href="https://youtu.be/pErTyQpA390?t=459" rel="noreferrer">I/O video</a>, I shouldn't use <code>this</code> but instead <code>viewLifecycleOwner</code>, but doesn't specify where should I start observing.</p></li> <li><p>According to this pitfalls <a href="https://medium.com/@BladeCoder/architecture-components-pitfalls-part-1-9300dd969808" rel="noreferrer">post</a>, I should observe in <code>onActivityCreated()</code> and use <code>viewLifecycleOwner</code>.</p></li> </ul> <p>So, where should I start observing? And should I either use <code>this</code> or <code>viewLifecycleOwner</code>?</p>
0debug
Cell Complete Problems : There is a colony of 8 cells arranged in a straight line where each day every cell competes with its adjacent cells(neighbour). Each day, for each cell, if its neighbours are both active or both inactive, the cell becomes inactive the next day,. otherwise itbecomes active the next day. Assumptions: The two cells on the ends have single adjacent cell, so the other adjacent cell can be assumsed to be always inactive. Even after updating the cell state. consider its pervious state for updating the state of other cells. Update the cell informationof allcells simultaneously. Write a fuction cellCompete which takes takes one 8 element array of integers cells representing the current state of 8 cells and one integer days representing te number of days to simulate. An integer value of 1 represents an active cell and value of 0 represents an inactive cell. program: int* cellCompete(int* cells,int days) { //write your code here } //function signature ends Test Case 1: INPUT: [1,0,0,0,0,1,0,0],1 EXPECTED RETURN VALUE: [0,1,0,0,1,0,1,0] Test Case 2: INPUT: [1,1,1,0,1,1,1,1,],2 EXPECTED RETURN VALUE: [0,0,0,0,0,1,1,0] This is the problem statement given above for the problem . The code which I have written for this problem is given below .But the output is coming same as the input please help . #include<iostream> using namespace std; // signature function to solve the problem int *cells(int *cells,int days) { int previous=0; for(int i=0;i<days;i++) { if(i==0) { if(cells[i+1]==0) { previous=cells[i]; cells[i]=0; } else { cells[i]=0; } if(i==days-1) { if(cells[days-2]==0) { previous=cells[days-1]; cells[days-1]=0; } else { cells[days-1]=1; } } if(previous==cells[i+1]) { previous=cells[i]; cells[i]=0; } else { previous=cells[i]; cells[i]=1; } } } return cells; } int main() { int array[]={1,0,0,0,0,1,0,0}; int *result=cells(array,8); for(int i=0;i<8;i++) cout<<result[i]; } I am not able to get the error and I think my logic is wrong Please help .Can we apply dynamic programming here If we can then how ? Please help me out
0debug
C# download file stealthy? : <p>I was wondering how I would go about retrieving a file in a way that wouldn't be shown (or at least somewhat encrypted) in a web debugger or similar tool (wireshark for instance). <br> <br>I am currently using FTP, but FTP has a couple security flaws such as username and password being viewable in a web debugger or in programs that have been created for getting FTP username and password. Would SFTP be any safer?</p>
0debug
Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0) : <p>I have this error </p> <p><strong>I am try reinstall android studio and remove .gradle folder , any solution please?</strong> </p> <pre><code> Error:FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processDebugResources'. &gt; Android resource linking failed (AAPT2 27.0.3 Daemon #0) Command: C:\javasdk\build-tools\27.0.3\aapt2.exe link -I\ C:\javasdk\platforms\android-26\android.jar\ --manifest\ C:\Users\Jalal D\.gradle\caches\transforms-1\files-1.1\fonticon-0.1.8.aar\2b09376fc14469ba65fc8e4d85c2eed1\res\values\values.xml:19:5-25:25: AAPT: error: resource android:attr/fontVariationSettings not found. C:\Users\Jalal D\.gradle\caches\transforms-1\files-1.1\fonticon-0.1.8.aar\2b09376fc14469ba65fc8e4d85c2eed1\res\values\values.xml:19:5-25:25: AAPT: error: resource android:attr/ttcIndex not found. error: failed linking references. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 1m 3s </code></pre>
0debug
void muls64(int64_t *phigh, int64_t *plow, int64_t a, int64_t b) { #if defined(__x86_64__) __asm__ ("imul %0\n\t" : "=d" (*phigh), "=a" (*plow) : "a" (a), "0" (b) ); #else int64_t ph; uint64_t pm1, pm2, pl; pl = (uint64_t)((uint32_t)a) * (uint64_t)((uint32_t)b); pm1 = (a >> 32) * (uint32_t)b; pm2 = (uint32_t)a * (b >> 32); ph = (a >> 32) * (b >> 32); ph += (int64_t)pm1 >> 32; pm1 = (uint64_t)((uint32_t)pm1) + pm2 + (pl >> 32); *phigh = ph + ((int64_t)pm1 >> 32); *plow = (pm1 << 32) + (uint32_t)pl; #endif }
1threat
def count(lst): return sum(lst)
0debug
What is the difference between BeforeTest and BeforeMethod in TestNG : <p>Both annotations runs before the @test in testNG then what is the difference between two of them.</p>
0debug
Does modules are maded of hash tables in python? : import module_name Is above expression is copying whole code inside working module or it'll just know its name(or its path)? If it copies whole code inside working library then why we have to use "module_name.function" kind of system to work with that module? If it does not copy any code then after the amendment of that module(module_name) why it still works?
0debug
void virtio_queue_set_notification(VirtQueue *vq, int enable) { vq->notification = enable; if (virtio_has_feature(vq->vdev, VIRTIO_RING_F_EVENT_IDX)) { vring_set_avail_event(vq, vring_avail_idx(vq)); } else if (enable) { vring_used_flags_unset_bit(vq, VRING_USED_F_NO_NOTIFY); } else { vring_used_flags_set_bit(vq, VRING_USED_F_NO_NOTIFY); } if (enable) { smp_mb(); } }
1threat
Python error - "ImportError: cannot import name 'dist'" : <p>I'm on Ubuntu 16.04, and I get:</p> <pre><code>Traceback (most recent call last): File "/home/omermazig/.virtualenvs/fixi/bin/pip", line 7, in &lt;module&gt; from pip import main File "/home/omermazig/.virtualenvs/fixi/lib/python3.6/site-packages/pip/__init__.py", line 26, in &lt;module&gt; from pip.utils import get_installed_distributions, get_prog File "/home/omermazig/.virtualenvs/fixi/lib/python3.6/site-packages/pip/utils/__init__.py", line 23, in &lt;module&gt; from pip.locations import ( File "/home/omermazig/.virtualenvs/fixi/lib/python3.6/site-packages/pip/locations.py", line 9, in &lt;module&gt; from distutils import sysconfig File "/home/omermazig/.virtualenvs/fixi/lib/python3.6/distutils/__init__.py", line 25, in &lt;module&gt; from distutils import dist, sysconfig ImportError: cannot import name 'dist' </code></pre> <p>When I run anything with python. This specifically is for trying to run "pip freeze". What to do?</p>
0debug
¿Add dollar sign in to currency format? Javascript : This is the code I have, it returns numbers in currency format but I wish to add the dollar sign ($) before the numbers. > document.getElementById("numbers").onblur = function (){ > this.value = parseFloat(this.value.replace(/,/g, "")) > .toFixed(2) > .toString() > .replace(/\B(?=(\d{3})+(?!\d))/g, ","); > } The id numbers refers to a input text Thanks!
0debug
static int qdm2_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; QDM2Context *s = avctx->priv_data; int16_t *out = data; int i; if(!buf) return 0; if(buf_size < s->checksum_size) return -1; av_log(avctx, AV_LOG_DEBUG, "decode(%d): %p[%d] -> %p[%d]\n", buf_size, buf, s->checksum_size, data, *data_size); for (i = 0; i < 16; i++) { if (qdm2_decode(s, buf, out) < 0) return -1; out += s->channels * s->frame_size; } *data_size = (uint8_t*)out - (uint8_t*)data; return s->checksum_size; }
1threat
void bdrv_set_dirty_iter(HBitmapIter *hbi, int64_t offset) { assert(hbi->hb); hbitmap_iter_init(hbi, hbi->hb, offset); }
1threat
std::map key value pairs not iterating in sequence : <p>I am inserting key value pairs in a <code>std::map</code> as</p> <pre><code>key = //something; value = //something; demoMap[key] = value; </code></pre> <p>Printing the key and value here gives me correct results. However, when I iterate this map as:</p> <pre><code>for( std::map&lt;std::string, std::string&gt;::iterator it = demoMap.begin(); it != demoMap.end(); it++ ) { std::cout &lt;&lt; it-&gt;first + "," &lt;&lt; it-&gt;second; } </code></pre> <p>Using above iteration, I get the second key value pair printed before the first one. Why is it so? The first key value pair should be printed first since the iterator of the map is set to <code>begin()</code> for the map.</p>
0debug
How to turn have a .json file as a string in C# : <p>So I have this .json file: temp_file.json</p> <p>Now all I need to do is get whatever is in this .json file, and put it in a string using C# in Visual Studio 2017.</p> <p>That's it.</p> <p>I don't want it to be turned into a object of a certain class or whatever. Just get whatsever in the file, right into a string. </p> <p>A lot of other questions/answers I have stumbled upon are about desirializing and serializing etc. I don't need that. Just turn the .json file in to a string. No need to write it to a console or whatsoever.</p> <p>Somewhy I just cant lay my finger on it. It sounds simple to do...</p>
0debug
Android TextView Hyperlink : <p>I'm implementing a TextView with a string containing two hyperlinks as below but the links are not opening a new browser window:</p> <pre><code>&lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:textColor="#ffffff" android:paddingLeft="50dp" android:paddingRight="50dp" android:textSize="14sp" android:clickable="true" android:linksClickable="true" android:textColorLink="@color/colorPrimary" android:autoLink="web" android:text="@string/agree_terms_privacy"/&gt; </code></pre> <p>In string.xml</p> <pre><code>&lt;string name="agree_terms_privacy"&gt;By continuing, you agree to our &lt;a href="http://link1/terms"&gt;Terms of Use&lt;/a&gt; and read the &lt;a href="http://link1/privacy"&gt;Privacy Policy&lt;/a&gt;&lt;/string&gt; </code></pre>
0debug
How to save the current date/time when I add new value to Firebase Realtime Database : <p>I want to save the current date/time in specific field when I add new value to Firebase Realtime Database via control panel.</p> <p>How can I achieve that?</p> <p>Please help me.</p>
0debug
static void do_loadvm(int argc, const char **argv) { if (argc != 2) { help_cmd(argv[0]); return; } if (qemu_loadvm(argv[1]) < 0) term_printf("I/O error when loading VM from '%s'\n", argv[1]); }
1threat
Serving static assets in webpack dev server : <p>I run webpack-dev-server from the root folder of my project. I have <em>assets</em> folder in <em>/src/assets</em> that is copied by CopyWebPackPlugin:</p> <pre><code>new CopyWebpackPlugin([ { from: 'src/assets', to: 'assets' } ]) </code></pre> <p>If I put <em>logo.png</em> inside assets folder then After running webpack-dev-server I can't access <em><a href="http://localhost/assets/logo.png">http://localhost/assets/logo.png</a></em> file, but can access <em><a href="http://localhost/src/assets/logo.png">http://localhost/src/assets/logo.png</a></em> file. However if I run in production mode the situation turns upside down.</p> <p>How to configure webpack server to make <em><a href="http://localhost/assets/logo.png">http://localhost/assets/logo.png</a></em> file accessible in development mode?</p>
0debug
merge multiple txt files as one csv file | table : Hey I have couple of files which contain data like this: file1.txt abc def hij file2.txt def abc qlm file3.txt def lop tmn desired output: mergedfile.csv file1 file2 file2 abc def def def abc lop hij qlm tmn will be eagerly waiting for you valuable answers many thanks.
0debug
I am creating change password functionality in android my application is crashing on getResponsecode() : I have provided onCreate and New password method where on debugging it is crashing on getResponsecode().It is crashing and not getting response.It is not going to get response from server protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.change_password_activity); list(getIntent().getExtras().getString("JSON_Object")); CurrentPwdCheck(); NewpwdCheck(); btnSubmit= (Button) findViewById(R.id.btnSubmit); btnSubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { NewPwd(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } } }); } public void NewPwd() throws IOException, JSONException { String myPwd=new_pwd.getText().toString(); String Surl="http://inmeets.com/ChangePwd.php?uid="+uid+"&NewPwd="+myPwd; URL url = null; HttpURLConnection conn = null; url = new URL(Surl); conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod("GET"); conn.setConnectTimeout(1000); if( conn.getResponseCode()==203) { Toast.makeText(getBaseContext(), "your password changed", Toast.LENGTH_SHORT).show(); } }
0debug
static void pc_q35_init_1_6(QEMUMachineInitArgs *args) { has_pci_info = false; pc_q35_init(args); }
1threat
void helper_wrmsr(void) { uint64_t val; helper_svm_check_intercept_param(SVM_EXIT_MSR, 1); val = ((uint32_t)EAX) | ((uint64_t)((uint32_t)EDX) << 32); switch((uint32_t)ECX) { case MSR_IA32_SYSENTER_CS: env->sysenter_cs = val & 0xffff; case MSR_IA32_SYSENTER_ESP: env->sysenter_esp = val; case MSR_IA32_SYSENTER_EIP: env->sysenter_eip = val; case MSR_IA32_APICBASE: cpu_set_apic_base(env, val); case MSR_EFER: { uint64_t update_mask; update_mask = 0; if (env->cpuid_ext2_features & CPUID_EXT2_SYSCALL) update_mask |= MSR_EFER_SCE; if (env->cpuid_ext2_features & CPUID_EXT2_LM) update_mask |= MSR_EFER_LME; if (env->cpuid_ext2_features & CPUID_EXT2_FFXSR) update_mask |= MSR_EFER_FFXSR; if (env->cpuid_ext2_features & CPUID_EXT2_NX) update_mask |= MSR_EFER_NXE; if (env->cpuid_ext3_features & CPUID_EXT3_SVM) update_mask |= MSR_EFER_SVME; cpu_load_efer(env, (env->efer & ~update_mask) | (val & update_mask)); } case MSR_STAR: env->star = val; case MSR_PAT: env->pat = val; case MSR_VM_HSAVE_PA: env->vm_hsave = val; #ifdef TARGET_X86_64 case MSR_LSTAR: env->lstar = val; case MSR_CSTAR: env->cstar = val; case MSR_FMASK: env->fmask = val; case MSR_FSBASE: env->segs[R_FS].base = val; case MSR_GSBASE: env->segs[R_GS].base = val; case MSR_KERNELGSBASE: env->kernelgsbase = val; #endif default: } }
1threat
static inline abi_long do_semctl(int semid, int semnum, int cmd, union target_semun target_su) { union semun arg; struct semid_ds dsarg; unsigned short *array; struct seminfo seminfo; abi_long ret = -TARGET_EINVAL; abi_long err; cmd &= 0xff; switch( cmd ) { case GETVAL: case SETVAL: arg.val = tswapl(target_su.val); ret = get_errno(semctl(semid, semnum, cmd, arg)); target_su.val = tswapl(arg.val); break; case GETALL: case SETALL: err = target_to_host_semarray(semid, &array, target_su.array); if (err) return err; arg.array = array; ret = get_errno(semctl(semid, semnum, cmd, arg)); err = host_to_target_semarray(semid, target_su.array, &array); if (err) return err; break; case IPC_STAT: case IPC_SET: case SEM_STAT: err = target_to_host_semid_ds(&dsarg, target_su.buf); if (err) return err; arg.buf = &dsarg; ret = get_errno(semctl(semid, semnum, cmd, arg)); err = host_to_target_semid_ds(target_su.buf, &dsarg); if (err) return err; break; case IPC_INFO: case SEM_INFO: arg.__buf = &seminfo; ret = get_errno(semctl(semid, semnum, cmd, arg)); err = host_to_target_seminfo(target_su.__buf, &seminfo); if (err) return err; break; case IPC_RMID: case GETPID: case GETNCNT: case GETZCNT: ret = get_errno(semctl(semid, semnum, cmd, NULL)); break; } return ret; }
1threat
Junit @Rule and @ClassRule : <p>I am writing JUnit4 test in which I am using TemporaryFolder rule. It seems that it works fine with both @Rule and @ClassRule. What is the difference between Junit @Rule and @ClassRule? Why should I use one and not another? </p>
0debug
How do I install Python 3.7 in google cloud shell : <p>I have python 3.5 on my google cloud shell and want 3.7 so I can do command line debugging of code I am going to deploy via google cloud functions (and use 3.7 features such as f-strings).</p> <p>I try various forms of the following:</p> <pre><code>sudo apt-get install python37 </code></pre> <p>and always get back</p> <pre><code>Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package python37 </code></pre> <p>Any help would be really appreciated!</p>
0debug
Getting through in Machine Learning : <p>I have just completed Machine learning course from Andrew ng and would like to proceed further. I also want the python implementation of Machine Learning from beginning so that i can practice on Kaggle. Also, is there any better book or tutorial or some resource like that so that i can proceed further without wasting any time searching such resources. </p>
0debug
How to detect if stack smashing protection is enabled in an iOS app : <p>I want to be able to check if stack smashing protection (-fstack-protector-all) is enabled in an iOS app built on Xcode 9 with a target of iOS 11.</p> <p>I built an app with -fstack-protector-all enabled in "Other C flags", and it does build and run, but how can I verify that stack smashing protection is enabled?</p> <p>There are lots of older (2013 and earlier) resources out there that mention <code>otool -Iv appName |grep stack_chk</code>, but I ran that on my app binary and stack_chk was nowhere to be found in the output.</p> <p>Is there a modern equivalent to that command? Is -fstack-protector-all even necessary anymore given the current set of defaults in Xcode?</p>
0debug
static int svq3_decode_frame (AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { MpegEncContext *const s = avctx->priv_data; H264Context *const h = avctx->priv_data; int m, mb_type; unsigned char *extradata; unsigned int size; s->flags = avctx->flags; s->flags2 = avctx->flags2; s->unrestricted_mv = 1; if (!s->context_initialized) { s->width = avctx->width; s->height = avctx->height; h->pred4x4[DIAG_DOWN_LEFT_PRED] = pred4x4_down_left_svq3_c; h->pred16x16[PLANE_PRED8x8] = pred16x16_plane_svq3_c; h->halfpel_flag = 1; h->thirdpel_flag = 1; h->unknown_svq3_flag = 0; h->chroma_qp = 4; if (MPV_common_init (s) < 0) return -1; h->b_stride = 4*s->mb_width; alloc_tables (h); extradata = (unsigned char *)avctx->extradata; for (m = 0; m < avctx->extradata_size; m++) { if (!memcmp (extradata, "SEQH", 4)) break; extradata++; } if (!memcmp (extradata, "SEQH", 4)) { GetBitContext gb; size = BE_32(&extradata[4]); init_get_bits (&gb, extradata + 8, size); if (get_bits (&gb, 3) == 7) { get_bits (&gb, 12); get_bits (&gb, 12); } h->halfpel_flag = get_bits1 (&gb); h->thirdpel_flag = get_bits1 (&gb); get_bits1 (&gb); get_bits1 (&gb); get_bits1 (&gb); get_bits1 (&gb); s->low_delay = get_bits1 (&gb); get_bits1 (&gb); while (get_bits1 (&gb)) { get_bits (&gb, 8); } h->unknown_svq3_flag = get_bits1 (&gb); avctx->has_b_frames = !s->low_delay; } } if (buf_size == 0) { if (s->next_picture_ptr && !s->low_delay) { *(AVFrame *) data = *(AVFrame *) &s->next_picture; *data_size = sizeof(AVFrame); } return 0; } init_get_bits (&s->gb, buf, 8*buf_size); s->mb_x = s->mb_y = 0; if (svq3_decode_slice_header (h)) return -1; s->pict_type = h->slice_type; s->picture_number = h->slice_num; if(avctx->debug&FF_DEBUG_PICT_INFO){ av_log(h->s.avctx, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d\n", av_get_pict_type_char(s->pict_type), h->halfpel_flag, h->thirdpel_flag, s->adaptive_quant, s->qscale ); } s->current_picture.pict_type = s->pict_type; s->current_picture.key_frame = (s->pict_type == I_TYPE); if (s->last_picture_ptr == NULL && s->pict_type == B_TYPE) return 0; if (avctx->hurry_up && s->pict_type == B_TYPE) return 0; if (avctx->hurry_up >= 5) return 0; if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE) ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE) || avctx->skip_frame >= AVDISCARD_ALL) return 0; if (s->next_p_frame_damaged) { if (s->pict_type == B_TYPE) return 0; else s->next_p_frame_damaged = 0; } frame_start (h); if (s->pict_type == B_TYPE) { h->frame_num_offset = (h->slice_num - h->prev_frame_num); if (h->frame_num_offset < 0) { h->frame_num_offset += 256; } if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) { av_log(h->s.avctx, AV_LOG_ERROR, "error in B-frame picture id\n"); return -1; } } else { h->prev_frame_num = h->frame_num; h->frame_num = h->slice_num; h->prev_frame_num_offset = (h->frame_num - h->prev_frame_num); if (h->prev_frame_num_offset < 0) { h->prev_frame_num_offset += 256; } } for(m=0; m<2; m++){ int i; for(i=0; i<4; i++){ int j; for(j=-1; j<4; j++) h->ref_cache[m][scan8[0] + 8*i + j]= 1; h->ref_cache[m][scan8[0] + 8*i + j]= PART_NOT_AVAILABLE; } } for (s->mb_y=0; s->mb_y < s->mb_height; s->mb_y++) { for (s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) { if ( (get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits && ((get_bits_count(&s->gb) & 7) == 0 || show_bits (&s->gb, (-get_bits_count(&s->gb) & 7)) == 0)) { skip_bits(&s->gb, h->next_slice_index - get_bits_count(&s->gb)); s->gb.size_in_bits = 8*buf_size; if (svq3_decode_slice_header (h)) return -1; } mb_type = svq3_get_ue_golomb (&s->gb); if (s->pict_type == I_TYPE) { mb_type += 8; } else if (s->pict_type == B_TYPE && mb_type >= 4) { mb_type += 4; } if (mb_type > 33 || svq3_decode_mb (h, mb_type)) { av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y); return -1; } if (mb_type != 0) { hl_decode_mb (h); } if (s->pict_type != B_TYPE && !s->low_delay) { s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride] = (s->pict_type == P_TYPE && mb_type < 8) ? (mb_type - 1) : -1; } } ff_draw_horiz_band(s, 16*s->mb_y, 16); } MPV_frame_end(s); if (s->pict_type == B_TYPE || s->low_delay) { *(AVFrame *) data = *(AVFrame *) &s->current_picture; } else { *(AVFrame *) data = *(AVFrame *) &s->last_picture; } avctx->frame_number = s->picture_number - 1; if (s->last_picture_ptr || s->low_delay) { *data_size = sizeof(AVFrame); } return buf_size; }
1threat
please help me with the below error in sql URGENT : while running the below query i am getting error for field error_num Implicit conversion from datatype 'VARCHAR' to 'INT' is not allowed. Use the CONVERT function to run this query. below is the query select top 100"Insert into KLG_TRN_SCE..dbBatchRequest values ('" + comp_nr +"','" + ssn_nr +"','" + convert(char(10),Version,101) +"','" + plan_nr +"','1" +"','" + CAST(LEFT(error_num, 4) AS int) +"'," + error_txt +"'," + addname +"'," + convert(char(10),adddate,101) +"')" From KLG_TRN_SCE..dcErrorBin Where ssn_nr='603761193'
0debug
RestTemplate RestTemplate is empty : I created a REST Web Service with the tutorial "http://www.journaldev.com/2552/spring-rest-example-tutorial-spring-restful-web-services", but I am getting a 404 Error running the client. Debugging I found out that in class RestTemplate, method doWithRequest at line 504 List<MediaType> allSupportedMediaTypes = new ArrayList<MediaType>(); allSupportedMediaTypes is empty. The URI is http://localhost:8080/FIRST_REST; in tne pom.xml I have <artifactId>FIRST_REST</artifactId> and <name>FIRST_REST</name>, but maybe the URI is wrong. I don't know how I will get a response; I am going to keep watching this link. Your help will be greatly appreciated, Alejandro Barrero handro1104@gmail.com
0debug
int pci_device_load(PCIDevice *s, QEMUFile *f) { uint32_t version_id; int i; version_id = qemu_get_be32(f); if (version_id > 2) return -EINVAL; qemu_get_buffer(f, s->config, 256); pci_update_mappings(s); if (version_id >= 2) for (i = 0; i < 4; i ++) s->irq_state[i] = qemu_get_be32(f); return 0; }
1threat
static int amr_wb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { AMRWBContext *s = avctx->priv_data; const int16_t *samples = (const int16_t *)frame->data[0]; int size, ret; if ((ret = ff_alloc_packet2(avctx, avpkt, MAX_PACKET_SIZE))) return ret; if (s->last_bitrate != avctx->bit_rate) { s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx); s->last_bitrate = avctx->bit_rate; } size = E_IF_encode(s->state, s->mode, samples, avpkt->data, s->allow_dtx); if (size <= 0 || size > MAX_PACKET_SIZE) { av_log(avctx, AV_LOG_ERROR, "Error encoding frame\n"); return AVERROR(EINVAL); } if (frame->pts != AV_NOPTS_VALUE) avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); avpkt->size = size; *got_packet_ptr = 1; return 0; }
1threat
Bs 4.0 dropdown bug on chrome? : So i've came accross a really weird compatibility issue, i'm using a dropdown for a sidenav menu with bootsrap 4.0 beta, and it works perfectly fine on firefox, but on chrome i have a problem : Basically right when the page loads, if you click the dropdown button it will go up as if it had an invisible negative margin-top, but then when you scroll the page just a bit, and you reclick it, the dropdown will display normally .... Here is a sample of the code i'm using <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous"> </head> <body> <div class="jumbotron" style="background-color:transparent"> <img src="img/logo.png"> <div id="titre"> <h1>My Website</h1><br> </div> </div> <div id="wrapper" class="row"> <div class="col-md-2"> <div class="dropdown show"> <button class="btn dropdown-toggle ml-md-1" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Choose an option </button> <div class="dropdown-menu" aria-labelledby="dropdownMenuLink"> <ul class="list-group"> <li class="dropdown-item list-group-item">Option 1</li> <li class="dropdown-item list-group-item">Option 2</li> <li class="dropdown-item list-group-item">Option 3</li> <li class="dropdown-item list-group-item">Option 4</li> <li class="dropdown-item list-group-item">Option 5</li> <li class="dropdown-item list-group-item">Option 6</li> <li class="dropdown-item list-group-item">Option 7</li> <li class="dropdown-item list-group-item">Option 8</li> <li class="dropdown-item list-group-item">Option 9</li> <li class="dropdown-item list-group-item">Option 10</li> </ul> </div> </div> </div> <div class="schedulePanel col-md-8"> </div> <div class="col-md-2" > <div id="mydiv"> </div> </div> </div> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script> </body> </html> <!-- end snippet -->
0debug
How take date in class constructor? : <p>have json</p> <pre><code>{"id":1,"name":"123","dateoff":"2016-01-12T13:30:46.358+05:00","available":true} </code></pre> <p>and have class</p> <pre><code>export class Compaing { constructor(public id: number, public name: string, public dateoff: Date, public available:boolean) { } } </code></pre> <p>But when i use in angular2 </p> <pre><code>&lt;Compaing&gt;res.json() </code></pre> <p>It dont work. In compaing.dateoff not date, it's string. How parse json string date to Date with constructor?</p>
0debug
Place JSON data in label in Swift : <p>I am able to capture my data through GET method. But I wanted to display my data in a label</p> <pre><code>if let data = data, let dataString = String(data: data, encoding: .utf8) { print("data: \(dataString)") } </code></pre> <p><code>dataString</code> displays </p> <p><code>data: {"data":{"id":1,"user_id":1,"month":9,"date":"2019-09-09 10:48:50","time_in":"09:00:00","time_out":"18:00:00","attendance":"\u25cf","reason":null,"estimated_time":null,"created_at":"2019-08-30 09:56:31","updated_at":"2019-09-09 10:49:48","deleted_at":null}}</code></p> <p>I wanted to get the value of "time_in" and "time_out" and display both in a label</p>
0debug
static inline int decode_subframe(FLACContext *s, int channel) { int32_t *decoded = s->decoded[channel]; int type, wasted = 0; int bps = s->flac_stream_info.bps; int i, tmp, ret; if (channel == 0) { if (s->ch_mode == FLAC_CHMODE_RIGHT_SIDE) bps++; } else { if (s->ch_mode == FLAC_CHMODE_LEFT_SIDE || s->ch_mode == FLAC_CHMODE_MID_SIDE) bps++; } if (get_bits1(&s->gb)) { av_log(s->avctx, AV_LOG_ERROR, "invalid subframe padding\n"); return AVERROR_INVALIDDATA; } type = get_bits(&s->gb, 6); if (get_bits1(&s->gb)) { int left = get_bits_left(&s->gb); if ( left <= 0 || (left < bps && !show_bits_long(&s->gb, left)) || !show_bits_long(&s->gb, bps)) { av_log(s->avctx, AV_LOG_ERROR, "Invalid number of wasted bits > available bits (%d) - left=%d\n", bps, left); return AVERROR_INVALIDDATA; } wasted = 1 + get_unary(&s->gb, 1, get_bits_left(&s->gb)); bps -= wasted; } if (bps > 32) { avpriv_report_missing_feature(s->avctx, "Decorrelated bit depth > 32"); return AVERROR_PATCHWELCOME; } if (type == 0) { tmp = get_sbits_long(&s->gb, bps); for (i = 0; i < s->blocksize; i++) decoded[i] = tmp; } else if (type == 1) { for (i = 0; i < s->blocksize; i++) decoded[i] = get_sbits_long(&s->gb, bps); } else if ((type >= 8) && (type <= 12)) { if ((ret = decode_subframe_fixed(s, decoded, type & ~0x8, bps)) < 0) return ret; } else if (type >= 32) { if ((ret = decode_subframe_lpc(s, decoded, (type & ~0x20)+1, bps)) < 0) return ret; } else { av_log(s->avctx, AV_LOG_ERROR, "invalid coding type\n"); return AVERROR_INVALIDDATA; } if (wasted) { int i; for (i = 0; i < s->blocksize; i++) decoded[i] <<= wasted; } return 0; }
1threat
completion handler's error in swift 3 and Xcode 8 : <p>I have working project in Xcode 7.3 with swift 2.2 version. Now I have updated Xcode 8 and migrated to swift 3. Now my project contains errors specially for blocks like success block of afnetworking.</p> <p><a href="https://i.stack.imgur.com/NYIe1.png"><img src="https://i.stack.imgur.com/NYIe1.png" alt="Snapshot for error in afnetworking post method"></a></p> <p>Which gives error as </p> <pre><code>Cannot convert value of type '() -&gt; ()' to expected argument type '((URLSessionDataTask, Any?) -&gt; Void)?' </code></pre> <p>I don't understand how to solve this to work as per swift 3.</p> <p>And there is also same like error in Facebook login.</p> <p><a href="https://i.stack.imgur.com/uJ9uG.png"><img src="https://i.stack.imgur.com/uJ9uG.png" alt="Facebook Login error"></a></p> <p>Which gives error as</p> <pre><code>Cannot convert value of type '(FBSDKLoginManagerLoginResult!, NSError!) -&gt; Void' to expected argument type 'FBSDKLoginManagerRequestTokenHandler!' </code></pre> <p>and </p> <pre><code>Cannot convert value of type '(_, _, NSError!) -&gt; Void' to expected argument type 'FBSDKGraphRequestHandler!' </code></pre> <p>This all errors are related to handler blocks in swift 3. I don't understand the errors and so that can't able to solve. Any help will be appreciated. Thanks in advance.</p>
0debug
TableView is displayed not how it's supposed to : I created a table view in Xcode, and when i run the project it's displayed awfully (pic related). Don't know what could be the problem What i did was : import UIKit class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { let fruit = ["Apple", "Prune", "Grapes", "Watermelon", "Melon", "Cherry"] @IBOutlet weak var tableView: UITableView! override func viewDidLoad() { super.viewDidLoad() tableView.delegate = self tableView.dataSource = self } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return fruit.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "customCell") as! FruitTableViewCell cell.fruitLable.text = fruit[indexPath.row] cell.fruitImage.image = UIImage(named: fruit[indexPath.row]) return cell } } import UIKit class FruitTableViewCell: UITableViewCell { @IBOutlet weak var fruitView: UIView! @IBOutlet weak var fruitImage: UIImageView! @IBOutlet weak var fruitLable: UILabel! override func awakeFromNib() { super.awakeFromNib() } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) } }
0debug
How to subtract months in dates? : <p>I have this dates function:</p> <pre><code>var isAnnual; var setupDate="05/09/2016" var currDate = new Date();//today </code></pre> <p>I need to check if subtraction of the <strong>months</strong> in dates above is equal to zero.</p> <p>Any idea what is the best way to implement it?</p>
0debug
Visual Studio Yellow Tooltip stuck on screen : <p>I'm running VS2013 Professional on Windows 7 x64 and often finding that, after a debug session, the yellow tooltips from the debugger don't go away and stay on the screen on top of other windows. For example, the image attached shows a debug tooltip now also showing on top of me posting this question.</p> <p><a href="https://i.stack.imgur.com/vyZQX.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/vyZQX.jpg" alt="enter image description here"></a></p> <p>I am able to hide it temporarily by pressing <kbd>Win</kbd> + <kbd>d</kbd> to show the desktop, but as soon as I open / navigate to any window, the tooltip is right back.</p> <p>The only way I've been able to get rid of these tooltips has been to close and re-open my Visual Studio. Any thoughts about what else I could do?</p>
0debug
Why I have different outputs in this C++ code which I could not understand ? : I couldn't understand the output of this program even after a debug, specially the line where you find " f(::x) = h(x) " what does it mean ? Could someone help me please to understand the C++ program and how it runs to understand the outputs. #include<iostream> using namespace std; int x = 6; int h(int & x){x = 2*x; return x;} int g(int m){return x++;} int & f(int &x){x+=::x; return x;} int main() { int x = -1; f(::x) = h(x); cout<<f(x)<<" "<<g(x)<<" "<<h(x)<<" "<<x<<" "<<::x<<endl; f(::x) = g(x); cout<<f(x)<<" "<<g(x)<<" "<<h(x)<<" "<<x<<" "<<::x<<endl; return 0; }
0debug
Array of dynamic length in c : #include <stdio.h> #include <string.h> #include<stdlib.h> int main(void) { char *names = NULL; int capacity = 0; int size = 0; printf("Type 'end' if you want to stop inputting names\n"); while (1) { char name[100]; printf("Input:\n"); fgets(name, sizeof(name), stdin); if (strncmp(name, "end", 3) == 0) { break; } if (size == capacity) { char *temp = realloc(names, sizeof(char) * (size + 1)); if (!temp ) { if (names) { return 1; } } names = temp; capacity++; } names[size] = name; size++; } for(int i=0;i<size; i++) { printf("OUTPUT :%c\n", names[i]); } if (names) { free(names); } } I am trying to create an array of dynamic length in c but I don't know what is wrong with my code? I think it is cause of how I take the user input and the problem occurs when the code" names [size]= name " is executed
0debug
static void gen_lea_modrm(DisasContext *s, int modrm, int *reg_ptr, int *offset_ptr) { int havesib; int base, disp; int index; int scale; int opreg; int mod, rm, code, override, must_add_seg; override = -1; must_add_seg = s->addseg; if (s->prefix & (PREFIX_CS | PREFIX_SS | PREFIX_DS | PREFIX_ES | PREFIX_FS | PREFIX_GS)) { if (s->prefix & PREFIX_ES) override = R_ES; else if (s->prefix & PREFIX_CS) override = R_CS; else if (s->prefix & PREFIX_SS) override = R_SS; else if (s->prefix & PREFIX_DS) override = R_DS; else if (s->prefix & PREFIX_FS) override = R_FS; else override = R_GS; must_add_seg = 1; } mod = (modrm >> 6) & 3; rm = modrm & 7; if (s->aflag) { havesib = 0; base = rm; index = 0; scale = 0; if (base == 4) { havesib = 1; code = ldub(s->pc++); scale = (code >> 6) & 3; index = (code >> 3) & 7; base = code & 7; } switch (mod) { case 0: if (base == 5) { base = -1; disp = ldl(s->pc); s->pc += 4; } else { disp = 0; } break; case 1: disp = (int8_t)ldub(s->pc++); break; default: case 2: disp = ldl(s->pc); s->pc += 4; break; } if (base >= 0) { gen_op_movl_A0_reg[base](); if (disp != 0) gen_op_addl_A0_im(disp); } else { gen_op_movl_A0_im(disp); } if (havesib && (index != 4 || scale != 0)) { gen_op_addl_A0_reg_sN[scale][index](); } if (must_add_seg) { if (override < 0) { if (base == R_EBP || base == R_ESP) override = R_SS; else override = R_DS; } gen_op_addl_A0_seg(offsetof(CPUX86State,seg_cache[override].base)); } } else { switch (mod) { case 0: if (rm == 6) { disp = lduw(s->pc); s->pc += 2; gen_op_movl_A0_im(disp); rm = 0; goto no_rm; } else { disp = 0; } break; case 1: disp = (int8_t)ldub(s->pc++); break; default: case 2: disp = lduw(s->pc); s->pc += 2; break; } switch(rm) { case 0: gen_op_movl_A0_reg[R_EBX](); gen_op_addl_A0_reg_sN[0][R_ESI](); break; case 1: gen_op_movl_A0_reg[R_EBX](); gen_op_addl_A0_reg_sN[0][R_EDI](); break; case 2: gen_op_movl_A0_reg[R_EBP](); gen_op_addl_A0_reg_sN[0][R_ESI](); break; case 3: gen_op_movl_A0_reg[R_EBP](); gen_op_addl_A0_reg_sN[0][R_EDI](); break; case 4: gen_op_movl_A0_reg[R_ESI](); break; case 5: gen_op_movl_A0_reg[R_EDI](); break; case 6: gen_op_movl_A0_reg[R_EBP](); break; default: case 7: gen_op_movl_A0_reg[R_EBX](); break; } if (disp != 0) gen_op_addl_A0_im(disp); gen_op_andl_A0_ffff(); no_rm: if (must_add_seg) { if (override < 0) { if (rm == 2 || rm == 3 || rm == 6) override = R_SS; else override = R_DS; } gen_op_addl_A0_seg(offsetof(CPUX86State,seg_cache[override].base)); } } opreg = OR_A0; disp = 0; *reg_ptr = opreg; *offset_ptr = disp; }
1threat
static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t val) { int i, bytes = 1; while (val >> bytes*8 && bytes < 8) bytes++; put_ebml_id(pb, elementid); put_ebml_num(pb, bytes, 0); for (i = bytes - 1; i >= 0; i--) put_byte(pb, val >> i*8); }
1threat
static_cast to a struct type to access all of its member variable : <p>I have a structure like below:</p> <pre><code>struct Param { Param(const void* a, const std::vector&lt;int&gt;&amp; b) : c(a), d(b) {} const void* c; const std::vector&lt;int&gt; d; }; </code></pre> <p>Now after creating a new instance of Param struct I store a class instance 'this' pointer in the member variable c. Later in a C Api (within C++ code) I need to refer back to the class pointer to invoke a method:</p> <pre><code>static_cast&lt;ClassA*&gt;(static_cast&lt;Param*&gt;(var-&gt;addr)-&gt;c)-&gt;ClassAMethod() </code></pre> <p>But the compiler states invalid expression type conversion. How can I refer to both Param structure variables in C Apis if the address of Param instance is stored in 'addr' variable?</p>
0debug
I m looking for a REGEX to split a response with & as part of the value : <p>So I get a response as pairs of keys and values sum=199&amp;name=arik&amp;business=<strong>arik &amp; sons</strong>&amp;address=xyz</p> <p>I m looking for a REGEX that will be able to split the keys and values</p> <p>giving the following guidelines 1. first pair doesn't have the &amp; 2. it could have &amp; inside some of the values</p> <p>Thank you</p>
0debug
How to implement view always visible and fixed in MainActivity above fragments? : How to implement view always visible and fixed in MainActivity above fragments? I also need it when the fragment is replaced, not only when add fragment. Thank u! Dave
0debug
rgb16_32ToUV_half_c_template(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width, enum PixelFormat origin, int shr, int shg, int shb, int shp, int maskr, int maskg, int maskb, int rsh, int gsh, int bsh, int S) { const int ru = RU << rsh, gu = GU << gsh, bu = BU << bsh, rv = RV << rsh, gv = GV << gsh, bv = BV << bsh, rnd = 257 << S, maskgx = ~(maskr | maskb); int i; maskr |= maskr << 1; maskb |= maskb << 1; maskg |= maskg << 1; for (i = 0; i < width; i++) { int px0 = input_pixel(2 * i + 0) >> shp; int px1 = input_pixel(2 * i + 1) >> shp; int b, r, g = (px0 & maskgx) + (px1 & maskgx); int rb = px0 + px1 - g; b = (rb & maskb) >> shb; if (shp || origin == PIX_FMT_BGR565LE || origin == PIX_FMT_BGR565BE || origin == PIX_FMT_RGB565LE || origin == PIX_FMT_RGB565BE) { g >>= shg; } else { g = (g & maskg) >> shg; } r = (rb & maskr) >> shr; dstU[i] = (ru * r + gu * g + bu * b + rnd) >> (S + 1); dstV[i] = (rv * r + gv * g + bv * b + rnd) >> (S + 1); } }
1threat
How to add custom product_meta fields i.e Brand, GTIN, MPN? : <p>I'm looking to add custom product meta to display on single products, basket and checkout. Fields being Brand, GTIN, MPN, Platform, Region and possibly room for Publisher and Developer. I'm unsure if YOAST SEO will submit this information to my sitemap? Also, it would be helpful if I had a way of using such code to use for future additions i.e Genre and Release Date. WooCommerce only offers SKU, Category and Tags as product_meta as default.</p> <p>Any help big or small is valued. Thank you.</p> <p><a href="https://i.stack.imgur.com/xtZyH.png" rel="nofollow noreferrer">screenshot</a></p>
0debug
About inheritance of java : <p>/** * Created by zhangzhongzheng on 2016/10/15. */</p> <p>public class ExtendsTest {</p> <pre><code>static Dog d = new Dog(); public static void main(String[] args) { Animal a = d; System.out.println(a instanceof Animal);//true System.out.println(a instanceof Dog);//true System.out.println(d instanceof Animal);//true System.out.println(d instanceof Dog);//true } static class Animal { } static class Dog extends Animal { } </code></pre> <p>}</p> <p>why all true??????</p>
0debug
InputEvent *qemu_input_event_new_move(InputEventKind kind, InputAxis axis, int value) { InputEvent *evt = g_new0(InputEvent, 1); InputMoveEvent *move = g_new0(InputMoveEvent, 1); evt->type = kind; evt->u.rel = move; move->axis = axis; move->value = value; return evt; }
1threat
static void exec_accept_incoming_migration(void *opaque) { QEMUFile *f = opaque; int ret; ret = qemu_loadvm_state(f); if (ret < 0) { fprintf(stderr, "load of migration failed\n"); goto err; } qemu_announce_self(); DPRINTF("successfully loaded vm state\n"); qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL); if (autostart) vm_start(); err: qemu_fclose(f); }
1threat
void slirp_init(int restricted, struct in_addr vnetwork, struct in_addr vnetmask, struct in_addr vhost, const char *vhostname, const char *tftp_path, const char *bootfile, struct in_addr vdhcp_start, struct in_addr vnameserver) { #ifdef _WIN32 WSADATA Data; WSAStartup(MAKEWORD(2,0), &Data); atexit(slirp_cleanup); #endif link_up = 1; slirp_restrict = restricted; if_init(); ip_init(); m_init(); inet_aton("127.0.0.1", &loopback_addr); if (get_dns_addr(&dns_addr) < 0) { dns_addr = loopback_addr; fprintf (stderr, "Warning: No DNS servers found\n"); } vnetwork_addr = vnetwork; vnetwork_mask = vnetmask; vhost_addr = vhost; if (vhostname) { pstrcpy(slirp_hostname, sizeof(slirp_hostname), vhostname); } qemu_free(tftp_prefix); tftp_prefix = NULL; if (tftp_path) { tftp_prefix = qemu_strdup(tftp_path); } qemu_free(bootp_filename); bootp_filename = NULL; if (bootfile) { bootp_filename = qemu_strdup(bootfile); } vdhcp_startaddr = vdhcp_start; vnameserver_addr = vnameserver; getouraddr(); register_savevm("slirp", 0, 1, slirp_state_save, slirp_state_load, NULL); }
1threat
DVMuxContext* dv_init_mux(AVFormatContext* s) { DVMuxContext *c; AVStream *vst = NULL; int i; if (s->nb_streams > 3) return NULL; c = av_mallocz(sizeof(DVMuxContext)); if (!c) return NULL; c->n_ast = 0; c->ast[0] = c->ast[1] = NULL; for (i=0; i<s->nb_streams; i++) { switch (s->streams[i]->codec->codec_type) { case CODEC_TYPE_VIDEO: vst = s->streams[i]; break; case CODEC_TYPE_AUDIO: c->ast[c->n_ast++] = s->streams[i]; break; default: goto bail_out; } } if (!vst || vst->codec->codec_id != CODEC_ID_DVVIDEO) goto bail_out; for (i=0; i<c->n_ast; i++) { if (c->ast[i] && (c->ast[i]->codec->codec_id != CODEC_ID_PCM_S16LE || c->ast[i]->codec->sample_rate != 48000 || c->ast[i]->codec->channels != 2)) goto bail_out; } c->sys = dv_codec_profile(vst->codec); if (!c->sys) goto bail_out; if((c->n_ast > 1) && (c->sys->n_difchan < 2)) { goto bail_out; } c->frames = 0; c->has_audio = 0; c->has_video = 0; c->start_time = (time_t)s->timestamp; for (i=0; i<c->n_ast; i++) { if (c->ast[i] && av_fifo_init(&c->audio_data[i], 100*AVCODEC_MAX_AUDIO_FRAME_SIZE) < 0) { while (i>0) { i--; av_fifo_free(&c->audio_data[i]); } goto bail_out; } } return c; bail_out: av_free(c); return NULL; }
1threat
static void m5206_mbar_writel(void *opaque, target_phys_addr_t offset, uint32_t value) { m5206_mbar_state *s = (m5206_mbar_state *)opaque; int width; offset &= 0x3ff; if (offset > 0x200) { hw_error("Bad MBAR write offset 0x%x", (int)offset); } width = m5206_mbar_width[offset >> 2]; if (width < 4) { m5206_mbar_writew(opaque, offset, value >> 16); m5206_mbar_writew(opaque, offset + 2, value & 0xffff); return; } m5206_mbar_write(s, offset, value, 4); }
1threat
Kubectl run set nodeSelector : <p>Is there a way to specify the nodeSelector when using the Kubernetes run command? </p> <p>I don't have a yaml file and I only want to override the nodeSelector.</p> <p>I tried the following but didn't work:</p> <pre><code>kubectl run myservice --image myserviceimage:latest --overrides='{ "nodeSelector": { "beta.kubernetes.io/os": "windows" } }' </code></pre>
0debug
static void memory_map_init(void) { system_memory = qemu_malloc(sizeof(*system_memory)); memory_region_init(system_memory, "system", UINT64_MAX); set_system_memory_map(system_memory); }
1threat
static int qemu_rdma_broken_ipv6_kernel(Error **errp, struct ibv_context *verbs) { struct ibv_port_attr port_attr; #ifdef CONFIG_LINUX int num_devices, x; struct ibv_device ** dev_list = ibv_get_device_list(&num_devices); bool roce_found = false; bool ib_found = false; for (x = 0; x < num_devices; x++) { verbs = ibv_open_device(dev_list[x]); if (ibv_query_port(verbs, 1, &port_attr)) { ibv_close_device(verbs); ERROR(errp, "Could not query initial IB port"); if (port_attr.link_layer == IBV_LINK_LAYER_INFINIBAND) { ib_found = true; } else if (port_attr.link_layer == IBV_LINK_LAYER_ETHERNET) { roce_found = true; ibv_close_device(verbs); if (roce_found) { if (ib_found) { fprintf(stderr, "WARN: migrations may fail:" " IPv6 over RoCE / iWARP in linux" " is broken. But since you appear to have a" " mixed RoCE / IB environment, be sure to only" " migrate over the IB fabric until the kernel " " fixes the bug.\n"); ERROR(errp, "You only have RoCE / iWARP devices in your systems" " and your management software has specified '[::]'" ", but IPv6 over RoCE / iWARP is not supported in Linux."); return -ENONET; return 0; if (ibv_query_port(verbs, 1, &port_attr)) { ERROR(errp, "Could not query initial IB port"); if (port_attr.link_layer == IBV_LINK_LAYER_ETHERNET) { ERROR(errp, "Linux kernel's RoCE / iWARP does not support IPv6 " "(but patches on linux-rdma in progress)"); return -ENONET; #endif return 0;
1threat
why is this crashing ? how to fix? : well im doing a recycler view with a database on firebase . that is working perfectly... now i want to implement a share button but i cant make the button reference each img. i found a tutorial to do so but when i try to implement this line (if i remove it the apps goes well but doest reference to the button position) public BlogViewHolder(View itemView) { ... button = (Button)mView.findViewById(R.id.share); ... the app crashes when i open the activity im only using toast to testing. i relay apreciate replies pardon my english and pardon the post im new to android develop and its my 1time here on stack, regards import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.firebase.ui.database.FirebaseRecyclerAdapter; import com.google.android.gms.analytics.HitBuilders; import com.google.android.gms.analytics.Tracker; import com.google.firebase.database.ChildEventListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.squareup.picasso.Picasso; import java.util.ArrayList; public class NoticiasActivity extends AppCompatActivity { private RecyclerView mBlogList; FirebaseDatabase database; DatabaseReference myRef; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_noticias); //Recycler View mBlogList = (RecyclerView)findViewById(R.id.blog_list); mBlogList.setHasFixedSize(true); mBlogList.setLayoutManager(new LinearLayoutManager(this)); // Send a Query to the database database = FirebaseDatabase.getInstance(); myRef = database.getReference("Data"); } @Override protected void onStart() { super.onStart(); FirebaseRecyclerAdapter<ModelClass, BlogViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<ModelClass, BlogViewHolder>( ModelClass.class, R.layout.design_row, BlogViewHolder.class, myRef) { @Override protected void populateViewHolder(BlogViewHolder viewHolder, ModelClass model,int position) { viewHolder.setTitle(model.getTitle()); viewHolder.setImage(getApplicationContext(), model.getImage()); viewHolder.button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(view.getContext(), "esto es un boton"+ view.getNextFocusUpId(), Toast.LENGTH_SHORT).show(); } }); } }; mBlogList.setAdapter(firebaseRecyclerAdapter); } //View Holder For Recycler View public static class BlogViewHolder extends RecyclerView.ViewHolder { View mView; Button button ; public BlogViewHolder(View itemView) { super(itemView); button = (Button)mView.findViewById(R.id.share); mView= itemView; itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // click en la imagen hace algo //añadir luego Toast.makeText(v.getContext(), "hola", Toast.LENGTH_SHORT).show(); } }); } public void setTitle(String title){ TextView post_title = (TextView)mView.findViewById(R.id.titleText); post_title.setText(title); } public void setImage(Context ctx , String image){ ImageView post_image = (ImageView)mView.findViewById(R.id.imageViewy); // We Need TO pass Context Picasso.with(ctx).load(image).into(post_image); } }}
0debug
IF statement with multiple expressions : <p>I'm trying to construct IF statement with multiple conditions but I can't get echo 'TRUE' with this PHP code.</p> <pre><code>&lt;?php $totalDays = 4; $startDateL = 'Friday'; $endDateL = 'Monday'; $pickupTime = '12:00:00'; $returnTime = '9:00:00'; if($totalDays == 4 AND $pickupTime == '12:00:00' AND $returnTime == '09:00:00' AND $startDateL == 'Friday' AND $endDateL == 'Monday') { echo 'TRUE'; } ?&gt; </code></pre>
0debug
jQuery Horizontal Scrolling? : <p>I would like to show animation on the below to show the horizantal scroll is there. Which means i the scroll move left few second and right few second after page load completed</p>
0debug
how to get youtube comment : <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;iframe width="560" height="315" src="https://www.youtube.com/embed/xH7vTWir9uU" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;</code></pre> </div> </div> </p> <p>This is code to get youtube video to website. The Question how to get video complete with comment? Thanks</p>
0debug
Div with text around : <p>I'd like insert a div into another div, with text that goes around.</p> <p><a href="https://i.stack.imgur.com/fkbxO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fkbxO.jpg" alt="example"></a></p>
0debug
static int idcin_read_header(AVFormatContext *s) { AVIOContext *pb = s->pb; IdcinDemuxContext *idcin = s->priv_data; AVStream *st; unsigned int width, height; unsigned int sample_rate, bytes_per_sample, channels; width = avio_rl32(pb); height = avio_rl32(pb); sample_rate = avio_rl32(pb); bytes_per_sample = avio_rl32(pb); channels = avio_rl32(pb); st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); avpriv_set_pts_info(st, 33, 1, IDCIN_FPS); idcin->video_stream_index = st->index; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_IDCIN; st->codec->codec_tag = 0; st->codec->width = width; st->codec->height = height; st->codec->extradata_size = HUFFMAN_TABLE_SIZE; st->codec->extradata = av_malloc(HUFFMAN_TABLE_SIZE); if (avio_read(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) != HUFFMAN_TABLE_SIZE) return AVERROR(EIO); if (sample_rate) { idcin->audio_present = 1; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); avpriv_set_pts_info(st, 33, 1, IDCIN_FPS); idcin->audio_stream_index = st->index; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_tag = 1; st->codec->channels = channels; st->codec->sample_rate = sample_rate; st->codec->bits_per_coded_sample = bytes_per_sample * 8; st->codec->bit_rate = sample_rate * bytes_per_sample * 8 * channels; st->codec->block_align = bytes_per_sample * channels; if (bytes_per_sample == 1) st->codec->codec_id = AV_CODEC_ID_PCM_U8; else st->codec->codec_id = AV_CODEC_ID_PCM_S16LE; if (sample_rate % 14 != 0) { idcin->audio_chunk_size1 = (sample_rate / 14) * bytes_per_sample * channels; idcin->audio_chunk_size2 = (sample_rate / 14 + 1) * bytes_per_sample * channels; } else { idcin->audio_chunk_size1 = idcin->audio_chunk_size2 = (sample_rate / 14) * bytes_per_sample * channels; idcin->current_audio_chunk = 0; } else idcin->audio_present = 1; idcin->next_chunk_is_video = 1; idcin->pts = 0; return 0;
1threat
void ff_xvmc_init_block(MpegEncContext *s) { struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.f->data[2]; assert(render && render->xvmc_id == AV_XVMC_ID); s->block = (int16_t (*)[64])(render->data_blocks + render->next_free_data_block_num * 64); }
1threat
How do I use the SqlResource method in EF Migrations? : <p>MSDN says this method "Adds an operation to execute a SQL resource file". Its signature is:</p> <pre><code>protected internal void SqlResource( string sqlResource, Assembly resourceAssembly = null, bool suppressTransaction = false, object anonymousArguments = null ) </code></pre> <p>And the <code>sqlResource</code> parameter is described as <code>The manifest resource name of the SQL resource file to be executed.</code> Is a "SQL resource file" the same as a normal <code>.resx</code> resource file, and if so, it can contain many files, so how do I specify the name of the resource file, and the file within that resource, in this one parameter? Or is a "SQL resource file" a different type of file, that only contains one SQL script, and I just pass the name of that file for the <code>sqlResource</code> parameter?</p>
0debug
int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) { int pqindex, lowquant, status; if (v->finterpflag) v->interpfrm = get_bits1(gb); if (!v->s.avctx->codec) return -1; if (v->s.avctx->codec_id == AV_CODEC_ID_MSS2) v->respic = v->rangered = v->multires = get_bits(gb, 2) == 1; else skip_bits(gb, 2); v->rangeredfrm = 0; if (v->rangered) v->rangeredfrm = get_bits1(gb); v->s.pict_type = get_bits1(gb); if (v->s.avctx->max_b_frames) { if (!v->s.pict_type) { if (get_bits1(gb)) v->s.pict_type = AV_PICTURE_TYPE_I; else v->s.pict_type = AV_PICTURE_TYPE_B; } else v->s.pict_type = AV_PICTURE_TYPE_P; } else v->s.pict_type = v->s.pict_type ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; v->bi_type = 0; if (v->s.pict_type == AV_PICTURE_TYPE_B) { if (read_bfraction(v, gb) < 0) return AVERROR_INVALIDDATA; if (v->bfraction == 0) { v->s.pict_type = AV_PICTURE_TYPE_BI; } } if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI) skip_bits(gb, 7); if (v->parse_only) return 0; if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI) v->rnd = 1; if (v->s.pict_type == AV_PICTURE_TYPE_P) v->rnd ^= 1; pqindex = get_bits(gb, 5); if (!pqindex) return -1; if (v->quantizer_mode == QUANT_FRAME_IMPLICIT) v->pq = ff_vc1_pquant_table[0][pqindex]; else v->pq = ff_vc1_pquant_table[1][pqindex]; v->pquantizer = 1; if (v->quantizer_mode == QUANT_FRAME_IMPLICIT) v->pquantizer = pqindex < 9; if (v->quantizer_mode == QUANT_NON_UNIFORM) v->pquantizer = 0; v->pqindex = pqindex; if (pqindex < 9) v->halfpq = get_bits1(gb); else v->halfpq = 0; if (v->quantizer_mode == QUANT_FRAME_EXPLICIT) v->pquantizer = get_bits1(gb); v->dquantfrm = 0; if (v->extended_mv == 1) v->mvrange = get_unary(gb, 0, 3); v->k_x = v->mvrange + 9 + (v->mvrange >> 1); v->k_y = v->mvrange + 8; v->range_x = 1 << (v->k_x - 1); v->range_y = 1 << (v->k_y - 1); if (v->multires && v->s.pict_type != AV_PICTURE_TYPE_B) v->respic = get_bits(gb, 2); if (v->res_x8 && (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI)) { v->x8_type = get_bits1(gb); } else v->x8_type = 0; av_dlog(v->s.avctx, "%c Frame: QP=[%i]%i (+%i/2) %i\n", (v->s.pict_type == AV_PICTURE_TYPE_P) ? 'P' : ((v->s.pict_type == AV_PICTURE_TYPE_I) ? 'I' : 'B'), pqindex, v->pq, v->halfpq, v->rangeredfrm); if (v->first_pic_header_flag) rotate_luts(v); switch (v->s.pict_type) { case AV_PICTURE_TYPE_P: if (v->pq < 5) v->tt_index = 0; else if (v->pq < 13) v->tt_index = 1; else v->tt_index = 2; lowquant = (v->pq > 12) ? 0 : 1; v->mv_mode = ff_vc1_mv_pmode_table[lowquant][get_unary(gb, 1, 4)]; if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][get_unary(gb, 1, 3)]; v->lumscale = get_bits(gb, 6); v->lumshift = get_bits(gb, 6); v->last_use_ic = 1; INIT_LUT(v->lumscale, v->lumshift, v->last_luty[0], v->last_lutuv[0], 1); INIT_LUT(v->lumscale, v->lumshift, v->last_luty[1], v->last_lutuv[1], 1); } v->qs_last = v->s.quarter_sample; if (v->mv_mode == MV_PMODE_1MV_HPEL || v->mv_mode == MV_PMODE_1MV_HPEL_BILIN) v->s.quarter_sample = 0; else if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { if (v->mv_mode2 == MV_PMODE_1MV_HPEL || v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN) v->s.quarter_sample = 0; else v->s.quarter_sample = 1; } else v->s.quarter_sample = 1; v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || (v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN)); if ((v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_MIXED_MV) || v->mv_mode == MV_PMODE_MIXED_MV) { status = bitplane_decoding(v->mv_type_mb_plane, &v->mv_type_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); } else { v->mv_type_is_raw = 0; memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height); } status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); v->s.mv_table_index = get_bits(gb, 2); v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)]; if (v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(v); } v->ttfrm = 0; if (v->vstransform) { v->ttmbf = get_bits1(gb); if (v->ttmbf) { v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)]; } } else { v->ttmbf = 1; v->ttfrm = TT_8X8; } break; case AV_PICTURE_TYPE_B: if (v->pq < 5) v->tt_index = 0; else if (v->pq < 13) v->tt_index = 1; else v->tt_index = 2; v->mv_mode = get_bits1(gb) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN; v->qs_last = v->s.quarter_sample; v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV); v->s.mspel = v->s.quarter_sample; status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); v->s.mv_table_index = get_bits(gb, 2); v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)]; if (v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(v); } v->ttfrm = 0; if (v->vstransform) { v->ttmbf = get_bits1(gb); if (v->ttmbf) { v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)]; } } else { v->ttmbf = 1; v->ttfrm = TT_8X8; } break; } if (!v->x8_type) { v->c_ac_table_index = decode012(gb); if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI) { v->y_ac_table_index = decode012(gb); } v->s.dc_table_index = get_bits1(gb); } if (v->s.pict_type == AV_PICTURE_TYPE_BI) { v->s.pict_type = AV_PICTURE_TYPE_B; v->bi_type = 1; } return 0; }
1threat
document.location = 'http://evil.com?username=' + user_input;
1threat
Bootstrap 4 IE 11 does not work : <p>so I have the problem, that my whole website does not work in IE 11. I don't get why because officially IE 11 should be supported by bootstrap 4... Website: www.ergotherapie-klinkicht.de I'm a bit helpless right now, because I don't know where to start. Did I miss something for IE 11 to inlcude in my code?</p> <p>In Firefox, , Edge, Chrome and Safari it works just fine...</p> <p>Because right now, I have the feeling that bootstrap 4 is not compatible for IE 11 at all...</p> <p>Thanks for any reply!</p> <p>this is my navbar for example, it is not visible in IE 11:</p> <pre><code>#logonav { height: 40px; width: auto; } /* change the link color */ .navbar-custom .navbar-nav .nav-link { color: #2E8B57; } /* change the color of active or hovered links */ .navbar-custom .nav-item .nav-link .active, .navbar-custom .nav-item:hover .nav-link { color: orangered; } /* change the brand and text color */ .navbar-custom .navbar-brand, .navbar-custom .navbar-text { color: #2E8B57; } .custom-toggler.navbar-toggler { border-color: rgb(46,139,87); } .custom-toggler .navbar-toggler-icon { background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(46, 139, 87, 1)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E%3C/svg%3E"); } &lt;!DOCTYPE html&gt; &lt;html lang="de"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;!-- IE Edge Meta Tag --&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt; &lt;!-- Viewport --&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;meta http-equiv="x-ua-compatible" content="ie=edge"&gt; &lt;!-- Minified CSS --&gt; &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous"&gt; &lt;link rel="stylesheet" href="ergo.css"&gt; &lt;title&gt;Bettina Klinkicht Ergotherapeutische Praxis Bonn&lt;/title&gt; &lt;link rel="shortcut icon" type="image/x-icon" class="img-circle" href="logopur.png"&gt; &lt;!-- Global Site Tag (gtag.js) - Google Analytics --&gt; &lt;script async src="https://www.googletagmanager.com/gtag/js?id=UA-107069424-1"&gt;&lt;/script&gt; &lt;script&gt; window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments) }; gtag('js', new Date()); gtag('config', 'UA-107069424-1'); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;nav class="navbar navbar-inverse fixed-top transparent navbar-toggleable-sm navbar-custom"&gt; &lt;div class="navbar-inner"&gt; &lt;!-- Brand and toggle grouped for better mobile display --&gt; &lt;button class="navbar-toggler navbar-toggler-right custom-toggler" type="button" data-toggle="collapse" data-target="#navmobile" aria-controls="navmobile" aria-expanded="false" aria-label="Toggle Navigation"&gt; &lt;span class="navbar-toggler-icon"&gt;&lt;/span&gt; &lt;/button&gt; &lt;a href="home.html" class="navbar-brand"&gt;&lt;img src="logopur_neu.png" alt="Logo" id="logonav"&gt;&lt;/a&gt; &lt;/div&gt; &lt;!-- Collect nav-links for toggling--&gt; &lt;div class="collapse navbar-collapse" id="navmobile"&gt; &lt;div class="navbar-nav ml-auto"&gt; &lt;a class="nav-item nav-link active" href="#"&gt;Home&lt;/a&gt; &lt;a class="nav-item nav-link" href="Therapeutin.html"&gt;Über mich&lt;/a&gt; &lt;div class="dropdown"&gt; &lt;a class="nav-item nav-link dropdown-toggle" href="#" data-toggle="dropdown" id="servicesDropdown" aria-haspopup="true" aria-expanded="false"&gt;Angebot&lt;/a&gt; &lt;div class="dropdown-menu" aria-labelledby="servicesDropdown"&gt; &lt;a class="dropdown-item" href="Geriatrie.html"&gt;Geriatrie&lt;/a&gt; &lt;a class="dropdown-item" href="Neurologie.html"&gt;Neurologie&lt;/a&gt; &lt;a class="dropdown-item" href="Spiegeltherapie.html"&gt;Spiegeltherapie&lt;/a&gt; &lt;a class="dropdown-item" href="Schwindeltherapie.html"&gt;Schwindeltherapie&lt;/a&gt; &lt;a class="dropdown-item" href="Biographiearbeit.html"&gt;Biographiearbeit&lt;/a&gt; &lt;a class="dropdown-item" href="Brain_Gym.html"&gt;Brain Gym&lt;/a&gt; &lt;a class="dropdown-item" href="Sensibilitaetstraining.html"&gt;Sensibilitätstraining&lt;/a&gt; &lt;a class="dropdown-item" href="Gleichgewichtstraining.html"&gt;Gleichgewichtstraining&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;a class="nav-item nav-link" href="Kontakt.html"&gt;Kontakt&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/nav&gt; &lt;script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"&gt;&lt;/script&gt; &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"&gt;&lt;/script&gt; &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"&gt;&lt;/script&gt; &lt;script src="ergo.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
0debug
AOF and RDB backups in redis : <p>This question is about Redis persistence. </p> <p>I'm using redis as a 'fast backend' for a social networking website. It's a single server set up. I've been transferring PostgreSQL responsibilities to Redis steadily. Currently in <code>etc/redis/redis.conf</code>, the appendonly setting is set to <code>appendonly no</code>. Snapshotting settings are <code>save 900 1</code>, <code>save 300 10</code>, <code>save 60 10000</code>. All this is true for production and development both. As per production logs, <code>save 60 10000</code> gets invoked heavily. Does this mean that practically, I'm getting backups every 60 seconds?</p> <p>Some literature suggests using AOF and RDB backups together. Thus I was weighing in on turning <code>appendonly on</code> and using <code>appendfsync everysec</code>. For anyone who has had experience of both sides of the coin:</p> <p>1) Will using <code>appendonly on</code> and <code>appendfsync everysec</code> cause a performance downgrade? Will it hit the CPU? The write load is on the high side.</p> <p>2) Once I restart the redis server with these new settings, I'll still lose the last 60 secs of my data, correct? </p> <p>3) Are restart times something to worry about? My <code>dump.rdb</code> file is small; ~90MB.</p> <p>I'm trying to find out more about redis persistence, and getting my expectations right. Personally, I'm fine with losing 60s of data in the case of a catastrophe, thus whether I should use AOF is also something I'm pondering. Feel free to chime in. Thanks!</p>
0debug
void co_run_in_worker_bh(void *opaque) { Coroutine *co = opaque; thread_pool_submit_aio(aio_get_thread_pool(qemu_get_aio_context()), coroutine_enter_func, co, coroutine_enter_cb, co); }
1threat
Incremental Numbering with PHP : <p>I have a website where I mention how long the company has been in business (53 years currently). I would like this number to automatically update each year. Is this possible with PHP?</p>
0debug
How to create per workspace snippets in VSCode? : <p>I would like to add some project specific snippets.</p> <p>How can I add snippets in the <code>.vscode</code> folder?</p>
0debug
int bdrv_truncate(BlockDriverState *bs, int64_t offset) { BlockDriver *drv = bs->drv; int ret; if (!drv) return -ENOMEDIUM; if (!drv->bdrv_truncate) return -ENOTSUP; if (bs->read_only) return -EACCES; ret = drv->bdrv_truncate(bs, offset); if (ret == 0) { ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS); bdrv_dirty_bitmap_truncate(bs); if (bs->blk) { blk_dev_resize_cb(bs->blk); } } return ret; }
1threat
Create object from array : <p>I want to create object from list of array. I have an array which is dynamic which suppose to be look like this:</p> <p><code>var dynamicArray = ["2007", "2008", "2009", "2010"];</code></p> <p>and with some javascript es6 I want to make an object like this:</p> <pre><code>const obj = { 2007: { x: width / 5, y: height / 2 }, 2008: { x: (2 / 5) * width, y: height / 2 }, 2009: { x: (3 / 5) * width, y: height / 2 }, 2010: { x: (4 / 5) * width, y: height / 2 } } </code></pre> <p>don't worry about inner objects but just wanted to a make structure like this:</p> <pre><code> obj = { 2007: ..., 2008: ..., ... } </code></pre> <p>Please help, Thanks.</p>
0debug