problem
stringlengths
26
131k
labels
class label
2 classes
scope of macro puzzle : #include <iostream> using namespace std; void sum(){ #define SUM(a,b) a+b } int main(void){ int a = 10; int b = 20; int c = SUM(a,b); int d = MUL(a,b); cout << c << endl; cout << d << endl; return 0; } void mul(){ #define MUL(a,b) a*b } Problem gives error with MUL macro. But runs fine with SUM macro. Why is this happening?
0debug
static int tqi_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; const uint8_t *buf_end = buf+buf_size; TqiContext *t = avctx->priv_data; MpegEncContext *s = &t->s; s->width = AV_RL16(&buf[0]); s->height = AV_RL16(&buf[2]); tqi_calculate_qtable(s, buf[4]); buf += 8; if (t->frame.data[0]) avctx->release_buffer(avctx, &t->frame); if (s->avctx->width!=s->width || s->avctx->height!=s->height) avcodec_set_dimensions(s->avctx, s->width, s->height); if(avctx->get_buffer(avctx, &t->frame) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } av_fast_malloc(&t->bitstream_buf, &t->bitstream_buf_size, (buf_end-buf) + FF_INPUT_BUFFER_PADDING_SIZE); if (!t->bitstream_buf) return AVERROR(ENOMEM); s->dsp.bswap_buf(t->bitstream_buf, (const uint32_t*)buf, (buf_end-buf)/4); init_get_bits(&s->gb, t->bitstream_buf, 8*(buf_end-buf)); s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 0; for (s->mb_y=0; s->mb_y<(avctx->height+15)/16; s->mb_y++) for (s->mb_x=0; s->mb_x<(avctx->width+15)/16; s->mb_x++) { if(tqi_decode_mb(s, t->block) < 0) break; tqi_idct_put(t, t->block); } *data_size = sizeof(AVFrame); *(AVFrame*)data = t->frame; return buf_size; }
1threat
Difference between daemonsets and deployments : <p>In Kelsey Hightower's Kubernetes Up and Running, he gives two commands :</p> <p><code>kubectl get daemonSets --namespace=kube-system kube-proxy</code></p> <p>and</p> <p><code>kubectl get deployments --namespace=kube-system kube-dns</code></p> <p>Why does one use daemonSets and the other deployments? And what's the difference?</p>
0debug
Finding an object in a nested object array : I have an object array that looks like the image below depicts. I need to iterate through that object array and return the object where the text property is equals to a string variable that comes as a param. e.g: an object where the text property is "Book an Internal Interview", the object could be in any level of the hierarchy. i was trying something like this, but it just allow me to look in a specific level: var txt = "Book an Internal Interview"; var obj = items[0].items[0].items.find(o => o.text === txt); I need something more recursive [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/4wlhp.png
0debug
Overriding configuration with environment variables in typesafe config : <p>Using <a href="https://github.com/typesafehub/config" rel="noreferrer">typesafe config</a>, how do I override the reference configuration with an environment variable? For example, lets say I have the following configuration:</p> <pre><code>foo: "bar" </code></pre> <p>I want it to be overriden with the environment variable <code>FOO</code> if one exists.</p>
0debug
document.write('<script src="evil.js"></script>');
1threat
JS/ES6: Destructuring of undefined : <p>I'm using some destructuring like this:</p> <pre><code>const { item } = content console.log(item) </code></pre> <p>But how should I handle <code>content === undefined</code> - which will throw an error?</p> <p>The 'old' way would look like this:</p> <pre><code>const item = content &amp;&amp; content.item </code></pre> <p>So, if <code>content</code> is undefined -> <code>item</code> will also be undefined.</p> <p>Can I do something similar using destructuring?</p>
0debug
Asking Solution for Login Activity : **When I press Login Button it shows (Username/Password Wrong) even if i put the right Username & password. It doesn't go to next Activity. the Sing up activity is working fine. i am not able to solve this problem. if anyone can find the problem it would be very helpful. This is my 1st android studio work.** MainActivity public class MainActivity extends AppCompatActivity { private Button signup; DatabaseHelper helper = new DatabaseHelper(this); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); signup = (Button) findViewById(R.id.Bsignup); signup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent button = new Intent(MainActivity.this, SignUp.class); MainActivity.this.startActivity(button); } }); } public void onButtonClick(View v) { if (v.getId() == R.id.BLogin) { EditText a = (EditText) findViewById(R.id.TFusername); String str = a.getText().toString(); EditText b = (EditText) findViewById(R.id.TFpassword); String pass = b.getText().toString(); String password = helper.searchPass(str); if (password.equals(pass)) { Intent i = new Intent(MainActivity.this, Display.class); i.putExtra("Username", str); startActivity(i); }else{ Toast temp = Toast.makeText(MainActivity.this, "Username/Password Wrong", Toast.LENGTH_LONG); temp.show(); } } }} SignupActivity public class SignUp extends AppCompatActivity { DatabaseHelper helper = new DatabaseHelper(this); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_up); } public void onSignUpClick(View v){ if(v.getId()== R.id.Bsignupbutton){ EditText name = (EditText) findViewById(R.id.TFname); EditText uname = (EditText) findViewById(R.id.TFuname); EditText phone = (EditText) findViewById(R.id.TFphone); EditText pass1 = (EditText) findViewById(R.id.TFpass1); EditText pass2 = (EditText) findViewById(R.id.TFpass2); String namestr = name.getText().toString(); String unamestr = uname.getText().toString(); String phonestr = phone.getText().toString(); String pass1str = pass1.getText().toString(); String pass2str = pass2.getText().toString(); if (!pass1str.equals(pass2str)){ Toast pass = Toast.makeText(SignUp.this, "Password doesn't match", Toast.LENGTH_LONG); pass.show(); }else{ Contact c = new Contact(); c.setName(namestr); c.setUname(unamestr); c.setPhone(phonestr); c.setPass(pass1str); helper.insertContact(c); Toast.makeText(getApplicationContext(), "Registration Successful", Toast.LENGTH_LONG).show(); startActivity(new Intent(this, MainActivity.class)); } } }} DatabaseHelper public class DatabaseHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1; private static final String DATABASE_NAME = "contacts.db"; private static final String TABLE_NAME = "contacts"; private static final String COLUMN_ID = "id"; private static final String COLUMN_NAME = "name"; private static final String COLUMN_UNAME = "uname"; private static final String COLUMN_PHONE = "phone"; private static final String COLUMN_PASS = "pass"; SQLiteDatabase db; public DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } private static final String TABLE_CREATE = "create table contacts (id integer primary key not null , " + "name text not null , uname text not null , phone text not null, pass text not null);"; @Override public void onCreate(SQLiteDatabase db) { db.execSQL(TABLE_CREATE); this.db = db; } public void insertContact(Contact c) { db = this.getWritableDatabase(); ContentValues values = new ContentValues(); String query = "select * from contacts"; Cursor cursor = db.rawQuery(query, null); int count = cursor.getCount(); values.put(COLUMN_ID, count); values.put(COLUMN_NAME, c.getName()); values.put(COLUMN_UNAME, c.getUname()); values.put(COLUMN_PHONE, c.getPhone()); values.put(COLUMN_PASS, c.getPass()); db.insert(TABLE_NAME , null , values); } public String searchPass(String uname) { db= this.getReadableDatabase(); String query = "select uname, pass from "+TABLE_NAME; Cursor cursor = db.rawQuery(query, null); String a, b; b = "not found"; if (cursor.moveToFirst()) { do{ a = cursor.getString(0); if (a.equals(uname)) { b = cursor.getString(1); break; } } while(cursor.moveToNext()); } return b; } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { String query = "DROP TABLE IF EXISTS " + TABLE_NAME; db.execSQL(query); this.onCreate(db); }} [1]: https://i.stack.imgur.com/eZuRS.png
0debug
def div_even_odd(list1): first_even = next((el for el in list1 if el%2==0),-1) first_odd = next((el for el in list1 if el%2!=0),-1) return (first_even/first_odd)
0debug
How to delete a pull request? : <p>I am getting a deployment error and I want to delete an unmerged pull request. I have to make changes to the pulled code and create a new PR.</p>
0debug
Angular Email Validation Per RFC 5322 Specs : I have a form which I need to do email validation on before submission. I've come across `ng-pattern="email.text"` which passes `bob@bob`. This lead me to several googles, which I found several suggestions with bad examples, such as http://stackoverflow.com/questions/24490668/how-to-validate-email-id-in-angularjs-using-ng-pattern as well as http://stackoverflow.com/questions/23671934/form-validation-email-validation-not-working-as-expected-in-angularjs . The examples shown don't handle all email addresses. What I'm looking for is a legit email validation that I can use. Reading http://www.regular-expressions.info/email.html it references `RFC 5322` with regular expression: \A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)* | "(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f] | \\[\x01-\x09\x0b\x0c\x0e-\x7f])*") @ (?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])? | \[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3} (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]: (?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f] | \\[\x01-\x09\x0b\x0c\x0e-\x7f])+) \])\z I'm not sure if the above is in the same governing regex standard that javascript uses, as I have not been able to get it to work. Is there a way to get the above into `ng-pattern` like form, that can be used like `ng-pattern="<regex goes here>"` in the form?
0debug
Android Studio - Adding an imageview with source : <p>When I add an ImageView in Android Studio from the Palette the program doesn't prompt me to select an actual image like it used to be in Eclipse. It just puts an empty ImageView there like this: </p> <pre><code>&lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView2" /&gt; </code></pre> <p>Is this a feature or a bug? Because it's very annoying that I have to select the src manually each time when this was pretty fast in Eclipse ADT.</p> <p>For reference my Android Studio version is 1.5.1</p>
0debug
void qemu_aio_flush(void) { AioHandler *node; int ret; do { ret = 0; qemu_aio_wait(); QLIST_FOREACH(node, &aio_handlers, node) { if (node->io_flush) { ret |= node->io_flush(node->opaque); } } } while (qemu_bh_poll() || ret > 0); }
1threat
static void x86_cpuid_get_apic_id(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { X86CPU *cpu = X86_CPU(obj); int64_t value = cpu->apic_id; visit_type_int(v, name, &value, errp); }
1threat
static int tight_compress_data(VncState *vs, int stream_id, size_t bytes, int level, int strategy) { z_streamp zstream = &vs->tight_stream[stream_id]; int previous_out; if (bytes < VNC_TIGHT_MIN_TO_COMPRESS) { vnc_write(vs, vs->tight.buffer, vs->tight.offset); return bytes; } if (tight_init_stream(vs, stream_id, level, strategy)) { return -1; } buffer_reserve(&vs->tight_zlib, bytes + 64); zstream->next_in = vs->tight.buffer; zstream->avail_in = vs->tight.offset; zstream->next_out = vs->tight_zlib.buffer + vs->tight_zlib.offset; zstream->avail_out = vs->tight_zlib.capacity - vs->tight_zlib.offset; zstream->data_type = Z_BINARY; previous_out = zstream->total_out; if (deflate(zstream, Z_SYNC_FLUSH) != Z_OK) { fprintf(stderr, "VNC: error during tight compression\n"); return -1; } vs->tight_zlib.offset = vs->tight_zlib.capacity - zstream->avail_out; bytes = zstream->total_out - previous_out; tight_send_compact_size(vs, bytes); vnc_write(vs, vs->tight_zlib.buffer, bytes); buffer_reset(&vs->tight_zlib); return bytes; }
1threat
static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int flags) { uint8_t *buf1; RMMuxContext *rm = s->priv_data; AVIOContext *pb = s->pb; StreamInfo *stream = rm->audio_stream; int i; buf1 = av_malloc(size * sizeof(uint8_t)); write_packet_header(s, stream, size, !!(flags & AV_PKT_FLAG_KEY)); if (stream->enc->codec_id == AV_CODEC_ID_AC3) { for(i=0;i<size;i+=2) { buf1[i] = buf[i+1]; buf1[i+1] = buf[i]; } avio_write(pb, buf1, size); } else { avio_write(pb, buf, size); } stream->nb_frames++; av_free(buf1); return 0; }
1threat
void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, Error **errp) { Location loc; DriveInfo *dinfo; int unit; Error *err = NULL; loc_push_none(&loc); for (unit = 0; unit <= bus->info->max_target; unit++) { dinfo = drive_get(IF_SCSI, bus->busnr, unit); if (dinfo == NULL) { continue; } qemu_opts_loc_restore(dinfo->opts); scsi_bus_legacy_add_drive(bus, blk_bs(blk_by_legacy_dinfo(dinfo)), unit, false, -1, NULL, &err); if (err != NULL) { error_report("%s", error_get_pretty(err)); error_propagate(errp, err); break; } } loc_pop(&loc); }
1threat
SQL Insert duplicating values : <p>I'm trying to insert data in SQL table, but it's duplicating the values:</p> <pre><code> $star1 = trim($_GET['star1']); $star2 = trim($_GET['star2']); $star3 = trim($_GET['star3']); $star4 = trim($_GET['star4']); $star5 = trim($_GET['star5']); $conn = new mysqli($host, $user, $pass, $db); if ($conn-&gt;connect_error) { die("Desculpe.. Falha ao salvar "); } $sql = "INSERT INTO classificacoes (nossa_empresa, produtos_oferecidos,atendimento, colaboradores, indicaria) VALUES ('$star1','$star2','$star3','$star4', '$star5')"; $conn-&gt;query($sql); if ($conn-&gt;query($sql) != TRUE){ echo "Erro ao gravar"; } else{ echo "Gravou"; } mysqli_close($conn); </code></pre> <p>That is: The code insert two identincal values in the table.</p> <p>What's wrong?</p>
0debug
static int get_phys_addr_lpae(CPUARMState *env, target_ulong address, int access_type, ARMMMUIdx mmu_idx, hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot, target_ulong *page_size_ptr) { CPUState *cs = CPU(arm_env_get_cpu(env)); MMUFaultType fault_type = translation_fault; uint32_t level = 1; uint32_t epd; int32_t tsz; uint32_t tg; uint64_t ttbr; int ttbr_select; hwaddr descaddr, descmask; uint32_t tableattrs; target_ulong page_size; uint32_t attrs; int32_t granule_sz = 9; int32_t va_size = 32; int32_t tbi = 0; TCR *tcr = regime_tcr(env, mmu_idx); int ap, ns, xn, pxn; if (arm_el_is_aa64(env, regime_el(env, mmu_idx))) { va_size = 64; if (extract64(address, 55, 1)) tbi = extract64(tcr->raw_tcr, 38, 1); else tbi = extract64(tcr->raw_tcr, 37, 1); tbi *= 8; } uint32_t t0sz = extract32(tcr->raw_tcr, 0, 6); if (va_size == 64) { t0sz = MIN(t0sz, 39); t0sz = MAX(t0sz, 16); } uint32_t t1sz = extract32(tcr->raw_tcr, 16, 6); if (va_size == 64) { t1sz = MIN(t1sz, 39); t1sz = MAX(t1sz, 16); } if (t0sz && !extract64(address, va_size - t0sz, t0sz - tbi)) { ttbr_select = 0; } else if (t1sz && !extract64(~address, va_size - t1sz, t1sz - tbi)) { ttbr_select = 1; } else if (!t0sz) { ttbr_select = 0; } else if (!t1sz) { ttbr_select = 1; } else { fault_type = translation_fault; goto do_fault; } if (ttbr_select == 0) { ttbr = regime_ttbr(env, mmu_idx, 0); epd = extract32(tcr->raw_tcr, 7, 1); tsz = t0sz; tg = extract32(tcr->raw_tcr, 14, 2); if (tg == 1) { granule_sz = 13; } if (tg == 2) { granule_sz = 11; } } else { ttbr = regime_ttbr(env, mmu_idx, 1); epd = extract32(tcr->raw_tcr, 23, 1); tsz = t1sz; tg = extract32(tcr->raw_tcr, 30, 2); if (tg == 3) { granule_sz = 13; } if (tg == 1) { granule_sz = 11; } } if (epd) { goto do_fault; } level = 4 - (va_size - tsz - 4) / granule_sz; if (tsz) { address &= (1ULL << (va_size - tsz)) - 1; } descmask = (1ULL << (granule_sz + 3)) - 1; descaddr = extract64(ttbr, 0, 48); descaddr &= ~((1ULL << (va_size - tsz - (granule_sz * (4 - level)))) - 1); tableattrs = regime_is_secure(env, mmu_idx) ? 0 : (1 << 4); for (;;) { uint64_t descriptor; bool nstable; descaddr |= (address >> (granule_sz * (4 - level))) & descmask; descaddr &= ~7ULL; nstable = extract32(tableattrs, 4, 1); descriptor = arm_ldq_ptw(cs, descaddr, !nstable); if (!(descriptor & 1) || (!(descriptor & 2) && (level == 3))) { goto do_fault; } descaddr = descriptor & 0xfffffff000ULL; if ((descriptor & 2) && (level < 3)) { tableattrs |= extract64(descriptor, 59, 5); level++; continue; } page_size = (1ULL << ((granule_sz * (4 - level)) + 3)); descaddr |= (address & (page_size - 1)); attrs = extract64(descriptor, 2, 10) | (extract64(descriptor, 52, 12) << 10); attrs |= extract32(tableattrs, 0, 2) << 11; attrs |= extract32(tableattrs, 3, 1) << 5; if (extract32(tableattrs, 2, 1)) { attrs &= ~(1 << 4); } attrs |= nstable << 3; break; } fault_type = access_fault; if ((attrs & (1 << 8)) == 0) { goto do_fault; } ap = extract32(attrs, 4, 2); ns = extract32(attrs, 3, 1); xn = extract32(attrs, 12, 1); pxn = extract32(attrs, 11, 1); *prot = get_S1prot(env, mmu_idx, va_size == 64, ap, ns, xn, pxn); fault_type = permission_fault; if (!(*prot & (1 << access_type))) { goto do_fault; } if (ns) { txattrs->secure = false; } *phys_ptr = descaddr; *page_size_ptr = page_size; return 0; do_fault: return (1 << 9) | (fault_type << 2) | level; }
1threat
Enter Key To Download Product : <p>I'm a game developer who is creating a website for his project. I want players to enter a key before downloading my game from this website. I am trying to use HTML and JavaScript to make this possible. I haven't done something like this before and would like some help writing the code for it. Could someone please help me out? If so, that'd be a big help. Thanks in advance!</p>
0debug
Java if else loop not working : I am currently working on a interactive timeline page generated all in js, but this loop is making the page not work <!-- begin snippet: js hide: false --> <!-- language: lang-js --> if (i = 0) { console.log('magic'); } else if (i = 1) { console.log('magic'); } else if (i = 2 ) { console.log('magic'); } else if (i = 3) { console.log('magic'); } else if (i = 4) { console.log('magic'); } else if (i = 5) { console.log('magic'); } else if (i = 6) { console.log('magic'); } else if (i = 7) { console.log('magic'); } else { console.log('magic'); } <!-- end snippet -->
0debug
SSIS licensing when deployed on different machine than the sql server : I have data warehouse database on SQL Server Enterprise. Currently the SSIS that feeds the data warehouse is running on the same server. I would like to move the SSIS execution on another server. What are the licensing options for SQL Server for running the SSIS? Can I use SQL Server Standard with server + 1 CAL license? SSIS runs under one service account. Thank you.
0debug
C# - converting from an exact number of seconds to DateTime : Newbie here! I have almost completed my given problem - got a total number of seconds. Now I need to print those seconds to a d:HH:mm:ss format. Like I mentioned, I'm kind of new, so it's kind of confusing. I tried the following: double totalSeconds = filteredPictures + totalFilterTime + totalUploadTime; string output = totalSeconds.ToString($"{total:dd.HH:mm:ss}"); Console.WriteLine(output); What am I doing that's not quite right?
0debug
static int64_t ratelimit_calculate_delay(RateLimit *limit, uint64_t n) { int64_t delay_ns = 0; int64_t now = qemu_get_clock_ns(rt_clock); if (limit->next_slice_time < now) { limit->next_slice_time = now + SLICE_TIME; limit->dispatched = 0; } if (limit->dispatched + n > limit->slice_quota) { delay_ns = limit->next_slice_time - now; } else { limit->dispatched += n; } return delay_ns; }
1threat
static void rtsp_send_cmd (AVFormatContext *s, const char *cmd, RTSPMessageHeader *reply, unsigned char **content_ptr) { rtsp_send_cmd_async(s, cmd, reply, content_ptr); rtsp_read_reply(s, reply, content_ptr, 0); }
1threat
What is the difference in these C function argument type? : <pre><code>void f(int **); void g(int *[]); void h(int *[3]); void i(int (*)[]); void j(int (*)[3]); void k(int [][3]); void f(int **a) {} void g(int *a[]) {} void h(int *a[3]) {} void i(int (*a)[]) {} void j(int (*a)[3]) {} void k(int a[][3]) {} int main(void) { int a[3] = {1,2,3}; int b[2] = {4,5}; int *c[2] = {a, b}; int d[2][3] = {{1,2,3},{4,5,6}}; f(c); f(d); // note: expected ‘int **’ but argument is of type ‘int (*)[3]’ g(c); g(d); // note: expected ‘int **’ but argument is of type ‘int (*)[3]’ h(c); h(d); // note: expected ‘int **’ but argument is of type ‘int (*)[3]’ i(c); // note: expected ‘int (*)[]’ but argument is of type ‘int **’ i(d); j(c); // note: expected ‘int (*)[3]’ but argument is of type ‘int **’ j(d); k(c); // note: expected ‘int (*)[3]’ but argument is of type ‘int **’ k(d); return 0; } </code></pre> <p>What is the difference in these C function argument type? There're a lot of confusing between <strong>arrays of pointers</strong> and <strong>two dimensional arrays</strong> The comments are the GCC warning logs.</p>
0debug
static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags) { AVStream *st = s->streams[stream_index]; int64_t seconds; if (!s->bit_rate) return AVERROR_INVALIDDATA; if (sample_time < 0) sample_time = 0; seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den); avio_seek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET); ff_update_cur_dts(s, st, sample_time); return 0; }
1threat
how to use setSupportActionBar in fragment : <p>I need to use the setSupportActionBar in fragment which I am unable to also I am unable to use setContentView please to help with it also Thankyou in advance the related code is given</p> <pre><code>public class StudentrFragment extends Fragment { Toolbar toolbar; TabLayout tabLayout; ViewPager viewPager; ViewPagerAdapter viewPagerAdapter; public StudentrFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.tabbar_layout); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); tabLayout = (TabLayout) findViewById(R.id.tabLayout); viewPager = (ViewPager) findViewById(R.id.viewPager); viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager()); viewPagerAdapter.addFragments(new CivilFragment(),"Civil Dept"); viewPagerAdapter.addFragments(new ComputerFragment(),"CSE Dept"); viewPagerAdapter.addFragments(new EeeFragment(),"EEE Dept"); viewPagerAdapter.addFragments(new EceFragment(),"ECE Dept"); viewPager.setAdapter(viewPagerAdapter); tabLayout.setupWithViewPager(viewPager); } } </code></pre>
0debug
How to align a text inside a <div> element horizontally? : <p>How to align the text inside a div centrally vertically?</p> <p>I have a div element inside my html page where and the height of the div is the screen size and the text inside that div need to be at the center. I have used text-align : center property to align it horizontally but i need to do that horizontally as well.</p>
0debug
How to not evaluate an expression until it is used? : I have a global variable that references local variables within a function, but I don't want the global variable to be evaluated until it's used. var a = (c > d) funciton b() { var c = 5; var d = 3; if (a) { return true; } else { return false; } } The condition in global variable `a` will immediately be evaluated and it'll throw an error that the variables in the condition are not defined. `a` is only used in function `b`, so how can I make it so `a` doesn't evaluate until it's used in the if statement?
0debug
How to use Robot Frame Ride execute branch statement : I met a question with use Robot Framework Ride to test. The test case structure as below: ---------------------------------- if A>B: print 1 print 2 print 3 if C>D: print 4 print 5 ---------------------------------- I didn't find a way to execute multiples case below one "if". I found one keyword "Run Keyword if",but it can only execute one statement. please tell me if you know how to resolve,thanks....
0debug
static ssize_t net_socket_receive(NetClientState *nc, const uint8_t *buf, size_t size) { NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc); uint32_t len; len = htonl(size); send_all(s->fd, (const uint8_t *)&len, sizeof(len)); return send_all(s->fd, buf, size); }
1threat
Get variable from inside of a method : <p>I am quite new to swift and I am learning to make HTTP requests from an API.</p> <p>Right now I have this struct</p> <pre><code>struct CNJokesProvider { let url = URL(string: "https://api.chucknorris.io/jokes/random")! func getRandomJoke() -&gt; String { var request = URLRequest(url: url) request.httpMethod = "GET" let session = URLSession.shared let task = session.dataTask(with: request, completionHandler: { data, response, error -&gt; Void in do { let json = try JSONDecoder().decode(CNJokesResponse.self, from: data!) } catch { print("\(error)") } }) task.resume() //return json.value } } </code></pre> <p>and you can see the declaration of the json constant. I need to get the data from the constant to return it from this getRandomJoke function. I tried to make it a struct property but I couldn't make it work.</p>
0debug
How do I enable the Ruby 2.3 `--enable-frozen-string-literal` globally in Rails? : <p>I am building a greenfield Rails application on top of Ruby 2.3, and I would like all Rails commands (e.g. <code>rails s</code>, <code>rails c</code>) and all Ruby commands (e.g. <code>rake do:something</code>) to use the new immutable-String functionality introduced in Ruby 2.3. (See, e.g. <a href="https://wyeworks.com/blog/2015/12/1/immutable-strings-in-ruby-2-dot-3/" rel="noreferrer">https://wyeworks.com/blog/2015/12/1/immutable-strings-in-ruby-2-dot-3/</a>)</p> <p>So, how do I pass that lovely <code>--enable-frozen-string-literal</code> Ruby option down to Ruby in all possible contexts where some command I issue bottoms out in Ruby?</p> <p>Thanks in advance!</p>
0debug
Error creating Node.js Express App. Cannot find : <p><a href="https://i.stack.imgur.com/Tr1vv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Tr1vv.png" alt="error msg"></a></p> <p>Im trying to create a node.js project in WebStorm Can you tell what am I missing here?</p>
0debug
void ff_h264_direct_ref_list_init(const H264Context *const h, H264SliceContext *sl) { H264Ref *const ref1 = &sl->ref_list[1][0]; H264Picture *const cur = h->cur_pic_ptr; int list, j, field; int sidx = (h->picture_structure & 1) ^ 1; int ref1sidx = (ref1->reference & 1) ^ 1; for (list = 0; list < sl->list_count; list++) { cur->ref_count[sidx][list] = sl->ref_count[list]; for (j = 0; j < sl->ref_count[list]; j++) cur->ref_poc[sidx][list][j] = 4 * sl->ref_list[list][j].parent->frame_num + (sl->ref_list[list][j].reference & 3); } if (h->picture_structure == PICT_FRAME) { memcpy(cur->ref_count[1], cur->ref_count[0], sizeof(cur->ref_count[0])); memcpy(cur->ref_poc[1], cur->ref_poc[0], sizeof(cur->ref_poc[0])); } cur->mbaff = FRAME_MBAFF(h); sl->col_fieldoff = 0; if (sl->list_count != 2 || !sl->ref_count[1]) return; if (h->picture_structure == PICT_FRAME) { int cur_poc = h->cur_pic_ptr->poc; int *col_poc = sl->ref_list[1][0].parent->field_poc; if (col_poc[0] == INT_MAX && col_poc[1] == INT_MAX) { av_log(h->avctx, AV_LOG_ERROR, "co located POCs unavailable\n"); sl->col_parity = 1; } else sl->col_parity = (FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc)); ref1sidx = sidx = sl->col_parity; } else if (!(h->picture_structure & sl->ref_list[1][0].reference) && !sl->ref_list[1][0].parent->mbaff) { sl->col_fieldoff = 2 * sl->ref_list[1][0].reference - 3; } if (sl->slice_type_nos != AV_PICTURE_TYPE_B || sl->direct_spatial_mv_pred) return; for (list = 0; list < 2; list++) { fill_colmap(h, sl, sl->map_col_to_list0, list, sidx, ref1sidx, 0); if (FRAME_MBAFF(h)) for (field = 0; field < 2; field++) fill_colmap(h, sl, sl->map_col_to_list0_field[field], list, field, field, 1); } }
1threat
How to Dynamic ID of static Users from a text file : How to get Dynamic ID of static user using python script. Currently i tried to store it in variable and trying to find it. mgmt = user-data (user-data contain below table information) dynamicID = user-data.find("User ID" sp001 ) print dynamicID #something like this to get the dynamic ID. User-data contain below text info. ID User Name 11 sp001 16 sp002 23 sp003 Am very new to python, Any idea is always welcome :) These user data is a text file information so space between ID and User name is issue like that..
0debug
Difference between OpenCV type CV_32F and CV_32FC1 : <p>I would like to know if there is any difference between OpenCV types CV_32F and CV_32FC1? I already know that 32F stands for a "32bits floating point" and C1 for "single channel", but further explanations would be appreciated.</p> <p>If yes, how are they different / which one should I use in which specific cases? As you might know that openCV types can get very tricky...</p> <p>Thank you all in advance for your help!</p>
0debug
How to use php in html coding to reduce no. Of .html files? : <p>I have made the structure of a website. I have made three .html files named index.html, blog.html, posts.html. index.html is the home page and on that page their is a link for blog.html on the blog.html page thier are some posts heading and i have connected one post to posts.html. But now i'm in trouble that if i have to made one .html file for each post then it would be very difficult so what should i do so that i have to make only one posts.html and anyhow connect it to a php file or something else so that i don't have to make many .html file for every post. Can i use php for it, is their any command that--> if you click on this post then this page will open and if you click on another post then another page will open. By this i will give the command for all the posts and it will help me alot.</p> <p>Thank you</p>
0debug
static inline int get_segment(CPUState *env, mmu_ctx_t *ctx, target_ulong eaddr, int rw, int type) { target_phys_addr_t sdr, hash, mask, sdr_mask, htab_mask; target_ulong sr, vsid, vsid_mask, pgidx, page_mask; int ds, vsid_sh, sdr_sh, pr, target_page_bits; int ret, ret2; pr = msr_pr; #if defined(TARGET_PPC64) if (env->mmu_model & POWERPC_MMU_64) { ppc_slb_t *slb; LOG_MMU("Check SLBs\n"); slb = slb_lookup(env, eaddr); if (!slb) { return -5; } vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT; page_mask = ~SEGMENT_MASK_256M; target_page_bits = (slb->vsid & SLB_VSID_L) ? TARGET_PAGE_BITS_16M : TARGET_PAGE_BITS; ctx->key = !!(pr ? (slb->vsid & SLB_VSID_KP) : (slb->vsid & SLB_VSID_KS)); ds = 0; ctx->nx = !!(slb->vsid & SLB_VSID_N); ctx->eaddr = eaddr; vsid_mask = 0x00003FFFFFFFFF80ULL; vsid_sh = 7; sdr_sh = 18; sdr_mask = 0x3FF80; } else #endif { sr = env->sr[eaddr >> 28]; page_mask = 0x0FFFFFFF; ctx->key = (((sr & 0x20000000) && (pr != 0)) || ((sr & 0x40000000) && (pr == 0))) ? 1 : 0; ds = sr & 0x80000000 ? 1 : 0; ctx->nx = sr & 0x10000000 ? 1 : 0; vsid = sr & 0x00FFFFFF; vsid_mask = 0x01FFFFC0; vsid_sh = 6; sdr_sh = 16; sdr_mask = 0xFFC0; target_page_bits = TARGET_PAGE_BITS; LOG_MMU("Check segment v=" TARGET_FMT_lx " %d " TARGET_FMT_lx " nip=" TARGET_FMT_lx " lr=" TARGET_FMT_lx " ir=%d dr=%d pr=%d %d t=%d\n", eaddr, (int)(eaddr >> 28), sr, env->nip, env->lr, (int)msr_ir, (int)msr_dr, pr != 0 ? 1 : 0, rw, type); } LOG_MMU("pte segment: key=%d ds %d nx %d vsid " TARGET_FMT_lx "\n", ctx->key, ds, ctx->nx, vsid); ret = -1; if (!ds) { if (type != ACCESS_CODE || ctx->nx == 0) { sdr = env->sdr1; pgidx = (eaddr & page_mask) >> target_page_bits; #if defined(TARGET_PPC64) if (env->mmu_model & POWERPC_MMU_64) { htab_mask = 0x0FFFFFFF >> (28 - (sdr & 0x1F)); hash = ((vsid ^ pgidx) << vsid_sh) & vsid_mask; } else #endif { htab_mask = sdr & 0x000001FF; hash = ((vsid ^ pgidx) << vsid_sh) & vsid_mask; } mask = (htab_mask << sdr_sh) | sdr_mask; LOG_MMU("sdr " TARGET_FMT_plx " sh %d hash " TARGET_FMT_plx " mask " TARGET_FMT_plx " " TARGET_FMT_lx "\n", sdr, sdr_sh, hash, mask, page_mask); ctx->pg_addr[0] = get_pgaddr(sdr, sdr_sh, hash, mask); hash = (~hash) & vsid_mask; LOG_MMU("sdr " TARGET_FMT_plx " sh %d hash " TARGET_FMT_plx " mask " TARGET_FMT_plx "\n", sdr, sdr_sh, hash, mask); ctx->pg_addr[1] = get_pgaddr(sdr, sdr_sh, hash, mask); #if defined(TARGET_PPC64) if (env->mmu_model & POWERPC_MMU_64) { if (target_page_bits > 23) { ctx->ptem = (vsid << 12) | ((pgidx << (target_page_bits - 16)) & 0xF80); } else { ctx->ptem = (vsid << 12) | ((pgidx >> 4) & 0x0F80); } } else #endif { ctx->ptem = (vsid << 7) | (pgidx >> 10); } ctx->raddr = (target_phys_addr_t)-1ULL; if (unlikely(env->mmu_model == POWERPC_MMU_SOFT_6xx || env->mmu_model == POWERPC_MMU_SOFT_74xx)) { ret = ppc6xx_tlb_check(env, ctx, eaddr, rw, type); } else { LOG_MMU("0 sdr1=" TARGET_FMT_plx " vsid=" TARGET_FMT_lx " " "api=" TARGET_FMT_lx " hash=" TARGET_FMT_plx " pg_addr=" TARGET_FMT_plx "\n", sdr, vsid, pgidx, hash, ctx->pg_addr[0]); ret = find_pte(env, ctx, 0, rw, type, target_page_bits); if (ret < 0) { if (eaddr != 0xEFFFFFFF) LOG_MMU("1 sdr1=" TARGET_FMT_plx " vsid=" TARGET_FMT_lx " " "api=" TARGET_FMT_lx " hash=" TARGET_FMT_plx " pg_addr=" TARGET_FMT_plx "\n", sdr, vsid, pgidx, hash, ctx->pg_addr[1]); ret2 = find_pte(env, ctx, 1, rw, type, target_page_bits); if (ret2 != -1) ret = ret2; } } #if defined (DUMP_PAGE_TABLES) if (qemu_log_enabled()) { target_phys_addr_t curaddr; uint32_t a0, a1, a2, a3; qemu_log("Page table: " TARGET_FMT_plx " len " TARGET_FMT_plx "\n", sdr, mask + 0x80); for (curaddr = sdr; curaddr < (sdr + mask + 0x80); curaddr += 16) { a0 = ldl_phys(curaddr); a1 = ldl_phys(curaddr + 4); a2 = ldl_phys(curaddr + 8); a3 = ldl_phys(curaddr + 12); if (a0 != 0 || a1 != 0 || a2 != 0 || a3 != 0) { qemu_log(TARGET_FMT_plx ": %08x %08x %08x %08x\n", curaddr, a0, a1, a2, a3); } } } #endif } else { LOG_MMU("No access allowed\n"); ret = -3; } } else { LOG_MMU("direct store...\n"); switch (type) { case ACCESS_INT: break; case ACCESS_CODE: return -4; case ACCESS_FLOAT: return -4; case ACCESS_RES: return -4; case ACCESS_CACHE: ctx->raddr = eaddr; return 0; case ACCESS_EXT: return -4; default: qemu_log("ERROR: instruction should not need " "address translation\n"); return -4; } if ((rw == 1 || ctx->key != 1) && (rw == 0 || ctx->key != 0)) { ctx->raddr = eaddr; ret = 2; } else { ret = -2; } } return ret; }
1threat
def zip_tuples(test_tup1, test_tup2): res = [] for i, j in enumerate(test_tup1): res.append((j, test_tup2[i % len(test_tup2)])) return (res)
0debug
How to create good database design using sql-server and asp.net? : <p>Right now, I'm learning all about database design. Basically the contents of my database are brands for musical instruments. And there are two types of musical instruments which is Guitar and Bass. Now, I have stumbled upon a problem where sometimes a brand would have two types. Like for example in the table below, as you can see the ibanez is repeated twice so that it can accomodate both guitar and bass. I was advised to never repeat data in database but I haven't thought of a solution for this yet.</p> <p>brandId&nbsp;&nbsp;type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;image <br/>1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Guitar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ibanez&nbsp;&nbsp;&nbsp;&nbsp;xyz.jpg <br/>2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Bass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ibanez&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hyz.jpg <br/>3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Guitar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fender&nbsp;&nbsp;&nbsp;&nbsp;abc.jpg <br/>4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Bass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fender&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fgh.jpg <br/>5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Guitar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PRS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;yui.jpg <br/>6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Guitar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ESP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mbm.jpg <br/>7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Bass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Warwick&nbsp;&nbsp;&nbsp;&nbsp;omo.jpg</p> <p>When i want to display the brand images in my webpage whether its for guitar or bass, i would normally use this query in asp.net.</p> <pre><code>public List&lt;brand&gt; GetBrandData() { MusicStoreDBEntities obj = new MusicStoreDBEntities(); List&lt;brand&gt; list = new List&lt;brand&gt;(); list = (from g in obj.brands where g.type=="Guitar" select g).ToList(); return list; } </code></pre> <p>I wanted to know if there are any alternative database design approach where i don't need to repeat data. Kindly provide better solutions or better query in asp.net and hopefully with actual examples.</p>
0debug
Need help writing to a file in Python : I am making a French Translator and purely for experience I want to make a 'Save' button they will save what is currently entered into the entry fields. e1 = Entry(master) e2 = Entry(master) e1.grid(row=0, column=1) e2.grid(row=1, column=1) def write(): name = 'SavedFile.txt' hello = int(3) file = open(name,'w+') file.write(e1.get()) file.close() menubar = Menu(master) master.config(menu=menubar) filemenu = Menu(menubar, tearoff=0) filemenu.add_command(label="Save", command=write()) Changing file.write(e1.get()) to file.write('hello'), works and writes 'Hello' to SavedFile. But I want it so when I click 'Save' under 'File', it rewrites to the file (preferably without overwriting what is there) P.s., s = e1.get() will actually make s = to whatever is currently in the field
0debug
Comparing of various nullable values in C# : How to translate these lines of VB.NET code into C#? this is a fragment of code which I don't understand ... cmd.Parameters.AddWithValue("@ID", res_ID) Dim m1 As Object = cmd.ExecuteScalar() If m1 Is DBNull.Value Or Nothing Then m1 = 0 Else m1= 1 End If
0debug
static void test_visitor_out_union_flat(TestOutputVisitorData *data, const void *unused) { QObject *arg; QDict *qdict; UserDefFlatUnion *tmp = g_malloc0(sizeof(UserDefFlatUnion)); tmp->enum1 = ENUM_ONE_VALUE1; tmp->string = g_strdup("str"); tmp->u.value1 = g_malloc0(sizeof(UserDefA)); tmp->integer = 41; tmp->u.value1->boolean = true; visit_type_UserDefFlatUnion(data->ov, NULL, &tmp, &error_abort); arg = qmp_output_get_qobject(data->qov); g_assert(qobject_type(arg) == QTYPE_QDICT); qdict = qobject_to_qdict(arg); g_assert_cmpstr(qdict_get_str(qdict, "enum1"), ==, "value1"); g_assert_cmpstr(qdict_get_str(qdict, "string"), ==, "str"); g_assert_cmpint(qdict_get_int(qdict, "integer"), ==, 41); g_assert_cmpint(qdict_get_bool(qdict, "boolean"), ==, true); qapi_free_UserDefFlatUnion(tmp); QDECREF(qdict); }
1threat
static void print_report(OutputFile *output_files, OutputStream *ost_table, int nb_ostreams, int is_last_report, int64_t timer_start) { char buf[1024]; OutputStream *ost; AVFormatContext *oc; int64_t total_size; AVCodecContext *enc; int frame_number, vid, i; double bitrate; int64_t pts = INT64_MAX; static int64_t last_time = -1; static int qp_histogram[52]; int hours, mins, secs, us; if (!is_last_report) { int64_t cur_time; cur_time = av_gettime(); if (last_time == -1) { last_time = cur_time; return; } if ((cur_time - last_time) < 500000) return; last_time = cur_time; } oc = output_files[0].ctx; total_size = avio_size(oc->pb); if(total_size<0) total_size= avio_tell(oc->pb); buf[0] = '\0'; vid = 0; for(i=0;i<nb_ostreams;i++) { float q = -1; ost = &ost_table[i]; enc = ost->st->codec; if (!ost->st->stream_copy && enc->coded_frame) q = enc->coded_frame->quality/(float)FF_QP2LAMBDA; if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q); } if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { float t = (av_gettime()-timer_start) / 1000000.0; frame_number = ost->frame_number; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3d q=%3.1f ", frame_number, (t>1)?(int)(frame_number/t+0.5) : 0, q); if(is_last_report) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L"); if(qp_hist){ int j; int qp = lrintf(q); if(qp>=0 && qp<FF_ARRAY_ELEMS(qp_histogram)) qp_histogram[qp]++; for(j=0; j<32; j++) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log(qp_histogram[j]+1)/log(2))); } if (enc->flags&CODEC_FLAG_PSNR){ int j; double error, error_sum=0; double scale, scale_sum=0; char type[3]= {'Y','U','V'}; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "PSNR="); for(j=0; j<3; j++){ if(is_last_report){ error= enc->error[j]; scale= enc->width*enc->height*255.0*255.0*frame_number; }else{ error= enc->coded_frame->error[j]; scale= enc->width*enc->height*255.0*255.0; } if(j) scale/=4; error_sum += error; scale_sum += scale; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], psnr(error/scale)); } snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum/scale_sum)); } vid = 1; } pts = FFMIN(pts, av_rescale_q(ost->st->pts.val, ost->st->time_base, AV_TIME_BASE_Q)); } secs = pts / AV_TIME_BASE; us = pts % AV_TIME_BASE; mins = secs / 60; secs %= 60; hours = mins / 60; mins %= 60; bitrate = pts ? total_size * 8 / (pts / 1000.0) : 0; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=%8.0fkB time=", total_size / 1024.0); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%02d:%02d:%02d.%02d ", hours, mins, secs, (100 * us) / AV_TIME_BASE); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "bitrate=%6.1fkbits/s", bitrate); if (nb_frames_dup || nb_frames_drop) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", nb_frames_dup, nb_frames_drop); av_log(NULL, is_last_report ? AV_LOG_WARNING : AV_LOG_INFO, "%s \r", buf); fflush(stderr); if (is_last_report) { int64_t raw= audio_size + video_size + extra_size; av_log(NULL, AV_LOG_INFO, "\n"); av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB global headers:%1.0fkB muxing overhead %f%%\n", video_size/1024.0, audio_size/1024.0, extra_size/1024.0, 100.0*(total_size - raw)/raw ); } }
1threat
May I know what language is this? is this javascript or jquery? : <p>these code makes me confuse, I would like to add an image for this variable but idk what is the code of adding an image is it image: ? or picture: ? </p> <pre><code> var goldStar = { path: 'M 125,5 155,90 245,90 175,145 200,230 125,180 50,230 75,145 5,90 95,90 z', fillColor: 'yellow', fillOpacity: 0.8, scale: 1, strokeColor: 'gold', strokeWeight: 14 }; </code></pre>
0debug
Creating a Scientific Calculator in Javascript : <p>I have a scientific calculator and I have a Calculator. My question is how do I write a scientific calculator class that matches this specification.</p> <pre><code>describe( "ScientificCalculator", function(){ var calculator; beforeEach( function(){ calculator = new ScientificCalculator(); } ); it( "extends Calculator", function(){ expect( calculator ).to.be.instanceOf( Calculator ); expect( calculator ).to.be.instanceOf( ScientificCalculator ); } ); it( "returns the sine of PI / 2", function(){ expect( calculator.sin( Math.PI / 2 ) ).to.equal( 1 ); } ); it( "returns the cosine of PI", function(){ expect( calculator.cos( Math.PI ) ).to.equal( -1 ); } ); it( "returns the tangent of 0", function(){ expect( calculator.tan( 0 ) ).to.equal( 0 ); } ); it( "returns the logarithm of 1", function(){ expect( calculator.log( 1 ) ).to.equal( 0 ); } ); } ); </code></pre>
0debug
BlockInfoList *qmp_query_block(Error **errp) { BlockInfoList *head = NULL, **p_next = &head; BlockBackend *blk; Error *local_err = NULL; for (blk = blk_next(NULL); blk; blk = blk_next(blk)) { BlockInfoList *info = g_malloc0(sizeof(*info)); bdrv_query_info(blk, &info->value, &local_err); if (local_err) { error_propagate(errp, local_err); goto err; } *p_next = info; p_next = &info->next; } return head; err: qapi_free_BlockInfoList(head); return NULL; }
1threat
static int v9fs_synth_close(FsContext *ctx, V9fsFidOpenState *fs) { V9fsSynthOpenState *synth_open = fs->private; V9fsSynthNode *node = synth_open->node; node->open_count--; g_free(synth_open); fs->private = NULL; return 0; }
1threat
static inline void vmsvga_fill_rect(struct vmsvga_state_s *s, uint32_t c, int x, int y, int w, int h) { DisplaySurface *surface = qemu_console_surface(s->vga.con); int bypl = surface_stride(surface); int width = surface_bytes_per_pixel(surface) * w; int line = h; int column; uint8_t *fst; uint8_t *dst; uint8_t *src; uint8_t col[4]; col[0] = c; col[1] = c >> 8; col[2] = c >> 16; col[3] = c >> 24; fst = s->vga.vram_ptr + surface_bytes_per_pixel(surface) * x + bypl * y; if (line--) { dst = fst; src = col; for (column = width; column > 0; column--) { *(dst++) = *(src++); if (src - col == surface_bytes_per_pixel(surface)) { src = col; } } dst = fst; for (; line > 0; line--) { dst += bypl; memcpy(dst, fst, width); } } vmsvga_update_rect_delayed(s, x, y, w, h); }
1threat
IndexOutOfRangeException was unhandled c# : I'm getting an error IndexOutOfRangeException was unhandled at the line " int euros = int.Parse(values[1])". My .csv file looks: name, 1, 2 name1, 3, 4 name2, 5, 6
0debug
static void coroutine_fn aio_read_response(void *opaque) { SheepdogObjRsp rsp; BDRVSheepdogState *s = opaque; int fd = s->fd; int ret; AIOReq *aio_req = NULL; SheepdogAIOCB *acb; uint64_t idx; if (QLIST_EMPTY(&s->inflight_aio_head)) { goto out; } ret = qemu_co_recv(fd, &rsp, sizeof(rsp)); if (ret < 0) { error_report("failed to get the header, %s", strerror(errno)); goto out; } QLIST_FOREACH(aio_req, &s->inflight_aio_head, aio_siblings) { if (aio_req->id == rsp.id) { break; } } if (!aio_req) { error_report("cannot find aio_req %x", rsp.id); goto out; } acb = aio_req->aiocb; switch (acb->aiocb_type) { case AIOCB_WRITE_UDATA: s->co_recv = NULL; if (!is_data_obj(aio_req->oid)) { break; } idx = data_oid_to_idx(aio_req->oid); if (s->inode.data_vdi_id[idx] != s->inode.vdi_id) { if (rsp.result == SD_RES_SUCCESS) { s->inode.data_vdi_id[idx] = s->inode.vdi_id; s->max_dirty_data_idx = MAX(idx, s->max_dirty_data_idx); s->min_dirty_data_idx = MIN(idx, s->min_dirty_data_idx); } send_pending_req(s, aio_req->oid); } break; case AIOCB_READ_UDATA: ret = qemu_co_recvv(fd, acb->qiov->iov, acb->qiov->niov, aio_req->iov_offset, rsp.data_length); if (ret < 0) { error_report("failed to get the data, %s", strerror(errno)); goto out; } break; case AIOCB_FLUSH_CACHE: if (rsp.result == SD_RES_INVALID_PARMS) { DPRINTF("disable cache since the server doesn't support it\n"); s->cache_flags = SD_FLAG_CMD_DIRECT; rsp.result = SD_RES_SUCCESS; } break; case AIOCB_DISCARD_OBJ: switch (rsp.result) { case SD_RES_INVALID_PARMS: error_report("sheep(%s) doesn't support discard command", s->host_spec); rsp.result = SD_RES_SUCCESS; s->discard_supported = false; break; case SD_RES_SUCCESS: idx = data_oid_to_idx(aio_req->oid); s->inode.data_vdi_id[idx] = 0; break; default: break; } } switch (rsp.result) { case SD_RES_SUCCESS: break; case SD_RES_READONLY: ret = resend_aioreq(s, aio_req); if (ret == SD_RES_SUCCESS) { goto out; } default: acb->ret = -EIO; error_report("%s", sd_strerror(rsp.result)); break; } free_aio_req(s, aio_req); if (!acb->nr_pending) { acb->aio_done_func(acb); } out: s->co_recv = NULL; }
1threat
How do you use a private variable in child classes? : <p>i have a private variable in my main class, is it possible to use it in other classes without making it a protected variable?</p>
0debug
static void do_branch(DisasContext *dc, int32_t offset, uint32_t insn, int cc, TCGv r_cond) { unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); target_ulong target = dc->pc + offset; if (cond == 0x0) { if (a) { dc->pc = dc->npc + 4; dc->npc = dc->pc + 4; } else { dc->pc = dc->npc; dc->npc = dc->pc + 4; } } else if (cond == 0x8) { if (a) { dc->pc = target; dc->npc = dc->pc + 4; } else { dc->pc = dc->npc; dc->npc = target; tcg_gen_mov_tl(cpu_pc, cpu_npc); } } else { flush_cond(dc, r_cond); gen_cond(r_cond, cc, cond, dc); if (a) { gen_branch_a(dc, target, dc->npc, r_cond); dc->is_br = 1; } else { dc->pc = dc->npc; dc->jump_pc[0] = target; dc->jump_pc[1] = dc->npc + 4; dc->npc = JUMP_PC; } } }
1threat
Why drivers are required for JDBC-ODBC? : <p>I am having a little confusion of what I have studied. I have studied that drivers are software programs that are required to interact external hardware devices like printers,mouse,mobiles etc. But when I connect ODBC or JDBC in Java,it requires that we specify the drivers.</p> <p>So why do we need to specify those drivers since our database( Oracle DBC ) is software and not a hardware.</p>
0debug
Can Spark Dataframe's where clause take Variable as argument? : I am running where clause from Spark Dataframe. When I put String variable as argument, it throws me an error message. If I copy that string and put that one in the query, it works. val a = """col("foo")==="bar" || col("abc")==="def"""" val df = df_.where(a) org.apache.spark.sql.catalyst.parser.ParseException: extraneous input '=' expecting {'(', 'SELECT', 'FROM', 'ADD', 'AS', 'ALL', 'DISTINCT', 'WHERE', 'GROUP', 'BY', 'GROUPING', 'SETS', 'CUBE', 'ROLLUP', 'ORDER', 'HAVING', 'LIMIT', 'AT', 'OR', 'AND', 'IN', NOT, 'NO', 'EXISTS', 'BETWEEN', 'LIKE', RLIKE, 'IS', 'NULL', 'TRUE', 'FALSE', 'NULLS', 'ASC', 'DESC', 'FOR', 'INTERVAL', 'CASE', 'WHEN', 'THEN', 'ELSE', 'END', 'JOIN', 'CROSS', 'OUTER', 'INNER', 'LEFT', 'SEMI', 'RIGHT', 'FULL', 'NATURAL', 'ON', 'LATERAL', 'WINDOW', 'OVER', 'PARTITION', 'RANGE', 'ROWS', 'UNBOUNDED', 'PRECEDING', 'FOLLOWING', 'CURRENT', 'FIRST', 'LAST', 'ROW', 'WITH', 'VALUES', 'CREATE', 'TABLE', 'VIEW', 'REPLACE', 'INSERT', 'DELETE', 'INTO', 'DESCRIBE', 'EXPLAIN', 'FORMAT', 'LOGICAL', 'CODEGEN', 'CAST', 'SHOW', 'TABLES', 'COLUMNS', 'COLUMN', 'USE', 'PARTITIONS', 'FUNCTIONS', 'DROP', 'UNION', 'EXCEPT', 'MINUS', 'INTERSECT', 'TO', 'TABLESAMPLE', 'STRATIFY', 'ALTER', 'RENAME', 'ARRAY', 'MAP', 'STRUCT', 'COMMENT', 'SET', 'RESET', 'DATA', 'START', 'TRANSACTION', 'COMMIT', 'ROLLBACK', 'MACRO', 'IF', '+', '-', '*', 'DIV', '~', 'PERCENT', 'BUCKET', 'OUT', 'OF', 'SORT', 'CLUSTER', 'DISTRIBUTE', 'OVERWRITE', 'TRANSFORM', 'REDUCE', 'USING', 'SERDE', 'SERDEPROPERTIES', 'RECORDREADER', 'RECORDWRITER', 'DELIMITED', 'FIELDS', 'TERMINATED', 'COLLECTION', 'ITEMS', 'KEYS', 'ESCAPED', 'LINES', 'SEPARATED', 'FUNCTION', 'EXTENDED', 'REFRESH', 'CLEAR', 'CACHE', 'UNCACHE', 'LAZY', 'FORMATTED', 'GLOBAL', TEMPORARY, 'OPTIONS', 'UNSET', 'TBLPROPERTIES', 'DBPROPERTIES', 'BUCKETS', 'SKEWED', 'STORED', 'DIRECTORIES', 'LOCATION', 'EXCHANGE', 'ARCHIVE', 'UNARCHIVE', 'FILEFORMAT', 'TOUCH', 'COMPACT', 'CONCATENATE', 'CHANGE', 'CASCADE', 'RESTRICT', 'CLUSTERED', 'SORTED', 'PURGE', 'INPUTFORMAT', 'OUTPUTFORMAT', DATABASE, DATABASES, 'DFS', 'TRUNCATE', 'ANALYZE', 'COMPUTE', 'LIST', 'STATISTICS', 'PARTITIONED', 'EXTERNAL', 'DEFINED', 'REVOKE', 'GRANT', 'LOCK', 'UNLOCK', 'MSCK', 'REPAIR', 'RECOVER', 'EXPORT', 'IMPORT', 'LOAD', 'ROLE', 'ROLES', 'COMPACTIONS', 'PRINCIPALS', 'TRANSACTIONS', 'INDEX', 'INDEXES', 'LOCKS', 'OPTION', 'ANTI', 'LOCAL', 'INPATH', 'CURRENT_DATE', 'CURRENT_TIMESTAMP', STRING, BIGINT_LITERAL, SMALLINT_LITERAL, TINYINT_LITERAL, INTEGER_VALUE, DECIMAL_VALUE, DOUBLE_LITERAL, BIGDECIMAL_LITERAL, IDENTIFIER, BACKQUOTED_IDENTIFIER}(line 1, pos 15) == SQL == col("foo")==="bar" || col("abc")==="def" ---------------^^^ at org.apache.spark.sql.catalyst.parser.ParseException.withCommand(ParseDriver.scala:197) at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parse(ParseDriver.scala:99) at org.apache.spark.sql.execution.SparkSqlParser.parse(SparkSqlParser.scala:45) at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parseExpression(ParseDriver.scala:43) at org.apache.spark.sql.Dataset.where(Dataset.scala:1322) … 48 elided If I try without using variable, it works. val df = df_.where(col("foo")==="bar" || col("abc")==="def")
0debug
void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs, int64_t speed, BlockDriverCompletionFunc *cb, void *opaque, Error **errp) { BlockJob *job; if (bs->job || bdrv_in_use(bs)) { error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs)); return NULL; } bdrv_ref(bs); bdrv_set_in_use(bs, 1); job = g_malloc0(driver->instance_size); job->driver = driver; job->bs = bs; job->cb = cb; job->opaque = opaque; job->busy = true; bs->job = job; if (speed != 0) { Error *local_err = NULL; block_job_set_speed(job, speed, &local_err); if (local_err) { bs->job = NULL; g_free(job); bdrv_set_in_use(bs, 0); error_propagate(errp, local_err); return NULL; } } return job; }
1threat
Why does my querySelectorAll is not working even though I converted it to an array? : # querySelectorAll is not working Hey guys I have been trying to inject some data from my JavaScript file to my index html with dom manipulation (querySelectorAll) but it is not working. Note that I have also tried converting nodelist into array for it to be displayed on html but to no avail, it still does not work. I've spent some time googling for a similar problem like this but I could not find any. **HTML code:** ``` <section class="section"> <div class="container"> <div style='margin: 40px 10px 40px'> <h1>Lifestyle.</h1> <p>The latest and best lifestyle articles selected<br/> by our editorial office. </p> </div> </div> <div class="container"> <div class='card-row'></div> <div class='card-row'></div> <div class='card-row'></div> <div class='card-row'></div> <div class='card-row'></div> <div class='card-row'></div> </div> </section> ``` **CSS code:** (this is for the cards layout) ``` .card-row { width: 300px; height: 270px; border-radius: 15px; background-color: tomato; color: #fff; } ``` **JS Code:** ``` const card = document.querySelectorAll('.card-row') const newCard = Array.from(card) const data = [ { topic: 'Food', title: 'Wake Up and Smell the Coffee', price: '$0.90', color: green }, { topic: 'Architecture', title: 'The Brand New NASA Office', price: '$0.19', color: black }, { topic: 'Travel', title: 'Experience the Saharan Sands', price: '$2.29', color: brown }, { topic: 'Interior', title: '9 Air-Cleaning Plants Your Home Needs', price: '$0.09', color: greenblue }, { topic: 'Food', title: 'One Month Sugar Detox', price: '$0.99', color: pink }, { topic: 'Photography', title: 'Shooting Minimal Instagram Photos', price: '$0.29', color: blue } ] data.forEach(info => { card.innerHTML += ` <span>${info.topic}</span> <h3>${info.title}</h3> <p>${info.price}</p> ` }) ``` Basically, I want my data variable to loop and inject the objects inside my cards. I have tried using only querySelector and of course it works for the first card but it is not something I want to achieve. I could also give each card an id and manually put each data's object but it is not efficient and I'm trying to avoid long code. ### I hope my explanation is clear enough. Thank you in advance!
0debug
static void qemu_rdma_init_one_block(void *host_addr, ram_addr_t block_offset, ram_addr_t length, void *opaque) { __qemu_rdma_add_block(opaque, host_addr, block_offset, length); }
1threat
JQuery - Get the minimum and maximum date and grouped it by id : I have this array of data [{"id":1, "start":"2018-10-10", "end":"2018-11-10"}, {"id":1, "start":"2018-11-10", "end":"2018-12-10"}, {"id":2, "start":"2018-11-22", "end":"2018-11-30"}] I wanted to get the `minimum` in the start and the `maximum` in the end. My desired output would be {"id":1, "start":"2018-10-10", "end":"2018-12-10"}, {"id":2, "start":"2018-11-22", "end":"2018-11-30"} I tried doing like this: data.sort((a,b) => a.start_date.toString().localeCompare(b.start_date))
0debug
Casting Objects -- How do they work? : <p>I have a Person class, and Object class is just the Object class of Java. I have a Student class that extends the Person Class as well. Can somebody explain why in these different scenarios I get errors when casting and some work?</p> <pre><code>Person p = (Person) new Object(); // error Person p = (Person) new Student(“Steve”, 21, 12345); // works Object o = new Person(“Steve”, 21); // works Person p = (Person) o; // works </code></pre>
0debug
static int filter_frame(AVFilterLink *inlink, AVFrame *src_buffer) { AVFilterContext *ctx = inlink->dst; ATempoContext *atempo = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; int ret = 0; int n_in = src_buffer->nb_samples; int n_out = (int)(0.5 + ((double)n_in) / atempo->tempo); const uint8_t *src = src_buffer->data[0]; const uint8_t *src_end = src + n_in * atempo->stride; while (src < src_end) { if (!atempo->dst_buffer) { atempo->dst_buffer = ff_get_audio_buffer(outlink, n_out); av_frame_copy_props(atempo->dst_buffer, src_buffer); atempo->dst = atempo->dst_buffer->data[0]; atempo->dst_end = atempo->dst + n_out * atempo->stride; } yae_apply(atempo, &src, src_end, &atempo->dst, atempo->dst_end); if (atempo->dst == atempo->dst_end) { ret = push_samples(atempo, outlink, n_out); if (ret < 0) goto end; atempo->request_fulfilled = 1; } } atempo->nsamples_in += n_in; end: av_frame_free(&src_buffer); return ret; }
1threat
static void ecc_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t val) { ECCState *s = opaque; switch (addr & ECC_ADDR_MASK) { case ECC_MER: s->regs[0] = (s->regs[0] & (ECC_MER_VER | ECC_MER_IMPL)) | (val & ~(ECC_MER_VER | ECC_MER_IMPL)); DPRINTF("Write memory enable %08x\n", val); break; case ECC_MDR: s->regs[1] = val & ECC_MDR_MASK; DPRINTF("Write memory delay %08x\n", val); break; case ECC_MFSR: s->regs[2] = val; DPRINTF("Write memory fault status %08x\n", val); break; case ECC_VCR: s->regs[3] = val; DPRINTF("Write slot configuration %08x\n", val); break; case ECC_DR: s->regs[6] = val; DPRINTF("Write diagnosiic %08x\n", val); break; case ECC_ECR0: s->regs[7] = val; DPRINTF("Write event count 1 %08x\n", val); break; case ECC_ECR1: s->regs[7] = val; DPRINTF("Write event count 2 %08x\n", val); break; } }
1threat
static inline int decode_seq_parameter_set(H264Context *h){ MpegEncContext * const s = &h->s; int profile_idc, level_idc; unsigned int sps_id, tmp, mb_width, mb_height; int i; SPS *sps; profile_idc= get_bits(&s->gb, 8); get_bits1(&s->gb); get_bits1(&s->gb); get_bits1(&s->gb); get_bits1(&s->gb); get_bits(&s->gb, 4); level_idc= get_bits(&s->gb, 8); sps_id= get_ue_golomb(&s->gb); sps = alloc_parameter_set(h, (void **)h->sps_buffers, sps_id, MAX_SPS_COUNT, sizeof(SPS), "sps"); if(sps == NULL) return -1; sps->profile_idc= profile_idc; sps->level_idc= level_idc; memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4)); memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8)); sps->scaling_matrix_present = 0; if(sps->profile_idc >= 100){ sps->chroma_format_idc= get_ue_golomb(&s->gb); if(sps->chroma_format_idc == 3) get_bits1(&s->gb); get_ue_golomb(&s->gb); get_ue_golomb(&s->gb); sps->transform_bypass = get_bits1(&s->gb); decode_scaling_matrices(h, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8); }else{ sps->chroma_format_idc= 1; } sps->log2_max_frame_num= get_ue_golomb(&s->gb) + 4; sps->poc_type= get_ue_golomb(&s->gb); if(sps->poc_type == 0){ sps->log2_max_poc_lsb= get_ue_golomb(&s->gb) + 4; } else if(sps->poc_type == 1){ sps->delta_pic_order_always_zero_flag= get_bits1(&s->gb); sps->offset_for_non_ref_pic= get_se_golomb(&s->gb); sps->offset_for_top_to_bottom_field= get_se_golomb(&s->gb); tmp= get_ue_golomb(&s->gb); if(tmp >= sizeof(sps->offset_for_ref_frame) / sizeof(sps->offset_for_ref_frame[0])){ av_log(h->s.avctx, AV_LOG_ERROR, "poc_cycle_length overflow %u\n", tmp); return -1; } sps->poc_cycle_length= tmp; for(i=0; i<sps->poc_cycle_length; i++) sps->offset_for_ref_frame[i]= get_se_golomb(&s->gb); }else if(sps->poc_type != 2){ av_log(h->s.avctx, AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type); return -1; } tmp= get_ue_golomb(&s->gb); if(tmp > MAX_PICTURE_COUNT-2 || tmp >= 32){ av_log(h->s.avctx, AV_LOG_ERROR, "too many reference frames\n"); return -1; } sps->ref_frame_count= tmp; sps->gaps_in_frame_num_allowed_flag= get_bits1(&s->gb); mb_width= get_ue_golomb(&s->gb) + 1; mb_height= get_ue_golomb(&s->gb) + 1; if(mb_width >= INT_MAX/16 || mb_height >= INT_MAX/16 || avcodec_check_dimensions(NULL, 16*mb_width, 16*mb_height)){ av_log(h->s.avctx, AV_LOG_ERROR, "mb_width/height overflow\n"); return -1; } sps->mb_width = mb_width; sps->mb_height= mb_height; sps->frame_mbs_only_flag= get_bits1(&s->gb); if(!sps->frame_mbs_only_flag) sps->mb_aff= get_bits1(&s->gb); else sps->mb_aff= 0; sps->direct_8x8_inference_flag= get_bits1(&s->gb); #ifndef ALLOW_INTERLACE if(sps->mb_aff) av_log(h->s.avctx, AV_LOG_ERROR, "MBAFF support not included; enable it at compile-time.\n"); #endif if(!sps->direct_8x8_inference_flag && sps->mb_aff) av_log(h->s.avctx, AV_LOG_ERROR, "MBAFF + !direct_8x8_inference is not implemented\n"); sps->crop= get_bits1(&s->gb); if(sps->crop){ sps->crop_left = get_ue_golomb(&s->gb); sps->crop_right = get_ue_golomb(&s->gb); sps->crop_top = get_ue_golomb(&s->gb); sps->crop_bottom= get_ue_golomb(&s->gb); if(sps->crop_left || sps->crop_top){ av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n"); } if(sps->crop_right >= 8 || sps->crop_bottom >= (8>> !sps->frame_mbs_only_flag)){ av_log(h->s.avctx, AV_LOG_ERROR, "brainfart cropping not supported, this could look slightly wrong ...\n"); } }else{ sps->crop_left = sps->crop_right = sps->crop_top = sps->crop_bottom= 0; } sps->vui_parameters_present_flag= get_bits1(&s->gb); if( sps->vui_parameters_present_flag ) decode_vui_parameters(h, sps); if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(h->s.avctx, AV_LOG_DEBUG, "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s %s\n", sps_id, sps->profile_idc, sps->level_idc, sps->poc_type, sps->ref_frame_count, sps->mb_width, sps->mb_height, sps->frame_mbs_only_flag ? "FRM" : (sps->mb_aff ? "MB-AFF" : "PIC-AFF"), sps->direct_8x8_inference_flag ? "8B8" : "", sps->crop_left, sps->crop_right, sps->crop_top, sps->crop_bottom, sps->vui_parameters_present_flag ? "VUI" : "", ((const char*[]){"Gray","420","422","444"})[sps->chroma_format_idc] ); } return 0; }
1threat
Angular 2 - Global CSS file : <p>Is it possible to add a global CSS file to Angular 2? At the moment I have many different components that have the same button styling - but each of the components have their own CSS file with the styling. This is frustrating for changes.</p> <p>I read somewhere on Stack Overflow to add:</p> <pre><code>import { ViewEncapsulation } from '@angular/core'; //add this @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'], encapsulation: ViewEncapsulation.None //add this }) </code></pre> <p>So I added the ViewEncapsulation lines in the root component, then added the CSS styling to the root app CSS (app.component.css) and removed the CSS styling from individual component CSS files, and it did not work.</p> <p>Surely there is a way to add a global CSS file? Do I need to add something to the individual components to make them access the global CSS file?</p>
0debug
What is the best and most used way of wiring in spring dependency injection : <p>This question is not pure coding but pre coding. Actually I am new to spring in winter season. I have a question is that What is the best and most used way of wiring in spring dependency injection? I come to know that xml based wiring is old now. I have confusion between annotation and java-based autowiring. I didn't get enough evidence to choose the right one. Which is most used way now a days? or I have to learn all(which might be confusing at some point).</p>
0debug
Understanding the use of Task.Run + Wait() + async + await used in one line : <p>I'm a C# newbie, so I'm struggling to understand some concepts, and I run into a piece of code that I'm not quite understanding:</p> <pre><code>static void Main(string[] args) { Task.Run(async () =&gt; { await SomeClass.Initiate(new Configuration()); }).Wait(); while (true) ; } </code></pre> <p>As I understand, this runs a task which initiates a method. This method runs, and then, once it finished, it gets into an infinite loop waiting. It feels that either the code doesn't make sense, or that I'm not understanding right.</p> <p>Thanks</p>
0debug
HTML - How do I reveal a checkbox group based on radio group? : <p>I want to have an html form with a required radio group. If one particular option in this radio group is selected, it reveals a checkbox group. This checkbox group should only be required if it is revealed. How could I do this? Preferably in pure HTML, but javascript can be used too if absolutely necessary.</p> <p>Thanks</p>
0debug
static int vmsa_ttbcr_raw_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { if (arm_feature(env, ARM_FEATURE_LPAE)) { value &= ~((7 << 19) | (3 << 14) | (0xf << 3)); } else { value &= 7; } env->cp15.c2_control = value; env->cp15.c2_mask = ~(((uint32_t)0xffffffffu) >> value); env->cp15.c2_base_mask = ~((uint32_t)0x3fffu >> value); return 0; }
1threat
static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int64_t total_size = 0; MOVAtom a; int i; if (atom.size < 0) atom.size = INT64_MAX; while (total_size + 8 <= atom.size && !url_feof(pb)) { int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL; a.size = atom.size; a.type=0; if (atom.size >= 8) { a.size = avio_rb32(pb); a.type = avio_rl32(pb); total_size += 8; if (a.size == 1) { a.size = avio_rb64(pb) - 8; total_size += 8; } } av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n", a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size); if (a.size == 0) { a.size = atom.size - total_size + 8; if (a.size <= 8) break; } a.size -= 8; if (a.size < 0) break; a.size = FFMIN(a.size, atom.size - total_size); for (i = 0; mov_default_parse_table[i].type; i++) if (mov_default_parse_table[i].type == a.type) { parse = mov_default_parse_table[i].parse; break; } if (!parse && (atom.type == MKTAG('u','d','t','a') || atom.type == MKTAG('i','l','s','t'))) parse = mov_read_udta_string; if (!parse) { avio_skip(pb, a.size); } else { int64_t start_pos = avio_tell(pb); int64_t left; int err = parse(c, pb, a); if (err < 0) return err; if (c->found_moov && c->found_mdat && (!pb->seekable || start_pos + a.size == avio_size(pb))) return 0; left = a.size - avio_tell(pb) + start_pos; if (left > 0) avio_skip(pb, left); } total_size += a.size; } if (total_size < atom.size && atom.size < 0x7ffff) avio_skip(pb, atom.size - total_size); return 0; }
1threat
static void gen_spr_BookE206(CPUPPCState *env, uint32_t mas_mask, uint32_t *tlbncfg) { #if !defined(CONFIG_USER_ONLY) const char *mas_names[8] = { "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7", }; int mas_sprn[8] = { SPR_BOOKE_MAS0, SPR_BOOKE_MAS1, SPR_BOOKE_MAS2, SPR_BOOKE_MAS3, SPR_BOOKE_MAS4, SPR_BOOKE_MAS5, SPR_BOOKE_MAS6, SPR_BOOKE_MAS7, }; int i; for (i = 0; i < 8; i++) { if (mas_mask & (1 << i)) { spr_register(env, mas_sprn[i], mas_names[i], SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); } } if (env->nb_pids > 1) { spr_register(env, SPR_BOOKE_PID1, "PID1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_booke_pid, 0x00000000); } if (env->nb_pids > 2) { spr_register(env, SPR_BOOKE_PID2, "PID2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_booke_pid, 0x00000000); } spr_register(env, SPR_MMUCFG, "MMUCFG", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, 0x00000000); switch (env->nb_ways) { case 4: spr_register(env, SPR_BOOKE_TLB3CFG, "TLB3CFG", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, tlbncfg[3]); case 3: spr_register(env, SPR_BOOKE_TLB2CFG, "TLB2CFG", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, tlbncfg[2]); case 2: spr_register(env, SPR_BOOKE_TLB1CFG, "TLB1CFG", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, tlbncfg[1]); case 1: spr_register(env, SPR_BOOKE_TLB0CFG, "TLB0CFG", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, tlbncfg[0]); case 0: default: break; } #endif gen_spr_usprgh(env); }
1threat
SQL server Function to select rows from multiple tables based : can anyone please help with this query ? I’m using SQL server 2008 . Objective is to select rows from multiple tables based on condition and values from different tables . 1) I have table1, table2, tableN with columns as ID,ColumnName,ColumnValue . These are the table I need to select rows based on conditions from below table 2) Control table with columns Number,Function and Enable 2) Repository table with columns Function and tableName I need pass Number and ID as parameters and get details of all Function values from Control table which has Enable value = 1 and by using these Function values collect tableNames from Repository table . And for each tableName returned from Repository table get all rows by using ID value . Appreciate any suggestions
0debug
Method not found System.Net.Http.Formatting.MediaTypeFormatter.get_SupportedMediaTypes() after adding .NET Standard 2.0 dependency : <p>I have a .NET Framework 4.6.1 WebApi project that is referencing a small NuGet package we use internally to share common utility methods.</p> <p>We want to start moving some of our stuff to .NET Core, so I changed the utility package to target .NET Standard 2.0. This was done by simply making a new .NET Standard 2.0 project and copying the source files over.</p> <p>Utility package csproj:</p> <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk"&gt; &lt;PropertyGroup&gt; &lt;TargetFramework&gt;netstandard2.0&lt;/TargetFramework&gt; &lt;GeneratePackageOnBuild&gt;true&lt;/GeneratePackageOnBuild&gt; &lt;/PropertyGroup&gt; &lt;/Project&gt; </code></pre> <p>After updating the package in my WebApi project, I get the following exception on startup:</p> <pre><code>[MissingMethodException: Method not found: 'System.Collections.ObjectModel.Collection`1&lt;System.Net.Http.Headers.MediaTypeHeaderValue&gt; System.Net.Http.Formatting.MediaTypeFormatter.get_SupportedMediaTypes()'.] MyWebApiProject.Application.InitializeHttpConfiguration(HttpConfiguration config) in C:\MyWebApiProject\Global.asax.cs:44 System.Web.Http.GlobalConfiguration.Configure(Action`1 configurationCallback) +34 MyWebApiProject.Application.OnApplicationStarted() in C:\MyWebApiProject\Global.asax.cs:62 Ninject.Web.Common.NinjectHttpApplication.Application_Start() +183 [HttpException (0x80004005): Method not found: 'System.Collections.ObjectModel.Collection`1&lt;System.Net.Http.Headers.MediaTypeHeaderValue&gt; System.Net.Http.Formatting.MediaTypeFormatter.get_SupportedMediaTypes()'.] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +10104513 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +173 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296 [HttpException (0x80004005): Method not found: 'System.Collections.ObjectModel.Collection`1&lt;System.Net.Http.Headers.MediaTypeHeaderValue&gt; System.Net.Http.Formatting.MediaTypeFormatter.get_SupportedMediaTypes()'.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10085804 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254 </code></pre> <p>The only changes are the version number in packages.config and the csproj.</p> <p>Any ideas?</p> <p>Thanks!</p>
0debug
static void curl_block_init(void) { bdrv_register(&bdrv_http); bdrv_register(&bdrv_https); bdrv_register(&bdrv_ftp); bdrv_register(&bdrv_ftps); bdrv_register(&bdrv_tftp); }
1threat
How do you populate two Lists with one text file based on an attribute? : <p>I have a text file with 40000 lines of data.</p> <p>The data is formatted as such:</p> <pre><code>Anna,F,98273 Christopher,M,2736 Robert,M,827 Mary,F,7264 Anthony,M,8 ... </code></pre> <p>I want to create two Lists based on a char value. The char indicates gender and I want to create a "female (f)" List and a "male (m)" List. <strong>How do I create two lists from one file based on this char value?</strong></p> <p>I have a class with a constructor already set up to create a List of all the data. I have already successfully created one List and am able to sort it based on any given attribute. If creating two Lists is not the best way to organize this data please give me alternatives. </p> <p>I have thought about compiling all the data into one List and then sorting it based on the char so females are first and then males. I would then have to sort it based on the number associated with the name. The issue I run into here is I need to display the top 10 (any given int works here as it will be inputted by the user) female names with the highest numbers alongside the top male names with the highest numbers. I am not sure how to call on these values as I cannot (to my knowledge) use the index to indicate rank if both genders are in the same List. To me, this method seems much more complicated than simply creating two Lists and is not ideal.</p>
0debug
Running Custom Android ROM on Emulator : <p>I built a custom ROM based out of AOSP (7.0 for Nexus 6) and I would like to use this ROM with SDK emulator. The lunch combo for the build is 'aosp_x86_64-eng' which I believe </p> <p>should work on SDK emulator. However, I don't see an option in AVD Manager to specify my custom system image. It only allows me to use the listed ROMs from Google.</p> <p>I tried copying my custom ROM's system.img over the stock Nexus 6 AVD but the emulator doesn't launch after that.</p> <p>Note that the emulator that gets generated during the build works fine. But the build happens on a server, and I want to use the generated ROM on my development machine with my SDK's AVD Manager.</p>
0debug
How to apply ensemble modelling approach for each group in data set? : Suppose , I have a data set which consists of variables like population age, life expectancy,gender , country, year(monthly data for each year). I would like to predict life expectancy (years) by each country. How can I apply ensemble modelling approach and scale it across all the countries?I am using R Thanks
0debug
Group elements of array of objects Js : <p>I've been trying to group elements with the same values in the array for hours but I'm going nowhere </p> <p>Array:</p> <pre><code>list = [ {id: "0", created_at: "foo1", value: "35"}, {id: "1", created_at: "foo1", value: "26"}, {id: "2", created_at: "foo", value: "13"}, {id: "3", created_at: "foo1", value: "11"}, {id: "4", created_at: "foo", value: "11"}, {id: "5", created_at: "foo1", value: "16"}, {id: "6", created_at: "foo", value: "26"}, {id: "7", created_at: "foo1", value: "13"}, {id: "8", created_at: "foo1", value: "16"} ]; </code></pre> <p>The result I'm trying to get is:</p> <pre><code>var result = [ [ {id: "0", created_at: "foo1", value: "35"} ], [ {id: "1", created_at: "foo1", value: "26"}, {id: "6", created_at: "foo", value: "26"} ], [ {id: "2", created_at: "foo", value: "13"}, {id: "7", created_at: "foo1", value: "13"} ], [ {id: "3", created_at: "foo1", value: "11"}, {id: "4", created_at: "foo", value: "11"} ], [ {id: "5", created_at: "foo1", value: "16"}, {id: "8", created_at: "foo1", value: "16"} ] ]; </code></pre> <p>any ideas how to get that? thanks in advance.</p> <p>Note: I'm working with angular 5.</p>
0debug
How can I run a docker windows container on osx? : <p>I'm running docker for mac and want to start up a windows container. From what I see this should work via a virtual machine. But I'm unclear where to find out how to get it to work? Or does it only work for linux containers? Thanks in advance!</p> <pre><code>docker build nanoserver/ Sending build context to Docker daemon 2.56kB Step 1/6 : FROM microsoft/nanoserver:10.0.14393.1480 10.0.14393.1480: Pulling from microsoft/nanoserver bce2fbc256ea: Pulling fs layer baa0507b781f: Pulling fs layer image operating system "windows" cannot be used on this platform </code></pre>
0debug
How to take input from text file for adjacency matrix in c language : <p>Here is the inline input for my code.</p> <pre><code>int graph[V][V] = {{0, 2, 0, 6, 0}, {2, 0, 3, 8, 5}, {0, 3, 0, 0, 7}, {6, 8, 0, 0, 9}, {0, 5, 7, 9, 0}, }; </code></pre> <p>I want to take this graph input from the text file to the graph array.</p>
0debug
What does the standard Keras model output mean? What is epoch and loss in Keras? : <p>I have just built my first model using Keras and this is the output. It looks like the standard output you get after building any Keras artificial neural network. Even after looking in the documentation, I do not fully understand what the epoch is and what the loss is which is printed in the output.</p> <p><strong>What is epoch and loss in Keras?</strong> </p> <p>(I know it's probably an extremely basic question, but I couldn't seem to locate the answer online, and if the answer is really that hard to glean from the documentation I thought others would have the same question and thus decided to post it here.)</p> <pre><code>Epoch 1/20 1213/1213 [==============================] - 0s - loss: 0.1760 Epoch 2/20 1213/1213 [==============================] - 0s - loss: 0.1840 Epoch 3/20 1213/1213 [==============================] - 0s - loss: 0.1816 Epoch 4/20 1213/1213 [==============================] - 0s - loss: 0.1915 Epoch 5/20 1213/1213 [==============================] - 0s - loss: 0.1928 Epoch 6/20 1213/1213 [==============================] - 0s - loss: 0.1964 Epoch 7/20 1213/1213 [==============================] - 0s - loss: 0.1948 Epoch 8/20 1213/1213 [==============================] - 0s - loss: 0.1971 Epoch 9/20 1213/1213 [==============================] - 0s - loss: 0.1899 Epoch 10/20 1213/1213 [==============================] - 0s - loss: 0.1957 Epoch 11/20 1213/1213 [==============================] - 0s - loss: 0.1923 Epoch 12/20 1213/1213 [==============================] - 0s - loss: 0.1910 Epoch 13/20 1213/1213 [==============================] - 0s - loss: 0.2104 Epoch 14/20 1213/1213 [==============================] - 0s - loss: 0.1976 Epoch 15/20 1213/1213 [==============================] - 0s - loss: 0.1979 Epoch 16/20 1213/1213 [==============================] - 0s - loss: 0.2036 Epoch 17/20 1213/1213 [==============================] - 0s - loss: 0.2019 Epoch 18/20 1213/1213 [==============================] - 0s - loss: 0.1978 Epoch 19/20 1213/1213 [==============================] - 0s - loss: 0.1954 Epoch 20/20 1213/1213 [==============================] - 0s - loss: 0.1949 </code></pre>
0debug
undefined method `detailsFileTag' for nil:NilClass : Aim is to test a design pattern -here which is a decorator pattern I have taken the below codes from the lib folder , controller folder. Idea is to test the decorator patter sample code here. The library file here has a BasicTag class which is inherited by class TaggingDecor and an another class DescriptionDecor. Now that all these 3 classes have a common function called 'detailsForTag'. This function when is called from controller file as listed below. The error is " undefined method `detailsFileTag' for nil:NilClass" and the error line is as tagged below in the code. # the concrete component we would like to decorate class BasicTag def initialize() @init_basicTag = "File with no tags" end # getter method def detailsFileTag return " test from BasicTag....." end end # decorator class -- this serves as the superclass for all the concrete decorators # the base/super class decorator (i.e. no actual decoration yet), each concrete decorator (i.e. subclass) will add its own decoration class TaggingDecor def initialize(r_file) @r_file = r_file @aTagg = "no tag added" @aDescTag = "no description added" end # override the details method to include the description of the extra feature def detailsFileTag return @aTagg + @aDescTag end end # a concrete decorator class TagDec < TaggingDecor def initialize(r_file) super(r_file) @aTagg = "no tag added" @aDescTag = "tagdec description added" end # override the details method to include the description def detailsFileTag return @aTagg + @aDescTag end end # another concrete decorator class DescriptionDec < TaggingDecor def initialize(r_file) super(r_file) @aTagg = "no tag added" @aDescTag = "descriptiondec description added" end # override the details method to include the description def detailsFileTag return @aTagg + @aDescTag end end ============================= controller file ============================ # POST /file_taggings # POST /file_taggings.json def create @file_tagging = FileTagging.new(file_tagging_params) ##################################################### #rails g scaffold fileTagging filename:string filetag:string filedescription:string # information For logging the file details into table @file_tagging.filename = params[:file_tagging][:filename] @file_tagging.filetag = params[:file_tagging][:filetag] @file_tagging.filedescription = params[:file_tagging][:filedescription] ######################################################################## # information For logging the file details # create an instance/object of a BasicTag myTagg = BasicTag.new # add the extra features to the new car if params[:file_tagging][:filetag].to_s.length > 0 then myTagg = TagDec.new(myTagg) end #if params[:file_tagging][:description].to_s.length > 0 then # myTagg = DescriptionDec.new(myTagg) #end ## populate the Description details - By calling the BASE class and SUPER class as stated above. #Error is here for the call myTagg.detailsFileTag ! @file_tagging.filedescription = myTagg.detailsFileTag # retrieve the instance/object of the MyLogger class logger = MyLogger.instance logger.logInformation("A new file details are: " + @file_tagging.filesdescription) logger.logInformation("A new file details are: ") ##################################################### respond_to do |format| if @file_tagging.save format.html { redirect_to @file_tagging, notice: 'File tagging was successfully created.' } format.json { render :show, status: :created, location: @file_tagging } else format.html { render :new } format.json { render json: @file_tagging.errors, status: :unprocessable_entity } end end end ============================================================
0debug
static void init_proc_620 (CPUPPCState *env) { gen_spr_ne_601(env); gen_spr_620(env); gen_tbl(env); spr_register(env, SPR_HID0, "HID0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); gen_low_BATs(env); gen_high_BATs(env); init_excp_620(env); env->dcache_line_size = 64; env->icache_line_size = 64; ppc6xx_irq_init(env); }
1threat
remove fragment in viewPager2 use FragmentStateAdapter, but still display : <p>I have a viewPager2 and FragmentStateAdapter, and there are Fragement1, 2,3 4, I am in fragment2, and want to remove fragment3, and display fragment4 after fragment2. The problem is it always show me fragment3(data), the debug shows the fragment3 has been removed, but the displayed page still has fragment3 content. </p> <p>Adpter:</p> <pre><code>class TipsAdapter( private val items: MutableList&lt;TripPage&gt;, context: FragmentActivity ) : FragmentStateAdapter(context) { private val fragmentFactory = context.supportFragmentManager.fragmentFactory private val classLoader = context.classLoader override fun getItemCount(): Int = items.size override fun createFragment(position: Int): Fragment { val pageInfo = items[position] val fragment = fragmentFactory.instantiate(classLoader, pageInfo.fragmentClass.name) fragment.arguments = Bundle().also { it.putParcelable(PAGE_INFO, pageInfo) } return fragment } fun getFragmentName(position: Int) = items[position].fragmentClass.simpleName fun removeFragment(position: Int) { items.removeAt(position) notifyItemRemoved(position) notifyItemRangeChanged(position, items.size) notifyDataSetChanged() } </code></pre> <p>}</p> <p>delete fragment code:</p> <pre><code> if ((view_pager.adapter as TipsAdapter).getFragmentName(index + 1).equals( TripPreFragment::class.simpleName) &amp;&amp; viewModel.shouldRemoveBulkApply()) { (view_pager.adapter as TipsAdapter).removeFragment(index + 1) view_pager.setCurrentItem(index + 1, true) } else { view_pager.setCurrentItem(index + 1, true) } </code></pre>
0debug
static int yuv4_read_header(AVFormatContext *s) { char header[MAX_YUV4_HEADER + 10]; char *tokstart, *tokend, *header_end; int i; AVIOContext *pb = s->pb; int width = -1, height = -1, raten = 0, rated = 0, aspectn = 0, aspectd = 0; enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE, alt_pix_fmt = AV_PIX_FMT_NONE; enum AVChromaLocation chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; AVStream *st; enum AVFieldOrder field_order; for (i = 0; i < MAX_YUV4_HEADER; i++) { header[i] = avio_r8(pb); if (header[i] == '\n') { header[i + 1] = 0x20; header[i + 2] = 0; break; } } if (i == MAX_YUV4_HEADER) return -1; if (strncmp(header, Y4M_MAGIC, strlen(Y4M_MAGIC))) return -1; header_end = &header[i + 1]; for (tokstart = &header[strlen(Y4M_MAGIC) + 1]; tokstart < header_end; tokstart++) { if (*tokstart == 0x20) continue; switch (*tokstart++) { case 'W': width = strtol(tokstart, &tokend, 10); tokstart = tokend; break; case 'H': height = strtol(tokstart, &tokend, 10); tokstart = tokend; break; case 'C': if (strncmp("420jpeg", tokstart, 7) == 0) { pix_fmt = AV_PIX_FMT_YUV420P; chroma_sample_location = AVCHROMA_LOC_CENTER; } else if (strncmp("420mpeg2", tokstart, 8) == 0) { pix_fmt = AV_PIX_FMT_YUV420P; chroma_sample_location = AVCHROMA_LOC_LEFT; } else if (strncmp("420paldv", tokstart, 8) == 0) { pix_fmt = AV_PIX_FMT_YUV420P; chroma_sample_location = AVCHROMA_LOC_TOPLEFT; } else if (strncmp("420", tokstart, 3) == 0) { pix_fmt = AV_PIX_FMT_YUV420P; chroma_sample_location = AVCHROMA_LOC_CENTER; } else if (strncmp("411", tokstart, 3) == 0) pix_fmt = AV_PIX_FMT_YUV411P; else if (strncmp("422", tokstart, 3) == 0) pix_fmt = AV_PIX_FMT_YUV422P; else if (strncmp("444alpha", tokstart, 8) == 0 ) { av_log(s, AV_LOG_ERROR, "Cannot handle 4:4:4:4 " "YUV4MPEG stream.\n"); return -1; } else if (strncmp("444", tokstart, 3) == 0) pix_fmt = AV_PIX_FMT_YUV444P; else if (strncmp("mono", tokstart, 4) == 0) { pix_fmt = AV_PIX_FMT_GRAY8; } else { av_log(s, AV_LOG_ERROR, "YUV4MPEG stream contains an unknown " "pixel format.\n"); return -1; } while (tokstart < header_end && *tokstart != 0x20) tokstart++; break; case 'I': switch (*tokstart++){ case '?': field_order = AV_FIELD_UNKNOWN; break; case 'p': field_order = AV_FIELD_PROGRESSIVE; break; case 't': field_order = AV_FIELD_TT; break; case 'b': field_order = AV_FIELD_BB; break; case 'm': av_log(s, AV_LOG_ERROR, "YUV4MPEG stream contains mixed " "interlaced and non-interlaced frames.\n"); return -1; default: av_log(s, AV_LOG_ERROR, "YUV4MPEG has invalid header.\n"); return -1; } break; case 'F': sscanf(tokstart, "%d:%d", &raten, &rated); while (tokstart < header_end && *tokstart != 0x20) tokstart++; break; case 'A': sscanf(tokstart, "%d:%d", &aspectn, &aspectd); while (tokstart < header_end && *tokstart != 0x20) tokstart++; break; case 'X': if (strncmp("YSCSS=", tokstart, 6) == 0) { tokstart += 6; if (strncmp("420JPEG", tokstart, 7) == 0) alt_pix_fmt = AV_PIX_FMT_YUV420P; else if (strncmp("420MPEG2", tokstart, 8) == 0) alt_pix_fmt = AV_PIX_FMT_YUV420P; else if (strncmp("420PALDV", tokstart, 8) == 0) alt_pix_fmt = AV_PIX_FMT_YUV420P; else if (strncmp("411", tokstart, 3) == 0) alt_pix_fmt = AV_PIX_FMT_YUV411P; else if (strncmp("422", tokstart, 3) == 0) alt_pix_fmt = AV_PIX_FMT_YUV422P; else if (strncmp("444", tokstart, 3) == 0) alt_pix_fmt = AV_PIX_FMT_YUV444P; } while (tokstart < header_end && *tokstart != 0x20) tokstart++; break; } } if (width == -1 || height == -1) { av_log(s, AV_LOG_ERROR, "YUV4MPEG has invalid header.\n"); return -1; } if (pix_fmt == AV_PIX_FMT_NONE) { if (alt_pix_fmt == AV_PIX_FMT_NONE) pix_fmt = AV_PIX_FMT_YUV420P; else pix_fmt = alt_pix_fmt; } if (raten <= 0 || rated <= 0) { unknown raten = 25; rated = 1; } if (aspectn == 0 && aspectd == 0) { unknown aspectd = 1; } st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->width = width; st->codec->height = height; av_reduce(&raten, &rated, raten, rated, (1UL << 31) - 1); avpriv_set_pts_info(st, 64, rated, raten); st->avg_frame_rate = av_inv_q(st->time_base); st->codec->pix_fmt = pix_fmt; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_RAWVIDEO; st->sample_aspect_ratio = (AVRational){ aspectn, aspectd }; st->codec->chroma_sample_location = chroma_sample_location; st->codec->field_order = field_order; return 0; }
1threat
static int hls_write_trailer(struct AVFormatContext *s) { HLSContext *hls = s->priv_data; AVFormatContext *oc = hls->avf; av_write_trailer(oc); hls->size = avio_tell(hls->avf->pb) - hls->start_pos; avio_closep(&oc->pb); avformat_free_context(oc); av_free(hls->basename); hls_append_segment(hls, hls->duration, hls->start_pos, hls->size); hls_window(s, 1); hls_free_segments(hls); avio_close(hls->pb); return 0; }
1threat
int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m) { BDRVQcowState *s = bs->opaque; int i, j = 0, l2_index, ret; uint64_t *old_cluster, *l2_table; uint64_t cluster_offset = m->alloc_offset; trace_qcow2_cluster_link_l2(qemu_coroutine_self(), m->nb_clusters); assert(m->nb_clusters > 0); old_cluster = g_malloc(m->nb_clusters * sizeof(uint64_t)); ret = perform_cow(bs, m, &m->cow_start); if (ret < 0) { goto err; } ret = perform_cow(bs, m, &m->cow_end); if (ret < 0) { goto err; } if (s->use_lazy_refcounts) { qcow2_mark_dirty(bs); } if (qcow2_need_accurate_refcounts(s)) { qcow2_cache_set_dependency(bs, s->l2_table_cache, s->refcount_block_cache); } ret = get_cluster_table(bs, m->offset, &l2_table, &l2_index); if (ret < 0) { goto err; } qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table); for (i = 0; i < m->nb_clusters; i++) { if(l2_table[l2_index + i] != 0) old_cluster[j++] = l2_table[l2_index + i]; l2_table[l2_index + i] = cpu_to_be64((cluster_offset + (i << s->cluster_bits)) | QCOW_OFLAG_COPIED); } ret = qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); if (ret < 0) { goto err; } if (j != 0) { for (i = 0; i < j; i++) { qcow2_free_any_clusters(bs, be64_to_cpu(old_cluster[i]), 1, QCOW2_DISCARD_NEVER); } } ret = 0; err: g_free(old_cluster); return ret; }
1threat
Would like to run powershell code from inside a C++ program : I want to be able to run like 30 lines of powershell script from my c++ program. I've heard it's a terrible idea, I don't care. I still would like to know how. I just want to code directly in the c++ program, i do not want to externally call the powershell script. Is there any way to do this? If it's impossible, just say no. For example void runPScode() { //command to tell compiler the following is powershell code //a bunch of powershell code } Thanks! I've looked for commands to do this and have read several 'similar' questions.
0debug
void axisdev88_init (ram_addr_t ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env; struct etraxfs_pic *pic; void *etraxfs_dmac; struct etraxfs_dma_client *eth[2] = {NULL, NULL}; int kernel_size; int i; int nand_regs; int gpio_regs; ram_addr_t phys_ram; ram_addr_t phys_intmem; if (cpu_model == NULL) { cpu_model = "crisv32"; } env = cpu_init(cpu_model); qemu_register_reset(main_cpu_reset, env); phys_ram = qemu_ram_alloc(ram_size); cpu_register_physical_memory(0x40000000, ram_size, phys_ram | IO_MEM_RAM); phys_intmem = qemu_ram_alloc(INTMEM_SIZE); cpu_register_physical_memory(0x38000000, INTMEM_SIZE, phys_intmem | IO_MEM_RAM); nand_state.nand = nand_init(NAND_MFR_STMICRO, 0x39); nand_regs = cpu_register_io_memory(0, nand_read, nand_write, &nand_state); cpu_register_physical_memory(0x10000000, 0x05000000, nand_regs); gpio_state.nand = &nand_state; gpio_regs = cpu_register_io_memory(0, gpio_read, gpio_write, &gpio_state); cpu_register_physical_memory(0x3001a000, 0x5c, gpio_regs); pic = etraxfs_pic_init(env, 0x3001c000); etraxfs_dmac = etraxfs_dmac_init(env, 0x30000000, 10); for (i = 0; i < 10; i++) { etraxfs_dmac_connect(etraxfs_dmac, i, pic->irq + 7 + i, i & 1); } eth[0] = etraxfs_eth_init(&nd_table[0], env, pic->irq + 25, 0x30034000); if (nb_nics > 1) eth[1] = etraxfs_eth_init(&nd_table[1], env, pic->irq + 26, 0x30036000); etraxfs_dmac_connect_client(etraxfs_dmac, 0, eth[0]); etraxfs_dmac_connect_client(etraxfs_dmac, 1, eth[0] + 1); if (eth[1]) { etraxfs_dmac_connect_client(etraxfs_dmac, 6, eth[1]); etraxfs_dmac_connect_client(etraxfs_dmac, 7, eth[1] + 1); } etraxfs_timer_init(env, pic->irq + 0x1b, pic->nmi + 1, 0x3001e000); etraxfs_timer_init(env, pic->irq + 0x1b, pic->nmi + 1, 0x3005e000); for (i = 0; i < 4; i++) { if (serial_hds[i]) { etraxfs_ser_init(env, pic->irq + 0x14 + i, serial_hds[i], 0x30026000 + i * 0x2000); } } if (kernel_filename) { uint64_t entry, high; int kcmdline_len; kernel_size = load_elf(kernel_filename, -0x80000000LL, &entry, NULL, &high); bootstrap_pc = entry; if (kernel_size < 0) { kernel_size = load_image(kernel_filename, phys_ram_base + 0x4000); bootstrap_pc = 0x40004000; env->regs[9] = 0x40004000 + kernel_size; } env->regs[8] = 0x56902387; if (kernel_cmdline && (kcmdline_len = strlen(kernel_cmdline))) { if (kcmdline_len > 256) { fprintf(stderr, "Too long CRIS kernel cmdline (max 256)\n"); exit(1); } pstrcpy_targphys(high, 256, kernel_cmdline); env->regs[10] = 0x87109563; env->regs[11] = high; } } env->pc = bootstrap_pc; printf ("pc =%x\n", env->pc); printf ("ram size =%ld\n", ram_size); }
1threat
Do i always need to use a container/container fluid in bootstrap? : <p>I was watching this video and the instructor said that bootstrap requires us to use a container/container fluid when using the grid system. However, she failed to always use a container even when she used the grid system. If you have 1 row and a bunch of columns that you make responsive, does that mean you are still using the grid system or does there need to be more than 1 row, since thats the case she didnt use a container and i was confused as to why she did not when bootstrap states we should use a container? I am a bit confused as when i should use a container in general and more importantly lets say i do not use a container and just use the grid system, what will end up happening?</p>
0debug
How to add hyperlink in this code? : This is a code to show blinking text on webpages. I want to add a hyperlink to the blinking text. How to do that? <script type="text/javascript"> function blinker() { if(document.getElementById("blink")) { var d = document.getElementById("blink") ; d.style.color= (d.style.color=='red'?'white':'red'); setTimeout('blinker()', 500); } } </script> <body onload="blinker();"> <div id="blink">GOOGLE</div> </body> I want to add www.google.com to that GOOGLE . When a user click on that GOOGLE, google.com should open. How to add a hperlink to the above code? Thanks in advance.
0debug
conditional formating table jquery : I have a quiz with 9 skills, and 1 skill has 2 questions - total 18 questions So when ppl submit the quiz, the result table returns 4 ranges (Rangea,b,c,d). So based on the score, I want to highlight the row for each skill [result table][1] [1]: https://i.stack.imgur.com/rPt5b.png <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> $(document).ready(function($) { var sum = 0; var numberQA = 2 $('.skillA:checkbox').click(function() { sum = 0; $('.skillA:checkbox:checked').each(function(idx, elm) { sum += parseInt(elm.value, 10); }); average = sum / numberQA; $('#totalSkillA').html(average); }); $('tbody tr td:not(":third")').each( function() { var rangeA = 1, rangeB = 2, rangeC = 3, rangeD = 4, score = $(#totalSkillA).value(); if (score < rangeA) { $(#totalSkillA).addClass('avg'); } else if (score < rangeB && score >= rangeA) { $(#totalSkillA).addClass('avg'); } else if (score >= rangeB && score < rangeC) { $(#totalSkillA).addClass('avg'); } else if (score >= rangeC && score <= rangeD) { $(#totalSkillA).addClass('avg'); } }); <!-- language: lang-css --> @charset "UTF-8"; body, td, th, input { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; } .avg { background-color: #060; } .liveSample { background-color: #FFFFCC; color: black; padding: 4px; margin-left: 10px; margin-right: 10px; border: 1px solid #000000; } .demoDiv { background-color: #CCCCCC; width: 2000px; } .highlited { background-color: #FFFFCC; color: #000000; } .grayBG { background-color: #CCCCCC; } pre { font-family: "Courier New", Courier, monospace; background-color: #F0F7FE; padding: 5px; overflow: auto; font-size: 1.1em; margin-left: 10px; margin-right: 10px; border: 1px solid #CCCCCC; } h3 { background-color: #F3F3F3; padding-top: 5px; padding-bottom: 5px; padding-left: 10px; font-size: 100%; line-height: 150%; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #CCCCCC; } h4{ color: #000099; font-variant: small-caps; font-size:120%; } td, th{ border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #CCCCCC; padding-top: 5px; padding-right: 10px; padding-bottom: 5px; padding-left: 10px; } th { background-color: #F3F3F3; vertical-align: top; } a { text-decoration: none; } <!-- language: lang-html --> <form name="readiness" method="post"> Navigate: <a href="#" onclick="sp5.showFirstPanel(); return false;">First</a> | <a href="#" onclick="sp5.showPreviousPanel(); return false;">Previous</a> | <a href="#" onclick="sp5.showNextPanel(); return false;">Next</a> | <a href="#" onclick="sp5.showLastPanel(); return false;">Last</a> </p> <p>&nbsp;</p> <div id="example5" class="SlidingPanels" tabindex="0"> <div class="SlidingPanelsContentGroup"> <div class="SlidingPanelsContent p1"> <div class="demoDiv" style="background-color: #E6E6E6"> <table width="650"> <!-- Skill A --> <!-- Question 1 --> <tr> <td width="400"> <h4>1. My need to take this course now is:</h4> <p><input class="skillA" type="checkbox" value="4" name="q1A" id="q1" onclick="if(this.checked) {document.readiness.q1B.checked=false;document.readiness.q1C.checked=false;document.readiness.q1D.checked=false;} showHide('feedback1', this);"/> A. High. I need it immediately for a specific job goal.</p> <p><input class="skillA" type="checkbox" value="3" name="q1B" id="q1" onclick="if(this.checked) {document.readiness.q1A.checked=false;document.readiness.q1C.checked=false;document.readiness.q1D.checked=false;} showHide('feedback1', this);"/> B. Moderate. I could take it on campus later or substitute another course.</p> <p><input class="skillA" type="checkbox" value="2" name="q1C" id="q1" onclick="if(this.checked) {document.readiness.q1A.checked=false;document.readiness.q1B.checked=false;document.readiness.q1D.checked=false;} showHide('feedback1', this);"/> C. Low. It could be postponed. </p> <p><input class="skillA" type="checkbox" value="1" name="q1D" id="q1" onclick="if(this.checked) {document.readiness.q1A.checked=false;document.readiness.q1B.checked=false;document.readiness.q1C.checked=false;} showHide('feedback1', this);"/> D. Low. It could be postponed. </p> </td> <td width="250"> <div id="feedback1" style="visibility:hidden"> <strong>Why this is important:<br></strong> Generally, the more urgently you need to take an online course, the more motivated you'll be, and therefore more successful. If you have a strong reason for taking an online course, like a job goal, you're more motivated to spend the time to complete it. </div> </td> </tr> <!-- End question 1 --> <!-- Question 2 --> <tr> <td width="400"> <h4>2. Considering my work and personal schedule, the amount of time I have to work on an online course is:</h4> <p><input class="skillA" type="checkbox" value="4" name="q2A" id="q2" onclick="if(this.checked) {document.readiness.q2B.checked=false;document.readiness.q2C.checked=false;document.readiness.q2D.checked=false;} showHide('feedback2', this);" />A. More than for a traditional course at the college.</p> <p><input class="skillA" type="checkbox" value="3" name="q2B" id="q2" onclick="if(this.checked) {document.readiness.q2A.checked=false;document.readiness.q2C.checked=false;document.readiness.q2D.checked=false;} showHide('feedback2', this);" />B. The same as for a traditional course at the college.</p> <p><input class="skillA" type="checkbox" value="2" name="q2C" id="q2" onclick="if(this.checked) {document.readiness.q2A.checked=false;document.readiness.q2B.checked=false;document.readiness.q2D.checked=false;} showHide('feedback2', this);" />C. Less than for a traditional course at the college.</p> <p><input class="skillA" type="checkbox" value="1" name="q2D" id="q2" onclick="if(this.checked) {document.readiness.q2A.checked=false;document.readiness.q2B.checked=false;document.readiness.q2C.checked=false;} showHide('feedback2', this);" />D. Less than for a traditional course at the college.</p> </td> <td width="250"> <div id="feedback2" style="visibility:hidden"> <strong>Why this is important:<br></strong> Allowing more study time while you're taking an online course is a good idea, partly because it may take a while to get used to the way it works, and partly because there's generally more reading and writing to do in online courses. Of course, when you work on your course is up to you. </div> </td> </tr> </div> <!-- End question 2 --> <!-- End Skill A --> <!-- end snippet --> SO if the score is in rangeA, I want the table highlight that section Please help me
0debug
How to summarize the employees by net revenue and not order date? : 8. The sales director would like to reward the employees with net sales over $150,000 for the years 2015 and 2016 combined. The Sales Manager would like the resulting query to display the following columns: Employee ID, Employee Name (First and Last as one field), Total Net Sales per employee. (Both years should be combined into one number.) [enter image description here][1]Sort largest to smallest. We cannot figure out how to combine the revenues by the employees. select o.EmpID, EmpFName + ' ' + EmpLastName as "Employee Name", sum((salesunitprice*quantitysold)-((salesunitprice*quantitysold)*ItemDiscount)) as "Net Sales" from EMPLOYEE e inner join ORDERS o on e.EmpID=o.EmpID inner join SALES_INVOICE si on o.OrderID=si.OrderID inner join SALES_INVOICE_DETAIL sd on si.SalesInvoiceID=sd.SalesInvoiceID group by o.EmpID, EmpFName + ' ' + EmpLastName, OrderDate having OrderDate between '2015-01-01' and '2016-12-31' order by [Employee Name] I expected the output to be the total per employee, but it is broken out by individual order dates instead of summing the total net sales per employee. Please help! [1]: https://i.stack.imgur.com/MEkfH.png
0debug
static void register_subpage(MemoryRegionSection *section) { subpage_t *subpage; target_phys_addr_t base = section->offset_within_address_space & TARGET_PAGE_MASK; MemoryRegionSection *existing = phys_page_find(base >> TARGET_PAGE_BITS); MemoryRegionSection subsection = { .offset_within_address_space = base, .size = TARGET_PAGE_SIZE, }; target_phys_addr_t start, end; assert(existing->mr->subpage || existing->mr == &io_mem_unassigned); if (!(existing->mr->subpage)) { subpage = subpage_init(base); subsection.mr = &subpage->iomem; phys_page_set(base >> TARGET_PAGE_BITS, 1, phys_section_add(&subsection)); } else { subpage = container_of(existing->mr, subpage_t, iomem); } start = section->offset_within_address_space & ~TARGET_PAGE_MASK; end = start + section->size; subpage_register(subpage, start, end, phys_section_add(section)); }
1threat
How to use windows authentication with SQL server docker container : <p>I have gone through all the examples I could find online for building docker container based applications. I would want to run two services running in two docker containers: </p> <ol> <li>A windows container running ASP.NET</li> <li>A windows container running SQL Server</li> </ol> <p>Easy job and many examples. However, in all examples you need to use SQL authentication and to provide a hard-coded SA password as an environment variable when running the SQL server container. You also need to hard code the SA password into the connection string in the ASP.Net code (or also provide it in some other manner in a configuration file, etc.) </p> <p>Bottom line in all examples the password is hard-coded somewhere. </p> <p>In most applications we develop now, we actually use windows authentication instead or use a grouped managed service account instead. But as far as I know, you cannot add a windows container to a domain, thus the SQL server is not part of the windows domain so I don't see a way to use windows authentication here.</p> <p>So does any one have an alternative to hard-coding passwords this way ? </p>
0debug
JAVA - Create object from generic class : I want to create objects from different classes extending the same class. Can you explain how it will work. Examples would be nice. Thank you. class MainClass{ private <T extends DataPoint> void someMethod(Class<T> clazz) { new clazz();//<-- create object of class (did not work) } private void anotherClass(){ someMethod(GreenDataPoint.class); someMethod(BlueDataPoint.class); } } class DataPoint {...} class BlueDataPoint extends DataPoint {...} class GreenDataPoint extends DataPoint {...}
0debug
Keycodes alt shift number : I am trying to use ALT + SHIFT + number. I have tried: if (e.which === 18 && e.which === 16 && e.which === 49) { //DO SOMETHING } if (e.altKey && ( e.which === 16 ) && ( e.which === 49 )) { //DO SOMETHING } if (e.which === 18) && (e.which === 16) && e.which === 49) { //DO SOMETHING } None of them work. Can someone show me how to combine these keys please.
0debug
static av_cold int libgsm_encode_init(AVCodecContext *avctx) { if (avctx->channels > 1) { av_log(avctx, AV_LOG_ERROR, "Mono required for GSM, got %d channels\n", avctx->channels); return -1; if (avctx->sample_rate != 8000) { av_log(avctx, AV_LOG_ERROR, "Sample rate 8000Hz required for GSM, got %dHz\n", avctx->sample_rate); if (avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) return -1; if (avctx->bit_rate != 13000 && avctx->bit_rate != 13200 && avctx->bit_rate != 0 ) { av_log(avctx, AV_LOG_ERROR, "Bitrate 13000bps required for GSM, got %dbps\n", avctx->bit_rate); if (avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) return -1; avctx->priv_data = gsm_create(); switch(avctx->codec_id) { case CODEC_ID_GSM: avctx->frame_size = GSM_FRAME_SIZE; avctx->block_align = GSM_BLOCK_SIZE; break; case CODEC_ID_GSM_MS: { int one = 1; gsm_option(avctx->priv_data, GSM_OPT_WAV49, &one); avctx->frame_size = 2*GSM_FRAME_SIZE; avctx->block_align = GSM_MS_BLOCK_SIZE; avctx->coded_frame= avcodec_alloc_frame(); return 0;
1threat
Vuex store state is undefined : <p>I am trying to use <code>Vuex ("^2.1.3")</code> with <code>vuejs ("^2.1.10")</code> project in this way:</p> <p>store.js:</p> <pre><code>import Vue from 'vue'; import Vuex from 'vuex'; Vue.use(Vuex); export const store = new Vuex.Store({ state: { inTheaters: [ { name: 'Resident Evil: The Final Chapter', poster_url: 'https://blackgirlnerds.com/wp-content/uploads/2017/02/Resident-Evil-The-Final-Chapter-Final-Poster-Featured.jpg', language: 'English', }, { name: 'Irada', poster_url: 'http://filmywave.com/wp-content/uploads/2017/02/irada-movie-poster-1.jpg', language: 'Hindi', }, ] }, }); </code></pre> <p>main.js:</p> <pre><code>import store from './store'; new Vue({ router, components: {App}, template: '&lt;App/&gt;', store, }).$mount('#app'); </code></pre> <p>some-component.js:</p> <pre><code>&lt;script&gt; export default { name: 'movieListWrapper', props: { movieListType: { type: String, default: 'in-theateras', }, }, computed: { movieList() { return this.$store.state.inTheaters; } }, } &lt;/script&gt; </code></pre> <p>I now have two problems:</p> <ol> <li>First is I get a warning in my console </li> </ol> <blockquote> <p>"export 'default' (imported as 'store') was not found in './store'</p> </blockquote> <ol start="2"> <li>The other problem is that the <code>state</code> is not defined.</li> </ol> <blockquote> <p>Uncaught TypeError: Cannot read property 'state' of undefined</p> </blockquote> <p>I am very new to this and may be I am missing some thing so please pardon me. What am I missing?</p>
0debug