problem
stringlengths
26
131k
labels
class label
2 classes
static int smc_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; SmcContext *s = avctx->priv_data; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); int ret; bytestream2_init(&s->gb, buf, buf_size); if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; if (pal) { s->frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); } smc_decode_stream(s); *got_frame = 1; if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; return buf_size; }
1threat
copying data with SSIS without recreating the tables : I want to copy data from db A to db B. I created a saved SSIS package successfully and data was indeed copied from A to B. Now I want to automate the process but when I'm launching the saved .dtsx file I get this error: "Error: Executing the query "CREATE TABLE ... failed with the following error: "There is already an object named ... in the database"..." Seems like SSIS is trying to create the table again. How do I set SSIS to copy the data only, without recreating the table? Ta.
0debug
declaring a public variable causes everything to have a "name does not exist in this context" error : <pre><code> using System; namespace GridSim { class Program { static void Main() { //error is right before declaring public. "} expected" public int h = 1; CreateWorld.Create(); } } } </code></pre> <p>I have a another class to create a grid in a nested for loop. the class is public. declaring a public variable ANYWHERE IN MY PROJECT yields the same result. </p> <p>"} expected" before the public variable.</p> <p>"The name "(insert thing here)" does not exist in this context" for literally everything after the public variable. </p> <p>I want to be able to set a part of a grid to a character from anywhere in my project, but this error is preventing me from doing that.</p>
0debug
static int cpu_ppc_handle_mmu_fault(CPUPPCState *env, target_ulong address, int rw, int mmu_idx) { CPUState *cs = CPU(ppc_env_get_cpu(env)); PowerPCCPU *cpu = POWERPC_CPU(cs); mmu_ctx_t ctx; int access_type; int ret = 0; if (rw == 2) { rw = 0; access_type = ACCESS_CODE; } else { access_type = env->access_type; } ret = get_physical_address(env, &ctx, address, rw, access_type); if (ret == 0) { tlb_set_page(cs, address & TARGET_PAGE_MASK, ctx.raddr & TARGET_PAGE_MASK, ctx.prot, mmu_idx, TARGET_PAGE_SIZE); ret = 0; } else if (ret < 0) { LOG_MMU_STATE(cs); if (access_type == ACCESS_CODE) { switch (ret) { case -1: switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: cs->exception_index = POWERPC_EXCP_IFTLB; env->error_code = 1 << 18; env->spr[SPR_IMISS] = address; env->spr[SPR_ICMP] = 0x80000000 | ctx.ptem; goto tlb_miss; case POWERPC_MMU_SOFT_74xx: cs->exception_index = POWERPC_EXCP_IFTLB; goto tlb_miss_74xx; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: cs->exception_index = POWERPC_EXCP_ITLB; env->error_code = 0; env->spr[SPR_40x_DEAR] = address; env->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_BOOKE206: booke206_update_mas_tlb_miss(env, address, rw); case POWERPC_MMU_BOOKE: cs->exception_index = POWERPC_EXCP_ITLB; env->error_code = 0; env->spr[SPR_BOOKE_DEAR] = address; return -1; case POWERPC_MMU_MPC8xx: cpu_abort(cs, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_REAL: cpu_abort(cs, "PowerPC in real mode should never raise " "any MMU exceptions\n"); return -1; default: cpu_abort(cs, "Unknown or invalid MMU model\n"); return -1; } break; case -2: cs->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x08000000; break; case -3: if ((env->mmu_model == POWERPC_MMU_BOOKE) || (env->mmu_model == POWERPC_MMU_BOOKE206)) { env->spr[SPR_BOOKE_ESR] = 0x00000000; } cs->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; case -4: cs->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; } } else { switch (ret) { case -1: switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: if (rw == 1) { cs->exception_index = POWERPC_EXCP_DSTLB; env->error_code = 1 << 16; } else { cs->exception_index = POWERPC_EXCP_DLTLB; env->error_code = 0; } env->spr[SPR_DMISS] = address; env->spr[SPR_DCMP] = 0x80000000 | ctx.ptem; tlb_miss: env->error_code |= ctx.key << 19; env->spr[SPR_HASH1] = env->htab_base + get_pteg_offset32(cpu, ctx.hash[0]); env->spr[SPR_HASH2] = env->htab_base + get_pteg_offset32(cpu, ctx.hash[1]); break; case POWERPC_MMU_SOFT_74xx: if (rw == 1) { cs->exception_index = POWERPC_EXCP_DSTLB; } else { cs->exception_index = POWERPC_EXCP_DLTLB; } tlb_miss_74xx: env->error_code = ctx.key << 19; env->spr[SPR_TLBMISS] = (address & ~((target_ulong)0x3)) | ((env->last_way + 1) & (env->nb_ways - 1)); env->spr[SPR_PTEHI] = 0x80000000 | ctx.ptem; break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: cs->exception_index = POWERPC_EXCP_DTLB; env->error_code = 0; env->spr[SPR_40x_DEAR] = address; if (rw) { env->spr[SPR_40x_ESR] = 0x00800000; } else { env->spr[SPR_40x_ESR] = 0x00000000; } break; case POWERPC_MMU_MPC8xx: cpu_abort(cs, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_BOOKE206: booke206_update_mas_tlb_miss(env, address, rw); case POWERPC_MMU_BOOKE: cs->exception_index = POWERPC_EXCP_DTLB; env->error_code = 0; env->spr[SPR_BOOKE_DEAR] = address; env->spr[SPR_BOOKE_ESR] = rw ? ESR_ST : 0; return -1; case POWERPC_MMU_REAL: cpu_abort(cs, "PowerPC in real mode should never raise " "any MMU exceptions\n"); return -1; default: cpu_abort(cs, "Unknown or invalid MMU model\n"); return -1; } break; case -2: cs->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; if (env->mmu_model == POWERPC_MMU_SOFT_4xx || env->mmu_model == POWERPC_MMU_SOFT_4xx_Z) { env->spr[SPR_40x_DEAR] = address; if (rw) { env->spr[SPR_40x_ESR] |= 0x00800000; } } else if ((env->mmu_model == POWERPC_MMU_BOOKE) || (env->mmu_model == POWERPC_MMU_BOOKE206)) { env->spr[SPR_BOOKE_DEAR] = address; env->spr[SPR_BOOKE_ESR] = rw ? ESR_ST : 0; } else { env->spr[SPR_DAR] = address; if (rw == 1) { env->spr[SPR_DSISR] = 0x0A000000; } else { env->spr[SPR_DSISR] = 0x08000000; } } break; case -4: switch (access_type) { case ACCESS_FLOAT: cs->exception_index = POWERPC_EXCP_ALIGN; env->error_code = POWERPC_EXCP_ALIGN_FP; env->spr[SPR_DAR] = address; break; case ACCESS_RES: cs->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) { env->spr[SPR_DSISR] = 0x06000000; } else { env->spr[SPR_DSISR] = 0x04000000; } break; case ACCESS_EXT: cs->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) { env->spr[SPR_DSISR] = 0x06100000; } else { env->spr[SPR_DSISR] = 0x04100000; } break; default: printf("DSI: invalid exception (%d)\n", ret); cs->exception_index = POWERPC_EXCP_PROGRAM; env->error_code = POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL; env->spr[SPR_DAR] = address; break; } break; } } #if 0 printf("%s: set exception to %d %02x\n", __func__, cs->exception, env->error_code); #endif ret = 1; } return ret; }
1threat
Eclipse "Enhanced Class Decompiler" plugin does not decompile when debugging : <p>Problem description: Decompile works fine when viewing a class (i.e. Ctrl+Shift+T), but not when stepping into code from the debugging perspective - instead the "Class File Viewer" is opened. Version Used: Eclipse Oxygen and Enhanced Class Decompiler 3.0.0</p>
0debug
NSDocumentDirectory remove folder : <p>I have created a folder inside documents directory using : </p> <pre><code>fileManager.createDirectory(atPath:ziPFolderPath,withIntermediateDirectories: false, attributes: nil) </code></pre> <p>In this folder I have placed few files.<br> Later in the app, I want to delete not just the files inside the above folder, but also the folder.<br> <code>FileManager</code> supports <code>removeItem</code> function but I am wondering if it removes the folder as well.</p>
0debug
static void find_block_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2, int cx, int cy, int stride, MotionVector *mv) { int x, y; int diff; int smallest = INT_MAX; int tmp, tmp2; #define CMP(i, j) deshake->c.sad[0](deshake, src1 + cy * stride + cx, \ src2 + (j) * stride + (i), stride, \ deshake->blocksize) if (deshake->search == EXHAUSTIVE) { for (y = -deshake->ry; y <= deshake->ry; y++) { for (x = -deshake->rx; x <= deshake->rx; x++) { diff = CMP(cx - x, cy - y); if (diff < smallest) { smallest = diff; mv->x = x; mv->y = y; } } } } else if (deshake->search == SMART_EXHAUSTIVE) { for (y = -deshake->ry + 1; y < deshake->ry - 2; y += 2) { for (x = -deshake->rx + 1; x < deshake->rx - 2; x += 2) { diff = CMP(cx - x, cy - y); if (diff < smallest) { smallest = diff; mv->x = x; mv->y = y; } } } tmp = mv->x; tmp2 = mv->y; for (y = tmp2 - 1; y <= tmp2 + 1; y++) { for (x = tmp - 1; x <= tmp + 1; x++) { if (x == tmp && y == tmp2) continue; diff = CMP(cx - x, cy - y); if (diff < smallest) { smallest = diff; mv->x = x; mv->y = y; } } } } if (smallest > 512) { mv->x = -1; mv->y = -1; } emms_c(); }
1threat
static inline void t_gen_sext(TCGv d, TCGv s, int size) { if (size == 1) tcg_gen_ext8s_i32(d, s); else if (size == 2) tcg_gen_ext16s_i32(d, s); else if(GET_TCGV(d) != GET_TCGV(s)) tcg_gen_mov_tl(d, s); }
1threat
Removing Line Break (Special Character) in text file. VB.Net : I have a Text file which shows a Line Break in Ultraedit if we replace a special character in text file manually it works fine.[Line Break][1]. I have to change it manually and then process the files. Please let me know some way out pragmatically. [1]: http://i.stack.imgur.com/T9W7y.jpg
0debug
Using a loop to find greatest integer in array using Ruby : <p>I need to find the greatest integer in an array using a loop in Ruby</p> <p>ex: numbers = [10, 20, 30, 40, 50, 60]</p> <p><em>note</em> I can't use the .max function. HAS TO BE A LOOP.</p>
0debug
cpu_mips_check_sign_extensions (CPUState *env, FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...), int flags) { int i; if (!SIGN_EXT_P(env->active_tc.PC)) cpu_fprintf(f, "BROKEN: pc=0x" TARGET_FMT_lx "\n", env->active_tc.PC); if (!SIGN_EXT_P(env->active_tc.HI[0])) cpu_fprintf(f, "BROKEN: HI=0x" TARGET_FMT_lx "\n", env->active_tc.HI[0]); if (!SIGN_EXT_P(env->active_tc.LO[0])) cpu_fprintf(f, "BROKEN: LO=0x" TARGET_FMT_lx "\n", env->active_tc.LO[0]); if (!SIGN_EXT_P(env->btarget)) cpu_fprintf(f, "BROKEN: btarget=0x" TARGET_FMT_lx "\n", env->btarget); for (i = 0; i < 32; i++) { if (!SIGN_EXT_P(env->active_tc.gpr[i])) cpu_fprintf(f, "BROKEN: %s=0x" TARGET_FMT_lx "\n", regnames[i], env->active_tc.gpr[i]); } if (!SIGN_EXT_P(env->CP0_EPC)) cpu_fprintf(f, "BROKEN: EPC=0x" TARGET_FMT_lx "\n", env->CP0_EPC); if (!SIGN_EXT_P(env->lladdr)) cpu_fprintf(f, "BROKEN: LLAddr=0x" TARGET_FMT_lx "\n", env->lladdr); }
1threat
How to implement In-App Purchases Subscription in Flutter? : <p>I want to provide auto renewable subscription in my Flutter App for both iOS and Android devices. Users can subscribe for 1 Month. </p> <p>There is not an officially maintained in-app purchase plugin yet. But there are lots of plugins about In-App Purchases in Flutter. </p> <p>Which one is the best? How to implement? Are these secure?</p>
0debug
static SocketAddress *unix_build_address(const char *path) { SocketAddress *saddr; saddr = g_new0(SocketAddress, 1); saddr->type = SOCKET_ADDRESS_KIND_UNIX; saddr->u.q_unix.data = g_new0(UnixSocketAddress, 1); saddr->u.q_unix.data->path = g_strdup(path); return saddr; }
1threat
Jenkins: two slaves vs. one slave two executors : <p>Is there any difference between I create two slaves, or one slave with two executors on the same Windows server?</p>
0debug
How to compare two lists of tuple elements : I am a beginner of python, so maybe there will be some incorrect words in my question, and please correct me without hesitation.<br/> Here is what I have got.<br/> `List_1 = [(1.1,2,3),(1.1,2,3,4),(3,4,5),5,6,7]`<br/> `List_2 = [(1.1,2,3),(1.1,2,3,4),(3,4.4,5),5,6,7]` I expect the output:<br/> `Error = (3,4.4,5)`<br/> Does anyone know how to do it? Thank you in advance.
0debug
Android Studio Runtime Error : Run Time errors guys... App does not open. Please advise Whenever I run the app on my device it does not open I only get the following message "Unfortunately My_APP has stopped working" Any help is much appreciated I have been working on this for a while now and this error is really bugging me. 01-15 18:55:18.264 4285-4285/com.example.adeel.lfc_news E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.adeel.lfc_news, PID: 4285 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.adeel.lfc_news/com.example.adeel.lfc_news.MainActivity}: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false } at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2658) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2723) at android.app.ActivityThread.access$900(ActivityThread.java:172) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1422) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5832) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false } at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:458) at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:312) at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:277) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) at com.example.adeel.lfc_news.MainActivity.onCreate(MainActivity.java:24) at android.app.Activity.performCreate(Activity.java:6221) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2611) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2723)  at android.app.ActivityThread.access$900(ActivityThread.java:172)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1422)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:145)  at android.app.ActivityThread.main(ActivityThread.java:5832)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) 
0debug
Angular7 production build wrongfully compiles a SASS mixin : I'm using [this mixin][1] to make sloped blocks in my app's layout. It works well until I compile the app (`ng b --prod`) and upload it to AWS. Somehow it doesn't work in the same way as it did in development, instead of this: `clip-path: polygon(0 0, 100% calc(0% + 7vw), 100% 100%, 0 100%);` I get this: `clip-path: polygon(0 calc(0 + 7vw),100% 0,100% 100%,0 100%);` which is an invalid value, hence the resulting blocks look very much rectangular again. While I can (and most likely will) just define my own styles for this, I'd like to find the reason for this weird behavior. Does anybody know how compiling SASS for dev and for prod differs in Angular and how to fix it? Here's my [`angular.json`][2] in case it's relevant. [1]: https://github.com/NigelOToole/angled-edges [2]: https://gist.github.com/BerekHalfhand/08cd1569c46ee0b65e8633036b92a66c
0debug
static inline TCGv gen_extend(TCGv val, int opsize, int sign) { TCGv tmp; switch (opsize) { case OS_BYTE: tmp = tcg_temp_new(); if (sign) tcg_gen_ext8s_i32(tmp, val); else tcg_gen_ext8u_i32(tmp, val); break; case OS_WORD: tmp = tcg_temp_new(); if (sign) tcg_gen_ext16s_i32(tmp, val); else tcg_gen_ext16u_i32(tmp, val); break; case OS_LONG: case OS_SINGLE: tmp = val; break; default: qemu_assert(0, "Bad operand size"); } return tmp; }
1threat
How does the browser manage it's memory or clean its DOM? : <p>I am learning Backbone and want to better understand how the browser keeps it DOM clean and how to be efficient overall with my code. From my understanding, we use Backbone as a framework to throw on views onto an element that is usually found in the index.html (most of the time being the body tag). The view we throw in uses up the Browser's memory, and because of this, we want to do something like <code>$(body).html('')</code> to erase everything when we switch to another view or no longer need the old view. Is this correct?</p>
0debug
Chaining promises with promises inside then() : <p>How do you chain in an scenario like this?</p> <p><em>api</em> is a function that returns a promise after an http request. <em>auth</em> is a function that returns a promise after <em>api</em> respond, if resolves <em>api</em> is called for a second time, if not <em>auth</em> rejects.</p> <p>I tried this, but not only am I going back to the callback hell, it does not work.</p> <pre><code>function api(query) { return new Promise(function(resolve, reject) { //DO SOME STUFF AND SOMETIMES resolves... }) } function auth() { return new Promise(function(resolve, reject) { api("/foo").then(function(asset1) { api("/bar").then(function(asset2) { resolve(asset2); }).catch(function() { reject(); }) }).catch(function(error) { reject(); }) }) } </code></pre>
0debug
static const char *rpath(FsContext *ctx, const char *path) { static char buffer[4096]; snprintf(buffer, sizeof(buffer), "%s/%s", ctx->fs_root, path); return buffer; }
1threat
static void arm_gic_common_realize(DeviceState *dev, Error **errp) { GICState *s = ARM_GIC_COMMON(dev); int num_irq = s->num_irq; if (s->num_cpu > GIC_NCPU) { error_setg(errp, "requested %u CPUs exceeds GIC maximum %d", s->num_cpu, GIC_NCPU); s->num_irq += GIC_BASE_IRQ; if (s->num_irq > GIC_MAXIRQ) { error_setg(errp, "requested %u interrupt lines exceeds GIC maximum %d", num_irq, GIC_MAXIRQ); if (s->num_irq < 32 || (s->num_irq % 32)) { error_setg(errp, "%d interrupt lines unsupported: not divisible by 32", num_irq);
1threat
int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data) { MigrationState *s = current_migration; if (s) s->cancel(s); return 0; }
1threat
storing form data to json : Hi I am new to Frontend web dev. I wrote a code for a sign up form. I want to add the values of email id and password to JSON file in the form of array objects. Here is my html file. <!DOCTYPE html> <head> <link rel="stylesheet" type="text/css" href="style.css"> <meta name="robots" content="noindex, nofollow" charset="UTF-8"> </head> <body> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.3.min.js"></script> <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/jquery.validate.min.js"></script> <script type="text/javascript" src="jQuery-UI.js"></script> <script src="validate.js"></script> <form id="myform" enctype="application/json"> <div class="container-form"> <fieldset> <legend>Sign up</legend> <label for="username">User Name</label><br> <input type="text" name="username[]" id="username" placeholder="Your name" minlength="2" required=""><br><br> <label for="contact">Contact</label><br> <input name="contact" type="number" id="contact" placeholder="Phone Number" > <br><br> <label for="emailid">Email id</label><br> <input type="email" name="emailid[]" id="email" pattern="[^@]+@[^@]+\.[a-zA-Z]{2,6}" placeholder="Enter email id" required=""><br><br> <label for="password">Password</label><br> <input type="password" name="password[]" id="password" placeholder="Enter password" required="" minlength="6"><br><br> <label for="password">Confirm Password</label><br> <input type="password" name="cpassword" id="cpassword" placeholder="Confirm Password"><br><br> <button type="submit" name="register" id="register" value="Submit">Submit</button> <button type="reset" value="Clear">Clear</button> <div id="result"> </div> </fieldset> </div> </form> </body> please help me out, if possible send the code instead of link to some website. Thanks. And also, do I need to install files to setup JSON?
0debug
Find and Replace , between 2 characters : <p>So I have a CSV file with some anomaly for eg</p> <pre><code>2019-07-25 00:00:00,1014488,2019-07-25 12:24:12,112629,Amy,Flutmus,84004,GM,0001,2.99,312,FFO &amp; CS PLATE ||22,10999,90027,90062||Sand w/ Options,1,0,0.2,18.85,0,1 </code></pre> <p>i want to replace , between these characters || ||. So I'm expecting </p> <pre><code>2019-07-25 00:00:00,1014488,2019-07-25 12:24:12,112629,Amy,Flutmus,84004,GM,0001,2.99,312,FFO &amp; CS PLATE ,22,*10999*90027*90062,Sand w/ Options,1,0,0.2,18.85,0,1 </code></pre>
0debug
How to do inline styling in html/php? : <p>I am working on a website in which I want to do inline styling inside php tags. </p> <pre><code>&lt;?php if($data['item']-&gt;hello_world!=null) { echo "policy:"; echo strtolower($data['item']-&gt;hello_world-&gt;name); echo "&lt;br&gt;"; echo strtolower($data['item']-&gt;hello_world-&gt;description); } ?&gt;&lt;?php if($data['item']-&gt;hello_world!=null) { echo "policy:"; echo strtolower($data['item']-&gt;hello_world-&gt;name); echo "&lt;br&gt;"; echo "&lt;br&gt;"; echo strtolower($data['item']-&gt;hello_world-&gt;description); } ?&gt; </code></pre> <p>The data which I want to style coming from the php code is:</p> <p><code>echo strtolower($data['item']-&gt;hello_world-&gt;name);</code></p> <p><br> <strong>Problem Statement:</strong></p> <p>I am wondering what changes I should make in the php code so that I am able to do styling for the above mentioned line. </p>
0debug
Difference between git-lfs and dvc : <p>What is the difference between these two? We used git-lfs in my previous job and we are starting to use dvc alongside git in my current one. They both place some kind of index instead of file and can be downloaded on demand. Has dvc some improvements over the former one?</p>
0debug
static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, long src_size) { const uint16_t *end; #ifdef HAVE_MMX const uint16_t *mm_end; #endif uint8_t *d = (uint8_t *)dst; const uint16_t *s = (const uint16_t *)src; end = s + src_size/2; #ifdef HAVE_MMX __asm __volatile(PREFETCH" %0"::"m"(*s):"memory"); __asm __volatile("pxor %%mm7,%%mm7\n\t":::"memory"); mm_end = end - 3; while(s < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movq %1, %%mm0\n\t" "movq %1, %%mm1\n\t" "movq %1, %%mm2\n\t" "pand %2, %%mm0\n\t" "pand %3, %%mm1\n\t" "pand %4, %%mm2\n\t" "psllq $3, %%mm0\n\t" "psrlq $2, %%mm1\n\t" "psrlq $7, %%mm2\n\t" "movq %%mm0, %%mm3\n\t" "movq %%mm1, %%mm4\n\t" "movq %%mm2, %%mm5\n\t" "punpcklwd %%mm7, %%mm0\n\t" "punpcklwd %%mm7, %%mm1\n\t" "punpcklwd %%mm7, %%mm2\n\t" "punpckhwd %%mm7, %%mm3\n\t" "punpckhwd %%mm7, %%mm4\n\t" "punpckhwd %%mm7, %%mm5\n\t" "psllq $8, %%mm1\n\t" "psllq $16, %%mm2\n\t" "por %%mm1, %%mm0\n\t" "por %%mm2, %%mm0\n\t" "psllq $8, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm4, %%mm3\n\t" "por %%mm5, %%mm3\n\t" MOVNTQ" %%mm0, %0\n\t" MOVNTQ" %%mm3, 8%0\n\t" :"=m"(*d) :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r) :"memory"); d += 16; s += 4; } __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(s < end) { #if 0 int bgr= *s++; *((uint32_t*)d)++ = ((bgr&0x1F)<<3) + ((bgr&0x3E0)<<6) + ((bgr&0x7C00)<<9); #else register uint16_t bgr; bgr = *s++; #ifdef WORDS_BIGENDIAN *d++ = 0; *d++ = (bgr&0x7C00)>>7; *d++ = (bgr&0x3E0)>>2; *d++ = (bgr&0x1F)<<3; #else *d++ = (bgr&0x1F)<<3; *d++ = (bgr&0x3E0)>>2; *d++ = (bgr&0x7C00)>>7; *d++ = 0; #endif #endif } }
1threat
authority http header - in chrome dev tools : <p>chrome dev tools - displays some http header with a leading <code>:</code> (not sure why it does with some and not others). </p> <p>One of these is the http header <code>authority</code> which is displays as:</p> <p><code>authority:api.somedomain.com</code></p> <p>However this is listed in the list of http headers on Wikipedia. Is this a new HTTP2 header or is possible to define any new request field in the headers -or are these fixed?</p>
0debug
static int fw_cfg_boot_set(void *opaque, const char *boot_device) { fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]); return 0; }
1threat
Parse Error in PhP Program : <p>I am trying to make a webpage that will take user input and add it to a .txt file. It is supposed to work like this webpage <a href="http://150.216.54.86:808/homework8/AirlineSurvey.html" rel="nofollow noreferrer">http://150.216.54.86:808/homework8/AirlineSurvey.html</a> Why am I receiving "Parse error: syntax error, unexpected ';'" on line 27?</p> <pre><code>&lt;?php $WaitTime = addslashes($_POST["wait_time"]); $Friendliness = addslashes($_POST["friendliness"]); //missing ); $Space = addslashes($_POST["space"]); $Comfort = addslashes($_POST["comfort"]); //missing $ $Cleanliness = addslashes($_POST["cleanliness"]); $Noise = addslashes($_POST["noise"]); if (empty($WaitTime) || empty($Friendliness) || empty($Space) || empty($Comfort) || empty($Cleanliness) || empty($Noise)) echo "&lt;hr /&gt;&lt;p&gt;You must enter a value in each field. Click your browser's Back button to return to the form.&lt;/p&gt;&lt;hr /&gt;"; else { $Entry = $WaitTime . "\n"; $Entry .= $Friendliness . "\n"; $Entry .= $Space . "\n"; $Entry .= $Comfort . "\n"; $Entry .= $Cleanliness . "\n"; $Entry .= $Noise . "\n"; $SurveyFile = fopen("survey.txt", "w"); /missing ; if (flock($SurveyFile, LOCK_EX)) { if (fwrite($SurveyFile, $Entry) &gt; 0) { echo "&lt;p&gt;The entry has been successfully added.&lt;/p&gt;"; flock($SurveyFile, LOCK_UN; fclose($SurveyFile); else echo "&lt;p&gt;The entry could not be saved!&lt;/p&gt;"; } } else echo "&lt;p&gt;The entry could not be saved!&lt;/p&gt;"; } empty($Noise)) echo "&lt;hr /&gt;&lt;p&gt;You must enter a value in each field. Click your browser's Back button to return to the form.&lt;/p&gt;&lt;hr /&gt;"; else { $Entry = $WaitTime . "\n"; $Entry .= $Friendliness . "\n"; $Entry .= $Space . "\n"; $Entry .= $Comfort . "\n"; $Entry .= $Cleanliness . "\n"; $Entry .= $Noise . "\n"; $SurveyFile = fopen("survey.txt", "w"); //missing ; //missing } } if (flock($SurveyFile, LOCK_EX)) { if (fwrite($SurveyFile, $Entry) &gt; 0) { echo "&lt;p&gt;The entry has been successfully added.&lt;/p&gt;"; flock($SurveyFile, LOCK_UN; fclose($SurveyFile); else echo "&lt;p&gt;The entry could not be saved!&lt;/p&gt;"; } else { echo "&lt;p&gt;The entry could not be saved!&lt;/p&gt;"; } } </code></pre> <p>?></p>
0debug
Beginner , don't understand logic in simple math : i will go straight to the problem . So this bothers me a lot and i know the logic behind it but i seem to not comprehend this logic . You will think of me as a retard but if you can , try to explain me .. So : when i write in python this x = 1 x = x + 1 it means x equals 1 (logic) but the 2nd line i was told that it says , "The new value of x is equal to the old value of x , which is 1 , + 1 " this bothers me because in math you would not have a "new value of x and an old value of x" cause x will have only one value and also i would replace the first x so it will be like 1 = 1 +1(because they are 2 x-s and i replace both of them with the value of 1 ) which is 1=2 which is non sense but until now that is how i would think about it . I don't know , maybe i'm just dumb.
0debug
AWS Cloudfront redirecting to S3 bucket : <p>I have created a cloudfront distribution to serve the static website. S3 is origin server. Now if we access cloudfront url, it redirects to S3 location.</p> <p>d2s18t7gwlicql.cloudfront.net or test.telekha.in</p> <p>In the browser it is showing <a href="https://telekha-test-www.s3.ap-south-1.amazonaws.com/index.html#/dashboard" rel="noreferrer">https://telekha-test-www.s3.ap-south-1.amazonaws.com/index.html#/dashboard</a></p> <p>i am expecting <a href="https://test.telekha.in/#/dashboard" rel="noreferrer">https://test.telekha.in/#/dashboard</a></p> <p>If I access <a href="https://test.telekha.in" rel="noreferrer">https://test.telekha.in</a> through curl it returns my index.html document</p> <p>If I access <a href="http://test.telekha.in" rel="noreferrer">http://test.telekha.in</a> through curl it returns</p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;title&gt;301 Moved Permanently&lt;/title&gt;&lt;/head&gt; &lt;body bgcolor="white"&gt; &lt;center&gt;&lt;h1&gt;301 Moved Permanently&lt;/h1&gt;&lt;/center&gt; &lt;hr&gt;&lt;center&gt;CloudFront&lt;/center&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>But in browser both http and https are redirecting to <a href="https://telekha-test-www.s3.ap-south-1.amazonaws.com/index.html#/" rel="noreferrer">https://telekha-test-www.s3.ap-south-1.amazonaws.com/index.html#/</a></p> <p>Please let me know how to resolve this issue.</p>
0debug
int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, const H2645NAL *nal) { int i, j, ret = 0; int first_slice = sl == h->slice_ctx && !h->current_slice; ret = h264_slice_header_parse(h, sl, nal); if (ret < 0) return ret; if (sl->first_mb_addr == 0) { if (h->current_slice) { if (h->setup_finished) { av_log(h->avctx, AV_LOG_ERROR, "Too many fields\n"); return AVERROR_INVALIDDATA; } if (h->max_contexts > 1) { if (!h->single_decode_warning) { av_log(h->avctx, AV_LOG_WARNING, "Cannot decode multiple access units as slice threads\n"); h->single_decode_warning = 1; } h->max_contexts = 1; return SLICE_SINGLETHREAD; } if (h->cur_pic_ptr && FIELD_PICTURE(h) && h->first_field) { ret = ff_h264_field_end(h, h->slice_ctx, 1); h->current_slice = 0; if (ret < 0) return ret; } else if (h->cur_pic_ptr && !FIELD_PICTURE(h) && !h->first_field && h->nal_unit_type == NAL_IDR_SLICE) { av_log(h, AV_LOG_WARNING, "Broken frame packetizing\n"); ret = ff_h264_field_end(h, h->slice_ctx, 1); h->current_slice = 0; ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 0); ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 1); h->cur_pic_ptr = NULL; if (ret < 0) return ret; } else return AVERROR_INVALIDDATA; } if (!h->first_field) { if (h->cur_pic_ptr && !h->droppable) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, h->picture_structure == PICT_BOTTOM_FIELD); } h->cur_pic_ptr = NULL; } } if (!h->current_slice) av_assert0(sl == h->slice_ctx); if (h->current_slice == 0 && !h->first_field) { if ( (h->avctx->skip_frame >= AVDISCARD_NONREF && !h->nal_ref_idc) || (h->avctx->skip_frame >= AVDISCARD_BIDIR && sl->slice_type_nos == AV_PICTURE_TYPE_B) || (h->avctx->skip_frame >= AVDISCARD_NONINTRA && sl->slice_type_nos != AV_PICTURE_TYPE_I) || (h->avctx->skip_frame >= AVDISCARD_NONKEY && h->nal_unit_type != NAL_IDR_SLICE && h->sei.recovery_point.recovery_frame_cnt < 0) || h->avctx->skip_frame >= AVDISCARD_ALL) { return SLICE_SKIPED; } } if (!first_slice) { const PPS *pps = (const PPS*)h->ps.pps_list[sl->pps_id]->data; if (h->ps.pps->sps_id != pps->sps_id || h->ps.pps->transform_8x8_mode != pps->transform_8x8_mode ) { av_log(h->avctx, AV_LOG_ERROR, "PPS changed between slices\n"); return AVERROR_INVALIDDATA; } if (h->ps.sps != (const SPS*)h->ps.sps_list[h->ps.pps->sps_id]->data) { av_log(h->avctx, AV_LOG_ERROR, "SPS changed in the middle of the frame\n"); return AVERROR_INVALIDDATA; } } if (h->current_slice == 0) { ret = h264_field_start(h, sl, nal, first_slice); if (ret < 0) return ret; } else { if (h->picture_structure != sl->picture_structure || h->droppable != (nal->ref_idc == 0)) { av_log(h->avctx, AV_LOG_ERROR, "Changing field mode (%d -> %d) between slices is not allowed\n", h->picture_structure, sl->picture_structure); return AVERROR_INVALIDDATA; } else if (!h->cur_pic_ptr) { av_log(h->avctx, AV_LOG_ERROR, "unset cur_pic_ptr on slice %d\n", h->current_slice + 1); return AVERROR_INVALIDDATA; } } av_assert1(h->mb_num == h->mb_width * h->mb_height); if (sl->first_mb_addr << FIELD_OR_MBAFF_PICTURE(h) >= h->mb_num || sl->first_mb_addr >= h->mb_num) { av_log(h->avctx, AV_LOG_ERROR, "first_mb_in_slice overflow\n"); return AVERROR_INVALIDDATA; } sl->resync_mb_x = sl->mb_x = sl->first_mb_addr % h->mb_width; sl->resync_mb_y = sl->mb_y = (sl->first_mb_addr / h->mb_width) << FIELD_OR_MBAFF_PICTURE(h); if (h->picture_structure == PICT_BOTTOM_FIELD) sl->resync_mb_y = sl->mb_y = sl->mb_y + 1; av_assert1(sl->mb_y < h->mb_height); if (!h->setup_finished) { ff_h264_init_poc(h->cur_pic_ptr->field_poc, &h->cur_pic_ptr->poc, h->ps.sps, &h->poc, h->picture_structure, nal->ref_idc); memcpy(h->mmco, sl->mmco, sl->nb_mmco * sizeof(*h->mmco)); h->nb_mmco = sl->nb_mmco; h->explicit_ref_marking = sl->explicit_ref_marking; } ret = ff_h264_build_ref_list(h, sl); if (ret < 0) return ret; if (h->ps.pps->weighted_bipred_idc == 2 && sl->slice_type_nos == AV_PICTURE_TYPE_B) { implicit_weight_table(h, sl, -1); if (FRAME_MBAFF(h)) { implicit_weight_table(h, sl, 0); implicit_weight_table(h, sl, 1); } } if (sl->slice_type_nos == AV_PICTURE_TYPE_B && !sl->direct_spatial_mv_pred) ff_h264_direct_dist_scale_factor(h, sl); ff_h264_direct_ref_list_init(h, sl); if (h->avctx->skip_loop_filter >= AVDISCARD_ALL || (h->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->nal_unit_type != NAL_IDR_SLICE) || (h->avctx->skip_loop_filter >= AVDISCARD_NONINTRA && sl->slice_type_nos != AV_PICTURE_TYPE_I) || (h->avctx->skip_loop_filter >= AVDISCARD_BIDIR && sl->slice_type_nos == AV_PICTURE_TYPE_B) || (h->avctx->skip_loop_filter >= AVDISCARD_NONREF && nal->ref_idc == 0)) sl->deblocking_filter = 0; if (sl->deblocking_filter == 1 && h->max_contexts > 1) { if (h->avctx->flags2 & AV_CODEC_FLAG2_FAST) { sl->deblocking_filter = 2; } else { h->postpone_filter = 1; } } sl->qp_thresh = 15 - FFMIN(sl->slice_alpha_c0_offset, sl->slice_beta_offset) - FFMAX3(0, h->ps.pps->chroma_qp_index_offset[0], h->ps.pps->chroma_qp_index_offset[1]) + 6 * (h->ps.sps->bit_depth_luma - 8); sl->slice_num = ++h->current_slice; if (sl->slice_num) h->slice_row[(sl->slice_num-1)&(MAX_SLICES-1)]= sl->resync_mb_y; if ( h->slice_row[sl->slice_num&(MAX_SLICES-1)] + 3 >= sl->resync_mb_y && h->slice_row[sl->slice_num&(MAX_SLICES-1)] <= sl->resync_mb_y && sl->slice_num >= MAX_SLICES) { av_log(h->avctx, AV_LOG_WARNING, "Possibly too many slices (%d >= %d), increase MAX_SLICES and recompile if there are artifacts\n", sl->slice_num, MAX_SLICES); } for (j = 0; j < 2; j++) { int id_list[16]; int *ref2frm = h->ref2frm[sl->slice_num & (MAX_SLICES - 1)][j]; for (i = 0; i < 16; i++) { id_list[i] = 60; if (j < sl->list_count && i < sl->ref_count[j] && sl->ref_list[j][i].parent->f->buf[0]) { int k; AVBuffer *buf = sl->ref_list[j][i].parent->f->buf[0]->buffer; for (k = 0; k < h->short_ref_count; k++) if (h->short_ref[k]->f->buf[0]->buffer == buf) { id_list[i] = k; break; } for (k = 0; k < h->long_ref_count; k++) if (h->long_ref[k] && h->long_ref[k]->f->buf[0]->buffer == buf) { id_list[i] = h->short_ref_count + k; break; } } } ref2frm[0] = ref2frm[1] = -1; for (i = 0; i < 16; i++) ref2frm[i + 2] = 4 * id_list[i] + (sl->ref_list[j][i].reference & 3); ref2frm[18 + 0] = ref2frm[18 + 1] = -1; for (i = 16; i < 48; i++) ref2frm[i + 4] = 4 * id_list[(i - 16) >> 1] + (sl->ref_list[j][i].reference & 3); } if (h->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(h->avctx, AV_LOG_DEBUG, "slice:%d %s mb:%d %c%s%s frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s %s\n", sl->slice_num, (h->picture_structure == PICT_FRAME ? "F" : h->picture_structure == PICT_TOP_FIELD ? "T" : "B"), sl->mb_y * h->mb_width + sl->mb_x, av_get_picture_type_char(sl->slice_type), sl->slice_type_fixed ? " fix" : "", nal->type == NAL_IDR_SLICE ? " IDR" : "", h->poc.frame_num, h->cur_pic_ptr->field_poc[0], h->cur_pic_ptr->field_poc[1], sl->ref_count[0], sl->ref_count[1], sl->qscale, sl->deblocking_filter, sl->slice_alpha_c0_offset, sl->slice_beta_offset, sl->pwt.use_weight, sl->pwt.use_weight == 1 && sl->pwt.use_weight_chroma ? "c" : "", sl->slice_type == AV_PICTURE_TYPE_B ? (sl->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""); } return 0; }
1threat
C language_Error:expected ')' before ';' token : <p>Just in case you need to know what the program I'm working on -It's a homework question:A five-digit number is entered through the keyboard. Write a function to obtain the reversed number and another function to determine whether the original and reversed numbers are equal or not. Use this functions inside the main() and provide the necessary arguments to get a result.</p> <p>My code is:</p> <pre><code>#include &lt;stdio.h&gt; int Reversed(int rev); int Equality(int equ); int main (){ int num,result; printf("Please enter a number that has five digits:"); scanf("%d", &amp;num); result=Equality(num); return 0; } int Reversed(int num){ int number=num; int rev=0; int digit; do{ digit=num%10; rev=rev*10+digit; num=num/10; } while ((num&gt;0)); return rev; } int Equality(num){ int reve,numb; if ( (numb=num)== (reve=Reversed(num);) ) printf("number equals the reversed number"); else printf("number doesn't equal the reversed number"); } </code></pre>
0debug
Append Elements to Expanding List : <p>I want to generate an expanding nested list. How do I generate a nested list as such?</p> <pre><code>[1.0, None] [-1.0, [1.0, None]] [-1.0, [1.0, [3.0, None]]] [6,[-1.0, [1.0, [3.0, None]]]] </code></pre> <p>Essentially, I want to create a nested list in which each element gets inserted into the original list. </p>
0debug
Get every variable loop value in array - Javascript : Can somebody please help me out how to get every variable of loop into an array and call all the variables in some other variable. I am very new to array. I don't have any idea how to solve this. Suppose I have an Array[] and the variable in an array is i, so i1, i2, i3 ....... in n is the number of times loop will run. So for (i=1; i<=n, i++) { i need an array called here. there will be some code play here There will be some value returned after the code it could be text or no. } then i want to assign all the values of array into a variable with comma seperated var k = array{} i.e k = "i1,i2,i3,......in" I try to find on google but not able to find any solution. Please Help me out. it's urgent. This example is a reference for what I want to achieve actually.
0debug
NODE_ENV is not recognised as an internal or external command : <p>I am developing in node.js and wanted to take into account both production and development environment. I found out that setting NODE_ENV while running the node.js server does the job. However when I try to set it in package.json script it gives me the error:</p> <blockquote> <p>NODE_ENV is not recognised as an internal or external command</p> </blockquote> <p>Below is my package.json</p> <pre><code>{ "name": "NODEAPT", "version": "0.0.0", "private": true, "scripts": { "start": "NODE_ENV=development node ./bin/server", "qa2": "NODE_ENV=qa2 node ./bin/server", "prod": "NODE_ENV=production node ./bin/server" }, "dependencies": { "body-parser": "~1.15.1", "cookie-parser": "~1.4.3", "debug": "~2.2.0", "express": "~4.13.4", "fs": "0.0.1-security", "jade": "~1.11.0", "morgan": "~1.7.0", "oracledb": "^1.11.0", "path": "^0.12.7", "serve-favicon": "~2.3.0" } } </code></pre> <p>I run my node server as: <code>npm run qa2</code> for example.</p> <p>I don't know what I am doing wrong. Any help is appreciated</p>
0debug
How can I do a Swift for-in loop with a step? : <p>With the <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0007-remove-c-style-for-loops.md">removal of the traditional C-style for-loop in Swift 3.0</a>, how can I do the following?</p> <pre><code>for (i = 1; i &lt; max; i+=2) { // Do something } </code></pre> <p>In Python, the for-in control flow statement has an optional step value:</p> <pre><code>for i in range(1, max, 2): # Do something </code></pre> <p>But the Swift range operator appears to have no equivalent:</p> <pre><code>for i in 1..&lt;max { // Do something } </code></pre>
0debug
static int decode_residual_block(AVSContext *h, GetBitContext *gb, const dec_2dvlc_t *r, int esc_golomb_order, int qp, uint8_t *dst, int stride) { int i, level_code, esc_code, level, run, mask; DCTELEM level_buf[64]; uint8_t run_buf[64]; DCTELEM *block = h->block; for(i=0;i<65;i++) { level_code = get_ue_code(gb,r->golomb_order); if(level_code >= ESCAPE_CODE) { run = ((level_code - ESCAPE_CODE) >> 1) + 1; esc_code = get_ue_code(gb,esc_golomb_order); level = esc_code + (run > r->max_run ? 1 : r->level_add[run]); while(level > r->inc_limit) r++; mask = -(level_code & 1); level = (level^mask) - mask; } else { level = r->rltab[level_code][0]; if(!level) break; run = r->rltab[level_code][1]; r += r->rltab[level_code][2]; } level_buf[i] = level; run_buf[i] = run; } if(dequant(h,level_buf, run_buf, block, ff_cavs_dequant_mul[qp], ff_cavs_dequant_shift[qp], i)) return -1; h->s.dsp.cavs_idct8_add(dst,block,stride); return 0; }
1threat
static void configure_rtc(QemuOpts *opts) { const char *value; value = qemu_opt_get(opts, "base"); if (value) { if (!strcmp(value, "utc")) { rtc_utc = 1; } else if (!strcmp(value, "localtime")) { rtc_utc = 0; } else { configure_rtc_date_offset(value, 0); } } value = qemu_opt_get(opts, "clock"); if (value) { if (!strcmp(value, "host")) { rtc_clock = QEMU_CLOCK_HOST; } else if (!strcmp(value, "rt")) { rtc_clock = QEMU_CLOCK_REALTIME; } else if (!strcmp(value, "vm")) { rtc_clock = QEMU_CLOCK_VIRTUAL; } else { fprintf(stderr, "qemu: invalid option value '%s'\n", value); exit(1); } } value = qemu_opt_get(opts, "driftfix"); if (value) { if (!strcmp(value, "slew")) { static GlobalProperty slew_lost_ticks[] = { { .driver = "mc146818rtc", .property = "lost_tick_policy", .value = "slew", }, { } }; qdev_prop_register_global_list(slew_lost_ticks); } else if (!strcmp(value, "none")) { } else { fprintf(stderr, "qemu: invalid option value '%s'\n", value); exit(1); } } }
1threat
i want to create login in laravel, i have problem in cmd with: php artisan make:auth : [**this is the image of the CMD!! **][1] [1]: https://i.stack.imgur.com/GtJRj.png i have problem in "CMD" with: php artisan "make:auth". how can i create login in laravel
0debug
How modulus operation works in C++? : <p>Why do I get this output: 0 1 2 3 0 1 2 3 0 1 after running the code below? Doesn't the modulus operation finds the remainder after division of one number by another? </p> <pre><code>#include &lt;iostream&gt; using namespace std; int main () { for (int i=0; i&lt; 10; ++i) cout &lt;&lt; i % 4 &lt;&lt; " "; } </code></pre>
0debug
static void sync_c0_tcstatus(CPUMIPSState *cpu, int tc, target_ulong v) { uint32_t status; uint32_t tcu, tmx, tasid, tksu; uint32_t mask = ((1 << CP0St_CU3) | (1 << CP0St_CU2) | (1 << CP0St_CU1) | (1 << CP0St_CU0) | (1 << CP0St_MX) | (3 << CP0St_KSU)); tcu = (v >> CP0TCSt_TCU0) & 0xf; tmx = (v >> CP0TCSt_TMX) & 0x1; tasid = v & 0xff; tksu = (v >> CP0TCSt_TKSU) & 0x3; status = tcu << CP0St_CU0; status |= tmx << CP0St_MX; status |= tksu << CP0St_KSU; cpu->CP0_Status &= ~mask; cpu->CP0_Status |= status; cpu->CP0_EntryHi &= ~0xff; cpu->CP0_EntryHi = tasid; compute_hflags(cpu); }
1threat
Jenkins git submodule update fails : <p>I have a git repo which has one submodule. Both belong to a team on BitBucket. My jenkins machine is a AWS windows server with the git plugin. I am using SSH keys for authentication. I have three jenkins jobs. One clones the main repo. This is successful. One clones the second repo on its own (the repo which will be used as a submodule). This is also successful. In my third build job I tell jenkins to recursively update the submodules. This fails and says public-key error. How can this be the case if I can clone the repo on its own?</p> <p>Console output below:</p> <pre><code>Started by user anonymous Building on master in workspace C:\Program Files (x86)\Jenkins\jobs\MainRepo\workspace Wiping out workspace first. Cloning the remote Git repository Cloning repository git@bitbucket.org:team/mainrepo.git &gt; git.exe init C:\Program Files (x86)\Jenkins\jobs\mainrepo\workspace # timeout=10 Fetching upstream changes from git@bitbucket.org:team/mainrepo.git &gt; git.exe --version # timeout=10 using GIT_SSH to set credentials &gt; git.exe -c core.askpass=true fetch --tags --progress git@bitbucket.org:team/mainrepo.git +refs/heads/*:refs/remotes/origin/* &gt; git.exe config remote.origin.url git@bitbucket.org:team/mainrepo.git # timeout=10 &gt; git.exe config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 &gt; git.exe config remote.origin.url git@bitbucket.org:team/mainrepo.git # timeout=10 Fetching upstream changes from git@bitbucket.org:team/mainrepo.git using GIT_SSH to set credentials &gt; git.exe -c core.askpass=true fetch --tags --progress git@bitbucket.org:team/mainrepo.git +refs/heads/*:refs/remotes/origin/* &gt; git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10 &gt; git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10 Checking out Revision 6b3f6535c45e79ee88f4918d464edead48d83369 (refs/remotes/origin/master) &gt; git.exe config core.sparsecheckout # timeout=10 &gt; git.exe checkout -f 6b3f6535c45e79ee88f4918d464edead48d83369 &gt; git.exe rev-list 6b3f6535c45e79ee88f4918d464edead48d83369 # timeout=10 &gt; git.exe remote # timeout=10 &gt; git.exe submodule init # timeout=10 &gt; git.exe submodule sync # timeout=10 &gt; git.exe config --get remote.origin.url # timeout=10 &gt; git.exe submodule update --init --recursive FATAL: Command "git.exe submodule update --init --recursive" returned status code 128: stdout: stderr: Cloning into 'my-submodule'... Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. fatal: clone of 'git@bitbucket.org:team/my-submodule.git' into submodule path 'my-submodule' failed hudson.plugins.git.GitException: Command "git.exe submodule update --init --recursive" returned status code 128: stdout: stderr: Cloning into 'my-submodule'... Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. fatal: clone of 'git@bitbucket.org:team/my-submodule.git' into submodule path 'my-submodule' failed at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1693) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:62) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$7.execute(CliGitAPIImpl.java:953) at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:90) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1098) at hudson.scm.SCM.checkout(SCM.java:485) at hudson.model.AbstractProject.checkout(AbstractProject.java:1276) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) at hudson.model.Run.execute(Run.java:1738) at hudson.matrix.MatrixBuild.run(MatrixBuild.java:301) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Finished: FAILURE </code></pre>
0debug
static void opt_output_file(const char *filename) { AVFormatContext *oc; int err, use_video, use_audio, use_subtitle; int input_has_video, input_has_audio, input_has_subtitle; AVFormatParameters params, *ap = &params; AVOutputFormat *file_oformat; if (!strcmp(filename, "-")) filename = "pipe:"; oc = avformat_alloc_context(); if (!oc) { print_error(filename, AVERROR(ENOMEM)); ffmpeg_exit(1); } if (last_asked_format) { file_oformat = av_guess_format(last_asked_format, NULL, NULL); if (!file_oformat) { fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); ffmpeg_exit(1); } last_asked_format = NULL; } else { file_oformat = av_guess_format(NULL, filename, NULL); if (!file_oformat) { fprintf(stderr, "Unable to find a suitable output format for '%s'\n", filename); ffmpeg_exit(1); } } oc->oformat = file_oformat; av_strlcpy(oc->filename, filename, sizeof(oc->filename)); if (!strcmp(file_oformat->name, "ffm") && av_strstart(filename, "http:", NULL)) { int err = read_ffserver_streams(oc, filename); if (err < 0) { print_error(filename, err); ffmpeg_exit(1); } } else { use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name; use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name; use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name; if (nb_input_files > 0) { check_audio_video_sub_inputs(&input_has_video, &input_has_audio, &input_has_subtitle); if (!input_has_video) use_video = 0; if (!input_has_audio) use_audio = 0; if (!input_has_subtitle) use_subtitle = 0; } if (audio_disable) { use_audio = 0; } if (video_disable) { use_video = 0; } if (subtitle_disable) { use_subtitle = 0; } if (use_video) { new_video_stream(oc); } if (use_audio) { new_audio_stream(oc); } if (use_subtitle) { new_subtitle_stream(oc); } oc->timestamp = recording_timestamp; for(; metadata_count>0; metadata_count--){ av_metadata_set2(&oc->metadata, metadata[metadata_count-1].key, metadata[metadata_count-1].value, 0); } av_metadata_conv(oc, oc->oformat->metadata_conv, NULL); } output_files[nb_output_files++] = oc; if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(oc->filename)) { print_error(oc->filename, AVERROR_NUMEXPECTED); ffmpeg_exit(1); } } if (!(oc->oformat->flags & AVFMT_NOFILE)) { if (!file_overwrite && (strchr(filename, ':') == NULL || filename[1] == ':' || av_strstart(filename, "file:", NULL))) { if (url_exist(filename)) { if (!using_stdin) { fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename); fflush(stderr); if (!read_yesno()) { fprintf(stderr, "Not overwriting - exiting\n"); ffmpeg_exit(1); } } else { fprintf(stderr,"File '%s' already exists. Exiting.\n", filename); ffmpeg_exit(1); } } } if ((err = url_fopen(&oc->pb, filename, URL_WRONLY)) < 0) { print_error(filename, err); ffmpeg_exit(1); } } memset(ap, 0, sizeof(*ap)); if (av_set_parameters(oc, ap) < 0) { fprintf(stderr, "%s: Invalid encoding parameters\n", oc->filename); ffmpeg_exit(1); } oc->preload= (int)(mux_preload*AV_TIME_BASE); oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE); oc->loop_output = loop_output; oc->flags |= AVFMT_FLAG_NONBLOCK; set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM, NULL); nb_streamid_map = 0; }
1threat
static int vnc_update_client(VncState *vs, int has_dirty) { if (vs->need_update && vs->csock != -1) { VncDisplay *vd = vs->vd; VncJob *job; int y; int width, height; int n = 0; if (vs->output.offset && !vs->audio_cap && !vs->force_update) return 0; if (!has_dirty && !vs->audio_cap && !vs->force_update) return 0; job = vnc_job_new(vs); width = MIN(pixman_image_get_width(vd->server), vs->client_width); height = MIN(pixman_image_get_height(vd->server), vs->client_height); for (y = 0; y < height; y++) { int x; int last_x = -1; for (x = 0; x < width / 16; x++) { if (test_and_clear_bit(x, vs->dirty[y])) { if (last_x == -1) { last_x = x; } } else { if (last_x != -1) { int h = find_and_clear_dirty_height(vs, y, last_x, x, height); n += vnc_job_add_rect(job, last_x * 16, y, (x - last_x) * 16, h); } last_x = -1; } } if (last_x != -1) { int h = find_and_clear_dirty_height(vs, y, last_x, x, height); n += vnc_job_add_rect(job, last_x * 16, y, (x - last_x) * 16, h); } } vnc_job_push(job); vs->force_update = 0; return n; } if (vs->csock == -1) vnc_disconnect_finish(vs); return 0; }
1threat
componentDidUpdate vs componentDidMount : <p>I need to make sure an input element is focused when the following is true:</p> <ul> <li>the DOM is available and </li> <li>properties got changed</li> </ul> <p>Question: Do I need to put my code in both <code>componentDidUpdate</code> and <code>componentDidMount</code> or just <code>componentDidUpdate</code> would be suffice?</p> <pre><code> private makeSureInputElementFocused() { if (this.props.shouldGetInputElementFocused &amp;&amp; this.inputElement !== null) { this.inputElement.focus(); } } componentDidMount() { this.makeSureInputElementFocused(); // &lt;-- do i need this? } componentDidUpdate() { this.makeSureInputElementFocused(); } </code></pre>
0debug
Iterate in RUN command in Dockerfile : <p>I have a line that looks something like: </p> <pre><code>RUN for i in `x y z`; do echo "$i"; done </code></pre> <p>...with the intention of printing each of the three items</p> <p>But it raises <code>/bin/sh: 1: x: not found</code></p> <p>Any idea what I'm doing wrong?</p>
0debug
filter one-to-many relationshipon : I'm using django-filter and I would like to ask you if it could filter one to many reliontionship because I did not found any doc or example even on StackOverflow., here are the model, the filter and the view class Aliens(models.Model): class Meta: db_table = 'aliens' verbose_name = ('Introduction Event') verbose_name_plural = ('Introuction Events') ordering = ['alien'] alien = models.OneToOneField(Taxonomy, verbose_name=u"Non-indigenous Species", on_delete=models.CASCADE, null=True, blank=True) #SpeciesName = models.CharField(max_length=100, verbose_name=u"Species Name", blank=True, null=True) group = models.OneToOneField(Ecofunctional, verbose_name=u"Ecofunctional Group", on_delete=models.CASCADE, blank=True, null=True, default='') firstsight = models.IntegerField(('First Mediterranean Sighting'), choices=YEAR_CHOICES, blank=True, null=True) med_citation = models.ForeignKey(biblio, verbose_name=u"Mediterranean first citation", on_delete=models.CASCADE, null=True, blank=True) origin = models.OneToOneField(Origin, on_delete=models.CASCADE, blank=True, null=True, default='', verbose_name=u"Origin") status = models.OneToOneField(SuccessType, on_delete=models.CASCADE, blank=True, null=True, default='', verbose_name=u"Establishement") created_by = CurrentUserField() created_at = models.DateField('date of inclusion', blank=True, null=True, default=datetime.datetime.now()) photo = models.ImageField(upload_to='photos', blank=True, null=True) vector = models.ManyToManyField(vectors, verbose_name=u"Vectors/Pathways") updated_at = models.DateField('date of updating', blank=True, null=True, default=datetime.datetime.now()) updated_by = models.ForeignKey(User, on_delete=models.CASCADE, related_name='%(class)s_requests_updated', default=CurrentUserField(), null=True) notes = models.TextField(verbose_name='Notes', blank=True, null=True) db_status = StateField(verbose_name='Species Status in the Db', blank=True, null=True) def __str__(self): # __unicode__ on Python 2 return self.alien.SpeciesName class Distributions(models.Model): class Meta: db_table = 'distributions' verbose_name = ('verified occurence') verbose_name_plural = ('verified occurences') alien = models.ForeignKey(Aliens, verbose_name=u"Non-Indeginous Species", related_name='distributions', on_delete=models.CASCADE, null=True, blank=True) country = models.OneToOneField(Country, on_delete=models.CASCADE, verbose_name='Country', blank=True, null=True) seas = models.OneToOneField(regionalseas, on_delete=models.CASCADE, verbose_name='Regional Sea', blank=True, null=True) MSFD = models.OneToOneField(MSFD, on_delete=models.CASCADE, verbose_name='MSFD/EcAp Sub-region', blank=True, null=True) area1stSighting = models.DateField('First Areas Sighting', blank=True, null=True, default=datetime.datetime.now()) AreaSuccessType = models.OneToOneField(SuccessType, on_delete=models.CASCADE, verbose_name='Area Establishement/Success', blank=True, null=True) Area_citation = models.ForeignKey(biblio, verbose_name=u"Area first citation", on_delete=models.CASCADE, null=True, blank=True) created_by = models.ForeignKey(User, on_delete=models.CASCADE, related_name='%(class)s_requests_created', default='') created_at = models.DateField('date of Edition', blank=True, null=True, default=datetime.datetime.now()) updated_by = models.ForeignKey(User, on_delete=models.CASCADE, related_name='%(class)s_requests_updated', default='') updated_at = models.DateField('date of updating', blank=True, null=True, default=datetime.datetime.now()) notes = models.TextField(verbose_name='Notes', blank=True, null=True) dverification = StateField(verbose_name='Validated ') def __str__(self): # __unicode__ on Python 2 return self.alien.SpeciesName class AliensFilter(django_filters.FilterSet): country = filters.ModelChoiceFilter(label='Country', queryset=Country.objects.all()) msfd = filters.ModelChoiceFilter(label='MSF/EcAp Subregions', queryset=MSFD.objects.all()) regseas = filters.ModelChoiceFilter(label='Regional Seas', queryset=regionalseas.objects.all()) vector = filters.ModelChoiceFilter(label='Vectors/Pathway', queryset=vectors.objects.all()) Species = filters.ModelChoiceFilter(label='Species Name', queryset=Taxonomy.objects.all()) class Meta: model = Aliens fields = ( 'Species', 'group', 'origin', 'firstsight', 'status', 'vector', 'country', 'msfd', 'regseas') def search(request): Aliens_list = Aliens.objects.all().select_related('origin', 'status', 'group', 'Taxonomy') aliens_filter = AliensFilter(request.GET, queryset=Aliens_list) # return render(request, 'mamias/list.html', {'filter': aliens_filter}) return render(request, 'mamias/list2.html', {'filter': aliens_filter}) how could I filter based on country for example thank you for your help
0debug
Insert data into mysql database in loop : <p>Im new to php and sql language and i got a question. I want to insert my data into the database while looping. So far, my code is like this.</p> <pre><code>for ($x = 0; $x &lt;= 10; $x++) { $sql="INSERT INTO exec (time, value) VALUES (now(), '34')"; } </code></pre> <p>However, when I execute this code, the data only insert into the database once and not 10 as I intended. I also want to add some delay around 10 seconds between each loop. Any help would be appreciated! </p>
0debug
why should case statement be within select statement? : why should CASE statement be within SELECT statement? ### Why does not the second code work? I mean, why should CASE statement be within SELECT statement? ### First SELECT report_code, year, month, day, wind_speed, CASE WHEN wind_speed >= 40 THEN 'HIGH' WHEN wind_speed >= 30 AND wind_speed < 40 THEN 'MODERATE' ELSE 'LOW' END AS wind_severity FROM station_data; ### Second SELECT report_code, year, month, day, wind_speed, ROM station_data CASE WHEN wind_speed >= 40 THEN 'HIGH' WHEN wind_speed >= 30 AND wind_speed < 40 THEN 'MODERATE' ELSE 'LOW' END AS wind_severity;
0debug
static void ram_init(target_phys_addr_t addr, ram_addr_t RAM_size, uint64_t max_mem) { DeviceState *dev; SysBusDevice *s; RamDevice *d; if ((uint64_t)RAM_size > max_mem) { fprintf(stderr, "qemu: Too much memory for this machine: %d, maximum %d\n", (unsigned int)(RAM_size / (1024 * 1024)), (unsigned int)(max_mem / (1024 * 1024))); exit(1); } dev = qdev_create(NULL, "memory"); s = sysbus_from_qdev(dev); d = FROM_SYSBUS(RamDevice, s); d->size = RAM_size; qdev_init(dev); sysbus_mmio_map(s, 0, addr); }
1threat
static void virgl_cmd_get_capset_info(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_get_capset_info info; struct virtio_gpu_resp_capset_info resp; VIRTIO_GPU_FILL_CMD(info); if (info.capset_index == 0) { resp.capset_id = VIRTIO_GPU_CAPSET_VIRGL; virgl_renderer_get_cap_set(resp.capset_id, &resp.capset_max_version, &resp.capset_max_size); } else { resp.capset_max_version = 0; resp.capset_max_size = 0; } resp.hdr.type = VIRTIO_GPU_RESP_OK_CAPSET_INFO; virtio_gpu_ctrl_response(g, cmd, &resp.hdr, sizeof(resp)); }
1threat
static void vc1_extract_headers(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t *buf, int buf_size) { VC1ParseContext *vpc = s->priv_data; GetBitContext gb; const uint8_t *start, *end, *next; uint8_t *buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); vpc->v.s.avctx = avctx; vpc->v.parse_only = 1; vpc->v.first_pic_header_flag = 1; next = buf; s->repeat_pict = 0; for(start = buf, end = buf + buf_size; next < end; start = next){ int buf2_size, size; next = find_next_marker(start + 4, end); size = next - start - 4; buf2_size = vc1_unescape_buffer(start + 4, size, buf2); init_get_bits(&gb, buf2, buf2_size * 8); if(size <= 0) continue; switch(AV_RB32(start)){ case VC1_CODE_SEQHDR: ff_vc1_decode_sequence_header(avctx, &vpc->v, &gb); break; case VC1_CODE_ENTRYPOINT: ff_vc1_decode_entry_point(avctx, &vpc->v, &gb); break; case VC1_CODE_FRAME: if(vpc->v.profile < PROFILE_ADVANCED) ff_vc1_parse_frame_header (&vpc->v, &gb); else ff_vc1_parse_frame_header_adv(&vpc->v, &gb); if (vpc->v.s.pict_type == AV_PICTURE_TYPE_BI) s->pict_type = AV_PICTURE_TYPE_B; else s->pict_type = vpc->v.s.pict_type; if (avctx->ticks_per_frame > 1){ s->repeat_pict = 1; if (vpc->v.rff){ s->repeat_pict = 2; }else if (vpc->v.rptfrm){ s->repeat_pict = vpc->v.rptfrm * 2 + 1; } } if (vpc->v.broadcast && vpc->v.interlace && !vpc->v.psf) s->field_order = vpc->v.tff ? AV_FIELD_TT : AV_FIELD_BB; else s->field_order = AV_FIELD_PROGRESSIVE; break; } } av_free(buf2); }
1threat
Instagram ?__a=1 not working anymore : <p>I've been using Instagram's undocumented API <code>https://www.instagram.com/&lt;user&gt;/?__a=1</code> to get a public user feed on a website. Since a while now, this is not working anymore, probably because Facebook removed it. Is there an other way to get the data of an instagram account in a easy way?</p>
0debug
static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, int mvn, int r_x, int r_y, uint8_t* is_intra, int dir) { MpegEncContext *s = &v->s; int xy, wrap, off = 0; int A[2], B[2], C[2]; int px = 0, py = 0; int a_valid = 0, b_valid = 0, c_valid = 0; int field_a, field_b, field_c; int total_valid, num_samefield, num_oppfield; int pos_c, pos_b, n_adj; wrap = s->b8_stride; xy = s->block_index[n]; if (s->mb_intra) { s->mv[0][n][0] = s->current_picture.motion_val[0][xy][0] = 0; s->mv[0][n][1] = s->current_picture.motion_val[0][xy][1] = 0; s->current_picture.motion_val[1][xy][0] = 0; s->current_picture.motion_val[1][xy][1] = 0; if (mvn == 1) { s->current_picture.motion_val[0][xy + 1][0] = 0; s->current_picture.motion_val[0][xy + 1][1] = 0; s->current_picture.motion_val[0][xy + wrap][0] = 0; s->current_picture.motion_val[0][xy + wrap][1] = 0; s->current_picture.motion_val[0][xy + wrap + 1][0] = 0; s->current_picture.motion_val[0][xy + wrap + 1][1] = 0; v->luma_mv[s->mb_x][0] = v->luma_mv[s->mb_x][1] = 0; s->current_picture.motion_val[1][xy + 1][0] = 0; s->current_picture.motion_val[1][xy + 1][1] = 0; s->current_picture.motion_val[1][xy + wrap][0] = 0; s->current_picture.motion_val[1][xy + wrap][1] = 0; s->current_picture.motion_val[1][xy + wrap + 1][0] = 0; s->current_picture.motion_val[1][xy + wrap + 1][1] = 0; } return; } off = ((n == 0) || (n == 1)) ? 1 : -1; if (s->mb_x || (n == 1) || (n == 3)) { if ((v->blk_mv_type[xy]) || (!v->blk_mv_type[xy] && !v->blk_mv_type[xy - 1])) { A[0] = s->current_picture.motion_val[dir][xy - 1][0]; A[1] = s->current_picture.motion_val[dir][xy - 1][1]; a_valid = 1; } else { A[0] = (s->current_picture.motion_val[dir][xy - 1][0] + s->current_picture.motion_val[dir][xy - 1 + off * wrap][0] + 1) >> 1; A[1] = (s->current_picture.motion_val[dir][xy - 1][1] + s->current_picture.motion_val[dir][xy - 1 + off * wrap][1] + 1) >> 1; a_valid = 1; } if (!(n & 1) && v->is_intra[s->mb_x - 1]) { a_valid = 0; A[0] = A[1] = 0; } } else A[0] = A[1] = 0; B[0] = B[1] = C[0] = C[1] = 0; if (n == 0 || n == 1 || v->blk_mv_type[xy]) { if (!s->first_slice_line) { if (!v->is_intra[s->mb_x - s->mb_stride]) { b_valid = 1; n_adj = n | 2; pos_b = s->block_index[n_adj] - 2 * wrap; if (v->blk_mv_type[pos_b] && v->blk_mv_type[xy]) { n_adj = (n & 2) | (n & 1); } B[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap][0]; B[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap][1]; if (v->blk_mv_type[pos_b] && !v->blk_mv_type[xy]) { B[0] = (B[0] + s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap][0] + 1) >> 1; B[1] = (B[1] + s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap][1] + 1) >> 1; } } if (s->mb_width > 1) { if (!v->is_intra[s->mb_x - s->mb_stride + 1]) { c_valid = 1; n_adj = 2; pos_c = s->block_index[2] - 2 * wrap + 2; if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { n_adj = n & 2; } C[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap + 2][0]; C[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap + 2][1]; if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { C[0] = (1 + C[0] + (s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap + 2][0])) >> 1; C[1] = (1 + C[1] + (s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap + 2][1])) >> 1; } if (s->mb_x == s->mb_width - 1) { if (!v->is_intra[s->mb_x - s->mb_stride - 1]) { c_valid = 1; n_adj = 3; pos_c = s->block_index[3] - 2 * wrap - 2; if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { n_adj = n | 1; } C[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap - 2][0]; C[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap - 2][1]; if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { C[0] = (1 + C[0] + s->current_picture.motion_val[dir][s->block_index[1] - 2 * wrap - 2][0]) >> 1; C[1] = (1 + C[1] + s->current_picture.motion_val[dir][s->block_index[1] - 2 * wrap - 2][1]) >> 1; } } else c_valid = 0; } } } } } else { pos_b = s->block_index[1]; b_valid = 1; B[0] = s->current_picture.motion_val[dir][pos_b][0]; B[1] = s->current_picture.motion_val[dir][pos_b][1]; pos_c = s->block_index[0]; c_valid = 1; C[0] = s->current_picture.motion_val[dir][pos_c][0]; C[1] = s->current_picture.motion_val[dir][pos_c][1]; } total_valid = a_valid + b_valid + c_valid; if (!s->mb_x && !(n == 1 || n == 3)) { A[0] = A[1] = 0; } if ((s->first_slice_line && v->blk_mv_type[xy]) || (s->first_slice_line && !(n & 2))) { B[0] = B[1] = C[0] = C[1] = 0; } if (!v->blk_mv_type[xy]) { if (s->mb_width == 1) { px = B[0]; py = B[1]; } else { if (total_valid >= 2) { px = mid_pred(A[0], B[0], C[0]); py = mid_pred(A[1], B[1], C[1]); } else if (total_valid) { if (a_valid) { px = A[0]; py = A[1]; } else if (b_valid) { px = B[0]; py = B[1]; } else if (c_valid) { px = C[0]; py = C[1]; } else av_assert2(0); } } } else { if (a_valid) field_a = (A[1] & 4) ? 1 : 0; else field_a = 0; if (b_valid) field_b = (B[1] & 4) ? 1 : 0; else field_b = 0; if (c_valid) field_c = (C[1] & 4) ? 1 : 0; else field_c = 0; num_oppfield = field_a + field_b + field_c; num_samefield = total_valid - num_oppfield; if (total_valid == 3) { if ((num_samefield == 3) || (num_oppfield == 3)) { px = mid_pred(A[0], B[0], C[0]); py = mid_pred(A[1], B[1], C[1]); } else if (num_samefield >= num_oppfield) { px = !field_a ? A[0] : B[0]; py = !field_a ? A[1] : B[1]; } else { px = field_a ? A[0] : B[0]; py = field_a ? A[1] : B[1]; } } else if (total_valid == 2) { if (num_samefield >= num_oppfield) { if (!field_a && a_valid) { px = A[0]; py = A[1]; } else if (!field_b && b_valid) { px = B[0]; py = B[1]; } else if (c_valid) { px = C[0]; py = C[1]; } else px = py = 0; } else { if (field_a && a_valid) { px = A[0]; py = A[1]; } else if (field_b && b_valid) { px = B[0]; py = B[1]; } else if (c_valid) { px = C[0]; py = C[1]; } } } else if (total_valid == 1) { px = (a_valid) ? A[0] : ((b_valid) ? B[0] : C[0]); py = (a_valid) ? A[1] : ((b_valid) ? B[1] : C[1]); } } s->mv[dir][n][0] = s->current_picture.motion_val[dir][xy][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x; s->mv[dir][n][1] = s->current_picture.motion_val[dir][xy][1] = ((py + dmv_y + r_y) & ((r_y << 1) - 1)) - r_y; if (mvn == 1) { s->current_picture.motion_val[dir][xy + 1 ][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + 1 ][1] = s->current_picture.motion_val[dir][xy][1]; s->current_picture.motion_val[dir][xy + wrap ][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + wrap ][1] = s->current_picture.motion_val[dir][xy][1]; s->current_picture.motion_val[dir][xy + wrap + 1][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + wrap + 1][1] = s->current_picture.motion_val[dir][xy][1]; } else if (mvn == 2) { s->current_picture.motion_val[dir][xy + 1][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + 1][1] = s->current_picture.motion_val[dir][xy][1]; s->mv[dir][n + 1][0] = s->mv[dir][n][0]; s->mv[dir][n + 1][1] = s->mv[dir][n][1]; } }
1threat
What is the correct way to create an already-completed CompletableFuture<Void> : <p>I am using Completable futures in java 8 and I want to write a method that, based on a received parameter, either runs multiple tasks with side effects in parallel and then return their "combined" future (using <code>CompletableFuture.allOf()</code>), or does nothing and returns an already-completed future.</p> <p>However, <code>allOf</code> returns a <code>CompletableFuture&lt;Void&gt;</code>:</p> <pre><code>public static CompletableFuture&lt;Void&gt; allOf(CompletableFuture&lt;?&gt;... cfs) </code></pre> <p>And the only way to create an already-completed future that know is using <code>completedFuture()</code>, which expects a value:</p> <pre><code>public static &lt;U&gt; CompletableFuture&lt;U&gt; completedFuture(U value) </code></pre> <blockquote> <p>Returns a new CompletableFuture that is already completed with the given value.</p> </blockquote> <p>and <code>Void</code> is uninstantiable, so I need another way to create an already-completed future of type <code>CompletableFuture&lt;Void&gt;</code>.</p> <p>What is the best way to do this?</p>
0debug
I'm getting error "Exception has been thrown by the target of an invocation." : <p>I'm learning c# at one site,and i came to this task: our program should read two integers each from the new line. Then, it should output the sum, difference, product and quotient of these numbers. If the second number is zero, it should answer "Can't divide by zero!" instead of the quotient. Example 1:</p> <blockquote> <p>12 4 16 8 48 3</p> </blockquote> <p>Example 2:</p> <blockquote> <p>12 0 12 12 0 Can't divide by zero!</p> </blockquote> <p>and this is my code:</p> <pre><code> int num1 = int.Parse(Console.ReadLine()); int num2 = int.Parse(Console.ReadLine()); int sum = num1 + num2; int diff = num1 - num2; int product = num1 * num2; int quo = num1 / num2; Console.WriteLine($"{sum}"); Console.WriteLine($"{diff}"); Console.WriteLine($"{product}"); if (num2 == 0) { Console.WriteLine("Can't divide by zero!"); } else { Console.WriteLine($"{quo}"); } </code></pre> <p>When second digit isnt 0,it works perfectly,but when it is,I get error "Exception has been thrown by the target of an invocation."</p>
0debug
I would like to have VB code in excel. If cell "A1:A200 is blank then concananet cells B1:C1 : <p>I would like to have VB code in excel. If cell "A1:A200 is blank then concananet cells B1:C1. <a href="https://i.stack.imgur.com/PI0DC.jpg" rel="nofollow noreferrer">enter image description here</a></p>
0debug
Efficient (and well explained) implementation of a Quadtree for 2D collision detection : <p>I've been working on adding a Quadtree to a program that I'm writing, and I can't help but notice that there are few well explained/performing tutorials for the implementation that I'm looking for.</p> <p>Specifically, a list of the methods and pseudocode for how to implement them (or just a description of their processes) that are commonly used in a Quadtree (retrieve, insert, remove, etc.) is what I'm looking for, along with maybe some tips to improve performance. This is for collision detection, so it'd be best to be explained with 2d rectangles in mind, as they are the objects that will be stored.</p>
0debug
How to clone abstract objects with final fields in Java? : <p>In <a href="https://stackoverflow.com/questions/7378843/cloning-in-java">this</a> question and this <a href="http://www.agiledeveloper.com/articles/cloning072002.htm" rel="noreferrer">post</a> is explained how to clone objects with final fields by using protected copy constructors.</p> <p>However, supposing that we have:</p> <pre><code>public abstract class Person implements Cloneable { private final Brain brain; // brain is final since I do not want // any transplant on it once created! private int age; public Person(Brain aBrain, int theAge) { brain = aBrain; age = theAge; } protected Person(Person another) { Brain refBrain = null; try { refBrain = (Brain) another.brain.clone(); // You can set the brain in the constructor } catch(CloneNotSupportedException e) {} brain = refBrain; age = another.age; } public String toString() { return "This is person with " + brain; // Not meant to sound rude as it reads! } public Object clone() { return new Person(this); } public abstract void Think(); //!!!! … } </code></pre> <p>Returns an error since we can't instantiate an abstract class. How can we solve this?</p>
0debug
how target a specific custom html tag with jQuerry script : i have trouble, i am trying to use a Jquerry script to hide something and make apear a form in a table. <script> $(document).ready(function(){ $(".hide").click(function(){ $("p").hide(100); $("z").show(100); }); $(".show").click(function(){ $("p").show(100); $("z").hide(100); }); }); </script> but right now i hide or make apear everything on my custome tag. how could i make this script to only target an ID that i could give to those tag. <table class="table table-bordered"> <th>début vacance</th> <th>fin vacance</th> <th>supprimer vacances</th> <tr th:each="vacations : ${selectedUser.getVacations()}"> <td th:utext="${vacations.getStartVacation()} ">...</td> <td th:utext="${vacations.getEndVacation()} + ${vacations.id}">...</td> <td> <p th:text="${vacation.fistname}">...</p> <z th:text="${vacations.id}">...</z> <button class="hide">Hide</button> <button class="show">Show</button> </td> </tables>
0debug
Solve Sudoku using Back tracking Algorithm in C : <p>I had a feel to solve sudoku using C programming in early October, and soon I came to know its no easy task. Currently, I did write a code to do all the functioning but there seems to be an error somewhere which is preventing the desired result to get printed or even get evaluated. </p> <p>I use the algorithm provided <a href="https://en.wikipedia.org/wiki/Sudoku_solving_algorithms" rel="nofollow noreferrer">here</a> as a reference to develop my code, </p> <p>This is the code which I have written and correcting the error would be greatly appreciated</p> <pre><code>#include &lt;stdio.h&gt; int row(int i,int j,int a[9][9]); int column(int i,int j,int a[9][9]); //function declaration's int grid(int i,int j,int a[9][9]); int main() { int a[9][9]; int i,j,x; for (i=0;i&lt;9;i++) { for(j=0;j&lt;9;j++) { a[i][j]=0;/*for making all the array values = 0*/ /*So that the stored garbage values will be removed*/ } } /*Entering known elements*/ printf("Enter the elements of known elements leaving the unknown as 0\n"); for (i=0;i&lt;9;i++) { for(j=0;j&lt;9;j++) { scanf("%d",&amp;a[i][j]); } } //If a given grid is '0', lets assign a value 1 and if 1 exists in the same row or column or in ints correspond 3x3 box, increment the value upto 9 i=0,j=0,x=1; incr: if ( a[i][j] == 0) { a[i][j] = x; if( row(i,j,a) &amp;&amp; column(i,j,a) &amp;&amp; grid(i,j,a) ) { a[i][j] = x; } else { x++; if ( x&gt;9) x = 1; } } else { while(i &lt; 9) { i++; goto incr; } if (i == 9) { i =1; j++; goto incr; } if (j == 9) { for(i=0;i&lt;9;i++) { for(j=0;j&lt;9;j++) { printf("%d ",a[i][j]); } printf("\n"); } } } } int row(int i,int j,int a[9][9]) { int m; for(m=0;m&lt;9;m++) { if( m != j) { if(a[i][j] == a[i][m]) { return 0; } } } return 1; } int column(int i,int j, int a[9][9]) { int m; printf("%d%d",i,j); for(m=0;m&lt;9;m++) { if ( m != i) { if(a[i][j] == a[m][j]) { return 0; } } } return 1; } int grid(int i,int j, int a[9][9]) { int m,n; if( i&gt;=0 &amp;&amp; i&lt;=2 &amp;&amp; j&gt;=0 &amp;&amp; j&lt;=2) /* grid 1*/ { for(m=0;m&lt;=2;m++) { for(n=0;n&lt;=2;n++) { if(i != m &amp;&amp; j != n) { if(a[i][j] == a[m][n]) { return 0; } } } } return 1; } if( i&gt;=0 &amp;&amp; i&lt;=2 &amp;&amp; j&gt;=3 &amp;&amp; j&lt;=5) /* grid 2*/ { for(m=0;m&lt;=2;m++) { for(n=3;n&lt;=5;n++) { if(i != m &amp;&amp; j != n) { if(a[i][j] == a[m][n]) { return 0; } } } } return 1; } if( i&gt;=0 &amp;&amp; i&lt;=2 &amp;&amp; j&gt;=6 &amp;&amp; j&lt;=8) /* grid 3*/ { for(m=0;m&lt;=2;m++) { for(n=6;n&lt;=8;n++) { if(i != m &amp;&amp; j != n) { if(a[i][j] == a[m][n]) { return 0; } } } } return 1; } if( i&gt;=3 &amp;&amp; i&lt;=5 &amp;&amp; j&gt;=0 &amp;&amp; j&lt;=2) /* grid 4*/ { for(m=3;m&lt;=5;m++) { for(n=0;n&lt;=2;n++) { if(i != m &amp;&amp; j != n) { if(a[i][j] == a[m][n]) { return 0; } } } } return 1; } if( i&gt;=3 &amp;&amp; i&lt;=5 &amp;&amp; j&gt;=3 &amp;&amp; j&lt;=5) /* grid 5*/ { for(m=3;m&lt;=5;m++) { for(n=3;n&lt;=5;n++) { if(i != m &amp;&amp; j != n) { if(a[i][j] == a[m][n]) { return 0; } } } } return 1; } if( i&gt;=3 &amp;&amp; i&lt;=5 &amp;&amp; j&gt;=6 &amp;&amp; j&lt;=8) /* grid 6*/ { for(m=3;m&lt;=5;m++) { for(n=6;n&lt;=8;n++) { if(i != m &amp;&amp; j != n) { if(a[i][j] == a[m][n]) { return 0; } } } } return 1; } if( i&gt;=6 &amp;&amp; i&lt;=8 &amp;&amp; j&gt;=0 &amp;&amp; j&lt;=2) /* grid 7*/ { for(m=6;m&lt;=8;m++) { for(n=0;n&lt;=2;n++) { if(i != m &amp;&amp; j != n) { if(a[i][j] == a[m][n]) { return 0; } } } } return 1; } if( i&gt;=6 &amp;&amp; i&lt;=8 &amp;&amp; j&gt;=3 &amp;&amp; j&lt;=5) /* grid 8*/ { for(m=6;m&lt;=8;m++) { for(n=3;n&lt;=5;n++) { if(i != m &amp;&amp; j != n) { if(a[i][j] == a[m][n]) { return 0; } } } } return 1; } if( i&gt;=6 &amp;&amp; i&lt;=8 &amp;&amp; j&gt;=6 &amp;&amp; j&lt;=8) /* grid 9*/ { for(m=6;m&lt;=8;m++) { for(n=6;n&lt;=8;n++) { if(i != m &amp;&amp; j != n) { if(a[i][j] == a[m][n]) { return 0; } } } } return 1; } return 0; } </code></pre>
0debug
Some array elements do not engage in newly chunked, different string length element array : I am trying to convert a string array into new string array, changing the word count of each elements by appending sibling items accordingly. But the problem I am having is some part of previous array is not converting as required. **Here is my code so far :** ``` $text_array = ['He needs to cultivate in order', 'to be at the fourth level of the', 'Martial Body Stage. Does he have inner energy?"', 'Everyone jeered, laughed, and taunted.', 'Qin Yun turned deaf ear to their taunts.', 'His eyes were filled with sincerity as he', 'looked at Yang Shiyue and said, "Teacher,', 'I only formed my elemental energy this morning.', 'I still not familiar with the control of', 'my elemental energy and inner energy."', 'After the empress heard the jeers from the', 'crowd, she let out a sigh of relief and', 'sneered, "This is only a little bit of', 'inner Qi that you forced out.', 'You have not yet stepped', 'into the fourth level', 'of the Martial Body realm and have no', 'chance of breaking through. embarrass yourself!']; $last_converted_index = 0; $new_string_array = []; $single_valid_length_string = ''; foreach (array_slice($text_array, $last_converted_index) as $item) { if (str_word_count($single_valid_length_string . $item) < 30) { $single_valid_length_string .= $item . ' '; $last_converted_index++; } else { $new_string_array[] = $single_valid_length_string."<br><br>"; $single_valid_length_string = ''; } } echo implode($new_string_array); ``` Any help would be appreciable.
0debug
C# -> RaiseEvent in VB.Net : <p>I am having fun with TweetInvi in VB.Net, unfornately I have issue with converting this code to VB.Net. I am still beginner and I was trying to get some information about RaiseEvent, but I couldn't do it. Here is code. I want to run this in button event:</p> <pre><code>var stream = Stream.CreateFilteredStream(); stream.AddTrack("tweetinvi"); stream.MatchingTweetReceived += (sender, args) =&gt; { Console.WriteLine("A tweet containing 'tweetinvi' has been found; the tweet is '" + args.Tweet + "'"); }; stream.StartStreamMatchingAllConditions(); </code></pre> <p>Thanks.</p>
0debug
PySpark replace null in column with value in other column : <p>I want to replace null values in one column with the values in an adjacent column ,for example if i have</p> <pre><code>A|B 0,1 2,null 3,null 4,2 </code></pre> <p>I want it to be:</p> <pre><code>A|B 0,1 2,2 3,3 4,2 </code></pre> <p>Tried with</p> <pre><code>df.na.fill(df.A,"B") </code></pre> <p>But didnt work, it says value should be a float, int, long, string, or dict</p> <p>Any ideas?</p>
0debug
BeginnerQ: import own textures easily..? : I just started with c# and unity (been a VBA and Java Developer) and have a simple question. When i draw a background, a character or something else in 2d in gimp with my wacom.. is it possible to easily import those in unity and use them there for a 2d platformer? Thanks! (Sorry for bas English, no native speaker)
0debug
How to create a popup window in XCode Swift? : I have an iOS info app. The main screen of the app consists of rows of icons. I want that after tap on certain icon card with information appears and background blurs. To close the card I need to swipe up or down. It is very similar to Instagram's imageviewer. Please help me create that. P.S. This is my first project so please keep this in mind when you going to describe the method. Thank you. [It should look like this][1] [1]: http://i.stack.imgur.com/P3UJv.jpg
0debug
int main(int argc, char *argv[]) { const char *sparc_machines[] = { "SPARCbook", "Voyager", "SS-20", NULL }; const char *sparc64_machines[] = { "sun4u", "sun4v", NULL }; const char *mac_machines[] = { "mac99", "g3beige", NULL }; const char *arch = qtest_get_arch(); g_test_init(&argc, &argv, NULL); if (!strcmp(arch, "ppc") || !strcmp(arch, "ppc64")) { add_tests(mac_machines); } else if (!strcmp(arch, "sparc")) { add_tests(sparc_machines); } else if (!strcmp(arch, "sparc64")) { add_tests(sparc64_machines); } else { g_assert_not_reached(); } return g_test_run(); }
1threat
Can you index an array with a binary number in C? : <p>I was wondering if it is possible to index an array by using a binary number instead of a decimal number. For instance, arr[binary].</p>
0debug
When do I use .val() vs .innerHTML? : <p>In JQuery when trying to access elements, I see that if I have a form (lets say a <code>textarea</code>), and I want to get the <code>text</code> inside of it, I must use <code>$("textarea").val();</code></p> <p>Instead if I have a <code>h1</code> element, I must use <code>$("h")[0].innerHTML;</code></p> <p>Why is this the case? <code>h1.val()/textarea.innerHTML do not work</code></p>
0debug
static void *spapr_create_fdt_skel(hwaddr initrd_base, hwaddr initrd_size, hwaddr kernel_size, bool little_endian, const char *boot_device, const char *kernel_cmdline, uint32_t epow_irq) { void *fdt; CPUState *cs; uint32_t start_prop = cpu_to_be32(initrd_base); uint32_t end_prop = cpu_to_be32(initrd_base + initrd_size); GString *hypertas = g_string_sized_new(256); GString *qemu_hypertas = g_string_sized_new(256); uint32_t refpoints[] = {cpu_to_be32(0x4), cpu_to_be32(0x4)}; uint32_t interrupt_server_ranges_prop[] = {0, cpu_to_be32(smp_cpus)}; int smt = kvmppc_smt_threads(); unsigned char vec5[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x80}; QemuOpts *opts = qemu_opts_find(qemu_find_opts("smp-opts"), NULL); unsigned sockets = opts ? qemu_opt_get_number(opts, "sockets", 0) : 0; uint32_t cpus_per_socket = sockets ? (smp_cpus / sockets) : 1; add_str(hypertas, "hcall-pft"); add_str(hypertas, "hcall-term"); add_str(hypertas, "hcall-dabr"); add_str(hypertas, "hcall-interrupt"); add_str(hypertas, "hcall-tce"); add_str(hypertas, "hcall-vio"); add_str(hypertas, "hcall-splpar"); add_str(hypertas, "hcall-bulk"); add_str(hypertas, "hcall-set-mode"); add_str(qemu_hypertas, "hcall-memop1"); fdt = g_malloc0(FDT_MAX_SIZE); _FDT((fdt_create(fdt, FDT_MAX_SIZE))); if (kernel_size) { _FDT((fdt_add_reservemap_entry(fdt, KERNEL_LOAD_ADDR, kernel_size))); } if (initrd_size) { _FDT((fdt_add_reservemap_entry(fdt, initrd_base, initrd_size))); } _FDT((fdt_finish_reservemap(fdt))); _FDT((fdt_begin_node(fdt, ""))); _FDT((fdt_property_string(fdt, "device_type", "chrp"))); _FDT((fdt_property_string(fdt, "model", "IBM pSeries (emulated by qemu)"))); _FDT((fdt_property_string(fdt, "compatible", "qemu,pseries"))); _FDT((fdt_property_cell(fdt, "#address-cells", 0x2))); _FDT((fdt_property_cell(fdt, "#size-cells", 0x2))); _FDT((fdt_begin_node(fdt, "chosen"))); _FDT((fdt_property(fdt, "ibm,architecture-vec-5", vec5, sizeof(vec5)))); _FDT((fdt_property_string(fdt, "bootargs", kernel_cmdline))); _FDT((fdt_property(fdt, "linux,initrd-start", &start_prop, sizeof(start_prop)))); _FDT((fdt_property(fdt, "linux,initrd-end", &end_prop, sizeof(end_prop)))); if (kernel_size) { uint64_t kprop[2] = { cpu_to_be64(KERNEL_LOAD_ADDR), cpu_to_be64(kernel_size) }; _FDT((fdt_property(fdt, "qemu,boot-kernel", &kprop, sizeof(kprop)))); if (little_endian) { _FDT((fdt_property(fdt, "qemu,boot-kernel-le", NULL, 0))); } } if (boot_device) { _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device))); } if (boot_menu) { _FDT((fdt_property_cell(fdt, "qemu,boot-menu", boot_menu))); } _FDT((fdt_property_cell(fdt, "qemu,graphic-width", graphic_width))); _FDT((fdt_property_cell(fdt, "qemu,graphic-height", graphic_height))); _FDT((fdt_property_cell(fdt, "qemu,graphic-depth", graphic_depth))); _FDT((fdt_end_node(fdt))); _FDT((fdt_begin_node(fdt, "cpus"))); _FDT((fdt_property_cell(fdt, "#address-cells", 0x1))); _FDT((fdt_property_cell(fdt, "#size-cells", 0x0))); CPU_FOREACH(cs) { PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; DeviceClass *dc = DEVICE_GET_CLASS(cs); PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cs); int index = ppc_get_vcpu_dt_id(cpu); char *nodename; uint32_t segs[] = {cpu_to_be32(28), cpu_to_be32(40), 0xffffffff, 0xffffffff}; uint32_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TIMEBASE_FREQ; uint32_t cpufreq = kvm_enabled() ? kvmppc_get_clockfreq() : 1000000000; uint32_t page_sizes_prop[64]; size_t page_sizes_prop_size; if ((index % smt) != 0) { continue; } nodename = g_strdup_printf("%s@%x", dc->fw_name, index); _FDT((fdt_begin_node(fdt, nodename))); g_free(nodename); _FDT((fdt_property_cell(fdt, "reg", index))); _FDT((fdt_property_string(fdt, "device_type", "cpu"))); _FDT((fdt_property_cell(fdt, "cpu-version", env->spr[SPR_PVR]))); _FDT((fdt_property_cell(fdt, "d-cache-block-size", env->dcache_line_size))); _FDT((fdt_property_cell(fdt, "d-cache-line-size", env->dcache_line_size))); _FDT((fdt_property_cell(fdt, "i-cache-block-size", env->icache_line_size))); _FDT((fdt_property_cell(fdt, "i-cache-line-size", env->icache_line_size))); if (pcc->l1_dcache_size) { _FDT((fdt_property_cell(fdt, "d-cache-size", pcc->l1_dcache_size))); } else { fprintf(stderr, "Warning: Unknown L1 dcache size for cpu\n"); } if (pcc->l1_icache_size) { _FDT((fdt_property_cell(fdt, "i-cache-size", pcc->l1_icache_size))); } else { fprintf(stderr, "Warning: Unknown L1 icache size for cpu\n"); } _FDT((fdt_property_cell(fdt, "timebase-frequency", tbfreq))); _FDT((fdt_property_cell(fdt, "clock-frequency", cpufreq))); _FDT((fdt_property_cell(fdt, "ibm,slb-size", env->slb_nr))); _FDT((fdt_property_string(fdt, "status", "okay"))); _FDT((fdt_property(fdt, "64-bit", NULL, 0))); if (env->spr_cb[SPR_PURR].oea_read) { _FDT((fdt_property(fdt, "ibm,purr", NULL, 0))); } if (env->mmu_model & POWERPC_MMU_1TSEG) { _FDT((fdt_property(fdt, "ibm,processor-segment-sizes", segs, sizeof(segs)))); } if (env->insns_flags & PPC_ALTIVEC) { uint32_t vmx = (env->insns_flags2 & PPC2_VSX) ? 2 : 1; _FDT((fdt_property_cell(fdt, "ibm,vmx", vmx))); } if (env->insns_flags2 & PPC2_DFP) { _FDT((fdt_property_cell(fdt, "ibm,dfp", 1))); } page_sizes_prop_size = create_page_sizes_prop(env, page_sizes_prop, sizeof(page_sizes_prop)); if (page_sizes_prop_size) { _FDT((fdt_property(fdt, "ibm,segment-page-sizes", page_sizes_prop, page_sizes_prop_size))); } _FDT((fdt_property_cell(fdt, "ibm,chip-id", cs->cpu_index / cpus_per_socket))); _FDT((fdt_end_node(fdt))); } _FDT((fdt_end_node(fdt))); _FDT((fdt_begin_node(fdt, "rtas"))); if (!kvm_enabled() || kvmppc_spapr_use_multitce()) { add_str(hypertas, "hcall-multi-tce"); } _FDT((fdt_property(fdt, "ibm,hypertas-functions", hypertas->str, hypertas->len))); g_string_free(hypertas, TRUE); _FDT((fdt_property(fdt, "qemu,hypertas-functions", qemu_hypertas->str, qemu_hypertas->len))); g_string_free(qemu_hypertas, TRUE); _FDT((fdt_property(fdt, "ibm,associativity-reference-points", refpoints, sizeof(refpoints)))); _FDT((fdt_property_cell(fdt, "rtas-error-log-max", RTAS_ERROR_LOG_MAX))); _FDT((fdt_end_node(fdt))); _FDT((fdt_begin_node(fdt, "interrupt-controller"))); _FDT((fdt_property_string(fdt, "device_type", "PowerPC-External-Interrupt-Presentation"))); _FDT((fdt_property_string(fdt, "compatible", "IBM,ppc-xicp"))); _FDT((fdt_property(fdt, "interrupt-controller", NULL, 0))); _FDT((fdt_property(fdt, "ibm,interrupt-server-ranges", interrupt_server_ranges_prop, sizeof(interrupt_server_ranges_prop)))); _FDT((fdt_property_cell(fdt, "#interrupt-cells", 2))); _FDT((fdt_property_cell(fdt, "linux,phandle", PHANDLE_XICP))); _FDT((fdt_property_cell(fdt, "phandle", PHANDLE_XICP))); _FDT((fdt_end_node(fdt))); _FDT((fdt_begin_node(fdt, "vdevice"))); _FDT((fdt_property_string(fdt, "device_type", "vdevice"))); _FDT((fdt_property_string(fdt, "compatible", "IBM,vdevice"))); _FDT((fdt_property_cell(fdt, "#address-cells", 0x1))); _FDT((fdt_property_cell(fdt, "#size-cells", 0x0))); _FDT((fdt_property_cell(fdt, "#interrupt-cells", 0x2))); _FDT((fdt_property(fdt, "interrupt-controller", NULL, 0))); _FDT((fdt_end_node(fdt))); spapr_events_fdt_skel(fdt, epow_irq); if (kvm_enabled()) { uint8_t hypercall[16]; _FDT((fdt_begin_node(fdt, "hypervisor"))); _FDT((fdt_property_string(fdt, "compatible", "linux,kvm"))); if (kvmppc_has_cap_fixup_hcalls()) { * Older KVM versions with older guest kernels were broken with the * magic page, don't allow the guest to map it. kvmppc_get_hypercall(first_cpu->env_ptr, hypercall, sizeof(hypercall)); _FDT((fdt_property(fdt, "hcall-instructions", hypercall, sizeof(hypercall)))); } _FDT((fdt_end_node(fdt))); } _FDT((fdt_end_node(fdt))); _FDT((fdt_finish(fdt))); return fdt; }
1threat
static int lag_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; LagarithContext *l = avctx->priv_data; AVFrame *const p = &l->picture; uint8_t frametype = 0; uint32_t offset_gu = 0, offset_bv = 0, offset_ry = 9; uint32_t offs[4]; uint8_t *srcs[4], *dst; int i, j, planes = 3; AVFrame *picture = data; if (p->data[0]) avctx->release_buffer(avctx, p); p->reference = 0; p->key_frame = 1; frametype = buf[0]; offset_gu = AV_RL32(buf + 1); offset_bv = AV_RL32(buf + 5); switch (frametype) { case FRAME_SOLID_RGBA: avctx->pix_fmt = PIX_FMT_RGB32; if (avctx->get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } dst = p->data[0]; for (j = 0; j < avctx->height; j++) { for (i = 0; i < avctx->width; i++) AV_WN32(dst + i * 4, offset_gu); dst += p->linesize[0]; } break; case FRAME_ARITH_RGBA: avctx->pix_fmt = PIX_FMT_RGB32; planes = 4; offset_ry += 4; offs[3] = AV_RL32(buf + 9); case FRAME_ARITH_RGB24: case FRAME_U_RGB24: if (frametype == FRAME_ARITH_RGB24 || frametype == FRAME_U_RGB24) avctx->pix_fmt = PIX_FMT_RGB24; if (avctx->get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } offs[0] = offset_bv; offs[1] = offset_gu; offs[2] = offset_ry; if (!l->rgb_planes) { l->rgb_stride = FFALIGN(avctx->width, 16); l->rgb_planes = av_malloc(l->rgb_stride * avctx->height * planes); if (!l->rgb_planes) { av_log(avctx, AV_LOG_ERROR, "cannot allocate temporary buffer\n"); return AVERROR(ENOMEM); } } for (i = 0; i < planes; i++) srcs[i] = l->rgb_planes + (i + 1) * l->rgb_stride * avctx->height - l->rgb_stride; if (offset_ry >= buf_size || offset_gu >= buf_size || offset_bv >= buf_size || (planes == 4 && offs[3] >= buf_size)) { av_log(avctx, AV_LOG_ERROR, "Invalid frame offsets\n"); return AVERROR_INVALIDDATA; } for (i = 0; i < planes; i++) lag_decode_arith_plane(l, srcs[i], avctx->width, avctx->height, -l->rgb_stride, buf + offs[i], buf_size - offs[i]); dst = p->data[0]; for (i = 0; i < planes; i++) srcs[i] = l->rgb_planes + i * l->rgb_stride * avctx->height; for (j = 0; j < avctx->height; j++) { for (i = 0; i < avctx->width; i++) { uint8_t r, g, b, a; r = srcs[0][i]; g = srcs[1][i]; b = srcs[2][i]; r += g; b += g; if (frametype == FRAME_ARITH_RGBA) { a = srcs[3][i]; AV_WN32(dst + i * 4, MKBETAG(a, r, g, b)); } else { dst[i * 3 + 0] = r; dst[i * 3 + 1] = g; dst[i * 3 + 2] = b; } } dst += p->linesize[0]; for (i = 0; i < planes; i++) srcs[i] += l->rgb_stride; } break; case FRAME_ARITH_YUY2: avctx->pix_fmt = PIX_FMT_YUV422P; if (avctx->get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } if (offset_ry >= buf_size || offset_gu >= buf_size || offset_bv >= buf_size) { av_log(avctx, AV_LOG_ERROR, "Invalid frame offsets\n"); return AVERROR_INVALIDDATA; } lag_decode_arith_plane(l, p->data[0], avctx->width, avctx->height, p->linesize[0], buf + offset_ry, buf_size - offset_ry); lag_decode_arith_plane(l, p->data[2], avctx->width / 2, avctx->height, p->linesize[2], buf + offset_gu, buf_size - offset_gu); lag_decode_arith_plane(l, p->data[1], avctx->width / 2, avctx->height, p->linesize[1], buf + offset_bv, buf_size - offset_bv); break; case FRAME_ARITH_YV12: avctx->pix_fmt = PIX_FMT_YUV420P; if (avctx->get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } if (offset_ry >= buf_size || offset_gu >= buf_size || offset_bv >= buf_size) { av_log(avctx, AV_LOG_ERROR, "Invalid frame offsets\n"); return AVERROR_INVALIDDATA; } lag_decode_arith_plane(l, p->data[0], avctx->width, avctx->height, p->linesize[0], buf + offset_ry, buf_size - offset_ry); lag_decode_arith_plane(l, p->data[2], avctx->width / 2, avctx->height / 2, p->linesize[2], buf + offset_gu, buf_size - offset_gu); lag_decode_arith_plane(l, p->data[1], avctx->width / 2, avctx->height / 2, p->linesize[1], buf + offset_bv, buf_size - offset_bv); break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported Lagarith frame type: %#x\n", frametype); return -1; } *picture = *p; *data_size = sizeof(AVFrame); return buf_size; }
1threat
static void test_flush(void) { AHCIQState *ahci; ahci = ahci_boot_and_enable(); ahci_test_flush(ahci); ahci_shutdown(ahci); }
1threat
static int qcow_create(const char *filename, QemuOpts *opts, Error **errp) { int header_size, backing_filename_len, l1_size, shift, i; QCowHeader header; uint8_t *tmp; int64_t total_size = 0; char *backing_file = NULL; Error *local_err = NULL; int ret; BlockBackend *qcow_blk; const char *encryptfmt = NULL; QDict *options; QDict *encryptopts = NULL; QCryptoBlockCreateOptions *crypto_opts = NULL; QCryptoBlock *crypto = NULL; total_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0), BDRV_SECTOR_SIZE); if (total_size == 0) { error_setg(errp, "Image size is too small, cannot be zero length"); ret = -EINVAL; goto cleanup; } backing_file = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FILE); encryptfmt = qemu_opt_get_del(opts, BLOCK_OPT_ENCRYPT_FORMAT); if (encryptfmt) { if (qemu_opt_get(opts, BLOCK_OPT_ENCRYPT)) { error_setg(errp, "Options " BLOCK_OPT_ENCRYPT " and " BLOCK_OPT_ENCRYPT_FORMAT " are mutually exclusive"); ret = -EINVAL; goto cleanup; } } else if (qemu_opt_get_bool_del(opts, BLOCK_OPT_ENCRYPT, false)) { encryptfmt = "aes"; } ret = bdrv_create_file(filename, opts, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto cleanup; } qcow_blk = blk_new_open(filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_PROTOCOL, &local_err); if (qcow_blk == NULL) { error_propagate(errp, local_err); ret = -EIO; goto cleanup; } blk_set_allow_write_beyond_eof(qcow_blk, true); ret = blk_truncate(qcow_blk, 0, PREALLOC_MODE_OFF, errp); if (ret < 0) { goto exit; } memset(&header, 0, sizeof(header)); header.magic = cpu_to_be32(QCOW_MAGIC); header.version = cpu_to_be32(QCOW_VERSION); header.size = cpu_to_be64(total_size); header_size = sizeof(header); backing_filename_len = 0; if (backing_file) { if (strcmp(backing_file, "fat:")) { header.backing_file_offset = cpu_to_be64(header_size); backing_filename_len = strlen(backing_file); header.backing_file_size = cpu_to_be32(backing_filename_len); header_size += backing_filename_len; } else { g_free(backing_file); backing_file = NULL; } header.cluster_bits = 9; header.l2_bits = 12; } else { header.cluster_bits = 12; header.l2_bits = 9; } header_size = (header_size + 7) & ~7; shift = header.cluster_bits + header.l2_bits; l1_size = (total_size + (1LL << shift) - 1) >> shift; header.l1_table_offset = cpu_to_be64(header_size); options = qemu_opts_to_qdict(opts, NULL); qdict_extract_subqdict(options, &encryptopts, "encrypt."); QDECREF(options); if (encryptfmt) { if (!g_str_equal(encryptfmt, "aes")) { error_setg(errp, "Unknown encryption format '%s', expected 'aes'", encryptfmt); ret = -EINVAL; goto exit; } header.crypt_method = cpu_to_be32(QCOW_CRYPT_AES); crypto_opts = block_crypto_create_opts_init( Q_CRYPTO_BLOCK_FORMAT_QCOW, encryptopts, errp); if (!crypto_opts) { ret = -EINVAL; goto exit; } crypto = qcrypto_block_create(crypto_opts, "encrypt.", NULL, NULL, NULL, errp); if (!crypto) { ret = -EINVAL; goto exit; } } else { header.crypt_method = cpu_to_be32(QCOW_CRYPT_NONE); } ret = blk_pwrite(qcow_blk, 0, &header, sizeof(header), 0); if (ret != sizeof(header)) { goto exit; } if (backing_file) { ret = blk_pwrite(qcow_blk, sizeof(header), backing_file, backing_filename_len, 0); if (ret != backing_filename_len) { goto exit; } } tmp = g_malloc0(BDRV_SECTOR_SIZE); for (i = 0; i < DIV_ROUND_UP(sizeof(uint64_t) * l1_size, BDRV_SECTOR_SIZE); i++) { ret = blk_pwrite(qcow_blk, header_size + BDRV_SECTOR_SIZE * i, tmp, BDRV_SECTOR_SIZE, 0); if (ret != BDRV_SECTOR_SIZE) { g_free(tmp); goto exit; } } g_free(tmp); ret = 0; exit: blk_unref(qcow_blk); cleanup: QDECREF(encryptopts); qcrypto_block_free(crypto); qapi_free_QCryptoBlockCreateOptions(crypto_opts); g_free(backing_file); return ret; }
1threat
void omap_clk_init(struct omap_mpu_state_s *mpu) { struct clk **i, *j, *k; int count; int flag; if (cpu_is_omap310(mpu)) flag = CLOCK_IN_OMAP310; else if (cpu_is_omap1510(mpu)) flag = CLOCK_IN_OMAP1510; else if (cpu_is_omap2410(mpu) || cpu_is_omap2420(mpu)) flag = CLOCK_IN_OMAP242X; else if (cpu_is_omap2430(mpu)) flag = CLOCK_IN_OMAP243X; else if (cpu_is_omap3430(mpu)) flag = CLOCK_IN_OMAP243X; else return; for (i = onchip_clks, count = 0; *i; i ++) if ((*i)->flags & flag) count ++; mpu->clks = (struct clk *) g_malloc0(sizeof(struct clk) * (count + 1)); for (i = onchip_clks, j = mpu->clks; *i; i ++) if ((*i)->flags & flag) { memcpy(j, *i, sizeof(struct clk)); for (k = mpu->clks; k < j; k ++) if (j->parent && !strcmp(j->parent->name, k->name)) { j->parent = k; j->sibling = k->child1; k->child1 = j; } else if (k->parent && !strcmp(k->parent->name, j->name)) { k->parent = j; k->sibling = j->child1; j->child1 = k; } j->divisor = j->divisor ?: 1; j->multiplier = j->multiplier ?: 1; j ++; } for (j = mpu->clks; count --; j ++) { omap_clk_update(j); omap_clk_rate_update(j); } }
1threat
static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags) { AVStream *st = s->streams[0]; R3DContext *r3d = s->priv_data; int frame_num; if (!st->codec->time_base.num || !st->time_base.den) return -1; frame_num = sample_time*st->codec->time_base.den/ ((int64_t)st->codec->time_base.num*st->time_base.den); av_dlog(s, "seek frame num %d timestamp %"PRId64"\n", frame_num, sample_time); if (frame_num < r3d->video_offsets_count) { avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET); } else { av_log(s, AV_LOG_ERROR, "could not seek to frame %d\n", frame_num); return -1; } return 0; }
1threat
static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base) { VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, qdev); VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, qdev, base); VirtIOSerialBus *bus = DO_UPCAST(VirtIOSerialBus, qbus, qdev->parent_bus); int ret, max_nr_ports; bool plugging_port0; port->vser = bus->vser; port->bh = qemu_bh_new(flush_queued_data_bh, port); plugging_port0 = port->is_console && !find_port_by_id(port->vser, 0); if (find_port_by_id(port->vser, port->id)) { error_report("virtio-serial-bus: A port already exists at id %u\n", port->id); return -1; } if (port->id == VIRTIO_CONSOLE_BAD_ID) { if (plugging_port0) { port->id = 0; } else { port->id = find_free_port_id(port->vser); if (port->id == VIRTIO_CONSOLE_BAD_ID) { error_report("virtio-serial-bus: Maximum port limit for this device reached\n"); return -1; } } } max_nr_ports = tswap32(port->vser->config.max_nr_ports); if (port->id >= max_nr_ports) { error_report("virtio-serial-bus: Out-of-range port id specified, max. allowed: %u\n", max_nr_ports - 1); return -1; } port->info = info; ret = info->init(port); if (ret) { return ret; } if (!use_multiport(port->vser)) { port->guest_connected = true; } port->elem.out_num = 0; QTAILQ_INSERT_TAIL(&port->vser->ports, port, next); port->ivq = port->vser->ivqs[port->id]; port->ovq = port->vser->ovqs[port->id]; add_port(port->vser, port->id); virtio_notify_config(&port->vser->vdev); return ret; }
1threat
__org_qemu_x_Union1 *qmp___org_qemu_x_command(__org_qemu_x_EnumList *a, __org_qemu_x_StructList *b, __org_qemu_x_Union2 *c, __org_qemu_x_Alt *d, Error **errp) { __org_qemu_x_Union1 *ret = g_new0(__org_qemu_x_Union1, 1); ret->kind = ORG_QEMU_X_UNION1_KIND___ORG_QEMU_X_BRANCH; ret->__org_qemu_x_branch = strdup("blah1"); return ret; }
1threat
How to integrate "Google Firebase Analytics" in ionic apps? : <p>In the official <a href="https://firebase.google.com/docs/android/setup">Firebase Integration Guide (Android)</a> and <a href="https://firebase.google.com/docs/ios/setup">Firebase Integration Guide (iOS)</a>, they have provided individual integration guidelines.</p> <p>Could you please tell me an ionic way I can integrate <code>Firebase Analytics</code> into ionic apps?</p> <p>I need to do this as AdMob made the <code>Firebase Analytics</code> as its recommendation analytics solution for mobile apps.</p> <p>Thank you in advance.</p>
0debug
[Android][Listview] Unable to show my ArrayList data in Listview : The question is... I put my data in ArrayList and adding to ListView. But there has no data show on ListView but I am sure those data has been retrieved. The System output for testing is correct.( my data ) Please solve my question... There is my partial code: public class query_page extends AppCompatActivity {     public ArrayList<String> show_Location, show_Messages;     public ListView listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_query_page); show_Location = new ArrayList<String>(); show_Messages = new ArrayList<String>(); listView = (ListView) findViewById(R.id.listView); ParseQuery<ParseObject> query = ParseQuery.getQuery("Danger"); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> list, ParseException e) { if (e == null) { for (ParseObject j : list) { show_Location.add(j.getString("DangerLocation")); show_Messages.add(j.getString("DangerMessage")); System.out.println("Location: " + j.getString("DangerLocation")); System.out.println("Messages: " + j.getString("DangerMessage")); } ArrayAdapter adapter = new ArrayAdapter(query_page.this, android.R.layout.simple_list_item_1, show_Location); listView.setAdapter(adapter); } else { System.out.println("Exception occur! "); } } }); } }
0debug
Which entity framework is used in visual studio 2012 with mvc 4 with windows os 7 : I have seen there is different option when we add entity framework for database connection,but those options are not in mvc 4 in visual studio 2012. Can anyone tell what is the step by step procedure to use database in visual studio 2012 mvc4 on windows operating system 7
0debug
Angular 2 flex-layout height 100% : <p>Angular app using Material design and flex-layout. <a href="https://github.com/angular/flex-layout" rel="noreferrer">https://github.com/angular/flex-layout</a></p> <p>I'm trying to create a simple page layout of 2-columns on top (left=fill, right=10%), followed by a single row on the bottom of the screen. The elements are still only filling just the vertical space required for the content. The only way I've found to do this is to manually set height to 100%. Is that how I have to do it? What is wrong with this html?</p> <pre><code>&lt;div fxLayout="column"&gt; &lt;div fxLayout="row" fxFlex="90%"&gt; &lt;div fxFlex="80%" class="border"&gt; &lt;p&gt;Stuff is happening here&lt;/p&gt; &lt;/div&gt; &lt;div fxFlex="20%" class="border"&gt; &lt;ul&gt; &lt;li&gt;Item 1&lt;/li&gt; &lt;li&gt;Item 2&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;div fxLayout="row" fxFlex="10%" class="border"&gt; &lt;p&gt;Bottom element&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Result:</p> <p><a href="https://i.stack.imgur.com/Qu5Cf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Qu5Cf.png" alt="enter image description here"></a></p>
0debug
static void xhci_port_reset(XHCIPort *port) { trace_usb_xhci_port_reset(port->portnr); if (!xhci_port_have_device(port)) { return; } usb_device_reset(port->uport->dev); switch (port->uport->dev->speed) { case USB_SPEED_LOW: case USB_SPEED_FULL: case USB_SPEED_HIGH: set_field(&port->portsc, PLS_U0, PORTSC_PLS); trace_usb_xhci_port_link(port->portnr, PLS_U0); port->portsc |= PORTSC_PED; break; } port->portsc &= ~PORTSC_PR; xhci_port_notify(port, PORTSC_PRC); }
1threat
static void get_bit(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { DeviceState *dev = DEVICE(obj); Property *prop = opaque; uint32_t *p = qdev_get_prop_ptr(dev, prop); bool value = (*p & qdev_get_prop_mask(prop)) != 0; visit_type_bool(v, &value, name, errp); }
1threat
generic method for returning maxId : I would like to have a method that could perform this code on other objects I have (For example: prize, person, team and so on.), so I don't have to write the same code multiple times and just put let's say GetMaxId(List< Person > persons, Person person). Each of my objects has an Id property. public static int GetMaxId(List<Prize> prizes, Prize prize) { int maxId = 1; if (prizes.Count > 0) maxId = prizes.Max(p => p.Id) + 1; prize.Id = maxId; return prize.Id; } I have tried different things but failed big time :) I believe there is a simple solution i am not seeing. Thanks.
0debug
User-Agent in request for IOS and Android : <p>Hi i'm developing a android and IOS app . I never set a user-agent header for my API call. (simply use some library to make request and get response) Now my server guys told me that </p> <p>" We are facing an issue as currently mobile does not do any authentication when calling esb</p> <p>Simply states SytemId=’ABC’</p> <p>Now we are getting malicious hits from intruders disguised as mobile and is cauing lot of traffic"</p> <p>Is this related to user-agent? What should I do now? Any help is much appreciated. I'm not good at security thing</p>
0debug
How to make the emitter listener in android work when the internet goes off and comes back on? : <p>I have implemented a provision for chat in my app.The chat works using socket.io .I am trying to resolve the issue of the emitter listeners working properly when internet goes off and comes back on.Currently , the socket gets re-connected on the internet but listeners don't work at all once the internet is connected back.Please help guys!</p>
0debug
Android: Get Data from Firebase Firestore : I just need to get the data "user_id" from Firebase and put it instead of xxx in condition (xxx == user_id). How can I do it? (Look at the Pictures) [Firebase Firestore][1] [Android Studio][2] [1]: https://i.stack.imgur.com/jMfr0.png [2]: https://i.stack.imgur.com/O0dAC.png
0debug
Is it possible Nlog not to write the same message : <p>I want to see something like that:</p> <p>error1<br> 50 times: error2<br> error3<br> 10 times: error2<br></p> <p>Is it possible?</p>
0debug
static int decode_hrd(VC9Context *v, GetBitContext *gb) { int i, num; num = get_bits(gb, 5); if (v->hrd_rate || num != v->hrd_num_leaky_buckets) { av_freep(&v->hrd_rate); } if (!v->hrd_rate) v->hrd_rate = av_malloc(num); if (!v->hrd_rate) return -1; if (v->hrd_buffer || num != v->hrd_num_leaky_buckets) { av_freep(&v->hrd_buffer); } if (!v->hrd_buffer) v->hrd_buffer = av_malloc(num); if (!v->hrd_buffer) return -1; v->hrd_num_leaky_buckets = num; v->bit_rate_exponent = get_bits(gb, 4); v->buffer_size_exponent = get_bits(gb, 4); for (i=0; i<num; i++) { v->hrd_rate[i] = get_bits(gb, 16); if (i && v->hrd_rate[i-1]>=v->hrd_rate[i]) { av_log(v, AV_LOG_ERROR, "HDR Rates aren't strictly increasing:" "%i vs %i\n", v->hrd_rate[i-1], v->hrd_rate[i]); return -1; } v->hrd_buffer[i] = get_bits(gb, 16); if (i && v->hrd_buffer[i-1]<v->hrd_buffer[i]) { av_log(v, AV_LOG_ERROR, "HDR Buffers aren't decreasing:" "%i vs %i\n", v->hrd_buffer[i-1], v->hrd_buffer[i]); return -1; } } return 0; }
1threat
void checkasm_check_h264pred(void) { static const struct { void (*func)(H264PredContext*, uint8_t*, uint8_t*, int, int, int); const char *name; } tests[] = { { check_pred4x4, "pred4x4" }, { check_pred8x8, "pred8x8" }, { check_pred16x16, "pred16x16" }, { check_pred8x8l, "pred8x8l" }, }; DECLARE_ALIGNED(16, uint8_t, buf0)[BUF_SIZE]; DECLARE_ALIGNED(16, uint8_t, buf1)[BUF_SIZE]; H264PredContext h; int test, codec, chroma_format, bit_depth; for (test = 0; test < FF_ARRAY_ELEMS(tests); test++) { for (codec = 0; codec < 4; codec++) { int codec_id = codec_ids[codec]; for (bit_depth = 8; bit_depth <= (codec_id == AV_CODEC_ID_H264 ? 10 : 8); bit_depth++) for (chroma_format = 1; chroma_format <= (codec_id == AV_CODEC_ID_H264 ? 2 : 1); chroma_format++) { ff_h264_pred_init(&h, codec_id, bit_depth, chroma_format); tests[test].func(&h, buf0, buf1, codec, chroma_format, bit_depth); } } report("%s", tests[test].name); } }
1threat
Replace all nonzero values by zero and all zero values by a specific value : <p>I have a 3d tensor which contains some zero and nonzero values. I want to replace all nonzero values by zero and zero values by a specific value. How can I do that?</p>
0debug
static IOWatchPoll *io_watch_poll_from_source(GSource *source) { IOWatchPoll *i; QTAILQ_FOREACH(i, &io_watch_poll_list, node) { if (i->src == source) { return i; } } return NULL; }
1threat
How to get back fo first element in list after reaching the end? : <p>For instance: </p> <p>If I am iterating through a Python list ['a','b','c'] how do I get back to element 'a' once I have reached 'c'?</p>
0debug
Why should I reduce the skewness of my data before applying a Machine Learning algorithm? : <p>What is the problem with skewed data? Why should we make the distribution more like a Gaussian?</p>
0debug
static inline int get_phys_addr(CPUARMState *env, target_ulong address, int access_type, int is_user, hwaddr *phys_ptr, int *prot, target_ulong *page_size) { uint32_t sctlr = A32_BANKED_CURRENT_REG_GET(env, sctlr); if (address < 0x02000000) address += env->cp15.c13_fcse; if ((sctlr & SCTLR_M) == 0) { *phys_ptr = address; *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; *page_size = TARGET_PAGE_SIZE; return 0; } else if (arm_feature(env, ARM_FEATURE_MPU)) { *page_size = TARGET_PAGE_SIZE; return get_phys_addr_mpu(env, address, access_type, is_user, phys_ptr, prot); } else if (extended_addresses_enabled(env)) { return get_phys_addr_lpae(env, address, access_type, is_user, phys_ptr, prot, page_size); } else if (sctlr & SCTLR_XP) { return get_phys_addr_v6(env, address, access_type, is_user, phys_ptr, prot, page_size); } else { return get_phys_addr_v5(env, address, access_type, is_user, phys_ptr, prot, page_size); } }
1threat
int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2) { CPUS390XState *env = &cpu->env; uint64_t offset, data; S390PCIBusDevice *pbdev; MemoryRegion *mr; uint8_t len; uint32_t fh; uint8_t pcias; cpu_synchronize_state(CPU(cpu)); if (env->psw.mask & PSW_MASK_PSTATE) { program_interrupt(env, PGM_PRIVILEGED, 4); return 0; } if (r2 & 0x1) { program_interrupt(env, PGM_SPECIFICATION, 4); return 0; } fh = env->regs[r2] >> 32; pcias = (env->regs[r2] >> 16) & 0xf; len = env->regs[r2] & 0xf; offset = env->regs[r2 + 1]; pbdev = s390_pci_find_dev_by_fh(fh); if (!pbdev) { DPRINTF("pcistg no pci dev\n"); setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE); return 0; } switch (pbdev->state) { case ZPCI_FS_RESERVED: case ZPCI_FS_STANDBY: case ZPCI_FS_DISABLED: case ZPCI_FS_PERMANENT_ERROR: setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE); return 0; case ZPCI_FS_ERROR: setcc(cpu, ZPCI_PCI_LS_ERR); s390_set_status_code(env, r2, ZPCI_PCI_ST_BLOCKED); return 0; default: break; } data = env->regs[r1]; if (pcias < 6) { if ((8 - (offset & 0x7)) < len) { program_interrupt(env, PGM_OPERAND, 4); return 0; } if (trap_msix(pbdev, offset, pcias)) { offset = offset - pbdev->msix.table_offset; mr = &pbdev->pdev->msix_table_mmio; update_msix_table_msg_data(pbdev, offset, &data, len); } else { mr = pbdev->pdev->io_regions[pcias].memory; } memory_region_dispatch_write(mr, offset, data, len, MEMTXATTRS_UNSPECIFIED); } else if (pcias == 15) { if ((4 - (offset & 0x3)) < len) { program_interrupt(env, PGM_OPERAND, 4); return 0; } switch (len) { case 1: break; case 2: data = bswap16(data); break; case 4: data = bswap32(data); break; case 8: data = bswap64(data); break; default: program_interrupt(env, PGM_OPERAND, 4); return 0; } pci_host_config_write_common(pbdev->pdev, offset, pci_config_size(pbdev->pdev), data, len); } else { DPRINTF("pcistg invalid space\n"); setcc(cpu, ZPCI_PCI_LS_ERR); s390_set_status_code(env, r2, ZPCI_PCI_ST_INVAL_AS); return 0; } setcc(cpu, ZPCI_PCI_LS_OK); return 0; }
1threat
I need a modal with a form inside to close only if submission is succesfull : <p>I have a form in a modal. I'm using standard mvc form validation and have set an event so that when a button is pressed the modal shows up and after the user submits the form the modal re-hides. The problem with that is that if the form is not valid the modal still closes and the error messages show only if it re-opens. I need a way to trigger the event only if the form is accepted as valid by the controller.</p> <p>The event looks for clicks on button that have the .toggleMOD class(too lazy to create 2 events per id)</p> <p>If you guys need to see any code i will include it but the trigger i want to create is about default mvc submission validation aka "if (ModelState.IsValid)"</p>
0debug