problem
stringlengths
26
131k
labels
class label
2 classes
How to get URL after equal in TypeScript : <p>I need to get this token that is in the url, to send to db later</p> <pre><code>mysite.com/changePassword?token=45456112241121131154 </code></pre> <p>Thanks for any help </p>
0debug
Android - Which Button was pressed first? : I need a way to know which of my buttons was pressed first. The app layout is more or less like this.: Button1 Button2 Button3 Button4 Button5 Button6 Button7 Button8 Button9 Button10 Button11 Button12 And if one of the buttons of it's "line" is pressed, the other disappears. The thing is, I have no idea how to know which one of all these 12 buttons was pressed first, then pressed second, then pressed third and so on... The code I have for hiding buttons works well, but that's pretty much the easy part. button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { button1.setVisibility(View.GONE); button2.setVisibility(View.GONE); } }); I searched but maybe I don't know what exactly to search for, and I didn't find a good answer. Thanks in advance!
0debug
How to make child z-index more than parent or any other way to achieve the effect? : <p><a href="https://i.stack.imgur.com/oq7q1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oq7q1.png" alt="a "></a></p> <p>I'm trying to develop the following effect. Where parents are two sections like this and child is an image. How to achieve this without using absolute?</p> <pre><code>&lt;section&gt; &lt;img /&gt; &lt;/section &lt;section&gt; ..more content &lt;/section&gt; </code></pre> <p>But I got to know that child's z-index cannot be more than parent than whats the way round this?</p>
0debug
Conversion of C# code to Delphi code (if condition) : <p>I'm converting a C# project to Delphi and am struggling with this C# code:</p> <pre><code>if (!String.IsNullOrEmpty(myItem.mySubItem?.Content) &amp;&amp; (myItem.Quantity == 0) &amp;&amp; (String.IsNullOrEmpty(myItem.Description))) { continue; } </code></pre> <p>From my understanding the Delphi code should look like this:</p> <pre><code>if assigned(myItem.mySubItem) and (length(trim(myItem.mySubItem.Content)) &gt; 0) and (myItem.Quantity = 0) and (length(trim(myItem.Description)) = 0) then begin Continue; end; </code></pre> <p>But I'm not 100% sure, because logically it doesn't make sense. That's another story though. My question is: is my Delphi code a correct conversion of the quoted C# code?</p> <p>In case it's wrong, what would be the correct code?</p>
0debug
How to install Perl on macOS 10.13 High Sierra : <p>I recently upgraded to macOS 10.13 High Sierra and shortly after encountered a problem attempting to install a more recent version of Perl (5.26.1). The gist of the problem is that the self-tests for <code>cpan/DB_File</code> consistently failed on macOS 10.13 High Sierra (home laptop) but succeeded on macOS 10.12 Sierra (work laptop). </p> <p>Here's the section of the installation log showing the failure:</p> <pre><code>../cpan/Config-Perl-V/t/30_plv5240.t ............................... ok ../cpan/Config-Perl-V/t/31_plv52511.t .............................. ok ../cpan/DB_File/t/db-btree.t ....................................... ok Use of uninitialized value $value in string eq at t/db-hash.t line 224. Use of uninitialized value $values[0] in string eq at t/db-hash.t line 224. Use of uninitialized value $value in lc at t/db-hash.t line 224. Use of uninitialized value $h{""} in string eq at t/db-hash.t line 243. Use of uninitialized value in numeric eq (==) at t/db-hash.t line 252. Use of uninitialized value in numeric eq (==) at t/db-hash.t line 252. Use of uninitialized value in numeric eq (==) at t/db-hash.t line 252. Use of uninitialized value in numeric eq (==) at t/db-hash.t line 252. Use of uninitialized value in numeric eq (==) at t/db-hash.t line 252. Use of uninitialized value in numeric eq (==) at t/db-hash.t line 252. Use of uninitialized value in numeric eq (==) at t/db-hash.t line 252. Use of uninitialized value in numeric eq (==) at t/db-hash.t line 252. Use of uninitialized value $foo[18] in join or string at t/db-hash.t line 261. Use of uninitialized value $foo[36] in join or string at t/db-hash.t line 261. Use of uninitialized value $foo[48] in join or string at t/db-hash.t line 261. Use of uninitialized value $foo[58] in join or string at t/db-hash.t line 261. Use of uninitialized value $foo[59] in join or string at t/db-hash.t line 261. Use of uninitialized value $foo[60] in join or string at t/db-hash.t line 261. Use of uninitialized value $foo[62] in join or string at t/db-hash.t line 261. Use of uninitialized value $foo[63] in join or string at t/db-hash.t line 261. Use of uninitialized value $foo[92] in join or string at t/db-hash.t line 261. Use of uninitialized value $foo[114] in join or string at t/db-hash.t line 261. Use of uninitialized value $foo[140] in join or string at t/db-hash.t line 261. Use of uninitialized value $foo[187] in join or string at t/db-hash.t line 261. Use of uninitialized value $foo[188] in join or string at t/db-hash.t line 261. Use of uninitialized value $foo[189] in join or string at t/db-hash.t line 261. Use of uninitialized value $h{"Fred"} in string eq at t/db-hash.t line 572. Use of uninitialized value $v in concatenation (.) or string at t/db-hash.t line 748. ../cpan/DB_File/t/db-hash.t ........................................ Dubious, test returned 2 (wstat 512, 0x200) Failed 76/166 subtests </code></pre> <p>I was able to repeat this same failure whether installing using <code>perlbrew install perl-5.26.1</code> or simply downloading <a href="http://www.cpan.org/src/5.0/perl-5.26.1.tar.gz" rel="noreferrer">the Perl tarfile</a> and installing manually. When I try to debug the test in question <code>t/db-hash.t</code>, I can see that the test hash <code>%h</code> is created and is being populated in the test file, but when I <code>print Dumper(\%h)</code> I see that the hash looks to have the right keys, but <em>all</em> of the values are <code>undef</code>, rather than the values being assigned in the test script. </p> <p>These <code>undef</code> values are causing the test failure. Oddly, the undefined values show up when I print the whole hash or try to make an array of the hash values. If I ask for a specific hash key's value, e.g. <code>my $value = $h{key}</code>, the value prints fine.</p> <p>Questions:</p> <ul> <li>How to fix this so that I can install a new Perl on macOS 10.13?</li> <li>What broke? This used to work on macOS 10.12.</li> </ul>
0debug
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size) { if (h->flags & AVIO_FLAG_WRITE) return AVERROR(EIO); return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read); }
1threat
In mysql ,I cann't create the table,it say that erros code:1005. there are some Chiese annotation : CREATE DATABASE bookstore; /*用户表*/ CREATE TABLE tb_user( uid CHAR(32) PRIMARY KEY,/*主键*/ username VARCHAR(50) NOT NULL,/*用户名*/ `password` VARCHAR(50) NOT NULL,/*密码*/ email VARCHAR(50) NOT NULL,/*邮箱*/ `code` CHAR(64) NOT NULL,/*激活码*/ state BOOLEAN/*用户状态,有两种是否激活*/ ); /*分类*/ CREATE TABLE category ( cid CHAR(32) PRIMARY KEY,/*主键*/ cname VARCHAR(100) NOT NULL/*分类名称*/ ); INSERT INTO category(cid,cname) VALUES ('1','JavaSE'); INSERT INTO category(cid,cname) VALUES ('2','JavaEE'); INSERT INTO category(cid,cname) VALUES ('3','Javascript'); /*图书表*/ CREATE TABLE book ( bid CHAR(32) PRIMARY KEY,/*主键*/ bname VARCHAR(100),/*图书名*/ price DECIMAL(5,1),/*单价*/ author VARCHAR(20),/*作者*/ image VARCHAR(200),/*图片*/ cid CHAR(32),/*所属分类*/ FOREIGN KEY (cid) REFERENCES category(cid)/*建立主外键关系*/ ); INSERT INTO book VALUES ('1','Java编程思想(第4版)','75.6','qdmmy6','book_img/9317290-1_l.jpg','1'); INSERT INTO book VALUES ('2','Java核心技术卷1','68.5','qdmmy6','book_img/20285763-1_l.jpg','1'); INSERT INTO book VALUES ('3','Java就业培训教程','39.9','张孝祥','book_img/8758723-1_l.jpg','1'); INSERT INTO book VALUES ('4','Head First java','47.5','(美)塞若','book_img/9265169-1_l.jpg','1'); INSERT INTO book VALUES ('5','JavaWeb开发详解','83.3','孙鑫','book_img/22788412-1_l.jpg','2'); INSERT INTO book VALUES ('6','Struts2深入详解','63.2','孙鑫','book_img/20385925-1_l.jpg','2'); INSERT INTO book VALUES ('7','精通Hibernate','30.0','孙卫琴','book_img/8991366-1_l.jpg','2'); INSERT INTO book VALUES ('8','精通Spring2.x','63.2','陈华雄','book_img/20029394-1_l.jpg','2'); INSERT INTO book VALUES ('9','Javascript权威指南','93.6','(美)弗兰纳根','book_img/22722790-1_l.jpg','3'); SELECT * FROM book; /*订单表*/ CREATE TABLE orders ( oid CHAR(32) PRIMARY KEY,/*主键*/ ordertime DATETIME,/*订单生成时间*/ total DECIMAL(10,0),/*订单合计*/ state SMALLINT(1),/*订单状态:未付款、已付款但未发货、已发货但未确认收货、收货已结束*/ uid CHAR(32),/*订单的主人*/ address VARCHAR(200),/*订单的收货地址*/ FOREIGN KEY (uid) REFERENCES USER (uid)/*建立主外键关系*/ ); SELECT * FROM orders; /*订单项表*/ CREATE TABLE orderitem ( iid CHAR(32) PRIMARY KEY,/*主键*/ COUNT INT,/*数量*/ subtotal DECIMAL(10,0),/*小计*/ oid CHAR(32),/*所属订单*/ bid CHAR(32),/*订单项所指的商品*/ FOREIGN KEY (oid) REFERENCES orders (oid),/*建立主外键关系*/ FOREIGN KEY (bid) REFERENCES book (bid)/*建立主外键关系*/ ); the erros messages: 共 1 行受到影响 执行耗时 : 0.003 sec 传送时间 : 2.045 sec 总耗时 : 2.048 sec -------------------------------------------------- 共 0 行受到影响 执行耗时 : 0.049 sec 传送时间 : 0.010 sec 总耗时 : 0.060 sec -------------------------------------------------- 共 0 行受到影响 执行耗时 : 0.025 sec 传送时间 : 1.022 sec 总耗时 : 1.048 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.094 sec 传送时间 : 0 sec 总耗时 : 0.095 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.059 sec 传送时间 : 0 sec 总耗时 : 0.060 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.044 sec 传送时间 : 0 sec 总耗时 : 0.045 sec -------------------------------------------------- 共 0 行受到影响 执行耗时 : 0.007 sec 传送时间 : 0.051 sec 总耗时 : 0.059 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.060 sec 传送时间 : 0 sec 总耗时 : 0.061 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.092 sec 传送时间 : 0 sec 总耗时 : 0.093 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.075 sec 传送时间 : 0 sec 总耗时 : 0.076 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.045 sec 传送时间 : 0 sec 总耗时 : 0.046 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.010 sec 传送时间 : 0 sec 总耗时 : 0.011 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.075 sec 传送时间 : 0 sec 总耗时 : 0.075 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.011 sec 传送时间 : 0 sec 总耗时 : 0.012 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.074 sec 传送时间 : 0 sec 总耗时 : 0.075 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.097 sec 传送时间 : 0 sec 总耗时 : 0.097 sec -------------------------------------------------- 返回了 9 行 执行耗时 : 0.001 sec 传送时间 : 0 sec 总耗时 : 0.001 sec -------------------------------------------------- 查询:/*订单表*/ CREATE TABLE orders ( oid CHAR(32) PRIMARY KEY,/*主键*/ ordertime DATETIME,/*订单生成时间*/ total DECIMAL(... 错误代码: 1005 Can't create table 'bookstore.orders' (errno: 150) 执行耗时 : 0 sec 传送时间 : 0 sec 总耗时 : 0.025 sec -------------------------------------------------- 查询:SELECT * FROM orders LIMIT 0, 1000 错误代码: 1146 Table 'bookstore.orders' doesn't exist 执行耗时 : 0 sec 传送时间 : 0 sec 总耗时 : 0.001 sec -------------------------------------------------- 查询:/*订单项表*/ CREATE TABLE orderitem ( iid CHAR(32) PRIMARY KEY,/*主键*/ COUNT INT,/*数量*/ subtotal DECIMAL(10,0),/*小议. 错误代码: 1005 Can't create table 'bookstore.orderitem' (errno: 150) 执行耗时 : 0 sec 传送时间 : 0 sec 总耗时 : 0.056 sec -------------------------------------------------- 查询:SELECT * FROM orderitem LIMIT 0, 1000 错误代码: 1146 Table 'bookstore.orderitem' doesn't exist 执行耗时 : 0 sec 传送时间 : 0 sec 总耗时 : 0 sec What should I solve it?
0debug
Cannot use 'Microsoft.AspNet.OData.Routing.ODataRoute' with Endpoint Routing.' Exception with ASP Net Core 2.2 : <p>After upgrading the ASP NET Web API project framework to the Core 2.2 version, the OData route configuration fails. It throws "Cannot use 'Microsoft.AspNet.OData.Routing.ODataRoute' with Endpoint Routing." Exception.</p> <p>The link <a href="https://github.com/Microsoft/aspnet-api-versioning/issues/361" rel="noreferrer">https://github.com/Microsoft/aspnet-api-versioning/issues/361</a> shows how to avoid the exception but disabling the new Core 2.2 routing model. Can you tell me how to solve the problem without deactivating this functionality?</p> <pre><code> public IServiceProvider ConfigureServices(IServiceCollection services) { ... services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2).AddControllersAsServices(); ... } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { ... app.UseMvc(b =&gt; { b.Select().Expand().Filter().OrderBy().MaxTop(100).Count(); b.MapODataServiceRoute("odata", "odata", ODataConfig.GetEdmModel()); }); } </code></pre>
0debug
Async/await in List.forEach() : <p>I'm writting some kind of bot (command line application) and I'm having trouble with async execution when I'm using "forEach" method. Here is a simplified code of what I'm trying to do : </p> <pre><code>main() async { print("main start"); await asyncOne(); print("main end"); } asyncOne() async { print("asyncOne start"); [1, 2, 3].forEach(await (num) async { await asyncTwo(num); }); print("asyncOne end"); } asyncTwo(num) async { print("asyncTwo #${num}"); } </code></pre> <p>And here is the output :</p> <pre><code>main start asyncOne start asyncOne end main end asyncTwo #1 asyncTwo #2 asyncTwo #3 </code></pre> <p>What I'm trying to get is :</p> <pre><code>main start asyncOne start asyncTwo #1 asyncTwo #2 asyncTwo #3 asyncOne end main end </code></pre> <p>If someone know what I'm doing wrong I would appreciate it.</p>
0debug
`return` in Ruby Array#map : <p>I have a method where I would like to decide what to return within a map function. I am aware that this can be done with assigning a variable, but this is how I though I could do it;</p> <pre><code>def some_method(array) array.map do |x| if x &gt; 10 return x+1 #or whatever else return x-1 end end end </code></pre> <p>This does not work as I expect because the first time <code>return</code> is hit, it returns from the method, and not in the map function, similar to how the return is used in javascript's map function.</p> <p>Is there a way to achieve my desired syntax? Or do I need to assign this to a variable, and leave it hanging at the end like this:</p> <pre><code>def some_method(array) array.map do |x| returnme = x-1 if x &gt; 10 returnme = x+1 #or whatever end returnme end end </code></pre>
0debug
pointer to struct C programming : I am having a problem with pointers. this is an example of what I want struct Book { char name[10]; int price; } int main() { struct Book b[10]; //Array of structure variables struct Book* p; //Pointer of Structure type p = &b; --- HERE is the ERROR } This is the error part p = &b;
0debug
GitLab CI Start job manually (deployment) : <p>Is it possible to mark gitlab ci jobs to start manually?</p> <p>I need it for deploying application but I want to decide if it's going to be deployed</p>
0debug
Nodejs/Express: Error: Failed to lookup view "error" in views directory : <p>I switched my nodejs template engine over to ejs (from jade). When I run my app.js with my ejs template, I receive a series of "Failed to lookup view 'error' in views" logs.</p> <p>Some of which include:</p> <pre><code>GET /css/bootstrap.min.css 500 12.588 ms - 1390 Error: Failed to lookup view "error" in views directory ... GET /css/clean-blog.min.css Error: Failed to lookup view "error" in views directory ... GET /js/bootstrap.min.js Error: Failed to lookup view "error" in views directory ... GET /js/jquery.js Error: Failed to lookup view "error" in views directory </code></pre> <p>Thing is, many of these dependencies are included in the template itself (included via script tags). What is the proper place to get these to work in express? It seems like express ultimately should not be looking for these in the <code>views</code> folder (since they aren't views).</p>
0debug
jQuery preventing from submission : My html <p><select name="status" class="form-control" id="showThisItem"> <option value=""> Select Status </option> <option value="Paid"> Paid </option> <option value="Unpaid"> Unpaid </option> </select></p> <td id="showHide"> <label>Due Date</label> <input type="text" name="due_date" class="form-control" data-date-format="mm/dd/yy" id="datepicker" required="true"> </td> My jquery code <script> $('#showHide').hide(500); var showThis = $('#showThisItem'); var select = this.value; showThis.change(function () { if ($(this).val() == 'Unpaid') { $('#showHide').show(500); } else { $('#showHide').hide(500); } }); </script> I have used this jquery code to hide and show a td element. When i will select "paid" the td will not show and when i will select Unpaid then the td will show. By default it will hide on page load. However, if i select Unpaid then , i can submit the form and if i select Paid the submit button does not work. Do not give me down vote for my question as i'm not so expert and I am new to this forum. Sorry for my bad English. Please give me a suggestion! Thank you for your time!
0debug
How to Pass extra parameters to a custom UIView class for initialization in swift : <p>I'm trying to write a class that is of type UIView, but on initialization I want it to take an extra parameter, but I can't figure out how to get around the UIView needing its params instead. Any help is much appreciated!</p> <pre><code>class MenuBar: UIView { let homeController: HomeController init(controller: HomeController){ homeController = controller super.init() } override init(frame: CGRect) { super.init(frame: frame) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } } </code></pre> <p>In the ViewController I'm initializing it like this:</p> <pre><code>let menuBar: MenuBar = { let mb = MenuBar(controller: self) return mb }() </code></pre>
0debug
static int qemu_rdma_write_one(QEMUFile *f, RDMAContext *rdma, int current_index, uint64_t current_addr, uint64_t length) { struct ibv_sge sge; struct ibv_send_wr send_wr = { 0 }; struct ibv_send_wr *bad_wr; int reg_result_idx, ret, count = 0; uint64_t chunk, chunks; uint8_t *chunk_start, *chunk_end; RDMALocalBlock *block = &(rdma->local_ram_blocks.block[current_index]); RDMARegister reg; RDMARegisterResult *reg_result; RDMAControlHeader resp = { .type = RDMA_CONTROL_REGISTER_RESULT }; RDMAControlHeader head = { .len = sizeof(RDMARegister), .type = RDMA_CONTROL_REGISTER_REQUEST, .repeat = 1, }; retry: sge.addr = (uint64_t)(block->local_host_addr + (current_addr - block->offset)); sge.length = length; chunk = ram_chunk_index(block->local_host_addr, (uint8_t *) sge.addr); chunk_start = ram_chunk_start(block, chunk); if (block->is_ram_block) { chunks = length / (1UL << RDMA_REG_CHUNK_SHIFT); if (chunks && ((length % (1UL << RDMA_REG_CHUNK_SHIFT)) == 0)) { chunks--; } } else { chunks = block->length / (1UL << RDMA_REG_CHUNK_SHIFT); if (chunks && ((block->length % (1UL << RDMA_REG_CHUNK_SHIFT)) == 0)) { chunks--; } } DDPRINTF("Writing %" PRIu64 " chunks, (%" PRIu64 " MB)\n", chunks + 1, (chunks + 1) * (1UL << RDMA_REG_CHUNK_SHIFT) / 1024 / 1024); chunk_end = ram_chunk_end(block, chunk + chunks); if (!rdma->pin_all) { #ifdef RDMA_UNREGISTRATION_EXAMPLE qemu_rdma_unregister_waiting(rdma); #endif } while (test_bit(chunk, block->transit_bitmap)) { (void)count; DDPRINTF("(%d) Not clobbering: block: %d chunk %" PRIu64 " current %" PRIu64 " len %" PRIu64 " %d %d\n", count++, current_index, chunk, sge.addr, length, rdma->nb_sent, block->nb_chunks); ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE, NULL); if (ret < 0) { fprintf(stderr, "Failed to Wait for previous write to complete " "block %d chunk %" PRIu64 " current %" PRIu64 " len %" PRIu64 " %d\n", current_index, chunk, sge.addr, length, rdma->nb_sent); return ret; } } if (!rdma->pin_all || !block->is_ram_block) { if (!block->remote_keys[chunk]) { if (can_use_buffer_find_nonzero_offset((void *)sge.addr, length) && buffer_find_nonzero_offset((void *)sge.addr, length) == length) { RDMACompress comp = { .offset = current_addr, .value = 0, .block_idx = current_index, .length = length, }; head.len = sizeof(comp); head.type = RDMA_CONTROL_COMPRESS; DDPRINTF("Entire chunk is zero, sending compress: %" PRIu64 " for %d " "bytes, index: %d, offset: %" PRId64 "...\n", chunk, sge.length, current_index, current_addr); compress_to_network(&comp); ret = qemu_rdma_exchange_send(rdma, &head, (uint8_t *) &comp, NULL, NULL, NULL); if (ret < 0) { return -EIO; } acct_update_position(f, sge.length, true); return 1; } reg.current_index = current_index; if (block->is_ram_block) { reg.key.current_addr = current_addr; } else { reg.key.chunk = chunk; } reg.chunks = chunks; DDPRINTF("Sending registration request chunk %" PRIu64 " for %d " "bytes, index: %d, offset: %" PRId64 "...\n", chunk, sge.length, current_index, current_addr); register_to_network(&reg); ret = qemu_rdma_exchange_send(rdma, &head, (uint8_t *) &reg, &resp, &reg_result_idx, NULL); if (ret < 0) { return ret; } if (qemu_rdma_register_and_get_keys(rdma, block, (uint8_t *) sge.addr, &sge.lkey, NULL, chunk, chunk_start, chunk_end)) { fprintf(stderr, "cannot get lkey!\n"); return -EINVAL; } reg_result = (RDMARegisterResult *) rdma->wr_data[reg_result_idx].control_curr; network_to_result(reg_result); DDPRINTF("Received registration result:" " my key: %x their key %x, chunk %" PRIu64 "\n", block->remote_keys[chunk], reg_result->rkey, chunk); block->remote_keys[chunk] = reg_result->rkey; block->remote_host_addr = reg_result->host_addr; } else { if (qemu_rdma_register_and_get_keys(rdma, block, (uint8_t *)sge.addr, &sge.lkey, NULL, chunk, chunk_start, chunk_end)) { fprintf(stderr, "cannot get lkey!\n"); return -EINVAL; } } send_wr.wr.rdma.rkey = block->remote_keys[chunk]; } else { send_wr.wr.rdma.rkey = block->remote_rkey; if (qemu_rdma_register_and_get_keys(rdma, block, (uint8_t *)sge.addr, &sge.lkey, NULL, chunk, chunk_start, chunk_end)) { fprintf(stderr, "cannot get lkey!\n"); return -EINVAL; } } send_wr.wr_id = qemu_rdma_make_wrid(RDMA_WRID_RDMA_WRITE, current_index, chunk); send_wr.opcode = IBV_WR_RDMA_WRITE; send_wr.send_flags = IBV_SEND_SIGNALED; send_wr.sg_list = &sge; send_wr.num_sge = 1; send_wr.wr.rdma.remote_addr = block->remote_host_addr + (current_addr - block->offset); DDDPRINTF("Posting chunk: %" PRIu64 ", addr: %lx" " remote: %lx, bytes %" PRIu32 "\n", chunk, sge.addr, send_wr.wr.rdma.remote_addr, sge.length); ret = ibv_post_send(rdma->qp, &send_wr, &bad_wr); if (ret == ENOMEM) { DDPRINTF("send queue is full. wait a little....\n"); ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE, NULL); if (ret < 0) { fprintf(stderr, "rdma migration: failed to make " "room in full send queue! %d\n", ret); return ret; } goto retry; } else if (ret > 0) { perror("rdma migration: post rdma write failed"); return -ret; } set_bit(chunk, block->transit_bitmap); acct_update_position(f, sge.length, false); rdma->total_writes++; return 0; }
1threat
BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs, const char *child_name, const BdrvChildRole *child_role, void *opaque) { BdrvChild *child = g_new(BdrvChild, 1); *child = (BdrvChild) { .bs = NULL, .name = g_strdup(child_name), .role = child_role, .opaque = opaque, }; bdrv_replace_child(child, child_bs); return child; }
1threat
Why am I getting an unexpected "}" syntax error in php file : <p>I'm making a sign up form for my website, I have created my db and wrote my html and php code but I keep getting this error: "Parse error: syntax error, unexpected '}' in D:\XAMPP\htdocs\example\boosie.php on line 73". If I remove it my file wont run on my browser, will just keep loading. Not sure what else is wrong, anything will help me!</p> <pre><code>&lt;?php $mysqli = new mysqli("127.0.0.1:3307", "root", "", "boosie"); if (mysqli_connect_error()) { echo mysqli_connect_error(); exit; } // The (?,?,?) below are parameter markers used for variable binding if(isset($_POST['submit'])){ $sql = "INSERT INTO Signup (First_Name, Last_Name, Email, Password, Re_Password) VALUES (?,?,?,?,?)"; $stmt = $mysqli-&gt;prepare($sql); $stmt-&gt;bind_param("sssss", $First_Name, $Last_Name, $Email, $Password, $Re_Password); // bind variables $First_Name = $_POST['First_Name']; $Last_Name = $_POST['Last_Name']; $Email = $_POST['Email']; $Password = $_POST['Password']; $Re_Password = $_POST['Re_Password']; $result=$stmt-&gt;execute(); // execute the prepared statement echo "New records created successfully "; $stmt-&gt;close(); // close the prepared statement $mysqli-&gt;close(); // close the database connection }else ?&gt; { &lt;html&gt; &lt;head&gt; &lt;title&gt; Signup Form Design Tutorial &lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="style.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="login-box"&gt; &lt;div class="left-box"&gt; &lt;h1&gt; Sign Up&lt;/h1&gt; &lt;form method="post" action="boosie.php"&gt; &lt;input type="text" name="First_Name" placeholder="First_Name"/&gt; &lt;input type="text" name="Last_Name" placeholder="Last_Name"/&gt; &lt;input type="email" name="Email" placeholder="Email"/&gt; &lt;input type="password" name="Password" placeholder="Password"/&gt; &lt;input type="password" name="Re_Password" placeholder="Retype Password"/&gt; &lt;input type="submit" name="signup-button" value="Sign Up"/&gt; &lt;/form&gt; &lt;/div&gt; &lt;div class="right-box"&gt; &lt;span class="signinwith"&gt;Sign in with&lt;br/&gt;Social Network &lt;/span&gt; &lt;button class="social facebook"&gt;Log in with Facebook&lt;/button&gt; &lt;button class="social twitter"&gt;Log in with Twitter&lt;/button&gt; &lt;button class="social google"&gt;Log in with Google+&lt;/button&gt; &lt;/div&gt; &lt;div class="or"&gt;OR&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; &lt;?php } ?&gt; </code></pre>
0debug
Android databinding: set default visibility in xml : <p>I show items in recyclerview and use <strong>databinding</strong>. In xml layout I has such view:</p> <pre><code> &lt;include android:visibility="@{viewmodel.expandable ? View.VISIBLE : View.GONE}" bind:viewmodel="@{viewmodel}" layout="@layout/full_station_layout"/&gt; </code></pre> <p>It works well but I has one issue: while recyclerview initializing and bind items to views this layout flashes once on the screen although initial value viewmodel.expandable is false. So, I decided temporary hide this layout and tried using <strong>default</strong>-parameter in xml like this:</p> <pre><code> &lt;include android:visibility="@{viewmodel.expandable ? View.VISIBLE : View.GONE, default=View.GONE}" bind:viewmodel="@{viewmodel}" layout="@layout/full_station_layout"/&gt; </code></pre> <p>But something went wrong:</p> <pre><code>error: 'View' is incompatible with attribute android:visibility (attr) enum [gone=2, invisible=1, visible=0]. </code></pre> <p>So, or I incorrectly use this parameter or Google remove this keyword from xml databinding rules (I've seen example of usage <strong>default</strong>-keyword in xml on Google developers before, but now I couldn't)</p>
0debug
how can I retrieve values from Nsmutable array having object with multiple values : I am beginner in objective-c/IOS development, I have an NsMutablearray that has say 4 objects, and each object has further elements in it, I Want to retrieve those elements i.e. Object at index 0 has 15 values( Ns strings) same is for rest of the 3 objects I don't know the syntax of how can I read the values below syntax I have tried gives me error for(int i=0;i<[array count]; i++) { for (int j=0;j<[array[i] count]; j++) { /// reading code here } }
0debug
Uncaught SyntaxError: Unexpected token return in Chrome console : <p>Stupid question, but why does:</p> <pre><code>function anymal(){var a=3, return a} VM215:1 Uncaught SyntaxError: Unexpected token return </code></pre> <p>return that Uncaught syntaxError?</p>
0debug
How to check a txr contain all the element in a list? : like I have a txt and read it already using with open(full_path,'r') as f2: contents = f2.read() content like: `sadasdasdasdsa dasdasdasdffsdf [sdas] aaa dfdsfdsfdfds bbb` and I have a list like a = ['aaa','bbb'] b = ['343242','bbb'] We could see all element in list`a` are in `content`, `b` not. but how could I check it in a loop? like if a in content print `ok` else print `not`. Thanks!!
0debug
c++ noob questions, &ss !ss or ss.X : <p>Sorry, this is a very noob question. I'm a fresh c++ student...</p> <p>I am trying to understand a c++ code I found online for a space shooter like game. I want to use it for my project. The hero shoots arrows to an enemy. It has this &amp;ss, ss.X and !ss but I don't know what they mean. What does the . between variables mean? And what does &amp;ss mean? Would you please share any topic or lesson related to this? Or do you know what term these are called? I'm trying to search it on google, but I don't know the right keyword.</p> <p>This is when the monster hits the hero. This is a function inside a class of my monster. </p> <pre><code>class monster { private: int x; int y; public: int X() { return x; } int Y() { return y; } void Collision(Hero &amp;ss) { if(((x &gt;= ss.X()) &amp;&amp; (x &lt;= ss.X() + 5)) &amp;&amp; ((y &gt;= ss.Y()) &amp;&amp; (y &lt;= ss.Y() + 2))) { ss.Damage(); //a function under my hero class which will decrease hero energy gotoxy(x,y); printf(" "); x = rand()%74 + 3; y = 4; } } </code></pre> <p>Thank you!</p>
0debug
Observe mutations on a target node that doesn't exist yet : <p>Is it possible to observer mutations on a DOM node that doesn't exist yet?</p> <p><strong>Example:</strong></p> <p>My app creates a div at some point: <code>&lt;div id="message" data-message-content="foo" data-message-type="bar" /&gt;</code>.</p> <p>I want to watch for the creation &amp; change of this div. </p> <pre><code>var mutationObserver = new MutationObserver(function(mutations){ // Some code to handle the mutation. }); mutationObserver.observe( document.querySelector('#message'), { attributes: true, subtree: true, childList: true, characterData: false } ); ); </code></pre> <p>Right now this returns an <strong>error</strong> since <code>#message</code> is null (the div hasn't been created yet).</p> <p><code>Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'.</code></p> <p>An obvious solution is to watch the <code>body</code> and check if any of the mutations are the creation of <code>div#Message</code>, but this seems like a bad idea / or possibly bad for performance.</p>
0debug
static void boston_mach_class_init(MachineClass *mc) { mc->desc = "MIPS Boston"; mc->init = boston_mach_init; mc->block_default_type = IF_IDE; mc->default_ram_size = 2 * G_BYTE; mc->max_cpus = 16; }
1threat
How do I Docker COPY as non root? : <p>While building a Docker image, how do I <code>COPY</code> a file into the image so that the resulting file is owned by a user other than root?</p>
0debug
int host_to_target_signal(int sig) { if (sig >= _NSIG) return sig; return host_to_target_signal_table[sig]; }
1threat
While Loop stops working before condition C++ : <p>The while loop should stop at 12 but ends at 9. Also, please ignore I spelled inches incorrectly.</p> <pre><code>int main() { double rainFall[12]; int i = 0; while(rainFall[i] &gt; 0 &amp;&amp; i &lt; 12 ){ cout &lt;&lt; "Enter your rainfaill in incehs for month #" &lt;&lt; i + 1 &lt;&lt; ": " ; cin &gt;&gt; rainFall[i]; i++; } } </code></pre> <p>Input / Output: Enter your rainfaill in incehs for month #1: 9 </p> <p>Enter your rainfaill in incehs for month #2: 9 </p> <p>Enter your rainfaill in incehs for month #3: 9</p> <p>Enter your rainfaill in incehs for month #4: 9</p> <p>Enter your rainfaill in incehs for month #5: 9</p> <p>Enter your rainfaill in incehs for month #6: 9</p> <p>Enter your rainfaill in incehs for month #7: 9</p> <p>Enter your rainfaill in incehs for month #8: 9</p> <p>Enter your rainfaill in incehs for month #9: 9</p>
0debug
Uninstalling Gulp globally (but not locally) : <p>New to Gulp, somehow I installed different versions of Gulp globally and locally, triggering version mismatch warning messages. Is it possible for me to uninstall Gulp globally without affecting local installs?</p>
0debug
Java timestamp VS php timestamp : <p>what are the tradeoffs of using either approach to get the current time and and store that figure in mySQL? for instance, would it be more appropriate to get the android system time and then send that as an HTTP request parameter or would it be it better to send a request and get the current time on the PHP side? why/why not?</p>
0debug
static void *qpa_thread_in (void *arg) { PAVoiceIn *pa = arg; HWVoiceIn *hw = &pa->hw; int threshold; threshold = conf.divisor ? hw->samples / conf.divisor : 0; if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { return NULL; } for (;;) { int incr, to_grab, wpos; for (;;) { if (pa->done) { goto exit; } if (pa->dead > threshold) { break; } if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) { goto exit; } } incr = to_grab = pa->dead; wpos = hw->wpos; if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) { return NULL; } while (to_grab) { int error; int chunk = audio_MIN (to_grab, hw->samples - wpos); void *buf = advance (pa->pcm_buf, wpos); if (pa_simple_read (pa->s, buf, chunk << hw->info.shift, &error) < 0) { qpa_logerr (error, "pa_simple_read failed\n"); return NULL; } hw->conv (hw->conv_buf + wpos, buf, chunk); wpos = (wpos + chunk) % hw->samples; to_grab -= chunk; } if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { return NULL; } pa->wpos = wpos; pa->dead -= incr; pa->incr += incr; } exit: audio_pt_unlock (&pa->pt, AUDIO_FUNC); return NULL; }
1threat
c preprocessor passing multiple arguments as one : <p>The C preprocessor is passing multiple arguments as if they were a single argument. I feel pretty sure the problem is how we are calling the <code>untouchable</code> macro, but every attempt we have made to alter the <code>first</code> macro has failed to produce the desired result. Here is a complete code sample with comments that explain what happens and what we want to happen:</p> <pre><code>//this can be changed, but it must remain a #define to be of any use to us #define first a,b,c // v all code below this line cannot be altered (it's outside of our control) #define untouchable(name, c1, c2, c3) \ wchar_t name[] = \ { \ quote(c1), \ quote(c2), \ quote(c3) \ } #define quote(c) L#@c // ^ all code above this line cannot be altered (it's outside of our control) int _tmain(int argc, _TCHAR* argv[]) { static untouchable(mrNess, first); // the line above is precompiled to: // static wchar_t mrNess[] = { L'a,b,c', L, L }; // whereas we want: // static wchar_t mrNess[] = { L'a', L'b', L'c' }; return 0; } </code></pre> <p>We are compiling in Windows under VisualStudio.</p>
0debug
How to merge more than cell in one new cell in Excel? : Dears, I want to merge more than cell in one new cell like below image example. Thanks for your support. [Example][1] [1]: https://i.stack.imgur.com/83lRP.jpg
0debug
void avfilter_draw_slice(AVFilterLink *link, int y, int h) { uint8_t *src[4], *dst[4]; int i, j, hsub, vsub; if(link->srcpic) { avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub); src[0] = link->srcpic-> data[0] + y * link->srcpic-> linesize[0]; dst[0] = link->cur_pic->data[0] + y * link->cur_pic->linesize[0]; for(i = 1; i < 4; i ++) { if(link->srcpic->data[i]) { src[i] = link->srcpic-> data[i] + (y >> vsub) * link->srcpic-> linesize[i]; dst[i] = link->cur_pic->data[i] + (y >> vsub) * link->cur_pic->linesize[i]; } else src[i] = dst[i] = NULL; } for(j = 0; j < h; j ++) { memcpy(dst[0], src[0], link->cur_pic->linesize[0]); src[0] += link->srcpic ->linesize[0]; dst[0] += link->cur_pic->linesize[0]; } for(i = 1; i < 4; i ++) { if(!src[i]) continue; for(j = 0; j < h >> vsub; j ++) { memcpy(dst[i], src[i], link->cur_pic->linesize[i]); src[i] += link->srcpic ->linesize[i]; dst[i] += link->cur_pic->linesize[i]; } } } if(!link_dpad(link).draw_slice) return; link_dpad(link).draw_slice(link, y, h); }
1threat
Mask integer in Read-Only input field in AngularJs? : <p>I have 2 pages.In first page i will fill my mobile number.Then,navigating to the second page I will show the mobile number in read only.In that i need to show the number like xxxxxx1234. If user clicks the edit button then,it should show all the numbers like 8790561234.</p> <p>I couldn't get the masking for read only field.?Any suggestions??</p>
0debug
static int cd_read_sector(IDEState *s, int lba, uint8_t *buf, int sector_size) { int ret; switch(sector_size) { case 2048: block_acct_start(bdrv_get_stats(s->bs), &s->acct, 4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ); ret = bdrv_read(s->bs, (int64_t)lba << 2, buf, 4); block_acct_done(bdrv_get_stats(s->bs), &s->acct); break; case 2352: block_acct_start(bdrv_get_stats(s->bs), &s->acct, 4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ); ret = bdrv_read(s->bs, (int64_t)lba << 2, buf + 16, 4); block_acct_done(bdrv_get_stats(s->bs), &s->acct); if (ret < 0) return ret; cd_data_to_raw(buf, lba); break; default: ret = -EIO; break; } return ret; }
1threat
static int mpeg_decode_slice(MpegEncContext *s, int mb_y, const uint8_t **buf, int buf_size) { AVCodecContext *avctx = s->avctx; const int field_pic = s->picture_structure != PICT_FRAME; int ret; s->resync_mb_x = s->resync_mb_y = -1; assert(mb_y < s->mb_height); init_get_bits(&s->gb, *buf, buf_size * 8); ff_mpeg1_clean_buffers(s); s->interlaced_dct = 0; s->qscale = get_qscale(s); if (s->qscale == 0) { av_log(s->avctx, AV_LOG_ERROR, "qscale == 0\n"); return AVERROR_INVALIDDATA; } while (get_bits1(&s->gb) != 0) skip_bits(&s->gb, 8); s->mb_x = 0; if (mb_y == 0 && s->codec_tag == AV_RL32("SLIF")) { skip_bits1(&s->gb); } else { while (get_bits_left(&s->gb) > 0) { int code = get_vlc2(&s->gb, ff_mbincr_vlc.table, MBINCR_VLC_BITS, 2); if (code < 0) { av_log(s->avctx, AV_LOG_ERROR, "first mb_incr damaged\n"); return AVERROR_INVALIDDATA; } if (code >= 33) { if (code == 33) s->mb_x += 33; } else { s->mb_x += code; break; } } } if (s->mb_x >= (unsigned) s->mb_width) { av_log(s->avctx, AV_LOG_ERROR, "initial skip overflow\n"); return AVERROR_INVALIDDATA; } if (avctx->hwaccel) { const uint8_t *buf_end, *buf_start = *buf - 4; int start_code = -1; buf_end = avpriv_find_start_code(buf_start + 2, *buf + buf_size, &start_code); if (buf_end < *buf + buf_size) buf_end -= 4; s->mb_y = mb_y; if (avctx->hwaccel->decode_slice(avctx, buf_start, buf_end - buf_start) < 0) return DECODE_SLICE_ERROR; *buf = buf_end; return DECODE_SLICE_OK; } s->resync_mb_x = s->mb_x; s->resync_mb_y = s->mb_y = mb_y; s->mb_skip_run = 0; ff_init_block_index(s); if (s->mb_y == 0 && s->mb_x == 0 && (s->first_field || s->picture_structure == PICT_FRAME)) { if (s->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(s->avctx, AV_LOG_DEBUG, "qp:%d fc:%2d%2d%2d%2d %s %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n", s->qscale, s->mpeg_f_code[0][0], s->mpeg_f_code[0][1], s->mpeg_f_code[1][0], s->mpeg_f_code[1][1], s->pict_type == AV_PICTURE_TYPE_I ? "I" : (s->pict_type == AV_PICTURE_TYPE_P ? "P" : (s->pict_type == AV_PICTURE_TYPE_B ? "B" : "S")), s->progressive_sequence ? "ps" : "", s->progressive_frame ? "pf" : "", s->alternate_scan ? "alt" : "", s->top_field_first ? "top" : "", s->intra_dc_precision, s->picture_structure, s->frame_pred_frame_dct, s->concealment_motion_vectors, s->q_scale_type, s->intra_vlc_format, s->repeat_first_field, s->chroma_420_type ? "420" : ""); } } for (;;) { #if FF_API_XVMC FF_DISABLE_DEPRECATION_WARNINGS if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) ff_xvmc_init_block(s); FF_ENABLE_DEPRECATION_WARNINGS #endif if ((ret = mpeg_decode_mb(s, s->block)) < 0) return ret; if (s->current_picture.motion_val[0] && !s->encoding) { const int wrap = s->b8_stride; int xy = s->mb_x * 2 + s->mb_y * 2 * wrap; int b8_xy = 4 * (s->mb_x + s->mb_y * s->mb_stride); int motion_x, motion_y, dir, i; for (i = 0; i < 2; i++) { for (dir = 0; dir < 2; dir++) { if (s->mb_intra || (dir == 1 && s->pict_type != AV_PICTURE_TYPE_B)) { motion_x = motion_y = 0; } else if (s->mv_type == MV_TYPE_16X16 || (s->mv_type == MV_TYPE_FIELD && field_pic)) { motion_x = s->mv[dir][0][0]; motion_y = s->mv[dir][0][1]; } else { motion_x = s->mv[dir][i][0]; motion_y = s->mv[dir][i][1]; } s->current_picture.motion_val[dir][xy][0] = motion_x; s->current_picture.motion_val[dir][xy][1] = motion_y; s->current_picture.motion_val[dir][xy + 1][0] = motion_x; s->current_picture.motion_val[dir][xy + 1][1] = motion_y; s->current_picture.ref_index [dir][b8_xy] = s->current_picture.ref_index [dir][b8_xy + 1] = s->field_select[dir][i]; assert(s->field_select[dir][i] == 0 || s->field_select[dir][i] == 1); } xy += wrap; b8_xy += 2; } } s->dest[0] += 16; s->dest[1] += 16 >> s->chroma_x_shift; s->dest[2] += 16 >> s->chroma_x_shift; ff_mpv_decode_mb(s, s->block); if (++s->mb_x >= s->mb_width) { const int mb_size = 16; ff_mpeg_draw_horiz_band(s, mb_size * (s->mb_y >> field_pic), mb_size); ff_mpv_report_decode_progress(s); s->mb_x = 0; s->mb_y += 1 << field_pic; if (s->mb_y >= s->mb_height) { int left = get_bits_left(&s->gb); int is_d10 = s->chroma_format == 2 && s->pict_type == AV_PICTURE_TYPE_I && avctx->profile == 0 && avctx->level == 5 && s->intra_dc_precision == 2 && s->q_scale_type == 1 && s->alternate_scan == 0 && s->progressive_frame == 0 ; if (left < 0 || (left && show_bits(&s->gb, FFMIN(left, 23)) && !is_d10) || ((avctx->err_recognition & AV_EF_BUFFER) && left > 8)) { av_log(avctx, AV_LOG_ERROR, "end mismatch left=%d %0X\n", left, show_bits(&s->gb, FFMIN(left, 23))); return AVERROR_INVALIDDATA; } else goto eos; } ff_init_block_index(s); } if (s->mb_skip_run == -1) { s->mb_skip_run = 0; for (;;) { int code = get_vlc2(&s->gb, ff_mbincr_vlc.table, MBINCR_VLC_BITS, 2); if (code < 0) { av_log(s->avctx, AV_LOG_ERROR, "mb incr damaged\n"); return AVERROR_INVALIDDATA; } if (code >= 33) { if (code == 33) { s->mb_skip_run += 33; } else if (code == 35) { if (s->mb_skip_run != 0 || show_bits(&s->gb, 15) != 0) { av_log(s->avctx, AV_LOG_ERROR, "slice mismatch\n"); return AVERROR_INVALIDDATA; } goto eos; } } else { s->mb_skip_run += code; break; } } if (s->mb_skip_run) { int i; if (s->pict_type == AV_PICTURE_TYPE_I) { av_log(s->avctx, AV_LOG_ERROR, "skipped MB in I-frame at %d %d\n", s->mb_x, s->mb_y); return AVERROR_INVALIDDATA; } s->mb_intra = 0; for (i = 0; i < 12; i++) s->block_last_index[i] = -1; if (s->picture_structure == PICT_FRAME) s->mv_type = MV_TYPE_16X16; else s->mv_type = MV_TYPE_FIELD; if (s->pict_type == AV_PICTURE_TYPE_P) { s->mv_dir = MV_DIR_FORWARD; s->mv[0][0][0] = s->mv[0][0][1] = 0; s->last_mv[0][0][0] = s->last_mv[0][0][1] = 0; s->last_mv[0][1][0] = s->last_mv[0][1][1] = 0; s->field_select[0][0] = (s->picture_structure - 1) & 1; } else { s->mv[0][0][0] = s->last_mv[0][0][0]; s->mv[0][0][1] = s->last_mv[0][0][1]; s->mv[1][0][0] = s->last_mv[1][0][0]; s->mv[1][0][1] = s->last_mv[1][0][1]; } } } } eos: *buf += (get_bits_count(&s->gb) - 1) / 8; ff_dlog(s, "y %d %d %d %d\n", s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y); return 0; }
1threat
static void rtas_set_time_of_day(sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { struct tm tm; tm.tm_year = rtas_ld(args, 0) - 1900; tm.tm_mon = rtas_ld(args, 1) - 1; tm.tm_mday = rtas_ld(args, 2); tm.tm_hour = rtas_ld(args, 3); tm.tm_min = rtas_ld(args, 4); tm.tm_sec = rtas_ld(args, 5); rtc_change_mon_event(&tm); spapr->rtc_offset = qemu_timedate_diff(&tm); rtas_st(rets, 0, 0); }
1threat
Why does List<T>.Add throw an index out of range exception? : <p>When I call <code>List&lt;T&gt;.Add(T)</code> it throws this exception:</p> <pre><code>System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Collections.Generic.List`1.Add(T item) at ConsoleApp5.Program.AddToList(Int32 seed) </code></pre> <p>I've also see this exception thrown by <code>Enumerable.Any</code> against the same list.</p>
0debug
How can I alias a default import in Javascript? : <p>Using ES6 modules, I know I can alias a named import</p> <pre><code>import { foo as bar } from 'my-module'; </code></pre> <p>And I know I can import a default import</p> <pre><code>import defaultMember from 'my-module'; </code></pre> <p>I'd like to alias a default import and I had thought the following would work</p> <pre><code>import defaultMember as alias from 'my-module'; </code></pre> <p>but that results in a parsing (syntax) error.</p> <p>How can I (or can I?) alias a default import?</p>
0debug
Split Spark Dataframe string column into multiple columns : <p>I've seen various people suggesting that <code>Dataframe.explode</code> is a useful way to do this, but it results in more rows than the original dataframe, which isn't what I want at all. I simply want to do the Dataframe equivalent of the very simple:</p> <pre><code>rdd.map(lambda row: row + [row.my_str_col.split('-')]) </code></pre> <p>which takes something looking like:</p> <pre><code>col1 | my_str_col -----+----------- 18 | 856-yygrm 201 | 777-psgdg </code></pre> <p>and converts it to this:</p> <pre><code>col1 | my_str_col | _col3 | _col4 -----+------------+-------+------ 18 | 856-yygrm | 856 | yygrm 201 | 777-psgdg | 777 | psgdg </code></pre> <p>I am aware of <code>pyspark.sql.functions.split()</code>, but it results in a nested array column instead of two top-level columns like I want. </p> <p>Ideally, I want these new columns to be named as well.</p>
0debug
Update Table Using Laravel Model : <p>I've got a table for a sports team. The record shows the team selection and some other information. I want to update the record with the team selection. My model is thus:</p> <pre><code>class Selection extends Model { protected $table = "selection"; protected $fillable = [ 'loose', 'hooker', 'tight', 'secrow1', 'secrow2', 'blindflank', 'openflank', 'eight', 'scrum', 'fly', 'leftwing', 'rightwing', 'fullback', 'sub1', 'sub2', 'sub3', 'sub4', 'sub5' ]; </code></pre> <p>}</p> <p>So I have a form which gives all the data for the positions and gives the id for the record in the DB. In my controller, I've got:</p> <pre><code>public function storeFirstTeam() { $input = Request::all(); Selection::update($input-&gt;id,$input); return redirect('first-team'); } </code></pre> <p>But I get the following error:</p> <blockquote> <p>Non-static method Illuminate\Database\Eloquent\Model::update() should not be called statically, assuming $this from incompatible context</p> </blockquote> <p>Can anyone point out my silly error?</p>
0debug
How Will I get the Present date is 1st of the Month in C# : <p>Could you please help me, </p> <p>How Will I get to know "Present date is 1st of the Month" in C#. I am writing Batch Job (Which runs on every day mid night 12 AM) in C#, here I am doing some logic , If the present date is 1st Of the Month. Kindly help me.</p>
0debug
jQuery .css not working at all : the following code is not working correctly $("p").css("background-color", "yellow"); alert( $("p").css("background-color")); the alert is "undefined". I tried on both google chrome and firefox. I have extracted this from the w3c website and in their example it works (I am even using the same jQuery version)
0debug
Scanner.skip("[\r\n]+") produz exception: java.util.NoSuchElementException : Estou tentando importar um arquivo csv para o java(JPA), para isso estou usando SCANNER, mas o problema é que no final da linha ele esta se perdendo, tentei usar o método skip("[\r\n]+") do scanner mas ainda assim, obtenho uma exception java.util.NoSuchElementException. Já tentei usar como parâmetro na função skip somente "\r\n" e também já tentei "[\r\n]".. sem sucesso, sera que alguém pode me ajudar? Scanner sc = new Scanner (new File(loq)).useDelimiter(";"); pote = sc.next(); Questoes quest = new Questoes( ); do { EntityManagerFactory quest_factory = Persistence.createEntityManagerFactory("TRM"); EntityManager entitymanager = quest_factory.createEntityManager( ); entitymanager.getTransaction( ).begin( ); //pote = sc.next(); System.out.println(pote); quest.setCategoria(Integer.parseInt(pote)); pote = sc.next(); System.out.println(pote); quest.setNivel(Integer.parseInt(pote)); pote = sc.next(); System.out.println(pote); quest.setQuestao(pote); pote = sc.next(); System.out.println(pote); quest.setR1(pote); pote = sc.next(); System.out.println(pote); quest.setR2(pote); pote = sc.next(); System.out.println(pote); quest.setR3(pote); pote = sc.next(); System.out.println(pote); quest.setCorreta(pote); System.out.println("fim linha"); sc.skip("[\r\n]"); entitymanager.persist( quest ); entitymanager.getTransaction( ).commit( ); entitymanager.close( ); quest_factory.close( ); } while((pote = sc.next())!= null); sc.close();[enter image description here][1] [1]: http://i.stack.imgur.com/9DyW4.png
0debug
What is the wrong with called opject in java code : I'm creating a menu based java code and when I create a new object in the main class show me error. >variable admin has not been initialized >incompatible string cannot convert to double. here is the Admin class `public class Admin extends User{ private String officNo; private String positon;` public Admin(String username, String pass, String officeNo, String postion) { super(username, pass); } public void addProduct(Product p){ Store.products.add(p); the product class public class Product { private String name; private String ID; private double price; private String seller; public Product(String name, String id, double price, String sell){ } The main class: public static void main(String[] args) { Admin admin; Scanner inter = new Scanner(System.in); System.out.println("Welcome to our Online Store\n\n if you are an admin enter 1 if user enter 2"); int sw1 = inter.nextInt(); switch(sw1){ case 1: System.out.println("choose one of the option below: \n" + "(1) add a new product to the store\n" + "(2) delete one of the products\n" + "(3) update one of the product attributes\n" + "(4) search if a certain product exits using its ID\n" + "(5) show the list of products\n"+ "(6) exit" ); int sw2 = inter.nextInt(); switch(sw2){ case 1: System.out.println("Enter product name: " ); String name=inter.next(); System.out.println("Enter product ID: " ); String id=inter.next(); System.out.println("Enter product price: " ); String price=inter.next(); System.out.println("Enter product seller: " ); String seller=inter.next(); admin.addProduct(new Product(name,id,price,seller); break; the error comes in this line admin.addProduct(new Product(name,id,price,seller); please any one helep
0debug
Pytest fixture for a class through self not as method argument : <p>Often I'll write a test class that uses a pytest fixture in every method. Here's an example. I'd like to be able to avoid having to write the fixture name in the signature of every method. It's not DRY. How can this be done? </p> <p>I would like to be able to access the fixture by giving the fixture as an attribute of the test class. In this example, I would like to see the google fixture as an attribute of TestGoogle. Is this possible?</p> <pre><code>from bs4 import BeautifulSoup import pytest import requests @pytest.fixture() def google(): return requests.get("https://www.google.com") class TestGoogle: def test_alive(self, google): assert google.status_code == 200 def test_html_title(self, google): soup = BeautifulSoup(google.content, "html.parser") assert soup.title.text.upper() == "GOOGLE" </code></pre>
0debug
void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { if (!mon) return; if (mon->mc && !mon->mc->print_enabled) { qemu_error_new(QERR_UNDEFINED_ERROR); } else { char buf[4096]; vsnprintf(buf, sizeof(buf), fmt, ap); monitor_puts(mon, buf); } }
1threat
Hello, I am beginner in C++ and have this kind of problem . It gives me multiply errors : <p>In this code, I try to explain the rules by which a person can get the driving license.. However, it gives me such errors like "expected primary-expression before ‘)’ token", "‘else’ without a previous ‘if’", " expected ‘;’ before ‘cout’", "expected primary-expression before ‘else’ " and "expected ‘)’ before ‘else’"</p> <pre><code>int age = 90; int ageAtLastExam = 16; bool isNotIntoxicated = true; if(age &lt; 16)); //if you are`enter code here` older or equal to 1 and younger than 16, you cannot drive cout &lt;&lt; "You can't drive" &lt;&lt; endl; else(age &gt;= 80 &amp;&amp; ((age &gt; 100) || ((age - ageAtLastExam) &gt; 5))) ///if your age is greater than 100, we are not going to allow you to the exam, but if you are older or equal to 80, you will have to take an exam every five years cout &lt;&lt; "You can't drive" &lt;&lt; endl; else cout &lt;&lt; "You can drive" &lt;&lt; endl; </code></pre>
0debug
Is it possible to send mail in ORACLE : <p>Is there any way to send mail in oracle ? Can anyone give an example.</p> <p>I tried but not working.</p>
0debug
static void lsp2lpc(int16_t *lpc) { int f1[LPC_ORDER / 2 + 1]; int f2[LPC_ORDER / 2 + 1]; int i, j; for (j = 0; j < LPC_ORDER; j++) { int index = lpc[j] >> 7; int offset = lpc[j] & 0x7f; int temp1 = cos_tab[index] << 16; int temp2 = (cos_tab[index + 1] - cos_tab[index]) * ((offset << 8) + 0x80) << 1; lpc[j] = -(av_sat_dadd32(1 << 15, temp1 + temp2) >> 16); } f1[0] = 1 << 28; f1[1] = (lpc[0] << 14) + (lpc[2] << 14); f1[2] = lpc[0] * lpc[2] + (2 << 28); f2[0] = 1 << 28; f2[1] = (lpc[1] << 14) + (lpc[3] << 14); f2[2] = lpc[1] * lpc[3] + (2 << 28); for (i = 2; i < LPC_ORDER / 2; i++) { f1[i + 1] = f1[i - 1] + MULL2(f1[i], lpc[2 * i]); f2[i + 1] = f2[i - 1] + MULL2(f2[i], lpc[2 * i + 1]); for (j = i; j >= 2; j--) { f1[j] = MULL2(f1[j - 1], lpc[2 * i]) + (f1[j] >> 1) + (f1[j - 2] >> 1); f2[j] = MULL2(f2[j - 1], lpc[2 * i + 1]) + (f2[j] >> 1) + (f2[j - 2] >> 1); } f1[0] >>= 1; f2[0] >>= 1; f1[1] = ((lpc[2 * i] << 16 >> i) + f1[1]) >> 1; f2[1] = ((lpc[2 * i + 1] << 16 >> i) + f2[1]) >> 1; } for (i = 0; i < LPC_ORDER / 2; i++) { int64_t ff1 = f1[i + 1] + f1[i]; int64_t ff2 = f2[i + 1] - f2[i]; lpc[i] = av_clipl_int32(((ff1 + ff2) << 3) + (1 << 15)) >> 16; lpc[LPC_ORDER - i - 1] = av_clipl_int32(((ff1 - ff2) << 3) + (1 << 15)) >> 16; } }
1threat
I am a Python noob, can you help me fix my syntax errors? : <p>This is a food timer for pizza, readymeals and curry. The interpreter returns a bunch of syntax errors. Could someone help me clean up the code? I'd be grateful.</p> <pre><code>import os # Native commands import time #Timer import sys choice = "" # Defining p = "pizza" # Defining r = "readymeal" # Defining c = "curry" # Defining class Main: # Check something = True/False def UserInput(): try: choice = raw_input("Which food?") if choice != p or r or c: print "Invalid choice" exit() if choice == p: print "Alarm Set" time.sleep(900) # 15 Min os.system("start Alien_Siren.mp3") # Notification elif choice == r: print "Alarm Set" time.sleep(420) # 7 Min os.system("start Alien_Siren.mp3") # Notification elif choice == c: print "Alarm Set" time.sleep(420) elif choice == "pizza and" and "readymeal": # Must type pizza and readymeal print "Alarm Set" time.sleep(1320) # 22 Min elif choice == "exit": # Exit exit() </code></pre>
0debug
how to disabled angular translation warning : I'm getting all translation related warning in browser console, so i want to suppress/disable all related warning (Dont show to user) [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/BQdVu.jpg
0debug
Accessing outer variable in PHP 7 anonymous class : <p>PHP 7 added support for <a href="http://php.net/manual/en/language.oop5.anonymous.php" rel="noreferrer">anonymous classes</a>, however I can't seem to find any information regarding associated scoping issues. I know I can use the <code>use</code> keyword with callables/closures to access outer scoped variables (like <code>function() use ($outer) { // do work with $outer }</code>), is there any way to do that with an anonymous class?</p> <p>I would like to be able to do so without relying on the anonymous class constructor arguments, and without doing things like adding a setter method or public property to store the value after the instantiation.</p> <p>Here's an example:</p> <pre><code>$outer = 'something'; $instance = new class { public function testing() { var_dump($outer); // would like this to dump the string 'something' } }; </code></pre>
0debug
Why it is not working? : Why is it not working? Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION. our result cannot contain duplicates. SELECT DISTINCT CITY FROM STATION WHERE CITY LIKE '%A' OR CITY LIKE '%E' OR LIKE '%I' LIKE '%O' OR LIKE '%U' ORDER BY CITY; What would be the correct query?
0debug
static int bmp_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { BMPParseContext *bpc = s->priv_data; uint64_t state = bpc->pc.state64; int next = END_NOT_FOUND; int i = 0; *poutbuf_size = 0; restart: if (bpc->pc.frame_start_found <= 2+4+4) { for (; i < buf_size; i++) { state = (state << 8) | buf[i]; if (bpc->pc.frame_start_found == 0) { if ((state >> 48) == (('B' << 8) | 'M')) { bpc->fsize = av_bswap32(state >> 16); bpc->pc.frame_start_found = 1; } } else if (bpc->pc.frame_start_found == 2+4+4) { unsigned ihsize = av_bswap32(state); if (ihsize < 12 || ihsize > 200) { bpc->pc.frame_start_found = 0; continue; } bpc->pc.frame_start_found++; bpc->remaining_size = bpc->fsize + i - 17; if (bpc->pc.index + i > 17) { next = i - 17; state = 0; break; } else { bpc->pc.state64 = 0; goto restart; } } else if (bpc->pc.frame_start_found) bpc->pc.frame_start_found++; } bpc->pc.state64 = state; } else { if (bpc->remaining_size) { i = FFMIN(bpc->remaining_size, buf_size); bpc->remaining_size -= i; if (bpc->remaining_size) goto flush; bpc->pc.frame_start_found = 0; goto restart; } } flush: if (ff_combine_frame(&bpc->pc, next, &buf, &buf_size) < 0) return buf_size; if (next != END_NOT_FOUND && next < 0) bpc->pc.frame_start_found = FFMAX(bpc->pc.frame_start_found - i - 1, 0); else bpc->pc.frame_start_found = 0; *poutbuf = buf; *poutbuf_size = buf_size; return next; }
1threat
Cannot conver from object to System.ValueType : I am trying to implement `IsNumeric` method from [here][1]. But passing an array value like this `Utility.IsNumeric(arrayCsvValues[i])` gives me the error Error CS1503 Argument 1: cannot convert from 'object' to 'System.ValueType' DataSetConsoleApplication \\DataSetConsoleApplication\Program.cs This is the method. public static bool IsNumeric(ValueType value) { return (value is Byte || value is Int16 || value is Int32 || value is Int64 || value is SByte || value is UInt16 || value is UInt32 || value is UInt64 || value is BigInteger || value is Decimal || value is Double || value is Single); } I am working with .NET Framework 4.5.2 Console Application. Please help. [1]: https://docs.microsoft.com/en-us/dotnet/api/system.valuetype?view=netframework-4.5://
0debug
static float get_band_cost_UPAIR12_mips(struct AACEncContext *s, PutBitContext *pb, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits) { const float Q34 = ff_aac_pow34sf_tab[POW_SF2_ZERO - scale_idx + SCALE_ONE_POS - SCALE_DIV_512]; const float IQ = ff_aac_pow2sf_tab [POW_SF2_ZERO + scale_idx - SCALE_ONE_POS + SCALE_DIV_512]; int i; float cost = 0; int qc1, qc2, qc3, qc4; int curbits = 0; uint8_t *p_bits = (uint8_t *)ff_aac_spectral_bits[cb-1]; float *p_codes = (float *)ff_aac_codebook_vectors[cb-1]; for (i = 0; i < size; i += 4) { const float *vec, *vec2; int curidx, curidx2; int sign1, count1, sign2, count2; int *in_int = (int *)&in[i]; float *in_pos = (float *)&in[i]; float di0, di1, di2, di3; int t0, t1, t2, t3, t4; qc1 = scaled[i ] * Q34 + ROUND_STANDARD; qc2 = scaled[i+1] * Q34 + ROUND_STANDARD; qc3 = scaled[i+2] * Q34 + ROUND_STANDARD; qc4 = scaled[i+3] * Q34 + ROUND_STANDARD; __asm__ volatile ( ".set push \n\t" ".set noreorder \n\t" "ori %[t4], $zero, 12 \n\t" "ori %[sign1], $zero, 0 \n\t" "ori %[sign2], $zero, 0 \n\t" "slt %[t0], %[t4], %[qc1] \n\t" "slt %[t1], %[t4], %[qc2] \n\t" "slt %[t2], %[t4], %[qc3] \n\t" "slt %[t3], %[t4], %[qc4] \n\t" "movn %[qc1], %[t4], %[t0] \n\t" "movn %[qc2], %[t4], %[t1] \n\t" "movn %[qc3], %[t4], %[t2] \n\t" "movn %[qc4], %[t4], %[t3] \n\t" "lw %[t0], 0(%[in_int]) \n\t" "lw %[t1], 4(%[in_int]) \n\t" "lw %[t2], 8(%[in_int]) \n\t" "lw %[t3], 12(%[in_int]) \n\t" "slt %[t0], %[t0], $zero \n\t" "movn %[sign1], %[t0], %[qc1] \n\t" "slt %[t2], %[t2], $zero \n\t" "movn %[sign2], %[t2], %[qc3] \n\t" "slt %[t1], %[t1], $zero \n\t" "sll %[t0], %[sign1], 1 \n\t" "or %[t0], %[t0], %[t1] \n\t" "movn %[sign1], %[t0], %[qc2] \n\t" "slt %[t3], %[t3], $zero \n\t" "sll %[t0], %[sign2], 1 \n\t" "or %[t0], %[t0], %[t3] \n\t" "movn %[sign2], %[t0], %[qc4] \n\t" "slt %[count1], $zero, %[qc1] \n\t" "slt %[t1], $zero, %[qc2] \n\t" "slt %[count2], $zero, %[qc3] \n\t" "slt %[t2], $zero, %[qc4] \n\t" "addu %[count1], %[count1], %[t1] \n\t" "addu %[count2], %[count2], %[t2] \n\t" ".set pop \n\t" : [qc1]"+r"(qc1), [qc2]"+r"(qc2), [qc3]"+r"(qc3), [qc4]"+r"(qc4), [sign1]"=&r"(sign1), [count1]"=&r"(count1), [sign2]"=&r"(sign2), [count2]"=&r"(count2), [t0]"=&r"(t0), [t1]"=&r"(t1), [t2]"=&r"(t2), [t3]"=&r"(t3), [t4]"=&r"(t4) : [in_int]"r"(in_int) : "memory" ); curidx = 13 * qc1; curidx += qc2; curidx2 = 13 * qc3; curidx2 += qc4; curbits += p_bits[curidx]; curbits += p_bits[curidx2]; curbits += upair12_sign_bits[curidx]; curbits += upair12_sign_bits[curidx2]; vec = &p_codes[curidx*2]; vec2 = &p_codes[curidx2*2]; __asm__ volatile ( ".set push \n\t" ".set noreorder \n\t" "lwc1 %[di0], 0(%[in_pos]) \n\t" "lwc1 %[di1], 4(%[in_pos]) \n\t" "lwc1 %[di2], 8(%[in_pos]) \n\t" "lwc1 %[di3], 12(%[in_pos]) \n\t" "abs.s %[di0], %[di0] \n\t" "abs.s %[di1], %[di1] \n\t" "abs.s %[di2], %[di2] \n\t" "abs.s %[di3], %[di3] \n\t" "lwc1 $f0, 0(%[vec]) \n\t" "lwc1 $f1, 4(%[vec]) \n\t" "lwc1 $f2, 0(%[vec2]) \n\t" "lwc1 $f3, 4(%[vec2]) \n\t" "nmsub.s %[di0], %[di0], $f0, %[IQ] \n\t" "nmsub.s %[di1], %[di1], $f1, %[IQ] \n\t" "nmsub.s %[di2], %[di2], $f2, %[IQ] \n\t" "nmsub.s %[di3], %[di3], $f3, %[IQ] \n\t" ".set pop \n\t" : [di0]"=&f"(di0), [di1]"=&f"(di1), [di2]"=&f"(di2), [di3]"=&f"(di3) : [in_pos]"r"(in_pos), [vec]"r"(vec), [vec2]"r"(vec2), [IQ]"f"(IQ) : "$f0", "$f1", "$f2", "$f3", "memory" ); cost += di0 * di0 + di1 * di1 + di2 * di2 + di3 * di3; } if (bits) *bits = curbits; return cost * lambda + curbits; }
1threat
Bootstrap HTML styling : I've never been good with CSS. I am especially bad with positioning. Some people claim they have poor sense of direction well i can say i have a very poor sense of positioning when it comes to CSS. Anyway, is there anyway to add padding styles in the html itself? <img class="img-rounded" src="http://placehold.it/100x100" style="padding-top:10px;"> How do i add padding on all sides? Is this impossible? I'm using bootstrap and so far i've never needed any CSS so i'd like to keep it that way. I'm relearning PHP/codeigniter and i don't want to bite off more than i can chew since i'm already using bootstrap and other jquery plugins adding CSS on top of that would only add confusion to my already loose schedule. I really don't have a detailed plan on this project of mine so it's a really confusing ride. I also would like to know, what's the limitations of bootstrap? So far any styling i've needed i got through w3school bootstrap and i've seen no need of CSS as of now so i would like to know where the line is drawn between CSS and bootstrap.
0debug
int main(int argc, char *argv[]) { g_test_init(&argc, &argv, NULL); qtest_add_func("qmp/protocol", test_qmp_protocol); return g_test_run(); }
1threat
document.getElementById('input').innerHTML = user_input;
1threat
static void test_endianness(gconstpointer data) { const TestCase *test = data; char *args; args = g_strdup_printf("-display none -M %s%s%s -device pc-testdev", test->machine, test->superio ? " -device " : "", test->superio ?: ""); qtest_start(args); isa_outl(test, 0xe0, 0x87654321); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654321); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4321); g_assert_cmphex(isa_inb(test, 0xe3), ==, 0x87); g_assert_cmphex(isa_inb(test, 0xe2), ==, 0x65); g_assert_cmphex(isa_inb(test, 0xe1), ==, 0x43); g_assert_cmphex(isa_inb(test, 0xe0), ==, 0x21); isa_outw(test, 0xe2, 0x8866); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x88664321); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8866); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4321); g_assert_cmphex(isa_inb(test, 0xe3), ==, 0x88); g_assert_cmphex(isa_inb(test, 0xe2), ==, 0x66); g_assert_cmphex(isa_inb(test, 0xe1), ==, 0x43); g_assert_cmphex(isa_inb(test, 0xe0), ==, 0x21); isa_outw(test, 0xe0, 0x4422); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x88664422); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8866); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4422); g_assert_cmphex(isa_inb(test, 0xe3), ==, 0x88); g_assert_cmphex(isa_inb(test, 0xe2), ==, 0x66); g_assert_cmphex(isa_inb(test, 0xe1), ==, 0x44); g_assert_cmphex(isa_inb(test, 0xe0), ==, 0x22); isa_outb(test, 0xe3, 0x87); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87664422); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8766); g_assert_cmphex(isa_inb(test, 0xe3), ==, 0x87); g_assert_cmphex(isa_inb(test, 0xe2), ==, 0x66); g_assert_cmphex(isa_inb(test, 0xe1), ==, 0x44); g_assert_cmphex(isa_inb(test, 0xe0), ==, 0x22); isa_outb(test, 0xe2, 0x65); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654422); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4422); g_assert_cmphex(isa_inb(test, 0xe3), ==, 0x87); g_assert_cmphex(isa_inb(test, 0xe2), ==, 0x65); g_assert_cmphex(isa_inb(test, 0xe1), ==, 0x44); g_assert_cmphex(isa_inb(test, 0xe0), ==, 0x22); isa_outb(test, 0xe1, 0x43); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654322); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4322); g_assert_cmphex(isa_inb(test, 0xe3), ==, 0x87); g_assert_cmphex(isa_inb(test, 0xe2), ==, 0x65); g_assert_cmphex(isa_inb(test, 0xe1), ==, 0x43); g_assert_cmphex(isa_inb(test, 0xe0), ==, 0x22); isa_outb(test, 0xe0, 0x21); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654321); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4321); g_assert_cmphex(isa_inb(test, 0xe3), ==, 0x87); g_assert_cmphex(isa_inb(test, 0xe2), ==, 0x65); g_assert_cmphex(isa_inb(test, 0xe1), ==, 0x43); g_assert_cmphex(isa_inb(test, 0xe0), ==, 0x21); qtest_quit(global_qtest); g_free(args); }
1threat
Undefined symbols for architecture x86_64: "std::terminate()", referenced from : <p>I got the error when i run <code>react-native run-ios</code> after upgraded RN to 0.26.0-rc. </p> <pre><code>Undefined symbols for architecture x86_64: "std::terminate()", referenced from: ___clang_call_terminate in libReact.a(RCTJSCExecutor.o) "___cxa_begin_catch", referenced from: ___clang_call_terminate in libReact.a(RCTJSCExecutor.o) "___gxx_personality_v0", referenced from: -[RCTJavaScriptContext initWithJSContext:onThread:] in libReact.a(RCTJSCExecutor.o) -[RCTJavaScriptContext init] in libReact.a(RCTJSCExecutor.o) -[RCTJavaScriptContext invalidate] in libReact.a(RCTJSCExecutor.o) _RCTNSErrorFromJSError in libReact.a(RCTJSCExecutor.o) +[RCTJSCExecutor runRunLoopThread] in libReact.a(RCTJSCExecutor.o) -[RCTJSCExecutor init] in libReact.a(RCTJSCExecutor.o) -[RCTJSCExecutor context] in libReact.a(RCTJSCExecutor.o) ... ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) </code></pre> <p>How can i fix it?</p>
0debug
Do we need to import React or just {Component, PropTypes} will do? : <p>in all of my components I am currently including react like this:</p> <pre><code>import React, {Component, PropTypes} from 'react' </code></pre> <p>I don't see why everyone is including React when it is not used, hence wanted to check if it is safe to remove it?</p>
0debug
static void new_subtitle_stream(AVFormatContext *oc, int file_idx) { AVStream *st; AVOutputStream *ost; AVCodec *codec=NULL; AVCodecContext *subtitle_enc; enum CodecID codec_id; st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); if (!st) { fprintf(stderr, "Could not alloc stream\n"); ffmpeg_exit(1); } ost = new_output_stream(oc, file_idx); subtitle_enc = st->codec; output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); if(!subtitle_stream_copy){ if (subtitle_codec_name) { codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1, avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance); codec= output_codecs[nb_output_codecs-1] = avcodec_find_encoder_by_name(subtitle_codec_name); } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_SUBTITLE); codec = avcodec_find_encoder(codec_id); } } avcodec_get_context_defaults3(st->codec, codec); ost->bitstream_filters = subtitle_bitstream_filters; subtitle_bitstream_filters= NULL; subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE; if(subtitle_codec_tag) subtitle_enc->codec_tag= subtitle_codec_tag; if (oc->oformat->flags & AVFMT_GLOBALHEADER) { subtitle_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->flags |= CODEC_FLAG_GLOBAL_HEADER; } if (subtitle_stream_copy) { st->stream_copy = 1; } else { subtitle_enc->codec_id = codec_id; set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec); } if (subtitle_language) { av_metadata_set2(&st->metadata, "language", subtitle_language, 0); av_freep(&subtitle_language); } subtitle_disable = 0; av_freep(&subtitle_codec_name); subtitle_stream_copy = 0; }
1threat
What is the best way to do payment processing on OS X? : <p>I have seen a million tutorials for Paypal on iOS but I noticed that Paypal doesn't seem to have an SDK for OS X and MAC desktop applications. I have desktop app that I have built in swift and the time has come for some sort of payment processing. If I cannot use Paypal then what is the best form of payment processing for non mobile applications? </p>
0debug
static void cpu_pre_save(void *opaque) { ARMCPU *cpu = opaque; if (!write_cpustate_to_list(cpu)) { abort(); } cpu->cpreg_vmstate_array_len = cpu->cpreg_array_len; memcpy(cpu->cpreg_vmstate_indexes, cpu->cpreg_indexes, cpu->cpreg_array_len * sizeof(uint64_t)); memcpy(cpu->cpreg_vmstate_values, cpu->cpreg_values, cpu->cpreg_array_len * sizeof(uint64_t)); }
1threat
Why doesn't remove_reference work on functions? : <p>Ran into something strange when doing some template metaprogramming the other day. It basically comes down to this assertion not (as I would expect) passing. </p> <pre><code>static_assert(std::is_same_v&lt;void(), std::remove_reference_t&lt;void()&amp;&gt;&gt;); </code></pre> <p>At first I thought I was making a syntactic mistake defining a function reference, but this assertion passes, showing that's not the case.</p> <pre><code>static_assert(std::is_same_v&lt;void()&amp;, void()&amp;&gt;); </code></pre> <p>I also tried implementing <code>remove_reference</code> myself copying the source from cppreference but that didn't work either. What is going on here?</p>
0debug
def count_Set_Bits(n): count = 0 while (n): count += n & 1 n >>= 1 return count
0debug
pip3 is not installing packages on mac : Pip3 is actually installing packages on mac but when I run <"Software name" --version> on mac it gives error that -bash:command not found. Please Help asap Thanks in advance
0debug
what is wrong with this query?geeting wrong count : Table1: mas_book_author author_id| author_name ------------+------------- 1 | jhon 2 | roobini 3 | virat 4 | sachin 5 | siva 6 | priya Table4: mas_bk_accession_entry id(int)(pk) | author_ids(varchar) -------------+------------------- 1 | 1,5 2 | 5,1 3 |2,5 4 |3,5 5 |4,5 my result should be like this: author_name |count| ----------+-------- jhon,siva |2 This is my Query select b.author_name,COUNT(*) as totbook from mas_bk_accession_entry a join mas_book_author as b on b.author_id in (select cast((unnest(string_to_array(f.author_ids,',')) ) as int) as author_ids from mas_bk_accession_entry f) where a.author_ids = '1,5' group by b.author_name
0debug
Data from HTML/PHP form won't insert into 1and1 SQL Database : <p>I've been trying to get the data from my form entered into my database in 1and1, and it won't work. Is my code formatted incorrectly?</p> <pre><code>$fullname = ($_POST["fullname"]); $email = ($_POST["email"]); $phone = ($_POST["phone"]); $message = ($_POST["message"]); // Attempt insert query execution $sql = "INSERT INTO contact (fullname, email, phone, message) VALUES ('$fullname', '$email', '$phone', '$message')"; if(mysqli_query($data, $sql)){ echo "Records inserted successfully."; } else{ echo "ERROR: Could not execute $sql. " . mysqli_error($data); } </code></pre> <p>I looked at the W3 school examples, and it looked the same, yet my code doesn't work.</p>
0debug
static void acpi_set_pci_info(void) { PCIBus *bus = find_i440fx(); unsigned bsel_alloc = 0; if (bus) { pci_for_each_bus_depth_first(bus, acpi_set_bsel, NULL, &bsel_alloc); } }
1threat
Generate a specific dictionary type from list in python : l=[(), (0,), (1,), (2,), (0, 1), (0, 2), (1, 2), (0, 1, 2)] And i want to generate a specific dict type as given below from the list in python dict3={(): [(0,), (1,), (2,)], (0,): [(0, 1), (0, 2), (1, 2)],(1,): [(0, 1), (0, 2), (1, 2)],(2,): [(0, 1), (0, 2), (1, 2)],(0, 1): [(0, 1, 2)], (0, 2): [(0, 1, 2)],(1, 2): [(0, 1, 2)]} Any suggestions how to do it?
0debug
static void vbe_update_vgaregs(VGACommonState *s) { int h, shift_control; if (!vbe_enabled(s)) { return; } s->gr[VGA_GFX_MISC] = (s->gr[VGA_GFX_MISC] & ~0x0c) | 0x04 | VGA_GR06_GRAPHICS_MODE; s->cr[VGA_CRTC_MODE] |= 3; s->cr[VGA_CRTC_OFFSET] = s->vbe_line_offset >> 3; s->cr[VGA_CRTC_H_DISP] = (s->vbe_regs[VBE_DISPI_INDEX_XRES] >> 3) - 1; h = s->vbe_regs[VBE_DISPI_INDEX_YRES] - 1; s->cr[VGA_CRTC_V_DISP_END] = h; s->cr[VGA_CRTC_OVERFLOW] = (s->cr[VGA_CRTC_OVERFLOW] & ~0x42) | ((h >> 7) & 0x02) | ((h >> 3) & 0x40); s->cr[VGA_CRTC_LINE_COMPARE] = 0xff; s->cr[VGA_CRTC_OVERFLOW] |= 0x10; s->cr[VGA_CRTC_MAX_SCAN] |= 0x40; if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) { shift_control = 0; s->sr[VGA_SEQ_CLOCK_MODE] &= ~8; } else { shift_control = 2; s->sr[VGA_SEQ_MEMORY_MODE] |= VGA_SR04_CHN_4M; s->sr[VGA_SEQ_PLANE_WRITE] |= VGA_SR02_ALL_PLANES; } s->gr[VGA_GFX_MODE] = (s->gr[VGA_GFX_MODE] & ~0x60) | (shift_control << 5); s->cr[VGA_CRTC_MAX_SCAN] &= ~0x9f; }
1threat
static void virtio_balloon_receive_stats(VirtIODevice *vdev, VirtQueue *vq) { VirtIOBalloon *s = VIRTIO_BALLOON(vdev); VirtQueueElement *elem = &s->stats_vq_elem; VirtIOBalloonStat stat; size_t offset = 0; qemu_timeval tv; if (!virtqueue_pop(vq, elem)) { goto out; } reset_stats(s); while (iov_to_buf(elem->out_sg, elem->out_num, offset, &stat, sizeof(stat)) == sizeof(stat)) { uint16_t tag = virtio_tswap16(vdev, stat.tag); uint64_t val = virtio_tswap64(vdev, stat.val); offset += sizeof(stat); if (tag < VIRTIO_BALLOON_S_NR) s->stats[tag] = val; } s->stats_vq_offset = offset; if (qemu_gettimeofday(&tv) < 0) { fprintf(stderr, "warning: %s: failed to get time of day\n", __func__); goto out; } s->stats_last_update = tv.tv_sec; out: if (balloon_stats_enabled(s)) { balloon_stats_change_timer(s, s->stats_poll_interval); } }
1threat
please explain this function code this code use to change colored picture into black and white : Can somebdy explain me the function of this code this code use to change colored picture into black and with picture Begin Indeks := 3 * Kolom; R := PDataBaris[Indeks]; G := PDataBaris[Indeks+1]; B := PDataBaris[Indeks+2]; Intensitas := Round(0.2989 * R + 0.5870 * G + 0.1141* B); if Intensitas < 128 then begin p:=p+1; Intensitas := 0 end; if Intensitas > 128 then begin h:=h+1; Intensitas := 255 end; PDataBaris[Indeks] := Intensitas; PDataBaris[Indeks+1] := Intensitas; PDataBaris[Indeks+2] := Intensitas; End; end;
0debug
How case works in if-case : <p>An old C programmer could use some help with Swift.</p> <p>I don't understanding something about the if-case syntax. E.g.:</p> <pre><code>if case 20...30 = age { print ("in range.") } </code></pre> <p>The <code>case 20...30 = age</code> appears to be the conditional test for the <code>if</code> statement. So I was initially confused to see the assignment operator ('=') used instead of a comparison operator ('==').</p> <p>Ok, I thought to myself, that probably means the <code>case</code> statement is actually a function call that returns a boolean value. The returned value will then satisfy the comparison test in the <code>if</code> statement.</p> <p>As an experiment, I tried treating the the <code>case</code> statement like a regular conditional test and placed parentheses around it. Swift will happily accept <code>if (x == 5)</code> or <code>if (true)</code>. But <code>if (case 20...30 = age)</code> generates an error. So the <code>case</code> statement doesn't seem to behave like function.</p> <p>I'm just curious to understand what's happening here. Any insight would be greatly appreciated.</p>
0debug
void pcnet_h_reset(void *opaque) { PCNetState *s = opaque; int i; uint16_t checksum; memcpy(s->prom, s->conf.macaddr.a, 6); s->prom[12] = s->prom[13] = 0x00; s->prom[14] = s->prom[15] = 0x57; for (i = 0,checksum = 0; i < 16; i++) checksum += s->prom[i]; *(uint16_t *)&s->prom[12] = cpu_to_le16(checksum); s->bcr[BCR_MSRDA] = 0x0005; s->bcr[BCR_MSWRA] = 0x0005; s->bcr[BCR_MC ] = 0x0002; s->bcr[BCR_LNKST] = 0x00c0; s->bcr[BCR_LED1 ] = 0x0084; s->bcr[BCR_LED2 ] = 0x0088; s->bcr[BCR_LED3 ] = 0x0090; s->bcr[BCR_FDC ] = 0x0000; s->bcr[BCR_BSBC ] = 0x9001; s->bcr[BCR_EECAS] = 0x0002; s->bcr[BCR_SWS ] = 0x0200; s->bcr[BCR_PLAT ] = 0xff06; pcnet_s_reset(s); pcnet_update_irq(s); pcnet_poll_timer(s); }
1threat
static void spapr_io_write(void *opaque, hwaddr addr, uint64_t data, unsigned size) { switch (size) { case 1: cpu_outb(addr, data); return; case 2: cpu_outw(addr, data); return; case 4: cpu_outl(addr, data); return; } assert(0); }
1threat
Not able insert data into table? : I'm able to see all the data that i have entered in form but not able to insert it into table. <?php echo "u r at starting"; $product_title = $_POST["product_title"]; $product_cat = $_POST["product_cat"]; $cat = $_POST["cat"]; $product_price = $_POST["product_price"]; $product_keywords = $_POST["product_keywords"]; $product_desc = $_POST["product_desc"]; $product_img1 = $_FILES["product_img1"]["name"]; $product_img2 = $_FILES["product_img2"]["name"]; $product_img3 = $_FILES["product_img3"]["name"]; echo $product_title; echo $product_cat; echo $cat; echo $product_price; echo $product_keywords; echo $product_desc; echo $product_img1; echo $product_img2; echo $product_img3; if(isset($_POST["abc"])) { $temp_name1 = $_FILES["product_img1"]["tmp_name"]; $temp_name2 = $_FILES["product_img2"]["tmp_name"]; $temp_name3 = $_FILES["product_img3"]["tmp_name"]; move_uploaded_file($temp_name1, "product_images/img1"); move_uploaded_file($temp_name2, "product_images/img2"); move_uploaded_file($temp_name3, "product_images/img3"); $insert_product = "INSERT INTO product_tab VALUES ('$product_cat','$cat_id',NOW(),'$product_title','$product_img1','$product_img2','$product_img3','$product_price','$product_keywords','$product_desc')"; $run_product = mysqli_query($con,$insert_product); echo $run_product; if($run_product) { echo "Product inserted successfully"; } else { echo "NOt inserted"; } } echo "end"; ?>
0debug
Helpp! New to programming (loops are my nightmare) ! Working with arrays? Bubble sorting? : I'm doing this assignment where by using the Bubble Sort Algorithm, create a program that asks a user for a number of integers. The program will then ask the user to input as many integers as the user requested and fill the values of the arrays into it. Afterwards, the program user output the following: a. Show Number List from File (Unsorted) b. Show Sorted List c. Show Greatest number d. Show Smallest Number e. Show the Median Value f. Show the Average Value So far I have this : import java.util.Scanner; public class Bubbles { public static void main(String[] args) { //Declare Variables String strUser; int intSize; int[] intNum; //Input Scanner scn=new Scanner(System.in); //Process/Output System.out.println("Please enter the number of values you would like to enter:"); strUser=scn.nextLine(); intSize=Integer.parseInt(strUser); intNum=new int [intSize]; for(int i=0; i < intNum.length; i++) { System.out.println("Please enter for index value of "+i+":"); intNum[i]=scn.nextInt(); } } } which outputs this (for example): Please enter the number of values you would like to enter: 3 Please enter for index value of 0: 47 Please enter for index value of 1: 89 Please enter for index value of 2: 42 BUILD SUCCESSFUL (total time: 13 seconds) Now how do I get all these inputed numbers into an array so I can be them in a list, and then use the bubble sorting to order them, and so on.. Like this: Unsorted order: 47,89,42 Sorted order: 42, 47, 89 I'm so lost, I know.
0debug
void memory_region_ram_resize(MemoryRegion *mr, ram_addr_t newsize, Error **errp) { assert(mr->terminates); qemu_ram_resize(mr->ram_addr, newsize, errp); }
1threat
static int readv_f(BlockBackend *blk, int argc, char **argv) { struct timeval t1, t2; int Cflag = 0, qflag = 0, vflag = 0; int c, cnt; char *buf; int64_t offset; int total = 0; int nr_iov; QEMUIOVector qiov; int pattern = 0; int Pflag = 0; while ((c = getopt(argc, argv, "CP:qv")) != EOF) { switch (c) { case 'C': Cflag = 1; break; case 'P': Pflag = 1; pattern = parse_pattern(optarg); if (pattern < 0) { return 0; } break; case 'q': qflag = 1; break; case 'v': vflag = 1; break; default: return qemuio_command_usage(&readv_cmd); } } if (optind > argc - 2) { return qemuio_command_usage(&readv_cmd); } offset = cvtnum(argv[optind]); if (offset < 0) { printf("non-numeric length argument -- %s\n", argv[optind]); return 0; } optind++; if (offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", offset); return 0; } nr_iov = argc - optind; buf = create_iovec(blk, &qiov, &argv[optind], nr_iov, 0xab); if (buf == NULL) { return 0; } gettimeofday(&t1, NULL); cnt = do_aio_readv(blk, &qiov, offset, &total); gettimeofday(&t2, NULL); if (cnt < 0) { printf("readv failed: %s\n", strerror(-cnt)); goto out; } if (Pflag) { void *cmp_buf = g_malloc(qiov.size); memset(cmp_buf, pattern, qiov.size); if (memcmp(buf, cmp_buf, qiov.size)) { printf("Pattern verification failed at offset %" PRId64 ", %zd bytes\n", offset, qiov.size); } g_free(cmp_buf); } if (qflag) { goto out; } if (vflag) { dump_buffer(buf, offset, qiov.size); } t2 = tsub(t2, t1); print_report("read", &t2, offset, qiov.size, total, cnt, Cflag); out: qemu_iovec_destroy(&qiov); qemu_io_free(buf); return 0; }
1threat
Creating array of int from array of objects using lodash : <p>I have this array of objects:</p> <pre><code>this.clients=[{firstName:"Tywin", lastName:"Lannister", age:46, id:2}, {firstName:"Arya", lastName:"Starck", age:46, id:-1}, {firstName:"John", lastName:"Snow", age:46, id:12}, {firstName:"Robb", lastName:"Starck", age:46, id:24}]; </code></pre> <p>And this variable:</p> <pre><code>var idArr; </code></pre> <p>I need to iterate threw all objects in array and get all id's and create array from them.Like that:</p> <pre><code>idArr = [2,-1,12,24] </code></pre> <p>How can I implement it using lodash?</p>
0debug
static av_always_inline void h264_loop_filter_strength_iteration_mmx2(int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2], int bidir, int edges, int step, int mask_mv, int dir) { const x86_reg d_idx = dir ? -8 : -1; DECLARE_ALIGNED(8, const uint64_t, mask_dir) = dir ? 0 : 0xffffffffffffffffULL; int b_idx, edge; for( b_idx=12, edge=0; edge<edges; edge+=step, b_idx+=8*step ) { __asm__ volatile( "pand %0, %%mm0 \n\t" ::"m"(mask_dir) ); if(!(mask_mv & edge)) { if(bidir) { __asm__ volatile( "movd (%1,%0), %%mm2 \n" "punpckldq 40(%1,%0), %%mm2 \n" "pshufw $0x44, (%1), %%mm0 \n" "pshufw $0x44, 40(%1), %%mm1 \n" "pshufw $0x4E, %%mm2, %%mm3 \n" "psubb %%mm2, %%mm0 \n" "psubb %%mm3, %%mm1 \n" "1: \n" "por %%mm1, %%mm0 \n" "movq (%2,%0,4), %%mm1 \n" "movq 8(%2,%0,4), %%mm2 \n" "movq %%mm1, %%mm3 \n" "movq %%mm2, %%mm4 \n" "psubw (%2), %%mm1 \n" "psubw 8(%2), %%mm2 \n" "psubw 160(%2), %%mm3 \n" "psubw 168(%2), %%mm4 \n" "packsswb %%mm2, %%mm1 \n" "packsswb %%mm4, %%mm3 \n" "paddb %%mm6, %%mm1 \n" "paddb %%mm6, %%mm3 \n" "psubusb %%mm5, %%mm1 \n" "psubusb %%mm5, %%mm3 \n" "packsswb %%mm3, %%mm1 \n" "add $40, %0 \n" "cmp $40, %0 \n" "jl 1b \n" "sub $80, %0 \n" "pshufw $0x4E, %%mm1, %%mm1 \n" "por %%mm1, %%mm0 \n" "pshufw $0x4E, %%mm0, %%mm1 \n" "pminub %%mm1, %%mm0 \n" ::"r"(d_idx), "r"(ref[0]+b_idx), "r"(mv[0]+b_idx) ); } else { __asm__ volatile( "movd (%1), %%mm0 \n" "psubb (%1,%0), %%mm0 \n" "movq (%2), %%mm1 \n" "movq 8(%2), %%mm2 \n" "psubw (%2,%0,4), %%mm1 \n" "psubw 8(%2,%0,4), %%mm2 \n" "packsswb %%mm2, %%mm1 \n" "paddb %%mm6, %%mm1 \n" "psubusb %%mm5, %%mm1 \n" "packsswb %%mm1, %%mm1 \n" "por %%mm1, %%mm0 \n" ::"r"(d_idx), "r"(ref[0]+b_idx), "r"(mv[0]+b_idx) ); } } __asm__ volatile( "movd %0, %%mm1 \n" "por %1, %%mm1 \n" ::"m"(nnz[b_idx]), "m"(nnz[b_idx+d_idx]) ); __asm__ volatile( "pminub %%mm7, %%mm1 \n" "pminub %%mm7, %%mm0 \n" "psllw $1, %%mm1 \n" "pxor %%mm2, %%mm2 \n" "pmaxub %%mm0, %%mm1 \n" "punpcklbw %%mm2, %%mm1 \n" "movq %%mm1, %0 \n" :"=m"(*bS[dir][edge]) ::"memory" ); } }
1threat
why im getting attempt to index 'pac' global (a nil value) (the : THIS CODE IS NOT MINE, My friend sent me this the error i get is this [ERROR] gamemodes/santosrp/gamemode/sh_pacmodels.lua:137: attempt to index global 'pac' (a nil value) 1. PlayerSwitchWeapon - gamemodes/santosrp/gamemode/sh_pacmodels.lua:137 2. UpdatePlayers - gamemodes/santosrp/gamemode/sh_pacmodels.lua:169 3. unknown - gamemodes/santosrp/gamemode/cl_init.lua:105 sh_pacmodels 137 is this function GM.PacModels:PlayerSwitchWeapon( pPlayer, entOldWep, entNewWep ) if not pPlayer.AttachPACPart then pac.SetupENT( pPlayer ) --line 137 pPlayer:SetPACDrawDistance( GetConVarNumber("srp_pac_drawrange") ) end local invalid for slotName, _ in pairs( GAMEMODE.Inv.m_tblEquipmentSlots ) do item = GAMEMODE.Inv:GetItem( GAMEMODE.Player:GetSharedGameVar(pPlayer, "eq_slot_".. slotName, "") ) if not item or not item.PacOutfit then continue end if not IsValid( entOldWep ) or not IsValid( entNewWep ) then continue end if item.EquipGiveClass == entOldWep:GetClass() or item.EquipGiveClass == entNewWep:GetClass() then invalid = true break end end sh_pacmodels 169 is this function GM.PacModels:UpdatePlayers() if not self.m_intLastThink then self.m_intLastThink = CurTime() +0.1 end if self.m_intLastThink > CurTime() then return end self.m_intLastThink = CurTime() +0.1 local ragdoll, item for k, v in pairs( player.GetAll() ) do --Track active weapon if not v.m_entLastActiveWeapon then v.m_entLastActiveWeapon = v:GetActiveWeapon() else if v:GetActiveWeapon() ~= v.m_entLastActiveWeapon then self:PlayerSwitchWeapon( v, v.m_entLastActiveWeapon, v:GetActiveWeapon() ) -- line 169 v.m_entLastActiveWeapon = v:GetActiveWeapon() end end thank you guyss
0debug
static void spapr_populate_pci_devices_dt(PCIBus *bus, PCIDevice *pdev, void *opaque) { PCIBus *sec_bus; sPAPRFDT *p = opaque; int offset; sPAPRFDT s_fdt; uint32_t drc_index = spapr_phb_get_pci_drc_index(p->sphb, pdev); offset = spapr_create_pci_child_dt(p->sphb, pdev, drc_index, NULL, p->fdt, p->node_off); if (!offset) { error_report("Failed to create pci child device tree node"); return; } if ((pci_default_read_config(pdev, PCI_HEADER_TYPE, 1) != PCI_HEADER_TYPE_BRIDGE)) { return; } sec_bus = pci_bridge_get_sec_bus(PCI_BRIDGE(pdev)); if (!sec_bus) { return; } s_fdt.fdt = p->fdt; s_fdt.node_off = offset; s_fdt.sphb = p->sphb; pci_for_each_device(sec_bus, pci_bus_num(sec_bus), spapr_populate_pci_devices_dt, &s_fdt); }
1threat
Why won't my docker-entrypoint.sh execute? : <p>My <code>ENTRYPOINT</code> script doesn't execute and throws <code>standard_init_linux.go:175: exec user process caused "no such file or directory"</code>. Why so?</p> <h1>Doesn't Work</h1> <pre><code>$ docker build -t gilani/trollo . &amp;&amp; docker run gilani/trollo Sending build context to Docker daemon 126 kB Step 1 : FROM vault:latest ---&gt; 1f127f53f8b5 Step 2 : MAINTAINER Amin Shah Gilani &lt;gilani@payload.tech&gt; ---&gt; Using cache ---&gt; 86b885ca1c81 Step 3 : COPY vaultConfig.json /vault/config ---&gt; Using cache ---&gt; 1a2be2fa3acd Step 4 : COPY ./docker-entrypoint.sh / ---&gt; Using cache ---&gt; 0eb7c1c992f1 Step 5 : RUN chmod +x /docker-entrypoint.sh ---&gt; Running in 251395c4790f ---&gt; 46aa0fbc9637 Removing intermediate container 251395c4790f Step 6 : ENTRYPOINT /docker-entrypoint.sh ---&gt; Running in 7434f052178f ---&gt; eca040859bfe Removing intermediate container 7434f052178f Successfully built eca040859bfe standard_init_linux.go:175: exec user process caused "no such file or directory" </code></pre> <p>Dockerfile:</p> <pre><code>FROM vault:latest MAINTAINER Amin Shah Gilani &lt;gilani@payload.tech&gt; COPY vaultConfig.json /vault/config COPY ./docker-entrypoint.sh / RUN chmod +x /docker-entrypoint.sh ENTRYPOINT ["/docker-entrypoint.sh"] </code></pre> <p>docker-entrypoint.sh:</p> <pre><code>#!/bin/bash echo 'Hello World!' </code></pre> <h1>Works</h1> <pre><code>$ docker build -t gilani/trollo . &amp;&amp; docker run gilani/trollo Sending build context to Docker daemon 126 kB Step 1 : FROM vault:latest ---&gt; 1f127f53f8b5 Step 2 : MAINTAINER Amin Shah Gilani &lt;gilani@payload.tech&gt; ---&gt; Using cache ---&gt; 86b885ca1c81 Step 3 : COPY vaultConfig.json /vault/config ---&gt; Using cache ---&gt; 1a2be2fa3acd Step 4 : ENTRYPOINT echo 'hello world' ---&gt; Using cache ---&gt; ef5792a1f252 Successfully built ef5792a1f252 'hello world' </code></pre> <p>Dockerfile:</p> <pre><code>FROM vault:latest MAINTAINER Amin Shah Gilani &lt;gilani@payload.tech&gt; COPY vaultConfig.json /vault/config ENTRYPOINT ["echo", "'hello world'"] </code></pre>
0debug
How can i test in-app payments when Google Play App Signing feature is enabled? : <p>I want to test in-app payments and I have Google Play App Signing (GPAS) enabled.</p> <p>To test payments, I need an apk signed with real key (signing key in terms of GPAS).</p> <p>But I do not have private key for signing certificate. It was generated by Google and stored in Google Play.</p> <p>How can I avoid necessity to upload apk to Google Play each time I want to test in-app payments?</p> <p>How can I download signing private key somewhere?</p>
0debug
After added a simple fmt.Println in "for {select }" structure the cup usage is quite different , why? : Encounter a confused situation : let's say we have a "for { select }" function which is written in Golang. Here the code below: package main //import "fmt" func main(){ for{ select{ default: _=1 1. first situation // fmt.Sprint("aa") 2. second situation } } } while in the first situation the cup usage shows below: [![enter image description here][1]][1] in the second situation the cpu usage shows below: [![enter image description here][2]][2] I guess something happend in fmt.Println . May be related to the mechanism of Golang fmt realization ? Not quite sure how it happens by using all the cpus ? Thanks in advance ! [1]: https://i.stack.imgur.com/dw7jn.png [2]: https://i.stack.imgur.com/CB9CO.png
0debug
Why use IntrospectionFragmentMatcher? : <p>Is there any reason to use <code>IntrospectionFragmentMatcher</code> to determine concrete types of values returned from interface and union fields? </p> <p>I'm talking about <code>apollo-client</code>. I'm using <code>InMemoryCache</code> with <code>addTypename: true</code>, so the type is known the moment the client gets the response. </p> <p>Meanwhile my console is plagued with warnings like these: <a href="https://i.stack.imgur.com/GPrlY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GPrlY.png" alt="console warnings"></a></p> <p>The only reason I see the documentation hint at is response validation. But why validate the server-sent response at all? If the server is not worth trusting, validation is useless anyway.</p>
0debug
How to Limit the Results Which get From One to Many Relationship : /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.sanu.siri.entity; import javax.persistence.*; import java.sql.Blob; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * @author Sanu AK */ @Entity @Table(name = "Parts") public class Parts implements SuperEntity { @Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "map") @TableGenerator(name = "map", table = "Id_Gen", pkColumnName = "Tables_Names", valueColumnName = "Gen_keys", pkColumnValue = "PartsDTO", initialValue = 1, allocationSize = 1) private int id; private String partName; private String partNumber; private String barCode; private String brand; private String partType; private String country; private String vehicleModel; private String packSize; private String location; private String rackNo; private String roq; private String rql; @Column(name = "imageUrl1") private String imageUrl1; @Column(name = "imageUrl2") private String imageUrl2; @Column(name = "imageUrl3") private String imageUrl3; @Column(name = "imageUrl4") private String imageUrl4; private Blob image; private Blob image1; private Blob image2; private Blob image3; private String warranty; private Date adedDate; @Enumerated(value = EnumType.STRING) private Catogary catogary; @ManyToMany(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) @JoinTable(name = "Parts_FuelType", joinColumns = {@JoinColumn(name = "part_ID", referencedColumnName = "id")}, inverseJoinColumns = {@JoinColumn(name = "fuel_Type", referencedColumnName = "id")}) private List<FuelType> fuelTypes = new ArrayList<>(); @OneToMany(mappedBy = "parts", cascade = CascadeType.DETACH, fetch = FetchType.LAZY) private List<OrderDetails> orderDetail = new ArrayList<>(); @OneToMany(mappedBy = "parts", cascade = CascadeType.DETACH, fetch = FetchType.LAZY) @OrderBy("date DESC") private List<Bulk> bulks = new ArrayList<>(); public Parts() { } public Parts(String partName, String partNumber, String barCode, String brand, String partType, String country, String vehicleModel, String packSize, String location, String rackNo, String roq, String rql, Blob image, Blob image1, Blob image2, Blob image3, String warranty, Date adedDate, Catogary catogary, List<FuelType> fuelTypes, List<OrderDetails> orderDetail, List<Bulk> bulks) { this.partName = partName; this.partNumber = partNumber; this.barCode = barCode; this.brand = brand; this.partType = partType; this.country = country; this.vehicleModel = vehicleModel; this.packSize = packSize; this.location = location; this.rackNo = rackNo; this.roq = roq; this.rql = rql; this.image = image; this.image1 = image1; this.image2 = image2; this.image3 = image3; this.warranty = warranty; this.adedDate = adedDate; this.catogary = catogary; this.fuelTypes = fuelTypes; this.orderDetail = orderDetail; this.bulks = bulks; } public Parts(int id, String partName, String partNumber, String barCode, String brand, String partType, String country, String vehicleModel, String packSize, String location, String rackNo, String roq, String rql, String imageUrl1, String imageUrl2, String imageUrl3, String imageUrl4, Blob image, Blob image1, Blob image2, Blob image3, String warranty, Date adedDate, Catogary catogary, List<FuelType> fuelTypes, List<OrderDetails> orderDetail, List<Bulk> bulks) { this.setId(id); this.partName = partName; this.partNumber = partNumber; this.barCode = barCode; this.brand = brand; this.partType = partType; this.country = country; this.vehicleModel = vehicleModel; this.packSize = packSize; this.location = location; this.rackNo = rackNo; this.roq = roq; this.rql = rql; this.imageUrl1 = imageUrl1; this.imageUrl2 = imageUrl2; this.imageUrl3 = imageUrl3; this.imageUrl4 = imageUrl4; this.image = image; this.image1 = image1; this.image2 = image2; this.image3 = image3; this.warranty = warranty; this.adedDate = adedDate; this.catogary = catogary; this.fuelTypes = fuelTypes; this.orderDetail = orderDetail; this.bulks = bulks; } public String getImageUrl1() { return imageUrl1; } public void setImageUrl1(String imageUrl1) { this.imageUrl1 = imageUrl1; } public String getImageUrl2() { return imageUrl2; } public void setImageUrl2(String imageUrl2) { this.imageUrl2 = imageUrl2; } public String getImageUrl3() { return imageUrl3; } public void setImageUrl3(String imageUrl3) { this.imageUrl3 = imageUrl3; } public String getImageUrl4() { return imageUrl4; } public void setImageUrl4(String imageUrl4) { this.imageUrl4 = imageUrl4; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getPartName() { return partName; } public void setPartName(String partName) { this.partName = partName; } public String getPartNumber() { return partNumber; } public void setPartNumber(String partNumber) { this.partNumber = partNumber; } public String getBarCode() { return barCode; } public void setBarCode(String barCode) { this.barCode = barCode; } public String getBrand() { return brand; } public void setBrand(String brand) { this.brand = brand; } public String getPartType() { return partType; } public void setPartType(String partType) { this.partType = partType; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getVehicleModel() { return vehicleModel; } public void setVehicleModel(String vehicleModel) { this.vehicleModel = vehicleModel; } public String getPackSize() { return packSize; } public void setPackSize(String packSize) { this.packSize = packSize; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public String getRackNo() { return rackNo; } public void setRackNo(String rackNo) { this.rackNo = rackNo; } public String getRoq() { return roq; } public void setRoq(String roq) { this.roq = roq; } public String getRql() { return rql; } public void setRql(String rql) { this.rql = rql; } public Blob getImage() { return image; } public void setImage(Blob image) { this.image = image; } public Blob getImage1() { return image1; } public void setImage1(Blob image1) { this.image1 = image1; } public Blob getImage2() { return image2; } public void setImage2(Blob image2) { this.image2 = image2; } public Blob getImage3() { return image3; } public void setImage3(Blob image3) { this.image3 = image3; } public String getWarranty() { return warranty; } public void setWarranty(String warranty) { this.warranty = warranty; } public Date getAdedDate() { return adedDate; } public void setAdedDate(Date adedDate) { this.adedDate = adedDate; } public Catogary getCatogary() { return catogary; } public void setCatogary(Catogary catogary) { this.catogary = catogary; } public List<FuelType> getFuelTypes() { return fuelTypes; } public void setFuelTypes(List<FuelType> fuelTypes) { this.fuelTypes = fuelTypes; } public List<OrderDetails> getOrderDetail() { return orderDetail; } public void setOrderDetail(List<OrderDetails> orderDetail) { this.orderDetail = orderDetail; } public List<Bulk> getBulks() { return bulks; } public void setBulks(List<Bulk> bulks) { this.bulks = bulks; } @Override public String toString() { return "Parts{" + "id=" + id + ", partName='" + partName + '\'' + ", partNumber='" + partNumber + '\'' + ", barCode='" + barCode + '\'' + ", brand='" + brand + '\'' + ", partType='" + partType + '\'' + ", country='" + country + '\'' + ", vehicleModel='" + vehicleModel + '\'' + ", packSize='" + packSize + '\'' + ", location='" + location + '\'' + ", rackNo='" + rackNo + '\'' + ", roq='" + roq + '\'' + ", rql='" + rql + '\'' + ", image=" + image + ", image1=" + image1 + ", image2=" + image2 + ", image3=" + image3 + ", warranty='" + warranty + '\'' + ", adedDate=" + adedDate + ", catogary=" + catogary + ", fuelTypes=" + fuelTypes + ", orderDetail=" + orderDetail + ", bulks=" + bulks + '}'; } } > I have a problem about this row > is there any way to limit those BulkList when we call this BulkList from > Part. @OrderBy("date DESC") private List<Bulk> bulks = new ArrayList<>(); > I mean like this **This is My Repo** public interface PartsRepo extends CrudRepository<Parts, Integer> { Parts findPartsByBarCode(String barCode) throws Exception; List<Parts> findPartsByPartNameContaining(String partName) throws Exception; List<Parts> findPartsByPartNumberContaining(String partNumber) throws Exception; Parts findPartsByPartNumber(String partNumber) throws Exception; } **This is my Controller** @GetMapping(value = "/search") public void searchParts(HttpServletRequest req) { try { return Parts p=partsService.searchParts(Integer.parseInt(req.getParameter("id"))); List<Bulk> bulkList=p.getBulks(); } catch (Exception e) { e.printStackTrace(); return null; } } > i want to limit the bulkList results from the entity.. is there any way to do that..? List<Bulk> bulkList=p.getBulks(); > limit above list from the @OrderBy("date DESC") private List<Bulk> bulks = new ArrayList<>(); review I have a problem about this row is there any way to limit those BulkList when we call this BulkList from Part. i want to limit the bulkList results from the entity.. is there any way to do that..?
0debug
webpack-cli@3.0.8 requires a peer of webpack@^4.x.x but none is installed : <p>Having a little trouble with React. Does anyone know how I can install the peer of webpack@^4.x.x? </p> <p>This is the error I am recieving when I try to run </p> <pre><code>webpack-dev-server </code></pre> <p>in cmd. It just returns </p> <pre><code>webpack-cli@3.0.8 requires a peer of webpack@^4.x.x but none is installed. You must install peer dependencies yourself. </code></pre>
0debug
static void lsp2polyf(const double *lsp, double *f, int lp_half_order) { int i, j; f[0] = 1.0; f[1] = -2 * lsp[0]; lsp -= 2; for(i=2; i<=lp_half_order; i++) { double val = -2 * lsp[2*i]; f[i] = val * f[i-1] + 2*f[i-2]; for(j=i-1; j>1; j--) f[j] += f[j-1] * val + f[j-2]; f[1] += val; } }
1threat
How can I alert for container restarted? : <p>I like to monitor the containers using Prometheus and cAdvisor so that when a container restart, I get an alert. I wonder if anyone have sample Prometheus alert for this.</p>
0debug
Warning: Native component for "BVLinearGradient" does not exist : <p>I'm trying to implement <a href="https://github.com/react-native-community/react-native-linear-gradient" rel="noreferrer">react-native-linear-gradient</a> but I get the following error once I import the library into my react-native component:</p> <pre><code>import LinearGradient from 'react-native-linear-gradient' </code></pre> <p><a href="https://i.stack.imgur.com/EaqTQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EaqTQ.png" alt="enter image description here"></a></p> <p>I can successfully compile the project in XCode and the gradient shows up on the physical iPhone but it doesn't in the Simulator.</p> <p>Has anyone dealt with this problem before? </p> <p>Again, the problem is that react-native (iOS Simulator) can't find the library but the BVLinearGradient library are there in Xcode and the project compiles successfully.</p> <p><a href="https://i.stack.imgur.com/wSNvL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wSNvL.png" alt="enter image description here"></a></p> <p>Thanks</p>
0debug
Jquery if output is over 60 output "you won!" else "too bad you lost" : <p>So I've got this script that outputs a random number between 0 and 100 every time you click on the button </p> <pre><code> $(document).ready(function(){ for ( i = 0; i &lt; 1; i++ ) { $('#btn').on('click', function(){ var randNum = 0; var randNum = Math.floor(Math.random() * 100); $(".result").html(" "+randNum); }); }; }); </code></pre> <p>Now do I want to have the outcome to have something like "you won" when a score of 60 or higher has been obtained otherwise "you lose". I appreciate any help!</p>
0debug
What is the right way to wrire javascricp in wordpress : I found javascript I like to use in my wordpress website but it's doesn't work... Here is the link to the script: http://jsfiddle.net/j08691/fs6Mb Here is how I tried to write it: <!-- begin snippet: js hide: false --> <!-- language: lang-html --> <head> <style> p span {color:blue;} </style> </head> <body> <p>sony sensor 2.1mp</p> <script> $('p').html(function(index, value) { return value.replace(/(\d+)/g, '<span>$1</span>'); }); </script> </body> <!-- end snippet --> What do I need to change in the script to make it work? My actual goal is to make the numbers bigger without writing <span> in the text so any other ideas will be welcome...
0debug
How to match single Image with multiple images using MATLAB? : <p>For example I have a 100 images in my directory of which 'x' images are same and I would like to know the value of x. </p>
0debug