problem
stringlengths
26
131k
labels
class label
2 classes
int qemu_paio_ioctl(struct qemu_paiocb *aiocb) { return qemu_paio_submit(aiocb, QEMU_PAIO_IOCTL); }
1threat
How use the real Floating Action Button (FAB) Extended? : <p>To remove any doubts or thoughts about duplicate: on <a href="https://material.io/design/components/buttons-floating-action-button.html#extended-fab" rel="noreferrer">Material Design</a> is defined what is "extended".</p> <p><a href="https://i.stack.imgur.com/R4nL2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/R4nL2.png" alt="FAB - Extended FAB"></a></p> <p>But most of the people confuses "extended" with "<a href="https://material.io/design/components/buttons-floating-action-button.html#types-of-transitions" rel="noreferrer">Type of Transition: Speed Dial</a>", what make hard to find solutions. Like <a href="https://stackoverflow.com/questions/35497274/extended-android-floating-button">here</a></p> <p><a href="https://i.stack.imgur.com/pUb12.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pUb12.png" alt="FAB - Type of Transition: Speed Dial"></a></p> <p><strong>Question</strong> So what I'm looking forward is how setup the FAB with text and a extended size.</p> <p>Today my code is like this:</p> <pre><code>&lt;android.support.design.widget.FloatingActionButton android:id="@+id/maps_main_distance_btn" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="@string/str_distance_btn" app:elevation="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /&gt; </code></pre> <p>But my button look like this: </p> <p><a href="https://i.stack.imgur.com/xbuFk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xbuFk.png" alt="enter image description here"></a></p> <p>No text and no right format. I'm using it in a Constraint Layout.</p>
0debug
void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts, int *duration) { int64_t out_pts = AV_NOPTS_VALUE; int removed_samples = 0; int i; if (afq->frame_count || afq->frame_alloc) { if (afq->frames->pts != AV_NOPTS_VALUE) out_pts = afq->frames->pts; } if(!afq->frame_count) av_log(afq->avctx, AV_LOG_WARNING, "Trying to remove %d samples, but que empty\n", nb_samples); if (pts) *pts = ff_samples_to_time_base(afq->avctx, out_pts); for(i=0; nb_samples && i<afq->frame_count; i++){ int n= FFMIN(afq->frames[i].duration, nb_samples); afq->frames[i].duration -= n; nb_samples -= n; removed_samples += n; if(afq->frames[i].pts != AV_NOPTS_VALUE) afq->frames[i].pts += n; } i -= i && afq->frames[i-1].duration; memmove(afq->frames, afq->frames + i, sizeof(*afq->frames) * (afq->frame_count - i)); afq->frame_count -= i; if(nb_samples){ av_assert0(!afq->frame_count); if(afq->frames[0].pts != AV_NOPTS_VALUE) afq->frames[0].pts += nb_samples; av_log(afq->avctx, AV_LOG_DEBUG, "Trying to remove %d more samples than are in the que\n", nb_samples); } if (duration) *duration = ff_samples_to_time_base(afq->avctx, removed_samples); }
1threat
static int ast_probe(AVProbeData *p) { if (AV_RL32(p->buf) == MKTAG('S','T','R','M') && AV_RB16(p->buf + 10) && AV_RB16(p->buf + 12) && AV_RB32(p->buf + 16)) return AVPROBE_SCORE_MAX / 3 * 2; return 0; }
1threat
static int is_allocated_sectors(const uint8_t *buf, int n, int *pnum) { int v, i; if (n <= 0) { *pnum = 0; return 0; } v = is_not_zero(buf, 512); for(i = 1; i < n; i++) { buf += 512; if (v != is_not_zero(buf, 512)) break; } *pnum = i; return v; }
1threat
static av_cold int decode_init(AVCodecContext *avctx) { ASV1Context *const a = avctx->priv_data; const int scale = avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2; int i; if (avctx->extradata_size < 1) { av_log(avctx, AV_LOG_ERROR, "No extradata provided\n"); return AVERROR_INVALIDDATA; } ff_asv_common_init(avctx); ff_blockdsp_init(&a->bdsp, avctx); ff_idctdsp_init(&a->idsp, avctx); init_vlcs(a); ff_init_scantable(a->idsp.idct_permutation, &a->scantable, ff_asv_scantab); avctx->pix_fmt = AV_PIX_FMT_YUV420P; a->inv_qscale = avctx->extradata[0]; if (a->inv_qscale == 0) { av_log(avctx, AV_LOG_ERROR, "illegal qscale 0\n"); if (avctx->codec_id == AV_CODEC_ID_ASV1) a->inv_qscale = 6; else a->inv_qscale = 10; } for (i = 0; i < 64; i++) { int index = ff_asv_scantab[i]; a->intra_matrix[i] = 64 * scale * ff_mpeg1_default_intra_matrix[index] / a->inv_qscale; } return 0; }
1threat
mysql - Design a tables layouts for a web application : Hi everybody and sorry for my english. Let's say for example that I have to organize these informations: books, books editions and colors of every page of each edition (I know it sounds stupid but it's for the example). Let's assume that a book can have only one edition, and that since the application is written in PHP, every table will have its set of functions to read and write on them, and I'd like to keep it simple if possible. I can't decide if it's best to do: **Books** bookid author **Editions** editionid bookid title publisher isbn **PagesColors** editionid page color or trying to simplify in: **Books** bookid bookidreference author title publisher isbn **PagesColors** bookid page color and records like this: 1, 0, "Jane Austen", null, null, null 2, 1, null, "Emma", "Books Enterprise", 12231231213 3, 1, null, "Emma in Italian", "Jane Austen Italian Editions", 45345354334 and so on. Thank you.
0debug
How to Avoid printing duplicate special characters in string? : <p>I have a String which includes special characters. and i want to print them but not the duplicate ones.</p> <pre><code>Input String s="&amp;*$%) )_@*% &amp;)(((" Ouput ="&amp;*$%)_@(" </code></pre>
0debug
Comparing ENUMS : <p>I am trying to write some code about a farm. The farm has different types of animals, described as Enums. I want to write a comparator that would compare the animals and tell which one is bigger. How could I manually tell him Cow is bigger than a dog, if these two have no parameters that could be compared to? for ex. there is no Cow.size=10, Dog.size=2, so if we compare the size we get the bigger. I just have ENUMS, and I want tell my comparator that if it compares a cow and a dog the cow is bigger. I have read online that the interface <strong>Comparable </strong> is very useful for this, but I couldn`t understand, how could I implement it on my case. </p> <p>Thanks in advance.</p>
0debug
Getting unencoded data from Google cloud Pub/Sub instead of base64 : <p>I'm attempting to use the Python library for Pub/Sub, but I keep getting this error: <code>TypeError: Incorrect padding</code>. Some quick googling revealed this issue: <a href="https://github.com/GoogleCloudPlatform/google-cloud-python/pull/2527" rel="nofollow">https://github.com/GoogleCloudPlatform/google-cloud-python/pull/2527</a></p> <p>However, this doesn't resolve the issue - in fact, printing out the data revealed that the data was not even base64 encoded at all, and setting <code>data = raw_data</code> in the library resolved the issue.</p> <p>We're sending the message from Java, here is the code we're using:</p> <pre><code>PCollection&lt;String&gt; userActionsJson = userActionsRaw.apply(ParDo.of(new BigQueryRowToJson())); String topicNameFull = "projects/" + options.getProject() + "/topics/" + options.getUsersActionsTopicName() + "-" + options.getProduct(); userActionsJson.apply(PubsubIO.Write.named("PublishToPubSub") .topic(topicNameFull)); </code></pre> <p>however, the same thing happens attempting to send a message through the console.</p> <p>Has something changed recently to mean that data is no longer base64 encoded?</p>
0debug
static int vnc_auth_sasl_check_ssf(VncState *vs) { const void *val; int err, ssf; if (!vs->sasl.wantSSF) return 1; err = sasl_getprop(vs->sasl.conn, SASL_SSF, &val); if (err != SASL_OK) return 0; ssf = *(const int *)val; VNC_DEBUG("negotiated an SSF of %d\n", ssf); if (ssf < 56) return 0; vs->sasl.runSSF = 1; return 1; }
1threat
import local file to google colab : <p>I don't understand how colab works with directories, I created a notebook, and colab put it in /Google Drive/Colab Notebooks.</p> <p>Now I need to import a file (data.py) where I have a bunch of functions I need. Intuition tells me to put the file in that same directory and import it with:</p> <p>import data</p> <p>but apparently that's not the way...</p> <p>I also tried adding the directory to the set of paths but I am specifying the directory incorrectly..</p> <p>Can anyone help with this?</p> <p>Thanks in advance!</p>
0debug
python print inside vs outside function? : <p>the below code had previously printed the fibonnacci using for loop at end. I moved the print inside the function and then called it but no fibonacci nubers were printed out in spite of the print within the function. Shouldnt they be?</p> <pre><code> def fibon(n): a = b = 1 for i in range(n): yield a a, b = b, a + b print(a) # move here inside function but doesnt print? fibon(20) </code></pre> <p>old code works as:</p> <pre><code> for x in fibon(100): print(x) </code></pre>
0debug
static uint64_t imx_ccm_read(void *opaque, target_phys_addr_t offset, unsigned size) { IMXCCMState *s = (IMXCCMState *)opaque; DPRINTF("read(offset=%x)", offset >> 2); switch (offset >> 2) { case 0: DPRINTF(" ccmr = 0x%x\n", s->ccmr); return s->ccmr; case 1: DPRINTF(" pdr0 = 0x%x\n", s->pdr0); return s->pdr0; case 2: DPRINTF(" pdr1 = 0x%x\n", s->pdr1); return s->pdr1; case 4: DPRINTF(" mpctl = 0x%x\n", s->mpctl); return s->mpctl; case 6: DPRINTF(" spctl = 0x%x\n", s->spctl); return s->spctl; case 8: DPRINTF(" cgr0 = 0x%x\n", s->cgr[0]); return s->cgr[0]; case 9: DPRINTF(" cgr1 = 0x%x\n", s->cgr[1]); return s->cgr[1]; case 10: DPRINTF(" cgr2 = 0x%x\n", s->cgr[2]); return s->cgr[2]; case 18: return 0x00004040; case 23: DPRINTF(" pcmr0 = 0x%x\n", s->pmcr0); return s->pmcr0; } DPRINTF(" return 0\n"); return 0; }
1threat
JUnit5 parameterized tests at class level : <p>Is it possible to use JUnit5's parameterized new features to run test classes to receive test parameters instead of doing it at method level?</p> <p>With JUnit 4 a runner such as <code>@RunWith(Parameterized::class)</code> plus inheritance could be used to pass an array of parameters to subclasses, but I am not sure if it is possible to achieve something equivalent but using the new JUnit 5 api.</p>
0debug
Perl, Show Password after Click : I'm a absolute beginner with Perl, I have a table with 7 columns, one of it contains passwords (pw) I dont want to show the passwords plain on that website, I would like to have a some kind of "click to expand" in taht table for every password to show it. Hope someone can help... Here is a part of that Script which contains the table: .... push @certlist, { state => $cert[0], 'expire' => $date, 'subject' => $cert[5], 'cn' => $cn, 'ip' => $ccd_ips->{$cn}, 'dl' => '', 're' => '', 'pw' => $password->{$cn}}; ... return $q->table({'class' => 'certs' }, $q->Tr( [ $q->th(['Status', 'Common Name','D','Password','Ablaufdatum', 'Subject', 'IP-Adresse', 'R'])."\n", map { $q->td( { 'class' => $_->{'state'} }, $states{$_->{'state'}} ). $q->td([@$_{qw(cn dl pw expire subject ip re)} ])."\n" } @certlist ] ))."\n"; .....
0debug
merging multiple workbooks into single sheet in current workbook using VBA : I need VBA code to select multiple workbooks by browsing the files and then merge all those into 1sheet of current workbook. All multiple workbooks having only 1 sheet headers is same for all workbooks so header is constant Merging should not get any empty rows while filling workbook by workbook No repetition of headers when merging. When 1st workbook merging is done, 2nd workbook data should be merged in the same sheet of current workbook exactly next row of the merged 1st workbook data ends which means no empty rows or gaps
0debug
void qemu_fflush(QEMUFile *f) { if (!f->is_writable) return; if (f->buf_index > 0) { if (f->is_file) { fseek(f->outfile, f->buf_offset, SEEK_SET); fwrite(f->buf, 1, f->buf_index, f->outfile); } else { bdrv_pwrite(f->bs, f->base_offset + f->buf_offset, f->buf, f->buf_index); } f->buf_offset += f->buf_index; f->buf_index = 0; } }
1threat
Convert PHP Code Block (fsockopen, fputs, feof, fgets) into C# : <p>I need someone to convert this php code block into equivalent C#. We are working on MT4 to register user via asp.net web application. We have been given the php version of the site to post the user information. every things is setup accordingly. however the following code block need to be converted. I tried to search online solution but could not find any documentation thanks.</p> <pre><code>function MQ_Query($query) { $ret='error'; //---- open socket $ptr=@fsockopen(T_MT4_HOST,T_MT4_PORT,$errno,$errstr,5); //---- check connection if($ptr) { //---- send request if(fputs($ptr,"W$query\nQUIT\n")!=FALSE) { //---- clear default answer $ret=''; //---- receive answer while(!feof($ptr)) { $line=fgets($ptr,128); if($line=="end\r\n") break; $ret.= $line; } } fclose($ptr); } //---- return answer return $ret; } </code></pre> <p>please </p>
0debug
static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp) { AssignedDevice *dev = PCI_ASSIGN(pci_dev); PCIRegion *pci_region = dev->real_device.regions; int ret, pos; pci_set_byte(pci_dev->config + PCI_CAPABILITY_LIST, 0); pci_set_word(pci_dev->config + PCI_STATUS, pci_get_word(pci_dev->config + PCI_STATUS) & ~PCI_STATUS_CAP_LIST); pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_MSI, 0); if (pos != 0 && kvm_check_extension(kvm_state, KVM_CAP_ASSIGN_DEV_IRQ)) { if (verify_irqchip_in_kernel(errp) < 0) { return -ENOTSUP; } dev->dev.cap_present |= QEMU_PCI_CAP_MSI; dev->cap.available |= ASSIGNED_DEVICE_CAP_MSI; ret = pci_add_capability(pci_dev, PCI_CAP_ID_MSI, pos, 10, errp); if (ret < 0) { return ret; } pci_dev->msi_cap = pos; pci_set_word(pci_dev->config + pos + PCI_MSI_FLAGS, pci_get_word(pci_dev->config + pos + PCI_MSI_FLAGS) & PCI_MSI_FLAGS_QMASK); pci_set_long(pci_dev->config + pos + PCI_MSI_ADDRESS_LO, 0); pci_set_word(pci_dev->config + pos + PCI_MSI_DATA_32, 0); pci_set_word(pci_dev->wmask + pos + PCI_MSI_FLAGS, PCI_MSI_FLAGS_QSIZE | PCI_MSI_FLAGS_ENABLE); pci_set_long(pci_dev->wmask + pos + PCI_MSI_ADDRESS_LO, 0xfffffffc); pci_set_word(pci_dev->wmask + pos + PCI_MSI_DATA_32, 0xffff); } pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_MSIX, 0); if (pos != 0 && kvm_device_msix_supported(kvm_state)) { int bar_nr; uint32_t msix_table_entry; uint16_t msix_max; if (verify_irqchip_in_kernel(errp) < 0) { return -ENOTSUP; } dev->dev.cap_present |= QEMU_PCI_CAP_MSIX; dev->cap.available |= ASSIGNED_DEVICE_CAP_MSIX; ret = pci_add_capability(pci_dev, PCI_CAP_ID_MSIX, pos, 12, errp); if (ret < 0) { return ret; } pci_dev->msix_cap = pos; msix_max = (pci_get_word(pci_dev->config + pos + PCI_MSIX_FLAGS) & PCI_MSIX_FLAGS_QSIZE) + 1; msix_max = MIN(msix_max, KVM_MAX_MSIX_PER_DEV); pci_set_word(pci_dev->config + pos + PCI_MSIX_FLAGS, msix_max - 1); pci_set_word(pci_dev->wmask + pos + PCI_MSIX_FLAGS, PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL); msix_table_entry = pci_get_long(pci_dev->config + pos + PCI_MSIX_TABLE); bar_nr = msix_table_entry & PCI_MSIX_FLAGS_BIRMASK; msix_table_entry &= ~PCI_MSIX_FLAGS_BIRMASK; dev->msix_table_addr = pci_region[bar_nr].base_addr + msix_table_entry; dev->msix_table_size = msix_max * sizeof(MSIXTableEntry); dev->msix_max = msix_max; } pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_PM, 0); if (pos) { uint16_t pmc; ret = pci_add_capability(pci_dev, PCI_CAP_ID_PM, pos, PCI_PM_SIZEOF, errp); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, PCI_PM_SIZEOF); pmc = pci_get_word(pci_dev->config + pos + PCI_CAP_FLAGS); pmc &= (PCI_PM_CAP_VER_MASK | PCI_PM_CAP_DSI); pci_set_word(pci_dev->config + pos + PCI_CAP_FLAGS, pmc); pci_set_word(pci_dev->config + pos + PCI_PM_CTRL, PCI_PM_CTRL_NO_SOFT_RESET); pci_set_byte(pci_dev->config + pos + PCI_PM_PPB_EXTENSIONS, 0); pci_set_byte(pci_dev->config + pos + PCI_PM_DATA_REGISTER, 0); } pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_EXP, 0); if (pos) { uint8_t version, size = 0; uint16_t type, devctl, lnksta; uint32_t devcap, lnkcap; version = pci_get_byte(pci_dev->config + pos + PCI_EXP_FLAGS); version &= PCI_EXP_FLAGS_VERS; if (version == 1) { size = 0x14; } else if (version == 2) { size = MIN(0x3c, PCI_CONFIG_SPACE_SIZE - pos); if (size < 0x34) { error_setg(errp, "Invalid size PCIe cap-id 0x%x", PCI_CAP_ID_EXP); return -EINVAL; } else if (size != 0x3c) { error_report("WARNING, %s: PCIe cap-id 0x%x has " "non-standard size 0x%x; std size should be 0x3c", __func__, PCI_CAP_ID_EXP, size); } } else if (version == 0) { uint16_t vid, did; vid = pci_get_word(pci_dev->config + PCI_VENDOR_ID); did = pci_get_word(pci_dev->config + PCI_DEVICE_ID); if (vid == PCI_VENDOR_ID_INTEL && did == 0x10ed) { size = 0x3c; } } if (size == 0) { error_setg(errp, "Unsupported PCI express capability version %d", version); return -EINVAL; } ret = pci_add_capability(pci_dev, PCI_CAP_ID_EXP, pos, size, errp); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, size); type = pci_get_word(pci_dev->config + pos + PCI_EXP_FLAGS); type = (type & PCI_EXP_FLAGS_TYPE) >> 4; if (type != PCI_EXP_TYPE_ENDPOINT && type != PCI_EXP_TYPE_LEG_END && type != PCI_EXP_TYPE_RC_END) { error_setg(errp, "Device assignment only supports endpoint " "assignment, device type %d", type); return -EINVAL; } devcap = pci_get_long(pci_dev->config + pos + PCI_EXP_DEVCAP); devcap &= ~PCI_EXP_DEVCAP_FLR; pci_set_long(pci_dev->config + pos + PCI_EXP_DEVCAP, devcap); devctl = pci_get_word(pci_dev->config + pos + PCI_EXP_DEVCTL); devctl = (devctl & (PCI_EXP_DEVCTL_READRQ | PCI_EXP_DEVCTL_PAYLOAD)) | PCI_EXP_DEVCTL_RELAX_EN | PCI_EXP_DEVCTL_NOSNOOP_EN; pci_set_word(pci_dev->config + pos + PCI_EXP_DEVCTL, devctl); devctl = PCI_EXP_DEVCTL_BCR_FLR | PCI_EXP_DEVCTL_AUX_PME; pci_set_word(pci_dev->wmask + pos + PCI_EXP_DEVCTL, ~devctl); pci_set_word(pci_dev->config + pos + PCI_EXP_DEVSTA, 0); lnkcap = pci_get_long(pci_dev->config + pos + PCI_EXP_LNKCAP); lnkcap &= (PCI_EXP_LNKCAP_SLS | PCI_EXP_LNKCAP_MLW | PCI_EXP_LNKCAP_ASPMS | PCI_EXP_LNKCAP_L0SEL | PCI_EXP_LNKCAP_L1EL); pci_set_long(pci_dev->config + pos + PCI_EXP_LNKCAP, lnkcap); lnksta = pci_get_word(pci_dev->config + pos + PCI_EXP_LNKSTA); lnksta &= (PCI_EXP_LNKSTA_CLS | PCI_EXP_LNKSTA_NLW); pci_set_word(pci_dev->config + pos + PCI_EXP_LNKSTA, lnksta); if (version >= 2) { pci_set_long(pci_dev->config + pos + PCI_EXP_SLTCAP, 0); pci_set_word(pci_dev->config + pos + PCI_EXP_SLTCTL, 0); pci_set_word(pci_dev->config + pos + PCI_EXP_SLTSTA, 0); pci_set_word(pci_dev->config + pos + PCI_EXP_RTCTL, 0); pci_set_word(pci_dev->config + pos + PCI_EXP_RTCAP, 0); pci_set_long(pci_dev->config + pos + PCI_EXP_RTSTA, 0); } } pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_PCIX, 0); if (pos) { uint16_t cmd; uint32_t status; ret = pci_add_capability(pci_dev, PCI_CAP_ID_PCIX, pos, 8, errp); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, 8); cmd = pci_get_word(pci_dev->config + pos + PCI_X_CMD); cmd &= (PCI_X_CMD_DPERR_E | PCI_X_CMD_ERO | PCI_X_CMD_MAX_READ | PCI_X_CMD_MAX_SPLIT); pci_set_word(pci_dev->config + pos + PCI_X_CMD, cmd); status = pci_get_long(pci_dev->config + pos + PCI_X_STATUS); status &= ~(PCI_X_STATUS_BUS | PCI_X_STATUS_DEVFN); status |= pci_get_bdf(pci_dev); status &= ~(PCI_X_STATUS_SPL_DISC | PCI_X_STATUS_UNX_SPL | PCI_X_STATUS_SPL_ERR); pci_set_long(pci_dev->config + pos + PCI_X_STATUS, status); } pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_VPD, 0); if (pos) { ret = pci_add_capability(pci_dev, PCI_CAP_ID_VPD, pos, 8, errp); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, 8); assigned_dev_direct_config_write(dev, pos + 2, 6); } for (pos = 0; (pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_VNDR, pos)); pos += PCI_CAP_LIST_NEXT) { uint8_t len = pci_get_byte(pci_dev->config + pos + PCI_CAP_FLAGS); ret = pci_add_capability(pci_dev, PCI_CAP_ID_VNDR, pos, len, errp); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, len); assigned_dev_direct_config_write(dev, pos + 2, len - 2); } if ((pci_get_word(pci_dev->config + PCI_STATUS) & PCI_STATUS_CAP_LIST) != (assigned_dev_pci_read_byte(pci_dev, PCI_STATUS) & PCI_STATUS_CAP_LIST)) { dev->emulate_config_read[PCI_STATUS] |= PCI_STATUS_CAP_LIST; } return 0; }
1threat
static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len) { MpegTSContext *ts = filter->u.section_filter.opaque; MpegTSSectionFilter *tssf = &filter->u.section_filter; SectionHeader h1, *h = &h1; const uint8_t *p, *p_end; int sid, pmt_pid; AVProgram *program; av_log(ts->stream, AV_LOG_TRACE, "PAT:\n"); hex_dump_debug(ts->stream, section, section_len); p_end = section + section_len - 4; p = section; if (parse_section_header(h, &p, p_end) < 0) return; if (h->tid != PAT_TID) return; if (ts->skip_changes) return; if (h->version == tssf->last_ver) return; tssf->last_ver = h->version; ts->stream->ts_id = h->id; clear_programs(ts); for (;;) { sid = get16(&p, p_end); if (sid < 0) break; pmt_pid = get16(&p, p_end); if (pmt_pid < 0) break; pmt_pid &= 0x1fff; if (pmt_pid == ts->current_pid) break; av_log(ts->stream, AV_LOG_TRACE, "sid=0x%x pid=0x%x\n", sid, pmt_pid); if (sid == 0x0000) { } else { MpegTSFilter *fil = ts->pids[pmt_pid]; program = av_new_program(ts->stream, sid); if (program) { program->program_num = sid; program->pmt_pid = pmt_pid; } if (fil) if ( fil->type != MPEGTS_SECTION || fil->pid != pmt_pid || fil->u.section_filter.section_cb != pmt_cb) mpegts_close_filter(ts, ts->pids[pmt_pid]); if (!ts->pids[pmt_pid]) mpegts_open_section_filter(ts, pmt_pid, pmt_cb, ts, 1); add_pat_entry(ts, sid); add_pid_to_pmt(ts, sid, 0); add_pid_to_pmt(ts, sid, pmt_pid); } } if (sid < 0) { int i,j; for (j=0; j<ts->stream->nb_programs; j++) { for (i = 0; i < ts->nb_prg; i++) if (ts->prg[i].id == ts->stream->programs[j]->id) break; if (i==ts->nb_prg && !ts->skip_clear) clear_avprogram(ts, ts->stream->programs[j]->id); } } }
1threat
Check matches between two file bash : I've two files like this (but with milion of colums) **File1.txt** some_key1 some_text1 some_key2 some_text2 ... some_keyn some_textn **File1.txt** some_key11 some_key11 some_text1 some_key22 some_key22 some_text2 ... some_keynn some_keynn some_textn In this two files there's some some_text that matches. I want to know some_key, some keynn some_keynn and some_text. Maybe printing the output in one file like ` *somescript* >> result.txt` Is it possible to do in bash?
0debug
Converting 13 decimals to datetime C++ : I have a project about cars with GPS. I need to return the start and the finish moment for each car. Please help me! So we have : time_t x, y; Because I will use later them for a transformation. I have a problem! I read from an external file data in this format: auto1 1439467747492 auto1 1439467748512 ......etc. auto1->name of the car; 1439467747492->the moment in time of the car I tried to get the first position of the first moment and the last moment for each car. This is the code in C++: void raportDistanta(/**/, long long momenti[], long long momentf[]) n=m=1; if (g.is_open()) { //momenti,momentf---arrays type long long because a moment has 13 digits //momenti=saves the start moments for each car //momentf=saves the final moments for each car momenti[n++] = a[0].getMoment(); for (i = 0; i < nr - 1; i++) { if (strcmp(a[i].getnume(), a[i + 1].getnume()) == 0) { //here i try to get the distance between two points. The car in the moment i and i+1 // I failed doing that...I don't transform the latitude and longitude properly and I get bad numbers. anyway.... } else { //Here I put momenti[n++] = a[i + 1].getMoment(); momentf[m++] = a[i].getMoment(); } } momentf[m++] = a[nr1].getMoment(); After this i do in main something like that: ** x = momenti[choice1] / 1000; y = momentf[choice1] / 1000; cout << " Moment i:\n " << ctime(&x) << " Moment final: \n" << ctime(&y) << endl; I receive the same date for every car. Is something like momenti[i]=momentf[i] What I did wrong? Thanks!
0debug
What is the difference between “||” and “or” in C++? : <p>What is the difference between "||" and "or"?</p> <pre><code>a = false || true; b = false or true; </code></pre>
0debug
Select a string between two characters in a loop in sql server : I have sql column which contains the value like "[157;#10 - S1 Pawl Cap],[168;#11 - S2 Two],[180;#11 - S2 TwoB],[153;#11-H3 Snowboard],[173;#12 - Fishing (CA Surf Casting)],[155;#12 - Fishing (Colorado)],[162;#12 - H3 Snow],[164;#12 - Internal Mono/Silver L5],[158;#12 - L5 Bike],[163;#12 - L5 Casual],[156;#12 - L5 Kids],[174;#12 - Nordic],[159;#12 - S2 Snap In Bike],[160;#12 - S2 Snap In Casual],[161;#12 - Treksta EX735],[185;#13 - 2nd Taste of Boa - External Test],[170;#13 - Fishing],[176;#13 - Gaerne Moto],[188;#13 - IP1 - FT 1 Bike and Run],[177;#13 - IP1 - FT 2 Bike],[178;#13 - IP1 - FT 2 Running],[154;#13 - Mono Stage 1 - Filament 2 Running],[175;#13 - Mono Stage 2 - Filament 3 Casual],[169;#13 - Mono Stage 2 - Filament 3 Running],[184;#13 - Retrofit Day - 4/5/13 Internal Test],[165;#13 - Vasque Open Race],[191;#13 - Winter HP88],[181;#13 - Winter NER],[192;#13 - Winter Webbing],[190;#13 - Zonal 1],[205;#14 - Cassowary],[207;#14 - DC Motocross Project],[204;#14 - Fishing (HP88SW)],[197;#14 - Golden Eagle],[198;#14 - Golf Pants Catching],[179;#14 - GOLF Test],[200;#14 - IP1 Agro Road Bike],[202;#14 - IP1 FT3],[182;#14 - L6 FT1],[193;#14 - L6 FT2],[183;#14 - Landscaping (Utility)],[195;#14 - No Sew Guides],[210;#14 - PC Replacement],[167;#14 - Running Suite FT ZERO],[166;#14 - Specialized Suite],[201;#14 - Track Spike],[203;#14 - Winter Snow],[216;#15 - American Football],[213;#15 - Boa Kids],[196;#15 - Cassowary],[212;#15 - Golf (IP1 Heel)],[215;#15 - L5 Running No Sew],[211;#15 - L6 No Sew],[208;#15 - L6 T1 Shots],[209;#15 - Mountaineering EMEA],[186;#15 - Redwing Utility Test],[187;#15 - Run Suite FT2],[206;#15 - Running NC722 Color],[217;#15 - S2-S No-Sew],[219;#15 - Snowboard],[221;#16 - Fit Lab],[225;#16 - Golf TX],[222;#16 - Internal FormTX],[228;#16 - OBG Snow],[227;#16 - OG Running],[194;#16 - OG Trail],[224;#16 - PVDF Lace],[214;#16 - Run Suite FT2 Two],[171;#16 - S3 Bike],[223;#16 - Summer Snow],[218;#16 - Trudel Fit Test],[226;#16 - TX5 Utility],[220;#16 - Unbranded Running],[189;#16 - Winter Snow],[199;#17 - M4],[172;#17 - S3 FT2]". I would like to select all the repeated values between '[' and ';'. From the above i would like to select 157,168 and so on.
0debug
Best way to call a function at specific timestamp : <p>I want to call a function when System timestamp reaches to specific time. is there anyway better than a CountDownTimer ? It should be called on a service because i want it still run when app closes.</p> <p>thanks a lot.</p>
0debug
validation function error , 'length' of undefined : var ClassSignUpValidation = function (){}; ClassSignUpValidation.prototype.CheckName = function (_target) { return false; } ClassSignUpValidation.prototype.CheckPassword = function (_target) { return false; } //SUBMIT FORM VALIDATION ClassSignUpValidation.prototype.SubmitForm = function (event) { var sumbit_errorspan = $("#submit-errorResult"); //array validation function var validators = [this.CheckName, this.CheckPassword]; // bypass all function var valid = validators.reduce(function(valid, validator){ return validator() && valid; }, true); if(valid){ sumbit_errorspan.html(''); }else{ sumbit_errorspan.css('color', 'red'); sumbit_errorspan.html('sumbit not requirements.'); } return valid; } i am making a validation function , submitForm function is to check other function return value true or false , but i have this error , i dont know why. error Uncaught TypeError: Cannot read property 'length' of undefined
0debug
Deploy a GitHub branch using heroku CLI : <p>I want to do this action: <a href="https://i.stack.imgur.com/UEo2a.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UEo2a.png" alt="enter image description here"></a></p> <p>using Heroku CLI.</p> <p>If I have the remote git on my computer I can do <code>git push my-heroku-remote master</code></p> <p>But because my heroku app is already connected to the git project, I find this approach redundant.</p> <p>Any ideas?</p>
0debug
Please help in query optimization : Please help in query optimization. I have one table which contains some members and their card. There are 3 unique type of cards i.e. ADIB, ADCB & NBAD. One person may have more than one card & also one person may have more than one type of card i.e 2 ADIB cards. Below is my query, please optimise: create table #cobrand(grp_number nvarchar(12), partner varchar(5)) insert into #cobrand select distinct c_grp_number grp_number, 'NBAD' partner from partnership_cards c where partner_name = 'NBAD' and not exists (select grp_number from #cobrand t where c.c_grp_number = t.grp_number) insert into #cobrand select distinct c_grp_number grp_number, 'ADIB' partner from partnership_cards c where partner_name = 'ADIB' and not exists (select grp_number from #cobrand t where c.c_grp_number = t.grp_number) insert into #cobrand select distinct c_grp_number grp_number, 'ADCB' partner from partnership_cards c where partner_name = 'ADCB' and not exists (select grp_number from #cobrand t where c.c_grp_number = t.grp_number) Thanks in advance, Nishant
0debug
sdhci_writefn(void *opaque, hwaddr off, uint64_t val, unsigned sz) { SDHCIState *s = (SDHCIState *)opaque; SDHCI_GET_CLASS(s)->mem_write(s, off, val, sz); }
1threat
static av_cold int libschroedinger_decode_init(AVCodecContext *avctx) { SchroDecoderParams *p_schro_params = avctx->priv_data; schro_init(); schro_debug_set_level(avctx->debug); p_schro_params->decoder = schro_decoder_new(); schro_decoder_set_skip_ratio(p_schro_params->decoder, 1); if (!p_schro_params->decoder) return -1; ff_schro_queue_init(&p_schro_params->dec_frame_queue); return 0; }
1threat
Why is copy O(n) when most hash table operations are O(1) : <p>A dict is essentially a hash table, most of whose operations are in O(1). And yet Copy is in O(n). Why?</p>
0debug
static inline int decode_subframe(FLACContext *s, int channel) { int type, wasted = 0; int i, tmp; s->curr_bps = s->bps; if (channel == 0) { if (s->decorrelation == RIGHT_SIDE) s->curr_bps++; } else { if (s->decorrelation == LEFT_SIDE || s->decorrelation == MID_SIDE) s->curr_bps++; } if (s->curr_bps > 32) { ff_log_missing_feature(s->avctx, "decorrelated bit depth > 32", 0); return -1; } if (get_bits1(&s->gb)) { av_log(s->avctx, AV_LOG_ERROR, "invalid subframe padding\n"); return -1; } type = get_bits(&s->gb, 6); if (get_bits1(&s->gb)) { wasted = 1; while (!get_bits1(&s->gb)) wasted++; s->curr_bps -= wasted; } if (type == 0) { tmp = get_sbits_long(&s->gb, s->curr_bps); for (i = 0; i < s->blocksize; i++) s->decoded[channel][i] = tmp; } else if (type == 1) { for (i = 0; i < s->blocksize; i++) s->decoded[channel][i] = get_sbits_long(&s->gb, s->curr_bps); } else if ((type >= 8) && (type <= 12)) { if (decode_subframe_fixed(s, channel, type & ~0x8) < 0) return -1; } else if (type >= 32) { if (decode_subframe_lpc(s, channel, (type & ~0x20)+1) < 0) return -1; } else { av_log(s->avctx, AV_LOG_ERROR, "invalid coding type\n"); return -1; } if (wasted) { int i; for (i = 0; i < s->blocksize; i++) s->decoded[channel][i] <<= wasted; } return 0; }
1threat
Convert Sql-Server DateTime to M/D/Y Format : <p>I want to convert a sql-server dateTime variable to MDY format. <br>Here is what it looks like : <br><br> 2016-12-30 21:34:56.840 <br><br> I would like it to look like : 12/30/2016</p>
0debug
What database to use for a C# desktop application : <p>I want to create a C# desktop application, the application must be used in different computers. I want a database to connect to remotely since my application will in different computers.</p>
0debug
read data from excel file using symfony4 : <p>I have been creating web application using symfony4, I want to read data from excel file.</p> <p>when I install the bundle liuggio/ExcelBundle, I get the error: </p> <p><code>Installation request for liuggio/excelbundle ^2.1 -&gt; satisfiable by liuggio/ExcelBundle[v2.1.0].</code></p>
0debug
static void bitband_writel(void *opaque, target_phys_addr_t offset, uint32_t value) { uint32_t addr; uint32_t mask; uint32_t v; addr = bitband_addr(opaque, offset) & ~3; mask = (1 << ((offset >> 2) & 31)); mask = tswap32(mask); cpu_physical_memory_read(addr, (uint8_t *)&v, 4); if (value & 1) v |= mask; else v &= ~mask; cpu_physical_memory_write(addr, (uint8_t *)&v, 4); }
1threat
void do_subfzeo_64 (void) { T1 = T0; T0 = ~T0 + xer_ca; if (likely(!(((uint64_t)~T1 ^ UINT64_MAX) & ((uint64_t)(~T1) ^ (uint64_t)T0) & (1ULL << 63)))) { xer_ov = 0; } else { xer_ov = 1; xer_so = 1; } if (likely((uint64_t)T0 >= (uint64_t)~T1)) { xer_ca = 0; } else { xer_ca = 1; } }
1threat
static int hls_start(AVFormatContext *s) { HLSContext *c = s->priv_data; AVFormatContext *oc = c->avf; int err = 0; if (c->wrap) c->number %= c->wrap; if (av_get_frame_filename(oc->filename, sizeof(oc->filename), c->basename, c->number++) < 0) return AVERROR(EINVAL); if ((err = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL)) < 0) return err; if (oc->oformat->priv_class && oc->priv_data) av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0); return 0; }
1threat
void fork_end(int child) { mmap_fork_end(child); if (child) { CPUState *cpu, *next_cpu; CPU_FOREACH_SAFE(cpu, next_cpu) { if (cpu != thread_cpu) { QTAILQ_REMOVE(&cpus, cpu, node); } } qemu_mutex_init(&tb_ctx.tb_lock); qemu_init_cpu_list(); gdbserver_fork(thread_cpu); } else { qemu_mutex_unlock(&tb_ctx.tb_lock); cpu_list_unlock(); } }
1threat
sql grouping and sum claims totals : i am new in sql, I am trying to group the following CLAIM # LINE SEQ AMNT BILLED AMOUNT ALLOWED AMOUNT PAID COPAY LA123456 1 20 18 15 3 LA123456 2 10 5 5 0 LA123456 3 50 30 30 0 MS123456 1 20 18 15 3 MS123456 2 10 5 5 0 MS123456 3 50 30 30 0 I am expecting to see something like this CLAIM # AMOUNT BILLED AMOUNT ALLOWED AMOUNT PAID COPAY LA123456 80 53 50 3 MS123456 80 53 50 3 Any advise on how to do it?
0debug
static void virtio_blk_handle_flush(BlockRequest *blkreq, int *num_writes, VirtIOBlockReq *req) { BlockDriverAIOCB *acb; if (*num_writes > 0) { do_multiwrite(req->dev->bs, blkreq, *num_writes); } *num_writes = 0; acb = bdrv_aio_flush(req->dev->bs, virtio_blk_flush_complete, req); if (!acb) { virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); } }
1threat
how to write a java code to copy a table in excel ten times one below another : `.` Lets say that i have an excel file which has a table and i need this table copied 10 times one below another in the same worksheet. How do i develop this program in java ?
0debug
Implementing timer Javascript - Trivia Game : <p>I've written up a Trivia Game in Javascript, but am having a hard time understanding how to correctly implement a timer for each question. I've made it so that each question gets presented individually, and I'd like to have a timer for each question. If the timer runs out, it should proceed to the next question. </p> <p>Here is a <code>link</code> to <a href="https://jsfiddle.net/qyhkv7e4/" rel="nofollow">JSFiddle</a> </p> <p>If someone could take a few minutes and modify the JSFiddle, or let me know what I'd have to do in order to make each question count down from 10, I'd greatly appreciate it. Thanks a lot!</p>
0debug
how to get the firstname and email from the JSON responce in IBMworklight : { "userId": 1, "userName": "username", "firstName": "firstname", "lastName": "lname", "middleInitial": null, "email": "nsk@gmail.com", "dob": -250666200000, "phoneNo": 2066628405, "workPhone": null, "mobileNo": 2036321543, "status": null, "address": null, "group": null }
0debug
Expected Semi Colon : <pre><code>&lt;?php 'doctrine' =&gt; [ 'meta' =&gt; [ 'entity_path' =&gt; [ 'app/src/Entity' ], 'auto_generate_proxies' =&gt; true, 'proxy_dir' =&gt; __DIR__.'/../cache/proxies', 'cache' =&gt; null, ], 'connection' =&gt; [ 'driver' =&gt; 'pdo_mysql', 'host' =&gt; 'localhost', 'dbname' =&gt; 'sano', 'user' =&gt; 'root', 'password' =&gt; 'root', ] ] </code></pre> <p>I have php file above. Error occure second line Expected Semi Colon. How can i solve this problem ?</p>
0debug
insufficient privileges using dbmd_sql : I have a PLSQL code using dbms_sql package. For example it starts with sequence creation. request:= 'CREATE SEQUENCE ' || utilisateur || '.' || 'seq_fusion_table MINVALUE 1 START WITH 1 INCREMENT BY 1'; dbms_sql.parse(curseur_ref, request, dbms_sql.native); response := dbms_sql.execute(curseur_ref); I have an error : ORA-01031: insufficient privileges I thought the user could not use dbms_sql so I sent this request : GRANT execute on DBMS_SQL to user; commit; And just to be sure I sent the creation request without using dbms_sql and indeed the user has the right to create sequences. What should I do to get rid of this insufficient privileges error ?
0debug
Why does TensorFlow's documentation call a softmax's input "logits"? : <p><a href="https://www.tensorflow.org/api_docs/python/tf/nn/softmax_cross_entropy_with_logits" rel="noreferrer">TensorFlow calls</a> each of the inputs to a softmax a logit. They go on to define the softmax's inputs/logits as: "Unscaled log probabilities."</p> <p><a href="https://en.wikipedia.org/wiki/Logit" rel="noreferrer">Wikipedia</a> and other sources say that a logit is the log of the odds, and the inverse of the sigmoid/logistic function. I.e., if sigmoid(x) = p(x), then logit( p(x) ) = log( p(x) / (1-p(x)) ) = x. </p> <p>Is there a mathematical or conventional reason for TensorFlow to call a softmax's inputs "logits"? Shouldn't they just be called "unscaled log probabilities"? </p> <p>Perhaps TensorFlow just wanted to keep the same variable name for binary logistic regression (where it makes sense to use the term logit) and categorical logistic regression...</p> <p>This question was <a href="https://stackoverflow.com/questions/34240703/difference-between-tensorflow-tf-nn-softmax-and-tf-nn-softmax-cross-entropy-with">covered a little bit here</a>, but no one seemed bothered by the use of the word "logit" to mean "unscaled log probability".</p>
0debug
static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; if ((uint64_t)atom.size > (1<<30)) return AVERROR_INVALIDDATA; if (st->codec->codec_id == AV_CODEC_ID_QDM2 || st->codec->codec_id == AV_CODEC_ID_QDMC) { av_free(st->codec->extradata); st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size; avio_read(pb, st->codec->extradata, atom.size); } else if (atom.size > 8) { int ret; if ((ret = mov_read_default(c, pb, atom)) < 0) return ret; } else avio_skip(pb, atom.size); return 0; }
1threat
static void exynos4210_uart_write(void *opaque, hwaddr offset, uint64_t val, unsigned size) { Exynos4210UartState *s = (Exynos4210UartState *)opaque; uint8_t ch; PRINT_DEBUG_EXTEND("UART%d: <0x%04x> %s <- 0x%08llx\n", s->channel, offset, exynos4210_uart_regname(offset), (long long unsigned int)val); switch (offset) { case ULCON: case UBRDIV: case UFRACVAL: s->reg[I_(offset)] = val; exynos4210_uart_update_parameters(s); break; case UFCON: s->reg[I_(UFCON)] = val; if (val & UFCON_Rx_FIFO_RESET) { fifo_reset(&s->rx); s->reg[I_(UFCON)] &= ~UFCON_Rx_FIFO_RESET; PRINT_DEBUG("UART%d: Rx FIFO Reset\n", s->channel); } if (val & UFCON_Tx_FIFO_RESET) { fifo_reset(&s->tx); s->reg[I_(UFCON)] &= ~UFCON_Tx_FIFO_RESET; PRINT_DEBUG("UART%d: Tx FIFO Reset\n", s->channel); } break; case UTXH: if (s->chr) { s->reg[I_(UTRSTAT)] &= ~(UTRSTAT_TRANSMITTER_EMPTY | UTRSTAT_Tx_BUFFER_EMPTY); ch = (uint8_t)val; qemu_chr_fe_write(s->chr, &ch, 1); #if DEBUG_Tx_DATA fprintf(stderr, "%c", ch); #endif s->reg[I_(UTRSTAT)] |= UTRSTAT_TRANSMITTER_EMPTY | UTRSTAT_Tx_BUFFER_EMPTY; s->reg[I_(UINTSP)] |= UINTSP_TXD; exynos4210_uart_update_irq(s); } break; case UINTP: s->reg[I_(UINTP)] &= ~val; s->reg[I_(UINTSP)] &= ~val; PRINT_DEBUG("UART%d: UINTP [%04x] have been cleared: %08x\n", s->channel, offset, s->reg[I_(UINTP)]); exynos4210_uart_update_irq(s); break; case UTRSTAT: case UERSTAT: case UFSTAT: case UMSTAT: case URXH: PRINT_DEBUG("UART%d: Trying to write into RO register: %s [%04x]\n", s->channel, exynos4210_uart_regname(offset), offset); break; case UINTSP: s->reg[I_(UINTSP)] &= ~val; break; case UINTM: s->reg[I_(UINTM)] = val; exynos4210_uart_update_irq(s); break; case UCON: case UMCON: default: s->reg[I_(offset)] = val; break; } }
1threat
int pcie_cap_init(PCIDevice *dev, uint8_t offset, uint8_t type, uint8_t port) { int pos; uint8_t *exp_cap; assert(pci_is_express(dev)); pos = pci_add_capability(dev, PCI_CAP_ID_EXP, offset, PCI_EXP_VER2_SIZEOF); if (pos < 0) { return pos; } dev->exp.exp_cap = pos; exp_cap = dev->config + pos; pcie_cap_v1_fill(exp_cap, port, type, PCI_EXP_FLAGS_VER2); pci_set_long(exp_cap + PCI_EXP_DEVCAP2, PCI_EXP_DEVCAP2_EFF | PCI_EXP_DEVCAP2_EETLPP); pci_set_word(dev->wmask + pos + PCI_EXP_DEVCTL2, PCI_EXP_DEVCTL2_EETLPPB); return pos; }
1threat
import re def road_rd(street): return (re.sub('Road$', 'Rd.', street))
0debug
static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb, void *dst, const int type) { int i, j, count = 0; int last, t; int A, S, T; int pos = s->pos; uint32_t crc = s->sc.crc; uint32_t crc_extra_bits = s->extra_sc.crc; int16_t *dst16 = dst; int32_t *dst32 = dst; float *dstfl = dst; s->one = s->zero = s->zeroes = 0; do { T = wv_get_value(s, gb, 0, &last); S = 0; if (last) break; for (i = 0; i < s->terms; i++) { t = s->decorr[i].value; if (t > 8) { if (t & 1) A = 2 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]; else A = (3 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]) >> 1; s->decorr[i].samplesA[1] = s->decorr[i].samplesA[0]; j = 0; } else { A = s->decorr[i].samplesA[pos]; j = (pos + t) & 7; if (type != AV_SAMPLE_FMT_S16P) S = T + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10); else S = T + ((s->decorr[i].weightA * A + 512) >> 10); if (A && T) s->decorr[i].weightA -= ((((T ^ A) >> 30) & 2) - 1) * s->decorr[i].delta; s->decorr[i].samplesA[j] = T = S; pos = (pos + 1) & 7; crc = crc * 3 + S; if (type == AV_SAMPLE_FMT_FLTP) { *dstfl++ = wv_get_value_float(s, &crc_extra_bits, S); } else if (type == AV_SAMPLE_FMT_S32P) { *dst32++ = wv_get_value_integer(s, &crc_extra_bits, S); } else { *dst16++ = wv_get_value_integer(s, &crc_extra_bits, S); count++; } while (!last && count < s->samples); wv_reset_saved_context(s); if (s->avctx->err_recognition & AV_EF_CRCCHECK) { int ret = wv_check_crc(s, crc, crc_extra_bits); if (ret < 0 && s->avctx->err_recognition & AV_EF_EXPLODE) return ret; return 0;
1threat
Way to override flex property to manually set width of span in HTML : <p>I wanted to manually set a width of a span to make a circular highlight on an element. But even when I set the width of the span, it stretches up end to end</p> <p>Its parent has flex basis property</p> <pre><code>element.style { flex-basis: 14.2857%; max-width: 14.2857%; overflow: hidden; } </code></pre> <p>Child property</p> <pre><code>background: #006edc; color: white; height: 40px; /* width: 10px; */ -&gt; How to set the width text-align: center; vertical-align: middle; border-radius: 50%; </code></pre> <p>Thank you for your help</p>
0debug
Increase object names programatically C# : I have a textbox for data entry and 10 textboxes for showing datas. 10 viewer textboxes is visible=false by default.For example when i enter textbox count to "3" , only 3 textboxes should be visible. ( Then i can do whatever i want those textboxes) [Example][1] [1]: http://i.stack.imgur.com/J24ea.png
0debug
static int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias) { uint16_t weight_matrix[64] = {1,}; int qscale, i; CHECKED_ALLOCZ(ctx->qmatrix_l, (ctx->m.avctx->qmax+1) * 64 * sizeof(int)); CHECKED_ALLOCZ(ctx->qmatrix_c, (ctx->m.avctx->qmax+1) * 64 * sizeof(int)); CHECKED_ALLOCZ(ctx->qmatrix_l16, (ctx->m.avctx->qmax+1) * 64 * 2 * sizeof(uint16_t)); CHECKED_ALLOCZ(ctx->qmatrix_c16, (ctx->m.avctx->qmax+1) * 64 * 2 * sizeof(uint16_t)); for (i = 1; i < 64; i++) { int j = ctx->m.dsp.idct_permutation[ff_zigzag_direct[i]]; weight_matrix[j] = ctx->cid_table->luma_weight[i]; } ff_convert_matrix(&ctx->m.dsp, ctx->qmatrix_l, ctx->qmatrix_l16, weight_matrix, ctx->m.intra_quant_bias, 1, ctx->m.avctx->qmax, 1); for (i = 1; i < 64; i++) { int j = ctx->m.dsp.idct_permutation[ff_zigzag_direct[i]]; weight_matrix[j] = ctx->cid_table->chroma_weight[i]; } ff_convert_matrix(&ctx->m.dsp, ctx->qmatrix_c, ctx->qmatrix_c16, weight_matrix, ctx->m.intra_quant_bias, 1, ctx->m.avctx->qmax, 1); for (qscale = 1; qscale <= ctx->m.avctx->qmax; qscale++) { for (i = 0; i < 64; i++) { ctx->qmatrix_l [qscale] [i] <<= 2; ctx->qmatrix_c [qscale] [i] <<= 2; ctx->qmatrix_l16[qscale][0][i] <<= 2; ctx->qmatrix_l16[qscale][1][i] <<= 2; ctx->qmatrix_c16[qscale][0][i] <<= 2; ctx->qmatrix_c16[qscale][1][i] <<= 2; } } return 0; fail: return -1; }
1threat
How can i set the calender instance getTime value back to the date object? : <p>First i have written the Calender instance getTime method value to a file. now by reading the file i want to set that value as date object?</p> <p>Format of the data written to the file </p> <blockquote> <p>Wed Mar 29 18:54:53 IST 2017</p> </blockquote> <p>How can i do that?</p> <p>Thanks!!</p>
0debug
How can I count number of colums whose name starts with specifc words : In my python dataframe I have around 40 columns. Out of these 40 columns around 20 columns starts with `"Name_"` for example `"Name_History","Name_Language`" and remaining column starts with `"score_"` for example "Score_Math","Scor_Physisc". I would like to determine dynamically First & last index of columns starts with `"Name_"` . Can you expert please help me? Thanks in advance
0debug
PostgreSQL conditional where clause : <p>In my Ruby on Rails app I'm using blazer(<a href="https://github.com/ankane/blazer" rel="noreferrer">https://github.com/ankane/blazer</a>) and I have the following sql query:</p> <pre><code>SELECT * FROM survey_results sr LEFT JOIN clients c ON c.id = sr.client_id WHERE sr.client_id = {client_id} </code></pre> <p>This query works really well. But I need to add conditional logic to check if client_id variable is present. If yes then I filter by this variable, if not then I not launching this <code>where</code> clause. How can I do it in PostgreSQL?</p>
0debug
Advanced Dice game in C : <p>Before I post the code there are two things I should mention, 1 there is a text file that works in link with this code that I will post the few details in the post. 2, I'm nearly done with this project of mine so I'm only really focused on the topFive() function and the topWin() function. My issue though is when I try to get the top five players in this function it only prints out one name five times. I'd really appreciate any help, very stumped!</p> <p>Here are the players.txt file's contents followed by the code.</p> <pre><code>Peter 100 90 Emma 150 0 Richard 50 10 Abigail 138 128 Jacob 210 100 Anthony 800 -10 Joseph 328 62 Ashley 89 16 Hannah 197 7 Ethan 11 -20 #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; #include &lt;string.h&gt; typedef struct { char pl_name[10]; int balance; int wincount; } plyr; plyr pl[10]; plyr top[5]; int psearch(){ // finds the index of the name in the file int i; char name[20];//This creates the initial array that searches throughout the array for the users name variable identity. printf("Enter the user's name. "); scanf("%s", name); // This will ask the user for the name whos balance they are changing. for(i=0;i&lt;10;){ if (strcmp(&amp;name, pl[i].pl_name) == 0 ) break; i++; //This will continue the search. } return i; } void topBalance(){ // finds the top balance for 5 players int i; printf("What is the player name? "); scanf("%s", pl[i].pl_name); // This basically takes a users name and is ready to edit it. printf("What's the balance? "); scanf("%d", &amp;pl[i].balance); // This changes whatever name is enters balance to whatever it wants to change it to. } void playGame(){ //Needs correction. srand(time(0)); char enter = 'i'; int r1, r2, sum, point; int playerno = psearch(); char again = 'y'; while (playerno == 10) { // This ensures that there are only 10 players that are going to be searched throughout. printf("Players not found.\n"); playerno = psearch(); } while(again == 'y'){ for(;;) { printf("Press enter to roll the dice. "); getchar(); // This will continue the dice to be rolled past the original point of just one or two rolls while (enter != '\n') enter = getchar(); r1 = (rand() % 6) + 1; // This acts as the math of the function and it takes a random integer and divides it by 6 and takes the remainder by 1. r2 = (rand() % 6) + 1; sum = r1 + r2; printf("You got a %d and %d from the roll, the sum is %d. \n", r1, r2, sum); if(sum == 7 || sum == 11) { pl[playerno].balance += 10; pl[playerno].wincount += 10; printf("Your new balance is %d. \n", pl[playerno].balance); break; } else if(sum == 2 || sum == 3 || sum == 12){ pl[playerno].balance -= 1; // This is anoyher simple way to lose if the sum is only equal to 2 or 3. pl[playerno].wincount -= 1; printf("You lose with a balance of %d", pl[playerno].balance); break; // The basic loss variable in the play game function. } else { point = sum; printf("Your point is %d. Roll %d without rolling a 7 to win. \n", point, point); for(;;){ enter = 'i'; printf("Roll the dice.\n"); while (enter != '\n') // This is a while loop that basically makes sure that if the dice is equal to 0 then it can not be submitted. enter = getchar(); r1 = (rand() % 6) + 1; r2 = (rand() % 6) + 1; sum = r1 + r2; // Adds together the first and second random calculation above. printf("You rolled %d and %d to get %d. \n", r1, r2, sum); if(sum == point){ pl[playerno].balance += 10; pl[playerno].wincount += 10; printf("You win. New Balance is %d. \n", pl[playerno].balance); break; } else if(sum == 7){ pl[playerno].balance -= 1; pl[playerno].wincount -= 1; printf("You lose. New Bal is %d. \n", pl[playerno].balance); break; } else printf("Retry. \n"); } break; } } printf("Want to play again?"); scanf("%s", &amp;again); } } void topWin(){ int maxM, list, max1; for(int p = 0; p &lt; 5; p++) { maxM = 999999; //makes sure that the top maximum variable is a really high number in this loop, basically ensures that this loop will run as long as it doesn't go over 999999 for(int a = 0; a &lt; 10; a++){ list = 0; for(int t = 0; t &lt; 5; t++){ if(strcmp(top[t].pl_name, pl[a].pl_name) == 0) list = 1; } if (pl[a].balance &gt; maxM &amp;&amp; !list) { maxM = pl[a].wincount; max1 = a; } } top[p] = pl[max1]; } printf("\n"); for(int a = 0; a &lt; 5; a++) { printf("%s\t%d\n", top[a].pl_name, top[a].wincount); } } void topFive(){ int maxM, list, max1; for(int p = 0; p &lt; 5; p++) { maxM = 999999; //makes sure that the top maximum variable is a really high number in this loop, basically ensures that this loop will run as long as it doesn't go over 999999 for(int a = 0; a &lt; 10; a++){ list = 0; for(int t = 0; t &lt; 5; t++){ if(strcmp(top[t].pl_name, pl[a].pl_name) == 0) list = 1; } if (pl[a].balance &gt; maxM &amp;&amp; !list) { maxM = pl[a].wincount; max1 = a; } } top[p] = pl[max1]; } printf("\n"); for(int a = 0; a &lt; 5; a++) { printf("%s\t%d\n", top[a].pl_name, top[a].wincount); } } int main(){ int i = 0, ch; FILE *rp; FILE *wp; rp = fopen("players.txt", "r"); while(!feof(rp)){ fscanf(rp, "%s\t%d\t%d", pl[i].pl_name, &amp;pl[i].balance, &amp;pl[i].wincount); i++; } char name[10]; srand (time(NULL)); while (ch != 4) { printf("\n0. Top up your balance "); printf("\n1. Play Game!!! "); printf("\n2. Top 5 Players by Balance "); printf("\n3. Top 5 Winners! "); printf("\n4. Exit "); printf("\nWhat do you pick? "); scanf("%d", &amp;ch); // From here on, I need to create seperate functions for each of these then tie them into the menu!! switch(ch) { case 0: topBalance(); wp = fopen("players.txt", "w"); for(i = 0; i &lt; 10; i++) fprintf(wp, "%s\t%d\t%d\n", pl[i].pl_name, pl[i].balance, pl[i].wincount); fclose(wp); break; case 1: // Need to finish this and correct it! playGame(); wp = fopen("players.txt", "w"); for(i = 0; i &lt; 10; i++) fprintf(wp, "%s\t%d\t%d\n", pl[i].pl_name, pl[i].balance, pl[i].wincount); fclose(wp); break; case 2: // Segmentation Error topFive(); break; case 3: topWin(); break; case 4: break; break; } } } </code></pre>
0debug
unreliable result for checking incoming number in contact : i m using code listed here `http://stackoverflow.com/questions/26859338/check-incoming-number-is-stored-in-contacts-list-or-not-android` for checking whether incoming number exist or not in contacts. This code does not give correct result always. Is there some correction required in this or some other better way to check? Code: String res = null; try { ContentResolver resolver = ctx.getContentResolver(); Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber)); Cursor c = resolver.query(uri, new String[]{PhoneLookup.DISPLAY_NAME}, null, null, null); if (c != null) { // cursor not null means number is found contactsTable if (c.moveToFirst()) { // so now find the contact Name res = c.getString(c.getColumnIndex(CommonDataKinds.Phone.DISPLAY_NAME)); } c.close(); } } catch (Exception ex) { /* Ignore */ } return res;
0debug
void cpu_reset(CPUARMState *env) { uint32_t id; id = env->cp15.c0_cpuid; memset(env, 0, offsetof(CPUARMState, breakpoints)); if (id) cpu_reset_model_id(env, id); #if defined (CONFIG_USER_ONLY) env->uncached_cpsr = ARM_CPU_MODE_USR; env->vfp.xregs[ARM_VFP_FPEXC] = 1 << 30; #else env->uncached_cpsr = ARM_CPU_MODE_SVC | CPSR_A | CPSR_F | CPSR_I; if (IS_M(env)) env->uncached_cpsr &= ~CPSR_I; env->vfp.xregs[ARM_VFP_FPEXC] = 0; env->cp15.c2_base_mask = 0xffffc000u; #endif env->regs[15] = 0; tlb_flush(env, 1);
1threat
static uint64_t pxa2xx_i2c_read(void *opaque, hwaddr addr, unsigned size) { PXA2xxI2CState *s = (PXA2xxI2CState *) opaque; I2CSlave *slave; addr -= s->offset; switch (addr) { case ICR: return s->control; case ISR: return s->status | (i2c_bus_busy(s->bus) << 2); case ISAR: slave = I2C_SLAVE(s->slave); return slave->address; case IDBR: return s->data; case IBMR: if (s->status & (1 << 2)) s->ibmr ^= 3; else s->ibmr = 0; return s->ibmr; default: printf("%s: Bad register " REG_FMT "\n", __FUNCTION__, addr); break; } return 0; }
1threat
I can't Set UILable to nil in Swift : I have just started working with Swift. I have a table and I wanna Set it to nil so that I can use an action on it to change its text , right now without nil it shows "optional" text! @IBOutlet var nameLable: UILabel! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } @IBAction func helloworldaction(nameTextField: UITextField) { nameLable.text = "\(nameTextField.text)" } but it shows errors when I change it to this: @IBOutlet var nameLable: UILabel = nil what should I do??
0debug
I have a problem with wiringPi git clone.Could you tell me please. Thank you : my name is Tom and I'm a beginner in writing coding. Recommend me Now I can do not git clone Gordon. Can you tell me.About what I would do to do git clone wiringPi or is there any program instead of git clone.
0debug
Create mutiple files in multiple directories : <p>I 've got tree of folders like:</p> <pre><code>00 -- 0 -- 1 ... -- 9 ... 99 -- 0 -- 1 ... -- 9 </code></pre> <p>How is the simplest way to create in every single subfolders a file like: /00/0/00_0.txt and save to every files some kind of data?</p> <p>I tried with <strong>touch</strong> and with <strong>loop</strong> but without success. Any ideas how to make it very simple?</p>
0debug
What is the best way to format a currency value when the user is typing any amount of cash? : What is the best way to automatically format a currency value when the user is typing any amount of cash? For Example I have a TextBox, if the user types "30" it considers 0.30 if he types "300" it considers 3.00.
0debug
TableView get next row : <p>I have table of Audio(My type) <a href="http://i.stack.imgur.com/kJBOG.png" rel="nofollow">table</a></p> <p>I not understand how get next row after selected</p>
0debug
static int load_bitmap_data(BlockDriverState *bs, const uint64_t *bitmap_table, uint32_t bitmap_table_size, BdrvDirtyBitmap *bitmap) { int ret = 0; BDRVQcow2State *s = bs->opaque; uint64_t sector, sbc; uint64_t bm_size = bdrv_dirty_bitmap_size(bitmap); uint64_t bm_sectors = DIV_ROUND_UP(bm_size, BDRV_SECTOR_SIZE); uint8_t *buf = NULL; uint64_t i, tab_size = size_to_clusters(s, bdrv_dirty_bitmap_serialization_size(bitmap, 0, bm_sectors)); if (tab_size != bitmap_table_size || tab_size > BME_MAX_TABLE_SIZE) { return -EINVAL; } buf = g_malloc(s->cluster_size); sbc = sectors_covered_by_bitmap_cluster(s, bitmap); for (i = 0, sector = 0; i < tab_size; ++i, sector += sbc) { uint64_t count = MIN(bm_sectors - sector, sbc); uint64_t entry = bitmap_table[i]; uint64_t offset = entry & BME_TABLE_ENTRY_OFFSET_MASK; assert(check_table_entry(entry, s->cluster_size) == 0); if (offset == 0) { if (entry & BME_TABLE_ENTRY_FLAG_ALL_ONES) { bdrv_dirty_bitmap_deserialize_ones(bitmap, sector, count, false); } else { } } else { ret = bdrv_pread(bs->file, offset, buf, s->cluster_size); if (ret < 0) { goto finish; } bdrv_dirty_bitmap_deserialize_part(bitmap, buf, sector, count, false); } } ret = 0; bdrv_dirty_bitmap_deserialize_finish(bitmap); finish: g_free(buf); return ret; }
1threat
Hiding the status bar with React Native : <p>How do you hide the status bar for iOS or Android when developing with React Native? I've imported StatusBar, but I believe there is also StatusBarIOS and a StatusBar for Android.</p>
0debug
Checking if two values are approximately the same in python : <p>I have two functions which give me very small numbers. I want to define a <code>IF statements</code> in which If two values are <code>approximately</code> the same print them otherwise <code>pass</code></p> <pre><code>a = (x, y) b = (h, p) If a == b: print(a, b) else: pass </code></pre> <p>for this we cannot use <code>==</code>. How to define it to be close? Because the order of values maybe like <code>a=7e-25</code>, <code>b=1.5e-26</code></p>
0debug
How to convert this code in devexpress VCL for Delphi : <p>Hello I want to convert this code into VCL Delphi: </p> <pre><code> // Create an empty list. ArrayList rows = new ArrayList(); // Add the selected rows to the list. for (int i = 0; i &lt; gridView1.SelectedRowsCount; i++) { if (gridView1.GetSelectedRows()[i] &gt;= 0) rows.Add(gridView1.GetDataRow(gridView1.GetSelectedRows()[i])); } try { gridView1.BeginUpdate(); for (int i = 0; i &lt; rows.Count; i++) { DataRow row = rows[i] as DataRow; // Change the field value. row["Discontinued"] = true; } } finally { gridView1.EndUpdate(); } </code></pre> <p>I am trying to do the same but in VCL there is not SelectedRowsCount or GetSelectedRows where can I find thoughs?</p>
0debug
What Data Structure Does the C# Class "List" Default to? : <p>Is it an ArrayList? Or a LinkedList? If I don't specify and run:</p> <pre><code>List&lt;int&gt; x = new List&lt;int&gt;(10); </code></pre> <p>What is the type of list created?</p>
0debug
int nbd_client_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { NBDClientSession *client = nbd_get_client_session(bs); NBDRequest request = { .type = NBD_CMD_WRITE, .from = offset, .len = bytes, }; if (flags & BDRV_REQ_FUA) { assert(client->info.flags & NBD_FLAG_SEND_FUA); request.flags |= NBD_CMD_FLAG_FUA; } assert(bytes <= NBD_MAX_BUFFER_SIZE); return nbd_co_request(bs, &request, qiov); }
1threat
How do I make my window 10 PC an SMTP server? : I want to configure my window system as mail server,please let me if any body know how to configure windows 10 as mail server, I have ec2 window instance.
0debug
Count bits starting from the ones, then tens and so on : <p>Coding in C++.</p> <p>I'm trying to print out only a specified digit from a binary code in the form of a string. The user can specify a certain digit position, and the number in that position must be printed. </p> <p>Eg. string c = "11011001" and the user wants the 1st position. The output has to be 0.</p> <p>Count indices start at 0 and from the 'ones' digit meaning a request of the 1st position is the number in the 'tens' digit position.</p> <p>I have no idea how to start counting from the ones column. I tried c.at() but that starts from the left most digit and counts towards the right.</p>
0debug
static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int is_meta, int64_t maxpos) { int count = ffio_read_varlen(bc); int skip_start = 0; int skip_end = 0; int channels = 0; int64_t channel_layout = 0; int sample_rate = 0; int width = 0; int height = 0; int i, ret; for (i=0; i<count; i++) { uint8_t name[256], str_value[256], type_str[256]; int value; if (avio_tell(bc) >= maxpos) return AVERROR_INVALIDDATA; ret = get_str(bc, name, sizeof(name)); if (ret < 0) { av_log(s, AV_LOG_ERROR, "get_str failed while reading sm data\n"); return ret; } value = get_s(bc); if (value == -1) { get_str(bc, str_value, sizeof(str_value)); av_log(s, AV_LOG_WARNING, "Unknown string %s / %s\n", name, str_value); } else if (value == -2) { uint8_t *dst = NULL; int64_t v64, value_len; get_str(bc, type_str, sizeof(type_str)); value_len = ffio_read_varlen(bc); if (avio_tell(bc) + value_len >= maxpos) return AVERROR_INVALIDDATA; if (!strcmp(name, "Palette")) { dst = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, value_len); } else if (!strcmp(name, "Extradata")) { dst = av_packet_new_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, value_len); } else if (sscanf(name, "CodecSpecificSide%"SCNd64"", &v64) == 1) { dst = av_packet_new_side_data(pkt, AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, value_len + 8); if(!dst) return AVERROR(ENOMEM); AV_WB64(dst, v64); dst += 8; } else if (!strcmp(name, "ChannelLayout") && value_len == 8) { channel_layout = avio_rl64(bc); continue; } else { av_log(s, AV_LOG_WARNING, "Unknown data %s / %s\n", name, type_str); avio_skip(bc, value_len); continue; } if(!dst) return AVERROR(ENOMEM); avio_read(bc, dst, value_len); } else if (value == -3) { value = get_s(bc); } else if (value == -4) { value = ffio_read_varlen(bc); } else if (value < -4) { get_s(bc); } else { if (!strcmp(name, "SkipStart")) { skip_start = value; } else if (!strcmp(name, "SkipEnd")) { skip_end = value; } else if (!strcmp(name, "Channels")) { channels = value; } else if (!strcmp(name, "SampleRate")) { sample_rate = value; } else if (!strcmp(name, "Width")) { width = value; } else if (!strcmp(name, "Height")) { height = value; } else { av_log(s, AV_LOG_WARNING, "Unknown integer %s\n", name); } } } if (channels || channel_layout || sample_rate || width || height) { uint8_t *dst = av_packet_new_side_data(pkt, AV_PKT_DATA_PARAM_CHANGE, 28); if (!dst) return AVERROR(ENOMEM); bytestream_put_le32(&dst, AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT*(!!channels) + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT*(!!channel_layout) + AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE*(!!sample_rate) + AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS*(!!(width|height)) ); if (channels) bytestream_put_le32(&dst, channels); if (channel_layout) bytestream_put_le64(&dst, channel_layout); if (sample_rate) bytestream_put_le32(&dst, sample_rate); if (width || height){ bytestream_put_le32(&dst, width); bytestream_put_le32(&dst, height); } } if (skip_start || skip_end) { uint8_t *dst = av_packet_new_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES, 10); if (!dst) return AVERROR(ENOMEM); AV_WL32(dst, skip_start); AV_WL32(dst+4, skip_end); } return 0; }
1threat
How to properly implement linkedIn login ? : <p>I have an andorid app and i am trying to implement linkedIn login in it. LinkedIn SDK has been successfully integrated and i am getting user information as well along with the email address. </p> <p><strong>Here is how my application works for google login :</strong> </p> <p>1) get access token on mobile </p> <p>2) send email address with access token to server </p> <p>3) fetch details of users with access token i received via webapi of google. </p> <p>4) if the response email matches with the email received from mobile device then check for account exists or not of that email address . If not create account and login other wise login. </p> <hr> <p><strong>Problem with linkedIn :</strong> </p> <p>The access token i have received belongs to mobile sdk and i cannot use the same token to make REST API request. (<a href="https://developer.linkedin.com/docs/android-sdk-auth" rel="noreferrer">as per documentation</a>)</p> <blockquote> <p>Mobile vs. server-side access tokens</p> <p>It is important to note that access tokens that are acquired via the Mobile SDK are only useable with the Mobile SDK, and cannot be used to make server-side REST API calls.</p> <p>Similarly, access tokens that you already have stored from your users that authenticated using a server-side REST API call will not work with the Mobile SDK.</p> </blockquote> <p>So how to verify details in step 3) i mentioned above on my webserver ?</p> <hr> <p><strong>Is It a disaster ?</strong> I am sure there has to be a way to do what i am trying to do, as there are many applications which let their users login through linkedin on their mobile apps. </p> <p><em>Because if its not possible then anyone can easily change the email address the mobile app is sending to webserver after receiving from linkedin and i can login with any email address i want by doing that.</em> </p>
0debug
void kvm_irqchip_commit_routes(KVMState *s) { int ret; s->irq_routes->flags = 0; trace_kvm_irqchip_commit_routes(); ret = kvm_vm_ioctl(s, KVM_SET_GSI_ROUTING, s->irq_routes); assert(ret == 0);
1threat
jQuery image scrolling, selecting and lightbox-like-fx : <p>I have a webpage in which I need to realize something that looks like the following sketch: <a href="https://i.stack.imgur.com/iZN5A.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iZN5A.jpg" alt="sketch"></a></p> <p>As you can see, there are basically two sections:</p> <ul> <li>a side-block (preferably) on the right that serves as image-thumbnails scroller;</li> <li>a contents-block on the left (in my draw) in which there are text parts and an image that is selected from the right side-scroller.</li> </ul> <p>Side scrolling may be achieved by a browser sidebar or (<em>very much</em> preferably better) by apposite up/down buttons. When clicking on a different image on the side-scroller that image get shown in place of the previous one. Last thing, clicking the image selected shall make it show in full-size (not larger than browser window anyway) with a lightbox-like-effect.</p> <p>Anyone know of a jQuery plugin that already provide all this?</p> <p>Thank you very much.</p>
0debug
static int raw_media_changed(BlockDriverState *bs) { return bdrv_media_changed(bs->file->bs); }
1threat
static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; int tag, len; get_be32(pb); len = mp4_read_descr(c, pb, &tag); if (tag == MP4ESDescrTag) { get_be16(pb); get_byte(pb); } else get_be16(pb); len = mp4_read_descr(c, pb, &tag); if (tag == MP4DecConfigDescrTag) { int object_type_id = get_byte(pb); get_byte(pb); get_be24(pb); get_be32(pb); get_be32(pb); st->codec->codec_id= codec_get_id(ff_mp4_obj_type, object_type_id); dprintf(c->fc, "esds object type id %d\n", object_type_id); len = mp4_read_descr(c, pb, &tag); if (tag == MP4DecSpecificDescrTag) { dprintf(c->fc, "Specific MPEG4 header len=%d\n", len); st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); get_buffer(pb, st->codec->extradata, len); st->codec->extradata_size = len; if ((*st->codec->extradata >> 3) == 29) { st->codec->codec_id = CODEC_ID_MP3ON4; } } } return 0; }
1threat
Salesforce JOIN query issues, How to work JOIN in Salesforce : Salesforce below my JOIN query not work,, so please help me $query = "SELECT s__c.Id,s__c.mobile_number__c,s__c.student_id__c,s__c.user_id__c,s__c.student_name__c FROM student__c AS s__c INNER JOIN uraan_db__c AS u__c ON u__c.Id=s__c.user_id__c "; Error:= Fatal error: Uncaught SoapFault exception: [sf:MALFORMED_QUERY] MALFORMED_QUERY: s__c.student_name__c FROM student__c AS s__c INNER JOIN uraan_db__c AS u__c ON ^ ERROR at Row:1:Column:118 unexpected token: 'INNER' in /opt/lampp/htdocs/ashvin/portal/soapclient/SforceBaseClient.php:799 Stack trace: #0 /opt/lampp/htdocs/ashvin/portal/soapclient/SforceBaseClient.php(799): SoapClient->__call('query', Array) #1 /opt/lampp/htdocs/ashvin/portal/soapclient/SforceBaseClient.php(799): SforceSoapClient->query(Array) #2 /opt/lampp/htdocs/ashvin/portal/student_list.php(24): SforceBaseClient->query('SELECT s__c.Id,...') #3 {main} thrown in /opt/lampp/htdocs/ashvin/portal/soapclient/SforceBaseClient.php on line 799
0debug
PHP String to variables : <p>I have </p> <pre><code>$string = "temp"; </code></pre> <p>I want extract string value and make new variable (array) :</p> <pre><code>$temp = array(); </code></pre> <p>is possible?</p>
0debug
Beginner level (Python): when i try to run my compare function i don't get a the return i put in. : this is the compare function: def compare(a, b): if a > b: return 1 elif a == b: return 0 else: return -1 a=int(input('Enter first number here:')) b=int(input('enter second number here:')) compare(a,b) -------------------------------------------------------------------------------- when i run it, it prompts the user for a and b but after they are entered the program doesn't do anything it returns none.
0debug
Using a list in a function python : <pre><code>file = open('Info.txt', 'r') x = str(file.read()) file.close() info = re.findall(r'\w+', x) j = len(info) Fname = [0] * j def FirstName(info, j, FName): i = 0 n = 0 while i&lt;j: name = info[i] name = name.upper() name = list(name) Fname[n] = name[0] i = i + 3 n = n + 1 </code></pre> <p>I am trying to use the list "FName" in the function I defined as "Firstname". But when i run the program, I get an error stating that "Fname is not defined".</p> <p>The solution is probably very simple but I am new to python.</p> <p>Thanks</p>
0debug
static int coroutine_fn nfs_co_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *iov) { NFSClient *client = bs->opaque; NFSRPC task; char *buf = NULL; nfs_co_init_task(client, &task); buf = g_malloc(nb_sectors * BDRV_SECTOR_SIZE); qemu_iovec_to_buf(iov, 0, buf, nb_sectors * BDRV_SECTOR_SIZE); if (nfs_pwrite_async(client->context, client->fh, sector_num * BDRV_SECTOR_SIZE, nb_sectors * BDRV_SECTOR_SIZE, buf, nfs_co_generic_cb, &task) != 0) { g_free(buf); return -ENOMEM; } while (!task.complete) { nfs_set_events(client); qemu_coroutine_yield(); } g_free(buf); if (task.ret != nb_sectors * BDRV_SECTOR_SIZE) { return task.ret < 0 ? task.ret : -EIO; } return 0; }
1threat
Dont understand how i am ment to get this answer : I need to answer a question as follows For example, an array of products can be set up as below for use on an ecommerce web site. var products = ["Printer","Tablet","Router"]; (i) Set up an array to include the items shown above, plus a few extras of your choice. this is what I have on my own I am currently doing GSCE computer science and need help thx guys <!DOCTYPE html> <html> <body> <p id="How to set up and Array with items in HTML"></p> <script> var Items = ["Printer", "Tablet", "Router","Headset","Keyboard","Mouse"]; document.getElementById("demo").innerHTML = Items; </script> </body> </html>
0debug
Hi everyone! can someone tell me what " if [ $# -ne 1 ]"means in a shell script? : <p>I have been trying to figure out the following line of code as well: if [ ! -e $1 ] thanks</p>
0debug
Get current filename in Babel Plugin? : <p>I'm attempting to write a plugin for babel, and am needing the filename of the current file that is being parsed. I know the lines of the code are passed in, but I haven't managed to find a reference to the filename. Any help??</p> <p>For instance given this code what could I do</p> <pre><code>export default function({ types: t }) { return { visitor: { Identifier(path) { // something here?? } } }; } </code></pre>
0debug
Challenge:: palindrome words : <p>A palindrome is a word that reads the same backward or forward. Write a function that checks if a given word is a palindrome. Character case should be ignored. function isPalindrome(word) For example, isPalindrome("Deleveled") should return true as character case should be ignored, resulting in "deleveled", which is a palindrome since it reads the same backward and forward.</p> <pre><code>function isPalindrome(word) { // Please write your code here. } var word = readline() print(isPalindrome(word)) </code></pre>
0debug
what does big data have to do with cloud computing : <h1> what does big data have to do with cloud computing? </h1> <h4> i have try to explain relation between big data and cloud computing. </h4>
0debug
static DriveInfo *blockdev_init(const char *file, QDict *bs_opts, Error **errp) { const char *buf; const char *serial; int ro = 0; int bdrv_flags = 0; int on_read_error, on_write_error; DriveInfo *dinfo; ThrottleConfig cfg; int snapshot = 0; bool copy_on_read; int ret; Error *error = NULL; QemuOpts *opts; const char *id; bool has_driver_specific_opts; BlockDriver *drv = NULL; id = qdict_get_try_str(bs_opts, "id"); opts = qemu_opts_create(&qemu_common_drive_opts, id, 1, &error); if (error) { error_propagate(errp, error); return NULL; } qemu_opts_absorb_qdict(opts, bs_opts, &error); if (error) { error_propagate(errp, error); goto early_err; } if (id) { qdict_del(bs_opts, "id"); } has_driver_specific_opts = !!qdict_size(bs_opts); snapshot = qemu_opt_get_bool(opts, "snapshot", 0); ro = qemu_opt_get_bool(opts, "read-only", 0); copy_on_read = qemu_opt_get_bool(opts, "copy-on-read", false); serial = qemu_opt_get(opts, "serial"); if ((buf = qemu_opt_get(opts, "discard")) != NULL) { if (bdrv_parse_discard_flags(buf, &bdrv_flags) != 0) { error_setg(errp, "invalid discard option"); goto early_err; } } if (qemu_opt_get_bool(opts, "cache.writeback", true)) { bdrv_flags |= BDRV_O_CACHE_WB; } if (qemu_opt_get_bool(opts, "cache.direct", false)) { bdrv_flags |= BDRV_O_NOCACHE; } if (qemu_opt_get_bool(opts, "cache.no-flush", false)) { bdrv_flags |= BDRV_O_NO_FLUSH; } #ifdef CONFIG_LINUX_AIO if ((buf = qemu_opt_get(opts, "aio")) != NULL) { if (!strcmp(buf, "native")) { bdrv_flags |= BDRV_O_NATIVE_AIO; } else if (!strcmp(buf, "threads")) { } else { error_setg(errp, "invalid aio option"); goto early_err; } } #endif if ((buf = qemu_opt_get(opts, "format")) != NULL) { if (is_help_option(buf)) { error_printf("Supported formats:"); bdrv_iterate_format(bdrv_format_print, NULL); error_printf("\n"); goto early_err; } drv = bdrv_find_format(buf); if (!drv) { error_setg(errp, "'%s' invalid format", buf); goto early_err; } } memset(&cfg, 0, sizeof(cfg)); cfg.buckets[THROTTLE_BPS_TOTAL].avg = qemu_opt_get_number(opts, "throttling.bps-total", 0); cfg.buckets[THROTTLE_BPS_READ].avg = qemu_opt_get_number(opts, "throttling.bps-read", 0); cfg.buckets[THROTTLE_BPS_WRITE].avg = qemu_opt_get_number(opts, "throttling.bps-write", 0); cfg.buckets[THROTTLE_OPS_TOTAL].avg = qemu_opt_get_number(opts, "throttling.iops-total", 0); cfg.buckets[THROTTLE_OPS_READ].avg = qemu_opt_get_number(opts, "throttling.iops-read", 0); cfg.buckets[THROTTLE_OPS_WRITE].avg = qemu_opt_get_number(opts, "throttling.iops-write", 0); cfg.buckets[THROTTLE_BPS_TOTAL].max = qemu_opt_get_number(opts, "throttling.bps-total-max", 0); cfg.buckets[THROTTLE_BPS_READ].max = qemu_opt_get_number(opts, "throttling.bps-read-max", 0); cfg.buckets[THROTTLE_BPS_WRITE].max = qemu_opt_get_number(opts, "throttling.bps-write-max", 0); cfg.buckets[THROTTLE_OPS_TOTAL].max = qemu_opt_get_number(opts, "throttling.iops-total-max", 0); cfg.buckets[THROTTLE_OPS_READ].max = qemu_opt_get_number(opts, "throttling.iops-read-max", 0); cfg.buckets[THROTTLE_OPS_WRITE].max = qemu_opt_get_number(opts, "throttling.iops-write-max", 0); cfg.op_size = qemu_opt_get_number(opts, "throttling.iops-size", 0); if (!check_throttle_config(&cfg, &error)) { error_propagate(errp, error); goto early_err; } on_write_error = BLOCKDEV_ON_ERROR_ENOSPC; if ((buf = qemu_opt_get(opts, "werror")) != NULL) { on_write_error = parse_block_error_action(buf, 0, &error); if (error) { error_propagate(errp, error); goto early_err; } } on_read_error = BLOCKDEV_ON_ERROR_REPORT; if ((buf = qemu_opt_get(opts, "rerror")) != NULL) { on_read_error = parse_block_error_action(buf, 1, &error); if (error) { error_propagate(errp, error); goto early_err; } } if (bdrv_find_node(qemu_opts_id(opts))) { error_setg(errp, "device id=%s is conflicting with a node-name", qemu_opts_id(opts)); goto early_err; } dinfo = g_malloc0(sizeof(*dinfo)); dinfo->id = g_strdup(qemu_opts_id(opts)); dinfo->bdrv = bdrv_new(dinfo->id, &error); if (error) { error_propagate(errp, error); goto bdrv_new_err; } dinfo->bdrv->open_flags = snapshot ? BDRV_O_SNAPSHOT : 0; dinfo->bdrv->read_only = ro; dinfo->refcount = 1; if (serial != NULL) { dinfo->serial = g_strdup(serial); } QTAILQ_INSERT_TAIL(&drives, dinfo, next); bdrv_set_on_error(dinfo->bdrv, on_read_error, on_write_error); if (throttle_enabled(&cfg)) { bdrv_io_limits_enable(dinfo->bdrv); bdrv_set_io_limits(dinfo->bdrv, &cfg); } if (!file || !*file) { if (has_driver_specific_opts) { file = NULL; } else { QDECREF(bs_opts); qemu_opts_del(opts); return dinfo; } } if (snapshot) { bdrv_flags &= ~BDRV_O_CACHE_MASK; bdrv_flags |= (BDRV_O_SNAPSHOT|BDRV_O_CACHE_WB|BDRV_O_NO_FLUSH); } if (copy_on_read) { bdrv_flags |= BDRV_O_COPY_ON_READ; } if (runstate_check(RUN_STATE_INMIGRATE)) { bdrv_flags |= BDRV_O_INCOMING; } bdrv_flags |= ro ? 0 : BDRV_O_RDWR; QINCREF(bs_opts); ret = bdrv_open(&dinfo->bdrv, file, NULL, bs_opts, bdrv_flags, drv, &error); if (ret < 0) { error_setg(errp, "could not open disk image %s: %s", file ?: dinfo->id, error_get_pretty(error)); error_free(error); goto err; } if (bdrv_key_required(dinfo->bdrv)) autostart = 0; QDECREF(bs_opts); qemu_opts_del(opts); return dinfo; err: bdrv_unref(dinfo->bdrv); QTAILQ_REMOVE(&drives, dinfo, next); bdrv_new_err: g_free(dinfo->id); g_free(dinfo); early_err: QDECREF(bs_opts); qemu_opts_del(opts); return NULL; }
1threat
int nbd_disconnect(int fd) { errno = ENOTSUP; return -1; }
1threat
How to load treeview nodes from sqlite database : I am trying to load nodes into a c# winform treeview using System.Data.SQLite. Currently my database table looks like this: ` ID, Parent_ID, Name 1, 0, Apple 2, 0, Pear 3, 2, Grapes 4, 3, Banana` I need my treeview to look like this: `Apple Pear -> Grapes -> -> Banana` 'Grapes' has a Parent_ID of '2', making it a child node of 'Pear', and 'Banana' has a Parent_ID of '3', making it a child node of 'Grapes'. I'm not very experienced with SQL and am not sure how to go about getting the data out of my SQLite file 'Database.db', containing a table 'MyTable'. Any help is much appreciated.
0debug
Render a view in Rails 5 API : <p>I generated an API-only rails app with Rails 5 via <code>rails new &lt;application-name&gt; --api</code>. I've decided I want to include a view for testing some things and am having issues getting a view to load. </p> <p>I created a users/index.html.erb file with some text and my controller is now simply <code>def index; end</code> but there is nothing appearing when I hit the /users URL. I also tried commenting out the <code># config.api_only = true</code> in config/application.rb but that didn't affect anything. Any suggestions on how to proceed? </p>
0debug
static void xhci_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); dc->vmsd = &vmstate_xhci; dc->props = xhci_properties; dc->reset = xhci_reset; k->init = usb_xhci_initfn; k->vendor_id = PCI_VENDOR_ID_NEC; k->device_id = PCI_DEVICE_ID_NEC_UPD720200; k->class_id = PCI_CLASS_SERIAL_USB; k->revision = 0x03; k->is_express = 1; }
1threat
What is the difference between the `--build` and `--force-recreate` flags to `docker-compose up`? : <p>Just as the title asks; what is the difference between the <code>--build</code> and <code>--force-recreate</code> flags to <code>docker-compose up</code>?</p> <p>To me it seem that these would do the same thing, but maybe I am missing something.</p>
0debug
Flowchart to HTML and CSS online tool? : <p>I need a tool where the user can draw an flowchart easily, and export this to a HTML and CSS file. My intention to save this HTML code in a database, and get this from my android app, and show this in a Webview. Do you know some flowchart tool for to do that? </p> <p>Thank you!</p>
0debug
static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg rd, tcg_target_long value) { AArch64Insn insn; if (type == TCG_TYPE_I32) { value = (uint32_t)value; } insn = I3405_MOVZ; do { unsigned shift = ctz64(value) & (63 & -16); tcg_out_insn_3405(s, insn, shift >= 32, rd, value >> shift, shift); value &= ~(0xffffUL << shift); insn = I3405_MOVK; } while (value); }
1threat