problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
button not going to another view when clicked in button in grails : Actaully i have this Cancel button and when i am pressing it, it is not going to required view page??whats the error??it is not showing any action.i dont want to change button to g:submitbutton because my css will change so i want to cancel this operation using button tag.i am using grails..................
mains.gsp
<button type="button" onclick="${remoteFunction(action:'index', controller: 'organization')}" class="cancelbtn">Cancel</button>
| 0debug
|
pgAdmin 4.7 displays blank popup screen on startup : <p>I've just installed latest pgAdmin (4.7) and whenever I start it up I get this strange blank popup which I can not remove:
<a href="https://i.stack.imgur.com/RbxAP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RbxAP.png" alt="enter image description here"></a></p>
<p>I can use the application just fine I just need to move that empty window to the side which is annoying.
I'm using Firefox version 67 (64bit).</p>
| 0debug
|
Python Time Function : <p>I am trying to create a function with Python that accepts an integer as input, representing a number of hours. It should return a tuple of that number converted to minutes (* 60), and then that number converted to seconds. Below is my current code, but I am not sure what I am doing wrong. Any help would be appreciated. </p>
<pre><code>def convert_nums(num):
x = int(num) * 3600
y = int(num) * 60
return x,y
print convert_nums
</code></pre>
| 0debug
|
Get a Java string of form (num/num), to become two double values : <p>For example, if I have a string (24/25), how would I go about being left with two double values of 24 and 25. My objective to to eventually, given a set of number of that form, divide each of them, and add to get the average. I'm fairly new to Java and I honestly am so confused as where to even begin. Thank you!</p>
| 0debug
|
C# Read (not write!) string from System.Net.Http.StringContent : <p>I have what seems like it should be a simple question, but I can't find an answer to it anywhere. Given the following code:</p>
<pre><code> using System.Net.Http;
...
StringContent sc = New StringContent("Hello!");
string myContent = ???;
</code></pre>
<p>What do I need to replace the <code>???</code> with in order to read the string value from <code>sc</code>, so that <code>myContent = "Hello!"</code>?</p>
<p><code>.ToString</code> just returns System.String, as does <code>.ReadAsStringAsync</code>. How do I read out what I've written in?</p>
| 0debug
|
Find first empty cell in column range : <p>I'm trying to create a loop to find the first empty cell in Column D of highlighted range (See picture) and return the row value (integer). However, I'm struggling to find a solution. </p>
<p>Does anyone have any ideas?</p>
<p><a href="https://i.stack.imgur.com/XYQJW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XYQJW.png" alt="enter image description here"></a></p>
| 0debug
|
need search box filter javascript : i need search box filter javascript for these which search and filter each "<li>" when i type words e.g like c then it show me calvin ,cars,cinama etc .my "ul"are
<ul>
<li><a HREF="#">KINDY</a></li>
<li><a HREF="#">BILLY</a></li>
<li><a HREF="#">DOB</a></li>
<li><a HREF="#">CALVIN</a></li>
<li><a HREF="#">ACNE</a></li>
<li><a HREF="#">boil</a></li>
<li><a HREF="#">cars</a></li>
<li><a HREF="#">cinama</a></li>
<li><a HREF="#">lamp</a></li>
</ul>
| 0debug
|
static int compute_mb_distortion(CinepakEncContext *s, AVPicture *a, AVPicture *b)
{
int x, y, p, d, ret = 0;
for(y = 0; y < MB_SIZE; y++) {
for(x = 0; x < MB_SIZE; x++) {
d = a->data[0][x + y*a->linesize[0]] - b->data[0][x + y*b->linesize[0]];
ret += d*d;
}
}
if(s->pix_fmt == AV_PIX_FMT_YUV420P) {
for(p = 1; p <= 2; p++) {
for(y = 0; y < MB_SIZE/2; y++) {
for(x = 0; x < MB_SIZE/2; x++) {
d = a->data[p][x + y*a->linesize[p]] - b->data[p][x + y*b->linesize[p]];
ret += d*d;
}
}
}
}
return ret;
}
| 1threat
|
Find All Instances of a String NOT Within HREF Tags? : I'm writing a JavaScript that goes through an html document and finds all instances of a keyword that are NOT links -- not within an HREF tag. For example, let's take the following HTML and I'm looking for the keyword "laptops."
<p>I love laptops so much and these are <a href="mylink">some of my <i>favorite laptops</i></a>. Don't you love laptops also?</p>
So I need a way to return instances 1 and 3 here, but not number 2, because it is within a link. I'm not sure if the right way to do this is with a Regex (I can't figure out the right one for this) or iterating through the DOM or something. I can use either JQuery or straight JS.
| 0debug
|
How do I move objects in Android Studio from the xml design mode? : I am a junior developer who study development in the school.
I have to make a mini-project - calculator, so I've started work on this.
When I'm trying to place some buttons in their place (by numerical order) there is a problem:
For example, I decided that I want 3 buttons per line.
one I am trying to move the upper line all the buttons lose there order.
Is there an auto-ordering so I can disable ?
Regards
Aviv
| 0debug
|
How to copy text inside Virtual Machine using Automation Anywhere bot?? : Steps:
1.Need to login to the Virtual Machine. Done
2.Open Notepad
3.Copy the text
Please let me know your feasible ways.
| 0debug
|
void do_load_6xx_tlb (int is_code)
{
target_ulong RPN, CMP, EPN;
int way;
RPN = env->spr[SPR_RPA];
if (is_code) {
CMP = env->spr[SPR_ICMP];
EPN = env->spr[SPR_IMISS];
} else {
CMP = env->spr[SPR_DCMP];
EPN = env->spr[SPR_DMISS];
}
way = (env->spr[SPR_SRR1] >> 17) & 1;
#if defined (DEBUG_SOFTWARE_TLB)
if (loglevel != 0) {
fprintf(logfile, "%s: EPN %08lx %08lx PTE0 %08lx PTE1 %08lx way %d\n",
__func__, (unsigned long)T0, (unsigned long)EPN,
(unsigned long)CMP, (unsigned long)RPN, way);
}
#endif
ppc6xx_tlb_store(env, T0 & TARGET_PAGE_MASK, way, is_code, CMP, RPN);
}
| 1threat
|
static void qxl_flip(PCIQXLDevice *qxl, QXLRect *rect)
{
uint8_t *src = qxl->guest_primary.data;
uint8_t *dst = qxl->guest_primary.flipped;
int len, i;
src += (qxl->guest_primary.surface.height - rect->top - 1) *
qxl->guest_primary.stride;
dst += rect->top * qxl->guest_primary.stride;
src += rect->left * qxl->guest_primary.bytes_pp;
dst += rect->left * qxl->guest_primary.bytes_pp;
len = (rect->right - rect->left) * qxl->guest_primary.bytes_pp;
for (i = rect->top; i < rect->bottom; i++) {
memcpy(dst, src, len);
dst += qxl->guest_primary.stride;
src -= qxl->guest_primary.stride;
}
}
| 1threat
|
void memory_region_iommu_replay(MemoryRegion *mr, Notifier *n,
hwaddr granularity, bool is_write)
{
hwaddr addr;
IOMMUTLBEntry iotlb;
for (addr = 0; addr < memory_region_size(mr); addr += granularity) {
iotlb = mr->iommu_ops->translate(mr, addr, is_write);
if (iotlb.perm != IOMMU_NONE) {
n->notify(n, &iotlb);
}
if ((addr + granularity) < addr) {
break;
}
}
}
| 1threat
|
How to use nested ternary operators in C++ : <p>I am trying to use nested ternary operators using following code, but it is giving wrong answer, I am not getting what's the mistake is. </p>
<pre><code>#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World\n";
int age, Result ;
cout<<"Enter age:";
cin>>age;
Result=age<0?-1
:0<=age<=10?0
:11<=age<=18?1
:-2;
cout<<"Result is: "<<Result;
return 0;
}
</code></pre>
<p>For the input age 13 its giving Result as 0 and for input age 20 also its giving result as 0. I am not getting what's the mistake. Could you help me? Thank you. </p>
| 0debug
|
R subset based on range of dates : <p>Say I have a data set with 3 columns, A, B and C, that contain dates for a large number of rows. How can I create a subset that omits the rows where the date in C is not within the range of the dates in A and B?</p>
| 0debug
|
Why does AngularJS show me that a scope variable is undefined in directive when it is clearly defined? : I have an angularJS directive that I call like this:
<rpt-closing closing-begin-ts="'None'" closing-begin-ts="'2014-11-25 23:59:59'"></rpt-closing>
Here is what the directive code looks like:
.directive('rptClosing',function(){
return {
restrict:'E',
scope: {
closingBeginTs: '=',
closingEndTs: '='
},
link: function(scope, element, attrs) {
console.log('*******************************************');
console.log('scope = ', scope);
console.log('scope.closingBeginTs = ', scope.closingBeginTs);
console.log('scope.closingEndTs = ', scope.closingEndTs);
console.log('*******************************************');
},
template: '<div>BLAH BLAH BLAH</div>'
};
}
)
This code works perfectly fine in [this jsFiddle][1]. I can see the values of `scope.closingBeginTs` and `scope.closingEndTs` in the console output.
However, when I run the same codebase on my machine, it doesn't work! I can see that those two values are properly attached to the `scope`. But when I try to log them to the console, it shows `undefined`. Why? You can see what I mean in the screenshot below. Very weird indeed.
[![enter image description here][2]][2]
[1]: https://jsfiddle.net/xgxwqxun/
[2]: http://i.stack.imgur.com/aLkue.png
| 0debug
|
Getting an error while reversing vowels in a string : <p>I know there are similar questions about this topic but I wanted to know error in my approach.</p>
<p>I'm writing a code to reverse vowels in a string. I first took all the vowels of a string into a vector and then I looped the string from backwards by replacing the vowels but I keep getting an error.</p>
<pre><code>#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
string reverseVowels(string s)
{
vector<char>v;
vector<char>v2;
char c;
for (int i = 0; i < s.size(); i++)
{
//taking all the vowels of the string into a vector
if (s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u')
{
v.push_back(s[i]);
}
}
//reversing the vowels of the string
for (int i = s.size() - 1; i >= 0; i--)
{
if (s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u')
{
s[i] = v[i]; //Getting an error here
}
}
return s;
}
int main()
{
//Required output is "holle"
string s = "hello";
string p = reverseVowels(s);
cout << p << endl;
return 0;
}
</code></pre>
| 0debug
|
Comparaison between 2 string : <p>I want to compare two String for exemple str="abc" and str2="bca" or str3="bac" are all twins (contains the same char)
i have this code </p>
<pre><code>package com.hr.access.chaine;
public class ChaineCaractere {
public static void main(String[] args) {
System.out.println(Solution.isTwin("hello", "world"));// false
System.out.println(Solution.isTwin("abc", "cab"));// true
System.out.println(Solution.isTwin("Lookout", "outlook"));// true
} }
</code></pre>
<p>and the other class for Solution.isTwins is there </p>
<pre><code>package com.hr.access.chaine;
public class Solution {
public static boolean isTwin(String a, String b) {
int longA = a.length();
int longB = b.length();
boolean retourneValeur;
if (longA != longB) {
System.out.println("Le deux chaine ne sont pas jumeau");
retourneValeur = false;
} else {
// I want to add the code in this place to compare into two string
retourneValeur = true;
}
return retourneValeur;
}}
</code></pre>
<p>I want to add the another code in the bloc of else and i will affect this if the two string are twins or no
Help me please my friend :) </p>
| 0debug
|
void helper_vmrun(target_ulong addr)
{
uint32_t event_inj;
uint32_t int_ctl;
if (loglevel & CPU_LOG_TB_IN_ASM)
fprintf(logfile,"vmrun! " TARGET_FMT_lx "\n", addr);
env->vm_vmcb = addr;
regs_to_env();
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.gdtr.base), env->gdt.base);
stl_phys(env->vm_hsave + offsetof(struct vmcb, save.gdtr.limit), env->gdt.limit);
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.idtr.base), env->idt.base);
stl_phys(env->vm_hsave + offsetof(struct vmcb, save.idtr.limit), env->idt.limit);
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.cr0), env->cr[0]);
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.cr2), env->cr[2]);
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.cr3), env->cr[3]);
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.cr4), env->cr[4]);
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.cr8), env->cr[8]);
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.dr6), env->dr[6]);
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.dr7), env->dr[7]);
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.efer), env->efer);
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.rflags), compute_eflags());
SVM_SAVE_SEG(env->vm_hsave, segs[R_ES], es);
SVM_SAVE_SEG(env->vm_hsave, segs[R_CS], cs);
SVM_SAVE_SEG(env->vm_hsave, segs[R_SS], ss);
SVM_SAVE_SEG(env->vm_hsave, segs[R_DS], ds);
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.rip), EIP);
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.rsp), ESP);
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.rax), EAX);
env->intercept = (ldq_phys(env->vm_vmcb + offsetof(struct vmcb, control.intercept)) << INTERCEPT_INTR) | INTERCEPT_SVM_MASK;
env->intercept_cr_read = lduw_phys(env->vm_vmcb + offsetof(struct vmcb, control.intercept_cr_read));
env->intercept_cr_write = lduw_phys(env->vm_vmcb + offsetof(struct vmcb, control.intercept_cr_write));
env->intercept_dr_read = lduw_phys(env->vm_vmcb + offsetof(struct vmcb, control.intercept_dr_read));
env->intercept_dr_write = lduw_phys(env->vm_vmcb + offsetof(struct vmcb, control.intercept_dr_write));
env->intercept_exceptions = ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.intercept_exceptions));
env->gdt.base = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.gdtr.base));
env->gdt.limit = ldl_phys(env->vm_vmcb + offsetof(struct vmcb, save.gdtr.limit));
env->idt.base = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.idtr.base));
env->idt.limit = ldl_phys(env->vm_vmcb + offsetof(struct vmcb, save.idtr.limit));
stq_phys(env->vm_vmcb + offsetof(struct vmcb, control.exit_info_2), 0);
cpu_x86_update_cr0(env, ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.cr0)));
cpu_x86_update_cr4(env, ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.cr4)));
cpu_x86_update_cr3(env, ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.cr3)));
env->cr[2] = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.cr2));
int_ctl = ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.int_ctl));
if (int_ctl & V_INTR_MASKING_MASK) {
env->cr[8] = int_ctl & V_TPR_MASK;
cpu_set_apic_tpr(env, env->cr[8]);
if (env->eflags & IF_MASK)
env->hflags |= HF_HIF_MASK;
}
#ifdef TARGET_X86_64
env->efer = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.efer));
env->hflags &= ~HF_LMA_MASK;
if (env->efer & MSR_EFER_LMA)
env->hflags |= HF_LMA_MASK;
#endif
env->eflags = 0;
load_eflags(ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.rflags)),
~(CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C | DF_MASK));
CC_OP = CC_OP_EFLAGS;
CC_DST = 0xffffffff;
SVM_LOAD_SEG(env->vm_vmcb, ES, es);
SVM_LOAD_SEG(env->vm_vmcb, CS, cs);
SVM_LOAD_SEG(env->vm_vmcb, SS, ss);
SVM_LOAD_SEG(env->vm_vmcb, DS, ds);
EIP = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.rip));
env->eip = EIP;
ESP = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.rsp));
EAX = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.rax));
env->dr[7] = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.dr7));
env->dr[6] = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.dr6));
cpu_x86_set_cpl(env, ldub_phys(env->vm_vmcb + offsetof(struct vmcb, save.cpl)));
switch(ldub_phys(env->vm_vmcb + offsetof(struct vmcb, control.tlb_ctl))) {
case TLB_CONTROL_DO_NOTHING:
break;
case TLB_CONTROL_FLUSH_ALL_ASID:
tlb_flush(env, 1);
break;
}
helper_stgi();
regs_to_env();
event_inj = ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.event_inj));
if (event_inj & SVM_EVTINJ_VALID) {
uint8_t vector = event_inj & SVM_EVTINJ_VEC_MASK;
uint16_t valid_err = event_inj & SVM_EVTINJ_VALID_ERR;
uint32_t event_inj_err = ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.event_inj_err));
stl_phys(env->vm_vmcb + offsetof(struct vmcb, control.event_inj), event_inj & ~SVM_EVTINJ_VALID);
if (loglevel & CPU_LOG_TB_IN_ASM)
fprintf(logfile, "Injecting(%#hx): ", valid_err);
switch (event_inj & SVM_EVTINJ_TYPE_MASK) {
case SVM_EVTINJ_TYPE_INTR:
env->exception_index = vector;
env->error_code = event_inj_err;
env->exception_is_int = 1;
env->exception_next_eip = -1;
if (loglevel & CPU_LOG_TB_IN_ASM)
fprintf(logfile, "INTR");
break;
case SVM_EVTINJ_TYPE_NMI:
env->exception_index = vector;
env->error_code = event_inj_err;
env->exception_is_int = 1;
env->exception_next_eip = EIP;
if (loglevel & CPU_LOG_TB_IN_ASM)
fprintf(logfile, "NMI");
break;
case SVM_EVTINJ_TYPE_EXEPT:
env->exception_index = vector;
env->error_code = event_inj_err;
env->exception_is_int = 0;
env->exception_next_eip = -1;
if (loglevel & CPU_LOG_TB_IN_ASM)
fprintf(logfile, "EXEPT");
break;
case SVM_EVTINJ_TYPE_SOFT:
env->exception_index = vector;
env->error_code = event_inj_err;
env->exception_is_int = 1;
env->exception_next_eip = EIP;
if (loglevel & CPU_LOG_TB_IN_ASM)
fprintf(logfile, "SOFT");
break;
}
if (loglevel & CPU_LOG_TB_IN_ASM)
fprintf(logfile, " %#x %#x\n", env->exception_index, env->error_code);
}
if ((int_ctl & V_IRQ_MASK) || (env->intercept & INTERCEPT_VINTR)) {
env->interrupt_request |= CPU_INTERRUPT_VIRQ;
}
cpu_loop_exit();
}
| 1threat
|
Android: What can we do to ensure that onDestroy() gets called? : I have a line of code that I should call after my activity is destroyed, so I override onDestroy() method and I call it inside. like this:
@override
public void onDestroy(){
//my code here
super.onDestroy()
}
Now I noticed that the this line of code is not always executed when my activity finishes.
I read about this and some said don't depend on onDestroy() method to call something.
My question is I need to call the code from onDestroy() and I want it to always work. Any thoughts on this? And why onDestroy() is found in the first place if we cant depend on it to execute?
Thanks.
| 0debug
|
static uint64_t omap_mpuio_read(void *opaque, target_phys_addr_t addr,
unsigned size)
{
struct omap_mpuio_s *s = (struct omap_mpuio_s *) opaque;
int offset = addr & OMAP_MPUI_REG_MASK;
uint16_t ret;
if (size != 2) {
return omap_badwidth_read16(opaque, addr);
}
switch (offset) {
case 0x00:
return s->inputs;
case 0x04:
return s->outputs;
case 0x08:
return s->dir;
case 0x10:
return s->row_latch;
case 0x14:
return s->cols;
case 0x18:
return s->event;
case 0x1c:
return s->edge;
case 0x20:
return (~s->row_latch & 0x1f) && !s->kbd_mask;
case 0x24:
ret = s->ints;
s->ints &= s->mask;
if (ret)
qemu_irq_lower(s->irq);
return ret;
case 0x28:
return s->kbd_mask;
case 0x2c:
return s->mask;
case 0x30:
return s->debounce;
case 0x34:
return s->latch;
}
OMAP_BAD_REG(addr);
return 0;
}
| 1threat
|
Download File from SFTP server without using JSch : <p>Due to some policy constraint at our company, we cannot use any external Library. I couldn't find any way to do that in Java.</p>
| 0debug
|
Creating Two dimensional arrays using nested-loop : I am trying to understand this code from the book. Using Java
int[][] grade = {{ 1, 0, 1},
{ 0, 1, 0},
{ 1, 0, 1}};
for ( int i = 0; i < 3; i++) {
for ( int j = 0; j < 3; j++) {
if (i==j)
System.out.print(grade[i][j] + grade[j][i] + " ");
else
System.out.print(grade[i][j] * grade[j][i] + " ");
}
System.out.println(" ");
}
I understand the logic of a two dimensional arrays being rows and columns I just don't understand how the answer came to be this.
2 0 1
0 2 0
1 0 2
| 0debug
|
Fetch certain values from dictionary : <p>I have below dictionary. I need to drop <code>OS::<name></code> from this dictionary (In this case first 3 key,value pairs). I am only interested in the rest of the key,value pairs. How can I achieve this? It would help if I can get the logic to be as short as possible.</p>
<pre><code>{u'OS::project_id': u'xyz',
u'OS::stack_id': u'xyz',
u'OS::stack_name': u'XYZ',
u'image': u'RHEL-7.2',
u'private_network_id': u'xyz',
u'floating_ip': u'xyz',
u'volume_type': u'ceph_fake',
u'volume_size': u'10',
u'key': u'my_key',
u'flavor': u'm1.small'}
</code></pre>
| 0debug
|
Please explain output of given program. : <p>the code is given below:
it gives output true2. </p>
<pre><code> #include<stdio.h>
int main()
{
int a=10;
if(a==a--)
printf("true 1\t");
a=10;
if(a==--a)
printf("true2 \t");
return 0;
}
</code></pre>
| 0debug
|
Java BufferedReader error : How can I fix the following error:
` Exception in thread "main" java.lang.StringIndexOutOfBoundsException: begin 3, end 4, length 3
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3116)
at java.base/java.lang.String.substring(String.java:1885)
at ReadZILLA.main(Main.java:26)`
This is the code:
import java.io.*;
import java.text.*;
class ReadZILLA {
public static void main(String[] args) throws IOException {
int vowel = 0;
int words = 0;
int line = 10;
int line_no = 11-line;
int n = 1;
String a = "a";
String e = "e";
String i = "i";
String o = "o";
String u = "u";
String A = "A";
String E = "E";
String I = "I";
String O = "O";
String U = "U";
String space = " ";
BufferedReader in_text = new BufferedReader(new InputStreamReader(System.in));
String text = in_text.readLine();
while(line > 1){
String char_def = text.substring(n-1,n);
System.out.println(char_def);
if (char_def == a || char_def == e || char_def == i || char_def == o || char_def == u || char_def == A || char_def == E || char_def == I|| char_def == O || char_def == U){
vowel = vowel + 1;
} else if (char_def == space){
words = words +1;
} else if (char_def == "\n"){
System.out.println ("Numbers of vowels: " + vowel + "in line " + line_no);
vowel = 0;
line = line-1;
}
n = n +1;
}
int words_avg = words/10;
System.out.println("Number of words: " + words);
System.out.println("Average number of words: " + words_avg);
}
The program is called ReadZILLA and it's supposed to output the numbers of vowels, words and average words in a line from the input.
E.G input: tHe DoG is BrOWN /n thE cat IS rED
output: vowels: 8, words: 8, average words per line: 4
| 0debug
|
Number of string objects created in program : <pre><code>String s1="abc"; //line 1
String s2 = new String ("abc"); //line 2
String s3 = "abc"; //line 3
String s4 = s1+s2+s3; //line 4
</code></pre>
<p>I need to know how many objects are created in total.(Heap and SCP area). </p>
<p>At line 1, one object "abc" in SCP</p>
<p>At line 2, one object "abc" in heap</p>
<p>At line 3, s3 points already existing object "abc" in SCP</p>
<p>Till this point there are 2 objects. I am not able to figure out exactly how many after line 4. Is there a way to find out how many objects are created in these cases using a java program?</p>
| 0debug
|
static bool eckd_valid_address(BootMapPointer *p)
{
const uint64_t cylinder = p->eckd.cylinder
+ ((p->eckd.head & 0xfff0) << 12);
const uint64_t head = p->eckd.head & 0x000f;
if (head >= virtio_get_heads()
|| p->eckd.sector > virtio_get_sectors()
|| p->eckd.sector <= 0) {
return false;
}
if (!virtio_guessed_disk_nature() && cylinder >= virtio_get_cylinders()) {
return false;
}
return true;
}
| 1threat
|
static inline void RENAME(rgb32to15)(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
mm_end = end - 15;
#if 1
asm volatile(
"movq %3, %%mm5 \n\t"
"movq %4, %%mm6 \n\t"
"movq %5, %%mm7 \n\t"
ASMALIGN16
"1: \n\t"
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 %%mm3, %%mm4 \n\t"
"pand %%mm6, %%mm0 \n\t"
"pand %%mm6, %%mm3 \n\t"
"pmaddwd %%mm7, %%mm0 \n\t"
"pmaddwd %%mm7, %%mm3 \n\t"
"pand %%mm5, %%mm1 \n\t"
"pand %%mm5, %%mm4 \n\t"
"por %%mm1, %%mm0 \n\t"
"por %%mm4, %%mm3 \n\t"
"psrld $6, %%mm0 \n\t"
"pslld $10, %%mm3 \n\t"
"por %%mm3, %%mm0 \n\t"
MOVNTQ" %%mm0, (%0) \n\t"
"add $16, %1 \n\t"
"add $8, %0 \n\t"
"cmp %2, %1 \n\t"
" jb 1b \n\t"
: "+r" (d), "+r"(s)
: "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215)
);
#else
__asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm __volatile(
"movq %0, %%mm7\n\t"
"movq %1, %%mm6\n\t"
::"m"(red_15mask),"m"(green_15mask));
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"
"psrlq $3, %%mm0\n\t"
"psrlq $3, %%mm3\n\t"
"pand %2, %%mm0\n\t"
"pand %2, %%mm3\n\t"
"psrlq $6, %%mm1\n\t"
"psrlq $6, %%mm4\n\t"
"pand %%mm6, %%mm1\n\t"
"pand %%mm6, %%mm4\n\t"
"psrlq $9, %%mm2\n\t"
"psrlq $9, %%mm5\n\t"
"pand %%mm7, %%mm2\n\t"
"pand %%mm7, %%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_15mask):"memory");
d += 4;
s += 16;
}
#endif
__asm __volatile(SFENCE:::"memory");
__asm __volatile(EMMS:::"memory");
#endif
while(s < end)
{
register int rgb = *(uint32_t*)s; s += 4;
*d++ = ((rgb&0xFF)>>3) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>9);
}
}
| 1threat
|
How to put (dot) to between of the number : <p>I am trying to change the type of the number but I don't know how and what keyword to search:</p>
<p>I would like to change the basic type of number in html from: </p>
<pre><code>2000000 -> 2.000.000
</code></pre>
<p>And it will show on the screen the number have the dot in between.<a href="https://i.stack.imgur.com/qvXWo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qvXWo.png" alt="enter image description here"></a></p>
<p>ps: the input is number, do I need to use Javascript to convert it to string and add to html?</p>
| 0debug
|
static void hmp_cont_cb(void *opaque, int err)
{
Monitor *mon = opaque;
if (!err) {
hmp_cont(mon, NULL);
}
}
| 1threat
|
document.write('<script src="evil.js"></script>');
| 1threat
|
python How to turn a double dictionary into a tab delimited file : <pre><code>dict = {a : {aa:1, bb:2, cc:3}, b: {aa:1, bb:2, cc:3}}
</code></pre>
<p>I want to turn this dictionary into a tab delimited file like this:</p>
<pre><code> aa bb cc
a 1 2 3
b 1 2 3
</code></pre>
<p>How should I do this. Thanks</p>
| 0debug
|
static void test_source_timer_schedule(void)
{
TimerTestData data = { .n = 0, .ctx = ctx, .ns = SCALE_MS * 750LL,
.max = 2,
.clock_type = QEMU_CLOCK_VIRTUAL };
int pipefd[2];
int64_t expiry;
g_assert(!qemu_pipe(pipefd));
qemu_set_nonblock(pipefd[0]);
qemu_set_nonblock(pipefd[1]);
aio_set_fd_handler(ctx, pipefd[0],
dummy_io_handler_read, NULL, NULL);
do {} while (g_main_context_iteration(NULL, false));
aio_timer_init(ctx, &data.timer, data.clock_type,
SCALE_NS, timer_test_cb, &data);
expiry = qemu_clock_get_ns(data.clock_type) +
data.ns;
timer_mod(&data.timer, expiry);
g_assert_cmpint(data.n, ==, 0);
g_usleep(1 * G_USEC_PER_SEC);
g_assert_cmpint(data.n, ==, 0);
g_assert(g_main_context_iteration(NULL, false));
g_assert_cmpint(data.n, ==, 1);
do {
g_assert(g_main_context_iteration(NULL, true));
} while (qemu_clock_get_ns(data.clock_type) <= expiry);
g_usleep(1 * G_USEC_PER_SEC);
g_main_context_iteration(NULL, false);
g_assert_cmpint(data.n, ==, 2);
aio_set_fd_handler(ctx, pipefd[0], NULL, NULL, NULL);
close(pipefd[0]);
close(pipefd[1]);
timer_del(&data.timer);
}
| 1threat
|
Interact with web pages using python : <p>I am quite fluent in Python, but have only really used it for data analysis.</p>
<p>I would like to learn how I can interact with webpages. For instance, I want to start by writing a code that will press a button on a webpage for me.</p>
<p>I just don't know where to start or what to google to find resources about this.</p>
<p>Could anyone point me out in the right directions, or suggest some key words that I could search for?</p>
<p>Thanks.</p>
| 0debug
|
static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev,
Error **errp)
{
VirtIODevice *vdev = VIRTIO_DEVICE(hotplug_dev);
VirtIOSCSI *s = VIRTIO_SCSI(vdev);
SCSIDevice *sd = SCSI_DEVICE(dev);
if (s->ctx && !s->dataplane_disabled) {
VirtIOSCSIBlkChangeNotifier *insert_notifier, *remove_notifier;
if (blk_op_is_blocked(sd->conf.blk, BLOCK_OP_TYPE_DATAPLANE, errp)) {
return;
}
blk_op_block_all(sd->conf.blk, s->blocker);
aio_context_acquire(s->ctx);
blk_set_aio_context(sd->conf.blk, s->ctx);
aio_context_release(s->ctx);
insert_notifier = g_new0(VirtIOSCSIBlkChangeNotifier, 1);
insert_notifier->n.notify = virtio_scsi_blk_insert_notifier;
insert_notifier->s = s;
insert_notifier->sd = sd;
blk_add_insert_bs_notifier(sd->conf.blk, &insert_notifier->n);
QTAILQ_INSERT_TAIL(&s->insert_notifiers, insert_notifier, next);
remove_notifier = g_new0(VirtIOSCSIBlkChangeNotifier, 1);
remove_notifier->n.notify = virtio_scsi_blk_remove_notifier;
remove_notifier->s = s;
remove_notifier->sd = sd;
blk_add_remove_bs_notifier(sd->conf.blk, &remove_notifier->n);
QTAILQ_INSERT_TAIL(&s->remove_notifiers, remove_notifier, next);
}
if (virtio_vdev_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) {
virtio_scsi_push_event(s, sd,
VIRTIO_SCSI_T_TRANSPORT_RESET,
VIRTIO_SCSI_EVT_RESET_RESCAN);
}
}
| 1threat
|
void hd_geometry_guess(BlockDriverState *bs,
uint32_t *pcyls, uint32_t *pheads, uint32_t *psecs,
int *ptrans)
{
int cylinders, heads, secs, translation;
if (guess_disk_lchs(bs, &cylinders, &heads, &secs) < 0) {
guess_chs_for_size(bs, pcyls, pheads, psecs);
translation = hd_bios_chs_auto_trans(*pcyls, *pheads, *psecs);
} else if (heads > 16) {
guess_chs_for_size(bs, pcyls, pheads, psecs);
translation = *pcyls * *pheads <= 131072
? BIOS_ATA_TRANSLATION_LARGE
: BIOS_ATA_TRANSLATION_LBA;
} else {
*pcyls = cylinders;
*pheads = heads;
*psecs = secs;
translation = BIOS_ATA_TRANSLATION_NONE;
}
if (ptrans) {
*ptrans = translation;
}
trace_hd_geometry_guess(bs, *pcyls, *pheads, *psecs, translation);
}
| 1threat
|
static int coroutine_fn qcow2_co_is_allocated(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, int *pnum)
{
BDRVQcowState *s = bs->opaque;
uint64_t cluster_offset;
int ret;
*pnum = nb_sectors;
qemu_co_mutex_lock(&s->lock);
ret = qcow2_get_cluster_offset(bs, sector_num << 9, pnum, &cluster_offset);
qemu_co_mutex_unlock(&s->lock);
if (ret < 0) {
*pnum = 0;
}
return (cluster_offset != 0);
}
| 1threat
|
static int map_f(BlockBackend *blk, int argc, char **argv)
{
int64_t offset;
int64_t nb_sectors, total_sectors;
char s1[64];
int64_t num;
int ret;
const char *retstr;
offset = 0;
total_sectors = blk_nb_sectors(blk);
if (total_sectors < 0) {
error_report("Failed to query image length: %s",
strerror(-total_sectors));
return 0;
}
nb_sectors = total_sectors;
do {
ret = map_is_allocated(blk_bs(blk), offset, nb_sectors, &num);
if (ret < 0) {
error_report("Failed to get allocation status: %s", strerror(-ret));
return 0;
} else if (!num) {
error_report("Unexpected end of image");
return 0;
}
retstr = ret ? " allocated" : "not allocated";
cvtstr(offset << 9ULL, s1, sizeof(s1));
printf("[% 24" PRId64 "] % 8" PRId64 "/% 8" PRId64 " sectors %s "
"at offset %s (%d)\n",
offset << 9ULL, num, nb_sectors, retstr, s1, ret);
offset += num;
nb_sectors -= num;
} while (offset < total_sectors);
return 0;
}
| 1threat
|
error: invalid types ‘int [200][float]’ for array subscript : so I basically have a coordinate system and I want to access the array by index of coordinates.pos is Vector2f(I use sfml).
int iposy=static_cast<int>(pos.y);
int iposx=static_cast<int>(pos.x);
if(col[iposy][iposx]==N)
col[iposy][iposx]=i;
else{
int vx1 = vx[i];
int vx2 = vx[(col[iposy][iposx])];
int vy1 = vy[i];
int vy2 =vy[(col[iposy][iposx])];
I get the following errors :"
error: invalid types ‘int [200][float]’ for array subscript
int vx2 = vx[(col[iposy][iposx])];
error: invalid types ‘int [200][float]’ for array subscript
int vy2 =vy[(col[iposy][iposx])];
| 0debug
|
Timespan AM to PM c# : <p>I am working on a project that involves shift work so I need my shifts to display correctly as time moves along. I currently have 3 shifts (shifth = start shifthe = end) as follows. Shift1 8AM-4PM Shift2 4:01PM-12:01AM and Shift3 12:02AM-7:59AM the AM times are overriding my PM times as I am in military time so they never change it just stays at shift3. any help would be greatly appreciated below is my code.</p>
<pre><code> private void shifts_Tick(object sender, EventArgs e)
{
if (DateTime.Now.TimeOfDay >= new TimeSpan(Settings.Default.shift1h,Settings.Default.shift1m, 0) && DateTime.Now.TimeOfDay <= new TimeSpan(Settings.Default.shift1he, Settings.Default.shift1me, 0))
{
txtbxname1.Text = "Shift1";
}
if (DateTime.Now.TimeOfDay >= new TimeSpan(Settings.Default.shift2h, Settings.Default.shift2m, 0) && DateTime.Now.TimeOfDay <= new TimeSpan(Settings.Default.shift2he, Settings.Default.shift2me, 0))
{
txtbxname1.Text = "Shift2";
}
if (DateTime.Now.TimeOfDay >= new TimeSpan(Settings.Default.shift3h, Settings.Default.shift3m, 0) && DateTime.Now.TimeOfDay <= new TimeSpan(Settings.Default.shift3he, Settings.Default.shift3me, 0))
{
txtbxname1.Text = "Shift3";
}
}
</code></pre>
| 0debug
|
Convert numbers (1-1000) to words in console log using Javascript : <p>So I was able to convert #1 - 9 into words using Javascript in console log.
How can I get my code to show the remaining numbers, which would be 10-1000?</p>
<pre><code>function numbersToWords(value) {
let input = String(value).split('');
let mapData = {
"0": "Zero",
"1": "One",
"2": "Two",
"3": "Three",
"4": "Four",
"5": "Five",
"6": "Six",
"7": "Seven",
"8": "Eight",
"9": "Nine",
};
let output = '';
var tempArray = []
for (let i = 0; i < input.length; i++) {
tempArray.push(mapData[input[i]])
}
output = tempArray.join(' ');
return output;
}
console.log(numbersToWords(123456789));
</code></pre>
| 0debug
|
NodeJs : how to use array_filter as of php : I am facing small issue on array_filter. I have successfully used it on PHP but now i want to change this on nodejs.
Any help will be thankful for me.
#MyPHPScript
$targets = [1.2, 2.3, 3.5];
$live_coin_price = 1.3;
$targets_hit = array_filter($targets, function($target_value) use($live_coin_price){
if($live_coin_price >= $target_value)
return $target_value ;
});
It will check if $target_filter > 0 or not .
This is workable code on PHP.
Now I want to change this with nodejs . How can i do it?
| 0debug
|
Jsf session timeout handling if user is not logged in : <p>I want to do the below if the session expires:
- reset session before it ends if user is not logged so he continue normally.
- redirect to login page if user is logged in.</p>
<p>I managed to do the second but I need to do the first. </p>
<p>I am working with jsf.</p>
| 0debug
|
New react-native app has 'TypeError: babelHelpers.typeof is not a function' [iOS] : <p>A new project created with the latest version of react-native throws javascript error while running(/debugging). Tested this on simulator. </p>
<pre><code>[fatal][tid:main] TypeError: babelHelpers.typeof is not a function. (In 'babelHelpers.typeof(target)', 'babelHelpers.typeof' is undefined)
</code></pre>
<p>Installed the react-native client today & created the app using </p>
<pre><code>react-native init AwesomeProject
</code></pre>
<p>App version:</p>
<pre><code>react-native-cli: 0.1.10
react-native: 0.20.0
node version: v5.6.0
</code></pre>
| 0debug
|
Unable to start activity (Binary XML file line #0: Error inflating class unknown) : <p>I have error running a Presences System. Something like this (when open ListOnline). My application stop and I ge Binary XML file error on line #0. It`s kinda weird, becouse I didnt see problem like this with line 0, so I need your help, everyone. Thanks!</p>
<pre><code>02-16 20:47:32.126 10542-10542/com.mystogan.presense E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mystogan.presense, PID: 10542
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mystogan.presense/com.mystogan.presense.ListOnline}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class <unknown>
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.mystogan.presense.ListOnline.onCreate(ListOnline.java:26)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Activity.performCreate(Activity.java:6991)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
</code></pre>
<p>activity_list_online.xml</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mystogan.presense.ListOnline">
<android.support.v7.widget.Toolbar
android:id="@+id/toolBar"
android:minHeight="?attr/actionBarSize"
android:minWidth="?attr/colorPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:title="@android:color/white">
</android.support.v7.widget.Toolbar>
<android.support.v7.widget.RecyclerView
android:id="@+id/listOnline"
android:layout_below="@id/toolBar"
android:layout_width="match_parent"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</RelativeLayout></code></pre>
</div>
</div>
</p>
| 0debug
|
Javascript Compressing if statement : is there a way of compressing this if statement.
var alive1 = true
if (x2 >= (x10 - 10) && x2 <= (x10 + 10) && y2 >= (y10 - 10) && y2 <= (y10 + 10) || x3 >= (x10 - 10) && x3 <= (x10 + 10) && y3 >= (y10 - 10) && y3 <= (y10 + 10) || x4 >= (x10 - 10) && x4 <= (x10 + 10) && y4 >= (y10 - 10) && y4 <= (y10 + 10) || x5 >= (x10 - 10) && x5 <= (x10 + 10) && y5 >= (y10 - 10) && y5 <= (y10 + 10)|| x6 >= (x10 - 10) && x6 <= (x10 + 10) && y6 >= (y10 - 10) && y6 <= (y10 + 10)) {
alive1 = false;
}
| 0debug
|
static void generate_len_table(uint8_t *dst, uint64_t *stats, int size){
heap_elem_t h[size];
int up[2*size];
int len[2*size];
int offset, i, next;
for(offset=1; ; offset<<=1){
for(i=0; i<size; i++){
h[i].name = i;
h[i].val = (stats[i] << 8) + offset;
}
for(i=size/2-1; i>=0; i--)
heap_sift(h, i, size);
for(next=size; next<size*2-1; next++){
uint64_t min1v = h[0].val;
up[h[0].name] = next;
h[0].val = INT64_MAX;
heap_sift(h, 0, size);
up[h[0].name] = next;
h[0].name = next;
h[0].val += min1v;
heap_sift(h, 0, size);
}
len[2*size-2] = 0;
for(i=2*size-3; i>=size; i--)
len[i] = len[up[i]] + 1;
for(i=0; i<size; i++) {
dst[i] = len[up[i]] + 1;
if(dst[i] > 32) break;
}
if(i==size) break;
}
}
| 1threat
|
Referencing Other Environment Variables in Systemd : <p>Is is possible to reference other environment variables when setting new ones in systemd?</p>
<pre><code>[Service]
EnvironmentFile=/etc/environment
Environment=HOSTNAME=$COREOS_PRIVATE_IPV4
Environment=IP=$COREOS_PRIVATE_IPV4
Environment=FELIX_FELIXHOSTNAME=$COREOS_PRIVATE_IPV4
</code></pre>
<p>The above code does not seem to be working.</p>
| 0debug
|
How to Complement a DNA matrix with a binary sequence : I have a DNA matrix, its length is 265*256. i have also a real number sequence .
how to complement the DNa matrix using the sequence after mapping it to a binary
sequence through the"Threshold function" which is:
[1]: https://i.stack.imgur.com/qn5Pz.png
| 0debug
|
I want to display variables in table format that should be perfectly align in python : <p>I want to make a table in python</p>
<pre><code>+----------------------------------+--------------------------+
| name | rank |
+----------------------------------+--------------------------+
| {} | [] |
+----------------------------------+--------------------------+
| {} | [] |
+----------------------------------+--------------------------+
</code></pre>
<p>But the problem is that I want to first load a text file that should contain domains name and then I would like to making a get request to each domain one by one and then print website name and status code in table format and table should be perfectly align. I have completed some code but failed to display output in a table format that should be in perfectly align as you can see in above table format.</p>
<p>Here is my code </p>
<pre><code>f = open('sub.txt', 'r')
for i in f:
try:
x = requests.get('http://'+i)
code = str(x.status_code)
#Now here I want to display `code` and `i` variables in table format
except:
pass
</code></pre>
<p>In above code I want to display code and i variables in table format as I showed in above table.</p>
<p>Thank you</p>
| 0debug
|
static void check_native_list(QObject *qobj,
UserDefNativeListUnionKind kind)
{
QDict *qdict;
QList *qlist;
int i;
g_assert(qobj);
g_assert(qobject_type(qobj) == QTYPE_QDICT);
qdict = qobject_to_qdict(qobj);
g_assert(qdict);
g_assert(qdict_haskey(qdict, "data"));
qlist = qlist_copy(qobject_to_qlist(qdict_get(qdict, "data")));
switch (kind) {
case USER_DEF_NATIVE_LIST_UNION_KIND_S8:
case USER_DEF_NATIVE_LIST_UNION_KIND_S16:
case USER_DEF_NATIVE_LIST_UNION_KIND_S32:
case USER_DEF_NATIVE_LIST_UNION_KIND_S64:
case USER_DEF_NATIVE_LIST_UNION_KIND_U8:
case USER_DEF_NATIVE_LIST_UNION_KIND_U16:
case USER_DEF_NATIVE_LIST_UNION_KIND_U32:
case USER_DEF_NATIVE_LIST_UNION_KIND_U64:
case USER_DEF_NATIVE_LIST_UNION_KIND_INTEGER:
for (i = 0; i < 32; i++) {
QObject *tmp;
QInt *qvalue;
tmp = qlist_peek(qlist);
g_assert(tmp);
qvalue = qobject_to_qint(tmp);
g_assert_cmpint(qint_get_int(qvalue), ==, i);
qobject_decref(qlist_pop(qlist));
}
break;
case USER_DEF_NATIVE_LIST_UNION_KIND_BOOLEAN:
for (i = 0; i < 32; i++) {
QObject *tmp;
QBool *qvalue;
tmp = qlist_peek(qlist);
g_assert(tmp);
qvalue = qobject_to_qbool(tmp);
g_assert_cmpint(qbool_get_bool(qvalue), ==, i % 3 == 0);
qobject_decref(qlist_pop(qlist));
}
break;
case USER_DEF_NATIVE_LIST_UNION_KIND_STRING:
for (i = 0; i < 32; i++) {
QObject *tmp;
QString *qvalue;
gchar str[8];
tmp = qlist_peek(qlist);
g_assert(tmp);
qvalue = qobject_to_qstring(tmp);
sprintf(str, "%d", i);
g_assert_cmpstr(qstring_get_str(qvalue), ==, str);
qobject_decref(qlist_pop(qlist));
}
break;
case USER_DEF_NATIVE_LIST_UNION_KIND_NUMBER:
for (i = 0; i < 32; i++) {
QObject *tmp;
QFloat *qvalue;
GString *double_expected = g_string_new("");
GString *double_actual = g_string_new("");
tmp = qlist_peek(qlist);
g_assert(tmp);
qvalue = qobject_to_qfloat(tmp);
g_string_printf(double_expected, "%.6f", (double)i / 3);
g_string_printf(double_actual, "%.6f", qfloat_get_double(qvalue));
g_assert_cmpstr(double_actual->str, ==, double_expected->str);
qobject_decref(qlist_pop(qlist));
g_string_free(double_expected, true);
g_string_free(double_actual, true);
}
break;
default:
g_assert_not_reached();
}
QDECREF(qlist);
}
| 1threat
|
static void pc_init1(MachineState *machine,
int pci_enabled,
int kvmclock_enabled)
{
PCMachineState *pc_machine = PC_MACHINE(machine);
MemoryRegion *system_memory = get_system_memory();
MemoryRegion *system_io = get_system_io();
int i;
ram_addr_t below_4g_mem_size, above_4g_mem_size;
PCIBus *pci_bus;
ISABus *isa_bus;
PCII440FXState *i440fx_state;
int piix3_devfn = -1;
qemu_irq *cpu_irq;
qemu_irq *gsi;
qemu_irq *i8259;
qemu_irq *smi_irq;
GSIState *gsi_state;
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
BusState *idebus[MAX_IDE_BUS];
ISADevice *rtc_state;
ISADevice *floppy;
MemoryRegion *ram_memory;
MemoryRegion *pci_memory;
MemoryRegion *rom_memory;
DeviceState *icc_bridge;
FWCfgState *fw_cfg = NULL;
PcGuestInfo *guest_info;
ram_addr_t lowmem;
if (machine->ram_size >= 0xe0000000) {
lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000;
} else {
lowmem = 0xe0000000;
}
if (lowmem > pc_machine->max_ram_below_4g) {
lowmem = pc_machine->max_ram_below_4g;
if (machine->ram_size - lowmem > lowmem &&
lowmem & ((1ULL << 30) - 1)) {
error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64
") not a multiple of 1G; possible bad performance.",
pc_machine->max_ram_below_4g);
}
}
if (machine->ram_size >= lowmem) {
above_4g_mem_size = machine->ram_size - lowmem;
below_4g_mem_size = lowmem;
} else {
above_4g_mem_size = 0;
below_4g_mem_size = machine->ram_size;
}
if (xen_enabled() && xen_hvm_init(&below_4g_mem_size, &above_4g_mem_size,
&ram_memory) != 0) {
fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
exit(1);
}
icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
object_property_add_child(qdev_get_machine(), "icc-bridge",
OBJECT(icc_bridge), NULL);
pc_cpus_init(machine->cpu_model, icc_bridge);
if (kvm_enabled() && kvmclock_enabled) {
kvmclock_create();
}
if (pci_enabled) {
pci_memory = g_new(MemoryRegion, 1);
memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
rom_memory = pci_memory;
} else {
pci_memory = NULL;
rom_memory = system_memory;
}
guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size);
guest_info->has_acpi_build = has_acpi_build;
guest_info->legacy_acpi_table_size = legacy_acpi_table_size;
guest_info->isapc_ram_fw = !pci_enabled;
guest_info->has_reserved_memory = has_reserved_memory;
if (smbios_defaults) {
MachineClass *mc = MACHINE_GET_CLASS(machine);
smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
mc->name, smbios_legacy_mode);
}
if (!xen_enabled()) {
fw_cfg = pc_memory_init(machine, system_memory,
below_4g_mem_size, above_4g_mem_size,
rom_memory, &ram_memory, guest_info);
} else if (machine->kernel_filename != NULL) {
fw_cfg = xen_load_linux(machine->kernel_filename,
machine->kernel_cmdline,
machine->initrd_filename,
below_4g_mem_size,
guest_info);
}
gsi_state = g_malloc0(sizeof(*gsi_state));
if (kvm_irqchip_in_kernel()) {
kvm_pc_setup_irq_routing(pci_enabled);
gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,
GSI_NUM_PINS);
} else {
gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
}
if (pci_enabled) {
pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
system_memory, system_io, machine->ram_size,
below_4g_mem_size,
above_4g_mem_size,
pci_memory, ram_memory);
} else {
pci_bus = NULL;
i440fx_state = NULL;
isa_bus = isa_bus_new(NULL, system_io);
no_hpet = 1;
}
isa_bus_irqs(isa_bus, gsi);
if (kvm_irqchip_in_kernel()) {
i8259 = kvm_i8259_init(isa_bus);
} else if (xen_enabled()) {
i8259 = xen_interrupt_controller_init();
} else {
cpu_irq = pc_allocate_cpu_irq();
i8259 = i8259_init(isa_bus, cpu_irq[0]);
}
for (i = 0; i < ISA_NUM_IRQS; i++) {
gsi_state->i8259_irq[i] = i8259[i];
}
if (pci_enabled) {
ioapic_init_gsi(gsi_state, "i440fx");
}
qdev_init_nofail(icc_bridge);
pc_register_ferr_irq(gsi[13]);
pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled(),
0x4);
pc_nic_init(isa_bus, pci_bus);
ide_drive_get(hd, MAX_IDE_BUS);
if (pci_enabled) {
PCIDevice *dev;
if (xen_enabled()) {
dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1);
} else {
dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
}
idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
} else {
for(i = 0; i < MAX_IDE_BUS; i++) {
ISADevice *dev;
char busname[] = "ide.0";
dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i],
ide_irq[i],
hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
busname[4] = '0' + i;
idebus[i] = qdev_get_child_bus(DEVICE(dev), busname);
}
}
pc_cmos_init(below_4g_mem_size, above_4g_mem_size, machine->boot_order,
floppy, idebus[0], idebus[1], rtc_state);
if (pci_enabled && usb_enabled(false)) {
pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
}
if (pci_enabled && acpi_enabled) {
DeviceState *piix4_pm;
I2CBus *smbus;
smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
gsi[9], *smi_irq,
kvm_enabled(), fw_cfg, &piix4_pm);
smbus_eeprom_init(smbus, 8, NULL, 0);
object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
TYPE_HOTPLUG_HANDLER,
(Object **)&pc_machine->acpi_dev,
object_property_allow_set_link,
OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort);
object_property_set_link(OBJECT(machine), OBJECT(piix4_pm),
PC_MACHINE_ACPI_DEVICE_PROP, &error_abort);
}
if (pci_enabled) {
pc_pci_device_init(pci_bus);
}
}
| 1threat
|
static void rtas_ibm_change_msi(sPAPREnvironment *spapr,
uint32_t token, uint32_t nargs,
target_ulong args, uint32_t nret,
target_ulong rets)
{
uint32_t config_addr = rtas_ld(args, 0);
uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2);
unsigned int func = rtas_ld(args, 3);
unsigned int req_num = rtas_ld(args, 4);
unsigned int seq_num = rtas_ld(args, 5);
unsigned int ret_intr_type;
int ndev, irq;
sPAPRPHBState *phb = NULL;
PCIDevice *pdev = NULL;
switch (func) {
case RTAS_CHANGE_MSI_FN:
case RTAS_CHANGE_FN:
ret_intr_type = RTAS_TYPE_MSI;
break;
case RTAS_CHANGE_MSIX_FN:
ret_intr_type = RTAS_TYPE_MSIX;
break;
default:
fprintf(stderr, "rtas_ibm_change_msi(%u) is not implemented\n", func);
rtas_st(rets, 0, -3);
return;
}
phb = find_phb(spapr, buid);
if (phb) {
pdev = find_dev(spapr, buid, config_addr);
}
if (!phb || !pdev) {
rtas_st(rets, 0, -3);
return;
}
if (!req_num) {
ndev = spapr_msicfg_find(phb, config_addr, false);
if (ndev < 0) {
trace_spapr_pci_msi("MSI has not been enabled", -1, config_addr);
rtas_st(rets, 0, -1);
return;
}
trace_spapr_pci_msi("Released MSIs", ndev, config_addr);
rtas_st(rets, 0, 0);
rtas_st(rets, 1, 0);
return;
}
ndev = spapr_msicfg_find(phb, config_addr, true);
if (ndev >= SPAPR_MSIX_MAX_DEVS || ndev < 0) {
fprintf(stderr, "No free entry for a new MSI device\n");
rtas_st(rets, 0, -1);
return;
}
trace_spapr_pci_msi("Configuring MSI", ndev, config_addr);
if (phb->msi_table[ndev].nvec && (req_num != phb->msi_table[ndev].nvec)) {
fprintf(stderr, "Cannot reuse MSI config for device#%d", ndev);
rtas_st(rets, 0, -1);
return;
}
if (!phb->msi_table[ndev].nvec) {
irq = spapr_allocate_irq_block(req_num, false);
if (irq < 0) {
fprintf(stderr, "Cannot allocate MSIs for device#%d", ndev);
rtas_st(rets, 0, -1);
return;
}
phb->msi_table[ndev].irq = irq;
phb->msi_table[ndev].nvec = req_num;
phb->msi_table[ndev].config_addr = config_addr;
}
spapr_msi_setmsg(pdev, phb->msi_win_addr | (ndev << 16),
ret_intr_type == RTAS_TYPE_MSIX, req_num);
rtas_st(rets, 0, 0);
rtas_st(rets, 1, req_num);
rtas_st(rets, 2, ++seq_num);
rtas_st(rets, 3, ret_intr_type);
trace_spapr_pci_rtas_ibm_change_msi(func, req_num);
}
| 1threat
|
scanf function not working on GCC ubuntu : <p>I'm starting to write a C code after a gap of almost 10 year. I was teaching my sister and unfortunately got stuck at a very basic scanf() function for a simple interest program on Ubuntu.</p>
<p>My program is not giving any compilation error but it's not showing anything on screen</p>
<p>Here is the code:</p>
<pre><code>#include <stdio.h>
int main()
{
int p,n;
float r,si;
printf("enter values of p,n,r");
scanf("%d %d %f",&p,&n,&r);
si = p*n*r/100;
printf("%f" , si);
return 0;
}
</code></pre>
| 0debug
|
Parse error: syntax error, unexpected '$Database' (T_VARIABLE) in /web/htdocs/www.aieci.it/home/Ptp145a000/salva.php on line 23 : <p>I've got this error on the following code and I'm not able to solve.
I've already cheched with hex editor and everything seems to be ok.
Can someone help me?</p>
<p>The database in defined in another php file recalled with the include statement at the beginning.</p>
<p>The code is the following:</p>
<pre><code><?php
// -----------------------------------------------------------
// INCLUSIONE FILE
// ----------------------------------------------------------------------
$GLOBALS['HomeDir']=substr($_SERVER['SCRIPT_FILENAME'], 0, strrpos($_SERVER['SCRIPT_FILENAME'], "")); //Rilevo Home directory
require_once "Include/Include.php"; //Inclusioni generali
if (isset($_GET["id"]) and isset($_GET["variabile"]) and isset($_GET["da"]) and isset($_GET["a"])){
$Nome="storico.csv";
header("Content-Type: application/text");
header("Content-Disposition: attachment; filename=".$Nome);
$Iden=$_GET["id"];
$Variab=$_GET["variabile"];
$Start=$_GET["da"];
$End=$_GET["a"];
if ($GLOBALS['Db']->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if (isset($GLOBALS['Db'])
$Database=$GLOBALS['Db']->get_results("SELECT DateTime, Value FROM ".RESTDATA." WHERE (UID = '".$Iden."' AND Field = '".$Variab."' AND DateTime >= '".UnixToMySQLTime($Start)."' AND DateTime <= '".UnixToMySQLTime($End)."' ORDER BY ID ASC;");
}
foreach ($Database as $Data){
print "'".gmdate("d/m H:i", MySQLToUnixTime($Data->DateTime))."';".$Data->Value."n"; //Scrivo in tabella dato
}
?>
</code></pre>
| 0debug
|
Which is better between @HostListener and Renderer.listen? : <p>I'm building a simple canvas drag n drop application similar to <a href="http://rectangleworld.com/demos/SimpleDragging/SimpleDragging" rel="noreferrer">http://rectangleworld.com/demos/SimpleDragging/SimpleDragging</a>. For mouseevent listeners, I used @Hostlistener because for me it has simpler syntax and it is working. There's another way to achieve it with Renderer.listen. But I can't decide to use it over hostlistener. Can anyone explain and tell which is better between <code>@HostListener</code> and <code>Renderer.listen</code>?</p>
| 0debug
|
How to remove duplicates from inked list which repeats double number of times(C++)? : I've been trying to create own linked list class on C++. My task is remove all nodes which data repeats double number of times in list and store only one node if data repeats odd number of times. I've written function removeDuplicates(), but my program crashes when i try to use the function. Implementation here:
void LinkedList::removeDuplicates(){
Node *ptr1, *ptr2, *dup, *toDel;
int counter = 1;
ptr1 = top;
while(ptr1 != NULL && ptr1->next != NULL){
ptr2 = ptr1;
while(ptr2->next != NULL){
if(ptr1->name == ptr2->next->name){
dup = ptr2->next;
ptr2->next = ptr2->next->next;
delete dup;
counter++;
} else {
ptr2 = ptr2->next;
}
}
if(counter % 2 == 0){
toDel = ptr1;
ptr1->next = ptr1->next->next;
ptr1 = ptr1->next;
delete toDel;
}else{
ptr1 = ptr1->next;
}
}
}
| 0debug
|
Unable to create table with column name "schemas" : <p>When I tried to execute following statement.</p>
<pre><code>create table user_schemas (user_id varchar(255) not null, schemas varchar(255));
</code></pre>
<p>I am getting following error.</p>
<pre><code>ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'schemas varchar(255))' at line 1
</code></pre>
<p>When I change the column name "schemas" to something else, it is working fine.</p>
<pre><code>mysql> create table user_schemas (user_id varchar(255) not null, schemas varchar(255));
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'schemas varchar(255))' at line 1
mysql>
mysql> create table user_schemas (user_id varchar(255) not null, rules varchar(255));
Query OK, 0 rows affected (0.01 sec)
</code></pre>
<p>Any idea on how to solve this problem??</p>
| 0debug
|
How to change the style of Title attribute tag? : <p>I have this line on my code:</p>
<pre><code><i title="Música Anterior" class="icon icon-to-start prev"></i>
</code></pre>
<p>How I cant make it work like this:
<a href="http://jsfiddle.net/tDQWN/129/" rel="nofollow noreferrer">Title Attb</a></p>
| 0debug
|
static void map_page(uint8_t **ptr, uint64_t addr, uint32_t wanted)
{
target_phys_addr_t len = wanted;
if (*ptr) {
cpu_physical_memory_unmap(*ptr, len, 1, len);
}
*ptr = cpu_physical_memory_map(addr, &len, 1);
if (len < wanted) {
cpu_physical_memory_unmap(*ptr, len, 1, len);
*ptr = NULL;
}
}
| 1threat
|
static void coroutine_fn v9fs_xattrcreate(void *opaque)
{
int flags;
int32_t fid;
int64_t size;
ssize_t err = 0;
V9fsString name;
size_t offset = 7;
V9fsFidState *file_fidp;
V9fsFidState *xattr_fidp;
V9fsPDU *pdu = opaque;
v9fs_string_init(&name);
err = pdu_unmarshal(pdu, offset, "dsqd", &fid, &name, &size, &flags);
if (err < 0) {
goto out_nofid;
}
trace_v9fs_xattrcreate(pdu->tag, pdu->id, fid, name.data, size, flags);
file_fidp = get_fid(pdu, fid);
if (file_fidp == NULL) {
err = -EINVAL;
goto out_nofid;
}
xattr_fidp = file_fidp;
xattr_fidp->fid_type = P9_FID_XATTR;
xattr_fidp->fs.xattr.copied_len = 0;
xattr_fidp->fs.xattr.xattrwalk_fid = false;
xattr_fidp->fs.xattr.len = size;
xattr_fidp->fs.xattr.flags = flags;
v9fs_string_init(&xattr_fidp->fs.xattr.name);
v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name);
g_free(xattr_fidp->fs.xattr.value);
xattr_fidp->fs.xattr.value = g_malloc0(size);
err = offset;
put_fid(pdu, file_fidp);
out_nofid:
pdu_complete(pdu, err);
v9fs_string_free(&name);
}
| 1threat
|
void virtio_queue_set_num(VirtIODevice *vdev, int n, int num)
{
if (num <= VIRTQUEUE_MAX_SIZE) {
vdev->vq[n].vring.num = num;
virtqueue_init(&vdev->vq[n]);
}
}
| 1threat
|
static void unicore_ii_cpu_initfn(Object *obj)
{
UniCore32CPU *cpu = UNICORE32_CPU(obj);
CPUUniCore32State *env = &cpu->env;
env->cp0.c0_cpuid = 0x40010863;
set_feature(env, UC32_HWCAP_CMOV);
set_feature(env, UC32_HWCAP_UCF64);
env->ucf64.xregs[UC32_UCF64_FPSCR] = 0;
env->cp0.c0_cachetype = 0x1dd20d2;
env->cp0.c1_sys = 0x00090078;
}
| 1threat
|
Trying to use bash on Windows and got no installed distributions message : <p>I am trying to use <strong>bash</strong> on <strong>Windows 10</strong>, but I'm getting this message when tried to run bash:</p>
<blockquote>
<p>Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Windows Store:
<a href="https://aka.ms/wslstore" rel="noreferrer">https://aka.ms/wslstore</a> Press any key to continue...</p>
</blockquote>
<p>When I go to that url which opens the <strong>Windows Store</strong> app, there no sign of any <strong>Linux</strong> distribution there.</p>
<p>My windows version is(as in my right bottom corner of the screen):</p>
<blockquote>
<p>Windows 10 Enterprise Insider Preview. Evaluation copy.Build
16215.rs_prerelease.170603-1840</p>
</blockquote>
<p>I follow the instructions in this guide <a href="https://msdn.microsoft.com/en-us/commandline/wsl/install_guide" rel="noreferrer">Installation Guide</a> and also was watching this video <a href="https://www.youtube.com/watch?v=XfRo63afjtM&feature=em-uploademail" rel="noreferrer">Editing code and files on Windows Subsystem for Linux on Windows 10</a> from Scott Hanselman, but they didn't get the message of no installed distribution.</p>
<p>Any Help?</p>
| 0debug
|
static void scsi_disk_apply_mode_select(SCSIDiskState *s, int page, uint8_t *p)
{
switch (page) {
case MODE_PAGE_CACHING:
bdrv_set_enable_write_cache(s->qdev.conf.bs, (p[0] & 4) != 0);
break;
default:
break;
}
}
| 1threat
|
Why does the command prompt showing this following error? : <p>I just installed the GCC compiler and wanted to test if it is working correctly. But in the middle, I am facing this issue with the command prompt as shown in the figure. 'ls' ie., List command is not working what might be the problem??</p>
<p>Regards,<a href="https://i.stack.imgur.com/Jd8OR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jd8OR.png" alt="enter image description here"></a></p>
| 0debug
|
Add two different integers together : <p>Currently I am having a speed bump with adding two different integers. For example </p>
<pre><code>int i = 32;
int j = 50;
/* Add i and j together into 3250 */
</code></pre>
<p>What I thought was changing the integers into strings and add them together but that takes too much effort. Is there any other way? </p>
| 0debug
|
how to load bitmap directly with picasso library like following : <pre><code>Picasso.with(context).load("url").into(imageView);
</code></pre>
<p>Here instead of url i want bitmap how can i achieve this.
like below-</p>
<pre><code>Picasso.with(context).load(bitmap).into(imageView);
</code></pre>
| 0debug
|
the logic behind converting integer array into String array is confusing : What is main logic trying to do **(from repeat loop)** ???.......
let digitNames = [
0: "Zero", 1: "One", 2: "Two", 3: "Three", 4: "Four",
5: "Five", 6: "Six", 7: "Seven", 8: "Eight", 9: "Nine"
]
let numbers = [16, 58, 510]
let strings = numbers.map { (number) -> String in
var number = number
var output = ""
repeat {
output = digitNames[number % 10]! + output
number /= 10
} while number > 0
return output
}
// strings is inferred to be of type [String]
// its value is ["OneSix", "FiveEight", "FiveOneZero"]
| 0debug
|
How get value from other component in react js? : I try get value from other elements with help props, but not worked. My logic, when load the main.js makes request to the child.js and I get the age, but not works.
class Main Connect extends Component {
constructor(props) {
this.age = this.props.age
}
render() {
<Child />
return(this.age)
}
}
class Chaild Connect extends Component {
render()
return(<Main age='21' />)
}
| 0debug
|
static int i386_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu,
int max_insns)
{
DisasContext *dc = container_of(dcbase, DisasContext, base);
CPUX86State *env = cpu->env_ptr;
uint32_t flags = dc->base.tb->flags;
target_ulong cs_base = dc->base.tb->cs_base;
dc->pe = (flags >> HF_PE_SHIFT) & 1;
dc->code32 = (flags >> HF_CS32_SHIFT) & 1;
dc->ss32 = (flags >> HF_SS32_SHIFT) & 1;
dc->addseg = (flags >> HF_ADDSEG_SHIFT) & 1;
dc->f_st = 0;
dc->vm86 = (flags >> VM_SHIFT) & 1;
dc->cpl = (flags >> HF_CPL_SHIFT) & 3;
dc->iopl = (flags >> IOPL_SHIFT) & 3;
dc->tf = (flags >> TF_SHIFT) & 1;
dc->cc_op = CC_OP_DYNAMIC;
dc->cc_op_dirty = false;
dc->cs_base = cs_base;
dc->popl_esp_hack = 0;
dc->mem_index = 0;
#ifdef CONFIG_SOFTMMU
dc->mem_index = cpu_mmu_index(env, false);
#endif
dc->cpuid_features = env->features[FEAT_1_EDX];
dc->cpuid_ext_features = env->features[FEAT_1_ECX];
dc->cpuid_ext2_features = env->features[FEAT_8000_0001_EDX];
dc->cpuid_ext3_features = env->features[FEAT_8000_0001_ECX];
dc->cpuid_7_0_ebx_features = env->features[FEAT_7_0_EBX];
dc->cpuid_xsave_features = env->features[FEAT_XSAVE];
#ifdef TARGET_X86_64
dc->lma = (flags >> HF_LMA_SHIFT) & 1;
dc->code64 = (flags >> HF_CS64_SHIFT) & 1;
#endif
dc->flags = flags;
dc->jmp_opt = !(dc->tf || dc->base.singlestep_enabled ||
(flags & HF_INHIBIT_IRQ_MASK));
dc->repz_opt = !dc->jmp_opt && !(dc->base.tb->cflags & CF_USE_ICOUNT);
#if 0
if (!dc->addseg && (dc->vm86 || !dc->pe || !dc->code32))
printf("ERROR addseg\n");
#endif
cpu_T0 = tcg_temp_new();
cpu_T1 = tcg_temp_new();
cpu_A0 = tcg_temp_new();
cpu_tmp0 = tcg_temp_new();
cpu_tmp1_i64 = tcg_temp_new_i64();
cpu_tmp2_i32 = tcg_temp_new_i32();
cpu_tmp3_i32 = tcg_temp_new_i32();
cpu_tmp4 = tcg_temp_new();
cpu_ptr0 = tcg_temp_new_ptr();
cpu_ptr1 = tcg_temp_new_ptr();
cpu_cc_srcT = tcg_temp_local_new();
return max_insns;
}
| 1threat
|
Convert String to json python : <p>I have this type of string given by my lambda function </p>
<blockquote>
<p>aws-internal/3 aws-sdk-java/1.11.432
Linux/4.9.124-0.1.ac.198.71.329.metal1.x86_64
OpenJDK_64-Bit_Server_VM/25.181-b13 java/1.8.0_181</p>
</blockquote>
<p>Now i want to convert this string into Json like</p>
<pre><code>{
aws-internal:3,
aws-sdk-java:1.11.432,
Linux:/4.9.124-0.1.ac.198.71.329.metal1.x86_64
}
</code></pre>
<p>Please Give me a suggestion i search many website and library </p>
| 0debug
|
static void gen_cli(DisasContext *ctx)
{
#if defined(CONFIG_USER_ONLY)
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
#else
if (unlikely(ctx->pr)) {
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
return;
}
#endif
}
| 1threat
|
Gitlab CI using Badges for each job : <p>Let's say I have configured multiple jobs for a project like following:</p>
<pre><code>build_win32:
script: ...
build_ios:
script: ...
unit_tests:
script: ...
server_tests:
script: ...
client_tests:
script: ...
</code></pre>
<p>What I want to achieve is to configure badges per each job under README.md so that I can have immediate feedback of specifically which part went wrong.</p>
<p>There is a <a href="https://docs.gitlab.com/ee/user/project/pipelines/settings.html#badges" rel="noreferrer">Gitlab Documentation</a> on setting badges but this has a limitation that it shows how to configure badges for <code>build</code> and <code>coverage status</code> only.</p>
<p>I'm wondering if there is such a build-in feature in Gitlab CI. I could use 3rd party plugins also. Any helps will be appreciated.</p>
| 0debug
|
How to get out of man command in terminal : <p>How to get out of <code>man command</code> ?</p>
<p>I pressed <code>man ls</code> command in mac and it is lot letting me enter other commands.</p>
<p>As I am learning Linux , so please do not downvote me</p>
| 0debug
|
Java(script) save variable outside of program : I am writing a simple iterator script in a third party program:
var 1 = 1.
function run(){
output1 = i;
i = i + 1
}
This function is run for every record. But the program works with batches of 25 records. So for 100 records it outputs 4 times 1 to 25. I have access to the java libs. It is a linux server. Can I put i in some kind of global java variable or memory, so i can live outside of my program? I tried reading and writing i to a text file. This works but is to slow giving me some empty's, ones and two's. Making the program wait would be my last option (how can I do that?
I have no other easy to add these numbers. I am limited by the program.
| 0debug
|
event.target.name is undefined : <p>I am trying to use e.target.name in react to set the state as I have done before, however e.target.name seems to be undefined for some reason and I can't figure out why, if any one has a suggestion it will be welcome.
thanks!</p>
<pre><code><li
onMouseEnter = {this.handleMouseEnter.bind(this)}
name ='HOME'
id="some id"
style={main.element}>HOME</li>
</code></pre>
<p>my event handler has only a debugger for me to play with</p>
<pre><code>handleMouseEnter(e){
debugger
}
</code></pre>
<p>and when i try to get the value of the name property i get undefined</p>
<pre><code>e.target
//<li name="HOME" id="some id" style="padding: 10px;">HOME</li>
e.target.name
//undefined
e.target.id
//"some id"
</code></pre>
| 0debug
|
const char *avfilter_configuration(void)
{
return FFMPEG_CONFIGURATION;
}
| 1threat
|
static void fsl_imx25_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
dc->realize = fsl_imx25_realize;
}
| 1threat
|
static void FUNCC(ff_h264_add_pixels4)(uint8_t *_dst, int16_t *_src, int stride)
{
int i;
pixel *dst = (pixel *) _dst;
dctcoef *src = (dctcoef *) _src;
stride /= sizeof(pixel);
for (i = 0; i < 4; i++) {
dst[0] += src[0];
dst[1] += src[1];
dst[2] += src[2];
dst[3] += src[3];
dst += stride;
src += 4;
}
memset(_src, 0, sizeof(dctcoef) * 16);
}
| 1threat
|
What's the ideal way to include dictionaries (gazetteer) in spaCy to improve NER? : <p>I'm currently working on replacing a system based on nltk entity extraction combined with regexp matching where I have several named entity dictionaries. The dictionary entities are both of common type (PERSON (employees) etc.) as well as custom types (e.g. SKILL). I want to use the pre-trained spaCy model and include my dictionaries somehow, to increase the NER accuracy. Here are my thoughts on possible methods:</p>
<ul>
<li><p>Use spaCy's Matcher API, iterate through the dictionary and add each phrase with a callback to add the entity?</p></li>
<li><p>I've just found spacy-lookup, which seems like an easy way to provide long lists of words/phrases to match.</p></li>
<li><p>But what if I want to have fuzzy matching? Is there a way to add directly to the Vocab and thus have some fuzzy matching through Bloom filter / n-gram word vectors, or is there some extension out there that suits this need? Otherwise I guess I could copy spacy-lookup and replace the flashtext machinery with something else, e.g. Levenshtein distance.</p></li>
<li><p>While playing around with spaCy I did try just training the NER directly with a single word from the dictionary (without any sentence context), and this did "work". But I would, of course, have to take much care to keep the model from forgetting everything. </p></li>
</ul>
<p>Any help appreciated, I feel like this must be a pretty common requirement and would love to hear what's working best for people out there. </p>
| 0debug
|
FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,
AddressSpace *dma_as)
{
DeviceState *dev;
SysBusDevice *sbd;
FWCfgIoState *ios;
FWCfgState *s;
bool dma_requested = dma_iobase && dma_as;
dev = qdev_create(NULL, TYPE_FW_CFG_IO);
if (!dma_requested) {
qdev_prop_set_bit(dev, "dma_enabled", false);
}
fw_cfg_init1(dev);
sbd = SYS_BUS_DEVICE(dev);
ios = FW_CFG_IO(dev);
sysbus_add_io(sbd, iobase, &ios->comb_iomem);
s = FW_CFG(dev);
if (s->dma_enabled) {
s->dma_as = dma_as;
s->dma_addr = 0;
sysbus_add_io(sbd, dma_iobase, &s->dma_iomem);
}
return s;
}
| 1threat
|
best way to serialize json android : <p>I'm quite new in android development. I have an app and I'm going with retrofit for the network requests. to handle the response there are some good libraries that I found such as gson , jackson , moshi and som much more. I'm abit confused and I can't decide what I should go with in this particular case. Any help is appreciated.m</p>
| 0debug
|
javascript not showing exact value in calulations : I would like to know why there is always some difference in value,when i perform the below calcualtions.
```
<!-- begin snippet: js hide: false console: true babel: false -->
var amt=1000;
var cr= 3.02%;
var net = (cr/100)*amt;
alert(net);//shows 29.02 instead of 30.02
```
| 0debug
|
How can you use multiple directories for static files in an aspnet core app? : <p>By default, the wwwroot directory can host static files. However, in some scenarios, it might be ideal to have two directories for static files. (For example, having webpack dump a build into one gitignored directory, and keeping some image files, favicon and such in a not-gitignored directory). Technically, this could be achieved by having two folders within the wwwroot, but it might organizationally preferable to have these folders at the root level. Is there a way to configure an aspnet core app to use two separate directories for static files?</p>
| 0debug
|
static VFIOINTp *vfio_init_intp(VFIODevice *vbasedev,
struct vfio_irq_info info)
{
int ret;
VFIOPlatformDevice *vdev =
container_of(vbasedev, VFIOPlatformDevice, vbasedev);
SysBusDevice *sbdev = SYS_BUS_DEVICE(vdev);
VFIOINTp *intp;
intp = g_malloc0(sizeof(*intp));
intp->vdev = vdev;
intp->pin = info.index;
intp->flags = info.flags;
intp->state = VFIO_IRQ_INACTIVE;
intp->kvm_accel = false;
sysbus_init_irq(sbdev, &intp->qemuirq);
ret = event_notifier_init(&intp->interrupt, 0);
if (ret) {
g_free(intp);
error_report("vfio: Error: trigger event_notifier_init failed ");
return NULL;
}
ret = event_notifier_init(&intp->unmask, 0);
if (ret) {
g_free(intp);
error_report("vfio: Error: resamplefd event_notifier_init failed");
return NULL;
}
QLIST_INSERT_HEAD(&vdev->intp_list, intp, next);
return intp;
}
| 1threat
|
static int handle_ping(URLContext *s, RTMPPacket *pkt)
{
RTMPContext *rt = s->priv_data;
int t, ret;
if (pkt->data_size < 2) {
av_log(s, AV_LOG_ERROR, "Too short ping packet (%d)\n",
pkt->data_size);
return AVERROR_INVALIDDATA;
t = AV_RB16(pkt->data);
if (t == 6) {
if ((ret = gen_pong(s, rt, pkt)) < 0)
return 0;
| 1threat
|
void acpi_pm1_cnt_init(ACPIREGS *ar, MemoryRegion *parent, uint8_t s4_val)
{
ar->pm1.cnt.s4_val = s4_val;
ar->wakeup.notify = acpi_notify_wakeup;
qemu_register_wakeup_notifier(&ar->wakeup);
memory_region_init_io(&ar->pm1.cnt.io, memory_region_owner(parent),
&acpi_pm_cnt_ops, ar, "acpi-cnt", 2);
memory_region_add_subregion(parent, 4, &ar->pm1.cnt.io);
}
| 1threat
|
How to access the NoneType type? : <p>For example looking at the type of None, we can see that it has <code>NoneType</code>:</p>
<pre><code>>>> type(None)
NoneType
</code></pre>
<p>However a <code>NameError</code> results when trying to access the <code>NoneType</code>:</p>
<pre><code>>>> NoneType
NameError: name 'NoneType' is not defined
</code></pre>
<p>How can the <code>NoneType</code> be accessed?</p>
| 0debug
|
the index page of gii doesn't work fine....lack of css style : [something wrong with index][1]
it doesn't work out.the success one is like this:
[the correct one][2]
the config of nginx is right.so, why can't I see the page with correct css style?
I'm new to yii,so please help me at your convenience
[1]: https://i.stack.imgur.com/Ca9vr.png
[2]: https://i.stack.imgur.com/CC1TR.png
| 0debug
|
NoSuchElementException, when method is called after code above it is run : <p>When I run my code, it will run fine up to the line "scanner.close()".
After than, when I run the "SumTenNumbers()" method... it will run the first line of the while loop once and crash with the "NoSuchElementException"...
When I remove the code above the line calling the method, it runs fine...
Why does this occur, and how can I solve it?</p>
<p>This is the code:</p>
<pre><code>public class Main
{
public static void main(String[] args)
{
// we use the class "scanner" for input data
Scanner scanner = new Scanner(System.in); //System.in allows you to type input data into the console which can be returned into the console
System.out.println("Enter your name: ");
String name = scanner.nextLine();
System.out.println("Your name is " + name);
System.out.println("Enter your year of birth: ");
boolean isInt = scanner.hasNextInt();
if (isInt)
{
int yearOfBirth = scanner.nextInt();
int age = 2019 - yearOfBirth;
if (age >= 0 && age <= 120)
{
System.out.println("You are " + age + " years old");
}
else
{
System.out.println("Invalid year of birth");
}
}
else
{
System.out.println("Unable to parse year of birth");
}
scanner.close(); // we must close scanner
SumTenNumbers();
}
public static void SumTenNumbers()
{
var reader = new Scanner(System.in);
int sum = 0;
int count = 1;
while (count < 11)
{
System.out.println("Enter number " + count + ": ");
boolean valid = reader.hasNextInt();
if (valid)
{
int userNum = reader.nextInt();
sum += userNum;
count++;
}
else
{
reader.next();
System.out.println("INVALID");
}
}
System.out.println(sum);
reader.close();
}
}
</code></pre>
<p>This is how it looks when I run the code...</p>
<pre><code>Enter your name:
Siddharth
Your name is Siddharth
Enter your year of birth:
2001
You are 18 years old
Enter number 1:
Exception in thread "main" java.util.NoSuchElementException
at java.base/java.util.Scanner.throwFor(Scanner.java:937)
at java.base/java.util.Scanner.next(Scanner.java:1478)
at com.company.Main.SumTenNumbers(Main.java:64)
at com.company.Main.main(Main.java:39)
Process finished with exit code 1
</code></pre>
| 0debug
|
Flexbox with Random Whitespace At Top : I have an issue with a flexbox not filling up all the way to my navbar, I cannot for the life of me figure it out and a negative margin does absolutely nothing
Here's a screenshot

Here's the code
<div class="container" id="heroImage">
<div class="hero">
<div class="center-content">
<h1>Lazris</h1>
<h3>Revive Your Web Presence</h3>
<a href="#" class="button">Some Action Here</a>
</div>
</div>
</div>
And the CSS
.hero {
background-image: url("https://unsplash.it/1500?random");
background-size: cover;
background-position: center;
width: 100%;
height: 100%;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
margin-top: -10px;
}
.hero > .center-content {
width: 400px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
margin: auto;
}
.hero > .center-content h1, .center-content h3 {
color: white;
line-height: 1;
}
.hero > .center-content h1 {
text-transform: uppercase;
font-size: 3em;
margin-bottom: 0;
text-align: center;
}
.hero > .center-content h3 {
margin-bottom: 40px;
font-size: 1.5em;
font-weight: normal;
}
.center-content > .button {
text-transform: uppercase;
color: white;
padding: 20px;
border: 1px solid white;
text-decoration: none;
}
.center-content > .button:hover {
background-color: rgba(255, 255, 255, 0.3);
border-color: rgba(255, 255, 255, 0.7);
color: #006594;
}
Any help is appreciated
Thanks!
| 0debug
|
How to delete extra spaces in an input type="text"? : <p>I got this input type="text" and this button which shows the users input, but if the input have extra spaces, them will be showed too.How to remove these extra spaces form the input value?</p>
<p></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var nameInput = $('#name');
function showName() {
if (nameInput.val() === "") {
alert('You must provide a Name');
}
else {
alert('¡Hello' + ' ' + nameInput.val() + '!')
}
};</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" id="name" />
<button type="button" onclick="showName()"> Show Name </button></code></pre>
</div>
</div>
</p>
| 0debug
|
SocketAddress *socket_address_flatten(SocketAddressLegacy *addr_legacy)
{
SocketAddress *addr = g_new(SocketAddress, 1);
if (!addr_legacy) {
return NULL;
}
switch (addr_legacy->type) {
case SOCKET_ADDRESS_LEGACY_KIND_INET:
addr->type = SOCKET_ADDRESS_TYPE_INET;
QAPI_CLONE_MEMBERS(InetSocketAddress, &addr->u.inet,
addr_legacy->u.inet.data);
break;
case SOCKET_ADDRESS_LEGACY_KIND_UNIX:
addr->type = SOCKET_ADDRESS_TYPE_UNIX;
QAPI_CLONE_MEMBERS(UnixSocketAddress, &addr->u.q_unix,
addr_legacy->u.q_unix.data);
break;
case SOCKET_ADDRESS_LEGACY_KIND_VSOCK:
addr->type = SOCKET_ADDRESS_TYPE_VSOCK;
QAPI_CLONE_MEMBERS(VsockSocketAddress, &addr->u.vsock,
addr_legacy->u.vsock.data);
break;
case SOCKET_ADDRESS_LEGACY_KIND_FD:
addr->type = SOCKET_ADDRESS_TYPE_FD;
QAPI_CLONE_MEMBERS(String, &addr->u.fd, addr_legacy->u.fd.data);
break;
default:
abort();
}
return addr;
}
| 1threat
|
How does this code I found work? Cipher : <p>So I found this cool cipher, im making a project for school (its kinda like, show us everything you learned kinda of project) and were allowed to get heavy look at other peoples code online (as long is its not a complete copy and paste). I want to understand how it works and make my own version (without copy and pasting), ive put comments for the parts I understand, and question marks for the parts I dont.</p>
<pre><code> Function EncryptDecrypt(ByVal text1 As String, ByVal key As String, ByVal isEncrypt As Boolean) As String //yea got this
Dim char1 As String //Defining char one
Dim char2 As String //Defining char two
Dim cKey As Byte //Defining a key as a byte
Dim strLength As Integer //Defining strLength as an integer
Dim Result As String = "" //Defining Result as String equal to nothing
Dim j As Integer = -1 //Defining j as an integer equal to -1
If text1 <> "" And IsNumeric(key) Then //if text1 is not nothing and the key is numeric then...
strLength = text1.Length //making strLength equal to the length of the text.
For i As Integer = 0 To strLength - 1 //Do until strLenth is less than 1 ???
char1 = text1.Substring(i, 1) //Char one is equal to
If j < key.Length - 1 Then //if j (-1) is less than the key's length - 1 then...
j = j + 1 //add one to j
Else //no explanation needed
j = 0 //no explanation needed
End If //no explanation needed
cKey = Val(key.Substring(j, 1)) //?? cKey is equal to value of the current character it is looking at (j, 1)??
If isEncrypt Then //if were encypting it
If (Asc(char1) + cKey) > 255 Then //????
char2 = Chr(Asc(char1) + cKey - 255) //????
Else //no explanation needed
char2 = Chr(Asc(char1) + cKey) //??
End If //no explanation needed
Else //no explanation needed
If (Asc(char1) - cKey) < 1 Then //????
char2 = Chr(Asc(char1) - cKey + 255) //?????
Else //no explanation needed
char2 = Chr(Asc(char1) - cKey) //?????
End If //no explanation needed
End If //no explanation needed
Result &= char2 //?????
Next //no explanation needed
Else //no explanation needed
MsgBox("Enter text or key!") //no explanation needed
End If //no explanation needed
Return Result //no explanation needed
End Function //no explanation needed
No explanation needed for these either VVVV
Private Sub btCrypt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btCrypt.Click
txtResult.Text = EncryptDecrypt(txtText.Text, txtKey.Text, True)
End Sub
Private Sub btDecrypt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btDecrypt.Click
txtResult.Text = EncryptDecrypt(txtText.Text, txtKey.Text, False)
End Sub
End Class
</code></pre>
<p>I kinda understand that each "letter" has an "Asc" value, but im not entirely sure how that works. Can anyone help, would be really great and helpful for me!</p>
| 0debug
|
ssize_t qsb_get_buffer(const QEMUSizedBuffer *qsb, off_t start,
size_t count, uint8_t *buffer)
{
const struct iovec *iov;
size_t to_copy, all_copy;
ssize_t index;
off_t s_off;
off_t d_off = 0;
char *s;
if (start > qsb->used) {
return 0;
}
all_copy = qsb->used - start;
if (all_copy > count) {
all_copy = count;
} else {
count = all_copy;
}
index = qsb_get_iovec(qsb, start, &s_off);
if (index < 0) {
return 0;
}
while (all_copy > 0) {
iov = &qsb->iov[index];
s = iov->iov_base;
to_copy = iov->iov_len - s_off;
if (to_copy > all_copy) {
to_copy = all_copy;
}
memcpy(&buffer[d_off], &s[s_off], to_copy);
d_off += to_copy;
all_copy -= to_copy;
s_off = 0;
index++;
}
return count;
}
| 1threat
|
static int milkymist_vgafb_init(SysBusDevice *dev)
{
MilkymistVgafbState *s = FROM_SYSBUS(typeof(*s), dev);
memory_region_init_io(&s->regs_region, &vgafb_mmio_ops, s,
"milkymist-vgafb", R_MAX * 4);
sysbus_init_mmio(dev, &s->regs_region);
s->con = graphic_console_init(vgafb_update_display,
vgafb_invalidate_display,
NULL, NULL, s);
return 0;
}
| 1threat
|
I want this fiddle carousel to be autoplayed. looped, if final slide reached :
I want your help to play [this carousel][1] automatically. 5 sec of delay is enough for each slide. Once it is reached it's limit (final slide) it should be looped.
[1]: http://urlshortener.at/AFG12
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.