problem
stringlengths
26
131k
labels
class label
2 classes
Why does proposed `std::shared_ptr::operator[]` take `std::ptrdiff_t` as an argument : <p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4562.html#memory.smartptr.shared.obs">According to the N4562 proposal, the newly proposed <code>std::shared_ptr::operator[]</code> takes in <code>std::ptrdiff_t</code>, which is a signed type</a>.</p> <p>This is inconsistent with every indexing operator in standard library. Even <code>std::unique_ptr::operator[]</code> takes <code>std::size_t</code>.</p> <p>What's the rationale for this decision?</p>
0debug
static void device_finalize(Object *obj) { NamedGPIOList *ngl, *next; DeviceState *dev = DEVICE(obj); qemu_opts_del(dev->opts); QLIST_FOREACH_SAFE(ngl, &dev->gpios, node, next) { QLIST_REMOVE(ngl, node); qemu_free_irqs(ngl->in, ngl->num_in); g_free(ngl->name); g_free(ngl); } }
1threat
aws efs connection timeout at mount : <p>I am following <a href="https://docs.aws.amazon.com/efs/latest/ug/getting-started.html" rel="noreferrer">this</a> tutorial to mount efs on AWS EC2 instance but when Iam executing the mount command </p> <pre><code>sudo mount -t nfs4 -o vers=4.1 $(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone).[EFS-ID].efs.[region].amazonaws.com:/ efs </code></pre> <p>I am getting connection time out every time.</p> <pre><code>mount.nfs4: Connection timed out </code></pre> <p>What may be the problem here?</p> <p>Thanks in advance!</p>
0debug
Print specific keys and values from a deep nested dictionary in python 3.X : <p>I am new to python and I've tried to search but can seem to find a sample of what I am trying to accomplish. Any ideas are much appreciated. I am working with a nested dictionary with lots of key and values but I only want to print specific ones using a filtered list variable.</p> <pre><code>my_nested_dict = {"global": {"peers": {"15.1.1.1": {"remote_id": "15.1.1.1", "address_family": {"ipv4": {"sent_prefixes": 1, "received_prefixes": 4, "accepted_prefixes": 4}}, "remote_as": 65002, "uptime": 13002, "is_enabled": true, "is_up": true, "description": "== R3 BGP Neighbor ==", "local_as": 65002}}, "router_id": "15.1.1.2"}} </code></pre> <p>I would like to a filter through it and choose which keys and values to print out</p> <pre><code>filtered_list = ['peers', 'remote_id', 'remote_as', 'uptime'] </code></pre> <p>and achieve a out out of </p> <pre><code>peers: 15.1.1.1 remote_id: 15.1.1.1 remote_as: 65002 uptime: 13002 </code></pre>
0debug
asp.net core defaultProxy : <p>In net 4.5 we are working with proxy like this:</p> <pre><code>&lt;system.net&gt; &lt;!-- --&gt; &lt;defaultProxy enabled="true" useDefaultCredentials="false"&gt; &lt;proxy usesystemdefault="True" proxyaddress="http://192.168.1.1:8888" bypassonlocal="True" autoDetect="False" /&gt; &lt;module type="CommonLibrary.Proxy.MyProxy, CommonLibrary, Version=1.0.0.0, Culture=neutral" /&gt; &lt;/defaultProxy&gt; &lt;settings&gt; &lt;httpWebRequest useUnsafeHeaderParsing="true" /&gt; &lt;servicePointManager expect100Continue="false" /&gt; &lt;/settings&gt; &lt;/system.net&gt; </code></pre> <p>but in asp.net core or test we can't found a solution like the above Could someone please help me?</p> <p>I really appreciate your help</p> <p>Thanks, Regards</p>
0debug
How to get rid of duplicate class errors in Intellij for a Mavenized project using Lombok : <p>I have a Maven managed Lombok project and I use Intellij. After building, I always get lots of errors in Intellij about duplicate classes because of the generated sources in target/generated-sources/delombok. Is there something I can do to git rid of these errors? Right now I just delete the target folder, but this is really irritating to have to do.</p> <p>I have the standard configuration in Maven and the lombok source code in is in main/src/lombok:</p> <pre><code> &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;3.5.1&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;1.8&lt;/source&gt; &lt;target&gt;1.8&lt;/target&gt; &lt;encoding&gt;UTF-8&lt;/encoding&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;groupId&gt;org.projectlombok&lt;/groupId&gt; &lt;artifactId&gt;lombok-maven-plugin&lt;/artifactId&gt; &lt;version&gt;1.16.8.0&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;phase&gt;generate-sources&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;delombok&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;profiles&gt; &lt;profile&gt; &lt;id&gt;lombok-needs-tools-jar&lt;/id&gt; &lt;activation&gt; &lt;file&gt; &lt;exists&gt;${java.home}/../lib/tools.jar&lt;/exists&gt; &lt;/file&gt; &lt;/activation&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.projectlombok&lt;/groupId&gt; &lt;artifactId&gt;lombok-maven-plugin&lt;/artifactId&gt; &lt;version&gt;1.16.8.0&lt;/version&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;sun.jdk&lt;/groupId&gt; &lt;artifactId&gt;tools&lt;/artifactId&gt; &lt;version&gt;1.8&lt;/version&gt; &lt;scope&gt;system&lt;/scope&gt; &lt;systemPath&gt;${java.home}/../lib/tools.jar&lt;/systemPath&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/profile&gt; &lt;/profiles&gt; </code></pre>
0debug
how to create a first vue js project : <p>I just started with vue.js. I created a simple project but it is not working.Please check what is wrong in the above code. I totally new to this I don't know what I have made mistake in this.</p> <p>thank you </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt; &lt;meta http-equiv="X-UA-Compatible" content="ie=edge"&gt; &lt;title&gt;Document&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="root"&gt; &lt;input type="text" v-model="name"&gt; &lt;p&gt;Hi my name is: {{ name }}&lt;/p&gt; &lt;/div&gt; &lt;script src="https://unpkg.com/vue@2.6.10/dist/vue.js"&gt;&lt;/script&gt; &lt;script&gt; new vue({ el: '#root', data: { name: 'Matheen' } }); &lt;/script&gt; </code></pre> <p> </p>
0debug
placing SQL order by (simple) : <p>I'm trying to order the following results on reference. Using Order by and desc limit 100. Can someone help me where to place it. </p> <pre><code>$stm = $pdo-&gt;prepare("SELECT `reference`, SUM( `stockdifference` ) AS 'stockdifference' FROM `results1` WHERE `datum` BETWEEN '".$oldDate."' AND '".$newDate."' AND `reference` = '".$stm[0]."'"); </code></pre>
0debug
static int pci_apb_map_irq(PCIDevice *pci_dev, int irq_num) { return ((pci_dev->devfn & 0x18) >> 1) + irq_num; }
1threat
static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_t size) { int fill_char = 0x00; if (sample_fmt == AV_SAMPLE_FMT_U8) fill_char = 0x80; memset(buf, fill_char, size); }
1threat
Why getting class in Kotlin using double-colon (::)? : <p>We know that double-colon (<code>::</code>) is used to get function (callable) reference in Kotlin, e.g. <code>String::compareTo</code>, <code>"string"::compareTo</code>. </p> <p>In Java we use <code>SomeClass.class</code> and <code>someInstance.getClass()</code> to get the class. Why in Kotlin we use <code>SomeClass::class</code> and <code>someInstance::class</code> while <code>class</code> is not a function/method?</p> <pre><code>println(String::compareTo) // output: fun kotlin.String.compareTo(kotlin.String): kotlin.Int println("string".compareTo("strong")) // output: -6 println(String::class) // output: class kotlin.String println("string".class) // compile error </code></pre>
0debug
static int aiff_read_packet(AVFormatContext *s, AVPacket *pkt) { AVStream *st = s->streams[0]; AIFFInputContext *aiff = s->priv_data; int64_t max_size; int res, size; max_size = aiff->data_end - avio_tell(s->pb); if (max_size <= 0) return AVERROR_EOF; if (st->codec->block_align >= 17) size = st->codec->block_align; else size = (MAX_SIZE / st->codec->block_align) * st->codec->block_align; size = FFMIN(max_size, size); res = av_get_packet(s->pb, pkt, size); if (res < 0) return res; if (size >= st->codec->block_align) pkt->flags &= ~AV_PKT_FLAG_CORRUPT; pkt->stream_index = 0; pkt->duration = (res / st->codec->block_align) * aiff->block_duration; return 0; }
1threat
How to convert Monthly data from rows to columns using Oracle statement : Source [enter image description here][1] Desired output [enter image description here][2] [1]: https://i.stack.imgur.com/h4DZB.png [2]: https://i.stack.imgur.com/MIFUx.png
0debug
static void do_subtitle_out(AVFormatContext *s, OutputStream *ost, InputStream *ist, AVSubtitle *sub, int64_t pts) { int subtitle_out_max_size = 1024 * 1024; int subtitle_out_size, nb, i; AVCodecContext *enc; AVPacket pkt; if (pts == AV_NOPTS_VALUE) { av_log(NULL, AV_LOG_ERROR, "Subtitle packets must have a pts\n"); if (exit_on_error) exit_program(1); return; } enc = ost->st->codec; if (!subtitle_out) { subtitle_out = av_malloc(subtitle_out_max_size); } if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) nb = 2; else nb = 1; for (i = 0; i < nb; i++) { ost->sync_opts = av_rescale_q(pts, ist->st->time_base, enc->time_base); if (!check_recording_time(ost)) return; sub->pts = av_rescale_q(pts, ist->st->time_base, AV_TIME_BASE_Q); sub->pts += av_rescale_q(sub->start_display_time, (AVRational){ 1, 1000 }, AV_TIME_BASE_Q); sub->end_display_time -= sub->start_display_time; sub->start_display_time = 0; subtitle_out_size = avcodec_encode_subtitle(enc, subtitle_out, subtitle_out_max_size, sub); if (subtitle_out_size < 0) { av_log(NULL, AV_LOG_FATAL, "Subtitle encoding failed\n"); exit_program(1); } av_init_packet(&pkt); pkt.data = subtitle_out; pkt.size = subtitle_out_size; pkt.pts = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ost->st->time_base); pkt.duration = av_rescale_q(sub->end_display_time, (AVRational){ 1, 1000 }, ost->st->time_base); if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) { if (i == 0) pkt.pts += 90 * sub->start_display_time; else pkt.pts += 90 * sub->end_display_time; } write_frame(s, &pkt, ost); subtitle_size += pkt.size; } }
1threat
static void register_subpage(MemoryRegionSection *section) { subpage_t *subpage; target_phys_addr_t base = section->offset_within_address_space & TARGET_PAGE_MASK; MemoryRegionSection *existing = phys_page_find(base >> TARGET_PAGE_BITS); MemoryRegionSection subsection = { .offset_within_address_space = base, .size = TARGET_PAGE_SIZE, }; target_phys_addr_t start, end; assert(existing->mr->subpage || existing->mr == &io_mem_unassigned); if (!(existing->mr->subpage)) { subpage = subpage_init(base); subsection.mr = &subpage->iomem; phys_page_set(base >> TARGET_PAGE_BITS, 1, phys_section_add(&subsection)); } else { subpage = container_of(existing->mr, subpage_t, iomem); } start = section->offset_within_address_space & ~TARGET_PAGE_MASK; end = start + section->size - 1; subpage_register(subpage, start, end, phys_section_add(section)); }
1threat
How do I list all remote refs? : <p>Recently I created a <a href="https://github.com/SocialiteProviders/Manager/pull/81" rel="noreferrer">PR</a> on GitHub, but some tests were failing. And locally even more tests didn't pass. So I tried to figure out what's the issue.</p> <p>And the thing I found out is that Travis was testing the repo being at <a href="https://travis-ci.org/SocialiteProviders/Manager/builds/199836015" rel="noreferrer">other commit</a> I don't have. The ref is refs/pull/81/merge. So, somebody supposedly merged my branch into the master and created corresponding ref. Was it GitHub or Travis?</p> <p>And the other question, can I list all the refs GitHub repo has?</p>
0debug
Different audio by language : <p>Different audio by language.</p> <p>Hello, I wonder if it is possible to use different audio tracks according to the user's language, similar to strings.xml but for sound files.</p>
0debug
static int avisynth_read_header(AVFormatContext *s) { AVISynthContext *avs = s->priv_data; HRESULT res; AVIFILEINFO info; DWORD id; AVStream *st; AVISynthStream *stream; wchar_t filename_wchar[1024] = { 0 }; char filename_char[1024] = { 0 }; AVIFileInit(); MultiByteToWideChar(CP_UTF8, 0, s->filename, -1, filename_wchar, 1024); WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wchar, -1, filename_char, 1024, NULL, NULL); res = AVIFileOpen(&avs->file, filename_char, OF_READ|OF_SHARE_DENY_WRITE, NULL); if (res != S_OK) { av_log(s, AV_LOG_ERROR, "AVIFileOpen failed with error %ld", res); AVIFileExit(); return -1; } res = AVIFileInfo(avs->file, &info, sizeof(info)); if (res != S_OK) { av_log(s, AV_LOG_ERROR, "AVIFileInfo failed with error %ld", res); AVIFileExit(); return -1; } avs->streams = av_mallocz(info.dwStreams * sizeof(AVISynthStream)); for (id=0; id<info.dwStreams; id++) { stream = &avs->streams[id]; stream->read = 0; if (AVIFileGetStream(avs->file, &stream->handle, 0, id) == S_OK) { if (AVIStreamInfo(stream->handle, &stream->info, sizeof(stream->info)) == S_OK) { if (stream->info.fccType == streamtypeAUDIO) { WAVEFORMATEX wvfmt; LONG struct_size = sizeof(WAVEFORMATEX); if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK) continue; st = avformat_new_stream(s, NULL); st->id = id; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->block_align = wvfmt.nBlockAlign; st->codec->channels = wvfmt.nChannels; st->codec->sample_rate = wvfmt.nSamplesPerSec; st->codec->bit_rate = wvfmt.nAvgBytesPerSec * 8; st->codec->bits_per_coded_sample = wvfmt.wBitsPerSample; stream->chunck_samples = wvfmt.nSamplesPerSec * (uint64_t)info.dwScale / (uint64_t)info.dwRate; stream->chunck_size = stream->chunck_samples * wvfmt.nChannels * wvfmt.wBitsPerSample / 8; st->codec->codec_tag = wvfmt.wFormatTag; st->codec->codec_id = ff_wav_codec_get_id(wvfmt.wFormatTag, st->codec->bits_per_coded_sample); } else if (stream->info.fccType == streamtypeVIDEO) { BITMAPINFO imgfmt; LONG struct_size = sizeof(BITMAPINFO); stream->chunck_size = stream->info.dwSampleSize; stream->chunck_samples = 1; if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK) continue; st = avformat_new_stream(s, NULL); st->id = id; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->r_frame_rate.num = stream->info.dwRate; st->r_frame_rate.den = stream->info.dwScale; st->codec->width = imgfmt.bmiHeader.biWidth; st->codec->height = imgfmt.bmiHeader.biHeight; st->codec->bits_per_coded_sample = imgfmt.bmiHeader.biBitCount; st->codec->bit_rate = (uint64_t)stream->info.dwSampleSize * (uint64_t)stream->info.dwRate * 8 / (uint64_t)stream->info.dwScale; st->codec->codec_tag = imgfmt.bmiHeader.biCompression; st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, imgfmt.bmiHeader.biCompression); st->duration = stream->info.dwLength; } else { AVIStreamRelease(stream->handle); continue; } avs->nb_streams++; st->codec->stream_codec_tag = stream->info.fccHandler; avpriv_set_pts_info(st, 64, info.dwScale, info.dwRate); st->start_time = stream->info.dwStart; } } } return 0; }
1threat
static void acpi_table_install(const char unsigned *blob, size_t bloblen, bool has_header, const struct AcpiTableOptions *hdrs, Error **errp) { size_t body_start; const char unsigned *hdr_src; size_t body_size, acpi_payload_size; struct acpi_table_header *ext_hdr; unsigned changed_fields; if (has_header) { body_start = sizeof dfl_hdr; if (bloblen < body_start) { error_setg(errp, "ACPI table claiming to have header is too " "short, available: %zu, expected: %zu", bloblen, body_start); return; } hdr_src = blob; } else { body_start = 0; hdr_src = dfl_hdr; } body_size = bloblen - body_start; acpi_payload_size = sizeof dfl_hdr + body_size; if (acpi_payload_size > UINT16_MAX) { error_setg(errp, "ACPI table too big, requested: %zu, max: %u", acpi_payload_size, (unsigned)UINT16_MAX); return; } if (acpi_tables == NULL) { acpi_tables_len = sizeof(uint16_t); acpi_tables = g_malloc0(acpi_tables_len); } acpi_tables = g_realloc(acpi_tables, acpi_tables_len + ACPI_TABLE_PFX_SIZE + sizeof dfl_hdr + body_size); ext_hdr = (struct acpi_table_header *)(acpi_tables + acpi_tables_len); acpi_tables_len += ACPI_TABLE_PFX_SIZE; memcpy(acpi_tables + acpi_tables_len, hdr_src, sizeof dfl_hdr); acpi_tables_len += sizeof dfl_hdr; if (blob != NULL) { memcpy(acpi_tables + acpi_tables_len, blob + body_start, body_size); acpi_tables_len += body_size; } stw_le_p(acpi_tables, lduw_le_p(acpi_tables) + 1u); changed_fields = 0; ext_hdr->_length = cpu_to_le16(acpi_payload_size); if (hdrs->has_sig) { strncpy(ext_hdr->sig, hdrs->sig, sizeof ext_hdr->sig); ++changed_fields; } if (has_header && le32_to_cpu(ext_hdr->length) != acpi_payload_size) { fprintf(stderr, "warning: ACPI table has wrong length, header says " "%" PRIu32 ", actual size %zu bytes\n", le32_to_cpu(ext_hdr->length), acpi_payload_size); } ext_hdr->length = cpu_to_le32(acpi_payload_size); if (hdrs->has_rev) { ext_hdr->revision = hdrs->rev; ++changed_fields; } ext_hdr->checksum = 0; if (hdrs->has_oem_id) { strncpy(ext_hdr->oem_id, hdrs->oem_id, sizeof ext_hdr->oem_id); ++changed_fields; } if (hdrs->has_oem_table_id) { strncpy(ext_hdr->oem_table_id, hdrs->oem_table_id, sizeof ext_hdr->oem_table_id); ++changed_fields; } if (hdrs->has_oem_rev) { ext_hdr->oem_revision = cpu_to_le32(hdrs->oem_rev); ++changed_fields; } if (hdrs->has_asl_compiler_id) { strncpy(ext_hdr->asl_compiler_id, hdrs->asl_compiler_id, sizeof ext_hdr->asl_compiler_id); ++changed_fields; } if (hdrs->has_asl_compiler_rev) { ext_hdr->asl_compiler_revision = cpu_to_le32(hdrs->asl_compiler_rev); ++changed_fields; } if (!has_header && changed_fields == 0) { warn_report("ACPI table: no headers are specified"); } ext_hdr->checksum = acpi_checksum((const char unsigned *)ext_hdr + ACPI_TABLE_PFX_SIZE, acpi_payload_size); }
1threat
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
How to get ABI (Application Binary Interface) in android : <p>It may be a duplicated question, but i'm unable to find it. I wonder how we can get what's the ABI of a phone, using code. I know that there's different Interface that may dictated in gradle file. But the problem is how i can get exactly the ABI of a certain device, so that i can manually copy it to system/lib/ folder using SuperSU. Thank you.</p> <pre><code>android.productFlavors { // for detailed abiFilter descriptions, refer to "Supported ABIs" @ // https://developer.android.com/ndk/guides/abis.html#sa create("arm") { ndk.abiFilters.add("armeabi") } create("arm7") { ndk.abiFilters.add("armeabi-v7a") } create("arm8") { ndk.abiFilters.add("arm64-v8a") } create("x86") { ndk.abiFilters.add("x86") } create("x86-64") { ndk.abiFilters.add("x86_64") } create("mips") { ndk.abiFilters.add("mips") } create("mips-64") { ndk.abiFilters.add("mips64") } // To include all cpu architectures, leaves abiFilters empty create("all") } </code></pre>
0debug
Continuously merge one char array into another char array : <p>I want to continuously merge <code>small_buf</code> into <code>big_buffer</code> while I receive the message in chunks. I do not how to do this.</p> <pre><code>char small_buf[100]; char big_buffer[2048]; ssize_t bytes_r = 0; while((bytes_r = recv(socket_fd,small_buf,sizeof(small_buf)-1,0)) &gt; 0) { small_buf[bytes_r] = '\0'; // now merge small_buf with big_buffer } </code></pre> <p><code>big_buffer</code> represents the big single message which was received as smaller chunks from <code>recv</code>. How could I merge all <code>small_buf</code> into <code>big_buffer</code>?</p>
0debug
static void network_to_register(RDMARegister *reg) { reg->key.current_addr = ntohll(reg->key.current_addr); reg->current_index = ntohl(reg->current_index); reg->chunks = ntohll(reg->chunks); }
1threat
static const char *vnc_auth_name(VncDisplay *vd) { switch (vd->auth) { case VNC_AUTH_INVALID: return "invalid"; case VNC_AUTH_NONE: return "none"; case VNC_AUTH_VNC: return "vnc"; case VNC_AUTH_RA2: return "ra2"; case VNC_AUTH_RA2NE: return "ra2ne"; case VNC_AUTH_TIGHT: return "tight"; case VNC_AUTH_ULTRA: return "ultra"; case VNC_AUTH_TLS: return "tls"; case VNC_AUTH_VENCRYPT: #ifdef CONFIG_VNC_TLS switch (vd->subauth) { case VNC_AUTH_VENCRYPT_PLAIN: return "vencrypt+plain"; case VNC_AUTH_VENCRYPT_TLSNONE: return "vencrypt+tls+none"; case VNC_AUTH_VENCRYPT_TLSVNC: return "vencrypt+tls+vnc"; case VNC_AUTH_VENCRYPT_TLSPLAIN: return "vencrypt+tls+plain"; case VNC_AUTH_VENCRYPT_X509NONE: return "vencrypt+x509+none"; case VNC_AUTH_VENCRYPT_X509VNC: return "vencrypt+x509+vnc"; case VNC_AUTH_VENCRYPT_X509PLAIN: return "vencrypt+x509+plain"; case VNC_AUTH_VENCRYPT_TLSSASL: return "vencrypt+tls+sasl"; case VNC_AUTH_VENCRYPT_X509SASL: return "vencrypt+x509+sasl"; default: return "vencrypt"; } #else return "vencrypt"; #endif case VNC_AUTH_SASL: return "sasl"; } return "unknown"; }
1threat
shell script: compile and execute a python via shell script : <p>I know how to program a python, but I have no idea about Unix, so how can I create two .sh files to compile and execute my python program. For example, my program named hello.py and I have two files named compile.sh and execute.sh, I want to invoke compile.sh then hello.py will be compiled, and invoke execute.sh then hello.py will be executed. Thanks!</p>
0debug
What system to use for auto login via URL : <p>I have limited skill with PHP and need to accomplish the discouraged/low security practice of passing credentials by URL-- which for my particular purpose is a perfectly good, relevant solution. </p> <p>I have an area of my site with trivial/non-sensitive content that, nevertheless, I want to have hidden and control access to. However, I want them to <strong>not need to log in</strong> nor deal with credentials. So I'm thinking the group's credentials are passed by URL to auto login any user, allowing them to navigate around that area of the site. This content isn't sensitive and these aren't user accounts/pws/data, but group ones I set up.</p> <p>I should be able to distribute links to any of the pages like <a href="http://example.com/home.php?&amp;username=GROUPNAME&amp;password=PW123" rel="nofollow">http://example.com/home.php?&amp;username=GROUPNAME&amp;password=PW123</a> and allow them to nav all of the protected pages without getting logged out.</p> <p><strong>More context</strong>: Offline a group would request an account for that area/those pages (a group account I create myself and later could delete/modify preventing access). I don't want people without a membership to have access to the content, and I'm not worried about the people sharing links outside of their group.</p> <p>Should I go with something like User Frosting/User Cake? Or will it be overkill and create challenges with passing the credentials with GET/POST? Not sure if this method doesn't work if passwords get encrypted.</p> <p>Or should a follow some low-security tutorial to set up a login system and another for using GET/POST to pass the credentials? </p>
0debug
Filepond : c# IFormFile is null : I using [filepond][1] for pretty input file, but I facing issue when submit form. Before using filepond, in `MyUpload` , the param `uploadedFile` are not null mean getting value. <form asp-route="MyUpload" method="post" enctype="multipart/form-data"> <input class="filepondinput" type="file" name="uploadedFile"/> </form> $(document).ready(function () { $('.filepondinput').filepond(); }); //C# Task<IActionResult> MyUpload(IFormFile uploadedFile){ } Below is the code i copy from devtools: **Before selected any file** it generate a new input call `filepond--browser` with the name `uploadedFile` <div class="filepond--root filepondinput filepond--hopper" data-style-button-remove-item-position="left" data-style-button-process-item-position="right" data-style-load-indicator-position="right" data-style-progress-indicator-position="right" style="height: 67px;"> <input class="filepond--browser" type="file" id="filepond--browser-qiu43sah3" name="uploadedFile" aria-controls="filepond--assistant-qiu43sah3" aria-labelledby="filepond--drop-label-qiu43sah3"> <div class="filepond--drop-label" style="transform: translate3d(0px, 0px, 0px); opacity: 1;"> <label for="filepond--browser-qiu43sah3" id="filepond--drop-label-qiu43sah3" aria-hidden="true">Drag &amp; Drop your files or <span class="filepond--label-action" tabindex="0">Browse</span></label> </div> <div class="filepond--list-scroller" style="transform: translate3d(0px, 0px, 0px);"> <ul class="filepond--list" role="list"></ul> </div> <div class="filepond--panel filepond--panel-root" data-scalable="true"> <div class="filepond--panel-top filepond--panel-root"></div> <div class="filepond--panel-center filepond--panel-root" style="transform: translate3d(0px, 7px, 0px) scale3d(1, 0.53, 1);"></div> <div class="filepond--panel-bottom filepond--panel-root" style="transform: translate3d(0px, 60px, 0px);"></div> </div><span class="filepond--assistant" id="filepond--assistant-qiu43sah3" role="status" aria-live="polite" aria-relevant="additions"></span> <div class="filepond--drip"></div> </div> **Below is after selected a file** `filepond--browser` name `uploadedFile` is gone, and a hidden input file with name `uploadedFile` appear <div class="filepond--root filepondinput filepond--hopper" data-style-button-remove-item-position="left" data-style-button-process-item-position="right" data-style-load-indicator-position="right" data-style-progress-indicator-position="right" style="height: 69px;"> <input class="filepond--browser" type="file" id="filepond--browser-qiu43sah3" aria-controls="filepond--assistant-qiu43sah3" aria-labelledby="filepond--drop-label-qiu43sah3"> <div class="filepond--drop-label" style="transform: translate3d(0px, 40px, 0px); opacity: 0; visibility: hidden; pointer-events: none;"> <label for="filepond--browser-qiu43sah3" id="filepond--drop-label-qiu43sah3" aria-hidden="true">Drag &amp; Drop your files or <span class="filepond--label-action" tabindex="0">Browse</span></label> </div> <div class="filepond--list-scroller" style="transform: translate3d(0px, -3px, 0px);"> <ul class="filepond--list" role="list"> <li class="filepond--item" id="filepond--item-xabj3x4o1" style="transform: translate3d(0px, 0px, 0px) scale3d(1, 1, 1); opacity: 1; height: 41px;" data-filepond-item-state="idle"> <fieldset class="filepond--file-wrapper"> <legend>fake.pdf</legend> <input type="hidden" name="uploadedFile" value=""> <div class="filepond--file"> <button class="filepond--file-action-button filepond--action-abort-item-load" type="button" data-align="right" disabled="disabled" style="transform: translate3d(0px, 0px, 0px) scale3d(1, 1, 1); opacity: 0; visibility: hidden; pointer-events: none;"><span>Abort</span></button> <button class="filepond--file-action-button filepond--action-retry-item-load" type="button" data-align="right" disabled="disabled" style="transform: translate3d(0px, 0px, 0px) scale3d(1, 1, 1); opacity: 0; visibility: hidden; pointer-events: none;"> <svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"> <path d="M10.81 9.185l-.038.02A4.997 4.997 0 0 0 8 13.683a5 5 0 0 0 5 5 5 5 0 0 0 5-5 1 1 0 0 1 2 0A7 7 0 1 1 9.722 7.496l-.842-.21a.999.999 0 1 1 .484-1.94l3.23.806c.535.133.86.675.73 1.21l-.804 3.233a.997.997 0 0 1-1.21.73.997.997 0 0 1-.73-1.21l.23-.928v-.002z" fill="currentColor" fill-rule="nonzero"></path> </svg><span>Retry</span></button> <button class="filepond--file-action-button filepond--action-remove-item" type="button" data-align="left" style="transform: translate3d(0px, 0px, 0px) scale3d(1, 1, 1); opacity: 1;"> <svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"> <path d="M11.586 13l-2.293 2.293a1 1 0 0 0 1.414 1.414L13 14.414l2.293 2.293a1 1 0 0 0 1.414-1.414L14.414 13l2.293-2.293a1 1 0 0 0-1.414-1.414L13 11.586l-2.293-2.293a1 1 0 0 0-1.414 1.414L11.586 13z" fill="currentColor" fill-rule="nonzero"></path> </svg><span>Remove</span></button> <div class="filepond--file-info" style="transform: translate3d(31px, 0px, 0px);"><span class="filepond--file-info-main" aria-hidden="true">fake.pdf</span><span class="filepond--file-info-sub">8 KB</span></div> <div class="filepond--file-status" style="transform: translate3d(31px, 0px, 0px); opacity: 0; visibility: hidden; pointer-events: none;"><span class="filepond--file-status-main"></span><span class="filepond--file-status-sub"></span></div> <div class="filepond--processing-complete-indicator" data-align="right" style="transform: scale3d(0.75, 0.75, 1); opacity: 0; visibility: hidden; pointer-events: none;"> <svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"> <path d="M18.293 9.293a1 1 0 0 1 1.414 1.414l-7.002 7a1 1 0 0 1-1.414 0l-3.998-4a1 1 0 1 1 1.414-1.414L12 15.586l6.294-6.293z" fill="currentColor" fill-rule="nonzero"></path> </svg> </div> <div class="filepond--progress-indicator filepond--load-indicator" style="opacity: 0; visibility: hidden; pointer-events: none;"> <svg> <path stroke-width="2" stroke-linecap="round"></path> </svg> </div> <div class="filepond--progress-indicator filepond--process-indicator" style="opacity: 0; visibility: hidden; pointer-events: none;"> <svg> <path stroke-width="2" stroke-linecap="round"></path> </svg> </div> </div> </fieldset> <div class="filepond--panel filepond--item-panel" data-scalable="true"> <div class="filepond--panel-top filepond--item-panel"></div> <div class="filepond--panel-center filepond--item-panel" style="transform: translate3d(0px, 7px, 0px) scale3d(1, 0.27, 1);"></div> <div class="filepond--panel-bottom filepond--item-panel" style="transform: translate3d(0px, 34px, 0px);"></div> </div> </li> </ul> </div> <div class="filepond--panel filepond--panel-root" data-scalable="true"> <div class="filepond--panel-top filepond--panel-root"></div> <div class="filepond--panel-center filepond--panel-root" style="transform: translate3d(0px, 7px, 0px) scale3d(1, 0.55, 1);"></div> <div class="filepond--panel-bottom filepond--panel-root" style="transform: translate3d(0px, 62px, 0px);"></div> </div><span class="filepond--assistant" id="filepond--assistant-qiu43sah3" role="status" aria-live="polite" aria-relevant="additions"></span> <div class="filepond--drip"></div> </div> This is the reason i think my c# Controller can't receive the param `uploadedFile` , how to solve the input name ? [1]: https://pqina.nl/filepond/
0debug
static void phys_page_set(AddressSpaceDispatch *d, hwaddr index, hwaddr nb, uint16_t leaf) { phys_map_node_reserve(3 * P_L2_LEVELS); phys_page_set_level(&d->phys_map, &index, &nb, leaf, P_L2_LEVELS - 1); }
1threat
Retrieving data using Prepared Statement in C# : I've been tring to retrieve data from my database ( MySQL ). I've been looking for samples on the web, but nothing that matches what I'm trying to do, even on Stack. So here's what I tried : public void RetrieveData() { cmd = new MySql.Data.MySqlClient.MySqlCommand(); cmd.Connection = conn; //connecting to database Connect(); try { cmd.CommandText = "SELECT * FROM storing WHERE id=1"; cmd.Prepare(); ResultSet rs = cmd.CommandText; } } But I have an error on the ResultSet saying 'ResultSet is not accessible because of it's protection level' cmd is created in the class because I need it into my other functions. Does anyone know what I should write ? I just want to retrieve all my data ( 5 columns in the database ) and print them in the console using this : location = rs.GetString(2, @location); Console.WriteLine("Location is : " + location ); That's an example, but I really don't know what to write. Thanks in advance for the help guys !
0debug
PHP String contain backslash, want to keep it as it is : $string = "doamin\username" $newStr = str_replace("\\", "\\\\", $string); I want the output to be: echo $newStr; doamin\username But It keeps giving me : domain sername can somebody help fixing this problem?? Thanks
0debug
int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, int log_offset, void *log_ctx) { FileLogContext file_log_ctx = { &file_log_ctx_class, log_offset, log_ctx }; int err, fd = open(filename, O_RDONLY); struct stat st; av_unused void *ptr; off_t off_size; char errbuf[128]; *bufptr = NULL; if (fd < 0) { err = AVERROR(errno); av_strerror(err, errbuf, sizeof(errbuf)); av_log(&file_log_ctx, AV_LOG_ERROR, "Cannot read file '%s': %s\n", filename, errbuf); return err; } if (fstat(fd, &st) < 0) { err = AVERROR(errno); av_strerror(err, errbuf, sizeof(errbuf)); av_log(&file_log_ctx, AV_LOG_ERROR, "Error occurred in fstat(): %s\n", errbuf); close(fd); return err; } off_size = st.st_size; if (off_size > SIZE_MAX) { av_log(&file_log_ctx, AV_LOG_ERROR, "File size for file '%s' is too big\n", filename); close(fd); return AVERROR(EINVAL); } *size = off_size; #if HAVE_MMAP ptr = mmap(NULL, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); if ((int)(ptr) == -1) { err = AVERROR(errno); av_strerror(err, errbuf, sizeof(errbuf)); av_log(&file_log_ctx, AV_LOG_ERROR, "Error occurred in mmap(): %s\n", errbuf); close(fd); return err; } *bufptr = ptr; #elif HAVE_MAPVIEWOFFILE { HANDLE mh, fh = (HANDLE)_get_osfhandle(fd); mh = CreateFileMapping(fh, NULL, PAGE_READONLY, 0, 0, NULL); if (!mh) { av_log(&file_log_ctx, AV_LOG_ERROR, "Error occurred in CreateFileMapping()\n"); close(fd); return -1; } ptr = MapViewOfFile(mh, FILE_MAP_READ, 0, 0, *size); CloseHandle(mh); if (!ptr) { av_log(&file_log_ctx, AV_LOG_ERROR, "Error occurred in MapViewOfFile()\n"); close(fd); return -1; } *bufptr = ptr; } #else *bufptr = av_malloc(*size); if (!*bufptr) { av_log(&file_log_ctx, AV_LOG_ERROR, "Memory allocation error occurred\n"); close(fd); return AVERROR(ENOMEM); } read(fd, *bufptr, *size); #endif close(fd); return 0; }
1threat
Please explain what is happening in this piece of code in chrome console? : <blockquote> <p><code>Javascript</code> code:</p> </blockquote> <pre><code>for(var i=0; i&lt;5; i++){ console.log(i); setTimeout(function(){ console.log(" magic "+ i) }, 2000); }; </code></pre> <blockquote> <p>outputs:</p> </blockquote> <p><a href="https://i.stack.imgur.com/DG64f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DG64f.png" alt="output"></a></p> <ol> <li>What does the number <code>25</code> mean ?</li> <li>How <code>i</code> was incremented to <code>5</code> while <code>i++</code> is unreachable after <code>4</code>?</li> </ol>
0debug
int av_find_stream_info(AVFormatContext *ic) { int i, count, ret, read_size, j; AVStream *st; AVPacket pkt1, *pkt; int64_t old_offset = url_ftell(ic->pb); struct { int64_t last_dts; int64_t duration_gcd; int duration_count; double duration_error[MAX_STD_TIMEBASES]; int64_t codec_info_duration; } info[MAX_STREAMS] = {{0}}; for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if (st->codec->codec_id == CODEC_ID_AAC) { st->codec->sample_rate = 0; st->codec->frame_size = 0; st->codec->channels = 0; } if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){ if(!st->codec->time_base.num) st->codec->time_base= st->time_base; } if (!st->parser && !(ic->flags & AVFMT_FLAG_NOPARSE)) { st->parser = av_parser_init(st->codec->codec_id); if(st->need_parsing == AVSTREAM_PARSE_HEADERS && st->parser){ st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES; } } assert(!st->codec->codec); if(!has_codec_parameters(st->codec)){ AVCodec *codec = avcodec_find_decoder(st->codec->codec_id); if (codec) avcodec_open(st->codec, codec); } } for(i=0;i<MAX_STREAMS;i++){ info[i].last_dts= AV_NOPTS_VALUE; } count = 0; read_size = 0; for(;;) { if(url_interrupt_cb()){ ret= AVERROR(EINTR); av_log(ic, AV_LOG_DEBUG, "interrupted\n"); break; } for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if (!has_codec_parameters(st->codec)) break; if( tb_unreliable(st->codec) && !(st->r_frame_rate.num && st->avg_frame_rate.num) && info[i].duration_count<20 && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) break; if(st->parser && st->parser->parser->split && !st->codec->extradata) break; if(st->first_dts == AV_NOPTS_VALUE) break; } if (i == ic->nb_streams) { if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) { ret = count; av_log(ic, AV_LOG_DEBUG, "All info found\n"); break; } } if (read_size >= ic->probesize) { ret = count; av_log(ic, AV_LOG_DEBUG, "Probe buffer size limit %d reached\n", ic->probesize); break; } ret = av_read_frame_internal(ic, &pkt1); if(ret == AVERROR(EAGAIN)) continue; if (ret < 0) { ret = -1; for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if (!has_codec_parameters(st->codec)){ char buf[256]; avcodec_string(buf, sizeof(buf), st->codec, 0); av_log(ic, AV_LOG_WARNING, "Could not find codec parameters (%s)\n", buf); } else { ret = 0; } } break; } pkt= add_to_pktbuf(&ic->packet_buffer, &pkt1, &ic->packet_buffer_end); if(av_dup_packet(pkt) < 0) { return AVERROR(ENOMEM); } read_size += pkt->size; st = ic->streams[pkt->stream_index]; if(st->codec_info_nb_frames>1) { if (st->time_base.den > 0 && av_rescale_q(info[st->index].codec_info_duration, st->time_base, AV_TIME_BASE_Q) >= ic->max_analyze_duration){ av_log(ic, AV_LOG_WARNING, "max_analyze_duration reached\n"); break; } info[st->index].codec_info_duration += pkt->duration; } { int index= pkt->stream_index; int64_t last= info[index].last_dts; int64_t duration= pkt->dts - last; if(pkt->dts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && duration>0){ double dur= duration * av_q2d(st->time_base); if(info[index].duration_count < 2) memset(info[index].duration_error, 0, sizeof(info[index].duration_error)); for(i=1; i<MAX_STD_TIMEBASES; i++){ int framerate= get_std_framerate(i); int ticks= lrintf(dur*framerate/(1001*12)); double error= dur - ticks*1001*12/(double)framerate; info[index].duration_error[i] += error*error; } info[index].duration_count++; if (info[index].duration_count > 3) info[index].duration_gcd = av_gcd(info[index].duration_gcd, duration); } if(last == AV_NOPTS_VALUE || info[index].duration_count <= 1) info[pkt->stream_index].last_dts = pkt->dts; } if(st->parser && st->parser->parser->split && !st->codec->extradata){ int i= st->parser->parser->split(st->codec, pkt->data, pkt->size); if(i){ st->codec->extradata_size= i; st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(st->codec->extradata, pkt->data, st->codec->extradata_size); memset(st->codec->extradata + i, 0, FF_INPUT_BUFFER_PADDING_SIZE); } } if (!has_codec_parameters(st->codec) || !has_decode_delay_been_guessed(st)) try_decode_frame(st, pkt); st->codec_info_nb_frames++; count++; } for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if(st->codec->codec) avcodec_close(st->codec); } for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if(st->codec_info_nb_frames>2 && !st->avg_frame_rate.num && info[i].codec_info_duration) av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, (st->codec_info_nb_frames-2)*(int64_t)st->time_base.den, info[i].codec_info_duration*(int64_t)st->time_base.num, 60000); if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample) st->codec->codec_tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); if (tb_unreliable(st->codec) && info[i].duration_count > 15 && info[i].duration_gcd > 1 && !st->r_frame_rate.num) av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * info[i].duration_gcd, INT_MAX); if(info[i].duration_count && !st->r_frame_rate.num && tb_unreliable(st->codec) ){ int num = 0; double best_error= 2*av_q2d(st->time_base); best_error= best_error*best_error*info[i].duration_count*1000*12*30; for(j=1; j<MAX_STD_TIMEBASES; j++){ double error= info[i].duration_error[j] * get_std_framerate(j); if(error < best_error){ best_error= error; num = get_std_framerate(j); } } if (num && (!st->r_frame_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(st->r_frame_rate))) av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX); } if (!st->r_frame_rate.num){ if( st->codec->time_base.den * (int64_t)st->time_base.num <= st->codec->time_base.num * st->codec->ticks_per_frame * (int64_t)st->time_base.den){ st->r_frame_rate.num = st->codec->time_base.den; st->r_frame_rate.den = st->codec->time_base.num * st->codec->ticks_per_frame; }else{ st->r_frame_rate.num = st->time_base.den; st->r_frame_rate.den = st->time_base.num; } } }else if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { if(!st->codec->bits_per_coded_sample) st->codec->bits_per_coded_sample= av_get_bits_per_sample(st->codec->codec_id); } } av_estimate_timings(ic, old_offset); compute_chapters_end(ic); #if 0 for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if(b-frames){ ppktl = &ic->packet_buffer; while(ppkt1){ if(ppkt1->stream_index != i) continue; if(ppkt1->pkt->dts < 0) break; if(ppkt1->pkt->pts != AV_NOPTS_VALUE) break; ppkt1->pkt->dts -= delta; ppkt1= ppkt1->next; } if(ppkt1) continue; st->cur_dts -= delta; } } } #endif return ret; }
1threat
swift 4 multiple picker view not working? : ## 1. multiple picker views are not showing the data in the picker view in swift 4, I already read many tutorials but no one solve my problem please check and answer me. 2.when I implemented 3 picker views the data is showing only of the first picker view i.e , (strblood) but not the other arrays ---------- the code below is working properly but there is one error regarding showing the array in the picker view when clciked on the other labels ("lblblood"."lblcountry") ## ------------------------------------------------------------------------ ** * import UIKit import Foundation class RegisterViewController: UIViewController { var strBlood = ["O+","O-","O","A","B+"] var strcountry = ["India","Canada","USA"] var strgender = ["Male","Female"] var selectedBlood: String? var selectedCountry: String? var selectedGender: String? @IBOutlet weak var txtGender: UITextField! @IBOutlet weak var txtCountry: UITextField! @IBOutlet weak var lblBloodGroup: UITextField! override func viewDidLoad() { super.viewDidLoad() self.chooseCountry() self.chooseBlood() self.choosGender() } func chooseBlood(){ let bloodPicker = UIPickerView() bloodPicker.delegate = self self.lblBloodGroup.inputView = bloodPicker } func chooseCountry(){ let countryname = UIPickerView() countryname.delegate = self self.txtCountry.inputView = countryname } func choosGender() { let gender1 = UIPickerView() gender1.delegate = self self.txtGender.inputView = gender1 } } extension RegisterViewController : UIPickerViewDelegate , UIPickerViewDataSource { func numberOfComponents(in pickerView: UIPickerView) -> Int { return 1 } func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { if lblBloodGroup.isEnabled { print("BLOOD SELECTED") return strBlood.count } else if txtCountry.isEnabled{ print("COUNTRY SELECTED") return strcountry.count }else { print("GENDER SELECTED") return strgender.count } } func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { if lblBloodGroup.isEnabled{ print("BLOOD SELECTED1") return strBlood[row] }else if txtCountry.isEnabled{ return strcountry[row] }else { return strgender[row] } } func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { if lblBloodGroup.isEnabled{ selectedBlood = strBlood[row] lblBloodGroup.text = selectedBlood }else if txtCountry.isEnabled{ selectedCountry = strcountry[row] txtCountry.text = selectedCountry }else { selectedGender = strgender[row] txtGender.text = selectedGender } } }
0debug
still getting CORS error spring boot and angular : I'm using Spring Boot 2.0.2 , I have spring-starter-web and spring-data-jpa in my project, Im' not using Spring Security for the moment. I created RestControllers and added @CrossOrigin annotation to them, and tried this code to enable CORS for my angular app @Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurer() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**")..allowedOrigins("*").allowedMethods("GET","POST","DELETE","PATCH","OPTIONS"); } } }; } But still getting CORS Error from my angular app
0debug
static V9fsSynthNode *v9fs_add_dir_node(V9fsSynthNode *parent, int mode, const char *name, V9fsSynthNodeAttr *attr, int inode) { V9fsSynthNode *node; mode = ((mode & 0777) | S_IFDIR) & ~(S_IWUSR | S_IWGRP | S_IWOTH); node = g_malloc0(sizeof(V9fsSynthNode)); if (attr) { node->attr = attr; node->attr->nlink++; } else { node->attr = &node->actual_attr; node->attr->inode = inode; node->attr->nlink = 1; node->attr->mode = mode; node->attr->write = NULL; node->attr->read = NULL; } node->private = node; strncpy(node->name, name, sizeof(node->name)); QLIST_INSERT_HEAD_RCU(&parent->child, node, sibling); return node; }
1threat
void qemu_iovec_init(QEMUIOVector *qiov, int alloc_hint) { qiov->iov = g_malloc(alloc_hint * sizeof(struct iovec)); qiov->niov = 0; qiov->nalloc = alloc_hint; qiov->size = 0; }
1threat
How to destroy widgets in tkinter : I want in my if statement for it to destroy the buttons on my tkinter. I have tried a couple of methods and looked up a few and some i don't understand/too complicated. I want a clear method of destroying widgets.
0debug
is there a bug in java new String : <p>I try this code:</p> <pre><code>byte[] data = new byte[66000]; int count = is.read(data); String sRequest = new String(data); //will received byte array hello String all = sRequest; all = all.concat("world"); System.out.println(all); </code></pre> <p>It only print to my console: <strong>hello</strong></p> <p><strong>concat</strong> funtion of java have bug? I also used + operator instead concat function but result same :( How can I concat a String with new String from a byte array?</p>
0debug
Calling function in directive : <p>I am trying to call a public function which is inside my directive from component by getting hold of the directive via viewchild like this</p> <pre><code> @ViewChild('myDirective') myDirective; .... myDirective.nativeElement.myFunction(); </code></pre> <p>But I get error that the myFunction does not exist. Is there a way to call a function which is iniside a directive?</p>
0debug
What does a blue circle on the "Run" button in Matlab mean? : <p>Title pretty much says it all. I am running R2015a, and got this to appear in my editor. There is a small blue circle appearing on the "Run" button. I've never seen this before, and can't find any documentation on the mathworks website that explains it's meaning.</p> <p>What does this blue circle with 3 dots mean?</p> <p><a href="https://i.stack.imgur.com/UGsiY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UGsiY.png" alt="enter image description here"></a></p>
0debug
Python: While Loop Looping Despite Break : My program seems to be looping several times here despite a break: for sequence in qwerty: for char in range(0,passlen): if password [char : char + 2] in sequence: score -= 5 print(score,"subtracting 5") break It usually outputs this: 38 subtracting 5 33 subtracting 5 It should only loop once, what should I do to mediate this.
0debug
static void unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs, const int num_bits) { const int mask = (1 << num_bits) - 1; int i, idx, val, alpha_val; idx = 0; alpha_val = mask; do { do { if (get_bits1(gb)) val = get_bits(gb, num_bits); else { int sign; val = get_bits(gb, num_bits == 16 ? 7 : 4); sign = val & 1; val = (val + 2) >> 1; if (sign) val = -val; } alpha_val = (alpha_val + val) & mask; if (num_bits == 16) dst[idx++] = alpha_val >> 6; else dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); if (idx == num_coeffs - 1) break; } while (get_bits1(gb)); val = get_bits(gb, 4); if (!val) val = get_bits(gb, 11); if (idx + val > num_coeffs) val = num_coeffs - idx; if (num_bits == 16) for (i = 0; i < val; i++) dst[idx++] = alpha_val >> 6; else for (i = 0; i < val; i++) dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); } while (idx < num_coeffs); }
1threat
Modify semantic UI column : <p>I have a question, is it possible to modify the width of a 'div class=column' in semantic? I have a two column grid container, but I would wish that one column to have 70% width and the other one 30%. Semantic makes bot columns with equal width 50%. </p>
0debug
is possible to use finish() in to return in previous activities like C>B>A? : Technically i have a MainActivity A then then i'll go to next activity which is activity B then there is the other activity which is Activity C but when i use finish, the activity B and C returns to each other instead backing to the main activity
0debug
Can virtual functions be constexpr? : <p>Can virtual functions like <code>X::f()</code> in the following code</p> <pre><code>struct X { constexpr virtual int f() const { return 0; } }; </code></pre> <p>be <code>constexpr</code>?</p>
0debug
Reference variables and pointers : Is `int &y=x` same as `int y=&x`? Also in the below code, why is `*s++` giving me some wrong results? I was expecting `*s` value to be 12 Are `s++` and `*s++` the same? #include <iostream> using namespace std; int main() { int p=10; int &q=p; //q is a reference variable to p //int r=&p; //error: invalid conversion from 'int*' to 'int' int *s=&p; //valid q++; *s++; //here even s++ works, and cout<<*s does not give 12 but some lengthy number //and cout<<s gives some hexadecimal, I'm guessing thats the address cout<<p<<endl<<q<<endl<<*s; } Output I'm getting: 11 11 6422280
0debug
How to search string in all files firefox developer 56 : <p>I can't find a way to search a string in all .js and .css files on Firefox Developer Edition 56.0b4.</p> <p>I found a way, but it was before versions 52. I wonder why they removed this feature?</p> <p>Thanks for help.</p>
0debug
Requied explanation for Django views.py code : <p>I'm learning Django and it was going pretty nice until I got confused with given code. Could someone explain me line by line what is happening there? </p> <pre><code>from .forms import NewsLinkForm from .models import NewsLink class NewsLinkUpdate(View): form_class = NewsLinkForm template_name = 'organizer/newslink_form_update.html' def get(self, request, pk): newslink = get_object_or_404(NewsLink, pk=pk) context = { 'form':self.form_class(instance=newslink), 'newslink':newslink, } return render(request, self.template_name, context) def post(self,request,pk): newslink = get_object_or_404(NewsLink, pk=pk) bound_form = self.form_class(request.POST, instance=newslink) if bound_form.is_valid(): new_newslink = bound_form.save() return redirect(new_newslink) else: context = { 'form':bound_form, 'newslink':newslink, } return render( request, self.template_name, context ) </code></pre>
0debug
Page redirect not working after firebase update in javascript : Below is my javascript function, which is properly writing to firebase. However, page redirect is not working. <script type="text/JavaScript"> function bookappnt() { var appname = document.getElementById("app-name").value; var ref = new Firebase("https://dermaenbgtt1233.firebaseio.com/"); var usersRef = ref.child("Appointment-Details"); usersRef.push({ applicationname: appname }); windiw.location.href = "http://www.example.com"; } </script> <input type="text" id="app-name" class="user" placeholder="Name"> <input type="submit" value="Book appointment" onclick ="bookappnt()">
0debug
Symfony4.3.2 - Allow access to specific pages : I am on Symfony 4.3.2, trying to get a way to allow users having role (CommissionOwner) access to only following specific pages. - www.xyz.com/Loginlandingpage - www.xyz.com/reportSalesCommissions I am trying in **myApp/config/packages/security.yaml** access_control: - { path: ^/reportSalesCommissions, roles: IS_CommissionOwner }
0debug
void do_m68k_simcall(CPUM68KState *env, int nr) { uint32_t *args; args = (uint32_t *)(env->aregs[7] + 4); switch (nr) { case SYS_EXIT: exit(ARG(0)); case SYS_READ: check_err(env, read(ARG(0), (void *)ARG(1), ARG(2))); break; case SYS_WRITE: check_err(env, write(ARG(0), (void *)ARG(1), ARG(2))); break; case SYS_OPEN: check_err(env, open((char *)ARG(0), translate_openflags(ARG(1)), ARG(2))); break; case SYS_CLOSE: { int fd = ARG(0); if (fd > 2) check_err(env, close(fd)); else check_err(env, 0); break; } case SYS_BRK: { int32_t ret; ret = do_brk((void *)ARG(0)); if (ret == -ENOMEM) ret = -1; check_err(env, ret); } break; case SYS_FSTAT: { struct stat s; int rc; struct m86k_sim_stat *p; rc = check_err(env, fstat(ARG(0), &s)); if (rc == 0) { p = (struct m86k_sim_stat *)ARG(1); p->sim_st_dev = tswap16(s.st_dev); p->sim_st_ino = tswap16(s.st_ino); p->sim_st_mode = tswap32(s.st_mode); p->sim_st_nlink = tswap16(s.st_nlink); p->sim_st_uid = tswap16(s.st_uid); p->sim_st_gid = tswap16(s.st_gid); p->sim_st_rdev = tswap16(s.st_rdev); p->sim_st_size = tswap32(s.st_size); p->sim_st_atime = tswap32(s.st_atime); p->sim_st_mtime = tswap32(s.st_mtime); p->sim_st_ctime = tswap32(s.st_ctime); p->sim_st_blksize = tswap32(s.st_blksize); p->sim_st_blocks = tswap32(s.st_blocks); } } break; case SYS_ISATTY: check_err(env, isatty(ARG(0))); break; case SYS_LSEEK: check_err(env, lseek(ARG(0), (int32_t)ARG(1), ARG(2))); break; default: cpu_abort(env, "Unsupported m68k sim syscall %d\n", nr); } }
1threat
How to convert numbers to string with decimal and commas : <p>I'd like to convert a number like 1323.67 to 1.323,67, how can I do that?</p> <p>I've tried this </p> <p><code>f'{1325.76:.,2f}'</code></p> <p>but it prints out 1,325.76</p> <p>I excpected <code>f'{1325.76:.,2f}'</code> to be 1.325,75 but it's 1,325.76</p>
0debug
Case statement for date format conversion in oracle : I have a "Entrydate" field that comes from Source in below date format 1) YYYY-MM-DD HH.MM.SS 2) YYYY-MM-DD It is loaded to a table as "YYYMM" format . I am looking for a case statement that handles both the conditions. I am using the below SQL SELECT CASE WHEN to_char(ENTRYDATE, 'YYYY-MM-DD HH.MM.SS') THEN to_char(ENTRYDATE, 'YYYYMM') to_char(ENTRYDATE, 'YYYY-MM-DD') THEN to_char(ENTRYDATE, 'YYYYMM') FROM TABLE; I will need to get the date in 'yyyymm' format to validate the output table. Getting "invalid relational operator" errror. Could someone help me with this. Thanks!
0debug
When to call function vs function() in react onClick? : <p>I'm having questions about when to call a function inside a react component. Sometimes my code breaks when I don't add the brackets to a function call, but not always. Is there some sort of rule i'm missing here?</p> <p><strong>Doesn't work</strong></p> <pre><code>// Callback of parent component &lt;Link onClick={this.props.OnNavigate}&gt; A link &lt;/Link&gt; </code></pre> <p><strong>Does work</strong></p> <pre><code>// Callback of parent component &lt;Link onClick={this.props.OnNavigate()}&gt; A link &lt;/Link&gt; // Callback for function of component &lt;li onClick={this.toggleDepartments}&gt;other example&lt;/li&gt; </code></pre>
0debug
static inline void RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size) { const uint8_t *s = src; const uint8_t *end; #ifdef HAVE_MMX const uint8_t *mm_end; #endif uint16_t *d = (uint16_t *)dst; end = s + src_size; #ifdef HAVE_MMX __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm __volatile( "movq %0, %%mm7\n\t" "movq %1, %%mm6\n\t" ::"m"(red_16mask),"m"(green_16mask)); mm_end = end - 15; while(s < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movd %1, %%mm0\n\t" "movd 4%1, %%mm3\n\t" "punpckldq 8%1, %%mm0\n\t" "punpckldq 12%1, %%mm3\n\t" "movq %%mm0, %%mm1\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm3, %%mm4\n\t" "movq %%mm3, %%mm5\n\t" "psllq $8, %%mm0\n\t" "psllq $8, %%mm3\n\t" "pand %%mm7, %%mm0\n\t" "pand %%mm7, %%mm3\n\t" "psrlq $5, %%mm1\n\t" "psrlq $5, %%mm4\n\t" "pand %%mm6, %%mm1\n\t" "pand %%mm6, %%mm4\n\t" "psrlq $19, %%mm2\n\t" "psrlq $19, %%mm5\n\t" "pand %2, %%mm2\n\t" "pand %2, %%mm5\n\t" "por %%mm1, %%mm0\n\t" "por %%mm4, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "por %%mm5, %%mm3\n\t" "psllq $16, %%mm3\n\t" "por %%mm3, %%mm0\n\t" MOVNTQ" %%mm0, %0\n\t" :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory"); d += 4; s += 16; } __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(s < end) { register int rgb = *(uint32_t*)s; s += 4; *d++ = ((rgb&0xF8)<<8) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>19); } }
1threat
void do_store_xer (void) { xer_so = (T0 >> XER_SO) & 0x01; xer_ov = (T0 >> XER_OV) & 0x01; xer_ca = (T0 >> XER_CA) & 0x01; xer_cmp = (T0 >> XER_CMP) & 0xFF; xer_bc = (T0 >> XER_BC) & 0x3F; }
1threat
Cannot find the UseMysql method on DbContextOptions : <p>I am playing around with the dotnet core on linux, and i am trying to configure my DbContext with a connection string to a mysql Server. </p> <p>my DbContext looks like so:</p> <pre><code>using Microsoft.EntityFrameworkCore; using Models.Entities; namespace Models { public class SomeContext : DbContext { //alot of dbSets... public DbSet&lt;SomeEntity&gt; SomeDbSet { get; set; } public EsportshubContext(DbContextOptions&lt;SomeContext&gt; options) : base(options) { } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseMysql //Cannot find this method } protected override void OnModelCreating(ModelBuilder modelBuilder) { //using modelBuilder to map some relationships } } } </code></pre> <p>My dependencies looks like so:</p> <pre><code>"dependencies": { "Microsoft.NETCore.App": { "version": "1.0.0", "type": "platform" }, "Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", "Microsoft.Extensions.Logging.Console": "1.0.0", "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0", "Microsoft.Extensions.Configuration.Json": "1.0.0", "Microsoft.Extensions.Configuration.CommandLine": "1.0.0", "Microsoft.AspNetCore.Mvc":"1.0.0", "Microsoft.EntityFrameworkCore": "1.0.1", "MySql.Data.Core": "7.0.4-ir-191", "MySql.Data.EntityFrameworkCore": "7.0.4-ir-191" }, </code></pre> <p>I also tried to use the mysql server in my Startup.cs in the following code</p> <pre><code>public class Startup { public void ConfigureServices(IServiceCollection services) { var connection = @"Server=(localdb)\mssqllocaldb;Database=EFGetStarted.AspNetCore.NewDb;Trusted_Connection=True;"; services.AddDbContext&lt;EsportshubContext&gt;(options =&gt; options.UseMysql); //Cannot find UseMysql* } </code></pre> <p>I tried to change my directive from </p> <pre><code>using Microsoft.EntityFrameworkCore; </code></pre> <p>to </p> <pre><code>using MySQL.Data.EntityFrameworkCore; </code></pre> <p>Which makes sense? maybe? but then all of the references to DbContext and DbSet is gone, so i suppose the solution is a mix of sorts??</p>
0debug
XAttribute null even though it is there? : <p>doc = GetSecureXDocument("<a href="https://www.predictit.org/api/marketdata/all" rel="nofollow noreferrer">https://www.predictit.org/api/marketdata/all</a>");</p> <pre><code> List &lt;MarketContract&gt; contracts = doc.Root.Element("Markets").Elements("MarketData").Elements("Contracts").Elements("MarketContract").Select(x =&gt; new MarketContract { //ID = int.Parse((string)x.Attribute("ID")), URL = (string)x.Attribute("URL"), Name = (string)x.Attribute("Name"), LongName = (string)x.Attribute("LongName"), ShortName = (string)x.Attribute("ShortName"), TickerSymbol = (string)x.Attribute("TickerSymbol"), Status = (string)x.Attribute("Status"), /*BestBuyNoCostInCents = int.Parse((string)x.Attribute("BestBuyNoCost")), BestBuyYesCostInCents = int.Parse((string)x.Attribute("BestBuyYesCost")), BestSellNoCostInCents = int.Parse((string)x.Attribute("BestSellNoCost")), BestSellYesCostInCents = int.Parse((string)x.Attribute("BestSellYesCost"))*/ }).ToList(); </code></pre> <p>The commented out sections throw nullargumentexceptions, and when the values of URL, Name, LongName etc are printed, they're all zero.</p> <p>Here's the value of 'x' in the lambda during a run:</p> <pre><code> &lt;MarketContract&gt; &lt;ID&gt;3414&lt;/ID&gt; &lt;DateEnd&gt;N/A&lt;/DateEnd&gt; &lt;Image&gt;https://az620379.vo.msecnd.net/images/Contracts/small_f6d2f26b-8055-45a3-872f-0796dc47e238.png&lt;/Image&gt; &lt;URL&gt;https://www.predictit.org/Contract/3414/Will-a-Democratic-candidate-win-the-2017-Virginia-gubernatorial-race&lt;/URL&gt; &lt;Name&gt;Democratic&lt;/Name&gt; &lt;LongName&gt;Will a Democratic candidate win the 2017 Virginia gubernatorial race?&lt;/LongName&gt; &lt;ShortName&gt;Democratic&lt;/ShortName&gt; &lt;TickerSymbol&gt;DEM.VAGOV17&lt;/TickerSymbol&gt; &lt;Status&gt;Open&lt;/Status&gt; &lt;LastTradePrice&gt;0.75&lt;/LastTradePrice&gt; &lt;BestBuyYesCost&gt;0.78&lt;/BestBuyYesCost&gt; &lt;BestBuyNoCost&gt;0.26&lt;/BestBuyNoCost&gt; &lt;BestSellYesCost&gt;0.74&lt;/BestSellYesCost&gt; &lt;BestSellNoCost&gt;0.22&lt;/BestSellNoCost&gt; &lt;LastClosePrice&gt;0.75&lt;/LastClosePrice&gt; &lt;/MarketContract&gt; </code></pre> <p>This is my first time dealing with XML, and if anyone could help, that would be greatly appreciated!</p>
0debug
Rust, if else assignement "move out of borrowed content" : All right, this is a snippet of the rust code. It's an insertion on a common bst, I just want the reference to the branch on which I'll perform the insertion. struct Node { value: i32, left: Option<Box<Node>>, right: Option<Box<Node>> } ... fn insert(&mut self, elem: i32) { let ref mut a = if elem < self.value { self.left } else { self.right }; ... This code is invalid, after tweaking a bit I came to understand when I perform a if/else statement, rust moves the content before assigning it. Infact this solution works let a = if elem < self.value { let ref mut b = self.left; b } else { let ref mut b = self.right; b }; But it's really ugly... is there a way to handle the thing without recurring to a Box? I could use a pointer, but it really looks like an overkill.
0debug
C++ Class Errors : <pre><code>class Bag { protected: Item** myItems; int numItems; public: Bag(); Bag(Item** items, int numberOfItems); Bag(const Bag&amp; other); /** Bag instance destructor */ virtual ~Bag(); /** Defines the = operation to assign an Bag */ void operator= (const Bag&amp; m); /** Defines the &lt;&lt; operation to display an Bag */ friend ostream&amp; operator&lt;&lt; (ostream&amp; s, Bag&amp; m); /** Prints out Bag instance */ virtual void display(ostream&amp; s); /** Add an item to the bag */ void addItem(int pos, Item* newItemPtr); /** deletes an item in the bag */ void deleteItem(int pos); //---------------------------------------------------------- Bag::Bag() { myItems = NULL; numItems = NULL; } //---------------------------------------------------------- Bag::Bag(Item** items, int numOfItems) { myItems = new Item*[numOfItems]; numItems = numOfItems; } //---------------------------------------------------------- Bag::Bag(const Bag&amp; other) { myItems = other.myItems; numItems = other.numItems; } //---------------------------------------------------------- Bag::~Bag() { cout &lt;&lt; "BAG ELIMINATED" &lt;&lt; endl; } //---------------------------------------------------------- void operator= (const Bag&amp; m) { myItems = m.myItems; numItems = m.numItems; } //---------------------------------------------------------- friend ostream&amp; operator&lt;&lt; (ostream&amp; s, Bag&amp; m) { } //---------------------------------------------------------- void display(ostream&amp; s) { } //---------------------------------------------------------- void addItem(int pos, Item* newItemPtr) { Item** temp = myItems; myItems = new Item*[numItems + 1]; for (int i = 0; i &lt; numItems; i++) { if (i &lt; pos) { myItems[i] = temp[i]; temp[i] = NULL; } else if (i == pos) { myItems[i] = newItemPtr; } else if (i &gt; pos) { myItems[i] = temp[i-1]; temp[i-1] = NULL; } } delete[] temp; numItems++; } //---------------------------------------------------------- void deleteItem(int pos) { Item** temp = myItems; myItems = new Item*[numItems-1]; for (int i = 0; i &lt; numItems; i++) { if (i &lt; pos) { myItems[i] = temp[i]; temp[i] = NULL; } else if (i == pos) { temp[i] = NULL; } else if (i &gt; pos) { myItems[i-1] = temp[i]; temp[i] = NULL; } } delete[] temp; numItems--; } }; </code></pre> <p>So, I am getting errors on lines like "Bag :: Bag()" where I am trying to define each method. I'm wondering why it's giving me these "member function already defined or declared" errors given that my other classes don't have this error.</p>
0debug
static int qemu_lock_fcntl(int fd, int64_t start, int64_t len, int fl_type) { int ret; struct flock fl = { .l_whence = SEEK_SET, .l_start = start, .l_len = len, .l_type = fl_type, }; ret = fcntl(fd, QEMU_SETLK, &fl); return ret == -1 ? -errno : 0; }
1threat
How dissemblers maintain the value of registers while analyzing object files? : When we analyze object files using gdb or any dissembler, we put break points into it. At any time it shows the current state of registers. There can be many programs running in background. Each of these programs will also use these registers and can change their value. How does dissembler maintains the value of registers for our program when other processes may be continuously changing it?
0debug
Python assign a variable use if condition : <p>I want to assign a variable when <code>if</code> statement is true. What's wrong with this assignment?</p> <blockquote> <p>b = 1 if 3 > 2</p> </blockquote> <pre><code>File "&lt;stdin&gt;", line 1 b = 1 if 3 &gt; 2 ^ SyntaxError: invalid syntax </code></pre>
0debug
How to make the program run in .exe mode explained below : <p>I just have written a code in C# its a web browser using Visual Studio 2015 How do i make it compiled to .exe file and etc, like chrome mozilla etc. Help appriciated.</p>
0debug
Filter array of objects by multiple properties and values : <p>Is it possible to filter an array of objects by multiple values?</p> <p>E.g in the sample below can I filter it by the term_ids 5 and 6 and type car at the same time? </p> <pre><code>[ { "id":1, "term_id":5, "type":"car" }, { "id":2, "term_id":3, "type":"bike" }, { "id":3, "term_id":6, "type":"car" } ] </code></pre> <p>Definitely up for using a library if it makes it easier. </p>
0debug
does Any == Object : <p>The following code in kotlin:</p> <pre><code>Any().javaClass </code></pre> <p>Has value of <code>java.lang.Object</code>. Does that mean <code>Any</code> and <code>Object</code> are the same class? What are their relations?</p>
0debug
Laravel framework tutorial : <p>I'm a PHP developer and want to learn <strong>php laravel framework</strong> . What is the most helpful website to learn Laravel framework ?!</p> <p>Thanks for helping 😊</p>
0debug
static void do_apply_filter(APEContext *ctx, int version, APEFilter *f, int32_t *data, int count, int order, int fracbits) { int res; int absres; while (count--) { res = ctx->adsp.scalarproduct_and_madd_int16(f->coeffs, f->delay - order, f->adaptcoeffs - order, order, APESIGN(*data)); res = (res + (1 << (fracbits - 1))) >> fracbits; res += *data; *data++ = res; *f->delay++ = av_clip_int16(res); if (version < 3980) { f->adaptcoeffs[0] = (res == 0) ? 0 : ((res >> 28) & 8) - 4; f->adaptcoeffs[-4] >>= 1; f->adaptcoeffs[-8] >>= 1; } else { absres = FFABS(res); if (absres) *f->adaptcoeffs = ((res & (-1<<31)) ^ (-1<<30)) >> (25 + (absres <= f->avg*3) + (absres <= f->avg*4/3)); else *f->adaptcoeffs = 0; f->avg += (absres - f->avg) / 16; f->adaptcoeffs[-1] >>= 1; f->adaptcoeffs[-2] >>= 1; f->adaptcoeffs[-8] >>= 1; } f->adaptcoeffs++; if (f->delay == f->historybuffer + HISTORY_SIZE + (order * 2)) { memmove(f->historybuffer, f->delay - (order * 2), (order * 2) * sizeof(*f->historybuffer)); f->delay = f->historybuffer + order * 2; f->adaptcoeffs = f->historybuffer + order; } } }
1threat
Using single, double and triple quotes in sql for text qualifiers : I am processing some CSV data from a client and one of the headers is 'booktitle'. The values of 'booktitle' are text qualifed with double quote and there are quotes in some of the titles, such as; "How to draw the "Marvel" way" I asked the client to escape the quotes in quotes with double quotes, and they sent me back this '"How to draw the """Marvel""" way "' So single, double, then triple quote. My question is will this work? I have not seen it done this way before for escaping text qualifiers. Thanks
0debug
C# DateTime TryParse dont check correct if string is time format : Im using datetime.tryparse(value, out datetime) to check a string have date. But i have a problem. If value is time format (ex: 14:25:26) then datetime.tryparse is true. Not good Please help me check string to date?
0debug
int load_vmstate(Monitor *mon, const char *name) { DriveInfo *dinfo; BlockDriverState *bs, *bs1; QEMUSnapshotInfo sn; QEMUFile *f; int ret; bs = get_bs_snapshots(); if (!bs) { monitor_printf(mon, "No block device supports snapshots\n"); return -EINVAL; } qemu_aio_flush(); TAILQ_FOREACH(dinfo, &drives, next) { bs1 = dinfo->bdrv; if (bdrv_has_snapshot(bs1)) { ret = bdrv_snapshot_goto(bs1, name); if (ret < 0) { if (bs != bs1) monitor_printf(mon, "Warning: "); switch(ret) { case -ENOTSUP: monitor_printf(mon, "Snapshots not supported on device '%s'\n", bdrv_get_device_name(bs1)); break; case -ENOENT: monitor_printf(mon, "Could not find snapshot '%s' on " "device '%s'\n", name, bdrv_get_device_name(bs1)); break; default: monitor_printf(mon, "Error %d while activating snapshot on" " '%s'\n", ret, bdrv_get_device_name(bs1)); break; } if (bs == bs1) return 0; } } } ret = bdrv_snapshot_find(bs, &sn, name); if ((ret >= 0) && (sn.vm_state_size == 0)) return -EINVAL; f = qemu_fopen_bdrv(bs, 0); if (!f) { monitor_printf(mon, "Could not open VM state file\n"); return -EINVAL; } ret = qemu_loadvm_state(f); qemu_fclose(f); if (ret < 0) { monitor_printf(mon, "Error %d while loading VM state\n", ret); return ret; } return 0; }
1threat
SQLAlchemy and Falcon - session initialization : <p>I'm wondering where the best place would be to create a scoped session for use in falcon.</p> <p>From reading the flask-sqlalchemy code, it, in a round about way, does something like this:</p> <pre><code>from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker try: from greenlet import get_current as get_ident except ImportError: try: from thread import get_ident except ImportError: from _thread import get_ident connection_uri = 'postgresql://postgres:@localhost:5432/db' engine = create_engine(connection_uri) session_factory = sessionmaker(bind=engine) session_cls = scoped_session(session_factory, scopefunc=get_ident) session = session_cls() </code></pre> <p>Would this work for falcon? Will the <code>get_ident</code> func "do the right thing" when using gunicorn?</p>
0debug
Getting null with @pathparam and @requestmapping : <p>I am using spring-boot 1.4.3.RELEASE for creating web services, whereas, while giving the request with <code>http://localhost:7211/person/get/ram</code>, I am getting null for the id property</p> <pre><code>@RequestMapping(value="/person/get/{id}", method=RequestMethod.GET, produces="application/json") public @ResponseBody Person getPersonById(@PathParam("id") String id) { return personService.getPersonById(id); } </code></pre> <p>Can you please suggest me, is there anything I missed.</p>
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
In REST Assured, how can I check if a field is present or not in the response? : <p>How can I make sure that my response, let's say it is in JSON, either <strong>contains</strong> or <strong>does not contain</strong> a specific field?</p> <pre><code>when() .get("/person/12345") .then() .body("surname", isPresent()) // Doesn't work... .body("age", isNotPresent()); // ...But that's the idea. </code></pre> <p>I'm looking for a way to assert whether my JSON will contain or not the fields <strong>age</strong> and <strong>surname</strong>.</p>
0debug
How to create a call adapter for suspending functions in Retrofit? : <p>I need to create a retrofit call adapter which can handle such network calls:</p> <pre><code>@GET("user") suspend fun getUser(): MyResponseWrapper&lt;User&gt; </code></pre> <p>I want it to work with Kotlin Coroutines without using <code>Deferred</code>. I have already have a successful implementation using <code>Deferred</code>, which can handle methods such as:</p> <pre><code>@GET("user") fun getUser(): Deferred&lt;MyResponseWrapper&lt;User&gt;&gt; </code></pre> <p>But I want the ability make the function a suspending function and remove the <code>Deferred</code> wrapper.</p> <p>With suspending functions, Retrofit works as if there is a <code>Call</code> wrapper around the return type, so <code>suspend fun getUser(): User</code> is treated as <code>fun getUser(): Call&lt;User&gt;</code></p> <h3>My Implementation</h3> <p>I have tried to create a call adapter which tries to handle this. Here is my implementation so far:</p> <p><strong>Factory</strong></p> <pre><code>class MyWrapperAdapterFactory : CallAdapter.Factory() { override fun get(returnType: Type, annotations: Array&lt;Annotation&gt;, retrofit: Retrofit): CallAdapter&lt;*, *&gt;? { val rawType = getRawType(returnType) if (rawType == Call::class.java) { returnType as? ParameterizedType ?: throw IllegalStateException("$returnType must be parameterized") val containerType = getParameterUpperBound(0, returnType) if (getRawType(containerType) != MyWrapper::class.java) { return null } containerType as? ParameterizedType ?: throw IllegalStateException("MyWrapper must be parameterized") val successBodyType = getParameterUpperBound(0, containerType) val errorBodyType = getParameterUpperBound(1, containerType) val errorBodyConverter = retrofit.nextResponseBodyConverter&lt;Any&gt;( null, errorBodyType, annotations ) return MyWrapperAdapter&lt;Any, Any&gt;(successBodyType, errorBodyConverter) } return null } </code></pre> <p><strong>Adapter</strong></p> <pre><code>class MyWrapperAdapter&lt;T : Any&gt;( private val successBodyType: Type ) : CallAdapter&lt;T, MyWrapper&lt;T&gt;&gt; { override fun adapt(call: Call&lt;T&gt;): MyWrapper&lt;T&gt; { return try { call.execute().toMyWrapper&lt;T&gt;() } catch (e: IOException) { e.toNetworkErrorWrapper() } } override fun responseType(): Type = successBodyType } </code></pre> <pre><code>runBlocking { val user: MyWrapper&lt;User&gt; = service.getUser() } </code></pre> <p>Everything works as expected using this implementation, but just before the result of the network call is delivered to the <code>user</code> variable, I get the following error:</p> <pre><code>java.lang.ClassCastException: com.myproject.MyWrapper cannot be cast to retrofit2.Call at retrofit2.HttpServiceMethod$SuspendForBody.adapt(HttpServiceMethod.java:185) at retrofit2.HttpServiceMethod.invoke(HttpServiceMethod.java:132) at retrofit2.Retrofit$1.invoke(Retrofit.java:149) at com.sun.proxy.$Proxy6.getText(Unknown Source) ... </code></pre> <p>From Retrofit's source, here is the piece of code at <code>HttpServiceMethod.java:185</code>:</p> <pre class="lang-java prettyprint-override"><code> @Override protected Object adapt(Call&lt;ResponseT&gt; call, Object[] args) { call = callAdapter.adapt(call); // ERROR OCCURS HERE //noinspection unchecked Checked by reflection inside RequestFactory. Continuation&lt;ResponseT&gt; continuation = (Continuation&lt;ResponseT&gt;) args[args.length - 1]; return isNullable ? KotlinExtensions.awaitNullable(call, continuation) : KotlinExtensions.await(call, continuation); } </code></pre> <p>I'm not sure how to handle this error. Is there a way to fix?</p>
0debug
static int rso_read_packet(AVFormatContext *s, AVPacket *pkt) { int bps = av_get_bits_per_sample(s->streams[0]->codec->codec_id); int ret = av_get_packet(s->pb, pkt, BLOCK_SIZE * bps >> 3); if (ret < 0) return ret; pkt->stream_index = 0; pkt->size = ret; return 0; }
1threat
select an element in an array depending of another element in the array : <p>I've the following array and I would like to select the <strong>tier</strong> and the <strong>rank</strong> of the array <strong>where queueType is equal to RANKED_FLEX_TT</strong> or RANKED_SOLO_5x5 or RANKED_FLEX_SR. How do I do this? I cannot do the following to select the RANKED_SOLO_5x5 as the array is displayed randomly. That is to say sometimes the queueType RANKED_SOLO_5x5 will be in the array [1] or in the array [2] and not always in the array [0]. So I cannot simply do this to find the tier and the rank where queueType is equal to RANKED_SOLO_5x5:</p> <pre><code>&lt;?php echo $r1[0]["tier"].' '.$r1[0]["rank"]; ?&gt; </code></pre> <p>Here is an example of the array:</p> <pre><code>Array ( [0] =&gt; Array ( [leagueName] =&gt; Anivia's Hunters [tier] =&gt; GOLD [queueType] =&gt; RANKED_SOLO_5x5 [rank] =&gt; IV [playerOrTeamId] =&gt; 19302018 [playerOrTeamName] =&gt; AlLeXaNDeR [leaguePoints] =&gt; 55 [wins] =&gt; 198 [losses] =&gt; 185 [veteran] =&gt; 1 [inactive] =&gt; [freshBlood] =&gt; [hotStreak] =&gt; ) [1] =&gt; Array ( [leagueName] =&gt; Yorick's Warmongers [tier] =&gt; GOLD [queueType] =&gt; RANKED_FLEX_TT [rank] =&gt; V [playerOrTeamId] =&gt; 19302018 [playerOrTeamName] =&gt; AlLeXaNDeR [leaguePoints] =&gt; 0 [wins] =&gt; 21 [losses] =&gt; 13 [veteran] =&gt; [inactive] =&gt; [freshBlood] =&gt; 1 [hotStreak] =&gt; ) [2] =&gt; Array ( [leagueName] =&gt; Yorick's Rageborn [tier] =&gt; SILVER [queueType] =&gt; RANKED_FLEX_SR [rank] =&gt; II [playerOrTeamId] =&gt; 19302018 [playerOrTeamName] =&gt; AlLeXaNDeR [leaguePoints] =&gt; 100 [wins] =&gt; 61 [losses] =&gt; 56 [veteran] =&gt; 1 [inactive] =&gt; [freshBlood] =&gt; [hotStreak] =&gt; [miniSeries] =&gt; Array ( [target] =&gt; 2 [wins] =&gt; 1 [losses] =&gt; 1 [progress] =&gt; LWN ) ) ) </code></pre>
0debug
Simple math in a string (Java) : This is what I have :` final EditText Pikkus = (EditText)findViewById(R.id.editText); final EditText Laius = (EditText)findViewById(R.id.editText3); final TextView pindala1 = (TextView)findViewById(R.id.editText2); final TextView ymbermoot1 = (TextView)findViewById(R.id.textView5); ImageButton button = (ImageButton)findViewById(R.id.teisenda); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String pindala2 = "" + Integer.parseInt(Pikkus.getText().toString()) * Integer.parseInt(Laius.getText().toString()); pindala1.setText(pindala2); String ymbermoot2 = "" + Integer.parseInt(Pikkus.getText().toString()) + Integer.parseInt(Laius.getText().toString()) ymbermoot1.setText(ymbermoot2); } }); }` But the `String ymbermoot2 = "" + Integer.parseInt(Pikkus.getText().toString()) + Integer.parseInt(Laius.getText().toString()) ymbermoot1.setText(ymbermoot2);`part doesn't work like its supposed to. Instead of adding up the values, it simply types them together. Example: integer Pikkus is 26, Laius is 23. The value should end up being 49, but my code somehow makes it to up to be 2623. Where's the mistake in the code?
0debug
void cpu_outl(pio_addr_t addr, uint32_t val) { LOG_IOPORT("outl: %04"FMT_pioaddr" %08"PRIx32"\n", addr, val); trace_cpu_out(addr, val); ioport_write(2, addr, val); }
1threat
static uint16_t qpci_spapr_io_readw(QPCIBus *bus, void *addr) { QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus); uint64_t port = (uintptr_t)addr; uint16_t v; if (port < s->pio.size) { v = readw(s->pio_cpu_base + port); } else { v = readw(s->mmio_cpu_base + port); } return bswap16(v); }
1threat
static void put_bool(QEMUFile *f, void *pv, size_t size) { bool *v = pv; qemu_put_byte(f, *v); }
1threat
Are there some open translation data (include reference data and candidate data )to calculate BLEU score? : <p>Are there are some open machine translation data include candidate and reference data for calculating BLEU scores. 100 rows data of candidate and reference data are ok for me to implement BLEU in python. Thanks! </p>
0debug
How to lunch my laravel project in another port : command line error : php artisan serve --port=8002 does not work It gives me an error like this. [Symfony\Component\Debug\Exception\FatalThrowableError] parse error: syntax error, unexpected '/' expecting, ',' or ';'
0debug
CDI object not proxyable with injected constructor : <p>When trying to inject arguments into the constructor of a CDI bean (ApplicationScoped), I'm encountering the following issue:</p> <pre><code>Caused by: org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001435: Normal scoped bean class xx.Config is not proxyable because it has no no-args constructor - Managed Bean [class xx.Config] with qualifiers [@Default @Named @Any]. at org.jboss.weld.bean.proxy.DefaultProxyInstantiator.validateNoargConstructor(DefaultProxyInstantiator.java:50) at org.jboss.weld.util.Proxies.getUnproxyableClassException(Proxies.java:217) at org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:178) </code></pre> <p>However, I do have an injectable constructor on the class:</p> <pre><code>@Inject public Config(ConfigLocator configLocator) { defaultConfigPath = configLocator.getPath(); doStuff(); } </code></pre> <p>With a default constructor, variable injection and a postconstruct method, this all works fine, but I'd prefer the constructor injection in this case.</p> <p>Any thoughts what is going wrong here?</p>
0debug
Run custom shell script with CMake : <p>I am having the following directory structure:</p> <pre><code>/CMakeLists.txt /component-a/CMakeLists.txt /... /component-b/CMakeLists.txt /... /doc/CMakeLists.txt /create-doc.sh </code></pre> <p>The shell script <code>create-doc.sh</code> creates a documentation file (<code>doc.pdf</code>). How can I use CMake to execute this shell script at build time and copy the file <code>doc.pdf</code> to the build directory?</p> <p>I tried it by using <code>add_custom_command</code> in the <code>CMakeLists.txt</code> file inside the directory <code>doc</code>:</p> <pre><code>add_custom_command ( OUTPUT doc.pdf COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/create-doc.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/) </code></pre> <p>Unfortunately the command is never run.</p> <p>I also tried <code>execute_process</code>:</p> <pre><code>execute_process ( COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/create-doc.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ ) </code></pre> <p>Now the script is executed during the configuration phase, but not at build time.</p>
0debug
How to trigger a JavaScript function with php : <p>Ok so I have a PHP document wich saves the contents of a text input how do I trigger a function in a .js file when it's done . I've done the part with the uploading I just can't figure out how to trigger the js function</p>
0debug
How to send post parameters dynamically (or in loop) in OKHTTP 3.x in android? : <p>I am using OKHTTP 3.x version. I want to post multiple parameters and would like to add the params in a loop. I know that in version 2.x , I can use FormEncodingBuilder and add params to it in loop and then from it create a request body. But In 3.x , the class has been removed.</p> <p>Here is my current code :</p> <pre><code>RequestBody formBody = new FormBody.Builder() .add("Param1", value1) .add("Param2", value2) .build(); Request request = new Request.Builder() .url("url") .post(formBody) .build(); </code></pre> <p>Now I want to add 5 params but in a loop i.e create request body by building formbody in a loop. Like I wrote above, I know how to do it in OKHTTP version 2.x but I am using version 3.x.</p> <p>Any help or guidance is appreciated.</p> <p>Thanks in Advance</p>
0debug
How to create a new pointer to a derived class which type is unknown at compile time in C++? : <p>I have a code where there are some pointers to derived classes of the same base class. At one point I need to create another pointer to one of this derived classes, but I don't know at compile time to which class it will point to. Here an example of the code:</p> <pre><code>#include &lt;iostream&gt; using namespace std; class Polygon { protected: int width, height; public: void set_values (int a, int b) { width=a; height=b; }; virtual int area() = 0; }; class Rectangle: public Polygon { public: int area() { return width*height; } }; class Triangle: public Polygon { public: int area() { return width*height/2; } }; int main () { Rectangle* rect = new Rectangle; Triangle* trgl = new Triangle; Polygon* ppoly; trgl-&gt;set_values (4,5); ppoly = trgl; cout &lt;&lt; ppoly-&gt;area() &lt;&lt; '\n'; trgl-&gt;set_values (8,5); cout &lt;&lt; ppoly-&gt;area() &lt;&lt; '\n'; return 0; } </code></pre> <p>Writing the code as above, 'ppoly' points to the same memory as trgl, so the 2 lines <code>cout &lt;&lt; ppoly-&gt;area() &lt;&lt; '\n'</code> print different results because I have changed width of the pointer <code>trgl</code>. In my codeI don't want this behaviour, but I would like that <code>ppoly</code> is a new pointer of the same type of <code>trgl</code>. I have tried to use <code>Polygon* ppoly = new Polygon</code>, but returns me an error at compile time: </p> <blockquote> <p>error: invalid new-expression of abstract class type 'Polygon'</p> </blockquote> <p>How can I correct the software?</p>
0debug
How can I draw lines with html, css and js : <p>I'm working on a Personal web project I need to draw lines from 2 inputs to a third one.</p> <p>How can I draw the lines (D in picture) using HTML, CSS and Js ?</p> <p><a href="https://i.stack.imgur.com/IC4eH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IC4eH.png" alt="enter image description here"></a></p> <p><strong>EDIT:</strong> Ths inputs can be inside div blocks.</p>
0debug
static int find_pte64(CPUPPCState *env, struct mmu_ctx_hash64 *ctx, ppc_slb_t *slb, target_ulong eaddr, int rwx) { hwaddr pteg_off, pte_offset; ppc_hash_pte64_t pte; uint64_t vsid, pageaddr, ptem; hwaddr hash; int segment_bits, target_page_bits; int ret; ret = -1; if (slb->vsid & SLB_VSID_B) { vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT_1T; segment_bits = 40; } else { vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT; segment_bits = 28; } target_page_bits = (slb->vsid & SLB_VSID_L) ? TARGET_PAGE_BITS_16M : TARGET_PAGE_BITS; ctx->key = !!(msr_pr ? (slb->vsid & SLB_VSID_KP) : (slb->vsid & SLB_VSID_KS)); pageaddr = eaddr & ((1ULL << segment_bits) - (1ULL << target_page_bits)); if (slb->vsid & SLB_VSID_B) { hash = vsid ^ (vsid << 25) ^ (pageaddr >> target_page_bits); } else { hash = vsid ^ (pageaddr >> target_page_bits); } ptem = (slb->vsid & SLB_VSID_PTEM) | ((pageaddr >> 16) & ((1ULL << segment_bits) - 0x80)); ret = -1; LOG_MMU("htab_base " TARGET_FMT_plx " htab_mask " TARGET_FMT_plx " hash " TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, hash); LOG_MMU("0 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=" TARGET_FMT_lx " ptem=" TARGET_FMT_lx " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, hash); pteg_off = (hash * HASH_PTEG_SIZE_64) & env->htab_mask; pte_offset = ppc_hash64_pteg_search(env, pteg_off, 0, ptem, &pte); if (pte_offset == -1) { LOG_MMU("1 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=" TARGET_FMT_lx " api=" TARGET_FMT_lx " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, ~hash); pteg_off = (~hash * HASH_PTEG_SIZE_64) & env->htab_mask; pte_offset = ppc_hash64_pteg_search(env, pteg_off, 1, ptem, &pte); } if (pte_offset != -1) { ret = pte64_check(ctx, pte.pte0, pte.pte1, rwx); LOG_MMU("found PTE at addr %08" HWADDR_PRIx " prot=%01x ret=%d\n", ctx->raddr, ctx->prot, ret); if (ppc_hash64_pte_update_flags(ctx, &pte.pte1, ret, rwx) == 1) { ppc_hash64_store_hpte1(env, pte_offset, pte.pte1); } } if (target_page_bits != TARGET_PAGE_BITS) { ctx->raddr |= (eaddr & ((1 << target_page_bits) - 1)) & TARGET_PAGE_MASK; } return ret; }
1threat
sql querry- BEGGINERS- NEED HELP FOR sCHOOL : [enter image description here][1] Id Parinte Angajator 1 Parinte1 Firma1 2 Parinte2 Firma2 3 Parinte3 Firma3 Id Copil Data_Nastere Id_Parinte Data_creare 1 Copil1 10.01.2013 1 2 Copil2 11.11.2012 1 3 Copil3 10.10.2013 2 4 Copil4 12.11.2013 2 I have these 2 tables (1st let's say table1 and 2nd table2) I need to do the follwings operations on these 2 tables for a project tomorrow! If anyone could help, would be much appreciated! I need em in querry so I can copy paste it for project! 1.Show all from "Parinti" that have "Angajator" as "Firma1" 2.Show all from "Copil" that have "Parinte1" 3.Update the field "Data_creare" from table2 with current date for "Copil" that have "Parent1" 4.Delete all from "Copil" that have "Data_Naster" = 10.01.2013 5.last I need to sort the values from table2 column "Copil" ascending ascending depending of field "Data_nastere" **Better use Image link to see the 2 tabs** [1]: http://i.stack.imgur.com/yHp3G.jpg
0debug
void acpi_setup(PcGuestInfo *guest_info) { AcpiBuildTables tables; AcpiBuildState *build_state; if (!guest_info->fw_cfg) { ACPI_BUILD_DPRINTF("No fw cfg. Bailing out.\n"); return; } if (!guest_info->has_acpi_build) { ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n"); return; } if (!acpi_enabled) { ACPI_BUILD_DPRINTF("ACPI disabled. Bailing out.\n"); return; } build_state = g_malloc0(sizeof *build_state); build_state->guest_info = guest_info; acpi_set_pci_info(); acpi_build_tables_init(&tables); acpi_build(build_state->guest_info, &tables); build_state->table_ram = acpi_add_rom_blob(build_state, tables.table_data, ACPI_BUILD_TABLE_FILE, ACPI_BUILD_TABLE_MAX_SIZE); assert(build_state->table_ram != RAM_ADDR_MAX); build_state->table_size = acpi_data_len(tables.table_data); build_state->linker_ram = acpi_add_rom_blob(build_state, tables.linker, "etc/table-loader", 0); build_state->linker_size = acpi_data_len(tables.linker); fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_TPMLOG_FILE, tables.tcpalog->data, acpi_data_len(tables.tcpalog)); if (guest_info->has_immutable_rsdp) { fw_cfg_add_file_callback(guest_info->fw_cfg, ACPI_BUILD_RSDP_FILE, acpi_build_update, build_state, tables.rsdp->data, acpi_data_len(tables.rsdp)); build_state->rsdp = tables.rsdp->data; } else { build_state->rsdp = qemu_get_ram_ptr( acpi_add_rom_blob(build_state, tables.rsdp, ACPI_BUILD_RSDP_FILE, 0) ); } qemu_register_reset(acpi_build_reset, build_state); acpi_build_reset(build_state); vmstate_register(NULL, 0, &vmstate_acpi_build, build_state); acpi_build_tables_cleanup(&tables, false); }
1threat
`React/RCTBridgeModule.h` file not found : <p>Getting this error while building a react-native iOS app on xcode.</p> <p><a href="https://i.stack.imgur.com/3stNm.png"><img src="https://i.stack.imgur.com/3stNm.png" alt="enter image description here"></a></p> <p>Started getting this error after npm install and rpm linking <a href="https://github.com/johanneslumpe/react-native-fs">react-native-fs</a> library. But after searching online for a solution, I noticed that many people are getting the same error while installing other react native libraries.</p> <p>A <strong>possible solution</strong> suggested by many is, Adding the following under "Build Settings" -> "Header Search Paths".</p> <p><code>$(SRCROOT)/../node_modules/react-native/React</code> - (Recursive)</p> <p>But no luck with this solution, still getting the same error</p>
0debug
IndexOutOfRangeException on for loop with enough content on list : I currently have a project that takes every x number of seconds (using Timer and a 10000 milliseconds Interval) the events happening on Windows and filters them under certain conditions. Each time the Timer does Tick, date and hour corresponding to 10 seconds before (due to the Interval) the moment events are checked, and the next method is executed: // Method that returns wanted events from an EventLogEntryCollection private List<EventLogEntry> lastEvents(EventLogEntryCollection eventsList, DateTime minimumMoment) { // Wanted events list // 4624: Login // 4634: Logout long[] events = new long[] { 4624, 4634 }; // Table to return with valid events List<EventLogEntry> filteredEventsList = new List<EventLogEntry>(); // Checking if there are events to filter if (eventsList.Count > 0) { // There are events to filter // Going across all events to filter for (int i = 0; i < eventsList.Count; i++) { // Getting the current event EventLogEntry event = listaEventos[i]; // Line with exception // Checking if the current event happened in the last 10 seconds (due to the Interval) if (event.TimeGenerated >= minimumMoment) { // The event is valid time wise // Checking if the event's ID is contained in the required ID's list if (events.Contains(event.InstanceId)) { // The event has a valid ID // Adding the event to the list filteredEventsList.Add(event); } } } } // Returning obtained list return filteredEventsList; } That event obtains a list of all events (obtained by using EventLog.Entries) and the date and time an event has to have to get added to the filtered events list (so an event had to be generated 10 seconds ago to be 'accepted'). But, during eventsList iterating, an OutOfRangeException is generated being i on the first test around 28000 and on the second test 43, and the Count property around 31000 in both tests. ¿Is anyone able to tell me why this happens? Here is a screenshot of the exception data (it is in Spanish, sorry): [IndexOutOfRange exception data][1] [1]: https://i.stack.imgur.com/KDVLI.png
0debug
av_cold int ff_wma_init(AVCodecContext *avctx, int flags2) { WMACodecContext *s = avctx->priv_data; int i; float bps1, high_freq; volatile float bps; int sample_rate1; int coef_vlc_table; if (avctx->sample_rate <= 0 || avctx->sample_rate > 50000 || avctx->channels <= 0 || avctx->channels > 2 || avctx->bit_rate <= 0) return -1; ff_fmt_convert_init(&s->fmt_conv, avctx); avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); if (avctx->codec->id == AV_CODEC_ID_WMAV1) s->version = 1; else s->version = 2; s->frame_len_bits = ff_wma_get_frame_len_bits(avctx->sample_rate, s->version, 0); s->next_block_len_bits = s->frame_len_bits; s->prev_block_len_bits = s->frame_len_bits; s->block_len_bits = s->frame_len_bits; s->frame_len = 1 << s->frame_len_bits; if (s->use_variable_block_len) { int nb_max, nb; nb = ((flags2 >> 3) & 3) + 1; if ((avctx->bit_rate / avctx->channels) >= 32000) nb += 2; nb_max = s->frame_len_bits - BLOCK_MIN_BITS; if (nb > nb_max) nb = nb_max; s->nb_block_sizes = nb + 1; } else s->nb_block_sizes = 1; s->use_noise_coding = 1; high_freq = avctx->sample_rate * 0.5; sample_rate1 = avctx->sample_rate; if (s->version == 2) { if (sample_rate1 >= 44100) sample_rate1 = 44100; else if (sample_rate1 >= 22050) sample_rate1 = 22050; else if (sample_rate1 >= 16000) sample_rate1 = 16000; else if (sample_rate1 >= 11025) sample_rate1 = 11025; else if (sample_rate1 >= 8000) sample_rate1 = 8000; } bps = (float) avctx->bit_rate / (float) (avctx->channels * avctx->sample_rate); s->byte_offset_bits = av_log2((int) (bps * s->frame_len / 8.0 + 0.5)) + 2; bps1 = bps; if (avctx->channels == 2) bps1 = bps * 1.6; if (sample_rate1 == 44100) { if (bps1 >= 0.61) s->use_noise_coding = 0; else high_freq = high_freq * 0.4; } else if (sample_rate1 == 22050) { if (bps1 >= 1.16) s->use_noise_coding = 0; else if (bps1 >= 0.72) high_freq = high_freq * 0.7; else high_freq = high_freq * 0.6; } else if (sample_rate1 == 16000) { if (bps > 0.5) high_freq = high_freq * 0.5; else high_freq = high_freq * 0.3; } else if (sample_rate1 == 11025) high_freq = high_freq * 0.7; else if (sample_rate1 == 8000) { if (bps <= 0.625) high_freq = high_freq * 0.5; else if (bps > 0.75) s->use_noise_coding = 0; else high_freq = high_freq * 0.65; } else { if (bps >= 0.8) high_freq = high_freq * 0.75; else if (bps >= 0.6) high_freq = high_freq * 0.6; else high_freq = high_freq * 0.5; } av_dlog(s->avctx, "flags2=0x%x\n", flags2); av_dlog(s->avctx, "version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n", s->version, avctx->channels, avctx->sample_rate, avctx->bit_rate, avctx->block_align); av_dlog(s->avctx, "bps=%f bps1=%f high_freq=%f bitoffset=%d\n", bps, bps1, high_freq, s->byte_offset_bits); av_dlog(s->avctx, "use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n", s->use_noise_coding, s->use_exp_vlc, s->nb_block_sizes); { int a, b, pos, lpos, k, block_len, i, j, n; const uint8_t *table; if (s->version == 1) s->coefs_start = 3; else s->coefs_start = 0; for (k = 0; k < s->nb_block_sizes; k++) { block_len = s->frame_len >> k; if (s->version == 1) { lpos = 0; for (i = 0; i < 25; i++) { a = ff_wma_critical_freqs[i]; b = avctx->sample_rate; pos = ((block_len * 2 * a) + (b >> 1)) / b; if (pos > block_len) pos = block_len; s->exponent_bands[0][i] = pos - lpos; if (pos >= block_len) { i++; break; } lpos = pos; } s->exponent_sizes[0] = i; } else { table = NULL; a = s->frame_len_bits - BLOCK_MIN_BITS - k; if (a < 3) { if (avctx->sample_rate >= 44100) table = exponent_band_44100[a]; else if (avctx->sample_rate >= 32000) table = exponent_band_32000[a]; else if (avctx->sample_rate >= 22050) table = exponent_band_22050[a]; } if (table) { n = *table++; for (i = 0; i < n; i++) s->exponent_bands[k][i] = table[i]; s->exponent_sizes[k] = n; } else { j = 0; lpos = 0; for (i = 0; i < 25; i++) { a = ff_wma_critical_freqs[i]; b = avctx->sample_rate; pos = ((block_len * 2 * a) + (b << 1)) / (4 * b); pos <<= 2; if (pos > block_len) pos = block_len; if (pos > lpos) s->exponent_bands[k][j++] = pos - lpos; if (pos >= block_len) break; lpos = pos; } s->exponent_sizes[k] = j; } } s->coefs_end[k] = (s->frame_len - ((s->frame_len * 9) / 100)) >> k; s->high_band_start[k] = (int) ((block_len * 2 * high_freq) / avctx->sample_rate + 0.5); n = s->exponent_sizes[k]; j = 0; pos = 0; for (i = 0; i < n; i++) { int start, end; start = pos; pos += s->exponent_bands[k][i]; end = pos; if (start < s->high_band_start[k]) start = s->high_band_start[k]; if (end > s->coefs_end[k]) end = s->coefs_end[k]; if (end > start) s->exponent_high_bands[k][j++] = end - start; } s->exponent_high_sizes[k] = j; #if 0 tprintf(s->avctx, "%5d: coefs_end=%d high_band_start=%d nb_high_bands=%d: ", s->frame_len >> k, s->coefs_end[k], s->high_band_start[k], s->exponent_high_sizes[k]); for (j = 0; j < s->exponent_high_sizes[k]; j++) tprintf(s->avctx, " %d", s->exponent_high_bands[k][j]); tprintf(s->avctx, "\n"); #endif } } #ifdef TRACE { int i, j; for (i = 0; i < s->nb_block_sizes; i++) { tprintf(s->avctx, "%5d: n=%2d:", s->frame_len >> i, s->exponent_sizes[i]); for (j = 0; j < s->exponent_sizes[i]; j++) tprintf(s->avctx, " %d", s->exponent_bands[i][j]); tprintf(s->avctx, "\n"); } } #endif for (i = 0; i < s->nb_block_sizes; i++) { ff_init_ff_sine_windows(s->frame_len_bits - i); s->windows[i] = ff_sine_windows[s->frame_len_bits - i]; } s->reset_block_lengths = 1; if (s->use_noise_coding) { if (s->use_exp_vlc) s->noise_mult = 0.02; else s->noise_mult = 0.04; #ifdef TRACE for (i = 0; i < NOISE_TAB_SIZE; i++) s->noise_table[i] = 1.0 * s->noise_mult; #else { unsigned int seed; float norm; seed = 1; norm = (1.0 / (float) (1LL << 31)) * sqrt(3) * s->noise_mult; for (i = 0; i < NOISE_TAB_SIZE; i++) { seed = seed * 314159 + 1; s->noise_table[i] = (float) ((int) seed) * norm; } } #endif } coef_vlc_table = 2; if (avctx->sample_rate >= 32000) { if (bps1 < 0.72) coef_vlc_table = 0; else if (bps1 < 1.16) coef_vlc_table = 1; } s->coef_vlcs[0] = &coef_vlcs[coef_vlc_table * 2]; s->coef_vlcs[1] = &coef_vlcs[coef_vlc_table * 2 + 1]; init_coef_vlc(&s->coef_vlc[0], &s->run_table[0], &s->level_table[0], &s->int_table[0], s->coef_vlcs[0]); init_coef_vlc(&s->coef_vlc[1], &s->run_table[1], &s->level_table[1], &s->int_table[1], s->coef_vlcs[1]); return 0; }
1threat
When i try to check version of Sudo on Linux Live Server via SSH getting this kind of Error : I'm getting this error -bash: sudo: command not found while trying to check version of Sudo So guys here is the screenshot of it and let me know how to fix this issue thanks in advance !![screenshotofbasherror--bash: sudo: command not found ][1] [1]: https://i.stack.imgur.com/KYQC7.png
0debug
int qcow2_get_refcount(BlockDriverState *bs, int64_t cluster_index, uint64_t *refcount) { BDRVQcowState *s = bs->opaque; uint64_t refcount_table_index, block_index; int64_t refcount_block_offset; int ret; void *refcount_block; refcount_table_index = cluster_index >> s->refcount_block_bits; if (refcount_table_index >= s->refcount_table_size) { *refcount = 0; return 0; } refcount_block_offset = s->refcount_table[refcount_table_index] & REFT_OFFSET_MASK; if (!refcount_block_offset) { *refcount = 0; return 0; } if (offset_into_cluster(s, refcount_block_offset)) { qcow2_signal_corruption(bs, true, -1, -1, "Refblock offset %#" PRIx64 " unaligned (reftable index: %#" PRIx64 ")", refcount_block_offset, refcount_table_index); return -EIO; } ret = qcow2_cache_get(bs, s->refcount_block_cache, refcount_block_offset, &refcount_block); if (ret < 0) { return ret; } block_index = cluster_index & (s->refcount_block_size - 1); *refcount = s->get_refcount(refcount_block, block_index); ret = qcow2_cache_put(bs, s->refcount_block_cache, &refcount_block); if (ret < 0) { return ret; } return 0; }
1threat
static int mp3_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *st; int64_t off; st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_MP3; st->need_parsing = AVSTREAM_PARSE_FULL; st->start_time = 0; ff_id3v1_read(s); ff_id3v2_read(s); off = url_ftell(s->pb); if (mp3_parse_vbr_tags(s, st, off) < 0) url_fseek(s->pb, off, SEEK_SET); return 0; }
1threat