problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
static int kvm_put_fpu(CPUState *env)
{
struct kvm_fpu fpu;
int i;
memset(&fpu, 0, sizeof fpu);
fpu.fsw = env->fpus & ~(7 << 11);
fpu.fsw |= (env->fpstt & 7) << 11;
fpu.fcw = env->fpuc;
for (i = 0; i < 8; ++i)
fpu.ftwx |= (!env->fptags[i]) << i;
memcpy(fpu.fpr, env->fpregs, sizeof env->fpregs);
memcpy(fpu.xmm, env->xmm_regs, sizeof env->xmm_regs);
fpu.mxcsr = env->mxcsr;
return kvm_vcpu_ioctl(env, KVM_SET_FPU, &fpu);
}
| 1threat |
static int parse_cube(AVFilterContext *ctx, FILE *f)
{
LUT3DContext *lut3d = ctx->priv;
char line[MAX_LINE_SIZE];
float min[3] = {0.0, 0.0, 0.0};
float max[3] = {1.0, 1.0, 1.0};
while (fgets(line, sizeof(line), f)) {
if (!strncmp(line, "LUT_3D_SIZE ", 12)) {
int i, j, k;
const int size = strtol(line + 12, NULL, 0);
if (size > MAX_LEVEL) {
av_log(ctx, AV_LOG_ERROR, "Too large 3D LUT\n");
return AVERROR(EINVAL);
}
lut3d->lutsize = size;
for (k = 0; k < size; k++) {
for (j = 0; j < size; j++) {
for (i = 0; i < size; i++) {
struct rgbvec *vec = &lut3d->lut[k][j][i];
do {
NEXT_LINE(0);
if (!strncmp(line, "DOMAIN_", 7)) {
float *vals = NULL;
if (!strncmp(line + 7, "MIN ", 4)) vals = min;
else if (!strncmp(line + 7, "MAX ", 4)) vals = max;
if (!vals)
return AVERROR_INVALIDDATA;
sscanf(line + 11, "%f %f %f", vals, vals + 1, vals + 2);
av_log(ctx, AV_LOG_DEBUG, "min: %f %f %f | max: %f %f %f\n",
min[0], min[1], min[2], max[0], max[1], max[2]);
continue;
}
} while (skip_line(line));
if (sscanf(line, "%f %f %f", &vec->r, &vec->g, &vec->b) != 3)
return AVERROR_INVALIDDATA;
vec->r *= max[0] - min[0];
vec->g *= max[1] - min[1];
vec->b *= max[2] - min[2];
}
}
}
break;
}
}
return 0;
}
| 1threat |
How to get a random enum in TypeScript? : <p>How to get a random item from an enumeration?</p>
<pre><code>enum Colors {
Red, Green, Blue
}
function getRandomColor(): Color {
// return a random Color (Red, Green, Blue) here
}
</code></pre>
| 0debug |
static void do_log(int loglevel, const char *format, ...)
{
va_list ap;
va_start(ap, format);
if (is_daemon) {
vsyslog(LOG_CRIT, format, ap);
} else {
vfprintf(stderr, format, ap);
}
va_end(ap);
}
| 1threat |
int ff_celp_lp_synthesis_filter(int16_t *out, const int16_t *filter_coeffs,
const int16_t *in, int buffer_length,
int filter_length, int stop_on_overflow,
int shift, int rounder)
{
int i,n;
for (n = 0; n < buffer_length; n++) {
int sum = -rounder, sum1;
for (i = 1; i <= filter_length; i++)
sum += filter_coeffs[i-1] * out[n-i];
sum1 = ((-sum >> 12) + in[n]) >> shift;
sum = av_clip_int16(sum1);
if (stop_on_overflow && sum != sum1)
return 1;
out[n] = sum;
}
return 0;
}
| 1threat |
int kvm_init(MachineClass *mc)
{
static const char upgrade_note[] =
"Please upgrade to at least kernel 2.6.29 or recent kvm-kmod\n"
"(see http:
struct {
const char *name;
int num;
} num_cpus[] = {
{ "SMP", smp_cpus },
{ "hotpluggable", max_cpus },
{ NULL, }
}, *nc = num_cpus;
int soft_vcpus_limit, hard_vcpus_limit;
KVMState *s;
const KVMCapabilityInfo *missing_cap;
int ret;
int i, type = 0;
const char *kvm_type;
s = g_malloc0(sizeof(KVMState));
assert(TARGET_PAGE_SIZE <= getpagesize());
page_size_init();
#ifdef KVM_CAP_SET_GUEST_DEBUG
QTAILQ_INIT(&s->kvm_sw_breakpoints);
#endif
s->vmfd = -1;
s->fd = qemu_open("/dev/kvm", O_RDWR);
if (s->fd == -1) {
fprintf(stderr, "Could not access KVM kernel module: %m\n");
ret = -errno;
goto err;
}
ret = kvm_ioctl(s, KVM_GET_API_VERSION, 0);
if (ret < KVM_API_VERSION) {
if (ret > 0) {
ret = -EINVAL;
}
fprintf(stderr, "kvm version too old\n");
goto err;
}
if (ret > KVM_API_VERSION) {
ret = -EINVAL;
fprintf(stderr, "kvm version not supported\n");
goto err;
}
s->nr_slots = kvm_check_extension(s, KVM_CAP_NR_MEMSLOTS);
if (!s->nr_slots) {
s->nr_slots = 32;
}
s->slots = g_malloc0(s->nr_slots * sizeof(KVMSlot));
for (i = 0; i < s->nr_slots; i++) {
s->slots[i].slot = i;
}
soft_vcpus_limit = kvm_recommended_vcpus(s);
hard_vcpus_limit = kvm_max_vcpus(s);
while (nc->name) {
if (nc->num > soft_vcpus_limit) {
fprintf(stderr,
"Warning: Number of %s cpus requested (%d) exceeds "
"the recommended cpus supported by KVM (%d)\n",
nc->name, nc->num, soft_vcpus_limit);
if (nc->num > hard_vcpus_limit) {
fprintf(stderr, "Number of %s cpus requested (%d) exceeds "
"the maximum cpus supported by KVM (%d)\n",
nc->name, nc->num, hard_vcpus_limit);
exit(1);
}
}
nc++;
}
kvm_type = qemu_opt_get(qemu_get_machine_opts(), "kvm-type");
if (mc->kvm_type) {
type = mc->kvm_type(kvm_type);
} else if (kvm_type) {
fprintf(stderr, "Invalid argument kvm-type=%s\n", kvm_type);
goto err;
}
do {
ret = kvm_ioctl(s, KVM_CREATE_VM, type);
} while (ret == -EINTR);
if (ret < 0) {
fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -ret,
strerror(-ret));
#ifdef TARGET_S390X
fprintf(stderr, "Please add the 'switch_amode' kernel parameter to "
"your host kernel command line\n");
#endif
goto err;
}
s->vmfd = ret;
missing_cap = kvm_check_extension_list(s, kvm_required_capabilites);
if (!missing_cap) {
missing_cap =
kvm_check_extension_list(s, kvm_arch_required_capabilities);
}
if (missing_cap) {
ret = -EINVAL;
fprintf(stderr, "kvm does not support %s\n%s",
missing_cap->name, upgrade_note);
goto err;
}
s->coalesced_mmio = kvm_check_extension(s, KVM_CAP_COALESCED_MMIO);
s->broken_set_mem_region = 1;
ret = kvm_check_extension(s, KVM_CAP_JOIN_MEMORY_REGIONS_WORKS);
if (ret > 0) {
s->broken_set_mem_region = 0;
}
#ifdef KVM_CAP_VCPU_EVENTS
s->vcpu_events = kvm_check_extension(s, KVM_CAP_VCPU_EVENTS);
#endif
s->robust_singlestep =
kvm_check_extension(s, KVM_CAP_X86_ROBUST_SINGLESTEP);
#ifdef KVM_CAP_DEBUGREGS
s->debugregs = kvm_check_extension(s, KVM_CAP_DEBUGREGS);
#endif
#ifdef KVM_CAP_XSAVE
s->xsave = kvm_check_extension(s, KVM_CAP_XSAVE);
#endif
#ifdef KVM_CAP_XCRS
s->xcrs = kvm_check_extension(s, KVM_CAP_XCRS);
#endif
#ifdef KVM_CAP_PIT_STATE2
s->pit_state2 = kvm_check_extension(s, KVM_CAP_PIT_STATE2);
#endif
#ifdef KVM_CAP_IRQ_ROUTING
s->direct_msi = (kvm_check_extension(s, KVM_CAP_SIGNAL_MSI) > 0);
#endif
s->intx_set_mask = kvm_check_extension(s, KVM_CAP_PCI_2_3);
s->irq_set_ioctl = KVM_IRQ_LINE;
if (kvm_check_extension(s, KVM_CAP_IRQ_INJECT_STATUS)) {
s->irq_set_ioctl = KVM_IRQ_LINE_STATUS;
}
#ifdef KVM_CAP_READONLY_MEM
kvm_readonly_mem_allowed =
(kvm_check_extension(s, KVM_CAP_READONLY_MEM) > 0);
#endif
ret = kvm_arch_init(s);
if (ret < 0) {
goto err;
}
ret = kvm_irqchip_create(s);
if (ret < 0) {
goto err;
}
kvm_state = s;
memory_listener_register(&kvm_memory_listener, &address_space_memory);
memory_listener_register(&kvm_io_listener, &address_space_io);
s->many_ioeventfds = kvm_check_many_ioeventfds();
cpu_interrupt_handler = kvm_handle_interrupt;
return 0;
err:
if (s->vmfd >= 0) {
close(s->vmfd);
}
if (s->fd != -1) {
close(s->fd);
}
g_free(s->slots);
g_free(s);
return ret;
}
| 1threat |
i have a json response in the following format.How to retriew data table from Json response in asp.net or c sharp code? : {
"status": "success",
"data": [
[
{
"value": "Department of Information Technology and Communication",
"key": "POSTED_DEPARTMENT"
},
{
"value": 5800002,
"key": "APPOINTING_DEPT_ID"
},
{
"value": 170,
"key": "EMP_CADRE"
},
{
"value": "Department of Information Technology and Communication",
"key": "APPOINTING_DEPT"
},
{
"value": "RJBI198009003722",
"key": "UNIQUE_ID"
},
{
"value": 5800002,
"key": "POSTED_DEPARTMENT_ID"
},
{
"value": 3004216,
"key": "EMP_ID"
},
{
"value": null,
"key": "DATE_OF_BIRTH"
},
{
"value": "06 Jan 2018",
"key": "IPR_SUBMITTED_DATE"
},
{
"value": "Programmer",
"key": "DESIGNATION"
},
{
"value": null,
"key": "PROPERTY_YEAR"
},
{
"value": "DINESHARORA",
"key": "EMPLOYEE_NAME"
},
{
"value": "Mr.MURLI MANOHAR ARORA",
"key": "FATHER_NAME"
},
]
],
"msg": "Data Successfully Retrived"
} | 0debug |
python not executing code written in init.py : I am having a print statement in inin.py file and is not getting printed on the console when I am calling the libraries
My directory structure is as follow
- Dir_1 -----under that ---> I am having two folders names `libraries` and `scripts` and a init.py file which is empty
- Libraries folder is having many python files and having init.py file
- I have added a print statement in init.py file. like print "*******************"
- I have added a created a new file say test.py under libraries folder and having below code in that
class TEST:
print "From class test"
obj = TEST()
`not getting proper indentation`
I am expecting that it should print the line that I have written in init.py file but it is not printing that line
What mistake I am doing
| 0debug |
static int rv40_h_loop_filter_strength(uint8_t *src, int stride,
int beta, int beta2, int edge,
int *p1, int *q1)
{
return rv40_loop_filter_strength(src, stride, 1, beta, beta2, edge, p1, q1);
}
| 1threat |
alert('Hello ' + user_input); | 1threat |
static void s390_init(ram_addr_t ram_size,
const char *boot_device,
const char *kernel_filename,
const char *kernel_cmdline,
const char *initrd_filename,
const char *cpu_model)
{
CPUState *env = NULL;
ram_addr_t ram_addr;
ram_addr_t kernel_size = 0;
ram_addr_t initrd_offset;
ram_addr_t initrd_size = 0;
int i;
if (!kvm_enabled()) {
fprintf(stderr, "The S390 target only works with KVM enabled\n");
exit(1);
}
s390_bus = s390_virtio_bus_init(&ram_size);
ram_addr = qemu_ram_alloc(ram_size);
cpu_register_physical_memory(0, ram_size, ram_addr);
if (cpu_model == NULL) {
cpu_model = "host";
}
ipi_states = qemu_malloc(sizeof(CPUState *) * smp_cpus);
for (i = 0; i < smp_cpus; i++) {
CPUState *tmp_env;
tmp_env = cpu_init(cpu_model);
if (!env) {
env = tmp_env;
}
ipi_states[i] = tmp_env;
tmp_env->halted = 1;
tmp_env->exception_index = EXCP_HLT;
}
env->halted = 0;
env->exception_index = 0;
if (kernel_filename) {
kernel_size = load_image(kernel_filename, qemu_get_ram_ptr(0));
if (lduw_phys(KERN_IMAGE_START) != 0x0dd0) {
fprintf(stderr, "Specified image is not an s390 boot image\n");
exit(1);
}
env->psw.addr = KERN_IMAGE_START;
env->psw.mask = 0x0000000180000000ULL;
} else {
ram_addr_t bios_size = 0;
char *bios_filename;
if (bios_name == NULL) {
bios_name = ZIPL_FILENAME;
}
bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
bios_size = load_image(bios_filename, qemu_get_ram_ptr(ZIPL_LOAD_ADDR));
if ((long)bios_size < 0) {
hw_error("could not load bootloader '%s'\n", bios_name);
}
if (bios_size > 4096) {
hw_error("stage1 bootloader is > 4k\n");
}
env->psw.addr = ZIPL_START;
env->psw.mask = 0x0000000180000000ULL;
}
if (initrd_filename) {
initrd_offset = INITRD_START;
while (kernel_size + 0x100000 > initrd_offset) {
initrd_offset += 0x100000;
}
initrd_size = load_image(initrd_filename, qemu_get_ram_ptr(initrd_offset));
stq_phys(INITRD_PARM_START, initrd_offset);
stq_phys(INITRD_PARM_SIZE, initrd_size);
}
if (kernel_cmdline) {
cpu_physical_memory_rw(KERN_PARM_AREA, (uint8_t *)kernel_cmdline,
strlen(kernel_cmdline), 1);
}
for(i = 0; i < nb_nics; i++) {
NICInfo *nd = &nd_table[i];
DeviceState *dev;
if (!nd->model) {
nd->model = qemu_strdup("virtio");
}
if (strcmp(nd->model, "virtio")) {
fprintf(stderr, "S390 only supports VirtIO nics\n");
exit(1);
}
dev = qdev_create((BusState *)s390_bus, "virtio-net-s390");
qdev_set_nic_properties(dev, nd);
qdev_init_nofail(dev);
}
for(i = 0; i < MAX_BLK_DEVS; i++) {
DriveInfo *dinfo;
DeviceState *dev;
dinfo = drive_get(IF_IDE, 0, i);
if (!dinfo) {
continue;
}
dev = qdev_create((BusState *)s390_bus, "virtio-blk-s390");
qdev_prop_set_drive(dev, "drive", dinfo);
qdev_init_nofail(dev);
}
}
| 1threat |
Guzzle difference between 'connect_timeout' and 'timeout' : <p>What's the difference between 'connect_timeout' and 'timeout' request options in Guzzle.</p>
| 0debug |
static int net_init_nic(QemuOpts *opts, const char *name, VLANState *vlan)
{
int idx;
NICInfo *nd;
const char *netdev;
idx = nic_get_free_idx();
if (idx == -1 || nb_nics >= MAX_NICS) {
error_report("Too Many NICs");
return -1;
}
nd = &nd_table[idx];
memset(nd, 0, sizeof(*nd));
if ((netdev = qemu_opt_get(opts, "netdev"))) {
nd->netdev = qemu_find_netdev(netdev);
if (!nd->netdev) {
error_report("netdev '%s' not found", netdev);
return -1;
}
} else {
assert(vlan);
nd->vlan = vlan;
}
if (name) {
nd->name = g_strdup(name);
}
if (qemu_opt_get(opts, "model")) {
nd->model = g_strdup(qemu_opt_get(opts, "model"));
}
if (qemu_opt_get(opts, "addr")) {
nd->devaddr = g_strdup(qemu_opt_get(opts, "addr"));
}
if (qemu_opt_get(opts, "macaddr") &&
net_parse_macaddr(nd->macaddr.a, qemu_opt_get(opts, "macaddr")) < 0) {
error_report("invalid syntax for ethernet address");
return -1;
}
qemu_macaddr_default_if_unset(&nd->macaddr);
nd->nvectors = qemu_opt_get_number(opts, "vectors",
DEV_NVECTORS_UNSPECIFIED);
if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED &&
(nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) {
error_report("invalid # of vectors: %d", nd->nvectors);
return -1;
}
nd->used = 1;
nb_nics++;
return idx;
}
| 1threat |
static uint32_t apic_mem_readb(void *opaque, target_phys_addr_t addr)
{
return 0;
}
| 1threat |
int loader_exec(const char * filename, char ** argv, char ** envp,
struct target_pt_regs * regs, struct image_info *infop,
struct linux_binprm *bprm)
{
int retval;
int i;
bprm->p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int);
memset(bprm->page, 0, sizeof(bprm->page));
retval = open(filename, O_RDONLY);
if (retval < 0) {
return -errno;
}
bprm->fd = retval;
bprm->filename = (char *)filename;
bprm->argc = count(argv);
bprm->argv = argv;
bprm->envc = count(envp);
bprm->envp = envp;
retval = prepare_binprm(bprm);
if(retval>=0) {
if (bprm->buf[0] == 0x7f
&& bprm->buf[1] == 'E'
&& bprm->buf[2] == 'L'
&& bprm->buf[3] == 'F') {
retval = load_elf_binary(bprm, regs, infop);
#if defined(TARGET_HAS_BFLT)
} else if (bprm->buf[0] == 'b'
&& bprm->buf[1] == 'F'
&& bprm->buf[2] == 'L'
&& bprm->buf[3] == 'T') {
retval = load_flt_binary(bprm,regs,infop);
#endif
} else {
return -ENOEXEC;
}
}
if(retval>=0) {
do_init_thread(regs, infop);
return retval;
}
for (i=0 ; i<MAX_ARG_PAGES ; i++) {
g_free(bprm->page[i]);
}
return(retval);
}
| 1threat |
Are there any large Python libraries that avoid OOP? : <p>I'm a developer working at a company that primarily uses Python. I have a <em>strong</em> dislike of OOP; I feel it is almost always the wrong tool for the job and quickly makes code unmanageable. In our code base, I would like to avoid using objects / classes / inheritance, etc as much as possible.</p>
<p>I know how to write good functional code in "functional" languages like SML (I use the scare quotes because it is difficult to define what a functional language is). I would ideally like to do the same in Python. Python doesn't force OOP; it has modules, and first-class functions, etc, but it seems like all the Python code I see makes heavy use of classes, and often inheritance as well (even multiple inheritance!). This is both true of the code I work with as well as third-party libraries I've seen.</p>
<p>Are there good examples of large Python libraries that are written in a more functional style that I could learn from? Or has anyone had success in their own private code with this? I don't just want to start writing all my code in a functional style only to run into some pitfalls later down the line.</p>
| 0debug |
How come my codes won't work? :( It won't upload... (jquery, ajax) FILE UPLOAD : I need help to upload a file using ajax without refreshing the page. (I tried using form element it works... but it redirects to the other page).
<!DOCTYPE html>
<html>
<head>
<title> Test File Upload </title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<input type="file" name="file" id="file"><br><br>
<button id="submitbtn"> Upload </button>
</body>
<script>
$(document).ready(function(){
$("#submitbtn").click(function(){
var property = document.getElementById('file').files[0];
var formData = new FormData();
formData.append("file", property);
$.ajax({
url: "AjaxPhp.php",
type: "POST",
data: formData,
cache : false,
contentType : false,
processType : false,
dataType: "json",
success: function(testresponse){
if(testresponse.success == true){
alert(testresponse.messages);
} else {
alert(testresponse.messages);
}
}
})
});
});
</script>
</html>
this is my php file... please help :) thank you so much!
<?php
$con = mysqli_connect("localhost", "root", "", "learningdb") or die("connection failed");
if($_POST){
$target_dir = "testupload/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
if(move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)){
$sql = "INSERT INTO uploadfile(image) VALUES ('$target_file')";
mysqli_query($con, $sql);
$valid['success'] = true;
$valid['messages'] = "Successfully Uploaded!";
} else {
$valid['success'] = false;
$valid['messages'] = "Something went wrong...";
}
echo json_encode($valid);
}
?>
Thank you in advance for to whoever could fix my problem. Arigato. | 0debug |
jQuery error - $ is not defined : <p>The following code:</p>
<pre><code>$('body').mousemove(function() {
clearTimeout(hide)
var hide = setTimeout(function() {
hidePlayer()
}, 2000)
showPlayer()
})
</code></pre>
<p>works fine if I link to a remote jquery library:</p>
<pre><code><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</code></pre>
<p>or if I link to my local file twice:</p>
<pre><code><script src="assets/js/jquery.min.js"></script>
<script src="assets/js/jquery.min.js"></script>
</code></pre>
<p>but using only one jquery script tag:</p>
<pre><code><script src="assets/js/jquery.min.js"></script>
</code></pre>
<p>gives me the following error:</p>
<pre><code>Uncaught ReferenceError: $ is not defined
</code></pre>
<p>I've tried different versions of jquery, using window.onload, replacing $ with jQuery, tried type="text/javascript" and charset="UTF-8"... I'm stumped. Any help is appreciated. </p>
| 0debug |
Using deep learning models from TensorFlow in other language environments : <p>I have a decent amount of experience with TensorFlow, and I am about to embark on a project which will ultimately culminate in using a TensorFlow trained model in a C# production environment. Essentially, I will have live data which will come into the C# environment, and I will ultimately need to output decisions / take certain actions based on the output of my model in TensorFlow. This is basically just a constraint of the existing infrastructure.</p>
<p>I can think of a couple of potentially bad ways to implement this, such as writing the data to disk and then calling the Python part of the application and then finally reading the result output by the Python application and taking some action based on it. This is slow, however.</p>
<p>Are there faster ways to accomplish this same integrated relationship between C# and the Python-based Tensorflow. I see that <a href="https://tensorflow.github.io/serving/serving_basic">there appear to be some ways</a> to do this with C++ and TensorFlow, but what about C#? </p>
| 0debug |
What is the use of Cygwin exactly? : <p>I installed Cygwin on my laptop. After going through the instructions on netbeans site, i found that i need to change the path directory. </p>
<p>My path directory initially shows some java thing on that and if i change it then will it create some problem?</p>
<p><strong><em>I basically Want to run C/C++ programs by NetBeans so I installed Cygwin thinking that it would help me.
Please Suggest me what to do.</em></strong></p>
| 0debug |
static void sys_write(void *opaque, target_phys_addr_t addr,
uint64_t value, unsigned size)
{
LM32SysState *s = opaque;
char *testname;
trace_lm32_sys_memory_write(addr, value);
addr >>= 2;
switch (addr) {
case R_CTRL:
qemu_system_shutdown_request();
break;
case R_PASSFAIL:
s->regs[addr] = value;
testname = (char *)s->testname;
qemu_log("TC %-16s %s\n", testname, (value) ? "FAILED" : "OK");
break;
case R_TESTNAME:
s->regs[addr] = value;
copy_testname(s);
break;
default:
error_report("lm32_sys: write access to unknown register 0x"
TARGET_FMT_plx, addr << 2);
break;
}
}
| 1threat |
Particles over background image : <p>As seen on <a href="https://discordapp.com/" rel="nofollow">https://discordapp.com/</a> there's floating particles overlaying the background of the header. I've searched pretty much everywhere, trying to export transparent videos, gifs from Premiere CC, After Effects even Photoshop, but none of them will work as seen on this page.
I have also not been able to read through the code to find the source of the effect.</p>
| 0debug |
unfortunately android application has been stooped. At Heep Post while attemting to call server : unfortunately android application has been stooped. At Http Post while attempting to call server at post activity please help
HttpClient cli = new DefaultHttpClient();
//HttpPost post = new HttpPost("http://" + sp.getString("ip", "localhost") + "/attendance/cliLogin.php");
HttpPost post = new HttpPost("localhost/attendance/");
// seting post data
List<NameValuePair> loginData = new ArrayList<NameValuePair>(2);
loginData.add(new BasicNameValuePair("uname", uname));
loginData.add(new BasicNameValuePair("pass", pass));
post.setEntity(new UrlEncodedFormEntity(loginData));
// executing login
HttpResponse res = cli.execute(post);
HttpEntity resent = res.getEntity();
String result = EntityUtils.toString(resent);
// reading response
if(result.equals("NoParams"))
Commons.showToast("Something went wrong", true);
else if(result.equals("Login"))
{
navi = new Intent(this, HomeActivity.class);
startActivity(navi);
}
else
Commons.showToast(result, true);
}
catch (HttpHostConnectException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Commons.showToast("Can't reach server, check the Hostname", true);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else
Commons.showToast("Username/Password can't be empty", true);
}
} | 0debug |
db.execute('SELECT * FROM employees WHERE id = ' + user_input) | 1threat |
SQL Server select multiple entries from a single column into a single row result : <p>I need to extract some system user data from table "userrole" into a configuration record, but these user permissions are held in a single column and identified by a different roleid.</p>
<p>So my userrole data table looks like this,</p>
<pre><code>UserID RoleID Discriminator
int int NVarChar
3483 1 Pathologist
3483 2 Histotech
3483 3 Configuration
3483 4 WebViewer
3484 1 Pathologist
3484 4 WebViewer
3485 1 Pathologist
3485 4 WebViewer
3487 1 Pathologist
3487 2 Histotech
3487 3 Configuration
3487 4 WebViewer
3488 1 Pathologist
3488 2 Histotech
3488 3 Configuration
3488 4 WebViewer
</code></pre>
<p>and my target result is </p>
<pre><code>3483 Pathologist Histotech Configuration WebViewer
3484 Pathologist WebViewer
3484 Pathologist WebViewer
3487 Pathologist Histotech Configuration WebViewer
</code></pre>
<p>etc.</p>
<p>But every attempt at "grouping by" just still me multiple rows returned, for example</p>
<pre><code> select USERID
,(select Discriminator where roleid = 1) as Pathologist
,(select Discriminator where roleid = 2) as Histologist
,(select Discriminator where roleid = 3) as Configuration
,(select Discriminator where roleid = 4) as Web
FROM [Workflow].[UserRole]
group by userid, RoleID, discriminator
</code></pre>
<p>gives </p>
<pre><code> USERID Pathologist Histologist Configuration Web
3483 Pathologist NULL NULL NULL
3483 NULL Histotech NULL NULL
3483 NULL NULL Configuration NULL
3483 NULL NULL NULL WebViewer
3484 Pathologist NULL NULL NULL
3484 NULL NULL NULL WebViewer
3485 Pathologist NULL NULL NULL
3485 NULL NULL NULL WebViewer
</code></pre>
<p>Trying to use a DISTINCT or MIN function on the userid as suggested in <a href="https://stackoverflow.com/questions/11937206/sql-query-multiple-columns-using-distinct-on-one-column-only">SQL Query Multiple Columns Using Distinct on One Column Only</a> (not quite the same scenario I know) also still gives me the same multiple row results.</p>
<p>I have reached a bit if a block as to what to try next, so any suggestions most gratefully received.</p>
| 0debug |
ruby unable to load rubygems after compilation : <p>I have compiled Ruby 193 and was able to load many of the modules without any issues. But when I tried to load 'rubygems' its saying false.</p>
<pre><code>irb(main):001:0> require 'json'
=> true
irb(main):002:0> require 'yaml'
=> true
irb(main):003:0> require 'time'
=> true
irb(main):004:0> require 'rubygems'
=> false
irb(main):005:0>
</code></pre>
<p>But on ruby 1.8.7, to load the json we needed to load rubygems first and only then json will load. Am having little confusion with the rubygems between ruby 193 and 187. </p>
| 0debug |
Jquery trigger reset not clear all inputs : I need to clear all the inputs inside form But when I execute trigger reset function. It clears text fields but not the textarea fields
<form id="frm" action="">
<div class="col-md-4">
<input name="" type="text" placeholder="Alan Adını Giriniz" value="" class="form-control"
id="txtCokluDomain">
</div>
<div class="col-md-4"><input type="button" id="liteyeEkle" class="btn btn-success"
value="Ekle">
</div>
</div>
<div class="row">
<div class="col-md-4 ">
<textarea name="" id="textAreaDomainListesi" cols="35" rows="10"></textarea>
</div>
</div>
</form> | 0debug |
Python Bigger is Greater optimization : python gurus.
I am trying to finish the below challenge and don't want to use permutation.
https://www.hackerrank.com/challenges/bigger-is-greater
The below code works well for small piece of test data, however it cannot pass 100000 cases. Could any masters help to provide some suggestions to optimize the below code. Much appreciated.
t=int(raw_input())
for _ in range(t):
s=list(raw_input().strip())#change to list
pos = -1#check pos, if pos is smaller, it's bigger lexilogical, so only choose small pos
i_temp=0
for i in reversed(range(len(s))):
for j in reversed(range(i)):
if s[i]>s[j]: #last letter is bigger than previous, in this case , we can swap to previous one, and found bigger one.
if j>pos:
pos=j#new place
i_temp=i
if j<pos:
break #already found good one
if i<pos:
break #already found good one
if pos>=0:
s_tmp=s[pos]
s[pos]=s[i_temp]
s[i_temp]=s_tmp
s1 = s[pos+1:] #get string for smallest
s1.sort()
print ("".join(s[:pos+1]+s1))
else:
print ("no answer")
| 0debug |
static void send_ext_key_event_ack(VncState *vs)
{
vnc_lock_output(vs);
vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
vnc_write_u8(vs, 0);
vnc_write_u16(vs, 1);
vnc_framebuffer_update(vs, 0, 0,
surface_width(vs->vd->ds),
surface_height(vs->vd->ds),
VNC_ENCODING_EXT_KEY_EVENT);
vnc_unlock_output(vs);
vnc_flush(vs);
}
| 1threat |
Javascript: counter on If Else in array loop not executing : <p>I want to show a line of text depending on what image is shown. I did a console.log on the counter and it seems to loop fine as do the images, but I can't get the line of text to show depending on what number the counter is.</p>
<p>Fiddle: <a href="http://jsfiddle.net/jzhang172/RwjFX/7/" rel="nofollow">http://jsfiddle.net/jzhang172/RwjFX/7/</a></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 imagesArray = ["http://vignette2.wikia.nocookie.net/pokemon/images/e/ef/025Pikachu_Pokemon_Mystery_Dungeon_Red_and_Blue_Rescue_Teams.png/revision/latest?cb=20150105233050",
"http://assets.pokemon.com/assets/cms2/img/pokedex/full//007.png",
"http://assets.pokemon.com/assets/cms2/img/pokedex/full/001.png",
"http://www.pokemonxy.com/_ui/img/_en/art/Fennekin-Pokemon-X-and-Y.jpg",
"http://www.pokemon20.com/assets/img/mythical/arceus/poke_arceus.png"];
function loopImages(count) {
var counter = count % imagesArray.length;
$('img').attr('src', imagesArray[counter]);
$('#firstStar').fadeIn(500, function(){
$('#firstStar').delay(500).fadeOut(500, loopImages.bind(null, count + 1));
});
console.log(counter);
if (counter=1){
$('#imageInfo').html('One');
}
else if (counter=2){
$('#imageInfo').html('Two');
}
}
loopImages(0);</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>
<img src="https://www.kingdomhearts.com/2_8/images/logos/kingdom_hearts_birth_by_sleep_logo.png" id="firstStar">
<p id="imageInfo">
</p></code></pre>
</div>
</div>
</p>
| 0debug |
Mercurial: enable git subrepo : <p>Recently this behavior was disabled by default. The message prompts you to check the help page but it's not helpful, at least it didn't help me.</p>
<pre><code> "subrepos"
----------
This section contains options that control the behavior of the
subrepositories feature. See also 'hg help subrepos'.
Security note: auditing in Mercurial is known to be insufficient to
prevent clone-time code execution with carefully constructed Git subrepos.
It is unknown if a similar detect is present in Subversion subrepos. Both
Git and Subversion subrepos are disabled by default out of security
concerns. These subrepo types can be enabled using the respective options
below.
"allowed"
Whether subrepositories are allowed in the working directory.
When false, commands involving subrepositories (like 'hg update') will
fail for all subrepository types. (default: true)
"hg:allowed"
Whether Mercurial subrepositories are allowed in the working
directory. This option only has an effect if "subrepos.allowed" is
true. (default: true)
"git:allowed"
Whether Git subrepositories are allowed in the working directory. This
option only has an effect if "subrepos.allowed" is true.
See the security note above before enabling Git subrepos. (default:
false)
"svn:allowed"
Whether Subversion subrepositories are allowed in the working
directory. This option only has an effect if "subrepos.allowed" is
true.
See the security note above before enabling Subversion subrepos.
(default: false)
</code></pre>
<p>I assumed it was adding the following to the project's hgrc:</p>
<pre><code>[subrepos]
git:allowed
</code></pre>
<p>But it gives a parsing error. Does anyone know the right format? And also, why they decided to disable this? Each time I checkout this project I'll have to make this change?</p>
| 0debug |
static int av_seek_frame_generic(AVFormatContext *s,
int stream_index, int64_t timestamp, int flags)
{
int index;
AVStream *st;
AVIndexEntry *ie;
st = s->streams[stream_index];
index = av_index_search_timestamp(st, timestamp, flags);
if(index < 0 || index==st->nb_index_entries-1){
int i;
AVPacket pkt;
if(st->nb_index_entries){
assert(st->index_entries);
ie= &st->index_entries[st->nb_index_entries-1];
url_fseek(s->pb, ie->pos, SEEK_SET);
av_update_cur_dts(s, st, ie->timestamp);
}else
url_fseek(s->pb, 0, SEEK_SET);
for(i=0;; i++) {
int ret = av_read_frame(s, &pkt);
if(ret<0)
break;
av_free_packet(&pkt);
if(stream_index == pkt.stream_index){
if((pkt.flags & PKT_FLAG_KEY) && pkt.dts > timestamp)
break;
}
}
index = av_index_search_timestamp(st, timestamp, flags);
}
if (index < 0)
return -1;
av_read_frame_flush(s);
if (s->iformat->read_seek){
if(s->iformat->read_seek(s, stream_index, timestamp, flags) >= 0)
return 0;
}
ie = &st->index_entries[index];
url_fseek(s->pb, ie->pos, SEEK_SET);
av_update_cur_dts(s, st, ie->timestamp);
return 0;
}
| 1threat |
static void decode_delta_d(uint8_t *dst,
const uint8_t *buf, const uint8_t *buf_end,
int w, int flag, int bpp, int dst_size)
{
int planepitch = FFALIGN(w, 16) >> 3;
int pitch = planepitch * bpp;
int planepitch_byte = (w + 7) / 8;
unsigned entries, ofssrc;
GetByteContext gb, ptrs;
PutByteContext pb;
int k;
if (buf_end - buf <= 4 * bpp)
return;
bytestream2_init_writer(&pb, dst, dst_size);
bytestream2_init(&ptrs, buf, bpp * 4);
for (k = 0; k < bpp; k++) {
ofssrc = bytestream2_get_be32(&ptrs);
if (!ofssrc)
continue;
if (ofssrc >= buf_end - buf)
continue;
bytestream2_init(&gb, buf + ofssrc, buf_end - (buf + ofssrc));
entries = bytestream2_get_be32(&gb);
while (entries) {
int32_t opcode = bytestream2_get_be32(&gb);
unsigned offset = bytestream2_get_be32(&gb);
bytestream2_seek_p(&pb, (offset / planepitch_byte) * pitch + (offset % planepitch_byte) + k * planepitch, SEEK_SET);
if (opcode >= 0) {
uint32_t x = bytestream2_get_be32(&gb);
while (opcode && bytestream2_get_bytes_left_p(&pb) > 0) {
bytestream2_put_be32(&pb, x);
bytestream2_skip_p(&pb, pitch - 4);
opcode--;
}
} else {
opcode = -opcode;
while (opcode && bytestream2_get_bytes_left(&gb) > 0) {
bytestream2_put_be32(&pb, bytestream2_get_be32(&gb));
bytestream2_skip_p(&pb, pitch - 4);
opcode--;
}
}
entries--;
}
}
}
| 1threat |
static void aarch64_cpu_register(const ARMCPUInfo *info)
{
TypeInfo type_info = {
.parent = TYPE_AARCH64_CPU,
.instance_size = sizeof(ARMCPU),
.instance_init = info->initfn,
.class_size = sizeof(ARMCPUClass),
.class_init = info->class_init,
};
if (!info->name) {
return;
}
type_info.name = g_strdup_printf("%s-" TYPE_ARM_CPU, info->name);
type_register(&type_info);
g_free((void *)type_info.name);
}
| 1threat |
Page with multiple chart.js charts to pdf : <p>I have used chart.js to generate a report page that has multiple charts. I need to export this report to PDF. There are many solutions available via search, but I cannot find one which has multiple canvas elements. </p>
<p>The only available solution seems to be to loop through all the images, and recreate the report using the images, and then download that as a pdf.</p>
<p>Is there any simpler/more efficient way to accomplish this?</p>
<pre><code><body>
<h1> Chart 1 </h1>
<div style="width:800px; height:400px;">
<canvas id="chart_1" width="50" height="50"></canvas>
</div>
<h1> Chart 2 </h1>
<div style="width:800px; height:400px;">
<canvas id="chart_2" width="50" height="50"></canvas>
</div>
<h1> Chart 3 </h1>
<div style="width:800px; height:400px;">
<canvas id="chart_3" width="50" height="50"></canvas>
</div>
</body>
</code></pre>
| 0debug |
av_cold int ff_vp8_decode_init(AVCodecContext *avctx)
{
VP8Context *s = avctx->priv_data;
int ret;
s->avctx = avctx;
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
avctx->internal->allocate_progress = 1;
ff_videodsp_init(&s->vdsp, 8);
ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1);
ff_vp8dsp_init(&s->vp8dsp);
if ((ret = vp8_init_frames(s)) < 0) {
ff_vp8_decode_free(avctx);
return ret;
}
return 0;
}
| 1threat |
Comparaison between two varchar : i need your help to find a solution that do so :
char1 : "1,2,3" .
char2 : "1,2,3,4,5"
and return as result
char3 : "4,5"
Thanks. | 0debug |
How can I create an option element using javascript and set it's value : <pre><code>const currencies = [
{
id: 'USD', name: 'US Dollars'
}, {
id: 'UGX', name: 'Ugandan Shillings'
}, {
id: 'KES', name: 'Kenyan Shillings'
}, {
id: 'GHS', name: 'Ghanian Cedi'
}, {
id: 'ZAR', name: 'South African Rand'
}
];
</code></pre>
<p>I have an issue with my code. I want to create an option element using javascript. I have done something like this below. What is my issue?</p>
<p>I want each item in the currencies arrays to populate into populateCurrencies function. And it should also create an option element. And also set it's value to the item id.</p>
<pre><code>const populateCurrencies = () => {
var ans = document.getElementById('USD').value;
}
</code></pre>
| 0debug |
static void qvirtio_9p_pci_free(QVirtIO9P *v9p)
{
qvirtqueue_cleanup(v9p->dev->bus, v9p->vq, v9p->alloc);
pc_alloc_uninit(v9p->alloc);
qvirtio_pci_device_disable(container_of(v9p->dev, QVirtioPCIDevice, vdev));
g_free(v9p->dev);
qpci_free_pc(v9p->bus);
g_free(v9p);
}
| 1threat |
What size screenshots should be used for IAPs ( In app purchases ) for Mac apps? : <p>What dimensions should be used for IAP screenshots for Mac apps on iTunesconnect?</p>
<p>I have tried uploading PNG screenshots with:</p>
<pre><code>2560 x 1600 px
640 x 920 px
</code></pre>
<p>to no avail... but the upload does not seem to be accepted... Can anyone advise which dimensions will be accepted? Apple specifies 640 x 920 but it does not upload and there is no error message.</p>
<p><a href="https://i.stack.imgur.com/7mZrQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7mZrQ.png" alt="enter image description here"></a></p>
| 0debug |
putInt java equivalent method in swift : I am looking for a java method putInt equivalent in swift and for java method System.arraycopy
I have tried with data in swift but got wrong result
ByteBuffer Len = ByteBuffer.allocate(4);
Len.putInt(mLen); // 0x00112233 order
mBlock[mLen1] = Len.get(0);
mLen is an integer
what would be equivalent in swift and for another method
System.arraycopy(bData, 0, mBlock, 0, mLen);
its giving array out of bounds error | 0debug |
Do all clustering methods are iteratives? : <p>I'm wondering if all clustering methodes are iteratives or not. Iteration permits to optimize the algorithms and adapt them to big data technologies.</p>
| 0debug |
Getting NA in Standard deviation in Rstudio : when i write mean it worked
> mean(b1temp[1, ])
but for standard deviation, it returns NA
>sd(b1temp[1, ])
>NA
SO, I modified the function but still returns NA
>sd(b1temp[1, ], na.rm=FALSE)
>NA
my dataset contains only a row. Is this an issue?
| 0debug |
E0001:invalid syntax (<string>, line 6) : <p>I am writing a discord bot using discord.py
however, I keep getting this error message:
E0001:invalid syntax (, line 6)</p>
<p>my code is</p>
<pre><code>import time
import discord
from discord.ext import commands
import asyncio
message = discord.Message type
client = commands.Bot(command_prefix='G')
channel = message.channel
print ("Discord version: " + discord.__version__)
</code></pre>
| 0debug |
New keyword used with Interfaces : <p>Although I've looked through several of the answers regarding this question, I'm still not sure if I know what this line of code is doing:</p>
<pre><code>public class SomeClass<P> : SomeInterface where P : AnotherInterface, new(){...}
</code></pre>
<p>What is <code>new()</code> doing?</p>
| 0debug |
Spark withColumn sequential integer based on date : <p>I've got a data set that has companies with a daily production rate of a product. I want to add a column to that dataframe which will sequentially number based on that company by date.</p>
<p>Ex.<br/>
Acme Product1 1/1/2000 5<br/>
Acme Product1 1/2/2000 7<br/>
Acme Product2 3/1/2000 9<br/>
Acme Product2 3/2/2000 4<br/>
Company2 ProductX 4/1/2015 6<br/>
Company2 ProductX 4/2/2015 3<br/></p>
<p>I want to add a new column like:<br/>
Acme Product1 1/1/2000 5 <b>1</b><br/>
Acme Product1 1/2/2000 7 <b>2</b><br/>
Acme Product2 3/1/2000 9 <b>1</b><br/>
Acme Product2 3/2/2000 4 <b>2</b><br/>
Company2 ProductX 4/1/2015 6 <b>1</b><br/>
Company2 ProductX 4/2/2015 3 <b>2</b><br/>
Company2 ProductX 4/2/2015 2 <b>3</b><br/></p>
<p>This is all so that I can compare companies and their products based on the new column. So all of their day one production for a product regardless of date.</p>
| 0debug |
PHP online store, looping buttons & databases : <p>So I am writing this code and I want to make it by getting the data of the database using a loop. The problem that I got is that I can't seem to find a way to push through a value to the database from the buttons that I got. I am open to ideas. Thanks !</p>
<pre><code><!Doctype HTML>
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css"/>
<title>Online Catalog</title>
</head>
<body>
<form action="" method="get">
<?php
session_start();
require('database.php');
echo "<h1><a href=". 'index.php' .">Catalog</a></h1>
<b id=".cart."><a href=". 'cart.php' .">Show cart</a></b>";
if ($result = $connection->query("SELECT * FROM `store`")) {
$row_cnt = $result->num_rows;
while ($row = $result->fetch_assoc()) {
echo "<p>
<table>
<th>
<img src=".$row[img_path].'/'.$row[img_name].">
</th>
<td>
<h2>". $row[name] ."</h2><br>
". $row[description] ."<br><br>
Price : ". $row[price] ."$<br>
</td>
<td >
<input type='submit' name='add".$row[id]."' value='Add to cart'/>
</td>
</table>
</p>
";
if(isset($_GET['add.$row[id].'])){
$cart=1;
if(mysqli_query($connection, "INSERT INTO `store-project`.`store` (`incart`) VALUES ('$cart')")){
mysqli_close($connection);
header("Location: cart.php");
}
}
}
$result->close();
}
?>
</form>
</body>
</html>
</code></pre>
<p><a href="http://i.stack.imgur.com/9HJdg.png" rel="nofollow">Here is the database</a></p>
<p><a href="http://i.stack.imgur.com/cr58y.png" rel="nofollow">And here is how it generally looks</a></p>
| 0debug |
WA Printing hex numbers : I want to write a program which prints hex number when an integer between 0 and 100 is given as an input. What is wrong with my code?
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n, p, q;
n = input.nextInt();
p = n / 16;
q = n % 16;
if (q == 10)
System.out.println(p + "" + "a");
else if (q == 11)
System.out.println(p + "" + "b");
else if (q == 12)
System.out.println(p + "" + "c");
else if (q == 13)
System.out.println(p + "" + "d");
else if (q == 14)
System.out.println(p + "" + "e");
else if (q == 15)
System.out.println(p + "" + "f");
else if (p == 0)
System.out.println(q);
else
System.out.println(p + "" + q);
}
}
| 0debug |
Simple App crashes when started, Android programming fault : A simple android program to Enter a text (in Edit text) and copy to clipboard (after hitting copy button)...
It crashes when opened, what am i missing?
package com.quickclip.panky.quickclip;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public abstract class MainActivity extends AppCompatActivity implements View.OnClickListener {
EditText e1;
Button b1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
e1 = (EditText) findViewById(R.id.editText);
b1 = (Button) findViewById(R.id.button);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
copytext(view);
}
});
}
public void copytext(View view) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("Copied Text", (CharSequence) e1);
clipboard.setPrimaryClip(clip);
}
}
I also tried using below with no success :
ClipData clip = ClipData.newPlainText("Copied Text", String.valueOf(e1)); | 0debug |
i have an binary word image with grid and i want to find the foreground pixels (number of black and white in each segments) in each segments : Help me to find foreground pixels in every segments in a image | 0debug |
Oracle Function -- I am passing a Date in an Oracle Function . Before I use that date in Sql queries under Begin block i want to change the date : In A Function I want to Pass A Date ... beDate is what i am passing .
Now I want to Update beDate as last day of beDate month if beDate is Last_business_day otherwise last_day of previous month .
Can Someone Please provide the syntactitally correct answer for the IF Part in the below code .
CREATE OR REPLACE Function AnyFunction ( beDate IN varchar2 )
RETURN date
IS
IF beDate = [ Last_Business_Day ] then beDate = last_day(beDate) ;
ELSIF beDate > [ Last_Business_Day ] then beDate = last_day(beDate) ;
ELSE
beDate = last_day(add_months(last_day(beDate),-1) ) ;
END IF ;
BEGIN
END; | 0debug |
static void nvdimm_build_nfit(AcpiNVDIMMState *state, GArray *table_offsets,
GArray *table_data, BIOSLinker *linker)
{
NvdimmFitBuffer *fit_buf = &state->fit_buf;
unsigned int header;
if (!fit_buf->fit->len) {
return;
}
acpi_add_table(table_offsets, table_data);
header = table_data->len;
acpi_data_push(table_data, sizeof(NvdimmNfitHeader));
g_array_append_vals(table_data, fit_buf->fit->data, fit_buf->fit->len);
build_header(linker, table_data,
(void *)(table_data->data + header), "NFIT",
sizeof(NvdimmNfitHeader) + fit_buf->fit->len, 1, NULL, NULL);
}
| 1threat |
in android studio i want make Timepickerdialoge but i found this error : [enter image description here][1]
i try to use timepickerDialoge but the application is crash
this is screenshot showing the error message in android monitor | 0debug |
static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height)
{
const uint8_t *frame_start = frame;
const uint8_t *frame_end = frame + width * height;
int mask = 0x10000, bitbuf = 0;
int i, v, offset, count, segments;
segments = bytestream2_get_le16(gb);
while (segments--) {
if (bytestream2_get_bytes_left(gb) < 2)
return -1;
if (mask == 0x10000) {
bitbuf = bytestream2_get_le16u(gb);
mask = 1;
}
if (frame_end - frame < 2)
return -1;
if (bitbuf & mask) {
v = bytestream2_get_le16(gb);
offset = (v & 0x1FFF) << 2;
count = ((v >> 13) + 2) << 1;
if (frame - frame_start < offset || frame_end - frame < count*2 + width)
return -1;
for (i = 0; i < count; i++) {
frame[0] = frame[1] =
frame[width] = frame[width + 1] = frame[-offset];
frame += 2;
}
} else if (bitbuf & (mask << 1)) {
frame += bytestream2_get_le16(gb) * 2;
} else {
frame[0] = frame[1] =
frame[width] = frame[width + 1] = bytestream2_get_byte(gb);
frame += 2;
frame[0] = frame[1] =
frame[width] = frame[width + 1] = bytestream2_get_byte(gb);
frame += 2;
}
mask <<= 2;
}
return 0;
}
| 1threat |
How do I check to see if an element is in an array of an object (with external files in place) : Javascript... I can't figure out why the following always goes to my else statement, instead of my initial if condition.
EXTERNAL JAVASCRIPT FILE #1
var player = {
inventory: [
"Bullet"
],
};
HTML FILE
<button id="use_bullet" onclick="use.call('Bullet')">Use Bullet</button>
EXTERNAL JAVASCRIPT FILE #2
function use() {
alert(this); // Returns "Bullet"
alert(player.inventory); // Returns "Bullet"
if (this == player.inventory) {
document.getElementById("inventory02").innerHTML = "You USED" + this;
alert("in inventory"); // She skips this
} else {
document.getElementById("inventory02").innerHTML = "You don't have" + this;
alert("not in inventory"); // She always does this
}
} | 0debug |
When using tweepy cursor, what is the best practice for catching over capacity errors? : <p>I'm gathering information on a large number of users using Python's Tweepy library. I've the API initialized as follows </p>
<blockquote>
<p>api = tweepy.API(auth,wait_on_rate_limit=True,
wait_on_rate_limit_notify=True)</p>
</blockquote>
<p>where auth contains my tokens. This code responds well to rate limit errors, but doesn't work for some other errors. For example, I sometimes see the following exception. </p>
<blockquote>
<pre><code>tweepy.error.TweepError: [{'message': 'Over capacity', 'code': 130}]
</code></pre>
</blockquote>
<p>I can handle this exception using a try except, but I was wondering if there is a way to handle this exception within the cursor like I'm handling rate limit exceptions. I see parameters like retry_count, but I'm not sure if they will work for this case as they seem designed for HTTP errors. </p>
| 0debug |
my app error runtime : when run app in genymotion. It show dialog "unfortunately has stopped". I don't understant logcat. Can you tell me about what happened?
01-14 11:16:55.561 3229-3229/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.example.mypc.map1-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.mypc.map1-1, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:4882)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4485)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4425)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.example.mypc.map1-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.mypc.map1-1, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.ActivityThread.installProvider(ActivityThread.java:4867)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4485)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4425)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
| 0debug |
Using JSON Web Tokens (JWT) with Azure Functions (WITHOUT using Active Directory) : <p>I am sure someone out there has already done this, but I have yet to find any documentation with regard to the Microsoft implementation of JWT. The official documentation from Microsoft for their JWT library is basically an empty page, see:</p>
<p><a href="https://docs.microsoft.com/en-us/dotnet/framework/security/json-web-token-handler-api-reference" rel="noreferrer">https://docs.microsoft.com/en-us/dotnet/framework/security/json-web-token-handler-api-reference</a></p>
<p>So, here is what I (and I am sure many others) would like to accomplish:</p>
<p><strong>Definition:</strong> User ID = The username or email address used to log into a system.</p>
<p><strong>AUTHENTICATION:</strong></p>
<ol>
<li><p>A user logs in. The user fills in web form and the system sends (via HTTPS POST) the users ID and password (hashed) to the server in order to authenticate / validate the user.</p></li>
<li><p>Server Authenticates user. The users ID and password are checked against the values saved in the database and if NOT valid, an invalid login response is returned to the caller.</p></li>
<li><p>Create a JWT Token - ???? No documentation available!</p></li>
<li><p>Return the JWT token to the caller - ???? - I assume in a header? via JSON, not sure -- again - no documentation.</p></li>
</ol>
<p>Given the code below, can anyone provide a code example for steps 3 and 4?</p>
<pre><code> [FunctionName( "authenticate" )]
public static async Task<HttpResponseMessage> Run( [HttpTrigger( AuthorizationLevel.Anonymous, "get", "post", Route = null )]HttpRequestMessage req, TraceWriter log )
{
// Step 1 - Get user ID and password from POST data
/*
* Step 2 - Verify user ID and password (compare against DB values)
* If user ID or password is not valid, return Invalid User response
*/
// Step 3 - Create JWT token - ????
// Step 4 - Return JWT token - ????
}
</code></pre>
<p><strong>AUTHORIZATION</strong>:</p>
<p>Assuming the user was authenticated and now has a JWT token (I am assuming the JWT token is saved in the users session; if someone wants to provide more info, please do):</p>
<ol>
<li><p>A POST request is made to an Azure Function to do something (like get a users birth date). The JWT token obtained above is loaded (from the POST data or a header - does it matter?) along with any other data required by the function.</p></li>
<li><p>The JWT token is validated - ???? No documentation available!</p></li>
<li><p>If the JWT token is NOT valid, a BadRequest response is returned by the function.</p></li>
<li><p>If the JWT token is valid, the function uses the data passed to it to process and issue a response.</p></li>
</ol>
<p>Given the code below, can anyone provide a code example for steps 1 and 2?</p>
<pre><code> [FunctionName( "do_something" )]
public static async Task<HttpResponseMessage> Run( [HttpTrigger( AuthorizationLevel.Anonymous, "get", "post", Route = null )]HttpRequestMessage req, TraceWriter log )
{
// Step 1 - Get JWT token (from POST data or headers?)
// Step 2 - Validate the JWT token - ???
// Step 3 - If JWT token is not valid, return BadRequest response
// Step 4 - Process the request and return data as JSON
}
</code></pre>
<p>Any and all information would really help those of us (me) understand how to use JWT with Azure (anonymous) functions in order to build a "secure" REST API.</p>
<p>Thanks in advance.</p>
| 0debug |
Why does my code result in a compile error? : <p>The code in question is as follows:</p>
<pre><code>importjava.util.ArrayList;
importjava.util.Collections;
importjava.util.List;
public class Test{
public static void main(String[] args) {
List<Human> humans= newArrayList<Human>();
humans.add(newHuman(13));
humans.add(newHuman(33));
humans.add(newHuman(21));
humans.add(newHuman(21));
Collections.sort(humans);
System.out.print(humans.get(0).age);
System.out.print(humans.size());
}
}
class Human implements Comparable<Human> {
int age;
public Human(int age) {
this.age = age;
}
public int compareTo(Human h) {
return h.age.compareTo(this.age);
}
}
</code></pre>
<p>I was wondering why this code causes a compilation error? I'm not sure where I'm going wrong. </p>
<p>Some extra details: </p>
| 0debug |
H264_CHROMA_MC(put_ , op_put)
H264_CHROMA_MC(avg_ , op_avg)
#undef op_avg
#undef op_put
#define H264_LOWPASS(OPNAME, OP, OP2) \
static av_unused void FUNC(OPNAME ## h264_qpel2_h_lowpass)(uint8_t *p_dst, uint8_t *p_src, int dstStride, int srcStride){\
const int h=2;\
INIT_CLIP\
int i;\
pixel *dst = (pixel*)p_dst;\
pixel *src = (pixel*)p_src;\
dstStride >>= sizeof(pixel)-1;\
srcStride >>= sizeof(pixel)-1;\
for(i=0; i<h; i++)\
{\
OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]));\
OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]));\
dst+=dstStride;\
src+=srcStride;\
}\
}\
\
static av_unused void FUNC(OPNAME ## h264_qpel2_v_lowpass)(uint8_t *p_dst, uint8_t *p_src, int dstStride, int srcStride){\
const int w=2;\
INIT_CLIP\
int i;\
pixel *dst = (pixel*)p_dst;\
pixel *src = (pixel*)p_src;\
dstStride >>= sizeof(pixel)-1;\
srcStride >>= sizeof(pixel)-1;\
for(i=0; i<w; i++)\
{\
const int srcB= src[-2*srcStride];\
const int srcA= src[-1*srcStride];\
const int src0= src[0 *srcStride];\
const int src1= src[1 *srcStride];\
const int src2= src[2 *srcStride];\
const int src3= src[3 *srcStride];\
const int src4= src[4 *srcStride];\
OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
dst++;\
src++;\
}\
}\
\
static av_unused void FUNC(OPNAME ## h264_qpel2_hv_lowpass)(uint8_t *p_dst, pixeltmp *tmp, uint8_t *p_src, int dstStride, int tmpStride, int srcStride){\
const int h=2;\
const int w=2;\
const int pad = (BIT_DEPTH > 9) ? (-10 * ((1<<BIT_DEPTH)-1)) : 0;\
INIT_CLIP\
int i;\
pixel *dst = (pixel*)p_dst;\
pixel *src = (pixel*)p_src;\
dstStride >>= sizeof(pixel)-1;\
srcStride >>= sizeof(pixel)-1;\
src -= 2*srcStride;\
for(i=0; i<h+5; i++)\
{\
tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]) + pad;\
tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]) + pad;\
tmp+=tmpStride;\
src+=srcStride;\
}\
tmp -= tmpStride*(h+5-2);\
for(i=0; i<w; i++)\
{\
const int tmpB= tmp[-2*tmpStride] - pad;\
const int tmpA= tmp[-1*tmpStride] - pad;\
const int tmp0= tmp[0 *tmpStride] - pad;\
const int tmp1= tmp[1 *tmpStride] - pad;\
const int tmp2= tmp[2 *tmpStride] - pad;\
const int tmp3= tmp[3 *tmpStride] - pad;\
const int tmp4= tmp[4 *tmpStride] - pad;\
OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\
OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\
dst++;\
tmp++;\
}\
}\
static void FUNC(OPNAME ## h264_qpel4_h_lowpass)(uint8_t *p_dst, uint8_t *p_src, int dstStride, int srcStride){\
const int h=4;\
INIT_CLIP\
int i;\
pixel *dst = (pixel*)p_dst;\
pixel *src = (pixel*)p_src;\
dstStride >>= sizeof(pixel)-1;\
srcStride >>= sizeof(pixel)-1;\
for(i=0; i<h; i++)\
{\
OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]));\
OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]));\
OP(dst[2], (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5]));\
OP(dst[3], (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6]));\
dst+=dstStride;\
src+=srcStride;\
}\
}\
\
static void FUNC(OPNAME ## h264_qpel4_v_lowpass)(uint8_t *p_dst, uint8_t *p_src, int dstStride, int srcStride){\
const int w=4;\
INIT_CLIP\
int i;\
pixel *dst = (pixel*)p_dst;\
pixel *src = (pixel*)p_src;\
dstStride >>= sizeof(pixel)-1;\
srcStride >>= sizeof(pixel)-1;\
for(i=0; i<w; i++)\
{\
const int srcB= src[-2*srcStride];\
const int srcA= src[-1*srcStride];\
const int src0= src[0 *srcStride];\
const int src1= src[1 *srcStride];\
const int src2= src[2 *srcStride];\
const int src3= src[3 *srcStride];\
const int src4= src[4 *srcStride];\
const int src5= src[5 *srcStride];\
const int src6= src[6 *srcStride];\
OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
OP(dst[2*dstStride], (src2+src3)*20 - (src1+src4)*5 + (src0+src5));\
OP(dst[3*dstStride], (src3+src4)*20 - (src2+src5)*5 + (src1+src6));\
dst++;\
src++;\
}\
}\
\
static void FUNC(OPNAME ## h264_qpel4_hv_lowpass)(uint8_t *p_dst, pixeltmp *tmp, uint8_t *p_src, int dstStride, int tmpStride, int srcStride){\
const int h=4;\
const int w=4;\
const int pad = (BIT_DEPTH > 9) ? (-10 * ((1<<BIT_DEPTH)-1)) : 0;\
INIT_CLIP\
int i;\
pixel *dst = (pixel*)p_dst;\
pixel *src = (pixel*)p_src;\
dstStride >>= sizeof(pixel)-1;\
srcStride >>= sizeof(pixel)-1;\
src -= 2*srcStride;\
for(i=0; i<h+5; i++)\
{\
tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]) + pad;\
tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]) + pad;\
tmp[2]= (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5]) + pad;\
tmp[3]= (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6]) + pad;\
tmp+=tmpStride;\
src+=srcStride;\
}\
tmp -= tmpStride*(h+5-2);\
for(i=0; i<w; i++)\
{\
const int tmpB= tmp[-2*tmpStride] - pad;\
const int tmpA= tmp[-1*tmpStride] - pad;\
const int tmp0= tmp[0 *tmpStride] - pad;\
const int tmp1= tmp[1 *tmpStride] - pad;\
const int tmp2= tmp[2 *tmpStride] - pad;\
const int tmp3= tmp[3 *tmpStride] - pad;\
const int tmp4= tmp[4 *tmpStride] - pad;\
const int tmp5= tmp[5 *tmpStride] - pad;\
const int tmp6= tmp[6 *tmpStride] - pad;\
OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\
OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\
OP2(dst[2*dstStride], (tmp2+tmp3)*20 - (tmp1+tmp4)*5 + (tmp0+tmp5));\
OP2(dst[3*dstStride], (tmp3+tmp4)*20 - (tmp2+tmp5)*5 + (tmp1+tmp6));\
dst++;\
tmp++;\
}\
}\
\
static void FUNC(OPNAME ## h264_qpel8_h_lowpass)(uint8_t *p_dst, uint8_t *p_src, int dstStride, int srcStride){\
const int h=8;\
INIT_CLIP\
int i;\
pixel *dst = (pixel*)p_dst;\
pixel *src = (pixel*)p_src;\
dstStride >>= sizeof(pixel)-1;\
srcStride >>= sizeof(pixel)-1;\
for(i=0; i<h; i++)\
{\
OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3 ]));\
OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4 ]));\
OP(dst[2], (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5 ]));\
OP(dst[3], (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6 ]));\
OP(dst[4], (src[4]+src[5])*20 - (src[3 ]+src[6])*5 + (src[2 ]+src[7 ]));\
OP(dst[5], (src[5]+src[6])*20 - (src[4 ]+src[7])*5 + (src[3 ]+src[8 ]));\
OP(dst[6], (src[6]+src[7])*20 - (src[5 ]+src[8])*5 + (src[4 ]+src[9 ]));\
OP(dst[7], (src[7]+src[8])*20 - (src[6 ]+src[9])*5 + (src[5 ]+src[10]));\
dst+=dstStride;\
src+=srcStride;\
}\
}\
\
static void FUNC(OPNAME ## h264_qpel8_v_lowpass)(uint8_t *p_dst, uint8_t *p_src, int dstStride, int srcStride){\
const int w=8;\
INIT_CLIP\
int i;\
pixel *dst = (pixel*)p_dst;\
pixel *src = (pixel*)p_src;\
dstStride >>= sizeof(pixel)-1;\
srcStride >>= sizeof(pixel)-1;\
for(i=0; i<w; i++)\
{\
const int srcB= src[-2*srcStride];\
const int srcA= src[-1*srcStride];\
const int src0= src[0 *srcStride];\
const int src1= src[1 *srcStride];\
const int src2= src[2 *srcStride];\
const int src3= src[3 *srcStride];\
const int src4= src[4 *srcStride];\
const int src5= src[5 *srcStride];\
const int src6= src[6 *srcStride];\
const int src7= src[7 *srcStride];\
const int src8= src[8 *srcStride];\
const int src9= src[9 *srcStride];\
const int src10=src[10*srcStride];\
OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
OP(dst[2*dstStride], (src2+src3)*20 - (src1+src4)*5 + (src0+src5));\
OP(dst[3*dstStride], (src3+src4)*20 - (src2+src5)*5 + (src1+src6));\
OP(dst[4*dstStride], (src4+src5)*20 - (src3+src6)*5 + (src2+src7));\
OP(dst[5*dstStride], (src5+src6)*20 - (src4+src7)*5 + (src3+src8));\
OP(dst[6*dstStride], (src6+src7)*20 - (src5+src8)*5 + (src4+src9));\
OP(dst[7*dstStride], (src7+src8)*20 - (src6+src9)*5 + (src5+src10));\
dst++;\
src++;\
}\
}\
\
static void FUNC(OPNAME ## h264_qpel8_hv_lowpass)(uint8_t *p_dst, pixeltmp *tmp, uint8_t *p_src, int dstStride, int tmpStride, int srcStride){\
const int h=8;\
const int w=8;\
const int pad = (BIT_DEPTH > 9) ? (-10 * ((1<<BIT_DEPTH)-1)) : 0;\
INIT_CLIP\
int i;\
pixel *dst = (pixel*)p_dst;\
pixel *src = (pixel*)p_src;\
dstStride >>= sizeof(pixel)-1;\
srcStride >>= sizeof(pixel)-1;\
src -= 2*srcStride;\
for(i=0; i<h+5; i++)\
{\
tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3 ]) + pad;\
tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4 ]) + pad;\
tmp[2]= (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5 ]) + pad;\
tmp[3]= (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6 ]) + pad;\
tmp[4]= (src[4]+src[5])*20 - (src[3 ]+src[6])*5 + (src[2 ]+src[7 ]) + pad;\
tmp[5]= (src[5]+src[6])*20 - (src[4 ]+src[7])*5 + (src[3 ]+src[8 ]) + pad;\
tmp[6]= (src[6]+src[7])*20 - (src[5 ]+src[8])*5 + (src[4 ]+src[9 ]) + pad;\
tmp[7]= (src[7]+src[8])*20 - (src[6 ]+src[9])*5 + (src[5 ]+src[10]) + pad;\
tmp+=tmpStride;\
src+=srcStride;\
}\
tmp -= tmpStride*(h+5-2);\
for(i=0; i<w; i++)\
{\
const int tmpB= tmp[-2*tmpStride] - pad;\
const int tmpA= tmp[-1*tmpStride] - pad;\
const int tmp0= tmp[0 *tmpStride] - pad;\
const int tmp1= tmp[1 *tmpStride] - pad;\
const int tmp2= tmp[2 *tmpStride] - pad;\
const int tmp3= tmp[3 *tmpStride] - pad;\
const int tmp4= tmp[4 *tmpStride] - pad;\
const int tmp5= tmp[5 *tmpStride] - pad;\
const int tmp6= tmp[6 *tmpStride] - pad;\
const int tmp7= tmp[7 *tmpStride] - pad;\
const int tmp8= tmp[8 *tmpStride] - pad;\
const int tmp9= tmp[9 *tmpStride] - pad;\
const int tmp10=tmp[10*tmpStride] - pad;\
OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\
OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\
OP2(dst[2*dstStride], (tmp2+tmp3)*20 - (tmp1+tmp4)*5 + (tmp0+tmp5));\
OP2(dst[3*dstStride], (tmp3+tmp4)*20 - (tmp2+tmp5)*5 + (tmp1+tmp6));\
OP2(dst[4*dstStride], (tmp4+tmp5)*20 - (tmp3+tmp6)*5 + (tmp2+tmp7));\
OP2(dst[5*dstStride], (tmp5+tmp6)*20 - (tmp4+tmp7)*5 + (tmp3+tmp8));\
OP2(dst[6*dstStride], (tmp6+tmp7)*20 - (tmp5+tmp8)*5 + (tmp4+tmp9));\
OP2(dst[7*dstStride], (tmp7+tmp8)*20 - (tmp6+tmp9)*5 + (tmp5+tmp10));\
dst++;\
tmp++;\
}\
}\
\
static void FUNC(OPNAME ## h264_qpel16_v_lowpass)(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
FUNC(OPNAME ## h264_qpel8_v_lowpass)(dst , src , dstStride, srcStride);\
FUNC(OPNAME ## h264_qpel8_v_lowpass)(dst+8*sizeof(pixel), src+8*sizeof(pixel), dstStride, srcStride);\
src += 8*srcStride;\
dst += 8*dstStride;\
FUNC(OPNAME ## h264_qpel8_v_lowpass)(dst , src , dstStride, srcStride);\
FUNC(OPNAME ## h264_qpel8_v_lowpass)(dst+8*sizeof(pixel), src+8*sizeof(pixel), dstStride, srcStride);\
}\
\
static void FUNC(OPNAME ## h264_qpel16_h_lowpass)(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
FUNC(OPNAME ## h264_qpel8_h_lowpass)(dst , src , dstStride, srcStride);\
FUNC(OPNAME ## h264_qpel8_h_lowpass)(dst+8*sizeof(pixel), src+8*sizeof(pixel), dstStride, srcStride);\
src += 8*srcStride;\
dst += 8*dstStride;\
FUNC(OPNAME ## h264_qpel8_h_lowpass)(dst , src , dstStride, srcStride);\
FUNC(OPNAME ## h264_qpel8_h_lowpass)(dst+8*sizeof(pixel), src+8*sizeof(pixel), dstStride, srcStride);\
}\
\
static void FUNC(OPNAME ## h264_qpel16_hv_lowpass)(uint8_t *dst, pixeltmp *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
FUNC(OPNAME ## h264_qpel8_hv_lowpass)(dst , tmp , src , dstStride, tmpStride, srcStride);\
FUNC(OPNAME ## h264_qpel8_hv_lowpass)(dst+8*sizeof(pixel), tmp+8, src+8*sizeof(pixel), dstStride, tmpStride, srcStride);\
src += 8*srcStride;\
dst += 8*dstStride;\
FUNC(OPNAME ## h264_qpel8_hv_lowpass)(dst , tmp , src , dstStride, tmpStride, srcStride);\
FUNC(OPNAME ## h264_qpel8_hv_lowpass)(dst+8*sizeof(pixel), tmp+8, src+8*sizeof(pixel), dstStride, tmpStride, srcStride);\
}\
#define H264_MC(OPNAME, SIZE) \
static av_unused void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc00)(uint8_t *dst, uint8_t *src, int stride){\
FUNCC(OPNAME ## pixels ## SIZE)(dst, src, stride, SIZE);\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc10)(uint8_t *dst, uint8_t *src, int stride){\
uint8_t half[SIZE*SIZE*sizeof(pixel)];\
FUNC(put_h264_qpel ## SIZE ## _h_lowpass)(half, src, SIZE*sizeof(pixel), stride);\
FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, src, half, stride, stride, SIZE*sizeof(pixel), SIZE);\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc20)(uint8_t *dst, uint8_t *src, int stride){\
FUNC(OPNAME ## h264_qpel ## SIZE ## _h_lowpass)(dst, src, stride, stride);\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc30)(uint8_t *dst, uint8_t *src, int stride){\
uint8_t half[SIZE*SIZE*sizeof(pixel)];\
FUNC(put_h264_qpel ## SIZE ## _h_lowpass)(half, src, SIZE*sizeof(pixel), stride);\
FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, src+sizeof(pixel), half, stride, stride, SIZE*sizeof(pixel), SIZE);\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc01)(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
uint8_t half[SIZE*SIZE*sizeof(pixel)];\
FUNC(copy_block ## SIZE )(full, src - stride*2, SIZE*sizeof(pixel), stride, SIZE + 5);\
FUNC(put_h264_qpel ## SIZE ## _v_lowpass)(half, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, full_mid, half, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc02)(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
FUNC(copy_block ## SIZE )(full, src - stride*2, SIZE*sizeof(pixel), stride, SIZE + 5);\
FUNC(OPNAME ## h264_qpel ## SIZE ## _v_lowpass)(dst, full_mid, stride, SIZE*sizeof(pixel));\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc03)(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
uint8_t half[SIZE*SIZE*sizeof(pixel)];\
FUNC(copy_block ## SIZE )(full, src - stride*2, SIZE*sizeof(pixel), stride, SIZE + 5);\
FUNC(put_h264_qpel ## SIZE ## _v_lowpass)(half, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, full_mid+SIZE*sizeof(pixel), half, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc11)(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
uint8_t halfH[SIZE*SIZE*sizeof(pixel)];\
uint8_t halfV[SIZE*SIZE*sizeof(pixel)];\
FUNC(put_h264_qpel ## SIZE ## _h_lowpass)(halfH, src, SIZE*sizeof(pixel), stride);\
FUNC(copy_block ## SIZE )(full, src - stride*2, SIZE*sizeof(pixel), stride, SIZE + 5);\
FUNC(put_h264_qpel ## SIZE ## _v_lowpass)(halfV, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfH, halfV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc31)(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
uint8_t halfH[SIZE*SIZE*sizeof(pixel)];\
uint8_t halfV[SIZE*SIZE*sizeof(pixel)];\
FUNC(put_h264_qpel ## SIZE ## _h_lowpass)(halfH, src, SIZE*sizeof(pixel), stride);\
FUNC(copy_block ## SIZE )(full, src - stride*2 + sizeof(pixel), SIZE*sizeof(pixel), stride, SIZE + 5);\
FUNC(put_h264_qpel ## SIZE ## _v_lowpass)(halfV, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfH, halfV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc13)(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
uint8_t halfH[SIZE*SIZE*sizeof(pixel)];\
uint8_t halfV[SIZE*SIZE*sizeof(pixel)];\
FUNC(put_h264_qpel ## SIZE ## _h_lowpass)(halfH, src + stride, SIZE*sizeof(pixel), stride);\
FUNC(copy_block ## SIZE )(full, src - stride*2, SIZE*sizeof(pixel), stride, SIZE + 5);\
FUNC(put_h264_qpel ## SIZE ## _v_lowpass)(halfV, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfH, halfV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc33)(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
uint8_t halfH[SIZE*SIZE*sizeof(pixel)];\
uint8_t halfV[SIZE*SIZE*sizeof(pixel)];\
FUNC(put_h264_qpel ## SIZE ## _h_lowpass)(halfH, src + stride, SIZE*sizeof(pixel), stride);\
FUNC(copy_block ## SIZE )(full, src - stride*2 + sizeof(pixel), SIZE*sizeof(pixel), stride, SIZE + 5);\
FUNC(put_h264_qpel ## SIZE ## _v_lowpass)(halfV, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfH, halfV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc22)(uint8_t *dst, uint8_t *src, int stride){\
pixeltmp tmp[SIZE*(SIZE+5)*sizeof(pixel)];\
FUNC(OPNAME ## h264_qpel ## SIZE ## _hv_lowpass)(dst, tmp, src, stride, SIZE*sizeof(pixel), stride);\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc21)(uint8_t *dst, uint8_t *src, int stride){\
pixeltmp tmp[SIZE*(SIZE+5)*sizeof(pixel)];\
uint8_t halfH[SIZE*SIZE*sizeof(pixel)];\
uint8_t halfHV[SIZE*SIZE*sizeof(pixel)];\
FUNC(put_h264_qpel ## SIZE ## _h_lowpass)(halfH, src, SIZE*sizeof(pixel), stride);\
FUNC(put_h264_qpel ## SIZE ## _hv_lowpass)(halfHV, tmp, src, SIZE*sizeof(pixel), SIZE*sizeof(pixel), stride);\
FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfH, halfHV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc23)(uint8_t *dst, uint8_t *src, int stride){\
pixeltmp tmp[SIZE*(SIZE+5)*sizeof(pixel)];\
uint8_t halfH[SIZE*SIZE*sizeof(pixel)];\
uint8_t halfHV[SIZE*SIZE*sizeof(pixel)];\
FUNC(put_h264_qpel ## SIZE ## _h_lowpass)(halfH, src + stride, SIZE*sizeof(pixel), stride);\
FUNC(put_h264_qpel ## SIZE ## _hv_lowpass)(halfHV, tmp, src, SIZE*sizeof(pixel), SIZE*sizeof(pixel), stride);\
FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfH, halfHV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc12)(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
pixeltmp tmp[SIZE*(SIZE+5)*sizeof(pixel)];\
uint8_t halfV[SIZE*SIZE*sizeof(pixel)];\
uint8_t halfHV[SIZE*SIZE*sizeof(pixel)];\
FUNC(copy_block ## SIZE )(full, src - stride*2, SIZE*sizeof(pixel), stride, SIZE + 5);\
FUNC(put_h264_qpel ## SIZE ## _v_lowpass)(halfV, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
FUNC(put_h264_qpel ## SIZE ## _hv_lowpass)(halfHV, tmp, src, SIZE*sizeof(pixel), SIZE*sizeof(pixel), stride);\
FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfV, halfHV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
}\
\
static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc32)(uint8_t *dst, uint8_t *src, int stride){\
uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
pixeltmp tmp[SIZE*(SIZE+5)*sizeof(pixel)];\
uint8_t halfV[SIZE*SIZE*sizeof(pixel)];\
uint8_t halfHV[SIZE*SIZE*sizeof(pixel)];\
FUNC(copy_block ## SIZE )(full, src - stride*2 + sizeof(pixel), SIZE*sizeof(pixel), stride, SIZE + 5);\
FUNC(put_h264_qpel ## SIZE ## _v_lowpass)(halfV, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
FUNC(put_h264_qpel ## SIZE ## _hv_lowpass)(halfHV, tmp, src, SIZE*sizeof(pixel), SIZE*sizeof(pixel), stride);\
FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfV, halfHV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
}\
#define op_avg(a, b) a = (((a)+CLIP(((b) + 16)>>5)+1)>>1)
#define op_put(a, b) a = CLIP(((b) + 16)>>5)
#define op2_avg(a, b) a = (((a)+CLIP(((b) + 512)>>10)+1)>>1)
#define op2_put(a, b) a = CLIP(((b) + 512)>>10)
H264_LOWPASS(put_ , op_put, op2_put)
H264_LOWPASS(avg_ , op_avg, op2_avg)
H264_MC(put_, 2)
H264_MC(put_, 4)
H264_MC(put_, 8)
H264_MC(put_, 16)
H264_MC(avg_, 4)
H264_MC(avg_, 8)
H264_MC(avg_, 16)
#undef op_avg
#undef op_put
#undef op2_avg
#undef op2_put
#if BIT_DEPTH == 8
# define put_h264_qpel8_mc00_8_c ff_put_pixels8x8_8_c
# define avg_h264_qpel8_mc00_8_c ff_avg_pixels8x8_8_c
# define put_h264_qpel16_mc00_8_c ff_put_pixels16x16_8_c
# define avg_h264_qpel16_mc00_8_c ff_avg_pixels16x16_8_c
#elif BIT_DEPTH == 9
# define put_h264_qpel8_mc00_9_c ff_put_pixels8x8_9_c
# define avg_h264_qpel8_mc00_9_c ff_avg_pixels8x8_9_c
# define put_h264_qpel16_mc00_9_c ff_put_pixels16x16_9_c
# define avg_h264_qpel16_mc00_9_c ff_avg_pixels16x16_9_c
#elif BIT_DEPTH == 10
# define put_h264_qpel8_mc00_10_c ff_put_pixels8x8_10_c
# define avg_h264_qpel8_mc00_10_c ff_avg_pixels8x8_10_c
# define put_h264_qpel16_mc00_10_c ff_put_pixels16x16_10_c
# define avg_h264_qpel16_mc00_10_c ff_avg_pixels16x16_10_c
#elif BIT_DEPTH == 12
# define put_h264_qpel8_mc00_12_c ff_put_pixels8x8_12_c
# define avg_h264_qpel8_mc00_12_c ff_avg_pixels8x8_12_c
# define put_h264_qpel16_mc00_12_c ff_put_pixels16x16_12_c
# define avg_h264_qpel16_mc00_12_c ff_avg_pixels16x16_12_c
#elif BIT_DEPTH == 14
# define put_h264_qpel8_mc00_14_c ff_put_pixels8x8_14_c
# define avg_h264_qpel8_mc00_14_c ff_avg_pixels8x8_14_c
# define put_h264_qpel16_mc00_14_c ff_put_pixels16x16_14_c
# define avg_h264_qpel16_mc00_14_c ff_avg_pixels16x16_14_c
#endif
void FUNCC(ff_put_pixels8x8)(uint8_t *dst, uint8_t *src, int stride) {
FUNCC(put_pixels8)(dst, src, stride, 8);
}
| 1threat |
Aurelia. How to connect the js file and print a simple function alert? : <p>Help please. How to connect the <strong>javascript</strong> file and print a simple function <strong>alert</strong>?</p>
| 0debug |
static void cirrus_invalidate_region(CirrusVGAState * s, int off_begin,
int off_pitch, int bytesperline,
int lines)
{
int y;
int off_cur;
int off_cur_end;
if (off_pitch < 0) {
off_begin -= bytesperline - 1;
}
for (y = 0; y < lines; y++) {
off_cur = off_begin;
off_cur_end = (off_cur + bytesperline) & s->cirrus_addr_mask;
assert(off_cur_end >= off_cur);
memory_region_set_dirty(&s->vga.vram, off_cur, off_cur_end - off_cur);
off_begin += off_pitch;
}
}
| 1threat |
static void vscsi_transfer_data(SCSIRequest *sreq, uint32_t len)
{
VSCSIState *s = VIO_SPAPR_VSCSI_DEVICE(sreq->bus->qbus.parent);
vscsi_req *req = sreq->hba_private;
uint8_t *buf;
int rc = 0;
DPRINTF("VSCSI: SCSI xfer complete tag=0x%x len=0x%x, req=%p\n",
sreq->tag, len, req);
if (req == NULL) {
fprintf(stderr, "VSCSI: Can't find request for tag 0x%x\n", sreq->tag);
return;
}
if (len) {
buf = scsi_req_get_buf(sreq);
rc = vscsi_srp_transfer_data(s, req, req->writing, buf, len);
}
if (rc < 0) {
fprintf(stderr, "VSCSI: RDMA error rc=%d!\n", rc);
vscsi_makeup_sense(s, req, HARDWARE_ERROR, 0, 0);
scsi_req_abort(req->sreq, CHECK_CONDITION);
return;
}
req->data_len -= rc;
scsi_req_continue(sreq);
}
| 1threat |
static void spapr_create_nvram(sPAPREnvironment *spapr)
{
DeviceState *dev = qdev_create(&spapr->vio_bus->bus, "spapr-nvram");
DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0);
if (dinfo) {
qdev_prop_set_drive_nofail(dev, "drive",
blk_bs(blk_by_legacy_dinfo(dinfo)));
}
qdev_init_nofail(dev);
spapr->nvram = (struct sPAPRNVRAM *)dev;
}
| 1threat |
document.getElementById('input').innerHTML = user_input; | 1threat |
static void omap_sysctl_write(void *opaque, target_phys_addr_t addr,
uint32_t value)
{
struct omap_sysctl_s *s = (struct omap_sysctl_s *) opaque;
switch (addr) {
case 0x000:
case 0x2a4:
case 0x2c0:
case 0x2f8:
case 0x2fc:
case 0x300:
case 0x304:
case 0x308:
case 0x30c:
case 0x310:
case 0x314:
case 0x318:
case 0x31c:
case 0x320:
case 0x324:
case 0x330:
case 0x334:
case 0x338:
case 0x33c:
case 0x340:
case 0x344:
case 0x348:
case 0x34c:
case 0x350:
case 0x354:
OMAP_RO_REG(addr);
return;
case 0x010:
s->sysconfig = value & 0x1e;
break;
case 0x030 ... 0x140:
s->padconf[(addr - 0x30) >> 2] = value & 0x1f1f1f1f;
break;
case 0x270:
s->obs = value & 0xff;
break;
case 0x274:
s->devconfig = value & 0xffffc7ff;
break;
case 0x28c:
break;
case 0x290:
s->msuspendmux[0] = value & 0x3fffffff;
break;
case 0x294:
s->msuspendmux[1] = value & 0x3fffffff;
break;
case 0x298:
s->msuspendmux[2] = value & 0x3fffffff;
break;
case 0x29c:
s->msuspendmux[3] = value & 0x3fffffff;
break;
case 0x2a0:
s->msuspendmux[4] = value & 0x3fffffff;
break;
case 0x2b8:
s->psaconfig = value & 0x1c;
s->psaconfig |= (value & 0x20) ? 2 : 1;
break;
case 0x2bc:
break;
case 0x2b0:
case 0x2b4:
case 0x2d0:
case 0x2d4:
case 0x2d8:
case 0x2dc:
case 0x2e0:
case 0x2e4:
case 0x2f0:
case 0x2f4:
break;
default:
OMAP_BAD_REG(addr);
return;
}
}
| 1threat |
Using Entity Framework Core migrations for class library project : <p>This seem to be <a href="https://github.com/aspnet/EntityFrameworkCore/issues/5320" rel="noreferrer">an issue that have been fixed already</a>, at least for the SQLite databases.</p>
<p>My solution consists of 3 projects:</p>
<ol>
<li>WPF project (default startup project) (<strong>.NET Framework 4.7</strong>),</li>
<li>"Core" project holding the view model and non-UI stuff - Class library project (<strong>.NET Standard 2.0</strong>)</li>
<li>"Relational" project holding all of the Entity Framework data layer - I like to keep those separated (<strong>.NET Standard 2.0</strong>)</li>
</ol>
<p>I have installed the following packages into the main WPF project:</p>
<pre><code>Microsoft.EntityFrameworkCore.Tools
Microsoft.EntityFrameworkCore.Design
</code></pre>
<p>Projects 2 and 3 are referenced in my main WPF project. So basically, it should be enough for the EF to resolve the DbContextes.</p>
<p>However, it's not - as running <code>Add-Migration</code> on my WPF project results in:</p>
<pre><code>PM> Add-Migration "Initial"
No DbContext was found in assembly 'TestWPFProject'. Ensure that you're using the correct assembly and that the type is neither abstract nor generic.
</code></pre>
<p>Switching to project <code>3</code> as default in the Package Manager Console results in:</p>
<pre><code>PM> Add-Migration "Initial"
Unable to create an object of type 'ClientDbContext'. Add an implementation of 'IDesignTimeDbContextFactory<ClientDataStoreDbContext>' to the project, or see https://go.microsoft.com/fwlink/?linkid=851728 for additional patterns supported at design time.
</code></pre>
<p><strong>How can I properly use EF Core migrations with my class library project and WPF project?</strong></p>
| 0debug |
Predicting on new data using locally weighted regression (LOESS/LOWESS) : <p>How to fit a locally weighted regression in python so that it can be used to predict on new data?</p>
<p>There is <code>statsmodels.nonparametric.smoothers_lowess.lowess</code>, but it returns the estimates only for the original data set; so it seems to only do <code>fit</code> and <code>predict</code> together, rather than separately as I expected.</p>
<p><code>scikit-learn</code> always has a <code>fit</code> method that allows the object to be used later on new data with <code>predict</code>; but it doesn't implement <code>lowess</code>.</p>
| 0debug |
int ff_mpeg_update_thread_context(AVCodecContext *dst,
const AVCodecContext *src)
{
int i;
MpegEncContext *s = dst->priv_data, *s1 = src->priv_data;
if (dst == src)
return 0;
if (!s->context_initialized) {
memcpy(s, s1, sizeof(MpegEncContext));
s->avctx = dst;
s->bitstream_buffer = NULL;
s->bitstream_buffer_size = s->allocated_bitstream_buffer_size = 0;
if (s1->context_initialized){
s->picture_range_start += MAX_PICTURE_COUNT;
s->picture_range_end += MAX_PICTURE_COUNT;
ff_MPV_common_init(s);
}
}
if (s->height != s1->height || s->width != s1->width || s->context_reinit) {
int err;
s->context_reinit = 0;
s->height = s1->height;
s->width = s1->width;
if ((err = ff_MPV_common_frame_size_change(s)) < 0)
return err;
}
s->avctx->coded_height = s1->avctx->coded_height;
s->avctx->coded_width = s1->avctx->coded_width;
s->avctx->width = s1->avctx->width;
s->avctx->height = s1->avctx->height;
s->coded_picture_number = s1->coded_picture_number;
s->picture_number = s1->picture_number;
s->input_picture_number = s1->input_picture_number;
memcpy(s->picture, s1->picture, s1->picture_count * sizeof(Picture));
memcpy(&s->last_picture, &s1->last_picture,
(char *) &s1->last_picture_ptr - (char *) &s1->last_picture);
for (i = 0; i < s->picture_count; i++)
s->picture[i].f.extended_data = s->picture[i].f.data;
s->last_picture_ptr = REBASE_PICTURE(s1->last_picture_ptr, s, s1);
s->current_picture_ptr = REBASE_PICTURE(s1->current_picture_ptr, s, s1);
s->next_picture_ptr = REBASE_PICTURE(s1->next_picture_ptr, s, s1);
s->next_p_frame_damaged = s1->next_p_frame_damaged;
s->workaround_bugs = s1->workaround_bugs;
s->padding_bug_score = s1->padding_bug_score;
memcpy(&s->time_increment_bits, &s1->time_increment_bits,
(char *) &s1->shape - (char *) &s1->time_increment_bits);
s->max_b_frames = s1->max_b_frames;
s->low_delay = s1->low_delay;
s->dropable = s1->dropable;
s->divx_packed = s1->divx_packed;
if (s1->bitstream_buffer) {
if (s1->bitstream_buffer_size +
FF_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_buffer_size)
av_fast_malloc(&s->bitstream_buffer,
&s->allocated_bitstream_buffer_size,
s1->allocated_bitstream_buffer_size);
s->bitstream_buffer_size = s1->bitstream_buffer_size;
memcpy(s->bitstream_buffer, s1->bitstream_buffer,
s1->bitstream_buffer_size);
memset(s->bitstream_buffer + s->bitstream_buffer_size, 0,
FF_INPUT_BUFFER_PADDING_SIZE);
}
memcpy(&s->progressive_sequence, &s1->progressive_sequence,
(char *) &s1->rtp_mode - (char *) &s1->progressive_sequence);
if (!s1->first_field) {
s->last_pict_type = s1->pict_type;
if (s1->current_picture_ptr)
s->last_lambda_for[s1->pict_type] = s1->current_picture_ptr->f.quality;
if (s1->pict_type != AV_PICTURE_TYPE_B) {
s->last_non_b_pict_type = s1->pict_type;
}
}
return 0;
}
| 1threat |
i want two add these two select list with each other : select name,value from (
select name,value from
(
select 'WHB' name,count(*) value from bld_comp_prep where bld_comp_code ='WHB' and comp_code =:a_bld_user_comp and nvl(status,'S')='S' and nvl(delete_flag,'N') ='N'
union all
select 'RBC' name,count(*) value from bld_comp_prep where bld_comp_code ='RBC' and comp_code =:a_bld_user_comp and nvl(status,'S')='S' and nvl(delete_flag,'N') ='N'
union all
select 'FFP' name,count(*) value from bld_comp_prep where bld_comp_code ='FFP' and comp_code =:a_bld_user_comp and nvl(status,'S')='S' and nvl(delete_flag,'N') ='N'
union all
select 'PLC' name,count(*) value from bld_comp_prep where bld_comp_code ='PLC' and comp_code =:a_bld_user_comp and nvl(status,'S')='S' and nvl(delete_flag,'N') ='N'
union all
select 'CRY' name,count(*) value from bld_comp_prep where bld_comp_code ='CRY' and comp_code =:a_bld_user_comp and nvl(status,'S')='S' and nvl(delete_flag,'N') ='N'
union all
select 'GRC' name,count(*) value from bld_comp_prep where bld_comp_code ='GRC' and comp_code =:a_bld_user_comp and nvl(status,'S')='S' and nvl(delete_flag,'N') ='N'
)
left JOIN (
select name,value from(
select 'WHB' name, count(*) value from bld_issue_dtl dtl,bld_issue_hdr hdr,bld_comp_prep prep where prep.bld_comp_code ='WHB' and hdr.issue_code =dtl.issue_code and hdr.comp_code =dtl.comp_code and dtl.comp_bag_code =prep.comp_bag_code and dtl.comp_code =prep.comp_code and TO_DATE(hdr.issue_date,'DD-MON-YY') =TO_DATE(:P29_STOCK_DATE,'DD-MON-YY')
union all
select 'RBC' name, count(*) value from bld_issue_dtl dtl,bld_issue_hdr hdr,bld_comp_prep prep where prep.bld_comp_code ='RBC' and hdr.issue_code =dtl.issue_code and hdr.comp_code =dtl.comp_code and dtl.comp_bag_code =prep.comp_bag_code and dtl.comp_code =prep.comp_code and TO_DATE(hdr.issue_date,'DD-MON-YY') =TO_DATE(:P29_STOCK_DATE,'DD-MON-YY')
union all
select 'FFP' name, count(*) value from bld_issue_dtl dtl,bld_issue_hdr hdr,bld_comp_prep prep where prep.bld_comp_code ='FFP' and hdr.issue_code =dtl.issue_code and hdr.comp_code =dtl.comp_code and dtl.comp_bag_code =prep.comp_bag_code and dtl.comp_code =prep.comp_code and TO_DATE(hdr.issue_date,'DD-MON-YY') =TO_DATE(:P29_STOCK_DATE,'DD-MON-YY')
union all
select 'PLC' name, count(*) value from bld_issue_dtl dtl,bld_issue_hdr hdr,bld_comp_prep prep where prep.bld_comp_code ='PLC' and hdr.issue_code =dtl.issue_code and hdr.comp_code =dtl.comp_code and dtl.comp_bag_code =prep.comp_bag_code and dtl.comp_code =prep.comp_code and TO_DATE(hdr.issue_date,'DD-MON-YY') =TO_DATE(:P29_STOCK_DATE,'DD-MON-YY')
union all
select 'CRY' name, count(*) value from bld_issue_dtl dtl,bld_issue_hdr hdr,bld_comp_prep prep where prep.bld_comp_code ='CRY' and hdr.issue_code =dtl.issue_code and hdr.comp_code =dtl.comp_code and dtl.comp_bag_code =prep.comp_bag_code and dtl.comp_code =prep.comp_code and TO_DATE(hdr.issue_date,'DD-MON-YY') =TO_DATE(:P29_STOCK_DATE,'DD-MON-YY')
union all
select 'GRC' name, count(*) value from bld_issue_dtl dtl,bld_issue_hdr hdr,bld_comp_prep prep where prep.bld_comp_code ='GRC' and hdr.issue_code =dtl.issue_code and hdr.comp_code =dtl.comp_code and dtl.comp_bag_code =prep.comp_bag_code and dtl.comp_code =prep.comp_code and TO_DATE(hdr.issue_date,'DD-MON-YY') =TO_DATE(:P29_STOCK_DATE,'DD-MON-YY')
))); | 0debug |
Athena vs Redshift Spectrum : <p>I am kind of evaluating Athena & Redshift Spectrum. Both serve the same purpose, Spectrum needs a Redshift cluster in place whereas Athena is pure serverless. Athena uses Presto and Spectrum uses its Redshift's engine</p>
<p>Are there any specific disadvantages for Athena or Redshift spectrum?
Any limitations on using Athena or Spectrum ?</p>
| 0debug |
How do I use charAt to check if the string doesn't start with a A-Z or a-z? : <pre><code>else if (!strEmail.toUppercase.charAt(0) < 'A' || !strEmail.toUppercase.charAt(0) > 'Z')
{
JOptionPane.showMessageDialog(null, "Must start with A through Z or a through z");
}
</code></pre>
<p>I tried doing that but I kept getting an error message. Should I just use charAt alone? Am I better off using indexOf to check if the string or email starts with a letter lower case or upper. I was thinking combining index and char, but I tried that, and it didn't work. </p>
| 0debug |
Object literal's property 'children' implicitly has an 'any[]' type : <p>How can I set the <code>myOtherKey</code> property to have <code>any</code>?</p>
<p>Typescript error ..</p>
<pre><code>Object literal's property 'children' implicitly has an 'any[]' type
</code></pre>
<p>Object initialization ..</p>
<pre><code>let myObject = {
myKey: 'someValue',
myOtherKey: []
};
</code></pre>
| 0debug |
static void av_always_inline filter_mb_edgev( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h) {
const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
const int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset];
if (alpha ==0 || beta == 0) return;
if( bS[0] < 4 ) {
int8_t tc[4];
tc[0] = tc0_table[index_a][bS[0]];
tc[1] = tc0_table[index_a][bS[1]];
tc[2] = tc0_table[index_a][bS[2]];
tc[3] = tc0_table[index_a][bS[3]];
h->h264dsp.h264_h_loop_filter_luma(pix, stride, alpha, beta, tc);
} else {
h->h264dsp.h264_h_loop_filter_luma_intra(pix, stride, alpha, beta);
}
}
| 1threat |
Excel VBA - Do While Loop for SKU numbers : I am trying to automate my SKU numbers
I have 3 Columbs the First goes to 28, Second 6, Third 58.
I want the SKU to have a Trend like so 0{(###)col1}{(##)col2}{(##)col3}0
My Code looks like this
Sub SKU()
Dim x As Long
x = 1
i = 1
j = 1
k = 1
Do While Cells(i, 1) <> ""
Do While Cells(j, 2) <> ""
Do While Cells(k, 3) <> ""
Cells(x, 4).Value = Format(0, "0") & Format(i, "000") & Format(j, "00") & Format(k, "00") & Format(0, "0")
k = k + 1
x = x + 1
Loop
j = j + 1
Loop
i = i + 1
Loop
End Sub
| 0debug |
static uint64_t exynos4210_pmu_read(void *opaque, target_phys_addr_t offset,
unsigned size)
{
Exynos4210PmuState *s = (Exynos4210PmuState *)opaque;
unsigned i;
const Exynos4210PmuReg *reg_p = exynos4210_pmu_regs;
for (i = 0; i < PMU_NUM_OF_REGISTERS; i++) {
if (reg_p->offset == offset) {
PRINT_DEBUG_EXTEND("%s [0x%04x] -> 0x%04x\n", reg_p->name,
(uint32_t)offset, s->reg[i]);
return s->reg[i];
}
reg_p++;
}
PRINT_DEBUG("QEMU PMU ERROR: bad read offset 0x%04x\n", (uint32_t)offset);
return 0;
}
| 1threat |
static void spitz_i2c_setup(PXA2xxState *cpu)
{
I2CBus *bus = pxa2xx_i2c_bus(cpu->i2c[0]);
DeviceState *wm;
wm = i2c_create_slave(bus, "wm8750", 0);
spitz_wm8750_addr(wm, 0, 0);
qdev_connect_gpio_out(cpu->gpio, SPITZ_GPIO_WM,
qemu_allocate_irqs(spitz_wm8750_addr, wm, 1)[0]);
cpu->i2s->opaque = wm;
cpu->i2s->codec_out = wm8750_dac_dat;
cpu->i2s->codec_in = wm8750_adc_dat;
wm8750_data_req_set(wm, cpu->i2s->data_req, cpu->i2s);
}
| 1threat |
How to add zeros after the significant digits after decimal in c programming language? :
double r;
float a;
scanf("%lf",&r);
a=M_PI*pow(r,2);
printf("%.2f",a);
I want the output like this 12.560000 | 0debug |
I have a list of URL's and I want to know to which html div each URL belongs in a HTML page : <p>I have a list of URL's and I want to know to which html div each URL belongs in a HTML page
I have to do it using java</p>
| 0debug |
void ff_init_block_index(MpegEncContext *s){
const int linesize = s->current_picture.f.linesize[0];
const int uvlinesize = s->current_picture.f.linesize[1];
const int mb_size= 4;
s->block_index[0]= s->b8_stride*(s->mb_y*2 ) - 2 + s->mb_x*2;
s->block_index[1]= s->b8_stride*(s->mb_y*2 ) - 1 + s->mb_x*2;
s->block_index[2]= s->b8_stride*(s->mb_y*2 + 1) - 2 + s->mb_x*2;
s->block_index[3]= s->b8_stride*(s->mb_y*2 + 1) - 1 + s->mb_x*2;
s->block_index[4]= s->mb_stride*(s->mb_y + 1) + s->b8_stride*s->mb_height*2 + s->mb_x - 1;
s->block_index[5]= s->mb_stride*(s->mb_y + s->mb_height + 2) + s->b8_stride*s->mb_height*2 + s->mb_x - 1;
s->dest[0] = s->current_picture.f.data[0] + ((s->mb_x - 1) << mb_size);
s->dest[1] = s->current_picture.f.data[1] + ((s->mb_x - 1) << (mb_size - s->chroma_x_shift));
s->dest[2] = s->current_picture.f.data[2] + ((s->mb_x - 1) << (mb_size - s->chroma_x_shift));
if(!(s->pict_type==AV_PICTURE_TYPE_B && s->avctx->draw_horiz_band && s->picture_structure==PICT_FRAME))
{
if(s->picture_structure==PICT_FRAME){
s->dest[0] += s->mb_y * linesize << mb_size;
s->dest[1] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift);
s->dest[2] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift);
}else{
s->dest[0] += (s->mb_y>>1) * linesize << mb_size;
s->dest[1] += (s->mb_y>>1) * uvlinesize << (mb_size - s->chroma_y_shift);
s->dest[2] += (s->mb_y>>1) * uvlinesize << (mb_size - s->chroma_y_shift);
assert((s->mb_y&1) == (s->picture_structure == PICT_BOTTOM_FIELD));
}
}
}
| 1threat |
Infinite Loop Somewhere? :
So I'm Writing A Program To Take Items From A Given .txt File And Put Them Into An Array,Then From That Array, Depending On The Number, Print It Out As A Character. For Some Reason It Continually Prints 3 Spaces, Then 8 At Symbols, Creates A New Line And Repeats, Infinitely. I've Tried A Switch Statement (Which Is Commented Out) But It Did The Same Thing. Cloudberry Is The Array In Which It Reads From, And It Contains All The Correct Numbers.
while(read.hasNextLine()) {
int nutmeg = 0;
for(int x = 0; x < cloudberry.length;x++ ){
//String dragonfruit = line.substring(x,x+1);
for(int y = 0; y < cloudberry[x].length;y++){
//int nutmeg = Integer.parseInt(dragonfruit);
nutmeg = cloudberry[x][y];
switch (nutmeg){
case 1:
System.out.print("@");
break;
case 2:
System.out.print("+");
break;
case 3:
System.out.print(" ");
break;
} | 0debug |
static inline void gen_op_arith_subf(DisasContext *ctx, TCGv ret, TCGv arg1,
TCGv arg2, bool add_ca, bool compute_ca,
bool compute_ov, bool compute_rc0)
{
TCGv t0 = ret;
if (compute_ca || compute_ov) {
t0 = tcg_temp_new();
}
if (compute_ca) {
if (NARROW_MODE(ctx)) {
TCGv inv1 = tcg_temp_new();
TCGv t1 = tcg_temp_new();
tcg_gen_not_tl(inv1, arg1);
if (add_ca) {
tcg_gen_add_tl(t0, arg2, cpu_ca);
} else {
tcg_gen_addi_tl(t0, arg2, 1);
}
tcg_gen_xor_tl(t1, arg2, inv1);
tcg_gen_add_tl(t0, t0, inv1);
tcg_gen_xor_tl(cpu_ca, t0, t1);
tcg_temp_free(t1);
tcg_gen_shri_tl(cpu_ca, cpu_ca, 32);
tcg_gen_andi_tl(cpu_ca, cpu_ca, 1);
} else if (add_ca) {
TCGv zero, inv1 = tcg_temp_new();
tcg_gen_not_tl(inv1, arg1);
zero = tcg_const_tl(0);
tcg_gen_add2_tl(t0, cpu_ca, arg2, zero, cpu_ca, zero);
tcg_gen_add2_tl(t0, cpu_ca, t0, cpu_ca, inv1, zero);
tcg_temp_free(zero);
} else {
tcg_gen_setcond_tl(TCG_COND_GEU, cpu_ca, arg2, arg1);
tcg_gen_sub_tl(t0, arg2, arg1);
}
} else if (add_ca) {
tcg_gen_sub_tl(t0, arg2, arg1);
tcg_gen_add_tl(t0, t0, cpu_ca);
tcg_gen_subi_tl(t0, t0, 1);
} else {
tcg_gen_sub_tl(t0, arg2, arg1);
}
if (compute_ov) {
gen_op_arith_compute_ov(ctx, t0, arg1, arg2, 1);
}
if (unlikely(compute_rc0)) {
gen_set_Rc0(ctx, t0);
}
if (!TCGV_EQUAL(t0, ret)) {
tcg_gen_mov_tl(ret, t0);
tcg_temp_free(t0);
}
} | 1threat |
Screen readers and Javascript : <p>I'm creating <a href="https://reader.ku.edu/">a website for a reading service for the blind and visually impaired</a> and I'm using JavaScript (with jQuery) to print some stuff to some of the pages after the page has loaded.</p>
<p>Will the screen reader read the content that is printed to the page with jquery after the page has been loaded?</p>
<p>From <a href="https://soap.stanford.edu/tips-and-tools/screen-reader-testing">this page</a> - "Generally, [screen readers] access the DOM (Document Object Model), and they use browser APIs (Application Programming Interfaces) to get the information they need."</p>
<p>and we know that jQuery is a DOM manipulation library. </p>
<p>So the question becomes.. do screen readers take a copy of the whole DOM and then parse it and read it? Or do they read the DOM, the same one that jQuery works on?</p>
<p>Here's an example of one of the pages that I use JavaScript on. It uses a function that determines what program we have playing over the air and then prints the name of the program and a link to listen to it.</p>
<pre><code><div id="now-playing-div"></div>
<script>
// invoke the audio-reader javascript library
$( document ).ready( function() {
var callback = nowPlaying; // catalog, schedule, podcasts, archive or nowPlaying
var selector = '#now-playing-div';
makeAudioReaderPage(callback, selector);
});
</script>
</code></pre>
<p>So as you can see, if the screen reader doesn't read what the javascript/jquery prints to the #now-playing-div then it will read nothing. Then, we started getting a few emails of confused listeners wondering what happened to the Now Playing link. </p>
<p>So this morning I added this:</p>
<pre><code><div id='no-js'>Please enable JavaScript to receive this content.</div>
<script>
$( document ).ready( function() {
$('#no-js').toggle();
});
</script>
</code></pre>
<p>But if the problem isn't that JavaScript needs to be enabled (<a href="http://webaim.org/projects/screenreadersurvey4/#javascript">a recent survey shows</a> that 99% of screen-reader users have JavaScript enabled) then the problem is not solved and is made even worse because now the screen reader user would think that JavaScript is not enabled.</p>
<p>What to do??</p>
| 0debug |
Professional/ Better way of header/body/footer layout : <p>So this is the fist way i have see this with a wrapper.</p>
<pre><code> <body>
<div id="wrapper">
<div id="header">
<h1>My page</h1>
<!-- Header content -->
</div>
<div id="main">
<!-- Page content -->
</div>
<div id="footer">
<!-- Footer content -->
</div>
</div>
</body
</code></pre>
<p>This is the second way with out a wrapper , i just wanted to know the better most used way even if it's different than these two that will not cause problems afterwards in my page.</p>
<pre><code> <body>
<div id="header">
<h1>My page</h1>
<!-- Header content -->
</div>
<div id="main">
<!-- Page content -->
</div>
<div id="footer">
<!-- Footer content -->
</div>
</body
</code></pre>
| 0debug |
mySQL Error with WHERE clause and group by clause : [enter image description here][1]
I'm trying to write a query that retrieves the names of all salespeople that have more than $1300 in orders from the tables above. (each salesperson only has one ID.)
[1]: https://i.stack.imgur.com/KUbgq.png
Here is my attempt:
SELECT name, sum(amount)
FROM salesperson
JOIN orders
ON salesperson.ID = orders.salesperson_id
WHERE sum(amount) > 1300
GROUP BY name;
However, it displays the error: ERROR 1111 (HY000): Invalid use of group function.
When I remove where clause, it works fine and returns following:
[enter image description here][2]
[2]: https://i.stack.imgur.com/EwJgy.png
Which is pretty similar to what I want except that there's no filter for sum(amount) less than 1300.
What did I do wrong with where clause and how can I solve it? I need urgent help.
Thank you. | 0debug |
static inline void downmix_3f_to_stereo(float *samples)
{
int i;
for (i = 0; i < 256; i++) {
samples[i] += samples[i + 256];
samples[i + 256] = samples[i + 512];
samples[i + 512] = 0;
}
}
| 1threat |
How to conver SELECT * FROM users WHERE name IN ('Peter', 'John') and age=30 in rethinkDB? : SELECT * FROM users
WHERE name IN ('Peter', 'John') and age=30;
I am new in rethinkDB.I want to convert this query in RethinkDB using NodeJS.Can someone please help. | 0debug |
Create php form to allow create new XMPP accounts : <p>I want create a simple PHP form (nickname and username) to allow users register a new jabber account in the server through the website. I'm using prosody as XMPP server and I can create new accounts through clients such Pidgin, etc but although I was reading about it, I found that to use XMPP over http I should enable a bosh server but I don't know if it can help me to find a solution for my problem and the few libraries which I found of XMPP in PHP haven't any function to create new accounts in the server (or unless I didn't see any function...). And I don't want use the exec function due to that the command to register new users ask me for sudo privileges.
If someone can teach me about how deal with it to learn I will be very grateful.</p>
| 0debug |
Tomcat 7 java.lang.NoClassDefFoundError: javax/el/ELManager : <p>I want to deploy my application to a tomcat in version 7 and I get the following Exception <code>java.lang.NoClassDefFoundError: javax/el/ELManager</code>
But if I try to deploy this application to tomcat version 8 it works fine.</p>
<p>Do you have any ideas how to fix this?</p>
<p>Why do i switch from tomcat 8 to 7? In the test environment was tomcat 8 in the repo and on the server it is tomcat7.</p>
<p>pom.xml</p>
<pre><code><project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>certplatform</groupId>
<artifactId>certplatform</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-
core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.0.4.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-
context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.4.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-
context-support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>5.0.4.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-
webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.0.4.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-web
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.4.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!--https://mvnrepository.com/artifact/javax.servlet.jsp.jstl/javax.servlet.jsp.jstl-api -->
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>javax.servlet.jsp.jstl-api</artifactId>
<version>1.2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.mail/mail -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.5.0-b01</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-validator -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.8.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.15.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.2.15.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.59</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcpkix-jdk15on -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.59</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.el/javax.el-api -->
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.el/el-api -->
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>2.2</version>
</dependency>
</code></pre>
<p></p>
<p></p>
<p>web.xml</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">
<display-name>spring-mvc-demo</display-name>
<!-- Spring MVC Configs -->
<!-- Step 1: Configure Spring MVC Dispatcher Servlet -->
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-mvc-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Step 2: Set up URL mapping for Spring MVC Dispatcher Servlet -->
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</code></pre>
<p></p>
| 0debug |
ASP.net update query c# : <p>i'm trying to make update query ,i've seen lot of related posts but i can't find the bug in my code... any tips please. here is the code</p>
<pre><code>SqlConnection connection= new SqlConnection(sqlconn.connStr);
connection.Open();
string cinOld = CINone.Value;
SqlCommand cmd = new SqlCommand("update Employee set cin=@cin,
name=@name, lastname=@lastname, function=@function, birthdate=@birthdate,
email=@email, numTel=@numTel where cin = @cina");
var x = 0;
cmd.Parameters.AddWithValue("@cin", cinid.Value);
cmd.Parameters.AddWithValue("@name", HiddenField1.Value);
cmd.Parameters.AddWithValue("@lastname", HiddenField2.Value);
cmd.Parameters.AddWithValue("@function", HiddenField3.Value);
cmd.Parameters.AddWithValue("@birthdate", HiddenField6.Value);
cmd.Parameters.AddWithValue("@email", HiddenField5.Value);
cmd.Parameters.AddWithValue("@numTel", HiddenField4.Value);
cmd.Parameters.AddWithValue("@cina", cinOld);
cmd.ExecuteNonQuery();
</code></pre>
| 0debug |
static int mirror_do_read(MirrorBlockJob *s, int64_t sector_num,
int nb_sectors)
{
BlockBackend *source = s->common.blk;
int sectors_per_chunk, nb_chunks;
int ret;
MirrorOp *op;
int max_sectors;
sectors_per_chunk = s->granularity >> BDRV_SECTOR_BITS;
max_sectors = sectors_per_chunk * s->max_iov;
nb_sectors = MIN(s->buf_size >> BDRV_SECTOR_BITS, nb_sectors);
nb_sectors = MIN(max_sectors, nb_sectors);
assert(nb_sectors);
ret = nb_sectors;
if (s->cow_bitmap) {
ret += mirror_cow_align(s, §or_num, &nb_sectors);
}
assert(nb_sectors << BDRV_SECTOR_BITS <= s->buf_size);
assert(!(sector_num % sectors_per_chunk));
nb_chunks = DIV_ROUND_UP(nb_sectors, sectors_per_chunk);
while (s->buf_free_count < nb_chunks) {
trace_mirror_yield_in_flight(s, sector_num * BDRV_SECTOR_SIZE,
s->in_flight);
mirror_wait_for_io(s);
}
op = g_new(MirrorOp, 1);
op->s = s;
op->sector_num = sector_num;
op->nb_sectors = nb_sectors;
qemu_iovec_init(&op->qiov, nb_chunks);
while (nb_chunks-- > 0) {
MirrorBuffer *buf = QSIMPLEQ_FIRST(&s->buf_free);
size_t remaining = nb_sectors * BDRV_SECTOR_SIZE - op->qiov.size;
QSIMPLEQ_REMOVE_HEAD(&s->buf_free, next);
s->buf_free_count--;
qemu_iovec_add(&op->qiov, buf, MIN(s->granularity, remaining));
}
s->in_flight++;
s->sectors_in_flight += nb_sectors;
trace_mirror_one_iteration(s, sector_num * BDRV_SECTOR_SIZE,
nb_sectors * BDRV_SECTOR_SIZE);
blk_aio_preadv(source, sector_num * BDRV_SECTOR_SIZE, &op->qiov, 0,
mirror_read_complete, op);
return ret;
}
| 1threat |
av_cold int ff_dcaadpcm_init(DCAADPCMEncContext *s)
{
if (!s)
return -1;
s->private_data = av_malloc(sizeof(premultiplied_coeffs) * DCA_ADPCM_VQCODEBOOK_SZ);
precalc(s->private_data);
return 0;
} | 1threat |
With My Navigation Bar Is Messed Up : <p>Need help with the text on my navigation bar. The items in it are all messed up, and jumbled I know my code is really sloppy I am new to coding. This is the link with JS bin here <a href="http://jsbin.com/cibuvozido/edit?html,output" rel="nofollow">http://jsbin.com/cibuvozido/edit?html,output</a></p>
| 0debug |
sql server 2012 copy data of table to another one (1 column extra in new one) : I want to copy the data of a table in another one, but the new table has an extra column where I want to add a static text "Table_Name" | 0debug |
Is possible to modify arcanist/differential template? : <p>I'm trying to configure a phabricator instance, and I find that change the arcanist default template when we use <code>arc diff</code> can be very useful for the team. </p>
<p>Actually the template contains this text: </p>
<pre><code><<Replace this line with your Revision Title>>
Summary:
Test Plan:
Reviewers:
Subscribers:
# Tip: Write "Fixes T123" in your summary to automatically close the
# corresponding task when this change lands.
# NEW DIFFERENTIAL REVISION
# Describe the changes in this new revision.
#
# arc could not identify any existing revision in your working copy.
# If you intended to update an existing revision, use:
#
# $ arc diff --update <revision>
</code></pre>
<p>I'm googling to find any way to change this default template, but I can't find it... </p>
<p>There is any way to "personalize" this template?</p>
| 0debug |
static void wav_capture_destroy (void *opaque)
{
WAVState *wav = opaque;
AUD_del_capture (wav->cap, wav);
} | 1threat |
Why are there so many formatting falvours in Python? : **DISCLAIMER**: If you find this questions as `off-topic`, `opinion-based`, or just `too-broad` for this fine gathering here, just drop me a line in the comments and I'll take this down. Meanwhile, bear with me here for a second.
I've recently watched a Python tutorial in which the author kept juggling various Python string formatting expressions and I was struck by a thought.
*Why are there so many string formatting flavours in Python?*
- There's the C language `prinf` based approach (which, by the way, in various sources is cited as being deprecated and scheduled for removal but there's an abundance of its examples in the standard Python documentation (!)).
- On the other hand, there's the `C#` derived `.format()` way of handling strings.
- Finally, as of the advent of `Ptyhon 3.6`, we've been given the `formatted f-string literal`, known as the `f-string`.
- Some also include the `string` module but that seems an overkill to me.
As I found out [here][1], the first two aforementioned techniques both differ and overlap each other, depending on the use.
And last but not least, isn't this opulence of methods contradictory to one of Python's declarations from the `import this`?
> There should be one-- and preferably only one --obvious way to do it.
Correct me if I'm wrong, but this is inherently "un-Pythonic" in a way.
I would highly appreciate some constructive thoughts on this (preferably backed up with some relevant examples).
Thanks for your time and effort!
[1]: https://stackoverflow.com/questions/5082452/python-string-formatting-vs-format | 0debug |
android kotlin - app do not show me toast : i want when someone insert more than 3 number in month input, the Toast should show a error message, i try it and the app do nothing ! why ?(*i am beginner*)
another question how can i use try and catch with that ?
@SuppressLint("SetTextI18n")
fun onClickButton(view: View){
getAGE.setOnClickListener {
val Get_year_input = age_year_input.text.toString().toInt()
val getCurrentYear = Calendar.getInstance().get(Calendar.YEAR)
val finish_year_input = Get_year_input - getCurrentYear
val getCurrentMonth = Calendar.getInstance().get(Calendar.MONTH)
val finish_month_input = age_month_input.text.toString().toInt()-getCurrentMonth
if (age_month_input.length() > 2) {
Toasty.error(this,"لقد أدخلت شهر غير صالح",Toast.LENGTH_LONG)
}else {
ShowYearInput.text = " عُمرك الميلادي هو : $finish_year_input و $finish_month_input أشهر "
}
}
} | 0debug |
Python dateutil returns YYYY-MM-DD, but I need it reversed , help please? : <p>I've got a piece of script in python that parses a line containing date and time:</p>
<pre><code>d = dateutil.parser.parse("%s %s" % (m.group('date'),
m.group('time')), dayfirst=True)
</code></pre>
<p>it returns the date in YYYY-MM-DD. How can I get it to say Weekday DD Month YYYY? Or if that is not possible DD-MM-YYYY? </p>
<p>Additionally, it also gives the time in HH:MM:SS, but I only need HH:MM, is there a way to lose the seconds? </p>
<p>Thank you! </p>
<p>I'm a complete novice to python so hope that anyone can help me, thank you very much!</p>
| 0debug |
static void g364fb_ctrl_write(void *opaque,
target_phys_addr_t addr,
uint64_t val,
unsigned int size)
{
G364State *s = opaque;
trace_g364fb_write(addr, val);
if (addr >= REG_CLR_PAL && addr < REG_CLR_PAL + 0x800) {
int idx = (addr - REG_CLR_PAL) >> 3;
s->color_palette[idx][0] = (val >> 16) & 0xff;
s->color_palette[idx][1] = (val >> 8) & 0xff;
s->color_palette[idx][2] = val & 0xff;
g364fb_invalidate_display(s);
} else if (addr >= REG_CURS_PAT && addr < REG_CURS_PAT + 0x1000) {
int idx = (addr - REG_CURS_PAT) >> 3;
s->cursor[idx] = val;
g364fb_invalidate_display(s);
} else if (addr >= REG_CURS_PAL && addr < REG_CURS_PAL + 0x18) {
int idx = (addr - REG_CURS_PAL) >> 3;
s->cursor_palette[idx][0] = (val >> 16) & 0xff;
s->cursor_palette[idx][1] = (val >> 8) & 0xff;
s->cursor_palette[idx][2] = val & 0xff;
g364fb_invalidate_display(s);
} else {
switch (addr) {
case REG_BOOT:
case 0x00108:
case 0x00110:
case 0x00120:
case 0x00128:
case 0x00130:
case 0x00138:
case 0x00140:
case 0x00148:
case 0x00158:
case 0x00160:
case 0x00168:
case 0x00170:
case 0x00200:
break;
case REG_TOP:
s->top_of_screen = val;
g364fb_invalidate_display(s);
break;
case REG_DISPLAY:
s->width = val * 4;
break;
case REG_VDISPLAY:
s->height = val / 2;
break;
case REG_CTLA:
s->ctla = val;
g364fb_update_depth(s);
g364fb_invalidate_display(s);
break;
case REG_CURS_POS:
g364_invalidate_cursor_position(s);
s->cursor_position = val;
g364_invalidate_cursor_position(s);
break;
case REG_RESET:
g364fb_reset(s);
break;
default:
error_report("g364: invalid write of 0x%" PRIx64
" at [" TARGET_FMT_plx "]", val, addr);
break;
}
}
qemu_irq_lower(s->irq);
}
| 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.