problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
static void spice_register_types(void)
{
qemu_spice_init();
}
| 1threat |
Evaluating the function 'function' timed out : <p>Environment: Visual Studio 2017 version 15.5.2</p>
<p>Error:</p>
<blockquote>
<p>Evaluating the function 'function' ("Windows.Controls...ToString" in my case) timed out and needed to be aborted
in an unsafe way.</p>
</blockquote>
<p>Answers say this commonly occurs when </p>
<blockquote>
<p>Options > Debugging > General > enable property evaluation > is
enabled.</p>
</blockquote>
<p>I disabled this. Problem still happens. Microsoft <a href="https://msdn.microsoft.com/en-us/library/mt772252.aspx" rel="noreferrer">presents</a> a few options to solve this including </p>
<ul>
<li>Prevent the debugger from calling the getter property or ToString
method (In my case this is 3rd party code)</li>
<li>Have the target code ask the debugger to abort the evaluation (I don't know what this means. It strikes me as "just ignore it")</li>
</ul>
| 0debug |
Use async react-select with redux-saga : <p>I try to implement a async react-select (<a href="https://github.com/JedWatson/react-select#async-options" rel="noreferrer">Select.Async</a>). The problem is, we want to do the fetch in redux-saga. So if a user types something, the fetch-action should be triggered. Saga then fetches the record and saved them to the store. This works so far.
Unfortunately loadOptions has to return a promise or the callback should be called. Since the newly retrieved options get propagated with a changing property, I see no way to use <em>Select.Async</em> together with saga to do the async fetch call. Any suggestions?</p>
<pre><code> <Select.Async
multi={false}
value={this.props.value}
onChange={this.onChange}
loadOptions={(searchTerm) => this.props.options.load(searchTerm)}
/>
</code></pre>
<p>I had a hack where i assigned the callback to a class variable and resolve it on componentWillReceiveProps. That way ugly and did not work properly so i look for a better solution.</p>
<p>Thanks</p>
| 0debug |
def get_carol(n):
result = (2**n) - 1
return result * result - 2 | 0debug |
static void opt_video_rc_override_string(char *arg)
{
video_rc_override_string = arg;
}
| 1threat |
static void unassigned_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
{
#ifdef DEBUG_UNASSIGNED
printf("Unassigned mem write " TARGET_FMT_plx " = 0x%x\n", addr, val);
#endif
#if defined(TARGET_ALPHA) || defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE)
do_unassigned_access(addr, 1, 0, 0, 1);
#endif
}
| 1threat |
matplotlib subplots - too many indices for array : <p>I'm quite confused with the way plt.subplots work</p>
<p>This snippet works - displays a 2 by 2 Layout</p>
<pre><code>fig, axs = plt.subplots(2,2, figsize=(20, 10))
axs[0,0].set_title('Sobel')
axs[0,0].imshow(sobelx)
axs[0,1].set_title('S Channel')
axs[0,1].imshow(s_channel)
axs[1,0].set_title('Combined Binary')
axs[1,0].imshow(combined_binary)
axs[1,1].set_title('Color Stack')
axs[1,1].imshow(color_stack)
</code></pre>
<p>This snippet doesn't work - 1 by 2 Layout</p>
<pre><code>fig, axs = plt.subplots(1,2, figsize=(20, 10))
axs[0,0].set_title('Undistorted Image')
axs[0,0].imshow(undistort_img)
axs[0,1].set_title('Warped Image')
axs[0,1].imshow(warped_img)
</code></pre>
<p>This errors out with <code>IndexError: too many indices for array</code></p>
<p>When I print axs shape, it is <code>(2, 2)</code> in the first case where as <code>(2,)</code> in the second case. What is this axs ? And how do i make the 2nd piece of code work?</p>
| 0debug |
select last data every day : <p>I have a table <code>CAD_CHANGES</code></p>
<pre><code>ID OBJECT U_ID CH_DATE
1 parcel 20 2017-08-02 15:25:56
2 parcel 20 2017-08-02 10:31:50
3 parcel 20 2017-08-02 18:21:45
4 building 20 2017-08-02 14:03:56
5 building 20 2017-08-02 12:10:10
6 parcel 20 2017-08-02 20:21:56
7 building 20 2017-08-02 21:05:05
8 parcel 20 2017-08-02 09:14:27
9 parcel 20 2017-08-02 12:08:15
10 building 20 2017-08-03 14:09:26
11 building 20 2017-08-03 11:08:37
12 building 20 2017-08-03 18:01:48
13 building 20 2017-08-03 19:05:59
14 building 20 2017-08-03 21:28:02
15 building 20 2017-08-03 23:31:05
16 parcel 20 2017-08-03 09:34:07
17 parcel 20 2017-08-03 20:21:08
18 parcel 20 2017-08-03 15:42:04
19 building 20 2017-08-03 10:51:37
20 parcel 20 2017-08-03 14:10:22
</code></pre>
<p>I want get result for example </p>
<pre><code>ID OBJECT U_ID CH_DATE
--------------------------------------------------------------------------
3 parcel 20 2017-08-02 18:21:45
7 building 20 2017-08-02 21:05:05
---------------------------------------------------------------------------
15 building 20 2017-08-03 23:31:05
17 parcel 20 2017-08-03 20:21:08
</code></pre>
<p>My table is big just I wrote only two days, please help solve the problem,
thank you in advance </p>
<p>( aaa bbb ccc ddd eee fff) </p>
| 0debug |
static int rtsp_parse_request(HTTPContext *c)
{
const char *p, *p1, *p2;
char cmd[32];
char url[1024];
char protocol[32];
char line[1024];
int len;
RTSPMessageHeader header1, *header = &header1;
c->buffer_ptr[0] = '\0';
p = c->buffer;
get_word(cmd, sizeof(cmd), &p);
get_word(url, sizeof(url), &p);
get_word(protocol, sizeof(protocol), &p);
av_strlcpy(c->method, cmd, sizeof(c->method));
av_strlcpy(c->url, url, sizeof(c->url));
av_strlcpy(c->protocol, protocol, sizeof(c->protocol));
if (url_open_dyn_buf(&c->pb) < 0) {
c->pb = NULL;
return -1;
}
if (strcmp(protocol, "RTSP/1.0") != 0) {
rtsp_reply_error(c, RTSP_STATUS_VERSION);
goto the_end;
}
memset(header, 0, sizeof(*header));
while (*p != '\n' && *p != '\0')
p++;
if (*p == '\n')
p++;
while (*p != '\0') {
p1 = strchr(p, '\n');
if (!p1)
break;
p2 = p1;
if (p2 > p && p2[-1] == '\r')
p2--;
if (p2 == p)
break;
len = p2 - p;
if (len > sizeof(line) - 1)
len = sizeof(line) - 1;
memcpy(line, p, len);
line[len] = '\0';
ff_rtsp_parse_line(header, line, NULL);
p = p1 + 1;
}
c->seq = header->seq;
if (!strcmp(cmd, "DESCRIBE"))
rtsp_cmd_describe(c, url);
else if (!strcmp(cmd, "OPTIONS"))
rtsp_cmd_options(c, url);
else if (!strcmp(cmd, "SETUP"))
rtsp_cmd_setup(c, url, header);
else if (!strcmp(cmd, "PLAY"))
rtsp_cmd_play(c, url, header);
else if (!strcmp(cmd, "PAUSE"))
rtsp_cmd_pause(c, url, header);
else if (!strcmp(cmd, "TEARDOWN"))
rtsp_cmd_teardown(c, url, header);
else
rtsp_reply_error(c, RTSP_STATUS_METHOD);
the_end:
len = url_close_dyn_buf(c->pb, &c->pb_buffer);
c->pb = NULL;
if (len < 0) {
return -1;
}
c->buffer_ptr = c->pb_buffer;
c->buffer_end = c->pb_buffer + len;
c->state = RTSPSTATE_SEND_REPLY;
return 0;
}
| 1threat |
static void pxa2xx_i2c_write(void *opaque, hwaddr addr,
uint64_t value64, unsigned size)
{
PXA2xxI2CState *s = (PXA2xxI2CState *) opaque;
uint32_t value = value64;
int ack;
addr -= s->offset;
switch (addr) {
case ICR:
s->control = value & 0xfff7;
if ((value & (1 << 3)) && (value & (1 << 6))) {
if (value & (1 << 0)) {
if (s->data & 1)
s->status |= 1 << 0;
else
s->status &= ~(1 << 0);
ack = !i2c_start_transfer(s->bus, s->data >> 1, s->data & 1);
} else {
if (s->status & (1 << 0)) {
s->data = i2c_recv(s->bus);
if (value & (1 << 2))
i2c_nack(s->bus);
ack = 1;
} else
ack = !i2c_send(s->bus, s->data);
}
if (value & (1 << 1))
i2c_end_transfer(s->bus);
if (ack) {
if (value & (1 << 0))
s->status |= 1 << 6;
else
if (s->status & (1 << 0))
s->status |= 1 << 7;
else
s->status |= 1 << 6;
s->status &= ~(1 << 1);
} else {
s->status |= 1 << 6;
s->status |= 1 << 10;
s->status |= 1 << 1;
}
}
if (!(value & (1 << 3)) && (value & (1 << 6)))
if (value & (1 << 4))
i2c_end_transfer(s->bus);
pxa2xx_i2c_update(s);
break;
case ISR:
s->status &= ~(value & 0x07f0);
pxa2xx_i2c_update(s);
break;
case ISAR:
i2c_set_slave_address(I2C_SLAVE(s->slave), value & 0x7f);
break;
case IDBR:
s->data = value & 0xff;
break;
default:
printf("%s: Bad register " REG_FMT "\n", __FUNCTION__, addr);
}
}
| 1threat |
How to detect if a specified amount is NaN and how to : <p>Okay, so I on my site people play with coins now the feature where you go to use the coins can be "Cheated" by using console in javascript using a string that is NaN so I wan't to know how I can filter if the string inputted in the bets are NaN and if they are not a number I wan't to pop up an error message and if they are numbers I want it to continue with the rest of the script.</p>
| 0debug |
A module needs a subroutine located in another module - fortran : I have a problem like this:
1. main.f90 --> contains MAIN file
2. sub_A.f90 --> contains subroutine A
3. sub_B.f90 --> contains subroutine B
4. other_stuffs.f90 --> contains all functions required by points 2 and 3.
All four points are written separately.
**main.f90**
include sub_A.f90
include sub_B.f90
include other_stuffs.f90
program MAIN
use A
use B
use other
...
call proc_A
call_proc_B
end program MAIN
**sub_A.f90**
module A
subroutine proc_A
use other !my assumption didn't work
...
call compute_something_1
end subroutine proc_A
end module A
**sub_B.f90**
module B
subroutine proc_B
use other !my assumption didn't work
...
call compute_something_2
end subroutine proc_B
end module B
**other_stuffs.f90**
module other
subroutine compute_something_1
...
end subroutine compute_something_1
subroutine compute_something_2
...
end subroutine compute_something_2
end module other
Unfortunately, it didn't work. Did I do something wrong? Thanks in advance.
| 0debug |
C - double result returning the value of 0 : <pre><code>#include <stdio.h>
int main(int argc, const char * argv[]) {
int a = 10;
int b = 20;
double result = a / b;
printf("%d divided by %d makes %f\n", a, b, result);
return 0;
}
</code></pre>
<p>Expecting that the <code>%f</code> would return 0.500000, I ran the code and it turned out to be 0.000000.</p>
<p>Is there a reason that the <code>result</code> variable is returning a zero value?</p>
| 0debug |
Angular 2 - replace history instead of pushing : <p>How to replace a history instead a pushing a new in angular 2's new router (rc.1)?</p>
<p>For example Im in a question list (<code>/questions</code>) opening a new modal in a new route (<code>/questions/add</code>), and after adding a new question I go to the question view (<code>/questions/1</code>). If I press back I would like to go to the <code>/questions</code> instead of <code>/questions/add</code></p>
| 0debug |
Add class to body on Angular2 : <p>I have three components. These are HomeComponent, SignInComponent and AppComponent. My Home Page (HomeComponent) is showing when the application opened. I clicked the "Sign In" button by signin page opens.I want "signin-page" class to body while opening it.</p>
<p>How can I do it?</p>
<pre><code>// AppComponent
import { Component } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'app',
template: '<router-outlet></router-outlet>'
})
export class AppComponent {}
// SignInComponent
import { Component } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'signin',
templateUrl: './signin.component.html',
styleUrls: ['./signin.component.css']
})
export class SignInComponent {}
// HomeComponent
import { Component } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'home',
templateUrl: './home.component.html'
})
export class HomeComponent { }
// Part of index.html
<body>
<app>
<div class="spinner">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>
</app>
</body>
</code></pre>
| 0debug |
Does SemaphoreSlim (.NET) prevent same thread from entering block? : <p>I have read the docs for SemaphoreSlim <a href="https://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k(System.Threading.SemaphoreSlim);k(TargetFrameworkMoniker-.NETFramework,Version%3Dv4.5.2);k(DevLang-csharp)&rd=true" rel="noreferrer">SemaphoreSlim MSDN</a>
which indicates that the SemaphoreSlim will limit a section of code to be run by only 1 thread at a time if you configure it as:</p>
<pre><code>SemaphoreSlim _semaphoreSlim = new SemaphoreSlim(1, 1);
</code></pre>
<p>However, it doesn't indicate if it stops the <strong>same</strong> thread from accessing that code. This comes up with async and await. If one uses await in a method, control leaves that method and returns when whatever task or thread has completed. In my example, I use a button with an async button handler. It calls another method (Function1) with 'await'. Function1 in turn calls </p>
<pre><code>await Task.Run(() => Function2(beginCounter));
</code></pre>
<p>Around my Task.Run() I have a SemaphoreSlim. It sure seems like it stops the same thread from getting to Function2. But this is not guaranteed (as I read it) from the documentation and I wonder if that can be counted on.</p>
<p>I have posted my complete example below.</p>
<p>Thanks,</p>
<p>Dave</p>
<pre><code> using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
namespace AsynchAwaitExample
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private readonly SemaphoreSlim _semaphoreSlim = new SemaphoreSlim(1, 1);
public MainWindow()
{
InitializeComponent();
}
static int beginCounter = 0;
static int endCounter = 0;
/// <summary>
/// Suggest hitting button 3 times in rapid succession
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void button_Click(object sender, RoutedEventArgs e)
{
beginCounter++;
endCounter++;
// Notice that if you click fast, you'll get all the beginCounters first, then the endCounters
Console.WriteLine("beginCounter: " + beginCounter + " threadId: " + Thread.CurrentThread.ManagedThreadId);
await Function1(beginCounter);
Console.WriteLine("endCounter: " + endCounter + " threadId: " + Thread.CurrentThread.ManagedThreadId);
}
private async Task Function1(int beginCounter)
{
try
{
Console.WriteLine("about to grab lock" + " threadId: " + Thread.CurrentThread.ManagedThreadId + " beginCounter: " + beginCounter);
await _semaphoreSlim.WaitAsync(); // get rid of _semaphoreSlim calls and you'll get into beginning of Function2 3 times before exiting
Console.WriteLine("grabbed lock" + " threadId: " + Thread.CurrentThread.ManagedThreadId + " beginCounter: " + beginCounter);
await Task.Run(() => Function2(beginCounter));
}
finally
{
Console.WriteLine("about to release lock" + " threadId: " + Thread.CurrentThread.ManagedThreadId + " beginCounter: " + beginCounter);
_semaphoreSlim.Release();
Console.WriteLine("released lock" + " threadId: " + Thread.CurrentThread.ManagedThreadId + " beginCounter: " + beginCounter);
}
}
private void Function2(int beginCounter)
{
Console.WriteLine("Function2 start" + " threadId: " + Thread.CurrentThread.ManagedThreadId + " beginCounter: " + beginCounter);
Thread.Sleep(1000);
Console.WriteLine("Function2 end" + " threadId: " + Thread.CurrentThread.ManagedThreadId + " beginCounter: " + beginCounter);
return;
}
}
}
</code></pre>
<p>Sample output if you click button 3 times. Notice that Function2 always finishes for a given counter before it starts again.</p>
<pre><code> beginCounter: 1 threadId: 9
about to grab lock threadId: 9 beginCounter: 1
grabbed lock threadId: 9 beginCounter: 1
Function2 start threadId: 13 beginCounter: 1
beginCounter: 2 threadId: 9
about to grab lock threadId: 9 beginCounter: 2
beginCounter: 3 threadId: 9
about to grab lock threadId: 9 beginCounter: 3
Function2 end threadId: 13 beginCounter: 1
about to release lock threadId: 9 beginCounter: 1
released lock threadId: 9 beginCounter: 1
grabbed lock threadId: 9 beginCounter: 2
Function2 start threadId: 13 beginCounter: 2
endCounter: 3 threadId: 9
Function2 end threadId: 13 beginCounter: 2
about to release lock threadId: 9 beginCounter: 2
released lock threadId: 9 beginCounter: 2
endCounter: 3 threadId: 9
grabbed lock threadId: 9 beginCounter: 3
Function2 start threadId: 13 beginCounter: 3
Function2 end threadId: 13 beginCounter: 3
about to release lock threadId: 9 beginCounter: 3
released lock threadId: 9 beginCounter: 3
endCounter: 3 threadId: 9
</code></pre>
<p>If you get rid of the SemaphoreSlim calls you'll get:</p>
<pre><code>beginCounter: 1 threadId: 10
about to grab lock threadId: 10 beginCounter: 1
grabbed lock threadId: 10 beginCounter: 1
Function2 start threadId: 13 beginCounter: 1
beginCounter: 2 threadId: 10
about to grab lock threadId: 10 beginCounter: 2
grabbed lock threadId: 10 beginCounter: 2
Function2 start threadId: 14 beginCounter: 2
beginCounter: 3 threadId: 10
about to grab lock threadId: 10 beginCounter: 3
grabbed lock threadId: 10 beginCounter: 3
Function2 start threadId: 15 beginCounter: 3
Function2 end threadId: 13 beginCounter: 1
about to release lock threadId: 10 beginCounter: 1
released lock threadId: 10 beginCounter: 1
endCounter: 3 threadId: 10
Function2 end threadId: 14 beginCounter: 2
about to release lock threadId: 10 beginCounter: 2
released lock threadId: 10 beginCounter: 2
endCounter: 3 threadId: 10
</code></pre>
| 0debug |
How to include git revision into angular-cli application? : <p>I need to display git revision on my angular2 application's about page. The project is based on angular-cli.</p>
<p>How can build be extended so git revision is put for example into <code>environment.ts</code> or other place accessible to application?</p>
| 0debug |
Upload the file on localhost so anyone in network can access : <p>I have created a html file that I am trying to host on the localhost using wamp server so that anyone in the network can access it I have also updated the hosts file to</p>
<pre><code>172.x.x.x www.kpcl.com
</code></pre>
<p>This works fine what, when anyone with this hosts file tries to access my page thing is person has to type <code>www.kpcl.com/checkl.html</code> where checkl.html is my file situated in www folder of wamp
in the url section I want that as soon as the person enters the <code>www.kpcl.com</code> <strong>by default the checkl.html</strong> page gets loaded what to do?</p>
| 0debug |
Which is faster inline function or MACRO : <p>I believe that preprocessor expands the Macro as a copy text in the code before compilation wherever is it called, while the compiler writes a copy of compiled function definition in each function call. So in both cases we avoided the overhead of regular function call, but in this case which is faster and has less overhead, inline function or MACRO? </p>
| 0debug |
static void write_fp_dreg(DisasContext *s, int reg, TCGv_i64 v)
{
TCGv_i64 tcg_zero = tcg_const_i64(0);
tcg_gen_st_i64(v, cpu_env, fp_reg_offset(reg, MO_64));
tcg_gen_st_i64(tcg_zero, cpu_env, fp_reg_hi_offset(reg));
tcg_temp_free_i64(tcg_zero);
}
| 1threat |
void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
{
CPUARMState *env = cs->env_ptr;
ARMCPU *cpu = arm_env_get_cpu(env);
DisasContext dc1, *dc = &dc1;
target_ulong pc_start;
target_ulong next_page_start;
int num_insns;
int max_insns;
bool end_of_page;
if (ARM_TBFLAG_AARCH64_STATE(tb->flags)) {
gen_intermediate_code_a64(cs, tb);
return;
}
pc_start = tb->pc;
dc->tb = tb;
dc->is_jmp = DISAS_NEXT;
dc->pc = pc_start;
dc->singlestep_enabled = cs->singlestep_enabled;
dc->condjmp = 0;
dc->aarch64 = 0;
dc->secure_routed_to_el3 = arm_feature(env, ARM_FEATURE_EL3) &&
!arm_el_is_aa64(env, 3);
dc->thumb = ARM_TBFLAG_THUMB(tb->flags);
dc->sctlr_b = ARM_TBFLAG_SCTLR_B(tb->flags);
dc->be_data = ARM_TBFLAG_BE_DATA(tb->flags) ? MO_BE : MO_LE;
dc->condexec_mask = (ARM_TBFLAG_CONDEXEC(tb->flags) & 0xf) << 1;
dc->condexec_cond = ARM_TBFLAG_CONDEXEC(tb->flags) >> 4;
dc->mmu_idx = core_to_arm_mmu_idx(env, ARM_TBFLAG_MMUIDX(tb->flags));
dc->current_el = arm_mmu_idx_to_el(dc->mmu_idx);
#if !defined(CONFIG_USER_ONLY)
dc->user = (dc->current_el == 0);
#endif
dc->ns = ARM_TBFLAG_NS(tb->flags);
dc->fp_excp_el = ARM_TBFLAG_FPEXC_EL(tb->flags);
dc->vfp_enabled = ARM_TBFLAG_VFPEN(tb->flags);
dc->vec_len = ARM_TBFLAG_VECLEN(tb->flags);
dc->vec_stride = ARM_TBFLAG_VECSTRIDE(tb->flags);
dc->c15_cpar = ARM_TBFLAG_XSCALE_CPAR(tb->flags);
dc->v7m_handler_mode = ARM_TBFLAG_HANDLER(tb->flags);
dc->cp_regs = cpu->cp_regs;
dc->features = env->features;
dc->ss_active = ARM_TBFLAG_SS_ACTIVE(tb->flags);
dc->pstate_ss = ARM_TBFLAG_PSTATE_SS(tb->flags);
dc->is_ldex = false;
dc->ss_same_el = false;
cpu_F0s = tcg_temp_new_i32();
cpu_F1s = tcg_temp_new_i32();
cpu_F0d = tcg_temp_new_i64();
cpu_F1d = tcg_temp_new_i64();
cpu_V0 = cpu_F0d;
cpu_V1 = cpu_F1d;
cpu_M0 = tcg_temp_new_i64();
next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
num_insns = 0;
max_insns = tb->cflags & CF_COUNT_MASK;
if (max_insns == 0) {
max_insns = CF_COUNT_MASK;
}
if (max_insns > TCG_MAX_INSNS) {
max_insns = TCG_MAX_INSNS;
}
gen_tb_start(tb);
tcg_clear_temp_count();
if (dc->condexec_mask || dc->condexec_cond)
{
TCGv_i32 tmp = tcg_temp_new_i32();
tcg_gen_movi_i32(tmp, 0);
store_cpu_field(tmp, condexec_bits);
}
do {
dc->insn_start_idx = tcg_op_buf_count();
tcg_gen_insn_start(dc->pc,
(dc->condexec_cond << 4) | (dc->condexec_mask >> 1),
0);
num_insns++;
#ifdef CONFIG_USER_ONLY
if (dc->pc >= 0xffff0000) {
gen_exception_internal(EXCP_KERNEL_TRAP);
dc->is_jmp = DISAS_NORETURN;
break;
}
#endif
if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) {
CPUBreakpoint *bp;
QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
if (bp->pc == dc->pc) {
if (bp->flags & BP_CPU) {
gen_set_condexec(dc);
gen_set_pc_im(dc, dc->pc);
gen_helper_check_breakpoints(cpu_env);
dc->is_jmp = DISAS_UPDATE;
} else {
gen_exception_internal_insn(dc, 0, EXCP_DEBUG);
dc->pc += 2;
goto done_generating;
}
break;
}
}
}
if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {
gen_io_start();
}
if (dc->ss_active && !dc->pstate_ss) {
assert(num_insns == 1);
gen_exception(EXCP_UDEF, syn_swstep(dc->ss_same_el, 0, 0),
default_exception_el(dc));
goto done_generating;
}
if (dc->thumb) {
disas_thumb_insn(env, dc);
if (dc->condexec_mask) {
dc->condexec_cond = (dc->condexec_cond & 0xe)
| ((dc->condexec_mask >> 4) & 1);
dc->condexec_mask = (dc->condexec_mask << 1) & 0x1f;
if (dc->condexec_mask == 0) {
dc->condexec_cond = 0;
}
}
} else {
unsigned int insn = arm_ldl_code(env, dc->pc, dc->sctlr_b);
dc->pc += 4;
disas_arm_insn(dc, insn);
}
if (dc->condjmp && !dc->is_jmp) {
gen_set_label(dc->condlabel);
dc->condjmp = 0;
}
if (tcg_check_temp_count()) {
fprintf(stderr, "TCG temporary leak before "TARGET_FMT_lx"\n",
dc->pc);
}
end_of_page = (dc->pc >= next_page_start) ||
((dc->pc >= next_page_start - 3) && insn_crosses_page(env, dc));
} while (!dc->is_jmp && !tcg_op_buf_full() &&
!is_singlestepping(dc) &&
!singlestep &&
!end_of_page &&
num_insns < max_insns);
if (tb->cflags & CF_LAST_IO) {
if (dc->condjmp) {
cpu_abort(cs, "IO on conditional branch instruction");
}
gen_io_end();
}
gen_set_condexec(dc);
if (dc->is_jmp == DISAS_BX_EXCRET) {
gen_bx_excret_final_code(dc);
} else if (unlikely(is_singlestepping(dc))) {
switch (dc->is_jmp) {
case DISAS_SWI:
gen_ss_advance(dc);
gen_exception(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb),
default_exception_el(dc));
break;
case DISAS_HVC:
gen_ss_advance(dc);
gen_exception(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2);
break;
case DISAS_SMC:
gen_ss_advance(dc);
gen_exception(EXCP_SMC, syn_aa32_smc(), 3);
break;
case DISAS_NEXT:
case DISAS_UPDATE:
gen_set_pc_im(dc, dc->pc);
default:
gen_singlestep_exception(dc);
break;
case DISAS_NORETURN:
break;
}
} else {
switch(dc->is_jmp) {
case DISAS_NEXT:
gen_goto_tb(dc, 1, dc->pc);
break;
case DISAS_JUMP:
gen_goto_ptr();
break;
case DISAS_UPDATE:
gen_set_pc_im(dc, dc->pc);
default:
tcg_gen_exit_tb(0);
break;
case DISAS_NORETURN:
break;
case DISAS_WFI:
gen_helper_wfi(cpu_env);
tcg_gen_exit_tb(0);
break;
case DISAS_WFE:
gen_helper_wfe(cpu_env);
break;
case DISAS_YIELD:
gen_helper_yield(cpu_env);
break;
case DISAS_SWI:
gen_exception(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb),
default_exception_el(dc));
break;
case DISAS_HVC:
gen_exception(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2);
break;
case DISAS_SMC:
gen_exception(EXCP_SMC, syn_aa32_smc(), 3);
break;
}
}
if (dc->condjmp) {
gen_set_label(dc->condlabel);
gen_set_condexec(dc);
if (unlikely(is_singlestepping(dc))) {
gen_set_pc_im(dc, dc->pc);
gen_singlestep_exception(dc);
} else {
gen_goto_tb(dc, 1, dc->pc);
}
}
done_generating:
gen_tb_end(tb, num_insns);
#ifdef DEBUG_DISAS
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) &&
qemu_log_in_addr_range(pc_start)) {
qemu_log_lock();
qemu_log("----------------\n");
qemu_log("IN: %s\n", lookup_symbol(pc_start));
log_target_disas(cs, pc_start, dc->pc - pc_start,
dc->thumb | (dc->sctlr_b << 1));
qemu_log("\n");
qemu_log_unlock();
}
#endif
tb->size = dc->pc - pc_start;
tb->icount = num_insns;
}
| 1threat |
static int usb_host_usbfs_type(USBHostDevice *s, USBPacket *p)
{
static const int usbfs[] = {
[USB_ENDPOINT_XFER_CONTROL] = USBDEVFS_URB_TYPE_CONTROL,
[USB_ENDPOINT_XFER_ISOC] = USBDEVFS_URB_TYPE_ISO,
[USB_ENDPOINT_XFER_BULK] = USBDEVFS_URB_TYPE_BULK,
[USB_ENDPOINT_XFER_INT] = USBDEVFS_URB_TYPE_INTERRUPT,
};
uint8_t type = usb_ep_get_type(&s->dev, p->pid, p->devep);
assert(type < ARRAY_SIZE(usbfs));
return usbfs[type];
}
| 1threat |
Moving elements within a golang slice of slices : <p>I have the following [][]interface{}:</p>
<pre><code>[
[1 65535 62242] [1 65531 20924] [1 96 229] [1 52 208] [1 58 207]
[2 65535 62680] [2 65531 20654] [2 28 212] [2 64 211] [2 17 210] [2 75 208]
[3 65535 62297] [3 65531 20694] [3 30 208] [3 87 207] [3 3 205] [3 36 204]
]
</code></pre>
<p>I need to move the elements in order to get the following result:</p>
<pre><code>[
[1 65535 62242] [1 65531 20924] [1 96 229] [1 52 208] [1 58 207]
[3 65535 62297] [3 65531 20694] [3 30 208] [3 87 207] [3 3 205] [3 36 204]
[2 65535 62680] [2 65531 20654] [2 28 212] [2 64 211] [2 17 210] [2 75 208]
]
</code></pre>
<p>I have checked the 'Slicetricks' page but after testing and testing I can't find the way to do it.</p>
| 0debug |
what is the difference between React.HTMLProps<> and React.HTMLAttributes<T>? : <p>I am trying to defined a props interface for my Component and would like it to include all common attributes.</p>
<p>but found out there are two different interface i can extend</p>
<p><code>
interface MyProps extend React.HTMLProps<HTMLElement>
</code>
and
<code>
interface MyProps extend React.HTMLAttributes<HTMLElement>
</code></p>
<p>what is the difference? which one should I use?
seems like HTMLProps includes HTMLAttributes, does it mean HTMLProps should be a better candidates?</p>
| 0debug |
int bdrv_child_try_set_perm(BdrvChild *c, uint64_t perm, uint64_t shared,
Error **errp)
{
int ret;
ret = bdrv_child_check_perm(c, perm, shared, errp);
if (ret < 0) {
bdrv_child_abort_perm_update(c);
return ret;
}
bdrv_child_set_perm(c, perm, shared);
return 0;
}
| 1threat |
why I get this return value? : <p>Today I was practicing some return types, and put this code:</p>
<pre><code>def funcion(numero):
return numero
print(funcion)
</code></pre>
<p>And the output is</p>
<pre><code><function funcion at 0x7fc48554f950>
</code></pre>
<p>but the weirdest thing is that each time I try to run the code it appears other output with different digets/numbers at the end, except 0x7fc48554f950 will be 0x7f8658401950 for example.</p>
<p>I was wondering why this happens?
The output from python 2.7.x and 3.6.5 are different as well, which would be
and
awalys with the beginning and ea0.</p>
| 0debug |
static void mcf5208evb_init(ram_addr_t ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
{
CPUState *env;
int kernel_size;
uint64_t elf_entry;
target_ulong entry;
qemu_irq *pic;
if (!cpu_model)
cpu_model = "m5208";
env = cpu_init(cpu_model);
if (!env) {
fprintf(stderr, "Unable to find m68k CPU definition\n");
exit(1);
}
env->vbr = 0;
cpu_register_physical_memory(0x40000000, ram_size,
qemu_ram_alloc(ram_size) | IO_MEM_RAM);
cpu_register_physical_memory(0x80000000, 16384,
qemu_ram_alloc(16384) | IO_MEM_RAM);
pic = mcf_intc_init(0xfc048000, env);
mcf_uart_mm_init(0xfc060000, pic[26], serial_hds[0]);
mcf_uart_mm_init(0xfc064000, pic[27], serial_hds[1]);
mcf_uart_mm_init(0xfc068000, pic[28], serial_hds[2]);
mcf5208_sys_init(pic);
if (nb_nics > 1) {
fprintf(stderr, "Too many NICs\n");
exit(1);
}
if (nd_table[0].vlan) {
if (nd_table[0].model == NULL
|| strcmp(nd_table[0].model, "mcf_fec") == 0) {
mcf_fec_init(&nd_table[0], 0xfc030000, pic + 36);
} else if (strcmp(nd_table[0].model, "?") == 0) {
fprintf(stderr, "qemu: Supported NICs: mcf_fec\n");
exit (1);
} else {
fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model);
exit (1);
}
}
if (!kernel_filename) {
fprintf(stderr, "Kernel image must be specified\n");
exit(1);
}
kernel_size = load_elf(kernel_filename, 0, &elf_entry, NULL, NULL);
entry = elf_entry;
if (kernel_size < 0) {
kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL);
}
if (kernel_size < 0) {
kernel_size = load_image(kernel_filename, phys_ram_base);
entry = 0x20000000;
}
if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename);
exit(1);
}
env->pc = entry;
}
| 1threat |
Vue converts input[type=number] to a string value : <p>I'm running into the problem, that Vue converts the value of an input field of type number into a string and I just can't figure out why. The guide I am following along does not run into this issue and get's the values as numbers, as expected.</p>
<p>The vue docs state, that Vue would convert the value to a number, if the type of the input is number.</p>
<p>The code is originated from a component, but I adjusted it to run in JSFiddle: <a href="https://jsfiddle.net/d5wLsnvp/3/" rel="noreferrer">https://jsfiddle.net/d5wLsnvp/3/</a></p>
<pre><code><template>
<div class="col-sm-6 col-md-4">
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">
{{ stock.name }}
<small>(Price: {{ stock.price }})</small>
</h3>
</div>
<div class="panel-body">
<div class="pull-left">
<input type="number" class="form-control" placeholder="Quantity" v-model="quantity"/>
</div>
<div class="pull-right">
<button class="btn btn-success" @click="buyStock">Buy</button>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: ['stock'],
data() {
return {
quantity: 0 // Init with 0 stays a number
};
},
methods: {
buyStock() {
const order = {
stockId: this.stock.id,
stockPrice: this.stock.price,
quantity: this.quantity
};
console.log(order);
this.quantity = 0; // Reset to 0 is a number
}
}
}
</script>
</code></pre>
<p>The quantity value is the issue.
It is initialized with 0 and when I just press the "Buy" button, the console shows:</p>
<pre><code>Object { stockId: 1, stockPrice: 110, quantity: 0 }
</code></pre>
<p>But as soon as I change the value by either using the spinners or just type in a new value, the console will show:</p>
<pre><code>Object { stockId: 1, stockPrice: 110, quantity: "1" }
</code></pre>
<p>Tested with Firefox 59.0.2 and Chrome 65.0.3325.181. Both state that they are up to date. I actually also tried it in Microsoft Edge, with the same result.</p>
<p>So what am I missing here? Why is Vue not converting the value to a number?</p>
| 0debug |
React native - How to implement iOS Settings : <p>Wondering if someone could help me with this, or at least point me in the right direction.</p>
<p>I've been searching for documentation on how to get/set settings in a React Native iOS app so that those settings appear in the iOS Settings app listed under my app. I see that there is a Settings API, but it appears that the documentation is not complete. The function definitions are listed there, but that's it. No examples or anything.</p>
<p>Can anyone provide me with a simple example, or point me to a tutorial or something that will help me get going? I'm assuming I import Settings from react-native, just like I would do for other APIs, but beyond that I'm not sure where to go.</p>
<p>Thanks.</p>
| 0debug |
.NET Core 2.0 RSA PlatformNotSupportedException : <p>I am trying to use this code to generate a public and private key, I am using .NET Core 2 on Windows 10</p>
<p>So far I had no success in running this code, it compiles just fine but when I get to the rsa.ToXmlString line it drops with a PlatformNotSupportedException and as I read in another answer on stack overflow the solution was using <code>System.Security.Cryptography.Algorithms</code> and they showed the almost exact code that I use here down below.</p>
<pre><code> using (RSA rsa = RSA.Create())
{
rsa.KeySize = 1024;
privateKey = rsa.ToXmlString(true);
publicKey = rsa.ToXmlString(false);
}
</code></pre>
<p>Error:
<a href="https://i.stack.imgur.com/X6TqW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/X6TqW.png" alt="enter image description here"></a></p>
<p>As seen here it does show up in their API browser, so it has to be supported, right?
<a href="https://i.stack.imgur.com/VL6bK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VL6bK.png" alt="enter image description here"></a></p>
<p>Does anyone have any similar problems? Or does anyone have a fix for this?
I have to use .NET Core so don't suggest using .NET 4.6</p>
| 0debug |
void async_context_push(void)
{
struct AsyncContext *new = qemu_mallocz(sizeof(*new));
new->parent = async_context;
new->id = async_context->id + 1;
async_context = new;
}
| 1threat |
convert string of valid JSON to JSON object in java, so I can index into it : right now I have this string:
```
[{"row 0":[{},{},{},{},{},{},{},{}]},{"row 1":[{},{},{},{},{},{},{},{}]},{"row 2":[{},{},{},{},{},{},{},{}]},{"row 3":[{},{},{},{},{},{},{},{}]},{"row 4":[{"column 0":"WhitePawn"},{},{},{},{},{},{},{}]},{"row 5":[{},{},{},{},{},{},{},{}]},{"row 6":[{},{},{},{},{},{},{},{}]},{"row 7":[{},{},{},{},{},{},{},{}]}]
```
^it's currently a String, let's call it `string`,
I'm trying to convert it into JSON like so:
```
new JSONObject(string);
```
but it isn't working... how to do this in Java?
| 0debug |
Difference between Javascript async functions and Web workers? : <p>Threading-wise, what's the difference between web workers and functions declared as </p>
<pre><code>async function xxx()
{
}
</code></pre>
<p>?</p>
<p>I am aware web workers are executed on separate threads, but what about async functions? Are such functions threaded in the same way as a function executed through setInterval is, or are they subject to yet another different kind of threading?</p>
| 0debug |
static inline int decode_picture_parameter_set(H264Context *h, int bit_length){
MpegEncContext * const s = &h->s;
unsigned int pps_id= get_ue_golomb(&s->gb);
PPS *pps;
if(pps_id>=MAX_PPS_COUNT){
av_log(h->s.avctx, AV_LOG_ERROR, "pps_id out of range\n");
return -1;
}
pps = &h->pps_buffer[pps_id];
pps->sps_id= get_ue_golomb(&s->gb);
pps->cabac= get_bits1(&s->gb);
pps->pic_order_present= get_bits1(&s->gb);
pps->slice_group_count= get_ue_golomb(&s->gb) + 1;
if(pps->slice_group_count > 1 ){
pps->mb_slice_group_map_type= get_ue_golomb(&s->gb);
av_log(h->s.avctx, AV_LOG_ERROR, "FMO not supported\n");
switch(pps->mb_slice_group_map_type){
case 0:
#if 0
| for( i = 0; i <= num_slice_groups_minus1; i++ ) | | |
| run_length[ i ] |1 |ue(v) |
#endif
break;
case 2:
#if 0
| for( i = 0; i < num_slice_groups_minus1; i++ ) | | |
|{ | | |
| top_left_mb[ i ] |1 |ue(v) |
| bottom_right_mb[ i ] |1 |ue(v) |
| } | | |
#endif
break;
case 3:
case 4:
case 5:
#if 0
| slice_group_change_direction_flag |1 |u(1) |
| slice_group_change_rate_minus1 |1 |ue(v) |
#endif
break;
case 6:
#if 0
| slice_group_id_cnt_minus1 |1 |ue(v) |
| for( i = 0; i <= slice_group_id_cnt_minus1; i++ | | |
|) | | |
| slice_group_id[ i ] |1 |u(v) |
#endif
break;
}
}
pps->ref_count[0]= get_ue_golomb(&s->gb) + 1;
pps->ref_count[1]= get_ue_golomb(&s->gb) + 1;
if(pps->ref_count[0] > 32 || pps->ref_count[1] > 32){
av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow (pps)\n");
return -1;
}
pps->weighted_pred= get_bits1(&s->gb);
pps->weighted_bipred_idc= get_bits(&s->gb, 2);
pps->init_qp= get_se_golomb(&s->gb) + 26;
pps->init_qs= get_se_golomb(&s->gb) + 26;
pps->chroma_qp_index_offset= get_se_golomb(&s->gb);
pps->deblocking_filter_parameters_present= get_bits1(&s->gb);
pps->constrained_intra_pred= get_bits1(&s->gb);
pps->redundant_pic_cnt_present = get_bits1(&s->gb);
pps->transform_8x8_mode= 0;
h->dequant_coeff_pps= -1;
memset(pps->scaling_matrix4, 16, 6*16*sizeof(uint8_t));
memset(pps->scaling_matrix8, 16, 2*64*sizeof(uint8_t));
if(get_bits_count(&s->gb) < bit_length){
pps->transform_8x8_mode= get_bits1(&s->gb);
decode_scaling_matrices(h, &h->sps_buffer[pps->sps_id], pps, 0, pps->scaling_matrix4, pps->scaling_matrix8);
get_se_golomb(&s->gb);
}
if(s->avctx->debug&FF_DEBUG_PICT_INFO){
av_log(h->s.avctx, AV_LOG_DEBUG, "pps:%u sps:%u %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d %s %s %s %s\n",
pps_id, pps->sps_id,
pps->cabac ? "CABAC" : "CAVLC",
pps->slice_group_count,
pps->ref_count[0], pps->ref_count[1],
pps->weighted_pred ? "weighted" : "",
pps->init_qp, pps->init_qs, pps->chroma_qp_index_offset,
pps->deblocking_filter_parameters_present ? "LPAR" : "",
pps->constrained_intra_pred ? "CONSTR" : "",
pps->redundant_pic_cnt_present ? "REDU" : "",
pps->transform_8x8_mode ? "8x8DCT" : ""
);
}
return 0;
}
| 1threat |
static inline void gen_op_fcmpes(int fccno, TCGv r_rs1, TCGv r_rs2)
{
gen_helper_fcmpes(cpu_env, r_rs1, r_rs2);
}
| 1threat |
How can I create this image with pure CSS? : [![enter image description here][1]][1]
[1]: http://i.stack.imgur.com/PkfBD.png
Ideally, I'd like a background shadow effect too.
Thanks in advance. | 0debug |
void omap_badwidth_write16(void *opaque, target_phys_addr_t addr,
uint32_t value)
{
uint16_t val16 = value;
OMAP_16B_REG(addr);
cpu_physical_memory_write(addr, (void *) &val16, 2);
}
| 1threat |
Use javascript variables in php : <p>I have to read the values of multiple elements, put them into variables and then write them with default text to a file. I'm now using javascript and php. I hope you can help me. I am possibly open to other solutions.</p>
<p>This is what I have right now:</p>
<pre><code> <script>
function createfile(){
var maximum = x;
var element = 0;
var Element_exists = document.getElementById(element);
if(Element_exists){
function toggle(Element_exists){
if(Element_exists.tagName === 'Input'){
var p_name = document.getElementById(element).value;
var p_font = document.getElementById(element + "_font").value;
var p_fontsize = document.getElementById(element + "_fontsize").value;
var total_p = "</p>"+ p_name + " new text "+ p_font +" even more new text " + p_fontsize + " last bit of text</p>"
}else{
}
}
<?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = total_p;
fwrite($myfile, $txt);
fclose($myfile);
?>
}
}
</script>
</code></pre>
| 0debug |
Hi, I wanted to know why the output of this code is nothing? : I wanted to know why the output of this code is nothing? is it something related to the use of SIZE in for expression?
#include<stdio.h>
int array[6] = {4, 5, 6, 10, -1, 0};
#define SIZE (sizeof(array)/sizeof(array[0]))
int main() {
int i;
for (i= -1; i< SIZE; ++i) printf("%d", array[i+1]);
return 0;
} | 0debug |
Rails sorting based on 2 fields : I have a product model with 'price' field and 'sale_price' field. I want to sort the records according to price in ascending order. But if a product has sale_price value then it should be sorted according to sale_price not by price.
E.g
Product.id:1, Product.name:watch, Product.price:100, Product.sale_price:nil
Product.id:2, Product.name:Bag, Product.price:200, Product.sale_price:50
Product.id:3, Product.name:Shoes, Product.price:300, Product.sale_price:nil
I want this to be sorted as
1.Bag
2.watch
3.Shoes
Thanks | 0debug |
Real Date and Time - C# : I have an audit trail where the date and time of user's time in / time out was enlisted. Is it possible that even I changed the system date and time. It ignores the system date/time that I have changed and log the real date and time of time in/ time out of the user.
This is my code.
dbAuditTrail.AddActionLog(userID, timeIn, DateTime.Now.ToString("MM/dd/yyyy - hh:mm:ss tt")); | 0debug |
static int decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
uint8_t *buf, int buf_size)
{
H264Context *h = avctx->priv_data;
MpegEncContext *s = &h->s;
AVFrame *pict = data;
float new_aspect;
int buf_index;
s->flags= avctx->flags;
*data_size = 0;
if (buf_size == 0) {
return 0;
}
if(s->flags&CODEC_FLAG_TRUNCATED){
int next= find_frame_end(s, buf, buf_size);
if( ff_combine_frame(s, next, &buf, &buf_size) < 0 )
return buf_size;
}
if(s->avctx->extradata_size && s->picture_number==0){
if(0 < decode_nal_units(h, s->avctx->extradata, s->avctx->extradata_size) )
return -1;
}
buf_index=decode_nal_units(h, buf, buf_size);
if(buf_index < 0)
return -1;
#if 0
if(s->pict_type==B_TYPE || s->low_delay){
*pict= *(AVFrame*)&s->current_picture;
} else {
*pict= *(AVFrame*)&s->last_picture;
}
#endif
*pict= *(AVFrame*)&s->current_picture;
assert(pict->data[0]);
if(avctx->debug&FF_DEBUG_QP){
int8_t *qtab= pict->qscale_table;
int x,y;
for(y=0; y<s->mb_height; y++){
for(x=0; x<s->mb_width; x++){
printf("%2d ", qtab[x + y*s->mb_width]);
}
printf("\n");
}
printf("\n");
}
#if 0
avctx->frame_number = s->picture_number - 1;
#endif
#if 0
if(s->last_picture_ptr || s->low_delay)
#endif
*data_size = sizeof(AVFrame);
return get_consumed_bytes(s, buf_index, buf_size);
}
| 1threat |
insert a number into a sorted array, time: log(n) : <p>i have a sorted array and would like to insert a number into the array, is it possible to do so in log(n)?
right now the only idea I have is to binary search for the index i to insert it and then move all the i
<p>thanks!</p>
| 0debug |
static void fill_thread_info(struct elf_note_info *info, const CPUState *env)
{
TaskState *ts = (TaskState *)env->opaque;
struct elf_thread_status *ets;
ets = qemu_mallocz(sizeof (*ets));
ets->num_notes = 1;
fill_prstatus(&ets->prstatus, ts, 0);
elf_core_copy_regs(&ets->prstatus.pr_reg, env);
fill_note(&ets->notes[0], "CORE", NT_PRSTATUS, sizeof (ets->prstatus),
&ets->prstatus);
TAILQ_INSERT_TAIL(&info->thread_list, ets, ets_link);
info->notes_size += note_size(&ets->notes[0]);
}
| 1threat |
static inline void asv2_put_level(PutBitContext *pb, int level)
{
unsigned int index = level + 31;
if (index <= 62) {
put_bits(pb, ff_asv2_level_tab[index][1], ff_asv2_level_tab[index][0]);
} else {
put_bits(pb, ff_asv2_level_tab[31][1], ff_asv2_level_tab[31][0]);
asv2_put_bits(pb, 8, level & 0xFF);
}
}
| 1threat |
How can I use variables in package.json? : <p>There is a feature from maven I miss a lot in package.json. In maven .pom file you can define variables in parent project and use them in child project's pom files.</p>
<p>Is there something like this in npm? We are building modular project and I want to define dependency versions centrally and them to be used in respective package.json files.</p>
<p>Thanks</p>
| 0debug |
Priority List with Heap Sort (Java) : <p>I would like know if exists a Java native implementation for a Priority List using Heap Sort approach. If not, is there any recommended alternative?</p>
| 0debug |
yuv2rgb48_1_c_template(SwsContext *c, const int32_t *buf0,
const int32_t *ubuf[2], const int32_t *vbuf[2],
const int32_t *abuf0, uint16_t *dest, int dstW,
int uvalpha, int y, enum AVPixelFormat target)
{
const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
int i;
if (uvalpha < 2048) {
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] ) >> 2;
int Y2 = (buf0[i * 2 + 1]) >> 2;
int U = (ubuf0[i] + (-128 << 11)) >> 2;
int V = (vbuf0[i] + (-128 << 11)) >> 2;
int R, G, B;
Y1 -= c->yuv2rgb_y_offset;
Y2 -= c->yuv2rgb_y_offset;
Y1 *= c->yuv2rgb_y_coeff;
Y2 *= c->yuv2rgb_y_coeff;
Y1 += 1 << 13;
Y2 += 1 << 13;
R = V * c->yuv2rgb_v2r_coeff;
G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
B = U * c->yuv2rgb_u2b_coeff;
output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
dest += 6;
}
} else {
const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] ) >> 2;
int Y2 = (buf0[i * 2 + 1]) >> 2;
int U = (ubuf0[i] + ubuf1[i] + (-128 << 12)) >> 3;
int V = (vbuf0[i] + vbuf1[i] + (-128 << 12)) >> 3;
int R, G, B;
Y1 -= c->yuv2rgb_y_offset;
Y2 -= c->yuv2rgb_y_offset;
Y1 *= c->yuv2rgb_y_coeff;
Y2 *= c->yuv2rgb_y_coeff;
Y1 += 1 << 13;
Y2 += 1 << 13;
R = V * c->yuv2rgb_v2r_coeff;
G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
B = U * c->yuv2rgb_u2b_coeff;
output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
dest += 6;
}
}
}
| 1threat |
static int rtp_asf_fix_header(uint8_t *buf, int len)
{
uint8_t *p = buf, *end = buf + len;
if (len < sizeof(ff_asf_guid) * 2 + 22 ||
memcmp(p, ff_asf_header, sizeof(ff_asf_guid))) {
return -1;
}
p += sizeof(ff_asf_guid) + 14;
do {
uint64_t chunksize = AV_RL64(p + sizeof(ff_asf_guid));
if (memcmp(p, ff_asf_file_header, sizeof(ff_asf_guid))) {
if (chunksize > end - p)
return -1;
p += chunksize;
continue;
}
p += 6 * 8 + 3 * 4 + sizeof(ff_asf_guid) * 2;
if (p + 8 <= end && AV_RL32(p) == AV_RL32(p + 4)) {
AV_WL32(p, 0);
return 0;
}
break;
} while (end - p >= sizeof(ff_asf_guid) + 8);
return -1;
}
| 1threat |
static int coroutine_fn bdrv_co_do_readv(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, QEMUIOVector *qiov)
{
BlockDriver *drv = bs->drv;
BdrvTrackedRequest req;
int ret;
if (!drv) {
return -ENOMEDIUM;
if (bdrv_check_request(bs, sector_num, nb_sectors)) {
return -EIO;
if (bs->io_limits_enabled) {
bdrv_io_limits_intercept(bs, false, nb_sectors);
tracked_request_begin(&req, bs, sector_num, nb_sectors, false);
ret = drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov);
tracked_request_end(&req);
return ret; | 1threat |
how to ensure mutability of class when it is composed of mutable attributes : To make a class mutable when it consists of mutable attribute(s), we should return defensive copies of the mutable attributes.
Consider below mentioned class
class User {
private String firstName;
private String lastName;
private Date dateOfBirth;
// standard getter and setter for firstName and lastName
public void setdateOfBirth(Date dateOfBirth){}
this.dateOfBirth = new Date(dateOfBirth.getTime());
public Date getDateOfBirth(){
return new Date(dateOfBirth.getTime());
}
}
Can we say that if date attribute is set and returned using the above mentioned getters and setter method, it would help in creating the class as immutable and would help in saving the internal state of user class for dateOfBirth field? | 0debug |
Making the for loop append on all the dataset in python : I'm trying to make the for loop append on all the dataset which is from the range of (0,8675) but it keeps getting error just working with 1 row
def convert_emoticons(text):
for emot in EMOTICONS:
text = re.sub(u'('+emot+')', "_".join(EMOTICONS[emot].replace(",","").split()), text)
return text
text = (dataset['posts'][0])
convert_emoticons(text)
| 0debug |
The target process exited without raising CoreCLR started event error with .NET Core 2.2 : <p>I want to debug empty WebApi Project based on .NET Core 2.2.</p>
<p>I installed <code>Core 2.2 SDK x86</code> and changed target framework to 2.2:</p>
<pre><code><Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
</code></pre>
<p>When i starting to debug this project, <code>IIS</code> starts, but in route <code>api/values</code> i see nothing (it loading forever) and i get this error:</p>
<blockquote>
<p>The target process exited without raising a CoreCLR started event.Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core</p>
</blockquote>
<p>In my solution <code>WPF</code> and <code>Class Library</code> projects exist. I wanted to make <code>WebApi</code> for it. Like i said, its empty base project genereted by <code>Visual Studio 2019</code>. I just installed <code>Core 2.2</code> why i get that error and what im doing wrong?</p>
<p><a href="https://i.stack.imgur.com/gt8jT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gt8jT.png" alt="enter image description here"></a></p>
| 0debug |
static int spapr_populate_pci_child_dt(PCIDevice *dev, void *fdt, int offset,
int phb_index, int drc_index,
sPAPRPHBState *sphb)
{
ResourceProps rp;
bool is_bridge = false;
int pci_status, err;
char *buf = NULL;
if (pci_default_read_config(dev, PCI_HEADER_TYPE, 1) ==
PCI_HEADER_TYPE_BRIDGE) {
is_bridge = true;
}
_FDT(fdt_setprop_cell(fdt, offset, "vendor-id",
pci_default_read_config(dev, PCI_VENDOR_ID, 2)));
_FDT(fdt_setprop_cell(fdt, offset, "device-id",
pci_default_read_config(dev, PCI_DEVICE_ID, 2)));
_FDT(fdt_setprop_cell(fdt, offset, "revision-id",
pci_default_read_config(dev, PCI_REVISION_ID, 1)));
_FDT(fdt_setprop_cell(fdt, offset, "class-code",
pci_default_read_config(dev, PCI_CLASS_PROG, 3)));
if (pci_default_read_config(dev, PCI_INTERRUPT_PIN, 1)) {
_FDT(fdt_setprop_cell(fdt, offset, "interrupts",
pci_default_read_config(dev, PCI_INTERRUPT_PIN, 1)));
}
if (!is_bridge) {
_FDT(fdt_setprop_cell(fdt, offset, "min-grant",
pci_default_read_config(dev, PCI_MIN_GNT, 1)));
_FDT(fdt_setprop_cell(fdt, offset, "max-latency",
pci_default_read_config(dev, PCI_MAX_LAT, 1)));
}
if (pci_default_read_config(dev, PCI_SUBSYSTEM_ID, 2)) {
_FDT(fdt_setprop_cell(fdt, offset, "subsystem-id",
pci_default_read_config(dev, PCI_SUBSYSTEM_ID, 2)));
}
if (pci_default_read_config(dev, PCI_SUBSYSTEM_VENDOR_ID, 2)) {
_FDT(fdt_setprop_cell(fdt, offset, "subsystem-vendor-id",
pci_default_read_config(dev, PCI_SUBSYSTEM_VENDOR_ID, 2)));
}
_FDT(fdt_setprop_cell(fdt, offset, "cache-line-size",
pci_default_read_config(dev, PCI_CACHE_LINE_SIZE, 1)));
pci_status = pci_default_read_config(dev, PCI_STATUS, 2);
_FDT(fdt_setprop_cell(fdt, offset, "devsel-speed",
PCI_STATUS_DEVSEL_MASK & pci_status));
if (pci_status & PCI_STATUS_FAST_BACK) {
_FDT(fdt_setprop(fdt, offset, "fast-back-to-back", NULL, 0));
}
if (pci_status & PCI_STATUS_66MHZ) {
_FDT(fdt_setprop(fdt, offset, "66mhz-capable", NULL, 0));
}
if (pci_status & PCI_STATUS_UDF) {
_FDT(fdt_setprop(fdt, offset, "udf-supported", NULL, 0));
}
_FDT(fdt_setprop_string(fdt, offset, "name", "pci"));
buf = spapr_phb_get_loc_code(sphb, dev);
if (!buf) {
error_report("Failed setting the ibm,loc-code");
return -1;
}
err = fdt_setprop_string(fdt, offset, "ibm,loc-code", buf);
g_free(buf);
if (err < 0) {
return err;
}
_FDT(fdt_setprop_cell(fdt, offset, "ibm,my-drc-index", drc_index));
_FDT(fdt_setprop_cell(fdt, offset, "#address-cells",
RESOURCE_CELLS_ADDRESS));
_FDT(fdt_setprop_cell(fdt, offset, "#size-cells",
RESOURCE_CELLS_SIZE));
_FDT(fdt_setprop_cell(fdt, offset, "ibm,req#msi-x",
RESOURCE_CELLS_SIZE));
populate_resource_props(dev, &rp);
_FDT(fdt_setprop(fdt, offset, "reg", (uint8_t *)rp.reg, rp.reg_len));
_FDT(fdt_setprop(fdt, offset, "assigned-addresses",
(uint8_t *)rp.assigned, rp.assigned_len));
return 0;
}
| 1threat |
setup ag-grid in angular 2 : I am trying to set up **ag-grid** my already running angular 2 project but I am unable to get the dependencies. In ourproject we have ag-grid 8.2.0 version available. We do not have ag-grid-angular or any other dependency. To get ag-grid support for angular, do we need to get other dependencies as well? How can I setup the ag-grid towork in my angular 2 project. Thanks in advance | 0debug |
More databases inside the same Firebase Project : <p>In the new Console in a Firebase Project, in <strong>Project Setting</strong> session in the <strong>Database tab</strong> there is the label <strong>Databases</strong>.</p>
<p>However I didn't find any action to create more than 1 database inside the same Firebase Project.</p>
<p>Is it possible to create more databases inside the same Firebase Project?</p>
<p><a href="https://i.stack.imgur.com/Vsgvr.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Vsgvr.png" alt="enter image description here"></a></p>
| 0debug |
query = 'SELECT * FROM customers WHERE email = ' + email_input | 1threat |
Slicing Task In Python : <p>What string do I need to pass the to the programm to get 'Success!'</p>
<pre><code>line = input("Enter line: \n")
if line[:14:2] != '4a7nqp7':
print('Fail!')
elif line[14::2] != 'o0p17kw0':
print('Fail!')
elif line[-1:-14:-2] != 'umlhb57':
print('Fail!')
elif line[-15:-30:-2] != 'xb9d8eal':
print('Fail!')
else:
print('Success!')
</code></pre>
| 0debug |
Covert nvarchar to int : // https://www.codeproject.com/Questions/823002/How-to-clear-Request-Querystring
string url = context.Request.Url.AbsoluteUri; // Henter URL
string[] separateURL = url.Split('?'); // Splitter URL
NameValueCollection queryString = System.Web.HttpUtility.ParseQueryString(separateURL[0]); // Parameterne
string categoryId = queryString[0]; // Indeks 0 er categoryId
StringBuilder table = new StringBuilder();
con.Open();
SqlCommand cmd = new SqlCommand("uspPasteDataSubCategories", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@categoryid", categoryId);
SqlDataReader rd = cmd.ExecuteReader();
Recieving the error: System.Data.SqlClient.SqlException: 'Error converting data type nvarchar to int.'
which doesn't make sense for me because the datatype is not nvarchar in the database.
Error happens at:
SqlDataReader rd = cmd.ExecuteReader(); | 0debug |
how to convert image to pdf and ms word document C#? : <p>i want to develop desktop app to convert images to text than add that text to PDF and ms word document simple c# code can anyone help me i just uploaded the image in picturebox but i can not get it how to to the remaining task</p>
| 0debug |
Confused on C# Static Member Concept : <p>I know static Member of a class is a shared member between all instances of that class but how can I use it when an instance is created?
For Example, I have a Class called <code>Map()</code> and I would like to keep <code>MaxZoom</code> level of all instances of the <code>Map()</code> in same level as 18. in following code I am populating the instance by using Object Initializer and setting the Title of each instance but how about <code>MaxZoom</code>? where and how I can specify it? </p>
<pre><code>void Main()
{
var map = new Map(){ Title= "Green Coverage"};
Console.WriteLine(map.Title);
}
public class Map
{
private static int MaxZoom = 18;
public string Title {get; set;}
}
</code></pre>
| 0debug |
How can I merge two structs in Golang? : <p>I have two json-marshallable anonymous structs.</p>
<pre><code>a := struct {
Name string `json:"name"`
}{"my name"}
b := struct {
Description string `json:"description"`
}{"my description"}
</code></pre>
<p>Is there any way to merge them into json to get something like that:</p>
<pre><code>{
"name":"my name",
"description":"my description"
}
</code></pre>
| 0debug |
Java Math Prooblem : <p>I have a problem with my Java code:</p>
<pre><code>public static void GetEquation () {
equation = Main.userInput.replaceAll(" ", "");
num1 = Double.parseDouble(equation.substring(0, 1));
operator = equation.substring(1, 2);
num2 = Double.parseDouble(equation.substring(2, 3));
if (operator == "+") {
result = num1 + num2;
}
else if (operator == "-") {
result = num1 - num2;
}
else if (operator == "/") {
result = num1 / num2;
}
else if (operator == "*") {
result = num1 * num2;
}
System.out.println(result);
}
</code></pre>
<p>I found that it gets rid of the whitespace fine and it assigns the variables fine but when it comes to doing the math and displaying the result it fails.
Whatever I typed in, I would get a result of 0. I can't see what is wrong.</p>
| 0debug |
How to gracefully remove a node from Kubernetes? : <p>I want to scale up/down the number of machines to increase/decrease the number of nodes in my Kubernetes cluster. When I add one machine, I’m able to successfully register it with Kubernetes; therefore, a new node is created as expected. However, it is not clear to me how to smoothly shut down the machine later. A good workflow would be:</p>
<ol>
<li>Mark the node related to the machine that I am going to shut down as unschedulable;</li>
<li>Start the pod(s) that is running in the node in other node(s);</li>
<li>Gracefully delete the pod(s) that is running in the node;</li>
<li>Delete the node.</li>
</ol>
<p>If I understood correctly, even <code>kubectl drain</code> (<a href="https://groups.google.com/forum/#!topic/google-containers/FxOYvJp82T0" rel="noreferrer">discussion</a>) doesn't do what I expect since it doesn’t start the pods before deleting them (it relies on a replication controller to start the pods afterwards which may cause downtime). Am I missing something?</p>
<p>How should I properly shutdown a machine?</p>
| 0debug |
How to set the label Fonts as "Time New Roman" by drawparallels in python : <p>I have draw a map with latitudes labelled but I want to set the fonts as "Times New Roman". How to make it possible?</p>
<p>m.drawparallels(parallels,labels=[1,0,0,0],fontsize=12)</p>
| 0debug |
static void lsi_scsi_init(PCIDevice *dev)
{
LSIState *s = (LSIState *)dev;
uint8_t *pci_conf;
pci_conf = s->pci_dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_LSI_LOGIC);
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_LSI_53C895A);
pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_SCSI);
pci_conf[0x2e] = 0x00;
pci_conf[0x2f] = 0x10;
pci_conf[0x0d] = 0xff;
pci_conf[0x3d] = 0x01;
s->mmio_io_addr = cpu_register_io_memory(lsi_mmio_readfn,
lsi_mmio_writefn, s);
s->ram_io_addr = cpu_register_io_memory(lsi_ram_readfn,
lsi_ram_writefn, s);
pci_register_bar((struct PCIDevice *)s, 0, 256,
PCI_ADDRESS_SPACE_IO, lsi_io_mapfunc);
pci_register_bar((struct PCIDevice *)s, 1, 0x400,
PCI_ADDRESS_SPACE_MEM, lsi_mmio_mapfunc);
pci_register_bar((struct PCIDevice *)s, 2, 0x2000,
PCI_ADDRESS_SPACE_MEM, lsi_ram_mapfunc);
s->queue = qemu_malloc(sizeof(lsi_queue));
s->queue_len = 1;
s->active_commands = 0;
s->pci_dev.unregister = lsi_scsi_uninit;
lsi_soft_reset(s);
scsi_bus_new(&dev->qdev, lsi_scsi_attach);
} | 1threat |
Python use your own commands in py : <p>My question is something like in batch</p>
<pre><code>:A
set /p cmd= Command:
%cmd%
goto a
</code></pre>
<p>so when program throws exception I can use my own commands in the middle to test other xpath's or forms.</p>
| 0debug |
How to fetch data through api in redux? : <p>I am a beginner with reactjs/redux, could not find a simple to use example of how to use an api call to retrieve data in a redux app. I guess you could use a jquery ajax call but there are probable better options out there?</p>
| 0debug |
How to effectively make use of a GPU for reinforcement learning? : <p>Recently i looked into reinforcement learning and there was one question bugging me, that i could not find an answer for: How is training effectively done using GPUs? To my understanding constant interaction with an environment is required, which for me seems like a huge bottleneck, since this task is often non-mathematical / non-parallelizable. Yet for example Alpha Go uses multiple TPUs/GPUs. So how are they doing it?</p>
| 0debug |
React - input type file Semantic UI React : <p>I'm trying to implement a file upload, but using <a href="https://react.semantic-ui.com/" rel="noreferrer">SUIR</a> <a href="https://react.semantic-ui.com/elements/input/" rel="noreferrer"><code><Input></code></a>, button, label, etc.</p>
<p>This is strictly about the use of the elements in render.</p>
<p>Using regular html <code><label></code> and <code><input></code> elements this process works as expected. </p>
<pre><code> <Form.Field>
<label>File input & upload for dataschemas & datasources</label>
<input type="file" onChange={this.fileChange} />
<Button type="submit">Upload</Button>
</Form.Field>
</code></pre>
<p>Now I'm trying to use SUIR <code><Input></code> element, as well as some props with the <code><Button></code> element for styling.</p>
<pre><code> <Form.Field>
<label>File input & upload </label>
<Input type="file" onChange={this.fileChange}>
<Button
content="Choose File"
labelPosition="left"
icon="file"
/>
</Input>
<Button type="submit">Upload</Button>
</Form.Field>
</code></pre>
<p>You can visit the codesandbox <a href="https://codesandbox.io/s/5wxr0mwq5p" rel="noreferrer">here</a> to get a better visual idea of what I'm talking about.</p>
<p>When I click <code>Choose File</code> in the SUIR implementation example it does not prompt the user to chose a file from their system, whereas the regular html <code><input></code> does. I'm not sure how to get <code><Input type="file ...></code> in semantic to behave the same way.</p>
| 0debug |
How start animation on focus (android studio) : I want to start an animation like a fade whenever a Text-view or Image-view is in focus without clicking.
If you have an idea how to find a solution. | 0debug |
static inline void gen_st8(TCGv val, TCGv addr, int index)
{
tcg_gen_qemu_st8(val, addr, index);
dead_tmp(val);
}
| 1threat |
MATLAB: I just want to plot a freaking function : MATLAB is probably the most frustrating thing ever. I'm just trying to plot a freaking function and keep receiving this freaking thing:
"Unbalanced or unexpected parenthesis or bracket."
This is my code:
file charge.m
function [q]=charge(t)
G=66;
R=24.7;
L=2.74;
C=0.000251;
P1=-0.5*(R/L)*t;
P2=t*sqrt(1/(L*C)-(R^2)/(4*L^2));
q=G*exp(P1)*cos(P2);
and my main function
main.m
x=(0:0.001:1);
y=charge(x.)
plot(x,y)
What am I doing wrong? I keep searching and searching about how to do this and I'm still blank about it.
Can someone help me?
| 0debug |
void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, int width){
const int w2= (width+1)>>1;
IDWTELEM temp_buf[(width>>1) + 4];
IDWTELEM * const temp = temp_buf + 4 - (((int)temp_buf & 0xF) >> 2);
const int w_l= (width>>1);
const int w_r= w2 - 1;
int i;
{
IDWTELEM * const ref = b + w2 - 1;
IDWTELEM b_0 = b[0];
i = 0;
asm volatile(
"pcmpeqd %%xmm7, %%xmm7 \n\t"
"pcmpeqd %%xmm3, %%xmm3 \n\t"
"psllw $1, %%xmm3 \n\t"
"paddw %%xmm7, %%xmm3 \n\t"
"psllw $13, %%xmm3 \n\t"
::);
for(; i<w_l-15; i+=16){
asm volatile(
"movdqu (%1), %%xmm1 \n\t"
"movdqu 16(%1), %%xmm5 \n\t"
"movdqu 2(%1), %%xmm2 \n\t"
"movdqu 18(%1), %%xmm6 \n\t"
"paddw %%xmm1, %%xmm2 \n\t"
"paddw %%xmm5, %%xmm6 \n\t"
"paddw %%xmm7, %%xmm2 \n\t"
"paddw %%xmm7, %%xmm6 \n\t"
"pmulhw %%xmm3, %%xmm2 \n\t"
"pmulhw %%xmm3, %%xmm6 \n\t"
"paddw (%0), %%xmm2 \n\t"
"paddw 16(%0), %%xmm6 \n\t"
"movdqa %%xmm2, (%0) \n\t"
"movdqa %%xmm6, 16(%0) \n\t"
:: "r"(&b[i]), "r"(&ref[i])
: "memory"
);
}
snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS);
b[0] = b_0 - ((W_DM * 2 * ref[1]+W_DO)>>W_DS);
}
{
IDWTELEM * const dst = b+w2;
i = 0;
for(; (((long)&dst[i]) & 0x1F) && i<w_r; i++){
dst[i] = dst[i] - (b[i] + b[i + 1]);
}
for(; i<w_r-15; i+=16){
asm volatile(
"movdqu (%1), %%xmm1 \n\t"
"movdqu 16(%1), %%xmm5 \n\t"
"movdqu 2(%1), %%xmm2 \n\t"
"movdqu 18(%1), %%xmm6 \n\t"
"paddw %%xmm1, %%xmm2 \n\t"
"paddw %%xmm5, %%xmm6 \n\t"
"movdqa (%0), %%xmm0 \n\t"
"movdqa 16(%0), %%xmm4 \n\t"
"psubw %%xmm2, %%xmm0 \n\t"
"psubw %%xmm6, %%xmm4 \n\t"
"movdqa %%xmm0, (%0) \n\t"
"movdqa %%xmm4, 16(%0) \n\t"
:: "r"(&dst[i]), "r"(&b[i])
: "memory"
);
}
snow_horizontal_compose_lift_lead_out(i, dst, dst, b, width, w_r, 1, W_CM, W_CO, W_CS);
}
{
IDWTELEM * const ref = b+w2 - 1;
IDWTELEM b_0 = b[0];
i = 0;
asm volatile(
"psllw $15, %%xmm7 \n\t"
"pcmpeqw %%xmm6, %%xmm6 \n\t"
"psrlw $13, %%xmm6 \n\t"
"paddw %%xmm7, %%xmm6 \n\t"
::);
for(; i<w_l-15; i+=16){
asm volatile(
"movdqu (%1), %%xmm0 \n\t"
"movdqu 16(%1), %%xmm4 \n\t"
"movdqu 2(%1), %%xmm1 \n\t"
"movdqu 18(%1), %%xmm5 \n\t"
"paddw %%xmm6, %%xmm0 \n\t"
"paddw %%xmm6, %%xmm4 \n\t"
"paddw %%xmm7, %%xmm1 \n\t"
"paddw %%xmm7, %%xmm5 \n\t"
"pavgw %%xmm1, %%xmm0 \n\t"
"pavgw %%xmm5, %%xmm4 \n\t"
"psubw %%xmm7, %%xmm0 \n\t"
"psubw %%xmm7, %%xmm4 \n\t"
"psraw $1, %%xmm0 \n\t"
"psraw $1, %%xmm4 \n\t"
"movdqa (%0), %%xmm1 \n\t"
"movdqa 16(%0), %%xmm5 \n\t"
"paddw %%xmm1, %%xmm0 \n\t"
"paddw %%xmm5, %%xmm4 \n\t"
"psraw $2, %%xmm0 \n\t"
"psraw $2, %%xmm4 \n\t"
"paddw %%xmm1, %%xmm0 \n\t"
"paddw %%xmm5, %%xmm4 \n\t"
"movdqa %%xmm0, (%0) \n\t"
"movdqa %%xmm4, 16(%0) \n\t"
:: "r"(&b[i]), "r"(&ref[i])
: "memory"
);
}
snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l);
b[0] = b_0 + ((2 * ref[1] + W_BO-1 + 4 * b_0) >> W_BS);
}
{
IDWTELEM * const src = b+w2;
i = 0;
for(; (((long)&temp[i]) & 0x1F) && i<w_r; i++){
temp[i] = src[i] - ((-W_AM*(b[i] + b[i+1]))>>W_AS);
}
for(; i<w_r-7; i+=8){
asm volatile(
"movdqu 2(%1), %%xmm2 \n\t"
"movdqu 18(%1), %%xmm6 \n\t"
"paddw (%1), %%xmm2 \n\t"
"paddw 16(%1), %%xmm6 \n\t"
"movdqu (%0), %%xmm0 \n\t"
"movdqu 16(%0), %%xmm4 \n\t"
"paddw %%xmm2, %%xmm0 \n\t"
"paddw %%xmm6, %%xmm4 \n\t"
"psraw $1, %%xmm2 \n\t"
"psraw $1, %%xmm6 \n\t"
"paddw %%xmm0, %%xmm2 \n\t"
"paddw %%xmm4, %%xmm6 \n\t"
"movdqa %%xmm2, (%2) \n\t"
"movdqa %%xmm6, 16(%2) \n\t"
:: "r"(&src[i]), "r"(&b[i]), "r"(&temp[i])
: "memory"
);
}
snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -W_AM, W_AO+1, W_AS);
}
{
snow_interleave_line_header(&i, width, b, temp);
for (; (i & 0x3E) != 0x3E; i-=2){
b[i+1] = temp[i>>1];
b[i] = b[i>>1];
}
for (i-=62; i>=0; i-=64){
asm volatile(
"movdqa (%1), %%xmm0 \n\t"
"movdqa 16(%1), %%xmm2 \n\t"
"movdqa 32(%1), %%xmm4 \n\t"
"movdqa 48(%1), %%xmm6 \n\t"
"movdqa (%1), %%xmm1 \n\t"
"movdqa 16(%1), %%xmm3 \n\t"
"movdqa 32(%1), %%xmm5 \n\t"
"movdqa 48(%1), %%xmm7 \n\t"
"punpcklwd (%2), %%xmm0 \n\t"
"punpcklwd 16(%2), %%xmm2 \n\t"
"punpcklwd 32(%2), %%xmm4 \n\t"
"punpcklwd 48(%2), %%xmm6 \n\t"
"movdqa %%xmm0, (%0) \n\t"
"movdqa %%xmm2, 32(%0) \n\t"
"movdqa %%xmm4, 64(%0) \n\t"
"movdqa %%xmm6, 96(%0) \n\t"
"punpckhwd (%2), %%xmm1 \n\t"
"punpckhwd 16(%2), %%xmm3 \n\t"
"punpckhwd 32(%2), %%xmm5 \n\t"
"punpckhwd 48(%2), %%xmm7 \n\t"
"movdqa %%xmm1, 16(%0) \n\t"
"movdqa %%xmm3, 48(%0) \n\t"
"movdqa %%xmm5, 80(%0) \n\t"
"movdqa %%xmm7, 112(%0) \n\t"
:: "r"(&(b)[i]), "r"(&(b)[i>>1]), "r"(&(temp)[i>>1])
: "memory"
);
}
}
}
| 1threat |
static uint32_t pci_apb_ioreadw (void *opaque, target_phys_addr_t addr)
{
uint32_t val;
val = bswap16(cpu_inw(addr & IOPORTS_MASK));
return val;
}
| 1threat |
Flyway repair with Spring Boot : <p>I don't quite understand what I am supposed to do when a migration fails using Flyway in a Spring Boot project.</p>
<p>I activated Flyway by simply adding the Flyway dependency in my <code>pom.xml</code>. And everything works fine. My database scripts are migrated when I launch the Spring Boot app.</p>
<p>But I had an error in one of my scripts and my last migration failed. Now when I try to migrate, there is a "Migration checksum mismatch". Normally, I would run <code>mvn flyway:repair</code>, but since I am using Spring Boot, I am not supposed to use the Flyway Maven plug-in. So what am I supposed to do?</p>
| 0debug |
const char *qjson_get_str(QJSON *json)
{
return qstring_get_str(json->str);
}
| 1threat |
DBeaver file encoding (cp1250 - Windows-1250) - change default encoding? : <p>I have a problem setting encoding in DBeaver, specifically
SQL file encoding (not db encoding!)
to cp1250 (Windows-1250)</p>
<p>No problem to set such encoding for new files/scripts - right click on Scripts folder (or the whole project folder, from which scripts are inheriting):
Properties / Resources / Text file encoding.</p>
<p>The problem is opening existing scripts from text files (SQL Editor / Load script). These are loaded in UTF-8, which is shown as deafult encoding. No easy way to change the encoding after opening...</p>
<p>Does anyone know how to change default encoding for DBeaver (or for opened files)?
I cannot find the answer anywhere...</p>
| 0debug |
how to create a recursive function that summs up? : hello I need to create a function that recursively adds up each number in a large number.
i.e. if the user inputs the number 143
the function will return 1+4+3
which is 8.
can someone help? | 0debug |
void helper_sysret(CPUX86State *env, int dflag)
{
int cpl, selector;
if (!(env->efer & MSR_EFER_SCE)) {
raise_exception_err(env, EXCP06_ILLOP, 0);
}
cpl = env->hflags & HF_CPL_MASK;
if (!(env->cr[0] & CR0_PE_MASK) || cpl != 0) {
raise_exception_err(env, EXCP0D_GPF, 0);
}
selector = (env->star >> 48) & 0xffff;
if (env->hflags & HF_LMA_MASK) {
cpu_load_eflags(env, (uint32_t)(env->regs[11]), TF_MASK | AC_MASK
| ID_MASK | IF_MASK | IOPL_MASK | VM_MASK | RF_MASK |
NT_MASK);
if (dflag == 2) {
cpu_x86_load_seg_cache(env, R_CS, (selector + 16) | 3,
0, 0xffffffff,
DESC_G_MASK | DESC_P_MASK |
DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK |
DESC_L_MASK);
env->eip = env->regs[R_ECX];
} else {
cpu_x86_load_seg_cache(env, R_CS, selector | 3,
0, 0xffffffff,
DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
env->eip = (uint32_t)env->regs[R_ECX];
}
cpu_x86_load_seg_cache(env, R_SS, selector + 8,
0, 0xffffffff,
DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
DESC_W_MASK | DESC_A_MASK);
} else {
env->eflags |= IF_MASK;
cpu_x86_load_seg_cache(env, R_CS, selector | 3,
0, 0xffffffff,
DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
env->eip = (uint32_t)env->regs[R_ECX];
cpu_x86_load_seg_cache(env, R_SS, selector + 8,
0, 0xffffffff,
DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
DESC_W_MASK | DESC_A_MASK);
}
}
| 1threat |
How to display objects inside an array using javascript : <p>So I have an array of objects and I want to display them in order. I want to assign each attribute or property of the object to DOM objects such as "title" to h1 or "description" to p etc. and have each object inside a new div element. I'm sort of new to javascript so I'm really not sure where to start here.</p>
<pre><code>var ads = [
{
title: "Photo Play Paper Collections",
description: "Don't miss these brand new Photo Play Paper Collections!",
},
{
title: "Foil & Foiling Accessories",
description: "Once you add this color & shine to your paper, wood, fabric, or other porous surfaces you'll want to do it over and over again.",
},
];
</code></pre>
<p>When I try to display this </p>
<pre><code> document.getElementById("test").innerHTML=ads
</code></pre>
<p>It just returns as </p>
<p>[object Object],[object Object]</p>
<p>First of all, how to I get it to display the actual information stored, and secondly how would I append each attribute to an element using javascript? Sorry this is sort of vague. The only things I've seen involve using angular or react. Is there a somewhat simple way to do this using only pure javascript?</p>
| 0debug |
How to fix this issue? : I am trying to write a C++ Program, but am greatly struggling with the copy assignment section. Here's my code:
#include <iostream>
using namespace std;
class CarCounter {
public:
CarCounter();
CarCounter& operator=(const CarCounter& objToCopy);
void SetCarCount(const int setVal) {
carCount = setVal;
}
int GetCarCount() const {
return carCount;
}
private:
int carCount;
};
CarCounter::CarCounter() {
carCount = 0;
}
// FIXME write copy assignment operator
/* Your solution goes here */
CarCounter& CarCounter::operator=(const CarCounter& objToCopy) {
CarCounter nobj;
cout << objToCopy.carCount << endl;
nobj.carCount = objToCopy.carCount;
cout << nobj.carCount << endl;
cout << *this << endl;
return *this;
}
int main() {
CarCounter frontParkingLot;
CarCounter backParkingLot;
frontParkingLot.SetCarCount(12);
backParkingLot = frontParkingLot;
cout << "Cars counted: " << backParkingLot.GetCarCount();
return 0;
}
And the output is:
main.cpp: In member function ‘CarCounter& CarCounter::operator=(const CarCounter&)’:
main.cpp:30:9: error: no match for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream<char>}’ and ‘CarCounter’)
cout << *this << endl;
~~~~~^~~~~~~~
I know it's probably an obvious rookie mistake, but I'm new to C++. I appreciate all the help I can get. Thanks! | 0debug |
Simpe drop down menu with html and css : What am i doing wrong in this code? I want to see a drop down menu as soon as i hover on the "About" button, but instead of hovering, I only see half of the drop down menu. Plzzzzzzzz help me. here is the code.
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<!DOCTYPE html>
<html>
<head>
<style>
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.goCenter {
text-align: center;
color: white;
}
body {
background-color: #1A1617
}
ul {
text-align: center;
list-style-type: 0px;
margin: 0px;
padding: 20px;
background-color: black;
overflow: hidden;
}
li a {
color: white;
padding: 8px 16px;
text-decoration: none;
}
li {
display: inline;
}
li a:hover {
background-color: red;
text-size: 10px;
}
.dropdown:hover .dropdown-content {
display: block;
}
</style>
</head>
<body>
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="news.html">News</a></li>
<div class="dropdown">
<li><a href="about.html">About</a></li>
<div class="dropdown-content">
<p>Check</p>
<div>
</div>
</ul>
<p class="goCenter"><strong></strong></p>
</body>
</html>
<!-- end snippet -->
| 0debug |
Sorting in python- How to sort in a different order? : <p>What is the python implementation to Sort this list: </p>
<pre><code>['a', 'C', 2, 'z', 'B', 1, 'h', 0, 'Y', 9]
</code></pre>
<p>into the below list?</p>
<pre><code>['a', 'B', 'C', 'h', 'Y', 'z', 9, 2, 1, 0]
</code></pre>
<p>Order: a->b->..->y->z->...3->-2->1->0</p>
<p>It is Case insensitive for letters ('A' is same as 'a').</p>
<p>Thank you!</p>
| 0debug |
Android plugin is too old (2.4.0-alpha7) : <p>I'm using android studio 2.4, And getting this error. Apparently I have to update my android plugin, but when I checked jcenter for new versions the only version
available was <strong>2.5.0-alpha-preview-02</strong>. which would cause the exact same error.
I also see somewhere in the error message that it says I must replace the <code>ANDROID_DAILY_OVERRIDE</code> environment variable. But I really have no idea where to put this environment variable? Should it go to local.properties or is it an OS env variable? I was wondering if anybody else is facing this problem.</p>
<p>This is the full message</p>
<pre><code>Error:(1, 0) The android gradle plugin version 2.5.0-alpha-preview-02 is too old, please update to the latest version.
To override this check from the command line please set the ANDROID_DAILY_OVERRIDE environment variable to "8d256f619ba96afd1273947e8b8bebea4cb2fd05"
<a href="fixGradleElements">Upgrade plugin to version 2.4.0-alpha7 and sync project</a><br><a
href="openFile:C:/Users/hshahdoost/MyWork/BAmooz/Android/build.gradle">Open File</a>
</code></pre>
| 0debug |
static long do_sigreturn_v1(CPUARMState *env)
{
abi_ulong frame_addr;
struct sigframe_v1 *frame;
target_sigset_t set;
sigset_t host_set;
int i;
if (env->regs[13] & 7)
goto badframe;
frame_addr = env->regs[13];
if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1))
goto badframe;
if (__get_user(set.sig[0], &frame->sc.oldmask))
goto badframe;
for(i = 1; i < TARGET_NSIG_WORDS; i++) {
if (__get_user(set.sig[i], &frame->extramask[i - 1]))
goto badframe;
}
target_to_host_sigset_internal(&host_set, &set);
sigprocmask(SIG_SETMASK, &host_set, NULL);
if (restore_sigcontext(env, &frame->sc))
goto badframe;
#if 0
if (ptrace_cancel_bpt(current))
send_sig(SIGTRAP, current, 1);
#endif
unlock_user_struct(frame, frame_addr, 0);
return env->regs[0];
badframe:
unlock_user_struct(frame, frame_addr, 0);
force_sig(TARGET_SIGSEGV );
return 0;
}
| 1threat |
static int check_refcounts_l1(BlockDriverState *bs,
uint16_t *refcount_table,
int refcount_table_size,
int64_t l1_table_offset, int l1_size,
int check_copied)
{
BDRVQcowState *s = bs->opaque;
uint64_t *l1_table, l2_offset, l1_size2;
int i, refcount, ret;
int errors = 0;
l1_size2 = l1_size * sizeof(uint64_t);
errors += inc_refcounts(bs, refcount_table, refcount_table_size,
l1_table_offset, l1_size2);
if (l1_size2 == 0) {
l1_table = NULL;
} else {
l1_table = qemu_malloc(l1_size2);
if (bdrv_pread(bs->file, l1_table_offset,
l1_table, l1_size2) != l1_size2)
goto fail;
for(i = 0;i < l1_size; i++)
be64_to_cpus(&l1_table[i]);
}
for(i = 0; i < l1_size; i++) {
l2_offset = l1_table[i];
if (l2_offset) {
if (check_copied) {
refcount = get_refcount(bs, (l2_offset & ~QCOW_OFLAG_COPIED)
>> s->cluster_bits);
if (refcount < 0) {
fprintf(stderr, "Can't get refcount for l2_offset %"
PRIx64 ": %s\n", l2_offset, strerror(-refcount));
}
if ((refcount == 1) != ((l2_offset & QCOW_OFLAG_COPIED) != 0)) {
fprintf(stderr, "ERROR OFLAG_COPIED: l2_offset=%" PRIx64
" refcount=%d\n", l2_offset, refcount);
errors++;
}
}
l2_offset &= ~QCOW_OFLAG_COPIED;
errors += inc_refcounts(bs, refcount_table,
refcount_table_size,
l2_offset,
s->cluster_size);
if (l2_offset & (s->cluster_size - 1)) {
fprintf(stderr, "ERROR l2_offset=%" PRIx64 ": Table is not "
"cluster aligned; L1 entry corrupted\n", l2_offset);
errors++;
}
ret = check_refcounts_l2(bs, refcount_table, refcount_table_size,
l2_offset, check_copied);
if (ret < 0) {
goto fail;
}
errors += ret;
}
}
qemu_free(l1_table);
return errors;
fail:
fprintf(stderr, "ERROR: I/O error in check_refcounts_l1\n");
qemu_free(l1_table);
return -EIO;
}
| 1threat |
How to serve angular cli app before running cypress in CI? : <p>I am trying to use Cypress with an Angular (v. 5) CLI application. </p>
<p>The tests works fine when running locally, because here I can just start the serve command before running the cypress tests. </p>
<p>I tried following the documentation <a href="https://docs.cypress.io/guides/guides/continuous-integration.html#Command-Line" rel="noreferrer">here</a>,
but none of the commands seems to be working.</p>
<p>I tried varioues combination, looking like this: </p>
<pre><code>"cypress:run:report": "./node_modules/.bin/cypress run --record --key <key>",
"cypress:run:ci": "start-server-and-test serve:dev http://localhost:4200 cypress:run:report",
"cypress:run:ci2": "npm run -s serve:dev & npm run -s cypress:run:report",
</code></pre>
<p>Thanks in advance.</p>
| 0debug |
removing number from notification icon : <p>I have a notification icon that has the number of notifications as below. I'm trying to remove the number upon clicking on the icon. </p>
<pre><code><li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-globe"></span>Notifications <span class="badge">{{count(auth()->user()->notifics)}}</span></a>
<ul class="dropdown-menu">
<li>
</code></pre>
<p>Which is the easiest way to do it, Jquery, or there is an easier way in HTML ?</p>
| 0debug |
KafkaConsumer 0.10 Java API error message: No current assignment for partition : <p>I am using KafkaConsumer 0.10 Java api. I want to consume from a specific partition and specific offset. I looked up and found that there is a seek method but its throwing an exception. Anyone had a similar use case or solution ?</p>
<p>Code:</p>
<pre><code>KafkaConsumer<String, byte[]> consumer = new KafkaConsumer<>(consumerProps);
consumer.seek(new TopicPartition("mytopic", 1), 4);
</code></pre>
<p>Exception</p>
<pre><code>java.lang.IllegalStateException: No current assignment for partition mytopic-1
at org.apache.kafka.clients.consumer.internals.SubscriptionState.assignedState(SubscriptionState.java:251)
at org.apache.kafka.clients.consumer.internals.SubscriptionState.seek(SubscriptionState.java:276)
at org.apache.kafka.clients.consumer.KafkaConsumer.seek(KafkaConsumer.java:1135)
at xx.xxx.xxx.Test.main(Test.java:182)
</code></pre>
| 0debug |
Scope Bootstrap Css in Vue : <p>I'm trying to use Bootstrap in a Vue component, and I want all CSS to be scoped. I tried something like this:</p>
<pre><code><style scoped>
@import "~bootstrap/dist/css/bootstrap.css";
@import "~bootstrap-vue/dist/bootstrap-vue.css";
</style>
</code></pre>
<p>But it doesn't seem like the css is scoped. Is there any way to do that?</p>
| 0debug |
static int read_config(BDRVBlkdebugState *s, const char *filename, Error **errp)
{
FILE *f;
int ret;
struct add_rule_data d;
f = fopen(filename, "r");
if (f == NULL) {
error_setg_errno(errp, errno, "Could not read blkdebug config file");
return -errno;
}
ret = qemu_config_parse(f, config_groups, filename);
if (ret < 0) {
error_setg(errp, "Could not parse blkdebug config file");
ret = -EINVAL;
goto fail;
}
d.s = s;
d.action = ACTION_INJECT_ERROR;
qemu_opts_foreach(&inject_error_opts, add_rule, &d, 0);
d.action = ACTION_SET_STATE;
qemu_opts_foreach(&set_state_opts, add_rule, &d, 0);
ret = 0;
fail:
qemu_opts_reset(&inject_error_opts);
qemu_opts_reset(&set_state_opts);
fclose(f);
return ret;
}
| 1threat |
How to make sure that the user can only submit specific pattern while inserting a value into an input? : <p>I was wondering if I have a form and the form contain some inputs that I want the user to be only able to submit a type of inputs I select , Like if I want to make sure that the password contain at least a CAPITAL letter , a number , a symbol and at least 8 letters , How to make sure even if the Javascript is disabled by the user?</p>
| 0debug |
static ssize_t mp_dacl_getxattr(FsContext *ctx, const char *path,
const char *name, void *value, size_t size)
{
char buffer[PATH_MAX];
return lgetxattr(rpath(ctx, path, buffer), MAP_ACL_DEFAULT, value, size);
}
| 1threat |
Closing React Semantic UI modal with button and close icon : <p>I have a Modal where the user needs to fill in some forms and save whatever was filled in through a button in the Modal. When the user saves I would like the modal to close. I can get this done, through using the <code>open</code> prop on the <code>Modal</code> component. But if I do this, the modal doesn't close when I attempt to do so through the closeIcon.</p>
<p>What can I do to allow the user to close the Modal through both methods?</p>
<p>Here is my current modal code:</p>
<pre><code> handleCreateButton (evt) {
evt.preventDefault()
// ...
// code to save whatever was typed in the form
// ...
this.setState({showModal: false})
}
renderModalForm () {
const {
something,
showModal
} = this.state
// if I have the open props, I get to close the Modal after the button is clicked
// however, when using the icon or clicking on dimmer it wont work anymore.
return (
<Modal closeIcon closeOnDimmerClick open={showModal} trigger={<Button onClick={() => this.setState({showModal: true})}><Icon className='plus'/>New Challenge</Button>}>
<Modal.Header>My Modal</Modal.Header>
<Modal.Content>
<Form>
<Form.Input
label='Something'
value={something}
onChange={(evt) => this.handleChangeForms('something', evt.target.value)}
/>
<Button onClick={(evt) => this.handleCreateButton(evt)}>Save</Button>
</Form>
</Modal.Content>
</Modal>
)
}
</code></pre>
| 0debug |
How to connect raspberry pi to internet? : <p>Here i have connected my raspberry pi to my laptop using the ethernet cable.
Inside the raspberry pi boot SD card i have opened the file cmdline and added the following information at the end of the file.</p>
<pre><code>ip=169.254.1.1
</code></pre>
<p>Now i have connected my raspberry pi to the laptop using the ethernet cable and used putty to connect to this device by using the ip address 169.254.1.1 and port 22 using SSH.</p>
<p>Everything is working fine , i have accesed the file system.
But now i wanted to access the intenet so i have entered the command </p>
<pre><code>ping 8.8.8.8
connect:Network in unreachable
</code></pre>
<p>How to access to the internet?How to approach this problem?Any suggestions.</p>
<p>Tutorial followed : <a href="https://www.youtube.com/watch?v=Ioih6MHNNqc" rel="nofollow">Youtube link</a></p>
| 0debug |
Android Target and Compiled SDK version for Android OREO (API26 or API27) : <p>Below is build.gradle </p>
<pre><code>android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
minSdkVersion 18
targetSdkVersion 21
versionName "5.3"
..
}
</code></pre>
<p>But I am able to run the App on Android OREO ( API version 26 or 27 )
How this can be possible?
Do I need to change the target SDK version to 26 or 27?</p>
| 0debug |
What is .AspNetCore.Antiforgery.xxxxxxx cookie in .Net Core? : <p>I was trying to use ValidateAntiForgeryToken in .Net Core but I was getting .AspNetCore.Antiforgery.xxxxxxx cookie is missing.</p>
<p>What is this .AspNetCore.Antiforgery.xxxxxxx cookie?</p>
| 0debug |
How to specify (optional) default props with TypeScript for stateless, functional React components? : <p>I'm trying to create a stateless React component with optional props and defaultProps in Typescript (for a React Native project). This is trivial with vanilla JS, but I'm stumped as to how to achieve it in TypeScript.</p>
<p>With the following code:</p>
<pre><code>import React, { Component } from 'react';
import { Text } from 'react-native';
interface TestProps {
title?: string,
name?: string
}
const defaultProps: TestProps = {
title: 'Mr',
name: 'McGee'
}
const Test = (props = defaultProps) => (
<Text>
{props.title} {props.name}
</Text>
);
export default Test;
</code></pre>
<p>Calling <code><Test title="Sir" name="Lancelot" /></code> renders "Sir Lancelot" as expected, but <code><Test /></code> results in nothing, when it should output
"Mr McGee".</p>
<p>Any help is greatly appreciated.</p>
| 0debug |
static int xio3130_downstream_initfn(PCIDevice *d)
{
PCIBridge* br = DO_UPCAST(PCIBridge, dev, d);
PCIEPort *p = DO_UPCAST(PCIEPort, br, br);
PCIESlot *s = DO_UPCAST(PCIESlot, port, p);
int rc;
int tmp;
rc = pci_bridge_initfn(d);
if (rc < 0) {
return rc;
}
pcie_port_init_reg(d);
pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_TI);
pci_config_set_device_id(d->config, PCI_DEVICE_ID_TI_XIO3130D);
d->config[PCI_REVISION_ID] = XIO3130_REVISION;
rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR,
XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT,
XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT);
if (rc < 0) {
goto err_bridge;
}
rc = pci_bridge_ssvid_init(d, XIO3130_SSVID_OFFSET,
XIO3130_SSVID_SVID, XIO3130_SSVID_SSID);
if (rc < 0) {
goto err_bridge;
}
rc = pcie_cap_init(d, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_DOWNSTREAM,
p->port);
if (rc < 0) {
goto err_msi;
}
pcie_cap_flr_init(d);
pcie_cap_deverr_init(d);
pcie_cap_slot_init(d, s->slot);
pcie_chassis_create(s->chassis);
rc = pcie_chassis_add_slot(s);
if (rc < 0) {
goto err_pcie_cap;
}
pcie_cap_ari_init(d);
rc = pcie_aer_init(d, XIO3130_AER_OFFSET);
if (rc < 0) {
goto err;
}
return 0;
err:
pcie_chassis_del_slot(s);
err_pcie_cap:
pcie_cap_exit(d);
err_msi:
msi_uninit(d);
err_bridge:
tmp = pci_bridge_exitfn(d);
assert(!tmp);
return rc;
}
| 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.