problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
Neo4j+apoc: Is there an apoc-function for importing word-doc? : Neo4j+apoc: Is there an apoc-function for importing word-doc ?
I try to import the text as a chain of nodes parsing some simple layout tags.
| 0debug
|
i can,t show my array in java script why? : i have a simple code in java script.i was going to create code to add some first name ,last name and age of students from client by click on "Add Student"button.
and show the list of students that just added by click on "Show Students" button.
add action is successfully.
but when i click on "Show Students" button it just shows me a table without any information(First Name,Last Name,Age).
this is my js page:
var students = new Array();
var i = 0;
function AddStudent()
{
var patt = /i[a-z]/;
var Fname = prompt("enter first name");
var Lname = prompt("enter last name");
var Age = prompt("enter age");
var std= {fname : Fname,lname : Lname,age : Age }
students[i++] =std;
}
function ShowStudents()
{
var table = "<table style='background-color:greenyellow; border:solid;'>";
table += "<tr><th>نام</th><th>نام خانوادگی</th><th>سن</th></tr>"
for( var j=0;j<students.length;j++)
{
table += "<tr>"
table += "<td>" + students[j].fname +"</td>"
table += "<td>" + students[j].lname + "</td>"
table += "<td>" + students[j].age + "</td>"
table +="</tr>"
}
table += "</table>";
document.getElementById("ShowStudents").innerHTML = table;
}
and this is my html page:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="JavaScript1.js"></script>
<title></title>
</head>
<body>
<input type="button" value="Add Student" onclick="AddStudent();"/>
<input type="button" value="Show Students" onclick="ShowStudents();"/>
<div id="ShowStudents" ></div>
please help me!
| 0debug
|
static void vvfat_refresh_limits(BlockDriverState *bs, Error **errp)
{
bs->request_alignment = BDRV_SECTOR_SIZE;
}
| 1threat
|
Powershell: How to loop through a text file (running a command) in batches of 500 : I have a very large exported list in text and i need to go through each of the entries and run a command using the entry. But i wish to do this in batches of 500 - as i need to allow processing time.
What I do not understand is how i Loop through the text file but only run a limited number at a time, then wait for a certain time, before running the next block until they are all completed.
Can someone help with an example which i can then apply to my scenario?
Many thanks!
| 0debug
|
Cant find the image links to images on the website in html I bought. I own it, but where is it? : <p>I can't find the link in the html to 3 images on the front page of my website. The black spy on green background and the two black graphs on green background. The website is here : home.alphaphoner.com it's a template I bought online, but now I want to update it and I can't. Can anyone find the links?</p>
| 0debug
|
static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
{
MXFContext *mxf = arg;
MXFPartition *partition;
UID op;
uint64_t footer_partition;
uint32_t nb_essence_containers;
int err;
if (mxf->partitions_count+1 >= UINT_MAX / sizeof(*mxf->partitions))
return AVERROR(ENOMEM);
if ((err = av_reallocp_array(&mxf->partitions, mxf->partitions_count + 1,
sizeof(*mxf->partitions))) < 0) {
mxf->partitions_count = 0;
return err;
}
if (mxf->parsing_backward) {
memmove(&mxf->partitions[mxf->last_forward_partition+1],
&mxf->partitions[mxf->last_forward_partition],
(mxf->partitions_count - mxf->last_forward_partition)*sizeof(*mxf->partitions));
partition = mxf->current_partition = &mxf->partitions[mxf->last_forward_partition];
} else {
mxf->last_forward_partition++;
partition = mxf->current_partition = &mxf->partitions[mxf->partitions_count];
}
memset(partition, 0, sizeof(*partition));
mxf->partitions_count++;
partition->pack_length = avio_tell(pb) - klv_offset + size;
switch(uid[13]) {
case 2:
partition->type = Header;
break;
case 3:
partition->type = BodyPartition;
break;
case 4:
partition->type = Footer;
break;
default:
av_log(mxf->fc, AV_LOG_ERROR, "unknown partition type %i\n", uid[13]);
return AVERROR_INVALIDDATA;
}
partition->closed = partition->type == Footer || !(uid[14] & 1);
partition->complete = uid[14] > 2;
avio_skip(pb, 4);
partition->kag_size = avio_rb32(pb);
partition->this_partition = avio_rb64(pb);
partition->previous_partition = avio_rb64(pb);
footer_partition = avio_rb64(pb);
partition->header_byte_count = avio_rb64(pb);
partition->index_byte_count = avio_rb64(pb);
partition->index_sid = avio_rb32(pb);
avio_skip(pb, 8);
partition->body_sid = avio_rb32(pb);
avio_read(pb, op, sizeof(UID));
nb_essence_containers = avio_rb32(pb);
if (footer_partition) {
if (mxf->footer_partition && mxf->footer_partition != footer_partition) {
av_log(mxf->fc, AV_LOG_ERROR,
"inconsistent FooterPartition value: %"PRIu64" != %"PRIu64"\n",
mxf->footer_partition, footer_partition);
} else {
mxf->footer_partition = footer_partition;
}
}
av_dlog(mxf->fc,
"PartitionPack: ThisPartition = 0x%"PRIX64
", PreviousPartition = 0x%"PRIX64", "
"FooterPartition = 0x%"PRIX64", IndexSID = %i, BodySID = %i\n",
partition->this_partition,
partition->previous_partition, footer_partition,
partition->index_sid, partition->body_sid);
if (partition->previous_partition &&
mxf->run_in + partition->previous_partition >= klv_offset) {
av_log(mxf->fc, AV_LOG_ERROR,
"PreviousPartition points to this partition or forward\n");
return AVERROR_INVALIDDATA;
}
if (op[12] == 1 && op[13] == 1) mxf->op = OP1a;
else if (op[12] == 1 && op[13] == 2) mxf->op = OP1b;
else if (op[12] == 1 && op[13] == 3) mxf->op = OP1c;
else if (op[12] == 2 && op[13] == 1) mxf->op = OP2a;
else if (op[12] == 2 && op[13] == 2) mxf->op = OP2b;
else if (op[12] == 2 && op[13] == 3) mxf->op = OP2c;
else if (op[12] == 3 && op[13] == 1) mxf->op = OP3a;
else if (op[12] == 3 && op[13] == 2) mxf->op = OP3b;
else if (op[12] == 3 && op[13] == 3) mxf->op = OP3c;
else if (op[12] == 64&& op[13] == 1) mxf->op = OPSonyOpt;
else if (op[12] == 0x10) {
if (nb_essence_containers != 1) {
MXFOP op = nb_essence_containers ? OP1a : OPAtom;
if (!mxf->op)
av_log(mxf->fc, AV_LOG_WARNING,
"\"OPAtom\" with %u ECs - assuming %s\n",
nb_essence_containers,
op == OP1a ? "OP1a" : "OPAtom");
mxf->op = op;
} else
mxf->op = OPAtom;
} else {
av_log(mxf->fc, AV_LOG_ERROR, "unknown operational pattern: %02xh %02xh - guessing OP1a\n", op[12], op[13]);
mxf->op = OP1a;
}
if (partition->kag_size <= 0 || partition->kag_size > (1 << 20)) {
av_log(mxf->fc, AV_LOG_WARNING, "invalid KAGSize %i - guessing ", partition->kag_size);
if (mxf->op == OPSonyOpt)
partition->kag_size = 512;
else
partition->kag_size = 1;
av_log(mxf->fc, AV_LOG_WARNING, "%i\n", partition->kag_size);
}
return 0;
}
| 1threat
|
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
| 1threat
|
void ff_avg_h264_qpel8_mc33_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_hv_qrt_and_aver_dst_8x8_msa(src + stride - 2,
src - (stride * 2) +
sizeof(uint8_t), stride, dst, stride);
}
| 1threat
|
What is "Trident" in my user agent string refer too? : <p>According to UserAgentString.com my user agent string: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko</p>
<p>Does this mean that I'm using IE 11 with an IE 7 user agent? UserAgentString.com stats that "Trident" is the layout engine for Internet Explorer. </p>
| 0debug
|
Date Regex with special character as optional pre element : <p>Date Regex with special character as optional pre element</p>
<p>I need a date regex for YYYY-MM-DD, plus the following four case: </p>
<pre><code>1978-12-20
>1978-12-20
>=1978-12-20
<1978-12-20
<=1978-12-20
</code></pre>
<p>How can I allow those 5 scenarios? </p>
| 0debug
|
static void usb_hub_handle_attach(USBDevice *dev)
{
USBHubState *s = DO_UPCAST(USBHubState, dev, dev);
int i;
for (i = 0; i < NUM_PORTS; i++) {
usb_port_location(&s->ports[i].port, dev->port, i+1);
}
}
| 1threat
|
How can i generate a random large image file using c# code? : <p>I have a requirement to generate 100s of thousands of random but unique image files (.jpeg/tiff/png) with the following criteria and drop it into a folder of choice :</p>
<p>Generated file to be with a given resolution, size (eg. 100mb each) but can be any dummy randomised colours/patterns etc...</p>
<p>Is there any way i can generate this using c# or any other programming technique ? </p>
| 0debug
|
static av_cold int mov_text_encode_init(AVCodecContext *avctx)
{
static const uint8_t text_sample_entry[] = {
0x00, 0x00, 0x00, 0x00,
0x01,
0xFF,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x01,
0x00,
0x12,
0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x12,
'f', 't', 'a', 'b',
0x00, 0x01,
0x00, 0x01,
0x05,
'S', 'e', 'r', 'i', 'f',
};
MovTextContext *s = avctx->priv_data;
avctx->extradata_size = sizeof text_sample_entry;
avctx->extradata = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return AVERROR(ENOMEM);
av_bprint_init(&s->buffer, 0, AV_BPRINT_SIZE_UNLIMITED);
memcpy(avctx->extradata, text_sample_entry, avctx->extradata_size);
s->ass_ctx = ff_ass_split(avctx->subtitle_header);
return s->ass_ctx ? 0 : AVERROR_INVALIDDATA;
}
| 1threat
|
Focus input after redux dispatch finished : <p>I am dynamically creating list of inputs with React and Redux. After clicking a button an input is added to the end of list. I need to focus last added input. I tried this code but it focuses penultimate input</p>
<pre><code>const mapDispatchToProps = (dispatch, ownProps) => ({
onOptionsChange: (newOptions) => {
dispatch(formActions.updateOptions(newOptions));
}
});
...
this.props.onOptionsChange({ ...this.props, inputsList}); // change list of inputs
ReactDOM.findDOMNode(this.inputs[this.props.choices.length - 1]).focus();
</code></pre>
<p>In logs I can see that focus() is executed before props from state are updated. How can I wait for dispatch to finish?</p>
| 0debug
|
Can someone explain to me how this program works? : <p>I am having trouble understanding how to program below works and I would appreciate someone explaining to me how exactly it runs. </p>
<pre><code>public static void main(String[] args) {
//Enter two number whose GCD needs to be calculated.
Scanner scanner = new Scanner(System.in);
// Title of what program will do
System.out.println("GCD Finder");
System.out.println("");
// Here user is instructed to enter the numbers
System.out.println("Please enter first number: ");
int number1 = scanner.nextInt();
System.out.println("Please enter second number: ");
int number2 = scanner.nextInt();
// The numbers are then calculated using findGCD.
System.out.println("GCD of two numbers " + number1 +" and " + number2 +" is : " + findGCD(number1,number2));
}
private static int findGCD(int number1, int number2) {
//base case
if(number2 == 0){
return number1;
}
// Returns the two numbers
return findGCD(number2, number1%number2);
}
</code></pre>
<p>This part below is specifically what I am having trouble understanding. Please do not hesitate to explain in detail, I want to understand it fully. Thank you for your time.</p>
<pre><code>private static int findGCD(int number1, int number2) {
//base case
if(number2 == 0){
return number1;
}
// Returns the two numbers
return findGCD(number2, number1%number2);
}
</code></pre>
| 0debug
|
static int iv_decode_frame(AVCodecContext *avctx,
const uint8_t *buf, int buf_size)
{
Indeo3DecodeContext *s = avctx->priv_data;
unsigned int image_width, image_height,
chroma_width, chroma_height;
unsigned long flags, cb_offset, data_size,
y_offset, v_offset, u_offset, mc_vector_count;
const uint8_t *hdr_pos, *buf_pos;
buf_pos = buf;
buf_pos += 18;
flags = bytestream_get_le16(&buf_pos);
data_size = bytestream_get_le32(&buf_pos);
cb_offset = *buf_pos++;
buf_pos += 3;
image_height = bytestream_get_le16(&buf_pos);
image_width = bytestream_get_le16(&buf_pos);
if(avcodec_check_dimensions(avctx, image_width, image_height))
return -1;
chroma_height = ((image_height >> 2) + 3) & 0x7ffc;
chroma_width = ((image_width >> 2) + 3) & 0x7ffc;
y_offset = bytestream_get_le32(&buf_pos);
v_offset = bytestream_get_le32(&buf_pos);
u_offset = bytestream_get_le32(&buf_pos);
buf_pos += 4;
hdr_pos = buf_pos;
if(data_size == 0x80) return 4;
if(FFMAX3(y_offset, v_offset, u_offset) >= buf_size-16) {
av_log(s->avctx, AV_LOG_ERROR, "y/u/v offset outside buffer\n");
return -1;
if(flags & 0x200) {
s->cur_frame = s->iv_frame + 1;
s->ref_frame = s->iv_frame;
} else {
s->cur_frame = s->iv_frame;
s->ref_frame = s->iv_frame + 1;
buf_pos = buf + 16 + y_offset;
mc_vector_count = bytestream_get_le32(&buf_pos);
if(2LL*mc_vector_count >= buf_size-16-y_offset) {
av_log(s->avctx, AV_LOG_ERROR, "mc_vector_count too large\n");
return -1;
iv_Decode_Chunk(s, s->cur_frame->Ybuf, s->ref_frame->Ybuf, image_width,
image_height, buf_pos + mc_vector_count * 2, cb_offset, hdr_pos, buf_pos,
FFMIN(image_width, 160));
if (!(s->avctx->flags & CODEC_FLAG_GRAY))
{
buf_pos = buf + 16 + v_offset;
mc_vector_count = bytestream_get_le32(&buf_pos);
if(2LL*mc_vector_count >= buf_size-16-v_offset) {
av_log(s->avctx, AV_LOG_ERROR, "mc_vector_count too large\n");
return -1;
iv_Decode_Chunk(s, s->cur_frame->Vbuf, s->ref_frame->Vbuf, chroma_width,
chroma_height, buf_pos + mc_vector_count * 2, cb_offset, hdr_pos, buf_pos,
FFMIN(chroma_width, 40));
buf_pos = buf + 16 + u_offset;
mc_vector_count = bytestream_get_le32(&buf_pos);
if(2LL*mc_vector_count >= buf_size-16-u_offset) {
av_log(s->avctx, AV_LOG_ERROR, "mc_vector_count too large\n");
return -1;
iv_Decode_Chunk(s, s->cur_frame->Ubuf, s->ref_frame->Ubuf, chroma_width,
chroma_height, buf_pos + mc_vector_count * 2, cb_offset, hdr_pos, buf_pos,
FFMIN(chroma_width, 40));
return 8;
| 1threat
|
void helper_set_cp15(CPUState *env, uint32_t insn, uint32_t val)
{
uint32_t op2;
uint32_t crm;
op2 = (insn >> 5) & 7;
crm = insn & 0xf;
switch ((insn >> 16) & 0xf) {
case 0:
if (arm_feature(env, ARM_FEATURE_XSCALE))
break;
if (arm_feature(env, ARM_FEATURE_OMAPCP))
break;
goto bad_reg;
case 1:
if (arm_feature(env, ARM_FEATURE_OMAPCP))
op2 = 0;
switch (op2) {
case 0:
if (!arm_feature(env, ARM_FEATURE_XSCALE) || crm == 0)
env->cp15.c1_sys = val;
tlb_flush(env, 1);
break;
case 1:
if (arm_feature(env, ARM_FEATURE_XSCALE)) {
env->cp15.c1_xscaleauxcr = val;
break;
}
goto bad_reg;
case 2:
if (arm_feature(env, ARM_FEATURE_XSCALE))
goto bad_reg;
env->cp15.c1_coproc = val;
tb_flush(env);
break;
default:
goto bad_reg;
}
break;
case 2:
if (arm_feature(env, ARM_FEATURE_MPU)) {
switch (op2) {
case 0:
env->cp15.c2_data = val;
break;
case 1:
env->cp15.c2_insn = val;
break;
default:
goto bad_reg;
}
} else {
env->cp15.c2_base = val;
}
break;
case 3:
env->cp15.c3 = val;
break;
case 4:
goto bad_reg;
case 5:
if (arm_feature(env, ARM_FEATURE_OMAPCP))
op2 = 0;
switch (op2) {
case 0:
if (arm_feature(env, ARM_FEATURE_MPU))
val = extended_mpu_ap_bits(val);
env->cp15.c5_data = val;
break;
case 1:
if (arm_feature(env, ARM_FEATURE_MPU))
val = extended_mpu_ap_bits(val);
env->cp15.c5_insn = val;
break;
case 2:
if (!arm_feature(env, ARM_FEATURE_MPU))
goto bad_reg;
env->cp15.c5_data = val;
break;
case 3:
if (!arm_feature(env, ARM_FEATURE_MPU))
goto bad_reg;
env->cp15.c5_insn = val;
break;
default:
goto bad_reg;
}
break;
case 6:
if (arm_feature(env, ARM_FEATURE_MPU)) {
if (crm >= 8)
goto bad_reg;
env->cp15.c6_region[crm] = val;
} else {
if (arm_feature(env, ARM_FEATURE_OMAPCP))
op2 = 0;
switch (op2) {
case 0:
env->cp15.c6_data = val;
break;
case 1:
env->cp15.c6_insn = val;
break;
default:
goto bad_reg;
}
}
break;
case 7:
env->cp15.c15_i_max = 0x000;
env->cp15.c15_i_min = 0xff0;
break;
case 8:
switch (op2) {
case 0:
tlb_flush(env, 0);
break;
case 1:
#if 0
val &= 0xfffff000;
tlb_flush_page(env, val);
tlb_flush_page(env, val + 0x400);
tlb_flush_page(env, val + 0x800);
tlb_flush_page(env, val + 0xc00);
#else
tlb_flush(env, 1);
#endif
break;
default:
goto bad_reg;
}
break;
case 9:
if (arm_feature(env, ARM_FEATURE_OMAPCP))
break;
switch (crm) {
case 0:
switch (op2) {
case 0:
env->cp15.c9_data = val;
break;
case 1:
env->cp15.c9_insn = val;
break;
default:
goto bad_reg;
}
break;
case 1:
goto bad_reg;
default:
goto bad_reg;
}
break;
case 10:
break;
case 12:
goto bad_reg;
case 13:
switch (op2) {
case 0:
if (!arm_feature(env, ARM_FEATURE_MPU))
goto bad_reg;
if (env->cp15.c13_fcse != val)
tlb_flush(env, 1);
env->cp15.c13_fcse = val;
break;
case 1:
if (env->cp15.c13_context != val
&& !arm_feature(env, ARM_FEATURE_MPU))
tlb_flush(env, 0);
env->cp15.c13_context = val;
break;
default:
goto bad_reg;
}
break;
case 14:
goto bad_reg;
case 15:
if (arm_feature(env, ARM_FEATURE_XSCALE)) {
if (op2 == 0 && crm == 1) {
if (env->cp15.c15_cpar != (val & 0x3fff)) {
tb_flush(env);
env->cp15.c15_cpar = val & 0x3fff;
}
break;
}
goto bad_reg;
}
if (arm_feature(env, ARM_FEATURE_OMAPCP)) {
switch (crm) {
case 0:
break;
case 1:
env->cp15.c15_ticonfig = val & 0xe7;
env->cp15.c0_cpuid = (val & (1 << 5)) ?
ARM_CPUID_TI915T : ARM_CPUID_TI925T;
break;
case 2:
env->cp15.c15_i_max = val;
break;
case 3:
env->cp15.c15_i_min = val;
break;
case 4:
env->cp15.c15_threadid = val & 0xffff;
break;
case 8:
cpu_interrupt(env, CPU_INTERRUPT_HALT);
break;
default:
goto bad_reg;
}
}
break;
}
return;
bad_reg:
cpu_abort(env, "Unimplemented cp15 register write\n");
}
| 1threat
|
How to organize variable which has connection with two objects : <p>In my code, there is a class Func, which denote a function. The class FuncSet is a collection of some functions in class Func. There are two objects FuncSet set1 and FuncSet set2. </p>
<p>Now I would like to make up a variable which is a 2D matrix and stores the convolution of all functions in set1 and set2. I do not know which is the best way to organize this variable. If I declare it as a member in class FuncSet, this does not make sense in logic since it has some connection between two objects.</p>
<pre><code>// class of function
class Func
{
// calculate convolution of this function and function v
double convolution(const Func & v);
}
// class of set of functions
class FuncSet
{
std::vector<Func> func;
}
// two objects set1 and set2, each of them has some Func objects.
// For example, set1 has 10 functions and set2 has 20 functions
FuncSet set1(10);
FuncSet set2(20);
// calculate convolution of u and v, for all functions u in set1 and all functions v in set2
// it should be a 10*20 double 2D matrix
// where should I store this 2D matrix?
</code></pre>
| 0debug
|
Javascript Generate Array of Hours in the Day Starting with Current Hour : <p>Hi I'm trying to generate an array of every hour of the day. However, I want it to start with the current hour. </p>
<p>For example, </p>
<p><strong>if the current time is 2:00 pm, the array should start:</strong></p>
<p>['1400', '1500', '1600', 1700', '1800', '1900', '2000', '2100', '2200', '2300']</p>
<p><strong>instead of</strong> </p>
<p>['0000', '0100', '0300', '0400', '0500', '0600', '0700', '0800', '0900', '1000', '1100', '1200', '1300', '1400', '1500', '1600', 1700', '1800', '1900', '2000', '2100', '2200', '2300']</p>
| 0debug
|
Why should use Version Control software rather a wordprocessor : <p>A word-processor has most if not all the features of a version control software without the gobbledegook and the complexity. You can set a word-processor to always keep history and probably save as versions every time you save. You could have an online word-processor- if one doesn't exist then it sounds like a great opportunity- with general access to allow multiple users to access it. Git and others are acknowledged to have multiple issues but I can't see a word-processor having big issues so why the preference for version control software? </p>
| 0debug
|
ObjectClass *object_class_dynamic_cast(ObjectClass *class,
const char *typename)
{
TypeImpl *target_type = type_get_by_name(typename);
TypeImpl *type = class->type;
ObjectClass *ret = NULL;
if (type->num_interfaces && type_is_ancestor(target_type, type_interface)) {
int found = 0;
GSList *i;
for (i = class->interfaces; i; i = i->next) {
ObjectClass *target_class = i->data;
if (type_is_ancestor(target_class->type, target_type)) {
ret = target_class;
found++;
}
}
if (found > 1) {
ret = NULL;
}
} else if (type_is_ancestor(type, target_type)) {
ret = class;
}
return ret;
}
| 1threat
|
static void lx_init(const LxBoardDesc *board, MachineState *machine)
{
#ifdef TARGET_WORDS_BIGENDIAN
int be = 1;
#else
int be = 0;
#endif
MemoryRegion *system_memory = get_system_memory();
XtensaCPU *cpu = NULL;
CPUXtensaState *env = NULL;
MemoryRegion *ram, *rom, *system_io;
DriveInfo *dinfo;
pflash_t *flash = NULL;
QemuOpts *machine_opts = qemu_get_machine_opts();
const char *cpu_model = machine->cpu_model;
const char *kernel_filename = qemu_opt_get(machine_opts, "kernel");
const char *kernel_cmdline = qemu_opt_get(machine_opts, "append");
const char *dtb_filename = qemu_opt_get(machine_opts, "dtb");
const char *initrd_filename = qemu_opt_get(machine_opts, "initrd");
int n;
if (!cpu_model) {
cpu_model = XTENSA_DEFAULT_CPU_MODEL;
}
for (n = 0; n < smp_cpus; n++) {
cpu = cpu_xtensa_init(cpu_model);
if (cpu == NULL) {
error_report("unable to find CPU definition '%s'",
cpu_model);
exit(EXIT_FAILURE);
}
env = &cpu->env;
env->sregs[PRID] = n;
qemu_register_reset(lx60_reset, cpu);
cpu_reset(CPU(cpu));
}
ram = g_malloc(sizeof(*ram));
memory_region_init_ram(ram, NULL, "lx60.dram", machine->ram_size,
&error_abort);
vmstate_register_ram_global(ram);
memory_region_add_subregion(system_memory, 0, ram);
system_io = g_malloc(sizeof(*system_io));
memory_region_init_io(system_io, NULL, &lx60_io_ops, NULL, "lx60.io",
224 * 1024 * 1024);
memory_region_add_subregion(system_memory, 0xf0000000, system_io);
lx60_fpga_init(system_io, 0x0d020000);
if (nd_table[0].used) {
lx60_net_init(system_io, 0x0d030000, 0x0d030400, 0x0d800000,
xtensa_get_extint(env, 1), nd_table);
}
if (!serial_hds[0]) {
serial_hds[0] = qemu_chr_new("serial0", "null", NULL);
}
serial_mm_init(system_io, 0x0d050020, 2, xtensa_get_extint(env, 0),
115200, serial_hds[0], DEVICE_NATIVE_ENDIAN);
dinfo = drive_get(IF_PFLASH, 0, 0);
if (dinfo) {
flash = pflash_cfi01_register(board->flash_base,
NULL, "lx60.io.flash", board->flash_size,
blk_by_legacy_dinfo(dinfo),
board->flash_sector_size,
board->flash_size / board->flash_sector_size,
4, 0x0000, 0x0000, 0x0000, 0x0000, be);
if (flash == NULL) {
error_report("unable to mount pflash");
exit(EXIT_FAILURE);
}
}
if (kernel_filename) {
uint32_t entry_point = env->pc;
size_t bp_size = 3 * get_tag_size(0);
uint32_t tagptr = 0xfe000000 + board->sram_size;
uint32_t cur_tagptr;
BpMemInfo memory_location = {
.type = tswap32(MEMORY_TYPE_CONVENTIONAL),
.start = tswap32(0),
.end = tswap32(machine->ram_size),
};
uint32_t lowmem_end = machine->ram_size < 0x08000000 ?
machine->ram_size : 0x08000000;
uint32_t cur_lowmem = QEMU_ALIGN_UP(lowmem_end / 2, 4096);
rom = g_malloc(sizeof(*rom));
memory_region_init_ram(rom, NULL, "lx60.sram", board->sram_size,
&error_abort);
vmstate_register_ram_global(rom);
memory_region_add_subregion(system_memory, 0xfe000000, rom);
if (kernel_cmdline) {
bp_size += get_tag_size(strlen(kernel_cmdline) + 1);
}
if (dtb_filename) {
bp_size += get_tag_size(sizeof(uint32_t));
}
if (initrd_filename) {
bp_size += get_tag_size(sizeof(BpMemInfo));
}
tagptr = (tagptr - bp_size) & ~0xff;
cur_tagptr = put_tag(tagptr, BP_TAG_FIRST, 0, NULL);
cur_tagptr = put_tag(cur_tagptr, BP_TAG_MEMORY,
sizeof(memory_location), &memory_location);
if (kernel_cmdline) {
cur_tagptr = put_tag(cur_tagptr, BP_TAG_COMMAND_LINE,
strlen(kernel_cmdline) + 1, kernel_cmdline);
}
if (dtb_filename) {
int fdt_size;
void *fdt = load_device_tree(dtb_filename, &fdt_size);
uint32_t dtb_addr = tswap32(cur_lowmem);
if (!fdt) {
error_report("could not load DTB '%s'", dtb_filename);
exit(EXIT_FAILURE);
}
cpu_physical_memory_write(cur_lowmem, fdt, fdt_size);
cur_tagptr = put_tag(cur_tagptr, BP_TAG_FDT,
sizeof(dtb_addr), &dtb_addr);
cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + fdt_size, 4096);
}
if (initrd_filename) {
BpMemInfo initrd_location = { 0 };
int initrd_size = load_ramdisk(initrd_filename, cur_lowmem,
lowmem_end - cur_lowmem);
if (initrd_size < 0) {
initrd_size = load_image_targphys(initrd_filename,
cur_lowmem,
lowmem_end - cur_lowmem);
}
if (initrd_size < 0) {
error_report("could not load initrd '%s'", initrd_filename);
exit(EXIT_FAILURE);
}
initrd_location.start = tswap32(cur_lowmem);
initrd_location.end = tswap32(cur_lowmem + initrd_size);
cur_tagptr = put_tag(cur_tagptr, BP_TAG_INITRD,
sizeof(initrd_location), &initrd_location);
cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + initrd_size, 4096);
}
cur_tagptr = put_tag(cur_tagptr, BP_TAG_LAST, 0, NULL);
env->regs[2] = tagptr;
uint64_t elf_entry;
uint64_t elf_lowaddr;
int success = load_elf(kernel_filename, translate_phys_addr, cpu,
&elf_entry, &elf_lowaddr, NULL, be, ELF_MACHINE, 0);
if (success > 0) {
entry_point = elf_entry;
} else {
hwaddr ep;
int is_linux;
success = load_uimage(kernel_filename, &ep, NULL, &is_linux,
translate_phys_addr, cpu);
if (success > 0 && is_linux) {
entry_point = ep;
} else {
error_report("could not load kernel '%s'",
kernel_filename);
exit(EXIT_FAILURE);
}
}
if (entry_point != env->pc) {
static const uint8_t jx_a0[] = {
#ifdef TARGET_WORDS_BIGENDIAN
0x0a, 0, 0,
#else
0xa0, 0, 0,
#endif
};
env->regs[0] = entry_point;
cpu_physical_memory_write(env->pc, jx_a0, sizeof(jx_a0));
}
} else {
if (flash) {
MemoryRegion *flash_mr = pflash_cfi01_get_memory(flash);
MemoryRegion *flash_io = g_malloc(sizeof(*flash_io));
memory_region_init_alias(flash_io, NULL, "lx60.flash",
flash_mr, board->flash_boot_base,
board->flash_size - board->flash_boot_base < 0x02000000 ?
board->flash_size - board->flash_boot_base : 0x02000000);
memory_region_add_subregion(system_memory, 0xfe000000,
flash_io);
}
}
}
| 1threat
|
Unable to Change Icon on Click() : <p>I have this HTML </p>
<pre><code><li><button class="btn-link glyphicon @(I._tp_favourite == 0 ? "glyphicon-heart-empty" : "glyphicon-heart")" style="text-decoration:none;" onclick="Fav(@I._id, @I._tp_favourite)" id="FavButton"></button></li>
</code></pre>
<p>OnClick I trigger this function</p>
<pre><code> function Fav(id,fav) {
var url = '@Url.Action("_Fav", "my")';
$.ajax({
url: url,
type: 'POST',
data: {
id: id,
fav: fav
},
success: function (data) {
$('#FavButton').toggleClass('btn-link glyphicon glyphicon-remove');
alert(data);
},
error: function (jqXHR) { // Http Status is not 200
alert(jqXHR.status);
}
});
};
</code></pre>
<p>This should change the button class to <code>btn-link glyphicon glyphicon-remove</code> But it is not, Do i need to attach an ID with each <code>id="FavButton"</code></p>
<p>Any Ideas</p>
<p>Cheers</p>
| 0debug
|
static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
{
int level, pred, code;
uint16_t *dc_val;
if (n < 4)
code = get_vlc2(&s->gb, dc_lum.table, DC_VLC_BITS, 1);
else
code = get_vlc2(&s->gb, dc_chrom.table, DC_VLC_BITS, 1);
if (code < 0 || code > 9 ){
fprintf(stderr, "illegal dc vlc\n");
return -1;
}
if (code == 0) {
level = 0;
} else {
level = get_xbits(&s->gb, code);
if (code > 8){
if(get_bits1(&s->gb)==0){
if(s->error_resilience>=2){
fprintf(stderr, "dc marker bit missing\n");
return -1;
}
}
}
}
pred = ff_mpeg4_pred_dc(s, n, &dc_val, dir_ptr);
level += pred;
if (level < 0){
if(s->error_resilience>=3){
fprintf(stderr, "dc<0 at %dx%d\n", s->mb_x, s->mb_y);
return -1;
}
level = 0;
}
if (n < 4) {
*dc_val = level * s->y_dc_scale;
} else {
*dc_val = level * s->c_dc_scale;
}
if(s->error_resilience>=3){
if(*dc_val > 2048 + s->y_dc_scale + s->c_dc_scale){
fprintf(stderr, "dc overflow at %dx%d\n", s->mb_x, s->mb_y);
return -1;
}
}
return level;
}
| 1threat
|
How to return different value in Mockito based on parameter attribute? : <p>The class that I test receive a client wrapper:</p>
<p>The tested class (snippest)</p>
<pre><code>private ClientWrapper cw
public Tested(ClientWrapper cw) {
this.cw = cw;
}
public String get(Request request) {
return cw.getClient().get(request);
}
</code></pre>
<p>The test initialization:</p>
<pre><code>ClientWrapper cw = Mockito.mock(ClientWrapper.class);
Client client = Mockito.mock(Client.class);
Mockito.when(cw.getClient()).thenReturn(client);
//Here is where I want to alternate the return value:
Mockito.when(client.get(Mockito.any(Request.class))).thenReturn("100");
</code></pre>
<p>In the exmaple I always return "100", but the Request have an attribute <code>id</code> and I would like to return different values to <code>client.get(Request)</code> based on the <code>request.getId()</code> value.</p>
<p>How can I do it?</p>
| 0debug
|
Change background color of ListTile upon selection in Flutter : <p>I've made a <code>ListView</code> in Flutter, but now I have some <code>ListTiles</code> in this <code>ListView</code> that can be selected. Upon selection, I want the background color to change to a color of my choice. I don't know how to do that.
In <a href="https://docs.flutter.io/flutter/material/ListTileTheme/style.html" rel="noreferrer">the docs</a> they mention that a <code>ListTile</code> has a property <code>style</code>. However, when I try to add that (as in third last line in the code below), this <code>style</code> property gets a squiggly red line underneath and the compiler tells me that <code>The named parameter 'style' isn't defined</code>.</p>
<pre><code>Widget _buildRow(String string){
return new ListTile(
title: new Text(string),
onTap: () => setState(() => toggleSelection(string)),
selected: selectedFriends.contains(string),
style: new ListTileTheme(selectedColor: Colors.white,),
);
}
</code></pre>
| 0debug
|
How do I get a website to change from two columns to one column with responsive design? : <p>I am making a simple web design where, on a web page, the logo and description are in the top right corner. The three images of bottles I have are in the bottom left corner.</p>
<p>I want to make the website responsive, but I want the 2 columns to change to one column when switching to a mobile screen. So on a smaller screen, the logo and description would be on-top of each other (like a hero-display) and the three images directly below it, horizontally aligned. How would I go about doing this?</p>
| 0debug
|
static int nvme_start_ctrl(NvmeCtrl *n)
{
uint32_t page_bits = NVME_CC_MPS(n->bar.cc) + 12;
uint32_t page_size = 1 << page_bits;
if (n->cq[0] || n->sq[0] || !n->bar.asq || !n->bar.acq ||
n->bar.asq & (page_size - 1) || n->bar.acq & (page_size - 1) ||
NVME_CC_MPS(n->bar.cc) < NVME_CAP_MPSMIN(n->bar.cap) ||
NVME_CC_MPS(n->bar.cc) > NVME_CAP_MPSMAX(n->bar.cap) ||
NVME_CC_IOCQES(n->bar.cc) < NVME_CTRL_CQES_MIN(n->id_ctrl.cqes) ||
NVME_CC_IOCQES(n->bar.cc) > NVME_CTRL_CQES_MAX(n->id_ctrl.cqes) ||
NVME_CC_IOSQES(n->bar.cc) < NVME_CTRL_SQES_MIN(n->id_ctrl.sqes) ||
NVME_CC_IOSQES(n->bar.cc) > NVME_CTRL_SQES_MAX(n->id_ctrl.sqes) ||
!NVME_AQA_ASQS(n->bar.aqa) || NVME_AQA_ASQS(n->bar.aqa) > 4095 ||
!NVME_AQA_ACQS(n->bar.aqa) || NVME_AQA_ACQS(n->bar.aqa) > 4095) {
return -1;
}
n->page_bits = page_bits;
n->page_size = page_size;
n->max_prp_ents = n->page_size / sizeof(uint64_t);
n->cqe_size = 1 << NVME_CC_IOCQES(n->bar.cc);
n->sqe_size = 1 << NVME_CC_IOSQES(n->bar.cc);
nvme_init_cq(&n->admin_cq, n, n->bar.acq, 0, 0,
NVME_AQA_ACQS(n->bar.aqa) + 1, 1);
nvme_init_sq(&n->admin_sq, n, n->bar.asq, 0, 0,
NVME_AQA_ASQS(n->bar.aqa) + 1);
return 0;
}
| 1threat
|
How to replace all occurrences of a sub string in kotlin : <p>How to replace a part of a string with something else in Kotlin?</p>
<p>For example, changing "good morning" to "good night" by replacing "morning" with "night"</p>
| 0debug
|
Can't parse my string into a JSON object in javascript : I am working on a parser for a text file. I am trying to parse some strings into JSON objects so I can easily display some different values on a webapp page (using flask). I am passing the strings into my html page using jinja2, and trying to parse them JSON objects in javascript.
<script type="text/javascript">
function parseLine(x){
var obj = JSON.parse(x);
document.write(obj.timestamp1);
}
I am getting this error:
SyntaxError: JSON.parse: expected property name or '}' at line 1 column 2 of the JSON data
in the console browser. I have found many stackoverflow questions with that error, but the suggestions do not fix my problem.
If I use a dummy string, surrounded by single quotes: '{"test": "1234"}' it works fine.
If I need to include anymore information I can.
| 0debug
|
Install mysqldump on Ubuntu 14.04 : <p>I have trouble installing the mysqldump utility on a Ubuntu Server. I tried with <code>apt-get install mysqldump</code> but i get <code>E: Unable to locate package mysqldump</code>. </p>
<p>I tried googling but couldn't find any quality information of the installation of mysqldump. I stumbled upon packages like <code>mysql-client-5.1</code> or thelike that might contain it. </p>
<p>But i am afraid it might somehow clash with the existing mysql installation. As i am no expert to the topic i wasn't able to gain enough information on the client packages, what they contain and if they will interfere. Can somebody help me find the right package and is it on top of mysql so it won't interfere with the current installation?</p>
| 0debug
|
Exception thrown at 0x00000000 in Project3.exe: 0xC0000005: Access violation executing location 0x00000000. occurred : i get this error tring to draw a tringle(?) with opengl i dont know why
glew 2.1.0
glfw3.2.1 win32
iam new and its my first time posing in overflow
#include <gl\glew.h>
#include <GLFW/glfw3.h>
#include <iostream>
using namespace std;
int main(void)
{
GLFWwindow* window;
glewInit();
//if (glewInit != GLEW_OK)
// std::cout << "ew";
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
float poss[6] = {
-0.5, -0.5,
0.0, 0.5,
0.5, -0.5
};
unsigned int buffer;
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(float), poss, GL_STATIC_DRAW);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
glDrawArrays(GL_TRIANGLES, 0, 3);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
if anyone know how plz help me i searched online and i couldnt find a solution even though theres lots facing the same problem guess i just too noob to undersand it indirectly
| 0debug
|
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
| 1threat
|
Jquery Event in JS : <p>I have a script to select form options. How can I change the document ready function to Javascript instead of using Jquery? </p>
<pre><code>$(document).ready(function () {
function FormFill() {
if {
var el1 = document.getElementsByName("FormOption1")[0];
if(typeof el1 !== 'undefined') {el1 = 1;}
var el2 = document.getElementsByName("FormOption2")[0];
if(typeof el2 !== 'undefined') {el2 = 2;}
}, 100);
}
}
setTimeout(FormFill,5000);
});
</code></pre>
| 0debug
|
How to update the mapping in Elasticsearch to change the field datatype and change the type of analyzers in string : <p>While trying to update the mapping I get the following error:</p>
<pre><code>{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"mapper [timestamp] of different type, current_type [string], merged_type [date]"}],"type":"illegal_argument_exception","reason":"
mapper [timestamp] of different type, current_type [string], merged_type [date]"},"status":400}
</code></pre>
<p>I m trying to run the following command on windows</p>
<pre><code> curl -XPUT localhost:9200/logstash-*/_mapping/log?update_all_types -d "{
"properties":
{
"timestamp":
{
"type": "date",
"format": "MM-dd-yyyy HH:mm:ss",
"fielddata":{"loading" : "lazy"} }
}
}";
</code></pre>
<p>How I can change the datatype of date field from string to date type with a particular format.</p>
<p>I tried to change the mapping of a string datatype to change it to <code>eager</code> loading and <code>not_analyzed</code> from analyzed, but it gives the following error:</p>
<pre><code>{"root_cause":[{"type":"illegal_argument_exception","reason":"Mapper for [AppName] conflicts with existing mapping in other types:\n[mapper [AppName] has different [index] values, mapper [App
different [doc_values] values, cannot change from disabled to enabled, mapper [AppName] has different [analyzer]]"}],"type":"illegal_argument_exception","reason":"Mapper for [AppName] conflict with
existing mapping in other types:\n[mapper [AppName] has different [index] values, mapper [AppName] has different [doc_values] values, cannot change from disabled to enabled, mapper [AppName]
rent [analyzer]]"},"status":400}
</code></pre>
<p>Here is my query for the same:</p>
<pre><code> curl -XPUT localhost:9200/logstash-*/_mapping/log?update_all_types -d "{
"properties":
{"AppName":
{
"type": "string",
"index" : "not_analyzed",
"fielddata":{"loading" : "eager"}
}
}
}"
</code></pre>
<p>However, if I change it from <code>not_analyzed</code> to <code>analyzed</code> it gives a <code>acknowledged=true</code> message. How can I change the analyzer. </p>
| 0debug
|
How do I disable the border on bootstrap 4 cards : <p>A grey outline keeps appearing on the img section of my bootstrap card, which I would like to remove.
<a href="https://i.stack.imgur.com/sIpIR.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sIpIR.png" alt="Bootstrap card"></a></p>
<pre><code> <!-- Card deck -->
<div class="card-deck">
<!-- Card -->
<div class="col-md-6 col-lg-4 col-xl-3">
<div class="card mb-4">
<!--Card image-->
<div class="view overlay"><img alt="Work eyewear" class="card-img-top img-fluid" src="img/clothing-1.jpg"></div><!--Card content-->
<div class="card-body">
<!--Title-->
<h4 class="card-title">PPE</h4><!--Text-->
<p class="card-text">PPE is equipment that will protect the user against health or safety risks at work...</p><!-- Provides extra visual weight and identifies the primary action in a set of buttons -->
<a class="" href="https://shop.spartansafety.co.uk/personal-protection-s/1820.htm">SHOP NOW <i class="fas fa-arrow-right fa-xs"></i></a>
</div>
</div>
</div><!-- Card -->
</code></pre>
| 0debug
|
Can git be made to mostly auto-merge XML order-insensitive files? : <p>When merging Lightswitch branches, often colleagues will add properties to an entity I also modified, which will result in a merge conflict, as the new XML entries are added to the same positions in the lsml file.</p>
<p>I can effectively always solve these by accepting left and right in no particular order, so one goes above the other, as order isn't important in these particular instances. On the rare instances this isn't valid, this would produce an error in the project anyway, which I accept as a risk (but haven't encountered).</p>
<p>Is there a way (preferably for the file extension) to get git to automatically accept source and target changes for the same position and simply place one beneath the other?</p>
| 0debug
|
How close the connection PDO PHP? : <p>I'm trying to close the connection in my class and I wonder if it is correct.</p>
<p>My public function disconnect(); close connection.</p>
<p>Class Connection:</p>
<pre><code><?php
class Connection{
private static $instance;
public static function getInstance(){
if (!isset(self::$instance)) {
try {
self::$instance = new PDO(DB_DRIVE . ':host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS);
self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
self::$instance->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
} catch (PDOException $exception) {
echo $exception->getMessage();
}
}
return self::$instance;
}
public static function prepare($sql){
return self::getInstance()->prepare($sql);
}
public static function lastInsertId($sql){
return self::getInstance()->lastInsertId($sql);
}
public function disconnect(){
return self::$instance = null;
}
}
</code></pre>
<p>I use so in my script after execution:</p>
<pre><code><?php
$connectionDb = new Connection();
$connectionDb->disconnect();
</code></pre>
<p>Is correct?</p>
| 0debug
|
static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap)
{
OggContext *context = avfcontext->priv_data;
ogg_packet op ;
char *buf ;
ogg_page og ;
AVStream *ast ;
AVCodecContext *codec;
uint8_t *p;
int i;
ogg_sync_init(&context->oy) ;
buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ;
if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0)
return AVERROR_IO ;
ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ;
ogg_sync_pageout(&context->oy, &og) ;
ogg_stream_init(&context->os, ogg_page_serialno(&og)) ;
ogg_stream_pagein(&context->os, &og) ;
ast = av_new_stream(avfcontext, 0) ;
if(!ast)
return AVERROR_NOMEM ;
av_set_pts_info(ast, 60, 1, AV_TIME_BASE);
codec= &ast->codec;
codec->codec_type = CODEC_TYPE_AUDIO;
codec->codec_id = CODEC_ID_VORBIS;
for(i=0; i<3; i++){
if(next_packet(avfcontext, &op)){
}
codec->extradata_size+= 2 + op.bytes;
codec->extradata= av_realloc(codec->extradata, codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
p= codec->extradata + codec->extradata_size - 2 - op.bytes;
*(p++)= op.bytes>>8;
*(p++)= op.bytes&0xFF;
memcpy(p, op.packet, op.bytes);
}
return 0 ;
}
| 1threat
|
Swift Remove Object from Realm : <p>I have Realm Object that save list from the JSON Response. But now i need to remove the object if the object is not on the list again from JSON. How i do that?
This is my init for realm</p>
<pre><code>func listItems (dic : Array<[String:AnyObject]>) -> Array<Items> {
let items : NSMutableArray = NSMutableArray()
let realm = try! Realm()
for itemDic in dic {
let item = Items.init(item: itemDic)
try! realm.write {
realm.add(item, update: true)
}
items.addObject(item)
}
return NSArray(items) as! Array<Items>
}
</code></pre>
| 0debug
|
PATCH and PUT Request Does not Working with form-data : <p>I am using Laravel to create a RESTFUL application and I test the application with Postman. Currently, there is an issue for <code>PATCH</code> or <code>PUT</code> if the data sent from Postman with form-data.</p>
<pre><code>// Parameter `{testimonial}` will be sent to backend.
Route::post ('testimonials/{testimonial}', 'TestimonialController@update');
// Parameter `{testimonial}` will not be sent to backend (`$request->all()` will be empty) if sent from Postman with form-data.
Route::patch ('testimonials/{testimonial}', 'TestimonialController@update');
Route::put ('testimonials/{testimonial}', 'TestimonialController@update');
</code></pre>
<ul>
<li>Using form-data, <code>$request->all()</code> will be okay for <code>POST</code>.</li>
<li>Using x-www-form-urlencoded, <code>$request->all()</code> will be okay for <code>PATCH</code>, <code>PUT</code>, and <code>POST</code>.</li>
<li>However, if I am sending <code>PUT</code> and <code>PATCH</code> with form-data from Postman, the <code>$request->all()</code> will be empty (the parameters will not be sent to backend).</li>
</ul>
<p>Right now the solution is to use <code>POST</code> for updating a model. I want to know why <code>PATCH</code> and <code>PUT</code> is not working when sent with form-data from Postman.</p>
| 0debug
|
Python Tuple in Java XMLRPC : <p>I'm trying to pass python tuple over java xmlrpc. Here is library what I'm using:
<a href="https://github.com/gturri/aXMLRPC" rel="noreferrer">XMLPRC Java Libray</a></p>
<p>I'm using odoo framework on server and <a href="https://www.odoo.com/documentation/10.0/api_integration.html" rel="noreferrer">api</a>. I want to pass argument which will looks like:</p>
<p><strong>[(4,7),(4,8)]</strong></p>
<p>I'm able to pass following structure:</p>
<p><strong>[[4,7],[4,8]]</strong></p>
<p>which is clearly array inside array like:</p>
<pre><code>new Object[]{new Object[]{4,7},new Object[]{4,8}}
</code></pre>
<p>The problem is there is no tuple in java. What I absorb is how to transform this structure:</p>
<p><strong><em>This [4,8] to This(4,8)</em></strong></p>
<p>It is some kind of serialization issue what don't know how to resolve it and pass expected python structure.</p>
| 0debug
|
How to disable spell checking in Sublime Text 3? : <p>I tried the following settings, but all it did was make things progressively worse.</p>
<pre><code>"spell_check": false,
"dictionary": "",
"spelling_selector": "",
</code></pre>
<p>I don't understand the default value of <code>spelling_selector</code>, but maybe that's the key?</p>
| 0debug
|
void qemu_mutex_lock(QemuMutex *mutex)
{
EnterCriticalSection(&mutex->lock);
assert(mutex->owner == 0);
mutex->owner = GetCurrentThreadId();
}
| 1threat
|
long do_rt_sigreturn(CPUPPCState *env)
{
struct target_rt_sigframe *rt_sf = NULL;
target_ulong rt_sf_addr;
rt_sf_addr = env->gpr[1] + SIGNAL_FRAMESIZE + 16;
if (!lock_user_struct(VERIFY_READ, rt_sf, rt_sf_addr, 1))
goto sigsegv;
if (do_setcontext(&rt_sf->uc, env, 1))
goto sigsegv;
do_sigaltstack(rt_sf_addr
+ offsetof(struct target_rt_sigframe, uc.tuc_stack),
0, env->gpr[1]);
unlock_user_struct(rt_sf, rt_sf_addr, 1);
return -TARGET_QEMU_ESIGRETURN;
sigsegv:
unlock_user_struct(rt_sf, rt_sf_addr, 1);
force_sig(TARGET_SIGSEGV);
return 0;
}
| 1threat
|
Sorting an Vector of Objekts : I am new at C++. I want to sort an Vector "Konten" of type vector Konto.
I've searched for a soulution but when i try to compile my code i get the error message:
Fehler C2678 Binärer Operator "=": Es konnte kein Operator gefunden werden, der einen linksseitigen Operanden vom Typ "const Konto" akzeptiert (oder keine geeignete Konvertierung möglich) c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.15.26726\include\algorithm 3835
```C++
//KontenManager.h
#pragma once
#include "Konto.h"
#include <vector>
class Kontenmanager
{
private:
vector<Konto> Konten;
public:
Kontenmanager();
~Kontenmanager();
string getKontenListe() const;
};
//Kontenmanager.cpp
#include "pch.h"
#include "Kontenmanager.h"
#include <sstream>
#include <algorithm>
#include <iomanip>
Kontenmanager::Kontenmanager()
{
}
Kontenmanager::~Kontenmanager()
{
}
string Kontenmanager::getKontenListe() const
{
stringstream out;
sort(Konten.begin(), Konten.end());
//do some stuff
}
//Konto.h
#pragma once
#include <string>
using namespace std;
class Konto
{
private:
const int kontoNr;
double saldo;
string inhaber;
int pin;
public:
Konto(int Kontonummer, string inhaber, int pin);
~Konto();
int getKontonummer() const;
};
bool operator<(const Konto &k1, const Konto &k2);
bool operator==(const Konto &k1, const Konto &k2);
//Konto.cpp
#include "pch.h"
#include "Konto.h"
Konto::Konto(int Kontonummer, string inhaber, int pin) :kontoNr(Kontonummer)
{
this->inhaber = inhaber;
this->pin = pin;
this->saldo = 0.0;
}
Konto::~Konto()
{
}
int Konto::getKontonummer() const
{
return kontoNr;
}
bool operator<(const Konto &k1, const Konto &k2)
{
return k1.getKontonummer() < k2.getKontonummer();
}
bool operator==(const Konto &k1, const Konto &k2)
{
return k1.getKontonummer() == k2.getKontonummer();
}
```
| 0debug
|
static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val)
{
static const S390Opcode ni_insns[4] = {
RI_NILL, RI_NILH, RI_NIHL, RI_NIHH
};
static const S390Opcode nif_insns[2] = {
RIL_NILF, RIL_NIHF
};
uint64_t valid = (type == TCG_TYPE_I32 ? 0xffffffffull : -1ull);
int i;
if ((val & valid) == 0xffffffff) {
tgen_ext32u(s, dest, dest);
return;
}
if (facilities & FACILITY_EXT_IMM) {
if ((val & valid) == 0xff) {
tgen_ext8u(s, TCG_TYPE_I64, dest, dest);
return;
}
if ((val & valid) == 0xffff) {
tgen_ext16u(s, TCG_TYPE_I64, dest, dest);
return;
}
}
for (i = 0; i < 4; i++) {
tcg_target_ulong mask = ~(0xffffull << i*16);
if (((val | ~valid) & mask) == mask) {
tcg_out_insn_RI(s, ni_insns[i], dest, val >> i*16);
return;
}
}
if (facilities & FACILITY_EXT_IMM) {
for (i = 0; i < 2; i++) {
tcg_target_ulong mask = ~(0xffffffffull << i*32);
if (((val | ~valid) & mask) == mask) {
tcg_out_insn_RIL(s, nif_insns[i], dest, val >> i*32);
return;
}
}
}
if ((facilities & FACILITY_GEN_INST_EXT) && risbg_mask(val)) {
tgen_andi_risbg(s, dest, dest, val);
return;
}
tcg_out_movi(s, type, TCG_TMP0, val);
if (type == TCG_TYPE_I32) {
tcg_out_insn(s, RR, NR, dest, TCG_TMP0);
} else {
tcg_out_insn(s, RRE, NGR, dest, TCG_TMP0);
}
}
| 1threat
|
static char *sysbus_get_fw_dev_path(DeviceState *dev)
{
SysBusDevice *s = sysbus_from_qdev(dev);
char path[40];
int off;
off = snprintf(path, sizeof(path), "%s", qdev_fw_name(dev));
if (s->num_mmio) {
snprintf(path + off, sizeof(path) - off, "@"TARGET_FMT_plx,
s->mmio[0].addr);
} else if (s->num_pio) {
snprintf(path + off, sizeof(path) - off, "@i%04x", s->pio[0]);
}
return strdup(path);
}
| 1threat
|
how can i rebuild npm modules in angular? : <p>I have some changes in one of my <strong>npm modules</strong> in my angular project but it has no effect in my build version.</p>
<p>can anyone help me?</p>
| 0debug
|
Android Application Craches on version 6 (Marshmallow) : I am building an Android Application with API 23. But on Marshmallow my app gets crashed as it launches. The error message I got is as follows:
E/DropboxRealtime: null InputStream java.io.IOException: null InputStream
at xjr.a(:com.google.android.gms:187)
at xjr.b(:com.google.android.gms:131)
at xiw.a(:com.google.android.gms:88)
at com.google.android.gms.stats.service.DropBoxEntryAddedChimeraService.onHandleIntent(:com.google.android.gms:1180)
at bhe.handleMessage(:com.google.android.gms:65) at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.os.HandlerThread.run(HandlerThread.java:61)
Please assist me to resolve this problem asap.
| 0debug
|
Need help pivot columns to rows sql server with count : This is what I am trying to achieve in SQL server but no luck.
I have table as below
ID Start Dt End Dt Count
1 3/1/2016 6/1/2016 3
This is what I need, If Count column is 3 then I need to generate three rows
ID Start Dt End Dt Count
1 3/1/2016 4/1/2016 1
1 4/1/2016 5/1/2016 1
1 5/1/2016 6/1/2016 1
Appreciate your help..
| 0debug
|
static int blk_root_inactivate(BdrvChild *child)
{
BlockBackend *blk = child->opaque;
if (blk->disable_perm) {
return 0;
}
if (!blk->dev && !blk->name[0]) {
return -EPERM;
}
blk->disable_perm = true;
if (blk->root) {
bdrv_child_try_set_perm(blk->root, 0, BLK_PERM_ALL, &error_abort);
}
return 0;
}
| 1threat
|
static void update_pam(PCII440FXState *d, uint32_t start, uint32_t end, int r,
PAMMemoryRegion *mem)
{
if (mem->initialized) {
memory_region_del_subregion(d->system_memory, &mem->mem);
memory_region_destroy(&mem->mem);
}
switch(r) {
case 3:
memory_region_init_alias(&mem->mem, "pam-ram", d->ram_memory,
start, end - start);
break;
case 1:
memory_region_init_alias(&mem->mem, "pam-rom", d->ram_memory,
start, end - start);
memory_region_set_readonly(&mem->mem, true);
break;
case 2:
case 0:
memory_region_init_alias(&mem->mem, "pam-pci", d->pci_address_space,
start, end - start);
break;
}
memory_region_add_subregion_overlap(d->system_memory,
start, &mem->mem, 1);
mem->initialized = true;
}
| 1threat
|
AVFilter *avfilter_get_by_name(const char *name)
{
int i;
for (i = 0; registered_avfilters[i]; i++)
if (!strcmp(registered_avfilters[i]->name, name))
return registered_avfilters[i];
return NULL;
}
| 1threat
|
BusState *qdev_get_child_bus(DeviceState *dev, const char *name)
{
BusState *bus;
LIST_FOREACH(bus, &dev->child_bus, sibling) {
if (strcmp(name, bus->name) == 0) {
return bus;
}
}
return NULL;
}
| 1threat
|
static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
{
AVDictionary **meta_in = NULL;
AVDictionary **meta_out;
int i, ret = 0;
char type_in, type_out;
const char *istream_spec = NULL, *ostream_spec = NULL;
int idx_in = 0, idx_out = 0;
parse_meta_type(inspec, &type_in, &idx_in, &istream_spec);
parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);
if (type_in == 'g' || type_out == 'g')
o->metadata_global_manual = 1;
if (type_in == 's' || type_out == 's')
o->metadata_streams_manual = 1;
if (type_in == 'c' || type_out == 'c')
o->metadata_chapters_manual = 1;
#define METADATA_CHECK_INDEX(index, nb_elems, desc)\
if ((index) < 0 || (index) >= (nb_elems)) {\
av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\n",\
(desc), (index));\
exit_program(1);\
}
#define SET_DICT(type, meta, context, index)\
switch (type) {\
case 'g':\
meta = &context->metadata;\
break;\
case 'c':\
METADATA_CHECK_INDEX(index, context->nb_chapters, "chapter")\
meta = &context->chapters[index]->metadata;\
break;\
case 'p':\
METADATA_CHECK_INDEX(index, context->nb_programs, "program")\
meta = &context->programs[index]->metadata;\
break;\
}\
SET_DICT(type_in, meta_in, ic, idx_in);
SET_DICT(type_out, meta_out, oc, idx_out);
if (type_in == 's') {
for (i = 0; i < ic->nb_streams; i++) {
if ((ret = check_stream_specifier(ic, ic->streams[i], istream_spec)) > 0) {
meta_in = &ic->streams[i]->metadata;
break;
} else if (ret < 0)
exit_program(1);
}
if (!meta_in) {
av_log(NULL, AV_LOG_FATAL, "Stream specifier %s does not match any streams.\n", istream_spec);
exit_program(1);
}
}
if (type_out == 's') {
for (i = 0; i < oc->nb_streams; i++) {
if ((ret = check_stream_specifier(oc, oc->streams[i], ostream_spec)) > 0) {
meta_out = &oc->streams[i]->metadata;
av_dict_copy(meta_out, *meta_in, AV_DICT_DONT_OVERWRITE);
} else if (ret < 0)
exit_program(1);
}
} else
av_dict_copy(meta_out, *meta_in, AV_DICT_DONT_OVERWRITE);
return 0;
}
| 1threat
|
What is the meaning of Event consumes in JavaFX : <p>I was trying to understand <a href="http://docs.oracle.com/javase/8/javafx/events-tutorial/processing.htm#CEGJCICG" rel="noreferrer">Event Handling in JavaFX</a> and there I found this line.</p>
<blockquote>
<p>The route can be modified as event filters and event handlers along
the route process the event. Also, if an event filter or event handler
consumes the event at any point, some nodes on the initial route might
not receive the event.</p>
</blockquote>
<p>Can you explain what is the meaning of event consumes?</p>
| 0debug
|
static ssize_t qio_channel_websock_writev(QIOChannel *ioc,
const struct iovec *iov,
size_t niov,
int *fds,
size_t nfds,
Error **errp)
{
QIOChannelWebsock *wioc = QIO_CHANNEL_WEBSOCK(ioc);
size_t i;
ssize_t done = 0;
ssize_t ret;
if (wioc->io_err) {
*errp = error_copy(wioc->io_err);
return -1;
}
if (wioc->io_eof) {
error_setg(errp, "%s", "Broken pipe");
return -1;
}
for (i = 0; i < niov; i++) {
size_t want = iov[i].iov_len;
if ((want + wioc->rawoutput.offset) > QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
want = (QIO_CHANNEL_WEBSOCK_MAX_BUFFER - wioc->rawoutput.offset);
}
if (want == 0) {
goto done;
}
buffer_reserve(&wioc->rawoutput, want);
buffer_append(&wioc->rawoutput, iov[i].iov_base, want);
done += want;
if (want < iov[i].iov_len) {
break;
}
}
done:
ret = qio_channel_websock_write_wire(wioc, errp);
if (ret < 0 &&
ret != QIO_CHANNEL_ERR_BLOCK) {
qio_channel_websock_unset_watch(wioc);
return -1;
}
qio_channel_websock_set_watch(wioc);
if (done == 0) {
return QIO_CHANNEL_ERR_BLOCK;
}
return done;
}
| 1threat
|
What are "Ambient Typings" in the Typescript Typings tool? : <p>I hear the term "ambient" used to describe type definitions downloaded with the <a href="https://github.com/typings/typings">typings</a> tool. What does that mean, though?</p>
<p>I can't seem to find a straightforward definition of it or the <code>--ambient</code> flag.</p>
| 0debug
|
query sum two Different table : [enter image description here][1]
[1]: https://i.stack.imgur.com/bZDlo.jpg
i have two different
ork3 ork2
k3 k1 k11 k1
1 a 2 a
4 b 3 b
5 c 4 c
3 a 7 a
3 a
1 b
k1 sum(k3) sum(k11) (sumk3-sumk11)
a 11 4 7
b 4 4 0
c 4 5 -1
i want value null in sum(sumk3-sumk11) not appear in query
| 0debug
|
Android Studio: Gradle sync failed: Could not HEAD '...'. Received status code 502 from server: Bad Gateway : <p>After update Android Studio to latest version (3.1) and gradle version in my project I get an error (the link is always different):</p>
<pre><code>12:54 Gradle sync started
12:56 Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/com/android/tools/analytics-library/shared/26.1.0/shared-26.1.0.jar'. Received status code 502 from server: Bad Gateway Consult IDE log for more details (Help | Show Log) (1m 56s 602ms)
12:56 Gradle sync started
12:57 Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/org/codehaus/mojo/animal-sniffer-parent/1.14/animal-sniffer-parent-1.14.pom'. Received status code 502 from server: Bad Gateway Consult IDE log for more details (Help | Show Log) (1m 4s 266ms)
12:58 Gradle sync started
12:59 Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/com/sun/activation/all/1.2.0/all-1.2.0.pom'. Received status code 502 from server: Bad Gateway Consult IDE log for more details (Help | Show Log) (1m 29s 985ms)
13:01 Gradle sync started
13:02 Gradle sync failed: Could not HEAD 'https://jcenter.bintray.com/com/sun/activation/javax.activation/1.2.0/javax.activation-1.2.0.pom'. Received status code 502 from server: Bad Gateway Consult IDE log for more details (Help | Show Log) (4s 976ms)
</code></pre>
<p>Android Studio version:</p>
<pre><code>Android Studio 3.1
Build #AI-173.4670197, built on March 22, 2018
JRE: 1.8.0_152-release-1024-b02 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
</code></pre>
<p>I already tried clean rebuild and update gradle, restart Android Studio and PC, but without success. Any ideas?</p>
<p>PS: of course I have internet. Also, if you open a link in the browser - the file is downloaded.</p>
| 0debug
|
why my android name has a erro in manifest layout? :
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ContentView"
android:label="@string/title_activity_content_view" >
</activity>
</application>
</manifest>
i have problem and RED error in android name (.ContenView & MainActivity)
how can i fix it?
i have Unfortunately when run program
| 0debug
|
Facebook Messenger Bot - How to disable bot and allow human to chat : <p>so this is something I've been trying to think through for about 16 hours. I am coding with PHP / CuRl / etc - the bot works and everything is fine. My current issue is figuring out how to disable the bot and allow a human to begin chatting with the customer/sender.</p>
<p>Has anyone successfully, created a route for this ? I mean it's pretty hard from what I see, you'd have to disable etc etc. A lot of effort for my clients.</p>
<p>Thanks for any input.</p>
| 0debug
|
Find last iteration of foreach loop in laravel blade : <p>In blade template i use last() method to find last iteration of foreach loop:</p>
<pre><code>@foreach ($colors as $k => $v)
<option value={!! $v->id !!} {{ $colors->last()->id==$v->id ? 'selected':'' }} > {!! $v->name !!} </option>
@endforeach
</code></pre>
<p>Is it ok? Perhaps there is a Laravel-style way to do the same?</p>
| 0debug
|
Share article from webapp to native facebook : <p>If I want to share some string from a mobile web page, is there any way to launch user's native facebook app to share ?</p>
| 0debug
|
static int vp3_decode_init(AVCodecContext *avctx)
{
Vp3DecodeContext *s = avctx->priv_data;
int i;
s->avctx = avctx;
s->width = avctx->width;
s->height = avctx->height;
avctx->pix_fmt = PIX_FMT_YUV420P;
avctx->has_b_frames = 0;
dsputil_init(&s->dsp, avctx);
s->quality_index = -1;
s->superblock_width = (s->width + 31) / 32;
s->superblock_height = (s->height + 31) / 32;
s->superblock_count = s->superblock_width * s->superblock_height * 3 / 2;
s->u_superblock_start = s->superblock_width * s->superblock_height;
s->v_superblock_start = s->superblock_width * s->superblock_height * 5 / 4;
s->superblock_coding = av_malloc(s->superblock_count);
s->macroblock_width = (s->width + 15) / 16;
s->macroblock_height = (s->height + 15) / 16;
s->macroblock_count = s->macroblock_width * s->macroblock_height;
s->fragment_width = s->width / FRAGMENT_PIXELS;
s->fragment_height = s->height / FRAGMENT_PIXELS;
s->fragment_count = s->fragment_width * s->fragment_height * 3 / 2;
s->u_fragment_start = s->fragment_width * s->fragment_height;
s->v_fragment_start = s->fragment_width * s->fragment_height * 5 / 4;
debug_init(" width: %d x %d\n", s->width, s->height);
debug_init(" superblocks: %d x %d, %d total\n",
s->superblock_width, s->superblock_height, s->superblock_count);
debug_init(" macroblocks: %d x %d, %d total\n",
s->macroblock_width, s->macroblock_height, s->macroblock_count);
debug_init(" %d fragments, %d x %d, u starts @ %d, v starts @ %d\n",
s->fragment_count,
s->fragment_width,
s->fragment_height,
s->u_fragment_start,
s->v_fragment_start);
s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment));
s->coded_fragment_list = av_malloc(s->fragment_count * sizeof(int));
s->pixel_addresses_inited = 0;
for (i = 0; i < 16; i++) {
init_vlc(&s->dc_vlc[i], 5, 32,
&dc_bias[i][0][1], 4, 2,
&dc_bias[i][0][0], 4, 2);
init_vlc(&s->ac_vlc_1[i], 5, 32,
&ac_bias_0[i][0][1], 4, 2,
&ac_bias_0[i][0][0], 4, 2);
init_vlc(&s->ac_vlc_2[i], 5, 32,
&ac_bias_1[i][0][1], 4, 2,
&ac_bias_1[i][0][0], 4, 2);
init_vlc(&s->ac_vlc_3[i], 5, 32,
&ac_bias_2[i][0][1], 4, 2,
&ac_bias_2[i][0][0], 4, 2);
init_vlc(&s->ac_vlc_4[i], 5, 32,
&ac_bias_3[i][0][1], 4, 2,
&ac_bias_3[i][0][0], 4, 2);
}
for (i = 0; i < 64; i++)
quant_index[dequant_index[i]] = i;
s->superblock_fragments = av_malloc(s->superblock_count * 16 * sizeof(int));
s->superblock_macroblocks = av_malloc(s->superblock_count * 4 * sizeof(int));
s->macroblock_fragments = av_malloc(s->macroblock_count * 6 * sizeof(int));
s->macroblock_coded = av_malloc(s->macroblock_count + 1);
init_block_mapping(s);
if(avctx->get_buffer(avctx, &s->golden_frame) < 0) {
printf("vp3: get_buffer() failed\n");
return -1;
}
return 0;
}
| 1threat
|
def maximum_Sum(list1):
maxi = -100000
for x in list1:
sum = 0
for y in x:
sum+= y
maxi = max(sum,maxi)
return maxi
| 0debug
|
How to make page redirect using javascript : I want to redirect the html page to another html page and link that html page to
text editor. if i change the text in text editor i want that changes in redirected html page by using java script
| 0debug
|
Failed to create the host-only adapter - windows 10, docker, virtualbox : <p>I've recently run into this problem after having used docker toolbox without a problem for a while.</p>
<p>Started happening after windows update?</p>
<p>Windows 10 Home - 64</p>
<p>Uninstalled and reinstalled Docker toolbox</p>
<p>Uninstalled and reinstalled various versions of VirtualBox</p>
<p>Still get the same error</p>
<pre><code>Running pre-create checks...
Creating machine...
(default) Copying C:\Users\me\.docker\machine\cache\boot2docker.iso to C:\Users\me\.docker\machine\machines\default\boot2docker.iso...
(default) Creating VirtualBox VM...
(default) Creating SSH key...
(default) Starting the VM...
(default) Check network to re-create if needed...
(default) Windows might ask for the permission to create a network adapter. Sometimes, such confirmation window is minimized in the taskbar.
(default) Creating a new host-only adapter produced an error: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe hostonlyif create failed:
(default) 0%...
(default) Progress state: E_FAIL
(default) VBoxManage.exe: error: Failed to create the host-only adapter
(default) VBoxManage.exe: error: Querying NetCfgInstanceId failed (0x00000002)
(default) VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
(default) VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreate(struct HandlerArg *)" at line 71 of file VBoxManageHostonly.cpp
(default)
(default) This is a known VirtualBox bug. Let's try to recover anyway...
Error creating machine: Error in driver during machine creation: Error setting up host only network on machine start: The host-only adapter we just created is not visible. This is a well known VirtualBox bug. You might want to uninstall it and reinstall at least version 5.0.12 that is is supposed to fix this issue
Looks like something went wrong in step ´Checking if machine default exists´... Press any key to continue...
</code></pre>
| 0debug
|
void page_set_flags(target_ulong start, target_ulong end, int flags)
{
target_ulong addr, len;
#if TARGET_ABI_BITS > L1_MAP_ADDR_SPACE_BITS
assert(end < ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS));
#endif
assert(start < end);
assert_memory_lock();
start = start & TARGET_PAGE_MASK;
end = TARGET_PAGE_ALIGN(end);
if (flags & PAGE_WRITE) {
flags |= PAGE_WRITE_ORG;
}
for (addr = start, len = end - start;
len != 0;
len -= TARGET_PAGE_SIZE, addr += TARGET_PAGE_SIZE) {
PageDesc *p = page_find_alloc(addr >> TARGET_PAGE_BITS, 1);
if (!(p->flags & PAGE_WRITE) &&
(flags & PAGE_WRITE) &&
p->first_tb) {
tb_invalidate_phys_page(addr, 0);
}
p->flags = flags;
}
}
| 1threat
|
Please explain the output to this code: : <pre><code>#include<stdio.h>
void main()
{
if(0xA)
if(052)
if('\xeb')
if('\012') //what do the above 3 statements mean?
printf("Hello World!")
else;
else;
else;
else;
}
</code></pre>
<p>Output:
Hello World!</p>
<p>so here, what is the meaning of 052, \xeb and \012?
And what is the significance of the multiple else statements?</p>
| 0debug
|
static BlockDriverAIOCB *qcow_aio_readv(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque)
{
QCowAIOCB *acb;
acb = qemu_aio_get(bs, cb, opaque);
if (!acb)
return NULL;
acb->hd_aiocb = NULL;
acb->sector_num = sector_num;
acb->qiov = qiov;
if (qiov->niov > 1)
acb->buf = acb->orig_buf = qemu_memalign(512, qiov->size);
else
acb->buf = (uint8_t *)qiov->iov->iov_base;
acb->nb_sectors = nb_sectors;
acb->n = 0;
acb->cluster_offset = 0;
qcow_aio_read_cb(acb, 0);
return &acb->common;
}
| 1threat
|
Can someone help me solve this syntax error? : <p>Hi I am trying the code below on a php page. I keep getting syntax error due to the single quotes around the parameter 'London' of the function openCity() shown below.</p>
<pre><code>echo '<button class="tablinks" onclick="openCity(event, 'London')">London</button>';
</code></pre>
<p>If I remove the single quotes covering 'London' and add double quotes there, the function doesn't work as expected. What am I not seeing? Is there a way to fix this?</p>
<p>The openCity() javacript function is shown below.</p>
<pre><code>function openCity(evt, cityName) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(cityName).style.display = "block";
evt.currentTarget.className += " active";
'''
What I am trying to do is when a user clicks the button, it shows a block of elements (Like a tabs).
</code></pre>
| 0debug
|
How to fix button clicked not updating but others do : <p>I'm making a math game. Every time I click a button a new question should appear with different results to choose from.</p>
<p>However every time I click the button which I think is the result it doesn't update the text but the others do.</p>
<p>See github: <a href="https://github.com/Combii/BrainTrainerSwift" rel="nofollow noreferrer">https://github.com/Combii/BrainTrainerSwift</a></p>
<p><a href="https://i.stack.imgur.com/XjnqB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XjnqB.png" alt="enter image description here"></a></p>
| 0debug
|
How much entities has Stackoverflow? : I'm studying Computer Engineering and this year my second-rate . and i decide to make this site's ER diagrams. so, I can't know how many entities are has this site ?
| 0debug
|
there is an error after open directory in python, can someone help me fix this problem? : import os
import time
import send2trash
import datetime
from tkinter import filedialog
from tkinter import *
import tkinter as tk
root = tk.Tk()
date = input("Enter your date: ")
date1 = time.strptime(date, '%Y-%m-%d')
date2 = time.mktime(date1)
dirname = filedialog.askdirectory(parent=root,initialdir="/",title='Please select a directory')
for f in os.listdir(dirname):
modified_time = os.path.getmtime(f)
if modified_time < date2:
send2trash.send2trash(f)
and there is an error: can someone help me to fix this error, thanks
[enter image description here][1]
[1]: https://i.stack.imgur.com/DlnL4.png
| 0debug
|
int av_opt_set_dict(void *obj, AVDictionary **options)
{
AVDictionaryEntry *t = NULL;
AVDictionary *tmp = NULL;
int ret = 0;
while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
ret = av_opt_set(obj, t->key, t->value, 0);
if (ret == AVERROR_OPTION_NOT_FOUND)
av_dict_set(&tmp, t->key, t->value, 0);
else if (ret < 0) {
av_log(obj, AV_LOG_ERROR, "Error setting option %s to value %s.\n", t->key, t->value);
break;
}
ret = 0;
}
av_dict_free(options);
*options = tmp;
return ret;
}
| 1threat
|
Regular Expression to find all except digits and decimals : <p>the regular express <code>/\D/g</code> identifies all non numeric characters and the following code will replace the letter 'q' and decimal '.' in <code>str</code> and result in <code>10025</code></p>
<pre><code> var str = "10q0.25";
var result = str.replace(/\D/g, '');
</code></pre>
<p>How can the regex be changed so as to allow the decimal point also and resulting in <code>100.25</code> ?</p>
| 0debug
|
How to check if app user is in Google Play Beta Testing : <p>I understand that the Google Play Beta feature allows me to distribute APKs to a closed user group, but I also need to be able to verify if the people logging in after download using Google Login are also in the beta program of my app, in order to make sure that the APK isnt distributed & used without my knowledge.</p>
<p>Is there any way to check if a Google Login user is participating in beta testing with OpenID Connect or similar technologies?</p>
<p>Thanks!</p>
| 0debug
|
New option in GCC 5.3: -fno-semantic-interposition : <p>GCC 5.3 has added a new option: <code>-fno-semantic-interposition</code></p>
<blockquote>
<p>A new -fno-semantic-interposition option can be used to improve code
quality of shared libraries where interposition of exported symbols is
not allowed.</p>
</blockquote>
<p>This sounds like this is something useful for C++ projects where interposition can't be used for whatever reason, but where latency is a concern.</p>
<p>However, the description is fairly vague. Is anyone able to clarify how this option works exactly?</p>
| 0debug
|
Filter out array values that result in errors : <p>Basically I have 2 data structures. For simplicity lets suppose they are both 1 dimensional arrays. Assuming all functions are defined correctly, I want to do something like </p>
<pre><code>Array1.delete_if(Array2.find(element in array 1) results in error)
</code></pre>
<p>I have no idea how to approach this. I've tried rescue statements and the such but I still end up with errors. Is there an efficient and easy way to filter out elements in an array based on if a method call results in an error? </p>
<p>Thanks. </p>
| 0debug
|
static int virtio_read_many(ulong sector, void *load_addr, int sec_num)
{
struct virtio_blk_outhdr out_hdr;
u8 status;
out_hdr.type = VIRTIO_BLK_T_IN;
out_hdr.ioprio = 99;
out_hdr.sector = sector;
vring_send_buf(&block, &out_hdr, sizeof(out_hdr), VRING_DESC_F_NEXT);
vring_send_buf(&block, load_addr, SECTOR_SIZE * sec_num,
VRING_DESC_F_WRITE | VRING_HIDDEN_IS_CHAIN |
VRING_DESC_F_NEXT);
vring_send_buf(&block, &status, sizeof(u8), VRING_DESC_F_WRITE |
VRING_HIDDEN_IS_CHAIN);
vring_wait_reply(&block, 0);
drain_irqs(block.schid);
return status;
}
| 1threat
|
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
| 1threat
|
Spring Boot: Wrapping JSON response in dynamic parent objects : <p>I have a REST API specification that talks with back-end microservices, which return the following values:</p>
<p>On "collections" responses (e.g. GET /users) :</p>
<pre><code>{
users: [
{
... // single user object data
}
],
links: [
{
... // single HATEOAS link object
}
]
}
</code></pre>
<p>On "single object" responses (e.g. <code>GET /users/{userUuid}</code>) :</p>
<pre><code>{
user: {
... // {userUuid} user object}
}
}
</code></pre>
<p>This approach was chosen so that single responses would be extensible (for example, maybe if <code>GET /users/{userUuid}</code> gets an additional query parameter down the line such at <code>?detailedView=true</code> we would have additional request information).</p>
<p>Fundamentally, I think it is an OK approach for minimizing breaking changes between API updates. However, translating this model to code is proving very arduous.</p>
<p>Let's say that for single responses, I have the following API model object for a single user:</p>
<pre><code>public class SingleUserResource {
private MicroserviceUserModel user;
public SingleUserResource(MicroserviceUserModel user) {
this.user = user;
}
public String getName() {
return user.getName();
}
// other getters for fields we wish to expose
}
</code></pre>
<p>The advantage of this method is that we can expose <em>only</em> the fields from the internally used models for which we have public getters, but not others. Then, for collections responses I would have the following wrapper class:</p>
<pre><code>public class UsersResource extends ResourceSupport {
@JsonProperty("users")
public final List<SingleUserResource> users;
public UsersResource(List<MicroserviceUserModel> users) {
// add each user as a SingleUserResource
}
}
</code></pre>
<p>For <em>single object</em> responses, we would have the following:</p>
<pre><code>public class UserResource {
@JsonProperty("user")
public final SingleUserResource user;
public UserResource(SingleUserResource user) {
this.user = user;
}
}
</code></pre>
<p>This yields <code>JSON</code> responses which are formatted as per the API specification at the top of this post. The upside of this approach is that we only expose those fields that we <em>want</em> to expose. The heavy downside is that I have a <em>ton</em> of wrapper classes flying around that perform no discernible logical task aside from being read by Jackson to yield a correctly formatted response.</p>
<p>My questions are the following:</p>
<ul>
<li><p>How can I possibly generalize this approach? Ideally, I would like to have a single <code>BaseSingularResponse</code> class (and maybe a <code>BaseCollectionsResponse extends ResourceSupport</code> class) that all my models can extend, but seeing how Jackson seems to derive the JSON keys from the object definitions, I would have to user something like <code>Javaassist</code> to add fields to the base response classes at Runtime - a dirty hack that I would like to stay as far away from as humanly possible.</p></li>
<li><p>Is there an easier way to accomplish this? Unfortunately, I may have a variable number of top-level JSON objects in the response a year from now, so I cannot use something like Jackson's <code>SerializationConfig.Feature.WRAP_ROOT_VALUE</code> because that wraps <em>everything</em> into a single root-level object (as far as I am aware).</p></li>
<li><p>Is there perhaps something like <code>@JsonProperty</code> for class-level (as opposed to just method and field level)?</p></li>
</ul>
| 0debug
|
website is showing up as part text and part html on pc : I was searching for c programs on the net and i landed on this program-
<http://www.c4learn.com/c-programs/calculating-area-of-circle-using.html>
I opened it on my phone and it opened properly but it shows some part text and some part html on my pc.
I wanted to know why this was happening.
thanks in advance.
| 0debug
|
how to Read all Whatsapp Messages using Python or JAVA with the new whatsapp protocols and settings : I want to read all the whatsapp messages from the backup taken from the Windows phone and write those messages in document or in the iphone.
I have read many questions, that were limited to crypt5 only as the whatsapp has changed alot. Following the the order of my backup file.
[![enter image description here][1]][1]
How to read and write the whatsapp messages from this backup file.
[1]: http://i.stack.imgur.com/XH7Wj.png
| 0debug
|
static int rv10_decode_packet(AVCodecContext *avctx,
uint8_t *buf, int buf_size)
{
MpegEncContext *s = avctx->priv_data;
int i, mb_count, mb_pos, left;
init_get_bits(&s->gb, buf, buf_size*8);
#if 0
for(i=0; i<buf_size*8 && i<100; i++)
printf("%d", get_bits1(&s->gb));
printf("\n");
return 0;
#endif
if(s->codec_id ==CODEC_ID_RV10)
mb_count = rv10_decode_picture_header(s);
else
mb_count = rv20_decode_picture_header(s);
if (mb_count < 0) {
av_log(s->avctx, AV_LOG_ERROR, "HEADER ERROR\n");
return -1;
}
if (s->mb_x >= s->mb_width ||
s->mb_y >= s->mb_height) {
av_log(s->avctx, AV_LOG_ERROR, "POS ERROR %d %d\n", s->mb_x, s->mb_y);
return -1;
}
mb_pos = s->mb_y * s->mb_width + s->mb_x;
left = s->mb_width * s->mb_height - mb_pos;
if (mb_count > left) {
av_log(s->avctx, AV_LOG_ERROR, "COUNT ERROR\n");
return -1;
}
if (s->mb_x == 0 && s->mb_y == 0) {
if(MPV_frame_start(s, avctx) < 0)
return -1;
}
#ifdef DEBUG
printf("qscale=%d\n", s->qscale);
#endif
if(s->codec_id== CODEC_ID_RV10){
if(s->mb_y==0) s->first_slice_line=1;
}else{
s->first_slice_line=1;
s->resync_mb_x= s->mb_x;
s->resync_mb_y= s->mb_y;
}
if(s->h263_aic){
s->y_dc_scale_table=
s->c_dc_scale_table= ff_aic_dc_scale_table;
}else{
s->y_dc_scale_table=
s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
}
s->y_dc_scale= s->y_dc_scale_table[ s->qscale ];
s->c_dc_scale= s->c_dc_scale_table[ s->qscale ];
s->rv10_first_dc_coded[0] = 0;
s->rv10_first_dc_coded[1] = 0;
s->rv10_first_dc_coded[2] = 0;
s->block_wrap[0]=
s->block_wrap[1]=
s->block_wrap[2]=
s->block_wrap[3]= s->mb_width*2 + 2;
s->block_wrap[4]=
s->block_wrap[5]= s->mb_width + 2;
ff_init_block_index(s);
for(i=0;i<mb_count;i++) {
int ret;
ff_update_block_index(s);
#ifdef DEBUG
printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y);
#endif
s->dsp.clear_blocks(s->block[0]);
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
ret=ff_h263_decode_mb(s, s->block);
if (ret == SLICE_ERROR) {
av_log(s->avctx, AV_LOG_ERROR, "ERROR at MB %d %d\n", s->mb_x, s->mb_y);
return -1;
}
ff_h263_update_motion_val(s);
MPV_decode_mb(s, s->block);
if (++s->mb_x == s->mb_width) {
s->mb_x = 0;
s->mb_y++;
ff_init_block_index(s);
}
if(s->mb_x == s->resync_mb_x)
s->first_slice_line=0;
if(ret == SLICE_END) break;
}
return buf_size;
}
| 1threat
|
Please help on Arduino : I wrote a program for Arduino for object avoiding using three ultrasonic sensors but it is giving error in compile. Can anyone suggest why is the error coming and how I can resolve it:
int trigPin = 6;<br/>
int echoPin = 7;<br/>
int trigPin = 8;<br/>
int echoPin = 9;<br/>
int trigPin = 10;<br/>
int echoPin = 11;<br/>
<br/>
int revleft4 = 2;<br/>
int fwdleft5 = 3;<br/>
int revright6 = 4;<br/>
int fwdright7 = 5;<br/>
<br/>
long duration, distance, RightSensor,FrontSensor,LeftSensor;<br/>
<br/>
void setup()<br/>
{<br/>
delay(random(500,2000));<br/>
Serial.begin (9600);<br/>
pinMode(revleft4, OUTPUT);<br/>
pinMode(fwdleft5, OUTPUT);<br/>
pinMode(revright6, OUTPUT);<br/>
pinMode(fwdright7, OUTPUT);<br/>
<br/>
pinMode(trigPin1, OUTPUT);<br/>
pinMode(echoPin1, INPUT);<br/>
pinMode(trigPin2, OUTPUT);<br/>
pinMode(echoPin2, INPUT);<br/>
pinMode(trigPin3, OUTPUT);<br/>
pinMode(echoPin3, INPUT);<br/>
}<br/>
<br/>
void loop() <br/>
SonarSensor(trigPin1, echoPin1);<br/>
RightSensor = distance;<br/>
SonarSensor(trigPin2, echoPin2);<br/>
LeftSensor = distance;<br/>
SonarSensor(trigPin3, echoPin3);<br/>
FrontSensor = distance;<br/>
<br/>
<br/>
if(FrontSensor<=20 && LeftSensor<=20)<br/>
{<br/>
Serial.println("Turn right");<br/>
digitalWrite(fwdright7,HIGH);<br/>
digitalWrite(revright6,LOW);<br/>
digitalWrite(fwdleft5,HIGH);<br/>
digitalWrite(revleft4,LOW);<br/>
}<br/>
else if(FrontSensor<=20 && RightSensor<=20)<br/>
{<br/>
Serial.println("Turn left");<br/>
digitalWrite(fwdright7,LOW);<br/>
digitalWrite(revright6,HIGH);<br/>
digitalWrite(fwdright5,LOW);<br/>
digitalWrite(revright4,HIGH);<br/>
}<br/>
else<br/>
{<br/>
Serial.println("Forward");<br/>
<br/>
digitalWrite(fwdright7,LOW);<br/>
digitalWrite(revright6,HIGH);<br/>
digitalWrite(fwdright5,HIGH);<br/>
digitalWrite(revright4,LOW);<br/>
}<br/>
delay(5);<br/>
}<br/>
<br/>
<br/>
void SonarSensor(int trigPin,int echoPin)<br/>
{<br/>
digitalWrite(trigPin, LOW);<br/>
delayMicroseconds(2);<br/>
digitalWrite(trigPin, HIGH);<br/>
delayMicroseconds(10);<br/>
digitalWrite(trigPin, LOW);<br/>
duration = pulseIn(echoPin, HIGH);<br/>
distance = duration/58.2; <br/>
}
| 0debug
|
Unable to properly do a While Loop : <p>I am trying to do a while loop. I have been trying for a long time, but still cannot figure this out. </p>
<pre><code>#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
char input;
double voltage, current;
while ((input = 'Y'))
{
cout << "Enter the voltage: ";
cin >> voltage;
cout << "Enter the current: ";
cin >> current;
cout << "The resistance is " << voltage/current << endl;
cout << "Do you wish to continue? [Y/N]";
cin >> input;
}
}
</code></pre>
<p>Entering other variables other than 'Y' still causes the code to loop. Doing //while ((input == 'Y')) does not give me an output</p>
| 0debug
|
static int hnm_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
AVFrame *frame = data;
Hnm4VideoContext *hnm = avctx->priv_data;
int ret;
uint16_t chunk_id;
if (avpkt->size < 8) {
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
chunk_id = AV_RL16(avpkt->data + 4);
if (chunk_id == HNM4_CHUNK_ID_PL) {
hnm_update_palette(avctx, avpkt->data, avpkt->size);
frame->palette_has_changed = 1;
} else if (chunk_id == HNM4_CHUNK_ID_IZ) {
unpack_intraframe(avctx, avpkt->data + 12, avpkt->size - 12);
memcpy(hnm->previous, hnm->current, hnm->width * hnm->height);
if (hnm->version == 0x4a)
memcpy(hnm->processed, hnm->current, hnm->width * hnm->height);
else
postprocess_current_frame(avctx);
copy_processed_frame(avctx, frame);
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
memcpy(frame->data[1], hnm->palette, 256 * 4);
*got_frame = 1;
} else if (chunk_id == HNM4_CHUNK_ID_IU) {
if (hnm->version == 0x4a) {
decode_interframe_v4a(avctx, avpkt->data + 8, avpkt->size - 8);
memcpy(hnm->processed, hnm->current, hnm->width * hnm->height);
} else {
decode_interframe_v4(avctx, avpkt->data + 8, avpkt->size - 8);
postprocess_current_frame(avctx);
copy_processed_frame(avctx, frame);
frame->pict_type = AV_PICTURE_TYPE_P;
frame->key_frame = 0;
memcpy(frame->data[1], hnm->palette, 256 * 4);
*got_frame = 1;
hnm_flip_buffers(hnm);
} else {
av_log(avctx, AV_LOG_ERROR, "invalid chunk id: %d\n", chunk_id);
return avpkt->size;
| 1threat
|
static void fw_cfg_data_mem_write(void *opaque, hwaddr addr,
uint64_t value, unsigned size)
{
fw_cfg_write(opaque, (uint8_t)value);
}
| 1threat
|
Size Image widget to parent height but overflow width : <p>I would like to create an Image widget that sizes to the height of it's parent, but then overflows the width of the parent based on the aspect ratio of the displayed image. I've tried <code>FittedBox</code> and a combination of <code>LayoutBuilder</code> and <code>SizedOverflowBox</code>, but no luck. So far I've only been able to get the image to size to the parent in both width and height.</p>
<p>Is there a combination of widgets that will give me this behavior?</p>
| 0debug
|
How to use preg_match in phone numbers - PHP : Hello everyone? I'm not a very regular programmer and I need your help. I would like to add a phone number in a registration form, users will need to input username, email, phone number and password. All these fields will be REQUIRED including the phone number. I'm based in Kenya so I would like to limit the Phone number to 13 characters including the + (sign). The No. should like:
+25470164XXXX OR 070164XXXX both formats are accepted. Kindly assist me on how to implement this using preg_match function in PHP.
Thanks
| 0debug
|
static void virtio_9p_device_realize(DeviceState *dev, Error **errp)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
V9fsVirtioState *v = VIRTIO_9P(dev);
V9fsState *s = &v->state;
if (v9fs_device_realize_common(s, errp)) {
goto out;
}
v->config_size = sizeof(struct virtio_9p_config) + strlen(s->fsconf.tag);
virtio_init(vdev, "virtio-9p", VIRTIO_ID_9P, v->config_size);
v->vq = virtio_add_queue(vdev, MAX_REQ, handle_9p_output);
v9fs_register_transport(s, &virtio_9p_transport);
out:
return;
}
| 1threat
|
TypeError: Super expression must be null or a function, not undefined with Babeljs : <p>I'm currently trying to make multiple-files inheritance in ES6, with node.JS and Babel (I'm using Babel to convert the code from ES6 to ES5 'cause Node don't implement ES6 right now).
I'm using import/export to "link" the differents files.</p>
<p>Actually I have :
<strong>Parent Class (File 1)</strong></p>
<pre><code>export class Point
{
constructor(x, y)
{
this.x = x;
this.y = y;
}
toString() {
return '(' + this.x + ', ' + this.y + ')';
}
}
</code></pre>
<p>And :
<strong>Child Class (File 2)</strong></p>
<pre><code>import Point from './pointES5'
export class ColorPoint extends Point
{
constructor(x, y, color)
{
super(x, y);
this.color = color;
}
toString() {
return super.toString() + ' in ' + this.color;
}
}
</code></pre>
<p>And the main
<strong>Main (File 3)</strong></p>
<pre><code>import Point from './pointES5'
import ColorPoint from './colorpointES5'
var m_point = new Point();
var m_colorpoint = new ColorPoint();
console.log(m_point.toString());
console.log(m_colorpoint.toString());
</code></pre>
<p>I'm doin' that to test the toString() methods calls, from Parent and from Child.<br>
So then I use Babel to convert the code from ES6 to ES5 and I run each parts separately to test if it's ok or not.<br>
- Point (the Parent) is good, and execute without error.<br>
- ColorPoint (the Child) don't run completely and throw : </p>
<blockquote>
<p>TypeError: Super expression must either be null or a function, not undefined</p>
</blockquote>
<p>The first line of the StackTrace is :</p>
<blockquote>
<p>function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.<strong>proto</strong> = superClass; }
(It comes from the ES5 converted code (Babelified), and I can post it entirely if it's needed).</p>
</blockquote>
<p>It is frustrating cause this code is very simple...
But I don't see what is causing the error.</p>
<p>I try differents versions of Babel (5, 5.8, 6) but there is no differences...</p>
<p>What have I done wrong ?</p>
<p>PS : I forgot to tell : it WORKS PERFECTLY when I do that in just one file. But it's really important to me to have only one class by file...</p>
| 0debug
|
How to check if coordinate inside certain area Python : <p>Lets say I have 2 kind of coordinate, first called <code>center_point</code> and second called <code>test_point</code>. I want to know if <code>test_point</code> coordinate is inside near or not to <code>center_point</code> coordinate by applying <code>radius</code> threshold. If I write it, its like:</p>
<pre><code>center_point = [{'lat': -7.7940023, 'lng': 110.3656535}]
test_point = [{'lat': -7.79457, 'lng': 110.36563}]
radius = 5 # in kilometer
</code></pre>
<p>How to check if the <code>test_point</code> inside or outside the radius from <code>center_point</code> in Python? how I perform this kind task in Python?</p>
<p>Result expected will say that <code>test_point</code> inside or outside the <code>radius</code> from <code>center_point</code> coordinate.</p>
| 0debug
|
Protobuf import failure : <p>Does anyone know where I can find an example of a gRPC protobuf file that imports from a different file and uses a protobuf message in a return? I can't find any at all.</p>
<p>I have a file...</p>
<pre><code>syntax = "proto3";
package a1;
import "a.proto";
service mainservice {
rpc DoSomething(...) returns (a.SomeResponse) {}
}
</code></pre>
<p>a.proto is also in the same directory and also compiles by itself. The error messages I'm getting are:
<code>"a.SomeResponse" is not defined.</code>
<code>mainfile.proto: warning: Import a.proto but not used.</code></p>
| 0debug
|
Running PHP SoapServer behind a proxy : <p>I'm attempting to run both a PHP SoapClient and a SoapServer (for Magento) behind a proxy, where the only network traffic allowed out is via the proxy server.</p>
<p>I have got this working with the client as so:</p>
<pre><code>$client = new SoapClient('https://www.domain.co.uk/api/v2_soap/?wsdl=1', [
'soap_version' => SOAP_1_1,
'connection_timeout' => 15000,
'proxy_host' => '192.168.x.x',
'proxy_port' => 'xxxx',
'stream_context' => stream_context_create(
[
'ssl' => [
'proxy' => 'tcp://192.168.x.x:xxxx',
'request_fulluri' => true,
],
'http' => [
'proxy' => 'tcp://192.168.x.x:xxxx',
'request_fulluri' => true,
],
]
),
]);
</code></pre>
<p>This works as expected - all the traffic is going via the proxy server.</p>
<p>However, with the SoapServer class, I can't work out how to force it to send all outbound traffic via the SoapServer. It appears to be trying to load <a href="http://schemas.xmlsoap.org/soap/encoding/">http://schemas.xmlsoap.org/soap/encoding/</a> directly form the network, not via the proxy, which is causing the "can't import schema from '<a href="http://schemas.xmlsoap.org/soap/encoding/">http://schemas.xmlsoap.org/soap/encoding/</a>'" error to be thrown.</p>
<p>I've tried adding a hosts file entry for schemas.xmlsoap.org to 127.0.0.1 and hosting this file locally, but I'm still getting the same issue.</p>
<p>Is there something I'm missing?</p>
| 0debug
|
Splitting a fasta file on the basis of header information : <p>I am new to scripting. Could you help me in finding my way to separate sequences based on the information in the header for example i have fasta file like this</p>
<blockquote>
<p>ERR1897927.533;barcodelabel=R40_1193R_F61_799F;
GTAGTCCTAGCCCTAAACGATGGATACTTGGTGTGACTGGGATTGAATCCAGTCGTGCCG
AAGCTAACGCATTAAGTATCCCGCCTGGGGAGTACGGTCGCAAGGCTGAAACTCAAAGGA
ATTGACGGGGGCCCGCACAAGCGGTGGAGCATGTGGTTTAATTCGAAGCAACGCGCAGAA
CCTTACCAGCGTTTGACATGGTAGGACGGTTTCCAGAGATGGATTCCTCCCCTTACGGGG
CCTACACACAGGTGCTGCATGGCTGTCGTCAGCTCGTGTCGTGAGATGTTGGGTTAAGTC
CCGCAACGAGCGCAACCCTCGTCTTTAGTTGCCACCATTTAGTTGGGCACTCTAAAGAAA
ERR1897927.925;barcodelabel=R41_1193R_F62_799F;</p>
</blockquote>
<p>Now i would like to separate sequences in to separate fasta files based on "barcodelabel" (just based on the header, not from sequence itself as i already removed the barcodes)</p>
<p>Please let me know the way,</p>
<p>May thanks in advance,</p>
<p>Best!
Wasim</p>
| 0debug
|
can anyone tell me what is wrong with my code? im trying to find the sum of the first n integer value, im quite a beginner : #include <iostream>
using namespace std;
int num(int n){
for(int i= 1 ; i<=n ; i++){
int sum=0;
sum += i;
cout<<sum;
}
}
i guess this part is clear.
int main()
{
int x;
cout<<"enter the value of x ";
cin>>x;
int answer=num(x);
cout<<"the total sum of the first n integer is "<<answer;
return 0;
}
ive tried looking it up but no results found....
ive always had some trouble with the loops.
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.