problem
stringlengths
26
131k
labels
class label
2 classes
condition check for Jquery radio button : <div class="error-message"></div> <form id="satisfaction" onsubmit="return validateInput()"> <input type="radio" name="satisfied" value="yes" required /> Satisfied <input type="checkbox" name="donate" /> Donate<br /> <input type="radio" name="satisfied" value="no" required /> Not satisfied <input type="text" name="reason" /> Reason<br /> <input type="submit" value="Submit" /> </form> <script> How can I write a code in Jquery that let the user check the donate button if and only if the satisfied button is checked? please help me here
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
static uint32_t drc_isolate_logical(sPAPRDRConnector *drc) { g_free(drc->ccs); drc->ccs = NULL; if (spapr_drc_type(drc) == SPAPR_DR_CONNECTOR_TYPE_LMB && !drc->unplug_requested) { return RTAS_OUT_HW_ERROR; } drc->isolation_state = SPAPR_DR_ISOLATION_STATE_ISOLATED; if (drc->unplug_requested) { uint32_t drc_index = spapr_drc_index(drc); if (drc->configured) { trace_spapr_drc_set_isolation_state_finalizing(drc_index); spapr_drc_detach(drc); } else { trace_spapr_drc_set_isolation_state_deferring(drc_index); } } drc->configured = false; return RTAS_OUT_SUCCESS; }
1threat
Cannot install kurento-media-server-6.0 in Ubuntu Linux 16.04 : <p>Cannot install kurento-media-server-6.0 in Ubuntu Linux 16.04 its always showing dependencies problem as below.</p> <pre><code>sudo apt-get install kurento-media-server-6.0 Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: kurento-media-server-6.0 : Depends: kms-core-6.0 (&gt;= 6.6.1) but it is not going to be installed Depends: libboost-filesystem1.55.0 but it is not installable Depends: libboost-log1.55.0 but it is not installable Depends: libboost-program-options1.55.0 but it is not installable Depends: libboost-system1.55.0 but it is not installable Depends: libboost-thread1.55.0 but it is not installable Depends: libglibmm-2.4-1c2a (&gt;= 2.36.2) but it is not installable Depends: libsigc++-2.0-0c2a (&gt;= 2.0.2) but it is not installable Depends: gstreamer1.5-plugins-bad (&gt;= 1.7.0~0) but it is not going to be installed Depends: gstreamer1.5-plugins-good (&gt;= 1.7.0~0) but it is not going to be installed Depends: gstreamer1.5-plugins-ugly (&gt;= 1.7.0~0) but it is not going to be installed Depends: kms-elements-6.0 (&gt;= 6.6.1) but it is not going to be installed Depends: kms-filters-6.0 (&gt;= 6.6.1) but it is not going to be installed E: Unable to correct problems, you have held broken packages. </code></pre> <p>How to install kurento-media-server-6.0 in Ubuntu Linux 16.04</p>
0debug
Celery tasks received but not executing : <p>I have Celery tasks that are received but will not execute. I am using Python 2.7 and Celery 4.0.2. My message broker is Amazon SQS.</p> <p>This the output of <code>celery worker</code>:</p> <pre><code>$ celery worker -A myapp.celeryapp --loglevel=INFO [tasks] . myapp.tasks.trigger_build [2017-01-12 23:34:25,206: INFO/MainProcess] Connected to sqs://13245:**@localhost// [2017-01-12 23:34:25,391: INFO/MainProcess] celery@ip-111-11-11-11 ready. [2017-01-12 23:34:27,700: INFO/MainProcess] Received task: myapp.tasks.trigger_build[b248771c-6dd5-469d-bc53-eaf63c4f6b60] </code></pre> <p>I have tried adding <code>-Ofair</code> when running <code>celery worker</code> but that did not help. Some other info that might be helpful:</p> <ul> <li>Celery always receives 8 tasks, although there are about 100 messages waiting to be picked up.</li> <li>About once in every 4 or 5 times a task actually <em>will</em> run and complete, but then it gets stuck again.</li> <li>This is the result of <code>ps aux</code>. Notice that it is running celery in 3 different processes (not sure why) and one of them has 99.6% CPU utilization, even though it's not completing any tasks or anything.</li> </ul> <p>Processes:</p> <pre><code>$ ps aux | grep celery nobody 7034 99.6 1.8 382688 74048 ? R 05:22 18:19 python2.7 celery worker -A myapp.celeryapp --loglevel=INFO nobody 7039 0.0 1.3 246672 55664 ? S 05:22 0:00 python2.7 celery worker -A myapp.celeryapp --loglevel=INFO nobody 7040 0.0 1.3 246672 55632 ? S 05:22 0:00 python2.7 celery worker -A myapp.celeryapp --loglevel=INFO </code></pre> <p>Settings:</p> <pre><code>CELERY_BROKER_URL = 'sqs://%s:%s@' % (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY.replace('/', '%2F')) CELERY_BROKER_TRANSPORT = 'sqs' CELERY_BROKER_TRANSPORT_OPTIONS = { 'region': 'us-east-1', 'visibility_timeout': 60 * 30, 'polling_interval': 0.3, 'queue_name_prefix': 'myapp-', } CELERY_BROKER_HEARTBEAT = 0 CELERY_BROKER_POOL_LIMIT = 1 CELERY_BROKER_CONNECTION_TIMEOUT = 10 CELERY_DEFAULT_QUEUE = 'myapp' CELERY_QUEUES = ( Queue('myapp', Exchange('default'), routing_key='default'), ) CELERY_ALWAYS_EAGER = False CELERY_ACKS_LATE = True CELERY_TASK_PUBLISH_RETRY = True CELERY_DISABLE_RATE_LIMITS = False CELERY_IGNORE_RESULT = True CELERY_SEND_TASK_ERROR_EMAILS = False CELERY_TASK_RESULT_EXPIRES = 600 CELERY_RESULT_BACKEND = 'django-db' CELERY_TIMEZONE = TIME_ZONE CELERY_TASK_SERIALIZER = 'json' CELERY_ACCEPT_CONTENT = ['application/json'] CELERYD_PID_FILE = "/var/celery_%N.pid" CELERYD_HIJACK_ROOT_LOGGER = False CELERYD_PREFETCH_MULTIPLIER = 1 CELERYD_MAX_TASKS_PER_CHILD = 1000 </code></pre> <p>Report:</p> <pre><code>$ celery report -A myapp.celeryapp software -&gt; celery:4.0.2 (latentcall) kombu:4.0.2 py:2.7.12 billiard:3.5.0.2 sqs:N/A platform -&gt; system:Linux arch:64bit, ELF imp:CPython loader -&gt; celery.loaders.app.AppLoader settings -&gt; transport:sqs results:django-db </code></pre>
0debug
trying to decipher the mathematical meaning of an if statement in matlab : I have this piece of code that I'm trying understand what is going on. I usually use R, but had to look at a piece of code from matlab. So can anyone tell me what this if statement does in math?? prob = exp(-dE / kT); if dE <= 0 I I rand() <= prob; spin(row, col) = - spin(row, col); Cheers, Emil
0debug
Learned how to make responsive HTML Emails from scratch using HTML & CSS. What's next? : <p>Looking at jobs online most of them have: Experience using MailChimp or Oracle responsys. Are these what most HTML Email developers use at work? </p> <ul> <li>Also I tested my code using the free <a href="https://putsmail.com/tests/new" rel="nofollow noreferrer">https://putsmail.com/tests/new</a> on gmail and hotmail apps (iphone)</li> </ul> <p>They both looked great.</p> <p>Is that enough? If not, what website is the best for testing to make sure it works well on every email clients?</p>
0debug
static void parse_type_int64(Visitor *v, const char *name, int64_t *obj, Error **errp) { StringInputVisitor *siv = to_siv(v); if (!siv->string) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "integer"); return; } parse_str(siv, errp); if (!siv->ranges) { goto error; } if (!siv->cur_range) { Range *r; siv->cur_range = g_list_first(siv->ranges); if (!siv->cur_range) { goto error; } r = siv->cur_range->data; if (!r) { goto error; } siv->cur = r->begin; } *obj = siv->cur; siv->cur++; return; error: error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null", "an int64 value or range"); }
1threat
I have a counting from 1 to 20 I want every 3rd and 4th value print as * how to empliment it : i used this but not working and i got stuck either one another got print as star or 3rd another not every 3rd and 4th. I am using java for loop with the % and also it not worked
0debug
i need a PHP code to find longest contiguous sequence of characters in the string. : i need a PHP code to find longest contiguous sequence of characters in the string. So if 'b' is coming together for maximum number of times your program should echo 'b' and count Example String: "aaabababbbbbaaaaabbbbbbbbaa" Output must be: 'b' 8
0debug
static void gen_compute_branch (DisasContext *ctx, uint32_t opc, int insn_bytes, int rs, int rt, int32_t offset) { target_ulong btgt = -1; int blink = 0; int bcond_compute = 0; TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); if (ctx->hflags & MIPS_HFLAG_BMASK) { #ifdef MIPS_DEBUG_DISAS LOG_DISAS("Branch in delay slot at PC 0x" TARGET_FMT_lx "\n", ctx->pc); #endif generate_exception(ctx, EXCP_RI); goto out; } switch (opc) { case OPC_BEQ: case OPC_BEQL: case OPC_BNE: case OPC_BNEL: if (rs != rt) { gen_load_gpr(t0, rs); gen_load_gpr(t1, rt); bcond_compute = 1; } btgt = ctx->pc + insn_bytes + offset; break; case OPC_BGEZ: case OPC_BGEZAL: case OPC_BGEZALL: case OPC_BGEZL: case OPC_BGTZ: case OPC_BGTZL: case OPC_BLEZ: case OPC_BLEZL: case OPC_BLTZ: case OPC_BLTZAL: case OPC_BLTZALL: case OPC_BLTZL: if (rs != 0) { gen_load_gpr(t0, rs); bcond_compute = 1; } btgt = ctx->pc + insn_bytes + offset; break; case OPC_J: case OPC_JAL: case OPC_JALX: btgt = ((ctx->pc + insn_bytes) & (int32_t)0xF0000000) | (uint32_t)offset; break; case OPC_JR: case OPC_JALR: case OPC_JALRC: if (offset != 0 && offset != 16) { MIPS_INVAL("jump hint"); generate_exception(ctx, EXCP_RI); goto out; } gen_load_gpr(btarget, rs); break; default: MIPS_INVAL("branch/jump"); generate_exception(ctx, EXCP_RI); goto out; } if (bcond_compute == 0) { switch (opc) { case OPC_BEQ: case OPC_BEQL: case OPC_BGEZ: case OPC_BGEZL: case OPC_BLEZ: case OPC_BLEZL: ctx->hflags |= MIPS_HFLAG_B; MIPS_DEBUG("balways"); break; case OPC_BGEZAL: case OPC_BGEZALL: blink = 31; ctx->hflags |= MIPS_HFLAG_B; MIPS_DEBUG("balways and link"); break; case OPC_BNE: case OPC_BGTZ: case OPC_BLTZ: MIPS_DEBUG("bnever (NOP)"); goto out; case OPC_BLTZAL: tcg_gen_movi_tl(cpu_gpr[31], ctx->pc + 8); MIPS_DEBUG("bnever and link"); goto out; case OPC_BLTZALL: tcg_gen_movi_tl(cpu_gpr[31], ctx->pc + 8); MIPS_DEBUG("bnever, link and skip"); ctx->pc += 4; goto out; case OPC_BNEL: case OPC_BGTZL: case OPC_BLTZL: MIPS_DEBUG("bnever and skip"); ctx->pc += 4; goto out; case OPC_J: ctx->hflags |= MIPS_HFLAG_B; MIPS_DEBUG("j " TARGET_FMT_lx, btgt); break; case OPC_JALX: ctx->hflags |= MIPS_HFLAG_BX; case OPC_JAL: blink = 31; ctx->hflags |= MIPS_HFLAG_B; ctx->hflags |= (ctx->hflags & MIPS_HFLAG_M16 ? MIPS_HFLAG_BDS16 : MIPS_HFLAG_BDS32); MIPS_DEBUG("jal " TARGET_FMT_lx, btgt); break; case OPC_JR: ctx->hflags |= MIPS_HFLAG_BR; if (ctx->hflags & MIPS_HFLAG_M16) ctx->hflags |= MIPS_HFLAG_BDS16; MIPS_DEBUG("jr %s", regnames[rs]); break; case OPC_JALR: case OPC_JALRC: blink = rt; ctx->hflags |= MIPS_HFLAG_BR; if (ctx->hflags & MIPS_HFLAG_M16) ctx->hflags |= MIPS_HFLAG_BDS16; MIPS_DEBUG("jalr %s, %s", regnames[rt], regnames[rs]); break; default: MIPS_INVAL("branch/jump"); generate_exception(ctx, EXCP_RI); goto out; } } else { switch (opc) { case OPC_BEQ: tcg_gen_setcond_tl(TCG_COND_EQ, bcond, t0, t1); MIPS_DEBUG("beq %s, %s, " TARGET_FMT_lx, regnames[rs], regnames[rt], btgt); goto not_likely; case OPC_BEQL: tcg_gen_setcond_tl(TCG_COND_EQ, bcond, t0, t1); MIPS_DEBUG("beql %s, %s, " TARGET_FMT_lx, regnames[rs], regnames[rt], btgt); goto likely; case OPC_BNE: tcg_gen_setcond_tl(TCG_COND_NE, bcond, t0, t1); MIPS_DEBUG("bne %s, %s, " TARGET_FMT_lx, regnames[rs], regnames[rt], btgt); goto not_likely; case OPC_BNEL: tcg_gen_setcond_tl(TCG_COND_NE, bcond, t0, t1); MIPS_DEBUG("bnel %s, %s, " TARGET_FMT_lx, regnames[rs], regnames[rt], btgt); goto likely; case OPC_BGEZ: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); MIPS_DEBUG("bgez %s, " TARGET_FMT_lx, regnames[rs], btgt); goto not_likely; case OPC_BGEZL: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); MIPS_DEBUG("bgezl %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BGEZAL: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); MIPS_DEBUG("bgezal %s, " TARGET_FMT_lx, regnames[rs], btgt); blink = 31; goto not_likely; case OPC_BGEZALL: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); blink = 31; MIPS_DEBUG("bgezall %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BGTZ: tcg_gen_setcondi_tl(TCG_COND_GT, bcond, t0, 0); MIPS_DEBUG("bgtz %s, " TARGET_FMT_lx, regnames[rs], btgt); goto not_likely; case OPC_BGTZL: tcg_gen_setcondi_tl(TCG_COND_GT, bcond, t0, 0); MIPS_DEBUG("bgtzl %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BLEZ: tcg_gen_setcondi_tl(TCG_COND_LE, bcond, t0, 0); MIPS_DEBUG("blez %s, " TARGET_FMT_lx, regnames[rs], btgt); goto not_likely; case OPC_BLEZL: tcg_gen_setcondi_tl(TCG_COND_LE, bcond, t0, 0); MIPS_DEBUG("blezl %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BLTZ: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); MIPS_DEBUG("bltz %s, " TARGET_FMT_lx, regnames[rs], btgt); goto not_likely; case OPC_BLTZL: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); MIPS_DEBUG("bltzl %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BLTZAL: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); blink = 31; MIPS_DEBUG("bltzal %s, " TARGET_FMT_lx, regnames[rs], btgt); not_likely: ctx->hflags |= MIPS_HFLAG_BC; break; case OPC_BLTZALL: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); blink = 31; MIPS_DEBUG("bltzall %s, " TARGET_FMT_lx, regnames[rs], btgt); likely: ctx->hflags |= MIPS_HFLAG_BL; break; default: MIPS_INVAL("conditional branch/jump"); generate_exception(ctx, EXCP_RI); goto out; } } MIPS_DEBUG("enter ds: link %d cond %02x target " TARGET_FMT_lx, blink, ctx->hflags, btgt); ctx->btarget = btgt; if (blink > 0) { int post_delay = insn_bytes; int lowbit = !!(ctx->hflags & MIPS_HFLAG_M16); if (opc != OPC_JALRC) post_delay += ((ctx->hflags & MIPS_HFLAG_BDS16) ? 2 : 4); tcg_gen_movi_tl(cpu_gpr[blink], ctx->pc + post_delay + lowbit); } out: if (insn_bytes == 2) ctx->hflags |= MIPS_HFLAG_B16; tcg_temp_free(t0); tcg_temp_free(t1); }
1threat
How do you look at console.log output of the amazon lambda function : <p>When you do a </p> <pre><code>console.log('Loading function'); </code></pre> <p>in an amazon lambda function, where does that go?</p> <p>My setup api gateway lambda function nodejs6.10 curl <a href="https://n2tredacted.execute-api.us-east-1.amazonaws.com/prod/redactedFunc" rel="noreferrer">https://n2tredacted.execute-api.us-east-1.amazonaws.com/prod/redactedFunc</a></p>
0debug
Explanation on how this code works for House robber in Python : So I was browsing solutions on leetcode and found this for HouseRobber 1: last, now = 0, 0 for i in nums: last, now = now, max(last + i, now) return now I'm kind of confused on how the code itself executes with the max value. It's a bit ambiguous to me since I'm still fairly new to python and coming from C++, I wrote something like this: lastNum = 0 #last number we took in lastSpot = 0 #last spot we took the number from (index placeholder) totalSum = 0 #max amount we can take from the houses for i, element in enumerate(nums): if element > lastNum: #if our element is bigger than our last number, we check... if lastSpot != i - 1: #if our last spot was more than a space away AND our element is bigger, we take our index number. if lastNum + nums[lastSpot] < lastNum + nums[i]: lastNum = element totalSum += element lastSpot = i #update our last spot elif lastSpot == i - 1: #if our last spot is next to our current spot, we gotta' swap a few values now. totalSum -= lastNum #we remove the last value we added since we found a bigger spot totalSum += element lastSpot = i lastNum = element elif i == lastSpot + 2: #if we are more than one spot away from our last spot, we take the number anyway and add it. lastNum = element totalSum += element elif element < lastNum: if lastNum + nums[lastSpot] < lastNum + nums[i]: lastNum = element totalSum += element totalSum += nums[i - 2] lastSpot = i else: lastNum = element return totalSum I understand that we need to validate the values against each other and if we pass a value, we check to see if it's bigger than our last held value plus our current, then decide to skip or take depending on if it's a spot next to our currently chosen value. But how does that execute within the small bit of python code? I know how the max function takes 2 values and returns the larger of two - but am I missing something? Shouldn't this also be returning values next to the same value? Thank you for your time!
0debug
ConstraintLayout: Unable to scale image to fit a ratio in RecyclerView : <ul> <li>I have a recycler view with StaggeredGridLayoutManager. </li> <li>Within in I have custom items/views. </li> <li>Each item is defined as a ConstraintLayout where there is an image which is supposed to have a constant aspect ratio.</li> <li>But the image is to still be able to scale to fit the width of each span. </li> <li>And then the height should be adjusted according to the ratio. </li> </ul> <p>But somehow the images are not maintaining the aspect ratio.</p> <p>Here are the xml files and code to create the recycler view:</p> <p>item.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:padding="10dp"&gt; &lt;ImageView android:id="@+id/image" android:layout_width="0dp" android:layout_height="0dp" android:adjustViewBounds="true" android:scaleType="centerCrop" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintDimensionRatio="16:9" tools:src="@drawable/ic_logo" /&gt; &lt;TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintBottom_toBottomOf="@+id/image" android:textColor="@color/white" tools:text="SAMPLE" android:paddingBottom="10dp" android:layout_margin="5dp"/&gt; &lt;/android.support.constraint.ConstraintLayout&gt; </code></pre> <p>activity.xml</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="10dp"&gt; &lt;android.support.v7.widget.RecyclerView android:id="@+id/recycler_view" android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentStart="true" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Code to generate the whole view:</p> <pre><code>adapter = new SampleAdapter(list); StaggeredGridLayoutManager manager = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL); sampleRecyclerView.setLayoutManager(manager); sampleRecyclerView.setAdapter(adapter); </code></pre> <p>The width of each item is set fine and fits the width of each column span. But the height is not maintained and is very little. </p> <p>Could someone please help?</p> <p>Thanks</p>
0debug
static void expand_timestamps(void *log, struct sbg_script *s) { int i, nb_rel = 0; int64_t now, cur_ts, delta = 0; for (i = 0; i < s->nb_tseq; i++) nb_rel += s->tseq[i].ts.type == 'N'; if (nb_rel == s->nb_tseq) { now = 0; if (s->start_ts != AV_NOPTS_VALUE) av_log(log, AV_LOG_WARNING, "Start time ignored in a purely relative script.\n"); } else if (nb_rel == 0 && s->start_ts != AV_NOPTS_VALUE || s->opt_start_at_first) { if (s->start_ts == AV_NOPTS_VALUE) s->start_ts = s->tseq[0].ts.t; now = s->start_ts; } else { time_t now0; struct tm *tm, tmpbuf; av_log(log, AV_LOG_WARNING, "Scripts with mixed absolute and relative timestamps can give " "unexpected results (pause, seeking, time zone change).\n"); #undef time time(&now0); tm = localtime_r(&now0, &tmpbuf); now = tm ? tm->tm_hour * 3600 + tm->tm_min * 60 + tm->tm_sec : now0 % DAY; av_log(log, AV_LOG_INFO, "Using %02d:%02d:%02d as NOW.\n", (int)(now / 3600), (int)(now / 60) % 60, (int)now % 60); now *= AV_TIME_BASE; for (i = 0; i < s->nb_tseq; i++) { if (s->tseq[i].ts.type == 'N') { s->tseq[i].ts.t += now; s->tseq[i].ts.type = 'T'; } } } if (s->start_ts == AV_NOPTS_VALUE) s->start_ts = s->opt_start_at_first ? s->tseq[0].ts.t : now; s->end_ts = s->opt_duration ? s->start_ts + s->opt_duration : AV_NOPTS_VALUE; cur_ts = now; for (i = 0; i < s->nb_tseq; i++) { if (s->tseq[i].ts.t + delta < cur_ts) delta += DAY_TS; cur_ts = s->tseq[i].ts.t += delta; } }
1threat
how to pass data from textfield to another textfiled : override func prepare(for segue: UIStoryboardSegue, sender: Any?) { var secondController = segue.destination as! EditBillsViewController secondController.textField = items secondController.notesTextBox = notes secondController.billNameTextBox = billsName secondController.dateToPayTextBox = DatePickerText secondController.DailyReminerTextBox = DaysNotification
0debug
why my login is not work in my app in localhost with xampp : I have created a app which can users to login by entering their email and password and the database for the activity was created from php my admin with xampp. The database name is user and table name is details.I test it by entering email and password which is in the database.But it doesn't make any reaction.Following I have included login.php, conn.php, login.java, backgroundWorker.java class. ##login.xml code## <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#1647a3" android:orientation="vertical" android:paddingEnd="2sp" android:paddingStart="2sp" tools:context="com.example.xxxxxx.xxxxxxxxxxx.login" android:weightSum="1"> <ImageView android:id="@+id/imageView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="7sp" android:contentDescription="@string/icon" android:paddingEnd="10sp" android:paddingStart="10sp" android:src="@drawable/icon" tools:ignore="InefficientWeight" android:layout_weight="0.52" /> <TextView android:id="@+id/txt_itst" android:layout_width="match_parent" android:layout_height="wrap_content" android:freezesText="true" android:paddingEnd="10sp" android:paddingStart="10sp" android:fontFamily="sans-serif-smallcaps" android:text="@string/app_name" android:textAlignment="center" android:textColor="#cac6bc" android:textSize="32sp" /> <TextView android:id="@+id/txtLogin" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="20sp" android:paddingBottom="4sp" android:paddingEnd="16sp" android:paddingStart="16sp" android:text="@string/login_nw" android:textColor="#212121" android:textSize="16sp" /> <EditText android:id="@+id/Et_email" android:layout_width="match_parent" android:layout_height="35dp" android:layout_marginEnd="5sp" android:layout_marginStart="5sp" android:layout_marginTop="5sp" android:background="@drawable/passord" android:cursorVisible="false" android:ems="10" android:hint="@string/e_mail" android:inputType="textEmailAddress" android:paddingEnd="15sp" android:paddingStart="20sp" android:textColor="#d9d6d6" android:textColorHint="#292828" /> <EditText android:id="@+id/Password" android:layout_width="match_parent" android:layout_height="35dp" android:layout_marginEnd="5dp" android:textColor="#d9d6d6" android:layout_marginStart="5dp" android:layout_marginTop="20dp" android:background="@drawable/passord" android:cursorVisible="false" android:ems="10" android:hint="@string/pass_w" android:inputType="textPassword" android:paddingEnd="15dp" android:paddingStart="20dp" android:textColorHint="#292828" /> <Button android:id="@+id/B_login" android:layout_width="match_parent" android:layout_height="36dp" android:layout_marginEnd="5dp" android:layout_marginStart="5dp" android:layout_marginTop="20dp" android:background="@drawable/passord" android:text="@string/lgn" android:textColor="#ffffff" android:textSize="20sp" /> <Button android:id="@+id/B_register" android:layout_width="match_parent" android:layout_height="40dp" android:layout_marginEnd="5dp" android:layout_marginStart="5dp" android:layout_marginTop="20dp" android:background="@android:color/transparent" android:text="@string/reg_now" android:textColor="#ffffff" android:textSize="20sp" /> </LinearLayout> ##login.java## package com.example.sayuru.itstimetobeginsinanotherday; import android.content.Intent; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.toolbox.Volley; import org.json.JSONException; import org.json.JSONObject; public class login extends AppCompatActivity { EditText Etemail, Etpassword; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); Etemail=(EditText)findViewById(R.id.Et_username); Etpassword=(EditText)findViewById(R.id.Et_pssword); } public void onLogin(View view){ String email=Etemail.getText().toString(); String password=Etpassword.getText().toString(); String type="login"; BagroundWorker bagroundWorker=new BagroundWorker(this); bagroundWorker.execute(type, email, password); } } ##BackgroundWorker.java class## package com.example.xxxxx.xxxxxxxxxxx; import android.content.Context; import android.os.AsyncTask; import android.support.v7.app.AlertDialog; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; public class BagroundWorker extends AsyncTask<String, Void, String> { Context context; AlertDialog alertDialog; BagroundWorker(Context ctx){ context=ctx; } @Override protected String doInBackground(String... params) { String type=params[0]; String login_url="http:// 10.0.2.2/login.php"; if (type.equals("login")){ try { String email=params[1]; String password=params[2]; URL url=new URL(login_url); HttpURLConnection httpURLConnection= (HttpURLConnection)url.openConnection(); httpURLConnection.setRequestMethod("POST"); httpURLConnection.setDoOutput(true); httpURLConnection.setDoOutput(true); OutputStream outputStream=httpURLConnection.getOutputStream(); BufferedWriter bufferedWriter=new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8")); String post_data= URLEncoder.encode("email","UTF- 8")+"="+URLEncoder.encode(email,"UTF-8")+"&" +URLEncoder.encode("password","UTF- 8")+"="+URLEncoder.encode(password,"UTF-8"); bufferedWriter.write(post_data); bufferedWriter.flush(); bufferedWriter.close(); outputStream.close(); InputStream inputStream=httpURLConnection.getInputStream(); BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(inputStream,"iso-8859-1")); String result=""; String line=""; while ((line=bufferedReader.readLine())!=null){ result +=line; } bufferedReader.close(); inputStream.close(); httpURLConnection.disconnect(); return result; } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } return null; } @Override protected void onPreExecute() { alertDialog=new AlertDialog.Builder(context).create(); alertDialog.setTitle("login status"); } @Override protected void onPostExecute(String result) { alertDialog.setMessage(result); alertDialog.show(); } @Override protected void onProgressUpdate(Void... values) { super.onProgressUpdate(values); } } ##conn.php to communicate with server## <?php $db_name = "user"; $mysql_username = "root"; $mysql_password = ""; $server_name = "localhost"; $conn = mysqli_connect($server_name, $mysql_username, $mysql_password,$db_name); ?> ##login.php to login with server## <?php require "conn.php"; $user_email = $_POST["email"]; $user_pass = $_POST["password"]; $mysql_qry = "select * from details where email like '$user_email' and password like '$user_pass';"; $result = mysqli_query($conn ,$mysql_qry); if(mysqli_num_rows($result) > 0) { echo "login success !!!!! Welcome user"; } else { echo "login not success"; } ?>
0debug
int ff_j2k_init_component(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty, Jpeg2000QuantStyle *qntsty, int cbps, int dx, int dy, AVCodecContext *avctx) { uint8_t log2_band_prec_width, log2_band_prec_height; int reslevelno, bandno, gbandno = 0, ret, i, j, csize = 1; if (ret=ff_jpeg2000_dwt_init(&comp->dwt, comp->coord, codsty->nreslevels2decode-1, codsty->transform)) return ret; for (i = 0; i < 2; i++) csize *= comp->coord[i][1] - comp->coord[i][0]; comp->data = av_malloc_array(csize, sizeof(*comp->data)); if (!comp->data) return AVERROR(ENOMEM); comp->reslevel = av_malloc_array(codsty->nreslevels, sizeof(*comp->reslevel)); if (!comp->reslevel) return AVERROR(ENOMEM); for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++) { int declvl = codsty->nreslevels - reslevelno; Jpeg2000ResLevel *reslevel = comp->reslevel + reslevelno; for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) reslevel->coord[i][j] = ff_jpeg2000_ceildivpow2(comp->coord_o[i][j], declvl - 1); reslevel->log2_prec_width = codsty->log2_prec_widths[reslevelno]; reslevel->log2_prec_height = codsty->log2_prec_heights[reslevelno]; if (reslevelno == 0) reslevel->nbands = 1; else reslevel->nbands = 3; if (reslevel->coord[0][1] == reslevel->coord[0][0]) reslevel->num_precincts_x = 0; else reslevel->num_precincts_x = ff_jpeg2000_ceildivpow2(reslevel->coord[0][1], reslevel->log2_prec_width) - (reslevel->coord[0][0] >> reslevel->log2_prec_width); if (reslevel->coord[1][1] == reslevel->coord[1][0]) reslevel->num_precincts_y = 0; else reslevel->num_precincts_y = ff_jpeg2000_ceildivpow2(reslevel->coord[1][1], reslevel->log2_prec_height) - (reslevel->coord[1][0] >> reslevel->log2_prec_height); reslevel->band = av_malloc_array(reslevel->nbands, sizeof(*reslevel->band)); if (!reslevel->band) return AVERROR(ENOMEM); for (bandno = 0; bandno < reslevel->nbands; bandno++, gbandno++) { Jpeg2000Band *band = reslevel->band + bandno; int cblkno, precno; int nb_precincts; switch (qntsty->quantsty) { uint8_t gain; int numbps; case JPEG2000_QSTY_NONE: band->f_stepsize = 1; break; case JPEG2000_QSTY_SI: numbps = cbps + lut_gain[codsty->transform == FF_DWT53][bandno + (reslevelno > 0)]; band->f_stepsize = SHL(2048 + qntsty->mant[gbandno], 2 + numbps - qntsty->expn[gbandno]); break; case JPEG2000_QSTY_SE: gain = cbps; band->f_stepsize = pow(2.0, gain - qntsty->expn[gbandno]); band->f_stepsize *= (qntsty->mant[gbandno] / 2048.0 + 1.0); break; default: band->f_stepsize = 0; av_log(avctx, AV_LOG_ERROR, "Unknown quantization format\n"); break; } if (!av_codec_is_encoder(avctx->codec)) band->f_stepsize *= 0.5; band->i_stepsize = band->f_stepsize * (1 << 16); if (reslevelno == 0) { for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) band->coord[i][j] = ff_jpeg2000_ceildivpow2(comp->coord_o[i][j] - comp->coord_o[i][0], declvl - 1); log2_band_prec_width = reslevel->log2_prec_width; log2_band_prec_height = reslevel->log2_prec_height; band->log2_cblk_width = FFMIN(codsty->log2_cblk_width, reslevel->log2_prec_width); band->log2_cblk_height = FFMIN(codsty->log2_cblk_height, reslevel->log2_prec_height); } else { for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) band->coord[i][j] = ff_jpeg2000_ceildivpow2(comp->coord_o[i][j] - comp->coord_o[i][0] - (((bandno + 1 >> i) & 1) << declvl - 1), declvl); band->log2_cblk_width = FFMIN(codsty->log2_cblk_width, reslevel->log2_prec_width - 1); band->log2_cblk_height = FFMIN(codsty->log2_cblk_height, reslevel->log2_prec_height - 1); log2_band_prec_width = reslevel->log2_prec_width - 1; log2_band_prec_height = reslevel->log2_prec_height - 1; } for (j = 0; j < 2; j++) band->coord[0][j] = ff_jpeg2000_ceildiv(band->coord[0][j], dx); for (j = 0; j < 2; j++) band->coord[1][j] = ff_jpeg2000_ceildiv(band->coord[1][j], dy); band->prec = av_malloc_array(reslevel->num_precincts_x * reslevel->num_precincts_y, sizeof(*band->prec)); if (!band->prec) return AVERROR(ENOMEM); nb_precincts = reslevel->num_precincts_x * reslevel->num_precincts_y; for (precno = 0; precno < nb_precincts; precno++) { Jpeg2000Prec *prec = band->prec + precno; prec->coord[0][0] = (precno % reslevel->num_precincts_x) * (1 << log2_band_prec_width); prec->coord[0][0] = FFMAX(prec->coord[0][0], band->coord[0][0]); prec->coord[1][0] = (precno / reslevel->num_precincts_x) * (1 << log2_band_prec_height); prec->coord[1][0] = FFMAX(prec->coord[1][0], band->coord[1][0]); prec->coord[0][1] = prec->coord[0][0] + (1 << log2_band_prec_width); prec->coord[0][1] = FFMIN(prec->coord[0][1], band->coord[0][1]); prec->coord[1][1] = prec->coord[1][0] + (1 << log2_band_prec_height); prec->coord[1][1] = FFMIN(prec->coord[1][1], band->coord[1][1]); prec->nb_codeblocks_width = ff_jpeg2000_ceildivpow2(prec->coord[0][1] - prec->coord[0][0], band->log2_cblk_width); prec->nb_codeblocks_height = ff_jpeg2000_ceildivpow2(prec->coord[1][1] - prec->coord[1][0], band->log2_cblk_height); prec->cblkincl = ff_j2k_tag_tree_init(prec->nb_codeblocks_width, prec->nb_codeblocks_height); if (!prec->cblkincl) return AVERROR(ENOMEM); prec->zerobits = ff_j2k_tag_tree_init(prec->nb_codeblocks_width, prec->nb_codeblocks_height); if (!prec->zerobits) return AVERROR(ENOMEM); prec->cblk = av_malloc_array(prec->nb_codeblocks_width * prec->nb_codeblocks_height, sizeof(*prec->cblk)); if (!prec->cblk) return AVERROR(ENOMEM); for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) { Jpeg2000Cblk *cblk = prec->cblk + cblkno; uint16_t Cx0, Cy0; Cx0 = (prec->coord[0][0] >> band->log2_cblk_width) << band->log2_cblk_width; Cx0 = Cx0 + ((cblkno % prec->nb_codeblocks_width) << band->log2_cblk_width); cblk->coord[0][0] = FFMAX(Cx0, prec->coord[0][0]); Cy0 = (prec->coord[1][0] >> band->log2_cblk_height) << band->log2_cblk_height; Cy0 = Cy0 + ((cblkno / prec->nb_codeblocks_width) << band->log2_cblk_height); cblk->coord[1][0] = FFMAX(Cy0, prec->coord[1][0]); cblk->coord[0][1] = FFMIN(Cx0 + (1 << band->log2_cblk_width), prec->coord[0][1]); cblk->coord[1][1] = FFMIN(Cy0 + (1 << band->log2_cblk_height), prec->coord[1][1]); if((bandno + !!reslevelno) & 1) { cblk->coord[0][0] += comp->reslevel[reslevelno-1].coord[0][1] - comp->reslevel[reslevelno-1].coord[0][0]; cblk->coord[0][1] += comp->reslevel[reslevelno-1].coord[0][1] - comp->reslevel[reslevelno-1].coord[0][0]; } if((bandno + !!reslevelno) & 2) { cblk->coord[1][0] += comp->reslevel[reslevelno-1].coord[1][1] - comp->reslevel[reslevelno-1].coord[1][0]; cblk->coord[1][1] += comp->reslevel[reslevelno-1].coord[1][1] - comp->reslevel[reslevelno-1].coord[1][0]; } cblk->zero = 0; cblk->lblock = 3; cblk->length = 0; cblk->lengthinc = 0; cblk->npasses = 0; } } } } return 0; }
1threat
int qemu_loadvm_state(QEMUFile *f) { QLIST_HEAD(, LoadStateEntry) loadvm_handlers = QLIST_HEAD_INITIALIZER(loadvm_handlers); LoadStateEntry *le, *new_le; Error *local_err = NULL; uint8_t section_type; unsigned int v; int ret; int file_error_after_eof = -1; if (qemu_savevm_state_blocked(&local_err)) { error_report_err(local_err); return -EINVAL; } v = qemu_get_be32(f); if (v != QEMU_VM_FILE_MAGIC) { error_report("Not a migration stream"); return -EINVAL; } v = qemu_get_be32(f); if (v == QEMU_VM_FILE_VERSION_COMPAT) { error_report("SaveVM v2 format is obsolete and don't work anymore"); return -ENOTSUP; } if (v != QEMU_VM_FILE_VERSION) { error_report("Unsupported migration stream version"); return -ENOTSUP; } while ((section_type = qemu_get_byte(f)) != QEMU_VM_EOF) { uint32_t instance_id, version_id, section_id; SaveStateEntry *se; char idstr[257]; int len; trace_qemu_loadvm_state_section(section_type); switch (section_type) { case QEMU_VM_SECTION_START: case QEMU_VM_SECTION_FULL: section_id = qemu_get_be32(f); len = qemu_get_byte(f); qemu_get_buffer(f, (uint8_t *)idstr, len); idstr[len] = 0; instance_id = qemu_get_be32(f); version_id = qemu_get_be32(f); trace_qemu_loadvm_state_section_startfull(section_id, idstr, instance_id, version_id); se = find_se(idstr, instance_id); if (se == NULL) { error_report("Unknown savevm section or instance '%s' %d", idstr, instance_id); ret = -EINVAL; goto out; } if (version_id > se->version_id) { error_report("savevm: unsupported version %d for '%s' v%d", version_id, idstr, se->version_id); ret = -EINVAL; goto out; } le = g_malloc0(sizeof(*le)); le->se = se; le->section_id = section_id; le->version_id = version_id; QLIST_INSERT_HEAD(&loadvm_handlers, le, entry); ret = vmstate_load(f, le->se, le->version_id); if (ret < 0) { error_report("error while loading state for instance 0x%x of" " device '%s'", instance_id, idstr); goto out; } break; case QEMU_VM_SECTION_PART: case QEMU_VM_SECTION_END: section_id = qemu_get_be32(f); trace_qemu_loadvm_state_section_partend(section_id); QLIST_FOREACH(le, &loadvm_handlers, entry) { if (le->section_id == section_id) { break; } } if (le == NULL) { error_report("Unknown savevm section %d", section_id); ret = -EINVAL; goto out; } ret = vmstate_load(f, le->se, le->version_id); if (ret < 0) { error_report("error while loading state section id %d(%s)", section_id, le->se->idstr); goto out; } break; default: error_report("Unknown savevm section type %d", section_type); ret = -EINVAL; goto out; } } file_error_after_eof = qemu_file_get_error(f); if (qemu_get_byte(f) == QEMU_VM_VMDESCRIPTION) { uint32_t size = qemu_get_be32(f); uint8_t *buf = g_malloc(0x1000); while (size > 0) { uint32_t read_chunk = MIN(size, 0x1000); qemu_get_buffer(f, buf, read_chunk); size -= read_chunk; } g_free(buf); } cpu_synchronize_all_post_init(); ret = 0; out: QLIST_FOREACH_SAFE(le, &loadvm_handlers, entry, new_le) { QLIST_REMOVE(le, entry); g_free(le); } if (ret == 0) { ret = file_error_after_eof; } return ret; }
1threat
How to find an optimum location point on a line? : <p>A line is given and a bunch of points are given. I have to find a point on line for which sum of distances from given points is minimum. <strong>I could't find any algorithm to implement in c</strong>. Please help, thanks in advance.</p>
0debug
How to reverse the scroll movement? : <p>I try to make a reverse navigation. I show the page from the bottom with scrollTo. I want reverse the wheel movement, when the whell movement is down the page goes to the top.</p> <p>The body has a fix height so I use:</p> <pre><code> window.scrollTo(0, 2000); </code></pre>
0debug
static uint32_t taihu_cpld_readl (void *opaque, hwaddr addr) { uint32_t ret; ret = taihu_cpld_readb(opaque, addr) << 24; ret |= taihu_cpld_readb(opaque, addr + 1) << 16; ret |= taihu_cpld_readb(opaque, addr + 2) << 8; ret |= taihu_cpld_readb(opaque, addr + 3); return ret; }
1threat
The page will strangely refresh when I click the button : <p>Here's my code:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="zh-CN"&gt; &lt;head&gt; &lt;title&gt;中国工程院无线投票系统&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8"&gt; &lt;link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt; &lt;link rel="stylesheet" href="css/login.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="container" id="login"&gt; &lt;div class="col-md-6 col-md-offset-3"&gt; &lt;div class="page-header"&gt; &lt;h1&gt;中国工程院无线投票系统&lt;/h1&gt; &lt;/div&gt; &lt;form&gt; &lt;div class="form-group"&gt; &lt;label&gt;用户名&lt;/label&gt; &lt;div class="input-group"&gt; &lt;div class="input-group-addon"&gt;&lt;i class="glyphicon glyphicon-user"&gt;&lt;/i&gt;&lt;/div&gt; &lt;input type="text" v-model="account.username" class="form-control" placeholder="Username" required autofocus&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label&gt;密码&lt;/label&gt; &lt;div class="input-group"&gt; &lt;div class="input-group-addon"&gt;&lt;i class="glyphicon glyphicon-lock"&gt;&lt;/i&gt;&lt;/div&gt; &lt;input type="password" v-model="account.password" class="form-control" placeholder="Password" required&gt; &lt;/div&gt; &lt;/div&gt; &lt;button v-on:click="validate" class="btn btn-lg btn-primary btn-block"&gt;登录&lt;/button&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;script src="https://unpkg.com/vue/dist/vue.js"&gt;&lt;/script&gt; &lt;script src="https://unpkg.com/axios@0.12.0/dist/axios.min.js"&gt;&lt;/script&gt; &lt;script src="js/login.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>In the login.js file:</p> <pre><code>var login = new Vue({ el:"#login", data:{account:{}}, methods:{ validate:function () { }, say: function (){ } } }); </code></pre> <p>At the beginning, I thought it had something to do with the code within method "validate". However, after I deleted all the code inside, the page still get refreshed when I click the button which is not supposed to happen.</p>
0debug
How to know which typescript version running on angular 4 project : <p>So i did <code>ng -v</code> it shows me everything except typescript, so how can i check Typescript version of my angular 4 project.</p>
0debug
I'm trying to declare a cursor. But I would like a certain parameter to be user input. However it is not compiled and displaying the following error : Code: DECLARE CURSOR currsor1 IN SELECT messid, studentname, messname FROM studentsmessdata WHERE messid = &messid; Error Message: old:DECLARE CURSOR currsor1 IN SELECT messid, studentname, messname FROM studentsmessdata WHERE messid = &messid; new:DECLARE CURSOR currsor1 IN SELECT messid, studentname, messname FROM studentsmessdata WHERE messid = 1; Error starting at line 1 in command: DECLARE CURSOR currsor1 IN SELECT messid, studentname, messname FROM studentsmessdata WHERE messid = &messid; Error report: ORA-06550: line 2, column 19: PLS-00103: Encountered the symbol "IN" when expecting one of the following: ( ; is return The symbol "is was inserted before "IN" to continue. ORA-06550: line 7, column 22: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: begin function pragma procedure subtype type <an identifier> <a double-quoted delimited-identifier> current cursor delete exists prior 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action:
0debug
av_cold int ff_vc2enc_init_transforms(VC2TransformContext *s, int p_width, int p_height) { s->vc2_subband_dwt[VC2_TRANSFORM_9_7] = vc2_subband_dwt_97; s->vc2_subband_dwt[VC2_TRANSFORM_5_3] = vc2_subband_dwt_53; s->vc2_subband_dwt[VC2_TRANSFORM_HAAR] = vc2_subband_dwt_haar; s->vc2_subband_dwt[VC2_TRANSFORM_HAAR_S] = vc2_subband_dwt_haar_shift; s->buffer = av_malloc(2*p_width*p_height*sizeof(dwtcoef)); if (!s->buffer) return 1; return 0; }
1threat
How does Firebase Analytics define a session? : <p>Firebase Analytics has a number of stats around "Sessions" (like "Sessions per user" and "Average session length"), but how exactly does Firebase Analytics define a session?</p>
0debug
navigation drawer baseactivity get crashed : hey guys when i choose my second activity in the navigation drawer ill get crashed. How to fix this? Please help me. Newbie Here. here is my code in my BaseActivity public abstract class BaseActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener,SearchView.OnQueryTextListener, SearchView.OnCloseListener { private LinearLayout linear2; private ListView mListView; private SearchView searchView; private CustomersDbAdapter mDbHelper; private TextView customerText; private TextView nameText; private TextView addressText; private TextView cityText; private TextView stateText; private TextView zipCodeText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); toolbar.setTitleTextColor(Color.parseColor("#ffffff")); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this);} My MainActivity public class MainActivity extends BaseActivity{ public static final double NORTH_WEST_LATITUDE = 39.9639998777094; public static final double NORTH_WEST_LONGITUDE = -75.17261900652977; public static final double SOUTH_EAST_LATITUDE = 39.93699709962642; public static final double SOUTH_EAST_LONGITUDE = -75.12462846235614; private TileView tileView; @Override public void onCreate( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); ImageView imageView2 = (ImageView) findViewById(R.id.indicator); imageView2.setImageResource(R.drawable.g); tileView = new TileView( this ); tileView.setId( R.id.tileview_id ); tileView.setSaveEnabled( true ); ((RelativeLayout)findViewById(R.id.mainFrame)).addView(tileView); // we'll reference the TileView multiple times TileView tileView = getTileView(); // size and geolocation tileView.setSize( 5000, 5000 ); // we won't use a downsample here, so color it similarly to tiles tileView.setBackgroundColor( 0xFFe7e7e7 ); and vertical bottom tileView.setMarkerAnchorPoints( -0.5f, -1.0f ); // provide the corner coordinates for relative positioning tileView.defineBounds( NORTH_WEST_LONGITUDE, NORTH_WEST_LATITUDE, SOUTH_EAST_LONGITUDE, SOUTH_EAST_LATITUDE ); } Please help me. Newbie Here.
0debug
How can I change Sourcetree theme? : <p>I use all my development's tools in the dark theme except Source Tree.</p> <p>It has not option in its configuration to change theme.</p> <p>Is there any other way to change for a dark theme?</p>
0debug
Project 'Pods' was rejected as an implicit dependency for 'Pods.framework' because its architectures didn't contain all required architectures : <p>Target 'AAA-Pods' for project 'Pods' was rejected as an implicit dependency for 'Pods_AAA.framework' because its architectures 'x86_64' didn't contain all required architectures 'i386 x86_64'.</p> <p>This appears as warning, then linker error appears.</p>
0debug
Let a = 5 (or any other integer). Use that to produce a = ’0..1..2..3..4’ in just one line : So far what I have come up with is a = list(range(5)), however I need it to output in the format of '#,#,#,#' so I thought oh this is just a string format so I just did a = str(list(range(5))), but this just makes a [#,#,#,#] a string, So im not sure if I am just missing a simple function, or if using range is the correct function.
0debug
.NET Core use Configuration to bind to Options with Array : <p>Using the .NET Core <code>Microsoft.Extensions.Configuration</code> <strong>is it possible to bind to a Configuration to an object that contains an array?</strong></p> <p><code>ConfigurationBinder</code> has a method <a href="https://github.com/aspnet/Configuration/blob/dev/src/Microsoft.Extensions.Configuration.Binder/ConfigurationBinder.cs#L273-L305" rel="noreferrer">BindArray</a>, so I'd assume it would work.</p> <p>But when I try it out I get an exception: </p> <blockquote> <p><code>System.NotSupportedException: ArrayConverter cannot convert from System.String.</code></p> </blockquote> <p>Here's my slimmed down code:</p> <pre><code>public class Test { private class ExampleOption { public int[] Array {get;set;} } [Test] public void CanBindArray() { // ARRANGE var config = new ConfigurationBuilder() .AddInMemoryCollection(new List&lt;KeyValuePair&lt;string, string&gt;&gt; { new KeyValuePair&lt;string, string&gt;("Array", "[1,2,3]") }) .Build(); var exampleOption= new ExampleOption(); // ACT config.Bind(complexOptions); // throws exception // ASSERT exampleOption.ShouldContain(1); } } </code></pre>
0debug
Why should you use 2D array of structs? : I curious if there are use cases for a 2D array of structs. typedef struct { //member variables }myStruct; myStruct array2D[x][y]; //Uses cases of array2D[x][y]? Do we need them?
0debug
How to sum all the numbers that I entered in the console : So my code looks like this <import java.util.Scanner; public class homework3 { public static void main(String[] args) { System.out.println("Enter a positive number: "); Scanner scan = new Scanner(System.in); int i = scan.nextInt(); int y = 1; int sum = 0; int e = 2; while (e <=i ) { System.out.print(" " + e); e += 2; } } } > I'm trying to sum all of the numbers that go up to the number that's entered.
0debug
void helper_rfci(CPUPPCState *env) { do_rfi(env, env->spr[SPR_BOOKE_CSRR0], SPR_BOOKE_CSRR1, ~((target_ulong)0x3FFF0000), 0); }
1threat
av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx) { int cpu_flags = av_get_cpu_flags(); #if HAVE_7REGS && HAVE_INLINE_ASM if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_CMOV) c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_cmov; #endif if (X86_MMX(cpu_flags)) { #if HAVE_INLINE_ASM const int idct_algo = avctx->idct_algo; if (avctx->lowres == 0 && avctx->bits_per_raw_sample <= 8) { if (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_SIMPLEMMX) { c->idct_put = ff_simple_idct_put_mmx; c->idct_add = ff_simple_idct_add_mmx; c->idct = ff_simple_idct_mmx; c->idct_permutation_type = FF_SIMPLE_IDCT_PERM; } else if (idct_algo == FF_IDCT_XVIDMMX) { if (cpu_flags & AV_CPU_FLAG_SSE2) { c->idct_put = ff_idct_xvid_sse2_put; c->idct_add = ff_idct_xvid_sse2_add; c->idct = ff_idct_xvid_sse2; c->idct_permutation_type = FF_SSE2_IDCT_PERM; } else if (cpu_flags & AV_CPU_FLAG_MMXEXT) { c->idct_put = ff_idct_xvid_mmxext_put; c->idct_add = ff_idct_xvid_mmxext_add; c->idct = ff_idct_xvid_mmxext; } else { c->idct_put = ff_idct_xvid_mmx_put; c->idct_add = ff_idct_xvid_mmx_add; c->idct = ff_idct_xvid_mmx; } } } #endif dsputil_init_mmx(c, avctx, cpu_flags); } if (X86_MMXEXT(cpu_flags)) dsputil_init_mmxext(c, avctx, cpu_flags); if (X86_SSE(cpu_flags)) dsputil_init_sse(c, avctx, cpu_flags); if (X86_SSE2(cpu_flags)) dsputil_init_sse2(c, avctx, cpu_flags); if (EXTERNAL_SSSE3(cpu_flags)) dsputil_init_ssse3(c, avctx, cpu_flags); if (EXTERNAL_SSE4(cpu_flags)) dsputil_init_sse4(c, avctx, cpu_flags); if (CONFIG_ENCODERS) ff_dsputilenc_init_mmx(c, avctx); }
1threat
Android 8.0: IllegalBlocksizeException when using RSA/ECB/OAEPWithSHA-512AndMGF1Padding : <p>I usually find answers for most of our issues here but this time I need to ask :-).</p> <p>We have encountered a problem with RSA encryption / decryption in one of our Apps running on Android 8.0 (API level 26).</p> <p>We've been using RSA with "RSA/ECB/OAEPWithSHA-256AndMGF1Padding", which works fine on all versions up to Android 7.1. The same code running on Android 8.0 throws an IllegalBlocksizeException when calling Cipher.doFinal().</p> <p>Here is the code to reproduce the issue:</p> <pre><code>private KeyStore mKeyStore; private static final String KEY_ALIAS = "MyKey"; void testEncryption() throws NoSuchProviderException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, KeyStoreException, IOException, CertificateException, BadPaddingException, IllegalBlockSizeException, InvalidKeyException, UnrecoverableEntryException, NoSuchPaddingException { mKeyStore = KeyStore.getInstance("AndroidKeyStore"); mKeyStore.load(null); // Generate Key Pair ------------------------------------- KeyPairGenerator kpg = KeyPairGenerator.getInstance(KeyProperties.KEY_ALGORITHM_RSA, "AndroidKeyStore"); kpg.initialize(new KeyGenParameterSpec.Builder( KEY_ALIAS, KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT) .setDigests(KeyProperties.DIGEST_SHA256, KeyProperties.DIGEST_SHA512) .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_RSA_OAEP) .setKeySize(2048) .build()); KeyPair kp = kpg.generateKeyPair(); // Encrypt ----------------------------------------------- KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry)mKeyStore.getEntry(KEY_ALIAS, null); PublicKey publicKey = (PublicKey) privateKeyEntry.getCertificate().getPublicKey(); Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding"); cipher.init(Cipher.ENCRYPT_MODE, publicKey); String x = "It doesn't have to be perfect, it's just for demonstration."; byte [] vals = cipher.doFinal(x.getBytes("UTF-8")); byte[] encryptedBytes = Base64.encode(vals, Base64.DEFAULT); String encryptedText = new String(encryptedBytes, "UTF-8"); // Decrypt ----------------------------------------------- PrivateKey privateKey = privateKeyEntry.getPrivateKey(); Cipher output = Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding"); output.init(Cipher.DECRYPT_MODE, privateKey/*, spec */); byte[] bxx = Base64.decode(encryptedText, Base64.DEFAULT); byte[] bytes = output.doFinal(bxx); // &lt;= throws IllegalBlocksizeException String finalText = new String(bytes, 0, bytes.length, "UTF-8"); } </code></pre> <p>I tried other padding algorithms too. "RSA/ECB/OAEPWithSHA-1AndMGF1Padding" works and also "RSA/ECB/PKCS1Padding" works fine. As a workaround I could change the padding but this might cause problems when updating from a previous version of the App which used "RSA/ECB/OAEPWithSHA-256AndMGF1Padding" because stored data could not be read anymore.</p> <p>Has anybody here the same problem and maybe an idea how to fix it without changing the padding?</p> <p>Thanks in advance and greetings from Hamburg, Dimitri</p>
0debug
static inline uint16_t mipsdsp_sub_i16(int16_t a, int16_t b, CPUMIPSState *env) { int16_t temp; temp = a - b; if (MIPSDSP_OVERFLOW(a, -b, temp, 0x8000)) { set_DSPControl_overflow_flag(1, 20, env); } return temp; }
1threat
C# Write a program that computes the average of five exam scores : <p>I am doing my homework. English is not my first language, so I am confused.</p> <p>This is the question: Write a program that computes the average of five exam scores. Declare and perform a compile-time initialization with the five exam values. Declare integer memory locations for the exam values. Use an integer constant to define the number of scores. Print all scores. The average value should be formatted with two digits to the right of the decimal. Rerun the application with different values. Be sure to desk check your results.</p> <p>I am not sure what is "a compile-time initialization" mean? What is "Declare integer memory locations for the exam values." want me to do? What is "desk check" mean?</p> <p>Here is my c# code:</p> <pre><code>using System; using static System.Console; namespace Chap2_1 { class Chap2_1 { static void Main() { int score1; int score2; int score3; int score4; int score5; double average; Console.Write("Please enter the 1st score: "); score1 = Convert.ToInt32(Console.ReadLine()); Console.Write("Please enter the 2nd score: "); score2 = Convert.ToInt32(Console.ReadLine()); Console.Write("Please enter the 3rd score: "); score3 = Convert.ToInt32(Console.ReadLine()); Console.Write("Please enter the 4th score: "); score4 = Convert.ToInt32(Console.ReadLine()); Console.Write("Please enter the 5th score: "); score5 = Convert.ToInt32(Console.ReadLine()); average = (score1+score2+score3+score4+score5) /5; Console.Write("Average score is " + "{0:N2}", average); Console.ReadKey(); } } } </code></pre>
0debug
Get information from between two tags in Java HtmlUnit : <pre><code>&lt;span&gt; &lt;a&gt;&lt;/a&gt; Hello &lt;div&gt;A very lot of unnecessary text&lt;/div&gt; &lt;/span&gt; </code></pre> <p>So I want to extract the "Hello" from the web page. I can select the span via XPath, but if I call .getTextContent() on it I also get what's in the div, but I want this unnecessary text not to be extracted. How can I do that?</p>
0debug
static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *decoded, int stride, int level, int threshold, int lambda, int intra){ int count, y, x, i, j, split, best_mean, best_score, best_count; int best_vector[6]; int block_sum[7]= {0, 0, 0, 0, 0, 0}; int w= 2<<((level+2)>>1); int h= 2<<((level+1)>>1); int size=w*h; int16_t block[7][256]; const int8_t *codebook_sum, *codebook; const uint16_t (*mean_vlc)[2]; const uint8_t (*multistage_vlc)[2]; best_score=0; if(intra){ codebook_sum= svq1_intra_codebook_sum[level]; codebook= svq1_intra_codebooks[level]; mean_vlc= svq1_intra_mean_vlc; multistage_vlc= svq1_intra_multistage_vlc[level]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int v= src[x + y*stride]; block[0][x + w*y]= v; best_score += v*v; block_sum[0] += v; } } }else{ codebook_sum= svq1_inter_codebook_sum[level]; codebook= svq1_inter_codebooks[level]; mean_vlc= svq1_inter_mean_vlc + 256; multistage_vlc= svq1_inter_multistage_vlc[level]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int v= src[x + y*stride] - ref[x + y*stride]; block[0][x + w*y]= v; best_score += v*v; block_sum[0] += v; } } } best_count=0; best_score -= ((block_sum[0]*block_sum[0])>>(level+3)); best_mean= (block_sum[0] + (size>>1)) >> (level+3); if(level<4){ for(count=1; count<7; count++){ int best_vector_score= INT_MAX; int best_vector_sum=-999, best_vector_mean=-999; const int stage= count-1; const int8_t *vector; for(i=0; i<16; i++){ int sum= codebook_sum[stage*16 + i]; int sqr, diff, mean, score; vector = codebook + stage*size*16 + i*size; sqr = s->dsp.ssd_int8_vs_int16(vector, block[stage], size); diff= block_sum[stage] - sum; mean= (diff + (size>>1)) >> (level+3); assert(mean >-300 && mean<300); if(intra) mean= av_clip(mean, 0, 255); else mean= av_clip(mean, -256, 255); score= sqr - ((diff*(int64_t)diff)>>(level+3)); if(score < best_vector_score){ best_vector_score= score; best_vector[stage]= i; best_vector_sum= sum; best_vector_mean= mean; } } assert(best_vector_mean != -999); vector= codebook + stage*size*16 + best_vector[stage]*size; for(j=0; j<size; j++){ block[stage+1][j] = block[stage][j] - vector[j]; } block_sum[stage+1]= block_sum[stage] - best_vector_sum; best_vector_score += lambda*(+ 1 + 4*count + multistage_vlc[1+count][1] + mean_vlc[best_vector_mean][1]); if(best_vector_score < best_score){ best_score= best_vector_score; best_count= count; best_mean= best_vector_mean; } } } split=0; if(best_score > threshold && level){ int score=0; int offset= (level&1) ? stride*h/2 : w/2; PutBitContext backup[6]; for(i=level-1; i>=0; i--){ backup[i]= s->reorder_pb[i]; } score += encode_block(s, src , ref , decoded , stride, level-1, threshold>>1, lambda, intra); score += encode_block(s, src + offset, ref + offset, decoded + offset, stride, level-1, threshold>>1, lambda, intra); score += lambda; if(score < best_score){ best_score= score; split=1; }else{ for(i=level-1; i>=0; i--){ s->reorder_pb[i]= backup[i]; } } } if (level > 0) put_bits(&s->reorder_pb[level], 1, split); if(!split){ assert((best_mean >= 0 && best_mean<256) || !intra); assert(best_mean >= -256 && best_mean<256); assert(best_count >=0 && best_count<7); assert(level<4 || best_count==0); put_bits(&s->reorder_pb[level], multistage_vlc[1 + best_count][1], multistage_vlc[1 + best_count][0]); put_bits(&s->reorder_pb[level], mean_vlc[best_mean][1], mean_vlc[best_mean][0]); for (i = 0; i < best_count; i++){ assert(best_vector[i]>=0 && best_vector[i]<16); put_bits(&s->reorder_pb[level], 4, best_vector[i]); } for(y=0; y<h; y++){ for(x=0; x<w; x++){ decoded[x + y*stride]= src[x + y*stride] - block[best_count][x + w*y] + best_mean; } } } return best_score; }
1threat
Is there any way to invoke PowerQuery/M outside of Excel or PowerBI? : <p>Our BI team is really growing to like the <a href="https://support.office.com/en-us/article/Introduction-to-Microsoft-Power-Query-for-Excel-6E92E2F4-2079-4E1F-BAD5-89F6269CD605?ui=en-US&amp;rs=en-US&amp;ad=US" rel="noreferrer">Power Query ETL tool</a> used within Excel and Power BI. The functional language <a href="https://msdn.microsoft.com/en-us/library/mt211003.aspx" rel="noreferrer">M/PowerQuery</a> has great utility and it would be nice to be able to utilize outside of the context of PowerBI.</p> <p>Is there or are there plans for exposing "M" as a stand-alone module, callable form the likes of c# or PowerShell?</p>
0debug
What's the effect of -Yrangepos other than giving me source locations in macros : <p>So I googl'ed a bit, but no information other than the sparse:</p> <pre class="lang-none prettyprint-override"><code>-Yrangepos Use range positions for syntax trees. </code></pre> <p>Ok. And I know I need to use it if I want to capture source fragments in a macro.</p> <p>Now my two questions are:</p> <ul> <li>why is this not on by default?</li> <li>are there any side-effects to using it (such as increasing the class file size)?</li> </ul>
0debug
static void put_codebook_header(PutBitContext * pb, codebook_t * cb) { int i; int ordered = 0; put_bits(pb, 24, 0x564342); put_bits(pb, 16, cb->ndimentions); put_bits(pb, 24, cb->nentries); for (i = 1; i < cb->nentries; i++) if (cb->entries[i].len < cb->entries[i-1].len) break; if (i == cb->nentries) ordered = 1; put_bits(pb, 1, ordered); if (ordered) { int len = cb->entries[0].len; put_bits(pb, 5, len); i = 0; while (i < cb->nentries) { int j; for (j = 0; j+i < cb->nentries; j++) if (cb->entries[j+i].len != len) break; put_bits(pb, ilog(cb->nentries - i), j); i += j; len++; } } else { int sparse = 0; for (i = 0; i < cb->nentries; i++) if (!cb->entries[i].len) break; if (i != cb->nentries) sparse = 1; put_bits(pb, 1, sparse); for (i = 0; i < cb->nentries; i++) { if (sparse) put_bits(pb, 1, !!cb->entries[i].len); if (cb->entries[i].len) put_bits(pb, 5, cb->entries[i].len - 1); } } put_bits(pb, 4, cb->lookup); if (cb->lookup) { int tmp = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries); int bits = ilog(cb->quantlist[0]); for (i = 1; i < tmp; i++) bits = FFMAX(bits, ilog(cb->quantlist[i])); put_float(pb, cb->min); put_float(pb, cb->delta); put_bits(pb, 4, bits - 1); put_bits(pb, 1, cb->seq_p); for (i = 0; i < tmp; i++) put_bits(pb, bits, cb->quantlist[i]); } }
1threat
Wordpress site wont load : Im getting this issue anyone be able to help me ?? Warning: require_once(/customers/4/7/0/jetpackprint.co.uk/httpd.www/wp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in /customers/4/7/0/jetpackprint.co.uk/httpd.www/wp-content/themes/xstore/framework/thirdparty/tgm-plugin-activation/class-tgm-plugin-activation.php on line 2170 Fatal error: require_once(): Failed opening required '/customers/4/7/0/jetpackprint.co.uk/httpd.www/wp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in /customers/4/7/0/jetpackprint.co.uk/httpd.www/wp-content/themes/xstore/framework/thirdparty/tgm-plugin-activation/class-tgm-plugin-activation.php on line 2170
0debug
static int local_link(FsContext *ctx, V9fsPath *oldpath, V9fsPath *dirpath, const char *name) { int ret; V9fsString newpath; char buffer[PATH_MAX], buffer1[PATH_MAX]; v9fs_string_init(&newpath); v9fs_string_sprintf(&newpath, "%s/%s", dirpath->data, name); ret = link(rpath(ctx, oldpath->data, buffer), rpath(ctx, newpath.data, buffer1)); if (!ret && (ctx->export_flags & V9FS_SM_MAPPED_FILE)) { ret = local_create_mapped_attr_dir(ctx, newpath.data); if (ret < 0) { goto err_out; } ret = link(local_mapped_attr_path(ctx, oldpath->data, buffer), local_mapped_attr_path(ctx, newpath.data, buffer1)); if (ret < 0 && errno != ENOENT) { goto err_out; } } err_out: v9fs_string_free(&newpath); return ret; }
1threat
How to find if users exist in firebase : I am using Firebase web sdk, and know methods to check wether a child in a collection exists or not. However I can't find a concise example checking the existance of an user, without trying to sign him/her in. Do you have any piece of code we could reuse?
0debug
SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockDriverState *bdrv, int unit, bool removable, int bootindex, const char *serial, Error **errp) { const char *driver; DeviceState *dev; Error *err = NULL; driver = bdrv_is_sg(bdrv) ? "scsi-generic" : "scsi-disk"; dev = qdev_create(&bus->qbus, driver); qdev_prop_set_uint32(dev, "scsi-id", unit); if (bootindex >= 0) { object_property_set_int(OBJECT(dev), bootindex, "bootindex", &error_abort); } if (object_property_find(OBJECT(dev), "removable", NULL)) { qdev_prop_set_bit(dev, "removable", removable); } if (serial && object_property_find(OBJECT(dev), "serial", NULL)) { qdev_prop_set_string(dev, "serial", serial); } if (qdev_prop_set_drive(dev, "drive", bdrv) < 0) { error_setg(errp, "Setting drive property failed"); object_unparent(OBJECT(dev)); return NULL; } object_property_set_bool(OBJECT(dev), true, "realized", &err); if (err != NULL) { error_propagate(errp, err); object_unparent(OBJECT(dev)); return NULL; } return SCSI_DEVICE(dev); }
1threat
Update Android Support Library to 23.2.0 cause error: XmlPullParserException Binary XML file line #17<vector> tag requires viewportWidth > 0 : <p>I try to update my Support Library up to 23.2.0 and face this error:</p> <pre><code>Exception while inflating &lt;vector&gt; org.xmlpull.v1.XmlPullParserException: Binary XML file line #17&lt;vector&gt; tag requires viewportWidth &gt; 0 at android.support.graphics.drawable.VectorDrawableCompat.updateStateFromTypedArray(VectorDrawableCompat.java:535) at android.support.graphics.drawable.VectorDrawableCompat.inflate(VectorDrawableCompat.java:472) at android.support.graphics.drawable.VectorDrawableCompat.createFromXmlInner(VectorDrawableCompat.java:436) at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:829) at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:303) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:178) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:173) at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:60) at android.support.v7.widget.Toolbar.&lt;init&gt;(Toolbar.java:254) at android.support.v7.widget.Toolbar.&lt;init&gt;(Toolbar.java:196) at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:417) at android.view.LayoutInflater.createView(LayoutInflater.java:594) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at android.view.LayoutInflater.inflate(LayoutInflater.java:353) at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129) at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121) at android.app.Activity.performCreate(Activity.java:5133) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) at android.app.ActivityThread.access$600(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>And</p> <pre><code>FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.chotot.vn.dev/com.chotot.vn.v2.activities.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class android.support.v7.widget.Toolbar at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) at android.app.ActivityThread.access$600(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class android.support.v7.widget.Toolbar at android.view.LayoutInflater.createView(LayoutInflater.java:620) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at android.view.LayoutInflater.inflate(LayoutInflater.java:353) at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129) at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121) at android.app.Activity.performCreate(Activity.java:5133) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) at android.app.ActivityThread.access$600(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:417) at android.view.LayoutInflater.createView(LayoutInflater.java:594) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at android.view.LayoutInflater.inflate(LayoutInflater.java:353) at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129) at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121) at android.app.Activity.performCreate(Activity.java:5133) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) at android.app.ActivityThread.access$600(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_ic_ab_back_material.xml from drawable resource ID #0x7f020016 at android.content.res.Resources.loadDrawable(Resources.java:2091) at android.content.res.Resources.getDrawable(Resources.java:695) at android.support.v7.widget.TintResources.superGetDrawable(TintResources.java:48) at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(AppCompatDrawableManager.java:374) at android.support.v7.widget.TintResources.getDrawable(TintResources.java:44) at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:180) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:173) at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:60) at android.support.v7.widget.Toolbar.&lt;init&gt;(Toolbar.java:254) at android.support.v7.widget.Toolbar.&lt;init&gt;(Toolbar.java:196) at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:417) at android.view.LayoutInflater.createView(LayoutInflater.java:594) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at android.view.LayoutInflater.inflate(LayoutInflater.java:353) at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129) at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121) at android.app.Activity.performCreate(Activity.java:5133) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) at android.app.ActivityThread.access$600(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:897) at android.graphics.drawable.Drawable.createFromXml(Drawable.java:837) at android.content.res.Resources.loadDrawable(Resources.java:2087) at android.content.res.Resources.getDrawable(Resources.java:695) at android.support.v7.widget.TintResources.superGetDrawable(TintResources.java:48) at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(AppCompatDrawableManager.java:374) at android.support.v7.widget.TintResources.getDrawable(TintResources.java:44) at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:180) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:173) at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:60) at android.support.v7.widget.Toolbar.&lt;init&gt;(Toolbar.java:254) at android.support.v7.widget.Toolbar.&lt;init&gt;(Toolbar.java:196) at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:417) at android.view.LayoutInflater.createView(LayoutInflater.java:594) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at android.view.LayoutInflater.inflate(LayoutInflater.java:353) at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129) at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121) at android.app.Activity.performCreate(Activity.java:5133) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) at android.app.ActivityThread.access$600(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>My <code>activity_main.xml</code></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"&gt; &lt;fragment android:id="@+id/f_actionbar" android:name="com.chotot.vn.fragments.ActionBarFragment" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;android.support.v7.widget.Toolbar android:id="@+id/main_tool_bar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:layout_alignParentTop="true" android:background="@color/action_bar_bg"&gt; &lt;RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"&gt; &lt;include android:id="@+id/main_action_bar_layout" layout="@layout/layout_actionbar_custom_search" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:layout_gravity="top" /&gt; &lt;LinearLayout android:id="@+id/main_action_bar_layout_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/main_action_bar_layout" android:orientation="vertical" /&gt; &lt;/RelativeLayout&gt; &lt;/android.support.v7.widget.Toolbar&gt; &lt;FrameLayout android:id="@+id/layout_content" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@id/main_tool_bar" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p><strong>How can I fix it?</strong></p>
0debug
I ENTER THIS CODE INTO MYSQL SERVER TO 'Write an SQL that will display authors and their publications even authors that have no publications ' : SELECT a.auth_name AS 'NAME', p.pub_title AS 'PUBLICATION' FROM publication p LEFT OUTER JOIN author_publication d ON p.pub_id = d.pub_id LEFT OUTER JOIN( SELECT a.auth_name FROM author a,author_publication d WHERE a.auth_id = d.auth_id); GO AND GET THE ERROR Msg 102, Level 15, State 1, Line 8 Incorrect syntax near ';'.
0debug
e1000e_setup_tx_offloads(E1000ECore *core, struct e1000e_tx *tx) { if (tx->props.tse && tx->props.cptse) { net_tx_pkt_build_vheader(tx->tx_pkt, true, true, tx->props.mss); net_tx_pkt_update_ip_checksums(tx->tx_pkt); e1000x_inc_reg_if_not_full(core->mac, TSCTC); return; } if (tx->props.sum_needed & E1000_TXD_POPTS_TXSM) { net_tx_pkt_build_vheader(tx->tx_pkt, false, true, 0); } if (tx->props.sum_needed & E1000_TXD_POPTS_IXSM) { net_tx_pkt_update_ip_hdr_checksum(tx->tx_pkt); } }
1threat
void av_register_input_format(AVInputFormat *format) { AVInputFormat **p = &first_iformat; while (*p != NULL) p = &(*p)->next; *p = format; format->next = NULL; }
1threat
What is $t in Vue.js : <p>First time ever working with <code>Vue.js</code> and have no clue what is <code>$t</code>. For instance I have someone's code like this: </p> <pre><code> &lt;li class="category-filter__back"&gt; &lt;button class="category-filter__button" @click="back(categoryPath)"&gt; {{ $t(backButtonText) }} &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; what is this $t? &lt;/button&gt; &lt;/li&gt; </code></pre> <p>Can't seem to find any concrete answer for this. </p>
0debug
Android firebase 9.0.0 setValue to serialize enums : <p>I have this class making use of enums. Parsing to Firebase json used to work just fine - using Jackson. While migrating to firebase-database:9.0.0 I get the following:</p> <blockquote> <p>com.google.firebase.database.DatabaseException: No properties to serialize found on class .... MyClass$Kind</p> </blockquote> <p>where Kind is the enum declared type. The class:</p> <pre><code>public class MyClass { public enum Kind {W,V,U}; private Double value; private Kind kind; /* Dummy Constructor */ public MyClass() {} public Double getValue() { return value; } public void setValue(Double value) { this.value = value; } public Kind getKind() { return kind; } public void setKind(Kind kind) { this.kind = kind; } } </code></pre> <p>I suspect Firebase no longer uses Jackson when serializing setValue(new MyClass()).</p> <p>Is there a way to get enum types serialized? Or some means to be explicit with respect to the serializer method?</p>
0debug
Need to create a button for a link using jquery : <p>I am having a link on the website which says "USE CURRENT LOCATION". I want to change that link to a shape of button. ID of the button is btnGeolocation</p> <p>You can have a look at that link in this page <a href="https://order.subway.com/Stores/Find.aspx?pid=1#pg1" rel="nofollow noreferrer">https://order.subway.com/Stores/Find.aspx?pid=1#pg1</a></p>
0debug
int net_init_hubport(const NetClientOptions *opts, const char *name, NetClientState *peer) { const NetdevHubPortOptions *hubport; assert(opts->kind == NET_CLIENT_OPTIONS_KIND_HUBPORT); hubport = opts->hubport; if (peer) { return -EINVAL; } net_hub_add_port(hubport->hubid, name); return 0; }
1threat
Accessing a PHP Website Source Code : <p>I'm a PHP beginner. I usually use ASP.NET C# using Visual Studio just developing my own practice unpublished websites.</p> <p>I have recently be asked to assist with a website using PHP and MySQL. I have been given the following details to access the code:</p> <p>host: www.hostname.xx username: xxxx password: xxxx</p> <p>I visited the host site, there is no Log In feature. I downloaded a Platform called WampDeveloper to check if there is a feature to allow you to log in to a server host, but was unsuccessful. It seems to just allow me to create a new website (this may not be the case).</p> <p>I'm embarrassed to ask, but can anyone offer any suggestions as to how I can use these log in details to view the site source code. Also, if there is a better Platform for PHP can you let me know, I've downloaded WordPress too.</p>
0debug
How can i convert account format from 101000002035 to 101-000002-03-5 in MySql : <p>It is possible to convert account column value from 101000002035 to 101-000002-03-5 in MySql?</p> <p>Please help. How can i do it.</p>
0debug
void virtio_scsi_common_realize(DeviceState *dev, Error **errp, VirtIOHandleOutput ctrl, VirtIOHandleOutput evt, VirtIOHandleOutput cmd) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(dev); int i; virtio_init(vdev, "virtio-scsi", VIRTIO_ID_SCSI, sizeof(VirtIOSCSIConfig)); if (s->conf.num_queues == 0 || s->conf.num_queues > VIRTIO_QUEUE_MAX - 2) { error_setg(errp, "Invalid number of queues (= %" PRIu32 "), " "must be a positive integer less than %d.", s->conf.num_queues, VIRTIO_QUEUE_MAX - 2); virtio_cleanup(vdev); return; } s->cmd_vqs = g_new0(VirtQueue *, s->conf.num_queues); s->sense_size = VIRTIO_SCSI_SENSE_DEFAULT_SIZE; s->cdb_size = VIRTIO_SCSI_CDB_DEFAULT_SIZE; s->ctrl_vq = virtio_add_queue_aio(vdev, VIRTIO_SCSI_VQ_SIZE, ctrl); s->event_vq = virtio_add_queue_aio(vdev, VIRTIO_SCSI_VQ_SIZE, evt); for (i = 0; i < s->conf.num_queues; i++) { s->cmd_vqs[i] = virtio_add_queue_aio(vdev, VIRTIO_SCSI_VQ_SIZE, cmd); } if (s->conf.iothread) { virtio_scsi_set_iothread(VIRTIO_SCSI(s), s->conf.iothread); } }
1threat
AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame, int perms) { AVFilterBufferRef *samplesref = avfilter_get_audio_buffer_ref_from_arrays((uint8_t **)frame->data, frame->linesize[0], perms, frame->nb_samples, frame->format, av_frame_get_channel_layout(frame)); if (!samplesref) return NULL; avfilter_copy_frame_props(samplesref, frame); return samplesref; }
1threat
void ahci_hba_enable(AHCIQState *ahci) { uint32_t reg, ports_impl; uint16_t i; uint8_t num_cmd_slots; g_assert(ahci != NULL); ahci_set(ahci, AHCI_GHC, AHCI_GHC_AE); reg = ahci_rreg(ahci, AHCI_GHC); ASSERT_BIT_SET(reg, AHCI_GHC_AE); ahci->cap = ahci_rreg(ahci, AHCI_CAP); ahci->cap2 = ahci_rreg(ahci, AHCI_CAP2); num_cmd_slots = ((ahci->cap & AHCI_CAP_NCS) >> ctzl(AHCI_CAP_NCS)) + 1; g_test_message("Number of Command Slots: %u", num_cmd_slots); ports_impl = ahci_rreg(ahci, AHCI_PI); for (i = 0; ports_impl; ports_impl >>= 1, ++i) { if (!(ports_impl & 0x01)) { continue; } g_test_message("Initializing port %u", i); reg = ahci_px_rreg(ahci, i, AHCI_PX_CMD); if (BITCLR(reg, AHCI_PX_CMD_ST | AHCI_PX_CMD_CR | AHCI_PX_CMD_FRE | AHCI_PX_CMD_FR)) { g_test_message("port is idle"); } else { g_test_message("port needs to be idled"); ahci_px_clr(ahci, i, AHCI_PX_CMD, (AHCI_PX_CMD_ST | AHCI_PX_CMD_FRE)); usleep(500000); reg = ahci_px_rreg(ahci, i, AHCI_PX_CMD); ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_CR); ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_FR); g_test_message("port is now idle"); } ahci->port[i].clb = ahci_alloc(ahci, num_cmd_slots * 0x20); qmemset(ahci->port[i].clb, 0x00, num_cmd_slots * 0x20); g_test_message("CLB: 0x%08" PRIx64, ahci->port[i].clb); ahci_px_wreg(ahci, i, AHCI_PX_CLB, ahci->port[i].clb); g_assert_cmphex(ahci->port[i].clb, ==, ahci_px_rreg(ahci, i, AHCI_PX_CLB)); ahci->port[i].fb = ahci_alloc(ahci, 0x100); qmemset(ahci->port[i].fb, 0x00, 0x100); g_test_message("FB: 0x%08" PRIx64, ahci->port[i].fb); ahci_px_wreg(ahci, i, AHCI_PX_FB, ahci->port[i].fb); g_assert_cmphex(ahci->port[i].fb, ==, ahci_px_rreg(ahci, i, AHCI_PX_FB)); ahci_px_wreg(ahci, i, AHCI_PX_SERR, 0xFFFFFFFF); ahci_px_wreg(ahci, i, AHCI_PX_IS, 0xFFFFFFFF); ahci_wreg(ahci, AHCI_IS, (1 << i)); reg = ahci_px_rreg(ahci, i, AHCI_PX_SERR); g_assert_cmphex(reg, ==, 0); reg = ahci_px_rreg(ahci, i, AHCI_PX_IS); g_assert_cmphex(reg, ==, 0); reg = ahci_rreg(ahci, AHCI_IS); ASSERT_BIT_CLEAR(reg, (1 << i)); ahci_px_wreg(ahci, i, AHCI_PX_IE, 0xFFFFFFFF); reg = ahci_px_rreg(ahci, i, AHCI_PX_IE); g_assert_cmphex(reg, ==, ~((uint32_t)AHCI_PX_IE_RESERVED)); ahci_px_set(ahci, i, AHCI_PX_CMD, AHCI_PX_CMD_FRE); reg = ahci_px_rreg(ahci, i, AHCI_PX_CMD); ASSERT_BIT_SET(reg, AHCI_PX_CMD_FR); reg = ahci_px_rreg(ahci, i, AHCI_PX_SERR); if (BITSET(reg, AHCI_PX_SERR_DIAG_X)) { ahci_px_set(ahci, i, AHCI_PX_SERR, AHCI_PX_SERR_DIAG_X); } reg = ahci_px_rreg(ahci, i, AHCI_PX_TFD); if (BITCLR(reg, AHCI_PX_TFD_STS_BSY | AHCI_PX_TFD_STS_DRQ)) { reg = ahci_px_rreg(ahci, i, AHCI_PX_SSTS); if ((reg & AHCI_PX_SSTS_DET) == SSTS_DET_ESTABLISHED) { ahci_px_set(ahci, i, AHCI_PX_CMD, AHCI_PX_CMD_ST); ASSERT_BIT_SET(ahci_px_rreg(ahci, i, AHCI_PX_CMD), AHCI_PX_CMD_CR); g_test_message("Started Device %u", i); } else if ((reg & AHCI_PX_SSTS_DET)) { g_assert_not_reached(); } } } ahci_set(ahci, AHCI_GHC, AHCI_GHC_IE); reg = ahci_rreg(ahci, AHCI_GHC); ASSERT_BIT_SET(reg, AHCI_GHC_IE); }
1threat
if there's no super object created,why can I call the super constructor in java : <p>if there's no super object created when creating a new sub-class object,why can I call the super constructor in the sub-class constructor &amp; pass to it parameters in java?</p>
0debug
How to call inherited method of superclass from the overridden subclass method? : <p>I have a class <strong>shape</strong> that has a toString() method. I have another class <strong>circle</strong> that extends shape. This <strong>circle</strong> class overrides the inherited toString() method. What I want to do is call the superclass - <strong>shape's</strong> toString() method from <strong>inside</strong> the <strong>circle's</strong> toString() method. The following is what I have done as of now. I thought calling toString() in the toString() of the <strong>circle</strong> might invoke the inherited toString() but that just goes into an infinite loop. </p> <p>Shape class:</p> <pre><code>class shape{ String color; boolean filled; shape() { color = "green"; filled = true; } shape(String color, boolean fill) { this.color = color; this.filled = fill; } public String toString() { String str = "A Shape with color = " + color + " and filled = " + filled + " ."; return str; } } </code></pre> <p>Circle class: </p> <pre><code>class circle extends shape { double radius; circle() { this.radius = 1.0; } public String toString() { String str = "A circle with radius " + radius + " and which is a subclass of " + toString(); return str; } </code></pre> <p>Please Help!</p>
0debug
void coroutine_fn co_aio_sleep_ns(AioContext *ctx, QEMUClockType type, int64_t ns) { CoSleepCB sleep_cb = { .co = qemu_coroutine_self(), }; sleep_cb.ts = aio_timer_new(ctx, type, SCALE_NS, co_sleep_cb, &sleep_cb); timer_mod(sleep_cb.ts, qemu_clock_get_ns(type) + ns); qemu_coroutine_yield(); timer_del(sleep_cb.ts); timer_free(sleep_cb.ts);
1threat
Find duplicate registers in R : <p>I have an excel file with a list of emails and channels that collected it. How can I know how many emails per channel are duplicated using R and automate it (every time I import a different file just have to run it and get the results ) ? </p> <p>Thank you!! </p>
0debug
Why in so many places *p() is called a function that return a pointer instead of a function that return an address? : <p>I see in so many places that the code <code>*p()</code> it refer to a <em>function that return a pointer</em>. But when coding looks clear that the function is not returning a pointer, its returning an address. The part <code>int *</code> in the function tells what is needed to handle what is coming from the function. </p> <pre><code>// Function returning an address int *funcX(void){ static int x = 5; return &amp;x; } int *x = funcX(); // Pointer to int type int *y(void) = &amp;funcx; // Pointer to function that return an address to an int </code></pre> <p>There is a concise explanation for why is called a function that return a pointer?</p>
0debug
How to config visual studio to use UTF-8 as the default encoding for all projects? : <p>I did the search, but only found ways to change the encoding for individual files. I want to start projects with the encoding already configured as UTF-8.</p>
0debug
Convert geopandas shapely polygon to geojson : <p>I created a circle using geopandas and it returned a shapely polygon: </p> <pre><code>POLYGON: ((...)) </code></pre> <p>I want this same polygon as a geojson object. I ran across this:</p> <pre><code>shapely.geometry.mapping(shapelyObject) </code></pre> <p>which returns this:</p> <pre><code>{'type': 'Polygon', 'coordinates': (((570909.9247264927, 125477.71811034005)...} </code></pre> <p>But when I try to map this in mapbox it does not show anything. I think maybe it is not fully a geojson object.</p>
0debug
Checking auth token valid before route enter in Vue router : <p>I have a simple use case, where my application is using <code>vue-router</code> and <code>vuex</code>. Then <code>store</code> contains a <code>user</code> object which is <code>null</code> in the beginning. After the user is validated from the server it sends back an <code>user</code> object which contains a <code>JWT</code> auth token which is assigned to the <code>user</code> object in the store. Now lets assume that the user came back after 3 hours and tried to visit a route or perform any other action, considering that the auth token has expired by then, what would be the best way to check that(need to call <code>axios post</code> to check it) and redirect user to the <code>login</code> page. My app will have loads of components so I know I can write logic to check the token valid in the <code>mounted</code> hook of each component but that would mean repeating it all of the components. Also I don't want to use the <code>beforeEach</code> navigation guard because I cannot show any visual feedback to the user like <code>checking...</code> or <code>loading...</code>.</p>
0debug
Why does gcc compile f(1199) and f(1200) differently? : <p>What causes GCC 7.2.1 on ARM to use a load from memory (<code>lr</code>) for certain constants, and an immediate (<code>mov</code>) in some other cases? Concretely, I'm seeing the following:</p> <p>GCC 7.2.1 for ARM compiles this:</p> <pre><code>extern void abc(int); int test() { abc(1199); return 0; } </code></pre> <p>…into that:</p> <pre><code>test(): push {r4, lr} ldr r0, .L4 // ??! bl abc(int) mov r0, #0 pop {r4, lr} bx lr .L4: .word 1199 </code></pre> <p>and this:</p> <pre><code>extern void abc(int); int test() { abc(1200); return 0; } </code></pre> <p>…into that:</p> <pre><code>test(): push {r4, lr} mov r0, #1200 // OK bl abc(int) mov r0, #0 pop {r4, lr} bx lr </code></pre> <p>At first I expected 1200 to be some sort of unique cutoff, but there are other cut-offs like this at 1024 (1024 yields a <code>mov r0, #1024</code>, whereas 1025 uses <code>ldr</code>) and at other values.</p> <p>Why would GCC use a load from memory to fetch a constant, rather than using an immediate?</p>
0debug
static int qed_write_header_sync(BDRVQEDState *s) { QEDHeader le; int ret; qed_header_cpu_to_le(&s->header, &le); ret = bdrv_pwrite(s->bs->file, 0, &le, sizeof(le)); if (ret != sizeof(le)) { return ret; } return 0; }
1threat
Visual Studio Code color theme in Visual Studio 2017 for JavaScript and TypeScript files : <p>As the topic suggests I would like to import/set Visual Studio Code color theme in Visual Studio 2017 for JavaScript and TypeScript files. The files I therefore would like to set color theme for are: <code>.js, .jsx, .ts and .tsx</code>. If it is not possible to edit per file or language then I would like to know if it is possible to import a whole theme that looks like Visual Studio Code. </p> <p>In short I would like this:</p> <p><a href="https://i.stack.imgur.com/CFRnB.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CFRnB.png" alt="enter image description here"></a></p> <p>To look like this: <a href="https://i.stack.imgur.com/ERCJQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ERCJQ.png" alt="enter image description here"></a></p>
0debug
static int decode_thread(void *arg) { VideoState *is = arg; AVFormatContext *ic; int err, i, ret; int st_index[AVMEDIA_TYPE_NB]; AVPacket pkt1, *pkt = &pkt1; AVFormatParameters params, *ap = &params; int eof=0; int pkt_in_play_range = 0; ic = avformat_alloc_context(); memset(st_index, -1, sizeof(st_index)); is->video_stream = -1; is->audio_stream = -1; is->subtitle_stream = -1; global_video_state = is; url_set_interrupt_cb(decode_interrupt_cb); memset(ap, 0, sizeof(*ap)); ap->prealloced_context = 1; ap->width = frame_width; ap->height= frame_height; ap->time_base= (AVRational){1, 25}; ap->pix_fmt = frame_pix_fmt; set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM, NULL); err = av_open_input_file(&ic, is->filename, is->iformat, 0, ap); if (err < 0) { print_error(is->filename, err); ret = -1; goto fail; } is->ic = ic; if(genpts) ic->flags |= AVFMT_FLAG_GENPTS; err = av_find_stream_info(ic); if (err < 0) { fprintf(stderr, "%s: could not find codec parameters\n", is->filename); ret = -1; goto fail; } if(ic->pb) ic->pb->eof_reached= 0; if(seek_by_bytes<0) seek_by_bytes= !!(ic->iformat->flags & AVFMT_TS_DISCONT); if (start_time != AV_NOPTS_VALUE) { int64_t timestamp; timestamp = start_time; if (ic->start_time != AV_NOPTS_VALUE) timestamp += ic->start_time; ret = avformat_seek_file(ic, -1, INT64_MIN, timestamp, INT64_MAX, 0); if (ret < 0) { fprintf(stderr, "%s: could not seek to position %0.3f\n", is->filename, (double)timestamp / AV_TIME_BASE); } } for (i = 0; i < ic->nb_streams; i++) ic->streams[i]->discard = AVDISCARD_ALL; if (!video_disable) st_index[AVMEDIA_TYPE_VIDEO] = av_find_best_stream(ic, AVMEDIA_TYPE_VIDEO, wanted_stream[AVMEDIA_TYPE_VIDEO], -1, NULL, 0); if (!audio_disable) st_index[AVMEDIA_TYPE_AUDIO] = av_find_best_stream(ic, AVMEDIA_TYPE_AUDIO, wanted_stream[AVMEDIA_TYPE_AUDIO], st_index[AVMEDIA_TYPE_VIDEO], NULL, 0); if (!video_disable) st_index[AVMEDIA_TYPE_SUBTITLE] = av_find_best_stream(ic, AVMEDIA_TYPE_SUBTITLE, wanted_stream[AVMEDIA_TYPE_SUBTITLE], (st_index[AVMEDIA_TYPE_AUDIO] >= 0 ? st_index[AVMEDIA_TYPE_AUDIO] : st_index[AVMEDIA_TYPE_VIDEO]), NULL, 0); if (show_status) { av_dump_format(ic, 0, is->filename, 0); } if (st_index[AVMEDIA_TYPE_AUDIO] >= 0) { stream_component_open(is, st_index[AVMEDIA_TYPE_AUDIO]); } ret=-1; if (st_index[AVMEDIA_TYPE_VIDEO] >= 0) { ret= stream_component_open(is, st_index[AVMEDIA_TYPE_VIDEO]); } is->refresh_tid = SDL_CreateThread(refresh_thread, is); if(ret<0) { if (!display_disable) is->show_audio = 2; } if (st_index[AVMEDIA_TYPE_SUBTITLE] >= 0) { stream_component_open(is, st_index[AVMEDIA_TYPE_SUBTITLE]); } if (is->video_stream < 0 && is->audio_stream < 0) { fprintf(stderr, "%s: could not open codecs\n", is->filename); ret = -1; goto fail; } for(;;) { if (is->abort_request) break; if (is->paused != is->last_paused) { is->last_paused = is->paused; if (is->paused) is->read_pause_return= av_read_pause(ic); else av_read_play(ic); } #if CONFIG_RTSP_DEMUXER if (is->paused && !strcmp(ic->iformat->name, "rtsp")) { SDL_Delay(10); continue; } #endif if (is->seek_req) { int64_t seek_target= is->seek_pos; int64_t seek_min= is->seek_rel > 0 ? seek_target - is->seek_rel + 2: INT64_MIN; int64_t seek_max= is->seek_rel < 0 ? seek_target - is->seek_rel - 2: INT64_MAX; ret = avformat_seek_file(is->ic, -1, seek_min, seek_target, seek_max, is->seek_flags); if (ret < 0) { fprintf(stderr, "%s: error while seeking\n", is->ic->filename); }else{ if (is->audio_stream >= 0) { packet_queue_flush(&is->audioq); packet_queue_put(&is->audioq, &flush_pkt); } if (is->subtitle_stream >= 0) { packet_queue_flush(&is->subtitleq); packet_queue_put(&is->subtitleq, &flush_pkt); } if (is->video_stream >= 0) { packet_queue_flush(&is->videoq); packet_queue_put(&is->videoq, &flush_pkt); } } is->seek_req = 0; eof= 0; } if ( is->audioq.size + is->videoq.size + is->subtitleq.size > MAX_QUEUE_SIZE || ( (is->audioq .size > MIN_AUDIOQ_SIZE || is->audio_stream<0) && (is->videoq .nb_packets > MIN_FRAMES || is->video_stream<0) && (is->subtitleq.nb_packets > MIN_FRAMES || is->subtitle_stream<0))) { SDL_Delay(10); continue; } if(eof) { if(is->video_stream >= 0){ av_init_packet(pkt); pkt->data=NULL; pkt->size=0; pkt->stream_index= is->video_stream; packet_queue_put(&is->videoq, pkt); } SDL_Delay(10); if(is->audioq.size + is->videoq.size + is->subtitleq.size ==0){ if(loop!=1 && (!loop || --loop)){ stream_seek(cur_stream, start_time != AV_NOPTS_VALUE ? start_time : 0, 0, 0); }else if(autoexit){ ret=AVERROR_EOF; goto fail; } } continue; } ret = av_read_frame(ic, pkt); if (ret < 0) { if (ret == AVERROR_EOF || ic->pb->eof_reached) eof=1; if (ic->pb->error) break; SDL_Delay(100); continue; } pkt_in_play_range = duration == AV_NOPTS_VALUE || (pkt->pts - ic->streams[pkt->stream_index]->start_time) * av_q2d(ic->streams[pkt->stream_index]->time_base) - (double)(start_time != AV_NOPTS_VALUE ? start_time : 0)/1000000 <= ((double)duration/1000000); if (pkt->stream_index == is->audio_stream && pkt_in_play_range) { packet_queue_put(&is->audioq, pkt); } else if (pkt->stream_index == is->video_stream && pkt_in_play_range) { packet_queue_put(&is->videoq, pkt); } else if (pkt->stream_index == is->subtitle_stream && pkt_in_play_range) { packet_queue_put(&is->subtitleq, pkt); } else { av_free_packet(pkt); } } while (!is->abort_request) { SDL_Delay(100); } ret = 0; fail: global_video_state = NULL; if (is->audio_stream >= 0) stream_component_close(is, is->audio_stream); if (is->video_stream >= 0) stream_component_close(is, is->video_stream); if (is->subtitle_stream >= 0) stream_component_close(is, is->subtitle_stream); if (is->ic) { av_close_input_file(is->ic); is->ic = NULL; } url_set_interrupt_cb(NULL); if (ret != 0) { SDL_Event event; event.type = FF_QUIT_EVENT; event.user.data1 = is; SDL_PushEvent(&event); } return 0; }
1threat
¿ How to check admin role? : I am looking the best way to check admin rolewith component in angular. I have the following code in component checkIfIsAdmin(): any { let user_string = localStorage.getItem("currentUser"); if (!isNullOrUndefined([user_string])) { console.log(user_string); return true; } else { return null; } } I need to check the ROLE_ADMIN that I receive with the following format, {"longId":4,"name":"bbb","email":"bbb@gmail.com","userName":"bbb","token":"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI0IiwiaWF0IjoxNTU5NDk0NTczLCJleHAiOjE1NTk0OTQ4NzN9.XmSHywZv09b4BR9-NxyCTVPF33pLsk3QtTEXQMQF4YHW7i27Ghj2Uh3WZAegpG4rdSImKcm1wMgJsPLpHcTyew","roles":["ROLE_USER","ROLE_ADMIN"]} I don't know how to iterate roles inside if condition , could anyone help to me ?
0debug
R Studios: How can create a new column in a dataset filled with random preselected values? : I want to fill the dataset "TEAM" with a new column , and at each row I want to input a random value from lets say a vector of integers (1, 1729, 4679, 10257). My end goal is to link two datasets TEAMS and LEAGUES.
0debug
How to parse from a string the numbers and punctuation in Python : <p>I want to turn a string like "$1,234.56" into 1234.56 so I can add it to a database, my current solution is using <code>re.sub("[^0-9]", "", str1</code> this however strips the punctuation too, is there a way to keep it?</p> <p>I'm using python 3.6.5</p>
0debug
how to make predefined tags/code in html or css : <p>Let's say I have this html code:</p> <pre><code>&lt;h1&gt;My website&lt;/h1&gt; &lt;p&gt;Welcome to my website&lt;/p&gt; </code></pre> <p>Let's say that I want to put that on pretty much every page of my website without copy and pasting the same thing every time. How would I do that? </p> <p>I'm also open to doing this in javascript but would prefer html or css.</p>
0debug
how to optimize this query for my school project : its my assignment kindly help me to optimzed below two quries Optimize Assignment 1: SELECT n.node_id, MIN(LEAST(n.date,ec.date)) date FROM n, ec WHERE (n.node_id = ec.node_id_from OR n.node_id = ec.node_id_to) AND n.date - ec.date > 0 GROUP BY n.node_id; Optimize Assignment 2: SELECT TO_CHAR(CONVERT_TIMEZONE ('UTC','America/Los_Angeles',tableA."date"), 'YYYY-MM') AS "date_month", COUNT(DISTINCT CASE WHEN (tableB."date" IS NOT NULL) THEN tableB._id ELSE NULL END) AS "tableB.countB", COUNT(DISTINCT CASE WHEN (tableC."date" IS NOT NULL) THEN tableC._id ELSE NULL END) AS "tableC.countC" FROM tableA AS tableA LEFT JOIN tableB AS tableB ON (DATE (CONVERT_TIMEZONE ('UTC', 'America/Los_Angeles',tableB."date"))) = (DATE (CONVERT_TIMEZONE ('UTC', 'America/Los_Angeles',tableA."date"))) LEFT JOIN tableC AS tableC ON (DATE (CONVERT_TIMEZONE ('UTC', 'America/Los_Angeles',tableC."date"))) = (DATE (CONVERT_TIMEZONE ('UTC', 'America/Los_Angeles',tableA."date"))) WHERE tableA."date" >= CONVERT_TIMEZONE ('America/Los_Angeles','UTC',DATEADD ( month,-17,DATE_TRUNC('month',DATE_TRUNC('day',CONVERT_TIMEZONE ('UTC', 'America/Los_Angeles',GETDATE ())))) GROUP BY 1 ORDER BY 1 DESC LIMIT 500;
0debug
static void print_report(int is_last_report, int64_t timer_start, int64_t cur_time) { char buf[1024]; AVBPrint buf_script; OutputStream *ost; AVFormatContext *oc; int64_t total_size; AVCodecContext *enc; int frame_number, vid, i; double bitrate; int64_t pts = INT64_MIN; static int64_t last_time = -1; static int qp_histogram[52]; int hours, mins, secs, us; if (!print_stats && !is_last_report && !progress_avio) return; if (!is_last_report) { if (last_time == -1) { last_time = cur_time; return; } if ((cur_time - last_time) < 500000) return; last_time = cur_time; } oc = output_files[0]->ctx; total_size = avio_size(oc->pb); if (total_size <= 0) total_size = avio_tell(oc->pb); buf[0] = '\0'; vid = 0; av_bprint_init(&buf_script, 0, 1); for (i = 0; i < nb_output_streams; i++) { float q = -1; ost = output_streams[i]; enc = ost->enc_ctx; if (!ost->stream_copy && enc->coded_frame) q = enc->coded_frame->quality / (float)FF_QP2LAMBDA; if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); } if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { float fps, t = (cur_time-timer_start) / 1000000.0; frame_number = ost->frame_number; fps = t > 1 ? frame_number / t : 0; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3.*f q=%3.1f ", frame_number, fps < 9.95, fps, q); av_bprintf(&buf_script, "frame=%d\n", frame_number); av_bprintf(&buf_script, "fps=%.1f\n", fps); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); if (is_last_report) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L"); if (qp_hist) { int j; int qp = lrintf(q); if (qp >= 0 && qp < FF_ARRAY_ELEMS(qp_histogram)) qp_histogram[qp]++; for (j = 0; j < 32; j++) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1))); } if ((enc->flags&CODEC_FLAG_PSNR) && (enc->coded_frame || is_last_report)) { int j; double error, error_sum = 0; double scale, scale_sum = 0; double p; char type[3] = { 'Y','U','V' }; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "PSNR="); for (j = 0; j < 3; j++) { if (is_last_report) { error = enc->error[j]; scale = enc->width * enc->height * 255.0 * 255.0 * frame_number; } else { error = enc->coded_frame->error[j]; scale = enc->width * enc->height * 255.0 * 255.0; } if (j) scale /= 4; error_sum += error; scale_sum += scale; p = psnr(error / scale); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], p); av_bprintf(&buf_script, "stream_%d_%d_psnr_%c=%2.2f\n", ost->file_index, ost->index, type[j] | 32, p); } p = psnr(error_sum / scale_sum); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum / scale_sum)); av_bprintf(&buf_script, "stream_%d_%d_psnr_all=%2.2f\n", ost->file_index, ost->index, p); } vid = 1; } if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE) pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st), ost->st->time_base, AV_TIME_BASE_Q)); if (is_last_report) nb_frames_drop += ost->last_droped; } secs = pts / AV_TIME_BASE; us = pts % AV_TIME_BASE; mins = secs / 60; secs %= 60; hours = mins / 60; mins %= 60; bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; if (total_size < 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=N/A time="); else snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=%8.0fkB time=", total_size / 1024.0); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%02d:%02d:%02d.%02d ", hours, mins, secs, (100 * us) / AV_TIME_BASE); if (bitrate < 0) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=N/A"); av_bprintf(&buf_script, "bitrate=N/A\n"); }else{ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=%6.1fkbits/s", bitrate); av_bprintf(&buf_script, "bitrate=%6.1fkbits/s\n", bitrate); } if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n"); else av_bprintf(&buf_script, "total_size=%"PRId64"\n", total_size); av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); av_bprintf(&buf_script, "out_time=%02d:%02d:%02d.%06d\n", hours, mins, secs, us); if (nb_frames_dup || nb_frames_drop) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", nb_frames_dup, nb_frames_drop); av_bprintf(&buf_script, "dup_frames=%d\n", nb_frames_dup); av_bprintf(&buf_script, "drop_frames=%d\n", nb_frames_drop); if (print_stats || is_last_report) { const char end = is_last_report ? '\n' : '\r'; if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) { fprintf(stderr, "%s %c", buf, end); } else av_log(NULL, AV_LOG_INFO, "%s %c", buf, end); fflush(stderr); } if (progress_avio) { av_bprintf(&buf_script, "progress=%s\n", is_last_report ? "end" : "continue"); avio_write(progress_avio, buf_script.str, FFMIN(buf_script.len, buf_script.size - 1)); avio_flush(progress_avio); av_bprint_finalize(&buf_script, NULL); if (is_last_report) { avio_closep(&progress_avio); } } if (is_last_report) print_final_stats(total_size); }
1threat
Gradle: is it possible to publish to Gradle's own local cache? : <p>I know that I can use the <code>maven</code> plugin coupled with <code>mavenLocal()</code> to install an artifact and use it locally.</p> <p>However investigating this a bit further, I notice that this means the artifacts are installed to Mavens's standard <code>~/.m2</code>, but at the same time Gradle's own cache lives under <code>~/.gradle/caches</code> in a different format.</p> <p>This seems wasteful to me, a) working with two local caches, and b) having to add <code>mavenLocal()</code> to all projects. I was wondering if there is a way to publish an artifact to Gradle's <code>~/.gradle/caches</code> ?</p>
0debug
int monitor_fdset_dup_fd_remove(int dup_fd) { return monitor_fdset_dup_fd_find_remove(dup_fd, true); }
1threat
javascript - How to get the content of a paragraph? : I have 10 paragraphs, each displaying a number from 1 to 10. I need a function that when clicking on the paragraph, reads the description of it an stores it in an array. So far I managed to do this: function readValue(p) { var text = document.getElementsByTagName('p')[0].innerHTML; console.log(textId); } But when I'm clicking on the 5th paragraph, it still logs "1" to console. How can it be changed to get the content of the paragraph that was actually clicked? Thank You!
0debug
ConstraintLayout: What does `layout_constraintLeft_creator` do in xml? : <p>Example code:</p> <pre><code> &lt;EditText android:id="@+id/msg_type" android:layout_width="0dp" android:layout_height="40dp" android:layout_marginBottom="8dp" android:layout_marginEnd="8dp" android:layout_marginStart="8dp" android:hint="Input message" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintHorizontal_bias="0.75" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toLeftOf="@+id/btn_chat_send" tools:layout_constraintBottom_creator="1" tools:layout_constraintLeft_creator="1" tools:layout_constraintRight_creator="1"/&gt; </code></pre> <p>What does <code>tools:layout_constraintRight_creator="1"</code> do here? There aren't any document explaining these things.</p>
0debug
static av_cold int dnxhd_encode_end(AVCodecContext *avctx) { DNXHDEncContext *ctx = avctx->priv_data; int max_level = 1 << (ctx->cid_table->bit_depth + 2); int i; av_free(ctx->vlc_codes - max_level * 2); av_free(ctx->vlc_bits - max_level * 2); av_freep(&ctx->run_codes); av_freep(&ctx->run_bits); av_freep(&ctx->mb_bits); av_freep(&ctx->mb_qscale); av_freep(&ctx->mb_rc); av_freep(&ctx->mb_cmp); av_freep(&ctx->slice_size); av_freep(&ctx->slice_offs); av_freep(&ctx->qmatrix_c); av_freep(&ctx->qmatrix_l); av_freep(&ctx->qmatrix_c16); av_freep(&ctx->qmatrix_l16); for (i = 1; i < avctx->thread_count; i++) av_freep(&ctx->thread[i]); av_frame_free(&avctx->coded_frame); return 0; }
1threat
Suddenly background is not visible in my chrome.Iam able to set only background color but not background image.why is this happening suddenly? : body{ background-image:linear-gradient(rgba(0, 0, 0, 0.5),rgba(0, 0, 0, 0.5)),url("images/smile.jpg"); height:100vh; ` `width:100%; ` `background-size: cover; ` ` background-position: center; ` `margin:0 auto; }
0debug
Issues with Macros in C : I'm still trying to firgure out macros in C #define A(x) #x int main() { int i = -i; char *s = A(i); i = -(s[0] == 'i'); printf("%d", i); return 0; } Anyone care to enlighten me and comment the code, especially what the macro does and this line: i = -(s[0] == 'i');
0debug
Vertical link in page sides : <p>How can I have links in my pages sides like places i colored in image below and move as page scrolls (fixed position)?</p> <p><a href="https://i.stack.imgur.com/HzKk0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HzKk0.png" alt="sample"></a></p>
0debug
PCIBus *pci_prep_init(qemu_irq *pic) { PREPPCIState *s; PCIDevice *d; int PPC_io_memory; s = qemu_mallocz(sizeof(PREPPCIState)); s->bus = pci_register_bus(NULL, "pci", prep_set_irq, prep_map_irq, pic, 0, 4); register_ioport_write(0xcf8, 4, 4, pci_prep_addr_writel, s); register_ioport_read(0xcf8, 4, 4, pci_prep_addr_readl, s); register_ioport_write(0xcfc, 4, 1, pci_host_data_writeb, s); register_ioport_write(0xcfc, 4, 2, pci_host_data_writew, s); register_ioport_write(0xcfc, 4, 4, pci_host_data_writel, s); register_ioport_read(0xcfc, 4, 1, pci_host_data_readb, s); register_ioport_read(0xcfc, 4, 2, pci_host_data_readw, s); register_ioport_read(0xcfc, 4, 4, pci_host_data_readl, s); PPC_io_memory = cpu_register_io_memory(PPC_PCIIO_read, PPC_PCIIO_write, s); cpu_register_physical_memory(0x80800000, 0x00400000, PPC_io_memory); d = pci_register_device(s->bus, "PREP Host Bridge - Motorola Raven", sizeof(PCIDevice), 0, NULL, NULL); pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_MOTOROLA); pci_config_set_device_id(d->config, PCI_DEVICE_ID_MOTOROLA_RAVEN); d->config[0x08] = 0x00; pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST); d->config[0x0C] = 0x08; d->config[0x0D] = 0x10; d->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; d->config[0x34] = 0x00; return s->bus; }
1threat
Can someone please tell me why the following Java code (for comparing two linked lists) is giving NullPointerException? This was in HackerRank : int CompareLists(Node headA, Node headB){<br> // This is a "method-only" submission. // You only need to complete this method int i =1;<br> Node tempA = new Node();<br> Node tempB = new Node();<br> tempA = headA; tempB = headB; if(tempA == null || tempB == null){ return 0; } while(i==1){ if(tempA.data==tempB.data){ i=1; } else if(tempA == null && tempB == null) return i; else{ i=0; } tempA = tempA.next; tempB = tempB.next; } return i; }
0debug
Repeatedly process items in parallel : <p>I have a set of items that need to be processed in parallel over and over again. </p> <p>I can do this:</p> <pre><code>while (true) { Parallel.ForEach(sources, source =&gt; { // do lots of work with source }) } </code></pre> <p>But the problem is, if one source takes far longer than the others, it will effectively hang the while loop and I'd like to reprocess each item in the list without waiting for other items to complete. </p> <p>How can I accomplish that? Start a task for each source which has it's own while loop or is there a more elegant way to do this?</p>
0debug
Unit testing internal methods in VS2017 .Net Standard library : <p>I am currently playing around with the latest Visual Studio 2017 Release Candidate by creating a .Net Standard 1.6 library. I am using xUnit to unit test my code and was wondering if you can still testing internal methods in VS2017.</p> <p>I remember that you could all a line AssemblyInfo.cs class in VS2015 that would enable specified projects to see internal methods</p> <pre><code>[assembly:InternalsVisibleTo("MyTests")] </code></pre> <p>As there is no AssemblyInfo.cs class in VS2017 .Net Standard projects I was wondering if you can still unit test internal methods?</p>
0debug
Python get last month and year : <p>I am trying to get last month and current year in the format: July 2016.</p> <p>I have tried (but that didn't work) and it does not print July but the number:</p> <pre><code>import datetime now = datetime.datetime.now() print now.year, now.month(-1) </code></pre>
0debug
Properly handle DrawerLayout animation while navigating through fragment : <p>I'm currently struggling with the <code>DrawerLayout</code> animation doing weird stuff; The <strong>hamburger icon</strong> is laggy and often switch from hamburger to arrow without animation if I don't put an Handler to delay the <code>fragment</code> transaction animation. </p> <p>So I ended up putting an handler to wait until the hamburger icon perform the animation but it just doesn't feel natural that we need to wait until the drawer close to switch fragment. I'm sure there is a better way to handle this...</p> <p><strong>Here is how I do currently:</strong></p> <pre><code>private void selectProfilFragment() { final BackHandledFragment fragment; // TODO test this again Bundle bundle = new Bundle(); bundle.putString(FragmentUserProfile.USER_FIRST_NAME, user.getFirstname()); bundle.putString(FragmentUserProfile.USER_LAST_NAME, user.getLastname()); bundle.putString(FragmentUserProfile.USER_PICTURE, user.getProfilepic()); bundle.putString(FragmentUserProfile.USER_EMAIL, user.getEmail()); bundle.putBoolean(FragmentUserProfile.USER_SECURITY, user.getParameters().getSecuritymodule().equals("YES")); fragment = new FragmentUserProfile(); fragment.setArguments(bundle); mDrawerLayout.closeDrawer(mDrawerLinear); new Handler().postDelayed(new Runnable() { public void run() { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.setCustomAnimations(R.anim.pull_in_right, R.anim.push_out_left, R.anim.pull_in_left, R.anim.push_out_right); ft.replace(R.id.content_frame, fragment) .addToBackStack(fragment.getTagText()) .commitAllowingStateLoss(); } }, 300); } </code></pre> <p>It's still <em>glitching</em> a little bit in between the <code>DrawerLayout</code> closing and opening fragment transaction animation.</p> <p><strong>Here is How I instanciate the drawer:</strong></p> <pre><code>mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); mDrawerListChild.setAdapter(new DrawerListAdapter(this, R.layout.drawer_layout_item, mPlanTitles)); mDrawerListChild.setOnItemClickListener(new DrawerItemClickListener()); mProfilPic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { selectProfilFragment(); } }); mDrawerToggle = new ActionBarDrawerToggle( this, mDrawerLayout, toolbar, R.string.drawer_open, R.string.drawer_close ) { public void onDrawerClosed(View view) { invalidateOptionsMenu(); } public void onDrawerOpened(View drawerView) { invalidateOptionsMenu(); } }; getSupportFragmentManager().addOnBackStackChangedListener(mOnBackStackChangedListener); mDrawerLayout.setDrawerListener(mDrawerToggle); setSupportActionBar(toolbar); </code></pre>
0debug
How to fail a (cron) job after a certain number of retries? : <p>We have a Kubernetes cluster of web scraping cron jobs set up. All seems to go well until a cron job starts to fail (e.g., when a site structure changes and our scraper no longer works). It looks like every now and then a few failing cron jobs will continue to retry to the point it brings down our cluster. Running <code>kubectl get cronjobs</code> (prior to a cluster failure) will show too many jobs running for a failing job.</p> <p>I've attempted following the note described <a href="https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#pod-backoff-failure-policy" rel="noreferrer">here</a> regarding a known issue with the pod backoff failure policy; however, that does not seem to work.</p> <p>Here is our config for reference:</p> <pre><code>apiVersion: batch/v1beta1 kind: CronJob metadata: name: scrape-al spec: schedule: '*/15 * * * *' concurrencyPolicy: Allow failedJobsHistoryLimit: 0 successfulJobsHistoryLimit: 0 jobTemplate: metadata: labels: app: scrape scrape: al spec: template: spec: containers: - name: scrape-al image: 'govhawk/openstates:1.3.1-beta' command: - /opt/openstates/openstates/pupa-scrape.sh args: - al bills --scrape restartPolicy: Never backoffLimit: 3 </code></pre> <p>Ideally we would prefer that a cron job would be terminated after N retries (e.g., something like <code>kubectl delete cronjob my-cron-job</code> after <code>my-cron-job</code> has failed 5 times). Any ideas or suggestions would be much appreciated. Thanks!</p>
0debug
create and store cookies of onclick div (dynamically) : I'm trying to create a cookie to store a text value of a div. I know I can use Document.getElementById('whatever') to get the text but I need the function to be dynanmic (non-specific) by getting the text of the onclick div. Can anyone lend me a helping hand by showing me how should I change my code to make this work? Thanks. <a href="" onClick="getOrder">#1234WDF</a> <a href="" onClick="getOrder">#7643FER</a> function getOrder(order){ createCookie('order', $this.text, 90); }
0debug
I can not do a swap operation while sorting. It crashes when I do it. Why? : <pre><code>struct Dates { int day; int month; int year; }accountinfo[3]; struct Accounts { string name,lastname; int number; float balance; }account[3]; void sortduetoaccnumbers() { for (i=0;i&lt;3;i++) { for (j=0;j&lt;3;j++) { if (account[j].number&gt;account[j+1].number) { //swap } } } } void sortduetodates() { for (i=0;i&lt;3;i++) { for (j=0;j&lt;3;j++) { if (accountinfo[j].year&gt;accountinfo[j+1].year) { //swap } else if (accountinfo[j].year==accountinfo[j+1].year) { if (accountinfo[j].month&gt;accountinfo[j+1].month) { //swap } else if (accountinfo[j].month==accountinfo[j+1].month) { if (accountinfo[j].day&gt;accountinfo[j+1].day) { //swap } } } } } } </code></pre> <p>I can not sort these accounts using sorting algorithms. It crashes if I enter them. cmd stops suddenly and finishes the program.</p> <p>I entered a comment line where swapping functions have to go. So you can analyze the code.</p> <p>Every other functions are working except this one. I'm stuck at this point.</p>
0debug
How can i concatenate string+int+string in c++ : How can I concatenate i+name+letter+i ? for(int i = 0; i < 10; ++i){ //I need a const char* to pass as a parameter to another function const char* name = "mki"; //letter is equal to "A" for the first 2, "B" for the second 3, //"C" for the following 4 ... const char* final_string = ??? } I already tried using: std::to_sting(i) but I got an error saying that to_string is undefined for std. I'm using VC++. Thanks.
0debug
static int patch_hypercalls(VAPICROMState *s) { hwaddr rom_paddr = s->rom_state_paddr & ROM_BLOCK_MASK; static const uint8_t vmcall_pattern[] = { 0xb8, 0x1, 0, 0, 0, 0xf, 0x1, 0xc1 }; static const uint8_t outl_pattern[] = { 0xb8, 0x1, 0, 0, 0, 0x90, 0xe7, 0x7e }; uint8_t alternates[2]; const uint8_t *pattern; const uint8_t *patch; int patches = 0; off_t pos; uint8_t *rom; rom = g_malloc(s->rom_size); cpu_physical_memory_read(rom_paddr, rom, s->rom_size); for (pos = 0; pos < s->rom_size - sizeof(vmcall_pattern); pos++) { if (kvm_irqchip_in_kernel()) { pattern = outl_pattern; alternates[0] = outl_pattern[7]; alternates[1] = outl_pattern[7]; patch = &vmcall_pattern[5]; } else { pattern = vmcall_pattern; alternates[0] = vmcall_pattern[7]; alternates[1] = 0xd9; patch = &outl_pattern[5]; } if (memcmp(rom + pos, pattern, 7) == 0 && (rom[pos + 7] == alternates[0] || rom[pos + 7] == alternates[1])) { cpu_physical_memory_write(rom_paddr + pos + 5, patch, 3); } } g_free(rom); if (patches != 0 && patches != 2) { return -1; } return 0; }
1threat
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
static int con_init(struct XenDevice *xendev) { struct XenConsole *con = container_of(xendev, struct XenConsole, xendev); char *type, *dom; dom = xs_get_domain_path(xenstore, con->xendev.dom); snprintf(con->console, sizeof(con->console), "%s/console", dom); free(dom); type = xenstore_read_str(con->console, "type"); if (!type || strcmp(type, "ioemu") != 0) { xen_be_printf(xendev, 1, "not for me (type=%s)\n", type); return -1; } if (!serial_hds[con->xendev.dev]) xen_be_printf(xendev, 1, "WARNING: serial line %d not configured\n", con->xendev.dev); else con->chr = serial_hds[con->xendev.dev]; return 0; }
1threat